Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Reduce 'six' usage #777

Merged
merged 8 commits into from
Jul 15, 2024
Merged

Chore: Reduce 'six' usage #777

merged 8 commits into from
Jul 15, 2024

Conversation

iLLiCiTiT
Copy link
Member

Changelog Description

As we moved from Python 2 we don't need to use six module anymore.

Additional info

Code where six module was used for Py2 and Py3 compatibility is not used anymore. There are still places where six is used but those are not as simple changes as these.

Replaced six.string_types with str. Instead of using six.add_metaclass is used ABC base class to define metaclass, or creation of class defines metaclass=... in creation. Replaced six.reraise with simple raise of exception, and some special cases are using different traceback.

Testing notes:

  1. Go through code and validate the changes.

@ynbot ynbot added size/S type: enhancement Improvement of existing functionality or minor addition labels Jul 15, 2024
@BigRoy
Copy link
Collaborator

BigRoy commented Jul 15, 2024

Somehow getting this when launching applications:

image

*** WRN: >>> { app_maya/2024 }: [  ERROR in anatomy.format: argument of type 'type' is not iterable  ]
==============================
ERROR in anatomy.format: argument of type 'type' is not iterable
==============================
Traceback (most recent call last):
  File "E:\dev\ayon-applications\client\ayon_applications\utils.py", line 480, in prepare_context_environments
    workdir = get_workdir_with_workdir_data(
  File "E:\dev\ayon-core\client\ayon_core\pipeline\workfile\path_resolving.py", line 142, in get_workdir_with_workdir_data
    output = template_obj.format_strict(workdir_data)
  File "E:\dev\ayon-core\client\ayon_core\lib\path_templates.py", line 139, in format_strict
    result = self.format(*args, **kwargs)
  File "E:\dev\ayon-core\client\ayon_core\pipeline\anatomy\templates.py", line 96, in format
    result = StringTemplate.format(self, data)
  File "E:\dev\ayon-core\client\ayon_core\lib\path_templates.py", line 117, in format
    part.format(data, result)
  File "E:\dev\ayon-core\client\ayon_core\lib\path_templates.py", line 520, in format
    if self.validate_value_type(value):
  File "E:\dev\ayon-core\client\ayon_core\lib\path_templates.py", line 458, in validate_value_type
    if inh_class in str:
TypeERROR: argument of type 'type' is not iterable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\dev\ayon-applications\client\ayon_applications\action.py", line 126, in process
    self.application.launch(
  File "E:\dev\ayon-applications\client\ayon_applications\defs.py", line 298, in launch
    return self.manager.launch(self.full_name, *args, **kwargs)
  File "E:\dev\ayon-applications\client\ayon_applications\manager.py", line 173, in launch
    return self.launch_with_context(context)
  File "E:\dev\ayon-applications\client\ayon_applications\manager.py", line 149, in launch_with_context
    return launch_context.launch()
  File "E:\dev\ayon-applications\client\ayon_applications\manager.py", line 597, in launch
    self.run_prelaunch_hooks()
  File "E:\dev\ayon-applications\client\ayon_applications\manager.py", line 581, in run_prelaunch_hooks
    prelaunch_hook.execute()
  File "E:\dev\ayon-core\client\ayon_core\hooks\pre_global_host_data.py", line 46, in execute
    prepare_context_environments(temp_data)
  File "E:\dev\ayon-applications\client\ayon_applications\utils.py", line 488, in prepare_context_environments
    raise ApplicationLaunchFAILED(
ayon_applications.exceptions.ApplicationLaunchFAILED: ERROR in anatomy.format: argument of type 'type' is not iterable

@BigRoy
Copy link
Collaborator

BigRoy commented Jul 15, 2024

Next error:
image

*** WRN: >>> { app_fusion/18 }: [  ERROR in anatomy.format: Anatomy template "{root[work]}/{project[name]}/{hierarchy}/{folder[name]}/work/{task[name]}" is unsolved. Keys with invalid DataType: `"project" {'name': <class 'str'>}, "hierarchy" <class 'str'>, "folder" {'name': <class 'str'>}, "task" {'name': <class 'str'>}`.  ]
==============================
ERROR in anatomy.format: Anatomy template "{root[ work]}/{project[name]}/{hierarchy}/{folder[name]}/work/{task[name ]}" is unsolved. Keys with invalid DataType: `"project" {'name': <class 'str'>}, "hierarchy" <class 'str'>, "folder" {'name': <class 'str'>}, "task" {'name': <class 'str'>}`.
==============================
Traceback (most recent call last):
  File "E:\dev\ayon-applications\client\ayon_applications\utils.py", line 480, in prepare_context_environments
    workdir = get_workdir_with_workdir_data(
  File "E:\dev\ayon-core\client\ayon_core\pipeline\workfile\path_resolving.py", line 142, in get_workdir_with_workdir_data
    output = template_obj.format_strict(workdir_data)
  File "E:\dev\ayon-core\client\ayon_core\lib\path_templates.py", line 140, in format_strict
    result.validate()
  File "E:\dev\ayon-core\client\ayon_core\pipeline\anatomy\templates.py", line 39, in validate
    raise AnatomyTemplateUnsolved(
ayon_core.pipeline.anatomy.exceptions.AnatomyTemplateUnsolved: Anatomy template "{root[ work]}/{project[name]}/{hierarchy}/{folder[name]}/work/{task[name ]}" is unsolved. Keys with invalid DataType: `"project" {'name': <class 'str'>}, "hierarchy" <class 'str'>, "folder" {'name': <class 'str'>}, "task" {'name': <class 'str'>}`.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\dev\ayon-applications\client\ayon_applications\action.py", line 126, in process
    self.application.launch(
  File "E:\dev\ayon-applications\client\ayon_applications\defs.py", line 298, in launch
    return self.manager.launch(self.full_name, *args, **kwargs)
  File "E:\dev\ayon-applications\client\ayon_applications\manager.py", line 173, in launch
    return self.launch_with_context(context)
  File "E:\dev\ayon-applications\client\ayon_applications\manager.py", line 149, in launch_with_context
    return launch_context.launch()
  File "E:\dev\ayon-applications\client\ayon_applications\manager.py", line 597, in launch
    self.run_prelaunch_hooks()
  File "E:\dev\ayon-applications\client\ayon_applications\manager.py", line 581, in run_prelaunch_hooks
    prelaunch_hook.execute()
  File "E:\dev\ayon-core\client\ayon_core\hooks\pre_global_host_data.py", line 46, in execute
    prepare_context_environments(temp_data)
  File "E:\dev\ayon-applications\client\ayon_applications\utils.py", line 488, in prepare_context_environments
    raise ApplicationLaunchFAILED(
ayon_applications.exceptions.ApplicationLaunchFAILED: ERROR in anatomy.format: Anatomy template "{root[ work]}/{project[name]}/{hierarchy}/{folder[name]}/work/{task[name ]}" is unsolved. Keys with invalid DataType: `"project" {'name': <class 'str'>}, "hierarchy" <class 'str'>, "folder" {'name': <class 'str'>}, "task" {'name': <class 'str'>}`.

@iLLiCiTiT
Copy link
Member Author

...I should maybe enable path to ayon-core in dev bundle.

Copy link
Collaborator

@BigRoy BigRoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if there's anything else to test.

  • Launching applications works (Maya, Fusion, Houdini, Standalone Loader, Standalone Publisher)
  • Updating containers works
  • Loader works Fusion, Maya, Houdini
  • Publishing works standalone publisher, Fusion, Maya

@iLLiCiTiT iLLiCiTiT merged commit 4b68ea4 into develop Jul 15, 2024
15 checks passed
@iLLiCiTiT iLLiCiTiT deleted the enhancement/reduce-six-usage branch July 15, 2024 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/S type: enhancement Improvement of existing functionality or minor addition
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants