diff --git a/rhodecode/apps/admin/views/permissions.py b/rhodecode/apps/admin/views/permissions.py index 116230a9..7c3b48f6 100644 --- a/rhodecode/apps/admin/views/permissions.py +++ b/rhodecode/apps/admin/views/permissions.py @@ -348,7 +348,7 @@ class AdminPermissionsView(BaseAppView, DataGridAppView): if 'route_name' in intr and intr['attr']: view_intr[intr['route_name']] = '{}:{}'.format( - str(intr['derived_callable'].func_name), intr['attr'] + str(intr['derived_callable'].__name__), intr['attr'] ) c.whitelist_key = 'api_access_controllers_whitelist' diff --git a/rhodecode/authentication/registry.py b/rhodecode/authentication/registry.py index e4fcfdf1..fd1c50af 100644 --- a/rhodecode/authentication/registry.py +++ b/rhodecode/authentication/registry.py @@ -109,7 +109,7 @@ class AuthenticationPluginRegistry(object): plugins = _get_auth_plugins('rhodecode_auth_plugins', 'v1', self._fallback_plugin) compute_time = time.time() - start - log.debug('cached method:%s took %.4fs', _get_auth_plugins.func_name, compute_time) + log.debug('cached method:%s took %.4fs', _get_auth_plugins.__name__, compute_time) statsd = StatsdClient.statsd if statsd: diff --git a/rhodecode/config/rcextensions/utils.py b/rhodecode/config/rcextensions/utils.py index 9ea2b6f3..00d2e0b9 100644 --- a/rhodecode/config/rcextensions/utils.py +++ b/rhodecode/config/rcextensions/utils.py @@ -137,10 +137,10 @@ def has_kwargs(required_args): """ def wrap(func): def wrapper(*args, **kwargs): - _verify_kwargs(func.func_name, required_args.keys(), kwargs) + _verify_kwargs(func.__name__, required_args.keys(), kwargs) # in case there's `calls` defined on module we store the data - maybe_log_call(func.func_name, args, kwargs) - log.debug('Calling rcextensions function %s', func.func_name) + maybe_log_call(func.__name__, args, kwargs) + log.debug('Calling rcextensions function %s', func.__name__) return func(*args, **kwargs) return wrapper return wrap diff --git a/rhodecode/lib/_vendor/authomatic/six.py b/rhodecode/lib/_vendor/authomatic/six.py index 14e3e497..13ed8526 100755 --- a/rhodecode/lib/_vendor/authomatic/six.py +++ b/rhodecode/lib/_vendor/authomatic/six.py @@ -505,7 +505,7 @@ try: advance_iterator = next except NameError: def advance_iterator(it): - return it.next() + return next(it) next = advance_iterator diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py index a910f45d..b2a3b1fa 100644 --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -615,7 +615,7 @@ def color_hasher(n=10000, saturation=0.10, lightness=0.95): if thing in color_dict: col = color_dict[thing] else: - col = color_dict[thing] = cgenerator.next() + col = color_dict[thing] = next(cgenerator) return "rgb(%s)" % (', '.join(col)) return get_color_string diff --git a/rhodecode/lib/middleware/simplevcs.py b/rhodecode/lib/middleware/simplevcs.py index 4d29defc..5ad01f69 100644 --- a/rhodecode/lib/middleware/simplevcs.py +++ b/rhodecode/lib/middleware/simplevcs.py @@ -98,7 +98,7 @@ def initialize_generator(factory): def wrapper(*args, **kwargs): gen = factory(*args, **kwargs) try: - init = gen.next() + init = next(gen) except StopIteration: raise ValueError('Generator must yield at least one element.') if init != "__init__": diff --git a/rhodecode/lib/vcs/client_http.py b/rhodecode/lib/vcs/client_http.py index b89df0ae..33c2246b 100644 --- a/rhodecode/lib/vcs/client_http.py +++ b/rhodecode/lib/vcs/client_http.py @@ -388,12 +388,12 @@ class VcsHttpProxy(object): def _get_result(self, result): iterator = self._iterate(result) - error = iterator.next() + error = next(iterator) if error: self._deserialize_and_raise(error) - status = iterator.next() - headers = iterator.next() + status = next(iterator) + headers = next(iterator) return iterator, status, headers diff --git a/rhodecode/model/__init__.py b/rhodecode/model/__init__.py index 18d4ce11..adf37175 100644 --- a/rhodecode/model/__init__.py +++ b/rhodecode/model/__init__.py @@ -85,7 +85,7 @@ class BaseModel(object): if instance: if callback is None: raise Exception( - 'given object must be int, long or Instance of %s ' + 'given object must be int or Instance of %s ' 'got %s, no callback provided' % (cls, type(instance)) ) else: diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py index efb6b73d..9cca864c 100644 --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -1907,7 +1907,7 @@ class Repository(Base, BaseModel): @classmethod def get_by_id_or_repo_name(cls, repoid): - if isinstance(repoid, (int, long)): + if isinstance(repoid, int): try: repo = cls.get(repoid) except ValueError: diff --git a/rhodecode/model/settings.py b/rhodecode/model/settings.py index ccae85e1..49edd86b 100644 --- a/rhodecode/model/settings.py +++ b/rhodecode/model/settings.py @@ -253,7 +253,7 @@ class SettingsModel(BaseModel): start = time.time() result = _get_all_settings('rhodecode_settings', cache_key) compute_time = time.time() - start - log.debug('cached method:%s took %.4fs', _get_all_settings.func_name, compute_time) + log.debug('cached method:%s took %.4fs', _get_all_settings.__name__, compute_time) statsd = StatsdClient.statsd if statsd: diff --git a/rhodecode/tests/__init__.py b/rhodecode/tests/__init__.py index d4f116b6..42c26869 100644 --- a/rhodecode/tests/__init__.py +++ b/rhodecode/tests/__init__.py @@ -57,7 +57,7 @@ __all__ = [ # SOME GLOBALS FOR TESTS TEST_DIR = tempfile.gettempdir() -TESTS_TMP_PATH = jn(TEST_DIR, 'rc_test_%s' % _RandomNameSequence().next()) +TESTS_TMP_PATH = jn(TEST_DIR, 'rc_test_{}'.format(next(_RandomNameSequence()))) TEST_USER_ADMIN_LOGIN = 'test_admin' TEST_USER_ADMIN_PASS = 'test12' TEST_USER_ADMIN_EMAIL = 'test_admin@mail.com' diff --git a/rhodecode/tests/scripts/test_concurency.py b/rhodecode/tests/scripts/test_concurency.py index 5cbed440..1f8571e8 100644 --- a/rhodecode/tests/scripts/test_concurency.py +++ b/rhodecode/tests/scripts/test_concurency.py @@ -146,7 +146,7 @@ def test_clone_with_credentials(repo=HG_REPO, method=METHOD, cwd = path = jn(TESTS_TMP_PATH, repo) if seq is None: - seq = _RandomNameSequence().next() + seq = next(_RandomNameSequence()) try: shutil.rmtree(path, ignore_errors=True) @@ -190,7 +190,7 @@ if __name__ == '__main__': backend = 'hg' if METHOD == 'pull': - seq = _RandomNameSequence().next() + seq = next(_RandomNameSequence()) test_clone_with_credentials(repo=sys.argv[1], method='clone', seq=seq, backend=backend) s = time.time() diff --git a/rhodecode/tests/vcs_operations/__init__.py b/rhodecode/tests/vcs_operations/__init__.py index 561c3391..87ea0b20 100644 --- a/rhodecode/tests/vcs_operations/__init__.py +++ b/rhodecode/tests/vcs_operations/__init__.py @@ -83,7 +83,7 @@ def _add_files(vcs, dest, clone_url=None, tags=None, target_branch=None, new_bra cwd = path = jn(dest) tags = tags or [] - added_file = jn(path, '%s_setup.py' % tempfile._RandomNameSequence().next()) + added_file = jn(path, '{}_setup.py'.format(next(tempfile._RandomNameSequence()))) Command(cwd).execute('touch %s' % added_file) Command(cwd).execute('%s add %s' % (vcs, added_file)) author_str = 'Marcin Kuźminski '