rename variables to be more consistent

I changed regex_match_revision to be regex_revision_match so that it matches
the way that the other revisions are named so that they are all of the form:
regex_<thing_being_matched_again>_<variable>

I made the same change for comments.
This commit is contained in:
Benjamin Mako Hill 2023-04-29 11:44:48 -07:00
parent 2ff4d60613
commit 9dcd337315

18
wikiq
View File

@ -196,7 +196,7 @@ class RegexPair(object):
class WikiqParser(): class WikiqParser():
def __init__(self, input_file, output_file, regex_match_revision, regex_revision_label, regex_revision_output_count, regex_match_comment, regex_comment_label, regex_comment_output_count, collapse_user=False, persist=None, urlencode=False, namespaces = None, revert_radius=15): def __init__(self, input_file, output_file, regex_revision_match, regex_revision_label, regex_revision_output_count, regex_comment_match, regex_comment_label, regex_comment_output_count, collapse_user=False, persist=None, urlencode=False, namespaces = None, revert_radius=15):
""" """
Parameters: Parameters:
persist : what persistence method to use. Takes a PersistMethod value persist : what persistence method to use. Takes a PersistMethod value
@ -215,10 +215,10 @@ class WikiqParser():
else: else:
self.namespace_filter = None self.namespace_filter = None
self.regex_revision_pairs = self.make_matchmake_pairs(regex_match_revision, regex_revision_label) self.regex_revision_pairs = self.make_matchmake_pairs(regex_revision_match, regex_revision_label)
self.regex_revision_output_count = regex_revision_output_count self.regex_revision_output_count = regex_revision_output_count
self.regex_comment_pairs = self.make_matchmake_pairs(regex_match_comment, regex_comment_label) self.regex_comment_pairs = self.make_matchmake_pairs(regex_comment_match, regex_comment_label)
self.regex_comment_output_count = regex_comment_output_count self.regex_comment_output_count = regex_comment_output_count
def make_matchmake_pairs(self, patterns, labels): def make_matchmake_pairs(self, patterns, labels):
@ -503,7 +503,7 @@ parser.add_argument('-rr',
default=15, default=15,
help="Number of edits to check when looking for reverts (default: 15)") help="Number of edits to check when looking for reverts (default: 15)")
parser.add_argument('-RP', '--revision-pattern', dest="regex_match_revision", default=None, type=str, action='append', parser.add_argument('-RP', '--revision-pattern', dest="regex_revision_match", default=None, type=str, action='append',
help="The regular expression to search for in revision text. The regex must be surrounded by quotes.") help="The regular expression to search for in revision text. The regex must be surrounded by quotes.")
parser.add_argument('-RPl', '--revision-pattern-label', dest="regex_revision_label", default=None, type=str, action='append', parser.add_argument('-RPl', '--revision-pattern-label', dest="regex_revision_label", default=None, type=str, action='append',
@ -512,7 +512,7 @@ parser.add_argument('-RPl', '--revision-pattern-label', dest="regex_revision_lab
parser.add_argument('-RPc', '--revision-pattern-count', dest="regex_revision_output_count", action='store_true', parser.add_argument('-RPc', '--revision-pattern-count', dest="regex_revision_output_count", action='store_true',
help="If present, this will cause the revision patterns to return counts of the number of matches instead of the text of the matches themselves. It will affect all revision patterns.") help="If present, this will cause the revision patterns to return counts of the number of matches instead of the text of the matches themselves. It will affect all revision patterns.")
parser.add_argument('-CP', '--comment-pattern', dest="regex_match_comment", default=None, type=str, action='append', parser.add_argument('-CP', '--comment-pattern', dest="regex_comment_match", default=None, type=str, action='append',
help="The regular expression to search for in comments of revisions.") help="The regular expression to search for in comments of revisions.")
parser.add_argument('-CPl', '--comment-pattern-label', dest="regex_comment_label", default=None, type=str, action='append', parser.add_argument('-CPl', '--comment-pattern-label', dest="regex_comment_label", default=None, type=str, action='append',
@ -564,10 +564,10 @@ if len(args.dumpfiles) > 0:
urlencode=args.urlencode, urlencode=args.urlencode,
namespaces=namespaces, namespaces=namespaces,
revert_radius=args.revert_radius, revert_radius=args.revert_radius,
regex_match_revision = args.regex_match_revision, regex_revision_match = args.regex_revision_match,
regex_revision_label = args.regex_revision_label, regex_revision_label = args.regex_revision_label,
regex_revision_output_count = args.regex_revision_output_count, regex_revision_output_count = args.regex_revision_output_count,
regex_match_comment = args.regex_match_comment, regex_comment_match = args.regex_comment_match,
regex_comment_label = args.regex_comment_label, regex_comment_label = args.regex_comment_label,
regex_comment_output_count = args.regex_comment_output_count) regex_comment_output_count = args.regex_comment_output_count)
@ -585,10 +585,10 @@ else:
urlencode=args.urlencode, urlencode=args.urlencode,
namespaces=namespaces, namespaces=namespaces,
revert_radius=args.revert_radius, revert_radius=args.revert_radius,
regex_match_revision = args.regex_match_revision, regex_revision_match = args.regex_revision_match,
regex_revision_label = args.regex_revision_label, regex_revision_label = args.regex_revision_label,
regex_revision_output_count = args.regex_revision_output_count, regex_revision_output_count = args.regex_revision_output_count,
regex_match_comment = args.regex_match_comment, regex_comment_match = args.regex_comment_match,
regex_comment_label = args.regex_comment_label, regex_comment_label = args.regex_comment_label,
regex_comment_output_count = args.regex_comment_output_count) regex_comment_output_count = args.regex_comment_output_count)