rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
MDiGConfig.MDiGConfig.migration_is_allowed = True | config.MDiGConfig.migration_is_allowed = True | def do_migration(args): if len(args) == 0: MDiGConfig.MDiGConfig.migration_is_allowed = True mdig_config = config.get_config() if not mdig_config.migration_occurred: print "Nothing to migrate within mdig.conf" print "Use 'mdig.py migrate old_repo_dir grassdb' to manually migrate a repository" elif len(args) == 1: impor... |
mdig.repository = ModelRepository.ModelRepository() | mdig.repository = modelrepository.ModelRepository() | def main(argv): global simulations # Do a migration of model repository data if len(argv) > 0 and argv[0] == 'migrate': do_migration(argv[1:]) # Otherwise start up normally mdig_config = config.get_config() logger = setupLogger(mdig_config["LOGGING"]["ansi"]) the_action = process_options(argv) signal.signal(signal.S... |
grass_interface = GRASSInterface.get_g() | grass_interface = grass.get_g() | def main(argv): global simulations # Do a migration of model repository data if len(argv) > 0 and argv[0] == 'migrate': do_migration(argv[1:]) # Otherwise start up normally mdig_config = config.get_config() logger = setupLogger(mdig_config["LOGGING"]["ansi"]) the_action = process_options(argv) signal.signal(signal.S... |
exp = DispersalModel.DispersalModel(model_xml_file, the_action) | exp = model.DispersalModel(model_xml_file, the_action) | def main(argv): global simulations # Do a migration of model repository data if len(argv) > 0 and argv[0] == 'migrate': do_migration(argv[1:]) # Otherwise start up normally mdig_config = config.get_config() logger = setupLogger(mdig_config["LOGGING"]["ansi"]) the_action = process_options(argv) signal.signal(signal.S... |
if GRASSInterface.get_g(False) is not None: GRASSInterface.get_g().clean_up() | if grass.get_g(False) is not None: grass.get_g().clean_up() | def exit_cleanup(): global simulations logger = logging.getLogger("mdig") logger.debug("Cleaning up") for exp in simulations: exp.clean_up() exp.save_model() if GRASSInterface.get_g(False) is not None: GRASSInterface.get_g().clean_up() config.get_config().write() from mdig.WebService import shutdown_webapp shutdown... |
if not row and not params: | if row is None and not params: | def delLocalRoles(self, path=None, row=None, **params): """Delete the specified roles.""" if not path: if not row and not params: self.localRoles.clear() return if not self.localRoles.has_key(path): return if row: try: del self.localRoles[path][row] except (IndexError, TypeError): logger.warning("delLocalRoles error de... |
if row: | if row is not None: | def delLocalRoles(self, path=None, row=None, **params): """Delete the specified roles.""" if not path: if not row and not params: self.localRoles.clear() return if not self.localRoles.has_key(path): return if row: try: del self.localRoles[path][row] except (IndexError, TypeError): logger.warning("delLocalRoles error de... |
(self.context, self.request), name="@@plone_context_state") | (self.context, self.request), name="plone_context_state") | def __call__(self): """""" postback = True form = self.request.form submitted = form.get('form.submitted', False) update_button = form.get('form.button.Update', None) is not None save_button = form.get('form.button.Save', None) is not None cancel_button = form.get('form.button.Cancel', None) is not None if submitted ... |
context = aq_inner(self.context) self.shibpermsplugin().getShibAttrs() | return self.shibpermsplugin().getShibAttrs() | def shibattrs(self): """ """ context = aq_inner(self.context) self.shibpermsplugin().getShibAttrs() |
try: rval = config.keys() except (AttributeError, TypeError): | if hasattr(config, 'keys'): return sorted(config.keys()) else: | def listKeys(self, config): """Return sorted keys of config. """ try: rval = config.keys() except (AttributeError, TypeError): return [] rval.sort() return rval |
rval.sort() return rval | def listKeys(self, config): """Return sorted keys of config. """ try: rval = config.keys() except (AttributeError, TypeError): return [] rval.sort() return rval | |
def __init__(namespace=''): | def __init__(self, namespace=''): | def __init__(namespace=''): self.namespace = namespace and namespace.upper() + '_' or '' |
print "\n=== TEST RESULTS ===" | print "\n=== TEST RESULTS ===\n" print "PATH: %s\n" os.getenv("PATH") | def main(argv=None): if argv is None: args = sys.argv usage = "Usage: ./runtests.py [options]\n\n" + BIG_WARNING parser = optparse.OptionParser(usage=usage) parser.add_option("-l", "--list-tests", action="store_true", dest="list_tests", default=False, help="List tests instead of running them.") parser.add_option("-t"... |
f.write(">\n\t\t<failure><![CDATA[\n") try: test_output = open("%s/test-output.txt" % t.test_name, "r") f.write("%s" % test_output.read()) test_output.close() except IOError: print "Failed to open test output for %s" % t.test_name f.write("\n\t\t]]></failure>\n\t</testcase>\n") | f.write(">\n\t\t<failure />") f.write("\n\t</testcase>\n") | def write_results_xml(self, fn, stdout=False): try: f = open(TEST_RESULTS, "w") except IOError: print "Failed to open test results output file: %s" % TEST_RESULTS return except: print "Unexpected error: %s" % sys.exc_info()[0] return |
print "--> Can not run test '%s'" % t.test_name | print "--> Cannot run test '%s'" % t.test_name print "--- --> Minimum Version: %s (%s)" % \ (str(t.minversion), str(t.minversion_check)) if t.maxversion is not None: print "--- --> Maximum Version: %s (%s)" % \ (str(t.maxversion), str(t.maxversion_check)) | def run(self, ast_version): test_suite_dir = os.getcwd() |
sys.stdout.write("--> %s --- " % t.test_name) | def main(argv=None): if argv is None: args = sys.argv usage = "Usage: ./runtests.py [options]\n\n" + BIG_WARNING parser = optparse.OptionParser(usage=usage) parser.add_option("-l", "--list-tests", action="store_true", dest="list_tests", default=False, help="List tests instead of running them.") (options, args) = pars... | |
if t.skip: | if t.skip is not None: | def run(self): test_suite_dir = os.getcwd() |
t.time = time.time() - start_time self.total_time += t.time | def run(self, ast_version): test_suite_dir = os.getcwd() | |
self.install_configs(os.getcwd() + "/tests/configs") | self.install_configs(os.getcwd() + "/configs") | def __init__(self, base=None, ast_conf_options=None): """Construct an Asterisk instance. |
f.write("[%s]\n\n" % c.name) | f.write("[%s]\n" % c.name) | def __gen_ast_conf(self, ast_conf, dir_cat, ast_conf_options): for (var, val) in dir_cat.options: if var == "astetcdir": self.astetcdir = "%s%s" % (self.base, val) os.makedirs(self.astetcdir) |
if not ast_conf_options or "nocolor" not in ast_conf_options: f.write("nocolor = yes\n") | def __gen_ast_conf(self, ast_conf, dir_cat, ast_conf_options): for (var, val) in dir_cat.options: if var == "astetcdir": self.astetcdir = "%s%s" % (self.base, val) os.makedirs(self.astetcdir) | |
help_output = subprocess.POPEN(['pjsua', '--help'],stdout=PIPE).communicate() | help_output = subprocess.Popen(['pjsua', '--help'], stdout=PIPE).communicate()[0] | def depend_pjsuav6(self): ''' This tests if pjsua was compiled with IPv6 support. To do this, we run pjsua --help and parse the output to determine if --ipv6 is a valid option ''' if self.__which('pjsua') is None: return False |
for (vbo, data, length) in self._vbos: | for surface in self._vbos: vbo = surface.update length = surface.important | def paint(self): """ For all of the known terrain, render whatever faces are exposed. """ if self._texture is None: self._texture = self._createTexture() |
array([ [x + 1, y + 1, z + 0, s + e, t], [x + 0, y + 1, z + 0, s + 0, t], [x + 0, y + 1, z + 1, s + 0, t + e], [x + 1, y + 1, z + 0, s + e, t], [x + 1, y + 1, z + 1, s + e, t + e], [x + 0, y + 1, z + 1, s + 0, t + e], | array([x, y, z, s, t], 'f') + array([ [1, 1, 0, e, 0], [0, 1, 0, 0, 0], [0, 1, 1, 0, e], [1, 1, 0, e, 0], [1, 1, 1, e, e], [0, 1, 1, 0, e], [0, 1, 1, e, 0], [0, 0, 1, 0, 0], [1, 0, 1, 0, e], [0, 1, 1, e, 0], [1, 1, 1, e, e], [1, 0, 1, 0, e], [0, 0, 1, e, 0], [0, 0, 0, 0, 0], [1, 0, 0, 0, e], [0, 0, 1, e, 0],... | def test_existingTerrain(self): """ When terrain already exists when L{SurfaceMesh} is constructed, the surface mesh for that terrain is computed immediately. """ x, y, z = 3, 2, 1 terrain = Terrain() terrain.set(x, y, z, loadTerrainFromString("M")) surface = SurfaceMesh(terrain, self.texCoords, self.e) s, t = self.tex... |
self.assertEquals(surface.important, 6) | self.assertEquals(surface.important, 36) | def test_existingTerrain(self): """ When terrain already exists when L{SurfaceMesh} is constructed, the surface mesh for that terrain is computed immediately. """ x, y, z = 3, 2, 1 terrain = Terrain() terrain.set(x, y, z, loadTerrainFromString("M")) surface = SurfaceMesh(terrain, self.texCoords, self.e) s, t = self.tex... |
glTranslate(-0.5, 1, -0.5) | glTranslate(-0.5, 0, -0.5) | def paint(self): glPushMatrix() |
try: self.surface[pos:pos + len(vertices)] = vertices except: print pos print self.surface.shape print vertices raise | self.surface[pos:pos + len(vertices)] = vertices | def _append(self, key, vertices): pos = self.important try: self.surface[pos:pos + len(vertices)] = vertices except: print pos print self.surface.shape print vertices raise self._voxelToSurface[key] = (pos, len(vertices)) self.important += len(vertices) |
simulation = self.getSimulationTime(2, self.clock) self.clock.advance(1.0) self.assertEquals(simulation.seconds(), 1.0) | simulation = self.simulation self.clock.advance(simulation.granularity * 2) self.assertEquals(simulation.seconds(), simulation.granularity * 2) | def test_framedrop(self): """ If the platform clock jumps forward by more than a granule, the simulation time updates by the same amount as if the platform clock had advanced more smoothly. """ simulation = self.getSimulationTime(2, self.clock) self.clock.advance(1.0) self.assertEquals(simulation.seconds(), 1.0) |
Send L{NewCommand} commands to this client for each existing L{Player} in the L{World}. | Send L{NewPlayer} commands to this client for each existing L{Player} in the L{World}. | def sendExistingPlayers(self): """ Send L{NewCommand} commands to this client for each existing L{Player} in the L{World}. """ for player in self.world.getPlayers(): if player is not self.player: self.notifyPlayerCreated(player) player.addObserver(self) self.world.addObserver(self) |
except KeyError, why: | except IndexError, why: | def width(self): """Returns the width of the Dataset.""" try: return len(self._data[0]) except KeyError, why: return 0 |
packages=['tablib'm 'tablib.formats'], | packages=['tablib', 'tablib.formats'], | def publish(): """Publish to PyPi""" os.system("python setup.py sdist upload") |
result["_row"] = self._row result["tags"] = self.tags | result['_row'] = self._row result['tags'] = self.tags | def __getstate__(self): |
self._row = state["_row"] self.tags = state["tags"] | self._row = state['_row'] self.tags = state['tags'] | def __setstate__(self, state): |
dset_sheet(dataset, ws) | dset_sheet(dset, ws) | def export_book(databook): """Returns XLS representation of DataBook.""" wb = xlwt.Workbook(encoding='utf8') for i, dset in enumerate(databook._datasets): ws = wb.add_sheet(dset.title if dset.title else 'Sheet%s' % (i)) dset_sheet(dataset, ws) stream = cStringIO.StringIO() wb.save(stream) return stream.getvalue() ... |
'tablib.packages.simplejson' | 'tablib.packages.simplejson', | def publish(): """Publish to PyPi""" os.system("python setup.py sdist upload") |
def __init__(self, sets=[]): | def __init__(self, sets=None): if sets is None: self._datasets = list() else: self._datasets = sets | def __init__(self, sets=[]): self._datasets = sets self._register_formats() |
version='0.8.5', | version='0.9.0', | def publish(): """Publish to PyPi""" os.system("python setup.py sdist upload") |
assert data.width == len(new_row) | self.assertTrue(data.width == len(new_row)) def test_empty_append_with_headers(self): data = tablib.Dataset() data.headers = ['first', 'second'] new_row = (1,2,3,4) | def test_empty_append(self): data = tablib.Dataset() new_row = (1,2,3) data.append(new_row) assert data.width == len(new_row) |
self.assertRaises(tablib.InvalidDimensions, data.append, new_row) | def test_empty_append(self): data = tablib.Dataset() new_row = (1,2,3) data.append(new_row) assert data.width == len(new_row) | |
self._datasets = sets | def __init__(self, sets=None): | |
_dset._data[:] = [row for row in self._data if row.has_tag(tag)] | _dset._data = [row for row in _dset._data if row.has_tag(tag)] | def filter(self, tag): """Returns a new instance of the :class:`Dataset`, excluding any rows that do not contain the given :ref:`tags <tags>`. """ _dset = copy(self) _dset._data[:] = [row for row in self._data if row.has_tag(tag)] return _dset |
if indicator.get_icon() == 'redshift': | if indicator.get_icon() == 'redshift-status-on': | def toggle_cb(widget, data=None): process.send_signal(signal.SIGUSR1) if appindicator: if indicator.get_icon() == 'redshift': indicator.set_icon('redshift-status-off') else: indicator.set_icon('redshift-status-on') else: if status_icon.get_icon_name() == 'redshift': status_icon.set_from_icon_name('redshift-status-off')... |
if status_icon.get_icon_name() == 'redshift': status_icon.set_from_icon_name('redshift-status-off') | if status_icon.get_icon_name() == 'redshift-status-on': status_icon.set_from_icon_name('redshift-status-off') | def toggle_cb(widget, data=None): process.send_signal(signal.SIGUSR1) if appindicator: if indicator.get_icon() == 'redshift': indicator.set_icon('redshift-status-off') else: indicator.set_icon('redshift-status-on') else: if status_icon.get_icon_name() == 'redshift': status_icon.set_from_icon_name('redshift-status-off')... |
self.tableFile = impl.createDocument(None, "xeps", None) | self.botsfile = impl.createDocument(None, "xeps", None) | def __init__(self, filename, shortXMLfilename): self.filename = filename self.shortXMLfilename = shortXMLfilename try: self.tableFile = parse(filename) except: impl = getDOMImplementation() self.tableFile = impl.createDocument(None, "table", None) self.tableFile.getElementsByTagName("table")[0].setAttribute("class", "... |
self.tableFile.getElementsByTagName("xeps")[0].normalize() f.write(self.tableFile.toxml()) | self.botsFile.getElementsByTagName("xeps")[0].normalize() f.write(self.botsFile.toxml()) | def save(self): f = open(self.filename, "wb") self.tableFile.getElementsByTagName("table")[0].normalize() f.write(self.tableFile.toxml()) f.close() f = open(self.shortXMLfilename, "wb") self.tableFile.getElementsByTagName("xeps")[0].normalize() f.write(self.tableFile.toxml()) f.close() |
nr = re.match("xep-(\d\d\d\d).xml", file).group(1) xepfilepath = getLatestXEPContent("", nr); if not xepfilepath: print "getLatestXEPContent (ERROR)" return files_to_delete.append(xepfilepath) | nr = re.match("xep-(\d\d\d\d).xml", filename).group(1) xepfilepath = getLatestXEPContent("", nr); if not xepfilepath: print "getLatestXEPContent (ERROR)" return files_to_delete.append(xepfilepath) | def buildXEP( filename ): nr = re.match("xep-(\d\d\d\d).xml", file).group(1) xepfilepath = getLatestXEPContent("", nr); if not xepfilepath: print "getLatestXEPContent (ERROR)" return files_to_delete.append(xepfilepath) if not fast: print "Building " + filename + ": ", if buildXHTML( xepfilepath, nr ): print "XHTML(OK)... |
xep.appendChild(child.getElementsByTagName("number")) | xep.appendChild(child.getElementsByTagName("number")[0]) | def setXEP(self, info): ## set for HTML table rows = self.tableFile.getElementsByTagName("tr") xeprow = 0 for row in rows: if row.getAttribute("id") == "xep" + info.getNr(): xeprow = row break if xeprow == 0: xeprow = self.tableFile.createElement("tr") self.tableFile.getElementsByTagName("table")[0].appendChild(xeprow... |
xep.appendChild(child.getElementsByTagName("name")) | xep.appendChild(child.getElementsByTagName("name")[0]) | def setXEP(self, info): ## set for HTML table rows = self.tableFile.getElementsByTagName("tr") xeprow = 0 for row in rows: if row.getAttribute("id") == "xep" + info.getNr(): xeprow = row break if xeprow == 0: xeprow = self.tableFile.createElement("tr") self.tableFile.getElementsByTagName("table")[0].appendChild(xeprow... |
xep.appendChild(child.getElementsByTagName("type")) | xep.appendChild(child.getElementsByTagName("type")[0]) | def setXEP(self, info): ## set for HTML table rows = self.tableFile.getElementsByTagName("tr") xeprow = 0 for row in rows: if row.getAttribute("id") == "xep" + info.getNr(): xeprow = row break if xeprow == 0: xeprow = self.tableFile.createElement("tr") self.tableFile.getElementsByTagName("table")[0].appendChild(xeprow... |
xep.appendChild(child.getElementsByTagName("status")) | xep.appendChild(child.getElementsByTagName("status")[0]) | def setXEP(self, info): ## set for HTML table rows = self.tableFile.getElementsByTagName("tr") xeprow = 0 for row in rows: if row.getAttribute("id") == "xep" + info.getNr(): xeprow = row break if xeprow == 0: xeprow = self.tableFile.createElement("tr") self.tableFile.getElementsByTagName("table")[0].appendChild(xeprow... |
xep.appendChild(child.getElementsByTagName("updated")) | xep.appendChild(child.getElementsByTagName("updated")[0]) | def setXEP(self, info): ## set for HTML table rows = self.tableFile.getElementsByTagName("tr") xeprow = 0 for row in rows: if row.getAttribute("id") == "xep" + info.getNr(): xeprow = row break if xeprow == 0: xeprow = self.tableFile.createElement("tr") self.tableFile.getElementsByTagName("table")[0].appendChild(xeprow... |
xep.appendChild(child.getElementsByTagName("shortname")) | xep.appendChild(child.getElementsByTagName("shortname")[0]) | def setXEP(self, info): ## set for HTML table rows = self.tableFile.getElementsByTagName("tr") xeprow = 0 for row in rows: if row.getAttribute("id") == "xep" + info.getNr(): xeprow = row break if xeprow == 0: xeprow = self.tableFile.createElement("tr") self.tableFile.getElementsByTagName("table")[0].appendChild(xeprow... |
xep.appendChild(child.getElementsByTagName("abstract")) | xep.appendChild(child.getElementsByTagName("abstract")[0]) | def setXEP(self, info): ## set for HTML table rows = self.tableFile.getElementsByTagName("tr") xeprow = 0 for row in rows: if row.getAttribute("id") == "xep" + info.getNr(): xeprow = row break if xeprow == 0: xeprow = self.tableFile.createElement("tr") self.tableFile.getElementsByTagName("table")[0].appendChild(xeprow... |
self.botsfile = impl.createDocument(None, "xeps", None) | self.botsFile = impl.createDocument(None, "xeps", None) | def __init__(self, filename, shortXMLfilename): self.filename = filename self.shortXMLfilename = shortXMLfilename try: self.tableFile = parse(filename) except: impl = getDOMImplementation() self.tableFile = impl.createDocument(None, "table", None) self.tableFile.getElementsByTagName("table")[0].setAttribute("class", "... |
shortnameNode = (headerNode.getElementsByTagName("shortname")[0]) | shortnameNode = headerNode.getElementsByTagName("shortname") | def __init__(self, filename, parseStr): thexep = "" if parseStr: thexep = parseString(filename) else: thexep = parse(filename) xepNode = (thexep.getElementsByTagName("xep")[0]) headerNode = (xepNode.getElementsByTagName("header")[0]) titleNode = (headerNode.getElementsByTagName("title")[0]) self.title = getText(titleNo... |
self.shortname = getText(shortnameNode.childNodes) | self.shortname = getText((shortnameNode[0]).childNodes) | def __init__(self, filename, parseStr): thexep = "" if parseStr: thexep = parseString(filename) else: thexep = parse(filename) xepNode = (thexep.getElementsByTagName("xep")[0]) headerNode = (xepNode.getElementsByTagName("header")[0]) titleNode = (headerNode.getElementsByTagName("title")[0]) self.title = getText(titleNo... |
print "Invalid line : %s" % username | print "Invalid line: %s" % line | def importUsers(self): """Import users from CSV file. |
return (val is None) and None or self.get_method(val)(*self.args, **self.kwargs) | if val is None: return None return self.get_method(val)(*self.args, **self.kwargs) | def get_value(self): obj = self.field.proxied_args['ObjectArg'] val = utils.resolve_dotted_attribute(obj, self.field.model_field_name) |
kwargs["formset"] = BaseModelForm | kwargs["form"] = ModelForm | def modelform_factory(*args, **kwargs): """Changed modelform_factory function, where we use our own formfield_callback""" kwargs["formfield_callback"] = formfield_function kwargs["formset"] = BaseModelForm return models.modelform_factory(*args, **kwargs) |
def formfield_function(field): | def formfield_function(field, **kwargs): | def formfield_function(field): """ Custom formfield function, so we can inject our own form fields. The mapping of model fields to form fields is defined in 'MODEL_TO_FORM_FIELD_MAP'. It uses the default django mapping as fallback, if there is no match in our custom map. field -- a model field """ for field_map in MOD... |
return field.formfield() | return field.formfield(**kwargs) | def formfield_function(field): """ Custom formfield function, so we can inject our own form fields. The mapping of model fields to form fields is defined in 'MODEL_TO_FORM_FIELD_MAP'. It uses the default django mapping as fallback, if there is no match in our custom map. field -- a model field """ for field_map in MOD... |
def __init__(self, attrs=None, choices=()): | def __init__(self, *args, **kwargs): | def __init__(self, attrs=None, choices=()): if dojo_config.version < '1.3': self.alt_require = 'dijit.form.CheckBox' super(RadioSelect, self).__init__(attrs, choices) |
super(RadioSelect, self).__init__(attrs, choices) | super(RadioSelect, self).__init__(*args, **kwargs) | def __init__(self, attrs=None, choices=()): if dojo_config.version < '1.3': self.alt_require = 'dijit.form.CheckBox' super(RadioSelect, self).__init__(attrs, choices) |
DEFAULT_DATE_INPUT_FORMATS = tuple(list(fields.DEFAULT_DATE_INPUT_FORMATS) + [ | dj_settings.DATE_INPUT_FORMATS = tuple(list(dj_settings.DATE_INPUT_FORMATS) + [ | def widget_attrs(self, widget): """Called, when the field is instanitating the widget. Here we collect all field attributes and pass it to the attributes of the widgets using the 'extra_field_attrs' key. These additional attributes will be evaluated by the widget and deleted within the 'DojoWidgetMixin'. """ ret = {'ex... |
kwargs['input_formats'] = input_formats or DEFAULT_DATE_INPUT_FORMATS | kwargs['input_formats'] = input_formats or formats.get_format('DATE_INPUT_FORMATS') | def __init__(self, input_formats=None, min_value=None, max_value=None, *args, **kwargs): kwargs['input_formats'] = input_formats or DEFAULT_DATE_INPUT_FORMATS self.max_value = max_value self.min_value = min_value super(DateField, self).__init__(*args, **kwargs) |
DEFAULT_TIME_INPUT_FORMATS = tuple(list(fields.DEFAULT_TIME_INPUT_FORMATS) + [ | dj_settings.TIME_INPUT_FORMATS = tuple(list(dj_settings.TIME_INPUT_FORMATS) + [ | def __init__(self, input_formats=None, min_value=None, max_value=None, *args, **kwargs): kwargs['input_formats'] = input_formats or DEFAULT_DATE_INPUT_FORMATS self.max_value = max_value self.min_value = min_value super(DateField, self).__init__(*args, **kwargs) |
kwargs['input_formats'] = input_formats or DEFAULT_TIME_INPUT_FORMATS | kwargs['input_formats'] = input_formats or formats.get_format('TIME_INPUT_FORMATS') | def __init__(self, input_formats=None, min_value=None, max_value=None, *args, **kwargs): kwargs['input_formats'] = input_formats or DEFAULT_TIME_INPUT_FORMATS self.max_value = max_value self.min_value = min_value super(TimeField, self).__init__(*args, **kwargs) |
release_dir = os.path.abspath(os.path.join(self.dojo_release_dir, "../")) + os.path.sep | if settings.DOJO_BUILD_USED_VERSION < '1.2.0': release_dir = release_dir + os.path.sep | def handle(self, *args, **options): if len(args)==0: # with no param, we use the default profile, that is defined in the settings profile_name = settings.DOJO_BUILD_PROFILE else: profile_name = args[0] profile = self._get_profile(profile_name) used_src_version = profile['used_src_version'] % {'DOJO_BUILD_VERSION': sett... |
def __init__(self, attrs=None): | def __init__(self, attrs=None, choices=()): | def __init__(self, attrs=None): if dojo_config.version < '1.3': self.alt_require = 'dijit.form.CheckBox' super(RadioSelect, self).__init__(attrs) |
super(RadioSelect, self).__init__(attrs) | super(RadioSelect, self).__init__(attrs, choices) | def __init__(self, attrs=None): if dojo_config.version < '1.3': self.alt_require = 'dijit.form.CheckBox' super(RadioSelect, self).__init__(attrs) |
stdin, stdout, stderr = os.popen3(settings.DOJO_BUILD_JAVA_EXEC) if stderr.read(): | try: subprocess.call(settings.DOJO_BUILD_JAVA_EXEC, stdout=subprocess.PIPE) except: | def handle(self, *args, **options): if len(args)==0: # with no param, we use the default profile, that is defined in the settings profile_name = settings.DOJO_BUILD_PROFILE else: profile_name = args[0] profile = self._get_profile(profile_name) used_src_version = profile['used_src_version'] % {'DOJO_BUILD_VERSION': sett... |
if opts.has_key('search'): opts['search_fields'] = ",".join(opts['search']) | if opts.has_key('search'): opts['search_fields'] = ",".join(opts['search']) opts['show_search'] = opts.get('show_search', True) else: opts['show_search'] = False | def render(self, context): opts = {} global disp_list_guid disp_list_guid = disp_list_guid + 1 # add dojo modules add_module("dojox.data.QueryReadStore") add_module("dojox.grid.DataGrid") # Setable options, not listed: label, query, search, nosort if self.model: opts['list_display'] = [x.attname for x in self.model._m... |
fontName = pango.FontDescription("Misc Fixed,Courier Bold 9") | fontName = get_fixed_font() | def __create_text(self, callback): scrolled_window = gtk.ScrolledWindow() scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) scrolled_window.set_shadow_type(gtk.SHADOW_IN) text_view = gtk.TextView() fontName = pango.FontDescription("Misc Fixed,Courier Bold 9") text_view.modify_font(fontName) scroll... |
fontName = pango.FontDescription("Misc Fixed,Courier Bold 9") | fontName = get_fixed_font() | def __new_text_view(self): text_view = gtk.TextView() text_view.set_border_width(4) fontName = pango.FontDescription("Misc Fixed,Courier Bold 9") text_view.modify_font(fontName) return text_view |
count = (self.amp_chs & 1) + ((self.amp_chs >> 1) & 1) return idx >= self.amp_idx and idx < self.amp_idx + count | if not self.amp_chs is None: count = (self.amp_chs & 1) + ((self.amp_chs >> 1) & 1) return idx >= self.amp_idx and idx < self.amp_idx + count else: return False | def amp_index_match(self, idx): count = (self.amp_chs & 1) + ((self.amp_chs >> 1) & 1) return idx >= self.amp_idx and idx < self.amp_idx + count |
ampcaps.nsteps = self.steps | ampcaps.nsteps = self.nsteps | def clone(self, ampcaps): ampcaps.ofs = self.ofs ampcaps.nsteps = self.steps ampcaps.stepsize = self.stepsize ampcaps.mute = self.mute ampcaps.cloned = True |
if lines[idx].startswith('Default PCM:'): | if idx < len(lines) and lines[idx].startswith('Default PCM:'): | def writeval(str, idx, var): res, val = self.decodeintw(str, var + '=') if val: self.proc_gpio[var] |= 1 << idx else: self.proc_gpio[var] &= ~(1 << idx) return res |
return 2, self.proc_afg | return 1, self.proc_mfg | def get_sub_nodes(self, nid): if nid == AC_NODE_ROOT: if self.proc_mfg >= 0: return 2, self.proc_afg return 1, self.proc_afg elif nid == self.proc_afg: if self.proc_nids: return len(self.proc_nids), self.proc_nids.keys()[0] return 0, 0 elif nid is None: return 0, 0 raise ValueError, "unimplemented get_sub_nodes(0x%x)" ... |
if sys.argv[1] in ('-h', '-help', '--help'): | if len(sys.argv) > 1 and sys.argv[1] in ('-h', '-help', '--help'): | def main(): if sys.argv[1] in ('-h', '-help', '--help'): print __doc__ % globals() sys.exit(0) if read_nodes(sys.argv[1:]) == 0: print "No HDA codecs were found or insufficient priviledges for " print "/dev/snd/controlC* and /dev/snd/hwdepC*D* device files." print print "You may also check, if you compiled HDA driver w... |
self.gpio.revert() | if not self.gpio is None: self.gpio.revert() | def revert(self): self.gpio.revert() for nid in self.nodes: self.nodes[nid].revert() |
if self.gpio: | if not self.gpio is None: | def reread(self): if self.gpio: self.gpio.reread() for node in self.nodes: self.nodes[node].reread() |
self.proc_gpio[var] |= 1 << idx | if val: self.proc_gpio[var] |= 1 << idx else: self.proc_gpio[var] &= ~(1 << idx) | def writeval(str, idx, var): res, val = self.decodeintw(str, var + '=') self.proc_gpio[var] |= 1 << idx return res |
if self.channels != idx or self.record.p == None: | if self.channels != idx or self.record_p == None: | def __channels_change(self, button, idx): if self.channels != idx or self.record.p == None: self.set_text('Switching to record...') self.channels = idx self.generate_cleanup() self.record_cleanup() self.record_sound() |
shell=False, bufsize=0, stdin=PIPE, stdout=PIPE, stderr=PIPE, | shell=False, bufsize=0, stdin=None, stdout=PIPE, stderr=PIPE, | def generate_sound(self): self.set_status('Playing sound #%s on channel %s...' % \ (self.generate_num, CHANNELS[self.channel])) self.generate_num += 1 channels = 2 if self.channel >= 6: channels = 8 elif self.channel >= 4: channels = 6 elif self.channel >= 2: channels = 4 self.cmd = ["speaker-test", "-D", self.device, ... |
shell=False, bufsize=0, stdin=PIPE, stdout=PIPE, stderr=PIPE, | shell=False, bufsize=0, stdin=None, stdout=PIPE, stderr=PIPE, | def record_sound(self): self.set_status('Recording sound - %s channels...' % self.channels) self.cmd = ["arecord", "-D", self.device, "-f", "dat", "-c", str(self.channels), "-t", "raw", "-vvv", "/dev/null"] p = Popen(self.cmd, shell=False, bufsize=0, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) for fd in [p.st... |
if not self.afg: return str | if self.afg is None: return str | def print_amp_caps(caps): if caps.ofs == None: return "N/A\n" return "ofs=0x%02x, nsteps=0x%02x, stepsize=0x%02x, mute=%x\n" % \ (caps.ofs, caps.nsteps, caps.stepsize, caps.mute and 1 or 0) |
print "properties_func_default called" | def properties_func_default(shape, saved_attrs): print "properties_func_default called" attr_list = copy.copy(shape.attr[0]) attr_dict = copy.copy(shape.attr[1]) attr_list.extend(saved_attrs[0]) attr_dict.update(saved_attrs[1]) color = attr_dict.get("color", None) color = _ds9_to_mpl_colormap.get(color, color) if s... | |
print "as_mpl_artists shape: ",shape | def as_mpl_artists(shape_list, properties_func=None, text_offset=5.0): """ Converts a region list to a list of patches and a list of artists. Optional Keywords: [ text_offset ] - If there is text associated with the regions, add some vertical offset (in pixels) to the text so that it doesn't overlap with the regions.... | |
xspacing = default_spacing(self.ax, 'x').todegrees() | xspacing = default_spacing(self.ax, 'x', self.ax.xaxis.apl_label_form).todegrees() | def _update(self, *args): |
yspacing = default_spacing(self.ax, 'y').todegrees() | yspacing = default_spacing(self.ax, 'y', self.ax.yaxis.apl_label_form).todegrees() | def _update(self, *args): |
kwargs = {'refresh':False} self._update(*args, **kwargs) @auto_refresh def _update(self, *args): | def _update_norefresh(self, *args): kwargs = {'refresh':False} self._update(*args, **kwargs) | |
markersize=int(attr_dict.get("size", 1)), | markersize=int(attr_dict.get("size", 6)), | def properties_func_default(shape, saved_attrs): attr_list = copy.copy(shape.attr[0]) attr_dict = copy.copy(shape.attr[1]) attr_list.extend(saved_attrs[0]) attr_dict.update(saved_attrs[1]) color = attr_dict.get("color", None) color = _ds9_to_mpl_colormap.get(color, color) if shape.name == "text": kwargs = dict(col... |
if not np.equal(None): | if not np.equal(vmid, None): | def __init__(self, stretch='linear', exponent=5, vmid=None, vmin=None, vmax=None, clip=False): ''' Initalize an APLpyNormalize instance. |
if not np.equal(vmid, None): | if stretch == 'power' and np.equal(self.exponent, None): raise Exception("For stretch=='power', an exponent should be specified") if np.equal(vmid, None): if stretch == 'log': self.midpoint = 0.05 elif stretch == 'arcsinh': self.midpoint = -0.033 else: self.midpoint = None else: | def __init__(self, stretch='linear', exponent=5, vmid=None, vmin=None, vmax=None, clip=False): ''' Initalize an APLpyNormalize instance. |
else: self.midpoint = None | def __init__(self, stretch='linear', exponent=5, vmid=None, vmin=None, vmax=None, clip=False): ''' Initalize an APLpyNormalize instance. | |
if np.equal(self.midpoint, None): self.midpoint = 0.05 | def __call__(self, value, clip=None): | |
if np.equal(self.midpoint, None): self.midpoint = -0.033 | def __call__(self, value, clip=None): | |
BPA if present) | BPA if present) in the anticlockwise direction. | def show(self, major='BMAJ', minor='BMIN', \ angle='BPA', corner='bottom left', frame=False, borderpad=0.4, pad=0.5, **kwargs): |
width=major, height=minor, angle=angle, \ | width=minor, height=major, angle=angle, \ | def show(self, major='BMAJ', minor='BMIN', \ angle='BPA', corner='bottom left', frame=False, borderpad=0.4, pad=0.5, **kwargs): |
self._update(*args, refresh=False) | kwargs = {'refresh':False} self._update(*args, **kwargs) | def _update_norefresh(self, *args): self._update(*args, refresh=False) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.