Parse the lease file and return a list of Lease instances.
174007
def get(self, include_backups=False):
        
        leases = []
        with open(self.filename) if not self.gzip else gzip.open(self.filename) as lease_file:
            lease_data = lease_file.read()
            if self.gzip:
                lease_data = lease_data.decode('utf-8')
            for match in self.regex_leaseblock.finditer(lease_data):
                block = match.groupdict()

                properties, options, sets = _extract_properties(block['config'])

                if 'hardware' not in properties and not include_backups:
                    # E.g. rows like {'binding': 'state abandoned', ...}
                    continue
                lease = Lease(block['ip'], properties=properties, options=options, sets=sets)
                leases.append(lease)

            for match in self.regex_leaseblock6.finditer(lease_data):
                block = match.groupdict()
                properties, options, sets = _extract_properties(block['config'])

                host_identifier = block['id']
                block_type = block['type']
                last_client_communication = parse_time(properties['cltt'])

                for address_block in self.regex_iaaddr.finditer(block['config']):
                    block = address_block.groupdict()
                    properties, options, sets = _extract_properties(block['config'])

                    lease = Lease6(block['ip'], properties, last_client_communication, host_identifier, block_type,
                                   options=options, sets=sets)
                    leases.append(lease)

        return leases
1042040
def with_source(self, lease):
        
        self.partition_id = lease.partition_id
        self.epoch = lease.epoch
        self.owner = lease.owner
        self.token = lease.token
        self.event_processor_context = lease.event_processor_context
317350
def get_properties(attributes):
        
        return [key for key, value in six.iteritems(attributes)
                if isinstance(value, property)]
1313726
def read_instances(self):
        
        logger.debug('Reading instances from: %s', self.instances_path)
        if os.path.exists(self.instances_path):
            with open(self.instances_path, 'r') as f:
                list_ = yaml.load(f.read())
                self.cluster = Cluster.from_list(list_, settings=self.settings)
199012
def keys(self):
        
        result = self.client.post(self.client.get_url("/kv/lease/timetolive"),
                                  json={"ID": self.id,
                                        "keys": True})
        keys = result['keys'] if 'keys' in result else []
        return [_decode(key) for key in keys]
427725
def parse_file(file):
    
    lines = []
    for line in file:
        line = line.rstrip('\n')
        if line == '%%':
            # This is a separator between items. Parse the data we've
            # collected and yield the result.
            yield from parse_item(lines)
            lines.clear()
        elif line.startswith('  '):
            # This is a continuation line. Concatenate it to the previous
            # line, including one of the spaces.
            lines[-1] += line[1:]
        else:
            lines.append(line)
    yield from parse_item(lines)
154992
def parse_files(self, req, name, field):
        """"""
        return get_value(req.files, name, field)
567294
def load_instances(self, instances):
        
        instances = instances.encode()

        if os.path.exists(instances):
            try:
                return self._load_instances_binary(instances)
            except CLIPSError:
                return self._load_instances_text(instances)
        else:
            return self._load_instances_string(instances)
1246100
private void readPropertiesFiles() {

        if (this.messageFileWildcard.isEmpty() || !CoreParameters.LOG_RESOLUTION.get()) {
            // Skip configuration loading
            LOGGER.info(JRebirthMarkers.MESSAGE, "Messages Loading is skipped");

        } else {
            // Assemble the regex pattern
            final Pattern filePattern = Pattern.compile(this.messageFileWildcard + "\\.properties");

            // Retrieve all resources from default classpath
            final Collection<String> list = ClasspathUtility.getClasspathResources(filePattern);

            LOGGER.info(JRebirthMarkers.MESSAGE, "{} Messages file{} found.", list.size(), list.size() > 1 ? "s" : "");

            for (final String rbFilename : list) {
                readPropertiesFile(rbFilename);
            }
        }
    }
424677
def parse_files(self, req, name, field):
        """"""
        return core.get_value(req.FILES, name, field)
663670
def parse_requirements(filename):
    
    with open(filename, 'r') as f:
        lineiter = list(line.strip() for line in f)
    return [line for line in lineiter if line and not line.startswith("#")]
193162
def lease(self):
        
        self._request_queue.put(
            requests.LeaseRequest(ack_id=self._ack_id, byte_size=self.size)
        )
1366907
def _parse_object_list(self):
        """"""
        array = []

        indent = 0
        while not self._finished:
            self._skip_newlines()
            if self._cur_token['type'] is TT.ws:
                while self._cur_token['type'] is TT.ws:
                    indent = self._skip_whitespace()
                    self._skip_newlines()
            elif self._cur_token['type'] is TT.id:
                array.append(self._parse_key(indent))
            elif self._cur_token['type'] is TT.hyphen:
                self._increment()
                if self._cur_token['type'] is not TT.hyphen or self._finished:
                    return array
                else:
                    self._increment()
            else:
                raise ParseError('something different', self._cur_token)
1085517
function getPropertiesGroupsData(src) {
        var groups = [],
            objectName;

        // intersection for restoring paths sequence
        grunt.util._.intersection(src, grunt.file.expand(options.initFiles)).forEach(function (path) {

            objectName = paths.getObjectNameByInitFile(path.replace(
                new RegExp('^' + utils.toRegExpText(options.base.replace(/^\.\//, ''))),
                ''
            ).replace(/^\/+/, ''));

            grunt.verbose.ok(objectName);

            groups.push({
                objectName:          objectName,
                initFilePath:        path,
                pattern:             new RegExp('^' + utils.toRegExpText(objectName) + (objectName ? '\\.' : ''), 'i'),
                inlineProperties:    [],
                prototypeProperties: []
            });
        });

        return groups;
    }
720347
def parse_requirements(path):
    
    try:
        requirements = map(str.strip, local_file(path).splitlines())
    except IOError:
        raise RuntimeError("Couldn't find the `requirements.txt' file :(")

    links = []
    pkgs = []
    for req in requirements:
        if not req:
            continue
        if 'http:' in req or 'https:' in req:
            links.append(req)
            name, version = re.findall("\#egg=([^\-]+)-(.+$)", req)[0]
            pkgs.append('{0}=={1}'.format(name, version))
        else:
            pkgs.append(req)

    return pkgs, links
185326
@Override
    protected void parse() {
        maximumInstances = getInt(PARAM_MAXIMUM_INSTANCES, DEFAULT_MAXIMUM_INSTANCES);
        mergeRelatedIssues = getBoolean(PARAM_MERGE_RELATED_ISSUES, true);
        overridesFilename = getString(PARAM_OVERRIDES_FILENAME, "");
    }
1173023
def ReadAllClientActionRequests(self, client_id):
    """"""
    res = []
    for key, orig_request in iteritems(self.client_action_requests):
      request_client_id, _, _ = key
      if request_client_id != client_id:
        continue

      request = orig_request.Copy()
      current_lease = self.client_action_request_leases.get(key)
      request.ttl = db.Database.CLIENT_MESSAGES_TTL
      if current_lease is not None:
        request.leased_until, request.leased_by, leased_count = current_lease
        request.ttl -= leased_count
      else:
        request.leased_until = None
        request.leased_by = None
      res.append(request)

    return res