Skip to content

Commit 8c1a3ea

Browse files
author
Pietro Giuffrida
committed
Code reformatted (black)
1 parent 836acd9 commit 8c1a3ea

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

docs/source/conf.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#
1515
import os
1616
import sys
17-
sys.path.insert(0, os.path.abspath('../../sqlantipathy/'))
1817

18+
sys.path.insert(0, os.path.abspath('../../sqlantipathy/'))
1919

2020
# -- Project information -----------------------------------------------------
2121

@@ -28,7 +28,6 @@
2828
# The full version, including alpha/beta/rc tags
2929
release = '0.1'
3030

31-
3231
# -- General configuration ---------------------------------------------------
3332

3433
# If your documentation needs a minimal Sphinx version, state it here.
@@ -73,7 +72,6 @@
7372
# The name of the Pygments (syntax highlighting) style to use.
7473
pygments_style = None
7574

76-
7775
# -- Options for HTML output -------------------------------------------------
7876

7977
# The theme to use for HTML and HTML Help pages. See the documentation for
@@ -109,7 +107,6 @@
109107
# Output file base name for HTML help builder.
110108
htmlhelp_basename = 'sqlantipathydoc'
111109

112-
113110
# -- Options for LaTeX output ------------------------------------------------
114111

115112
latex_elements = {
@@ -138,7 +135,6 @@
138135
'Pietro Giuffrida', 'manual'),
139136
]
140137

141-
142138
# -- Options for manual page output ------------------------------------------
143139

144140
# One entry per manual page. List of tuples
@@ -148,7 +144,6 @@
148144
[author], 1)
149145
]
150146

151-
152147
# -- Options for Texinfo output ----------------------------------------------
153148

154149
# Grouping the document tree into Texinfo files. List of tuples
@@ -160,7 +155,6 @@
160155
'Miscellaneous'),
161156
]
162157

163-
164158
# -- Options for Epub output -------------------------------------------------
165159

166160
# Bibliographic Dublin Core info.
@@ -178,15 +172,13 @@
178172
# A list of files that should not be packed into the epub file.
179173
epub_exclude_files = ['search.html']
180174

181-
182175
# -- Extension configuration -------------------------------------------------
183176

184177
# -- Options for todo extension ----------------------------------------------
185178

186179
# If true, `todo` and `todoList` produce output, else they produce nothing.
187180
todo_include_todos = True
188181

189-
190182
autodoc_default_options = {
191183
'members': True,
192184
# 'member-order': "bysource", # 'bysource', "alphabetical", "groupwise"
@@ -198,4 +190,4 @@
198190

199191
'inherited-members': False,
200192
'show-inheritance': False,
201-
}
193+
}

sqlantipathy/mssqlantipathy.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ def connect(self):
7777

7878
self.cursor = self.open_cursor()
7979

80-
def _get_driver(self, driver):
80+
@staticmethod
81+
def _get_driver(driver):
8182
"""Funzione che permette di ottenere il driver
8283
8384
Arguments:
@@ -109,7 +110,8 @@ def _make_connection_string(self):
109110
"""Crea stringa contenente credenziali per accedere al server MSSQL
110111
111112
Raises:
112-
ValueError: Restituisce errore se sono contemporaneamente impostate la connessione tramite username/password e autenticazione windows
113+
ValueError: Restituisce errore se sono contemporaneamente impostate
114+
la connessione tramite username/password e autenticazione windows
113115
114116
Returns:
115117
str: Restituisce stringa di connessione
@@ -248,10 +250,10 @@ def insert_one(self, table_name, values, dbname=None):
248250
"""Inserisce una nuova riga all'interno di una tabella
249251
250252
Args:
251-
dbname (str): Nome del database contenente la tabella a cui si vuole aggiugnere la riga
252253
table_name (str): Nome della tabella a cui si vuole aggiungere la riga
253-
values (dict): dizionario contenente i valori che compongono la nuova riga che si desidera aggiungere
254-
fields (list, optional): colonne a cui vengono associati i nuovi valori. Defaults to None.
254+
values (dict): dizionario contenente i valori che compongono la nuova riga che si desidera
255+
aggiungere
256+
dbname (str): Nome del database contenente la tabella a cui si vuole aggiugnere la riga
255257
"""
256258

257259
logger.debug("insert_one {0}.{1}".format(dbname, table_name))
@@ -300,8 +302,7 @@ def bulk_insertion(
300302

301303
multiple_values.append("(" + values + ")")
302304

303-
if (idx > 0 and idx % record_each_statement == 0 or
304-
idx + 1 == len_data):
305+
if idx > 0 and idx % record_each_statement == 0 or idx + 1 == len_data:
305306

306307
statement = self.bulk_insert_statement.format(
307308
table_name,
@@ -315,13 +316,12 @@ def bulk_insertion(
315316
executions += 1
316317

317318
except:
318-
logger.error("Errore a idx {0}".format(idx + 1 ))
319+
logger.error("Errore a idx {0}".format(idx + 1))
319320
logger.error("Statement {}".format(statement))
320321
logger.exception("")
321322
return 1
322323

323-
if (idx > 0 and idx % commit_every == 0 or
324-
idx + 1 == len_data):
324+
if idx > 0 and idx % commit_every == 0 or idx + 1 == len_data:
325325
logger.info(
326326
"Arrivato a {}/{} ({} executions)".format(
327327
idx, len_data, executions
@@ -393,6 +393,7 @@ def insert_many(self, data, dbname, table_name, step=5000):
393393
logger.exception("")
394394
return 1
395395

396+
@staticmethod
396397
def _handle_datetimeoffset(dto_value):
397398
# ref: https://github.com/mkleehammer/pyodbc/issues/134#issuecomment-281739794
398399
# https://github.com/mkleehammer/pyodbc/wiki/Using-an-Output-Converter-function
@@ -410,7 +411,8 @@ def _handle_datetimeoffset(dto_value):
410411
timezone(timedelta(hours=tup[7], minutes=tup[8])),
411412
)
412413

413-
def _sql_clean(self, value):
414+
@staticmethod
415+
def _sql_clean(value):
414416
"""Pulisce valori nulli e stringhe.
415417
416418
Ricevuto il valore da inserire nel db, esegue dei controlli per codificare

0 commit comments

Comments
 (0)