Return iCal objects and etags of all Remind entries in uids

        filename -- the remind file
        uids -- the UIDs of the Remind lines (all if None)
331477
def to_vobjects(self, filename, uids=None):
        
        self._update()

        if not uids:
            uids = self._reminders[filename]

        items = []

        for uid in uids:
            cal = iCalendar()
            self._gen_vevent(self._reminders[filename][uid], cal.add('vevent'))
            etag = md5()
            etag.update(self._reminders[filename][uid]['line'].encode("utf-8"))
            items.append((uid, cal, '"%s"' % etag.hexdigest()))
        return items
522544
def _parse_access_token(self, r):
        '''
        
        '''
        current = int(time.time())
        expires = r.expires_in + current
        remind_in = r.get('remind_in', None)
        if remind_in:
            rtime = int(remind_in) + current
            if rtime < expires:
                expires = rtime
        return JsonDict(access_token=r.access_token, expires=expires, expires_in=expires, uid=r.get('uid', None))
852854
def get_reference_results(self):
        
        referenceresults = self.context.getReferenceResults()
        return dict(map(lambda rr: (rr.get("uid"), rr), referenceresults))
273871
def get_uids(self):
        
        uids = self.get_uids_from_request()
        if not uids and api.is_object(self.context):
            uids = [api.get_uid(self.context)]
        return uids
583328
def ics2rem():
    """"""
    from argparse import ArgumentParser, FileType
    from sys import stdin, stdout

    parser = ArgumentParser(description='Converter from iCalendar to Remind syntax.')
    parser.add_argument('-l', '--label', help='Label for every Remind entry')
    parser.add_argument('-p', '--priority', type=int,
                        help='Priority for every Remind entry (0..9999)')
    parser.add_argument('-t', '--tag', action='append',
                        help='Tag(s) for every Remind entry')
    parser.add_argument('--tail',
                        help='Text to append to every remind summary, following final %%"')
    parser.add_argument('--sep', default=" ",
                        help='String to separate summary (and tail) from description')
    parser.add_argument('--postdate',
                        help='String to follow the date in every Remind entry. '
                        'Useful for entering "back" and "delta" fields (see man remind).')
    parser.add_argument('--posttime',
                        help='String to follow the time in every timed Remind entry. '
                        'Useful for entering "tdelta" and "trepeat" fields (see man remind).')
    parser.add_argument('-z', '--zone',
                        help='Timezone of Remind file (default: local timezone)')
    parser.add_argument('infile', nargs='?', type=FileType('r'), default=stdin,
                        help='Input iCalendar file (default: stdin)')
    parser.add_argument('outfile', nargs='?', type=FileType('w'), default=stdout,
                        help='Output Remind file (default: stdout)')
    args = parser.parse_args()

    zone = timezone(args.zone) if args.zone else None

    vobject = readOne(args.infile.read())
    rem = Remind(localtz=zone).to_reminders(
        vobject, args.label, args.priority, args.tag, args.tail, args.sep,
        args.postdate, args.posttime)
    args.outfile.write(rem)
943455
def ICALImporter(ctx, filename, all, owner, calendar, create_calendar, clear_calendar, dry, execfilter):
    

    log('iCal importer running')

    objectmodels = ctx.obj['db'].objectmodels

    if objectmodels['user'].count({'name': owner}) > 0:
        owner_object = objectmodels['user'].find_one({'name': owner})
    elif objectmodels['user'].count({'uuid': owner}) > 0:
        owner_object = objectmodels['user'].find_one({'uuid': owner})
    else:
        log('User unknown. Specify either uuid or name.', lvl=warn)
        return

    log('Found user')

    if objectmodels['calendar'].count({'name': calendar}) > 0:
        calendar = objectmodels['calendar'].find_one({'name': calendar})
    elif objectmodels['calendar'].count({'uuid': owner}) > 0:
        calendar = objectmodels['calendar'].find_one({'uuid': calendar})
    elif create_calendar:
        calendar = objectmodels['calendar']({
            'uuid': std_uuid(),
            'name': calendar
        })
    else:
        log('Calendar unknown and no --create-calendar specified. Specify either uuid or name of an existing calendar.',
            lvl=warn)
        return

    log('Found calendar')

    if clear_calendar is True:
        log('Clearing calendar events')
        for item in objectmodels['event'].find({'calendar': calendar.uuid}):
            item.delete()

    with open(filename, 'rb') as file_object:
        caldata = Calendar.from_ical(file_object.read())

    keys = {
        'class': 'str',
        'created': 'dt',
        'description': 'str',
        'dtstart': 'dt',
        'dtend': 'dt',
        'timestamp': 'dt',
        'modified': 'dt',
        'location': 'str',
        'status': 'str',
        'summary': 'str',
        'uid': 'str'
    }
    mapping = {
        'description': 'summary',
        'summary': 'name'
    }

    imports = []

    def ical_import_filter(original, logfacilty):
        log('Passthrough filter')
        return original

    if execfilter is not None:
        import os

        textFilePath = os.path.abspath(os.path.join(os.path.curdir, execfilter))
        textFileFolder = os.path.dirname(textFilePath)

        from importlib.machinery import SourceFileLoader

        filter_module = SourceFileLoader("importfilter", textFilePath).load_module()
        ical_import_filter = filter_module.ical_import_filter

    for event in caldata.walk():
        if event.name == 'VEVENT':
            log(event, lvl=verbose, pretty=True)
            initializer = {
                'uuid': std_uuid(),
                'calendar': calendar.uuid,
            }

            for item in keys:
                thing = event.get(item, None)
                if thing is None:
                    thing = 'NO-' + item
                else:
                    if keys[item] == 'str':
                        thing = str(thing)
                    else:
                        thing = parser.parse(str(thing.dt))
                        thing = thing.isoformat()

                if item in mapping:
                    item_assignment = mapping[item]
                else:
                    item_assignment = item

                initializer[item_assignment] = thing
            new_event = objectmodels['event'](initializer)

            new_event = ical_import_filter(new_event, log)

            imports.append(new_event)

            log(new_event, lvl=debug)

    for ev in imports:
        log(ev.summary)

    if not dry:
        log('Bulk creating events')
        objectmodels['event'].bulk_create(imports)

        calendar.save()
    else:
        log('Dry run - nothing stored.', lvl=warn)
481458
def replace_vobject(self, uid, ical, filename=None):
        """"""
        if not filename:
            filename = self._filename
        elif filename not in self._reminders:
            return

        uid = uid.split('@')[0]

        with self._lock:
            rem = open(filename).readlines()
            for (index, line) in enumerate(rem):
                if uid == md5(line[:-1].encode('utf-8')).hexdigest():
                    rem[index] = self.to_reminders(ical)
                    new_uid = self._get_uid(rem[index])
                    open(filename, 'w').writelines(rem)
                    return new_uid
296707
def get_all(self, uids: Iterable[int]) -> Mapping[int, Record]:
        
        return {uid: self._records[uid] for uid in uids
                if uid in self._records}
272986
def get_items(self):
        
        uids = self.get_uids()
        if not uids:
            return [SuperModel(self.context)]
        items = map(lambda uid: SuperModel(uid), uids)
        return self._resolve_number_of_copies(items)
1050900
def get_file_ids(object):
    """"""
    import MOPdbaccess
    mysql = MOPdbaccess.connect('cfeps','cfhls',dbSystem='MYSQL')
    cfeps=mysql.cursor()
    sql="SELECT file_id FROM measure WHERE provisional LIKE %s"
    cfeps.execute(sql,(object, ))
    file_ids=cfeps.fetchall()

    return (file_ids)
845898
def _GetTimelineStatEntriesRelDB(api_client_id, file_path, with_history=True):
  """"""
  path_type, components = rdf_objects.ParseCategorizedPath(file_path)

  client_id = str(api_client_id)

  try:
    root_path_info = data_store.REL_DB.ReadPathInfo(client_id, path_type,
                                                    components)
  except db.UnknownPathError:
    return

  path_infos = []
  for path_info in itertools.chain(
      [root_path_info],
      data_store.REL_DB.ListDescendentPathInfos(client_id, path_type,
                                                components),
  ):
    # TODO(user): this is to keep the compatibility with current
    # AFF4 implementation. Check if this check is needed.
    if path_info.directory:
      continue

    categorized_path = rdf_objects.ToCategorizedPath(path_info.path_type,
                                                     path_info.components)
    if with_history:
      path_infos.append(path_info)
    else:
      yield categorized_path, path_info.stat_entry, path_info.hash_entry

  if with_history:
    hist_path_infos = data_store.REL_DB.ReadPathInfosHistories(
        client_id, path_type, [tuple(pi.components) for pi in path_infos])
    for path_info in itertools.chain(*hist_path_infos.itervalues()):
      categorized_path = rdf_objects.ToCategorizedPath(path_info.path_type,
                                                       path_info.components)
      yield categorized_path, path_info.stat_entry, path_info.hash_entry
339549
def getFixedStarList(IDs, date):
    
    starList = [getFixedStar(ID, date) for ID in IDs]
    return FixedStarList(starList)
801812
def adj_names(self):
        
        return list(self.pst.parameter_data.parnme.loc[~self.fixed_indexer])
806453
def rem2ics():
    """"""
    # pylint: disable=maybe-no-member
    from argparse import ArgumentParser, FileType
    from dateutil.parser import parse
    from sys import stdin, stdout

    parser = ArgumentParser(description='Converter from Remind to iCalendar syntax.')
    parser.add_argument('-s', '--startdate', type=lambda s: parse(s).date(),
                        default=date.today() - timedelta(weeks=12),
                        help='Start offset for remind call (default: -12 weeks)')
    parser.add_argument('-m', '--month', type=int, default=15,
                        help='Number of month to generate calendar beginning wit startdate (default: 15)')
    parser.add_argument('-a', '--alarm', type=int, default=-10,
                        help='Trigger time for the alarm before the event in minutes (default: -10)')
    parser.add_argument('-z', '--zone',
                        help='Timezone of Remind file (default: local timezone)')
    parser.add_argument('infile', nargs='?', default=expanduser('~/.reminders'),
                        help='The Remind file to process (default: ~/.reminders)')
    parser.add_argument('outfile', nargs='?', type=FileType('w'), default=stdout,
                        help='Output iCalendar file (default: stdout)')
    args = parser.parse_args()

    zone = timezone(args.zone) if args.zone else None

    if args.infile == '-':
        remind = Remind(args.infile, zone, args.startdate, args.month, timedelta(minutes=args.alarm))
        vobject = remind.stdin_to_vobject(stdin.read())
        if vobject:
            args.outfile.write(vobject.serialize())
    else:
        remind = Remind(args.infile, zone, args.startdate, args.month, timedelta(minutes=args.alarm))
        args.outfile.write(remind.to_vobject().serialize())
1356956
def update_reminder(self, reminder):
		'''
		'''
		uri = '/'.join([self.api_uri,
						self.reminders_suffix,
						])
		#req sanity check
		payload = None
		if  type(reminder) is not StreakReminder:
			return requests.codes.bad_request, None

		payload = reminder.to_dict(rw = True)
	
		try:
			uri = '/'.join([uri, reminder.attributes['key']])
		except KeyError:
			return requests.codes.bad_request, None
	
		code, data = self._req('post', uri , json.dumps(payload))
		
		return code, data
894820
def getidfobjectlist(idf):
    """"""
    idfobjects = idf.idfobjects  
    # idfobjlst = [idfobjects[key] for key in idfobjects if idfobjects[key]]
    idfobjlst = [idfobjects[key] for key in idf.model.dtls if idfobjects[key]]
        # `for key in idf.model.dtls` maintains the order
        # `for key in idfobjects` does not have order
    idfobjlst = itertools.chain.from_iterable(idfobjlst)
    idfobjlst = list(idfobjlst)
    return idfobjlst
168067
def find_file_ident_desc_by_name(self, currpath):
        # type: (bytes) -> UDFFileIdentifierDescriptor
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('UDF File Entry not initialized')

        # If this is a directory or it is an empty directory, just skip
        # all work.
        if self.icb_tag.file_type != 4 or not self.fi_descs:
            raise pycdlibexception.PyCdlibInvalidInput('Could not find path')

        tmp = currpath.decode('utf-8')
        try:
            latin1_currpath = tmp.encode('latin-1')
        except (UnicodeDecodeError, UnicodeEncodeError):
            latin1_currpath = b''
        ucs2_currpath = tmp.encode('utf-16_be')

        child = None

        for fi_desc in self.fi_descs:
            if latin1_currpath and fi_desc.encoding == 'latin-1':
                eq = fi_desc.fi == latin1_currpath
            else:
                eq = fi_desc.fi == ucs2_currpath

            if eq:
                child = fi_desc
                break

        if child is None:
            raise pycdlibexception.PyCdlibInvalidInput('Could not find path')

        return child