Browse Source

Fix pipenv dev dependencies and address pylint complaints

merge-requests/1/head
Drew Short 7 years ago
parent
commit
b483ec3d54
  1. 22
      server/Pipfile
  2. 2
      server/Pipfile.lock
  3. 15
      server/atheneum/service/patch_service.py
  4. 7
      server/atheneum/service/validation_service.py

22
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"

2
server/Pipfile.lock

@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "b0d90486a769e10025b310d91ee6e7023af9c9e303fce92df9a3541004e3256c"
"sha256": "3ce19ff3ec099304cd32e4cb6868cbc317ec05da27c6020ebc5f35262f2d9613"
},
"pipfile-spec": 6,
"requires": {

15
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__
))

7
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

Loading…
Cancel
Save