Skip to content

Commit

Permalink
pycodestyle: fix w605
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewrmshin committed Apr 11, 2018
1 parent 09af864 commit d73939c
Show file tree
Hide file tree
Showing 17 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion lib/python/rose/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ def add(self, config_diff):
self.unset(keys=removed_key)

def __add__(self, config_diff):
"""Return a new node by applying a ConfigNodeDiff or ConfigNode to self.
"""Apply a ConfigNodeDiff or ConfigNode to self and return new node.
Create a new node by applying either a ConfigNodeDiff or ConfigNode
instance to this ConfigNode.
Expand Down
2 changes: 1 addition & 1 deletion lib/python/rose/config_editor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with Rose. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
"""This package contains the code for the Rose config editor.
r"""This package contains the code for the Rose config editor.
This module contains constants that are only used in the config editor.
Expand Down
4 changes: 2 additions & 2 deletions lib/python/rose/config_editor/data_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@ def get_icon_path_for_config(self, config_name):
return icon_path

def get_macro_module_prefix(self, config_name):
# Return a valid module-like name for macros.
return re.sub("[^\w]", "_", config_name.strip("/")) + "/"
"""Return a valid module-like name for macros."""
return re.sub(r"[^\w]", "_", config_name.strip("/")) + "/"

def get_ignored_sections(self, namespace, get_enabled=False):
"""Return the user-ignored sections for this namespace.
Expand Down
4 changes: 2 additions & 2 deletions lib/python/rose/config_editor/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class MainController(object):
"""

RE_ARRAY_ELEMENT = re.compile('\([\d:, ]+\)$')
RE_ARRAY_ELEMENT = re.compile(r'\([\d:, ]+\)$')

def __init__(self, config_directory=None, config_objs=None,
config_obj_types=None, pluggable=False, load_updater=None,
Expand Down Expand Up @@ -1895,7 +1895,7 @@ def spawn_window(config_directory_path=None, debug_mode=False,
# for each partial namespace get the full namespace
full_namespaces = []
for namespace in initial_namespaces:
exp = re.compile('(.*%s?[^\/]+)' % (re.escape(namespace),))
exp = re.compile(r'(.*%s?[^\/]+)' % (re.escape(namespace),))
for ns in sorted(sorted(ctrl.data.namespace_meta_lookup),
key=len):
match = exp.search(ns)
Expand Down
2 changes: 1 addition & 1 deletion lib/python/rose/config_editor/ops/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def copy_section(self, config_name, section, new_section=None,
start_stack_index = len(self.undo_stack)
group = rose.config_editor.STACK_GROUP_COPY + "-" + str(time.time())
config_data = self.data.config[config_name]
section_base = re.sub('(.*)\(\w+\)$', r"\1", section)
section_base = re.sub(r'(.*)\(\w+\)$', r"\1", section)
existing_sections = []
clone_vars = []
existing_sections = config_data.vars.now.keys()
Expand Down
2 changes: 1 addition & 1 deletion lib/python/rose/config_editor/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ def generate_sub_data_panel(self, override_custom=False):
widget_dir = rose.META_DIR_WIDGET
metadata_files.sort(
lambda x, y: (widget_dir in y) - (widget_dir in x))
prefix = re.sub("[^\w]", "_", self.config_name.strip("/"))
prefix = re.sub(r"[^\w]", "_", self.config_name.strip("/"))
prefix += "/" + rose.META_DIR_WIDGET + "/"
custom_widget = rose.resource.import_object(
widget_path,
Expand Down
2 changes: 1 addition & 1 deletion lib/python/rose/config_editor/valuewidget/array/mixed.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class MixedArrayValueWidget(gtk.HBox):

BAD_COLOUR = rose.gtk.util.color_parse(
rose.config_editor.COLOUR_VARIABLE_TEXT_ERROR)
CHECK_NAME_IS_ELEMENT = re.compile('.*\(\d+\)$').match
CHECK_NAME_IS_ELEMENT = re.compile(r'.*\(\d+\)$').match
TIP_ADD = 'Add array element'
TIP_DELETE = 'Remove last array element'
TIP_INVALID_ENTRY = "Invalid entry - not {0}"
Expand Down
2 changes: 1 addition & 1 deletion lib/python/rose/config_editor/valuewidget/array/row.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class RowArrayValueWidget(gtk.HBox):

BAD_COLOUR = rose.gtk.util.color_parse(
rose.config_editor.COLOUR_VARIABLE_TEXT_ERROR)
CHECK_NAME_IS_ELEMENT = re.compile('.*\(\d+\)$').match
CHECK_NAME_IS_ELEMENT = re.compile(r'.*\(\d+\)$').match
TIP_ADD = 'Add array element'
TIP_DELETE = 'Remove last array element'
TIP_INVALID_ENTRY = "Invalid entry - not {0}"
Expand Down
2 changes: 1 addition & 1 deletion lib/python/rose/formats/namelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _rec(exp):
REC_VALUE = _rec(r"\A" + RE_VALUE + r"\Z")
# Matches a repeat-value, captures count and value
RE_VALUE_REPEAT = r"(" + RE_NATURAL + r")\*(?:" + RE_VALUE + r")?"
REC_VALUE_REPEAT = _rec("\A" + RE_VALUE_REPEAT + "\Z")
REC_VALUE_REPEAT = _rec(r"\A" + RE_VALUE_REPEAT + r"\Z")
# Matches a group initialisation, captures group name
RE_GROUP_INIT = r"[^&]* &(" + RE_NAME + r")"
# Matches a group termination
Expand Down
2 changes: 1 addition & 1 deletion lib/python/rose/macro.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_cleanup(stuff_to_remove):
OPT_CONFIG_REPORT = "(opts={0})"
REC_MODIFIER = re.compile(r"\{.+\}")
REC_ID_STRIP_DUPL = re.compile(r"\([^()]+\)")
REC_ID_STRIP = re.compile('(?:\{.+\})?(?:\([^()]+\))?$')
REC_ID_STRIP = re.compile(r'(?:\{.+\})?(?:\([^()]+\))?$')
REC_ID_ELEMENT = re.compile(r"\(([^()]+)\)$")
REC_ID_SINGLE_ELEMENT = re.compile(r"\((\d+)\)$")
ID_ELEMENT_FORMAT = "{0}({1})"
Expand Down
42 changes: 21 additions & 21 deletions lib/python/rose/macros/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@


REC_EXPR_IS_THIS_RULE = re.compile(
"""(?:^.*[^\w:=]|^) (?# Break or beginning)
this (?# 'this')
(?: (?# Followed by:)
$ (?# the end)
| (?# or)
\W (?# break plus)
.* (?# anything)
( (?# Start operator)
[+*%<>=-] (?# Arithmetic)
| (?# or)
in\s (?# String)
| (?# or)
not\s (?# Logical not)
| (?# or)
and\s (?# Logical and)
| (?# or)
or\s (?# Logical or)
) (?# End operator)
.* (?# anything)
$ (?# the end)
)""", re.X)
r"""(?:^.*[^\w:=]|^) (?# Break or beginning)
this (?# 'this')
(?: (?# Followed by:)
$ (?# the end)
| (?# or)
\W (?# break plus)
.* (?# anything)
( (?# Start operator)
[+*%<>=-] (?# Arithmetic)
| (?# or)
in\s (?# String)
| (?# or)
not\s (?# Logical not)
| (?# or)
and\s (?# Logical and)
| (?# or)
or\s (?# Logical or)
) (?# End operator)
.* (?# anything)
$ (?# the end)
)""", re.X)


class RuleValueError(Exception):
Expand Down
2 changes: 1 addition & 1 deletion lib/python/rose/namelist_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from rose.opt_parse import RoseOptionParser


RE_NAME_INDEX = re.compile("^(.*)\((\d+)\)$")
RE_NAME_INDEX = re.compile(r"^(.*)\((\d+)\)$")
STD_FILE_ARG = "-"


Expand Down
14 changes: 7 additions & 7 deletions lib/python/rose/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@
import rose


RE_REAL = "[\+\-]?\d*\.?\d*(?:[de][\+\-]?\d+)?"
RE_REAL = r"[\+\-]?\d*\.?\d*(?:[de][\+\-]?\d+)?"
RE_CAPT_REAL = '(' + RE_REAL + ')'

REC_RANGE_NUM = re.compile(RE_CAPT_REAL + "$")
REC_RANGE_SPLIT = re.compile('\s*(,)\s*')
REC_RANGE_NUM = re.compile(RE_CAPT_REAL + r"$")
REC_RANGE_SPLIT = re.compile(r'\s*(,)\s*')
REC_RANGE_RANGE = re.compile(
"(" + RE_REAL + "?)" + "\s*:\s*" +
"(" + RE_REAL + "?)" +
"(?<!^:)$") # Expression can't just be a colon.
REC_FULL_URL = re.compile("^(\w+://|www\.)")
r"(" + RE_REAL + r"?)" + r"\s*:\s*" +
r"(" + RE_REAL + r"?)" +
r"(?<!^:)$") # Expression can't just be a colon.
REC_FULL_URL = re.compile(r"^(\w+://|www\.)")

# Ignored types used in rose.variable.ignored_reason,
# used by macros and user switches.
Expand Down
2 changes: 1 addition & 1 deletion lib/python/rosie/browser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with Rose. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
"""This package contains the specific Python code driving rosie go.
r"""This package contains the specific Python code driving rosie go.
This module contains constants that are only used in rosie go.
Expand Down
2 changes: 1 addition & 1 deletion lib/python/rosie/suite_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class SuiteId(object):
FORMAT_VERSION = r"/%s@%s"
SID_0 = "aa000"
SID_LEN = len(SID_0)
REC_IDX = re.compile("\A(?:(\w+)-)?(\w+)(?:/([^\@/]+))?(?:@([^\@/]+))?\Z")
REC_IDX = re.compile(r"\A(?:(\w+)-)?(\w+)(?:/([^\@/]+))?(?:@([^\@/]+))?\Z")
BRANCH_TRUNK = "trunk"
REV_HEAD = "HEAD"
svn = SvnCaller()
Expand Down
2 changes: 1 addition & 1 deletion lib/python/rosie/svn_post_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class RosieSvnPostCommitHook(object):
LEN_ID = len(ID_CHARS_LIST)
INFO_FILE = "rose-suite.info"
KNOWN_KEYS_FILE_PATH = "R/O/S/I/E/trunk/rosie-keys"
REC_COPY_INFO = re.compile("\A\s+\(from\s(\S+):r(\d+)\)\s*\Z")
REC_COPY_INFO = re.compile(r"\A\s+\(from\s(\S+):r(\d+)\)\s*\Z")
ST_ADDED = "A"
ST_DELETED = "D"
ST_MODIFIED = "M"
Expand Down
4 changes: 2 additions & 2 deletions lib/python/rosie/ws_client_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
PRINT_FORMAT_DEFAULT = "%local %suite %owner %project %title"
PRINT_FORMAT_QUIET = "%suite"

REC_COL_IN_FORMAT = re.compile("(?:^|[^%])%([\w-]+)")
DATE_TIME_FORMAT = "%FT%H:%M:%SZ"
REC_COL_IN_FORMAT = re.compile(r"(?:^|[^%])%([\w-]+)")
DATE_TIME_FORMAT = r"%FT%H:%M:%SZ"


class URLEvent(Event):
Expand Down

0 comments on commit d73939c

Please sign in to comment.