_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q242600
Expression.to_cnf
train
def to_cnf(self): """Return an equivalent expression in conjunctive normal form.""" node = self.node.to_cnf() if node is self.node: return self else: return _expr(node)
python
{ "resource": "" }
q242601
Expression.complete_sum
train
def complete_sum(self): """ Return an equivalent DNF expression that includes all prime implicants. """ node = self.node.complete_sum() if node is self.node: return self else: return _expr(node)
python
{ "resource": "" }
q242602
Expression.expand
train
def expand(self, vs=None, conj=False): """Return the Shannon expansion with respect to a list of variables.""" vs = self._expect_vars(vs) if vs: outer, inner = (And, Or) if conj else (Or, And) terms = [inner(self.restrict(p), *boolfunc.point2ter...
python
{ "resource": "" }
q242603
Expression.encode_inputs
train
def encode_inputs(self): """Return a compact encoding for input variables.""" litmap = dict() nvars = 0 for i, v in enumerate(self.inputs, start=1): litmap[v] = i litmap[~v] = -i litmap[i] = v litmap[-i] = ~v nvars += 1 ...
python
{ "resource": "" }
q242604
Expression.tseitin
train
def tseitin(self, auxvarname='aux'): """Convert the expression to Tseitin's encoding.""" if self.is_cnf(): return self _, constraints = _tseitin(self.to_nnf(), auxvarname) fst = constraints[-1][1] rst = [Equal(v, ex).to_cnf() for v, ex in constraints[:-1]] re...
python
{ "resource": "" }
q242605
Expression.equivalent
train
def equivalent(self, other): """Return True if this expression is equivalent to other.""" f = Xor(self, self.box(other)) return f.satisfy_one() is None
python
{ "resource": "" }
q242606
NormalForm.reduce
train
def reduce(self): """Reduce to a canonical form.""" support = frozenset(range(1, self.nvars+1)) new_clauses = set() for clause in self.clauses: vs = list(support - {abs(uniqid) for uniqid in clause}) if vs: for num in range(1 << len(vs)): ...
python
{ "resource": "" }
q242607
DisjNormalForm.decode
train
def decode(self, litmap): """Convert the DNF to an expression.""" return Or(*[And(*[litmap[idx] for idx in clause]) for clause in self.clauses])
python
{ "resource": "" }
q242608
ConjNormalForm.satisfy_one
train
def satisfy_one(self, assumptions=None, **params): """ If the input CNF is satisfiable, return a satisfying input point. A contradiction will return None. """ verbosity = params.get('verbosity', 0) default_phase = params.get('default_phase', 2) propagation_limit =...
python
{ "resource": "" }
q242609
ConjNormalForm.satisfy_all
train
def satisfy_all(self, **params): """Iterate through all satisfying input points.""" verbosity = params.get('verbosity', 0) default_phase = params.get('default_phase', 2) propagation_limit = params.get('propagation_limit', -1) decision_limit = params.get('decision_limit', -1) ...
python
{ "resource": "" }
q242610
ConjNormalForm.soln2point
train
def soln2point(soln, litmap): """Convert a solution vector to a point.""" return {litmap[i]: int(val > 0) for i, val in enumerate(soln, start=1)}
python
{ "resource": "" }
q242611
_cover2exprs
train
def _cover2exprs(inputs, noutputs, cover): """Convert a cover to a tuple of Expression instances.""" fs = list() for i in range(noutputs): terms = list() for invec, outvec in cover: if outvec[i]: term = list() for j, v in enumerate(inputs): ...
python
{ "resource": "" }
q242612
fcat
train
def fcat(*fs): """Concatenate a sequence of farrays. The variadic *fs* input is a homogeneous sequence of functions or arrays. """ items = list() for f in fs: if isinstance(f, boolfunc.Function): items.append(f) elif isinstance(f, farray): items.extend(f.flat...
python
{ "resource": "" }
q242613
_dims2shape
train
def _dims2shape(*dims): """Convert input dimensions to a shape.""" if not dims: raise ValueError("expected at least one dimension spec") shape = list() for dim in dims: if isinstance(dim, int): dim = (0, dim) if isinstance(dim, tuple) and len(dim) == 2: if...
python
{ "resource": "" }
q242614
_volume
train
def _volume(shape): """Return the volume of a shape.""" prod = 1 for start, stop in shape: prod *= stop - start return prod
python
{ "resource": "" }
q242615
_zeros
train
def _zeros(ftype, *dims): """Return a new farray filled with zeros.""" shape = _dims2shape(*dims) objs = [ftype.box(0) for _ in range(_volume(shape))] return farray(objs, shape, ftype)
python
{ "resource": "" }
q242616
_vars
train
def _vars(ftype, name, *dims): """Return a new farray filled with Boolean variables.""" shape = _dims2shape(*dims) objs = list() for indices in itertools.product(*[range(i, j) for i, j in shape]): objs.append(_VAR[ftype](name, indices)) return farray(objs, shape, ftype)
python
{ "resource": "" }
q242617
_uint2objs
train
def _uint2objs(ftype, num, length=None): """Convert an unsigned integer to a list of constant expressions.""" if num == 0: objs = [ftype.box(0)] else: _num = num objs = list() while _num != 0: objs.append(ftype.box(_num & 1)) _num >>= 1 if length:...
python
{ "resource": "" }
q242618
_uint2farray
train
def _uint2farray(ftype, num, length=None): """Convert an unsigned integer to an farray.""" if num < 0: raise ValueError("expected num >= 0") else: objs = _uint2objs(ftype, num, length) return farray(objs)
python
{ "resource": "" }
q242619
_int2farray
train
def _int2farray(ftype, num, length=None): """Convert a signed integer to an farray.""" if num < 0: req_length = clog2(abs(num)) + 1 objs = _uint2objs(ftype, 2**req_length + num) else: req_length = clog2(num + 1) + 1 objs = _uint2objs(ftype, num, req_length) if length: ...
python
{ "resource": "" }
q242620
_itemize
train
def _itemize(objs): """Recursive helper function for farray.""" if not isinstance(objs, collections.Sequence): raise TypeError("expected a sequence of Function") isseq = [isinstance(obj, collections.Sequence) for obj in objs] if not any(isseq): ftype = None for obj in objs: ...
python
{ "resource": "" }
q242621
_check_shape
train
def _check_shape(shape): """Verify that a shape has the right format.""" if isinstance(shape, tuple): for dim in shape: if (isinstance(dim, tuple) and len(dim) == 2 and isinstance(dim[0], int) and isinstance(dim[1], int)): if dim[0] < 0: ...
python
{ "resource": "" }
q242622
_norm_index
train
def _norm_index(dim, index, start, stop): """Return an index normalized to an farray start index.""" length = stop - start if -length <= index < 0: normindex = index + length elif start <= index < stop: normindex = index - start else: fstr = "expected dim {} index in range [{...
python
{ "resource": "" }
q242623
_norm_slice
train
def _norm_slice(sl, start, stop): """Return a slice normalized to an farray start index.""" length = stop - start if sl.start is None: normstart = 0 else: if sl.start < 0: if sl.start < -length: normstart = 0 else: normstart = sl.st...
python
{ "resource": "" }
q242624
_filtdim
train
def _filtdim(items, shape, dim, nsl): """Return items, shape filtered by a dimension slice.""" normshape = tuple(stop - start for start, stop in shape) nsl_type = type(nsl) newitems = list() # Number of groups num = reduce(operator.mul, normshape[:dim+1]) # Size of each group size = len(...
python
{ "resource": "" }
q242625
_iter_coords
train
def _iter_coords(nsls): """Iterate through all matching coordinates in a sequence of slices.""" # First convert all slices to ranges ranges = list() for nsl in nsls: if isinstance(nsl, int): ranges.append(range(nsl, nsl+1)) else: ranges.append(range(nsl.start, nsl...
python
{ "resource": "" }
q242626
farray.restrict
train
def restrict(self, point): """Apply the ``restrict`` method to all functions. Returns a new farray. """ items = [f.restrict(point) for f in self._items] return self.__class__(items, self.shape, self.ftype)
python
{ "resource": "" }
q242627
farray.compose
train
def compose(self, mapping): """Apply the ``compose`` method to all functions. Returns a new farray. """ items = [f.compose(mapping) for f in self._items] return self.__class__(items, self.shape, self.ftype)
python
{ "resource": "" }
q242628
farray.reshape
train
def reshape(self, *dims): """Return an equivalent farray with a modified shape.""" shape = _dims2shape(*dims) if _volume(shape) != self.size: raise ValueError("expected shape with equal volume") return self.__class__(self._items, shape, self.ftype)
python
{ "resource": "" }
q242629
farray.to_uint
train
def to_uint(self): """Convert vector to an unsigned integer, if possible. This is only useful for arrays filled with zero/one entries. """ num = 0 for i, f in enumerate(self._items): if f.is_zero(): pass elif f.is_one(): nu...
python
{ "resource": "" }
q242630
farray.to_int
train
def to_int(self): """Convert vector to an integer, if possible. This is only useful for arrays filled with zero/one entries. """ num = self.to_uint() if num and self._items[-1].unbox(): return num - (1 << self.size) else: return num
python
{ "resource": "" }
q242631
farray.uor
train
def uor(self): """Unary OR reduction operator""" return reduce(operator.or_, self._items, self.ftype.box(0))
python
{ "resource": "" }
q242632
farray.uand
train
def uand(self): """Unary AND reduction operator""" return reduce(operator.and_, self._items, self.ftype.box(1))
python
{ "resource": "" }
q242633
farray.uxor
train
def uxor(self): """Unary XOR reduction operator""" return reduce(operator.xor, self._items, self.ftype.box(0))
python
{ "resource": "" }
q242634
farray._keys2sls
train
def _keys2sls(self, keys, key2sl): """Convert an input key to a list of slices.""" sls = list() if isinstance(keys, tuple): for key in keys: sls.append(key2sl(key)) else: sls.append(key2sl(keys)) if len(sls) > self.ndim: fstr = ...
python
{ "resource": "" }
q242635
farray._coord2offset
train
def _coord2offset(self, coord): """Convert a normalized coordinate to an item offset.""" size = self.size offset = 0 for dim, index in enumerate(coord): size //= self._normshape[dim] offset += size * index return offset
python
{ "resource": "" }
q242636
farray._op_shape
train
def _op_shape(self, other): """Return shape that will be used by farray constructor.""" if isinstance(other, farray): if self.shape == other.shape: return self.shape elif self.size == other.size: return None else: raise ...
python
{ "resource": "" }
q242637
delete_records
train
def delete_records(keep=20): """Clean up files on server and mark the record as deleted""" sql = "SELECT * from records where is_deleted<>1 ORDER BY id desc LIMIT -1 offset {}".format(keep) assert isinstance(g.db, sqlite3.Connection) c = g.db.cursor() c.execute(sql) rows = c.fetchall() for r...
python
{ "resource": "" }
q242638
WebdriverWrapperErrorMixin.check_expected_errors
train
def check_expected_errors(self, test_method): """ This method is called after each test. It will read decorated informations and check if there are expected errors. You can set expected errors by decorators :py:func:`.expected_error_page`, :py:func:`.allowed_error_pages`, :py:fu...
python
{ "resource": "" }
q242639
WebdriverWrapperErrorMixin.get_error_page
train
def get_error_page(self): """ Method returning error page. Should return string. By default it find element with class ``error-page`` and returns text of ``h1`` header. You can change this method accordingly to your app. Error page returned from this method is used in decorator...
python
{ "resource": "" }
q242640
WebdriverWrapperErrorMixin.get_error_traceback
train
def get_error_traceback(self): """ Method returning traceback of error page. By default it find element with class ``error-page`` and returns text of element with class ``traceback``. You can change this method accordingly to your app. """ try: error_...
python
{ "resource": "" }
q242641
WebdriverWrapperErrorMixin.get_error_messages
train
def get_error_messages(self): """ Method returning error messages. Should return list of messages. By default it find element with class ``error`` and theirs value in attribute ``error`` or text if that attribute is missing. You can change this method accordingly to your app. ...
python
{ "resource": "" }
q242642
WebdriverWrapperInfoMixin.check_expected_infos
train
def check_expected_infos(self, test_method): """ This method is called after each test. It will read decorated informations and check if there are expected infos. You can set expected infos by decorators :py:func:`.expected_info_messages` and :py:func:`.allowed_info_messages`. ...
python
{ "resource": "" }
q242643
WebdriverWrapperInfoMixin.get_info_messages
train
def get_info_messages(self): """ Method returning info messages. Should return list of messages. By default it find element with class ``info`` and theirs value in attribute ``info`` or text if that attribute is missing. You can change this method accordingly to your app. ...
python
{ "resource": "" }
q242644
_ConvertToWebelementWrapper._make_instance
train
def _make_instance(cls, element_class, webelement): """ Firefox uses another implementation of element. This method switch base of wrapped element to firefox one. """ if isinstance(webelement, FirefoxWebElement): element_class = copy.deepcopy(element_class) ...
python
{ "resource": "" }
q242645
_WebdriverWrapper.html
train
def html(self): """ Returns ``innerHTML`` of whole page. On page have to be tag ``body``. .. versionadded:: 2.2 """ try: body = self.get_elm(tag_name='body') except selenium_exc.NoSuchElementException: return None else: return ...
python
{ "resource": "" }
q242646
_WebdriverWrapper.switch_to_window
train
def switch_to_window(self, window_name=None, title=None, url=None): """ WebDriver implements switching to other window only by it's name. With wrapper there is also option to switch by title of window or URL. URL can be also relative path. """ if window_name: ...
python
{ "resource": "" }
q242647
_WebdriverWrapper.close_window
train
def close_window(self, window_name=None, title=None, url=None): """ WebDriver implements only closing current window. If you want to close some window without having to switch to it, use this method. """ main_window_handle = self.current_window_handle self.switch_to_windo...
python
{ "resource": "" }
q242648
_WebdriverWrapper.close_other_windows
train
def close_other_windows(self): """ Closes all not current windows. Useful for tests - after each test you can automatically close all windows. """ main_window_handle = self.current_window_handle for window_handle in self.window_handles: if window_handle == mai...
python
{ "resource": "" }
q242649
_WebdriverWrapper.close_alert
train
def close_alert(self, ignore_exception=False): """ JS alerts all blocking. This method closes it. If there is no alert, method raises exception. In tests is good to call this method with ``ignore_exception`` setted to ``True`` which will ignore any exception. """ try: ...
python
{ "resource": "" }
q242650
_WebdriverWrapper.wait_for_alert
train
def wait_for_alert(self, timeout=None): """ Shortcut for waiting for alert. If it not ends with exception, it returns that alert. Detault timeout is `~.default_wait_timeout`. """ if not timeout: timeout = self.default_wait_timeout alert = Alert(self) ...
python
{ "resource": "" }
q242651
DocstringTypeMeta.type_name
train
def type_name(self) -> T.Optional[str]: """Return type name associated with given docstring metadata.""" return self.args[1] if len(self.args) > 1 else None
python
{ "resource": "" }
q242652
Docstring.params
train
def params(self) -> T.List[DocstringParam]: """Return parameters indicated in docstring.""" return [ DocstringParam.from_meta(meta) for meta in self.meta if meta.args[0] in {"param", "parameter", "arg", "argument", "key", "keyword"} ]
python
{ "resource": "" }
q242653
Docstring.raises
train
def raises(self) -> T.List[DocstringRaises]: """Return exceptions indicated in docstring.""" return [ DocstringRaises.from_meta(meta) for meta in self.meta if meta.args[0] in {"raises", "raise", "except", "exception"} ]
python
{ "resource": "" }
q242654
Docstring.returns
train
def returns(self) -> T.Optional[DocstringReturns]: """Return return information indicated in docstring.""" try: return next( DocstringReturns.from_meta(meta) for meta in self.meta if meta.args[0] in {"return", "returns", "yield", "yields"} ...
python
{ "resource": "" }
q242655
_build_meta
train
def _build_meta(text: str, title: str) -> DocstringMeta: """Build docstring element. :param text: docstring element text :param title: title of section containing element :return: """ meta = _sections[title] if meta == "returns" and ":" not in text.split()[0]: return DocstringMeta(...
python
{ "resource": "" }
q242656
parse
train
def parse(text: str) -> Docstring: """ Parse the Google-style docstring into its components. :returns: parsed docstring """ ret = Docstring() if not text: return ret # Clean according to PEP-0257 text = inspect.cleandoc(text) # Find first title and split on its position ...
python
{ "resource": "" }
q242657
_determine_tool
train
def _determine_tool(files): """Yields tuples in the form of (linker file, tool the file links for""" for file in files: linker_ext = file.split('.')[-1] if "sct" in linker_ext or "lin" in linker_ext: yield (str(file),"uvision") elif "ld" in linker_ext: yield (str(...
python
{ "resource": "" }
q242658
IAREmbeddedWorkbenchProject._get_option
train
def _get_option(self, settings, find_key): """ Return index for provided key """ # This is used as in IAR template, everything # is as an array with random positions. We look for key with an index for option in settings: if option['name'] == find_key: return ...
python
{ "resource": "" }
q242659
IAREmbeddedWorkbenchProject._ewp_flags_set
train
def _ewp_flags_set(self, ewp_dic_subset, project_dic, flag_type, flag_dic): """ Flags from misc to set to ewp project """ try: if flag_type in project_dic['misc'].keys(): # enable commands index_option = self._get_option(ewp_dic_subset, flag_dic['enable']) ...
python
{ "resource": "" }
q242660
IAREmbeddedWorkbenchProject._ewp_files_set
train
def _ewp_files_set(self, ewp_dic, project_dic): """ Fills files in the ewp dictionary """ # empty any files in the template which are not grouped try: ewp_dic['project']['file'] = [] except KeyError: pass # empty groups ewp_dic['project']['group'] ...
python
{ "resource": "" }
q242661
IAREmbeddedWorkbenchProject._clean_xmldict_single_dic
train
def _clean_xmldict_single_dic(self, dictionary): """ Every None replace by '' in the dic, as xml parsers puts None in those fiels, which is not valid for IAR """ for k, v in dictionary.items(): if v is None: dictionary[k] = ''
python
{ "resource": "" }
q242662
IAREmbeddedWorkbench._fix_paths
train
def _fix_paths(self, data): """ All paths needs to be fixed - add PROJ_DIR prefix + normalize """ data['include_paths'] = [join('$PROJ_DIR$', path) for path in data['include_paths']] if data['linker_file']: data['linker_file'] = join('$PROJ_DIR$', data['linker_file']) data[...
python
{ "resource": "" }
q242663
IAREmbeddedWorkbench.build_project
train
def build_project(self): """ Build IAR project """ # > IarBuild [project_path] -build [project_name] proj_path = join(getcwd(), self.workspace['files']['ewp']) if proj_path.split('.')[-1] != 'ewp': proj_path += '.ewp' if not os.path.exists(proj_path): logg...
python
{ "resource": "" }
q242664
Exporter.gen_file_jinja
train
def gen_file_jinja(self, template_file, data, output, dest_path): if not os.path.exists(dest_path): os.makedirs(dest_path) output = join(dest_path, output) logger.debug("Generating: %s" % output) """ Fills data to the project template, using jinja2. """ env = Environ...
python
{ "resource": "" }
q242665
Exporter._expand_data
train
def _expand_data(self, old_data, new_data, group): """ data expansion - uvision needs filename and path separately. """ for file in old_data: if file: extension = file.split(".")[-1].lower() if extension in self.file_types.keys(): new_data[...
python
{ "resource": "" }
q242666
Exporter._get_groups
train
def _get_groups(self, data): """ Get all groups defined """ groups = [] for attribute in SOURCE_KEYS: for k, v in data[attribute].items(): if k == None: k = 'Sources' if k not in groups: groups.append(k) ...
python
{ "resource": "" }
q242667
Exporter._iterate
train
def _iterate(self, data, expanded_data): """ _Iterate through all data, store the result expansion in extended dictionary """ for attribute in SOURCE_KEYS: for k, v in data[attribute].items(): if k == None: group = 'Sources' else: ...
python
{ "resource": "" }
q242668
EclipseGnuARM.export_project
train
def export_project(self): """ Processes groups and misc options specific for eclipse, and run generator """ output = copy.deepcopy(self.generated_project) data_for_make = self.workspace.copy() self.exporter.process_data_for_makefile(data_for_make) output['path'], output['files'...
python
{ "resource": "" }
q242669
ProjectWorkspace.generate
train
def generate(self, tool, copied=False, copy=False): """ Generates a workspace """ # copied - already done by external script, copy - do actual copy tools = [] if not tool: logger.info("Workspace supports one tool for all projects within.") return -1 else...
python
{ "resource": "" }
q242670
Project._validate_tools
train
def _validate_tools(self, tool): """ Use tool_supported or tool """ tools = [] if not tool: if len(self.project['common']['tools_supported']) == 0: logger.info("No tool defined.") return -1 tools = self.project['common']['tools_supported']...
python
{ "resource": "" }
q242671
Project._generate_output_dir
train
def _generate_output_dir(settings, path): """ This is a separate function, so that it can be more easily tested """ relpath = os.path.relpath(settings.root,path) count = relpath.count(os.sep) + 1 return relpath+os.path.sep, count
python
{ "resource": "" }
q242672
Project._copy_sources_to_generated_destination
train
def _copy_sources_to_generated_destination(self): """ Copies all project files to specified directory - generated dir """ files = [] for key in FILES_EXTENSIONS.keys(): if type(self.project['export'][key]) is dict: for k,v in self.project['export'][key].items(): ...
python
{ "resource": "" }
q242673
Project.clean
train
def clean(self, tool): """ Clean a project """ tools = self._validate_tools(tool) if tools == -1: return -1 for current_tool in tools: # We get the export dict formed, then use it for cleaning self._fill_export_dict(current_tool) path = s...
python
{ "resource": "" }
q242674
Project.generate
train
def generate(self, tool, copied=False, copy=False): """ Generates a project """ tools = self._validate_tools(tool) if tools == -1: return -1 generated_files = {} result = 0 for export_tool in tools: exporter = ToolsSupported().get_tool(export_too...
python
{ "resource": "" }
q242675
Project.build
train
def build(self, tool): """build the project""" tools = self._validate_tools(tool) if tools == -1: return -1 result = 0 for build_tool in tools: builder = ToolsSupported().get_tool(build_tool) # None is an error if builder is None...
python
{ "resource": "" }
q242676
Project.get_generated_project_files
train
def get_generated_project_files(self, tool): """ Get generated project files, the content depends on a tool. Look at tool implementation """ exporter = ToolsSupported().get_tool(tool) return exporter(self.generated_files[tool], self.settings).get_generated_project_files()
python
{ "resource": "" }
q242677
MakefileArmcc.export_project
train
def export_project(self): """ Processes misc options specific for GCC ARM, and run generator """ generated_projects = deepcopy(self.generated_projects) self.process_data_for_makefile(self.workspace) generated_projects['path'], generated_projects['files']['makefile'] = self.gen_file_jinja...
python
{ "resource": "" }
q242678
MakefileTool._parse_specific_options
train
def _parse_specific_options(self, data): """ Parse all specific setttings. """ data['common_flags'] = [] data['ld_flags'] = [] data['c_flags'] = [] data['cxx_flags'] = [] data['asm_flags'] = [] for k, v in data['misc'].items(): if type(v) is list: ...
python
{ "resource": "" }
q242679
SublimeTextMakeGccARM.export_project
train
def export_project(self): """ Processes misc options specific for GCC ARM, and run generator. """ output = copy.deepcopy(self.generated_project) self.process_data_for_makefile(self.workspace) self._fix_sublime_paths(self.workspace) self.workspace['linker_options'] =[] ou...
python
{ "resource": "" }
q242680
fix_paths
train
def fix_paths(project_data, rel_path, extensions): """ Fix paths for extension list """ norm_func = lambda path : os.path.normpath(os.path.join(rel_path, path)) for key in extensions: if type(project_data[key]) is dict: for k,v in project_data[key].items(): project_data[k...
python
{ "resource": "" }
q242681
TypedList._make_cls
train
def _make_cls(self, value): """If value is not instance of self._cls, converts and returns it. Otherwise, returns value. :param value: the thing to make a self._cls from :rtype self._cls """ if isinstance(value, self._cls): return value return self._c...
python
{ "resource": "" }
q242682
RemoteLRS._send_request
train
def _send_request(self, request): """Establishes connection and returns http response based off of request. :param request: HTTPRequest object :type request: :class:`tincan.http_request.HTTPRequest` :returns: LRS Response object :rtype: :class:`tincan.lrs_response.LRSResponse` ...
python
{ "resource": "" }
q242683
RemoteLRS.about
train
def about(self): """Gets about response from LRS :return: LRS Response object with the returned LRS about object as content :rtype: :class:`tincan.lrs_response.LRSResponse` """ request = HTTPRequest( method="GET", resource="about" ) lrs_re...
python
{ "resource": "" }
q242684
RemoteLRS.save_statement
train
def save_statement(self, statement): """Save statement to LRS and update statement id if necessary :param statement: Statement object to be saved :type statement: :class:`tincan.statement.Statement` :return: LRS Response object with the saved statement as content :rtype: :class:...
python
{ "resource": "" }
q242685
RemoteLRS.save_statements
train
def save_statements(self, statements): """Save statements to LRS and update their statement id's :param statements: A list of statement objects to be saved :type statements: :class:`StatementList` :return: LRS Response object with the saved list of statements as content :rtype: ...
python
{ "resource": "" }
q242686
RemoteLRS.retrieve_statement
train
def retrieve_statement(self, statement_id): """Retrieve a statement from the server from its id :param statement_id: The UUID of the desired statement :type statement_id: str | unicode :return: LRS Response object with the retrieved statement as content :rtype: :class:`tincan.lr...
python
{ "resource": "" }
q242687
RemoteLRS.query_statements
train
def query_statements(self, query): """Query the LRS for statements with specified parameters :param query: Dictionary of query parameters and their values :type query: dict :return: LRS Response object with the returned StatementsResult object as content :rtype: :class:`tincan.l...
python
{ "resource": "" }
q242688
RemoteLRS.more_statements
train
def more_statements(self, more_url): """Query the LRS for more statements :param more_url: URL from a StatementsResult object used to retrieve more statements :type more_url: str | unicode :return: LRS Response object with the returned StatementsResult object as content :rtype: ...
python
{ "resource": "" }
q242689
RemoteLRS.retrieve_state_ids
train
def retrieve_state_ids(self, activity, agent, registration=None, since=None): """Retrieve state id's from the LRS with the provided parameters :param activity: Activity object of desired states :type activity: :class:`tincan.activity.Activity` :param agent: Agent object of desired state...
python
{ "resource": "" }
q242690
RemoteLRS.retrieve_state
train
def retrieve_state(self, activity, agent, state_id, registration=None): """Retrieve state from LRS with the provided parameters :param activity: Activity object of desired state :type activity: :class:`tincan.activity.Activity` :param agent: Agent object of desired state :type a...
python
{ "resource": "" }
q242691
RemoteLRS.save_state
train
def save_state(self, state): """Save a state doc to the LRS :param state: State document to be saved :type state: :class:`tincan.documents.state_document.StateDocument` :return: LRS Response object with saved state as content :rtype: :class:`tincan.lrs_response.LRSResponse` ...
python
{ "resource": "" }
q242692
RemoteLRS._delete_state
train
def _delete_state(self, activity, agent, state_id=None, registration=None, etag=None): """Private method to delete a specified state from the LRS :param activity: Activity object of state to be deleted :type activity: :class:`tincan.activity.Activity` :param agent: Agent object of state...
python
{ "resource": "" }
q242693
RemoteLRS.delete_state
train
def delete_state(self, state): """Delete a specified state from the LRS :param state: State document to be deleted :type state: :class:`tincan.documents.state_document.StateDocument` :return: LRS Response object :rtype: :class:`tincan.lrs_response.LRSResponse` """ ...
python
{ "resource": "" }
q242694
RemoteLRS.retrieve_activity_profile
train
def retrieve_activity_profile(self, activity, profile_id): """Retrieve activity profile with the specified parameters :param activity: Activity object of the desired activity profile :type activity: :class:`tincan.activity.Activity` :param profile_id: UUID of the desired profile ...
python
{ "resource": "" }
q242695
RemoteLRS.save_activity_profile
train
def save_activity_profile(self, profile): """Save an activity profile doc to the LRS :param profile: Activity profile doc to be saved :type profile: :class:`tincan.documents.activity_profile_document.ActivityProfileDocument` :return: LRS Response object with the saved activity profile d...
python
{ "resource": "" }
q242696
RemoteLRS.delete_activity_profile
train
def delete_activity_profile(self, profile): """Delete activity profile doc from LRS :param profile: Activity profile document to be deleted :type profile: :class:`tincan.documents.activity_profile_document.ActivityProfileDocument` :return: LRS Response object :rtype: :class:`tin...
python
{ "resource": "" }
q242697
RemoteLRS.retrieve_agent_profile
train
def retrieve_agent_profile(self, agent, profile_id): """Retrieve agent profile with the specified parameters :param agent: Agent object of the desired agent profile :type agent: :class:`tincan.agent.Agent` :param profile_id: UUID of the desired agent profile :type profile_id: st...
python
{ "resource": "" }
q242698
RemoteLRS.save_agent_profile
train
def save_agent_profile(self, profile): """Save an agent profile doc to the LRS :param profile: Agent profile doc to be saved :type profile: :class:`tincan.documents.agent_profile_document.AgentProfileDocument` :return: LRS Response object with the saved agent profile doc as content ...
python
{ "resource": "" }
q242699
RemoteLRS.delete_agent_profile
train
def delete_agent_profile(self, profile): """Delete agent profile doc from LRS :param profile: Agent profile document to be deleted :type profile: :class:`tincan.documents.agent_profile_document.AgentProfileDocument` :return: LRS Response object :rtype: :class:`tincan.lrs_respons...
python
{ "resource": "" }