bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def to_integral(self, rounding = None, context=None): """Rounds to the nearest integer, without raising inexact, rounded.""" if self._is_special: ans = self._check_nans(context=context) if ans: return ans if self._exp >= 0: return self if context is None: context = getcontext() flags = context._ignore_flags(Rounded, In... | def to_integral(self, rounding=None, context=None): """Rounds to the nearest integer, without raising inexact, rounded.""" if self._is_special: ans = self._check_nans(context=context) if ans: return ans if self._exp >= 0: return self if context is None: context = getcontext() flags = context._ignore_flags(Rounded, Inex... | 25,200 |
def sqrt(self, context=None): """Return the square root of self. | def sqrt(self, context=None): """Return the square root of self. | 25,201 |
def sqrt(self, context=None): """Return the square root of self. | def sqrt(self, context=None): """Return the square root of self. | 25,202 |
def max(self, other, context=None): """Returns the larger value. | def max(self, other, context=None): """Returns the larger value. | 25,203 |
def min(self, other, context=None): """Returns the smaller value. | def min(self, other, context=None): """Returns the smaller value. | 25,204 |
def create_decimal(self, num='0'): """Creates a new Decimal instance but using self as context.""" d = Decimal(num, context=self) return d._fix(context=self) | def create_decimal(self, num='0'): """Creates a new Decimal instance but using self as context.""" d = Decimal(num, context=self) return d._fix(context=self) | 25,205 |
def _apply(self, a): return str(a._fix(context=self)) | def _apply(self, a): return str(a._fix(context=self)) | 25,206 |
def _norm_version(version,build=''): """ Normalize the version and build strings and return a single vesion string using the format major.minor.build (or patchlevel). """ l = string.split(version,'.') if build: l.append(build) try: ints = map(int,l) except ValueError: strings = l else: strings = map(str,ints) version ... | def _norm_version(version,build=''): """ Normalize the version and build strings and return a single version string using the format major.minor.build (or patchlevel). """ l = string.split(version,'.') if build: l.append(build) try: ints = map(int,l) except ValueError: strings = l else: strings = map(str,ints) version... | 25,207 |
def test_setparameters(dsp): # Two configurations for testing: # config1 (8-bit, mono, 8 kHz) should work on even the most # ancient and crufty sound card, but maybe not on special- # purpose high-end hardware # config2 (16-bit, stereo, 44.1kHz) should work on all but the # most ancient and crufty ha... | def test_setparameters(dsp): # Two configurations for testing: # config1 (8-bit, mono, 8 kHz) should work on even the most # ancient and crufty sound card, but maybe not on special- # purpose high-end hardware # config2 (16-bit, stereo, 44.1kHz) should work on all but the # most ancient and crufty ha... | 25,208 |
def test_setparameters(dsp): # Two configurations for testing: # config1 (8-bit, mono, 8 kHz) should work on even the most # ancient and crufty sound card, but maybe not on special- # purpose high-end hardware # config2 (16-bit, stereo, 44.1kHz) should work on all but the # most ancient and crufty ha... | def test_setparameters(dsp): # Two configurations for testing: # config1 (8-bit, mono, 8 kHz) should work on even the most # ancient and crufty sound card, but maybe not on special- # purpose high-end hardware # config2 (16-bit, stereo, 44.1kHz) should work on all but the # most ancient and crufty ha... | 25,209 |
def _set_hostport(self, host, port): if port is None: i = host.rfind(':') j = host.rfind(']') # ipv6 addresses have [...] if i > j: try: port = int(host[i+1:]) except ValueError: raise InvalidURL("nonnumeric port: '%s'" % host[i+1:]) host = host[:i] else: port = self.default_port if host[0] == '[' and host[-1] ... | def _set_hostport(self, host, port): if port is None: i = host.rfind(':') j = host.rfind(']') # ipv6 addresses have [...] if i > j: try: port = int(host[i+1:]) except ValueError: raise InvalidURL("nonnumeric port: '%s'" % host[i+1:]) host = host[:i] else: port = self.default_port if host and host[0] == '[' and ... | 25,210 |
def open_file(self, url): """Use local file or FTP depending on form of URL.""" if url[:2] == '//' and url[2:3] != '/': return self.open_ftp(url) else: return self.open_local_file(url) | def open_file(self, url): """Use local file or FTP depending on form of URL.""" if url[:2] == '//' and url[2:3] != '/' and url[2:12] != 'localhost/': return self.open_ftp(url) else: return self.open_local_file(url) | 25,211 |
def _stringify(string): return string | def _stringify(string): return string | 25,212 |
def _stringify(string): return string | def _stringify(string): return string | 25,213 |
def __init__(self, value=0): t = type(value) if not isinstance(t, StringType): if not isinstance(t, TupleType): if value == 0: value = time.time() value = time.localtime(value) value = time.strftime("%Y%m%dT%H:%M:%S", value) self.value = value | def __init__(self, value=0): if not isinstance(value, StringType): if not isinstance(value, TupleType): if value == 0: value = time.time() value = time.localtime(value) value = time.strftime("%Y%m%dT%H:%M:%S", value) self.value = value | 25,214 |
def __repr__(self): return ( "<Server proxy for %s%s>" % (self.__host, self.__handler) ) | def __repr__(self): return ( "<ServerProxy for %s%s>" % (self.__host, self.__handler) ) | 25,215 |
def __getattr__(self, name): # magic method dispatcher return _Method(self.__request, name) | def __getattr__(self, name): # magic method dispatcher return _Method(self.__request, name) | 25,216 |
def run(self, _no_object=None, _attributes={}, **_arguments): """run: Run the Terminal application Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' _subcode = 'oapp' | def run(self, _no_object=None, _attributes={}, **_arguments): """run: Run the Terminal application Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' _subcode = 'oapp' | 25,217 |
def quit(self, _no_object=None, _attributes={}, **_arguments): """quit: Quit the Terminal application Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' _subcode = 'quit' | def quit(self, _no_object=None, _attributes={}, **_arguments): """quit: Quit the Terminal application Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' _subcode = 'quit' | 25,218 |
def count(self, _object=None, _attributes={}, **_arguments): """count: Return the number of elements of a particular class within an object Required argument: a reference to the objects to be counted Keyword argument _attributes: AppleEvent attribute dictionary Returns: the number of objects counted """ _code = 'core' ... | def count(self, _object=None, _attributes={}, **_arguments): """count: Return the number of elements of a particular class within an object Required argument: a reference to the objects to be counted Keyword argument _attributes: AppleEvent attribute dictionary Returns: the number of objects counted """ _code = 'core' ... | 25,219 |
def do_script(self, _no_object=None, _attributes={}, **_arguments): """do script: Run a UNIX shell script or command Keyword argument with_command: data to be passed to the Terminal application as the command line Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' _subcode = 'dosc' | def do_script(self, _no_object=None, _attributes={}, **_arguments): """do script: Run a UNIX shell script or command Keyword argument with_command: data to be passed to the Terminal application as the command line Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' _subcode = 'dosc' | 25,220 |
def CFUNCTYPE(restype, *argtypes): """CFUNCTYPE(restype, *argtypes) -> function prototype. restype: the result type argtypes: a sequence specifying the argument types The function prototype can be called in three ways to create a callable object: prototype(integer address) -> foreign function prototype(callable) -> ... | def CFUNCTYPE(restype, *argtypes): """CFUNCTYPE(restype, *argtypes) -> function prototype. restype: the result type argtypes: a sequence specifying the argument types The function prototype can be called in different ways to create a callable object: prototype(integer address) -> foreign function prototype(callable)... | 25,221 |
def test_badbom(self): s = StringIO.StringIO("\xff\xff") f = codecs.getwriter(self.encoding)(s) self.assertRaises(UnicodeError, f.read) | def test_badbom(self): s = StringIO.StringIO("\xff\xff") f = codecs.getreader(self.encoding)(s) self.assertRaises(UnicodeError, f.read) | 25,222 |
def test_badbom(self): s = StringIO.StringIO("\xff\xff") f = codecs.getwriter(self.encoding)(s) self.assertRaises(UnicodeError, f.read) | def test_badbom(self): s = StringIO.StringIO("\xff\xff") f = codecs.getreader(self.encoding)(s) self.assertRaises(UnicodeError, f.read) | 25,223 |
def play_sound_file(path): fp = open(path, 'r') size, enc, rate, nchannels, extra = sunaudio.gethdr(fp) data = fp.read() fp.close() if enc != SND_FORMAT_MULAW_8: print "Expect .au file with 8-bit mu-law samples" return try: a = linuxaudiodev.open('w') except linuxaudiodev.error, msg: if msg[0] in (errno.EACCES, errno... | def play_sound_file(path): fp = open(path, 'r') size, enc, rate, nchannels, extra = sunaudio.gethdr(fp) data = fp.read() fp.close() if enc != SND_FORMAT_MULAW_8: print "Expect .au file with 8-bit mu-law samples" return try: a = linuxaudiodev.open('w') except linuxaudiodev.error, msg: if msg[0] in (errno.EACCES, errno... | 25,224 |
def print_exception(): flush_stdout() efile = sys.stderr typ, val, tb = sys.exc_info() tbe = traceback.extract_tb(tb) print >>efile, '\nTraceback (most recent call last):' exclude = ("run.py", "rpc.py", "threading.py", "Queue.py", "RemoteDebugger.py", "bdb.py") cleanup_traceback(tbe, exclude) traceback.print_list(tbe, ... | def print_exception(): flush_stdout() efile = sys.stderr typ, val, tb = excinfo = sys.exc_info() sys.last_type, sys.last_value, sys.last_traceback = excinfo tbe = traceback.extract_tb(tb) print >>efile, '\nTraceback (most recent call last):' exclude = ("run.py", "rpc.py", "threading.py", "Queue.py", "RemoteDebugger.py"... | 25,225 |
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.append('/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.append( '/usr/local/include' ) | def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.append('/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.append( '/usr/local/include' ) | 25,226 |
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.append('/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.append( '/usr/local/include' ) | def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.append('/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.append( '/usr/local/include' ) | 25,227 |
def _indent_formatter(self, match, fullmatch): depth = int((len(fullmatch.group('idepth')) + 1) / 2) list_depth = len(self._list_stack) if list_depth > 0 and depth == list_depth + 1: self.in_list_item = True else: self.open_indentation(depth) return '' | def _indent_formatter(self, match, fullmatch): depth = int((len(fullmatch.group('idepth')) + 1) / 2) list_depth = len(self._list_stack) if list_depth > 0 and depth == list_depth + 1: self.in_list_item = 1 else: self.open_indentation(depth) return '' | 25,228 |
def check_modified(self, timesecs, extra=''): etag = 'W"%s/%d/%s"' % (self.authname, timesecs, extra) inm = self.get_header('If-None-Match') if (not inm or inm != etag): self.send_header('ETag', etag) return self.send_response(304) self.end_headers() raise NotModifiedException() | def check_modified(self, timesecs, extra=''): etag = 'W"%s/%d/%s"' % (self.authname, timesecs, extra) inm = self.get_header('If-None-Match') if (not inm or inm != etag): self.send_header('ETag', etag) return self.send_response(304) self.end_headers() raise NotModifiedException() | 25,229 |
def _init_defaults(self, db=None): for field in self.fields: default = None if not field.get('custom'): default = self.env.config.get('ticket', 'default_' + field['name']) else: default = field.get('value') options = field.get('options', []) if default and default not in field.get('options', []): try: default_idx = int... | def _init_defaults(self, db=None): for field in self.fields: default = None if not field.get('custom'): default = self.env.config.get('ticket', 'default_' + field['name']) else: default = field.get('value') options = field.get('options') if default and options and default not in options: try: default_idx = int(default)... | 25,230 |
def check_modified(self, timesecs, extra=''): """Check the request "If-None-Match" header against an entity tag generated from the specified last modified time in seconds (`timesecs`), optionally appending an `extra` string to indicate variants of the requested resource. That `extra` parameter can also be a list, in wh... | def check_modified(self, timesecs, extra=''): """Check the request "If-None-Match" header against an entity tag generated from the specified last modified time in seconds (`timesecs`), optionally appending an `extra` string to indicate variants of the requested resource. That `extra` parameter can also be a list, in wh... | 25,231 |
def check_modified(self, timesecs, extra=''): """Check the request "If-None-Match" header against an entity tag generated from the specified last modified time in seconds (`timesecs`), optionally appending an `extra` string to indicate variants of the requested resource. That `extra` parameter can also be a list, in wh... | def check_modified(self, timesecs, extra=''): """Check the request "If-None-Match" header against an entity tag generated from the specified last modified time in seconds (`timesecs`), optionally appending an `extra` string to indicate variants of the requested resource. That `extra` parameter can also be a list, in wh... | 25,232 |
def insert_custom_fields(env, hdf, vals={}): for idx, field in util.enum(TicketSystem(env).get_custom_fields()): name = field['name'] value = vals.get('custom_' + name, field['value']) prefix = 'ticket.custom.%d' % idx hdf[prefix] = { 'name': field['name'], 'type': field['type'], 'label': field['label'] or field['name'... | def insert_custom_fields(env, hdf, vals={}): for idx, field in util.enum(TicketSystem(env).get_custom_fields()): name = field['name'] value = vals.get('custom_' + name, field['value']) prefix = 'ticket.custom.%d' % idx hdf[prefix] = { 'name': field['name'], 'type': field['type'], 'label': field['label'] or field['name'... | 25,233 |
def main(): from optparse import OptionParser parser = OptionParser(usage='usage: %prog [options] [projenv] ...', version='%%prog %s' % __version__) auths = {} def _auth_callback(option, opt_str, value, parser, auths, cls): info = value.split(',', 3) if len(info) != 3: usage() env_name, filename, realm = info if env_n... | def main(): from optparse import OptionParser, OptionValueError parser = OptionParser(usage='usage: %prog [options] [projenv] ...', version='%%prog %s' % __version__) auths = {} def _auth_callback(option, opt_str, value, parser, auths, cls): info = value.split(',', 3) if len(info) != 3: usage() env_name, filename, rea... | 25,234 |
def _auth_callback(option, opt_str, value, parser, auths, cls): info = value.split(',', 3) if len(info) != 3: usage() env_name, filename, realm = info if env_name in auths: print >>sys.stderr, 'Ignoring duplicate authentication option for ' \ 'project: %s' % env_name else: auths[env_name] = cls(filename, realm) | 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... | 25,235 |
def serve(): server_cls = __import__('flup.server.%s' % options.protocol, None, None, ['']).WSGIServer ret = server_cls(wsgi_app, bindAddress=server_address).run() sys.exit(ret and 42 or 0) # if SIGHUP exit with status 42 | def serve(): server_cls = __import__('flup.server.%s' % options.protocol, None, None, ['']).WSGIServer ret = server_cls(wsgi_app, bindAddress=server_address).run() sys.exit(ret and 42 or 0) # if SIGHUP exit with status 42 | 25,236 |
def _do_wiki_import(self, filename, title, cursor=None): if not os.path.isfile(filename): print "%s is not a file" % filename return f = open(filename,'r') data = util.to_utf8(f.read()) | def _do_wiki_import(self, filename, title, cursor=None): if not os.path.isfile(filename): print "%s is not a file" % filename return f = open(filename,'r') data = util.to_utf8(f.read()) | 25,237 |
def setup_log(self): """Initialize the logging sub-system.""" from trac.log import logger_factory logtype = self.config.get('logging', 'log_type') loglevel = self.config.get('logging', 'log_level') logfile = self.config.get('logging', 'log_file') logfile = os.path.join(self.get_log_dir(), logfile) logid = self.path # E... | def setup_log(self): """Initialize the logging sub-system.""" from trac.log import logger_factory logtype = self.config.get('logging', 'log_type') loglevel = self.config.get('logging', 'log_level') logfile = self.config.get('logging', 'log_file') if not os.path.isabs(logfile): logfile = os.path.join(self.get_log_dir(),... | 25,238 |
def render(self, req): self.perm.assert_permission(perm.ROADMAP_VIEW) req.hdf.setValue('title', 'Roadmap') | def render(self, req): self.perm.assert_permission(perm.ROADMAP_VIEW) req.hdf.setValue('title', 'Roadmap') | 25,239 |
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) | 25,240 |
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) | 25,241 |
def _render_view(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': 'REPORT_CREATE', 'delete': 'REPORT_DELETE', 'modify': 'REPORT_MODIFY'} for action in [k for k,v in actions.items() if req.perm.has_permission(v... | def _render_view(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': 'REPORT_CREATE', 'delete': 'REPORT_DELETE', 'modify': 'REPORT_MODIFY'} for action in [k for k,v in actions.items() if req.perm.has_permission(v... | 25,242 |
def add_link(req, rel, href, title=None, type=None, class_name=None): link = {'href': escape(href)} if title: link['title'] = escape(title) if type: link['type'] = type if class_name: link['class'] = class_name idx = 0 while req.hdf.get('links.%s.%d.href' % (rel, idx)): idx += 1 req.hdf['links.%s.%d' % (rel, idx)] = li... | def add_link(req, rel, href, title=None, type=None, class_name=None): link = {'href': escape(href)} if title: link['title'] = escape(title) if type: link['type'] = type if class_name: link['class'] = class_name idx = 0 while req.hdf.get('chrome.links.%s.%d.href' % (rel, idx)): idx += 1 req.hdf['links.%s.%d' % (rel, idx... | 25,243 |
def add_link(req, rel, href, title=None, type=None, class_name=None): link = {'href': escape(href)} if title: link['title'] = escape(title) if type: link['type'] = type if class_name: link['class'] = class_name idx = 0 while req.hdf.get('links.%s.%d.href' % (rel, idx)): idx += 1 req.hdf['links.%s.%d' % (rel, idx)] = li... | def add_link(req, rel, href, title=None, type=None, class_name=None): link = {'href': escape(href)} if title: link['title'] = escape(title) if type: link['type'] = type if class_name: link['class'] = class_name idx = 0 while req.hdf.get('links.%s.%d.href' % (rel, idx)): idx += 1 req.hdf['chrome.links.%s.%d' % (rel, idx... | 25,244 |
def populate_hdf(self, req, handler): """ Add chrome-related data to the HDF. """ | def populate_hdf(self, req, handler): """ Add chrome-related data to the HDF. """ | 25,245 |
def populate_hdf(self, req, handler): """ Add chrome-related data to the HDF. """ | def populate_hdf(self, req, handler): """ Add chrome-related data to the HDF. """ | 25,246 |
def populate_hdf(self, req, handler): """ Add chrome-related data to the HDF. """ | def populate_hdf(self, req, handler): """ Add chrome-related data to the HDF. """ | 25,247 |
def populate_hdf(self, req, handler): """ Add chrome-related data to the HDF. """ | def populate_hdf(self, req, handler): """ Add chrome-related data to the HDF. """ | 25,248 |
def render_macro(self, req, name, content): # args will be null if the macro is called without parenthesis. if not content: return '' # parse arguments # we expect the 1st argument to be a filename (filespec) args = content.split(',') if len(args) == 0: raise Exception("No argument.") filespec = args[0] size_re = re.co... | def render_macro(self, req, name, content): # args will be null if the macro is called without parenthesis. if not content: return '' # parse arguments # we expect the 1st argument to be a filename (filespec) args = content.split(',') if len(args) == 0: raise Exception("No argument.") filespec = args[0] size_re = re.co... | 25,249 |
def test_custom_field_select(self): self.env.config.set('ticket-custom', 'test', 'select') self.env.config.set('ticket-custom', 'test.label', 'Test') self.env.config.set('ticket-custom', 'test.value', '1') self.env.config.set('ticket-custom', 'test.options', 'option1|option2') fields = TicketSystem(self.env).get_custom... | def test_custom_field_select(self): self.env.config.set('ticket-custom', 'test', 'select') self.env.config.set('ticket-custom', 'test.label', 'Test') self.env.config.set('ticket-custom', 'test.value', '1') self.env.config.set('ticket-custom', 'test.options', 'option1|option2') fields = TicketSystem(self.env).get_custom... | 25,250 |
def test_custom_field_optional_select(self): self.env.config.set('ticket-custom', 'test', 'select') self.env.config.set('ticket-custom', 'test.label', 'Test') self.env.config.set('ticket-custom', 'test.value', '1') self.env.config.set('ticket-custom', 'test.options', '|option1|option2') fields = TicketSystem(self.env).... | def test_custom_field_optional_select(self): self.env.config.set('ticket-custom', 'test', 'select') self.env.config.set('ticket-custom', 'test.label', 'Test') self.env.config.set('ticket-custom', 'test.value', '1') self.env.config.set('ticket-custom', 'test.options', '|option1|option2') fields = TicketSystem(self.env).... | 25,251 |
def get_changes(self): """ Generator that produces a (path, kind, change, base_rev, base_path) 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... | 25,252 |
def process_request(self, req): req.perm.assert_permission('MILESTONE_VIEW') | def process_request(self, req): req.perm.assert_permission('MILESTONE_VIEW') | 25,253 |
def _validate_mimebody(self, mime, ticket, newtk): """Validate the body of a ticket notification message""" (mime_decoder, mime_name, mime_charset) = mime tn = TicketNotifyEmail(self.env) tn.notify(ticket, newticket=newtk) message = notifysuite.smtpd.get_message() (headers, body) = parse_smtp_message(message) self.fail... | def _validate_mimebody(self, mime, ticket, newtk): """Validate the body of a ticket notification message""" (mime_decoder, mime_name, mime_charset) = mime tn = TicketNotifyEmail(self.env) tn.notify(ticket, newticket=newtk) message = notifysuite.smtpd.get_message() (headers, body) = parse_smtp_message(message) self.fail... | 25,254 |
def perform_query (self, query, changeset, tickets, wiki, page=0): keywords = query.split(' ') | def perform_query (self, query, changeset, tickets, wiki, page=0): keywords = query.split(' ') | 25,255 |
def perform_query (self, query, changeset, tickets, wiki, page=0): keywords = query.split(' ') | def perform_query (self, query, changeset, tickets, wiki, page=0): keywords = query.split(' ') | 25,256 |
def perform_query (self, query, changeset, tickets, wiki, page=0): keywords = query.split(' ') | def perform_query (self, query, changeset, tickets, wiki, page=0): keywords = query.split(' ') | 25,257 |
def do_initenv(self, line): if self.env_check(): print "Initenv for '%s' failed.\nDoes an environment already exist?" % self.envname return arg = self.arg_tokenize(line) project_name = None repository_dir = None templates_dir = None if len(arg) == 1: returnvals = self.get_initenv_args() project_name = returnvals[0] rep... | def do_initenv(self, line): if self.env_check(): print "Initenv for '%s' failed.\nDoes an environment already exist?" % self.envname return arg = self.arg_tokenize(line) project_name = None repository_dir = None templates_dir = None if len(arg) == 1: returnvals = self.get_initenv_args() project_name = returnvals[0] rep... | 25,258 |
def do_initenv(self, line): if self.env_check(): print "Initenv for '%s' failed.\nDoes an environment already exist?" % self.envname return arg = self.arg_tokenize(line) project_name = None repository_dir = None templates_dir = None if len(arg) == 1: returnvals = self.get_initenv_args() project_name = returnvals[0] rep... | def do_initenv(self, line): if self.env_check(): print "Initenv for '%s' failed.\nDoes an environment already exist?" % self.envname return arg = self.arg_tokenize(line) project_name = None repository_dir = None templates_dir = None if len(arg) == 1: returnvals = self.get_initenv_args() project_name = returnvals[0] rep... | 25,259 |
def _init_defaults(self, db=None): for field in self.fields: default = None if not field.get('custom'): default = self.env.config.get('ticket', 'default_' + field['name']) else: default = field.get('value') options = field.get('options') if default and options and default not in options: try: default_idx = int(default)... | def _init_defaults(self, db=None): for field in self.fields: default = None if not field.get('custom'): default = self.env.config.get('ticket', 'default_' + field['name']) else: default = field.get('value') options = field.get('options') if default and options and default not in options: try: default = options[int(defa... | 25,260 |
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() break elif self._maxsize and self._cursize < self... | 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() break except Exception: cnx.clo... | 25,261 |
def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * ' ' + mod * ' ' | def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * ' ' + mod * ' ' | 25,262 |
def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * ' ' + mod * ' ' | def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * ' ' + mod * ' ' | 25,263 |
def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * ' ' + mod * ' ' | def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * ' ' + mod * ' ' | 25,264 |
def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * ' ' + mod * ' ' | def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * ' ' + mod * ' ' | 25,265 |
def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * ' ' + mod * ' ' | def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * ' ' + mod * ' ' | 25,266 |
def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * ' ' + mod * ' ' | def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * ' ' + mod * ' ' | 25,267 |
def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * ' ' + mod * ' ' | def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * ' ' + mod * ' ' | 25,268 |
def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * ' ' + mod * ' ' | def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * ' ' + mod * ' ' | 25,269 |
def _insert_ticket_data(self, req, db, ticket, data, reporter_id): """Insert ticket data into the hdf""" replyto = req.args.get('replyto') version = req.args.get('version', None) data['replyto'] = replyto if version: try: version = int(version) data['version'] = version except ValueError: pass | def _insert_ticket_data(self, req, db, ticket, data, reporter_id): """Insert ticket data into the hdf""" replyto = req.args.get('replyto') version = req.args.get('version', None) data['replyto'] = replyto if version: try: version = int(version) data['version'] = version except ValueError: pass | 25,270 |
def quote_original(author, original, link): if 'comment' not in req.args: # i.e. the comment was not yet edited data['comment'] = '\n'.join( ['Replying to [%s %s]:' % (link, author)] + ['> %s' % line for line in original.splitlines()] + ['']) | def quote_original(author, original, link): if 'comment' not in req.args: # i.e. the comment was not yet edited data['comment'] = '\n'.join( ['Replying to [%s %s]:' % (link, author)] + ['> %s' % line for line in original.splitlines()] + ['']) | 25,271 |
def quote_original(author, original, link): if 'comment' not in req.args: # i.e. the comment was not yet edited data['comment'] = '\n'.join( ['Replying to [%s %s]:' % (link, author)] + ['> %s' % line for line in original.splitlines()] + ['']) | def quote_original(author, original, link): if 'comment' not in req.args: # i.e. the comment was not yet edited data['comment'] = '\n'.join( ['Replying to [%s %s]:' % (link, author)] + ['> %s' % line for line in original.splitlines()] + ['']) | 25,272 |
def quote_original(author, original, link): if 'comment' not in req.args: # i.e. the comment was not yet edited data['comment'] = '\n'.join( ['Replying to [%s %s]:' % (link, author)] + ['> %s' % line for line in original.splitlines()] + ['']) | def quote_original(author, original, link): if 'comment' not in req.args: # i.e. the comment was not yet edited data['comment'] = '\n'.join( ['Replying to [%s %s]:' % (link, author)] + ['> %s' % line for line in original.splitlines()] + ['']) | 25,273 |
def get_info(self, id, args): cursor = self.db.cursor() | def get_info(self, id, args): cursor = self.db.cursor() | 25,274 |
def get_info(self, id, args): cursor = self.db.cursor() | def get_info(self, id, args): cursor = self.db.cursor() | 25,275 |
def get_history(self): history = _get_history(self.scope + self.path, self.authz, self.fs_ptr, self.pool, self.rev) for path, rev in history: if path.startswith(self.scope): yield path[len(self.scope):], rev | def get_history(self): history = _get_history(self.scope + self.path, self.authz, self.fs_ptr, self.pool, self.rev) for path, rev in history: if rev > 0 and path.startswith(self.scope): yield path[len(self.scope):], rev | 25,276 |
def produce((id, t, author, type, summary), status, fields, comment, cid): if status == 'edit': if 'ticket_details' in filters: info = '' if len(fields) > 0: info = ', '.join(['<i>%s</i>' % f for f in \ fields.keys()]) + ' changed<br />' else: return None elif 'ticket' in filters: if status == 'closed' and fields.has_k... | def produce((id, t, author, type, summary), status, fields, comment, cid): if status == 'edit': if 'ticket_details' in filters: info = '' if len(fields) > 0: info = ', '.join(['<i>%s</i>' % f for f in \ fields.keys()]) + ' changed<br />' else: return None elif 'ticket' in filters: if status == 'closed' and fields.has_k... | 25,277 |
def _render_config(self, req): req.perm.assert_permission('CONFIG_VIEW') req.hdf['about.page'] = 'config' # Gather default values defaults = {} for section, options in self.env.get_default_config().iteritems(): defaults[section] = default_options = {} for opt in options: default_options[opt.name] = opt.default # Expor... | def _render_config(self, req): req.perm.assert_permission('CONFIG_VIEW') req.hdf['about.page'] = 'config' # Gather default values # Export the config table to hdf sections = [] for section in self.config.sections(): options = [] default_options = defaults.get(section) for name,value in self.config.options(section): def... | 25,278 |
def _render_config(self, req): req.perm.assert_permission('CONFIG_VIEW') req.hdf['about.page'] = 'config' # Gather default values defaults = {} for section, options in self.env.get_default_config().iteritems(): defaults[section] = default_options = {} for opt in options: default_options[opt.name] = opt.default # Expor... | def _render_config(self, req): req.perm.assert_permission('CONFIG_VIEW') req.hdf['about.page'] = 'config' # Gather default values defaults = {} for section, options in self.env.get_default_config().iteritems(): defaults[section] = default_options = {} for opt in options: default_options[opt.name] = opt.default # Expor... | 25,279 |
def _render_config(self, req): req.perm.assert_permission('CONFIG_VIEW') req.hdf['about.page'] = 'config' # Gather default values defaults = {} for section, options in self.env.get_default_config().iteritems(): defaults[section] = default_options = {} for opt in options: default_options[opt.name] = opt.default # Expor... | def _render_config(self, req): req.perm.assert_permission('CONFIG_VIEW') req.hdf['about.page'] = 'config' # Gather default values defaults = {} for section, options in self.env.get_default_config().iteritems(): defaults[section] = default_options = {} for opt in options: default_options[opt.name] = opt.default # Expor... | 25,280 |
def __init__(self, path, authz, log): self.path = path self.log = log if core.SVN_VER_MAJOR < 1: raise TracError("Subversion >= 1.0 required: Found %d.%d.%d" % \ (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_MICRO)) self.pool = Pool() # Remove any trailing slash or else subversion might abort path = os.path.no... | def __init__(self, path, authz, log): self.path = path self.log = log if core.SVN_VER_MAJOR < 1: raise TracError("Subversion >= 1.0 required: Found %d.%d.%d" % \ (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_MICRO)) self.pool = Pool() # Remove any trailing slash or else subversion might abort path = os.path.no... | 25,281 |
def test_severity_change_ok(self): """ Tests the 'severity add' command in trac-admin. This particular test passes valid arguments and checks for success. """ test_name = sys._getframe().f_code.co_name self._execute('severity add critical') self._execute('severity change critical end-of-the-world') test_results = self... | def test_severity_change_ok(self): """ Tests the 'severity add' command in trac-admin. This particular test passes valid arguments and checks for success. """ test_name = sys._getframe().f_code.co_name self._execute('severity add critical') self._execute('severity change critical "end-of-the-world"') test_results = se... | 25,282 |
def implementation(self, component): cfgvalue = component.config.get(self.cfg_section, self.cfg_property) for impl in self.xtnpt.extensions(component): if impl.__class__.__name__ == cfgvalue: return impl if self.default is not None: return self.default raise AttributeError('Cannot find an implementation of the "%s" ' '... | def implementation(self, component): cfgvalue = component.config.get(self.cfg_section, self.cfg_property) for impl in self.xtnpt.extensions(component): if impl.__class__.__name__ == cfgvalue: return impl if self.default is not None: return self.default(component.env) raise AttributeError('Cannot find an implementation ... | 25,283 |
def insert(self, filename, fileobj, size, t=None, db=None): # FIXME: `t` should probably be switched to `datetime` too if not db: db = self.env.get_db_cnx() handle_ta = True else: handle_ta = False | def insert(self, filename, fileobj, size, t=None, db=None): # FIXME: `t` should probably be switched to `datetime` too if not db: db = self.env.get_db_cnx() handle_ta = True else: handle_ta = False | 25,284 |
def insert(self, filename, fileobj, size, t=None, db=None): # FIXME: `t` should probably be switched to `datetime` too if not db: db = self.env.get_db_cnx() handle_ta = True else: handle_ta = False | def insert(self, filename, fileobj, size, t=None, db=None): # FIXME: `t` should probably be switched to `datetime` too if not db: db = self.env.get_db_cnx() handle_ta = True else: handle_ta = False | 25,285 |
def get_ticket (self, id): global fields cnx = db.get_connection () cursor = cnx.cursor () | def get_ticket (self, id, escape_values=1): global fields cnx = db.get_connection () cursor = cnx.cursor () | 25,286 |
def get_ticket (self, id): global fields cnx = db.get_connection () cursor = cnx.cursor () | def get_ticket (self, id): global fields cnx = db.get_connection () cursor = cnx.cursor () | 25,287 |
def insert_ticket_data(self, hdf, id): """Inserts ticket data into the hdf""" cnx = db.get_connection () cursor = cnx.cursor() cursor.execute('SELECT time, author, field, oldvalue, newvalue ' 'FROM ticket_change ' 'WHERE ticket=%s ORDER BY time', id) curr_author = None curr_date = 0 comment = None idx = 0 | def insert_ticket_data(self, hdf, id): """Inserts ticket data into the hdf""" cnx = db.get_connection () cursor = cnx.cursor() cursor.execute('SELECT time, author, field, oldvalue, newvalue ' 'FROM ticket_change ' 'WHERE ticket=%s ORDER BY time', id) curr_author = None curr_date = 0 comment = None idx = 0 | 25,288 |
def render (self): action = dict_get_with_default(self.args, 'action', 'view') if action == 'create': self.create_ticket () try: id = int(self.args['id']) except: redirect (href.menu()) | def render (self): action = dict_get_with_default(self.args, 'action', 'view') if action == 'create': self.create_ticket () try: id = int(self.args['id']) except: redirect (href.menu()) | 25,289 |
def do_auth(self, environ, start_response): raise NotImplementedError | def do_auth(self, environ, start_response): raise NotImplementedError | 25,290 |
def __init__(self, htpasswd, realm): self.hash = {} self.realm = realm try: import crypt self.crypt = crypt.crypt except ImportError: self.crypt = None self.load(htpasswd) | def __init__(self, htpasswd, realm): self.realm = realm try: import crypt self.crypt = crypt.crypt except ImportError: self.crypt = None self.load(htpasswd) | 25,291 |
def __init__(self, htpasswd, realm): self.hash = {} self.realm = realm try: import crypt self.crypt = crypt.crypt except ImportError: self.crypt = None self.load(htpasswd) | def __init__(self, htpasswd, realm): self.hash = {} self.realm = realm try: import crypt self.crypt = crypt.crypt except ImportError: self.crypt = None self.load(htpasswd) | 25,292 |
def do_auth(self, environ, start_response): header = environ.get('HTTP_AUTHORIZATION') if header and header.startswith('Basic'): auth = b64decode(header[6:]).split(':') if len(auth) == 2: user, password = auth if self.test(user, password): return user | def do_auth(self, environ, start_response): header = environ.get('HTTP_AUTHORIZATION') if header and header.startswith('Basic'): auth = b64decode(header[6:]).split(':') if len(auth) == 2: user, password = auth if self.test(user, password): return user | 25,293 |
def __init__(self, htdigest, realm): self.active_nonces = [] self.hash = {} self.realm = realm self.load_htdigest(htdigest, realm) | def __init__(self, htdigest, realm): self.active_nonces = [] self.realm = realm self.load_htdigest(htdigest, realm) | 25,294 |
def __init__(self, htdigest, realm): self.active_nonces = [] self.hash = {} self.realm = realm self.load_htdigest(htdigest, realm) | def __init__(self, htdigest, realm): self.active_nonces = [] self.hash = {} self.realm = realm self.load_htdigest(htdigest, realm) | 25,295 |
def load_htdigest(self, filename, realm): """Load account information from apache style htdigest files, only users from the specified realm are used """ fd = open(filename, 'r') for line in fd.readlines(): line = line.strip() if not line: continue try: u, r, a1 = line.split(':') except ValueError: print >>sys.stderr, '... | def load_htdigest(self, filename, realm): """Load account information from apache style htdigest files, only users from the specified realm are used """ fd = open(filename, 'r') for line in fd.readlines(): line = line.strip() if not line: continue try: u, r, a1 = line.split(':') except ValueError: print >>sys.stderr, '... | 25,296 |
def load_htdigest(self, filename, realm): """Load account information from apache style htdigest files, only users from the specified realm are used """ fd = open(filename, 'r') for line in fd.readlines(): line = line.strip() if not line: continue try: u, r, a1 = line.split(':') except ValueError: print >>sys.stderr, '... | def load_htdigest(self, filename, realm): """Load account information from apache style htdigest files, only users from the specified realm are used """ fd = open(filename, 'r') for line in fd.readlines(): line = line.strip() if not line: continue try: u, r, a1 = line.split(':') except ValueError: print >>sys.stderr, '... | 25,297 |
def verify(self): """Verify that the provided path points to a valid Trac environment directory.""" fd = None try: fd = open(os.path.join(self.path, 'VERSION'), 'r') assert fd.read(26) == 'Trac Environment Version 1' finally: if fd: fd.close() | def verify(self): """Verify that the provided path points to a valid Trac environment directory.""" fd = open(os.path.join(self.path, 'VERSION'), 'r') try: fd = open(os.path.join(self.path, 'VERSION'), 'r') assert fd.read(26) == 'Trac Environment Version 1' finally: if fd: fd.close() | 25,298 |
def verify(self): """Verify that the provided path points to a valid Trac environment directory.""" fd = None try: fd = open(os.path.join(self.path, 'VERSION'), 'r') assert fd.read(26) == 'Trac Environment Version 1' finally: if fd: fd.close() | def verify(self): """Verify that the provided path points to a valid Trac environment directory.""" fd = None try: assert fd.read(26) == 'Trac Environment Version 1' finally: if fd: fd.close() | 25,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.