diff --git a/string/metadata.txt b/string/metadata.txt new file mode 100644 index 00000000..7fd02826 --- /dev/null +++ b/string/metadata.txt @@ -0,0 +1,3 @@ +srctype=micropython-lib +type=module +version=0.0.1 diff --git a/string/setup.py b/string/setup.py new file mode 100644 index 00000000..a0895c3c --- /dev/null +++ b/string/setup.py @@ -0,0 +1,18 @@ +import sys +# Remove current dir from sys.path, otherwise setuptools will peek up our +# module instead of system. +sys.path.pop(0) +from setuptools import setup + + +setup(name='micropython-string', + version='0.0.1', + description='string module for MicroPython', + long_description="This is a module reimplemented specifically for MicroPython standard library,\nwith efficient and lean design in mind. Note that this module is likely work\nin progress and likely supports just a subset of CPython's corresponding\nmodule. Please help with the development if you are interested in this\nmodule.", + url='https://github.com/micropython/micropython/issues/405', + author='MicroPython Developers', + author_email='micro-python@googlegroups.com', + maintainer='MicroPython Developers', + maintainer_email='micro-python@googlegroups.com', + license='MIT', + py_modules=['string']) diff --git a/string/string.py b/string/string.py new file mode 100644 index 00000000..dff21124 --- /dev/null +++ b/string/string.py @@ -0,0 +1,10 @@ +# Some strings for ctype-style character classification +whitespace = ' \t\n\r\v\f' +ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz' +ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' +ascii_letters = ascii_lowercase + ascii_uppercase +digits = '0123456789' +hexdigits = digits + 'abcdef' + 'ABCDEF' +octdigits = '01234567' +punctuation = """!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~""" +printable = digits + ascii_letters + punctuation + whitespace