diff --git a/server/Pipfile b/server/Pipfile index 0b45044..a5d9df6 100644 --- a/server/Pipfile +++ b/server/Pipfile @@ -8,19 +8,19 @@ flask = ">=1.0,<1.1" flask-sqlalchemy = ">=2.3,<2.4" flask-migrate = ">=2.1,<2.2" pynacl = ">=1.2,<1.3" -click = "*" -"rfc3339" = "*" -"iso8601" = "*" +click = ">=6.7,<6.8" +rfc3339 = ">=6.0,<6.1" +iso8601 = ">=0.1,<0.2" [dev-packages] -python-dotenv = "*" -pytest = "*" -coverage = "*" -pycodestyle = "*" -mypy = "*" -mock = "*" -pylint = "*" -pydocstyle = "*" +python-dotenv = ">=0.8,<0.9" +pytest = ">=3.6<3.7" +coverage = ">=4.5,<4.6" +pycodestyle = ">=2.4,<2.5" +mypy = ">=0.620,<1.0" +mock = ">=2.0,<2.1" +pylint = ">=2.0,<2.1" +pydocstyle = ">=2.1,<2.2" [requires] python_version = "3.6" diff --git a/server/Pipfile.lock b/server/Pipfile.lock index b322b98..55d3b62 100644 --- a/server/Pipfile.lock +++ b/server/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "b0d90486a769e10025b310d91ee6e7023af9c9e303fce92df9a3541004e3256c" + "sha256": "3ce19ff3ec099304cd32e4cb6868cbc317ec05da27c6020ebc5f35262f2d9613" }, "pipfile-spec": 6, "requires": { diff --git a/server/atheneum/service/patch_service.py b/server/atheneum/service/patch_service.py index d30b579..1a42cff 100644 --- a/server/atheneum/service/patch_service.py +++ b/server/atheneum/service/patch_service.py @@ -9,9 +9,9 @@ from atheneum.service import validation_service def get_patch_fields(patch_json: Dict[str, Any]) -> Set[str]: """Convert json fields to python fields.""" - return set([ + return { transformation_service.convert_key_from_json(key) for key in - patch_json.keys()]) + patch_json.keys()} def perform_patch(request_user: User, @@ -108,9 +108,8 @@ def patch( patch_model, model_attributes, patched_fields) - else: - raise ValueError( - 'Model types "{}" and "{}" do not match'.format( - original_model.__class__.__name__, - patch_model.__class__.__name__ - )) + raise ValueError( + 'Model types "{}" and "{}" do not match'.format( + original_model.__class__.__name__, + patch_model.__class__.__name__ + )) diff --git a/server/atheneum/service/validation_service.py b/server/atheneum/service/validation_service.py index 0583b5f..2c0bfdd 100644 --- a/server/atheneum/service/validation_service.py +++ b/server/atheneum/service/validation_service.py @@ -23,10 +23,9 @@ def get_changable_attribute_names(model: Type[db.Model]) -> Set[str]: if class_name in _changable_attribute_names: return _changable_attribute_names[class_name] - model_attributes = set([prop.key for prop in - orm.class_mapper( - model.__class__).iterate_properties - if isinstance(prop, orm.ColumnProperty)]) + model_attributes = {prop.key for prop in + orm.class_mapper(model.__class__).iterate_properties + if isinstance(prop, orm.ColumnProperty)} _changable_attribute_names[class_name] = model_attributes return model_attributes