code
stringlengths
1
18.2k
parent.genus_type.identifier == 'course': found_course = True course_node = parent else: search_node = parent if course_node is None: return '' else: for index, child in enumerate(self.my_osid_object.get_children()): group_ids[index] = 'i4x://{0}/{1}/{2}/{3}'.format(course_node.org.text, re.sub('[^\w\s-]', '', course_n...
def export_olx(self, tarball, root_path): """if sequestered, only export the assets""" def append_asset_to_soup_and_export(asset_): if isinstance(asset_, Item): try: unique_url = asset_.export_olx(tarball, root_path) except AttributeError: pass else: unique_name = get_file_name_without_extension(unique_url) asset_type ...
if my_tag == 'split_test': getattr(my_soup, my_tag)['group_id_to_child'] = self.my_osid_object.group_id_to_child getattr(my_soup, my_tag)['user_partition_id'] = self.my_osid_object.user_partition_id.text rm = self.my_osid_object._get_provider_manager('REPOSITORY') if self.my_osid_object._proxy is None: cls = rm.get_com...
def load(self, d3mds): """Load X, y and context from D3MDS.""" X, y = d3mds.get_data() return Dataset(d3mds.dataset_id, X, y)
def load(self, d3mds): """Load X, y and context from D3MDS.""" X, y = d3mds.get_data() resource_columns = d3mds.get_related_resources(self.data_modality) for resource_column in resource_columns: X = self.load_resources(X, resource_column, d3mds) context = self.get_context(X, y) return Dataset(d3mds.dataset_id, X, y, co...
def long_encode(input, errors='strict'): """Transliterate to 8 bit using as many letters as needed. For example, \u00e4 LATIN SMALL LETTER A WITH DIAERESIS ``ä`` will be replaced with ``ae``. """ if not isinstance(input, text_type): input = text_type(input, sys.getdefaultencoding(), errors) length = len(input) input = ...
def short_encode(input, errors='strict'): """Transliterate to 8 bit using as few letters as possible. For example, \u00e4 LATIN SMALL LETTER A WITH DIAERESIS ``ä`` will be replaced with ``a``. """ if not isinstance(input, text_type): input = text_type(input, sys.getdefaultencoding(), errors) length = len(input) input =...
def single_encode(input, errors='strict'): """Transliterate to 8 bit using only single letter replacements. For example, \u2639 WHITE FROWNING FACE ``☹`` will be passed through unchanged. """ if not isinstance(input, text_type): input = text_type(input, sys.getdefaultencoding(), errors) length = len(input) input = unic...
def _double_encoding_factory(encoder, byte_encoder, byte_encoding): """Send the transliterated output to another codec.""" def dbl_encode(input, errors='strict'): uni, length = encoder(input, errors) return byte_encoder(uni, errors)[0], length dbl_encode.__name__ = '%s_%s' % (encoder.__name__, byte_encoding) return dbl...
def trans_search(encoding): """Lookup transliterating codecs.""" if encoding == 'transliterate': return codecs.CodecInfo(long_encode, no_decode) # translit/long/utf8 # translit/one # translit/short/ascii if encoding.startswith('translit/'): parts = encoding.split('/') if parts[1] == 'long': encoder = long_encode elif p...
def visit(self, node): """Returns a generator that walks all children recursively.""" for child in node: yield child for subchild in self.visit(child): yield subchild
def get_objective_mdata(): """Return default mdata map for Objective""" return { 'cognitive_process': { 'element_label': { 'text': 'cognitive process', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'formatTypeId': str(DEFAULT_FORMAT_TYPE), }, 'instructions': { 'text': 'accepts ...
False, 'array': False, 'default_id_values': [''], 'syntax': 'ID', 'id_set': [], }, }
def get_activity_mdata(): """Return default mdata map for Activity""" return { 'courses': { 'element_label': { 'text': 'courses', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'formatTypeId': str(DEFAULT_FORMAT_TYPE), }, 'instructions': { 'text': 'accepts an osid.id.Id[] object...
False, 'default_id_values': [''], 'syntax': 'ID', 'id_set': [], }, 'assets': { 'element_label': { 'text': 'assets', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'formatTypeId': str(DEFAULT_FORMAT_TYPE), }, 'instructions': { 'text': 'accepts an osid.id.Id[] object', 'languageTy...
def get_proficiency_mdata(): """Return default mdata map for Proficiency""" return { 'completion': { 'element_label': { 'text': 'completion', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'formatTypeId': str(DEFAULT_FORMAT_TYPE), }, 'instructions': { 'text': 'enter a decimal va...
False, 'read_only': False, 'linked': False, 'array': False, 'default_id_values': [''], 'syntax': 'ID', 'id_set': [], }, 'level': { 'element_label': { 'text': 'level', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'formatTypeId': str(DEFAULT_FORMAT_TYPE), }, 'instructions': { 't...
def getLogger(name): """Return a logger from a given name. If the name does not have a log handler, this will create one for it based on the module name which will log everything to a log file in a location the executing user will have access to. :param name: ``str`` :return: ``object`` """ log = logging.getLogger(name...
def getMessage(self): """Returns a colorized log message based on the log level. If the platform is windows the original message will be returned without colorization windows escape codes are crazy. :returns: ``str`` """ msg = str(self.msg) if self.args: msg = msg % self.args if platform.system().lower() == 'windows' o...
def default_logger(self, name=__name__, enable_stream=False, enable_file=True): """Default Logger. This is set to use a rotating File handler and a stream handler. If you use this logger all logged output that is INFO and above will be logged, unless debug_logging is set then everything is logged. The logger will send ...
is True: stream_handler = logging.StreamHandler() self.set_handler(log, handler=stream_handler) log.info('Logger [ %s ] loaded', name) return log
def set_handler(self, log, handler): """Set the logging level as well as the handlers. :param log: ``object`` :param handler: ``object`` """ if self.debug_logging is True: log.setLevel(logging.DEBUG) handler.setLevel(logging.DEBUG) else: log.setLevel(logging.INFO) handler.setLevel(logging.INFO) handler.name = self.name...
def return_logfile(filename, log_dir='/var/log'): """Return a path for logging file. If ``log_dir`` exists and the userID is 0 the log file will be written to the provided log directory. If the UserID is not 0 or log_dir does not exist the log file will be written to the users home folder. :param filename: ``str`` :par...
def text_coords(string, position): r""" Transform a simple index into a human-readable position in a string. This function accepts a string and an index, and will return a triple of `(lineno, columnno, line)` representing the position through the text. It's useful for displaying a string index in a human-readable way::...
def get_regex(regex): """ Ensure we have a compiled regular expression object. >>> import re >>> get_regex('string') # doctest: +ELLIPSIS <_sre.SRE_Pattern object at 0x...> >>> pattern = re.compile(r'string') >>> get_regex(pattern) is pattern True >>> get_regex(3) # doctest: +ELLIPSIS Traceback (most recent call last):...
def beginning_of_line(self): r""" Return true if the scan pointer is at the beginning of a line. >>> s = Scanner("test\ntest\n") >>> s.beginning_of_line() True >>> s.skip(r'te') 2 >>> s.beginning_of_line() False >>> s.skip(r'st\n') 3 >>> s.beginning_of_line() True >>> s.terminate() >>> s.beginning_of_line() True """ if...
def getch(self): """ Get a single character and advance the scan pointer. >>> s = Scanner("abc") >>> s.getch() 'a' >>> s.getch() 'b' >>> s.getch() 'c' >>> s.pos 3 """ self.pos += 1 return self.string[self.pos - 1:self.pos]
def peek(self, length): """ Get a number of characters without advancing the scan pointer. >>> s = Scanner("test string") >>> s.peek(7) 'test st' >>> s.peek(7) 'test st' """ return self.string[self.pos:self.pos + length]
def unscan(self): """ Undo the last scan, resetting the position and match registers. >>> s = Scanner('test string') >>> s.pos 0 >>> s.skip(r'te') 2 >>> s.rest 'st string' >>> s.unscan() >>> s.pos 0 >>> s.rest 'test string' """ self.pos_history.pop() self._pos = self.pos_history[-1] self.match_history.pop() self._match...
def scan_full(self, regex, return_string=True, advance_pointer=True): """ Match from the current position. If `return_string` is false and a match is found, returns the number of characters matched. >>> s = Scanner("test string") >>> s.scan_full(r' ') >>> s.scan_full(r'test ') 'test ' >>> s.pos 5 >>> s.scan_full(r'stri...
def search_full(self, regex, return_string=True, advance_pointer=True): """ Search from the current position. If `return_string` is false and a match is found, returns the number of characters matched (from the current position *up to* the end of the match). >>> s = Scanner("test string") >>> s.search_full(r' ') 'test ...
def scan(self, regex): """ Match a pattern from the current position. If a match is found, advances the scan pointer and returns the matched string. Otherwise returns ``None``. >>> s = Scanner("test string") >>> s.pos 0 >>> s.scan(r'foo') >>> s.scan(r'bar') >>> s.pos 0 >>> s.scan(r'test ') 'test ' >>> s.pos 5 """ retur...
def scan_until(self, regex): """ Search for a pattern from the current position. If a match is found, advances the scan pointer and returns the matched string, from the current position *up to* the end of the match. Otherwise returns ``None``. >>> s = Scanner("test string") >>> s.pos 0 >>> s.scan_until(r'foo') >>> s.sc...
def scan_upto(self, regex): """ Scan up to, but not including, the given regex. >>> s = Scanner("test string") >>> s.scan('t') 't' >>> s.scan_upto(r' ') 'est' >>> s.pos 4 >>> s.pos_history [0, 1, 4] """ pos = self.pos if self.scan_until(regex) is not None: self.pos -= len(self.matched()) # Remove the intermediate posit...
def skip(self, regex): """ Like :meth:`scan`, but return the number of characters matched. >>> s = Scanner("test string") >>> s.skip('test ') 5 """ return self.scan_full(regex, return_string=False, advance_pointer=True)
def skip_until(self, regex): """ Like :meth:`scan_until`, but return the number of characters matched. >>> s = Scanner("test string") >>> s.skip_until(' ') 5 """ return self.search_full(regex, return_string=False, advance_pointer=True)
def check(self, regex): """ See what :meth:`scan` would return without advancing the pointer. >>> s = Scanner("test string") >>> s.check('test ') 'test ' >>> s.pos 0 """ return self.scan_full(regex, return_string=True, advance_pointer=False)
def check_until(self, regex): """ See what :meth:`scan_until` would return without advancing the pointer. >>> s = Scanner("test string") >>> s.check_until(' ') 'test ' >>> s.pos 0 """ return self.search_full(regex, return_string=True, advance_pointer=False)
def exists(self, regex): """ See what :meth:`skip_until` would return without advancing the pointer. >>> s = Scanner("test string") >>> s.exists(' ') 5 >>> s.pos 0 Returns the number of characters matched if it does exist, or ``None`` otherwise. """ return self.search_full(regex, return_string=False, advance_pointer=Fa...
def address_from_path(self, path=None): """ Args: path (str): Path for the HD wallet. If path is ``None`` it will generate a unique path based on time. Returns: A ``tuple`` with the path and leaf address. """ path = path if path else self._unique_hierarchical_string() return path, self.wallet.subkey_for_path(path).addr...
def _unique_hierarchical_string(self): """ Returns: str: a representation of time such as:: '2014/2/23/15/26/8/9877978' The last part (microsecond) is needed to avoid duplicates in rapid-fire transactions e.g. ``> 1`` edition. """ t = datetime.now() return '%s/%s/%s/%s/%s/%s/%s' % (t.year, t.month, t.day, t.hour, t.min...
def parse(requirements): """ Parses given requirements line-by-line. """ transformer = RTransformer() return map(transformer.transform, filter(None, map(_parse, requirements.splitlines())))
def authenticate(self, transport, account_name, password): """ Authenticates account, if no password given tries to pre-authenticate. @param transport: transport to use for method calls @param account_name: account name @param password: account password @return: AuthToken if authentication succeeded @raise AuthExceptio...
def simulate_system(self, parameters, initial_conditions, timepoints, max_moment_order=1, number_of_processes=1): """ Perform Gillespie SSA simulations and returns trajectories for of each species. Each trajectory is interpolated at the given time points. By default, the average amounts of species for all simulations i...
returned, instead of the averaged moments. E.g. a value of one will return means, a values of two, means, variances and covariance and so on. :return: a list of :class:`~means.simulation.Trajectory` one per species in the problem, or a list of lists of trajectories (one per simulation) if `return_average == False`. :rt...
= multiprocessing.Pool(number_of_processes, initializer=multiprocessing_pool_initialiser, initargs=[population_rates_as_function, self.__problem.change, self.__problem.species, initial_conditions, t_max, self.__random_seed]) results = p.map(multiprocessing_apply_ssa, seed_for_processes) p.close() p.join() resampled_res...
def _gssa(self, initial_conditions, t_max): """ This function is inspired from Yoav Ram's code available at: http://nbviewer.ipython.org/github/yoavram/ipython-notebooks/blob/master/GSSA.ipynb :param initial_conditions: the initial conditions of the system :param t_max: the time when the simulation should stop :return:...
def generate_single_simulation(self, x): """ Generate a single SSA simulation :param x: an integer to reset the random seed. If None, the initial random number generator is used :return: a list of :class:`~means.simulation.Trajectory` one per species in the problem :rtype: list[:class:`~means.simulation.Trajectory`] ""...
def requirements(): """Build the requirements list for this project""" requirements_list = [] with open('requirements.txt') as requirements: for install in requirements: requirements_list.append(install.strip()) return requirements_list
def request(self, url, parameters): """Perform a http(s) request for given parameters to given URL Keyword arguments: url -- API url parameters -- dict with payload. """ try: request = Request(url + '?' + urlencode(parameters), None, { 'X-Authentication-Token': self.api_key, 'User-Agent': self.user_agent }, None, False...
def do_sum(self, count=1): '''Set self.sum, self.avr and return sum of dice rolled, count times. :param count: Number of rolls to make :return: Total sum of all rolls ''' if not self.roll.summable: return 0 self.sum = sum(self.roll.roll(count)) self.avr = self.sum / count return self.sum
def do_bucket(self, count=1): '''Set self.bucket and return results. :param count: Number of rolls to make :return: List of tuples (total of roll, times it was rolled) ''' self._bucket = dict() for roll in self.roll.roll(count): self._bucket[roll] = self._bucket.get(roll, 0) + 1 return self.bucket
def do_run(self, count=1): '''Roll count dice, store results. Does all stats so might be slower than specific doFoo methods. But, it is proly faster than running each of those seperately to get same stats. Sets the following properties: - stats.bucket - stats.sum - stats.avr :param count: Number of rolls to make. ''' i...
def get_distr(center=0.0, stdev=default_stdev, length=50): "Returns a PDF of a given length. " # distr = np.random.random(length) # sticking to normal distibution to easily control separability distr = rng.normal(center, stdev, size=[length, 1]) return distr
def make_random_histogram(center=0.0, stdev=default_stdev, length=default_feature_dim, num_bins=default_num_bins): "Returns a sequence of histogram density values that sum to 1.0" hist, bin_edges = np.histogram(get_distr(center, stdev, length), range=edge_range, bins=num_bins, density=True) # to ensure they sum to 1.0 ...
def pull(self, conf, ignore_missing=False): """Push this image""" with Builder().remove_replaced_images(conf): self.push_or_pull(conf, "pull", ignore_missing=ignore_missing)
def push_or_pull(self, conf, action=None, ignore_missing=False): """Push or pull this image""" if action not in ("push", "pull"): raise ProgrammerError("Should have called push_or_pull with action to either push or pull, got {0}".format(action)) if not conf.image_index: raise BadImage("Can't {0} without an image_index ...
sync_stream.feed(line) except Failure as error: if ignore_missing and action == "pull": log.error("Failed to %s an image\timage=%s\timage_name=%s\tmsg=%s", action, conf.name, conf.image_name, error) break else: raise FailedImage("Failed to {0} an image".format(action), image=conf.name, image_name=conf.image_name, msg=e...
def match_grade_system_id(self, grade_system_id, match): """Sets the grade system ``Id`` for this query. arg: grade_system_id (osid.id.Id): a grade system ``Id`` arg: match (boolean): ``true`` for a positive match, ``false`` for a negative match raise: NullArgument - ``grade_system_id`` is ``null`` *compliance: mandato...
def releasers(cls): """ Returns all of the supported releasers. """ return [ HookReleaser, VersionFileReleaser, PythonReleaser, CocoaPodsReleaser, NPMReleaser, CReleaser, ChangelogReleaser, GitHubReleaser, GitReleaser, ]
def detected_releasers(cls, config): """ Returns all of the releasers that are compatible with the project. """ def get_config(releaser): if config: return config.get(releaser.config_name(), {}) return {} releasers = [] for releaser_cls in cls.releasers(): releaser_config = get_config(releaser_cls) if releaser_config.g...
def check_version_consistency(self): """ Determine if any releasers have inconsistent versions """ version = None releaser_name = None for releaser in self.releasers: try: next_version = releaser.determine_current_version() except NotImplementedError: continue if next_version and version and version != next_version: ra...
def get_aws_s3_handle(config_map): """Convenience function for getting AWS S3 objects Added by cjshaw@mit.edu, Jan 9, 2015 Added to aws_adapter build by birdland@mit.edu, Jan 25, 2015, and added support for Configuration May 25, 2017: Switch to boto3 """ url = 'https://' + config_map['s3_bucket'] + '.s3.amazonaws.com' ...
def get_signed_url(url, config_map): """ Convenience function for getting cloudfront signed URL given a saved URL cjshaw, Jan 7, 2015 Follows: http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ private-content-creating-signed-url-canned-policy.html#private- content-creating-signed-url-canned-policy-proc...
def remove_file(config_map, file_key): """Convenience function for removing objects from AWS S3 Added by cjshaw@mit.edu, Apr 28, 2015 May 25, 2017: Switch to boto3 """ # for boto3, need to remove any leading / if file_key[0] == '/': file_key = file_key[1::] client = boto3.client( 's3', aws_access_key_id=config_map['put...
def get_grade_systems(self): """Gets the grade system list resulting from the search. return: (osid.grading.GradeSystemList) - the grade system list raise: IllegalState - list already retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: raise errors.IllegalState('List has already...
def get_grade_entries(self): """Gets the package list resulting from the search. return: (osid.grading.GradeEntryList) - the grade entry list raise: IllegalState - list already retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: raise errors.IllegalState('List has already been r...
def get_gradebook_columns(self): """Gets the gradebook column list resulting from the search. return: (osid.grading.GradebookColumnList) - the gradebook column list raise: IllegalState - list already retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: raise errors.IllegalState('...
def get_gradebooks(self): """Gets the gradebook list resulting from the search. return: (osid.grading.GradebookList) - the gradebook list raise: IllegalState - list already retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: raise errors.IllegalState('List has already been retri...
def _get_next_object(self, object_class): """stub""" try: next_object = OsidList.next(self) except StopIteration: raise except Exception: # Need to specify exceptions here! raise OperationFailed() if isinstance(next_object, dict): next_object = object_class(next_object) return next_object
def get_relationship_lookup_session(self): """Gets the ``OsidSession`` associated with the relationship lookup service. return: (osid.relationship.RelationshipLookupSession) - a ``RelationshipLookupSession`` raise: OperationFailed - unable to complete request raise: Unimplemented - ``supports_relationship_lookup()`` is...
def get_relationship_lookup_session_for_family(self, family_id=None): """Gets the ``OsidSession`` associated with the relationship lookup service for the given family. arg: family_id (osid.id.Id): the ``Id`` of the family return: (osid.relationship.RelationshipLookupSession) - a ``RelationshipLookupSession`` raise: Not...
def get_relationship_admin_session_for_family(self, family_id=None): """Gets the ``OsidSession`` associated with the relationship administration service for the given family. arg: family_id (osid.id.Id): the ``Id`` of the ``Family`` return: (osid.relationship.RelationshipAdminSession) - a ``RelationshipAdminSession`` r...
def get_family_lookup_session(self): """Gets the ``OsidSession`` associated with the family lookup service. return: (osid.relationship.FamilyLookupSession) - a ``FamilyLookupSession`` raise: OperationFailed - unable to complete request raise: Unimplemented - ``supports_family_lookup()`` is ``false`` *compliance: option...
def get_family_admin_session(self): """Gets the ``OsidSession`` associated with the family administrative service. return: (osid.relationship.FamilyAdminSession) - a ``FamilyAdminSession`` raise: OperationFailed - unable to complete request raise: Unimplemented - ``supports_family_admin()`` is ``false`` *compliance: op...
def get_relationship_lookup_session_for_family(self, family_id=None, proxy=None, *args, **kwargs): """Gets the ``OsidSession`` associated with the relationship lookup service for the given family. arg: family_id (osid.id.Id): the ``Id`` of the family arg: proxy (osid.proxy.Proxy): a proxy return: (osid.relationship.Rel...
proxy=proxy, runtime=self._runtime, **kwargs) except AttributeError: raise OperationFailed() return session
def get_relationship_query_session(self, proxy=None): """Gets the ``OsidSession`` associated with the relationship query service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.relationship.RelationshipQuerySession) - a ``RelationshipQuerySession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFaile...
def get_relationship_query_session_for_family(self, family_id=None, proxy=None): """Gets the ``OsidSession`` associated with the relationship query service for the given family. arg: family_id (osid.id.Id): the ``Id`` of the family arg: proxy (osid.proxy.Proxy): a proxy return: (osid.relationship.RelationshipQuerySessi...
except AttributeError: raise OperationFailed() return session
def get_relationship_search_session(self, proxy=None): """Gets the ``OsidSession`` associated with the relationship search service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.relationship.RelationshipSearchSession) - a ``RelationshipSearchSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationF...
def get_relationship_search_session_for_family(self, family_id=None, proxy=None): """Gets the ``OsidSession`` associated with the relationship search service for the given family. arg: family_id (osid.id.Id): the ``Id`` of the family arg: proxy (osid.proxy.Proxy): a proxy return: (osid.relationship.RelationshipSearchSe...
except AttributeError: raise OperationFailed() return session
def get_relationship_admin_session(self, proxy=None): """Gets the ``OsidSession`` associated with the relationship administration service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.relationship.RelationshipAdminSession) - a ``RelationshipAdminSession`` raise: NullArgument - ``proxy`` is ``null`` raise: Opera...
def get_relationship_admin_session_for_family(self, family_id=None, proxy=None, *args, **kwargs): """Gets the ``OsidSession`` associated with the relationship administration service for the given family. arg: family_id (osid.id.Id): the ``Id`` of the family arg: proxy (osid.proxy.Proxy): a proxy return: (osid.relations...
proxy=proxy, runtime=self._runtime, **kwargs) except AttributeError: raise OperationFailed() return session
def get_relationship_family_session(self, proxy=None): """Gets the ``OsidSession`` to lookup relationship/family mappings. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.relationship.RelationshipFamilySession) - a ``RelationshipFamilySession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - u...
def get_relationship_family_assignment_session(self, proxy=None): """Gets the ``OsidSession`` associated with assigning relationships to families. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.relationship.RelationshipFamilyAssignmentSession) - a ``RelationshipFamilyAssignmentSession`` raise: NullArgument - ``pr...
def get_family_lookup_session(self, proxy=None, *args, **kwargs): """Gets the ``OsidSession`` associated with the family lookup service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.relationship.FamilyLookupSession) - a ``FamilyLookupSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed -...
def get_family_query_session(self, proxy=None): """Gets the ``OsidSession`` associated with the family query service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.relationship.FamilyQuerySession) - a ``FamilyQuerySession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - unable to complete r...
def get_family_search_session(self, proxy=None): """Gets the ``OsidSession`` associated with the family search service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.relationship.FamilySearchSession) - a ``FamilySearchSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - unable to comple...
def get_family_hierarchy_session(self, proxy=None): """Gets the ``OsidSession`` associated with the family hierarchy service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.relationship.FamilyHierarchySession) - a ``FamilyHierarchySession`` for families raise: NullArgument - ``proxy`` is ``null`` raise: Operation...
def get_family_hierarchy_design_session(self, proxy=None): """Gets the ``OsidSession`` associated with the family hierarchy design service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.relationship.FamilyHierarchyDesignSession) - a ``HierarchyDesignSession`` for families raise: NullArgument - ``proxy`` is ``nul...
def _get_asset_content(self, asset_id, asset_content_type_str=None, asset_content_id=None): """stub""" rm = self.my_osid_object._get_provider_manager('REPOSITORY') if 'assignedBankIds' in self.my_osid_object._my_map: if self.my_osid_object._proxy is not None: als = rm.get_asset_lookup_session_for_repository( Id(self.my...
def create_asset(self, asset_data=None, asset_type=None, asset_content_type=None, asset_content_record_types=None, display_name='', description=''): """stub""" # This method creates a new Asset in the Repository orchestrated # with this AssessmentBank: return self._set_asset(asset_data=asset_data, asset_type=asset_type...
def _set_asset(self, asset_data=None, asset_type=None, asset_content_type=None, asset_content_record_types=None, display_name='', description=''): """stub""" # This method should be deprecated and its code added to the create_asset method: rm = self.my_osid_object_form._get_provider_manager('REPOSITORY') catalog_id = '...
aas.get_asset_content_form_for_create(asset_id, asset_content_type_list) if asset_content_type is not None: acfc.set_genus_type(asset_content_type) acfc.set_data(asset_data) ac = aas.create_asset_content(acfc) # really stupid, but set the data again, because for filesystem impl # the ID above will be off by one-ish -- ...
def add_content_to_asset(self, asset_id, asset_data=None, asset_url=None, asset_content_type=None, asset_label=None): """stub""" # This method creates a new AssetContent related to the given asset_id: return self._add_asset_content(asset_id=asset_id, asset_data=asset_data, asset_url=asset_url, asset_content_type=asset_...
def _add_asset_content(self, asset_id, asset_data=None, asset_url=None, asset_content_type=None, asset_label=None): """stub""" rm = self.my_osid_object_form._get_provider_manager('REPOSITORY') try: # for create forms catalog_id = self.my_osid_object_form._catalog_id except AttributeError: # for update forms catalog_id ...
def get_creation_time(self): """stub""" ct = self.my_osid_object._my_map['creationTime'] return DateTime(ct.year, ct.month, ct.day, ct.hour, ct.minute, ct.second, ct.microsecond)