rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
component.get("EventManager").deregister_event_handler("ConfigValueChangedEvent", self.on_config_value_changed) | def disable(self): try: self.timer.cancel() except: pass | |
core_config.apply_set_functions("max_download_speed") core_config.apply_set_functions("max_upload_speed") core_config.apply_set_functions("max_active_limit") core_config.apply_set_functions("max_active_downloading") core_config.apply_set_functions("max_active_seeding") | for setting in CONTROLLED_SETTINGS: core_config.apply_set_functions(setting) | def __apply_set_functions(self): """ Have the core apply it's bandwidth settings as specified in core.conf. """ core_config = deluge.configmanager.ConfigManager("core.conf") core_config.apply_set_functions("max_download_speed") core_config.apply_set_functions("max_upload_speed") core_config.apply_set_functions("max_act... |
def event_handler(torrent_id): self.execute_commands(torrent_id, command[EXECUTE_EVENT]) | def create_event_handler(event): def event_handler(torrent_id): self.execute_commands(torrent_id, event) return event_handler event_handler = create_event_handler(event) | def event_handler(torrent_id): self.execute_commands(torrent_id, command[EXECUTE_EVENT]) |
log.debug("[execute] Running commands for %s", EXECUTE_EVENT) | log.debug("[execute] Running commands for %s", event) | def execute_commands(self, torrent_id, event): torrent = component.get("TorrentManager").torrents[torrent_id] info = torrent.get_status(["name", "save_path", "move_on_completed", "move_on_completed_path"]) |
return shlex.split(text) | return shlex.split(text, posix=not deluge.common.windows_check()) | def split(self, text): return shlex.split(text) |
self.command_parser(self.input) | self.command_parser(self.input.encode(self.encoding)) | def _doRead(self): # Read the character c = self.stdscr.getch() |
uchar = None while 1: | uchar = "" while not uchar: | def _doRead(self): # Read the character c = self.stdscr.getch() |
pass c = self.stdscr.getch() if c == -1: break stroke += chr(c) | c = self.stdscr.getch() stroke += chr(c) | def _doRead(self): # Read the character c = self.stdscr.getch() |
if t - self.cache_times[torrent_id][key] > self.cache_time: | if t - self.cache_times[torrent_id].get(key, 0.0) > self.cache_time: | def find_torrents_to_fetch(torrent_ids): to_fetch = [] t = time.time() for torrent_id in torrent_ids: torrent = self.torrents[torrent_id] if t - torrent[0] > self.cache_time: to_fetch.append(torrent_id) else: # We need to check if a key is expired for key in keys: if t - self.cache_times[torrent_id][key] > self.cache_t... |
entry_points["console-scripts"].append("deluge-debug = deluge.main:start_ui") | entry_points["console_scripts"].append("deluge-debug = deluge.main:start_ui") | def run(self): # Run all sub-commands (at least those that need to be run) for cmd_name in self.get_sub_commands(): self.run_command(cmd_name) _clean.run(self) |
response = self.glade.get_widget("remote_save_dialog").run() | dialog = self.glade.get_widget("remote_save_dialog") response = dialog.run() | def _on_button_save_clicked(self, widget): log.debug("_on_button_save_clicked") if len(self.files_treestore) == 0: return |
chooser.destroy() | def hide_progress(result): self.glade.get_widget("progress_dialog").hide_all() | |
info = torrent.get_status(["name", "save_path", "move_completed", "move_on_completed_path"]) | info = torrent.get_status(["name", "save_path", "move_on_completed", "move_on_completed_path"]) | def execute_commands(self, torrent_id, event): torrent = component.get("TorrentManager").torrents[torrent_id] info = torrent.get_status(["name", "save_path", "move_completed", "move_on_completed_path"]) |
save_path = info["move_on_completed_path"] if info ["move_completed"] else info["save_path"] | save_path = info["move_on_completed_path"] if info ["move_on_completed"] else info["save_path"] | def execute_commands(self, torrent_id, event): torrent = component.get("TorrentManager").torrents[torrent_id] info = torrent.get_status(["name", "save_path", "move_completed", "move_on_completed_path"]) |
elif f.check(IndexError, HTMLParseError): | elif f.check(NoIconsError, HTMLParseError): | def on_download_icon_fail(self, f, host, icons=[]): """ Recovers from a download error |
if deluge.common.FILE_PRIORITY[priority] == "Do Not Download": cell.set_property("stock-id", gtk.STOCK_STOP) elif deluge.common.FILE_PRIORITY[priority] == "Normal Priority": | if deluge.common.FILE_PRIORITY[priority] == _("Do Not Download"): cell.set_property("stock-id", gtk.STOCK_NO) elif deluge.common.FILE_PRIORITY[priority] == _("Normal Priority"): | def cell_priority_icon(column, cell, model, row, data): if model.get_value(row, 5) == -1: # This is a folder, so lets just set it blank for now cell.set_property("stock-id", None) return priority = model.get_value(row, data) if deluge.common.FILE_PRIORITY[priority] == "Do Not Download": cell.set_property("stock-id", gt... |
elif deluge.common.FILE_PRIORITY[priority] == "High Priority": | elif deluge.common.FILE_PRIORITY[priority] == _("High Priority"): | def cell_priority_icon(column, cell, model, row, data): if model.get_value(row, 5) == -1: # This is a folder, so lets just set it blank for now cell.set_property("stock-id", None) return priority = model.get_value(row, data) if deluge.common.FILE_PRIORITY[priority] == "Do Not Download": cell.set_property("stock-id", gt... |
elif deluge.common.FILE_PRIORITY[priority] == "Highest Priority": | elif deluge.common.FILE_PRIORITY[priority] == _("Highest Priority"): | def cell_priority_icon(column, cell, model, row, data): if model.get_value(row, 5) == -1: # This is a folder, so lets just set it blank for now cell.set_property("stock-id", None) return priority = model.get_value(row, data) if deluge.common.FILE_PRIORITY[priority] == "Do Not Download": cell.set_property("stock-id", gt... |
reactor.stop() | if client.is_classicmode(): gtk.main_quit() else: reactor.stop() | def quit(self): reactor.stop() |
items["tracker_host"]["All"] = len(torrent_ids) | def get_filter_tree(self, show_zero_hits=True, hide_cat=None): """ returns {field: [(value,count)] } for use in sidebar. """ torrent_ids = self.torrents.get_torrent_list() status_func = self.core.get_torrent_status #premature optimalisation.. tree_keys = list(self.tree_fields.keys()) if hide_cat: for cat in hide_cat: t... | |
self.settings.ignore_limits_on_local_network = value self.session.set_settings(self.settings) | self.session_set_setting("ignore_limits_on_local_network", value) | def _on_ignore_limits_on_local_network(self, key, value): self.settings.ignore_limits_on_local_network = value self.session.set_settings(self.settings) |
if event == "completed": | if event == "complete": | def execute_commands(self, torrent_id, event): torrent = component.get("TorrentManager").torrents[torrent_id] info = torrent.get_status(["name", "save_path", "move_completed", "move_on_completed_path"]) |
options = self._clean_unicode(options) | options = self._make_unicode(options) | def set_options(self, watchdir_id, options): """Update the options for a watch folder.""" watchdir_id = str(watchdir_id) options = self._clean_unicode(options) CheckInput(watchdir_id in self.watchdirs , _("Watch folder does not exist.")) if options.has_key('path'): options['abspath'] = os.path.abspath(options['path']) ... |
opts = self._clean_unicode(opts) | def update_watchdir(self, watchdir_id): """Check the watch folder for new torrents to add.""" watchdir_id = str(watchdir_id) watchdir = self.watchdirs[watchdir_id] if not watchdir['enabled']: # We shouldn't be updating because this watchdir is not enabled self.disable_watchdir(watchdir_id) return | |
def _clean_unicode(self, options): | def _make_unicode(self, options): | def get_watchdirs(self): return self.watchdirs.keys() |
for key, value in options.iteritems(): if isinstance(key, unicode): key = str(key) if isinstance(value, unicode): value = str(value) opts[key] = value | for key in options: if isinstance(options[key], str): options[key] = unicode(options[key], "utf8") opts[key] = options[key] | def _clean_unicode(self, options): opts = {} for key, value in options.iteritems(): if isinstance(key, unicode): key = str(key) if isinstance(value, unicode): value = str(value) opts[key] = value return opts |
options = self._clean_unicode(options) | options = self._make_unicode(options) | def add(self, options={}): """Add a watch folder.""" options = self._clean_unicode(options) abswatchdir = os.path.abspath(options['path']) CheckInput(os.path.isdir(abswatchdir) , _("Path does not exist.")) CheckInput(os.access(abswatchdir, os.R_OK|os.W_OK), "You must have read and write access to watch folder.") if abs... |
if session_id > -1: | if session_id > -1 and session_id in self.factory.authorized_sessions: | def get_session_user(self): """ Returns the username calling the current RPC. |
if self._save_timer: | if self._save_timer and self._save_timer.active(): | def save(self, filename=None): """ Save configuration to disk |
import xdg, xdg.BaseDirectory | def load(fp, **kw): return json.loads(fp.read()) | |
location = error_msg.split(" to ")[1] | location = urljoin(self.config["url"], error_msg.split(" to ")[1]) | def on_download_error(self, f): """ Recovers from download error :param f: failure that occured :type f: Failure :returns: a Deferred if recovery was possible else the original failure :rtype: Deferred or Failure """ self.is_downloading = False error_msg = f.getErrorMessage() d = f if f.check(error.PageRedirect): # Ha... |
dialog.destroy() | dialog.hide() | def _on_get_path_size(size): log.debug("size: %s", size) if size > 0: self.files_treestore.clear() self.files_treestore.append(None, [result, gtk.STOCK_NETWORK, size]) self.adjust_piece_size() |
gtk.rc_parse_string('style "treeview-style" { GtkTreeView::expander-size = 15 } class "GtkTreeView" style "treeview-style"') | def __init__(self): component.Component.__init__(self, "FilterTreeView", interval=2) self.window = component.get("MainWindow") glade = self.window.main_glade self.hpaned = glade.get_widget("hpaned") self.scrolled = glade.get_widget("scrolledwindow_sidebar") self.sidebar = component.get("SideBar") self.config = ConfigMa... | |
request.lookup_path = os.path.join(request.lookup_path, path) | request.lookup_path += '/' + path | def getChild(self, path, request): if hasattr(request, "lookup_path"): request.lookup_path = os.path.join(request.lookup_path, path) else: request.lookup_path = path return self |
sd[torrent_id] = dict([(x, y) for x, y in self.torrents[torrent_id][1].iteritems() if x in keys]) | if keys: sd[torrent_id] = dict([(x, y) for x, y in self.torrents[torrent_id][1].iteritems() if x in keys]) else: sd[torrent_id] = dict(self.torrents[torrent_id][1]) | def create_status_dict(self, torrent_ids, keys): """ Creates a status dict from the cache. |
self.cache_times[torrent_id] = {} | def on_status(status): self.torrents[torrent_id][1].update(status) self.cache_times[torrent_id] = {} t = time.time() for key in status: self.cache_times[torrent_id][key] = t | |
self.user = "localclient" | self.username = "localclient" | def __init__(self, event_handlers={}): import deluge.core.daemon self.__daemon = deluge.core.daemon.Daemon(classic=True) log.debug("daemon created!") self.connected = True self.host = "localhost" self.port = 58846 self.user = "localclient" # Register the event handlers for event in event_handlers: for handler in event_... |
if time.time() - self.torrents[torrent_id][0] < self.cache_time: return succeed(self.create_status_dict([torrent_id], keys)[torrent_id]) | keys_to_get = [] if not keys: keys = self.torrents[torrent_id][1].keys() for key in keys: if time.time() - self.cache_times[torrent_id][key] > self.cache_time: keys_to_get.append(key) if not keys_to_get: return succeed(self.create_status_dict([torrent_id], keys)[torrent_id]) | def get_torrent_status(self, torrent_id, keys): """ Get a status dict for one torrent. |
d = client.core.get_torrent_status(torrent_id, keys, True) | d = client.core.get_torrent_status(torrent_id, keys_to_get, True) | def get_torrent_status(self, torrent_id, keys): """ Get a status dict for one torrent. |
self.torrents[torrent_id][0] = time.time() | t = time.time() self.torrents[torrent_id][0] = t | def on_status(result, torrent_id): self.torrents[torrent_id][0] = time.time() self.torrents[torrent_id][1].update(result) return self.create_status_dict([torrent_id], keys)[torrent_id] |
self.torrents[torrent_id] = (time.time(), result) | t = time.time() self.torrents[torrent_id] = (t, result) self.cache_times[torrent_id] = {} for key in result: self.cache_times[torrent_id][key] = t | def on_status(result): if result: self.torrents[torrent_id] = (time.time(), result) return result |
for key in torrent_ids: torrent = self.torrents[key] | for torrent_id in torrent_ids: torrent = self.torrents[torrent_id] | def find_torrents_to_fetch(torrent_ids): to_fetch = [] t = time.time() for key in torrent_ids: torrent = self.torrents[key] if t - torrent[0] > self.cache_time: to_fetch.append(key) |
to_fetch.append(key) | to_fetch.append(torrent_id) else: for key in keys: if t - self.cache_times[torrent_id][key] > self.cache_time: to_fetch.append(torrent_id) break | def find_torrents_to_fetch(torrent_ids): to_fetch = [] t = time.time() for key in torrent_ids: torrent = self.torrents[key] if t - torrent[0] > self.cache_time: to_fetch.append(key) |
self.__config = dict(defaults) | for key, value in defaults.iteritems(): self.set_item(key, value) | def __init__(self, filename, defaults=None, config_dir=None): self.__config = {} self.__set_functions = {} self.__change_callbacks = [] |
return self.__config[key].decode("utf8") | try: return self.__config[key].decode("utf8") except UnicodeDecodeError: return self.__config[key] | def get_item(self, key): """ Gets the value of item 'key' |
default=False, help="Only consider keys matching this REGEX") | default=False, help="Actually do a delete. If not specified, just list the keys found that match.") | def main(args): parser = OptionParser() parser.add_option("--key", dest="key", metavar="KEY", help="AWS Access Key") parser.add_option("--secret", dest="secret", metavar="SECRET", help="AWS Access Secret Key") parser.add_option("--maxage", dest="maxage", metavar="SECONDS", help="Max age a key(file) can have before we w... |
try: self.zoneid = config.get('hostedzone', zonename.to_text(omit_final_dot=True)) except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): logging.error('no zoneid for %s' % zonename) raise else: logging.debug('found %s zoneid: %s' % (zonename, self.zoneid)) assert type(self.zoneid) is StringType, 'zoneid is... | def __init__(self, zonename): assert type(zonename) is dns.name.Name, 'zonename is not Name obj' self.additions = [] self.deletions = [] try: self.zoneid = config.get('hostedzone', zonename.to_text(omit_final_dot=True)) except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): logging.error('no zoneid for %s' %... | |
xml = """<?xml version="1.0" encoding="UTF-8"?>""" xml += self.Route53APIXMLRRSetChangeHeader xml += ' <Comment>%s</Comment>\n' % comment xml += ' <Changes>' | xml = self.Route53APIXMLRRSetChangeHeader xml += '<Comment>%s</Comment>\n' % comment xml += '<Changes>' | def to_xml(self, comment=None): # TODO # Max of 1000 ResourceRecord elements # Max of 32000 characters in record data xml = """<?xml version="1.0" encoding="UTF-8"?>""" xml += self.Route53APIXMLRRSetChangeHeader xml += ' <Comment>%s</Comment>\n' % comment xml += ' <Changes>' xml += self.rrset_xml('DELETE',... |
xml += '</Changes>' | xml += '\n</Changes>' | def to_xml(self, comment=None): # TODO # Max of 1000 ResourceRecord elements # Max of 32000 characters in record data xml = """<?xml version="1.0" encoding="UTF-8"?>""" xml += self.Route53APIXMLRRSetChangeHeader xml += ' <Comment>%s</Comment>\n' % comment xml += ' <Changes>' xml += self.rrset_xml('DELETE',... |
<Change> <Action>%s</Action> <ResourceRecordSet> <Name>%s</Name> <Type>%s</Type> <TTL>%d</TTL> <ResourceRecords> %s </ResourceRecords> </ResourceRecordSet> </Change> """ % (action, r.name, dns.rdatatype.to_text(r.rdtype), r.ttl, \ self.rr_xml(r)) for r in rrsetlist]) | <Change><Action>%s</Action> <ResourceRecordSet> <Name>%s</Name><Type>%s</Type><TTL>%d</TTL> <ResourceRecords> %s </ResourceRecords> </ResourceRecordSet></Change>""" % (action, r.name, dns.rdatatype.to_text(r.rdtype), r.ttl, self.rr_xml(r)) for r in rrsetlist]) | def rrset_xml(self, action, rrsetlist): assert type(action) is StringType, 'action is not String obj' assert type(rrsetlist) is ListType, 'rrsetlist is not List obj' |
return '\n'.join(['<ResourceRecord><Value>%s</Value></ResourceRecord>' \ | return ''.join(['<ResourceRecord><Value>%s</Value></ResourceRecord>' \ | def rr_xml(self, rrset): assert type(rrset) is dns.rrset.RRset, 'rrset is not RRset obj' return '\n'.join(['<ResourceRecord><Value>%s</Value></ResourceRecord>' \ % r for r in rrset]) |
dryrun = 0 | dryrun = False | def submit(self, serial=None): |
logging.info('ChangeID: %s Status: %s' % \ (info.get('Id'), info.get('Status'))) | logging.info('ChangeID: %s Status: %s' % (info.get('Id'), info.get('Status'))) | def submit(self, serial=None): |
logging.warn('unsupported opcode from %s: %d' % \ (remote_ip, msg.opcode())) | logging.warn('unsupported opcode from %s: %d' % (remote_ip, msg.opcode())) | def handle(self): """Basic sanity check then handover to the opcode-specific function.""" |
assert type(response) is dns.message.Message, 'response is not Message obj' | assert type(response) is dns.message.Message, \ 'response is not Message obj' | def handle(self): """Basic sanity check then handover to the opcode-specific function.""" |
assert type(msg) is dns.message.Message, 'msg is not Message obj' | def handle_update(self, msg): """Process an update message.""" | |
return(self.servfail(msg)) else: logging.info('UPDATE from %s: %s %s %s' % (remote_ip, qname, \ dns.rdataclass.to_text(qclass), \ | return self.servfail(msg) else: logging.info('UPDATE from %s: %s %s %s' % (remote_ip, qname, dns.rdataclass.to_text(qclass), | def handle_update(self, msg): """Process an update message.""" |
assert type(qname) is dns.name.Name, 'qname is not Name obj' assert type(qclass) is IntType, 'qclass is not Int obj' assert type(qtype) is IntType, 'qtype is not Int obj' | def handle_update(self, msg): """Process an update message.""" | |
logging.warn('UPDATE invalid question %s' % remote_ip) | logging.warn('UPDATE invalid question from %s' % remote_ip) | def handle_update(self, msg): """Process an update message.""" |
assert type(response) is dns.message.Message, 'response is not Message obj' | assert type(response) is dns.message.Message, \ 'response is not Message obj' try: APIRequest = Route53HostedZoneRequest(qname) except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): response.set_rcode(dns.rcode.NOTAUTH) return response | def handle_update(self, msg): """Process an update message.""" |
Route53Request = Route53HostedZoneRequest(qname) | def handle_update(self, msg): """Process an update message.""" | |
if rrset.rdclass == dns.rdataclass.IN: | if not rrset.deleting and rrset.rdclass == dns.rdataclass.IN: | def handle_update(self, msg): """Process an update message.""" |
if rrset.rdtype in (dns.rdatatype.ANY, dns.rdatatype.AXFR, \ dns.rdatatype.IXFR, dns.rdatatype.MAILA, \ | if rrset.rdtype in (dns.rdatatype.ANY, dns.rdatatype.AXFR, dns.rdatatype.IXFR, dns.rdatatype.MAILA, | def handle_update(self, msg): """Process an update message.""" |
Route53Request.add(rrset) elif rrset.rdclass == dns.rdataclass.ANY: | else: APIRequest.add(rrset) elif rrset.deleting == dns.rdataclass.ANY : | def handle_update(self, msg): """Process an update message.""" |
if rrset.ttl != 0: logging.error('UPDATE bad ttl from %s: %s' % \ (remote_ip, rrset)) | if rrset.ttl != 0 or \ rrset.rdtype in (dns.rdatatype.AXFR, dns.rdatatype.IXFR, dns.rdatatype.MAILA, dns.rdatatype.MAILB): logging.error('UPDATE illegal values from %s: %s' % \ (remote_ip, rrset)) | def handle_update(self, msg): """Process an update message.""" |
if rrset.rdtype in (dns.rdatatype.AXFR, dns.rdatatype.IXFR, \ dns.rdatatype.MAILA, dns.rdatatype.MAILB): logging.error('UPDATE bad rdtype from %s: %s' % \ (remote_ip, rrset)) response.set_rcode(dns.rcode.FORMERR) return response if rrset.rdtype == dns.rdatatype.ANY: logging.warn('UPDATE unsupported delete name: %s' % ... | logging.warn('UPDATE unsupported delete from %s: %s %s' % \ (remote_ip, rrset)) response.set_rcode(dns.rcode.REFUSED) | def handle_update(self, msg): """Process an update message.""" |
elif rrset.rdclass == dns.rdataclass.NONE: | elif rrset.deleting == dns.rdataclass.NONE: | def handle_update(self, msg): """Process an update message.""" |
if rrset.ttl != 0: logging.error('UPDATE bad ttl from %s: %s' % \ (remote_ip, rrset)) response.set_rcode(dns.rcode.FORMERR) return response if rrset.rdtype in (dns.rdatatype.ANY, dns.rdatatype.AXFR, \ dns.rdatatype.IXFR, dns.rdatatype.MAILA, \ dns.rdatatype.MAILB): logging.error('UPDATE bad rdtype from %s: %s' % \ (re... | if rrset.ttl != 0 or \ rrset.rdtype in (dns.rdatatype.ANY, dns.rdatatype.AXFR, dns.rdatatype.IXFR, dns.rdatatype.MAILA, dns.rdatatype.MAILB): logging.error('UPDATE illegal values from %s: %s' % \ (remote_ip, rrset)) | def handle_update(self, msg): """Process an update message.""" |
Route53Request.delete(rrset) | APIRequest.delete(rrset) | def handle_update(self, msg): """Process an update message.""" |
logging.warn('UPDATE unknown rr from %s: %s' % (remote_ip, rrset)) | logging.warn('UPDATE unknown rr from %s: %s' % \ (remote_ip, rrset)) | def handle_update(self, msg): """Process an update message.""" |
Route53Request.submit(qname) | APIRequest.submit() | def handle_update(self, msg): """Process an update message.""" |
logging.error('UPDATE API call failed: %s - %s - %s' % (e.code, e.message, str(e))) | logging.error('UPDATE API call failed: %s - %s - %s' % \ (e.code, e.message, str(e))) | def handle_update(self, msg): """Process an update message.""" |
return(response) | return response | def handle_update(self, msg): """Process an update message.""" |
assert type(msg) is dns.message.Message, 'msg is not Message obj' | def handle_notify(self, msg): """Process an update message.""" | |
logging.info('NOTIFY from %s: %s %s %s' % (remote_ip, qname, \ dns.rdataclass.to_text(qclass), \ | logging.info('NOTIFY from %s: %s %s %s' % (remote_ip, qname, dns.rdataclass.to_text(qclass), | def handle_notify(self, msg): """Process an update message.""" |
assert type(qname) is dns.name.Name, 'qname is not Name obj' assert type(qclass) is IntType, 'qclass is not Int obj' assert type(qtype) is IntType, 'qtype is not Int obj' | def handle_notify(self, msg): """Process an update message.""" | |
logging.warn('NOTIFY !AA from %s' % remote_ip) | logging.info('NOTIFY !AA from %s' % remote_ip) | def handle_notify(self, msg): """Process an update message.""" |
response = dns.message.make_response(msg) response.flags |= dns.flags.AA return response | try: xfr = XFRClient(qname, local_serial=1) except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): pass except (dns.exception.BadResponse, dns.exception.UnexpectedSource): pass except Exception, e: logging.error('XFRClient unhandled init exception: %s' % e) return self.servfail(msg) try: xfr.parse_ixfr() ... | def handle_notify(self, msg): """Process an update message.""" |
assert type(msg) is dns.message.Message, 'msg is not Message obj' | def handle_query(self, msg): """Process a query message.""" | |
return(self.servfail(msg)) else: logging.info('QUERY from %s: %s %s %s' % (remote_ip, qname, \ dns.rdataclass.to_text(qclass), \ | return self.servfail(msg) else: logging.info('QUERY from %s: %s %s %s' % (remote_ip, qname, dns.rdataclass.to_text(qclass), | def handle_query(self, msg): """Process a query message.""" |
assert type(qname) is dns.name.Name, 'qname is not Name obj' assert type(qclass) is IntType, 'qclass is not Int obj' assert type(qtype) is IntType, 'qtype is not Int obj' | def handle_query(self, msg): """Process a query message.""" | |
rdclass = self.zone_rdclass | def _get_section(self, section, count): """Read the next I{count} records from the wire data and add them to the specified section. @param section: the section of the message to which to add records @type section: list of dns.rrset.RRset objects @param count: the number of records to read @type count: int""" if self.u... | |
section == self.message.answer): | section is self.message.answer): | def _get_section(self, section, count): """Read the next I{count} records from the wire data and add them to the specified section. @param section: the section of the message to which to add records @type section: list of dns.rrset.RRset objects @param count: the number of records to read @type count: int""" if self.u... |
logging.shutdown() | sys.stdout.flush() sys.stderr.flush() | def parse_config(file): """Parse the config file into the `config' global variable.""" global config config = ConfigParser.SafeConfigParser() try: config.readfp(open(file)) except Exception, e: print('error parsing %s config file: %s' % (file, e)) logging.shutdown() sys.exit(1) |
logging.basicConfig(level=logging.DEBUG, datefmt=datefmt, \ format='%(asctime)s - %(process)d - %(levelname)s - %(filename)s:%(lineno)d %(funcName)s - %(message)s') | logging.basicConfig(level=logging.DEBUG, datefmt=datefmt, format='%(asctime)s - %(process)d - %(levelname)s - ' \ '%(filename)s:%(lineno)d %(funcName)s - %(message)s') | def setup_logging(debug): datefmt='%Y-%m-%d %H:%M.%S %Z' if debug: logging.basicConfig(level=logging.DEBUG, datefmt=datefmt, \ format='%(asctime)s - %(process)d - %(levelname)s - %(filename)s:%(lineno)d %(funcName)s - %(message)s') else: logging.basicConfig(level=logging.INFO, datefmt=datefmt, \ format='%(asctime)s - ... |
logging.basicConfig(level=logging.INFO, datefmt=datefmt, \ | logging.basicConfig(level=logging.INFO, datefmt=datefmt, | def setup_logging(debug): datefmt='%Y-%m-%d %H:%M.%S %Z' if debug: logging.basicConfig(level=logging.DEBUG, datefmt=datefmt, \ format='%(asctime)s - %(process)d - %(levelname)s - %(filename)s:%(lineno)d %(funcName)s - %(message)s') else: logging.basicConfig(level=logging.INFO, datefmt=datefmt, \ format='%(asctime)s - ... |
logging.debug('Starting worker') | def worker(server): """Worker loop. Jumping to a signal handler can yield harmless select.error exceptions. Catch them and reattach to the socket. """ while 1: try: logging.debug('Starting worker') server.serve_forever() except select.error: # ignore the interrupted syscall spew if we catch a signal pass except Keyb... | |
logging.info('Exiting.') | def worker(server): """Worker loop. Jumping to a signal handler can yield harmless select.error exceptions. Catch them and reattach to the socket. """ while 1: try: logging.debug('Starting worker') server.serve_forever() except select.error: # ignore the interrupted syscall spew if we catch a signal pass except Keyb... | |
xfr = XFRClient(qname, local_serial=1) | xfr = XFRClient(qname) | def handle_notify(self, msg): """Process an update message.""" |
except (dns.exception.BadResponse, dns.exception.UnexpectedSource): | except (dns.query.BadResponse, dns.query.UnexpectedSource): | def handle_notify(self, msg): """Process an update message.""" |
def __init__(self, zonename, local_serial=1): | def __init__(self, zonename): | def __init__(self, zonename, local_serial=1): |
self.local_serial = local_serial | self.local_serial = None | def __init__(self, zonename, local_serial=1): |
except (BadResponse, UnexpectedSource), e: | except (dns.query.BadResponse, dns.query.UnexpectedSource), e: | def __init__(self, zonename, local_serial=1): |
self.hyphenate = True | self.hyphenate = False | def __init__(self,style=None): self.style=style self.xoffset = 0.0 self.yoffset = 0.0 self.margin_top = 0.0 self.margin_bottom = 0.0 self.margin_left= 0.0 self.margin_right = 0.0 self.hyphenate = True self.language=None self.justify = True |
if(self.justify and self.language and self.hiphenate): | if(self.justify and self.language and self.hyphenate): | def __getattribute__(self,name): if name=='text': text = normalizer.normalize(object.__getattribute__(self, 'text')) if(self.justify and self.language and self.hiphenate): text= Hyphenator().hyphenate(text,self.language) return text else: return object.__getattribute__(self, name) |
self.pdf = PDFWriter(self.url.split("/")[-1] +".pdf", StandardPaper.A4) | self.pdf = PDFWriter(urllib.unquote(self.url.split("/")[-1]) +".pdf", StandardPaper.A4) | def __init__(self, url, verbose=0): "Initialise an object, passing 'verbose' to the superclass." SGMLParser.__init__(self, verbose) self.hyperlinks = [] self.url = url self.language = detect_language(url) self.pdf = PDFWriter(self.url.split("/")[-1] +".pdf", StandardPaper.A4) header = Header(text_align = pango.ALIGN_CE... |
header.set_text(self.url) | header.set_text(urllib.unquote(self.url)) | def __init__(self, url, verbose=0): "Initialise an object, passing 'verbose' to the superclass." SGMLParser.__init__(self, verbose) self.hyperlinks = [] self.url = url self.language = detect_language(url) self.pdf = PDFWriter(self.url.split("/")[-1] +".pdf", StandardPaper.A4) header = Header(text_align = pango.ALIGN_CE... |
h1= Text(self.url.split("/")[-1],font="Serif",font_size=32) | h1= Text(urllib.unquote(self.url.split("/")[-1]),font="FreeSerif",font_size=32) h1.color = StandardColors.Blue | def __init__(self, url, verbose=0): "Initialise an object, passing 'verbose' to the superclass." SGMLParser.__init__(self, verbose) self.hyperlinks = [] self.url = url self.language = detect_language(url) self.pdf = PDFWriter(self.url.split("/")[-1] +".pdf", StandardPaper.A4) header = Header(text_align = pango.ALIGN_CE... |
h2= Text(self.url,font="Serif",font_size=16) | h2= Text(urllib.unquote(self.url),font="FreeSerif",font_size=16) h2.color = StandardColors.Blue | def __init__(self, url, verbose=0): "Initialise an object, passing 'verbose' to the superclass." SGMLParser.__init__(self, verbose) self.hyperlinks = [] self.url = url self.language = detect_language(url) self.pdf = PDFWriter(self.url.split("/")[-1] +".pdf", StandardPaper.A4) header = Header(text_align = pango.ALIGN_CE... |
h1= Text(self.buffer,font="Serif",font_size=16) | h1= Text(self.buffer,font="FreeSerif",font_size=16) h1.color = StandardColors.Blue | def end_h1(self): self.h1=False h1= Text(self.buffer,font="Serif",font_size=16) self.pdf.add_text(h1) self.buffer = None |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.