Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.idea/

/moretools/__version__.py
42 changes: 29 additions & 13 deletions moretools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

"""MOREtools >>> MORE Overly Reusable Essentials for python."""

__import__('zetup').toplevel(__name__, [
__all__ = (
'SimpleTree',
'StrictBool',
'dictitems',
Expand All @@ -31,18 +31,34 @@
'qualname',
'simpledict',
'strictbool',
# TODO: fill in rest!
], aliases={
# six-like aliases for dict... functions
'iteritems': 'dictitems',
'iterkeys': 'dictkeys',
'itervalues': 'dictvalues',
}, deprecated_aliases={
'Bool': 'StrictBool',
'boolclass': 'strictbool',
'booltype': 'strictbool',
'isbooltype': 'isboolclass',
})
)

# __import__('zetup').toplevel(__name__, [
# 'SimpleTree',
# 'StrictBool',
# 'dictitems',
# 'dictkeys',
# 'dictvalues',
# 'func_types',
# 'getfunc',
# 'isboolclass',
# 'isbool',
# 'isfunc',
# 'qualname',
# 'simpledict',
# 'strictbool',
# # TODO: fill in rest!
# ], aliases={
# # six-like aliases for dict... functions
# 'iteritems': 'dictitems',
# 'iterkeys': 'dictkeys',
# 'itervalues': 'dictvalues',
# }, deprecated_aliases={
# 'Bool': 'StrictBool',
# 'boolclass': 'strictbool',
# 'booltype': 'strictbool',
# 'isbooltype': 'isboolclass',
# })


def qualname(cls):
Expand Down
4 changes: 2 additions & 2 deletions moretools/_cached.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
"""
__all__ = ['cached']

from inspect import getargspec
from inspect import getfullargspec

from decorator import decorator

from ._common import *


def cached(func):
argspec = getargspec(func)
argspec = getfullargspec(func)
try: # Python >= 3.5
varkw = argspec.varkw
except AttributeError:
Expand Down
4 changes: 2 additions & 2 deletions moretools/_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
__all__ = ['multimethod']

import sys
from inspect import getargspec
from inspect import getfullargspec

from decorator import decorator

Expand Down Expand Up @@ -59,7 +59,7 @@ def multimethod(func):
func_name = func.__name__
func_qualname = qualname(func)

argspec = getargspec(func)
argspec = getfullargspec(func)

def caller(func, self, *args, **kwargs):
if method.fenter is not None:
Expand Down
6 changes: 3 additions & 3 deletions moretools/_simpledict.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"""

from six import with_metaclass
import zetup
# import zetup

__all__ = [
'SimpleDictType', 'SimpleFrozenDictType', 'SimpleDictStructType',
Expand Down Expand Up @@ -64,7 +64,7 @@ def __init__(self, attrname, key, attr_from_key):
AttrToKeyToAttrMismatch.__name__ = 'simpledict.AttrToKeyToAttrMismatch'


class SimpleDictMeta(zetup.meta):
class SimpleDictMeta(type): # zetup.meta):
"""The basic metaclass for :class:`SimpleDictType`.

- Provides methods and attributes
Expand Down Expand Up @@ -103,7 +103,7 @@ def _reverse_check_attr(cls, attrname, key):
raise AttrToKeyToAttrMismatch(attrname, key, attr_from_key)


class SimpleDictType(with_metaclass(SimpleDictMeta, zetup.object)):
class SimpleDictType(metaclass=SimpleDictMeta): # with_metaclass(SimpleDictMeta, zetup.object)):
"""A simple *mapping* type providing item value access
with `__getattr__`/`__setattr__`,
using custom *key*<-->*attrname* conversion functions
Expand Down
8 changes: 4 additions & 4 deletions moretools/_simpletree.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from inspect import isclass

from six import PY2, reraise, with_metaclass
import zetup
# import zetup

import moretools
from moretools import qualname
Expand All @@ -14,7 +14,7 @@
__all__ = ('SimpleTree', )


class ContextStack(zetup.object):
class ContextStack: # (zetup.object):

def __init__(self, _type):
self._list = []
Expand Down Expand Up @@ -45,7 +45,7 @@ def __repr__(self):
return repr(self._list)


class SimpleTreeMeta(zetup.meta, ABCMeta):
class SimpleTreeMeta(ABCMeta): # zetup.meta, ABCMeta):
"""
Metaclass for abstract :class:`moretools.SimpleTree`.

Expand Down Expand Up @@ -86,7 +86,7 @@ class root(cls):
return root


class SimpleTree(with_metaclass(SimpleTreeMeta, zetup.object)):
class SimpleTree(metaclass=SimpleTreeMeta): # with_metaclass(SimpleTreeMeta, zetup.object)):
r"""
The simple yet powerful tree creation and processing factory.

Expand Down
8 changes: 4 additions & 4 deletions moretools/func.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from doctest import DocTestParser
from inspect import isfunction

from zetup import apifunction
# from zetup import apifunction

import moretools

Expand All @@ -16,10 +16,10 @@


#: All types of ``function`` objects.
func_types = (types.BuiltinFunctionType, types.FunctionType, apifunction)
func_types = (types.BuiltinFunctionType, types.FunctionType) # , apifunction)


@apifunction(moretools)
# @apifunction(moretools)
def isfunc(obj):
"""
Check if `obj` is a built-in/user ``function`` or ``zetup.apifunction``.
Expand Down Expand Up @@ -56,7 +56,7 @@ def isfunc(obj):
return isinstance(obj, func_types)


@apifunction(moretools)
# @apifunction(moretools)
def getfunc(obj):
"""
Get the actual ``function`` object of any ``callable`` `obj`.
Expand Down
43 changes: 43 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[build-system]
build-backend = 'hatchling.build'
requires = [
'hatch-vcs~=0.5.0',
"hatchling~=1.32.0",
"setuptools-scm~=10.2.1",
]

[project]
name = 'moretools'
description = 'MORE Overly Reusable Essentials for python'
dynamic = ['version']

authors = [{ name = 'Stefan Zimmermann', email = 'user@zimmermann.co' }]
urls = { Repository = 'https://github.com/zimmermanncode/moretools'}
license = 'LGPL-3.0-or-later'
license-files = ['COPYING', 'COPYING.LESSER']

requires-python = '>=3.14.7'
dependencies = [
'decorator~=5.3.1',
"six~=1.17.0",
]

[dependency-groups]
dev = [
'ipython~=9.18.1',
'mypy~=2.3.1',
'pre-commit~=4.6.2',
'pytest~=9.1.1',
'pytest-cov~=7.1.0',
'ruff~=0.16.3',
'setuptools-scm~=10.2.1',
]

[tool.hatch.version]
source = 'vcs'

[tool.hatch.build.hooks.vcs]
version-file = 'moretools/__version__.py'

[tool.setuptools_scm]
version_file = 'moretools/__version__.py'