micropython-stubber icon indicating copy to clipboard operation
micropython-stubber copied to clipboard

merge - add ability to add / some classes & functions

Open Josverl opened this issue 3 years ago • 0 comments

  • [x] add new method to Class
  • [x] find/extract method in docstubs
  • [x] find/extract class in docstubs
  • [ ] add new ClassDef to module

machine

  • [x] machine.Pin.__call__
  • [x] read method from doc-stubs ( currently hardcoded)

micropython.pyi

  • [ ] add decorators from doc stubs
def viper(func:Callable) -> Callable:
    """
    The Viper code emitter is not fully compliant. It supports special Viper native data types in pursuit of performance. 
    Integer processing is non-compliant because it uses machine words: arithmetic on 32 bit hardware is performed modulo 2**32.
    Like the Native emitter Viper produces machine instructions but further optimisations are performed, substantially increasing 
    performance especially for integer arithmetic and bit manipulations.
    """
    ...

def native(func:Callable) -> Callable:
    """
    This causes the MicroPython compiler to emit native CPU opcodes rather than bytecode. 
    It covers the bulk of the MicroPython functionality, so most functions will require no adaptation. 
    See: https://docs.micropython.org/en/latest/reference/speed_python.html?highlight=viper#the-native-code-emitter
    """
    ...

btree.pyi

  • [ ] add btree class from docstubs

io.py

Add baseclasses to class

  • [ ] IOBase(IO)
  • [ ] BufferedWriter(IO)

implementation options:

  1. ~~using libcts merge ( one of the first merge options did this )~~
  2. ~~git patch~~
  3. ✅libcst Codemod

Josverl avatar Nov 13 '22 18:11 Josverl