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