Fix typing errors
This commit is contained in:
parent
847159135d
commit
9d6f535e01
|
@ -24,6 +24,7 @@ from argparse import ArgumentParser
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from shlex import quote
|
from shlex import quote
|
||||||
|
from typing import Optional, List
|
||||||
from xml.sax.saxutils import quoteattr
|
from xml.sax.saxutils import quoteattr
|
||||||
|
|
||||||
from shapely.geometry import *
|
from shapely.geometry import *
|
||||||
|
@ -181,9 +182,9 @@ class ArgparseEdgeType:
|
||||||
"""argparse type to select from a set of edge types"""
|
"""argparse type to select from a set of edge types"""
|
||||||
|
|
||||||
names = edges.getDescriptions()
|
names = edges.getDescriptions()
|
||||||
edges = []
|
edges: List[str] = []
|
||||||
|
|
||||||
def __init__(self, edges=None):
|
def __init__(self, edges: Optional[str] = None):
|
||||||
if edges:
|
if edges:
|
||||||
self.edges = list(edges)
|
self.edges = list(edges)
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import argparse
|
||||||
import inspect
|
import inspect
|
||||||
import math
|
import math
|
||||||
import re
|
import re
|
||||||
|
from typing import Optional, Dict, Any
|
||||||
|
|
||||||
from boxes import gears
|
from boxes import gears
|
||||||
|
|
||||||
|
@ -167,8 +168,8 @@ class Settings(object):
|
||||||
the suported keys and default values. The values are available via
|
the suported keys and default values. The values are available via
|
||||||
attribute access.
|
attribute access.
|
||||||
"""
|
"""
|
||||||
absolute_params = {}
|
absolute_params: Dict[str, Any] = {} # TODO find better typing.
|
||||||
relative_params = {}
|
relative_params: Dict[str, Any] = {} # TODO find better typing.
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def parserArguments(cls, parser, prefix=None, **defaults):
|
def parserArguments(cls, parser, prefix=None, **defaults):
|
||||||
|
@ -299,7 +300,7 @@ class Settings(object):
|
||||||
|
|
||||||
class BaseEdge(object):
|
class BaseEdge(object):
|
||||||
"""Abstract base class for all Edges"""
|
"""Abstract base class for all Edges"""
|
||||||
char = None
|
char: Optional[str] = None
|
||||||
description = "Abstract Edge Class"
|
description = "Abstract Edge Class"
|
||||||
|
|
||||||
def __init__(self, boxes, settings):
|
def __init__(self, boxes, settings):
|
||||||
|
@ -1907,7 +1908,7 @@ Values:
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
__doc__ += FingerJointSettings.__doc__
|
__doc__ += FingerJointSettings.__doc__ or ""
|
||||||
|
|
||||||
absolute_params = FingerJointSettings.absolute_params.copy()
|
absolute_params = FingerJointSettings.absolute_params.copy()
|
||||||
relative_params = FingerJointSettings.relative_params.copy()
|
relative_params = FingerJointSettings.relative_params.copy()
|
||||||
|
|
|
@ -732,9 +732,3 @@ class Gears():
|
||||||
if not teeth_only:
|
if not teeth_only:
|
||||||
self.boxes.move(width, height, move)
|
self.boxes.move(width, height, move)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
e = Gears()
|
|
||||||
e.affect()
|
|
||||||
|
|
||||||
# Notes
|
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
try:
|
try:
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
except ImportError:
|
except ImportError:
|
||||||
def _(message):
|
def _(message: str) -> str:
|
||||||
return message
|
return message
|
||||||
|
|
||||||
from boxes import *
|
from boxes import *
|
||||||
|
|
|
@ -82,7 +82,8 @@ class ArgumentParserError(Exception): pass
|
||||||
class ThrowingArgumentParser(argparse.ArgumentParser):
|
class ThrowingArgumentParser(argparse.ArgumentParser):
|
||||||
def error(self, message):
|
def error(self, message):
|
||||||
raise ArgumentParserError(message)
|
raise ArgumentParserError(message)
|
||||||
boxes.ArgumentParser = ThrowingArgumentParser # Evil hack
|
# Evil hack
|
||||||
|
boxes.ArgumentParser = ThrowingArgumentParser # type: ignore
|
||||||
|
|
||||||
class BServer:
|
class BServer:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue