A system for Python that generates static type annotations by collecting runtime types

Overview

MonkeyType

MonkeyType collects runtime types of function arguments and return values, and can automatically generate stub files or even add draft type annotations directly to your Python code based on the types collected at runtime.

Example

Say some/module.py originally contains:

def add(a, b):
    return a + b

And myscript.py contains:

from some.module import add

add(1, 2)

Now we want to infer the type annotation of add in some/module.py by running myscript.py with MonkeyType. One way is to run:

$ monkeytype run myscript.py

By default, this will dump call traces into a SQLite database in the file monkeytype.sqlite3 in the current working directory. You can then use the monkeytype command to generate a stub file for a module, or apply the type annotations directly to your code.

Running monkeytype stub some.module will output a stub:

def add(a: int, b: int) -> int: ...

Running monkeytype apply some.module will modify some/module.py to:

def add(a: int, b: int) -> int:
    return a + b

This example demonstrates both the value and the limitations of MonkeyType. With MonkeyType, it's very easy to add annotations that reflect the concrete types you use at runtime, but those annotations may not always match the full intended capability of the functions. For instance, add is capable of handling many more types than just integers. Similarly, MonkeyType may generate a concrete List annotation where an abstract Sequence or Iterable would be more appropriate. MonkeyType's annotations are an informative first draft, to be checked and corrected by a developer.

Motivation

Readability and static analysis are the primary motivations for adding type annotations to code. It's already common in many Python style guides to document the argument and return types for a function in its docstring; annotations are a standardized way to provide this documentation, which also permits static analysis by a typechecker such as mypy.

For more on the motivation and design of Python type annotations, see PEP 483 and PEP 484.

Requirements

MonkeyType requires Python 3.6+ and the libcst library (for applying type stubs to code files). It generates only Python 3 type annotations (no type comments).

Installing

Install MonkeyType with pip:

pip install MonkeyType

How MonkeyType works

MonkeyType uses the sys.setprofile hook provided by Python to interpose on function calls, function returns, and generator yields, and record the types of arguments / return values / yield values.

It generates stub files based on that data, and can use libcst to apply those stub files directly to your code.

See the full documentation for details.

Troubleshooting

Check if your issue is mentioned in the frequently asked questions list.

Development

See CONTRIBUTING.rst for information on developing and contributing to MonkeyType.

LICENSE

MonkeyType is BSD licensed.

Comments
  • Python 3.9 AttributeError: __args__

    Python 3.9 AttributeError: __args__

    I honestly cannot parse this error message.

    I'm trying to run monkeytype on manim's mobject.py

    monkeytype stub manim.mobject.mobject
    
    Traceback (most recent call last):
      File "C:\Python39\lib\runpy.py", line 197, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "C:\Python39\lib\runpy.py", line 87, in _run_code
        exec(code, run_globals)
      File "C:\Users\ethan\AppData\Local\pypoetry\Cache\virtualenvs\manim-ob3XvX2_-py3.9\Scripts\monkeytype.exe\__main__.py", line 7, in <module>
      File "c:\users\ethan\appdata\local\pypoetry\cache\virtualenvs\manim-ob3xvx2_-py3.9\lib\site-packages\monkeytype\cli.py", line 396, in entry_point_main
        sys.exit(main(sys.argv[1:], sys.stdout, sys.stderr))
      File "c:\users\ethan\appdata\local\pypoetry\cache\virtualenvs\manim-ob3xvx2_-py3.9\lib\site-packages\monkeytype\cli.py", line 381, in main
        handler(args, stdout, stderr)
      File "c:\users\ethan\appdata\local\pypoetry\cache\virtualenvs\manim-ob3xvx2_-py3.9\lib\site-packages\monkeytype\cli.py", line 199, in print_stub_handler
        stub = get_stub(args, stdout, stderr)
      File "c:\users\ethan\appdata\local\pypoetry\cache\virtualenvs\manim-ob3xvx2_-py3.9\lib\site-packages\monkeytype\cli.py", line 126, in get_stub
        stubs = build_module_stubs_from_traces(
      File "c:\users\ethan\appdata\local\pypoetry\cache\virtualenvs\manim-ob3xvx2_-py3.9\lib\site-packages\monkeytype\stubs.py", line 819, in build_module_stubs_from_traces
        return build_module_stubs(defns)
      File "c:\users\ethan\appdata\local\pypoetry\cache\virtualenvs\manim-ob3xvx2_-py3.9\lib\site-packages\monkeytype\stubs.py", line 784, in build_module_stubs
        imports = get_imports_for_signature(entry.signature)
      File "c:\users\ethan\appdata\local\pypoetry\cache\virtualenvs\manim-ob3xvx2_-py3.9\lib\site-packages\monkeytype\stubs.py", line 157, in get_imports_for_signature
        param_imports = get_imports_for_annotation(param.annotation)
      File "c:\users\ethan\appdata\local\pypoetry\cache\virtualenvs\manim-ob3xvx2_-py3.9\lib\site-packages\monkeytype\stubs.py", line 143, in get_imports_for_annotation
        elem_types = anno.__args__ or []
      File "C:\Python39\lib\typing.py", line 694, in __getattr__
        raise AttributeError(attr)
    AttributeError: __args__
    
    opened by GameDungeon 28
  • TypeVar instances also lack `__qualname__`

    TypeVar instances also lack `__qualname__`

    Sharing a quick fix I needed to get to work on some of the projects I quickly gave this a shot on. It choked on trying to serialize TypeVar instances as it seems like it also lacks __qualname__.

    CLA Signed 
    opened by vodik 18
  • Getting '_SpecialForm' object has no attribute '__name__'

    Getting '_SpecialForm' object has no attribute '__name__'

    I'm getting this error running monkeytype 21.5 on python 3.8:

    monkeytype run -m pytest tests
    Failed collecting trace
    Traceback (most recent call last):
      File "path\to\env\lib\site-packages\monkeytype\tracing.py", line 259, in __call__
        self.handle_call(frame)
      File "path\to\env\lib\site-packages\monkeytype\tracing.py", line 225, in handle_call
        arg_types[name] = get_type(frame.f_locals[name],
      File "path\to\env\lib\site-packages\monkeytype\typing.py", line 190, in get_type
        return get_dict_type(obj, max_typed_dict_size)
      File "path\to\env\lib\site-packages\monkeytype\typing.py", line 170, in get_dict_type
        val_type = shrink_types((get_type(v, max_typed_dict_size) for v in dct.values()), max_typed_dict_size)
      File "path\to\env\lib\site-packages\monkeytype\typing.py", line 133, in shrink_types
        annotation = shrink_types((getattr(typ, '__args__')[0] for typ in types), max_typed_dict_size)
      File "path\to\env\lib\site-packages\monkeytype\typing.py", line 132, in shrink_types
        if all(is_list(typ) for typ in types):
      File "path\to\env\lib\site-packages\monkeytype\typing.py", line 132, in <genexpr>
        if all(is_list(typ) for typ in types):
      File "path\to\env\lib\site-packages\monkeytype\typing.py", line 54, in is_list
        return is_generic(typ) and name_of_generic(typ) == 'List'
      File "path\to\env\lib\site-packages\monkeytype\compat.py", line 43, in name_of_generic
        return typ._name or typ.__origin__.__name__
    AttributeError: '_SpecialForm' object has no attribute '__name__'
    

    Using 20.5 works correctly instead. This happens while running monkeytype on alembic.

    To reproduce (commit e31971cfb46efd0ef41525473a1d9bcb81e90f43 is the current head of alembic):

    git clone https://github.com/sqlalchemy/alembic.git
    cd alembic
    git checkout e31971cfb46efd0ef41525473a1d9bcb81e90f43
    pip install -e .
    pip install python-dateutil
    monkeytype run -m pytest tests
    
    need-info 
    opened by CaselIT 12
  • Allow typing specified modules in site-packages

    Allow typing specified modules in site-packages

    #82

    This PR allows users to define an environment variable MONKEYTYPE_MODULE with name of a module, which would be typed by MonkeyType even if it is under Python site-packages.

    CLA Signed 
    opened by BoPeng 12
  • `monkeytype run manage.py test` doesn't produce sqllite file

    `monkeytype run manage.py test` doesn't produce sqllite file

    I've run monkeytype run manage.py test in my django project after pip install monkeytype (inside of a virtual env) and I'm not seeing any output of the sqllite file described in the README.

    Running monkeytype stub for any of my modules doesn't work either. If there's something different that I have to do for django tests, let's add that to the README. Otherwise, am I missing something?

    opened by nsillik 10
  • record per-key types for heterogenous dicts and suggest TypedDict annotation

    record per-key types for heterogenous dicts and suggest TypedDict annotation

    Currently MonkeyType assumes dicts are homogenous. When heterogenous dicts are seen, we just combine all the value types into a Union (and then if that Union gets too big, by default we rewrite it to Any). It'd be more useful in such cases to suggest a TypedDict annotation with per-key value types.

    The trick here is that we don't really know the intention, so there'd be some level of heuristic involved. Like, if there's multiple non-None value types (and probably if the number of keys is less than some threshold), rather than recording just a single value type, we record per-key value types. Then we'd also need some smarts when combining traces into an annotation: if we have any traces with per-key value types, try to construct a consistent TypedDict, but if we find that key names and value types aren't matching up consistently, fallback to normal Dict.

    There's enough fuzziness in the heuristics here and this'd be enough work that it might not be worth it, but for codebases that use lots of heterogenous dicts, it'd make the generated annotations a lot more useful.

    enhancement 
    opened by carljm 9
  • demo example tests are not passing at 100% on Windows

    demo example tests are not passing at 100% on Windows

    I tried to run the demo but I got:

    monkeytype\demo>pytest
    ============================= test session starts =============================
    platform win32 -- Python 3.6.1, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
    rootdir: monkeytype\demo, inifile: pytest.ini
    plugins: cov-2.5.1
    collected 8 items
    
    test_inbox.py ......F.                                                   [100%]
    
    ================================== FAILURES ===================================
    _______________________________ test_everything _______________________________
    
        def test_everything():
            u = make_user()
            other = make_user(name="Other", following=[u.id])
            first_entry = make_feedentry(user_id=u.id, caption="My First Post")
            follow = make_followed(user_id=u.id, follower_id=other.id)
            second_entry = make_feedentry(user_id=u.id, caption="Second Post")
            like1 = make_liked(user_id=u.id, liker_id=other.id, feedentry_id=first_entry.id)
            comment = make_commented(
                user_id=u.id, commenter_id=other.id, feedentry_id=first_entry.id
            )
            like2 = make_liked(user_id=u.id, liker_id=other.id, feedentry_id=second_entry.id)
            repo = FakeRepo(u, other, first_entry, second_entry, like1, like2, comment, follow)
            box = inbox.Inbox(u, repo)
    
    >       assert (
                box.aggregate()
                == [
                    models.AggregatedItem(
                        type=models.EventType.LIKED,
                        text='Other liked your post "Second Post".',
                        published=like2.published,
                    ),
                    models.AggregatedItem(
                        type=models.EventType.COMMENTED,
                        text="Other commented on your post.",
                        published=comment.published,
                    ),
                    models.AggregatedItem(
                        type=models.EventType.LIKED,
                        text='Other liked your post "My First Post".',
                        published=like1.published,
                    ),
                    models.AggregatedItem(
                        type=models.EventType.FOLLOWED,
                        text="Other started following you.",
                        published=follow.published,
                    ),
                ]
            )
    E       assert [AggregatedIt... 26, 231564))] == [AggregatedIte... 26, 231564))]
    E         At index 0 diff: AggregatedItem(type=<EventType.COMMENTED: 'commented'>, text='Other commented on your post.', published=datetime.datetime(2018, 7, 25, 6, 38, 26, 231564)) != AggregatedItem(type=<EventType.LIKED: 'liked'>, text='Other liked your post "Second Post".', published=datetime.datetime(2018, 7, 25, 6, 38, 26, 231564))
    E         Use -v to get the full diff
    
    test_inbox.py:242: AssertionError
    
    ----------- coverage: platform win32, python 3.6.1-final-0 -----------
    Name       Stmts   Miss Branch BrPart  Cover   Missing
    ------------------------------------------------------
    inbox.py      87      2     33      1    98%   163-164, 160->163
    Coverage HTML written to dir htmlcov
    
    ===================== 1 failed, 7 passed in 0.38 seconds ======================
    
    monkeytype\demo>
    
    opened by bluebird75 9
  • MonkeyType is not working in IPython

    MonkeyType is not working in IPython

    The newer version of MonkeyType does not work in IPython. I think https://github.com/Instagram/MonkeyType/commit/e8bb8a687e18dbb3c734ef33501a573265465c9d could be the reason.

    An interactive session in IPython will assert __name__ == '__main__' it would still be meaningful to capture the CallTrace so folks could interactively type their notebook/python source.

    I can totally understand if this falls outside the scope of the project.

    bug 
    opened by tonyfast 9
  • cannot use MonkeyType on Azure App Services filesystem: `sqlite3.OperationalError: database is locked`

    cannot use MonkeyType on Azure App Services filesystem: `sqlite3.OperationalError: database is locked`

    I've been attempting to get MonkeyType 21.5.0 to work in AzureML, which uses Ubuntu VMs for compute instances. However, after multiple attempts in both Python 3.6.9 and 3.8.1, every command, version, and file I've tried returns the same error trace:

    Traceback (most recent call last):
      File "/anaconda/envs/azureml_py38/bin/monkeytype", line 8, in <module>
        sys.exit(entry_point_main())
      File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/monkeytype/cli.py", line 396, in entry_point_main
        sys.exit(main(sys.argv[1:], sys.stdout, sys.stderr))
      File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/monkeytype/cli.py", line 381, in main
        handler(args, stdout, stderr)
      File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/monkeytype/cli.py", line 210, in list_modules_handler
        modules = args.config.trace_store().list_modules()
      File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/monkeytype/config.py", line 147, in trace_store
        return SQLiteStore.make_store(db_path)
      File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/monkeytype/db/sqlite.py", line 82, in make_store
        create_call_trace_table(conn)
      File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/monkeytype/db/sqlite.py", line 45, in create_call_trace_table
        conn.execute(query)
    sqlite3.OperationalError: database is locked
    

    The sqlite3 DB is being created, but the connection isn't being closed correctly despite the with statement in line 44 of ./monkeytype/db/sqlite.py. Is there any way to config the context manager for the sqlite DB?

    opened by ColtAllen 8
  • monkeytype/typing.py import error in PyCharm

    monkeytype/typing.py import error in PyCharm

    Trying to set up dev environment per instructions in CONTRIBUTING.rst

    Getting an import error: Traceback (most recent call last): File "/home/johnar/github/MonkeyType/monkeytype/cli.py", line 17, in from typing import ( File "/home/johnar/github/MonkeyType/monkeytype/typing.py", line 10, in from typing import ( ImportError: cannot import name 'Any'

    In pycharm it actually shows that import _Any and _Union result in unresolved reference, as they're not defined in the typing module.

    This is with stdlib typing 3.6.4: typing 3.6.4

    opened by johnarnold 8
  • monkeytype / retype doesn't apply stubs in __init__.py

    monkeytype / retype doesn't apply stubs in __init__.py

    For one of my modules, I ran test cases via monketype run, I can see the traces in the sqlite3 database, and I can run 'monketype stub modulename' and see what looks like valid stub output.

    However, when I run 'monkeytype apply modulename', it returns no errors but the module is not modified.

    I've been able to successfully update other modules. This module is my only good repro so far. There are no errors anywhere. I'm open to ideas on how to proceed. I guess i can start with debugging monkeytype?

    bug 
    opened by johnarnold 8
  • Support PEP 604 Union syntax  (Union[a, b] → a | b)

    Support PEP 604 Union syntax (Union[a, b] → a | b)

    PEP 604 introduces a new Union syntax in Python 3.10+. It would be nice if Monkeytype could leverage that, and perhaps have a flag to use a union with None rather than the Optional type.

    # Old syntax
    def foo(a: Optional[Union[float, int]]) -> Optional[float]:
        ...
    
    # New syntax
    def foo(a: float | int | None) -> float | None:
        ...
    
    enhancement 
    opened by AllanLeanderRostockHansen 0
  • Traces with builtins.coroutine, builtins.async_generator fail to decode

    Traces with builtins.coroutine, builtins.async_generator fail to decode

    WARNING: Failed decoding trace: Module 'builtins' has no attribute 'async_generator'
    WARNING: Failed decoding trace: Module 'builtins' has no attribute 'async_generator'
    WARNING: Failed decoding trace: Module 'builtins' has no attribute 'async_generator'
    WARNING: Failed decoding trace: Module 'builtins' has no attribute 'coroutine'
    WARNING: Failed decoding trace: Module 'builtins' has no attribute 'coroutine'
    WARNING: Failed decoding trace: Module 'builtins' has no attribute 'coroutine'
    WARNING: Failed decoding trace: Module 'builtins' has no attribute 'coroutine'
    WARNING: Failed decoding trace: Module 'builtins' has no attribute 'coroutine'
    

    Got the above in verbose mode when running Python 3.6.15 and MonkeyType 21.5.0 .

    Should these be in the following? https://github.com/Instagram/MonkeyType/blob/cef09c6702fbab58e66582f76f2559d6a21e448c/monkeytype/encoding.py#L97-L102

    And are there any other async or builtin types that need this special handling?

    Even though traces that don't decode usually get ignored, async types are probably very meaningful for the codebase.

    bug 
    opened by slix 1
  • "Failed collecting trace" and then lots of exceptions

    Should be a pretty easy repro.

    Create a Dockerfile with the following contents:

    FROM ubuntu:20.04
    RUN apt-get update
    RUN apt-get install -y python3 python3-pip
    RUN pip3 install monkeytype
    RUN echo "from pkg_resources.extern import six" > repro.py
    

    Then build it with docker build --network=host -t repro . and start with docker run --rm -it repro bash (or whatever).

    Can verify that the import works correctly:

    root@2ed6e4080312:/# python3 repro.py
    root@2ed6e4080312:/#
    

    (python3 here is 3.8)

    But this doesn't work through MonkeyType:

    root@2ed6e4080312:/# monkeytype run repro.py
    Failed collecting trace
    Traceback (most recent call last):
      File "/usr/local/lib/python3.8/dist-packages/monkeytype/tracing.py", line 259, in __call__
        self.handle_call(frame)
      File "/usr/local/lib/python3.8/dist-packages/monkeytype/tracing.py", line 213, in handle_call
        func = self._get_func(frame)
      File "/usr/local/lib/python3.8/dist-packages/monkeytype/tracing.py", line 207, in _get_func
        self.cache[code] = get_func(frame)
      File "/usr/local/lib/python3.8/dist-packages/monkeytype/tracing.py", line 151, in get_func
        func = get_func_in_mro(first_arg, code)
      File "/usr/local/lib/python3.8/dist-packages/monkeytype/tracing.py", line 113, in get_func_in_mro
        val = inspect.getattr_static(obj, code.co_name, None)
      File "/usr/lib/python3.8/inspect.py", line 1596, in getattr_static
        instance_result = _check_instance(obj, attr)
      File "/usr/lib/python3.8/inspect.py", line 1546, in _check_instance
        return dict.get(instance_dict, attr, _sentinel)
    TypeError: descriptor 'get' for 'dict' objects doesn't apply to a 'NoneType' object
    ...
    ...
    
    bug 
    opened by EvanED 1
  • Less scary output on failed collecting trace warnings

    Less scary output on failed collecting trace warnings

    We don't need to print the full traceback, and we could probably hint people that even if a few traces failed to collect that doesn't mean useful type traces weren't still collected.

    See e.g. #244

    enhancement 
    opened by carljm 0
  • failed collecting trace: TypeError: descriptor 'get' for 'dict' objects doesn't apply to a 'NoneType' object

    failed collecting trace: TypeError: descriptor 'get' for 'dict' objects doesn't apply to a 'NoneType' object

    First time using this tool, after watching the utoob discussion. No type info whatsoever in my code, but I was prepared to be converted, and was interested to get a leg up with this tool.

    monkeytype run zwi/zwi.py Failed collecting trace Traceback (most recent call last): File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 259, in __call__ self.handle_call(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 213, in handle_call func = self._get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 207, in _get_func self.cache[code] = get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 151, in get_func func = get_func_in_mro(first_arg, code) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 113, in get_func_in_mro val = inspect.getattr_static(obj, code.co_name, None) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1622, in getattr_static instance_result = _check_instance(obj, attr) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1572, in _check_instance return dict.get(instance_dict, attr, _sentinel) TypeError: descriptor 'get' for 'dict' objects doesn't apply to a 'NoneType' object Failed collecting trace Traceback (most recent call last): File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 259, in __call__ self.handle_call(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 213, in handle_call func = self._get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 207, in _get_func self.cache[code] = get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 151, in get_func func = get_func_in_mro(first_arg, code) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 113, in get_func_in_mro val = inspect.getattr_static(obj, code.co_name, None) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1622, in getattr_static instance_result = _check_instance(obj, attr) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1572, in _check_instance return dict.get(instance_dict, attr, _sentinel) TypeError: descriptor 'get' for 'dict' objects doesn't apply to a 'NoneType' object Failed collecting trace Traceback (most recent call last): File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 259, in __call__ self.handle_call(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 213, in handle_call func = self._get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 207, in _get_func self.cache[code] = get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 151, in get_func func = get_func_in_mro(first_arg, code) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 113, in get_func_in_mro val = inspect.getattr_static(obj, code.co_name, None) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1622, in getattr_static instance_result = _check_instance(obj, attr) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1572, in _check_instance return dict.get(instance_dict, attr, _sentinel) TypeError: descriptor 'get' for 'dict' objects doesn't apply to a 'NoneType' object Failed collecting trace Traceback (most recent call last): File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 259, in __call__ self.handle_call(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 213, in handle_call func = self._get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 207, in _get_func self.cache[code] = get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 151, in get_func func = get_func_in_mro(first_arg, code) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 113, in get_func_in_mro val = inspect.getattr_static(obj, code.co_name, None) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1622, in getattr_static instance_result = _check_instance(obj, attr) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1572, in _check_instance return dict.get(instance_dict, attr, _sentinel) TypeError: descriptor 'get' for 'dict' objects doesn't apply to a 'NoneType' object Failed collecting trace Traceback (most recent call last): File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 259, in __call__ self.handle_call(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 213, in handle_call func = self._get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 207, in _get_func self.cache[code] = get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 151, in get_func func = get_func_in_mro(first_arg, code) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 113, in get_func_in_mro val = inspect.getattr_static(obj, code.co_name, None) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1622, in getattr_static instance_result = _check_instance(obj, attr) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1572, in _check_instance return dict.get(instance_dict, attr, _sentinel) TypeError: descriptor 'get' for 'dict' objects doesn't apply to a 'NoneType' object Failed collecting trace Traceback (most recent call last): File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 259, in __call__ self.handle_call(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 213, in handle_call func = self._get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 207, in _get_func self.cache[code] = get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 151, in get_func func = get_func_in_mro(first_arg, code) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 113, in get_func_in_mro val = inspect.getattr_static(obj, code.co_name, None) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1622, in getattr_static instance_result = _check_instance(obj, attr) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1572, in _check_instance return dict.get(instance_dict, attr, _sentinel) TypeError: descriptor 'get' for 'dict' objects doesn't apply to a 'NoneType' object Failed collecting trace Traceback (most recent call last): File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 259, in __call__ self.handle_call(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 213, in handle_call func = self._get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 207, in _get_func self.cache[code] = get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 151, in get_func func = get_func_in_mro(first_arg, code) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 113, in get_func_in_mro val = inspect.getattr_static(obj, code.co_name, None) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1622, in getattr_static instance_result = _check_instance(obj, attr) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1572, in _check_instance return dict.get(instance_dict, attr, _sentinel) TypeError: descriptor 'get' for 'dict' objects doesn't apply to a 'NoneType' object Failed collecting trace Traceback (most recent call last): File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 259, in __call__ self.handle_call(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 213, in handle_call func = self._get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 207, in _get_func self.cache[code] = get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 151, in get_func func = get_func_in_mro(first_arg, code) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 113, in get_func_in_mro val = inspect.getattr_static(obj, code.co_name, None) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1622, in getattr_static instance_result = _check_instance(obj, attr) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1572, in _check_instance return dict.get(instance_dict, attr, _sentinel) TypeError: descriptor 'get' for 'dict' objects doesn't apply to a 'NoneType' object Failed collecting trace Traceback (most recent call last): File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 259, in __call__ self.handle_call(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 213, in handle_call func = self._get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 207, in _get_func self.cache[code] = get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 151, in get_func func = get_func_in_mro(first_arg, code) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 113, in get_func_in_mro val = inspect.getattr_static(obj, code.co_name, None) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1622, in getattr_static instance_result = _check_instance(obj, attr) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1572, in _check_instance return dict.get(instance_dict, attr, _sentinel) TypeError: descriptor 'get' for 'dict' objects doesn't apply to a 'NoneType' object Failed collecting trace Traceback (most recent call last): File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 259, in __call__ self.handle_call(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 213, in handle_call func = self._get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 207, in _get_func self.cache[code] = get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 151, in get_func func = get_func_in_mro(first_arg, code) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 113, in get_func_in_mro val = inspect.getattr_static(obj, code.co_name, None) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1622, in getattr_static instance_result = _check_instance(obj, attr) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1572, in _check_instance return dict.get(instance_dict, attr, _sentinel) TypeError: descriptor 'get' for 'dict' objects doesn't apply to a 'NoneType' object Failed collecting trace Traceback (most recent call last): File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 259, in __call__ self.handle_call(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 213, in handle_call func = self._get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 207, in _get_func self.cache[code] = get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 151, in get_func func = get_func_in_mro(first_arg, code) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 113, in get_func_in_mro val = inspect.getattr_static(obj, code.co_name, None) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1622, in getattr_static instance_result = _check_instance(obj, attr) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1572, in _check_instance return dict.get(instance_dict, attr, _sentinel) TypeError: descriptor 'get' for 'dict' objects doesn't apply to a 'NoneType' object Failed collecting trace Traceback (most recent call last): File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 259, in __call__ self.handle_call(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 213, in handle_call func = self._get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 207, in _get_func self.cache[code] = get_func(frame) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 151, in get_func func = get_func_in_mro(first_arg, code) File "/Users/dap/Library/Python/3.9/lib/python/site-packages/monkeytype/tracing.py", line 113, in get_func_in_mro val = inspect.getattr_static(obj, code.co_name, None) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1622, in getattr_static instance_result = _check_instance(obj, attr) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 1572, in _check_instance return dict.get(instance_dict, attr, _sentinel) TypeError: descriptor 'get' for 'dict' objects doesn't apply to a 'NoneType' object Usage: python -m zwi [OPTIONS] COMMAND [ARGS]...

    need-info 
    opened by permezel 5
Owner
Instagram
Instagram
Read write method - Read files in various types of formats

一个关于所有格式文件读取的方法 1。 问题描述: 各种各样的文件格式,读写操作非常的麻烦,能够有一种方法,可以整合所有格式的文件,方便用户进行读取和写入。 2

null 2 Jan 26, 2022
VSCode extension that generates docstrings for python files

VSCode Python Docstring Generator Visual Studio Code extension to quickly generate docstrings for python functions. Features Quickly generate a docstr

Nils Werner 506 Jan 3, 2023
Type hints support for the Sphinx autodoc extension

sphinx-autodoc-typehints This extension allows you to use Python 3 annotations for documenting acceptable argument types and return value types of fun

Alex Grönholm 462 Dec 29, 2022
Mayan EDMS is a document management system.

Mayan EDMS is a document management system. Its main purpose is to store, introspect, and categorize files, with a strong emphasis on preserving the contextual and business information of documents. It can also OCR, preview, label, sign, send, and receive thoses files.

null 3 Oct 2, 2021
Software engineering course project. Secondhand trading system.

PigeonSale Software engineering course project. Secondhand trading system. Documentation API doumenatation: list of APIs Backend documentation: notes

Harry Lee 1 Sep 1, 2022
Build AGNOS, the operating system for your comma three

agnos-builder This is the tool to build AGNOS, our Ubuntu based OS. AGNOS runs on the comma three devkit. NOTE: the edk2_tici and agnos-firmare submod

comma.ai 21 Dec 24, 2022
BakTst_Org is a backtesting system for quantitative transactions.

BakTst_Org 中文reademe:传送门 Introduction: BakTst_Org is a prototype of the backtesting system used for BTC quantitative trading. This readme is mainly di

null 18 May 8, 2021
Obmovies - A short guide on setting up the system and environment dependencies required for ob's Movies database

Obmovies - A short guide on setting up the system and environment dependencies required for ob's Movies database

null 1 Jan 4, 2022
graphical orbitational simulation of solar system planets with real values and physics implemented so you get a nice elliptical orbits. you can change timestamp value or scale from source code idc.

solarSystemOrbitalSimulation graphical orbitational simulation of solar system planets with real values and physics implemented so you get a nice elli

Mega 3 Mar 3, 2022
A collection of simple python mini projects to enhance your python skills

A collection of simple python mini projects to enhance your python skills

PYTHON WORLD 12.1k Jan 5, 2023
Python Eacc is a minimalist but flexible Lexer/Parser tool in Python.

Python Eacc is a parsing tool it implements a flexible lexer and a straightforward approach to analyze documents.

Iury de oliveira gomes figueiredo 60 Nov 16, 2022
Repository for learning Python (Python Tutorial)

Repository for learning Python (Python Tutorial) Languages and Tools ?? Overview ?? Repository for learning Python (Python Tutorial) Languages and Too

Swiftman 2 Aug 22, 2022
A python package to avoid writing and maintaining duplicated python docstrings.

docstring-inheritance is a python package to avoid writing and maintaining duplicated python docstrings.

Antoine Dechaume 15 Dec 7, 2022
advance python series: Data Classes, OOPs, python

Working With Pydantic - Built-in Data Process ========================== Normal way to process data (reading json file): the normal princiople, it's f

Phung Hưng Binh 1 Nov 8, 2021
A comprehensive and FREE Online Python Development tutorial going step-by-step into the world of Python.

FREE Reverse Engineering Self-Study Course HERE Fundamental Python The book and code repo for the FREE Fundamental Python book by Kevin Thomas. FREE B

Kevin Thomas 7 Mar 19, 2022
A simple USI Shogi Engine written in python using python-shogi.

Revengeshogi My attempt at creating a USI Shogi Engine in python using python-shogi. Current State of Engine Currently only generating random moves us

null 1 Jan 6, 2022
Python-slp - Side Ledger Protocol With Python

Side Ledger Protocol Run python-slp node First install Mongo DB and run the mong

Solar 3 Mar 2, 2022
Python-samples - This project is to help someone need some practices when learning python language

Python-samples - This project is to help someone need some practices when learning python language

Gui Chen 0 Feb 14, 2022
A curated list of awesome tools for Sphinx Python Documentation Generator

Awesome Sphinx (Python Documentation Generator) A curated list of awesome extra libraries, software and resources for Sphinx (Python Documentation Gen

Hyunjun Kim 831 Dec 27, 2022