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

Cannot create a consistent method resolution order (MRO) for bases Generic, immutabledict #228

Closed
sambk17 opened this issue Aug 29, 2023 · 0 comments · Fixed by #227
Closed
Labels
bug Something isn't working

Comments

@sambk17
Copy link

sambk17 commented Aug 29, 2023

Description

Issue:

  • After generating the files and python -m pip install . from the repository, I am unable to import {package}
TypeError: Cannot create a consistent method resolution
order (MRO) for bases Generic, immutabledict
  • This was tested using Python 3.9 (3.9.12)
openapi-generator version

3.0.0

Steps to reproduce
import {package_name}

Output:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In [1], line 1
----> 1 import mlp

File ~/miniconda3/lib/python3.9/site-packages/mlp/__init__.py:16
     13 __version__ = "0.0.10"
     15 # import ApiClient
---> 16 from mlp.api_client import ApiClient
     18 # import Configuration
     19 from mlp.configurations.api_configuration import ApiConfiguration

File ~/miniconda3/lib/python3.9/site-packages/mlp/api_client.py:31
     27 import urllib3
     28 from urllib3 import _collections, fields
---> 31 from mlp import exceptions, rest, schemas, security_schemes, api_response
     32 from mlp.configurations import api_configuration, schema_configuration as schema_configuration_
     35 class JSONEncoder(json.JSONEncoder):

File ~/miniconda3/lib/python3.9/site-packages/mlp/exceptions.py:14
     11 import dataclasses
     12 import typing
---> 14 from mlp import api_response
     17 class OpenApiException(Exception):
     18     """The base exception class for all OpenAPIExceptions"""

File ~/miniconda3/lib/python3.9/site-packages/mlp/api_response.py:15
     11 import typing
     13 import urllib3
---> 15 from mlp import schemas
     18 @dataclasses.dataclass
     19 class ApiResponse:
     20     response: urllib3.HTTPResponse

File ~/miniconda3/lib/python3.9/site-packages/mlp/schemas/__init__.py:15
     11 import typing
     13 import typing_extensions
---> 15 from .schema import (
     16     get_class,
     17     none_type_,
     18     classproperty,
     19     Bool,
     20     FileIO,
     21     Schema,
     22     SingletonMeta,
     23     AnyTypeSchema,
     24     UnsetAnyTypeSchema,
     25     INPUT_TYPES_ALL
     26 )
     28 from .schemas import (
     29     ListSchema,
     30     NoneSchema,
   (...)
     48     DictSchema
     49 )
     50 from .validation import (
     51     PatternInfo,
     52     ValidationMetadata,
     53     immutabledict
     54 )

File ~/miniconda3/lib/python3.9/site-packages/mlp/schemas/schema.py:15
     12 from mlp import exceptions
     13 from mlp.configurations import schema_configuration
---> 15 from . import validation
     17 _T_co = typing.TypeVar("_T_co", covariant=True)
     20 class SequenceNotStr(typing.Protocol[_T_co]):

File ~/miniconda3/lib/python3.9/site-packages/mlp/schemas/validation.py:32
     28 _K = typing.TypeVar('_K')
     29 _V = typing.TypeVar('_V', covariant=True)
---> 32 class immutabledict(typing.Generic[_K, _V], original_immutabledict.immutabledict[_K, _V]):
     33     # this class layer needed to not show init signature when making new instances
     34     pass
     37 @dataclasses.dataclass
     38 class ValidationMetadata:

File ~/miniconda3/lib/python3.9/abc.py:106, in ABCMeta.__new__(mcls, name, bases, namespace, **kwargs)
    105 def __new__(mcls, name, bases, namespace, **kwargs):
--> 106     cls = super().__new__(mcls, name, bases, namespace, **kwargs)
    107     _abc_init(cls)
    108     return cls

TypeError: Cannot create a consistent method resolution
order (MRO) for bases Generic, immutabledict
Related issues/PRs

#225

Suggest a fix/enhancement

Replace the following in src/{pathway}/schemas/validation.py:

# class immutabledict(typing.Generic[_K, _V], original_immutabledict.immutabledict[_K, _V]):
#     # this class layer needed to not show init signature when making new instances
#     pass

immutabledict = original_immutabledict.immutabledict
@spacether spacether linked a pull request Aug 29, 2023 that will close this issue
3 tasks
@spacether spacether added the bug Something isn't working label Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants