Skip to content

Commit 1756050

Browse files
committed
Fix all invalid escape chars to elimn8 py3.12 warnings on import
1 parent f34870b commit 1756050

File tree

6 files changed

+95
-95
lines changed

6 files changed

+95
-95
lines changed

cape/pycart/inputCntl.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""
1+
r"""
22
:mod:`cape.pycart.inputCntl`: Cart3D ``input.cntl`` interface
33
==============================================================
44
@@ -67,7 +67,7 @@ def __init__(self, fname="input.cntl"):
6767
# Save the file name.
6868
self.fname = fname
6969
# Split into sections.
70-
self.SplitToSections(reg="\$__([\w_]+)")
70+
self.SplitToSections(reg=r"\$__([\w_]+)")
7171

7272
# Copy the file
7373
def Copy(self, fname):
@@ -366,7 +366,7 @@ def SetNOrders(self, nOrders):
366366

367367
# Function to set the list of x-slices
368368
def SetXSlices(self, x):
369-
"""
369+
r"""
370370
Set the list of *x*-coordinates at which to form cut planes
371371
372372
:Call:
@@ -393,7 +393,7 @@ def SetXSlices(self, x):
393393

394394
# Function to set the list of x-slices
395395
def SetYSlices(self, y):
396-
"""
396+
r"""
397397
Set the list of *x*-coordinates at which to form cut planes
398398
399399
:Call:
@@ -420,7 +420,7 @@ def SetYSlices(self, y):
420420

421421
# Function to set the list of x-slices
422422
def SetZSlices(self, z):
423-
"""
423+
r"""
424424
Set the list of *x*-coordinates at which to form cut planes
425425
426426
:Call:
@@ -447,7 +447,7 @@ def SetZSlices(self, z):
447447

448448
# Function to report the line sensors
449449
def GetLineSensor(self, name):
450-
"""Get the coordinates for a line sensor
450+
r"""Get the coordinates for a line sensor
451451
452452
:Call:
453453
>>> X = IC.GetLineSensor(name)
@@ -475,7 +475,7 @@ def GetLineSensor(self, name):
475475

476476
# Function to write a line sensor
477477
def AddLineSensor(self, name, X):
478-
"""Write a line sensor
478+
r"""Write a line sensor
479479
480480
:Call:
481481
>>> IC.AddLineSensor(name, X)
@@ -506,14 +506,14 @@ def AddLineSensor(self, name, X):
506506
for x in R[:6]:
507507
line += (" %s" % x)
508508
# Regular expression of existing line sensor to search for
509-
reg = 'lineSensor\s*%s' % name
509+
reg = r'lineSensor\s*%s' % name
510510
# Write the line
511511
self.ReplaceOrAddLineToSectionSearch('Post_Processing',
512512
reg, line + "\n")
513513

514514
# Set list of line sensors
515515
def SetLineSensors(self, LS):
516-
"""Write all line sensors
516+
r"""Write all line sensors
517517
518518
:Call:
519519
>>> IC.SetLineSensors(LS)
@@ -531,7 +531,7 @@ def SetLineSensors(self, LS):
531531

532532
# Function to report the point sensors
533533
def GetPointSensor(self, name):
534-
"""Get the coordinates for a point sensor
534+
r"""Get the coordinates for a point sensor
535535
536536
:Call:
537537
>>> X = IC.GetPointSensor(name)
@@ -547,7 +547,7 @@ def GetPointSensor(self, name):
547547
* 2015-12-04 ``@ddalle``: v1.0
548548
"""
549549
# Regular expression of existing line sensor to search for
550-
reg = 'pointSensor\s*%s' % name
550+
reg = r'pointSensor\s*%s' % name
551551
# Get the line
552552
lines = self.GetLineInSectionSearch('Post_Processing', reg)
553553
# Check for a match.
@@ -559,7 +559,7 @@ def GetPointSensor(self, name):
559559

560560
# Function to write a point sensor
561561
def AddPointSensor(self, name, X):
562-
"""Write a point sensor
562+
r"""Write a point sensor
563563
564564
:Call:
565565
>>> IC.AddPointSensor(name, X)
@@ -583,14 +583,14 @@ def AddPointSensor(self, name, X):
583583
for x in X[:3]:
584584
line += (" %s" % x)
585585
# Regular expression of existing line sensor to search for
586-
reg = 'pointSensor\s*%s' % name
586+
reg = r'pointSensor\s*%s' % name
587587
# Write the line
588588
self.ReplaceOrAddLineToSectionSearch('Post_Processing',
589589
reg, line + "\n")
590590

591591
# Set list of point sensors
592592
def SetPointSensors(self, PS):
593-
"""Write all point sensors
593+
r"""Write all point sensors
594594
595595
:Call:
596596
>>> IC.SetPointSensors(PS)
@@ -609,7 +609,7 @@ def SetPointSensors(self, PS):
609609

610610
# Function to set the reference area(s)
611611
def SetReferenceArea(self, A):
612-
"""Set all moment reference points according to an input :class:`dict`
612+
r"""Set all moment reference points according to an input :class:`dict`
613613
614614
:Call:
615615
>>> IC.SetReferenceArea(A)
@@ -633,7 +633,7 @@ def SetReferenceArea(self, A):
633633

634634
# Function to set a single reference area
635635
def SetSingleReferenceArea(self, Aref, compID='all'):
636-
"""
636+
r"""
637637
Set the reference area in an :file:`input.cntl` file.
638638
639639
:Call:
@@ -651,14 +651,14 @@ def SetSingleReferenceArea(self, Aref, compID='all'):
651651
* 2014-10-08 ``@ddalle``: Demoted to "single"
652652
"""
653653
# Regular expression for this line.
654-
reg = 'Reference_Area.*%s\s*$' % compID
654+
reg = r'Reference_Area.*%s\s*$' % compID
655655
# Replace or add the line.
656656
self.ReplaceOrAddLineToSectionSearch('Force_Moment_Processing',
657657
reg, 'Reference_Area %s %s\n' % (Aref, compID))
658658

659659
# Function to set the reference length(s)
660660
def SetReferenceLength(self, L):
661-
"""Set all moment reference points according to an input :class:`dict`
661+
r"""Set all moment reference points according to an input :class:`dict`
662662
663663
:Call:
664664
>>> IC.SetReferenceLength(L)
@@ -682,7 +682,7 @@ def SetReferenceLength(self, L):
682682

683683
# Function to set a single reference length
684684
def SetSingleReferenceLength(self, Lref, compID='all'):
685-
"""Set the reference length in an :file:`input.cntl` file
685+
r"""Set the reference length in an :file:`input.cntl` file
686686
687687
:Call:
688688
>>> IC.SetSingleReferenceLength(Lref)
@@ -699,7 +699,7 @@ def SetSingleReferenceLength(self, Lref, compID='all'):
699699
* 2014-10-08 ``@ddalle``: Demoted to "single"
700700
"""
701701
# Regular expression for this line.
702-
reg = 'Reference_Length.*%s\s*$' % compID
702+
reg = r'Reference_Length.*%s\s*$' % compID
703703
# Replace or add the line.
704704
self.ReplaceOrAddLineToSectionSearch('Force_Moment_Processing',
705705
reg, 'Reference_Length %s %s\n' % (Lref, compID))
@@ -738,7 +738,7 @@ def SetMomentPoint(self, xMRP, comps=None):
738738

739739
# Function to a single moment reference point
740740
def SetSingleMomentPoint(self, x, compID='all'):
741-
"""Set the moment reference point in an :file:`input.cntl` file
741+
r"""Set the moment reference point in an :file:`input.cntl` file
742742
743743
:Call:
744744
>>> IC.SetSingleMomentPoint(x)
@@ -755,7 +755,7 @@ def SetSingleMomentPoint(self, x, compID='all'):
755755
* 2014-10-08 ``@ddalle``: Downgraded to "single" function
756756
"""
757757
# Regular expression for this line.
758-
reg = 'Moment_Point.*%s\s*$' % compID
758+
reg = r'Moment_Point.*%s\s*$' % compID
759759
# Form the output line.
760760
line = 'Moment_Point '
761761
# Loop through entries of x.
@@ -769,7 +769,7 @@ def SetSingleMomentPoint(self, x, compID='all'):
769769

770770
# Function to get a reference point
771771
def GetSingleMomentPoint(self, compID='all'):
772-
"""Get the moment reference point of a component in :file:`input.cntl`
772+
r"""Get the moment reference point of a component in :file:`input.cntl`
773773
774774
:Call:
775775
>>> x = IC.GetSingleMomentPoint(compID)
@@ -785,7 +785,7 @@ def GetSingleMomentPoint(self, compID='all'):
785785
* 2015-03-02 ``@ddalle``: v1.0
786786
"""
787787
# Regular expression to look for.
788-
reg = 'Moment_Point.*%s\s*$' % compID
788+
reg = r'Moment_Point.*%s\s*$' % compID
789789
# Find the line.
790790
line = self.GetLineInSectionSearch('Force_Moment_Processing', reg, 1)
791791
# Check for a match.
@@ -804,7 +804,7 @@ def GetSingleMomentPoint(self, compID='all'):
804804

805805
# Function to set a surface boundary condition (e.g. nozzle condition)
806806
def SetSurfBC(self, compID, u):
807-
"""
807+
r"""
808808
Set a surface boundary condition, for example on a nozzle surface
809809
810810
:Call:
@@ -824,7 +824,7 @@ def SetSurfBC(self, compID, u):
824824
"""
825825
# Line starts with "SurfBC", has some amount of white space, and then
826826
# has the component number.
827-
reg = 'SurfBC\s+' + str(compID) + '\s'
827+
reg = r'SurfBC\s+' + str(compID) + '\s'
828828
# Create the output line.
829829
if u is None:
830830
# Turn off the BC; make it a commented line
@@ -839,7 +839,7 @@ def SetSurfBC(self, compID, u):
839839

840840
# Function to set an output functional force
841841
def SetOutputForce(self, Name, **kwargs):
842-
"""Request a force be added to the output functional
842+
r"""Request a force be added to the output functional
843843
844844
:Call:
845845
>>> IC.SetOutputForce(Name, **kwargs)
@@ -867,7 +867,7 @@ def SetOutputForce(self, Name, **kwargs):
867867
* 2014-11-19 ``@ddalle``: v1.0
868868
"""
869869
# Line looks like "optForce CY_L 1 0 0 1 0. 1. 0 Core"
870-
reg = 'optForce\s+' + str(Name) + '\s'
870+
reg = r'optForce\s+' + str(Name) + '\s'
871871
# Process the other inputs (with defaults)
872872
Force = kwargs.get('force', 0)
873873
Frame = kwargs.get('frame', 1)
@@ -890,7 +890,7 @@ def SetOutputForce(self, Name, **kwargs):
890890

891891
# Function to set an output functional force
892892
def SetOutputMoment(self, Name, **kwargs):
893-
"""Request a force be added to the output functional
893+
r"""Request a force be added to the output functional
894894
895895
:Call:
896896
>>> IC.SetOutputMoment(Name, **kwargs)
@@ -920,7 +920,7 @@ def SetOutputMoment(self, Name, **kwargs):
920920
* 2014-11-19 ``@ddalle``: v1.0
921921
"""
922922
# Line looks like "optForce CY_L 1 0 0 1 0. 1. 0 Core"
923-
reg = 'optMoment_Point\s+' + str(Name) + '\s'
923+
reg = r'optMoment_Point\s+' + str(Name) + r'\s'
924924
# Process the other inputs (with defaults)
925925
Index = kwargs.get('index', 0)
926926
Force = kwargs.get('moment', 0)
@@ -945,7 +945,7 @@ def SetOutputMoment(self, Name, **kwargs):
945945

946946
# Function to set an output functional line or point sensor
947947
def SetOutputSensor(self, Name, **kwargs):
948-
"""Request a line or point sensor
948+
r"""Request a line or point sensor
949949
950950
:Call:
951951
>>> IC.SetOutputSensor(Name, **kwargs)
@@ -964,7 +964,7 @@ def SetOutputSensor(self, Name, **kwargs):
964964
* 2015-05-06 ``@ddalle``: v1.0
965965
"""
966966
# Line looks like "optSensor Line1 0 2 0.0 1.0 0"
967-
reg = 'optSensor\s+' + str(Name) + '\s'
967+
reg = r'optSensor\s+' + str(Name) + r'\s'
968968
# Process the other inputs (with defaults)
969969
Weight = kwargs.get('weight', 1.0)
970970
Target = kwargs.get('target', 0.0)
@@ -984,7 +984,7 @@ def SetOutputSensor(self, Name, **kwargs):
984984

985985
# Function to get Cart3D to report the forces on several components
986986
def RequestForce(self, comps):
987-
"""Request the force coefficients on a component or list of components
987+
r"""Request the force coefficients on a component or list of components
988988
989989
:Call:
990990
>>> IC.RequestForce(comps)
@@ -1011,7 +1011,7 @@ def RequestForce(self, comps):
10111011

10121012
# Function to get Cart3D to report the forces on a component
10131013
def RequestSingleForce(self, compID):
1014-
"""Request the force coefficients on a particular component
1014+
r"""Request the force coefficients on a particular component
10151015
10161016
:Call:
10171017
>>> IC.RequestSingleForce(compID)
@@ -1028,15 +1028,15 @@ def RequestSingleForce(self, compID):
10281028
* 2014-12-08 ``@ddalle``: Renamed from `RequestForce`
10291029
"""
10301030
# Line looks like "Force $compID", but arbitrary white space.
1031-
reg = 'Force\s+' + str(compID) + '$'
1031+
reg = r'Force\s+' + str(compID) + '$'
10321032
# Replace the line or add it if necessary.
10331033
self.ReplaceOrAddLineToSectionSearch('Force_Moment_Processing',
10341034
reg, 'Force %s\n' % compID)
10351035
return None
10361036

10371037
# Function to get Cart3D to report the moments on a component
10381038
def RequestMoment(self, compID, MRP=None):
1039-
"""Request the moment coefficients on a particular component.
1039+
r"""Request the moment coefficients on a particular component.
10401040
10411041
:Call:
10421042
>>> IC.RequestMoment(compID, MRP)
@@ -1072,7 +1072,7 @@ def RequestMoment(self, compID, MRP=None):
10721072

10731073
# Function to set Runge-Kutta inputs
10741074
def SetRungeKutta(self, RK):
1075-
"""Set the Runge-Kutta time step coefficients
1075+
r"""Set the Runge-Kutta time step coefficients
10761076
10771077
The input can be a list of lists or a string or ``None``. If it's a
10781078
string, the the function will attempt to use one of the following known

cape/pycart/pointSensor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def get_DataBookNStatsPS():
175175

176176
# Data book for group of point sensors
177177
class DBPointSensorGroup(pointSensor.DBPointSensorGroup):
178-
"""
178+
r"""
179179
Point sensor group data book
180180
181181
:Call:
@@ -769,7 +769,7 @@ def GetPointSensorIndex(self, name):
769769

770770
# Compute statistics
771771
def GetStats(self, k, nStats=1, nLast=None):
772-
"""Compute min, max, mean, and standard deviation of each quantity
772+
r"""Compute min, max, mean, and standard deviation of each quantity
773773
774774
This includes computing pressure coefficient. NaNs are reported as the
775775
standard deviation if *nStats* is 1 or 0. If the point sensor is
@@ -1032,7 +1032,7 @@ def PlotState(self, c, pt, **kw):
10321032

10331033
# Individual file point sensor
10341034
class PointSensor(object):
1035-
"""Class for individual point sensor
1035+
r"""Class for individual point sensor
10361036
10371037
:Call:
10381038
>>> PS = PointSensor(fname="pointSensors.dat", data=None)

cape/pycart/preSpecCntl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ def __init__(self, fname="preSpec.c3d.cntl"):
4949
# Save the file name.
5050
self.fname = fname
5151
# Split into sections.
52-
self.SplitToSections(reg="\$__([\w_]+)")
52+
self.SplitToSections(reg=r"\$__([\w_]+)")
5353
return None
5454

5555
# Function to add an additional BBox
5656
def AddBBox(self, n, xlim):
57-
"""
57+
r"""
5858
Add an additional bounding box to the :file:`cubes` input control file
5959
6060
:Call:
@@ -95,7 +95,7 @@ def ClearBBox(self):
9595

9696
# Function to add an additional XLev line
9797
def AddXLev(self, n, compID):
98-
"""
98+
r"""
9999
Add a refinement level on a component or list of components
100100
101101
:Call:

0 commit comments

Comments
 (0)