Revision 6c881c52
b/lib/backend.py | ||
---|---|---|
26 | 26 |
|
27 | 27 |
""" |
28 | 28 |
|
29 |
# pylint: disable-msg=E1103 |
|
30 |
|
|
31 |
# E1103: %s %r has no %r member (but some types could not be |
|
32 |
# inferred), because the _TryOSFromDisk returns either (True, os_obj) |
|
33 |
# or (False, "string") which confuses pylint |
|
34 |
|
|
29 | 35 |
|
30 | 36 |
import os |
31 | 37 |
import os.path |
b/lib/confd/client.py | ||
---|---|---|
45 | 45 |
|
46 | 46 |
""" |
47 | 47 |
|
48 |
# pylint: disable-msg=E0203 |
|
49 |
|
|
50 |
# E0203: Access to member %r before its definition, since we use |
|
51 |
# objects.py which doesn't explicitely initialise its members |
|
52 |
|
|
48 | 53 |
import socket |
49 | 54 |
import time |
50 | 55 |
import random |
... | ... | |
400 | 405 |
|
401 | 406 |
if not filter_upcall: |
402 | 407 |
self._callback(up) |
403 |
|
b/lib/http/client.py | ||
---|---|---|
22 | 22 |
|
23 | 23 |
""" |
24 | 24 |
|
25 |
# pylint: disable-msg=E1103 |
|
26 |
|
|
27 |
# # E1103: %s %r has no %r member (but some types could not be |
|
28 |
# inferred), since _socketobject could be ssl or not and pylint |
|
29 |
# doesn't parse that |
|
30 |
|
|
31 |
|
|
25 | 32 |
import os |
26 | 33 |
import select |
27 | 34 |
import socket |
b/lib/jqueue.py | ||
---|---|---|
540 | 540 |
self.queue = queue |
541 | 541 |
|
542 | 542 |
|
543 |
class JobQueue(object):
|
|
544 |
"""Queue used to manage the jobs.
|
|
543 |
def _RequireOpenQueue(fn):
|
|
544 |
"""Decorator for "public" functions.
|
|
545 | 545 |
|
546 |
@cvar _RE_JOB_FILE: regex matching the valid job file names |
|
546 |
This function should be used for all 'public' functions. That is, |
|
547 |
functions usually called from other classes. Note that this should |
|
548 |
be applied only to methods (not plain functions), since it expects |
|
549 |
that the decorated function is called with a first argument that has |
|
550 |
a '_queue_lock' argument. |
|
547 | 551 |
|
548 |
""" |
|
549 |
_RE_JOB_FILE = re.compile(r"^job-(%s)$" % constants.JOB_ID_TEMPLATE) |
|
552 |
@warning: Use this decorator only after utils.LockedMethod! |
|
550 | 553 |
|
551 |
def _RequireOpenQueue(fn): |
|
552 |
"""Decorator for "public" functions. |
|
554 |
Example:: |
|
555 |
@utils.LockedMethod |
|
556 |
@_RequireOpenQueue |
|
557 |
def Example(self): |
|
558 |
pass |
|
553 | 559 |
|
554 |
This function should be used for all 'public' functions. That is, |
|
555 |
functions usually called from other classes. |
|
560 |
""" |
|
561 |
def wrapper(self, *args, **kwargs): |
|
562 |
assert self._queue_lock is not None, "Queue should be open" |
|
563 |
return fn(self, *args, **kwargs) |
|
564 |
return wrapper |
|
556 | 565 |
|
557 |
@warning: Use this decorator only after utils.LockedMethod! |
|
558 | 566 |
|
559 |
Example:: |
|
560 |
@utils.LockedMethod |
|
561 |
@_RequireOpenQueue |
|
562 |
def Example(self): |
|
563 |
pass |
|
567 |
class JobQueue(object): |
|
568 |
"""Queue used to manage the jobs. |
|
564 | 569 |
|
565 |
""" |
|
566 |
def wrapper(self, *args, **kwargs): |
|
567 |
assert self._queue_lock is not None, "Queue should be open" |
|
568 |
return fn(self, *args, **kwargs) |
|
569 |
return wrapper |
|
570 |
@cvar _RE_JOB_FILE: regex matching the valid job file names |
|
571 |
|
|
572 |
""" |
|
573 |
_RE_JOB_FILE = re.compile(r"^job-(%s)$" % constants.JOB_ID_TEMPLATE) |
|
570 | 574 |
|
571 | 575 |
def __init__(self, context): |
572 | 576 |
"""Constructor for JobQueue. |
b/lib/objects.py | ||
---|---|---|
26 | 26 |
|
27 | 27 |
""" |
28 | 28 |
|
29 |
# pylint: disable-msg=E0203 |
|
30 |
|
|
31 |
# E0203: Access to member %r before its definition, since we use |
|
32 |
# objects.py which doesn't explicitely initialise its members |
|
33 |
|
|
29 | 34 |
|
30 | 35 |
import ConfigParser |
31 | 36 |
import re |
b/lib/storage.py | ||
---|---|---|
328 | 328 |
"""LVM Physical Volume storage unit. |
329 | 329 |
|
330 | 330 |
""" |
331 |
@staticmethod |
|
331 | 332 |
def _GetAllocatable(attr): |
332 | 333 |
if attr: |
333 | 334 |
return (attr[0] == "a") |
b/lib/utils.py | ||
---|---|---|
2413 | 2413 |
|
2414 | 2414 |
@type field: str |
2415 | 2415 |
@param field: the string to match |
2416 |
@return: either False or a regular expression match object
|
|
2416 |
@return: either None or a regular expression match object
|
|
2417 | 2417 |
|
2418 | 2418 |
""" |
2419 | 2419 |
for m in itertools.ifilter(None, (val.match(field) for val in self.items)): |
2420 | 2420 |
return m |
2421 |
return False
|
|
2421 |
return None
|
|
2422 | 2422 |
|
2423 | 2423 |
def NonMatching(self, items): |
2424 | 2424 |
"""Returns the list of fields not matching the current set |
Also available in: Unified diff