rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
headers.update(self.headers) | myheaders = headers.copy() myheaders.update(self.headers) | def request(self, method, url, body="", headers={}): headers.update(self.headers) urlparts = urlparse.urlsplit(url) if HTTPS_PROXY != "": port = httplib.HTTPS_PORT if urlparts.port != None: port = urlparts.port return self.conn.request("CONNECT", urlparts.hostname + ":" + port, body, headers) else: url = urlparts.path ... |
return self.conn.request("CONNECT", urlparts.hostname + ":" + port, body, headers) | return self.conn.request("CONNECT", urlparts.hostname + ":" + port, body, myheaders) | def request(self, method, url, body="", headers={}): headers.update(self.headers) urlparts = urlparse.urlsplit(url) if HTTPS_PROXY != "": port = httplib.HTTPS_PORT if urlparts.port != None: port = urlparts.port return self.conn.request("CONNECT", urlparts.hostname + ":" + port, body, headers) else: url = urlparts.path ... |
return self.conn.request("GET", url, body, headers) | return self.conn.request("GET", url, body, myheaders) | def request(self, method, url, body="", headers={}): headers.update(self.headers) urlparts = urlparse.urlsplit(url) if HTTPS_PROXY != "": port = httplib.HTTPS_PORT if urlparts.port != None: port = urlparts.port return self.conn.request("CONNECT", urlparts.hostname + ":" + port, body, headers) else: url = urlparts.path ... |
def set_list(self, opt, value): | def set_list(self, opt, type, value): | def set_list(self, opt, value): self.opts[opt] = value return |
for e in sml.errors: | for e in ml.errors: | def save(self): # Generate the file mlfile = self.ml mlfile.filename = self.txtctrl_filename.GetValue() mlfile.identity = self.txtctrl_identity.GetValue() mlfile.publisher_name = self.txtctrl_pub_name.GetValue() mlfile.publisher_url = self.txtctrl_pub_url.GetValue() mlfile.copyright = self.txtctrl_copy.GetValue() mlfil... |
if main_is_frozen(): code = os.system("bin\\gdk-pixbuf-query-loaders.exe > etc\\gtk-2.0\\gdk-pixbuf.loaders") else: code = os.system("gtk\\bin\\gdk-pixbuf-query-loaders.exe > gtk\\etc\\gtk-2.0\\gdk-pixbuf.loaders") | def fix_pixbuf_paths(): if main_is_frozen(): gtkdir = "" else: gtkdir = "gtk" filename = os.path.join(gtkdir, "etc\\gtk-2.0\\gdk-pixbuf.loaders") fullgtkdir = os.path.join(get_main_dir(), gtkdir) handle = open(filename, "r") lines = handle.readlines() fixed = False outbuf = [] for line in lines: if line.find("libpixb... | def get_main_dir(): if main_is_frozen(): return os.path.dirname(sys.executable) return os.path.dirname(sys.argv[0]) |
if http.conn != None: http.conn.request("HEAD", url, headers = self.headers) | if http.conn != None: | def get_size(self): ''' Take a best guess at size based on first 3 matching servers raise socket.error e.g. "Operation timed out" ''' i = 0 sizes = [] urls = list(self.urls) while (i < len(urls) and (len(sizes) < 3)): url = urls[i] protocol = get_transport(url) if protocol == "http": status = httplib.MOVED_PERMANENTL... |
def notify_add(self, opt, callback): | def __notify(self, opt, type): try: for callback in self.notify[opt]: try: callback(self, 0, Entry(self.opts[opt], type), 0) except AttributeError: pass except KeyError: pass | def set_bool(self, opt, value): return |
) | def __start_download(self, download): # Python 2.5 seems to have a bug: sys.excepthook is not call from code # in a thread, see http://spyced.blogspot.com/2007/06/workaround-for-sysexcepthook-bug.html # sys.excepthook(*sys.exc_info()) | |
self.thisjob.id += "." + task | def endElement_tasks(self,name): task = self.text self.thisjob.id += "." + task | |
self.thisjob.id += "." + task | def endElement_tasks(self,name): task = self.text # # the line below goofs up the CPU calculations for array jobs # # self.thisjob.id += "." + task | |
dtDriftTime = .1*ms | dtDriftTime = 1*ms | def MOT(Start): ## Camera Settings ## dtCameraShutter = 0*ms dtCameraPulseWidth = 1000*us + dtCameraShutter dtCameraDelay = 5*us expTime = 100*us ## 1530 Shutter Settings ## dtShutterOpenHoldOff = 2.04*ms #Initialization Settings tStart =1.1*s +dtShutterOpenHoldOff ## throwaway image settings ## tThrowaway = tS... |
event(TA2, tTAEndOfSequence, voltageTA2) | event(TA2, tTAEndOfSequence, 0) | def MOT(Start): ## Camera Settings ## dtCameraShutter = 0*ms dtCameraPulseWidth = 1000*us + dtCameraShutter dtCameraDelay = 5*us expTime = 100*us ## 1530 Shutter Settings ## dtShutterOpenHoldOff = 2.04*ms #Initialization Settings tStart =1.1*s +dtShutterOpenHoldOff ## throwaway image settings ## tThrowaway = tS... |
event(ch(trigger, 0), 10*us, "Stop" ) event(ch(trigger, 0), 20*us, "Play" ) | def MOT(Start): event(ch(trigger, 0), 10*us, "Stop" ) event(ch(trigger, 0), 20*us, "Play" ) tDDS=Start+50*us event(ch(digitalOut, 4), Start+50*us, 0) event(ch(digitalOut, 4), Start+ 55*us, 1) event(ch(digitalOut, 4), Start + 60*us, 0) VCOScaleFactor=112.19421 | |
event(ch(dds, 1), tDDS, ( (1076/VCOScaleFactor, (1076+80)/VCOScaleFactor, 1*s), 100, 0 ) ) | def MOT(Start): event(ch(trigger, 0), 10*us, "Stop" ) event(ch(trigger, 0), 20*us, "Play" ) tDDS=Start+50*us event(ch(digitalOut, 4), Start+50*us, 0) event(ch(digitalOut, 4), Start+ 55*us, 1) event(ch(digitalOut, 4), Start + 60*us, 0) VCOScaleFactor=112.19421 | |
voltageTA = 1.4 | voltageTA2 = 1.4 voltageTA3 = 1.5 | def MOT(Start): ## 1530 Shutter Settings ## dtShutterOpenHoldOff = 2.04*ms #Initialization Settings tStart = 1000*us +dtShutterOpenHoldOff ## Camera Settings ## dtCameraDelay = 5*us dtCameraPadding = 0*us #AOM settings |
event(TA2, tStart, voltageTA) | event(TA2, tStart, voltageTA2) event(TA3, tStart, voltageTA3) | def MOT(Start): ## 1530 Shutter Settings ## dtShutterOpenHoldOff = 2.04*ms #Initialization Settings tStart = 1000*us +dtShutterOpenHoldOff ## Camera Settings ## dtCameraDelay = 5*us dtCameraPadding = 0*us #AOM settings |
event(TA2, tTAEndOfSequence, 0) | event(TA2, tTAEndOfSequence, voltageTA2) event(TA3, tTAEndOfSequence, 0) | def MOT(Start): ## 1530 Shutter Settings ## dtShutterOpenHoldOff = 2.04*ms #Initialization Settings tStart = 1000*us +dtShutterOpenHoldOff ## Camera Settings ## dtCameraDelay = 5*us dtCameraPadding = 0*us #AOM settings |
event(ch(trigger, 0), 10*us, "Stop" ) event(ch(trigger, 0), 20*us, "Play" ) | def MOT(Start): event(ch(trigger, 0), 10*us, "Stop" ) event(ch(trigger, 0), 20*us, "Play" ) setvar('test', 55) return Start | |
symbols = self.get_binary_symbols(file) | def add_binary_records(self, tag_id, record, rpm): """ Function to add binary symbols and flags to the database """ logging.debug('in Binary.add_binary_records(%s, %s, %s)' % (tag_id, record, rpm)) | |
self.add_symbol_records(tag_id, record, symbols) | def add_binary_records(self, tag_id, record, rpm): """ Function to add binary symbols and flags to the database """ logging.debug('in Binary.add_binary_records(%s, %s, %s)' % (tag_id, record, rpm)) | |
if symbol not in excluded_symbols: | if symbol not in self.excluded_symbols: | def get_binary_symbols(self, file): """ Function to get symbols from a binary file """ symbols = [] |
flags['relro'] = '1' | flags['relro'] = 1 | def get_binary_flags(self, file): """ Function to get binary flags from a file """ flags = {} |
flags['relro'] = '2' | flags['relro'] = 2 | def get_binary_flags(self, file): """ Function to get binary flags from a file """ flags = {} |
flags['relro'] = '0' | flags['relro'] = 0 | def get_binary_flags(self, file): """ Function to get binary flags from a file """ flags = {} |
flags['ssp'] = '1' | flags['ssp'] = 1 | def get_binary_flags(self, file): """ Function to get binary flags from a file """ flags = {} |
flags['ssp'] = '0' | flags['ssp'] = 0 | def get_binary_flags(self, file): """ Function to get binary flags from a file """ flags = {} |
flags['nx'] = '0' | flags['nx'] = 0 | def get_binary_flags(self, file): """ Function to get binary flags from a file """ flags = {} |
flags['nx'] = '1' | flags['nx'] = 1 | def get_binary_flags(self, file): """ Function to get binary flags from a file """ flags = {} |
flags['pie'] = '0' | flags['pie'] = 0 | def get_binary_flags(self, file): """ Function to get binary flags from a file """ flags = {} |
flags['pie'] = '1' | flags['pie'] = 1 | def get_binary_flags(self, file): """ Function to get binary flags from a file """ flags = {} |
flags['pie'] = '2' | flags['pie'] = 2 | def get_binary_flags(self, file): """ Function to get binary flags from a file """ flags = {} |
flags['fortify_source'] = '1' | flags['fortify_source'] = 1 | def get_binary_flags(self, file): """ Function to get binary flags from a file """ flags = {} |
flags['fortify_source'] = '0' | flags['fortify_source'] = 0 | def get_binary_flags(self, file): """ Function to get binary flags from a file """ flags = {} |
for x in flags: query = "INSERT INTO flags (t_record, p_record, f_relro, f_ssp, f_pie, f_fortify, f_nx) VALUES ('%s', '%s', %d, %d, %d, %d, %d)" % ( | query = "INSERT INTO flags (t_record, p_record, f_relro, f_ssp, f_pie, f_fortify, f_nx) VALUES ('%s', '%s', %d, %d, %d, %d, %d)" % ( tag_id, record, flags['relro'], flags['ssp'], flags['pie'], flags['fortify_source'], flags['nx']) result = self.db.do_query(query) def add_symbol_records(self, tag_id, record, symbols)... | def add_flag_records(self, tag_id, record, flags): """ Function to add flag records to the database """ logging.debug('in Binary.add_flag_records(%s, %s, %s)' % (tag_id, record, flags)) |
file_list[x]['relro'], file_list[x]['ssp'], file_list[x]['pie'], file_list[x]['fortify_source'], file_list[x]['nx']) | self.db.sanitize_string(symbol)) | def add_flag_records(self, tag_id, record, flags): """ Function to add flag records to the database """ logging.debug('in Binary.add_flag_records(%s, %s, %s)' % (tag_id, record, flags)) |
def clean_shell(string): | def clean_shell(self, string): | def clean_shell(string): """ Function to clean shell arguments """ return("%s" % string.replace(' ', '\ ') .replace('(', '\(') .replace(')', '\)') .replace('$', '\$') .replace("'", "\'") .replace('"', '\"') .replace('`', '\`') .replace(';', '\;') .replace('*', '\*') ) |
rpm_list = commands.getoutput("rpm -qlvp --nosignature " + self.clean_shell(file)) | rpm_list = commands.getoutput("rpm -qlvp --nosignature " + self.clean_shell(rpm_file)) | def rpm_list(self, rpm_file, raw=False): """ Function to get the list of files in an RPM, excluding those files defined by files_exclude """ logging.debug('in rpm_list(%s)' % rpm_file) |
for the most recent 'c_call' event. | for the most recent 'c_call' event). | def trace(self, frame, event): """Tries to recognize the current event in terms of calls to and returns from C. |
(pre- and post- call dependencies ech do one of those). Next, we look | (pre- and post- call dependencies each do one of those). Next, we look | def _calculate(self, objects, relevant_side_effects): """ First, we look at all objects required for the call's input/output (pre- and post- call dependencies ech do one of those). Next, we look at all side effects that affected those objects before the call. Those side effects can reference more objects, which in turn... |
text = 'Results on PREPROCESSING the Image for configuration: \n' preProcessingConfiguration = item.preProcessingConfiguration text += 'PreProcessing Parameters Used: \n' text += 'dp : '+str(preProcessingConfiguration.dp) + '\n' text += 'minimumRadius: '+str(preProcessingConfiguration.minimumRadius) + '\n' te... | def checkResults(self): ''' Refer GmailResultsFramework.checkResults for documentation ''' tags = self.grestags + " IANA" gmail_user = setting.get("username") gmail_pwd = setting.get("password") smtpserver = smtplib.SMTP("smtp.gmail.com",587) smtpserver.ehlo() smtpserver.starttls() smtpserver.ehlo() smtpserver.login(... | |
text += 'Results: \n' text += 'SampledRGB : ' + str(item.preProcessingResult.sampled) + '\n' text += 'DebugPicName: '+item.preProcessingResult.debugImage.name + '\n\n' | text = render_to_string("result_email_debug.html", {'item': item}) textmsg = MIMEText(text) | def checkResults(self): ''' Refer GmailResultsFramework.checkResults for documentation ''' tags = self.grestags + " IANA" gmail_user = setting.get("username") gmail_pwd = setting.get("password") smtpserver = smtplib.SMTP("smtp.gmail.com",587) smtpserver.ehlo() smtpserver.starttls() smtpserver.ehlo() smtpserver.login(... |
text += 'Results on COMPUTATION of the Results: \n' computationConfiguration = item.computationConfiguration text += 'Computation parameters Used: \n' text += 'filterRadius: ' + str(computationConfiguration.filterRadius) + '\n' text += 'exposedTime : ' + str(computationConfiguration.exposedTime) + '\n' text += 'bcStrip... | def checkResults(self): ''' Refer GmailResultsFramework.checkResults for documentation ''' tags = self.grestags + " IANA" gmail_user = setting.get("username") gmail_pwd = setting.get("password") smtpserver = smtplib.SMTP("smtp.gmail.com",587) smtpserver.ehlo() smtpserver.starttls() smtpserver.ehlo() smtpserver.login(... | |
if "PPROCCALIB" in item.status: text = "Failed to Fetch PreProcessingData for item : "+item.item.file.name+'\n\n' elif "PPROC" in item.status: text = "Failed to PreProcess the item: "+item.item.file.name+"\n\n" preProcessingConfiguration = item.preProcessingConfiguration text += 'PreProcessing Parameters Used: \n' tex... | def checkResults(self): ''' Refer GmailResultsFramework.checkResults for documentation ''' tags = self.grestags + " IANA" gmail_user = setting.get("username") gmail_pwd = setting.get("password") smtpserver = smtplib.SMTP("smtp.gmail.com",587) smtpserver.ehlo() smtpserver.starttls() smtpserver.ehlo() smtpserver.login(... | |
elif "SAVIN" in item.status: text = "Failed to Save Results for item : "+item.item.file.name+'\n\n' | text = render_to_string("failed_email_debug.html", {'item': item}) | def checkResults(self): ''' Refer GmailResultsFramework.checkResults for documentation ''' tags = self.grestags + " IANA" gmail_user = setting.get("username") gmail_pwd = setting.get("password") smtpserver = smtplib.SMTP("smtp.gmail.com",587) smtpserver.ehlo() smtpserver.starttls() smtpserver.ehlo() smtpserver.login(... |
else: text = "Failed processing item: "+item.item.file.name+'\n' | def checkResults(self): ''' Refer GmailResultsFramework.checkResults for documentation ''' tags = self.grestags + " IANA" gmail_user = setting.get("username") gmail_pwd = setting.get("password") smtpserver = smtplib.SMTP("smtp.gmail.com",587) smtpserver.ehlo() smtpserver.starttls() smtpserver.ehlo() smtpserver.login(... | |
msghdr += "Subject: BC Results for " + str(item.computationResult.chartImage.name) + '\n\n' | msghdr += "Subject: BC Results for " + str(item.computationResult.chartImage.name) + '\n' | def checkResults(self): ''' Refer GmailResultsFramework.checkResults for documentation ''' tags = self.grestags + " IANA" gmail_user = setting.get("username") gmail_pwd = setting.get("password") smtpserver = smtplib.SMTP("smtp.gmail.com",587) smtpserver.ehlo() smtpserver.starttls() smtpserver.ehlo() smtpserver.login(... |
text = render_to_string("result_email_debug.html", {'item': item}) | text = render_to_string("result_email_default.html", {'item': item}) | def checkResults(self): ''' Refer GmailResultsFramework.checkResults for documentation''' tags = self.grestags + " IANA" gmail_user = setting.get("username") gmail_pwd = setting.get("password") smtpserver = smtplib.SMTP("smtp.gmail.com",587) smtpserver.ehlo() smtpserver.starttls() smtpserver.ehlo() smtpserver.login(gm... |
args = (self.path, "rU", self.encoding) with contextlib.closing(codecs.open(*args)) as fobj: lines = fobj.readlines() | decode = lambda x: x.decode(self.encoding) with contextlib.closing(open(self.path, "rU")) as fobj: lines = map(decode, fobj.readlines()) | def _read_lines(self): """Read file to a unicoded list of lines. |
return gettext.gettext(message) | return gettext.gettext(unicode(message)) | def _(message): """Return the localized translation of `message`.""" return gettext.gettext(message) |
return gettext.dgettext(domain, message) | return gettext.dgettext(domain, unicode(message)) | def dgettext(domain, message): """Return the localized translation of `message` from `domain`.""" return gettext.dgettext(domain, message) |
self.close(self.pages[-1], False) | self.close(self.pages[-1]) | def close_all(self): """Close all pages after asking to save their documents. |
def _on_conf_application_window_notify_size(self, value): | def _on_conf_application_window_notify_size(self, obj, value): | def _on_conf_application_window_notify_size(self, value): assert value == [99, 99] |
self._subtitle_spin.set_value(1) rows = page.view.get_selected_rows() subtitle = (rows[0] + 1 if rows else 1) self._subtitle_spin.set_value(subtitle) | def _init_subtitle_spin(self): """Initialize the subtitle spin button.""" page = self.application.get_current_page() self._subtitle_spin.set_range(2, len(page.project.subtitles)) self._subtitle_spin.set_value(1) rows = page.view.get_selected_rows() subtitle = (rows[0] + 1 if rows else 1) self._subtitle_spin.set_value(s... | |
self._label = gtk.Label(_("(Empty)")) | self._label = gtk.Label("(Empty)") | def __init__(self, application): """Initialize a :class:`SidePane` object.""" aeidon.Observable.__init__(self) self._conf = gaupol.conf.extensions.side_pane self._focus_handler_id = None self._has_focus = False self._label = gtk.Label(_("(Empty)")) self._notebook = gtk.Notebook() self._paned = gtk.HPaned() self._toggle... |
if subprocess.call(command) != 0: | if os.system(command) != 0: | def run_command_or_exit(command): """Run command in shell and raise SystemExit if it fails.""" if subprocess.call(command) != 0: log.error("command %s failed" % repr(command)) raise SystemExit(1) |
if subprocess.call(command) != 0: | if os.system(command) != 0: | def run_command_or_warn(command): """Run command in shell and raise SystemExit if it fails.""" if subprocess.call(command) != 0: log.warn("command %s failed" % repr(command)) |
run_command_or_warn(("update-desktop-database", directory)) | run_command_or_warn('update-desktop-database "%s"' % directory) | def run(self): """Install everything and update the desktop file database.""" install.run(self) if self.distribution.with_gaupol: get_command_obj = self.distribution.get_command_obj root = get_command_obj("install").root data_dir = get_command_obj("install_data").install_dir # Assume we're actually installing if --root... |
files = glob.glob("extensions/*/*.py") files = [os.path.join(data_dir, x) for x in files] | files = glob.glob("%s/extensions/*/*.py" % data_dir) | def __build_extensions(self): """Build all Python code files in extensions.""" get_command_obj = self.distribution.get_command_obj if not get_command_obj("install_lib").compile: return optimize = get_command_obj("install_lib").optimize data_dir = get_command_obj("install_data").install_dir data_dir = os.path.join(data_... |
for extension in os.listdir("extensions"): pattern = "extensions/%s/*.gaupol-extension.in" % extension | for extension in os.listdir("data/extensions"): pattern = "data/extensions/%s/*.gaupol-extension.in" pattern = pattern % extension | def run(self): """Install data files after translating them.""" if "py2exe" in sys.argv: # Do not try compiling translations on Windows, # instead expect them to have been precompiled. return install_data.run(self) if self.distribution.with_aeidon: for po_file in glob.glob("po/*.po"): self.data_files.append(self.__get_... |
run_command_or_exit("tools/git2cl > ChangeLog") | run_command_or_exit("tools/generate-change-log > ChangeLog") | def run(self): version = get_gaupol_version() if os.path.isfile("ChangeLog"): os.remove("ChangeLog") run_command_or_exit("tools/git2cl > ChangeLog") assert os.path.isfile("ChangeLog") sdist.run(self) basename = "gaupol-%s" % version tarballs = os.listdir(self.dist_dir) os.chdir(self.dist_dir) # Compare tarball contents... |
col = page.view.get_focus()[1] | row, col = page.view.get_focus() | def _on_paste_texts_activate(self, *args): """Paste texts from the clipboard.""" page = self.get_current_page() rows = page.view.get_selected_rows() col = page.view.get_focus()[1] doc = page.text_column_to_document(col) length = len(page.project.subtitles) rows = page.project.paste_texts(rows[0], doc) count = len(page.... |
if self.with_iso_codes: self.__find_data_files("iso-codes") | def parse_command_line(self): """Parse commands and options given as arguments.""" value = distribution.parse_command_line(self) # Configuration files are parsed before the command line, # so once the command line is parsed, all options have # their final values and thus files corresponding to # the packages to install... | |
has_attr = hasattr(obj, name) attr = getattr(obj, name, None) setattr(obj, name, copy.deepcopy(attr)) try: return function(*args, **kwargs) | has_attr_def = _hasattr_def(obj, name) if has_attr_def: attr = getattr(obj, name) setattr(obj, name, copy.deepcopy(attr)) try: return function(*args, **kwargs) | def inner_wrapper(*args, **kwargs): has_attr = hasattr(obj, name) attr = getattr(obj, name, None) setattr(obj, name, copy.deepcopy(attr)) try: return function(*args, **kwargs) finally: setattr(obj, name, attr) assert getattr(obj, name) == attr assert getattr(obj, name) is attr if not has_attr: delattr(obj, name) assert... |
setattr(obj, name, attr) assert getattr(obj, name) == attr assert getattr(obj, name) is attr if not has_attr: | if has_attr_def: setattr(obj, name, attr) assert getattr(obj, name) == attr assert getattr(obj, name) is attr else: | def inner_wrapper(*args, **kwargs): has_attr = hasattr(obj, name) attr = getattr(obj, name, None) setattr(obj, name, copy.deepcopy(attr)) try: return function(*args, **kwargs) finally: setattr(obj, name, attr) assert getattr(obj, name) == attr assert getattr(obj, name) is attr if not has_attr: delattr(obj, name) assert... |
assert not hasattr(obj, name) | assert not _hasattr_def(obj, name) | def inner_wrapper(*args, **kwargs): has_attr = hasattr(obj, name) attr = getattr(obj, name, None) setattr(obj, name, copy.deepcopy(attr)) try: return function(*args, **kwargs) finally: setattr(obj, name, attr) assert getattr(obj, name) == attr assert getattr(obj, name) is attr if not has_attr: delattr(obj, name) assert... |
if not gaupol.conf.editor.use_custom_font: return | font = gaupol.util.get_font() | def _on_conf_editor_notify_custom_font(self, *args): """Apply the new font to all columns.""" if not gaupol.conf.editor.use_custom_font: return for column in self.get_columns(): renderer = column.get_cell_renderers()[0] if hasattr(renderer.props, "font"): renderer.props.font = gaupol.conf.editor.custom_font self.column... |
renderer.props.font = gaupol.conf.editor.custom_font | renderer.props.font = font | def _on_conf_editor_notify_custom_font(self, *args): """Apply the new font to all columns.""" if not gaupol.conf.editor.use_custom_font: return for column in self.get_columns(): renderer = column.get_cell_renderers()[0] if hasattr(renderer.props, "font"): renderer.props.font = gaupol.conf.editor.custom_font self.column... |
if not gaupol.conf.editor.use_custom_font: return | font = gaupol.util.get_font() | def _on_conf_editor_notify_use_custom_font(self, *args): """Apply the new font to all columns.""" if not gaupol.conf.editor.use_custom_font: return for column in self.get_columns(): renderer = column.get_cell_renderers()[0] if hasattr(renderer.props, "font"): renderer.props.font = gaupol.conf.editor.custom_font self.co... |
renderer.props.font = gaupol.conf.editor.custom_font | renderer.props.font = font | def _on_conf_editor_notify_use_custom_font(self, *args): """Apply the new font to all columns.""" if not gaupol.conf.editor.use_custom_font: return for column in self.get_columns(): renderer = column.get_cell_renderers()[0] if hasattr(renderer.props, "font"): renderer.props.font = gaupol.conf.editor.custom_font self.co... |
renderer = gtk.CellRendererText() self._pattern_combo.pack_start(renderer, True) self._pattern_combo.add_attribute(renderer, "text", 0) | self._pattern_combo.set_text_column(0) | def _init_pattern_combo(self): """Initialize the pattern combo box.""" store = gtk.ListStore(str) self._pattern_combo.set_model(store) for pattern in self.patterns: store.append((pattern,)) renderer = gtk.CellRendererText() self._pattern_combo.pack_start(renderer, True) self._pattern_combo.add_attribute(renderer, "text... |
renderer = gtk.CellRendererText() self._replacement_combo.pack_start(renderer, True) self._replacement_combo.add_attribute(renderer, "text", 0) | self._replacement_combo.set_text_column(0) | def _init_replacement_combo(self): """Initialize the replacement combo box.""" store = gtk.ListStore(str) self._replacement_combo.set_model(store) for replacement in self.replacements: store.append((replacement,)) renderer = gtk.CellRendererText() self._replacement_combo.pack_start(renderer, True) self._replacement_com... |
if indices and gaupol.conf.text_assitant.remove_blank: | if indices and gaupol.conf.text_assistant.remove_blank: | def _on_apply(self, *args): """Apply accepted changes to projects.""" gaupol.util.set_cursor_busy(self) edits = removals = 0 changes = self._confirmation_page.get_confirmed_changes() target = self._introduction_page.get_target() application_pages = self.application.get_target_pages(target) field = self._introduction_pa... |
env=os.environ.copy(), | env=(os.environ.copy() if sys.platform != "win32" else None), | def start_process(command, **kwargs): """Start `command` as a new background subprocess. `command` and `kwargs` are passed to :meth:`subprocess.Popen.__init__`. Raise :exc:`aeidon.ProcessError` if something goes wrong. Return :class:`subprocess.Popen` instance. """ try: return subprocess.Popen(command, shell=(sys.plat... |
if module in self._inferior: self._inferior.remove(module) | else: if module in self._inferior: self._inferior.remove(module) | def setup_extension(self, module, inferior=False): """Import and setup extension by module name. |
self.load(filename) | self.Load(filename) | def __init__(self, filename = None): self.__data = {} self.__chunks = [] if filename is not None: self.load(filename) return |
if not (ct == CHUNK_TYPES["HEADER"] and cd in ["Module info file v1.1\x00", "Module info file v2.0\x00"]): raise Exception("Invalid Mod chunk") | def Load(self, filename): try: f = open(filename, "rb") ct, cd = ReadNextChunk(f) | |
if __name__ == "__main__": import sys, glob u = Udd() for fn in glob.glob(sys.argv[1]): u.Load(fn) print u.FindByRVA(0x162) u.AppendChunk(MakeLabelChunk(0x162, "label")) u.Save(fn) | def FindByRVA(self, RVA): found = self.FindByTypes(RVAINFO_TYPES) | |
def load(name = "..\compiled.exe"): | def load(name = "..\PE\compiled.exe"): | def load(name = "..\compiled.exe"): """load PE, return pe object, it's entry point, imagebase, VA of the section of the entry point, its physical size""" pe = pefile.PE(name) oep = pe.OPTIONAL_HEADER.AddressOfEntryPoint ib = pe.OPTIONAL_HEADER.ImageBase section = pe.sections[getEPsection(pe)] start, size = section.Virt... |
command='mv --reply=yes %s %s' % (k,korig) | command='mv -f %s %s' % (k,korig) | def checkedit(): p=0 for i in editorvars[:2]: act=os.getenv(i,1) if(act==1): print "- $%s is not accessible!" % i else: print "- $%s is accessible!" % i a_editors.append('$'+i) for i in os.walk('/usr/bin'): files=(i[2]) for s in files: if s in editors: a_editors.append(s) print "- Found %s as an alternative editor" % ... |
self.logfile = "syncpkgcd-%s.log" % time.strftime("%Y%m%d", time.localtime()) | def __init__(self): self.daemon = False self.pidfile = "syncpkgcd.pid" self.logfile = "syncpkgcd.log" self.help = False self.uid = False self.logfile = "syncpkgcd-%s.log" % time.strftime("%Y%m%d", time.localtime()) | |
singleCopyThreshold = 17 | singleCopyThreshold = 30 | def computeAStat(arrivalRate, len, n): return arrivalRate * len - (n * math.log(2)) |
alignments[record.qname].append(ContigPosition(record.pos, record.pos + record.rlen)) | alignments[record.qname].append(ContigPosition(record.pos, record.pos + record.alen)) | def usage(): print 'usage: evalScaffolds.py SCAFFOLDS SAM' print 'evaluate the correctness of the SCAFFOLDS using the alignments of the components to the reference in SAM' print 'Options:' print ' --no-singleton Skip evaluating singleton scaffolds' print '' |
new_values = v[:] | def optimise(self, transsys_program, objective_function, factor_name_list = None, gene_name_list = None) : tp = copy.deepcopy(transsys_program) self.initialiseParameterTransformer(tp, factor_name_list, gene_name_list) current_values = self.transformer.getParameters() if self.verbose : sys.stderr.write('optimising %d va... | |
read_id = (id_num_digits == 0) | read_id = (id_num_digits > 0) | def main(): options = read_cmd_options() config = read_config() save_pattern = config.get('default', 'save-filename-pattern') if options.ex_data_filename is not None: solutions, dimensions, id_num_digits = \ process_exam_data(options.ex_data_filename) else: solutions = [] dimensions = [] id_num_digits = 0 read_id = (i... |
if self.options['show-lines']: | elif self.options['show-lines']: | def detect(self): lines = detect_lines(self.image_proc) if len(lines) < 2: return axes = detect_boxes(lines, self.boxes_dim) if axes is not None: self.corner_matrixes = cell_corners(axes[1][1], axes[0][1], self.image_raw.width, self.image_raw.height, self.boxes_dim) self.id_hlines = id_horizontal_lines(axes[1][1], axes... |
print "Too many lines in detect_directions:", lines.total | def detect_lines(image): st = opencv.cvCreateMemStorage() lines = opencv.cvHoughLines2(image, st, opencv.CV_HOUGH_STANDARD, 1, 0.01, param_hough_threshold) if lines.total > 500: print "Too many lines in detect_directions:", lines.total return [] s_lines = sorted([(float(l[0]), float(l[1])) for l in lines], key = lambda... | |
plu, pru = line_bounds(image, hlines[0], iwidth) | plu, pru = line_bounds_adaptive(image, hlines[0], iwidth, 3) | def id_boxes_geometry(image, hlines, iwidth, num_cells): success = False plu, pru = line_bounds(image, hlines[0], iwidth) if plu is not None: pld, prd = line_bounds(image, hlines[1], iwidth) if plu is not None and pld is not None: # adjust corners outer_up = [plu, pru] outer_down = [pld, prd] success = id_boxes_adjust(... |
pld, prd = line_bounds(image, hlines[1], iwidth) | pld, prd = line_bounds_adaptive(image, hlines[1], iwidth, 3) | def id_boxes_geometry(image, hlines, iwidth, num_cells): success = False plu, pru = line_bounds(image, hlines[0], iwidth) if plu is not None: pld, prd = line_bounds(image, hlines[1], iwidth) if plu is not None and pld is not None: # adjust corners outer_up = [plu, pru] outer_down = [pld, prd] success = id_boxes_adjust(... |
hlines[0], hlines[1], 7, iwidth) | hlines[0], hlines[1], 7, 0, iwidth) | def id_boxes_geometry(image, hlines, iwidth, num_cells): success = False plu, pru = line_bounds(image, hlines[0], iwidth) if plu is not None: pld, prd = line_bounds(image, hlines[1], iwidth) if plu is not None and pld is not None: # adjust corners outer_up = [plu, pru] outer_down = [pld, prd] success = id_boxes_adjust(... |
hlines[0], hlines[1], 3, iwidth) | hlines[0], hlines[1], 3, 3, iwidth) | def id_boxes_geometry(image, hlines, iwidth, num_cells): success = False plu, pru = line_bounds(image, hlines[0], iwidth) if plu is not None: pld, prd = line_bounds(image, hlines[1], iwidth) if plu is not None and pld is not None: # adjust corners outer_up = [plu, pru] outer_down = [pld, prd] success = id_boxes_adjust(... |
x_var, iwidth): | x_var, rho_var, iwidth): | def id_boxes_adjust(image, corners_up, corners_down, line_up, line_down, x_var, iwidth): for i in range(0, len(corners_up)): up = corners_up[i] down = corners_down[i] selected = id_boxes_adjust_points(image, up, down, line_up, line_down, x_var, iwidth) if selected is not None: corners_up[i] = selected[0] corners_down[i... |
corners_up[i] = selected[0] corners_down[i] = selected[1] | if rho_var > 0: if i == 0: interval = (0, 2 * rho_var) elif i == len(corners_up) - 1: interval = (- 2 * rho_var, 0) else: interval = (- rho_var, rho_var) corners_up[i] = \ id_boxes_adjust_point_vertically(image, selected[0], line_up, interval, iwidth) corners_down[i] = \ id_boxes_adjust_point_vertically(image, selected... | def id_boxes_adjust(image, corners_up, corners_down, line_up, line_down, x_var, iwidth): for i in range(0, len(corners_up)): up = corners_up[i] down = corners_down[i] selected = id_boxes_adjust_points(image, up, down, line_up, line_down, x_var, iwidth) if selected is not None: corners_up[i] = selected[0] corners_down[i... |
if energies[0][0] > param_id_boxes_match_threshold: | if len(energies) > 0 and energies[0][0] > param_id_boxes_match_threshold: | def id_boxes_adjust_points(image, p_up, p_down, line_up, line_down, x_var, iwidth): points_up = [] points_down = [] for x in range(p_up[0] - x_var, p_up[0] + x_var + 1): p = line_point(line_up, x = x) if p[0] >= 0 and p[0] < iwidth and p[1] >= 0: points_up.append(p) for x in range(p_down[0] - x_var, p_down[0] + x_var +... |
points = [] | def line_bounds(image, line, iwidth): # points of intersection with x = 0 and x = width - 1 p0 = line_point(line, x = 0) if p0[1] < 0: p0 = line_point(line, y = 0) p1 = line_point(line, x = iwidth - 1) if p1[1] < 0: p1 = line_point(line, y = 0) # get bounds ini_found = False ini = None end = None points = [] last = 0 ... | |
def init(config): camera = imageproc.init_camera(config.getint('default', 'camera-dev')) | def init(camera_dev): camera = imageproc.init_camera(camera_dev) | def init(config): camera = imageproc.init_camera(config.getint('default', 'camera-dev')) return camera |
parser.add_option("-d", "--output-dir", dest = "output_dir", help = "stored captured images at the given directory") | parser.add_option("-o", "--output-dir", dest = "output_dir", help = "store captured images at the given directory") parser.add_option("-d", "--debug", action="store_true", dest = "debug", default = False, help = "activate debugging features") parser.add_option("-c", "--camera", type="int", dest = "camera_dev", help = "... | def read_cmd_options(): parser = OptionParser("usage: %prog [options]") parser.add_option("-e", "--exam-data-file", dest = "ex_data_filename", help = "read model data from FILENAME") parser.add_option("-a", "--answers-file", dest = "answers_filename", help = "write students' answers to FILENAME") parser.add_option("-s"... |
camera = init(config) | camera = init(select_camera(options, config)) | def main(): options = read_cmd_options() config = read_config() save_pattern = config.get('default', 'save-filename-pattern') if options.ex_data_filename is not None: solutions, dimensions = process_exam_data(options.ex_data_filename) else: solutions = [] dimensions = [] answers_file = options.answers_filename if opti... |
image.detect(False) | image.detect(options.debug) | def main(): options = read_cmd_options() config = read_config() save_pattern = config.get('default', 'save-filename-pattern') if options.ex_data_filename is not None: solutions, dimensions = process_exam_data(options.ex_data_filename) else: solutions = [] dimensions = [] answers_file = options.answers_filename if opti... |
self.student_id = self.decide_student_id(valid_student_ids) self.student_id_filter = [] | if self.image.options['read-id']: self.student_id = self.decide_student_id(valid_student_ids) self.student_id_filter = [] else: self.student_id = '-1' | def __init__(self, image, model, solutions, valid_student_ids = None, im_id = None, save_stats = False): self.image = image self.model = model self.solutions = solutions self.im_id = im_id self.correct = None self.score = None self.original_decisions = copy.copy(self.image.decisions) self.save_stats = save_stats self.s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.