code stringlengths 1 18.2k |
|---|
def put_connection_filename(filename, working_filename, verbose = False): """ This function reverses the effect of a previous call to get_connection_filename(), restoring the working copy to its original location if the two are different. This function should always be called after calling get_connection_filename() whe... |
meaning any other scratch files that might be in use get deleted and the current process is terminated. """ if working_filename != filename: # initialize SIGTERM and SIGTSTP trap deferred_signals = [] def newsigterm(signum, frame): deferred_signals.append(signum) oldhandlers = {} for sig in (signal.SIGTERM, signal.SIGT... |
find a # better way to shut TemporaryFile up try: open(working_filename, "w").close() except: pass with temporary_files_lock: del temporary_files[working_filename] # restore original handlers, and send ourselves any trapped signals # in order for sig, oldhandler in oldhandlers.iteritems(): signal.signal(sig, oldhandler... |
def discard_connection_filename(filename, working_filename, verbose = False): """ Like put_connection_filename(), but the working copy is simply deleted instead of being copied back to its original location. This is a useful performance boost if it is known that no modifications were made to the file, for example if qu... |
temporary files in place, remove the # temporary-file signal traps if not temporary_files: uninstall_signal_trap() |
def idmap_sync(connection): """ Iterate over the tables in the database, ensure that there exists a custom DBTable class for each, and synchronize that table's ID generator to the ID values in the database. """ xmldoc = get_xml(connection) for tbl in xmldoc.getElementsByTagName(DBTable.tagName): tbl.sync_next_id() xmld... |
def idmap_get_new(connection, old, tbl): """ From the old ID string, obtain a replacement ID string by either grabbing it from the _idmap_ table if one has already been assigned to the old ID, or by using the current value of the Table instance's next_id class attribute. In the latter case, the new ID is recorded in th... |
in _idmap_ table, assign a new ID and # record it new = tbl.get_next_id() cursor.execute("INSERT INTO _idmap_ VALUES (?, ?)", (old, new)) return new |
def idmap_get_max_id(connection, id_class): """ Given an ilwd:char ID class, return the highest ID from the table for whose IDs that is the class. Example: >>> event_id = ilwd.ilwdchar("sngl_burst:event_id:0") >>> print event_id sngl_inspiral:event_id:0 >>> max_id = get_max_id(connection, type(event_id)) >>> print max_... |
def get_table_names(connection): """ Return a list of the table names in the database. """ cursor = connection.cursor() cursor.execute("SELECT name FROM sqlite_master WHERE type == 'table'") return [name for (name,) in cursor] |
def get_column_info(connection, table_name): """ Return an in order list of (name, type) tuples describing the columns in the given table. """ cursor = connection.cursor() cursor.execute("SELECT sql FROM sqlite_master WHERE type == 'table' AND name == ?", (table_name,)) statement, = cursor.fetchone() coldefs = re.match... |
def get_xml(connection, table_names = None): """ Construct an XML document tree wrapping around the contents of the database. On success the return value is a ligolw.LIGO_LW element containing the tables as children. Arguments are a connection to to a database, and an optional list of table names to dump. If table_name... |
type column_type = ligolwtypes.FromSQLiteType[column_type] table_elem.appendChild(table.Column(AttributesImpl({u"Name": u"%s:%s" % (table_name, column_name), u"Type": column_type}))) table_elem._end_of_columns() table_elem.appendChild(table.TableStream(AttributesImpl({u"Name": u"%s:table" % table_name, u"Delimiter": ta... |
def build_indexes(connection, verbose = False): """ Using the how_to_index annotations in the table class definitions, construct a set of indexes for the database at the given connection. """ cursor = connection.cursor() for table_name in get_table_names(connection): # FIXME: figure out how to do this extensibly if tab... |
def use_in(ContentHandler): """ Modify ContentHandler, a sub-class of pycbc_glue.ligolw.LIGOLWContentHandler, to cause it to use the DBTable class defined in this module when parsing XML documents. Instances of the class must provide a connection attribute. When a document is parsed, the value of this attribute will be... |
name in TableByName: return TableByName[name](attrs, connection = self.connection) return DBTable(attrs, connection = self.connection) ContentHandler.startTable = startTable return ContentHandler |
def _append(self, row): """ Standard .append() method. This method is for intended for internal use only. """ self.cursor.execute(self.append_statement, self.append_attrgetter(row)) |
def _remapping_append(self, row): """ Replacement for the standard .append() method. This version performs on the fly row ID reassignment, and so also performs the function of the updateKeyMapping() method. SQLite does not permit the PRIMARY KEY of a row to be modified, so it needs to be done prior to insertion. This m... |
def row_from_cols(self, values): """ Given an iterable of values in the order of columns in the database, construct and return a row object. This is a convenience function for turning the results of database queries into Python objects. """ row = self.RowType() for c, t, v in zip(self.dbcolumnnames, self.dbcolumntypes,... |
def applyKeyMapping(self): """ Used as the second half of the key reassignment algorithm. Loops over each row in the table, replacing references to old row keys with the new values from the _idmap_ table. """ assignments = ", ".join("%s = (SELECT new FROM _idmap_ WHERE old == %s)" % (colname, colname) for coltype, coln... |
not do # that, so I don't bother checking. self.cursor.execute("UPDATE %s SET %s WHERE ROWID > %d" % (self.Name, assignments, self.last_maxrowid)) self.last_maxrowid = self.maxrowid() or 0 |
def as_dict(self): """ Return a ditionary mapping time slide IDs to offset dictionaries. """ return dict((ilwd.ilwdchar(id), offsetvector.offsetvector((instrument, offset) for id, instrument, offset in values)) for id, values in itertools.groupby(self.cursor.execute("SELECT time_slide_id, instrument, offset FROM time_s... |
def get_time_slide_id(self, offsetdict, create_new = None, superset_ok = False, nonunique_ok = False): """ Return the time_slide_id corresponding to the offset vector described by offsetdict, a dictionary of instrument/offset pairs. If the optional create_new argument is None (the default), then the table must contain ... |
newly created) matching offset vector. If the optional superset_ok argument is False (the default) then an offset vector in the table is considered to "match" the requested offset vector only if they contain the exact same set of instruments. If the superset_ok argument is True, then an offset vector in the table is co... |
vector. If the optional nonunique_ok is True then the return value is the ID of one of the matching offset vectors selected at random. """ # look for matching offset vectors if superset_ok: ids = [id for id, slide in self.as_dict().items() if offsetdict == dict((instrument, offset) for instrument, offset in slide.items... |
for instrument, offset in offsetdict.items(): row = self.RowType() row.process_id = create_new.process_id row.time_slide_id = id row.instrument = instrument row.offset = offset self.append(row) # return new ID return id |
def findCredential(): """ Follow the usual path that GSI libraries would follow to find a valid proxy credential but also allow an end entity certificate to be used along with an unencrypted private key if they are pointed to by X509_USER_CERT and X509_USER_KEY since we expect this will be the output from the eventual ... |
# if we get here could not find a credential RFCproxyUsage() sys.exit(1) |
def validateProxy(path): """ Test that the proxy certificate is RFC 3820 compliant and that it is valid for at least the next 15 minutes. """ # load the proxy from path try: proxy = M2Crypto.X509.load_cert(path) except Exception, e: msg = "Unable to load proxy from path %s : %s" % (path, e) print >>sys.stderr, msg sys.... |
= proxy.get_not_after().__str__() expireGMT = time.strptime(expireASN1, "%b %d %H:%M:%S %Y %Z") expireUTC = calendar.timegm(expireGMT) now = int(time.time()) secondsLeft = expireUTC - now except Exception, e: # problem getting or parsing time so just let the client # continue and pass the issue along to the server seco... |
def save(self, *args, **kwargs): """If creating new instance, create profile on Authorize.NET also""" data = kwargs.pop('data', {}) sync = kwargs.pop('sync', True) if not self.id and sync: self.push_to_server(data) super(CustomerProfile, self).save(*args, **kwargs) |
def delete(self): """Delete the customer profile remotely and locally""" response = delete_profile(self.profile_id) response.raise_if_error() super(CustomerProfile, self).delete() |
def push_to_server(self, data): """Create customer profile for given ``customer`` on Authorize.NET""" output = add_profile(self.customer.pk, data, data) output['response'].raise_if_error() self.profile_id = output['profile_id'] self.payment_profile_ids = output['payment_profile_ids'] |
def sync(self): """Overwrite local customer profile data with remote data""" output = get_profile(self.profile_id) output['response'].raise_if_error() for payment_profile in output['payment_profiles']: instance, created = CustomerPaymentProfile.objects.get_or_create( customer_profile=self, payment_profile_id=payment_pr... |
def save(self, *args, **kwargs): """Sync payment profile on Authorize.NET if sync kwarg is not False""" if kwargs.pop('sync', True): self.push_to_server() self.card_code = None self.card_number = "XXXX%s" % self.card_number[-4:] super(CustomerPaymentProfile, self).save(*args, **kwargs) |
def push_to_server(self): """ Use appropriate CIM API call to save payment profile to Authorize.NET 1. If customer has no profile yet, create one with this payment profile 2. If payment profile is not on Authorize.NET yet, create it there 3. If payment profile exists on Authorize.NET update it there """ if not self.cus... |
def sync(self, data): """Overwrite local customer payment profile data with remote data""" for k, v in data.get('billing', {}).items(): setattr(self, k, v) self.card_number = data.get('credit_card', {}).get('card_number', self.card_number) self.save(sync=False) |
def delete(self): """Delete the customer payment profile remotely and locally""" response = delete_payment_profile(self.customer_profile.profile_id, self.payment_profile_id) response.raise_if_error() return super(CustomerPaymentProfile, self).delete() |
def get_changelog_file_for_database(database=DEFAULT_DB_ALIAS): """get changelog filename for given `database` DB alias""" from django.conf import settings try: return settings.LIQUIMIGRATE_CHANGELOG_FILES[database] except AttributeError: if database == DEFAULT_DB_ALIAS: try: return settings.LIQUIMIGRATE_CHANGELOG_FILE... |
def find_target_migration_file(database=DEFAULT_DB_ALIAS, changelog_file=None): """Finds best matching target migration file""" if not database: database = DEFAULT_DB_ALIAS if not changelog_file: changelog_file = get_changelog_file_for_database(database) try: doc = minidom.parse(changelog_file) except ExpatError as ex:... |
def connection(self): """Returns an stablished connection""" if self._connection: return self._connection self.log.debug('Initializing connection to %s' % (self.bosh_service. netloc)) if self.bosh_service.scheme == 'http': Connection = httplib.HTTPConnection elif self.bosh_service.scheme == 'https': Connection = httpli... |
def request_sid(self): """ Request a BOSH session according to http://xmpp.org/extensions/xep-0124.html#session-request Returns the new SID (str). """ if self._sid: return self._sid self.log.debug('Prepare to request BOSH session') data = self.send_request(self.get_body(sid_request=True)) if not data: return None # Thi... |
self.server_auth.append(mechanism.text) self.log.debug('New AUTH method: %s' % mechanism.text) if not self.server_auth: self.log.debug(('The server didn\'t send the allowed ' 'authentication methods')) self._sid = None return self._sid |
def send_challenge_response(self, response_plain): """Send a challenge response to server""" # Get a basic stanza body body = self.get_body() # Create a response tag and add the response content on it # using base64 encoding response_node = ET.SubElement(body, 'response') response_node.set('xmlns', XMPP_SASL_NS) respon... |
def authenticate_xmpp(self): """Authenticate the user to the XMPP server via the BOSH connection.""" self.request_sid() self.log.debug('Prepare the XMPP authentication') # Instantiate a sasl object sasl = SASLClient( host=self.to, service='xmpp', username=self.jid, password=self.password ) # Choose an auth mechanism sa... |
def getParamsByName(elem, name): """ Return a list of params with name name under elem. """ name = StripParamName(name) return elem.getElements(lambda e: (e.tagName == ligolw.Param.tagName) and (e.Name == name)) |
def new_param(name, type, value, start = None, scale = None, unit = None, dataunit = None, comment = None): """ Construct a LIGO Light Weight XML Param document subtree. FIXME: document keyword arguments. """ elem = Param() elem.Name = name elem.Type = type elem.pcdata = value # FIXME: I have no idea how most of the at... |
def get_param(xmldoc, name): """ Scan xmldoc for a param named name. Raises ValueError if not exactly 1 such param is found. """ params = getParamsByName(xmldoc, name) if len(params) != 1: raise ValueError("document must contain exactly one %s param" % StripParamName(name)) return params[0] |
def from_pyvalue(name, value, **kwargs): """ Convenience wrapper for new_param() that constructs a Param element from an instance of a Python builtin type. See new_param() for a description of the valid keyword arguments. """ return new_param(name, ligolwtypes.FromPyType[type(value)], value, **kwargs) |
def pickle_to_param(obj, name): """ Return the top-level element of a document sub-tree containing the pickled serialization of a Python object. """ return from_pyvalue(u"pickle:%s" % name, unicode(pickle.dumps(obj))) |
def pickle_from_param(elem, name): """ Retrieve a pickled Python object from the document tree rooted at elem. """ return pickle.loads(str(get_pyvalue(elem, u"pickle:%s" % name))) |
def yaml_to_param(obj, name): """ Return the top-level element of a document sub-tree containing the YAML serialization of a Python object. """ return from_pyvalue(u"yaml:%s" % name, unicode(yaml.dump(obj))) |
def use_in(ContentHandler): """ Modify ContentHandler, a sub-class of pycbc_glue.ligolw.LIGOLWContentHandler, to cause it to use the Param class defined in this module when parsing XML documents. Example: >>> from pycbc_glue.ligolw import ligolw >>> def MyContentHandler(ligolw.LIGOLWContentHandler): ... pass ... >>> us... |
def all_connections(self): """Returns a generator over all current connection objects""" for i in _xrange(self.num_patterns): for c in self._available_connections[i]: yield c for c in self._in_use_connections[i]: yield c |
def get_connection(self, command_name, *keys, **options): """Get a connection from the pool""" self._checkpid() try: connection = self._available_connections[self._pattern_idx].pop() except IndexError: connection = self.make_connection() self._in_use_connections[self._pattern_idx].add(connection) self._next_pattern() r... |
def make_connection(self): """Create a new connection""" if self._created_connections[self._pattern_idx] >= self.max_connections_per_pattern: raise ConnectionError("Too many connections") self._created_connections[self._pattern_idx] += 1 conn = self.connection_class(**self.patterns[self._pattern_idx]) conn._pattern_idx... |
def release(self, connection): """Releases the connection back to the pool""" self._checkpid() if connection.pid == self.pid: idx = connection._pattern_idx self._in_use_connections[idx].remove(connection) self._available_connections[idx].append(connection) |
def purge(self, connection): """Remove the connection from rotation""" self._checkpid() if connection.pid == self.pid: idx = connection._pattern_idx if connection in self._in_use_connections[idx]: self._in_use_connections[idx].remove(connection) else: self._available_connections[idx].remove(connection) connection.disco... |
def execute_command(self, *args, **options): """Execute a command and return a parsed response""" pool = self.connection_pool command_name = args[0] for i in _xrange(self.execution_attempts): connection = pool.get_connection(command_name, **options) try: connection.send_command(*args) res = self.parse_response(connecti... |
def sort_files_by_size(filenames, verbose = False, reverse = False): """ Return a list of the filenames sorted in order from smallest file to largest file (or largest to smallest if reverse is set to True). If a filename in the list is None (used by many pycbc_glue.ligolw based codes to indicate stdin), its size is tre... |
def local_path_from_url(url): """ For URLs that point to locations in the local filesystem, extract and return the filesystem path of the object to which they point. As a special case pass-through, if the URL is None, the return value is None. Raises ValueError if the URL is not None and does not point to a local file.... |
def load_fileobj(fileobj, gz = None, xmldoc = None, contenthandler = None): """ Parse the contents of the file object fileobj, and return the contents as a LIGO Light Weight document tree. The file object does not need to be seekable. If the gz parameter is None (the default) then gzip compressed data will be automatic... |
hex digits of the bytestream that was parsed. Example: >>> from pycbc_glue.ligolw import ligolw >>> import StringIO >>> f = StringIO.StringIO('<?xml version="1.0" encoding="utf-8" ?><!DOCTYPE LIGO_LW SYSTEM "http://ldas-sw.ligo.caltech.edu/doc/ligolwAPI/html/ligolw_dtd.txt"><LIGO_LW><Table Name="demo:table"><Column Nam... |
= "rb", fileobj = fileobj) if xmldoc is None: xmldoc = ligolw.Document() ligolw.make_parser(contenthandler(xmldoc)).parse(fileobj) return xmldoc, md5obj.hexdigest() |
def load_filename(filename, verbose = False, **kwargs): """ Parse the contents of the file identified by filename, and return the contents as a LIGO Light Weight document tree. stdin is parsed if filename is None. Helpful verbosity messages are printed to stderr if verbose is True. All other keyword arguments are passe... |
%s" % (hexdigest, (filename if filename is not None else "")) return xmldoc |
def load_url(url, verbose = False, **kwargs): """ Parse the contents of file at the given URL and return the contents as a LIGO Light Weight document tree. Any source from which Python's urllib2 library can read data is acceptable. stdin is parsed if url is None. Helpful verbosity messages are printed to stderr if verb... |
scheme, host, path = urlparse.urlparse(url)[:3] if scheme.lower() in ("", "file") and host.lower() in ("", "localhost"): fileobj = open(path) else: fileobj = urllib2.urlopen(url) else: fileobj = sys.stdin xmldoc, hexdigest = load_fileobj(fileobj, **kwargs) if verbose: print >>sys.stderr, "md5sum: %s %s" % (hexdigest, (... |
def write_fileobj(xmldoc, fileobj, gz = False, trap_signals = (signal.SIGTERM, signal.SIGTSTP), **kwargs): """ Writes the LIGO Light Weight document tree rooted at xmldoc to the given file object. Internally, the .write() method of the xmldoc object is invoked and any additional keyword arguments are passed to that met... |
during the write process. When the file write is concluded the original signal handlers are restored. Then, if signals were trapped during the write process, the signals are then resent to the current process in the order in which they were received. The signal.signal() system call cannot be invoked from threads, and t... |
deferred_signals = [] def newsigterm(signum, frame): deferred_signals.append(signum) oldhandlers = {} if trap_signals is not None: for sig in trap_signals: oldhandlers[sig] = signal.getsignal(sig) signal.signal(sig, newsigterm) # write the document with MD5File(fileobj, closable = False) as fileobj: md5obj = fileobj.md... |
def write_filename(xmldoc, filename, verbose = False, gz = False, **kwargs): """ Writes the LIGO Light Weight document tree rooted at xmldoc to the file name filename. Friendly verbosity messages are printed while doing so if verbose is True. The output data is gzip compressed on the fly if gz is True. Internally, writ... |
open(filename, "w") else: fileobj = sys.stdout hexdigest = write_fileobj(xmldoc, fileobj, gz = gz, **kwargs) if not fileobj is sys.stdout: fileobj.close() if verbose: print >>sys.stderr, "md5sum: %s %s" % (hexdigest, (filename if filename is not None else "")) |
def handleMatch(self, m): """ Handles user input into [magic] tag, processes it, and inserts the returned URL into an <img> tag through a Python ElementTree <img> Element. """ userStr = m.group(3) # print(userStr) imgURL = processString(userStr) # print(imgURL) el = etree.Element('img') # Sets imgURL to 'src' attribute... |
def home(request): """Show the home page. Send the list of polls""" polls = [] for row in curDB.execute('SELECT id, title FROM Poll ORDER BY title'): polls.append({'id': row[0], 'name': row[1]}) return {'polls': polls} |
def show(request, pollId): """Show a poll. We send informations about votes only if the user is an administrator""" # Get the poll curDB.execute('SELECT id, title, description FROM Poll WHERE id = ? ORDER BY title', (pollId,)) poll = curDB.fetchone() if poll is None: return {} responses = [] totalVotes = 0 votedFor = 0... |
suer if request.args.get('ebuio_u_username') == rowVote[0]: votedFor = rowRep[0] totalVotes += nbVotes responses.append({'id': rowRep[0], 'title': rowRep[1], 'nbVotes': nbVotes, 'votes': votes}) return {'id': poll[0], 'name': poll[1], 'description': poll[2], 'responses': responses, 'totalVotes': totalVotes, 'votedFor':... |
def vote(request, pollId, responseId): """Vote for a poll""" username = request.args.get('ebuio_u_username') # Remove old votes from the same user on the same poll curDB.execute('DELETE FROM Vote WHERE username = ? AND responseId IN (SELECT id FROM Response WHERE pollId = ?) ', (username, pollId)) # Save the vote curDB... |
def create(request): """Create a new poll""" errors = [] success = False listOfResponses = ['', '', ''] # 3 Blank lines by default title = '' description = '' id = '' if request.method == 'POST': # User saved the form # Retrieve parameters title = request.form.get('title') description = request.form.get('description') ... |
rep in listOfResponses: curDB.execute("INSERT INTO Response (pollId, title) VALUES (?, ?)", (id, rep)) coxDB.commit() success = True # Minimum of 3 lines of questions while len(listOfResponses) < 3: listOfResponses.append('') return {'errors': errors, 'success': success, 'listOfResponses': listOfResponses, 'title': tit... |
def New(Type, columns = None, **kwargs): """ Construct a pre-defined LSC table. The optional columns argument is a sequence of the names of the columns the table should be constructed with. If columns = None, then the table is constructed with all valid columns (use columns = [] to create a table with no columns). Exam... |
colnamefmt % key, u"Type": new.validcolumns[key]}))) else: for key, value in new.validcolumns.items(): new.appendChild(table.Column(sax.xmlreader.AttributesImpl({u"Name": colnamefmt % key, u"Type": value}))) new._end_of_columns() new.appendChild(table.TableStream(sax.xmlreader.AttributesImpl({u"Name": Type.tableName, u... |
def IsTableProperties(Type, tagname, attrs): """ obsolete. see .CheckProperties() method of pycbc_glue.ligolw.table.Table class. """ import warnings warnings.warn("lsctables.IsTableProperties() is deprecated. use pycbc_glue.ligolw.table.Table.CheckProperties() instead", DeprecationWarning) return Type.CheckProperties(t... |
def HasNonLSCTables(elem): """ Return True if the document tree below elem contains non-LSC tables, otherwise return False. """ return any(t.Name not in TableByName for t in elem.getElementsByTagName(ligolw.Table.tagName)) |
def instrument_set_from_ifos(ifos): """ Parse the values stored in the "ifos" and "instruments" columns found in many tables. This function is mostly for internal use by the .instruments properties of the corresponding row classes. The mapping from input to output is as follows (rules are applied in order): input is No... |
output is set of two-character pieces input is a non-empty string --> output is a set containing input as single value else output is an empty set. NOTE: the complexity of this algorithm is a consequence of there being several conventions in use for encoding a set of instruments into one of these columns; it has been p... |
decoding to be used. ifos_from_instrument_set() does this for you. Example: >>> print instrument_set_from_ifos(None) None >>> instrument_set_from_ifos(u"") set([]) >>> instrument_set_from_ifos(u" , ,,") set([]) >>> instrument_set_from_ifos(u"H1") set([u'H1']) >>> instrument_set_from_ifos(u"SWIFT") set([u'SWIFT']) >>> i... |
set(ifos[n:n+2] for n in range(0, len(ifos), 2)) if ifos: return set([ifos]) return set() |
def ifos_from_instrument_set(instruments): """ Convert an iterable of instrument names into a value suitable for storage in the "ifos" column found in many tables. This function is mostly for internal use by the .instruments properties of the corresponding row classes. The input can be None or an iterable of zero or mo... |
in the iterable and it has an even number of characters > 2 in it, the output will have a "," appended in order to force instrument_set_from_ifos() to parse the string back into a single instrument name. This is a special case included temporarily to disambiguate the encoding until all codes have been ported to the com... |
or pluses in them as they cannot survive the encode/decode # process if not all(_instruments) or any(u"," in instrument or u"+" in instrument for instrument in _instruments): raise ValueError(instruments) if len(_instruments) == 1 and len(_instruments[0]) > 2 and not len(_instruments[0]) % 2: # special case disambiguat... |
def use_in(ContentHandler): """ Modify ContentHandler, a sub-class of pycbc_glue.ligolw.LIGOLWContentHandler, to cause it to use the Table classes defined in this module when parsing XML documents. Example: >>> from pycbc_glue.ligolw import ligolw >>> class MyContentHandler(ligolw.LIGOLWContentHandler): ... pass ... >>... |
def get_ids_by_program(self, program): """ Return a set containing the process IDs from rows whose program string equals the given program. """ return set(row.process_id for row in self if row.program == program) |
def get_in_segmentlistdict(self, process_ids = None): """ Return a segmentlistdict mapping instrument to in segment list. If process_ids is a sequence of process IDs, then only rows with matching IDs are included otherwise all rows are included. Note: the result is not coalesced, each segmentlist contains the segments ... |
def get_out_segmentlistdict(self, process_ids = None): """ Return a segmentlistdict mapping instrument to out segment list. If process_ids is a sequence of process IDs, then only rows with matching IDs are included otherwise all rows are included. Note: the result is not coalesced, each segmentlist contains the segment... |
def get_expr_id(self, search_group, search, lars_id, instruments, gps_start_time, gps_end_time, comments = None): """ Return the expr_def_id for the row in the table whose values match the givens. If a matching row is not found, returns None. @search_group: string representing the search group (e.g., cbc) @serach: stri... |
None |
def write_new_expr_id(self, search_group, search, lars_id, instruments, gps_start_time, gps_end_time, comments = None): """ Creates a new def_id for the given arguments and returns it. If an entry already exists with these, will just return that id. @search_group: string representing the search group (e.g., cbc) @serac... |
ifos_from_instrument_set(instruments) row.gps_start_time = gps_start_time row.gps_end_time = gps_end_time row.comments = comments self.append(row) # return new ID return row.experiment_id |
def get_row_from_id(self, experiment_id): """ Returns row in matching the given experiment_id. """ row = [row for row in self if row.experiment_id == experiment_id] if len(row) > 1: raise ValueError("duplicate ids in experiment table") if len(row) == 0: raise ValueError("id '%s' not found in table" % experiment_id) ret... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.