make mypy happy

master
Salvo 'LtWorf' Tomaselli 2017-06-24 11:31:07 +07:00
parent 57936db6b9
commit 2d9bbf39f0
No known key found for this signature in database
GPG Key ID: B3A7CF0C801886CF
8 changed files with 24 additions and 13 deletions

@ -1,5 +1,5 @@
# 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
# it under the terms of the GNU General Public License as published by

@ -1,5 +1,5 @@
# 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
# it under the terms of the GNU General Public License as published by
@ -24,6 +24,8 @@
#
# Language definition here:
# http://ltworf.github.io/relational/grammar.html
from typing import Optional
from relational import rtypes
RELATION = 0
@ -100,8 +102,8 @@ class Node (object):
operation.
This class is used to convert an expression into python code.'''
kind = None
__hash__ = None
kind = None # type: Optional[int]
__hash__ = None # type: None
def __init__(self, expression=None):
'''Generates the tree from the tokenized expression

@ -1,5 +1,5 @@
# 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
# 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()
method.
'''
__hash__ = None
__hash__ = None # type: None
def __init__(self, filename=""):
self._readonly = False

@ -57,7 +57,7 @@ class Rstring (str):
self._autocast = rdate(self)
return self._autocast
def isInt(self):
def isInt(self) -> bool:
'''Returns true if the string represents an int number
it only considers as int numbers the strings matching
the following regexp:
@ -65,7 +65,7 @@ class Rstring (str):
'''
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
it only considers as float numbers, the strings matching
the following regexp:
@ -73,7 +73,7 @@ class Rstring (str):
'''
return Rstring.float_regexp.match(self) is not None
def isDate(self):
def isDate(self) -> bool:
'''Returns true if the string represents a date,
in the format YYYY-MM-DD. as separators '-' , '\', '/' are allowed.
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
def is_valid_relation_name(name):
def is_valid_relation_name(name: str) -> bool:
'''Checks if a name is valid for a relation.
Returns boolean'''
return re.match(RELATION_NAME_REGEXP, name) != None and not keyword.iskeyword(name)

@ -1,5 +1,5 @@
# 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
# 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:
webk = False
version = 0
version = ''
class Ui_Dialog(object):

@ -1,5 +1,5 @@
# 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
# 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
version = ''
class relForm(QtWidgets.QMainWindow):
def __init__(self):

@ -24,6 +24,9 @@ from PyQt5 import QtWidgets
from relational import maintenance
version = ''
class surveyForm (QtWidgets.QWidget):
'''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)
version = ''
def printtty(*args, **kwargs):
'''
Prints only if stdout and stdin are a tty