python3: fixed usage of .next() and .func_name
This commit is contained in:
parent
94a50edf39
commit
0122133e4e
13 changed files with 18 additions and 18 deletions
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -505,7 +505,7 @@ try:
|
|||
advance_iterator = next
|
||||
except NameError:
|
||||
def advance_iterator(it):
|
||||
return it.next()
|
||||
return next(it)
|
||||
next = advance_iterator
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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 <me@email.com>'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue