diff --git a/appCommon/Common.py b/appCommon/Common.py index ed51aff7..08c7b72a 100644 --- a/appCommon/Common.py +++ b/appCommon/Common.py @@ -1034,7 +1034,7 @@ def nearest_point(origin, points_list): :return: Nearest Point :rtype: Point """ - old_dist = np.Inf + old_dist = np.inf nearest_pt = None for pt in points_list: diff --git a/appEditors/appExcEditor.py b/appEditors/appExcEditor.py index 34a687b7..85f34982 100644 --- a/appEditors/appExcEditor.py +++ b/appEditors/appExcEditor.py @@ -2703,10 +2703,10 @@ class CopyEditorExc(FCShapeTool): geo_source = [s.geo for s in self.draw_app.get_selected()] def geo_bounds(geo: (BaseGeometry, list)): - minx = np.Inf - miny = np.Inf - maxx = -np.Inf - maxy = -np.Inf + minx = np.inf + miny = np.inf + maxx = -np.inf + maxy = -np.inf if type(geo) == list: for shp in geo: @@ -5396,10 +5396,10 @@ class AppExcEditorUI: def get_shapely_list_bounds(geometry_list): - xmin = np.Inf - ymin = np.Inf - xmax = -np.Inf - ymax = -np.Inf + xmin = np.inf + ymin = np.inf + xmax = -np.inf + ymax = -np.inf for gs in geometry_list: try: diff --git a/appEditors/appGeoEditor.py b/appEditors/appGeoEditor.py index 37b626b8..0bde596e 100644 --- a/appEditors/appGeoEditor.py +++ b/appEditors/appGeoEditor.py @@ -1764,7 +1764,7 @@ class AppGeoEditor(QtCore.QObject): """ snap_x, snap_y = (x, y) - snap_distance = np.Inf + snap_distance = np.inf # # ## Object (corner?) snap # # ## No need for the objects, just the coordinates @@ -2664,10 +2664,10 @@ class DrawToolShape(object): def bounds_rec(shape_el): if type(shape_el) is list: - minx = np.Inf - miny = np.Inf - maxx = -np.Inf - maxy = -np.Inf + minx = np.inf + miny = np.inf + maxx = -np.inf + maxy = -np.inf for k in shape_el: minx_, miny_, maxx_, maxy_ = bounds_rec(k) @@ -2937,10 +2937,10 @@ class DrawTool(object): def bounds(obj): def bounds_rec(o): if type(o) is list: - minx = np.Inf - miny = np.Inf - maxx = -np.Inf - maxy = -np.Inf + minx = np.inf + miny = np.inf + maxx = -np.inf + maxy = -np.inf for k in o: try: @@ -5086,10 +5086,10 @@ class FCCopy(FCShapeTool): geo_source = [s.geo for s in self.draw_app.get_selected()] def geo_bounds(geo: (BaseGeometry, list)): - minx = np.Inf - miny = np.Inf - maxx = -np.Inf - maxy = -np.Inf + minx = np.inf + miny = np.inf + maxx = -np.inf + maxy = -np.inf if type(geo) == list: for shp in geo: @@ -5785,10 +5785,10 @@ def poly2rings(poly): def get_shapely_list_bounds(geometry_list): - xmin = np.Inf - ymin = np.Inf - xmax = -np.Inf - ymax = -np.Inf + xmin = np.inf + ymin = np.inf + xmax = -np.inf + ymax = -np.inf for gs in geometry_list: try: diff --git a/appEditors/appGerberEditor.py b/appEditors/appGerberEditor.py index 3365abd2..c795155e 100644 --- a/appEditors/appGerberEditor.py +++ b/appEditors/appGerberEditor.py @@ -7970,10 +7970,10 @@ class TransformEditorTool(AppTool): """ def bounds_rec(lst): - minx = np.Inf - miny = np.Inf - maxx = -np.Inf - maxy = -np.Inf + minx = np.inf + miny = np.inf + maxx = -np.inf + maxy = -np.inf try: for shape in lst: @@ -7993,10 +7993,10 @@ class TransformEditorTool(AppTool): def get_shapely_list_bounds(geometry_list): - xmin = np.Inf - ymin = np.Inf - xmax = -np.Inf - ymax = -np.Inf + xmin = np.inf + ymin = np.inf + xmax = -np.inf + ymax = -np.inf for gs in geometry_list: try: diff --git a/appEditors/geo_plugins/GeoTransformationPlugin.py b/appEditors/geo_plugins/GeoTransformationPlugin.py index 012c1ecc..8f7b9bf0 100644 --- a/appEditors/geo_plugins/GeoTransformationPlugin.py +++ b/appEditors/geo_plugins/GeoTransformationPlugin.py @@ -583,10 +583,10 @@ class TransformEditorTool(AppToolEditor): """ def bounds_rec(lst): - minx = np.Inf - miny = np.Inf - maxx = -np.Inf - maxy = -np.Inf + minx = np.inf + miny = np.inf + maxx = -np.inf + maxy = -np.inf try: for shp in lst: diff --git a/appEditors/grb_plugins/GrbCommon.py b/appEditors/grb_plugins/GrbCommon.py index 78724841..c7cea8d5 100644 --- a/appEditors/grb_plugins/GrbCommon.py +++ b/appEditors/grb_plugins/GrbCommon.py @@ -120,10 +120,10 @@ class DrawTool(object): def bounds(obj): def bounds_rec(o): if type(o) is list: - minx = np.Inf - miny = np.Inf - maxx = -np.Inf - maxy = -np.Inf + minx = np.inf + miny = np.inf + maxx = -np.inf + maxy = -np.inf for k in o: try: diff --git a/appEditors/grb_plugins/GrbTransformationPlugin.py b/appEditors/grb_plugins/GrbTransformationPlugin.py index 012c1ecc..8f7b9bf0 100644 --- a/appEditors/grb_plugins/GrbTransformationPlugin.py +++ b/appEditors/grb_plugins/GrbTransformationPlugin.py @@ -583,10 +583,10 @@ class TransformEditorTool(AppToolEditor): """ def bounds_rec(lst): - minx = np.Inf - miny = np.Inf - maxx = -np.Inf - maxy = -np.Inf + minx = np.inf + miny = np.inf + maxx = -np.inf + maxy = -np.inf try: for shp in lst: diff --git a/appGUI/PlotCanvasLegacy.py b/appGUI/PlotCanvasLegacy.py index bb052cff..b849f79b 100644 --- a/appGUI/PlotCanvasLegacy.py +++ b/appGUI/PlotCanvasLegacy.py @@ -1217,7 +1217,7 @@ class PlotCanvasLegacy(QtCore.QObject): """ snap_x, snap_y = (x, y) - snap_distance = np.Inf + snap_distance = np.inf # ### Grid snap if self.app.grid_status(): diff --git a/appParsers/ParseExcellon.py b/appParsers/ParseExcellon.py index 9bf68f1b..c79b9a5d 100644 --- a/appParsers/ParseExcellon.py +++ b/appParsers/ParseExcellon.py @@ -1126,10 +1126,10 @@ class Excellon(Geometry): def bounds_rec(obj): if type(obj) is list: - minx = np.Inf - miny = np.Inf - maxx = -np.Inf - maxy = -np.Inf + minx = np.inf + miny = np.inf + maxx = -np.inf + maxy = -np.inf for k in obj: if type(k) is dict: diff --git a/appParsers/ParseFont.py b/appParsers/ParseFont.py index e24e2988..217098c8 100644 --- a/appParsers/ParseFont.py +++ b/appParsers/ParseFont.py @@ -70,7 +70,7 @@ class ParseFont: executable = '/usr/sbin/chkfontpath' if os.path.isfile(executable): data = os.popen(executable).readlines() - match = re.compile('\d+: (.+)') + match = re.compile(r'\d+: (.+)') set_lst = [] for line in data: result = match.match(line) diff --git a/appParsers/ParseGerber.py b/appParsers/ParseGerber.py index 366e4b7c..0377e287 100644 --- a/appParsers/ParseGerber.py +++ b/appParsers/ParseGerber.py @@ -194,7 +194,7 @@ class Gerber(Geometry): # optional coordinates but at least one in any order. self.circ_re = re.compile( r'^(?:G0?([23]))?(?=.*X([+-]?\d+))?(?=.*Y([+-]?\d+))' + - '?(?=.*I([+-]?\d+))?(?=.*J([+-]?\d+))?[XYIJ][^D]*(?:D0([12]))?\*$' + r'?(?=.*I([+-]?\d+))?(?=.*J([+-]?\d+))?[XYIJ][^D]*(?:D0([12]))?\*$' ) # G01/2/3 Occurring without coordinates @@ -1919,10 +1919,10 @@ class Gerber(Geometry): def bounds_rec(obj): if type(obj) is list and type(obj) is not MultiPolygon: - minx = np.Inf - miny = np.Inf - maxx = -np.Inf - maxy = -np.Inf + minx = np.inf + miny = np.inf + maxx = -np.inf + maxy = -np.inf for k in obj: if type(k) is dict: diff --git a/appParsers/ParseSVG.py b/appParsers/ParseSVG.py index fc8a4c9b..24038a24 100644 --- a/appParsers/ParseSVG.py +++ b/appParsers/ParseSVG.py @@ -447,7 +447,7 @@ def getsvggeo(node, object_type, root=None, units='MM', res=64, factor=1.0, app= else: log = logging.getLogger('base2') - kind = re.search('(?:\{.*})?(.*)$', node.tag).group(1) + kind = re.search(r'(?:\{.*})?(.*)$', node.tag).group(1) geo = [] # Recurse @@ -558,7 +558,7 @@ def getsvgtext(node, object_type, app, units='MM'): :return: List of Shapely geometry :rtype: list """ - kind = re.search('(?:\{.*})?(.*)$', node.tag).group(1) + kind = re.search(r'(?:\{.*})?(.*)$', node.tag).group(1) geo = [] # Recurse diff --git a/appPlugins/ToolDrilling.py b/appPlugins/ToolDrilling.py index 8407550b..84a124a5 100644 --- a/appPlugins/ToolDrilling.py +++ b/appPlugins/ToolDrilling.py @@ -2220,7 +2220,7 @@ class ToolDrilling(AppTool, Excellon): x_tc, y_tc = [0, 0] try: if cnc_job_obj.xy_toolchange != '': - tcxy_temp = re.sub('[()\[\]]', '', str(cnc_job_obj.xy_toolchange)) + tcxy_temp = re.sub(r'[()\[\]]', '', str(cnc_job_obj.xy_toolchange)) if tcxy_temp: x_tc, y_tc = [float(eval(a)) for a in tcxy_temp.split(",")] except Exception: diff --git a/appPlugins/ToolNCC.py b/appPlugins/ToolNCC.py index 334c02c0..5fee53c7 100644 --- a/appPlugins/ToolNCC.py +++ b/appPlugins/ToolNCC.py @@ -976,7 +976,7 @@ class NonCopperClear(AppTool, Gerber): if len(total_geo) in [0, 1]: msg = ('[ERROR_NOTCL] %s' % _("Too few polygons in the Gerber object to determine distances.")) - return msg, np.Inf + return msg, np.inf min_dict = {} idx = 1 for geo in total_geo: diff --git a/appPlugins/ToolTransform.py b/appPlugins/ToolTransform.py index aa63eadc..2acc2a21 100644 --- a/appPlugins/ToolTransform.py +++ b/appPlugins/ToolTransform.py @@ -549,10 +549,10 @@ class ToolTransform(AppTool): """ def bounds_rec(lst): - minx = np.Inf - miny = np.Inf - maxx = -np.Inf - maxy = -np.Inf + minx = np.inf + miny = np.inf + maxx = -np.inf + maxy = -np.inf try: for obj in lst: diff --git a/camlib.py b/camlib.py index 1caa49a5..be0bf645 100644 --- a/camlib.py +++ b/camlib.py @@ -774,10 +774,10 @@ class Geometry(object): def bounds_rec(obj): if type(obj) is list: - gminx = np.Inf - gminy = np.Inf - gmaxx = -np.Inf - gmaxy = -np.Inf + gminx = np.inf + gminy = np.inf + gmaxx = -np.inf + gmaxy = -np.inf for k in obj: if type(k) is dict: @@ -5290,10 +5290,10 @@ class CNCjob(Geometry): def bounds_rec(obj): if type(obj) is list: - minx = np.Inf - miny = np.Inf - maxx = -np.Inf - maxy = -np.Inf + minx = np.inf + miny = np.inf + maxx = -np.inf + maxy = -np.inf for k in obj: if type(k) is dict: @@ -7328,10 +7328,10 @@ class CNCjob(Geometry): def bounds_rec(obj): if type(obj) is list: - cminx = np.Inf - cminy = np.Inf - cmaxx = -np.Inf - cmaxy = -np.Inf + cminx = np.inf + cminy = np.inf + cmaxx = -np.inf + cmaxy = -np.inf w_geo = obj.geoms if isinstance(obj, (MultiPolygon, MultiLineString)) else obj for oo in w_geo: @@ -7361,17 +7361,17 @@ class CNCjob(Geometry): bounds_coords = bounds_rec(self.solid_geometry) else: - minx = np.Inf - miny = np.Inf - maxx = -np.Inf - maxy = -np.Inf + minx = np.inf + miny = np.inf + maxx = -np.inf + maxy = -np.inf # for CNCJob objects made from Gerber or Geometry objects if self.obj_options['type'].lower() == 'geometry': for k, v in self.tools.items(): - minx = np.Inf - miny = np.Inf - maxx = -np.Inf - maxy = -np.Inf + minx = np.inf + miny = np.inf + maxx = -np.inf + maxy = -np.inf try: work_geo = v['solid_geometry'] i_wg = work_geo.geoms if isinstance(work_geo, (MultiPolygon, MultiLineString)) else work_geo @@ -7394,10 +7394,10 @@ class CNCjob(Geometry): if self.obj_options['type'].lower() == 'excellon': for k, v in self.tools.items(): - minx = np.Inf - miny = np.Inf - maxx = -np.Inf - maxy = -np.Inf + minx = np.inf + miny = np.inf + maxx = -np.inf + maxy = -np.inf try: for geo in v['solid_geometry']: minx_, miny_, maxx_, maxy_ = bounds_rec(geo) @@ -7861,10 +7861,10 @@ def get_bounds(geometry_list: list) -> list: :param geometry_list: List of geometries for which to calculate the bounds limits :return: """ - xmin = np.Inf - ymin = np.Inf - xmax = -np.Inf - ymax = -np.Inf + xmin = np.inf + ymin = np.inf + xmax = -np.inf + ymax = -np.inf for gs in geometry_list: try: