Skip to content

Commit

Permalink
Fix pep8 W605 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
JarrettSJohnson committed Dec 21, 2023
1 parent 125054d commit c3e2983
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions modules/chempy/sdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
class SDFRec:

def __init__(self,sdflist):
getkee = re.compile("^>\s+<([^>]*)>")
gettag = re.compile("^>\s+<[^>]*>\s+\((.*)\)")
getkee = re.compile(r"^>\s+<([^>]*)>")
gettag = re.compile(r"^>\s+<[^>]*>\s+\((.*)\)")
ll = len(sdflist)
if ll<4:
print(" SDFRec: invalid SDF record format #1")
Expand Down
4 changes: 2 additions & 2 deletions modules/pmg_tk/skins/normal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ def file_save2(self, sels, multiple_files_flag, state_flag):
# _state004
inter = "_state" + str(stateSave).zfill(len(str(s))+1)
# g either MATCHES *.pdb or not. If so, save, name_stateXYZ.pdb
g = re.search("(.*)(\..*)$", save_file)
g = re.search(r"(.*)(\..*)$", save_file)
if g!=None:
# 1PDB_state004.pdb
save_file = g.groups()[0] + inter + g.groups()[1]
Expand Down Expand Up @@ -889,7 +889,7 @@ def file_run(self):
])
if len(ofile):
self.__script__ = ofile
if re.search("\.pym*$|\.PYM*$",ofile):
if re.search(r"\.pym*$|\.PYM*$",ofile):
self.cmd.do("run "+ofile);
else:
self.cmd.do("@"+ofile);
Expand Down
8 changes: 4 additions & 4 deletions modules/pymol/internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,12 @@ def _mpng(prefix, first=-1, last=-1, preserve=0, modal=0,
try:
_self.lock(_self)
fname = prefix
if re.search("[0-9]*\.png$",fname): # remove numbering, etc.
fname = re.sub("[0-9]*\.png$","",fname)
if re.search("[0-9]*\.ppm$",fname):
if re.search(r"[0-9]*\.png$",fname): # remove numbering, etc.
fname = re.sub(r"[0-9]*\.png$","",fname)
if re.search(r"[0-9]*\.ppm$",fname):
if format<0:
format = 1 # PPM
fname = re.sub("[0-9]*\.ppm$","",fname)
fname = re.sub(r"[0-9]*\.ppm$","",fname)
if format<0:
format = 0 # default = PNG
fname = cmd.exp_path(fname)
Expand Down
2 changes: 1 addition & 1 deletion modules/pymol/movie.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ def _encode(filename,first,last,preserve,


def find_exe(exe):
'''Return full path to executable or None.
r'''Return full path to executable or None.
Excludes C:\Windows\System32\convert.exe
Tests .exe extension on Unix (e.g. for legacy "mpeg_encode.exe" name).
'''
Expand Down
2 changes: 1 addition & 1 deletion modules/pymol/moving.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ def mset(specification="",frame=1,freeze=0,_self=cmd):
try:
_self.lock(_self)
output=[]
input = re.sub("\s"," ",specification)
input = re.sub(r"\s"," ",specification)
input = input.replace("x"," x");
input = input.replace("-"," -");
input = input.replace("x ","x");
Expand Down
4 changes: 2 additions & 2 deletions modules/pymol/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class SecurityException(Exception):
'|=' :1, '^=' : 1, '>>=' : 1,'<<=' : 1,
'**=':1 }

remove_lists_re = re.compile("\[[^\]]*\]")
remove_lists_re = re.compile(r"\[[^\]]*\]")

def complete_sc(st,sc,type_name,postfix, mode=0):
result = None
Expand Down Expand Up @@ -405,7 +405,7 @@ def parse_embed():
nest_securely = 1
else:
nest_securely = secure
if re.search("\.py$|\.pym$",path) is not None:
if re.search(r"\.py$|\.pym$",path) is not None:
if self.cmd._feedback(fb_module.parser,fb_mask.warnings):
print("Warning: use 'run' instead of '@' with Python files?")
layer.script = open(path,'r')
Expand Down
2 changes: 1 addition & 1 deletion modules/pymol/plugins/installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class BadInstallationFile(Exception):
pass

def get_default_user_plugin_path():
'''
r'''
User plugin directory defaults to ~/.pymol/startup on Linux and to
%APPDATA%\pymol\startup on windows.
'''
Expand Down
6 changes: 3 additions & 3 deletions modules/pymol/viewing.py
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ def chain_session(_self=cmd):
# assumes locked interpreter
r = 0
session_file = str(_self.get("session_file"))
re_pat = re.compile("[0-9]+\.")
re_pat = re.compile(r"[0-9]+\.")
if len(session_file): # find next session file, if it exists
mo = re_pat.search(session_file)
if mo is not None:
Expand All @@ -949,9 +949,9 @@ def chain_session(_self=cmd):
new_file = re_pat.sub(new_pat, session_file)
# try both PSE and PSW
if not os.path.exists(new_file):
new_file = re.sub("\.pse$",".psw",new_file,re.I)
new_file = re.sub(r"\.pse$",".psw",new_file,re.I)
if not os.path.exists(new_file):
new_file = re.sub("\.psw$",".pse",new_file,re.I)
new_file = re.sub(r"\.psw$",".pse",new_file,re.I)
if os.path.exists(new_file):
_self.do("_ cmd.load(r'''"+new_file+"''',format='psw')")
return 1
Expand Down
2 changes: 1 addition & 1 deletion modules/pymol/wizard/pseudoatom.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def __init__(self,mode='label',pos='[0.0,0.0,0.0]',_self=cmd):
Wizard.__init__(self,_self)
self.mode = mode
if mode == 'label':
self.prefix = 'Label text: \888'
self.prefix = r'Label text: \888'
self.text = ''
self.pos = pos

Expand Down

0 comments on commit c3e2983

Please sign in to comment.