##// END OF EJS Templates
py3: remove use of pyramid.compat
super-admin -
r4908:04e2d7da default
parent child Browse files
Show More
@@ -22,8 +22,6 b' import logging'
22 22 import itertools
23 23 import base64
24 24
25 from pyramid import compat
26
27 25 from rhodecode.api import (
28 26 jsonrpc_method, JSONRPCError, JSONRPCForbidden, find_methods)
29 27
@@ -19,7 +19,6 b''
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 import logging
22 from pyramid import compat
23 22
24 23 from rhodecode.api import (
25 24 jsonrpc_method, JSONRPCError, JSONRPCForbidden, JSONRPCValidationError)
@@ -245,7 +244,7 b' def create_user(request, apiuser, userna'
245 244 # generate temporary password if user is external
246 245 password = PasswordGenerator().gen_password(length=16)
247 246 create_repo_group = Optional.extract(create_personal_repo_group)
248 if isinstance(create_repo_group, compat.string_types):
247 if isinstance(create_repo_group, str):
249 248 create_repo_group = str2bool(create_repo_group)
250 249
251 250 username = Optional.extract(username)
@@ -22,7 +22,6 b' import time'
22 22 import logging
23 23 import operator
24 24
25 from pyramid import compat
26 25 from pyramid.httpexceptions import HTTPFound, HTTPForbidden, HTTPBadRequest
27 26
28 27 from rhodecode.lib import helpers as h, diffs, rc_cache
@@ -531,7 +530,7 b' class DataGridAppView(object):'
531 530 return draw, start, length
532 531
533 532 def _get_order_col(self, order_by, model):
534 if isinstance(order_by, compat.string_types):
533 if isinstance(order_by, str):
535 534 try:
536 535 return operator.attrgetter(order_by)(model)
537 536 except AttributeError:
@@ -19,7 +19,6 b''
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20 import os
21 21 import logging
22 from pyramid import compat
23 22
24 23 # Do not use `from rhodecode import events` here, it will be overridden by the
25 24 # events module in this package due to pythons import mechanism.
@@ -67,7 +66,7 b' def _append_path_sep(path):'
67 66 """
68 67 Append the path separator if missing.
69 68 """
70 if isinstance(path, compat.string_types) and not path.endswith(os.path.sep):
69 if isinstance(path, str) and not path.endswith(os.path.sep):
71 70 path += os.path.sep
72 71 return path
73 72
@@ -26,7 +26,6 b' by celery daemon'
26 26 import os
27 27 import time
28 28
29 from pyramid import compat
30 29 from pyramid_mailer.mailer import Mailer
31 30 from pyramid_mailer.message import Message
32 31 from email.utils import formatdate
@@ -70,7 +69,7 b' def send_email(recipients, subject, body'
70 69 subject = "%s %s" % (email_config.get('email_prefix', ''), subject)
71 70
72 71 if recipients:
73 if isinstance(recipients, compat.string_types):
72 if isinstance(recipients, str):
74 73 recipients = recipients.split(',')
75 74 else:
76 75 # if recipients are not defined we send to email_config + all admins
@@ -26,7 +26,6 b' from pygments import lex'
26 26 from pygments.formatters.html import _get_ttype_class as pygment_token_class
27 27 from pygments.lexers.special import TextLexer, Token
28 28 from pygments.lexers import get_lexer_by_name
29 from pyramid import compat
30 29
31 30 from rhodecode.lib.helpers import (
32 31 get_lexer_for_filenode, html_escape, get_custom_lexer)
@@ -712,7 +711,7 b' class DiffSet(object):'
712 711 filenode = None
713 712 filename = None
714 713
715 if isinstance(input_file, compat.string_types):
714 if isinstance(input_file, str):
716 715 filename = input_file
717 716 elif isinstance(input_file, FileNode):
718 717 filenode = input_file
@@ -18,15 +18,13 b''
18 18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 from pyramid import compat
22
23 21
24 22 def strip_whitespace(value):
25 23 """
26 24 Removes leading/trailing whitespace, newlines, and tabs from the value.
27 25 Implements the `colander.interface.Preparer` interface.
28 26 """
29 if isinstance(value, compat.string_types):
27 if isinstance(value, str):
30 28 return value.strip(' \t\n\r')
31 29 else:
32 30 return value
@@ -12,7 +12,6 b' import sqlalchemy'
12 12
13 13 from sqlalchemy.schema import ForeignKeyConstraint
14 14 from sqlalchemy.schema import UniqueConstraint
15 from pyramid import compat
16 15
17 16 from rhodecode.lib.dbmigrate.migrate.exceptions import *
18 17 from rhodecode.lib.dbmigrate.migrate.changeset import SQLA_07, SQLA_08
@@ -233,7 +232,7 b' class ColumnDelta(DictMixin, sqlalchemy.'
233 232 diffs = self.compare_1_column(*p, **kw)
234 233 else:
235 234 # Zero columns specified
236 if not len(p) or not isinstance(p[0], compat.string_types):
235 if not len(p) or not isinstance(p[0], str):
237 236 raise ValueError("First argument must be column name")
238 237 diffs = self.compare_parameters(*p, **kw)
239 238
@@ -342,7 +341,7 b' class ColumnDelta(DictMixin, sqlalchemy.'
342 341 """Extracts data from p and modifies diffs"""
343 342 p = list(p)
344 343 while len(p):
345 if isinstance(p[0], compat.string_types):
344 if isinstance(p[0], str):
346 345 k.setdefault('name', p.pop(0))
347 346 elif isinstance(p[0], sqlalchemy.types.TypeEngine):
348 347 k.setdefault('type', p.pop(0))
@@ -380,7 +379,7 b' class ColumnDelta(DictMixin, sqlalchemy.'
380 379 return getattr(self, '_table', None)
381 380
382 381 def _set_table(self, table):
383 if isinstance(table, compat.string_types):
382 if isinstance(table, str):
384 383 if self.alter_metadata:
385 384 if not self.meta:
386 385 raise ValueError("metadata must be specified for table"
@@ -597,7 +596,7 b' populated with defaults'
597 596 if isinstance(cons,(ForeignKeyConstraint,
598 597 UniqueConstraint)):
599 598 for col_name in cons.columns:
600 if not isinstance(col_name, compat.string_types):
599 if not isinstance(col_name, str):
601 600 col_name = col_name.name
602 601 if self.name==col_name:
603 602 to_drop.add(cons)
@@ -632,7 +631,7 b' populated with defaults'
632 631 if (getattr(self, name[:-5]) and not obj):
633 632 raise InvalidConstraintError("Column.create() accepts index_name,"
634 633 " primary_key_name and unique_name to generate constraints")
635 if not isinstance(obj, compat.string_types) and obj is not None:
634 if not isinstance(obj, str) and obj is not None:
636 635 raise InvalidConstraintError(
637 636 "%s argument for column must be constraint name" % name)
638 637
@@ -9,7 +9,6 b' from sqlalchemy import (Table, Column, M'
9 9 from sqlalchemy.sql import and_
10 10 from sqlalchemy import exc as sa_exceptions
11 11 from sqlalchemy.sql import bindparam
12 from pyramid import compat
13 12
14 13 from rhodecode.lib.dbmigrate.migrate import exceptions
15 14 from rhodecode.lib.dbmigrate.migrate.changeset import SQLA_07
@@ -26,7 +25,7 b' class ControlledSchema(object):'
26 25 """A database under version control"""
27 26
28 27 def __init__(self, engine, repository):
29 if isinstance(repository, compat.string_types):
28 if isinstance(repository, str):
30 29 repository = Repository(repository)
31 30 self.engine = engine
32 31 self.repository = repository
@@ -135,7 +134,7 b' class ControlledSchema(object):'
135 134 """
136 135 # Confirm that the version # is valid: positive, integer,
137 136 # exists in repos
138 if isinstance(repository, compat.string_types):
137 if isinstance(repository, str):
139 138 repository = Repository(repository)
140 139 version = cls._validate_version(repository, version)
141 140 table = cls._create_table_version(engine, repository, version)
@@ -200,7 +199,7 b' class ControlledSchema(object):'
200 199 """
201 200 Compare the current model against the current database.
202 201 """
203 if isinstance(repository, compat.string_types):
202 if isinstance(repository, str):
204 203 repository = Repository(repository)
205 204 model = load_model(model)
206 205
@@ -213,7 +212,7 b' class ControlledSchema(object):'
213 212 """
214 213 Dump the current database as a Python model.
215 214 """
216 if isinstance(repository, compat.string_types):
215 if isinstance(repository, str):
217 216 repository = Repository(repository)
218 217
219 218 diff = schemadiff.getDiffOfModelAgainstDatabase(
@@ -7,7 +7,6 b' import logging'
7 7 import inspect
8 8 from StringIO import StringIO
9 9
10 from pyramid import compat
11 10 from rhodecode.lib.dbmigrate import migrate
12 11 from rhodecode.lib.dbmigrate.migrate.versioning import genmodel, schemadiff
13 12 from rhodecode.lib.dbmigrate.migrate.versioning.config import operations
@@ -52,7 +51,7 b' class PythonScript(base.BaseScript):'
52 51 :rtype: string
53 52 """
54 53
55 if isinstance(repository, compat.string_types):
54 if isinstance(repository, str):
56 55 # oh dear, an import cycle!
57 56 from rhodecode.lib.dbmigrate.migrate.versioning.repository import Repository
58 57 repository = Repository(repository)
@@ -11,7 +11,6 b' from sqlalchemy import create_engine'
11 11 from sqlalchemy.engine import Engine
12 12 from sqlalchemy.pool import StaticPool
13 13
14 from pyramid import compat
15 14 from rhodecode.lib.dbmigrate.migrate import exceptions
16 15 from rhodecode.lib.dbmigrate.migrate.versioning.util.keyedinstance import KeyedInstance
17 16 from rhodecode.lib.dbmigrate.migrate.versioning.util.importpath import import_path
@@ -28,7 +27,7 b' def load_model(dotted_name):'
28 27 .. versionchanged:: 0.5.4
29 28
30 29 """
31 if isinstance(dotted_name, compat.string_types):
30 if isinstance(dotted_name, str):
32 31 if ':' not in dotted_name:
33 32 # backwards compatibility
34 33 warnings.warn('model should be in form of module.model:User '
@@ -41,7 +40,7 b' def load_model(dotted_name):'
41 40
42 41 def asbool(obj):
43 42 """Do everything to use object as bool"""
44 if isinstance(obj, compat.string_types):
43 if isinstance(obj, str):
45 44 obj = obj.strip().lower()
46 45 if obj in ['true', 'yes', 'on', 'y', 't', '1']:
47 46 return True
@@ -114,7 +113,7 b' def construct_engine(engine, **opts):'
114 113 """
115 114 if isinstance(engine, Engine):
116 115 return engine
117 elif not isinstance(engine, compat.string_types):
116 elif not isinstance(engine, str):
118 117 raise ValueError("you need to pass either an existing engine or a database uri")
119 118
120 119 # get options for create_engine
@@ -28,7 +28,6 b' from sqlalchemy import *'
28 28 from sqlalchemy.ext.hybrid import hybrid_property
29 29 from sqlalchemy.orm import relationship, joinedload, class_mapper, validates
30 30 from beaker.cache import cache_region, region_invalidate
31 from pyramid import compat
32 31
33 32 from rhodecode.lib.vcs import get_backend
34 33 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -414,7 +413,7 b' class UserGroup(Base, BaseModel):'
414 413 Session.flush()
415 414 members_list = []
416 415 if v:
417 v = [v] if isinstance(v, compat.string_types) else v
416 v = [v] if isinstance(v, str) else v
418 417 for u_id in set(v):
419 418 member = UserGroupMember(users_group_id, u_id)
420 419 members_list.append(member)
@@ -49,7 +49,6 b' from sqlalchemy.exc import IntegrityErro'
49 49 from sqlalchemy.dialects.mysql import LONGTEXT
50 50 from beaker.cache import cache_region
51 51 from zope.cachedescriptors.property import Lazy as LazyProperty
52 from pyramid import compat
53 52 from pyramid.threadlocal import get_current_request
54 53
55 54 from rhodecode.translation import _
@@ -2110,7 +2109,7 b' class Repository(Base, BaseModel):'
2110 2109 warnings.warn("Use get_commit", DeprecationWarning)
2111 2110 commit_id = None
2112 2111 commit_idx = None
2113 if isinstance(rev, compat.string_types):
2112 if isinstance(rev, str):
2114 2113 commit_id = rev
2115 2114 else:
2116 2115 commit_idx = rev
@@ -3725,7 +3724,7 b' class PullRequestReviewers(Base, BaseMod'
3725 3724 @reasons.setter
3726 3725 def reasons(self, val):
3727 3726 val = val or []
3728 if any(not isinstance(x, compat.string_types) for x in val):
3727 if any(not isinstance(x, str) for x in val):
3729 3728 raise Exception('invalid reasons type, must be list of strings')
3730 3729 self._reasons = val
3731 3730
@@ -49,7 +49,6 b' from sqlalchemy.exc import IntegrityErro'
49 49 from sqlalchemy.dialects.mysql import LONGTEXT
50 50 from beaker.cache import cache_region
51 51 from zope.cachedescriptors.property import Lazy as LazyProperty
52 from pyramid import compat
53 52 from pyramid.threadlocal import get_current_request
54 53
55 54 from rhodecode.translation import _
@@ -2176,7 +2175,7 b' class Repository(Base, BaseModel):'
2176 2175 warnings.warn("Use get_commit", DeprecationWarning)
2177 2176 commit_id = None
2178 2177 commit_idx = None
2179 if isinstance(rev, compat.string_types):
2178 if isinstance(rev, str):
2180 2179 commit_id = rev
2181 2180 else:
2182 2181 commit_idx = rev
@@ -3808,7 +3807,7 b' class PullRequestReviewers(Base, BaseMod'
3808 3807 @reasons.setter
3809 3808 def reasons(self, val):
3810 3809 val = val or []
3811 if any(not isinstance(x, compat.string_types) for x in val):
3810 if any(not isinstance(x, str) for x in val):
3812 3811 raise Exception('invalid reasons type, must be list of strings')
3813 3812 self._reasons = val
3814 3813
@@ -48,7 +48,6 b' from sqlalchemy.ext.hybrid import hybrid'
48 48 from sqlalchemy.exc import IntegrityError # pragma: no cover
49 49 from sqlalchemy.dialects.mysql import LONGTEXT
50 50 from zope.cachedescriptors.property import Lazy as LazyProperty
51 from pyramid import compat
52 51 from pyramid.threadlocal import get_current_request
53 52
54 53 from rhodecode.translation import _
@@ -2217,7 +2216,7 b' class Repository(Base, BaseModel):'
2217 2216 warnings.warn("Use get_commit", DeprecationWarning)
2218 2217 commit_id = None
2219 2218 commit_idx = None
2220 if isinstance(rev, compat.string_types):
2219 if isinstance(rev, str):
2221 2220 commit_id = rev
2222 2221 else:
2223 2222 commit_idx = rev
@@ -3956,7 +3955,7 b' class PullRequestReviewers(Base, BaseMod'
3956 3955 @reasons.setter
3957 3956 def reasons(self, val):
3958 3957 val = val or []
3959 if any(not isinstance(x, compat.string_types) for x in val):
3958 if any(not isinstance(x, str) for x in val):
3960 3959 raise Exception('invalid reasons type, must be list of strings')
3961 3960 self._reasons = val
3962 3961
@@ -48,7 +48,6 b' from sqlalchemy.ext.hybrid import hybrid'
48 48 from sqlalchemy.exc import IntegrityError # pragma: no cover
49 49 from sqlalchemy.dialects.mysql import LONGTEXT
50 50 from zope.cachedescriptors.property import Lazy as LazyProperty
51 from pyramid import compat
52 51 from pyramid.threadlocal import get_current_request
53 52
54 53 from rhodecode.translation import _
@@ -2240,7 +2239,7 b' class Repository(Base, BaseModel):'
2240 2239 warnings.warn("Use get_commit", DeprecationWarning)
2241 2240 commit_id = None
2242 2241 commit_idx = None
2243 if isinstance(rev, compat.string_types):
2242 if isinstance(rev, str):
2244 2243 commit_id = rev
2245 2244 else:
2246 2245 commit_idx = rev
@@ -4030,7 +4029,7 b' class PullRequestReviewers(Base, BaseMod'
4030 4029 @reasons.setter
4031 4030 def reasons(self, val):
4032 4031 val = val or []
4033 if any(not isinstance(x, compat.string_types) for x in val):
4032 if any(not isinstance(x, str) for x in val):
4034 4033 raise Exception('invalid reasons type, must be list of strings')
4035 4034 self._reasons = val
4036 4035
@@ -48,7 +48,6 b' from sqlalchemy.ext.hybrid import hybrid'
48 48 from sqlalchemy.exc import IntegrityError # pragma: no cover
49 49 from sqlalchemy.dialects.mysql import LONGTEXT
50 50 from zope.cachedescriptors.property import Lazy as LazyProperty
51 from pyramid import compat
52 51 from pyramid.threadlocal import get_current_request
53 52
54 53 from rhodecode.translation import _
@@ -2240,7 +2239,7 b' class Repository(Base, BaseModel):'
2240 2239 warnings.warn("Use get_commit", DeprecationWarning)
2241 2240 commit_id = None
2242 2241 commit_idx = None
2243 if isinstance(rev, compat.string_types):
2242 if isinstance(rev, str):
2244 2243 commit_id = rev
2245 2244 else:
2246 2245 commit_idx = rev
@@ -4031,7 +4030,7 b' class PullRequestReviewers(Base, BaseMod'
4031 4030 @reasons.setter
4032 4031 def reasons(self, val):
4033 4032 val = val or []
4034 if any(not isinstance(x, compat.string_types) for x in val):
4033 if any(not isinstance(x, str) for x in val):
4035 4034 raise Exception('invalid reasons type, must be list of strings')
4036 4035 self._reasons = val
4037 4036
@@ -50,7 +50,6 b' from sqlalchemy.ext.hybrid import hybrid'
50 50 from sqlalchemy.exc import IntegrityError # pragma: no cover
51 51 from sqlalchemy.dialects.mysql import LONGTEXT
52 52 from zope.cachedescriptors.property import Lazy as LazyProperty
53 from pyramid import compat
54 53 from pyramid.threadlocal import get_current_request
55 54 from webhelpers2.text import collapse, remove_formatting
56 55
@@ -2281,7 +2280,7 b' class Repository(Base, BaseModel):'
2281 2280 warnings.warn("Use get_commit", DeprecationWarning)
2282 2281 commit_id = None
2283 2282 commit_idx = None
2284 if isinstance(rev, compat.string_types):
2283 if isinstance(rev, str):
2285 2284 commit_id = rev
2286 2285 else:
2287 2286 commit_idx = rev
@@ -4276,7 +4275,7 b' class PullRequestReviewers(Base, BaseMod'
4276 4275 @reasons.setter
4277 4276 def reasons(self, val):
4278 4277 val = val or []
4279 if any(not isinstance(x, compat.string_types) for x in val):
4278 if any(not isinstance(x, str) for x in val):
4280 4279 raise Exception('invalid reasons type, must be list of strings')
4281 4280 self._reasons = val
4282 4281
@@ -50,7 +50,6 b' from sqlalchemy.ext.hybrid import hybrid'
50 50 from sqlalchemy.exc import IntegrityError # pragma: no cover
51 51 from sqlalchemy.dialects.mysql import LONGTEXT
52 52 from zope.cachedescriptors.property import Lazy as LazyProperty
53 from pyramid import compat
54 53 from pyramid.threadlocal import get_current_request
55 54 from webhelpers2.text import remove_formatting
56 55
@@ -2348,7 +2347,7 b' class Repository(Base, BaseModel):'
2348 2347 warnings.warn("Use get_commit", DeprecationWarning)
2349 2348 commit_id = None
2350 2349 commit_idx = None
2351 if isinstance(rev, compat.string_types):
2350 if isinstance(rev, str):
2352 2351 commit_id = rev
2353 2352 else:
2354 2353 commit_idx = rev
@@ -4391,7 +4390,7 b' class PullRequestReviewers(Base, BaseMod'
4391 4390 @reasons.setter
4392 4391 def reasons(self, val):
4393 4392 val = val or []
4394 if any(not isinstance(x, compat.string_types) for x in val):
4393 if any(not isinstance(x, str) for x in val):
4395 4394 raise Exception('invalid reasons type, must be list of strings')
4396 4395 self._reasons = val
4397 4396
@@ -50,7 +50,6 b' from sqlalchemy.ext.hybrid import hybrid'
50 50 from sqlalchemy.exc import IntegrityError # pragma: no cover
51 51 from sqlalchemy.dialects.mysql import LONGTEXT
52 52 from zope.cachedescriptors.property import Lazy as LazyProperty
53 from pyramid import compat
54 53 from pyramid.threadlocal import get_current_request
55 54 from webhelpers2.text import remove_formatting
56 55
@@ -2354,7 +2353,7 b' class Repository(Base, BaseModel):'
2354 2353 warnings.warn("Use get_commit", DeprecationWarning)
2355 2354 commit_id = None
2356 2355 commit_idx = None
2357 if isinstance(rev, compat.string_types):
2356 if isinstance(rev, str):
2358 2357 commit_id = rev
2359 2358 else:
2360 2359 commit_idx = rev
@@ -4440,7 +4439,7 b' class PullRequestReviewers(Base, BaseMod'
4440 4439 @reasons.setter
4441 4440 def reasons(self, val):
4442 4441 val = val or []
4443 if any(not isinstance(x, compat.string_types) for x in val):
4442 if any(not isinstance(x, str) for x in val):
4444 4443 raise Exception('invalid reasons type, must be list of strings')
4445 4444 self._reasons = val
4446 4445
@@ -50,7 +50,6 b' from sqlalchemy.ext.hybrid import hybrid'
50 50 from sqlalchemy.exc import IntegrityError # pragma: no cover
51 51 from sqlalchemy.dialects.mysql import LONGTEXT
52 52 from zope.cachedescriptors.property import Lazy as LazyProperty
53 from pyramid import compat
54 53 from pyramid.threadlocal import get_current_request
55 54 from webhelpers2.text import remove_formatting
56 55
@@ -2385,7 +2384,7 b' class Repository(Base, BaseModel):'
2385 2384 warnings.warn("Use get_commit", DeprecationWarning)
2386 2385 commit_id = None
2387 2386 commit_idx = None
2388 if isinstance(rev, compat.string_types):
2387 if isinstance(rev, str):
2389 2388 commit_id = rev
2390 2389 else:
2391 2390 commit_idx = rev
@@ -4502,7 +4501,7 b' class PullRequestReviewers(Base, BaseMod'
4502 4501 @reasons.setter
4503 4502 def reasons(self, val):
4504 4503 val = val or []
4505 if any(not isinstance(x, compat.string_types) for x in val):
4504 if any(not isinstance(x, str) for x in val):
4506 4505 raise Exception('invalid reasons type, must be list of strings')
4507 4506 self._reasons = val
4508 4507
@@ -44,7 +44,6 b' from sqlalchemy.sql.expression import tr'
44 44 from beaker.cache import cache_region, region_invalidate
45 45 from webob.exc import HTTPNotFound
46 46 from zope.cachedescriptors.property import Lazy as LazyProperty
47 from pyramid import compat
48 47
49 48 # replace pylons with fake url for migration
50 49 from rhodecode.lib.dbmigrate.schema import url
@@ -1811,7 +1810,7 b' class Repository(Base, BaseModel):'
1811 1810 warnings.warn("Use get_commit", DeprecationWarning)
1812 1811 commit_id = None
1813 1812 commit_idx = None
1814 if isinstance(rev, compat.string_types):
1813 if isinstance(rev, str):
1815 1814 commit_id = rev
1816 1815 else:
1817 1816 commit_idx = rev
@@ -44,7 +44,6 b' from sqlalchemy.sql.expression import tr'
44 44 from beaker.cache import cache_region, region_invalidate
45 45 from webob.exc import HTTPNotFound
46 46 from zope.cachedescriptors.property import Lazy as LazyProperty
47 from pyramid import compat
48 47
49 48 # replace pylons with fake url for migration
50 49 from rhodecode.lib.dbmigrate.schema import url
@@ -1814,7 +1813,7 b' class Repository(Base, BaseModel):'
1814 1813 warnings.warn("Use get_commit", DeprecationWarning)
1815 1814 commit_id = None
1816 1815 commit_idx = None
1817 if isinstance(rev, compat.string_types):
1816 if isinstance(rev, str):
1818 1817 commit_id = rev
1819 1818 else:
1820 1819 commit_idx = rev
@@ -44,7 +44,6 b' from sqlalchemy.sql.expression import tr'
44 44 from beaker.cache import cache_region, region_invalidate
45 45 from webob.exc import HTTPNotFound
46 46 from zope.cachedescriptors.property import Lazy as LazyProperty
47 from pyramid import compat
48 47 # replace pylons with fake url for migration
49 48 from rhodecode.lib.dbmigrate.schema import url
50 49 from rhodecode.translation import _
@@ -1813,7 +1812,7 b' class Repository(Base, BaseModel):'
1813 1812 warnings.warn("Use get_commit", DeprecationWarning)
1814 1813 commit_id = None
1815 1814 commit_idx = None
1816 if isinstance(rev, compat.string_types):
1815 if isinstance(rev, str):
1817 1816 commit_id = rev
1818 1817 else:
1819 1818 commit_idx = rev
@@ -45,7 +45,6 b' from sqlalchemy.sql.expression import tr'
45 45 from beaker.cache import cache_region, region_invalidate
46 46 from webob.exc import HTTPNotFound
47 47 from zope.cachedescriptors.property import Lazy as LazyProperty
48 from pyramid import compat
49 48 # replace pylons with fake url for migration
50 49 from rhodecode.lib.dbmigrate.schema import url
51 50 from rhodecode.translation import _
@@ -1815,7 +1814,7 b' class Repository(Base, BaseModel):'
1815 1814 warnings.warn("Use get_commit", DeprecationWarning)
1816 1815 commit_id = None
1817 1816 commit_idx = None
1818 if isinstance(rev, compat.string_types):
1817 if isinstance(rev, str):
1819 1818 commit_id = rev
1820 1819 else:
1821 1820 commit_idx = rev
@@ -45,7 +45,6 b' from sqlalchemy.sql.expression import tr'
45 45 from beaker.cache import cache_region, region_invalidate
46 46 from webob.exc import HTTPNotFound
47 47 from zope.cachedescriptors.property import Lazy as LazyProperty
48 from pyramid import compat
49 48 # replace pylons with fake url for migration
50 49 from rhodecode.lib.dbmigrate.schema import url
51 50 from rhodecode.translation import _
@@ -1815,7 +1814,7 b' class Repository(Base, BaseModel):'
1815 1814 warnings.warn("Use get_commit", DeprecationWarning)
1816 1815 commit_id = None
1817 1816 commit_idx = None
1818 if isinstance(rev, compat.string_types):
1817 if isinstance(rev, str):
1819 1818 commit_id = rev
1820 1819 else:
1821 1820 commit_idx = rev
@@ -3178,7 +3177,7 b' class PullRequestReviewers(Base, BaseMod'
3178 3177 @reasons.setter
3179 3178 def reasons(self, val):
3180 3179 val = val or []
3181 if any(not isinstance(x, compat.string_types) for x in val):
3180 if any(not isinstance(x, str) for x in val):
3182 3181 raise Exception('invalid reasons type, must be list of strings')
3183 3182 self._reasons = val
3184 3183
@@ -43,7 +43,6 b' from sqlalchemy.sql.expression import tr'
43 43 from beaker.cache import cache_region
44 44 from webob.exc import HTTPNotFound
45 45 from zope.cachedescriptors.property import Lazy as LazyProperty
46 from pyramid import compat
47 46
48 47 # replace pylons with fake url for migration
49 48 from rhodecode.lib.dbmigrate.schema import url
@@ -1858,7 +1857,7 b' class Repository(Base, BaseModel):'
1858 1857 warnings.warn("Use get_commit", DeprecationWarning)
1859 1858 commit_id = None
1860 1859 commit_idx = None
1861 if isinstance(rev, compat.string_types):
1860 if isinstance(rev, str):
1862 1861 commit_id = rev
1863 1862 else:
1864 1863 commit_idx = rev
@@ -3406,7 +3405,7 b' class PullRequestReviewers(Base, BaseMod'
3406 3405 @reasons.setter
3407 3406 def reasons(self, val):
3408 3407 val = val or []
3409 if any(not isinstance(x, compat.string_types) for x in val):
3408 if any(not isinstance(x, str) for x in val):
3410 3409 raise Exception('invalid reasons type, must be list of strings')
3411 3410 self._reasons = val
3412 3411
@@ -43,7 +43,6 b' from sqlalchemy.sql.expression import tr'
43 43 from beaker.cache import cache_region
44 44 from webob.exc import HTTPNotFound
45 45 from zope.cachedescriptors.property import Lazy as LazyProperty
46 from pyramid import compat
47 46
48 47 # replace pylons with fake url for migration
49 48 from rhodecode.lib.dbmigrate.schema import url
@@ -1859,7 +1858,7 b' class Repository(Base, BaseModel):'
1859 1858 warnings.warn("Use get_commit", DeprecationWarning)
1860 1859 commit_id = None
1861 1860 commit_idx = None
1862 if isinstance(rev, compat.string_types):
1861 if isinstance(rev, str):
1863 1862 commit_id = rev
1864 1863 else:
1865 1864 commit_idx = rev
@@ -3407,7 +3406,7 b' class PullRequestReviewers(Base, BaseMod'
3407 3406 @reasons.setter
3408 3407 def reasons(self, val):
3409 3408 val = val or []
3410 if any(not isinstance(x, compat.string_types) for x in val):
3409 if any(not isinstance(x, str) for x in val):
3411 3410 raise Exception('invalid reasons type, must be list of strings')
3412 3411 self._reasons = val
3413 3412
@@ -43,7 +43,6 b' from sqlalchemy.sql.expression import tr'
43 43 from sqlalchemy.sql.functions import coalesce, count # pragma: no cover
44 44 from beaker.cache import cache_region
45 45 from zope.cachedescriptors.property import Lazy as LazyProperty
46 from pyramid import compat
47 46 from pyramid.threadlocal import get_current_request
48 47
49 48 from rhodecode.translation import _
@@ -2046,7 +2045,7 b' class Repository(Base, BaseModel):'
2046 2045 warnings.warn("Use get_commit", DeprecationWarning)
2047 2046 commit_id = None
2048 2047 commit_idx = None
2049 if isinstance(rev, compat.string_types):
2048 if isinstance(rev, str):
2050 2049 commit_id = rev
2051 2050 else:
2052 2051 commit_idx = rev
@@ -3660,7 +3659,7 b' class PullRequestReviewers(Base, BaseMod'
3660 3659 @reasons.setter
3661 3660 def reasons(self, val):
3662 3661 val = val or []
3663 if any(not isinstance(x, compat.string_types) for x in val):
3662 if any(not isinstance(x, str) for x in val):
3664 3663 raise Exception('invalid reasons type, must be list of strings')
3665 3664 self._reasons = val
3666 3665
@@ -2,7 +2,6 b' import logging'
2 2 import datetime
3 3
4 4 from sqlalchemy import *
5 from pyramid import compat
6 5
7 6 from rhodecode.lib.utils2 import safe_str
8 7 from rhodecode.model import meta
@@ -13,7 +12,7 b' log = logging.getLogger(__name__)'
13 12
14 13 def time_to_datetime(tm):
15 14 if tm:
16 if isinstance(tm, compat.string_types):
15 if isinstance(tm, str):
17 16 try:
18 17 tm = float(tm)
19 18 except ValueError:
@@ -32,7 +32,6 b' import re'
32 32 import sys
33 33 import time
34 34 import urllib
35 from pyramid import compat
36 35
37 36
38 37 class diff_match_patch:
@@ -1439,7 +1438,7 b' class diff_match_patch:'
1439 1438 text1 = None
1440 1439 diffs = None
1441 1440 # Note that texts may arrive as 'str' or 'unicode'.
1442 if isinstance(a, compat.string_types) and isinstance(b, compat.string_types) and c is None:
1441 if isinstance(a, str) and isinstance(b, str) and c is None:
1443 1442 # Method 1: text1, text2
1444 1443 # Compute diffs from text1 and text2.
1445 1444 text1 = a
@@ -1452,11 +1451,11 b' class diff_match_patch:'
1452 1451 # Compute text1 from diffs.
1453 1452 diffs = a
1454 1453 text1 = self.diff_text1(diffs)
1455 elif isinstance(a, compat.string_types) and isinstance(b, list) and c is None:
1454 elif isinstance(a, str) and isinstance(b, list) and c is None:
1456 1455 # Method 3: text1, diffs
1457 1456 text1 = a
1458 1457 diffs = b
1459 elif (isinstance(a, compat.string_types) and isinstance(b, compat.string_types) and
1458 elif (isinstance(a, str) and isinstance(b, str) and
1460 1459 isinstance(c, list)):
1461 1460 # Method 4: text1, text2, diffs
1462 1461 # text2 is not used.
@@ -47,7 +47,6 b' import itertools'
47 47 import fnmatch
48 48 import bleach
49 49
50 from pyramid import compat
51 50 from datetime import datetime
52 51 from functools import partial
53 52 from pygments.formatters.html import HtmlFormatter
@@ -190,7 +190,7 b' def get_default_cache_settings(settings,'
190 190 if key.startswith(prefix):
191 191 name = key.split(prefix)[1].strip()
192 192 val = settings[key]
193 if isinstance(val, compat.string_types):
193 if isinstance(val, str):
194 194 val = val.strip()
195 195 cache_settings[name] = val
196 196 return cache_settings
@@ -48,7 +48,6 b' import sqlalchemy.exc'
48 48 import sqlalchemy.sql
49 49 import webob
50 50 import pyramid.threadlocal
51 from pyramid import compat
52 51 from pyramid.settings import asbool
53 52
54 53 import rhodecode
@@ -269,7 +268,7 b' def safe_str(unicode_, to_encoding=None,'
269 268 """
270 269
271 270 # if it's not basestr cast to str
272 if not isinstance(unicode_, compat.string_types):
271 if not isinstance(unicode_, str):
273 272 return str(unicode_)
274 273
275 274 if isinstance(unicode_, str):
@@ -712,7 +711,7 b' def datetime_to_time(dt):'
712 711
713 712 def time_to_datetime(tm):
714 713 if tm:
715 if isinstance(tm, compat.string_types):
714 if isinstance(tm, str):
716 715 try:
717 716 tm = float(tm)
718 717 except ValueError:
@@ -722,7 +721,7 b' def time_to_datetime(tm):'
722 721
723 722 def time_to_utcdatetime(tm):
724 723 if tm:
725 if isinstance(tm, compat.string_types):
724 if isinstance(tm, str):
726 725 try:
727 726 tm = float(tm)
728 727 except ValueError:
@@ -34,7 +34,6 b' import warnings'
34 34
35 35 from zope.cachedescriptors.property import Lazy as LazyProperty
36 36
37 from pyramid import compat
38 37
39 38 import rhodecode
40 39 from rhodecode.translation import lazy_ugettext
@@ -785,7 +784,7 b' class BaseRepository(object):'
785 784 (commit, self, commit.repository))
786 785
787 786 def _validate_commit_id(self, commit_id):
788 if not isinstance(commit_id, compat.string_types):
787 if not isinstance(commit_id, str):
789 788 raise TypeError("commit_id must be a string value got {} instead".format(type(commit_id)))
790 789
791 790 def _validate_commit_idx(self, commit_idx):
@@ -822,7 +821,7 b' class BaseRepository(object):'
822 821 warnings.warn("Use get_commit instead", DeprecationWarning)
823 822 commit_id = None
824 823 commit_idx = None
825 if isinstance(revision, compat.string_types):
824 if isinstance(revision, str):
826 825 commit_id = revision
827 826 else:
828 827 commit_idx = revision
@@ -849,7 +848,7 b' class BaseRepository(object):'
849 848 if revision is None:
850 849 return revision
851 850
852 if isinstance(revision, compat.string_types):
851 if isinstance(revision, str):
853 852 commit_id = revision
854 853 else:
855 854 commit_id = self.commit_ids[revision]
@@ -25,7 +25,6 b' import logging'
25 25 import functools
26 26 import urllib2
27 27 import rhodecode
28 from pyramid import compat
29 28
30 29 log = logging.getLogger(__name__)
31 30
@@ -196,7 +195,7 b' def map_vcs_exceptions(func):'
196 195 org_remote_tb = getattr(e, '_vcs_server_org_exc_tb', '')
197 196 __traceback_info__ = None
198 197 if remote_tb:
199 if isinstance(remote_tb, compat.string_types):
198 if isinstance(remote_tb, str):
200 199 remote_tb = [remote_tb]
201 200 __traceback_info__ = (
202 201 'Found VCSServer remote traceback information:\n'
@@ -50,7 +50,6 b' from sqlalchemy.ext.hybrid import hybrid'
50 50 from sqlalchemy.exc import IntegrityError # pragma: no cover
51 51 from sqlalchemy.dialects.mysql import LONGTEXT
52 52 from zope.cachedescriptors.property import Lazy as LazyProperty
53 from pyramid import compat
54 53 from pyramid.threadlocal import get_current_request
55 54 from webhelpers2.text import remove_formatting
56 55
@@ -2407,7 +2406,7 b' class Repository(Base, BaseModel):'
2407 2406 warnings.warn("Use get_commit", DeprecationWarning)
2408 2407 commit_id = None
2409 2408 commit_idx = None
2410 if isinstance(rev, compat.string_types):
2409 if isinstance(rev, str):
2411 2410 commit_id = rev
2412 2411 else:
2413 2412 commit_idx = rev
@@ -4604,7 +4603,7 b' class PullRequestReviewers(Base, BaseMod'
4604 4603 @reasons.setter
4605 4604 def reasons(self, val):
4606 4605 val = val or []
4607 if any(not isinstance(x, compat.string_types) for x in val):
4606 if any(not isinstance(x, str) for x in val):
4608 4607 raise Exception('invalid reasons type, must be list of strings')
4609 4608 self._reasons = val
4610 4609
@@ -32,7 +32,6 b' import datetime'
32 32 import urllib
33 33 import collections
34 34
35 from pyramid import compat
36 35 from pyramid.threadlocal import get_current_request
37 36
38 37 from rhodecode.lib.vcs.nodes import FileNode
@@ -1426,7 +1425,7 b' class PullRequestModel(BaseModel):'
1426 1425
1427 1426 reviewers = {}
1428 1427 for user_id, reasons, mandatory, role, rules in reviewer_data:
1429 if isinstance(user_id, (int, compat.string_types)):
1428 if isinstance(user_id, (int, str)):
1430 1429 user_id = self._get_user(user_id).user_id
1431 1430 reviewers[user_id] = {
1432 1431 'reasons': reasons, 'mandatory': mandatory, 'role': role}
@@ -1508,7 +1507,7 b' class PullRequestModel(BaseModel):'
1508 1507
1509 1508 observers = {}
1510 1509 for user_id, reasons, mandatory, role, rules in observer_data:
1511 if isinstance(user_id, (int, compat.string_types)):
1510 if isinstance(user_id, (int, str)):
1512 1511 user_id = self._get_user(user_id).user_id
1513 1512 observers[user_id] = {
1514 1513 'reasons': reasons, 'observers': mandatory, 'role': role}
@@ -20,7 +20,6 b''
20 20
21 21 import logging
22 22 import traceback
23 from pyramid import compat
24 23
25 24 from rhodecode.lib.utils2 import safe_str, safe_unicode
26 25 from rhodecode.lib.exceptions import (
@@ -248,7 +247,7 b' class UserGroupModel(BaseModel):'
248 247 # handle owner change
249 248 if 'user' in form_data:
250 249 owner = form_data['user']
251 if isinstance(owner, compat.string_types):
250 if isinstance(owner, str):
252 251 owner = User.get_by_username(form_data['user'])
253 252
254 253 if not isinstance(owner, User):
@@ -19,7 +19,6 b''
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 import unicodedata
22 from pyramid import compat
23 22
24 23
25 24 def strip_preparer(value):
@@ -84,6 +83,6 b' def unique_list_from_str_preparer(value)'
84 83 """
85 84 from rhodecode.lib.utils2 import aslist
86 85
87 if isinstance(value, compat.string_types):
86 if isinstance(value, str):
88 87 value = aslist(value, ',')
89 88 return unique_list_preparer(value) No newline at end of file
@@ -19,9 +19,7 b''
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 import re
22
23 22 import colander
24 from pyramid import compat
25 23
26 24 from rhodecode.model.validation_schema import preparers
27 25 from rhodecode.model.db import User, UserGroup
@@ -108,7 +106,7 b' class StringBooleanType(colander.String)'
108 106 if isinstance(cstruct, bool):
109 107 return cstruct
110 108
111 if not isinstance(cstruct, compat.string_types):
109 if not isinstance(cstruct, str):
112 110 raise colander.Invalid(node, '%r is not a string' % cstruct)
113 111
114 112 value = cstruct.lower()
@@ -192,7 +190,7 b' class UserGroupType(UserOrUserGroupType)'
192 190
193 191 class StrOrIntType(colander.String):
194 192 def deserialize(self, node, cstruct):
195 if isinstance(cstruct, compat.string_types):
193 if isinstance(cstruct, str):
196 194 return super(StrOrIntType, self).deserialize(node, cstruct)
197 195 else:
198 196 return colander.Integer().deserialize(node, cstruct)
@@ -37,7 +37,6 b' from formencode.validators import ('
37 37
38 38 from sqlalchemy.sql.expression import true
39 39 from sqlalchemy.util import OrderedSet
40 from pyramid import compat
41 40
42 41 from rhodecode.authentication import (
43 42 legacy_plugin_prefix, _import_legacy_plugin)
@@ -126,7 +125,7 b' def UniqueListFromString(localizer):'
126 125
127 126 class _validator(UniqueList(localizer)):
128 127 def _to_python(self, value, state):
129 if isinstance(value, compat.string_types):
128 if isinstance(value, str):
130 129 value = aslist(value, ',')
131 130 return super(_validator, self)._to_python(value, state)
132 131 return _validator
@@ -19,7 +19,6 b''
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 import pytest
22 from pyramid import compat
23 22
24 23 from rhodecode.config.utils import set_instance_id
25 24
@@ -32,6 +31,6 b' def test_set_instance_id(instance_id):'
32 31 if instance_id == 'custom-id':
33 32 assert config['instance_id'] == instance_id
34 33 else:
35 assert isinstance(config['instance_id'], compat.string_types)
34 assert isinstance(config['instance_id'], str)
36 35 assert len(config['instance_id'])
37 36 assert instance_id != config['instance_id']
@@ -35,7 +35,6 b' import os'
35 35 import sys
36 36 from os.path import join as jn
37 37 from os.path import dirname as dn
38 from pyramid import compat
39 38 from sqlalchemy.util import OrderedSet
40 39
41 40 __here__ = os.path.abspath(__file__)
@@ -77,7 +76,7 b' urllib2.install_opener(o)'
77 76
78 77
79 78 def _get_repo(proj):
80 if isinstance(proj, compat.string_types):
79 if isinstance(proj, str):
81 80 repo = vcs.get_repo(jn(PROJECT_PATH, proj))
82 81 proj = proj
83 82 else:
General Comments 0
You need to be logged in to leave comments. Login now