_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q42500
Setup.from_json
train
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 """ wi...
python
{ "resource": "" }
q42501
Setup.to_json
train
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, inhibito...
python
{ "resource": "" }
q42502
Setup.filter
train
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 -----...
python
{ "resource": "" }
q42503
Setup.cues
train
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 ------- ...
python
{ "resource": "" }
q42504
SkipList.insert
train
def insert(self, key, value): """Insert a key-value pair in the list. The pair is inserted at the correct location so that the list remains sorted on *key*. If a pair with the same key is already in the list, then the pair is appended after all other pairs with that key. """ ...
python
{ "resource": "" }
q42505
SkipList.clear
train
def clear(self): """Remove all key-value pairs.""" for i in range(self.maxlevel): self._head[2+i] = self._tail self._tail[-1] = 0 self._level = 1
python
{ "resource": "" }
q42506
SkipList.items
train
def items(self, start=None, stop=None): """Return an iterator yielding pairs. If *start* is specified, iteration starts at the first pair with a key that is larger than or equal to *start*. If not specified, iteration starts at the first pair in the list. If *stop* is specified...
python
{ "resource": "" }
q42507
SkipList.popitem
train
def popitem(self): """Removes the first key-value pair and return it. This method raises a ``KeyError`` if the list is empty. """ node = self._head[2] if node is self._tail: raise KeyError('list is empty') self._find_lt(node[0]) self._remove(node) ...
python
{ "resource": "" }
q42508
TabsAPI.update_tab_for_course
train
def update_tab_for_course(self, tab_id, course_id, hidden=None, position=None): """ Update a tab for a course. Home and Settings tabs are not manageable, and can't be hidden or moved Returns a tab object """ path = {} data = {} params =...
python
{ "resource": "" }
q42509
Select.select_all
train
def select_all(self, table, limit=MAX_ROWS_PER_QUERY, execute=True): """Query all rows and columns from a table.""" # Determine if a row per query limit should be set num_rows = self.count_rows(table) if num_rows > limit: return self._select_batched(table, '*', num_rows, limi...
python
{ "resource": "" }
q42510
Select.select_distinct
train
def select_distinct(self, table, cols='*', execute=True): """Query distinct values from a table.""" return self.select(table, cols, execute, select_type='SELECT DISTINCT')
python
{ "resource": "" }
q42511
Select.select
train
def select(self, table, cols, execute=True, select_type='SELECT', return_type=list): """Query every row and only certain columns from a table.""" # Validate query type select_type = select_type.upper() assert select_type in SELECT_QUERY_TYPES # Concatenate statement stat...
python
{ "resource": "" }
q42512
Select.select_limit
train
def select_limit(self, table, cols='*', offset=0, limit=MAX_ROWS_PER_QUERY): """Run a select query with an offset and limit parameter.""" return self.fetch(self._select_limit_statement(table, cols, offset, limit))
python
{ "resource": "" }
q42513
Select.select_where
train
def select_where(self, table, cols, where, return_type=list): """ Query certain rows from a table where a particular value is found. cols parameter can be passed as a iterable (list, set, tuple) or a string if only querying a single column. where parameter can be passed as a two or thr...
python
{ "resource": "" }
q42514
Select.select_where_between
train
def select_where_between(self, table, cols, where_col, between): """ Query rows from a table where a columns value is found between two values. :param table: Name of the table :param cols: List, tuple or set of columns or string with single column name :param where_col: Column t...
python
{ "resource": "" }
q42515
Select.select_where_like
train
def select_where_like(self, table, cols, where_col, start=None, end=None, anywhere=None, index=(None, None), length=None): """ Query rows from a table where a specific pattern is found in a column. MySQL syntax assumptions: (%) The percent sign represents z...
python
{ "resource": "" }
q42516
Select._where_clause
train
def _where_clause(where): """ Unpack a where clause tuple and concatenate a MySQL WHERE statement. :param where: 2 or 3 part tuple containing a where_column and a where_value (optional operator) :return: WHERE clause statement """ assert isinstance(where, tuple) ...
python
{ "resource": "" }
q42517
Select._return_rows
train
def _return_rows(self, table, cols, values, return_type): """Return fetched rows in the desired type.""" if return_type is dict: # Pack each row into a dictionary cols = self.get_columns(table) if cols is '*' else cols if len(values) > 0 and isinstance(values[0], (set...
python
{ "resource": "" }
q42518
Select._select_batched
train
def _select_batched(self, table, cols, num_rows, limit, queries_per_batch=3, execute=True): """Run select queries in small batches and return joined resutls.""" # Execute select queries in small batches to avoid connection timeout commands, offset = [], 0 while num_rows > 0: ...
python
{ "resource": "" }
q42519
Select._select_limit_statement
train
def _select_limit_statement(table, cols='*', offset=0, limit=MAX_ROWS_PER_QUERY): """Concatenate a select with offset and limit statement.""" return 'SELECT {0} FROM {1} LIMIT {2}, {3}'.format(join_cols(cols), wrap(table), offset, limit)
python
{ "resource": "" }
q42520
Select._like_pattern
train
def _like_pattern(start, end, anywhere, index, length): """ Create a LIKE pattern to use as a search parameter for a WHERE clause. :param start: Value to be found at the start :param end: Value to be found at the end :param anywhere: Value to be found anywhere :param ind...
python
{ "resource": "" }
q42521
insert_statement
train
def insert_statement(table, columns, values): """Generate an insert statement string for dumping to text file or MySQL execution.""" if not all(isinstance(r, (list, set, tuple)) for r in values): values = [[r] for r in values] rows = [] for row in values: new_row = [] for col in ...
python
{ "resource": "" }
q42522
Export.dump_table
train
def dump_table(self, table, drop_statement=True): """Export a table structure and data to SQL file for backup or later import.""" create_statement = self.get_table_definition(table) data = self.select_all(table) statements = ['\n', sql_file_comment(''), sql_file_com...
python
{ "resource": "" }
q42523
Export.dump_database
train
def dump_database(self, file_path, database=None, tables=None): """ Export the table structure and data for tables in a database. If not database is specified, it is assumed the currently connected database is the source. If no tables are provided, all tables will be dumped. ""...
python
{ "resource": "" }
q42524
retry
train
def retry(method): """ Allows to retry method execution few times. """ def inner(self, *args, **kwargs): attempt_number = 1 while attempt_number < self.retries: try: return method(self, *args, **kwargs) except HasOffersException as exc: ...
python
{ "resource": "" }
q42525
HasOffersAPI.setup_managers
train
def setup_managers(self): """ Allows to access manager by model name - it is convenient, because HasOffers returns model names in responses. """ self._managers = {} for manager_class in MODEL_MANAGERS: instance = manager_class(self) if not instance.forbid_...
python
{ "resource": "" }
q42526
HasOffersAPI.handle_response
train
def handle_response(self, content, target=None, single_result=True, raw=False): """ Parses response, checks it. """ response = content['response'] self.check_errors(response) data = response.get('data') if is_empty(data): return data elif is...
python
{ "resource": "" }
q42527
HasOffersAPI.init_all_objects
train
def init_all_objects(self, data, target=None, single_result=True): """ Initializes model instances from given data. Returns single instance if single_result=True. """ if single_result: return self.init_target_object(target, data) return list(self.expand_models...
python
{ "resource": "" }
q42528
HasOffersAPI.init_target_object
train
def init_target_object(self, target, data): """ Initializes target object and assign extra objects to target as attributes """ target_object = self.init_single_object(target, data.pop(target, data)) for key, item in data.items(): key_alias = MANAGER_ALIASES.get(key, k...
python
{ "resource": "" }
q42529
HasOffersAPI.expand_models
train
def expand_models(self, target, data): """ Generates all objects from given data. """ if isinstance(data, dict): data = data.values() for chunk in data: if target in chunk: yield self.init_target_object(target, chunk) else: ...
python
{ "resource": "" }
q42530
merge_roles
train
def merge_roles(dominant_name, deprecated_name): """ Merges a deprecated role into a dominant role. """ dominant_qs = ContributorRole.objects.filter(name=dominant_name) if not dominant_qs.exists() or dominant_qs.count() != 1: return dominant = dominant_qs.first() deprecated_qs = Cont...
python
{ "resource": "" }
q42531
Bugzilla.quick_search
train
def quick_search(self, terms): '''Wrapper for search_bugs, for simple string searches''' assert type(terms) is str p = [{'quicksearch': terms}] return self.search_bugs(p)
python
{ "resource": "" }
q42532
Bugzilla._get
train
def _get(self, q, params=''): '''Generic GET wrapper including the api_key''' if (q[-1] == '/'): q = q[:-1] headers = {'Content-Type': 'application/json'} r = requests.get('{url}{q}?api_key={key}{params}'.format(url=self.url, q=q, key=self.api_key, params=params), ...
python
{ "resource": "" }
q42533
Bugzilla._post
train
def _post(self, q, payload='', params=''): '''Generic POST wrapper including the api_key''' if (q[-1] == '/'): q = q[:-1] headers = {'Content-Type': 'application/json'} r = requests.post('{url}{q}?api_key={key}{params}'.format(url=self.url, q=q, key=self.api_key, params=params), ...
python
{ "resource": "" }
q42534
game_system.bind_objects
train
def bind_objects(self, *objects): """Bind one or more objects""" self.control.bind_keys(objects) self.objects += objects
python
{ "resource": "" }
q42535
game_system.draw
train
def draw(self): """Draw all the sprites in the system using their renderers. This method is convenient to call from you Pyglet window's on_draw handler to redraw particles when needed. """ glPushAttrib(GL_ALL_ATTRIB_BITS) self.draw_score() for sprite in s...
python
{ "resource": "" }
q42536
ball.reset_ball
train
def reset_ball(self, x, y): """reset ball to set location on the screen""" self.sprite.position.x = x self.sprite.position.y = y
python
{ "resource": "" }
q42537
ball.update
train
def update(self, td): """Update state of ball""" self.sprite.last_position = self.sprite.position self.sprite.last_velocity = self.sprite.velocity if self.particle_group != None: self.update_particle_group(td)
python
{ "resource": "" }
q42538
Box.generate
train
def generate(self): """Return a random point inside the box""" x, y, z = self.point1 return (x + self.size_x * random(), y + self.size_y * random(), z + self.size_z * random())
python
{ "resource": "" }
q42539
custom_search_model
train
def custom_search_model(model, query, preview=False, published=False, id_field="id", sort_pinned=True, field_map={}): """Filter a model with the given filter. `field_map` translates incoming field names to the appropriate ES names. """ if preview: func = preview_filter_f...
python
{ "resource": "" }
q42540
preview_filter_from_query
train
def preview_filter_from_query(query, id_field="id", field_map={}): """This filter includes the "excluded_ids" so they still show up in the editor.""" f = groups_filter_from_query(query, field_map=field_map) # NOTE: we don't exclude the excluded ids here so they show up in the editor # include these, ple...
python
{ "resource": "" }
q42541
filter_from_query
train
def filter_from_query(query, id_field="id", field_map={}): """This returns a filter which actually filters out everything, unlike the preview filter which includes excluded_ids for UI purposes. """ f = groups_filter_from_query(query, field_map=field_map) excluded_ids = query.get("excluded_ids") ...
python
{ "resource": "" }
q42542
get_condition_filter
train
def get_condition_filter(condition, field_map={}): """ Return the appropriate filter for a given group condition. # TODO: integrate this into groups_filter_from_query function. """ field_name = condition.get("field") field_name = field_map.get(field_name, field_name) operation = condition[...
python
{ "resource": "" }
q42543
groups_filter_from_query
train
def groups_filter_from_query(query, field_map={}): """Creates an F object for the groups of a search query.""" f = None # filter groups for group in query.get("groups", []): group_f = MatchAll() for condition in group.get("conditions", []): field_name = condition["field"] ...
python
{ "resource": "" }
q42544
date_range_filter
train
def date_range_filter(range_name): """Create a filter from a named date range.""" filter_days = list(filter( lambda time: time["label"] == range_name, settings.CUSTOM_SEARCH_TIME_PERIODS)) num_days = filter_days[0]["days"] if len(filter_days) else None if num_days: dt = timedel...
python
{ "resource": "" }
q42545
Rest.request
train
def request(self, action, data={}, headers={}, method='GET'): """ Append the REST headers to every request """ headers = { "Authorization": "Bearer " + self.token, "Content-Type": "application/json", "X-Version": "1", "Accept": "application...
python
{ "resource": "" }
q42546
AdminsAPI.make_account_admin
train
def make_account_admin(self, user_id, account_id, role=None, role_id=None, send_confirmation=None): """ Make an account admin. Flag an existing user as an admin within the account. """ path = {} data = {} params = {} # REQUIRED - PATH - account...
python
{ "resource": "" }
q42547
AdminsAPI.list_account_admins
train
def list_account_admins(self, account_id, user_id=None): """ List account admins. List the admins in the account """ path = {} data = {} params = {} # REQUIRED - PATH - account_id """ID""" path["account_id"] = account_id ...
python
{ "resource": "" }
q42548
TintRegistry.match_name
train
def match_name(self, in_string, fuzzy=False): """Match a color to a sRGB value. The matching will be based purely on the input string and the color names in the registry. If there's no direct hit, a fuzzy matching algorithm is applied. This method will never fail to return a sRGB value,...
python
{ "resource": "" }
q42549
TintRegistry.find_nearest
train
def find_nearest(self, hex_code, system, filter_set=None): """Find a color name that's most similar to a given sRGB hex code. In normalization terms, this method implements "normalize an arbitrary sRGB value to a well-defined color name". Args: system (string): The color syst...
python
{ "resource": "" }
q42550
SessionAuthSourceInitializer
train
def SessionAuthSourceInitializer( value_key='sanity.' ): """ An authentication source that uses the current session """ value_key = value_key + 'value' @implementer(IAuthSourceService) class SessionAuthSource(object): vary = [] def __init__(self, context, request): sel...
python
{ "resource": "" }
q42551
CookieAuthSourceInitializer
train
def CookieAuthSourceInitializer( secret, cookie_name='auth', secure=False, max_age=None, httponly=False, path="/", domains=None, debug=False, hashalg='sha512', ): """ An authentication source that uses a unique cookie. """ @implementer(IAuthSourceService) class CookieAut...
python
{ "resource": "" }
q42552
HeaderAuthSourceInitializer
train
def HeaderAuthSourceInitializer( secret, salt='sanity.header.' ): """ An authentication source that uses the Authorization header. """ @implementer(IAuthSourceService) class HeaderAuthSource(object): vary = ['Authorization'] def __init__(self, context, request): self.re...
python
{ "resource": "" }
q42553
PWRESTHandler.sort
train
def sort(self, *sorting, **kwargs): """Sort resources.""" sorting_ = [] for name, desc in sorting: field = self.meta.model._meta.fields.get(name) if field is None: continue if desc: field = field.desc() sorting_.appe...
python
{ "resource": "" }
q42554
PWRESTHandler.paginate
train
def paginate(self, request, offset=0, limit=None): """Paginate queryset.""" return self.collection.offset(offset).limit(limit), self.collection.count()
python
{ "resource": "" }
q42555
AccountsAPI.get_sub_accounts_of_account
train
def get_sub_accounts_of_account(self, account_id, recursive=None): """ Get the sub-accounts of an account. List accounts that are sub-accounts of the given account. """ path = {} data = {} params = {} # REQUIRED - PATH - account_id """...
python
{ "resource": "" }
q42556
AccountsAPI.list_active_courses_in_account
train
def list_active_courses_in_account(self, account_id, by_subaccounts=None, by_teachers=None, completed=None, enrollment_term_id=None, enrollment_type=None, hide_enrollmentless_courses=None, include=None, published=None, search_term=None, state=None, with_enrollments=None): """ List active courses in an...
python
{ "resource": "" }
q42557
AccountsAPI.update_account
train
def update_account(self, id, account_default_group_storage_quota_mb=None, account_default_storage_quota_mb=None, account_default_time_zone=None, account_default_user_storage_quota_mb=None, account_name=None, account_services=None, account_settings_lock_all_announcements_locked=None, account_settings_lock_all_announceme...
python
{ "resource": "" }
q42558
AccountsAPI.create_new_sub_account
train
def create_new_sub_account(self, account_id, account_name, account_default_group_storage_quota_mb=None, account_default_storage_quota_mb=None, account_default_user_storage_quota_mb=None, account_sis_account_id=None): """ Create a new sub-account. Add a new sub-account to a given account. ...
python
{ "resource": "" }
q42559
Delete.delete
train
def delete(self, table, where=None): """Delete existing rows from a table.""" if where: where_key, where_val = where query = "DELETE FROM {0} WHERE {1}='{2}'".format(wrap(table), where_key, where_val) else: query = 'DELETE FROM {0}'.format(wrap(table)) ...
python
{ "resource": "" }
q42560
networks_distribution
train
def networks_distribution(df, filepath=None): """ Generates two alternative plots describing the distribution of variables `mse` and `size`. It is intended to be used over a list of logical networks. Parameters ---------- df: `pandas.DataFrame`_ DataFrame with columns `mse` and `si...
python
{ "resource": "" }
q42561
mappings_frequency
train
def mappings_frequency(df, filepath=None): """ Plots the frequency of logical conjunction mappings Parameters ---------- df: `pandas.DataFrame`_ DataFrame with columns `frequency` and `mapping` filepath: str Absolute path to a folder where to write the plot Returns --...
python
{ "resource": "" }
q42562
behaviors_distribution
train
def behaviors_distribution(df, filepath=None): """ Plots the distribution of logical networks across input-output behaviors. Optionally, input-output behaviors can be grouped by MSE. Parameters ---------- df: `pandas.DataFrame`_ DataFrame with columns `networks` and optionally `mse` ...
python
{ "resource": "" }
q42563
experimental_designs
train
def experimental_designs(df, filepath=None): """ For each experimental design it plot all the corresponding experimental conditions in a different plot Parameters ---------- df: `pandas.DataFrame`_ DataFrame with columns `id` and starting with `TR:` filepath: str Absolute p...
python
{ "resource": "" }
q42564
differences_distribution
train
def differences_distribution(df, filepath=None): """ For each experimental design it plot all the corresponding generated differences in different plots Parameters ---------- df: `pandas.DataFrame`_ DataFrame with columns `id`, `pairs`, and starting with `DIF:` filepath: str ...
python
{ "resource": "" }
q42565
predictions_variance
train
def predictions_variance(df, filepath=None): """ Plots the mean variance prediction for each readout Parameters ---------- df: `pandas.DataFrame`_ DataFrame with columns starting with `VAR:` filepath: str Absolute path to a folder where to write the plots Returns ----...
python
{ "resource": "" }
q42566
intervention_strategies
train
def intervention_strategies(df, filepath=None): """ Plots all intervention strategies Parameters ---------- df: `pandas.DataFrame`_ DataFrame with columns starting with `TR:` filepath: str Absolute path to a folder where to write the plot Returns ------- plot ...
python
{ "resource": "" }
q42567
interventions_frequency
train
def interventions_frequency(df, filepath=None): """ Plots the frequency of occurrence for each intervention Parameters ---------- df: `pandas.DataFrame`_ DataFrame with columns `frequency` and `intervention` filepath: str Absolute path to a folder where to write the plot ...
python
{ "resource": "" }
q42568
Report.add_graph
train
def add_graph( self, y, x_label=None, y_label="", title="", x_run=None, y_run=None, svg_size_px=None, key_position="bottom right", ): """ Add a new graph to the overlap report. Args: y (str): Value plotted on y-axis. x_label ...
python
{ "resource": "" }
q42569
Report.clean
train
def clean(self): """Remove all temporary files.""" rnftools.utils.shell('rm -fR "{}" "{}"'.format(self.report_dir, self._html_fn))
python
{ "resource": "" }
q42570
Traceback.generate_plaintext_traceback
train
def generate_plaintext_traceback(self): """Like the plaintext attribute but returns a generator""" yield text_('Traceback (most recent call last):') for frame in self.frames: yield text_(' File "%s", line %s, in %s' % ( frame.filename, frame.lineno, ...
python
{ "resource": "" }
q42571
Frame.render_source
train
def render_source(self): """Render the sourcecode.""" return SOURCE_TABLE_HTML % text_('\n'.join(line.render() for line in self.get_annotated_lines()))
python
{ "resource": "" }
q42572
DwgSim.recode_dwgsim_reads
train
def recode_dwgsim_reads( dwgsim_prefix, fastq_rnf_fo, fai_fo, genome_id, estimate_unknown_values, number_of_read_tuples=10**9, ): """Convert DwgSim FASTQ file to RNF FASTQ file. Args: dwgsim_prefix (str): DwgSim prefix of the simulation (see its commandl...
python
{ "resource": "" }
q42573
task
train
def task(func): """Decorator to run the decorated function as a Task """ def task_wrapper(*args, **kwargs): return spawn(func, *args, **kwargs) return task_wrapper
python
{ "resource": "" }
q42574
Task.join
train
def join(self, timeout=None): """Wait for this Task to end. If a timeout is given, after the time expires the function will return anyway.""" if not self._started: raise RuntimeError('cannot join task before it is started') return self._exit_event.wait(timeout)
python
{ "resource": "" }
q42575
LogicalNetworkList.reset
train
def reset(self): """ Drop all networks in the list """ self.__matrix = np.array([]) self.__networks = np.array([])
python
{ "resource": "" }
q42576
LogicalNetworkList.split
train
def split(self, indices): """ Splits logical networks according to given indices Parameters ---------- indices : list 1-D array of sorted integers, the entries indicate where the array is split Returns ------- list List of :class:...
python
{ "resource": "" }
q42577
LogicalNetworkList.to_funset
train
def to_funset(self): """ Converts the list of logical networks to a set of `gringo.Fun`_ instances Returns ------- set Representation of all networks as a set of `gringo.Fun`_ instances .. _gringo.Fun: http://potassco.sourceforge.net/gringo.html#Fun ...
python
{ "resource": "" }
q42578
LogicalNetworkList.to_dataframe
train
def to_dataframe(self, networks=False, dataset=None, size=False, n_jobs=-1): """ Converts the list of logical networks to a `pandas.DataFrame`_ object instance Parameters ---------- networks : boolean If True, a column with number of networks having the same behavior...
python
{ "resource": "" }
q42579
LogicalNetworkList.to_csv
train
def to_csv(self, filename, networks=False, dataset=None, size=False, n_jobs=-1): """ Writes the list of logical networks to a CSV file Parameters ---------- filename : str Absolute path where to write the CSV file networks : boolean If True, a co...
python
{ "resource": "" }
q42580
LogicalNetworkList.frequencies_iter
train
def frequencies_iter(self): """ Iterates over all non-zero frequencies of logical conjunction mappings in this list Yields ------ tuple[caspo.core.mapping.Mapping, float] The next pair (mapping,frequency) """ f = self.__matrix.mean(axis=0) for...
python
{ "resource": "" }
q42581
LogicalNetworkList.predictions
train
def predictions(self, setup, n_jobs=-1): """ Returns a `pandas.DataFrame`_ with the weighted average predictions and variance of all readouts for each possible clampings in the given experimental setup. For each logical network the weight corresponds to the number of networks having the ...
python
{ "resource": "" }
q42582
LogicalNetwork.to_graph
train
def to_graph(self): """ Converts the logical network to its underlying interaction graph Returns ------- caspo.core.graph.Graph The underlying interaction graph """ edges = set() for clause, target in self.edges_iter(): for source,...
python
{ "resource": "" }
q42583
LogicalNetwork.step
train
def step(self, state, clamping): """ Performs a simulation step from the given state and with respect to the given clamping Parameters ---------- state : dict The key-value mapping describing the current state of the logical network clamping : caspo.core.cla...
python
{ "resource": "" }
q42584
LogicalNetwork.predictions
train
def predictions(self, clampings, readouts, stimuli=None, inhibitors=None, nclampings=-1): """ Computes network predictions for the given iterable of clampings Parameters ---------- clampings : iterable Iterable over clampings readouts : list[str] ...
python
{ "resource": "" }
q42585
LogicalNetwork.variables
train
def variables(self): """ Returns variables in the logical network Returns ------- set[str] Unique variables names """ variables = set() for v in self.nodes_iter(): if isinstance(v, Clause): for l in v: ...
python
{ "resource": "" }
q42586
LogicalNetwork.formulas_iter
train
def formulas_iter(self): """ Iterates over all variable-clauses in the logical network Yields ------ tuple[str,frozenset[caspo.core.clause.Clause]] The next tuple of the form (variable, set of clauses) in the logical network. """ for var in it.ifilter...
python
{ "resource": "" }
q42587
QuizSubmissionQuestionsAPI.answering_questions
train
def answering_questions(self, attempt, validation_token, quiz_submission_id, access_code=None, quiz_questions=None): """ Answering questions. Provide or update an answer to one or more QuizQuestions. """ path = {} data = {} params = {} # REQUIR...
python
{ "resource": "" }
q42588
QuizSubmissionQuestionsAPI.unflagging_question
train
def unflagging_question(self, id, attempt, validation_token, quiz_submission_id, access_code=None): """ Unflagging a question. Remove the flag that you previously set on a quiz question after you've returned to it. """ path = {} data = {} params ...
python
{ "resource": "" }
q42589
ClampingList.to_funset
train
def to_funset(self, lname="clamping", cname="clamped"): """ Converts the list of clampings to a set of `gringo.Fun`_ instances Parameters ---------- lname : str Predicate name for the clamping id cname : str Predicate name for the clamped variabl...
python
{ "resource": "" }
q42590
ClampingList.to_dataframe
train
def to_dataframe(self, stimuli=None, inhibitors=None, prepend=""): """ Converts the list of clampigns to a `pandas.DataFrame`_ object instance Parameters ---------- stimuli : Optional[list[str]] List of stimuli names. If given, stimuli are converted to {0,1} instead ...
python
{ "resource": "" }
q42591
ClampingList.to_csv
train
def to_csv(self, filename, stimuli=None, inhibitors=None, prepend=""): """ Writes the list of clampings to a CSV file Parameters ---------- filename : str Absolute path where to write the CSV file stimuli : Optional[list[str]] List of stimuli nam...
python
{ "resource": "" }
q42592
ClampingList.frequencies_iter
train
def frequencies_iter(self): """ Iterates over the frequencies of all clamped variables Yields ------ tuple[ caspo.core.literal.Literal, float ] The next tuple of the form (literal, frequency) """ df = self.to_dataframe() n = float(len(self)) ...
python
{ "resource": "" }
q42593
ClampingList.frequency
train
def frequency(self, literal): """ Returns the frequency of a clamped variable Parameters ---------- literal : :class:`caspo.core.literal.Literal` The clamped variable Returns ------- float The frequency of the given literal ...
python
{ "resource": "" }
q42594
ClampingList.differences
train
def differences(self, networks, readouts, prepend=""): """ Returns the total number of pairwise differences over the given readouts for the given networks Parameters ---------- networks : iterable[:class:`caspo.core.logicalnetwork.LogicalNetwork`] Iterable of logical...
python
{ "resource": "" }
q42595
ClampingList.drop_literals
train
def drop_literals(self, literals): """ Returns a new list of clampings without the given literals Parameters ---------- literals : iterable[:class:`caspo.core.literal.Literal`] Iterable of literals to be removed from each clamping Returns ------- ...
python
{ "resource": "" }
q42596
Clamping.to_funset
train
def to_funset(self, index, name="clamped"): """ Converts the clamping to a set of `gringo.Fun`_ object instances Parameters ---------- index : int An external identifier to associate several clampings together in ASP name : str A function name fo...
python
{ "resource": "" }
q42597
Clamping.to_array
train
def to_array(self, variables): """ Converts the clamping to a 1-D array with respect to the given variables Parameters ---------- variables : list[str] List of variables names Returns ------- `numpy.ndarray`_ 1-D array where posi...
python
{ "resource": "" }
q42598
CustomGradebookColumnsAPI.create_custom_gradebook_column
train
def create_custom_gradebook_column(self, course_id, column_title, column_hidden=None, column_position=None, column_teacher_notes=None): """ Create a custom gradebook column. Create a custom gradebook column """ path = {} data = {} params = {} #...
python
{ "resource": "" }
q42599
CustomGradebookColumnsAPI.update_column_data
train
def update_column_data(self, id, user_id, course_id, column_data_content): """ Update column data. Set the content of a custom column """ path = {} data = {} params = {} # REQUIRED - PATH - course_id """ID""" path["course_id"]...
python
{ "resource": "" }