Read a grp file at the path specified by in_path.

    Args:
        in_path (string): path to GRP file

    Returns:
        grp (list)
1931
def read(in_path):
    
    assert os.path.exists(in_path), "The following GRP file can't be found. in_path: {}".format(in_path)

    with open(in_path, "r") as f:
        lines = f.readlines()
        # need the second conditional to ignore comment lines
        grp = [line.strip() for line in lines if line and not re.match("^#", line)]

    return grp
1183177
def read_file(path, encoding='utf-8', *args, **kwargs):
    ''' 
    '''
    if 'mode' in kwargs and kwargs['mode'] == 'rb':
        return process_file(path, processor=lambda x: x.read(),
                            encoding=encoding, *args, **kwargs)
    else:
        return process_file(path, processor=lambda x: to_string(x.read(), encoding),
                            encoding=encoding, *args, **kwargs)
700124
def read_data(file_path):
    

    if not is_valid(file_path):
        write_data(file_path, {})

    db = open_file_for_reading(file_path)
    content = db.read()

    obj = decode(content)

    db.close()

    return obj
261190
def load_from_file(self, path):
        

        with open(path) as inf:
            data = inf.read()
            if data:
                items = json.loads(data)
            else:
                items = {}
        for item in items:
            extra = dict((x, y) for x, y in item.items()
                         if x not in ['name', 'value', 'domain'])
            self.set(item['name'], item['value'], item['domain'], **extra)
92779
def read_json_file(path):
    

    with open(path, 'r', encoding='utf-8') as f:
        data = json.load(f)

    return data
1136170
def read_file(self, path, **kwargs):
        
        # TODO support JSON here
        # TODO sphinx way of reporting errors in logs?

        parser_command = ["godocjson"]

        _ignore = kwargs.get("ignore")
        if _ignore:
            parser_command.extend(["-e", "{0}".format("|".join(_ignore))])

        parser_command.append(path)

        try:
            parsed_data = json.loads(subprocess.check_output(parser_command))
            return parsed_data
        except IOError:
            LOGGER.warning("Error reading file: {0}".format(path))
        except TypeError:
            LOGGER.warning("Error reading file: {0}".format(path))
        return None
1276889
def read(self, path, environ):
        
        try:
            inp = open(path, 'rb')
        except FileNotFoundError as error:
            if error.errno != 2:
                raise
            return None
        parsing = parse_vexrc(inp, environ)
        for heading, key, value in parsing:
            heading = self.default_heading if heading is None else heading
            if heading not in self.headings:
                self.headings[heading] = OrderedDict()
            self.headings[heading][key] = value
        parsing.close()
864790
function load(inPath)
{
  var keys;

  // Group description file can be specified as relative to CWD
  var configFilePath = pathlib.resolve(process.cwd(),inPath);

  // Paths are relative to the config file (inPath) + /public by default
  var configDir = pathlib.dirname(configFilePath);
  var baseDir = pathlib.resolve(configDir,'public');

  // Load the JSON description of the groups
  var input = JSON.parse(stripJsonComments(fs.readFileSync(configFilePath,'utf8')));
  var ret = {};

  // 1. Resolve everything to absolute paths

  // 1a. Root file dirs -- relative to the config file
  ret.rootFileDirs = (input.rootFileDirs||[]).map(function(path) {
    return pathlib.resolve(configDir, path);
  });

  // 1b. Static file dirs -- relative to the config file
  ret.staticFileDirs = {};
  keys = Object.keys(input.staticFileDirs||{});
  keys.forEach(function(key) {
    var paths = input.staticFileDirs[key];
    if ( !util.isArray(paths) )
      paths = [paths];

    ret.staticFileDirs[key] = paths.map(function(path) {
      return pathlib.resolve(configDir, path);
    });
  });

  // 1c. Groups
  keys = Object.keys(input.groups||{});

  // Loop over each group definition
  ret.groups = {};
  keys.forEach(function(groupName) {
    var group = input.groups[groupName];
    var subKeys = Object.keys(group);

    var newGroup = {};

    // You can override the base directory per-group
    if ( group.baseDir )
    {
      var paths = group.baseDir;
      if ( !util.isArray(paths) )
        paths = [paths];

      newGroup.customBaseDir = true;
      newGroup.baseDir = paths.map(function(path) {
        // If baseDir is specified for the group, it's relative to the location of the asset file
        return pathlib.resolve(configDir, path);
      });
    }
    else
    {
      newGroup.customBaseDir = false;
      newGroup.baseDir = [baseDir];
    }

    newGroup.include = group.include || [];

    // Loop over each key in the group definition
    subKeys.forEach(function(subKey) {
      if ( SPECIAL_KEYS.indexOf(subKey) >= 0 )
      {
        // We've already dealt with these
        return;
      }

      if ( HANDLER_KEYS.indexOf(subKey) === -1 )
      {
        throw new Error('Unknown group property: '+ subKey);
      }

      // Resolve file names into absolute paths
      newGroup[subKey] = (group[subKey]||[]).map(function(filename) {
        return resolveFile(newGroup.baseDir, !newGroup.customBaseDir, filename, subKey);
      });
    });

    ret.groups[groupName] = newGroup;
  });

  // 2. Process each group into a flat list of the file names needed
  keys = Object.keys(ret.groups);
  keys.forEach(function(groupName) {
    var flattened = _flatten(ret.groups, groupName);

    // Remember if we're supposed to save the output or not for compliling
    flattened.saveOutput = input.groups[groupName].saveOutput !== false;

    ret.groups[groupName] = flattened;
  });

  return ret;
}
1028310
def read(self, path, base=None):
        ''''''
        if base == None:
            base = os.getcwd()
        absolute = os.path.abspath(path)
        if os.path.isfile(absolute):
            # Load that particular file
            logger.info('Loading %s' % absolute)
            self.extend(Task.load(path, base))
        elif os.path.isdir(absolute):
            # Walk this directory looking for tasks
            tasks = []
            for root, _, files in os.walk(absolute):
                files = [f for f in files if f.endswith('.py')]
                for child in files:
                    absolute = os.path.join(root, child)
                    logger.info('Loading %s' % absolute)
                    tasks.extend(Task.load(absolute, base))
            self.extend(tasks)
1129684
def load(self, path):
        
        with open(path, 'rb') as f:
            self.data = f.read()
            self.root = et.fromstring(self.data)
1062927
def read_json_file(cls, path):
        
        with open(path, 'r') as f:
            return cls.from_dict(json.load(f))
179734
def _read_file_data(self, path):
        
        _, ext = os.path.splitext(path)
        # YAML files
        if ext in ('.yml', '.yaml'):
            try:
                with open(path) as f:
                    return yaml.safe_load(f)
            except YAMLError as e:
                raise ConfigParseError(path, e)
        # JSON files
        elif ext == '.json':
            try:
                return json.loads(open(path).read())
            except ValueError as e:
                raise ConfigParseError(path, e)
        else:
            raise ConfigParseError(path, TypeError("Unsupported file type {}".format(ext)))
749720
def get_files(self, path):
        

        if os.path.isfile(path):
            self.logger.debug('Called with single file as target: {0}'.format(path))
            yield path
            return

        self.logger.debug('Getting list of files in {0}'.format(path))

        try:
            for f in os.listdir(path):
                cur_file = os.path.join(path, f)
                if f[0] != '.' and os.path.isfile(cur_file):
                    yield cur_file
        except OSError:
            self.logger.error('Could not read files from {0}'.format(path))
            raise
824680
def read_file(self, path, **kwargs):
        
        try:
            with open(path, "r") as handle:
                parsed_data = yaml.safe_load(handle)
                return parsed_data
        except IOError:
            LOGGER.warning("Error reading file: {0}".format(path))
        except TypeError:
            LOGGER.warning("Error reading file: {0}".format(path))
        return None
281686
def _path_to_str(self, path):
        
        inp = ''
        for arc in path:
            i = self.isyms.find(arc.ilabel)
            # Ignore \epsilon transitions both on input
            if i != fst.EPSILON:
                inp += i
        return inp
15903
def FromFile(cls, in_path):
        

        with open(in_path, "rb") as infile:
            in_data = json.load(infile)

        if not ('trace', 'selectors') in in_data:
            raise ArgumentError("Invalid trace file format", keys=in_data.keys(), expected=('trace', 'selectors'))

        selectors = [DataStreamSelector.FromString(x) for x in in_data['selectors']]
        readings = [IOTileReading(x['time'], DataStream.FromString(x['stream']).encode(), x['value'], reading_id=x['reading_id']) for x in in_data['trace']]

        return SimulationTrace(readings, selectors=selectors)
410445
def get_file_meta(self, path):
        
        if self.tree is None:
            self.read_index()

        if path not in self.tree:
            raise KeyError("Path doesn't exist")

        return self._make_meta_dict(self.tree[path])