Skip to content

Commit d36dd6b

Browse files
committed
Fix: Flake8 reports.
1 parent aa02b66 commit d36dd6b

File tree

5 files changed

+5
-23
lines changed

5 files changed

+5
-23
lines changed

scripts/lang_sync

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,6 @@ def setup_auth():
176176
"""
177177
Setup the authentication for connecting to Eints.
178178
"""
179-
global user_cfg
180-
181179
user, passwd = None, None
182180

183181
# Read the file if provided.
@@ -275,8 +273,6 @@ def build_url(suffix):
275273
@param suffix: Path to retrieve from, at L{UserConfig.base_url}
276274
@type suffix: C{str}
277275
"""
278-
global user_cfg
279-
280276
assert suffix[0] == "/"
281277
if user_cfg.base_url[-1] == "/":
282278
return user_cfg.base_url + suffix[1:]
@@ -420,7 +416,7 @@ def get_eints_languages():
420416
@return: Available language information for the project as returned by Eints.
421417
@rtype: C{list} of L{EintsLanguageInfo}
422418
"""
423-
global user_cfg, eints_files_cache
419+
global eints_files_cache
424420

425421
if eints_files_cache is not None:
426422
return eints_files_cache
@@ -498,7 +494,7 @@ def get_local_languages():
498494
@return: Found language files.
499495
@rtype: C{list} of L{LocalLanguageInfo}
500496
"""
501-
global user_cfg, local_files_cache
497+
global local_files_cache
502498

503499
if local_files_cache is not None:
504500
return local_files_cache
@@ -582,8 +578,6 @@ def perform_operation(op_type, lang_type, credits_handle):
582578
@param credits_handle: If available, output stream for writing credits of language file changes.
583579
@type credits_handle: C{file} or C{None}
584580
"""
585-
global user_cfg
586-
587581
if op_type == "create":
588582
assert lang_type == "project"
589583
# Project creation operation.
@@ -639,8 +633,6 @@ def perform_create_project():
639633
"""
640634
Create a new project in Eints.
641635
"""
642-
global user_cfg
643-
644636
assert user_cfg.project_desc is not None
645637

646638
if user_cfg.project_type not in KNOWN_PROJECT_TYPES:

webtranslate/rights.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ def has_access(page, roles):
118118
@return: Whether access is granted.
119119
@rtype: C{bool}
120120
"""
121-
global _table
122-
123121
if "USER" not in roles:
124122
roles = set(["SOMEONE"])
125123

webtranslate/users/development.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ def authenticate(user, pwd):
6262
@return: Whether the combination is valid (C{True} means 'valid').
6363
@rtype: C{bool}
6464
"""
65-
global _users
66-
6765
if len(pwd) == 0:
6866
return False
6967
return (user, pwd) in _users

webtranslate/users/ldap.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def init():
6363
"""
6464
Initialize the user admin system.
6565
"""
66-
global server, ldap_host
66+
global server
6767
import ldap3
6868

6969
rights.init_page_access()
@@ -89,7 +89,6 @@ def get_authentication(user, pwd):
8989
# Note that failure to authenticate is not fatal, it falls back to an 'unknown' user.
9090
groups = set()
9191
if user is not None and user != "" and pwd is not None and pwd != "":
92-
global server, ldap_basedn_users, ldap_basedn_groups
9392
import ldap3
9493

9594
try:

webtranslate/users/redmine.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def connect():
7575
@return: Whether we are connected (not 100% certain).
7676
@rtype: C{bool}
7777
"""
78-
global db_type, db_schema, db_name, db_password, db_user, db_host, db_port, db_connection
78+
global db_connection
7979

8080
if db_connection is not None:
8181
return True # Already connected.
@@ -142,7 +142,7 @@ def _do_command(cmd, parms):
142142
@return: Cursor with the result, if all went well, else C{None}
143143
@rtype: db cursor, or C{None}
144144
"""
145-
global db_type, db_schema, db_name, db_password, db_user, db_host, db_port, db_connection
145+
global db_connection
146146

147147
if db_type == "postgress":
148148
import psycopg2
@@ -176,8 +176,6 @@ def query(cmd, parms):
176176
@return: Cursor with the result, if all went well, else C{None}
177177
@rtype: db cursor, or C{None}
178178
"""
179-
global db_type, db_schema, db_name, db_password, db_user, db_host, db_port, db_connection
180-
181179
count = 0
182180
while count < 3:
183181
# Connect if not connected.
@@ -225,9 +223,6 @@ def get_authentication(user, pwd):
225223
@return: UserAuthentication object to test accesses with.
226224
@rtype: C{UserAuthentication}
227225
"""
228-
global db_type, db_schema, db_name, db_password, db_user, db_host, db_port, db_connection
229-
global owner_role, translator_roles
230-
231226
# Verify user.
232227
# Note that failure to authenticate is not fatal, it falls back to an 'unknown' user.
233228
if user is not None and user != "" and pwd is not None:

0 commit comments

Comments
 (0)