code stringlengths 1 18.2k |
|---|
def init_app(self, app): """Flask application initialization. :param app: The Flask application. :returns: The :class:`invenio_pages.ext.InvenioPages` instance initialized. """ self.init_config(app) self.wrap_errorhandler(app) app.extensions['invenio-pages'] = _InvenioPagesState(app) return app.extensions['invenio-page... |
def list_conferences_groups(self, group_id): """ List conferences. Retrieve the list of conferences for this context This API returns a JSON object containing the list of conferences, the key for the list of conferences is "conferences" """ path = {} data = {} params = {} # REQUIRED - PATH - group_id """ID""" path["gro... |
def retrieve_assignment_overridden_dates_for_quizzes(self, course_id, quiz_assignment_overrides_0_quiz_ids=None): """ Retrieve assignment-overridden dates for quizzes. Retrieve the actual due-at, unlock-at, and available-at dates for quizzes based on the assignment overrides active for the current API user. """ path = ... |
def fit(self, X, y): """Fit the model using X as training data and y as target values""" self._data = X self._classes = np.unique(y) self._labels = y self._is_fitted = True |
def predict(self, X): """Predict the class labels for the provided data Parameters ---------- X : array-like, shape (n_query, n_features). Test samples. Returns ------- y : array of shape [n_samples] Class labels for each data sample. """ # TODO: Make classification of multiple samples a bit more effective... if X.ndim... |
= self._labels[np.argmax(out)] else: y_pred, _ = mode(labels) return y_pred.tolist() |
def replaced_url_for(endpoint, filename=None, **values): """ This function acts as "replacement" for the default url_for() and intercepts if it is a request for bower assets If the file is not available in bower, the result is passed to flasks url_for(). This is useful - but not recommended - for "overlaying" the stati... |
def handle_url_error(error, endpoint, values): """ Intercept BuildErrors of url_for() using flasks build_error_handler API """ url = overlay_url_for(endpoint, **values) if url is None: exc_type, exc_value, tb = sys.exc_info() if exc_value is error: reraise(exc_type, exc_value, tb) else: raise error # url_for will use t... |
def overlay_url_for(endpoint, filename=None, **values): """ Replace flasks url_for() function to allow usage without template changes If the requested endpoint is static or ending in .static, it tries to serve a bower asset, otherwise it will pass the arguments to flask.url_for() See http://flask.pocoo.org/docs/0.10/ap... |
def build_url(component, filename, **values): """ search bower asset and build url :param component: bower component (package) :type component: str :param filename: filename in bower component - can contain directories (like dist/jquery.js) :type filename: str :param values: additional url parameters :type values: dict... |
check if specified file actually exists if not os.path.exists(os.path.join(current_app.root_path, root, component, filename)): return None # check if minified file exists (by pattern <filename>.min.<ext> # returns filename if successful if current_app.config['BOWER_TRY_MINIFIED']: if '.min.' not in filename: minified_f... |
def init_ixn(api, logger, install_dir=None): """ Create IXN object. :param api: tcl/python/rest :type api: trafficgenerator.tgn_utils.ApiType :param logger: logger object :param install_dir: IXN installation directory :return: IXN object """ if api == ApiType.tcl: api_wrapper = IxnTclWrapper(logger, install_dir) elif a... |
def disconnect(self): """ Disconnect from chassis and server. """ if self.root.ref is not None: self.api.disconnect() self.root = None |
def reserve(self, ports, force=False, wait_for_up=True, timeout=80): """ Reserve port and optionally wait for port to come up. :param ports: dict of <port, ip/module/port'>. :param force: whether to revoke existing reservation (True) or not (False). :param wait_for_up: True - wait for port to come up, False - return im... |
def start(self): """Schedule the timeout. This is called on construction, so it should not be called explicitly, unless the timer has been canceled.""" assert not self._timer, '%r is already started; to restart it, cancel it first' % self loop = evergreen.current.loop current = evergreen.current.task if self.seconds is... |
def flush_read_tuple(self): """Flush the internal buffer of reads. """ if not self.is_empty(): suffix_comment_buffer = [] if self._info_simulator is not None: suffix_comment_buffer.append(self._info_simulator) if self._info_reads_in_tuple: # todo: orientation (FF, FR, etc.) # orientation="".join([]) suffix_comment_buff... |
def add_read( self, read_tuple_id, bases, qualities, segments, ): """Add a new read to the current buffer. If it is a new read tuple (detected from ID), the buffer will be flushed. Args: read_tuple_id (int): ID of the read tuple. bases (str): Sequence of bases. qualities (str): Sequence of FASTQ qualities. segments (li... |
def add_category(self, name): """ Adds a bayes category that we can later train :param name: name of the category :type name: str :return: the requested category :rtype: BayesCategory """ category = BayesCategory(name) self.categories[name] = category return category |
def line_is_interesting(self, line): """Return True, False, or None. True means always output, False means never output, None means output only if there are interesting lines. """ if line.startswith('Name'): return None if line.startswith('--------'): return None if line.startswith('TOTAL'): return None if '100%' in li... |
def from_tuples(cls, tuples): """ Creates a graph from an iterable of tuples describing edges like (source, target, sign) Parameters ---------- tuples : iterable[(str,str,int))] Tuples describing signed and directed edges Returns ------- caspo.core.graph.Graph Created object instance """ return cls(it.imap(lambda (sour... |
def read_sif(cls, path): """ Creates a graph from a `simple interaction format (SIF)`_ file Parameters ---------- path : str Absolute path to a SIF file Returns ------- caspo.core.graph.Graph Created object instance .. _simple interaction format (SIF): http://wiki.cytoscape.org/Cytoscape_User_Manual/Network_Formats """... |
def predecessors(self, node, exclude_compressed=True): """ Returns the list of predecessors of a given node Parameters ---------- node : str The target node exclude_compressed : boolean If true, compressed nodes are excluded from the predecessors list Returns ------- list List of predecessors nodes """ preds = super(Gr... |
def successors(self, node, exclude_compressed=True): """ Returns the list of successors of a given node Parameters ---------- node : str The target node exclude_compressed : boolean If true, compressed nodes are excluded from the successors list Returns ------- list List of successors nodes """ succs = super(Graph, sel... |
def compress(self, setup): """ Returns the compressed graph according to the given experimental setup Parameters ---------- setup : :class:`caspo.core.setup.Setup` Experimental setup used to compress the graph Returns ------- caspo.core.graph.Graph Compressed graph """ designated = set(setup.nodes) zipped = self.copy()... |
d.get('compressed', False)] return zipped.subgraph([n for n, _ in not_compressed]) |
def combine(*rnf_profiles): """Combine more profiles and set their maximal values. Args: *rnf_profiles (rnftools.rnfformat.RnfProfile): RNF profile. """ for rnf_profile in rnf_profiles: self.prefix_width = max(self.prefix_width, rnf_profile.prefix_width) self.read_tuple_id_width = max(self.read_tuple_id_width, rnf_prof... |
def load(self, read_tuple_name): """Load RNF values from a read tuple name. Args: read_tuple_name (str): Read tuple name which the values are taken from. """ self.prefix_width = 0 self.read_tuple_id_width = 0 self.genome_id_width = 0 self.chr_id_width = 0 self.coor_width = 0 parts = read_tuple_name.split("__") self.pre... |
def apply(self, read_tuple_name, read_tuple_id=None, synchronize_widths=True): """Apply profile on a read tuple name and update read tuple ID. Args: read_tuple_name (str): Read tuple name to be updated. read_tuple_id (id): New read tuple ID. synchronize_widths (bool): Update widths (in accordance to this profile). """ ... |
def check(self, read_tuple_name): """Check if the given read tuple name satisfies this profile. Args: read_tuple_name (str): Read tuple name. """ parts = read_tuple_name.split("__") if len(parts[0]) != self.prefix_width or len(parts[1]) != self.read_tuple_id_width: return False segments = parts[2][1:-1].split("),(") fo... |
def get_column_definition_all(self, table): """Retrieve the column definition statement for all columns in a table.""" # Get complete table definition col_defs = self.get_table_definition(table).split('\n') # Return only column definitions return [i[0:-1].strip().replace(',', ', ') for i in col_defs if i.strip().starts... |
def get_column_definition(self, table, column): """Retrieve the column definition statement for a column from a table.""" # Parse column definitions for match for col in self.get_column_definition_all(table): if col.strip('`').startswith(column): return col.strip(',') |
def original(modname): """ This returns an unpatched version of a module.""" # note that it's not necessary to temporarily install unpatched # versions of all patchable modules during the import of the # module; this is because none of them import each other, except # for threading which imports thread original_name = ... |
def patch(**on): """Globally patches certain system modules to be 'cooperaive'. The keyword arguments afford some control over which modules are patched. If no keyword arguments are supplied, all possible modules are patched. If keywords are set to True, only the specified modules are patched. E.g., ``monkey_patch(sock... |
accepted_args: on.setdefault(modname, default_on) modules_to_patch = [] if on['select'] and not already_patched.get('select'): modules_to_patch += _select_modules() already_patched['select'] = True if on['socket'] and not already_patched.get('socket'): modules_to_patch += _socket_modules() already_patched['socket'] = T... |
def inject(module_name, new_globals, *additional_modules): """Base method for "injecting" greened modules into an imported module. It imports the module specified in *module_name*, arranging things so that the already-imported modules in *additional_modules* are used when *module_name* makes its imports. *new_globals* ... |
destroy existing # references to patched modules return sys.modules[patched_name] if not additional_modules: # supply some defaults additional_modules = (_select_modules() + _socket_modules() + _time_modules()) # after this we are gonna screw with sys.modules, so capture the # state of all the modules we're going to me... |
for name in dir(module): if name not in __exclude: new_globals[name] = getattr(module, name) ## Keep a reference to the new module to prevent it from dying sys.modules[patched_name] = module finally: saver.restore() # Put the original modules back return module |
def slurp_properties(source, destination, ignore=[], srckeys=None): """Copy properties from *source* (assumed to be a module) to *destination* (assumed to be a dict). *ignore* lists properties that should not be thusly copied. *srckeys* is a list of keys to copy, if the source's __all__ is untrustworthy. """ if srckeys... |
def save(self, *module_names): """Saves the named modules to the object.""" for modname in module_names: self._saved[modname] = sys.modules.get(modname, None) |
def restore(self): """Restores the modules that the saver knows about into sys.modules. """ try: for modname, mod in self._saved.items(): if mod is not None: sys.modules[modname] = mod else: try: del sys.modules[modname] except KeyError: pass finally: imp.release_lock() |
def nested_insert(self, item_list): """ Create a series of nested LIVVDicts given a list """ if len(item_list) == 1: self[item_list[0]] = LIVVDict() elif len(item_list) > 1: if item_list[0] not in self: self[item_list[0]] = LIVVDict() self[item_list[0]].nested_insert(item_list[1:]) |
def nested_assign(self, key_list, value): """ Set the value of nested LIVVDicts given a list """ if len(key_list) == 1: self[key_list[0]] = value elif len(key_list) > 1: if key_list[0] not in self: self[key_list[0]] = LIVVDict() self[key_list[0]].nested_assign(key_list[1:], value) |
def post_save(sender, instance, created, **kwargs): """ After save create order instance for sending instance for orderable models. """ # Only create order model instances for # those modules specified in settings. model_label = '.'.join([sender._meta.app_label, sender._meta.object_name]) labels = resolve_labels(model_... |
def parse_children(parent): """Recursively parse child tags until match is found""" components = [] for tag in parent.children: matched = parse_tag(tag) if matched: components.append(matched) elif hasattr(tag, 'contents'): components += parse_children(tag) return components |
def save(self, path): """ Writes file to a particular location This won't work for cloud environments like Google's App Engine, use with caution ensure to catch exceptions so you can provide informed feedback. prestans does not mask File IO exceptions so your handler can respond better. """ file_handle = open(path, 'wb... |
def query_by_assignment(self, assignment_id, end_time=None, start_time=None): """ Query by assignment. List grade change events for a given assignment. """ path = {} data = {} params = {} # REQUIRED - PATH - assignment_id """ID""" path["assignment_id"] = assignment_id # OPTIONAL - start_time """The beginning of the tim... |
def query_by_student(self, student_id, end_time=None, start_time=None): """ Query by student. List grade change events for a given student. """ path = {} data = {} params = {} # REQUIRED - PATH - student_id """ID""" path["student_id"] = student_id # OPTIONAL - start_time """The beginning of the time range from which yo... |
def query_by_grader(self, grader_id, end_time=None, start_time=None): """ Query by grader. List grade change events for a given grader. """ path = {} data = {} params = {} # REQUIRED - PATH - grader_id """ID""" path["grader_id"] = grader_id # OPTIONAL - start_time """The beginning of the time range from which you want ... |
def main(argv=None): """The entry point of the application.""" if argv is None: argv = sys.argv[1:] usage = '\n\n\n'.join(__doc__.split('\n\n\n')[1:]) version = 'Nosey ' + __version__ # Parse options args = docopt(usage, argv=argv, version=version) # Execute return watch(args['<directory>'], args['--clear']) |
def _set_serializer_by_mime_type(self, mime_type): """ :param mime_type: :return: used by content_type_set to set get a reference to the appropriate serializer """ # ignore if binary response if isinstance(self._app_iter, BinaryResponse): self.logger.info("ignoring setting serializer for binary response") return for av... |
def register_serializers(self, serializers): """ Adds extra serializers; generally registered during the handler lifecycle """ for new_serializer in serializers: if not isinstance(new_serializer, serializer.Base): msg = "registered serializer %s.%s does not inherit from prestans.serializer.Serializer" % ( new_serialize... |
def is_valid(self): """returns `True` if the report should be sent.""" if not self.total: return False if not self.contributor.freelanceprofile.is_freelance: return False return True |
def contributions(self): """Apply a datetime filter against the contributor's contribution queryset.""" if self._contributions is None: self._contributions = self.contributor.contributions.filter( content__published__gte=self.start, content__published__lt=self.end ) return self._contributions |
def line_items(self): """Apply a datetime filter against the contributors's line item queryset.""" if self._line_items is None: self._line_items = self.contributor.line_items.filter( payment_date__range=(self.start, self.end) ) return self._line_items |
def deadline(self): """Return next day as deadline if no deadline provided.""" if not self._deadline: self._deadline = self.now + timezone.timedelta(days=1) return self._deadline |
def send_contributor_email(self, contributor): """Send an EmailMessage object for a given contributor.""" ContributorReport( contributor, month=self.month, year=self.year, deadline=self._deadline, start=self._start, end=self._end ).send() |
def send_mass_contributor_emails(self): """Send report email to all relevant contributors.""" # If the report configuration is not active we only send to the debugging user. for contributor in self.contributors: if contributor.email not in EMAIL_SETTINGS.get("EXCLUDED", []): self.send_contributor_email(contributor) |
def get_contributors(self): """Return a list of contributors with contributions between the start/end dates.""" return User.objects.filter( freelanceprofile__is_freelance=True ).filter( contributions__content__published__gte=self.start, contributions__content__published__lt=self.end ).distinct() |
def contributors(self): """Property to retrieve or access the list of contributors.""" if not self._contributors: self._contributors = self.get_contributors() return self._contributors |
def control(self, size=0, configure=None): """ Finds all inclusion-minimal intervention strategies up to the given size. Intervention strategies found are saved in the attribute :attr:`strategies` as a :class:`caspo.core.clamping.ClampingList` object instance. Example:: >>> from caspo import core, control >>> networks ... |
self.stats['time_optimum'] = clingo.stats['time_solve'] self.stats['time_enumeration'] = clingo.stats['time_total'] self._logger.info("%s optimal intervention strategies found in %.4fs", len(self._strategies), self.stats['time_enumeration']) self.strategies = core.ClampingList(self._strategies) |
def open_url(self, url, stale_after, parse_as_html = True, **kwargs): """ Download or retrieve from cache. url -- The URL to be downloaded, as a string. stale_after -- A network request for the url will be performed if the cached copy does not exist or if it exists but its age (in days) is larger or equal to the stale_... |
BannedException -- If does_show_ban returns True. HTTPCodeNotOKError -- If the returned HTTP status code is not equal to 200. """ _LOGGER.info('open_url() received url: %s', url) today = datetime.date.today() threshold_date = today - datetime.timedelta(stale_after) downloaded = False with self._get_conn() as conn: rs =... |
not from cache): {u}' .format(f = self.does_show_ban, u = url)) _LOGGER.error(message) _LOGGER.info('Deleting url %s from the cache (if it exists) ' 'because it triggered ban page cache poisoning ' 'exception', url) with self._get_conn() as conn: conn.execute('delete from cache where url = ?', [str(url)]) if downloaded... |
(?, ?, ?) ''', ( str(url), _date_to_sqlite_str(today), sqlite3.Binary(to_store) ) ) return tree |
def xpath_pick_one(self, xpaths): """ Try each of the xpaths successively until a single element is found. If no xpath succeeds then raise the last UnexpectedContentException caught. """ for xpathi, xpath in enumerate(xpaths): try: return self.xpath(xpath, [1, 1])[0] except UnexpectedContentException as e: if xpathi ==... |
def get_content_title(self, obj): """Get content's title.""" return Content.objects.get(id=obj.content.id).title |
def is_date(self): """Determine if a data record is of type DATE.""" dt = DATA_TYPES['date'] if type(self.data) is dt['type'] and '-' in str(self.data) and str(self.data).count('-') == 2: # Separate year, month and day date_split = str(self.data).split('-') y, m, d = date_split[0], date_split[1], date_split[2] # Valida... |
def is_time(self): """Determine if a data record is of type TIME.""" dt = DATA_TYPES['time'] if type(self.data) is dt['type'] and ':' in str(self.data) and str(self.data).count(':') == 2: # Separate hour, month, second date_split = str(self.data).split(':') h, m, s = date_split[0], date_split[1], date_split[2] # Valida... |
def is_year(self): """Determine if a data record is of type YEAR.""" dt = DATA_TYPES['year'] if dt['min'] and dt['max']: if type(self.data) is dt['type'] and dt['min'] < self.data < dt['max']: self.type = 'year'.upper() self.len = None return True |
def _is_date_data(self, data_type): """Private method for determining if a data record is of type DATE.""" dt = DATA_TYPES[data_type] if isinstance(self.data, dt['type']): self.type = data_type.upper() self.len = None return True |
def wait(self, timeout=None): """Wait for the barrier. When the specified number of threads have started waiting, they are all simultaneously awoken. If an 'action' was provided for the barrier, one of the threads will have executed that callback prior to returning. Returns an individual index number from 0 to 'parties... |
def reset(self): """Reset the barrier to the initial state. Any threads currently waiting will get the BrokenBarrier exception raised. """ with self._cond: if self._count > 0: if self._state == 0: #reset the barrier, waking up threads self._state = -1 elif self._state == -2: #was broken, set it to reset state #which cl... |
def get(self, request, *args, **kwargs): """Override default get function to use token if there is one to retrieve object. If a subclass should use their own GET implementation, token_from_kwargs should be called if that detail view should be accessible via token.""" self.object = self.get_object() allow_anonymous = kw... |
redirect_unpublished_to_login_or_404( request=request, next_url=self.object.get_absolute_url(), next_params=request.GET) # Never cache unpublished articles add_never_cache_headers(response) else: response["Vary"] = "Accept-Encoding" return response |
def host(value): """ Validates that the value is a valid network location """ if not value: return (True, "") try: host,port = value.split(":") except ValueError as _: return (False, "value needs to be <host>:<port>") try: int(port) except ValueError as _: return (False, "port component of the host address needs to be ... |
def get_wallpaper(): '''Get the desktop wallpaper. Get the current desktop wallpaper. Returns: str: The path to the current wallpaper. ''' desktop_env = system.get_name() if desktop_env in ['gnome', 'unity', 'cinnamon', 'pantheon', 'mate']: SCHEMA = 'org.gnome.desktop.background' KEY = 'picture-uri' if desktop_env == '... |
'') elif desktop_env == 'xfce4': # XFCE4's image property is not image-path but last-image (What?) list_of_properties = system.get_cmd_out( ['xfconf-query', '-R', '-l', '-c', 'xfce4-desktop', '-p', '/backdrop']) for i in list_of_properties.split('\n'): if i.endswith('last-image') and 'workspace' in i: # The property gi... |
= fehbg[0] for i in fehbg.split(' '): if not i.startswith("-"): if not i.startswith('feh'): if not i in ['', ' ', ' ', '\n']: return(i.replace("'", '')) # TODO: way to get wallpaper for desktops which are commented-out below elif desktop_env == 'icewm': with open(os.path.expanduser('~/.icewm/preferences')) as f: for li... |
sp.Popen(args) # # elif desktop_env == 'lxde': # args = 'pcmanfm --set-wallpaper %s --wallpaper-mode=scaled' % image # sp.Popen(args, shell=True) # # elif desktop_env == 'lxqt': # args = 'pcmanfm-qt --set-wallpaper %s --wallpaper-mode=scaled' % image # sp.Popen(args, shell=True) # # elif desktop_env == 'windowmaker': #... |
try: from appscript import app app('Finder').desktop_picture.get() except ImportError: OSX_SCRIPT = ('tell app "finder" to get posix path' ' of (get desktop picture as alias)') return system.get_cmd_out(['osascript', OSX_SCRIPT]) |
def set_wallpaper(image): '''Set the desktop wallpaper. Sets the desktop wallpaper to an image. Args: image (str): The path to the image to be set as wallpaper. ''' desktop_env = system.get_name() if desktop_env in ['gnome', 'unity', 'cinnamon', 'pantheon', 'mate']: uri = 'file://%s' % image SCHEMA = 'org.gnome.desktop... |
This probably only works in Plasma 5+ kde_script = dedent( '''\ var Desktops = desktops(); for (i=0;i<Desktops.length;i++) {{ d = Desktops[i]; d.wallpaperPlugin = "org.kde.image"; d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General"); d.writeConfig("Image", "file://{}") }} ''').format(image) sp.Popen( [... |
'desktop.conf') if os.path.isfile(desktop_conf_file): config_option = r'screens\1\desktops\1\wallpaper' else: desktop_conf_file = os.path.join( os.path.expanduser('~'), '.razor/desktop.conf') config_option = r'desktops\1\wallpaper' desktop_conf.read(os.path.join(desktop_conf_file)) try: if desktop_conf.has_option('razo... |
'enlightenment': args = 'enlightenment_remote -desktop-bg-add 0 0 0 0 %s' % image sp.Popen(args, shell=True) elif desktop_env == 'awesome': with sp.Popen("awesome-client", stdin=sp.PIPE) as awesome_client: command = ('local gears = require("gears"); for s = 1,' ' screen.count() do gears.wallpaper.maximized' '("%s", s, ... |
repeat with desktopNumber from 1 to desktopCount tell desktop desktopNumber set picture to POSIX file "%s" end tell end repeat end tell''') % image sp.Popen(['osascript', OSX_SCRIPT]) else: try: sp.Popen(['feh', '--bg-scale', image]) # feh is nearly a catch-all for Linux WMs except: pass |
def retrieve_all_quiz_reports(self, quiz_id, course_id, includes_all_versions=None): """ Retrieve all quiz reports. Returns a list of all available reports. """ path = {} data = {} params = {} # REQUIRED - PATH - course_id """ID""" path["course_id"] = course_id # REQUIRED - PATH - quiz_id """ID""" path["quiz_id"] = qui... |
def create_quiz_report(self, quiz_id, course_id, quiz_report_report_type, include=None, quiz_report_includes_all_versions=None): """ Create a quiz report. Create and return a new report for this quiz. If a previously generated report matches the arguments and is still current (i.e. there have been no new submissions), ... |
submissions or only the most recent. Defaults to false, ignored for item_analysis.""" if quiz_report_includes_all_versions is not None: data["quiz_report[includes_all_versions]"] = quiz_report_includes_all_versions # OPTIONAL - include """Whether the output should include documents for the file and/or progress objects ... |
def clampings_iter(self, cues=None): """ Iterates over all possible clampings of this experimental setup Parameters ---------- cues : Optional[iterable] If given, restricts clampings over given species names Yields ------ caspo.core.clamping.Clamping The next clamping with respect to the experimental setup """ s = cues... |
def to_funset(self): """ Converts the experimental setup to a set of `gringo.Fun`_ object instances Returns ------- set The set of `gringo.Fun`_ object instances .. _gringo.Fun: http://potassco.sourceforge.net/gringo.html#Fun """ fs = set((gringo.Fun('stimulus', [str(var)]) for var in self.stimuli)) fs = fs.union((grin... |
def from_json(cls, filename): """ Creates an experimental setup from a JSON file Parameters ---------- filename : str Absolute path to JSON file Returns ------- caspo.core.setup.Setup Created object instance """ with open(filename) as fp: raw = json.load(fp) return cls(raw['stimuli'], raw['inhibitors'], raw['readouts']... |
def to_json(self, filename): """ Writes the experimental setup to a JSON file Parameters ---------- filename : str Absolute path where to write the JSON file """ with open(filename, 'w') as fp: json.dump(dict(stimuli=self.stimuli, inhibitors=self.inhibitors, readouts=self.readouts), fp) |
def filter(self, networks): """ Returns a new experimental setup restricted to species present in the given list of networks Parameters ---------- networks : :class:`caspo.core.logicalnetwork.LogicalNetworkList` List of logical networks Returns ------- caspo.core.setup.Setup The restricted experimental setup """ cues =... |
def cues(self, rename_inhibitors=False): """ Returns stimuli and inhibitors species of this experimental setup Parameters ---------- rename_inhibitors : boolean If True, rename inhibitors with an ending 'i' as in MIDAS files. Returns ------- list List of species names in order: first stimuli followed by inhibitors """ ... |
def list_external_tools_courses(self, course_id, include_parents=None, search_term=None, selectable=None): """ List external tools. Returns the paginated list of external tools for the current context. See the get request docs for a single tool for a list of properties on an external tool. """ path = {} data = {} param... |
params["include_parents"] = include_parents self.logger.debug("GET /api/v1/courses/{course_id}/external_tools with query params: {params} and form data: {data}".format(params=params, data=data, **path)) return self.generic_request("GET", "/api/v1/courses/{course_id}/external_tools".format(**path), data=data, params=par... |
def list_external_tools_accounts(self, account_id, include_parents=None, search_term=None, selectable=None): """ List external tools. Returns the paginated list of external tools for the current context. See the get request docs for a single tool for a list of properties on an external tool. """ path = {} data = {} par... |
params["include_parents"] = include_parents self.logger.debug("GET /api/v1/accounts/{account_id}/external_tools with query params: {params} and form data: {data}".format(params=params, data=data, **path)) return self.generic_request("GET", "/api/v1/accounts/{account_id}/external_tools".format(**path), data=data, params... |
def list_external_tools_groups(self, group_id, include_parents=None, search_term=None, selectable=None): """ List external tools. Returns the paginated list of external tools for the current context. See the get request docs for a single tool for a list of properties on an external tool. """ path = {} data = {} params ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.