Skip to content

Commit 03ad4cf

Browse files
committed
PEP 8: At least two spaces before inline comments, https://www.python.org/dev/peps/pep-0008/#inline-comments
1 parent 82e60ff commit 03ad4cf

1 file changed

Lines changed: 50 additions & 50 deletions

File tree

rivescript/rivescript.py

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -102,27 +102,27 @@ def __init__(self, debug=False, strict=True, depth=50, log="", utf8=False):
102102
int depth: Specify the recursion depth limit.
103103
bool utf8: Enable UTF-8 support."""
104104
# Instance variables.
105-
self._debug = debug # Debug mode
106-
self._log = log # Debug log file
107-
self._utf8 = utf8 # UTF-8 mode
108-
self._strict = strict # Strict mode
109-
self._depth = depth # Recursion depth limit
110-
self._gvars = {} # 'global' variables
111-
self._bvars = {} # 'bot' variables
112-
self._subs = {} # 'sub' variables
113-
self._person = {} # 'person' variables
114-
self._arrays = {} # 'array' variables
115-
self._users = {} # 'user' variables
116-
self._freeze = {} # frozen 'user' variables
117-
self._includes = {} # included topics
118-
self._lineage = {} # inherited topics
119-
self._handlers = {} # Object handlers
120-
self._objlangs = {} # Languages of objects used
121-
self._topics = {} # Main reply structure
122-
self._thats = {} # %Previous reply structure
123-
self._sorted = {} # Sorted buffers
124-
self._syntax = {} # Syntax tracking (filenames & line no.'s)
125-
self._regexc = { # Precomputed regexes for speed optimizations.
105+
self._debug = debug # Debug mode
106+
self._log = log # Debug log file
107+
self._utf8 = utf8 # UTF-8 mode
108+
self._strict = strict # Strict mode
109+
self._depth = depth # Recursion depth limit
110+
self._gvars = {} # 'global' variables
111+
self._bvars = {} # 'bot' variables
112+
self._subs = {} # 'sub' variables
113+
self._person = {} # 'person' variables
114+
self._arrays = {} # 'array' variables
115+
self._users = {} # 'user' variables
116+
self._freeze = {} # frozen 'user' variables
117+
self._includes = {} # included topics
118+
self._lineage = {} # inherited topics
119+
self._handlers = {} # Object handlers
120+
self._objlangs = {} # Languages of objects used
121+
self._topics = {} # Main reply structure
122+
self._thats = {} # %Previous reply structure
123+
self._sorted = {} # Sorted buffers
124+
self._syntax = {} # Syntax tracking (filenames & line no.'s)
125+
self._regexc = { # Precomputed regexes for speed optimizations.
126126
"trigger": {},
127127
"subs": {},
128128
"person": {},
@@ -216,21 +216,21 @@ def _parse(self, fname, code):
216216
self._say("Parsing code")
217217

218218
# Track temporary variables.
219-
topic = 'random' # Default topic=random
220-
lineno = 0 # Line numbers for syntax tracking
221-
comment = False # In a multi-line comment
222-
inobj = False # In an object
223-
objname = '' # The name of the object we're in
224-
objlang = '' # The programming language of the object
225-
objbuf = [] # Object contents buffer
226-
ontrig = '' # The current trigger
227-
repcnt = 0 # Reply counter
228-
concnt = 0 # Condition counter
229-
isThat = '' # Is a %Previous trigger
219+
topic = 'random' # Default topic=random
220+
lineno = 0 # Line numbers for syntax tracking
221+
comment = False # In a multi-line comment
222+
inobj = False # In an object
223+
objname = '' # The name of the object we're in
224+
objlang = '' # The programming language of the object
225+
objbuf = [] # Object contents buffer
226+
ontrig = '' # The current trigger
227+
repcnt = 0 # Reply counter
228+
concnt = 0 # Condition counter
229+
isThat = '' # Is a %Previous trigger
230230

231231
# Local (file scoped) parser options.
232232
local_options = dict(
233-
concat="none", # Concat mode for ^Continue command
233+
concat="none", # Concat mode for ^Continue command
234234
)
235235

236236
# Read each line.
@@ -760,7 +760,7 @@ def deparse(self):
760760

761761
# Topic Triggers.
762762
for topic in self._topics:
763-
dest = {} # Where to place the topic info
763+
dest = {} # Where to place the topic info
764764

765765
if topic == "__begin__":
766766
# Begin block.
@@ -777,7 +777,7 @@ def deparse(self):
777777

778778
# %Previous's.
779779
for topic in self._thats:
780-
dest = {} # Where to place the topic info
780+
dest = {} # Where to place the topic info
781781

782782
if topic == "__begin__":
783783
# Begin block.
@@ -876,7 +876,7 @@ def write(self, fh, deparsed=None):
876876
if topic == "random" and done_random: continue
877877
if topic == "random": done_random = True
878878

879-
tagged = False # Used > topic tag
879+
tagged = False # Used > topic tag
880880

881881
if topic != "random" or topic in deparsed["include"] or topic in deparsed["inherit"]:
882882
tagged = True
@@ -963,7 +963,7 @@ def _write_wrapped(self, line, sep=" ", indent="", width=78):
963963
line = sep.join(buf)
964964
if len(line) > width:
965965
# Need to word wrap!
966-
words.insert(0, buf.pop()) # Undo
966+
words.insert(0, buf.pop()) # Undo
967967
lines.append(sep.join(buf))
968968
buf = []
969969
line = ""
@@ -1249,14 +1249,14 @@ def by_length(word1, word2):
12491249
def _init_sort_track(self):
12501250
"""Returns a new dict for keeping track of triggers for sorting."""
12511251
return {
1252-
'atomic': {}, # Sort by number of whole words
1253-
'option': {}, # Sort optionals by number of words
1254-
'alpha': {}, # Sort alpha wildcards by no. of words
1255-
'number': {}, # Sort number wildcards by no. of words
1256-
'wild': {}, # Sort wildcards by no. of words
1257-
'pound': [], # Triggers of just #
1258-
'under': [], # Triggers of just _
1259-
'star': [] # Triggers of just *
1252+
'atomic': {}, # Sort by number of whole words
1253+
'option': {}, # Sort optionals by number of words
1254+
'alpha': {}, # Sort alpha wildcards by no. of words
1255+
'number': {}, # Sort number wildcards by no. of words
1256+
'wild': {}, # Sort wildcards by no. of words
1257+
'pound': [], # Triggers of just #
1258+
'under': [], # Triggers of just _
1259+
'star': [] # Triggers of just *
12601260
}
12611261

12621262

@@ -1928,7 +1928,7 @@ def _reply_regexp(self, user, regexp):
19281928
regexp = regexp.replace('*', '(.+?)') # Convert * into (.+?)
19291929
regexp = regexp.replace('#', '(\d+?)') # Convert # into (\d+?)
19301930
regexp = regexp.replace('_', '(\w+?)') # Convert _ into (\w+?)
1931-
regexp = re.sub(r'\{weight=\d+\}', '', regexp) # Remove {weight} tags
1931+
regexp = re.sub(r'\{weight=\d+\}', '', regexp) # Remove {weight} tags
19321932
regexp = regexp.replace('<zerowidthstar>', r'(.*?)')
19331933

19341934
# Optionals.
@@ -2001,12 +2001,12 @@ def _precompile_regexp(self, trigger):
20012001
`<bot>`, `<get>`, `<input>/<reply>` or arrays, it can be precompiled
20022002
and save time when matching."""
20032003
if self._is_atomic(trigger):
2004-
return # Don't need a regexp for atomic triggers.
2004+
return # Don't need a regexp for atomic triggers.
20052005

20062006
# Check for dynamic tags.
20072007
for tag in ["@", "<bot", "<get", "<input", "<reply"]:
20082008
if tag in trigger:
2009-
return # Can't precompile this trigger.
2009+
return # Can't precompile this trigger.
20102010

20112011
self._regexc["trigger"][trigger] = self._reply_regexp(None, trigger)
20122012

@@ -2094,13 +2094,13 @@ def _process_tags(self, user, msg, reply, st=[], bst=[], depth=0):
20942094
# not the <set> tag, on the first pass. The second pass will get the
20952095
# <set> tag, and so on.
20962096
match = re.search(RE.tag_search, reply)
2097-
if not match: break # No remaining tags!
2097+
if not match: break # No remaining tags!
20982098

20992099
match = match.group(1)
21002100
parts = match.split(" ", 1)
21012101
tag = parts[0].lower()
21022102
data = parts[1] if len(parts) > 1 else ""
2103-
insert = "" # Result of the tag evaluation
2103+
insert = "" # Result of the tag evaluation
21042104

21052105
# Handle the tags.
21062106
if tag == "bot" or tag == "env":

0 commit comments

Comments
 (0)