Git Product home page Git Product logo

Comments (2)

mtshiba avatar mtshiba commented on May 29, 2024 1

Most of these problems have been fixed.

Dictionary-type inference needs to be devised differently from others. Please wait a moment.

from pylyzer.

inaz2 avatar inaz2 commented on May 29, 2024

Wonderful! This improvement is quite valuable.

Unfortunately, the original test cases was not exhaustive. I confirmed another test case that is incompatible with the other type checkers result. Please check if necessary.

# https://docs.python.org/3/library/stdtypes.html
# https://docs.python.org/3/library/functions.html

def print_repr(x):
    print(repr(x))

# class complex(string)
# -> TypeError: the type of Complex::real (the 1st argument) is mismatched
print_repr(complex('1+2j'))

# class dict(**kwarg)
# -> TypeError: missing 1 positional argument(s) for .GenericDict(qual_name: GenericDict)(: {GenericDict, })
print_repr(dict(a=1, b=2))

# class str(object=b'', encoding='utf-8', errors='strict')
# -> TypeError: too many arguments for .Str(qual_name: Str)(: {Str, })
print_repr(str(b'\xE3\x81\x82', 'utf-8'))
print_repr(str(b'\xE3\x81\x82', 'utf-8', 'replace'))

# class bytes(source=b'') ... "source" also accepts int and iterable
# class bytes(source, encoding, errors)
# -> TypeError: missing 1 positional argument(s) for .bytes(: (str: Str, encoding: Str) -> Bytes)
print_repr(bytes(b'\xE3\x81\x82'))
print_repr(bytes(10))
print_repr(bytes(range(20)))
print_repr(bytes('str', 'utf-8', 'replace'))

# class bytearray(source=b'') ... "source" also accepts int and iterable
# class bytearray(source, encoding)
# class bytearray(source, encoding, errors)
# -> NameError: bytearray is not defined
print_repr(bytearray(b'\xE3\x81\x82'))
print_repr(bytearray(10))
print_repr(bytearray(range(20)))
print_repr(bytearray('str', 'utf-8'))
print_repr(bytearray('str', 'utf-8', 'replace'))

# class memoryview(object)
# -> NameError: memoryview is not defined
print_repr(memoryview(b"abcefg"))

# class frozenset(iterable=set())
# -> NameError: frozenset is not defined
print_repr(frozenset([1, 2, 2]))

from pylyzer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.