Skip to content

Commit

Permalink
[REF] spec_driven_model: pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rvalyi committed Oct 18, 2024
1 parent 2ee2b3b commit b721e21
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion spec_driven_model/models/spec_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _register_hook(self):
if not hasattr(self, "_spec_module"):
return res

load_key = "_%s_loaded" % (self._spec_module,)
load_key = f"_{self._spec_module}_loaded"
if hasattr(self.env.registry, load_key): # already done for registry
return res
setattr(self.env.registry, load_key, True)
Expand Down
8 changes: 4 additions & 4 deletions spec_driven_model/models/spec_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def _setup_fields(self):
def _map_concrete(cls, dbname, key, target, quiet=False):
# TODO bookkeep according to a key to allow multiple injection contexts
if not quiet:
_logger.debug("%s ---> %s" % (key, target))
_logger.debug(f"{key} ---> {target}")
global SPEC_MIXIN_MAPPINGS
SPEC_MIXIN_MAPPINGS[dbname][key] = target

Expand All @@ -188,7 +188,7 @@ def spec_module_classes(cls, spec_module):
Cache the list of spec_module classes to save calls to
slow reflection API.
"""
spec_module_attr = "_spec_cache_%s" % (spec_module.replace(".", "_"),)
spec_module_attr = f"_spec_cache_{spec_module.replace('.', '_')}"
if not hasattr(cls, spec_module_attr):
setattr(
cls, spec_module_attr, getmembers(sys.modules[spec_module], isclass)
Expand Down Expand Up @@ -239,7 +239,7 @@ class StackedModel(SpecModel):
def _build_model(cls, pool, cr):
# inject all stacked m2o as inherited classes
if cls._stacked:
_logger.info("building StackedModel %s %s" % (cls._name, cls))
_logger.info(f"building StackedModel {cls._name} {cls}")
node = cls._odoo_name_to_class(cls._stacked, cls._spec_module)
env = api.Environment(cr, SUPERUSER_ID, {})
for kind, klass, _path, _field_path, _child_concrete in cls._visit_stack(
Expand Down Expand Up @@ -318,7 +318,7 @@ def _visit_stack(cls, env, node, path=None):
):
# then we will STACK the child in the current class
child._stack_path = path
child_path = "%s.%s" % (path, field_path)
child_path = f"{path}.{field-path}"
cls._stacking_points[name] = env[node._name]._fields.get(name)
yield from cls._visit_stack(env, child, child_path)
else:
Expand Down

0 comments on commit b721e21

Please sign in to comment.