Parse the content of a PLIST file from country-files.com return the
        parsed values in dictionaries.
        Country-files.com provides Prefixes and Exceptions
554522
def _parse_country_file(self, cty_file, country_mapping_filename=None):
        

        import plistlib

        cty_list = None
        entities = {}
        exceptions = {}
        prefixes = {}

        exceptions_index = {}
        prefixes_index = {}

        exceptions_counter = 0
        prefixes_counter = 0

        mapping = None

        with open(country_mapping_filename, "r") as f:
            mapping = json.loads(f.read(),encoding='UTF-8')

        cty_list = plistlib.readPlist(cty_file)

        for item in cty_list:
            entry = {}
            call = str(item)
            entry[const.COUNTRY] = unicode(cty_list[item]["Country"])
            if mapping:
                 entry[const.ADIF] = int(mapping[cty_list[item]["Country"]])
            entry[const.CQZ] = int(cty_list[item]["CQZone"])
            entry[const.ITUZ] = int(cty_list[item]["ITUZone"])
            entry[const.CONTINENT] = unicode(cty_list[item]["Continent"])
            entry[const.LATITUDE] = float(cty_list[item]["Latitude"])
            entry[const.LONGITUDE] = float(cty_list[item]["Longitude"])*(-1)

            if cty_list[item]["ExactCallsign"]:
                if call in exceptions_index.keys():
                    exceptions_index[call].append(exceptions_counter)
                else:
                    exceptions_index[call] = [exceptions_counter]
                exceptions[exceptions_counter] = entry
                exceptions_counter += 1
            else:
                if call in prefixes_index.keys():
                    prefixes_index[call].append(prefixes_counter)
                else:
                    prefixes_index[call] = [prefixes_counter]
                prefixes[prefixes_counter] = entry
                prefixes_counter += 1

        self._logger.debug(str(len(prefixes))+" Prefixes added")
        self._logger.debug(str(len(prefixes_index))+" Prefixes in Index")
        self._logger.debug(str(len(exceptions))+" Exceptions added")
        self._logger.debug(str(len(exceptions_index))+" Exceptions in Index")

        result = {
            "prefixes" : prefixes,
            "exceptions" : exceptions,
            "prefixes_index" : prefixes_index,
            "exceptions_index" : exceptions_index,
        }

        return result
98734
def content(self):
        
        if self._content is None:
            self._content = self.parse_files()
        return self._content
804691
def parsed_pipfile(self):
        """"""
        contents = self.read_pipfile()
        # use full contents to get around str/bytes 2/3 issues
        cache_key = (self.pipfile_location, contents)
        if cache_key not in _pipfile_cache:
            parsed = self._parse_pipfile(contents)
            _pipfile_cache[cache_key] = parsed
        return _pipfile_cache[cache_key]
542404
def parse(self):
        
        data = json.loads(sys.argv[1])
        self.config_path = self.decode(data['config_path'])
        self.subject = self.decode(data['subject'])
        self.text = self.decode(data['text'])
        self.html = self.decode(data['html'])
        self.send_as_one = data['send_as_one']
        if 'files' in data:
            self.parse_files(data['files'])
        self.ccs = data['ccs']
        self.addresses = data['addresses']
        if not self.addresses:
            raise ValueError(
                'Atleast one email address is required to send an email')
493176
def _ParsePlistKeyValue(self, knowledge_base, name, value):
    
    if not knowledge_base.GetValue('operating_system_version'):
      if name in self._PLIST_KEYS:
        knowledge_base.SetValue('operating_system_version', value)
940283
def _get_file_content(source):
    
    filepath = os.path.join('siglists', source + '.txt')

    lines = []
    with resource_stream(__name__, filepath) as f:
        for i, line in enumerate(f):
            line = line.decode('utf-8', 'strict').strip()
            if not line or line.startswith('#'):
                continue

            try:
                re.compile(line)
            except Exception as ex:
                raise BadRegularExpressionLineError(
                    'Regex error: {} in file {} at line {}'.format(
                        str(ex),
                        filepath,
                        i
                    )
                )

            lines.append(line)

    if source in _SPECIAL_EXTENDED_VALUES:
        lines = lines + _SPECIAL_EXTENDED_VALUES[source]

    return tuple(lines)
312402
def extract_country_code(input, options={})
      options[:region] ||= Phoney.region
      intl_prefix = international_call_prefix_for(input, region: options[:region])
      
      # only try to extract a country code if we're dialing internationally
      if intl_prefix
        rest   = input[intl_prefix.count(NUMPAD_CHARS)..-1]
        region = Phoney::Region.all.find { |r| rest.start_with? r.country_code.to_s }
        
        region.country_code.to_s if region
      end
    end
1321832
function getEntitlementsFileContent() {
  var pathToFile = pathToEntitlementsFile();
  var content;

  try {
    content = fs.readFileSync(pathToFile, 'utf8');
  } catch (err) {
    return defaultEntitlementsFile();
  }

  return plist.parse(content);
}
695010
def parse(self, plist):
        
        if not isinstance(plist, PacketList):
            plist = PacketList(plist)
        for pkt in plist[LLTD]:
            if LLTDQueryLargeTlv in pkt:
                key = "%s:%s:%d" % (pkt.real_dst, pkt.real_src, pkt.seq)
                self.types_offsets[key] = (pkt[LLTDQueryLargeTlv].type,
                                           pkt[LLTDQueryLargeTlv].offset)
            elif LLTDQueryLargeTlvResp in pkt:
                try:
                    key = "%s:%s:%d" % (pkt.real_src, pkt.real_dst, pkt.seq)
                    content, offset = self.types_offsets[key]
                except KeyError:
                    continue
                loc = slice(offset, offset + pkt[LLTDQueryLargeTlvResp].len)
                key = "%s > %s [%s]" % (
                    pkt.real_src, pkt.real_dst,
                    LLTDQueryLargeTlv.fields_desc[0].i2s.get(content, content),
                )
                data = self.data.setdefault(key, array("B"))
                datalen = len(data)
                if datalen < loc.stop:
                    data.extend(array("B", b"\x00" * (loc.stop - datalen)))
                data[loc] = array("B", pkt[LLTDQueryLargeTlvResp].value)
1331280
def _GetPlistRootKey(self, file_entry):
    
    file_object = file_entry.GetFileObject()

    try:
      plist_file = plist.PlistFile()
      plist_file.Read(file_object)

    except IOError as exception:
      location = getattr(file_entry.path_spec, 'location', '')
      raise errors.PreProcessFail(
          'Unable to read plist file: {0:s} with error: {1!s}'.format(
              location, exception))

    finally:
      file_object.close()

    return plist_file.root_key
288127
def parse(path, contents = nil)
      print_known_info if verbose

      contents ||= File.open(path, "r:utf-8", &:read)

      # Work around for Rubinius incomplete encoding in 1.9 mode
      if contents.respond_to?(:encoding) && contents.encoding.name != "UTF-8"
        contents.encode!("UTF-8")
      end

      if contents.tr!("“”‘’‛", %(""'''))
        # Changes have been made
        ui.puts "Your #{path.basename} has had smart quotes sanitised. " \
          "To avoid issues in the future, you should not use " \
          "TextEdit for editing it. If you are not using TextEdit, " \
          "you should turn off smart quotes in your editor of choice.".red
      end

      if contents.include?("puts")
        ui.puts "You used `puts` in your Dangerfile. To print out text to GitHub use `message` instead"
      end

      self.defined_in_file = path
      instance_eval do
        # rubocop:disable Lint/RescueException
        begin
          eval_file(contents, path)
        rescue Exception => e
          message = "Invalid `#{path.basename}` file: #{e.message}"
          raise DSLError.new(message, path, e.backtrace, contents)
        end
        # rubocop:enable Lint/RescueException
      end
    end
434528
def parse_file(defn, preprocess=True):
    
    if pycparser is None:
        raise ImportError("Please install pycparser in order to parse C definitions")

    defn = '\n'.join(x for x in defn.split('\n') if _include_re.match(x) is None)

    if preprocess:
        defn = do_preprocess(defn)

    preamble, ignoreme = make_preamble()
    node = pycparser.c_parser.CParser().parse(preamble + defn)
    if not isinstance(node, pycparser.c_ast.FileAST):
        raise ValueError("Something went horribly wrong using pycparser")
    out = {}
    extra_types = {}
    for piece in node.ext:
        if isinstance(piece, pycparser.c_ast.FuncDef):
            out[piece.decl.name] = _decl_to_type(piece.decl.type, extra_types)
        elif isinstance(piece, pycparser.c_ast.Decl):
            ty = _decl_to_type(piece.type, extra_types)
            if piece.name is not None:
                out[piece.name] = ty
        elif isinstance(piece, pycparser.c_ast.Typedef):
            extra_types[piece.name] = _decl_to_type(piece.type, extra_types)

    for ty in ignoreme:
        del extra_types[ty]
    return out, extra_types
781451
def parse_contents(password_string)
      unpacked = password_string[/password: 0x([a-f0-9]+)/i, 1]

      password = if unpacked
        [unpacked].pack("H*")
      else
        password_string[/password: "(.+)"/m, 1]
      end

      password ||= ""

      parsed = Plist.parse_xml(password.force_encoding("".encoding))
      if parsed and parsed["NOTE"]
        parsed["NOTE"]
      else
        password
      end
    end
397049
function parseFile (file, content) {
  let type = getParseType(file)

  debug('parse file: file = %s, parseType = %s', file, type)

  if (type in parser) {
    if (typeof content !== 'string') {
      content = fs.readFileSync(file, 'utf8')
    }

    return parser[type](content)
  }
}
11947
def parse_plist(entry):
    """"""
    if is_leaf(entry):
        url = entry[KEY_URLSTRING]
        title = entry[KEY_URIDICTIONARY].get('title', url)
        yield (url, title)
    elif has_children(entry):
        for child in entry[KEY_CHILDREN]:
            for item in parse_plist(child):
                yield item
980598
def parse(self, file_obj, parsed_files=None):
        '''
        
        '''
        host = {'host': ['*'], 'config': {}}
        for line in file_obj:
            # Strip any leading or trailing whitespace from the line.
            # Refer to https://github.com/paramiko/paramiko/issues/499
            line = line.strip()
            if not line or line.startswith('#'):
                continue

            match = re.match(self.SETTINGS_REGEX, line)
            if not match:
                raise Exception('Unparsable line {}'.format(line))
            key = match.group(1).lower()
            value = match.group(2)

            if key == 'host':
                self._config.append(host)
                host = {
                    'host': self._get_hosts(value),
                    'config': {}
                }
            elif key == 'proxycommand' and value.lower() == 'none':
                # Store 'none' as None; prior to 3.x, it will get stripped out
                # at the end (for compatibility with issue #415). After 3.x, it
                # will simply not get stripped, leaving a nice explicit marker.
                host['config'][key] = None
            elif key == 'include':
                # support for Include directive in ssh_config
                path = value
                # the path can be relative to its parent configuration file
                if os.path.isabs(path) is False and path[0] != '~':
                    folder = os.path.dirname(file_obj.name)
                    path = os.path.join(folder, path)

                # expand the user home path
                path = os.path.expanduser(path)
                if parsed_files is None:
                    parsed_files = []

                # parse every included file
                for filename in glob.iglob(path):
                    if os.path.isfile(filename):
                        if filename in parsed_files:
                            raise Exception('Include loop detected in ssh config file: %s' % filename)
                        with open(filename) as fd:
                            parsed_files.append(filename)
                            self.parse(fd, parsed_files)

            else:
                if value.startswith('"') and value.endswith('"'):
                    value = value[1:-1]

                # identityfile, localforward, remoteforward keys are special
                # cases, since they are allowed to be specified multiple times
                # and they should be tried in order of specification.
                if key in ['identityfile', 'localforward', 'remoteforward']:
                    if key in host['config']:
                        host['config'][key].append(value)
                    else:
                        host['config'][key] = [value]
                elif key not in host['config']:
                    host['config'][key] = value
        self._config.append(host)
804207
def _parse_scheme_file(self):
        
        schemes = json.loads(self.scheme_file.read(), object_pairs_hook=OrderedDict)
        scheme_list = []
        scheme_dict = defaultdict(list)
        for scheme_len, scheme_group in schemes.items():
            for scheme_str, _count in scheme_group:
                scheme_code = tuple(int(c) for c in scheme_str.split(' '))
                scheme_list.append(scheme_code)
                scheme_dict[int(scheme_len)].append(len(scheme_list) - 1)
        return scheme_list, scheme_dict