rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
cls.dprint("%s: layout=%s" % (url, layout)) | cls.dprint("%s: layout=%s" % (unicode(url), unicode(layout))) | def getLayoutSubsequent(cls, major_mode_keyword, url): #dprint("getLayoutSubsequent") ukey = unicode(url).encode("utf-8") if major_mode_keyword in cls.layout: try: key = str(url) # Convert old style string keyword to unicode keyword if ukey != key and key in cls.layout[major_mode_keyword]: cls.layout[major_mode_keyword... |
if action.keyboard is None: keyboard = "" else: keyboard = str(action.keyboard) | keyboard = action.keyboard if keyboard is None: keyboard = "" else: keyboard = str(keyboard) | def __cmp__(self, other): return cmp(self.name, other.name) |
self.pid = wx.Execute(self.cmd, wx.EXEC_ASYNC, self.process) | if wx.Platform != '__WXMSW__': flag = wx.EXEC_ASYNC else: flag = wx.EXEC_NOHIDE self.pid = wx.Execute(self.cmd, flag, self.process) | def run(self, text=""): assert self.dprint("Running %s in %s" % (self.cmd, self.working_dir)) savecwd = os.getcwd() try: os.chdir(self.working_dir) self.process = wx.Process(self.handler) self.process.Redirect(); self.pid = wx.Execute(self.cmd, wx.EXEC_ASYNC, self.process) finally: os.chdir(savecwd) if self.pid==0: ass... |
return attrs.st_mtime @classmethod def get_mtime(cls, ref): attrs = cls._stat(ref) return attrs.st_mtime | return datetime.fromtimestamp(attrs.st_mtime) get_ctime = get_mtime | def get_mtime(cls, ref): attrs = cls._stat(ref) return attrs.st_mtime |
return attrs.st_atime | return datetime.fromtimestamp(attrs.st_atime) | def get_atime(cls, ref): attrs = cls._stat(ref) return attrs.st_atime |
self._spelling_debug = True | self._spelling_debug = False | def __init__(self, stc, *args, **kwargs): """Mixin must be initialized using this constructor. Keyword arguments are also available instead of calling the convenience functions. For L{setIndicator}, use C{indicator}, C{indicator_color}, and {indicator_style}; for L{setLanguage}, use C{language}; and for L{setMinimumW... |
list.InsertSizedColumn(0, "URL", min=100, greedy=False) | list.InsertSizedColumn(0, "File", min=100, greedy=False) | def createColumns(self, list): list.InsertSizedColumn(0, "URL", min=100, greedy=False) list.InsertSizedColumn(1, "Line", min=10, greedy=False) list.InsertSizedColumn(2, "Match", min=300, greedy=True) |
return (unicode(item.url), item.line, unicode(item.text)) | return (unicode(item.short), item.line, unicode(item.text), item.url) | def getItemRawValues(self, index, item): return (unicode(item.url), item.line, unicode(item.text)) |
self.frame.open(values[0], options={'line':values[1] - 1}) | self.frame.open(values[3], options={'line':values[1] - 1}) | def OnItemActivated(self, evt): index = evt.GetIndex() orig_index = self.list.GetItemData(index) values = self.list.itemDataMap[orig_index] dprint(values) self.frame.open(values[0], options={'line':values[1] - 1}) |
dprint("no selection; cursor at %s" % start) | self.dprint("no selection; cursor at %s" % start) | def action(self, index=-1, multiplier=1): s = self.mode # FIXME: Because the autoindenter depends on the styling information, # need to make sure the document is up to date. But, is this call to # style the entire document fast enough in practice, or will it have # to be optimized? s.Colourise(0, s.GetTextLength()) |
dprint("selection: %s - %s" % (start, end)) | self.dprint("selection: %s - %s" % (start, end)) | def action(self, index=-1, multiplier=1): s = self.mode # FIXME: Because the autoindenter depends on the styling information, # need to make sure the document is up to date. But, is this call to # style the entire document fast enough in practice, or will it have # to be optimized? s.Colourise(0, s.GetTextLength()) |
except re.error: | self.error = "" except re.error, errmsg: | def __init__(self, string, match_case): try: if not match_case: flags = re.IGNORECASE else: flags = 0 self.cre = re.compile(string, flags) except re.error: self.cre = None self.last_match = None |
return bool(self.cre) | return bool(self.string) and bool(self.cre) def getErrorString(self): if len(self.string) == 0: return "Search error: search string is blank" return "Regular expression error: %s" % self.error | def isValid(self): return bool(self.cre) |
self.setStatusText("Invalid search string.") | if hasattr(matcher, "getErrorString"): error = matcher.getErrorString() else: error = "Invalid search string." self.setStatusText(error) self.showSearchButton(False) | def OnStartSearch(self, evt): if not self.isSearchRunning(): self.showSearchButton(True) method = self.buffer.stc.search_method.option if method.isValid(): status = SearchStatus(self) matcher = self.buffer.stc.search_type.option.getStringMatcher(self.search_text.GetValue()) ignorer = WildcardListIgnorer(self.ignore_fil... |
if not prefix.endswith("/"): prefix += "/" | if not prefix.endswith(os.sep): prefix += os.sep | def getPrefix(self): prefix = unicode(self.pathname) if not prefix.endswith("/"): prefix += "/" return prefix |
self.wrapper.spring.clearRadio() self.frame.spring.clearRadio() | try: self.wrapper.spring.clearRadio() self.frame.spring.clearRadio() except wx.PyDeadObjectError: pass | def OnFocus(self, evt): """Callback used to pop down any springtabs. When the major mode loses keyboard focus, the springtabs should be cleared to allow the new focus receiver to display itself. This fails when the major mode never takes keyboard focus at all, in which case a focus-lost event is never generated and t... |
options = {'byte_order': self.endian} | options['byte_order'] = self.endian | def action(self, index=-1, multiplier=1): filename = self.frame.showSaveAs("Save Image as ENVI", wildcard="BIL (*.bil)|*.bil|BIP (*.bip)|*.bip|BSQ (*.bsq)|*.bsq") if filename: root, ext = os.path.splitext(filename) ext = ext.lower() if ext in ['.bil', '.bip', '.bsq']: handler = HyperspectralFileFormat.getHandlerByName(... |
list.InsertSizedColumn(0, "File", min=100, greedy=False) | list.InsertSizedColumn(0, "File", min=100, max=250, greedy=False) | def createColumns(self, list): list.InsertSizedColumn(0, "File", min=100, greedy=False) list.InsertSizedColumn(1, "Line", min=10, greedy=False) list.InsertSizedColumn(2, "Match", min=300, greedy=True) |
list.InsertSizedColumn(2, "Match", min=300, greedy=True) | list.InsertSizedColumn(2, "Match", min=300, greedy=True, ok_offscreen=True) | def createColumns(self, list): list.InsertSizedColumn(0, "File", min=100, greedy=False) list.InsertSizedColumn(1, "Line", min=10, greedy=False) list.InsertSizedColumn(2, "Match", min=300, greedy=True) |
self.raw.tofile(str(url.path)) | filename = unicode(url.path) try: self.raw.tofile(filename) except ValueError: fd = open(filename, "wb") flat = self.raw.ravel() size = flat.size start = 0 while start < size: last = start + 10000 if last > size: last = size fd.write(flat[start:last].tostring()) start = last | def save(self, url): if self.mmap: self.mmap.flush() self.mmap.sync() else: self.raw.tofile(str(url.path)) |
ukey = unicode(url) | ukey = unicode(url).encode("utf-8") | def getLayoutSubsequent(cls, major_mode_keyword, url): #dprint("getLayoutSubsequent") ukey = unicode(url) if major_mode_keyword in cls.layout: try: key = str(url) # Convert old style string keyword to unicode keyword if key in cls.layout[major_mode_keyword]: cls.layout[major_mode_keyword][ukey] = cls.layout[major_mode_... |
if key in cls.layout[major_mode_keyword]: | if ukey != key and key in cls.layout[major_mode_keyword]: | def getLayoutSubsequent(cls, major_mode_keyword, url): #dprint("getLayoutSubsequent") ukey = unicode(url) if major_mode_keyword in cls.layout: try: key = str(url) # Convert old style string keyword to unicode keyword if key in cls.layout[major_mode_keyword]: cls.layout[major_mode_keyword][ukey] = cls.layout[major_mode_... |
return cls.layout[major_mode_keyword][ukey] | layout = cls.layout[major_mode_keyword][ukey] | def getLayoutSubsequent(cls, major_mode_keyword, url): #dprint("getLayoutSubsequent") ukey = unicode(url) if major_mode_keyword in cls.layout: try: key = str(url) # Convert old style string keyword to unicode keyword if key in cls.layout[major_mode_keyword]: cls.layout[major_mode_keyword][ukey] = cls.layout[major_mode_... |
return {} | layout = {} cls.dprint("%s: layout=%s" % (url, layout)) return layout | def getLayoutSubsequent(cls, major_mode_keyword, url): #dprint("getLayoutSubsequent") ukey = unicode(url) if major_mode_keyword in cls.layout: try: key = str(url) # Convert old style string keyword to unicode keyword if key in cls.layout[major_mode_keyword]: cls.layout[major_mode_keyword][ukey] = cls.layout[major_mode_... |
if self.frame == frame: | if not self.frame: dprint("Frame has been deleted!!! Message was:") dprint(message) dlg = wx.MessageDialog(wx.GetApp().GetTopWindow(), message, "Error message for deleted frame!!!", wx.OK | wx.ICON_EXCLAMATION ) retval=dlg.ShowModal() dlg.Destroy() elif self.frame == frame: | def showError(self, message=None): data = message.data if isinstance(data, tuple) or isinstance(data, list): frame = data[0] text = data[1] else: frame = wx.GetApp().GetTopWindow() text = data if self.frame == frame: paneinfo = frame._mgr.GetPane(self) if self.classprefs.unhide_on_message: if not paneinfo.IsShown(): pa... |
StrParam('minor_modes', 'GraphvizView'), ) class GraphvizViewMinorMode(MinorMode, JobOutputMixin, wx.Panel, debugmixin): """Display the graphical view of the DOT file. This displays the graphic image that is represented by the .dot file. It calls the external graphviz program and displays a bitmap version of the g... | StrParam('graphic_format', 'png'), StrParam('layout', 'dot'), SupersededParam('output_log') | def action(self, index=-1, multiplier=1): self.frame.open("about:sample.dot") |
dotprogs = ['dot', 'neato', 'twopi', 'circo', 'fdp'] | def getInterpreterArgs(self): self.dot_output = vfs.reference_with_new_extension(self.buffer.url, self.classprefs.graphic_format) args = "%s -v -T%s -K%s -o%s" % (self.classprefs.interpreter_args, self.classprefs.graphic_format, self.classprefs.layout, str(self.dot_output.path)) return args | def action(self, index=-1, multiplier=1): self.frame.open("about:sample.dot") |
@classmethod def worksWithMajorMode(self, mode): if mode.__class__ == GraphvizMode: return True return False def __init__(self, parent, **kwargs): MinorMode.__init__(self, parent, **kwargs) wx.Panel.__init__(self, parent) self.sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.sizer) buttons = wx.BoxSizer(wx.HORIZO... | def getJobOutput(self): return self | def action(self, index=-1, multiplier=1): self.frame.open("about:sample.dot") |
self.busy(True) | def startupCallback(self, job): self.process = job self.busy(True) self.preview = StringIO() | |
self.process = None self.busy(False) self.createImage() def createImage(self): assert self.dprint("using image, size=%s" % len(self.preview.getvalue())) if len(self.preview.getvalue())==0: self.mode.setStatusText("Error running graphviz!") return fh = StringIO(self.preview.getvalue()) img = wx.EmptyImage() if img... | del self.process self.frame.findTabOrOpen(self.dot_output) | def finishedCallback(self, job): assert self.dprint() self.process = None self.busy(False) self.createImage() # Don't call evt.Skip() here because it causes a crash |
def getMinorModes(self): yield GraphvizViewMinorMode | def getMajorModes(self): yield GraphvizMode | |
def download(self, url, path): | def download(url, path): | def download(self, url, path): """ Download url and store it at path """ f = None g = None try: f = urllib.urlopen(url) g = open(path, 'wb') copyobj(f, g) finally: if f: f.close() if g: g.close() |
""" | """) | def usage(): sys.stderr.write( "Usage: %s COMMAND\n" % os.path.basename(sys.argv[0])) sys.stderr.write( """ |
except DBLockDeadlockError, e: | except bdb.DBLockDeadlockError, e: | def with_transaction(self, *args, **kwargs): deadlocks = 0 while True: txn = self.env.txn_begin() try: result = method(self, txn, *args, **kwargs) txn.commit() return result except DBLockDeadlockError, e: txn.abort() deadlocks += 1 if deadlocks < retries: self.log.info("Deadlock detected, retrying") continue else: self... |
def list(self): | def list(self, txn): | def list(self): cur = self.db.cursor(txn) try: result = [] current = cur.first() while current is not None: rec = pickle.loads(current[1]) rec['lfn'] = current[0] result.append(rec) current = cur.next() return result finally: cur.close() |
def with_transaction(method): | def with_transaction(method, retries=3): | def with_transaction(method): def with_transaction(self, *args, **kwargs): if len(args)>0 and isinstance(args[0],Database): return method(self, *args, **kwargs) else: txn = self.env.txn_begin() try: result = method(self, txn, *args, **kwargs) txn.commit() return result except: txn.abort() raise return with_transaction |
if len(args)>0 and isinstance(args[0],Database): return method(self, *args, **kwargs) else: | deadlocks = 0 while True: | def with_transaction(self, *args, **kwargs): if len(args)>0 and isinstance(args[0],Database): return method(self, *args, **kwargs) else: txn = self.env.txn_begin() try: result = method(self, txn, *args, **kwargs) txn.commit() return result except: txn.abort() raise |
class CheckpointThread(Thread): | class DatabaseManagerThread(Thread): | def with_transaction(self, *args, **kwargs): if len(args)>0 and isinstance(args[0],Database): return method(self, *args, **kwargs) else: txn = self.env.txn_begin() try: result = method(self, txn, *args, **kwargs) txn.commit() return result except: txn.abort() raise |
self.log = log.get_log("ckpt_thread") | self.log = log.get_log("bdb manager") | def __init__(self, env, interval=300): Thread.__init__(self) self.setDaemon(True) self.log = log.get_log("ckpt_thread") self.env = env self.interval = interval |
if bdb.version() > (4,7): | if hasattr(self.env, "log_set_config"): | def __init__(self, path, name, duplicates=False): self.path = path self.dbpath = os.path.join(self.path, name) if not os.path.isdir(self.path): os.makedirs(self.path) self.env = bdb.DBEnv() self.env.set_tx_max(self.max_txns) self.env.set_lk_max_lockers(self.max_txns*2) self.env.set_lk_max_locks(self.max_txns*2) self.... |
def lookup(self, lfn): cur = self.db.cursor() | @with_transaction def lookup(self, txn, lfn): cur = self.db.cursor(txn) | def delete(self, txn, lfn, pfn=None): cur = self.db.cursor(txn) try: if pfn is None: current = cur.set(lfn) while current is not None: cur.delete() current = cur.next_dup() else: current = cur.set_both(lfn, pfn) if current is not None: cur.delete() finally: cur.close() |
def get(self, lfn): current = self.db.get(lfn) | @with_transaction def get(self, txn, lfn): current = self.db.get(lfn, txn) | def get(self, lfn): current = self.db.get(lfn) if current is not None: return pickle.loads(current) else: return None |
@with_transaction | def remove(self, txn, lfn): self.db.delete(lfn, txn) | |
cur = self.db.cursor() | cur = self.db.cursor(txn) | def list(self): cur = self.db.cursor() try: result = [] current = cur.first() while current is not None: rec = pickle.loads(current[1]) rec['lfn'] = current[0] result.append(rec) current = cur.next() return result finally: cur.close() |
def lookup(lfn): | def lookup(self, conn, lfn): | def lookup(lfn): cur = conn.cursor() cur.execute("select pfn from map where lfn=?",(lfn,)) pfns = [] for row in cur.fetchall(): pfns.append(row['pfn']) cur.close() return pfns |
current = self.db.get(lfn, txn) | current = self.db.get(lfn, None, txn) | def get(self, txn, lfn): current = self.db.get(lfn, txn) if current is not None: return pickle.loads(current) else: return None |
@mockdata.check_http_method def _http_request(self, path, data=None, method=None, **kwargs): | def _http_request(self, path, data=None, method=None): | def __repr__(self): return '<MailmanRESTClient: %s>' % self.host |
:param data: POST, PUT or PATCH data to send | :param data: POST oder PUT data to send | def _http_request(self, path, data=None, method=None, **kwargs): """Send an HTTP request. :param path: the path to send the request to :type path: string :param data: POST, PUT or PATCH data to send :type data: dict :param method: the HTTP method; defaults to GET or POST (if data is not None) :type method: string :ret... |
data = urlencode(data) | data = urlencode(data, doseq=True) headers['Content-type'] = "application/x-www-form-urlencoded" | def _http_request(self, path, data=None, method=None, **kwargs): """Send an HTTP request. :param path: the path to send the request to :type path: string :param data: POST, PUT or PATCH data to send :type data: dict :param method: the HTTP method; defaults to GET or POST (if data is not None) :type method: string :ret... |
if method == 'POST': headers['Content-type'] = "application/x-www-form-urlencoded" | def _http_request(self, path, data=None, method=None, **kwargs): """Send an HTTP request. :param path: the path to send the request to :type path: string :param data: POST, PUT or PATCH data to send :type data: dict :param method: the HTTP method; defaults to GET or POST (if data is not None) :type method: string :ret... | |
def get_member(self, email_address, fqdn_listname): """Return a member object. :param email_adresses: the email address used :type email_address: string :param fqdn_listname: the mailing list :type fqdn_listname: string :return: a member object :rtype: _Member """ return _Member(self.host, email_address, fqdn_listname... | def get_member(self, email_address, fqdn_listname): """Return a member object. :param email_adresses: the email address used :type email_address: string :param fqdn_listname: the mailing list :type fqdn_listname: string :return: a member object :rtype: _Member """ return _Member(self.host, email_address, fqdn_listname... | |
@mockdata.add_list_mock_data | def delete_list(self, list_name): fqdn_listname = list_name + '@' + self.info['email_host'] return self._http_request('/3.0/lists/' + fqdn_listname, None, 'DELETE') | |
def get_member(self, email_address): """Return a member object. :param email_adresses: the email address used :type email_address: string :param fqdn_listname: the mailing list :type fqdn_listname: string :return: a member object :rtype: _Member """ return _Member(self.host, email_address, self.info['fqdn_listname']) ... | def update_config(self, data): """Update the list configuration. :param data: A dict with the config attributes to be updated. :type data: dict :return: the return code of the http request :rtype: integer """ url = '/3.0/lists/%s/config' % self.info['fqdn_listname'] status = self._http_request(url, data, 'PATCH') if s... | def get_members(self): """Get a list of all list members. |
print("-> glob_corr=%f\n" % glob_corr) | print("-> glob_corr={}\n".format(glob_corr)) | def correl_split_weighted( X , Y , segments ): # expects segments = [(0,i1-1),(i1-1,i2-1),(i2,len-1)] correl = list(); interv = list(); # regr. line coeffs and range glob_corr=0 sum_nb_val=0 for (start,stop) in segments: sum_nb_val = sum_nb_val + stop - start; #if start==stop : # return 0 S_XY= cov( X [start:stop+1], ... |
readdata.append( (int(l[1]),float(l[3]) / 2 ) ); | readdata.append( (int(l[1]),float(l[3])) ); | def correl_split( X , Y , segments ): # expects segments = [(0,i1-1),(i1-1,i2-1),(i2,len-1)] correl = list(); interv = list(); # regr. line coeffs and range glob_corr=1 for (start,stop) in segments: #if start==stop : # return 0 S_XY= cov( X [start:stop+1], Y [start:stop+1] ) S_X2 = variance( X [start:stop+1] ) S_Y2 =... |
print("** OPT: [%d .. %d]" % (i,j)) print("** Product of correl coefs = %f" % (max_glob_corr)) | print("** OPT: [%d .. %d] correl coef prod=%f slope: %f x + %f" % (i,j,max_glob_corr,a,b)) | def correl_split( X , Y , segments ): # expects segments = [(0,i1-1),(i1-1,i2-1),(i2,len-1)] correl = list(); interv = list(); # regr. line coeffs and range glob_corr=1 for (start,stop) in segments: #if start==stop : # return 0 S_XY= cov( X [start:stop+1], Y [start:stop+1] ) S_X2 = variance( X [start:stop+1] ) S_Y2 =... |
for i in xrange(n): | for i in range(n): | def cov (X, Y): assert len(X) == len(Y) n = len(X) # n=len(X)=len(Y) avg_X = avg(X) avg_Y = avg(Y) S_XY = 0.0 for i in xrange(n): S_XY += (X[i] - avg_X) * (Y[i] - avg_Y) return (S_XY / n) |
for i in xrange(n): | for i in range(n): | def variance (X): n = len(X) avg_X = avg (X) S_X2 = 0.0 for i in xrange(n): S_X2 += (X[i] - avg_X) ** 2 return (S_X2 / n) |
timings.append(float(l[3]) / links) sizes.append(int(l[1])) | readdata.append( (int(l[1]),float(l[3]) / 2 ) ); sorteddata = sorted( readdata, key=lambda pair: pair[0]) sizes,timings = zip(*sorteddata); | def calibrate (links, latency, bandwidth, sizes, timings): assert len(sizes) == len(timings) if len(sizes) < 2: return None S_XY = cov(sizes, timings) S_X2 = variance(sizes) a = S_XY / S_X2 b = avg(timings) - a * avg(sizes) return (b * 1e-6) / (latency * links), 1e6 / (a * bandwidth) |
for i in xrange(5, len(sys.argv)): limits += [idx for idx in xrange(len(sizes)) if sizes[idx] == int(sys.argv[i])] | for i in range(5, len(sys.argv)): limits += [idx for idx in range(len(sizes)) if sizes[idx] == int(sys.argv[i])] | def calibrate (links, latency, bandwidth, sizes, timings): assert len(sizes) == len(timings) if len(sizes) < 2: return None S_XY = cov(sizes, timings) S_X2 = variance(sizes) a = S_XY / S_X2 b = avg(timings) - a * avg(sizes) return (b * 1e-6) / (latency * links), 1e6 / (a * bandwidth) |
requires=("gtk (>=2.12.0)",), | requires=("gtk",), | def run(self): """Build tarballs and create additional files.""" if os.path.isfile("ChangeLog"): os.remove("ChangeLog") os.system("tools/generate-change-log > ChangeLog") assert os.path.isfile("ChangeLog") assert open("ChangeLog", "r").read().strip() distutils.command.sdist.sdist.run(self) basename = "nfoview-%s" % sel... |
while not lines[-1]: | while lines and not lines[-1]: | def _read_file(self, path, encoding=None): """Read and return the text of the NFO file. |
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) 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 was not given. if (root is not No... |
self.original.tap( x=x, y=y, z=self.z2(z), self.z2(zretract), depth, standoff, dwell_bottom, pitch, stoppos, spin_in, spin_out, tap_mode, direction) | self.original.tap( x, y, self.z2(z), self.z2(zretract), depth, standoff, dwell_bottom, pitch, stoppos, spin_in, spin_out, tap_mode, direction) | def tap(self, x=None, y=None, z=None, zretract=None, depth=None, standoff=None, dwell_bottom=None, pitch=None, stoppos=None, spin_in=None, spin_out=None, tap_mode=None, direction=None): self.original.tap( x=x, y=y, z=self.z2(z), self.z2(zretract), depth, standoff, dwell_bottom, pitch, stoppos, spin_in, spin_out, tap_mo... |
move = False | no_move = True | def Parse(self, name, oname=None): self.files_open(name,oname) #self.begin_ncblock() #self.begin_path(None) #self.add_line(z=500) #self.end_path() #self.end_ncblock() path_col = None f = None arc = 0 |
drill = True; move = False; path_col = "feed"; col = "feed"; | drill = True no_move = True path_col = "feed" col = "feed" | def Parse(self, name, oname=None): self.files_open(name,oname) #self.begin_ncblock() #self.begin_path(None) #self.add_line(z=500) #self.end_path() #self.end_ncblock() path_col = None f = None arc = 0 |
move = False; | no_move = True | def Parse(self, name, oname=None): self.files_open(name,oname) #self.begin_ncblock() #self.begin_path(None) #self.add_line(z=500) #self.end_path() #self.end_ncblock() path_col = None f = None arc = 0 |
drill = True; move = False; | drill = True no_move = True | def Parse(self, name, oname=None): self.files_open(name,oname) #self.begin_ncblock() #self.begin_path(None) #self.add_line(z=500) #self.end_path() #self.end_ncblock() path_col = None f = None arc = 0 |
if (move): | if (move and not no_move): | def Parse(self, name, oname=None): self.files_open(name,oname) #self.begin_ncblock() #self.begin_path(None) #self.add_line(z=500) #self.end_path() #self.end_ncblock() path_col = None f = None arc = 0 |
if direction == "on": return if roll_on == None: return | if direction == "on": roll_on = None | def add_roll_on(k, roll_on_k, direction, roll_radius, offset_extra, roll_on): if direction == "on": return if roll_on == None: return num_spans = kurve.num_spans(k) if num_spans == 0: return if roll_on == 'auto': sp, sx, sy, ex, ey, cx, cy = kurve.get_span(k, 0) vx, vy = kurve.get_span_dir(k, 0, 0) # get start directi... |
if roll_on == 'auto': sp, sx, sy, ex, ey, cx, cy = kurve.get_span(k, 0) | sp, sx, sy, ex, ey, cx, cy = kurve.get_span(k, 0) if roll_on == None: rollstartx = sx rollstarty = sy elif roll_on == 'auto': | def add_roll_on(k, roll_on_k, direction, roll_radius, offset_extra, roll_on): if direction == "on": return if roll_on == None: return num_spans = kurve.num_spans(k) if num_spans == 0: return if roll_on == 'auto': sp, sx, sy, ex, ey, cx, cy = kurve.get_span(k, 0) vx, vy = kurve.get_span_dir(k, 0, 0) # get start directi... |
rollstartx, rollstarty = roll_on sp, sx, sy, ex, ey, cx, cy = kurve.get_span(k, 0) if sx == rollstartx and sy == rollstarty: return vx, vy = kurve.get_span_dir(k, 0, 0) rcx, rcy, rdir = kurve.tangential_arc(sx, sy, -vx, -vy, rollstartx, rollstarty) rdir = -rdir | rollstartx, rollstarty = roll_on if sx == rollstartx and sy == rollstarty: rdir = 0 rcx = 0 rcy = 0 else: vx, vy = kurve.get_span_dir(k, 0, 0) rcx, rcy, rdir = kurve.tangential_arc(sx, sy, -vx, -vy, rollstartx, rollstarty) rdir = -rdir | def add_roll_on(k, roll_on_k, direction, roll_radius, offset_extra, roll_on): if direction == "on": return if roll_on == None: return num_spans = kurve.num_spans(k) if num_spans == 0: return if roll_on == 'auto': sp, sx, sy, ex, ey, cx, cy = kurve.get_span(k, 0) vx, vy = kurve.get_span_dir(k, 0, 0) # get start directi... |
tool_r = tooldiameter / 2 top_r = diameter / 2 | def cone(x_cen, y_cen, z_cen, tool_id, tooldiameter, spindle_speed, horizontal_feedrate, vertical_feedrate, depth, diameter, angle, z_safe, step_over, step_down): | |
comment('tool change') tool_change(id=tool_id) spindle(spindle_speed) feedrate_hv(horizontal_feedrate, vertical_feedrate) | tool_r = tooldiameter / 2 top_r = diameter / 2 | def cone(x_cen, y_cen, z_cen, tool_id, tooldiameter, spindle_speed, horizontal_feedrate, vertical_feedrate, depth, diameter, angle, z_safe, step_over, step_down): |
bottom_r = top_r - (math.tan(angle * math.pi / 180) * depth) | comment('tool change') tool_change(id=tool_id) spindle(spindle_speed) feedrate_hv(horizontal_feedrate, vertical_feedrate) | def cone(x_cen, y_cen, z_cen, tool_id, tooldiameter, spindle_speed, horizontal_feedrate, vertical_feedrate, depth, diameter, angle, z_safe, step_over, step_down): |
if top_r >= bottom_r: top_r = top_r - tool_r bottom_r = bottom_r - tool_r if top_r < bottom_r: top_r = top_r + tool_r bottom_r = bottom_r + tool_r | bottom_r = top_r - (math.tan(angle * math.pi / 180) * depth) | def cone(x_cen, y_cen, z_cen, tool_id, tooldiameter, spindle_speed, horizontal_feedrate, vertical_feedrate, depth, diameter, angle, z_safe, step_over, step_down): |
if bottom_r < 0: bottom_r = bottom_r * -1 depth = depth - (bottom_r / math.tan(angle * math.pi / 180)) bottom_r = 0 | if top_r >= bottom_r: top_r = top_r - tool_r bottom_r = bottom_r - tool_r if top_r < bottom_r: top_r = top_r + tool_r bottom_r = bottom_r + tool_r | def cone(x_cen, y_cen, z_cen, tool_id, tooldiameter, spindle_speed, horizontal_feedrate, vertical_feedrate, depth, diameter, angle, z_safe, step_over, step_down): |
no better idea) cone_feed = (step_down / math.tan(angle * math.pi / 180)) if angle < 0 : cone_feed = cone_feed * -1 flush_nc() | if bottom_r < 0: bottom_r = bottom_r * -1 depth = depth - (bottom_r / math.tan(angle * math.pi / 180)) bottom_r = 0 | def cone(x_cen, y_cen, z_cen, tool_id, tooldiameter, spindle_speed, horizontal_feedrate, vertical_feedrate, depth, diameter, angle, z_safe, step_over, step_down): |
rapid(x=(x_cen + bottom_r), y=y_cen) rapid(z=z_safe) | cone_feed = (step_down / math.tan(angle * math.pi / 180)) if angle < 0 : cone_feed = cone_feed * -1 flush_nc() | def cone(x_cen, y_cen, z_cen, tool_id, tooldiameter, spindle_speed, horizontal_feedrate, vertical_feedrate, depth, diameter, angle, z_safe, step_over, step_down): |
loop_feed = 0 while(loop_feed < depth): loop_feed = loop_feed + step_down if loop_feed >= depth: feed(z=(z_cen - depth)) else: feed(z=(z_cen - loop_feed)) arc_ccw(x=(x_cen - bottom_r), y=y_cen, i= -bottom_r, j=0) arc_ccw(x=(x_cen + bottom_r), y=y_cen, i=bottom_r, j=0) feed(z=z_cen) | rapid(x=(x_cen + bottom_r), y=y_cen) rapid(z=z_safe) | def cone(x_cen, y_cen, z_cen, tool_id, tooldiameter, spindle_speed, horizontal_feedrate, vertical_feedrate, depth, diameter, angle, z_safe, step_over, step_down): |
loop_feed = 0 while(loop_feed < depth): loop_feed = loop_feed + cone_feed if loop_feed >= depth: temp_depth = depth else: temp_depth = loop_feed temp_top_r = bottom_r + (math.tan(angle * math.pi / 180) * temp_depth) | loop_feed = 0 while(loop_feed < depth): loop_feed = loop_feed + step_down if loop_feed >= depth: feed(z=(z_cen - depth)) else: feed(z=(z_cen - loop_feed)) arc_ccw(x=(x_cen - bottom_r), y=y_cen, i= -bottom_r, j=0) arc_ccw(x=(x_cen + bottom_r), y=y_cen, i=bottom_r, j=0) feed(z=z_cen) | def cone(x_cen, y_cen, z_cen, tool_id, tooldiameter, spindle_speed, horizontal_feedrate, vertical_feedrate, depth, diameter, angle, z_safe, step_over, step_down): |
cutcone(x_cen, y_cen, z_cen, temp_top_r, bottom_r, temp_depth, step_over) | loop_feed = 0 while(loop_feed < depth): loop_feed = loop_feed + cone_feed if loop_feed >= depth: temp_depth = depth else: temp_depth = loop_feed temp_top_r = bottom_r + (math.tan(angle * math.pi / 180) * temp_depth) | def cone(x_cen, y_cen, z_cen, tool_id, tooldiameter, spindle_speed, horizontal_feedrate, vertical_feedrate, depth, diameter, angle, z_safe, step_over, step_down): |
rapid(z=z_safe) | cutcone(x_cen, y_cen, z_cen, temp_top_r, bottom_r, temp_depth, step_over) rapid(z=z_safe) | def cone(x_cen, y_cen, z_cen, tool_id, tooldiameter, spindle_speed, horizontal_feedrate, vertical_feedrate, depth, diameter, angle, z_safe, step_over, step_down): |
def cut_curve(curve, need_rapid, p, rapid_down_to_height, final_depth): | def cut_curve(curve, need_rapid, p, rapid_down_to_height, current_start_depth, final_depth): | def cut_curve(curve, need_rapid, p, rapid_down_to_height, final_depth): prev_p = p first = True for vertex in curve.getVertices(): if need_rapid and first: # rapid across rapid(vertex.p.x, vertex.p.y) ##rapid down rapid(z = rapid_down_to_height) #feed down feed(z = final_depth) first = False else: dc = vertex.c - p... |
rapid(z = rapid_down_to_height) | rapid(z = current_start_depth + rapid_down_to_height) | def cut_curve(curve, need_rapid, p, rapid_down_to_height, final_depth): prev_p = p first = True for vertex in curve.getVertices(): if need_rapid and first: # rapid across rapid(vertex.p.x, vertex.p.y) ##rapid down rapid(z = rapid_down_to_height) #feed down feed(z = final_depth) first = False else: dc = vertex.c - p... |
def cut_curvelist(curve_list, rapid_down_to_height, depth, clearance_height, keep_tool_down_if_poss): | def cut_curvelist(curve_list, rapid_down_to_height, current_start_depth, depth, clearance_height, keep_tool_down_if_poss): | def cut_curvelist(curve_list, rapid_down_to_height, depth, clearance_height, keep_tool_down_if_poss): p = area.Point(0, 0) first = True for curve in curve_list: need_rapid = True if first == False: s = curve.FirstVertex().p if keep_tool_down_if_poss == True: # see if we can feed across if feed_possible(p, s): need_rapi... |
p = cut_curve(curve, need_rapid, p, rapid_down_to_height, depth) | p = cut_curve(curve, need_rapid, p, rapid_down_to_height, current_start_depth, depth) | def cut_curvelist(curve_list, rapid_down_to_height, depth, clearance_height, keep_tool_down_if_poss): p = area.Point(0, 0) first = True for curve in curve_list: need_rapid = True if first == False: s = curve.FirstVertex().p if keep_tool_down_if_poss == True: # see if we can feed across if feed_possible(p, s): need_rapi... |
flunkOnFailure=False, | def tools_run_tests(self): self.addStep(ShellCommand( workdir='tools/release/signing', command=['python', 'tests.py'], name='release_signing_tests', )) self.addStep(ShellCommand( workdir='tools/lib/python', env={'PYTHONPATH': WithProperties('%(topdir)s/tools/lib/python')}, name='run_lib_nosetests', command=['nosetests'... | |
./bin/pip install Twisted || exit 1; | ./bin/pip install Twisted==10.1.0 || exit 1; | def createSummary(self, log): self.parent_class.createSummary(self, log) key = 'pylint-%s' % self.project if not self.build.getProperties().has_key(key): self.setProperty(key, {}) props = self.getProperty(key) for msg, fullmsg in self.MESSAGES.items(): props[fullmsg] = self.getProperty('pylint-%s' % fullmsg) props['tot... |
self.addStep(RemovePYCs(workdir=".")) | self.addStep(ShellCommand( name='rm_pyc', command=['find', '.', '-name', '*.pyc', '-exec', 'rm', '-fv', '{}', ';'], workdir=".", )) | def __init__(self, hgHost, **kwargs): self.parent_class = BuildFactory self.parent_class.__init__(self, **kwargs) self.hgHost = hgHost self.addStep(SetProperty(name='set_topdir', command=['pwd'], property='topdir', workdir='.', )) self.addStep(RemovePYCs(workdir=".")) |
'PYTHONPATH': WithProperties('%(topdir)s'), | 'PYTHONPATH': WithProperties('%(topdir)s:%(topdir)s/tools/lib/python'), | def test_masters(self): self.addStep(ShellCommand(name='test_masters', command=['./test-masters.sh', '-8'], env = { 'PYTHONPATH': WithProperties('%(topdir)s'), 'PATH': WithProperties('%(topdir)s/sandbox/bin:/bin:/usr/bin'), }, workdir="buildbot-configs", )) |
flunkOnFailure=False, | def tools_pylint(self): # TODO: move pylintrc to tools self.addStep(PyLintExtended( command='../../../sandbox/bin/pylint --rcfile=../../.pylintrc *', workdir='tools/lib/python', flunkOnFailure=False, name='tools_lib_pylint', project='tools_lib', )) self.addStep(PyLintExtended( command='find buildbot-helpers buildfarm \... | |
else: values[field] = getattr(self, field) values['id'] = self.id return values def _on_change_args(self, args): res = {} values = {} for field, definition in self._fields.iteritems(): if definition['type'] in ('one2many', 'many2many'): values[field] = [x._get_eval() for x in getattr(self, field)] | def _get_eval(self): values = {} for field, definition in self._fields.iteritems(): if definition['type'] in ('one2many', 'many2many'): values[field] = [x.id for x in getattr(self, field) or []] else: values[field] = getattr(self, field) values['id'] = self.id return values | |
setting.EMAIL_SUBJECT_PREFIX + (_("Configuration for %s/%s") % (d['hostname'], d['ip'])), | settings.EMAIL_SUBJECT_PREFIX + (_("Configuration for %s/%s") % (d['hostname'], d['ip'])), | def generate_image(d): """ Generates an image accoording to given configuration. """ logging.debug(repr(d)) if d['imagebuilder'] not in IMAGEBUILDERS: raise Exception("Invalid imagebuilder specified!") x = OpenWrtConfig() x.setUUID(d['uuid']) x.setOpenwrtVersion(d['openwrt_ver']) x.setArch(d['arch']) x.setPortLayout(... |
snr = float(signal) / float(noise) | snr = float(signal) - float(noise) | def process_node(node_ip, ping_results, is_duped, peers, varsize_results): """ Processes a single node. @param node_ip: Node's IP address @param ping_results: Results obtained from ICMP ECHO tests @param is_duped: True if duplicate echos received @param peers: Peering info from routing daemon @param varsize_results: R... |
self.addService('S35', 'misc') self.addService('K35', 'misc') | self.addService('S46', 'misc') self.addService('K46', 'misc') | def __init__(self): """ Class constructor. """ NodeConfig.__init__(self) # Add some basic services self.addService('S35', 'misc') self.addService('K35', 'misc') |
f.write('START=35') f.write('\n') f.write('STOP=35') f.write('\n') | f.write('START=46\n') f.write('STOP=46\n') | def __generateMiscScript(self, f): f.write('#!/bin/sh /etc/rc.common\n') f.write('START=35') f.write('\n') f.write('STOP=35') f.write('\n') f.write('start() {\n') # Prevent the time from reseting to far into the past t = datetime.today() f.write('\tif [ ! -f /etc/datetime.save ]; then\n') f.write('\t echo -n "%02d%02... |
fresh_subnet = pool.allocate_subnet() | fresh_subnet = pool.allocate_subnet(prefix_len) | def save(self, user): """ Completes node registration. """ ip = self.cleaned_data.get('ip') project = self.cleaned_data.get('project') pool = self.cleaned_data.get('pool') subnet = None |
return _("If this is not intentional, it is a bug. Please report it. If it is intentional, please get into a contact with network administrators to arrange new project entry with you own ESSID for you.") | return _("If this is not intentional, it is a bug. Please report it. If it is intentional, please get in contact with network administrators to arrange a new project entry with your own ESSID for you.") | def to_help_string(code): """ A helper method for transforming a warning code to a human readable help string. |
f.write('LinkQualityDijkstraLimit 0 9.0\n') | def __generateOlsrdConfig(self, f): # Subnet configuration if self.subnets: f.write('Hna4\n') f.write('{\n') for subnet in self.subnets: if subnet['olsr'] and subnet['cidr'] < 29: f.write(' %(subnet)s %(mask)s\n' % subnet) f.write('}\n\n') # General configuration (static) f.write('AllowNoInt yes\n') f.write('UseHy... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.