Commit 3634308b authored by Nsukami Patrick's avatar Nsukami Patrick
Browse files

[mypy] Fix errors: 'Unexpected keyword argument' & 'Too few arguments'

- Error: "Unexpected keyword argument" [call-arg]
- Error: "Too few arguments" [call-arg]

- Fix: Call deprecation.callable_renamed instead of deprecation.renamed
parent 868c2189e377
Pipeline #99732 passed with stages
in 1 minute and 40 seconds
......@@ -88,7 +88,7 @@ def _RELATION_DEFINITION_PROPERTIES() -> Tuple[str, ...]:
return tuple(base)
_RDEF_PROPERTIES = deprecation.renamed(
_RDEF_PROPERTIES = deprecation.callable_renamed(
old_name="_RDEF_PROPERTIES", new_function=_RELATION_DEFINITION_PROPERTIES
)
......@@ -101,7 +101,9 @@ def _RELATION_PROPERTIES() -> Tuple[str, ...]:
return RTYPE_PROPERTIES + _RELATION_DEFINITION_PROPERTIES()
_REL_PROPERTIES = deprecation.renamed(old_name="_REL_PROPERTIES", new_function=_RELATION_PROPERTIES)
_REL_PROPERTIES = deprecation.callable_renamed(
old_name="_REL_PROPERTIES", new_function=_RELATION_PROPERTIES
)
# pre 0.37 backward compat
......
......@@ -243,7 +243,9 @@ class SchemaLoader:
with tempattr(buildobjs, "PACKAGE", package):
self.handle_file(file_path, module_name=module_name)
_load_modnames = deprecation.renamed(old_name="_load_modnames", new_function=_load_module_names)
_load_modnames = deprecation.callable_renamed(
old_name="_load_modnames", new_function=_load_module_names
)
# has to be overridable sometimes (usually for test purpose)
main_schema_directory: str = "schema"
......
......@@ -422,7 +422,7 @@ class EntitySchema(PermissionMixIn, ERSchema):
return relation_schema.role_relation_definition(self.type, target_type, role)
rdef = deprecation.renamed(old_name="rdef", new_function=relation_definition)
rdef = deprecation.callable_renamed(old_name="rdef", new_function=relation_definition)
@cached
def ordered_relations(self) -> List["RelationSchema"]:
......@@ -1172,7 +1172,9 @@ class RelationSchema(ERSchema):
else:
relation_definition.object.add_object_relation(self)
_add_rdef = deprecation.renamed(old_name="_add_rdef", new_function=_add_relation_definition)
_add_rdef = deprecation.callable_renamed(
old_name="_add_rdef", new_function=_add_relation_definition
)
@deprecation.argument_renamed(old_name="subjectschema", new_name="subject_schema")
@deprecation.argument_renamed(old_name="objectschema", new_name="object_schema")
......@@ -1339,7 +1341,7 @@ class RelationSchema(ERSchema):
else:
raise KeyError(f"{subject} {self} {object}")
rdef = deprecation.renamed(old_name="rdef", new_function=relation_definition)
rdef = deprecation.callable_renamed(old_name="rdef", new_function=relation_definition)
@deprecation.argument_renamed(old_name="etype", new_name="entity_type")
@deprecation.argument_renamed(old_name="ttype", new_name="target_type")
......@@ -1354,7 +1356,9 @@ class RelationSchema(ERSchema):
return self.relation_definitions[(target_type, entity_type)]
role_rdef = deprecation.renamed(old_name="role_rdef", new_function=role_relation_definition)
role_rdef = deprecation.callable_renamed(
old_name="role_rdef", new_function=role_relation_definition
)
def check_permission_definitions(self) -> None:
"""check permissions are correctly defined"""
......@@ -1688,7 +1692,7 @@ class Schema:
"""
return self._entities[entity_type]
eschema = deprecation.renamed("eschema", entity_schema_for)
eschema = deprecation.callable_renamed("eschema", entity_schema_for)
def relations(self) -> List["RelationSchema"]:
"""return the list of possible relation'types
......@@ -1722,7 +1726,7 @@ class Schema:
else:
raise KeyError(f"No relation named {relation_type} in schema")
rschema = deprecation.renamed("rschema", relation_schema_for)
rschema = deprecation.callable_renamed("rschema", relation_schema_for)
def finalize(self) -> None:
"""Finalize schema
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment