houtianze/bypy

View on GitHub
bypy/bypy.py

Summary

Maintainability
F
1 mo
Test Coverage

File bypy.py has 3042 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python -tt
# encoding: utf-8
# PYTHON_ARGCOMPLETE_OK
# ===  IMPORTANT  ====
# NOTE: In order to support non-ASCII file names,
Severity: Major
Found in bypy/bypy.py - About 1 wk to fix

    ByPy has 187 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ByPy(object):
        '''The main class of the bypy program'''
        # TODO: Apply to configdir instead of ~/.bypy
        @staticmethod
        def migratesettings():
    Severity: Major
    Found in bypy/bypy.py - About 3 days to fix

      Function _request_work has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
      Open

          def _request_work(self, url, pars, act, method, actargs = None, addtoken = True, dumpex = True, **kwargs):
              result = const.ENoError
              r = None
      
              self._extraupdate()
      Severity: Minor
      Found in bypy/bypy.py - About 1 day to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function __init__ has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self,
              slice_size = const.DefaultSliceSize,
              dl_chunk_size = const.DefaultDlChunkSize,
              verify = True,
              retry = 5, timeout = const.DefaultTimeOutInSeconds,
      Severity: Minor
      Found in bypy/bypy.py - About 1 day to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function _downfile has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

          def _downfile(self, remotefile, localfile):
              pinfo('{} <- {}'.format(localfile, remotefile))
              # TODO: this is a quick patch
              if not self._shallinclude(localfile, remotefile, False):
                  # since we are not going to download it, there is no error
      Severity: Minor
      Found in bypy/bypy.py - About 5 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function main has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

      def main(argv=None): # IGNORE:C0111
          ''' Main Entry '''
          # printBaiduBanner()
      
          by = None
      Severity: Minor
      Found in bypy/bypy.py - About 5 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function _upload_file_slices has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          def _upload_file_slices(self, localpath, remotepath, ondup = 'overwrite'):
              pieces = const.MaxSlicePieces
              slice = self._slice_size
              if self._current_file_size <= self._slice_size * const.MaxSlicePieces:
                  # slice them using slice size
      Severity: Minor
      Found in bypy/bypy.py - About 4 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function __init__ has 27 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self,
      Severity: Major
      Found in bypy/bypy.py - About 3 hrs to fix

        Function _dump_exception has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def _dump_exception(self, ex, url, pars, r, act):
                if self.debug or self.verbose:
                    perr("Error accessing '{}'".format(url))
                    if self.debug:
                        perr(formatex(ex))
        Severity: Minor
        Found in bypy/bypy.py - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function _compare has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def _compare(self, remotedir = None, localdir = None, skip_remote_only_dirs = False):
                if not localdir:
                    localdir = '.'
        
                self.pv("Gathering local directory ...")
        Severity: Minor
        Found in bypy/bypy.py - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Consider simplifying this complex logical expression.
        Open

                        if ec == 111 or ec == 110 or ec == 6 or ec == const.IEAppIDIsEmpty: # and sc == 401:
                            self.pd("ec = {}".format(ec))
                            self.pd("Need to refresh token, refreshing")
                            if const.ENoError == self._refresh_token(): # refresh the token and re-request
                                # TODO: avoid infinite recursive loops
        Severity: Critical
        Found in bypy/bypy.py - About 2 hrs to fix

          Function _walk_upload has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              def _walk_upload(self, localpath, remotepath, ondup, walk):
                  (dirpath, dirnames, filenames) = walk
          
                  rdir = os.path.relpath(dirpath, localpath)
                  if rdir == '.':
          Severity: Minor
          Found in bypy/bypy.py - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function migratesettings has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def migratesettings():
                  result = const.ENoError
          
                  if os.path.exists(const.OldByPyCertsPath):
                      removefile(const.OldByPyCertsPath)
          Severity: Minor
          Found in bypy/bypy.py - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function _upload_file has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def _upload_file(self, localpath, remotepath, ondup = 'overwrite'):
                  # TODO: this is a quick patch
                  if not self._shallinclude(localpath, remotepath, True):
                      # since we are not going to upload it, there is no error
                      #return const.ENoError
          Severity: Minor
          Found in bypy/bypy.py - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function _walk_remote_dir has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def _walk_remote_dir(self, remotepath, remoterootpath, args = None, skip_remote_only_dirs = False, recursive = True):
                  dirjs = []
                  filejs = []
                  listStart = 0
                  # https://github.com/houtianze/bypy/issues/285
          Severity: Minor
          Found in bypy/bypy.py - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function __init__ has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def __init__(self,
                  slice_size = const.DefaultSliceSize,
                  dl_chunk_size = const.DefaultDlChunkSize,
                  verify = True,
                  retry = 5, timeout = const.DefaultTimeOutInSeconds,
          Severity: Major
          Found in bypy/bypy.py - About 2 hrs to fix

            Function getparser has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            def getparser():
                #name = os.path.basename(sys.argv[0])
                version = "v%s" % const.__version__
                version_message = '%%(prog)s %s' % (version)
                desc = "{} - {}".format(version_message, const.__desc__)
            Severity: Minor
            Found in bypy/bypy.py - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function _auth has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def _auth(self):
                    params = {
                        'client_id' : self._apikey,
                        'response_type' : 'code',
                        'redirect_uri' : 'oob',
            Severity: Minor
            Found in bypy/bypy.py - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function upload has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def upload(self, localpath = '', remotepath = '', ondup = "overwrite"):
                    ''' Usage: upload [localpath] [remotepath] [ondup] - \
            upload a file or directory (recursively)
                localpath - local path, is the current directory '.' if not specified
                remotepath - remote path at Baidu Yun (after app root directory at Baidu Yun)
            Severity: Minor
            Found in bypy/bypy.py - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function _verify_current_file has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def _verify_current_file(self, j, gotlmd5):
                    # if we really don't want to verify
                    if self._current_file == '/dev/null' and not self._verify:
                        return const.ENoError
            
            
            Severity: Minor
            Found in bypy/bypy.py - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function _cdl_addmon has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                def _cdl_addmon(self, source_url, rpath, timeout = 3600):
                    pars = self._prepare_cdl_add(source_url, rpath, timeout)
                    jc = [{}] # out param
                    result = self._post(pcsurl + 'services/cloud_dl',
                        pars, self._cdl_addmon_act, jc)
            Severity: Minor
            Found in bypy/bypy.py - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function combine has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                def combine(self, remotefile, localfile = '*', *args):
                    ''' Usage: combine <remotefile> [localfile] [md5s] - \
            try to create a file at PCS by combining slices, having MD5s specified
              remotefile - remote file at Baidu Yun (after app root directory at Baidu Yun)
              localfile - local file to verify against, passing in a star '*' or '/dev/null' means no verification
            Severity: Minor
            Found in bypy/bypy.py - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function _request has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                def _request(self, url, pars, act, method, actargs = None, retry = True, addtoken = True, dumpex = True, **kwargs):
                    tries = 1
                    if retry:
                        tries = self._retry
            
            
            Severity: Minor
            Found in bypy/bypy.py - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function _downchunks has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def _downchunks(self, rfile, start):
                    rsize = self._remote_json['size']
            
                    pars = {
                        'method' : 'download',
            Severity: Minor
            Found in bypy/bypy.py - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function _refresh_token has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def _refresh_token(self):
                    if self._use_server_auth:
                        pr('Refreshing, please be patient, it may take upto {} seconds...'.format(self._repr_timeout()))
            
                        pars = {
            Severity: Minor
            Found in bypy/bypy.py - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function _ok_to_use_remote_temp_dir has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def _ok_to_use_remote_temp_dir(self):
                    if const.SettingKey_OverwriteRemoteTempDir in self._setting and \
                    self._setting[const.SettingKey_OverwriteRemoteTempDir]:
                        return True
            
            
            Severity: Minor
            Found in bypy/bypy.py - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function _syncup_diff_one has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def _syncup_diff_one(self, rpath, localdir, d):
                    result = const.ENoError
                    t = d[0] # type
                    p = d[1] # path
                    #lcpath = os.path.join(localdir, p) # local complete path
            Severity: Minor
            Found in bypy/bypy.py - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function _share_local_file has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def _share_local_file(self, lpath, rpath, fast):
                    filesize = getfilesize(lpath)
                    if filesize < const.MinRapidUploadFileSize:
                        perr("File size ({}) of '{}' is too small (must be greater or equal than {}) to be shared".format(
                            human_size(filesize), lpath, human_size(const.MinRapidUploadFileSize)))
            Severity: Minor
            Found in bypy/bypy.py - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function getparser has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def getparser():
                #name = os.path.basename(sys.argv[0])
                version = "v%s" % const.__version__
                version_message = '%%(prog)s %s' % (version)
                desc = "{} - {}".format(version_message, const.__desc__)
            Severity: Minor
            Found in bypy/bypy.py - About 1 hr to fix

              Function _shallinclude has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _shallinclude(self, lpath, rpath, direction):
                      arrow = '==>' if direction else '<=='
                      checkpath = lpath if direction else rpath
                      # TODO: bad practice, see os.access() document for more info
                      if direction: # upload
              Severity: Minor
              Found in bypy/bypy.py - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function _request has 9 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def _request(self, url, pars, act, method, actargs = None, retry = True, addtoken = True, dumpex = True, **kwargs):
              Severity: Major
              Found in bypy/bypy.py - About 1 hr to fix

                Function _share_remote has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _share_remote(self, tmpdir, rpath, srpath, fast): # srpath - share remote path (full path)
                        subr = self._get_file_info(rpath)
                        if const.ENoError == subr:
                            if 'isdir' in self._remote_json:
                                if self._remote_json['isdir']:
                Severity: Minor
                Found in bypy/bypy.py - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function _downchunks_act has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _downchunks_act(self, r, args):
                        rfile, offset, rsize, start_time = args
                
                        expectedBytes = self._dl_chunk_size
                        if rsize - offset < self._dl_chunk_size:
                Severity: Minor
                Found in bypy/bypy.py - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function _syncdown_delete_local has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _syncdown_delete_local(self, localdir, local):
                        result = const.ENoError
                        for l in local:
                            # use os.path.isfile()/isdir() instead of l[0], because we need to check file/dir existence.
                            # as we may have removed the parent dir previously during the iteration
                Severity: Minor
                Found in bypy/bypy.py - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function syncup has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def syncup(self, localdir = '', remotedir = '', deleteremote = False):
                        ''' Usage: syncup [localdir] [remotedir] [deleteremote] - \
                sync up from the local directory to the remote directory
                  localdir - the local directory to sync from if not specified, it defaults to the current directory.
                  remotedir - the remote directory at Baidu Yun (after app's directory) to sync to. \
                Severity: Minor
                Found in bypy/bypy.py - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function download has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def download(self, remotepath = '/', localpath = ''):
                        ''' Usage: download [remotepath] [localpath] - \
                download a remote directory (recursively) / file
                  remotepath - remote path at Baidu Yun (after app root directory), if not specified, it is set to the root directory at Baidu Yun
                  localpath - local path. if not specified, it is set to the current directory
                Severity: Minor
                Found in bypy/bypy.py - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function syncdown has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def syncdown(self, remotedir = '', localdir = '', deletelocal = False):
                        ''' Usage: syncdown [remotedir] [localdir] [deletelocal] - \
                sync down from the remote directory to the local directory
                  remotedir - the remote directory at Baidu Yun (after app's directory) to sync from. \
                if not specified, it defaults to the root directory
                Severity: Minor
                Found in bypy/bypy.py - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function _post has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def _post(self, url, pars, act, actargs = None, retry = True, addtoken = True, dumpex = True, **kwargs):
                Severity: Major
                Found in bypy/bypy.py - About 1 hr to fix

                  Function _request_work has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def _request_work(self, url, pars, act, method, actargs = None, addtoken = True, dumpex = True, **kwargs):
                  Severity: Major
                  Found in bypy/bypy.py - About 1 hr to fix

                    Function _get has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def _get(self, url, pars, act, actargs = None, retry = True, addtoken = True, dumpex = True, **kwargs):
                    Severity: Major
                    Found in bypy/bypy.py - About 1 hr to fix

                      Function _get_file_info has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _get_file_info(self, remotefile, **kwargs):
                              if remotefile == const.AppPcsPath: # root path
                                  # fake it
                                  rj = {}
                                  rj['isdir'] = 1
                      Severity: Minor
                      Found in bypy/bypy.py - About 55 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function _share_local_dir has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _share_local_dir(self, lpath, rpath, fast):
                              result = const.ENoError
                              for walk in self._walk_normal_file(lpath):
                                  (dirpath, dirnames, filenames) = walk
                                  for filename in filenames:
                      Severity: Minor
                      Found in bypy/bypy.py - About 55 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function _down_aria2c has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _down_aria2c(self, remotefile, localfile):
                              url = "{}{}".format(dpcsurl, "file")
                              # i think encoding in UTF-8 before escaping is presumably the best practice
                              # http://stackoverflow.com/a/913653/404271
                              pars = {
                      Severity: Minor
                      Found in bypy/bypy.py - About 55 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function mppprgr has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def mppprgr(finish, total, start_time = None, existing = 0,
                      Severity: Major
                      Found in bypy/bypy.py - About 50 mins to fix

                        Function _stream_upload has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def _stream_upload(self, fo, pars, act, remotepath,
                        Severity: Minor
                        Found in bypy/bypy.py - About 45 mins to fix

                          Function _rapidupload_file_post has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def _rapidupload_file_post(self, rpath, size, md5str, slicemd5str, crcstr, ondup = 'overwrite'):
                          Severity: Minor
                          Found in bypy/bypy.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                if helpline.find('help') == 0:
                                                    summary.insert(0, helpline)
                                                else:
                                                    summary.append(helpline)
                                                #commands.append(v.__name__) # append command name
                            Severity: Major
                            Found in bypy/bypy.py - About 45 mins to fix

                              Function _downfile_act has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def _downfile_act(self, r, args):
                                      rfile, offset = args
                                      with io.open(self._current_file, 'r+b' if offset > 0 else 'wb') as f:
                                          if offset > 0:
                                              f.seek(offset)
                              Severity: Minor
                              Found in bypy/bypy.py - About 45 mins to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

                              Function clean_prog_files has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                              def clean_prog_files(cleanlevel, verbose, configdir = const.ConfigDir):
                                  tokenpath = os.path.join(configdir, const.TokenFileName)
                                  result = removefile(tokenpath, verbose)
                                  if result == const.ENoError:
                                      pr("Token file '{}' removed. You need to re-authorize "
                              Severity: Minor
                              Found in bypy/bypy.py - About 45 mins to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

                              Consider simplifying this complex logical expression.
                              Open

                                                  if (r.status_code != 200 and r.status_code != 206) \
                                                      or (not ('method' in pars and pars['method'] == 'download') \
                                                          and url.find('method=download') == -1 \
                                                          and url.find('baidupcs.com/file/') == -1):
                                                      self._print_error_json(r)
                              Severity: Major
                              Found in bypy/bypy.py - About 40 mins to fix

                                Function _dump_exception has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    def _dump_exception(self, ex, url, pars, r, act):
                                Severity: Minor
                                Found in bypy/bypy.py - About 35 mins to fix

                                  Function _proceed_remote_gather has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      def _proceed_remote_gather(self, walkresult, remotepath, dirjs, filejs, args = None):
                                  Severity: Minor
                                  Found in bypy/bypy.py - About 35 mins to fix

                                    Function _proceed_downdir has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                        def _proceed_downdir(self, walkresult, remotepath, dirjs, filejs, args):
                                    Severity: Minor
                                    Found in bypy/bypy.py - About 35 mins to fix

                                      Function _accept has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                          def _accept(self, rpath, size, md5str, slicemd5str, crcstr):
                                      Severity: Minor
                                      Found in bypy/bypy.py - About 35 mins to fix

                                        Function _request_work_die has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                            def _request_work_die(self, ex, url, pars, r, act):
                                        Severity: Minor
                                        Found in bypy/bypy.py - About 35 mins to fix

                                          Function _walk_proceed_remote_dir has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                          Open

                                              def _walk_proceed_remote_dir(self, remotepath, proceed, args = None, skip_remote_only_dirs = False, recursive = True):
                                          Severity: Minor
                                          Found in bypy/bypy.py - About 35 mins to fix

                                            Function _walk_remote_dir has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                            Open

                                                def _walk_remote_dir(self, remotepath, remoterootpath, args = None, skip_remote_only_dirs = False, recursive = True):
                                            Severity: Minor
                                            Found in bypy/bypy.py - About 35 mins to fix

                                              Function _proceed_share_remote has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                              Open

                                                  def _proceed_share_remote(self, walkresult, rpath, dirjs, filejs, args):
                                              Severity: Minor
                                              Found in bypy/bypy.py - About 35 mins to fix

                                                Function accept has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                Open

                                                    def accept(self, remotepath, size, md5str, slicemd5str, crcstr):
                                                Severity: Minor
                                                Found in bypy/bypy.py - About 35 mins to fix

                                                  Function _handle_more_response_error has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                  Open

                                                      def _handle_more_response_error(self, r, sc, ec, act, actargs):
                                                  Severity: Minor
                                                  Found in bypy/bypy.py - About 35 mins to fix

                                                    Function _proceed_list has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                    Open

                                                        def _proceed_list(self, walkresult, remotepath, dirjs, filejs, args):
                                                    Severity: Minor
                                                    Found in bypy/bypy.py - About 35 mins to fix

                                                      Function _syncdown_diff_one has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          def _syncdown_diff_one(self, rpath, localdir, d):
                                                              result = const.ENoError
                                                              t = d[0]
                                                              p = d[1]
                                                              #lcpath = os.path.join(localdir, p) # local complete path
                                                      Severity: Minor
                                                      Found in bypy/bypy.py - About 35 mins to fix

                                                      Cognitive Complexity

                                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                      A method's cognitive complexity is based on a few simple rules:

                                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                      • Code is considered more complex for each "break in the linear flow of the code"
                                                      • Code is considered more complex when "flow breaking structures are nested"

                                                      Further reading

                                                      Function _is_error_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          def _is_error_response(self, r):
                                                              # don't attempt on large contents
                                                              isJson = False
                                                              ContentTypeKey = 'Content-Type'
                                                              contentType = r.headers.get(ContentTypeKey)
                                                      Severity: Minor
                                                      Found in bypy/bypy.py - About 35 mins to fix

                                                      Cognitive Complexity

                                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                      A method's cognitive complexity is based on a few simple rules:

                                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                      • Code is considered more complex for each "break in the linear flow of the code"
                                                      • Code is considered more complex when "flow breaking structures are nested"

                                                      Further reading

                                                      Function _proceed_downdir has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          def _proceed_downdir(self, walkresult, remotepath, dirjs, filejs, args):
                                                              result = walkresult
                                                              rootrpath, localpath = args
                                                              #rlen = len(remotepath) + 1
                                                              rootlen = len(rootrpath) + 1 # '+ 1' for the trailing '/', it bites.
                                                      Severity: Minor
                                                      Found in bypy/bypy.py - About 35 mins to fix

                                                      Cognitive Complexity

                                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                      A method's cognitive complexity is based on a few simple rules:

                                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                      • Code is considered more complex for each "break in the linear flow of the code"
                                                      • Code is considered more complex when "flow breaking structures are nested"

                                                      Further reading

                                                      Function _get_json_errorcode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          def _get_json_errorcode(self, r, act, defaultec = const.ERequestFailed):
                                                              try:
                                                                  j = r.json()
                                                                  self.pd("Website returned JSON: {}".format(j))
                                                                  if 'error_code' in j:
                                                      Severity: Minor
                                                      Found in bypy/bypy.py - About 35 mins to fix

                                                      Cognitive Complexity

                                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                      A method's cognitive complexity is based on a few simple rules:

                                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                      • Code is considered more complex for each "break in the linear flow of the code"
                                                      • Code is considered more complex when "flow breaking structures are nested"

                                                      Further reading

                                                      Function _cdl_mon_act has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          def _cdl_mon_act(self, r, args):
                                                              try:
                                                                  task_id, start_time, done = args
                                                                  j = r.json()
                                                                  ti = j['task_info'][str(task_id)]
                                                      Severity: Minor
                                                      Found in bypy/bypy.py - About 35 mins to fix

                                                      Cognitive Complexity

                                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                      A method's cognitive complexity is based on a few simple rules:

                                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                      • Code is considered more complex for each "break in the linear flow of the code"
                                                      • Code is considered more complex when "flow breaking structures are nested"

                                                      Further reading

                                                      Avoid too many return statements within this function.
                                                      Open

                                                                  return subr
                                                      Severity: Major
                                                      Found in bypy/bypy.py - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                    return True
                                                        Severity: Major
                                                        Found in bypy/bypy.py - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                                      return False
                                                          Severity: Major
                                                          Found in bypy/bypy.py - About 30 mins to fix

                                                            Avoid too many return statements within this function.
                                                            Open

                                                                        return subr
                                                            Severity: Major
                                                            Found in bypy/bypy.py - About 30 mins to fix

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                              return result
                                                              Severity: Major
                                                              Found in bypy/bypy.py - About 30 mins to fix

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                            return const.EHashMismatch
                                                                Severity: Major
                                                                Found in bypy/bypy.py - About 30 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                              return result
                                                                  Severity: Major
                                                                  Found in bypy/bypy.py - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                            return const.EArgument
                                                                    Severity: Major
                                                                    Found in bypy/bypy.py - About 30 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                              return const.EParameter
                                                                      Severity: Major
                                                                      Found in bypy/bypy.py - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                                        return result
                                                                        Severity: Major
                                                                        Found in bypy/bypy.py - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                                      return False
                                                                          Severity: Major
                                                                          Found in bypy/bypy.py - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                                return const.EHashMismatch
                                                                            Severity: Major
                                                                            Found in bypy/bypy.py - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                          return result
                                                                              Severity: Major
                                                                              Found in bypy/bypy.py - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                            return result
                                                                                Severity: Major
                                                                                Found in bypy/bypy.py - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                          return result
                                                                                  Severity: Major
                                                                                  Found in bypy/bypy.py - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                                return const.EParameter
                                                                                    Severity: Major
                                                                                    Found in bypy/bypy.py - About 30 mins to fix

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

                                                                                                      return const.ESkipped
                                                                                      Severity: Major
                                                                                      Found in bypy/bypy.py - About 30 mins to fix

                                                                                        Avoid too many return statements within this function.
                                                                                        Open

                                                                                                        return False
                                                                                        Severity: Major
                                                                                        Found in bypy/bypy.py - About 30 mins to fix

                                                                                          Avoid too many return statements within this function.
                                                                                          Open

                                                                                                          return const.ENoError
                                                                                          Severity: Major
                                                                                          Found in bypy/bypy.py - About 30 mins to fix

                                                                                            Function help has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                            Open

                                                                                                def help(command): # this comes first to make it easy to spot
                                                                                                    ''' Usage: help <command> - provide some information for the command '''
                                                                                                    for i, v in ByPy.__dict__.items():
                                                                                                        if callable(v) and v.__doc__ and v.__name__ == command :
                                                                                                            help = v.__doc__.strip()
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py - About 25 mins to fix

                                                                                            Cognitive Complexity

                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                            Further reading

                                                                                            Function _select_fastest_mirror_act has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                            Open

                                                                                                def _select_fastest_mirror_act(self, r, args):
                                                                                                    pr("Selecting fastest mirror")
                                                                                                    j = r.json()
                                                                                                    self.pv("List of PCS mirrors:\n" + pprint.pformat(j))
                                                                                                    if 'path' not in j:
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py - About 25 mins to fix

                                                                                            Cognitive Complexity

                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                            Further reading

                                                                                            Function _syncup_local_one has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                            Open

                                                                                                def _syncup_local_one(self, rpath, localdir, l):
                                                                                                    result = const.ENoError
                                                                                                    t = l[0]
                                                                                                    p = l[1]
                                                                                                    #lcpath = os.path.join(localdir, p) # local complete path
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py - About 25 mins to fix

                                                                                            Cognitive Complexity

                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                            Further reading

                                                                                            Function _print_error_json has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                            Open

                                                                                                def _print_error_json(self, r):
                                                                                                    try:
                                                                                                        dj = r.json()
                                                                                                        if 'error_code' in dj and 'error_msg' in dj:
                                                                                                            ec = dj['error_code']
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py - About 25 mins to fix

                                                                                            Cognitive Complexity

                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                            Further reading

                                                                                            Function _proceed_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                            Open

                                                                                                def _proceed_list(self, walkresult, remotepath, dirjs, filejs, args):
                                                                                                    result = walkresult
                                                                                                    fmt = args
                                                                                                    # cutfront = const.AppPcsPathLen
                                                                                                    cutfront = len(remotepath) + 1
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py - About 25 mins to fix

                                                                                            Cognitive Complexity

                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                            Further reading

                                                                                            Function _share_local has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                            Open

                                                                                                def _share_local(self, lpath, rpath, fast):
                                                                                                    if not os.path.exists(lpath):
                                                                                                        perr("Local path '{}' does not exist.".format(lpath))
                                                                                                        return const.EParameter
                                                                                            
                                                                                            
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py - About 25 mins to fix

                                                                                            Cognitive Complexity

                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                            Further reading

                                                                                            Function _syncdown_single has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                            Open

                                                                                                def _syncdown_single(self, rpath, localdir, compare_result):
                                                                                                    result = const.ENoError
                                                                                                    same, diff, local, remote = compare_result
                                                                                                    # clear the way
                                                                                                    for d in diff:
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py - About 25 mins to fix

                                                                                            Cognitive Complexity

                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                            Further reading

                                                                                            Function _syncup_single has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                            Open

                                                                                                def _syncup_single(self, localdir, rpath, compare_result):
                                                                                                    result = const.ENoError
                                                                                                    same, diff, local, remote = compare_result
                                                                                                    # clear the way
                                                                                                    for d in diff:
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py - About 25 mins to fix

                                                                                            Cognitive Complexity

                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                            Further reading

                                                                                            Function share has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                            Open

                                                                                                def share(self, path = '.', sharepath = '/', islocal = True, fast = False):
                                                                                                    islocal = str2bool(islocal)
                                                                                                    fast = str2bool(fast)
                                                                                                    if islocal:
                                                                                                        lpath = path
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py - About 25 mins to fix

                                                                                            Cognitive Complexity

                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                            Further reading

                                                                                            Function _compare_size has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                            Open

                                                                                                def _compare_size(self, lsize, rjson):
                                                                                                    if 'size' in rjson:
                                                                                                        rsize = rjson['size']
                                                                                                        if lsize == rsize:
                                                                                                            return 0
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py - About 25 mins to fix

                                                                                            Cognitive Complexity

                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                            Further reading

                                                                                            Function _syncdown_remote_one has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                            Open

                                                                                                def _syncdown_remote_one(self, rpath, localdir, r):
                                                                                                    result = const.ENoError
                                                                                                    t = r[0]
                                                                                                    p = r[1]
                                                                                                    #lcpath = os.path.join(localdir, p) # local complete path
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py - About 25 mins to fix

                                                                                            Cognitive Complexity

                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                            Further reading

                                                                                            Function _syncup_delete_remote has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                            Open

                                                                                                def _syncup_delete_remote(self, rpath, remote):
                                                                                                    result = const.ENoError
                                                                                                    # i think the list is built top-down, so directories appearing later are either
                                                                                                    # children or another set of directories
                                                                                                    pp = '\\' # previous path, setting to '\\' make sure it won't be found in the first step
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py - About 25 mins to fix

                                                                                            Cognitive Complexity

                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                            Further reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                def syncup(self, localdir = '', remotedir = '', deleteremote = False):
                                                                                                    ''' Usage: syncup [localdir] [remotedir] [deleteremote] - \
                                                                                            sync up from the local directory to the remote directory
                                                                                              localdir - the local directory to sync from if not specified, it defaults to the current directory.
                                                                                              remotedir - the remote directory at Baidu Yun (after app's directory) to sync to. \
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 1 day to fix
                                                                                            bypy/bypy.py on lines 2911..2938

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 194.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                def syncdown(self, remotedir = '', localdir = '', deletelocal = False):
                                                                                                    ''' Usage: syncdown [remotedir] [localdir] [deletelocal] - \
                                                                                            sync down from the remote directory to the local directory
                                                                                              remotedir - the remote directory at Baidu Yun (after app's directory) to sync from. \
                                                                                            if not specified, it defaults to the root directory
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 1 day to fix
                                                                                            bypy/bypy.py on lines 3034..3061

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 194.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                def _syncup_multi(self, localdir, rpath, compare_result):
                                                                                                    result = const.ENoError
                                                                                                    same, diff, local, remote = compare_result
                                                                                                    # clear the way
                                                                                                    worker = partial(self._syncup_diff_one, rpath, localdir)
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 7 hrs to fix
                                                                                            bypy/bypy.py on lines 2897..2909

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 115.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                def _syncdown_multi(self, rpath, localdir, compare_result):
                                                                                                    result = const.ENoError
                                                                                                    same, diff, local, remote = compare_result
                                                                                                    # clear the way
                                                                                                    worker = partial(self._syncdown_diff_one, rpath, localdir)
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 7 hrs to fix
                                                                                            bypy/bypy.py on lines 3020..3032

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 115.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                def _syncdown_single(self, rpath, localdir, compare_result):
                                                                                                    result = const.ENoError
                                                                                                    same, diff, local, remote = compare_result
                                                                                                    # clear the way
                                                                                                    for d in diff:
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 6 hrs to fix
                                                                                            bypy/bypy.py on lines 3006..3018

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 101.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                def _syncup_single(self, localdir, rpath, compare_result):
                                                                                                    result = const.ENoError
                                                                                                    same, diff, local, remote = compare_result
                                                                                                    # clear the way
                                                                                                    for d in diff:
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 6 hrs to fix
                                                                                            bypy/bypy.py on lines 2883..2895

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 101.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                def _remove_local_on_success(self, localpath):
                                                                                                    if self._deletesource:
                                                                                                        self.pd("Removing local path '{}' after successful upload.".format(localpath))
                                                                                                        result = cached.remove_path_and_cache(localpath)
                                                                                                        if result == const.ENoError:
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 4 hrs to fix
                                                                                            bypy/bypy.py on lines 1212..1220

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 83.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                def _remove_remote_on_success(self, remotepath):
                                                                                                    if self._deletesource:
                                                                                                        self.pd("Removing remote path '{}' after successful download.".format(remotepath))
                                                                                                        result = self._delete(remotepath)
                                                                                                        if result == const.ENoError:
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 4 hrs to fix
                                                                                            bypy/bypy.py on lines 1222..1230

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 83.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                def copy(self, fromp, to):
                                                                                                    ''' Usage: copy/cp <from> <to> - \
                                                                                            copy a file / dir remotely at Baidu Yun
                                                                                              from - source path (file / dir)
                                                                                              to - destination path (file / dir)
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 4 hrs to fix
                                                                                            bypy/bypy.py on lines 2491..2505

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 77.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                def move(self, fromp, to):
                                                                                                    ''' Usage: move/mv/rename/ren <from> <to> - \
                                                                                            move a file / dir remotely at Baidu Yun
                                                                                              from - source path (file / dir)
                                                                                              to - destination path (file / dir)
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 4 hrs to fix
                                                                                            bypy/bypy.py on lines 2521..2535

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 77.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                        for refresh in self.RefreshServerList:
                                                                                                            (url, retry, msg) = refresh
                                                                                                            pr(msg)
                                                                                                            result = self._get(url, pars, self._refresh_token_act, retry = retry, addtoken = False)
                                                                                                            if result == const.ENoError:
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 2 hrs to fix
                                                                                            bypy/bypy.py on lines 1076..1080

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 59.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                        for auth in self.AuthServerList:
                                                                                                            (url, retry, msg) = auth
                                                                                                            pr(msg)
                                                                                                            result = self._get(url, pars, self._server_auth_act, retry = retry, addtoken = False)
                                                                                                            if result == const.ENoError:
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 2 hrs to fix
                                                                                            bypy/bypy.py on lines 1157..1161

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 59.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                            if i < tries:
                                                                                                                # algo changed: delay more after each failure
                                                                                                                delay = const.RetryDelayInSec * i
                                                                                                                perr("Waiting {} seconds before retrying...".format(delay))
                                                                                                                time.sleep(delay)
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 2 hrs to fix
                                                                                            bypy/bypy.py on lines 2068..2073

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 56.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                        if i < tries:
                                                                                                            # algo changed: delay more after each failure
                                                                                                            delay = const.RetryDelayInSec * i
                                                                                                            perr("Waiting {} seconds before retrying...".format(delay))
                                                                                                            time.sleep(delay)
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 2 hrs to fix
                                                                                            bypy/bypy.py on lines 887..892

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 56.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                            Open

                                                                                                    if result == const.ENoError:
                                                                                                        self.pv("'{}' =C=> '{}' OK.".format(self._current_file, args))
                                                                                                    else:
                                                                                                        perr("'{}' =C=> '{}' FAILED.".format(self._current_file, args))
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 3 other locations - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 1735..1738
                                                                                            bypy/bypy.py on lines 2015..2018
                                                                                            bypy/bypy.py on lines 2133..2136

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 47.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                            Open

                                                                                                    if result == const.ENoError:
                                                                                                        self.pv("'{}' <== '{}' OK".format(self._current_file, rfile))
                                                                                                    else:
                                                                                                        perr("'{}' <== '{}' FAILED".format(self._current_file, rfile))
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 3 other locations - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 1486..1489
                                                                                            bypy/bypy.py on lines 1735..1738
                                                                                            bypy/bypy.py on lines 2133..2136

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 47.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                            Open

                                                                                                    if result == const.ENoError:
                                                                                                        self.pv("'{}' ==> '{}' OK.".format(self._current_file, args))
                                                                                                    else:
                                                                                                        perr("'{}' ==> '{}' FAILED.".format(self._current_file, args))
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 3 other locations - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 1486..1489
                                                                                            bypy/bypy.py on lines 2015..2018
                                                                                            bypy/bypy.py on lines 2133..2136

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 47.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                            Open

                                                                                                    if result == const.ENoError:
                                                                                                        self.pv("'{}' <== '{}' OK".format(self._current_file, rfile))
                                                                                                    else:
                                                                                                        perr("'{}' <== '{}' FAILED".format(self._current_file, rfile))
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 3 other locations - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 1486..1489
                                                                                            bypy/bypy.py on lines 1735..1738
                                                                                            bypy/bypy.py on lines 2015..2018

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 47.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                    try:
                                                                                                        task_id, start_time, done = args
                                                                                                        j = r.json()
                                                                                                        ti = j['task_info'][str(task_id)]
                                                                                                        if ('file_size' not in ti) or ('finished_size' not in ti):
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 3171..3178

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 47.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                    try:
                                                                                                        args[0] = r.json()
                                                                                                        pr(pprint.pformat(args[0]))
                                                                                                        return const.ENoError
                                                                                                    except Exception as ex:
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 3150..3168

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 47.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                    if const.ENoError == subr:
                                                                                                        if 'isdir' in self._remote_json:
                                                                                                            if self._remote_json['isdir']:
                                                                                                                return self._share_remote_dir(tmpdir, rpath, srpath, fast)
                                                                                                            else:
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 2425..2439

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 46.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                    if const.ENoError == subr:
                                                                                                        if 'isdir' in self._remote_json:
                                                                                                            if self._remote_json['isdir']:
                                                                                                                return self.downdir(remotepath, localpath)
                                                                                                            else:
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 3404..3418

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 46.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                            Open

                                                                                                def _list_pcs_hosts(self):
                                                                                                    url = const.PcsUrl + 'manage'
                                                                                                    pars = { 'method': 'listhost'}
                                                                                                    return self._get(url, pars, self._list_pcs_hosts_act, addtoken = False)
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 2 other locations - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 3469..3472
                                                                                            bypy/bypy.py on lines 3518..3521

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 45.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                            Open

                                                                                                def _select_fastest_mirror(self):
                                                                                                    url = const.PcsUrl + 'manage'
                                                                                                    pars = { 'method': 'listhost'}
                                                                                                    return self._get(url, pars, self._select_fastest_mirror_act, addtoken = False)
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 2 other locations - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 3469..3472
                                                                                            bypy/bypy.py on lines 3479..3482

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 45.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                            Open

                                                                                                def _locate_fastest_upload_server(self):
                                                                                                    url = const.PcsUrl + 'file'
                                                                                                    pars = { 'method': 'locateupload'}
                                                                                                    return self._get(url, pars, self._locate_fastest_upload_server_act, addtoken = False)
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 2 other locations - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 3479..3482
                                                                                            bypy/bypy.py on lines 3518..3521

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 45.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                        if result == const.ENoError:
                                                                                                            pr("Successfully authorized")
                                                                                                        else:
                                                                                                            perr("Fatal: All server authorizations failed.")
                                                                                                            self._prompt_clean()
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 1166..1171

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 43.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                        if result == const.ENoError:
                                                                                                            pr("Token successfully refreshed")
                                                                                                        else:
                                                                                                            perr("Token-refreshing on all the servers failed")
                                                                                                            self._prompt_clean()
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 1085..1090

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 43.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                        if t == 'F' or t == 'FD':
                                                                                                            subresult = self._upload_file(lcpath, rcpath)
                                                                                                            if subresult != const.ENoError:
                                                                                                                result = subresult
                                                                                                        else: # " t == 'DF' " must be true
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 2978..2985

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 42.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                    if t == 'F':
                                                                                                        subresult = self._upload_file(lcpath, rcpath)
                                                                                                        if subresult != const.ENoError:
                                                                                                            result = subresult
                                                                                                    else: # " t == 'D' " must be true
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 2956..2963

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 42.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                try:
                                                                                                    chunk_size = interpret_size(args.chunk)
                                                                                                except (ValueError, KeyError):
                                                                                                    perr("Error: Invalid slice size specified '{}'".format(args.slice))
                                                                                                    return const.EArgument
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 3794..3798

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 41.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                try:
                                                                                                    slice_size = interpret_size(args.slice)
                                                                                                except (ValueError, KeyError):
                                                                                                    perr("Error: Invalid slice size specified '{}'".format(args.slice))
                                                                                                    return const.EArgument
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 3800..3804

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 41.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                    if 'size' in j:
                                                                                                        rsize = j['size']
                                                                                                    else:
                                                                                                        perr("Unable to verify JSON: '{}', as no 'size' entry found".format(j))
                                                                                                        return const.EHashMismatch
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 1286..1297

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 40.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                    if 'md5' in j:
                                                                                                        rmd5 = j['md5']
                                                                                                    #elif 'block_list' in j and len(j['block_list']) > 0:
                                                                                                    #    rmd5 = j['block_list'][0]
                                                                                                    #else:
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 1280..1284

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 40.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                        if const.ENoError == self._verify_current_file(self._remote_json, False) \
                                                                                                            and not (self._downloader[:5] == const.DownloaderAria2 and os.path.exists(localfile + '.aria2')):
                                                                                                            self.pd("Same local file '{}' already exists, skip downloading".format(localfile))
                                                                                                            self._remove_remote_on_success(remotefile)
                                                                                                            return const.ENoError
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 2188..2192

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 38.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                        if not self.shalloverwrite("Same-name directory '{}' exists, "
                                                                                                            "do you want to remove it? [y/N]".format(localfile)):
                                                                                                            pinfo("Same-name directory '{}' exists, skip downloading".format(localfile))
                                                                                                            #return const.ENoError
                                                                                                            return const.ESkipped
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 2165..2175

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 38.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                def cdl_add(self, source_url, save_path = '/', timeout = 3600):
                                                                                                    ''' Usage: cdl_add <source_url> [save_path] [timeout] - add an offline (cloud) download task
                                                                                              source_url - the URL to download file from.
                                                                                              save_path - path on PCS to save file to. default is to save to root directory '/'.
                                                                                              timeout - timeout in seconds. default is 3600 seconds.
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 3221..3228

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 38.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                def cdl_addmon(self, source_url, save_path = '/', timeout = 3600):
                                                                                                    ''' Usage: cdl_addmon <source_url> [save_path] [timeout] - add an offline (cloud) download task and monitor the download progress
                                                                                              source_url - the URL to download file from.
                                                                                              save_path - path on PCS to save file to. default is to save to root directory '/'.
                                                                                              timeout - timeout in seconds. default is 3600 seconds.
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 1 other location - About 1 hr to fix
                                                                                            bypy/bypy.py on lines 3122..3129

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 38.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                def _get_meta(self, remotefile):
                                                                                                    pars = {
                                                                                                        'method' : 'meta',
                                                                                                        'path' : remotefile }
                                                                                                    return self._get(
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py and 1 other location - About 55 mins to fix
                                                                                            bypy/bypy.py on lines 3240..3244

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 37.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                def _cdl_cancel(self, task_id):
                                                                                                    pars = {
                                                                                                        'method': 'cancel_task',
                                                                                                        'task_id': task_id }
                                                                                                    return self._post(pcsurl + 'services/cloud_dl', pars, self._cdl_act)
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py and 1 other location - About 55 mins to fix
                                                                                            bypy/bypy.py on lines 1984..1990

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 37.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                    (len(args.command) == 1 and args.command[0].lower() == 'help'):
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py and 1 other location - About 50 mins to fix
                                                                                            bypy/bypy.py on lines 3810..3810

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 36.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                elif len(args.command) == 2 and args.command[0].lower() == 'help':
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py and 1 other location - About 50 mins to fix
                                                                                            bypy/bypy.py on lines 3807..3807

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 36.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                def _post(self, url, pars, act, actargs = None, retry = True, addtoken = True, dumpex = True, **kwargs):
                                                                                                    return self._request(url, pars, act, 'POST', actargs, retry, addtoken, dumpex, **kwargs)
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py and 1 other location - About 50 mins to fix
                                                                                            bypy/bypy.py on lines 904..905

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 36.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                def _get(self, url, pars, act, actargs = None, retry = True, addtoken = True, dumpex = True, **kwargs):
                                                                                                    return self._request(url, pars, act, 'GET', actargs, retry, addtoken, dumpex, **kwargs)
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py and 1 other location - About 50 mins to fix
                                                                                            bypy/bypy.py on lines 907..908

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 36.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                    if self._verify:
                                                                                                        self._current_file_size = getfilesize(self._current_file)
                                                                                                        result = self._verify_current_file(self._remote_json, False)
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py and 1 other location - About 35 mins to fix
                                                                                            bypy/bypy.py on lines 2011..2013

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 33.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                    if self._verify:
                                                                                                        self._current_file_size = getfilesize(self._current_file)
                                                                                                        result = self._verify_current_file(self._remote_json, False)
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py and 1 other location - About 35 mins to fix
                                                                                            bypy/bypy.py on lines 2129..2131

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 33.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                        pars = {
                                                                                                            'method' : 'list',
                                                                                                            'path' : remotepath,
                                                                                                            'by' : 'name',
                                                                                                            'order' : 'asc',
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py and 1 other location - About 30 mins to fix
                                                                                            bypy/bypy.py on lines 1370..1375

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 32.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                def _delete_children(self, rpath):
                                                                                                    pars = {
                                                                                                        'method' : 'list',
                                                                                                        'path' : rpath}
                                                                                            
                                                                                            
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py and 1 other location - About 30 mins to fix
                                                                                            bypy/bypy.py on lines 2650..2654

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 32.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                            Open

                                                                                                    for c in same:
                                                                                                        pr("{} - {}".format(c[0], c[1]))
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 3 other locations - About 30 mins to fix
                                                                                            bypy/bypy.py on lines 2800..2801
                                                                                            bypy/bypy.py on lines 2804..2805
                                                                                            bypy/bypy.py on lines 2808..2809

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 32.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                            Open

                                                                                                    for l in local:
                                                                                                        pr("{} - {}".format(l[0], l[1]))
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 3 other locations - About 30 mins to fix
                                                                                            bypy/bypy.py on lines 2796..2797
                                                                                            bypy/bypy.py on lines 2800..2801
                                                                                            bypy/bypy.py on lines 2808..2809

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 32.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                            pars = {
                                                                                                                'method' : 'list',
                                                                                                                'path' : rdir,
                                                                                                                'by' : 'name', # sort in case we can use binary-search, etc in the futrue.
                                                                                                                'order' : 'asc',
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py and 1 other location - About 30 mins to fix
                                                                                            bypy/bypy.py on lines 2305..2310

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 32.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                            Open

                                                                                                    if fsid:
                                                                                                        pars = {
                                                                                                            'method' : 'restore',
                                                                                                            'fs_id' : fsid }
                                                                                                        return self._post(pcsurl + 'file', pars, self._restore_act, path)
                                                                                            Severity: Minor
                                                                                            Found in bypy/bypy.py and 1 other location - About 30 mins to fix
                                                                                            bypy/bypy.py on lines 2569..2574

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 32.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                            Open

                                                                                                    for r in remote:
                                                                                                        pr("{} - {}".format(r[0], r[1]))
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 3 other locations - About 30 mins to fix
                                                                                            bypy/bypy.py on lines 2796..2797
                                                                                            bypy/bypy.py on lines 2800..2801
                                                                                            bypy/bypy.py on lines 2804..2805

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 32.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                            Open

                                                                                                    for d in diff:
                                                                                                        pr("{} - {}".format(d[0], d[1]))
                                                                                            Severity: Major
                                                                                            Found in bypy/bypy.py and 3 other locations - About 30 mins to fix
                                                                                            bypy/bypy.py on lines 2796..2797
                                                                                            bypy/bypy.py on lines 2804..2805
                                                                                            bypy/bypy.py on lines 2808..2809

                                                                                            Duplicated Code

                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                            Tuning

                                                                                            This issue has a mass of 32.

                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                            Refactorings

                                                                                            Further Reading

                                                                                            There are no issues that match your filters.

                                                                                            Category
                                                                                            Status