from ..constants import *
from ..i18n import _
-DEF_MATCH = re.compile(r"C?DEF:([A-Za-z0-9_]+)=")
+DEF_MATCH = r"C?DEF:([A-Za-z0-9_]+)="
class Environment(object):
"""
return "default"
def collect(self):
- expr = re.compile(r"^ctxt (\d+)$")
+ expr = r"^ctxt (\d+)$"
with open("/proc/stat") as f:
for line in f.readlines():
templates = [GraphTemplateCPUFreq]
- cpuid_pattern = re.compile(r"cpu[0-9]+")
-
@property
def objects(self):
core_ids = []
for cpuid in os.listdir("/sys/devices/system/cpu"):
- if not self.cpuid_pattern.match(cpuid):
+ if not re.match(r"cpu[0-9]+", cpuid):
continue
o = CPUFreqObject(self, cpuid)
]
block_device_patterns = [
- re.compile(r"(x?v|s)d[a-z]+"),
- re.compile(r"mmcblk[0-9]+"),
+ r"(x?v|s)d[a-z]+",
+ r"mmcblk[0-9]+",
]
@property
def _valid_block_device_name(self, name):
# Check if the given name matches any of the valid patterns.
for pattern in self.block_device_patterns:
- if pattern.match(name):
+ if re.match(pattern, name):
return True
return False
return "default"
def collect(self):
- expr = re.compile(r"^intr (\d+)")
+ expr = r"^intr (\d+)"
with open("/proc/stat") as f:
for line in f.readlines():