Skip to content

Commit

Permalink
add extra types and clean flake8 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
deavid committed Jun 29, 2019
1 parent 39ebb9d commit 5d018cf
Show file tree
Hide file tree
Showing 95 changed files with 607 additions and 493 deletions.
15 changes: 12 additions & 3 deletions build-pineboo-binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,21 @@ def run(args):

if target == "android-32":
try:
os.symlink("%s/../../src/bzip2-android/lib/include/bzlib.h" % os.path.abspath(os.path.join(sysroot_dir)), "%s/include/bzlib.h" % sysroot_dir)
os.symlink("%s/../../src/bzip2-android/lib/lib/armeabi/libbz2.so" % os.path.abspath(os.path.join(sysroot_dir)), "%s/lib/libbz2.so" % sysroot_dir)
os.symlink(
"%s/../../src/bzip2-android/lib/include/bzlib.h" % os.path.abspath(os.path.join(sysroot_dir)),
"%s/include/bzlib.h" % sysroot_dir,
)
os.symlink(
"%s/../../src/bzip2-android/lib/lib/armeabi/libbz2.so" % os.path.abspath(os.path.join(sysroot_dir)),
"%s/lib/libbz2.so" % sysroot_dir,
)
# os.symlink("%s/../../src/zlib-android/libz.a" % os.path.abspath(os.path.join(sysroot_dir)), "%s/lib/libz.a" % sysroot_dir)
# os.symlink("%s/../../src/zlib-android/zconf.h" % os.path.abspath(os.path.join(sysroot_dir)), "%s/include/zconf.h" % sysroot_dir)
# os.symlink("%s/../../src/zlib-android/zlib.h" % os.path.abspath(os.path.join(sysroot_dir)), "%s/include/zlib.h" % sysroot_dir)
os.symlink("%s/../../src/sqlite3-android/build/sqlite3.h" % os.path.abspath(os.path.join(sysroot_dir)), "%s/include/sqlite3.h" % sysroot_dir)
os.symlink(
"%s/../../src/sqlite3-android/build/sqlite3.h" % os.path.abspath(os.path.join(sysroot_dir)),
"%s/include/sqlite3.h" % sysroot_dir,
)
os.symlink(
"%s/../../src/sqlite3-android/obj/local/armeabi/libsqlite3.so" % os.path.abspath(os.path.join(sysroot_dir)),
"%s/lib/libsqlite3.so" % sysroot_dir,
Expand Down
3 changes: 2 additions & 1 deletion pineboolib/application/proxy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Callable
import logging
from typing import Any


class DelayedObjectProxyLoader(object):
Expand Down Expand Up @@ -28,7 +29,7 @@ def __load(self):
self.loaded_obj = self._obj(*self._args, **self._kwargs)
return self.loaded_obj

def __getattr__(self, name): # Solo se lanza si no existe la propiedad.
def __getattr__(self, name: str) -> Any: # Solo se lanza si no existe la propiedad.
"""
Retorna una función buscada
@param name. Nombre del la función buscada
Expand Down
1 change: 1 addition & 0 deletions pineboolib/application/utils/check_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pineboolib.core.utils.utils_base import version_check, is_deployed

from typing import Dict

logger = logging.getLogger("application.utils.check_dependencies")
DEPENDENCIES_CHECKED = {}

Expand Down
1 change: 1 addition & 0 deletions pineboolib/application/utils/convert_flaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from pineboolib.application.xmlaction import XMLAction
from pineboolib.fllegacy.flaction import FLAction

logger = logging.getLogger("application.utils.convert_flaction")


Expand Down
2 changes: 2 additions & 0 deletions pineboolib/application/utils/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

from PyQt5.QtCore import QSize
from typing import Dict, Optional, Union


def saveGeometryForm(name: str, geo: QSize) -> None:
"""
Guarda la geometría de una ventana
Expand Down
1 change: 1 addition & 0 deletions pineboolib/application/utils/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pineboolib

from typing import Optional

logger = logging.getLogger(__name__)


Expand Down
1 change: 1 addition & 0 deletions pineboolib/core/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from typing import Callable

from typing import Any

logger = logging.getLogger(__name__)
MSG_EMITTED = {}
CLEAN_REGEX = re.compile(r"\s*object\s+at\s+0x[0-9a-zA-Z]{6,38}", re.VERBOSE)
Expand Down
1 change: 1 addition & 0 deletions pineboolib/core/parsetable.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from .utils.utils_base import getTableObj

from pineboolib.core.utils.utils_base import Struct

logger = logging.getLogger("core.parsetable")


Expand Down
1 change: 1 addition & 0 deletions pineboolib/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from PyQt5.QtCore import QSettings, QSize

from typing import Dict, List, Optional, Union

logger = logging.getLogger("core.settings")


Expand Down
12 changes: 7 additions & 5 deletions pineboolib/fllegacy/aqsobjects/aqboolflagstate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Any

# -*- coding: utf-8 -*-


Expand All @@ -13,11 +15,11 @@ class AQBoolFlagStateList(object):
def __init__(self):
self.data_list_ = []

def append(self, data=None):
def append(self, data=None) -> None:
if data is not None:
self.data_list_.append(data)

def pushOnTop(self, data):
def pushOnTop(self, data) -> None:

data_list_new = []
data_list_new.append(data)
Expand All @@ -26,14 +28,14 @@ def pushOnTop(self, data):

self.data_list_ = data_list_new

def erase(self, data):
def erase(self, data) -> None:

for d in self.data_list_:
if d == data:
del d
break

def find(self, data):
def find(self, data) -> Any:
ret_ = None
for d in self.data_list_:
if d.modifier_ == data:
Expand All @@ -42,5 +44,5 @@ def find(self, data):

return ret_

def current(self):
def current(self) -> Any:
return self.data_list_[0]
13 changes: 8 additions & 5 deletions pineboolib/fllegacy/flaccesscontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@


from typing import List
from typing import Any


class FLAccessControl(object):

"""
Expand Down Expand Up @@ -112,7 +115,7 @@ def name(self) -> str:
@return Cadena de texto con el nombre (login) del usuario.
"""

def user(self):
def user(self) -> Any:
return self.user_

"""
Expand All @@ -139,7 +142,7 @@ def setName(self, n: str) -> None:
@param u Nombre (login) del usuario.
"""

def setUser(self, u):
def setUser(self, u) -> None:
self.user_ = u

"""
Expand Down Expand Up @@ -174,7 +177,7 @@ def clear(self) -> None:
@return Cadena de texto que identifica al tipo de objeto general de la regla, p.e.: "table".
"""

def type(self):
def type(self) -> str:
return ""

"""
Expand All @@ -183,7 +186,7 @@ def type(self):
@param e Elemento correspondiente al nodo DOM que se utilizará para definir la regla.
"""

def set(self, e):
def set(self, e) -> None:
if not e:
return

Expand Down Expand Up @@ -224,7 +227,7 @@ def set(self, e):
@param d Documento DOM/XML donde se insertará el nodo construido a partir de la regla de control de acceso.
"""

def get(self, d):
def get(self, d) -> None:
if not self.type() or d is None:
return

Expand Down
4 changes: 3 additions & 1 deletion pineboolib/fllegacy/flaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@


from typing import Optional


class FLAction(object):

"""
Expand Down Expand Up @@ -123,7 +125,7 @@ def setCaption(self, c: str) -> None:
Establece la descripción
"""

def setDescription(self, d):
def setDescription(self, d) -> None:
self.description_ = d

"""
Expand Down
2 changes: 2 additions & 0 deletions pineboolib/fllegacy/flcompoundkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@


from pineboolib.fllegacy.flfieldmetadata import FLFieldMetaData


class FLCompoundKey(object):

"""
Expand Down
4 changes: 2 additions & 2 deletions pineboolib/fllegacy/flfieldmetadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def inicializeNewFLFieldMetaData(
rX: Optional[str] = None,
vG: bool = True,
gen: bool = True,
iCK: bool = False
iCK: bool = False,
) -> None:
self.d = FLFieldMetaDataPrivate(
n, a, aN, isPrimaryKey, t, length_, c, v, ed, pI, pD, iNX, uNI, coun, defValue, oT, rX, vG, gen, iCK
Expand Down Expand Up @@ -925,7 +925,7 @@ def inicialize(
rX: Optional[str],
vG: bool,
gen: bool,
iCK: bool
iCK: bool,
) -> None:
self.fieldName_ = n.lower()
self.alias_ = a
Expand Down
1 change: 1 addition & 0 deletions pineboolib/fllegacy/flmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from PyQt5.QtXml import QDomElement
from pineboolib.pnconnection import PNConnection
from typing import Optional, Union

logger = logging.getLogger(__name__)

# FIXME: This class is emulating Eneboo, but the way is set up it is a core part of Pineboo now.
Expand Down
5 changes: 4 additions & 1 deletion pineboolib/fllegacy/flmodulesstaticloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@ def delDir(self):
return

if QtWidgets.QMessageBox.No == QtWidgets.QMessageBox.warning(
None, self.tr("Borrar registro"), self.tr("El registro activo será borrado. ¿ Está seguro ?"), QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.No
None,
self.tr("Borrar registro"),
self.tr("El registro activo será borrado. ¿ Está seguro ?"),
QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.No,
):
return

Expand Down
8 changes: 6 additions & 2 deletions pineboolib/fllegacy/flreportviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ def exportFileCSVData(self):
return

util = FLUtil()
fileName = QFileDialog.getSaveFileName(self, util.translate("app", "Exportar a CSV"), "", util.translate("app", "Fichero CSV (*.csv *.txt)"))
fileName = QFileDialog.getSaveFileName(
self, util.translate("app", "Exportar a CSV"), "", util.translate("app", "Fichero CSV (*.csv *.txt)")
)

if not fileName or fileName == "":
return
Expand Down Expand Up @@ -300,7 +302,9 @@ def exportToPDF(self):
return

util = FLUtil()
fileName = QFileDialog.getSaveFileName(self, util.translate("app", "Exportar a PDF"), "", util.translate("app", "Fichero PDF (*.pdf)"))
fileName = QFileDialog.getSaveFileName(
self, util.translate("app", "Exportar a PDF"), "", util.translate("app", "Fichero PDF (*.pdf)")
)

if fileName[0] == "":
return
Expand Down
2 changes: 2 additions & 0 deletions pineboolib/fllegacy/flsettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@


from typing import List, Optional, Union


class FLSettings(object):
s = settings

Expand Down
8 changes: 6 additions & 2 deletions pineboolib/fllegacy/flstylepainter.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,9 @@ def play(self, node, elm):
bcolor = self.painter_.brush().color()
pn.setColor(bcolor)
self.painter_.setPen(pn)
QtCore.QwtPainter.drawText(self.painter_, self.painter_.xFormDev(self.lastLabelRect_), self.curr_.textalign | self.tf_, self.text_)
QtCore.QwtPainter.drawText(
self.painter_, self.painter_.xFormDev(self.lastLabelRect_), self.curr_.textalign | self.tf_, self.text_
)
pn.setColor(pcolor)
self.painter_.setPen(pn)
self.lastLabelRect_.setSize(QtCore.QSize(0, 0))
Expand Down Expand Up @@ -826,7 +828,9 @@ def pathArc(self, path, pcount, rx, ry, x_axis_rotation, large_arc_flag, sweep_f
n_segs = int(math.ceil(math.fabs(th_arc / (self.Q_PI * 0.5 + 0.001))))

for i in range(n_segs):
pcount = self.pathArcSegment(path, pcount, xc, yc, th0 + i * th_arc / n_segs, th0 + (i + 1) * th_arc / n_segs, rx, ry, x_axis_rotation)
pcount = self.pathArcSegment(
path, pcount, xc, yc, th0 + i * th_arc / n_segs, th0 + (i + 1) * th_arc / n_segs, rx, ry, x_axis_rotation
)

return pcount

Expand Down
Loading

0 comments on commit 5d018cf

Please sign in to comment.