[Notes] [Git][BuildStream/buildstream][danielsilverstone-ct/fix-lint-issues] 39 commits: _yaml.py: Quieten a lint in Python < 3.6



Title: GitLab

Daniel Silverstone pushed to branch danielsilverstone-ct/fix-lint-issues at BuildStream / buildstream

Commits:

24 changed files:

Changes:

  • buildstream/_artifactcache/artifactcache.py
    ... ... @@ -156,7 +156,7 @@ class ArtifactCache():
    156 156
         def setup_remotes(self, *, use_config=False, remote_url=None):
    
    157 157
     
    
    158 158
             # Ensure we do not double-initialise since this can be expensive
    
    159
    -        assert(not self._remotes_setup)
    
    159
    +        assert not self._remotes_setup
    
    160 160
             self._remotes_setup = True
    
    161 161
     
    
    162 162
             # Initialize remote artifact caches. We allow the commandline to override
    
    ... ... @@ -252,7 +252,7 @@ class ArtifactCache():
    252 252
         #    (int): The size of the cache after having cleaned up
    
    253 253
         #
    
    254 254
         def clean(self):
    
    255
    -        artifacts = self.list_artifacts()
    
    255
    +        artifacts = self.list_artifacts()  # pylint: disable=assignment-from-no-return
    
    256 256
     
    
    257 257
             # Build a set of the cache keys which are required
    
    258 258
             # based on the required elements at cleanup time
    
    ... ... @@ -294,7 +294,7 @@ class ArtifactCache():
    294 294
                 if key not in required_artifacts:
    
    295 295
     
    
    296 296
                     # Remove the actual artifact, if it's not required.
    
    297
    -                size = self.remove(to_remove)
    
    297
    +                size = self.remove(to_remove)  # pylint: disable=assignment-from-no-return
    
    298 298
     
    
    299 299
                     # Remove the size from the removed size
    
    300 300
                     self.set_cache_size(self._cache_size - size)
    
    ... ... @@ -311,7 +311,7 @@ class ArtifactCache():
    311 311
         #    (int): The size of the artifact cache.
    
    312 312
         #
    
    313 313
         def compute_cache_size(self):
    
    314
    -        self._cache_size = self.calculate_cache_size()
    
    314
    +        self._cache_size = self.calculate_cache_size()  # pylint: disable=assignment-from-no-return
    
    315 315
     
    
    316 316
             return self._cache_size
    
    317 317
     
    

  • buildstream/_artifactcache/cascache.py
    ... ... @@ -33,11 +33,11 @@ import grpc
    33 33
     
    
    34 34
     from .. import _yaml
    
    35 35
     
    
    36
    +from .._protos.google.rpc import code_pb2
    
    36 37
     from .._protos.google.bytestream import bytestream_pb2, bytestream_pb2_grpc
    
    37 38
     from .._protos.build.bazel.remote.execution.v2 import remote_execution_pb2, remote_execution_pb2_grpc
    
    38 39
     from .._protos.buildstream.v2 import buildstream_pb2, buildstream_pb2_grpc
    
    39 40
     
    
    40
    -from .._message import MessageType, Message
    
    41 41
     from .. import _signals, utils
    
    42 42
     from .._exceptions import ArtifactError
    
    43 43
     
    
    ... ... @@ -81,8 +81,9 @@ class CASCache(ArtifactCache):
    81 81
         ################################################
    
    82 82
     
    
    83 83
         def preflight(self):
    
    84
    -        if (not os.path.isdir(os.path.join(self.casdir, 'refs', 'heads')) or
    
    85
    -            not os.path.isdir(os.path.join(self.casdir, 'objects'))):
    
    84
    +        headdir = os.path.join(self.casdir, 'refs', 'heads')
    
    85
    +        objdir = os.path.join(self.casdir, 'objects')
    
    86
    +        if not (os.path.isdir(headdir) and os.path.isdir(objdir)):
    
    86 87
                 raise ArtifactError("CAS repository check failed for '{}'"
    
    87 88
                                     .format(self.casdir))
    
    88 89
     
    
    ... ... @@ -918,7 +919,7 @@ class CASCache(ArtifactCache):
    918 919
                 # Skip download, already in local cache.
    
    919 920
                 pass
    
    920 921
             elif (digest.size_bytes >= remote.max_batch_total_size_bytes or
    
    921
    -                not remote.batch_read_supported):
    
    922
    +              not remote.batch_read_supported):
    
    922 923
                 # Too large for batch request, download in independent request.
    
    923 924
                 self._ensure_blob(remote, digest)
    
    924 925
                 in_local_cache = True
    
    ... ... @@ -958,7 +959,7 @@ class CASCache(ArtifactCache):
    958 959
             batch = _CASBatchRead(remote)
    
    959 960
     
    
    960 961
             while len(fetch_queue) + len(fetch_next_queue) > 0:
    
    961
    -            if len(fetch_queue) == 0:
    
    962
    +            if not fetch_queue:
    
    962 963
                     batch = self._fetch_directory_batch(remote, batch, fetch_queue, fetch_next_queue)
    
    963 964
     
    
    964 965
                 dir_digest = fetch_queue.pop(0)
    
    ... ... @@ -1087,6 +1088,10 @@ class _CASRemote():
    1087 1088
             self.bytestream = None
    
    1088 1089
             self.cas = None
    
    1089 1090
             self.ref_storage = None
    
    1091
    +        self.batch_update_supported = None
    
    1092
    +        self.batch_read_supported = None
    
    1093
    +        self.capabilities = None
    
    1094
    +        self.max_batch_total_size_bytes = None
    
    1090 1095
     
    
    1091 1096
         def init(self):
    
    1092 1097
             if not self._initialized:
    
    ... ... @@ -1191,13 +1196,13 @@ class _CASBatchRead():
    1191 1196
             assert not self._sent
    
    1192 1197
             self._sent = True
    
    1193 1198
     
    
    1194
    -        if len(self._request.digests) == 0:
    
    1199
    +        if not self._request.digests:
    
    1195 1200
                 return
    
    1196 1201
     
    
    1197 1202
             batch_response = self._remote.cas.BatchReadBlobs(self._request)
    
    1198 1203
     
    
    1199 1204
             for response in batch_response.responses:
    
    1200
    -            if response.status.code != grpc.StatusCode.OK.value[0]:
    
    1205
    +            if response.status.code != code_pb2.OK:
    
    1201 1206
                     raise ArtifactError("Failed to download blob {}: {}".format(
    
    1202 1207
                         response.digest.hash, response.status.code))
    
    1203 1208
                 if response.digest.size_bytes != len(response.data):
    
    ... ... @@ -1236,13 +1241,13 @@ class _CASBatchUpdate():
    1236 1241
             assert not self._sent
    
    1237 1242
             self._sent = True
    
    1238 1243
     
    
    1239
    -        if len(self._request.requests) == 0:
    
    1244
    +        if not self._request.requests:
    
    1240 1245
                 return
    
    1241 1246
     
    
    1242 1247
             batch_response = self._remote.cas.BatchUpdateBlobs(self._request)
    
    1243 1248
     
    
    1244 1249
             for response in batch_response.responses:
    
    1245
    -            if response.status.code != grpc.StatusCode.OK.value[0]:
    
    1250
    +            if response.status.code != code_pb2.OK:
    
    1246 1251
                     raise ArtifactError("Failed to upload blob {}: {}".format(
    
    1247 1252
                         response.digest.hash, response.status.code))
    
    1248 1253
     
    

  • buildstream/_frontend/app.py
    ... ... @@ -20,7 +20,6 @@
    20 20
     from contextlib import contextmanager
    
    21 21
     import os
    
    22 22
     import sys
    
    23
    -import resource
    
    24 23
     import traceback
    
    25 24
     import datetime
    
    26 25
     from textwrap import TextWrapper
    

  • buildstream/_frontend/status.py
    ... ... @@ -18,8 +18,8 @@
    18 18
     #        Tristan Van Berkom <tristan vanberkom codethink co uk>
    
    19 19
     import os
    
    20 20
     import sys
    
    21
    -import click
    
    22 21
     import curses
    
    22
    +import click
    
    23 23
     
    
    24 24
     # Import a widget internal for formatting time codes
    
    25 25
     from .widget import TimeCode
    

  • buildstream/_fuse/hardlinks.py
    ... ... @@ -42,9 +42,11 @@ from .mount import Mount
    42 42
     #
    
    43 43
     class SafeHardlinks(Mount):
    
    44 44
     
    
    45
    -    def __init__(self, directory, tempdir, fuse_mount_options={}):
    
    45
    +    def __init__(self, directory, tempdir, fuse_mount_options=None):
    
    46 46
             self.directory = directory
    
    47 47
             self.tempdir = tempdir
    
    48
    +        if fuse_mount_options is None:
    
    49
    +            fuse_mount_options = {}
    
    48 50
             super().__init__(fuse_mount_options=fuse_mount_options)
    
    49 51
     
    
    50 52
         def create_operations(self):
    

  • buildstream/_fuse/mount.py
    ... ... @@ -87,8 +87,8 @@ class Mount():
    87 87
         #               User Facing API                #
    
    88 88
         ################################################
    
    89 89
     
    
    90
    -    def __init__(self, fuse_mount_options={}):
    
    91
    -        self._fuse_mount_options = fuse_mount_options
    
    90
    +    def __init__(self, fuse_mount_options=None):
    
    91
    +        self._fuse_mount_options = {} if fuse_mount_options is None else fuse_mount_options
    
    92 92
     
    
    93 93
         # mount():
    
    94 94
         #
    
    ... ... @@ -182,7 +182,7 @@ class Mount():
    182 182
     
    
    183 183
             # Ask the subclass to give us an Operations object
    
    184 184
             #
    
    185
    -        self.__operations = self.create_operations()
    
    185
    +        self.__operations = self.create_operations()  # pylint: disable=assignment-from-no-return
    
    186 186
     
    
    187 187
             # Run fuse in foreground in this child process, internally libfuse
    
    188 188
             # will handle SIGTERM and gracefully exit its own little main loop.
    

  • buildstream/_options/optionbool.py
    ... ... @@ -43,9 +43,9 @@ class OptionBool(Option):
    43 43
                 self.value = _yaml.node_get(node, bool, self.name)
    
    44 44
     
    
    45 45
         def set_value(self, value):
    
    46
    -        if value == 'True' or value == 'true':
    
    46
    +        if value in ('True', 'true'):
    
    47 47
                 self.value = True
    
    48
    -        elif value == 'False' or value == 'false':
    
    48
    +        elif value in ('False', 'false'):
    
    49 49
                 self.value = False
    
    50 50
             else:
    
    51 51
                 raise LoadError(LoadErrorReason.INVALID_DATA,
    

  • buildstream/_platform/darwin.py
    ... ... @@ -16,9 +16,7 @@
    16 16
     #  License along with this library. If not, see <http://www.gnu.org/licenses/>.
    
    17 17
     
    
    18 18
     import os
    
    19
    -import resource
    
    20 19
     
    
    21
    -from .._exceptions import PlatformError
    
    22 20
     from ..sandbox import SandboxDummy
    
    23 21
     
    
    24 22
     from . import Platform
    
    ... ... @@ -29,10 +27,6 @@ class Darwin(Platform):
    29 27
         # This value comes from OPEN_MAX in syslimits.h
    
    30 28
         OPEN_MAX = 10240
    
    31 29
     
    
    32
    -    def __init__(self):
    
    33
    -
    
    34
    -        super().__init__()
    
    35
    -
    
    36 30
         def create_sandbox(self, *args, **kwargs):
    
    37 31
             kwargs['dummy_reason'] = \
    
    38 32
                 "OSXFUSE is not supported and there are no supported sandbox" + \
    

  • buildstream/_platform/linux.py
    ... ... @@ -22,7 +22,6 @@ import subprocess
    22 22
     
    
    23 23
     from .. import _site
    
    24 24
     from .. import utils
    
    25
    -from .._message import Message, MessageType
    
    26 25
     from ..sandbox import SandboxDummy
    
    27 26
     
    
    28 27
     from . import Platform
    
    ... ... @@ -112,8 +111,4 @@ class Linux(Platform):
    112 111
             except subprocess.CalledProcessError:
    
    113 112
                 output = ''
    
    114 113
     
    
    115
    -        if output == 'root':
    
    116
    -            return True
    
    117
    -
    
    118
    -        else:
    
    119
    -            return False
    114
    +        return output == 'root'

  • buildstream/_scheduler/jobs/job.py
    ... ... @@ -414,7 +414,7 @@ class Job():
    414 414
     
    
    415 415
                 try:
    
    416 416
                     # Try the task action
    
    417
    -                result = self.child_process()
    
    417
    +                result = self.child_process()  # pylint: disable=assignment-from-no-return
    
    418 418
                 except SkipJob as e:
    
    419 419
                     elapsed = datetime.datetime.now() - starttime
    
    420 420
                     self.message(MessageType.SKIPPED, str(e),
    

  • buildstream/_scheduler/queues/pullqueue.py
    ... ... @@ -57,7 +57,7 @@ class PullQueue(Queue):
    57 57
         def done(self, _, element, result, success):
    
    58 58
     
    
    59 59
             if not success:
    
    60
    -            return False
    
    60
    +            return
    
    61 61
     
    
    62 62
             element._pull_done()
    
    63 63
     
    

  • buildstream/_scheduler/queues/trackqueue.py
    ... ... @@ -20,7 +20,6 @@
    20 20
     
    
    21 21
     # BuildStream toplevel imports
    
    22 22
     from ...plugin import _plugin_lookup
    
    23
    -from ... import SourceError
    
    24 23
     
    
    25 24
     # Local imports
    
    26 25
     from . import Queue, QueueStatus
    

  • buildstream/_yaml.py
    ... ... @@ -470,10 +470,11 @@ def node_get_project_path(node, key, project_dir, *,
    470 470
                             .format(provenance, path_str))
    
    471 471
     
    
    472 472
         try:
    
    473
    +        full_path = (project_dir_path / path)
    
    473 474
             if sys.version_info[0] == 3 and sys.version_info[1] < 6:
    
    474
    -            full_resolved_path = (project_dir_path / path).resolve()
    
    475
    +            full_resolved_path = full_path.resolve()
    
    475 476
             else:
    
    476
    -            full_resolved_path = (project_dir_path / path).resolve(strict=True)
    
    477
    +            full_resolved_path = full_path.resolve(strict=True)  # pylint: disable=unexpected-keyword-arg
    
    477 478
         except FileNotFoundError:
    
    478 479
             raise LoadError(LoadErrorReason.MISSING_FILE,
    
    479 480
                             "{}: Specified path '{}' does not exist"
    

  • buildstream/_yamlcache.py
    ... ... @@ -27,9 +27,8 @@ import sys
    27 27
     from contextlib import contextmanager
    
    28 28
     from collections import namedtuple
    
    29 29
     
    
    30
    -from ._cachekey import generate_key
    
    31 30
     from ._context import Context
    
    32
    -from . import utils, _yaml
    
    31
    +from . import _yaml
    
    33 32
     
    
    34 33
     
    
    35 34
     YAML_CACHE_FILENAME = "yaml_cache.pickle"
    
    ... ... @@ -207,7 +206,7 @@ class YamlCache():
    207 206
                 filepath = os.path.relpath(full_path, project.directory)
    
    208 207
             else:
    
    209 208
                 filepath = full_path
    
    210
    -        return full_path
    
    209
    +        return filepath
    
    211 210
     
    
    212 211
         # _calculate_key():
    
    213 212
         #
    
    ... ... @@ -329,7 +328,7 @@ class BstUnpickler(pickle.Unpickler):
    329 328
                     if not project:
    
    330 329
                         projects = [p.name for p in self._context.get_projects()]
    
    331 330
                         raise pickle.UnpicklingError("No project with name {} found in {}"
    
    332
    -                                                 .format(key_id, projects))
    
    331
    +                                                 .format(project_tag, projects))
    
    333 332
                 else:
    
    334 333
                     project = None
    
    335 334
                     name = tagged_name
    

  • buildstream/buildelement.py
    ... ... @@ -152,7 +152,7 @@ class BuildElement(Element):
    152 152
         #############################################################
    
    153 153
         def configure(self, node):
    
    154 154
     
    
    155
    -        self.__commands = {}
    
    155
    +        self.__commands = {}  # pylint: disable=attribute-defined-outside-init
    
    156 156
     
    
    157 157
             # FIXME: Currently this forcefully validates configurations
    
    158 158
             #        for all BuildElement subclasses so they are unable to
    

  • buildstream/element.py
    ... ... @@ -432,7 +432,7 @@ class Element(Plugin):
    432 432
                                                     visited=visited, recursed=True)
    
    433 433
     
    
    434 434
             # Yeild self only at the end, after anything needed has been traversed
    
    435
    -        if should_yield and (recurse or recursed) and (scope == Scope.ALL or scope == Scope.RUN):
    
    435
    +        if should_yield and (recurse or recursed) and (scope in (Scope.ALL, Scope.RUN)):
    
    436 436
                 yield self
    
    437 437
     
    
    438 438
         def search(self, scope, name):
    
    ... ... @@ -1563,7 +1563,7 @@ class Element(Plugin):
    1563 1563
                         # Step 3 - Prepare
    
    1564 1564
                         self.__prepare(sandbox)
    
    1565 1565
                         # Step 4 - Assemble
    
    1566
    -                    collect = self.assemble(sandbox)
    
    1566
    +                    collect = self.assemble(sandbox)  # pylint: disable=assignment-from-no-return
    
    1567 1567
                         self.__set_build_result(success=True, description="succeeded")
    
    1568 1568
                     except BstError as e:
    
    1569 1569
                         # If an error occurred assembling an element in a sandbox,
    
    ... ... @@ -2521,7 +2521,7 @@ class Element(Plugin):
    2521 2521
             strong_key = meta['strong']
    
    2522 2522
             weak_key = meta['weak']
    
    2523 2523
     
    
    2524
    -        assert key == strong_key or key == weak_key
    
    2524
    +        assert key in (strong_key, weak_key)
    
    2525 2525
     
    
    2526 2526
             self.__metadata_keys[strong_key] = meta
    
    2527 2527
             self.__metadata_keys[weak_key] = meta
    

  • buildstream/plugin.py
    ... ... @@ -751,9 +751,7 @@ class Plugin():
    751 751
             self.__context.message(message)
    
    752 752
     
    
    753 753
         def __note_command(self, output, *popenargs, **kwargs):
    
    754
    -        workdir = os.getcwd()
    
    755
    -        if 'cwd' in kwargs:
    
    756
    -            workdir = kwargs['cwd']
    
    754
    +        workdir = kwargs.get('cwd', os.getcwd())
    
    757 755
             command = " ".join(popenargs[0])
    
    758 756
             output.write('Running host command {}: {}\n'.format(workdir, command))
    
    759 757
             output.flush()
    

  • buildstream/plugins/sources/git.py
    ... ... @@ -343,13 +343,13 @@ class GitMirror(SourceFetcher):
    343 343
                                                   '--contains', self.ref],
    
    344 344
                                                  cwd=fullpath,)
    
    345 345
             if branch:
    
    346
    -            return True
    
    346
    +            return
    
    347 347
             else:
    
    348 348
                 _, tag = self.source.check_output([self.source.host_git, 'tag', '--list', track,
    
    349 349
                                                    '--contains', self.ref],
    
    350 350
                                                   cwd=fullpath,)
    
    351 351
                 if tag:
    
    352
    -                return True
    
    352
    +                return
    
    353 353
     
    
    354 354
             detail = "The ref provided for the element does not exist locally in the provided track branch / tag " + \
    
    355 355
                      "'{}'.\nYou may wish to track the element to update the ref from '{}' ".format(track, track) + \
    

  • buildstream/sandbox/_mount.py
    ... ... @@ -30,7 +30,7 @@ from .._fuse import SafeHardlinks
    30 30
     # Helper data object representing a single mount point in the mount map
    
    31 31
     #
    
    32 32
     class Mount():
    
    33
    -    def __init__(self, sandbox, mount_point, safe_hardlinks, fuse_mount_options={}):
    
    33
    +    def __init__(self, sandbox, mount_point, safe_hardlinks, fuse_mount_options=None):
    
    34 34
             scratch_directory = sandbox._get_scratch_directory()
    
    35 35
             # Getting _get_underlying_directory() here is acceptable as
    
    36 36
             # we're part of the sandbox code. This will fail if our
    
    ... ... @@ -39,7 +39,7 @@ class Mount():
    39 39
     
    
    40 40
             self.mount_point = mount_point
    
    41 41
             self.safe_hardlinks = safe_hardlinks
    
    42
    -        self._fuse_mount_options = fuse_mount_options
    
    42
    +        self._fuse_mount_options = {} if fuse_mount_options is None else fuse_mount_options
    
    43 43
     
    
    44 44
             # FIXME: When the criteria for mounting something and its parent
    
    45 45
             #        mount is identical, then there is no need to mount an additional
    
    ... ... @@ -101,10 +101,13 @@ class Mount():
    101 101
     #
    
    102 102
     class MountMap():
    
    103 103
     
    
    104
    -    def __init__(self, sandbox, root_readonly, fuse_mount_options={}):
    
    104
    +    def __init__(self, sandbox, root_readonly, fuse_mount_options=None):
    
    105 105
             # We will be doing the mounts in the order in which they were declared.
    
    106 106
             self.mounts = OrderedDict()
    
    107 107
     
    
    108
    +        if fuse_mount_options is None:
    
    109
    +            fuse_mount_options = {}
    
    110
    +
    
    108 111
             # We want safe hardlinks on rootfs whenever root is not readonly
    
    109 112
             self.mounts['/'] = Mount(sandbox, '/', not root_readonly, fuse_mount_options)
    
    110 113
     
    

  • buildstream/sandbox/_mounter.py
    ... ... @@ -25,7 +25,7 @@ from .. import utils, _signals
    25 25
     
    
    26 26
     
    
    27 27
     # A class to wrap the `mount` and `umount` system commands
    
    28
    -class Mounter(object):
    
    28
    +class Mounter():
    
    29 29
         @classmethod
    
    30 30
         def _mount(cls, dest, src=None, mount_type=None,
    
    31 31
                    stdout=sys.stdout, stderr=sys.stderr, options=None,
    

  • buildstream/sandbox/_sandboxbwrap.py
    ... ... @@ -130,7 +130,7 @@ class SandboxBwrap(Sandbox):
    130 130
             mount_source_overrides = self._get_mount_sources()
    
    131 131
             for mark in marked_directories:
    
    132 132
                 mount_point = mark['directory']
    
    133
    -            if mount_point in mount_source_overrides:
    
    133
    +            if mount_point in mount_source_overrides:  # pylint: disable=consider-using-get
    
    134 134
                     mount_source = mount_source_overrides[mount_point]
    
    135 135
                 else:
    
    136 136
                     mount_source = mount_map.get_mount_source(mount_point)
    

  • buildstream/sandbox/_sandboxchroot.py
    ... ... @@ -72,7 +72,6 @@ class SandboxChroot(Sandbox):
    72 72
             # each mount point needs to be mounted from and to
    
    73 73
             self.mount_map = MountMap(self, flags & SandboxFlags.ROOT_READ_ONLY,
    
    74 74
                                       self._FUSE_MOUNT_OPTIONS)
    
    75
    -        root_mount_source = self.mount_map.get_mount_source('/')
    
    76 75
     
    
    77 76
             # Create a sysroot and run the command inside it
    
    78 77
             with ExitStack() as stack:
    
    ... ... @@ -147,7 +146,7 @@ class SandboxChroot(Sandbox):
    147 146
     
    
    148 147
             try:
    
    149 148
                 with _signals.suspendable(suspend_proc, resume_proc), _signals.terminator(kill_proc):
    
    150
    -                process = subprocess.Popen(
    
    149
    +                process = subprocess.Popen(  # pylint: disable=subprocess-popen-preexec-fn
    
    151 150
                         command,
    
    152 151
                         close_fds=True,
    
    153 152
                         cwd=os.path.join(rootfs, cwd.lstrip(os.sep)),
    
    ... ... @@ -264,7 +263,7 @@ class SandboxChroot(Sandbox):
    264 263
             @contextmanager
    
    265 264
             def mount_point(point, **kwargs):
    
    266 265
                 mount_source_overrides = self._get_mount_sources()
    
    267
    -            if point in mount_source_overrides:
    
    266
    +            if point in mount_source_overrides:  # pylint: disable=consider-using-get
    
    268 267
                     mount_source = mount_source_overrides[point]
    
    269 268
                 else:
    
    270 269
                     mount_source = self.mount_map.get_mount_source(point)
    

  • buildstream/source.py
    ... ... @@ -637,7 +637,7 @@ class Source(Plugin):
    637 637
                 # Source consistency interrogations are silent.
    
    638 638
                 context = self._get_context()
    
    639 639
                 with context.silence():
    
    640
    -                self.__consistency = self.get_consistency()
    
    640
    +                self.__consistency = self.get_consistency()  # pylint: disable=assignment-from-no-return
    
    641 641
     
    
    642 642
         # Return cached consistency
    
    643 643
         #
    
    ... ... @@ -687,14 +687,14 @@ class Source(Plugin):
    687 687
     
    
    688 688
             key['directory'] = self.__directory
    
    689 689
             if include_source:
    
    690
    -            key['unique'] = self.get_unique_key()
    
    690
    +            key['unique'] = self.get_unique_key()  # pylint: disable=assignment-from-no-return
    
    691 691
     
    
    692 692
             return key
    
    693 693
     
    
    694 694
         # Wrapper for set_ref(), also returns whether it changed.
    
    695 695
         #
    
    696 696
         def _set_ref(self, ref, node):
    
    697
    -        current_ref = self.get_ref()
    
    697
    +        current_ref = self.get_ref()  # pylint: disable=assignment-from-no-return
    
    698 698
             changed = False
    
    699 699
     
    
    700 700
             # This comparison should work even for tuples and lists,
    
    ... ... @@ -773,7 +773,7 @@ class Source(Plugin):
    773 773
             elif project.ref_storage == ProjectRefStorage.PROJECT_REFS:
    
    774 774
     
    
    775 775
                 # First warn if there is a ref already loaded, and reset it
    
    776
    -            redundant_ref = self.get_ref()
    
    776
    +            redundant_ref = self.get_ref()  # pylint: disable=assignment-from-no-return
    
    777 777
                 if redundant_ref is not None:
    
    778 778
                     self.set_ref(None, {})
    
    779 779
     
    
    ... ... @@ -883,7 +883,7 @@ class Source(Plugin):
    883 883
             else:
    
    884 884
                 new_ref = self.__do_track()
    
    885 885
     
    
    886
    -        current_ref = self.get_ref()
    
    886
    +        current_ref = self.get_ref()  # pylint: disable=assignment-from-no-return
    
    887 887
     
    
    888 888
             if new_ref is None:
    
    889 889
                 # No tracking, keep current ref
    
    ... ... @@ -1038,15 +1038,12 @@ class Source(Plugin):
    1038 1038
             if not mirrors or not alias:
    
    1039 1039
                 return self.track(**kwargs)
    
    1040 1040
     
    
    1041
    -        context = self._get_context()
    
    1042
    -        source_kind = type(self)
    
    1043
    -
    
    1044 1041
             # NOTE: We are assuming here that tracking only requires substituting the
    
    1045 1042
             #       first alias used
    
    1046 1043
             for uri in reversed(project.get_alias_uris(alias, first_pass=self.__first_pass)):
    
    1047 1044
                 new_source = self.__clone_for_uri(uri)
    
    1048 1045
                 try:
    
    1049
    -                ref = new_source.track(**kwargs)
    
    1046
    +                ref = new_source.track(**kwargs)  # pylint: disable=assignment-from-none
    
    1050 1047
                 # FIXME: Need to consider temporary vs. permanent failures,
    
    1051 1048
                 #        and how this works with retries.
    
    1052 1049
                 except BstError as e:
    

  • buildstream/utils.py
    ... ... @@ -29,13 +29,13 @@ import re
    29 29
     import shutil
    
    30 30
     import signal
    
    31 31
     import stat
    
    32
    +from stat import S_ISDIR
    
    32 33
     import string
    
    33 34
     import subprocess
    
    34 35
     import tempfile
    
    35 36
     import itertools
    
    36 37
     import functools
    
    37 38
     from contextlib import contextmanager
    
    38
    -from stat import S_ISDIR
    
    39 39
     
    
    40 40
     import psutil
    
    41 41
     
    
    ... ... @@ -1088,7 +1088,8 @@ def _call(*popenargs, terminate=False, **kwargs):
    1088 1088
                 os.killpg(group_id, signal.SIGCONT)
    
    1089 1089
     
    
    1090 1090
         with _signals.suspendable(suspend_proc, resume_proc), _signals.terminator(kill_proc):
    
    1091
    -        process = subprocess.Popen(*popenargs, preexec_fn=preexec_fn, **kwargs)
    
    1091
    +        process = subprocess.Popen(  # pylint: disable=subprocess-popen-preexec-fn
    
    1092
    +            *popenargs, preexec_fn=preexec_fn, **kwargs)
    
    1092 1093
             output, _ = process.communicate()
    
    1093 1094
             exit_code = process.poll()
    
    1094 1095
     
    



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]