##// END OF EJS Templates
python3: fixed usage of .next() and .func_name
super-admin -
r4936:0d6cd344 default
parent child Browse files
Show More
@@ -348,7 +348,7 b' class AdminPermissionsView(BaseAppView, '
348 348
349 349 if 'route_name' in intr and intr['attr']:
350 350 view_intr[intr['route_name']] = '{}:{}'.format(
351 str(intr['derived_callable'].func_name), intr['attr']
351 str(intr['derived_callable'].__name__), intr['attr']
352 352 )
353 353
354 354 c.whitelist_key = 'api_access_controllers_whitelist'
@@ -109,7 +109,7 b' class AuthenticationPluginRegistry(objec'
109 109 plugins = _get_auth_plugins('rhodecode_auth_plugins', 'v1', self._fallback_plugin)
110 110
111 111 compute_time = time.time() - start
112 log.debug('cached method:%s took %.4fs', _get_auth_plugins.func_name, compute_time)
112 log.debug('cached method:%s took %.4fs', _get_auth_plugins.__name__, compute_time)
113 113
114 114 statsd = StatsdClient.statsd
115 115 if statsd:
@@ -137,10 +137,10 b' def has_kwargs(required_args):'
137 137 """
138 138 def wrap(func):
139 139 def wrapper(*args, **kwargs):
140 _verify_kwargs(func.func_name, required_args.keys(), kwargs)
140 _verify_kwargs(func.__name__, required_args.keys(), kwargs)
141 141 # in case there's `calls` defined on module we store the data
142 maybe_log_call(func.func_name, args, kwargs)
143 log.debug('Calling rcextensions function %s', func.func_name)
142 maybe_log_call(func.__name__, args, kwargs)
143 log.debug('Calling rcextensions function %s', func.__name__)
144 144 return func(*args, **kwargs)
145 145 return wrapper
146 146 return wrap
@@ -505,7 +505,7 b' try:'
505 505 advance_iterator = next
506 506 except NameError:
507 507 def advance_iterator(it):
508 return it.next()
508 return next(it)
509 509 next = advance_iterator
510 510
511 511
@@ -615,7 +615,7 b' def color_hasher(n=10000, saturation=0.1'
615 615 if thing in color_dict:
616 616 col = color_dict[thing]
617 617 else:
618 col = color_dict[thing] = cgenerator.next()
618 col = color_dict[thing] = next(cgenerator)
619 619 return "rgb(%s)" % (', '.join(col))
620 620
621 621 return get_color_string
@@ -98,7 +98,7 b' def initialize_generator(factory):'
98 98 def wrapper(*args, **kwargs):
99 99 gen = factory(*args, **kwargs)
100 100 try:
101 init = gen.next()
101 init = next(gen)
102 102 except StopIteration:
103 103 raise ValueError('Generator must yield at least one element.')
104 104 if init != "__init__":
@@ -388,12 +388,12 b' class VcsHttpProxy(object):'
388 388
389 389 def _get_result(self, result):
390 390 iterator = self._iterate(result)
391 error = iterator.next()
391 error = next(iterator)
392 392 if error:
393 393 self._deserialize_and_raise(error)
394 394
395 status = iterator.next()
396 headers = iterator.next()
395 status = next(iterator)
396 headers = next(iterator)
397 397
398 398 return iterator, status, headers
399 399
@@ -85,7 +85,7 b' class BaseModel(object):'
85 85 if instance:
86 86 if callback is None:
87 87 raise Exception(
88 'given object must be int, long or Instance of %s '
88 'given object must be int or Instance of %s '
89 89 'got %s, no callback provided' % (cls, type(instance))
90 90 )
91 91 else:
@@ -1907,7 +1907,7 b' class Repository(Base, BaseModel):'
1907 1907
1908 1908 @classmethod
1909 1909 def get_by_id_or_repo_name(cls, repoid):
1910 if isinstance(repoid, (int, long)):
1910 if isinstance(repoid, int):
1911 1911 try:
1912 1912 repo = cls.get(repoid)
1913 1913 except ValueError:
@@ -253,7 +253,7 b' class SettingsModel(BaseModel):'
253 253 start = time.time()
254 254 result = _get_all_settings('rhodecode_settings', cache_key)
255 255 compute_time = time.time() - start
256 log.debug('cached method:%s took %.4fs', _get_all_settings.func_name, compute_time)
256 log.debug('cached method:%s took %.4fs', _get_all_settings.__name__, compute_time)
257 257
258 258 statsd = StatsdClient.statsd
259 259 if statsd:
@@ -57,7 +57,7 b' log = logging.getLogger(__name__)'
57 57 # SOME GLOBALS FOR TESTS
58 58 TEST_DIR = tempfile.gettempdir()
59 59
60 TESTS_TMP_PATH = jn(TEST_DIR, 'rc_test_%s' % _RandomNameSequence().next())
60 TESTS_TMP_PATH = jn(TEST_DIR, 'rc_test_{}'.format(next(_RandomNameSequence())))
61 61 TEST_USER_ADMIN_LOGIN = 'test_admin'
62 62 TEST_USER_ADMIN_PASS = 'test12'
63 63 TEST_USER_ADMIN_EMAIL = 'test_admin@mail.com'
@@ -146,7 +146,7 b' def test_clone_with_credentials(repo=HG_'
146 146 cwd = path = jn(TESTS_TMP_PATH, repo)
147 147
148 148 if seq is None:
149 seq = _RandomNameSequence().next()
149 seq = next(_RandomNameSequence())
150 150
151 151 try:
152 152 shutil.rmtree(path, ignore_errors=True)
@@ -190,7 +190,7 b" if __name__ == '__main__':"
190 190 backend = 'hg'
191 191
192 192 if METHOD == 'pull':
193 seq = _RandomNameSequence().next()
193 seq = next(_RandomNameSequence())
194 194 test_clone_with_credentials(repo=sys.argv[1], method='clone',
195 195 seq=seq, backend=backend)
196 196 s = time.time()
@@ -83,7 +83,7 b' def _add_files(vcs, dest, clone_url=None'
83 83 cwd = path = jn(dest)
84 84
85 85 tags = tags or []
86 added_file = jn(path, '%s_setup.py' % tempfile._RandomNameSequence().next())
86 added_file = jn(path, '{}_setup.py'.format(next(tempfile._RandomNameSequence())))
87 87 Command(cwd).execute('touch %s' % added_file)
88 88 Command(cwd).execute('%s add %s' % (vcs, added_file))
89 89 author_str = 'Marcin Kuźminski <me@email.com>'
General Comments 0
You need to be logged in to leave comments. Login now