##// END OF EJS Templates
cleanup: drop some dead code spotted by "vulture"
Mads Kiilerich -
r8098:b6b69559 default
parent child Browse files
Show More
@@ -13,9 +13,6 b' The :mod:`models` module'
13 .. automodule:: kallithea.model.permission
13 .. automodule:: kallithea.model.permission
14 :members:
14 :members:
15
15
16 .. automodule:: kallithea.model.repo_permission
17 :members:
18
19 .. automodule:: kallithea.model.repo
16 .. automodule:: kallithea.model.repo
20 :members:
17 :members:
21
18
@@ -101,7 +101,6 b' class RepoGroupsController(BaseControlle'
101 _list = RepoGroup.query(sorted=True).all()
101 _list = RepoGroup.query(sorted=True).all()
102 group_iter = RepoGroupList(_list, perm_level='admin')
102 group_iter = RepoGroupList(_list, perm_level='admin')
103 repo_groups_data = []
103 repo_groups_data = []
104 total_records = len(group_iter)
105 _tmpl_lookup = app_globals.mako_lookup
104 _tmpl_lookup = app_globals.mako_lookup
106 template = _tmpl_lookup.get_template('data_table/_dt_elements.html')
105 template = _tmpl_lookup.get_template('data_table/_dt_elements.html')
107
106
@@ -86,7 +86,6 b' class UserGroupsController(BaseControlle'
86 .all()
86 .all()
87 group_iter = UserGroupList(_list, perm_level='admin')
87 group_iter = UserGroupList(_list, perm_level='admin')
88 user_groups_data = []
88 user_groups_data = []
89 total_records = len(group_iter)
90 _tmpl_lookup = app_globals.mako_lookup
89 _tmpl_lookup = app_globals.mako_lookup
91 template = _tmpl_lookup.get_template('data_table/_dt_elements.html')
90 template = _tmpl_lookup.get_template('data_table/_dt_elements.html')
92
91
@@ -70,7 +70,6 b' class UsersController(BaseController):'
70 .all()
70 .all()
71
71
72 users_data = []
72 users_data = []
73 total_records = len(c.users_list)
74 _tmpl_lookup = app_globals.mako_lookup
73 _tmpl_lookup = app_globals.mako_lookup
75 template = _tmpl_lookup.get_template('data_table/_dt_elements.html')
74 template = _tmpl_lookup.get_template('data_table/_dt_elements.html')
76
75
@@ -215,7 +215,6 b' def create_cs_pr_comment(repo_name, revi'
215 return {
215 return {
216 'location': h.url('my_pullrequests'), # or repo pr list?
216 'location': h.url('my_pullrequests'), # or repo pr list?
217 }
217 }
218 raise HTTPFound(location=h.url('my_pullrequests')) # or repo pr list?
219 raise HTTPForbidden()
218 raise HTTPForbidden()
220
219
221 text = request.POST.get('text', '').strip()
220 text = request.POST.get('text', '').strip()
@@ -54,7 +54,6 b' class DbManage(object):'
54 self.tests = tests
54 self.tests = tests
55 self.root = root
55 self.root = root
56 self.dburi = dbconf
56 self.dburi = dbconf
57 self.db_exists = False
58 self.cli_args = cli_args or {}
57 self.cli_args = cli_args or {}
59 self.init_db(SESSION=SESSION)
58 self.init_db(SESSION=SESSION)
60
59
@@ -74,9 +74,5 b' class UserCreationError(Exception):'
74 pass
74 pass
75
75
76
76
77 class RepositoryCreationError(Exception):
78 pass
79
80
81 class HgsubversionImportError(Exception):
77 class HgsubversionImportError(Exception):
82 pass
78 pass
@@ -2,35 +2,6 b' from kallithea.lib.rcmail.exceptions imp'
2 from kallithea.lib.rcmail.response import MailResponse
2 from kallithea.lib.rcmail.response import MailResponse
3
3
4
4
5 class Attachment(object):
6 """
7 Encapsulates file attachment information.
8
9 :param filename: filename of attachment
10 :param content_type: file mimetype
11 :param data: the raw file data, either as string or file obj
12 :param disposition: content-disposition (if any)
13 """
14
15 def __init__(self,
16 filename=None,
17 content_type=None,
18 data=None,
19 disposition=None):
20
21 self.filename = filename
22 self.content_type = content_type
23 self.disposition = disposition or 'attachment'
24 self._data = data
25
26 @property
27 def data(self):
28 if isinstance(self._data, str):
29 return self._data
30 self._data = self._data.read()
31 return self._data
32
33
34 class Message(object):
5 class Message(object):
35 """
6 """
36 Encapsulates an email message.
7 Encapsulates an email message.
@@ -392,7 +392,7 b' class MIMEPart(MIMEBase):'
392 if mail.body is None:
392 if mail.body is None:
393 return # only None, '' is still ok
393 return # only None, '' is still ok
394
394
395 ctype, ctype_params = mail.content_encoding['Content-Type']
395 ctype, _ctype_params = mail.content_encoding['Content-Type']
396 cdisp, cdisp_params = mail.content_encoding['Content-Disposition']
396 cdisp, cdisp_params = mail.content_encoding['Content-Disposition']
397
397
398 assert ctype, ("Extract payload requires that mail.content_encoding "
398 assert ctype, ("Extract payload requires that mail.content_encoding "
@@ -258,8 +258,6 b' class BaseRepository(object):'
258 """
258 """
259 Persists current changes made on this repository and returns newly
259 Persists current changes made on this repository and returns newly
260 created changeset.
260 created changeset.
261
262 :raises ``NothingChangedError``: if no changes has been made
263 """
261 """
264 raise NotImplementedError
262 raise NotImplementedError
265
263
@@ -30,10 +30,6 b' class TagDoesNotExistError(RepositoryErr'
30 pass
30 pass
31
31
32
32
33 class BranchAlreadyExistError(RepositoryError):
34 pass
35
36
37 class BranchDoesNotExistError(RepositoryError):
33 class BranchDoesNotExistError(RepositoryError):
38 pass
34 pass
39
35
@@ -50,10 +46,6 b' class CommitError(RepositoryError):'
50 pass
46 pass
51
47
52
48
53 class NothingChangedError(CommitError):
54 pass
55
56
57 class NodeError(VCSError):
49 class NodeError(VCSError):
58 pass
50 pass
59
51
@@ -88,7 +80,3 b' class NodeAlreadyRemovedError(CommitErro'
88
80
89 class ImproperArchiveTypeError(VCSError):
81 class ImproperArchiveTypeError(VCSError):
90 pass
82 pass
91
92
93 class CommandError(VCSError):
94 pass
@@ -221,17 +221,6 b' class BufferedGenerator(object):'
221 return not self.worker.keep_reading.is_set()
221 return not self.worker.keep_reading.is_set()
222
222
223 @property
223 @property
224 def done_reading_event(self):
225 """
226 Done_reading does not mean that the iterator's buffer is empty.
227 Iterator might have done reading from underlying source, but the read
228 chunks might still be available for serving through .next() method.
229
230 :returns: An threading.Event class instance.
231 """
232 return self.worker.EOF
233
234 @property
235 def done_reading(self):
224 def done_reading(self):
236 """
225 """
237 Done_reading does not mean that the iterator's buffer is empty.
226 Done_reading does not mean that the iterator's buffer is empty.
@@ -1,6 +1,3 b''
1 import threading
2
3
4 class _Missing(object):
1 class _Missing(object):
5
2
6 def __repr__(self):
3 def __repr__(self):
@@ -44,21 +41,3 b' class LazyProperty(object):'
44 value = self._func(obj)
41 value = self._func(obj)
45 obj.__dict__[self.__name__] = value
42 obj.__dict__[self.__name__] = value
46 return value
43 return value
47
48
49 class ThreadLocalLazyProperty(LazyProperty):
50 """
51 Same as above but uses thread local dict for cache storage.
52 """
53
54 def __get__(self, obj, klass=None):
55 if obj is None:
56 return self
57 if not hasattr(obj, '__tl_dict__'):
58 obj.__tl_dict__ = threading.local().__dict__
59
60 value = obj.__tl_dict__.get(self.__name__, _missing)
61 if value is _missing:
62 value = self._func(obj)
63 obj.__tl_dict__[self.__name__] = value
64 return value
@@ -11,7 +11,7 b' def get_dirs_for_path(*paths):'
11 for path in paths:
11 for path in paths:
12 head = path
12 head = path
13 while head:
13 while head:
14 head, tail = os.path.split(head)
14 head, _tail = os.path.split(head)
15 if head:
15 if head:
16 yield head
16 yield head
17 else:
17 else:
@@ -33,7 +33,6 b' from tg import app_globals'
33 from tg import tmpl_context as c
33 from tg import tmpl_context as c
34 from tg.i18n import ugettext as _
34 from tg.i18n import ugettext as _
35
35
36 import kallithea
37 from kallithea.lib import helpers as h
36 from kallithea.lib import helpers as h
38 from kallithea.model.db import User
37 from kallithea.model.db import User
39
38
@@ -149,7 +148,6 b' class EmailNotificationModel(object):'
149
148
150 def __init__(self):
149 def __init__(self):
151 super(EmailNotificationModel, self).__init__()
150 super(EmailNotificationModel, self).__init__()
152 self._template_root = kallithea.CONFIG['paths']['templates'][0]
153 self._tmpl_lookup = app_globals.mako_lookup
151 self._tmpl_lookup = app_globals.mako_lookup
154 self.email_types = {
152 self.email_types = {
155 self.TYPE_CHANGESET_COMMENT: 'changeset_comment',
153 self.TYPE_CHANGESET_COMMENT: 'changeset_comment',
@@ -52,7 +52,7 b' class SshKeyModel(object):'
52 Will raise SshKeyModelException on errors
52 Will raise SshKeyModelException on errors
53 """
53 """
54 try:
54 try:
55 keytype, pub, comment = ssh.parse_pub_key(public_key)
55 keytype, _pub, comment = ssh.parse_pub_key(public_key)
56 except ssh.SshKeyParseError as e:
56 except ssh.SshKeyParseError as e:
57 raise SshKeyModelException(_('SSH key %r is invalid: %s') % (public_key, e.args[0]))
57 raise SshKeyModelException(_('SSH key %r is invalid: %s') % (public_key, e.args[0]))
58 if not description.strip():
58 if not description.strip():
@@ -584,11 +584,11 b" def ValidPerms(type_='repo'):"
584 for k, v, t in perms_new:
584 for k, v, t in perms_new:
585 try:
585 try:
586 if t == 'user':
586 if t == 'user':
587 self.user_db = User.query() \
587 _user_db = User.query() \
588 .filter(User.active == True) \
588 .filter(User.active == True) \
589 .filter(User.username == k).one()
589 .filter(User.username == k).one()
590 if t == 'users_group':
590 if t == 'users_group':
591 self.user_db = UserGroup.query() \
591 _user_db = UserGroup.query() \
592 .filter(UserGroup.users_group_active == True) \
592 .filter(UserGroup.users_group_active == True) \
593 .filter(UserGroup.users_group_name == k).one()
593 .filter(UserGroup.users_group_name == k).one()
594
594
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now