make mypy happy
This commit is contained in:
parent
57936db6b9
commit
2d9bbf39f0
@ -1,5 +1,5 @@
|
|||||||
# Relational
|
# Relational
|
||||||
# Copyright (C) 2009-2016 Salvo "LtWorf" Tomaselli
|
# Copyright (C) 2009-2017 Salvo "LtWorf" Tomaselli
|
||||||
#
|
#
|
||||||
# Relational is free software: you can redistribute it and/or modify
|
# Relational is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Relational
|
# Relational
|
||||||
# Copyright (C) 2008-2016 Salvo "LtWorf" Tomaselli
|
# Copyright (C) 2008-2017 Salvo "LtWorf" Tomaselli
|
||||||
#
|
#
|
||||||
# Relational is free software: you can redistribute it and/or modify
|
# Relational is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -24,6 +24,8 @@
|
|||||||
#
|
#
|
||||||
# Language definition here:
|
# Language definition here:
|
||||||
# http://ltworf.github.io/relational/grammar.html
|
# http://ltworf.github.io/relational/grammar.html
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from relational import rtypes
|
from relational import rtypes
|
||||||
|
|
||||||
RELATION = 0
|
RELATION = 0
|
||||||
@ -100,8 +102,8 @@ class Node (object):
|
|||||||
operation.
|
operation.
|
||||||
|
|
||||||
This class is used to convert an expression into python code.'''
|
This class is used to convert an expression into python code.'''
|
||||||
kind = None
|
kind = None # type: Optional[int]
|
||||||
__hash__ = None
|
__hash__ = None # type: None
|
||||||
|
|
||||||
def __init__(self, expression=None):
|
def __init__(self, expression=None):
|
||||||
'''Generates the tree from the tokenized expression
|
'''Generates the tree from the tokenized expression
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Relational
|
# Relational
|
||||||
# Copyright (C) 2008-2016 Salvo "LtWorf" Tomaselli
|
# Copyright (C) 2008-2017 Salvo "LtWorf" Tomaselli
|
||||||
#
|
#
|
||||||
# Relational is free software: you can redistribute it and/or modify
|
# Relational is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -50,7 +50,7 @@ class Relation (object):
|
|||||||
An empty relation needs a header, and can be filled using the insert()
|
An empty relation needs a header, and can be filled using the insert()
|
||||||
method.
|
method.
|
||||||
'''
|
'''
|
||||||
__hash__ = None
|
__hash__ = None # type: None
|
||||||
|
|
||||||
def __init__(self, filename=""):
|
def __init__(self, filename=""):
|
||||||
self._readonly = False
|
self._readonly = False
|
||||||
|
@ -57,7 +57,7 @@ class Rstring (str):
|
|||||||
self._autocast = rdate(self)
|
self._autocast = rdate(self)
|
||||||
return self._autocast
|
return self._autocast
|
||||||
|
|
||||||
def isInt(self):
|
def isInt(self) -> bool:
|
||||||
'''Returns true if the string represents an int number
|
'''Returns true if the string represents an int number
|
||||||
it only considers as int numbers the strings matching
|
it only considers as int numbers the strings matching
|
||||||
the following regexp:
|
the following regexp:
|
||||||
@ -65,7 +65,7 @@ class Rstring (str):
|
|||||||
'''
|
'''
|
||||||
return Rstring.int_regexp.match(self) is not None
|
return Rstring.int_regexp.match(self) is not None
|
||||||
|
|
||||||
def isFloat(self):
|
def isFloat(self) -> bool:
|
||||||
'''Returns true if the string represents a float number
|
'''Returns true if the string represents a float number
|
||||||
it only considers as float numbers, the strings matching
|
it only considers as float numbers, the strings matching
|
||||||
the following regexp:
|
the following regexp:
|
||||||
@ -73,7 +73,7 @@ class Rstring (str):
|
|||||||
'''
|
'''
|
||||||
return Rstring.float_regexp.match(self) is not None
|
return Rstring.float_regexp.match(self) is not None
|
||||||
|
|
||||||
def isDate(self):
|
def isDate(self) -> bool:
|
||||||
'''Returns true if the string represents a date,
|
'''Returns true if the string represents a date,
|
||||||
in the format YYYY-MM-DD. as separators '-' , '\', '/' are allowed.
|
in the format YYYY-MM-DD. as separators '-' , '\', '/' are allowed.
|
||||||
As side-effect, the date object will be stored for future usage, so
|
As side-effect, the date object will be stored for future usage, so
|
||||||
@ -159,7 +159,7 @@ class Rdate (object):
|
|||||||
return (self.intdate - other.intdate).days
|
return (self.intdate - other.intdate).days
|
||||||
|
|
||||||
|
|
||||||
def is_valid_relation_name(name):
|
def is_valid_relation_name(name: str) -> bool:
|
||||||
'''Checks if a name is valid for a relation.
|
'''Checks if a name is valid for a relation.
|
||||||
Returns boolean'''
|
Returns boolean'''
|
||||||
return re.match(RELATION_NAME_REGEXP, name) != None and not keyword.iskeyword(name)
|
return re.match(RELATION_NAME_REGEXP, name) != None and not keyword.iskeyword(name)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Relational
|
# Relational
|
||||||
# Copyright (C) 2008-2015 Salvo "LtWorf" Tomaselli
|
# Copyright (C) 2008-2017 Salvo "LtWorf" Tomaselli
|
||||||
#
|
#
|
||||||
# Relational is free software: you can redistribute it and/or modify
|
# Relational is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -24,7 +24,7 @@ try: # If QtWebKit is available, uses it
|
|||||||
except:
|
except:
|
||||||
webk = False
|
webk = False
|
||||||
|
|
||||||
version = 0
|
version = ''
|
||||||
|
|
||||||
|
|
||||||
class Ui_Dialog(object):
|
class Ui_Dialog(object):
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Relational
|
# Relational
|
||||||
# Copyright (C) 2008-2016 Salvo "LtWorf" Tomaselli
|
# Copyright (C) 2008-2017 Salvo "LtWorf" Tomaselli
|
||||||
#
|
#
|
||||||
# Relational is free software: you can redistribute it and/or modify
|
# Relational is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -28,6 +28,9 @@ from relational_gui import surveyForm
|
|||||||
from relational_gui import maingui
|
from relational_gui import maingui
|
||||||
|
|
||||||
|
|
||||||
|
version = ''
|
||||||
|
|
||||||
|
|
||||||
class relForm(QtWidgets.QMainWindow):
|
class relForm(QtWidgets.QMainWindow):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -24,6 +24,9 @@ from PyQt5 import QtWidgets
|
|||||||
from relational import maintenance
|
from relational import maintenance
|
||||||
|
|
||||||
|
|
||||||
|
version = ''
|
||||||
|
|
||||||
|
|
||||||
class surveyForm (QtWidgets.QWidget):
|
class surveyForm (QtWidgets.QWidget):
|
||||||
|
|
||||||
'''This class is the form used for the survey, needed to intercept the events.
|
'''This class is the form used for the survey, needed to intercept the events.
|
||||||
|
@ -35,6 +35,9 @@ COLOR_GREEN = 0x00ff00
|
|||||||
|
|
||||||
TTY = os.isatty(0) and os.isatty(1)
|
TTY = os.isatty(0) and os.isatty(1)
|
||||||
|
|
||||||
|
version = ''
|
||||||
|
|
||||||
|
|
||||||
def printtty(*args, **kwargs):
|
def printtty(*args, **kwargs):
|
||||||
'''
|
'''
|
||||||
Prints only if stdout and stdin are a tty
|
Prints only if stdout and stdin are a tty
|
||||||
|
Loading…
x
Reference in New Issue
Block a user