Permalink
Browse files

remove circular imports in msgpoll.py

  • Loading branch information...
jquast committed Jan 19, 2015
1 parent 8f5712f commit ef916784421a3bce805c0a2edb75b032744dcf44
Showing with 33 additions and 22 deletions.
  1. +3 −0 .prospector.yaml
  2. +2 −0 tox.ini
  3. +6 −7 x84/default/common.py
  4. +1 −1 x84/default/ol.py
  5. +3 −0 x84/default/profile.py
  6. +14 −11 x84/default/si.py
  7. +1 −1 x84/default/writemsg.py
  8. +2 −0 x84/fail2ban.py
  9. +1 −2 x84/msgpoll.py
View
@@ -4,6 +4,7 @@ inherits:
ignore:
- (^|/)\..+
- ^docs/
- ^x84/default/extras
test-warnings: true
@@ -45,6 +46,8 @@ pylint:
# no 'mark' member
ignored-classes: pytest
disable:
# Use % formatting in logging functions but pass the % parameters as arguments
- W1202
# Used builtin function 'map' (col 29)
- W0141
# Used * or ** magic
View
@@ -3,6 +3,8 @@ envlist = static_analysis
[testenv:static_analysis]
deps = prospector[with_everything]
-r{toxinidir}/requirements.txt
-r{toxinidir}/requirements-crypto.txt
install_command = pip install {opts} {packages}
commands = prospector \
--die-on-tool-error \
View
@@ -117,19 +117,19 @@ def show_breaker():
echo(term.move_up() + term.clear_eol)
show_breaker()
if noprompt: return
if noprompt:
return
echo(u'\r\n')
if term.width > 80:
echo(term.move_x(max(0,(term.width / 2) - 40)))
echo(term.move_x(max(0, (term.width // 2) - 40)))
echo(u'Press {enter}.'.format(
enter=colors['highlight'](u'return')))
enter=colors['highlight'](u'enter')))
inp = LineEditor(0, colors=colors).read()
def prompt_input(term, key, content=u'', sep_ok=u'::',
width=None, colors=None):
""" Prompt for and return input, up to given width and colorscheme.
"""
""" Prompt for and return input, up to given width and colorscheme. """
term = getterminal()
colors = colors or {
'highlight': term.yellow,
@@ -141,8 +141,7 @@ def prompt_input(term, key, content=u'', sep_ok=u'::',
def coerce_terminal_encoding(term, encoding):
# attempt to coerce encoding of terminal to match session.
# NOTE: duplicated in top.py
""" Coerce encoding of terminal to match session by CSI. """
echo(u'\r\n')
echo({
# ESC %G activates UTF-8 with an unspecified implementation
View
@@ -248,7 +248,7 @@ def add_oneline(session, message):
key = max([int(key) for key in udb.keys()] or [0]) + 1
udb[key] = {
'oneliner': message,
'alias': getsession().handle,
'alias': getsession().user.handle,
'bbsname': get_ini('system', 'bbsname'),
'timestamp': time.strftime('%Y-%m-%d %H:%M:%S'),
}
View
@@ -279,6 +279,9 @@ def do_command(term, session, inp, fields, tgt_user, point):
# return False if no field matches this key
return False
# pylint: disable=W0631
# Using possibly undefined loop variable 'field'
# TODO: we could probably stand to do a bit of a better job of detecting
# screen resizes and providing ^L full-screen refresh during the remainder
# of this procedure ... It would require quite the refactor, though.
View
@@ -1,4 +1,4 @@
""" System info for x/84 BBS, https://github.com/jquast/x84 """
""" System info script for x/84. """
def main():
@@ -16,18 +16,21 @@ def main():
session, term = getsession(), getterminal()
session.activity = 'System Info'
artfile = os.path.join(os.path.dirname(__file__), 'art', 'plant.ans',)
# pylint: disable=W0633
# Attempting to unpack a non-sequence defined at line 1160 of
# platform
system, _node, release, _version, machine, _processor = platform.uname()
body = [u'AUthORS:',
body = [u'authors:',
u'Johannes Lundberg',
u'Jeffrey Quast',
u'Wijnand Modderman-Lenstra',
u'',
u'ARtWORk:',
u'spidy!food,',
u'artwork:',
u'hellbeard!impure',
u'\r\n',
u'SYStEM: %s %s %s' % (system, release, machine),
u'SOftWARE: X/84',
u'system: %s %s %s' % (system, release, machine),
u'software: x/84',
url,
u'\r\n',
(platform.python_implementation() + u' '
@@ -160,7 +163,7 @@ def erase(star_idx):
def melt():
""" Iterate through all stars and phase through melt sequence. """
def melted(yloc, xloc):
""" shift melt, delete if dissapeared. """
""" shift melt, delete if disappeared. """
melting[(yloc, xloc)] -= 1
if 0 == melting[(yloc, xloc)]:
del melting[(yloc, xloc)]
@@ -205,15 +208,15 @@ def draw_star(star, xloc, yloc):
num_stars = int(num_stars * .5)
stars = dict([(n, (random.choice('\\|/-'),
float(random.choice(range(term.width))),
float(random.choice(range(term.height)))))
for n in range(num_stars)])
float(random.choice(range(term.height)))
)) for n in range(num_stars)])
elif inp in (term.KEY_RIGHT, 'l'):
if num_stars < (term.width * term.height) / 4:
num_stars = int(num_stars * 1.5)
stars = dict([(n, (random.choice('\\|/-'),
float(random.choice(range(term.width))),
float(random.choice(range(term.height)))))
for n in range(num_stars)])
float(random.choice(range(term.height)))
)) for n in range(num_stars)])
elif inp in (u'*',) and not show_star:
show_star = True
elif inp in (u'*',) and show_star:
View
@@ -186,7 +186,7 @@ def prompt_tags(msg):
err = False
for tag in tags.copy():
if tag not in tagdb and not (
session.users.groups & moderated_groups):
session.user.groups & moderated_groups):
tags.remove(tag)
echo(msg_invalidtag % (term.bold_red(tag),))
err = True
View
@@ -81,6 +81,8 @@ def get_fail2ban_function():
def wrapper(ip):
log = logging.getLogger(__name__)
# pylint: disable=W0602
# Using global for 'BANNED_IP_LIST' but no assignment is done
global BANNED_IP_LIST, ATTEMPTED_LOGINS
now = int(time.time())
View
@@ -341,7 +341,7 @@ def main(background_daemon=True):
:rtype: None
"""
from threading import Thread
from x84.bbs import get_ini
from x84.bbs.ini import get_ini
log = logging.getLogger(__name__)
@@ -374,7 +374,6 @@ def poll(networks):
# as we are running outside of the 'engine' context, it is necessary
# for us to initialize the .ini configuration scheme so that the list
# of web modules and ssl options may be gathered.
import x84.engine
import x84.bbs.ini
x84.bbs.ini.init(*cmdline.parse_args())

0 comments on commit ef91678

Please sign in to comment.