bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def get_cnx(self, timeout=None): start = time.time() self._available.acquire() try: tid = threading._get_ident() if tid in self._active: self._active[tid][0] += 1 return PooledConnection(self, self._active[tid][1]) while True: if self._dormant: cnx = self._dormant.pop() try: cnx.cursor() # check whether the connection ... | def get_cnx(self, timeout=None): start = time.time() self._available.acquire() try: tid = threading._get_ident() if tid in self._active: num, cnx = self._active.get(tid) if num == 0: cnx.rollback() self._active[tid][0] = num + 1 return PooledConnection(self, cnx, tid) while True: if self._dormant: cnx = self._dormant.p... | 26,300 |
def get_cnx(self, timeout=None): start = time.time() self._available.acquire() try: tid = threading._get_ident() if tid in self._active: self._active[tid][0] += 1 return PooledConnection(self, self._active[tid][1]) while True: if self._dormant: cnx = self._dormant.pop() try: cnx.cursor() # check whether the connection ... | def get_cnx(self, timeout=None): start = time.time() self._available.acquire() try: tid = threading._get_ident() if tid in self._active: self._active[tid][0] += 1 return PooledConnection(self, self._active[tid][1]) while True: if self._dormant: cnx = self._dormant.pop() try: cnx.cursor() # check whether the connection ... | 26,301 |
def _return_cnx(self, cnx): self._available.acquire() try: tid = threading._get_ident() if tid in self._active: num, cnx_ = self._active.get(tid) assert cnx is cnx_ if num > 1: self._active[tid][0] = num - 1 else: self._cleanup(tid) finally: self._available.release() | def _return_cnx(self, cnx, tid): self._available.acquire() try: tid = threading._get_ident() if tid in self._active: num, cnx_ = self._active.get(tid) assert cnx is cnx_ if num > 1: self._active[tid][0] = num - 1 else: self._cleanup(tid) finally: self._available.release() | 26,302 |
def _return_cnx(self, cnx): self._available.acquire() try: tid = threading._get_ident() if tid in self._active: num, cnx_ = self._active.get(tid) assert cnx is cnx_ if num > 1: self._active[tid][0] = num - 1 else: self._cleanup(tid) finally: self._available.release() | def _return_cnx(self, cnx): self._available.acquire() try: if tid in self._active: num, cnx_ = self._active.get(tid) assert cnx is cnx_ if num > 1: self._active[tid][0] = num - 1 else: self._cleanup(tid) finally: self._available.release() | 26,303 |
def _cleanup(self, tid): # Note: self._available *must* be acquired if tid in self._active: cnx = self._active.pop(tid)[1] if cnx not in self._dormant: cnx.rollback() if cnx.poolable: self._dormant.append(cnx) else: cnx.close() self._cursize -= 1 self._available.notify() | def _cleanup(self, tid): # Note: self._available *must* be acquired if tid in self._active: cnx = self._active.pop(tid)[1] if cnx not in self._dormant: if cnx.poolable: cnx.rollback() self._dormant.append(cnx) else: cnx.close() self._cursize -= 1 self._available.notify() | 26,304 |
def _cleanup(self, tid): # Note: self._available *must* be acquired if tid in self._active: cnx = self._active.pop(tid)[1] if cnx not in self._dormant: cnx.rollback() if cnx.poolable: self._dormant.append(cnx) else: cnx.close() self._cursize -= 1 self._available.notify() | def _cleanup(self, tid): # Note: self._available *must* be acquired if tid in self._active: cnx = self._active.pop(tid)[1] if cnx not in self._dormant: cnx.rollback() if cnx.poolable: self._dormant.append(cnx) elif tid == threading._get_ident(): cnx.rollback() cnx.close() self._cursize -= 1 self._available.notify() | 26,305 |
def code_formatter(language, text): processor = WikiProcessor(self.env, language) html = processor.process(req.hdf, text) raw = nodes.raw('', html, format='html') return raw | def code_formatter(language, text): processor = WikiProcessor(self.env, language) html = processor.process(req, text) raw = nodes.raw('', html, format='html') return raw | 26,306 |
def get_cnx(self, timeout=None): start = time.time() self._available.acquire() try: tid = threading._get_ident() if tid in self._active: self._active[tid][0] += 1 return PooledConnection(self, self._active[tid][1]) while True: if self._dormant: cnx = self._dormant.pop() try: cnx.cursor() # check whether the connection ... | def get_cnx(self, timeout=None): start = time.time() self._available.acquire() try: tid = threading._get_ident() if tid in self._active: self._active[tid][0] += 1 return PooledConnection(self, self._active[tid][1]) while True: if self._dormant: cnx = self._dormant.pop() try: cnx.cursor() # check whether the connection ... | 26,307 |
def _format_link(self, formatter, ns, path, label): rev = None match = img_re.search(path) if formatter.flavor != 'oneliner' and match: return '<img src="%s" alt="%s" />' % \ (formatter.href.file(path, format='raw'), label) match = rev_re.search(path) if match: path = match.group(1) rev = match.group(2) label = urllib.... | def _format_link(self, formatter, ns, path, label): match = img_re.search(path) if formatter.flavor != 'oneliner' and match: return '<img src="%s" alt="%s" />' % \ (formatter.href.file(path, format='raw'), label) match = rev_re.search(path) if match: path = match.group(1) rev = match.group(2) label = urllib.unquote(lab... | 26,308 |
def _format_link(self, formatter, ns, path, label): rev = None match = img_re.search(path) if formatter.flavor != 'oneliner' and match: return '<img src="%s" alt="%s" />' % \ (formatter.href.file(path, format='raw'), label) match = rev_re.search(path) if match: path = match.group(1) rev = match.group(2) label = urllib.... | def _format_link(self, formatter, ns, path, label): rev = None match = img_re.search(path) if formatter.flavor != 'oneliner' and match: return '<img src="%s" alt="%s" />' % \ (formatter.href.file(path, format='raw'), label) path, rev = _get_path_rev(path) label = urllib.unquote(label) path = urllib.unquote(path) if rev... | 26,309 |
def _format_link(self, formatter, ns, path, label): rev = None match = img_re.search(path) if formatter.flavor != 'oneliner' and match: return '<img src="%s" alt="%s" />' % \ (formatter.href.file(path, format='raw'), label) match = rev_re.search(path) if match: path = match.group(1) rev = match.group(2) label = urllib.... | def _format_link(self, formatter, ns, path, label): rev = None match = img_re.search(path) if formatter.flavor != 'oneliner' and match: return '<img src="%s" alt="%s" />' % \ (formatter.href.file(path, format='raw'), label) match = rev_re.search(path) if match: path = match.group(1) rev = match.group(2) label = urllib.... | 26,310 |
def _format_link(self, formatter, ns, path, label): rev = None match = img_re.search(path) if formatter.flavor != 'oneliner' and match: return '<img src="%s" alt="%s" />' % \ (formatter.href.file(path, format='raw'), label) match = rev_re.search(path) if match: path = match.group(1) rev = match.group(2) label = urllib.... | def _format_link(self, formatter, ns, path, label): rev = None match = img_re.search(path) if formatter.flavor != 'oneliner' and match: return '<img src="%s" alt="%s" />' % \ (formatter.href.file(path, format='raw'), label) match = rev_re.search(path) if match: path = match.group(1) rev = match.group(2) label = urllib.... | 26,311 |
def make_log_href(path, **args): params = {'rev': rev, 'mode': mode, 'limit': limit} params.update(args) if verbose: params['verbose'] = verbose return self.env.href.log(path, **params) | def make_log_href(path, **args): link_rev = rev if rev == str(repos.youngest_rev): link_rev = None params = {'rev': link_rev, 'mode': mode, 'limit': limit} params.update(args) if verbose: params['verbose'] = verbose return self.env.href.log(path, **params) | 26,312 |
def make_log_href(path, **args): params = {'rev': rev, 'mode': mode, 'limit': limit} params.update(args) if verbose: params['verbose'] = verbose return self.env.href.log(path, **params) | def make_log_href(path, **args): params = {'rev': rev, 'mode': mode, 'limit': limit} params.update(args) if verbose: params['verbose'] = verbose return self.env.href.log(path, **params) | 26,313 |
def is_component_enabled(self, cls): return cls.__module__.find('.tests.') == -1 | def is_component_enabled(self, cls): return cls.__module__.find('.tests.') == -1 | 26,314 |
def get_info(self, req, start, stop, maxrows, filters=AVAILABLE_FILTERS): perm_map = {'tickets': perm.TICKET_VIEW, 'changeset': perm.CHANGESET_VIEW, 'wiki': perm.WIKI_VIEW, 'milestone': perm.MILESTONE_VIEW} filters = list(filters) # copy list so we can make modifications for k,v in perm_map.items(): if k in filters and... | def get_info(self, req, start, stop, maxrows, filters=AVAILABLE_FILTERS): perm_map = {'ticket': perm.TICKET_VIEW, 'changeset': perm.CHANGESET_VIEW, 'wiki': perm.WIKI_VIEW, 'milestone': perm.MILESTONE_VIEW} filters = list(filters) # copy list so we can make modifications for k,v in perm_map.items(): if k in filters and ... | 26,315 |
def get_supported_types(): """Return the types of version control systems that are supported by this connector, and their relative priorities. Highest number is highest priority. """ | def get_supported_types(): """Return the types of version control systems that are supported. Yields `(repotype, priority)` pairs, where `repotype` is used to match against the configured `[trac] repository_type` value in TracIni. If multiple provider match a given type, the `priority` is used to choose between them ... | 26,316 |
def get_repository(repos_type, repos_dir, authname): """Return the Repository object for the given repository type and directory. """ | def get_repository(repos_type, repos_dir, authname): """Return a Repository instance for the given repository type and dir. """ | 26,317 |
def get_repository(repos_type, repos_dir, authname): """Return the Repository object for the given repository type and directory. """ | def get_repository(repos_type, repos_dir, authname): """Return the Repository object for the given repository type and directory. """ | 26,318 |
def get_repository(self, authname): if not self._connector: candidates = [] for connector in self.connectors: for repos_type_, prio in connector.get_supported_types(): if self.repository_type != repos_type_: continue heappush(candidates, (-prio, connector)) if not candidates: raise TracError, 'Unsupported version contr... | def get_repository(self, authname): if not self._connector: candidates = [] for connector in self.connectors: for repos_type_, prio in connector.get_supported_types(): if self.repository_type != repos_type_: continue heappush(candidates, (-prio, connector)) if not candidates: raise TracError('Unsupported version contro... | 26,319 |
def __init__(self, path, rev, msg=None): TracError.__init__(self, "%sNo node %s at revision %s" \ % (msg and '%s: ' % msg or '', path, rev)) | def __init__(self, path, rev, msg=None): TracError.__init__(self, "%sNo node %s at revision %s" \ % (msg and '%s: ' % msg or '', path, rev)) | 26,320 |
def close(self): """ Close the connection to the repository. """ raise NotImplementedError | def close(self): """Close the connection to the repository.""" raise NotImplementedError | 26,321 |
def get_changeset(self, rev): """ Retrieve a Changeset object that describes the changes made in revision 'rev'. """ raise NotImplementedError | def get_changeset(self, rev): """Retrieve a Changeset corresponding to the given revision `rev`.""" raise NotImplementedError | 26,322 |
def get_changesets(self, start, stop): """ Generate Changeset belonging to the given time period (start, stop). """ rev = self.youngest_rev while rev: if self.authz.has_permission_for_changeset(rev): chgset = self.get_changeset(rev) if chgset.date < start: return if chgset.date < stop: yield chgset rev = self.previous_... | def get_changesets(self, start, stop): """Generate Changeset belonging to the given time period (start, stop). """ rev = self.youngest_rev while rev: if self.authz.has_permission_for_changeset(rev): chgset = self.get_changeset(rev) if chgset.date < start: return if chgset.date < stop: yield chgset rev = self.previous_r... | 26,323 |
def has_node(self, path, rev=None): """ Tell if there's a node at the specified (path,rev) combination. | def has_node(self, path, rev=None): """ Tell if there's a node at the specified (path,rev) combination. | 26,324 |
def get_node(self, path, rev=None): """ Retrieve a Node (directory or file) from the repository at the given path. If the rev parameter is specified, the version of the node at that revision is returned, otherwise the latest version of the node is returned. """ raise NotImplementedError | def get_node(self, path, rev=None): """Retrieve a Node from the repository at the given path. A Node represents a directory or a file at a given revision in the repository. If the `rev` parameter is specified, the Node corresponding to that revision is returned, otherwise the Node corresponding to the youngest revisio... | 26,325 |
def get_oldest_rev(self): """ Return the oldest revision stored in the repository. """ raise NotImplementedError | def get_oldest_rev(self): """Return the oldest revision stored in the repository.""" raise NotImplementedError | 26,326 |
def get_youngest_rev(self): """ Return the youngest revision in the repository. """ raise NotImplementedError | def get_youngest_rev(self): """Return the youngest revision in the repository.""" raise NotImplementedError | 26,327 |
def previous_rev(self, rev): """ Return the revision immediately preceding the specified revision. """ raise NotImplementedError | def previous_rev(self, rev): """Return the revision immediately preceding the specified revision.""" raise NotImplementedError | 26,328 |
def next_rev(self, rev, path=''): """ Return the revision immediately following the specified revision. """ raise NotImplementedError | def next_rev(self, rev, path=''): """Return the revision immediately following the specified revision.""" raise NotImplementedError | 26,329 |
def rev_older_than(self, rev1, rev2): """ Return True if rev1 is older than rev2, i.e. if rev1 comes before rev2 in the revision sequence. """ raise NotImplementedError | def rev_older_than(self, rev1, rev2): """Provides a total order over revisions. Return `True` if `rev1` is older than `rev2`, i.e. if `rev1` comes before `rev2` in the revision sequence. """ raise NotImplementedError | 26,330 |
def get_youngest_rev_in_cache(self, db): """ Return the youngest revision currently cached. The way revisions are sequenced is version control specific. By default, one assumes that the revisions are sequenced in time. """ cursor = db.cursor() cursor.execute("SELECT rev FROM revision ORDER BY time DESC LIMIT 1") row = ... | def get_youngest_rev_in_cache(self, db): """Return the youngest revision currently cached. The way revisions are sequenced is version control specific. By default, one assumes that the revisions are sequenced in time. """ cursor = db.cursor() cursor.execute("SELECT rev FROM revision ORDER BY time DESC LIMIT 1") row = ... | 26,331 |
def get_youngest_rev_in_cache(self, db): """ Return the youngest revision currently cached. The way revisions are sequenced is version control specific. By default, one assumes that the revisions are sequenced in time. """ cursor = db.cursor() cursor.execute("SELECT rev FROM revision ORDER BY time DESC LIMIT 1") row = ... | def get_youngest_rev_in_cache(self, db): """ Return the youngest revision currently cached. The way revisions are sequenced is version control specific. By default, one assumes that the revisions are sequenced in time (... which is ''not'' correct for most VCS, including Subversion). """ cursor = db.cursor() cursor.exe... | 26,332 |
def get_path_history(self, path, rev=None, limit=None): """ Retrieve all the revisions containing this path (no newer than 'rev'). The result format should be the same as the one of Node.get_history() """ raise NotImplementedError | def get_path_history(self, path, rev=None, limit=None): """Retrieve all the revisions containing this path If given, `rev` is used as a starting point (i.e. no revision ''newer'' than `rev` should be returned). The result format should be the same as the one of Node.get_history() """ raise NotImplementedError | 26,333 |
def normalize_path(self, path): """ Return a canonical representation of path in the repos. """ return NotImplementedError | def normalize_path(self, path): """Return a canonical representation of path in the repos.""" return NotImplementedError | 26,334 |
def normalize_rev(self, rev): """ Return a canonical representation of a revision in the repos. 'None' is a valid revision value and represents the youngest revision. """ return NotImplementedError | def normalize_rev(self, rev): """Return a canonical representation of a revision. It's up to the backend to decide which string values of `rev` (usually provided by the user) should be accepted, and how they should be normalized. Some backends may for instance want to match against known tags or branch names. In addi... | 26,335 |
def short_rev(self, rev): """ Return a compact representation of a revision in the repos. """ return self.normalize_rev(rev) | def short_rev(self, rev): """Return a compact representation of a revision in the repos.""" return self.normalize_rev(rev) | 26,336 |
def get_changes(self, old_path, old_rev, new_path, new_rev, ignore_ancestry=1): """ Generator that yields change tuples (old_node, new_node, kind, change) for each node change between the two arbitrary (path,rev) pairs. | def get_changes(self, old_path, old_rev, new_path, new_rev, ignore_ancestry=1): """Generates changes corresponding to generalized diffs. Generator that yields change tuples (old_node, new_node, kind, change) for each node change between the two arbitrary (path,rev) pairs. | 26,337 |
def get_changes(self, old_path, old_rev, new_path, new_rev, ignore_ancestry=1): """ Generator that yields change tuples (old_node, new_node, kind, change) for each node change between the two arbitrary (path,rev) pairs. | def get_changes(self, old_path, old_rev, new_path, new_rev, ignore_ancestry=1): """ Generator that yields change tuples (old_node, new_node, kind, change) for each node change between the two arbitrary (path,rev) pairs. | 26,338 |
def __init__(self, path, rev, kind): assert kind in (Node.DIRECTORY, Node.FILE), "Unknown node kind %s" % kind self.path = unicode(path) self.rev = rev self.kind = kind | def __init__(self, path, rev, kind): assert kind in (Node.DIRECTORY, Node.FILE), \ "Unknown node kind %s" % kind self.path = unicode(path) self.rev = rev self.kind = kind | 26,339 |
def get_content(self): """ Return a stream for reading the content of the node. This method will return None for directories. The returned object should provide a read([len]) function. """ raise NotImplementedError | def get_content(self): """Return a stream for reading the content of the node. This method will return `None` for directories. The returned object must support a `read([len])` method. """ raise NotImplementedError | 26,340 |
def get_entries(self): """ Generator that yields the immediate child entries of a directory, in no particular order. If the node is a file, this method returns None. """ raise NotImplementedError | def get_entries(self): """Generator that yields the immediate child entries of a directory. The entries are returned in no particular order. If the node is a file, this method returns `None`. """ raise NotImplementedError | 26,341 |
def get_history(self, limit=None): """ Generator that yields (path, rev, chg) tuples, one for each revision in which the node was changed. This generator will follow copies and moves of a node (if the underlying version control system supports that), which will be indicated by the first element of the tuple (i.e. the p... | def get_history(self, limit=None): """Provide backward history for this Node. Generator that yields `(path, rev, chg)` tuples, one for each revision in which the node was changed. This generator will follow copies and moves of a node (if the underlying version control system supports that), which will be indicated by ... | 26,342 |
def get_previous(self): """ Return the (path, rev, chg) tuple corresponding to the previous revision for that node. """ skip = True for p in self.get_history(2): if skip: skip = False else: return p | def get_previous(self): """Return the change event corresponding to the previous revision. This returns a `(path, rev, chg)` tuple. """ skip = True for p in self.get_history(2): if skip: skip = False else: return p | 26,343 |
def get_properties(self): """ Returns a dictionary containing the properties (meta-data) of the node. The set of properties depends on the version control system. """ raise NotImplementedError | def get_properties(self): """Returns the properties (meta-data) of the node, as a dictionary. The set of properties depends on the version control system. """ raise NotImplementedError | 26,344 |
def get_last_modified(self): raise NotImplementedError | def get_last_modified(self): raise NotImplementedError | 26,345 |
def get_changes(self): """ Generator that produces a (path, kind, change, base_path, base_rev) tuple for every change in the changeset, where change can be one of Changeset.ADD, Changeset.COPY, Changeset.DELETE, Changeset.EDIT or Changeset.MOVE, and kind is one of Node.FILE or Node.DIRECTORY. """ raise NotImplementedEr... | def get_changes(self): """Generator that produces a tuple for every change in the changeset The tuple will contain `(path, kind, change, base_path, base_rev)`, where `change` can be one of Changeset.ADD, Changeset.COPY, Changeset.DELETE, Changeset.EDIT or Changeset.MOVE, and `kind` is one of Node.FILE or Node.DIRECTOR... | 26,346 |
def get_changes(self): """ Generator that produces a (path, kind, change, base_path, base_rev) tuple for every change in the changeset, where change can be one of Changeset.ADD, Changeset.COPY, Changeset.DELETE, Changeset.EDIT or Changeset.MOVE, and kind is one of Node.FILE or Node.DIRECTORY. """ raise NotImplementedEr... | def get_changes(self): """ Generator that produces a (path, kind, change, base_path, base_rev) tuple for every change in the changeset, where change can be one of Changeset.ADD, Changeset.COPY, Changeset.DELETE, Changeset.EDIT or Changeset.MOVE, and kind is one of Node.FILE or Node.DIRECTORY. """ raise NotImplementedEr... | 26,347 |
def __str__(self): return self.action | def __str__(self): return self.action | 26,348 |
def authz_cb(root, path, pool): return self.authzperm.has_permission(path) and 1 or 0 | def authz_cb(root, path, pool): return self.authzperm.has_permission(path) and 1 or 0 | 26,349 |
def render_report_list(self, req, db, id): """ uses a user specified sql query to extract some information from the database and presents it as a html table. """ actions = {'create': perm.REPORT_CREATE, 'delete': perm.REPORT_DELETE, 'modify': perm.REPORT_MODIFY} for action in [k for k,v in actions.items() if req.perm.h... | def render_report_list(self, req, db, id): """ uses a user specified sql query to extract some information from the database and presents it as a html table. """ actions = {'create': perm.REPORT_CREATE, 'delete': perm.REPORT_DELETE, 'modify': perm.REPORT_MODIFY} for action in [k for k,v in actions.items() if req.perm.h... | 26,350 |
def render_report_list(self, req, db, id): """ uses a user specified sql query to extract some information from the database and presents it as a html table. """ actions = {'create': perm.REPORT_CREATE, 'delete': perm.REPORT_DELETE, 'modify': perm.REPORT_MODIFY} for action in [k for k,v in actions.items() if req.perm.h... | def render_report_list(self, req, db, id): """ uses a user specified sql query to extract some information from the database and presents it as a html table. """ actions = {'create': perm.REPORT_CREATE, 'delete': perm.REPORT_DELETE, 'modify': perm.REPORT_MODIFY} for action in [k for k,v in actions.items() if req.perm.h... | 26,351 |
def execute(self, req, db=None): if not self.cols: self.get_columns() | def execute(self, req, db=None): if not self.cols: self.get_columns() | 26,352 |
def execute(self, req, db=None): if not self.cols: self.get_columns() | def execute(self, req, db=None): if not self.cols: self.get_columns() | 26,353 |
def process_request(self, req): """The appropriate mode of operation is inferred from the request parameters: | def process_request(self, req): """The appropriate mode of operation is inferred from the request parameters: | 26,354 |
def process_request(self, req): """The appropriate mode of operation is inferred from the request parameters: | def process_request(self, req): """The appropriate mode of operation is inferred from the request parameters: | 26,355 |
def process_request(self, req): """The appropriate mode of operation is inferred from the request parameters: | def process_request(self, req): """The appropriate mode of operation is inferred from the request parameters: | 26,356 |
def _render_html(self, req, repos, chgset, restricted, diff, diff_options): """HTML version""" req.hdf['changeset'] = { 'chgset': chgset and True, 'restricted': restricted, 'href': { 'new_rev': req.href.changeset(diff.new_rev), 'old_rev': req.href.changeset(diff.old_rev), 'new_path': req.href.browser(diff.new_path, rev... | def _render_html(self, req, repos, chgset, restricted, message, diff, diff_options): """HTML version""" req.hdf['changeset'] = { 'chgset': chgset and True, 'restricted': restricted, 'href': { 'new_rev': req.href.changeset(diff.new_rev), 'old_rev': req.href.changeset(diff.old_rev), 'new_path': req.href.browser(diff.new_... | 26,357 |
def _changeset_title(rev): if restricted: return 'Changeset %s for %s' % (rev, path) else: return 'Changeset %s' % rev | def _changeset_title(rev): if restricted: return 'Changeset %s for %s' % (rev, path) else: return 'Changeset %s' % rev | 26,358 |
def get_timeline_events(self, req, start, stop, filters): if 'milestone' in filters: format = req.args.get('format') db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT completed,name,description FROM milestone " "WHERE completed>=%s AND completed<=%s", (start, stop,)) for completed, name, descriptio... | def get_timeline_events(self, req, start, stop, filters): if 'milestone' in filters: format = req.args.get('format') db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT completed,name,description FROM milestone " "WHERE completed>=%s AND completed<=%s", (start, stop,)) for completed, name, descriptio... | 26,359 |
def process(self, req, text, in_paragraph=False): if self.error: text = system_message(Markup('Error: Failed to load processor ' '<code>%s</code>', self.name), self.error) else: text = self.processor(req, text) if in_paragraph: content_for_span = None interrupt_paragraph = False if isinstance(text, Element): tagname = ... | def process(self, req, text, in_paragraph=False): if self.error: text = system_message(Markup('Error: Failed to load processor ' '<code>%s</code>', self.name), self.error) else: text = self.processor(req, text) if in_paragraph: content_for_span = None interrupt_paragraph = False if isinstance(text, Element): tagname = ... | 26,360 |
def suite(data=None, setup=None, file=__file__): suite = unittest.TestSuite() if not data: file = os.path.join(os.path.split(file)[0], 'wiki-tests.txt') data = open(file, 'r').read().decode('utf-8') tests = data.split('=' * 30) line = 1 for test in tests: if not test or test == '\n': continue blocks = test.split('-' * ... | def suite(data=None, setup=None, file=__file__): suite = unittest.TestSuite() if not data: file = os.path.join(os.path.split(file)[0], 'wiki-tests.txt') data = open(file, 'r').read().decode('utf-8') tests = data.split('=' * 30) next_line = 1 line = 0 for test in tests: if not test or test == '\n': continue blocks = tes... | 26,361 |
def suite(data=None, setup=None, file=__file__): suite = unittest.TestSuite() if not data: file = os.path.join(os.path.split(file)[0], 'wiki-tests.txt') data = open(file, 'r').read().decode('utf-8') tests = data.split('=' * 30) line = 1 for test in tests: if not test or test == '\n': continue blocks = test.split('-' * ... | def suite(data=None, setup=None, file=__file__): suite = unittest.TestSuite() if not data: file = os.path.join(os.path.split(file)[0], 'wiki-tests.txt') data = open(file, 'r').read().decode('utf-8') tests = data.split('=' * 30) line = 1 for test in tests: if not test or test == '\n': continue blocks = test.split('-' * ... | 26,362 |
def _html_splitlines(lines): """Tracks open and close tags in lines of HTML text and yields lines that have no tags spanning more than one line.""" open_tag_re = re.compile(r'<(\w+)\s.*?[^/]?>') close_tag_re = re.compile(r'</(\w+)>') open_tags = [] for line in lines: # Reopen tags still open from the previous line for ... | def _html_splitlines(lines): """Tracks open and close tags in lines of HTML text and yields lines that have no tags spanning more than one line.""" open_tag_re = re.compile(r'<(\w+)(\s.*)?[^/]?>') close_tag_re = re.compile(r'</(\w+)>') open_tags = [] for line in lines: # Reopen tags still open from the previous line fo... | 26,363 |
def _auth_callback(option, opt_str, value, parser, auths, cls): info = value.split(',', 3) if len(info) != 3: raise OptionValueError("Incorrect number of parameters for %s" % option) usage() env_name, filename, realm = info if env_name in auths: print >>sys.stderr, 'Ignoring duplicate authentication option for ' \ 'pro... | def _auth_callback(option, opt_str, value, parser, auths, cls): info = value.split(',', 3) if len(info) != 3: raise OptionValueError("Incorrect number of parameters for %s" % option) env_name, filename, realm = info if env_name in auths: print >>sys.stderr, 'Ignoring duplicate authentication option for ' \ 'project: %... | 26,364 |
def _do_wiki_import(self, filename, title, cursor=None): if not os.path.isfile(filename): raise Exception, '%s is not a file' % filename | def _do_wiki_import(self, filename, title, cursor=None): if not os.path.isfile(filename): raise Exception, '%s is not a file' % filename | 26,365 |
def display_html(self, req, query): req.hdf['title'] = 'Custom Query' add_stylesheet(req, 'report.css') | def display_html(self, req, query): req.hdf['title'] = 'Custom Query' add_stylesheet(req, 'report.css') | 26,366 |
def get_timeline_events(self, req, start, stop, filters): if 'ticket' in filters: format = req.args.get('format') sql = [] | def get_timeline_events(self, req, start, stop, filters): if 'ticket' in filters: format = req.args.get('format') sql = [] | 26,367 |
def render(self): self.perm.assert_permission(perm.TICKET_VIEW) | def render(self): self.perm.assert_permission(perm.TICKET_VIEW) | 26,368 |
def render(self): self.perm.assert_permission(perm.TICKET_VIEW) | def render(self): self.perm.assert_permission(perm.TICKET_VIEW) | 26,369 |
def print_table(data, headers=None, sep=' ', out=None): if out is None: out = sys.stdout charset = getattr(out, 'encoding', 'utf-8') data = list(data) if headers: data.insert(0, headers) elif not data: return num_cols = len(data[0]) # assumes all rows are of equal length col_width = [] for idx in range(num_cols): col... | def print_table(data, headers=None, sep=' ', out=None): if out is None: out = sys.stdout charset = getattr(out, 'encoding', 'utf-8') data = list(data) if headers: data.insert(0, headers) elif not data: return num_cols = len(data[0]) # assumes all rows are of equal length col_width = [] for idx in range(num_cols): col... | 26,370 |
def get_changes(env, repos, revs, full=None, req=None, format=None): db = env.get_db_cnx() changes = {} for rev in revs: try: changeset = repos.get_changeset(rev) except NoSuchChangeset: changes[rev] = {} continue wiki_format = env.config['changeset'].getbool('wiki_format_messages') message = changeset.message or '--'... | def get_changes(env, repos, revs, full=None, req=None, format=None): db = env.get_db_cnx() changes = {} for rev in revs: try: changeset = repos.get_changeset(rev) except NoSuchChangeset: changes[rev] = {} continue wiki_format = env.config['changeset'].getbool('wiki_format_messages') message = changeset.message or '--'... | 26,371 |
def get_changes(env, repos, revs, full=None, req=None, format=None): db = env.get_db_cnx() changes = {} for rev in revs: try: changeset = repos.get_changeset(rev) except NoSuchChangeset: changes[rev] = {} continue wiki_format = env.config['changeset'].getbool('wiki_format_messages') message = changeset.message or '--'... | def get_changes(env, repos, revs, full=None, req=None, format=None): db = env.get_db_cnx() changes = {} for rev in revs: try: changeset = repos.get_changeset(rev) except NoSuchChangeset: changes[rev] = {} continue wiki_format = env.config['changeset'].getbool('wiki_format_messages') message = changeset.message or '--'... | 26,372 |
def display_html(self, context, query): req = context.req db = self.env.get_db_cnx() tickets = query.execute(req, db) | def display_html(self, context, query): req = context.req db = self.env.get_db_cnx() tickets = query.execute(req, db) | 26,373 |
def display_html(self, context, query): req = context.req db = self.env.get_db_cnx() tickets = query.execute(req, db) | defdisplay_html(self,context,query):req=context.reqdb=self.env.get_db_cnx()tickets=query.execute(req,db) | 26,374 |
def match_request(self, req): match = re.match(r'^/attachment/(ticket|wiki)(?:[/:](.*))?$', req.path_info) if match: req.args['type'] = match.group(1) req.args['path'] = match.group(2).replace(':', '/') return True | def match_request(self, req): match = re.match(r'^/(raw-)?attachment/([^/]+)(?:[/:](.*))?$', req.path_info) if match: req.args['type'] = match.group(1) req.args['path'] = match.group(2).replace(':', '/') return True | 26,375 |
def match_request(self, req): match = re.match(r'^/attachment/(ticket|wiki)(?:[/:](.*))?$', req.path_info) if match: req.args['type'] = match.group(1) req.args['path'] = match.group(2).replace(':', '/') return True | def match_request(self, req): match = re.match(r'^/attachment/(ticket|wiki)(?:[/:](.*))?$', req.path_info) if match: req.args['format'] = match.group(1) and 'raw' or '' req.args['type'] = match.group(2) req.args['path'] = match.group(3).replace(':', '/') return True | 26,376 |
def _render_view(self, req, attachment): perm_map = {'ticket': 'TICKET_VIEW', 'wiki': 'WIKI_VIEW'} req.perm.require(perm_map[attachment.parent_type]) | def _render_view(self, req, attachment): perm_map = {'ticket': 'TICKET_VIEW', 'wiki': 'WIKI_VIEW'} req.perm.require(perm_map[attachment.parent_type]) | 26,377 |
def attachment_link(parent_type, parent_id, filename): href = formatter.href() try: attachment = Attachment(self.env, parent_type, parent_id, filename) if formatter.req: href = attachment.href(formatter.req) + params return html.A(label, class_='attachment', href=href, title='Attachment %s' % attachment.title) except T... | def attachment_link(parent_type, parent_id, filename): href = formatter.href() try: attachment = Attachment(self.env, parent_type, parent_id, filename) if ns.startswith('raw'): href = attachment.raw_href(formatter.req) elif formatter.req: href = attachment.href(formatter.req) + params return html.A(label, class_='attac... | 26,378 |
def get_charset(mimetype): """Return the character encoding included in the given content type string, or `None` if `mimetype` is `None` or empty or if no charset information is available. """ if mimetype: ctpos = mimetype.find('charset=') if ctpos >= 0: return mime_type[ctpos + 8:] | def get_charset(mimetype): """Return the character encoding included in the given content type string, or `None` if `mimetype` is `None` or empty or if no charset information is available. """ if mimetype: ctpos = mimetype.find('charset=') if ctpos >= 0: return mimetype[ctpos + 8:] | 26,379 |
def wiki_escape_newline(text): return text.replace(os.linesep, '[[BR]]' + os.linesep) | def wiki_escape_newline(text): return text.replace(os.linesep, '[[BR]]' + os.linesep) | 26,380 |
def shorten_line(text, maxlen = 75): if not text: return '' i = text.find('[[BR]]') if i < maxlen: shortline = text[:i]+' ...' elif len(text) < maxlen: shortline = text else: i = text[:maxlen].rfind(' ') if i == -1: i = maxlen shortline = text[:i]+' ...' return shortline | def shorten_line(text, maxlen = 75): if not text: return '' i = text.find('[[BR]]') if i > -1 and i < maxlen: shortline = text[:i]+' ...' elif len(text) < maxlen: shortline = text else: i = text[:maxlen].rfind(' ') if i == -1: i = maxlen shortline = text[:i]+' ...' return shortline | 26,381 |
def __getattr__(self, str): return self[str] | def __getattr__(self, str): return self[str] | 26,382 |
def sortkey(row): val = row[colIndex] if isinstance(val, basestring): val = val.lower() return val | def sortkey(row): val = row[colIndex] if isinstance(val, basestring): val = val.lower() return val | 26,383 |
def render_ics(self, req, db, milestones): req.send_response(200) req.send_header('Content-Type', 'text/calendar;charset=utf-8') req.end_headers() | def render_ics(self, req, db, milestones): req.send_response(200) req.send_header('Content-Type', 'text/calendar;charset=utf-8') req.end_headers() | 26,384 |
def write_utctime(name, value, params={}): write_prop(name, strftime('%Y%m%dT%H%M%SZ', value), params) | def write_utctime(name, value, params={}): write_prop(name, strftime('%Y%m%dT%H%M%SZ', value), params) | 26,385 |
def write_utctime(name, value, params={}): write_prop(name, strftime('%Y%m%dT%H%M%SZ', value), params) | def write_utctime(name, value, params={}): write_prop(name, strftime('%Y%m%dT%H%M%SZ', value), params) | 26,386 |
def add_stylesheet(req, filename, mimetype='text/css'): """Add a link to a style sheet to the HDF data set so that it gets included in the generated HTML page. """ if filename.startswith('common/') and 'htdocs_location' in req.chrome: href = Href(req.chrome['htdocs_location']) filename = filename[7:] else: href = Href(... | def add_stylesheet(req, filename, mimetype='text/css'): """Add a link to a style sheet to the HDF data set so that it gets included in the generated HTML page. """ if filename.startswith('common/') and 'htdocs_location' in req.chrome: href = Href(req.chrome['htdocs_location']) filename = filename[7:] else: href = req.h... | 26,387 |
def add_script(req, filename, mimetype='text/javascript'): """Add a reference to an external javascript file to the template.""" scriptset = req.chrome.setdefault('trac.chrome.scriptset', set()) if filename in scriptset: return False # Already added that script if filename.startswith('common/') and 'htdocs_location' i... | def add_script(req, filename, mimetype='text/javascript'): """Add a reference to an external javascript file to the template. If the filename is absolute (i.e. starts with a slash), the generated link will be based off the application root path. If it is relative, the link will be based off the `/chrome/` path. """ sc... | 26,388 |
def add_script(req, filename, mimetype='text/javascript'): """Add a reference to an external javascript file to the template.""" scriptset = req.chrome.setdefault('trac.chrome.scriptset', set()) if filename in scriptset: return False # Already added that script if filename.startswith('common/') and 'htdocs_location' i... | def add_script(req, filename, mimetype='text/javascript'): """Add a reference to an external javascript file to the template.""" scriptset = req.chrome.setdefault('trac.chrome.scriptset', set()) if filename in scriptset: return False # Already added that script if filename.startswith('common/') and 'htdocs_location' i... | 26,389 |
def _shref_formatter(self, match, fullmatch): ns = fullmatch.group('sns') target = fullmatch.group('stgt') if target[0] in "'\"": target = target[1:-1] return self._make_link(ns, target, match, match) | def _shref_formatter(self, match, fullmatch): ns = fullmatch.group('sns') target = self._unquote(fullmatch.group('stgt')) return self._make_link(ns, target, match, match) | 26,390 |
def _lhref_formatter(self, match, fullmatch): ns = fullmatch.group('lns') target = fullmatch.group('ltgt') if target and target[0] in ("'",'"'): target = target[1:-1] label = fullmatch.group('label') if not label: # e.g. `[http://target]` or `[wiki:target]` if target: if target.startswith('//'): # for `[http://target]`... | def _lhref_formatter(self, match, fullmatch): ns = fullmatch.group('lns') target = self._unquote(fullmatch.group('ltgt')) label = fullmatch.group('label') if not label: # e.g. `[http://target]` or `[wiki:target]` if target: if target.startswith('//'): # for `[http://target]` label = ns+':'+target # use `http://target... | 26,391 |
def _lhref_formatter(self, match, fullmatch): ns = fullmatch.group('lns') target = fullmatch.group('ltgt') if target and target[0] in ("'",'"'): target = target[1:-1] label = fullmatch.group('label') if not label: # e.g. `[http://target]` or `[wiki:target]` if target: if target.startswith('//'): # for `[http://target]`... | def _lhref_formatter(self, match, fullmatch): ns = fullmatch.group('lns') target = fullmatch.group('ltgt') if target and target[0] in ("'",'"'): target = target[1:-1] label = fullmatch.group('label') if not label: # e.g. `[http://target]` or `[wiki:target]` if target: if target.startswith('//'): # for `[http://target]`... | 26,392 |
def __init__(self, hdf, prefix='changeset.diff'): self.block = [] self.ttype = None self.p_block = [] self.p_type = None self.hdf = hdf self.prefix = prefix self.changeno = 0 self.blockno = 0 | def __init__(self, hdf, prefix='changeset.diff'): self.block = [] self.ttype = None self.p_block = [] self.p_type = None self.hdf = hdf self.prefix = prefix self.changeno = -1 self.blockno = 0 | 26,393 |
def print_block (self): self.blockno += 1 prefix = '%s.changes.%d.blocks.%d' % (self.prefix, self.changeno, self.blockno) if self.p_type == '-' and self.ttype == '+': self._write_block(prefix, 'mod', old=string.join(self.p_block, '<br />'), new=string.join(self.block, '<br />')) elif self.ttype == '+': self._write_bloc... | def print_block (self): prefix = '%s.changes.%d.blocks.%d' % (self.prefix, self.changeno, self.blockno) if self.p_type == '-' and self.ttype == '+': self._write_block(prefix, 'mod', old=string.join(self.p_block, '<br />'), new=string.join(self.block, '<br />')) elif self.ttype == '+': self._write_block(prefix, 'add', n... | 26,394 |
def writeline(self, text): match = header_re.search(text) if match: self.hdf.setValue('%s.name.old' % self.prefix, match.group(1)) self.hdf.setValue('%s.name.new' % self.prefix, match.group(2)) return if text[0:2] in ['++', '--']: return match = line_re.search(text) if match: self.changeno += 1 pfx = '%s.changes.%d.lin... | def writeline(self, text): match = header_re.search(text) if match: self.hdf.setValue('%s.name.old' % self.prefix, match.group(1)) self.hdf.setValue('%s.name.new' % self.prefix, match.group(2)) return if text[0:2] in ['++', '--']: return match = line_re.search(text) if match: self.changeno += 1 pfx = '%s.changes.%d.lin... | 26,395 |
def add_file(self, path, parent_baton, copyfrom_path, copyfrom_revision, file_pool): return [None, path, file_pool] | def add_file(self, path, parent_baton, copyfrom_path, copyfrom_revision, file_pool): return [None, path, file_pool] | 26,396 |
def get_header(self, name): return self.req.headers_out.get(name) | def get_header(self, name): return self.req.headers_out.get(name) | 26,397 |
def init(req): global env try: options = req.req.get_options() if not options.has_key('TracEnv'): raise EnvironmentError, \ 'Missing PythonOption "TracEnv". Trac requires this option '\ 'to point to a valid Trac Environment.' env_path = options['TracEnv'] env = Environment.Environment(env_path) version = env.get_vers... | def init(req): global envtry: options = req.req.get_options() if not options.has_key('TracEnv'): raise EnvironmentError, \ 'Missing PythonOption "TracEnv". Trac requires this option '\ 'to point to a valid Trac Environment.' env_path = options['TracEnv']env = Environment.Environment(env_path) version = env.get_version(... | 26,398 |
def _do_create(self, req, db): if not req.args.get('summary'): raise TracError('Tickets must contain a summary.') | def _do_create(self, req, db): if not req.args.get('summary'): raise TracError('Tickets must contain a summary.') | 26,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.