简体   繁体   中英

pytype -> ninja: error: dependency cycle:

I want to check the type using pytype on the below code.

import re
  
def GetEmailMatch(email):
  return re.match(r'([^@]+)@example\.com', email)

def GetUsername(email_address):
  match = GetEmailMatch(email_address)
  if match is None:
    return None
  return match.group(1)

But When I run "pytype get_username.py", I got an error.

ninja: error: dependency cycle: /media/arpon/New -> /media/arpon/New

Can you suggest to me how can I overcome this error?

The module usage is like this:

from pytypes import typechecked

@typechecked
def some_function(a: int, b: str, c: List[Union[str, float]]) -> int:
    return a+len(b)+len(c)

So it looks like this module should be imported for pytype to work.

Interestingly, i just installed the same module to show you the example but it errors out because it works up to version 3.8 and i am using version 3.10 .

Can you confirm the version that you are using?

Here are the official docs where i see this: https://pypi.org/project/pytypes/

The error message is this: module 'collections' has no attribute 'Iterable' and when searched the collections module that is referred to has changed beyong 3.8 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM