Skip to content

Commit

Permalink
clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
xnuinside committed Aug 14, 2021
1 parent 02b061a commit ab0d5e1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
2 changes: 0 additions & 2 deletions omymodels/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ def prepare_columns_data(columns: List[Dict]) -> List[Dict]:
if column["type"] is None:
if column["default"]:
column["type"] = type(column["default"]).__name__
print(column["type"])
return columns


def models_to_meta(data: List[Dict]) -> List[TableMeta]:
tables = []
types = []
for model in data:
print(model["parents"])
if "Enum" not in model["parents"]:
model["table_name"] = model["name"]
model["columns"] = prepare_columns_data(model["attrs"])
Expand Down
3 changes: 0 additions & 3 deletions omymodels/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,9 @@ def prepare_column_type_orm(obj: object, column_data: Dict) -> str:
if "[" in column_data.type and column_data.type not in json_types:
obj.postgresql_dialect_cols.add("ARRAY")
column_type = f"ARRAY({column_type})"
print(column_type)
return column_type


from typing import Dict

string_types = (
"str",
"Text",
Expand Down
4 changes: 2 additions & 2 deletions tests/converter/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


def test_convert_models():

models_from = """
class MaterialType(str, Enum):
Expand Down Expand Up @@ -45,4 +45,4 @@ class Material(db.Model):
created_at = db.Column(db.DateTime())
updated_at = db.Column(db.DateTime())
"""
assert result == expected
assert result == expected

0 comments on commit ab0d5e1

Please sign in to comment.