Reads cams conf from file and intantiate appropiate classes.
    Returns: an array of IpCam classes.
14000
def load_cams(conf_file):
    """"""
    with open(conf_file, "r") as c_file:
        lines = c_file.readlines()
    cams_conf = [json.loads(j) for j in lines]
    cams = []
    for cam_c in cams_conf:
        init_params = __parse_args(cam_c)
        cams.append(cam_types[cam_c["type"]](**init_params))
    return cams
252519
def read(cls, iprot):
        '''
        
        '''

        init_kwds = {}

        iprot.read_struct_begin()
        while True:
            ifield_name, ifield_type, _ifield_id = iprot.read_field_begin()
            if ifield_type == 0:  # STOP
                break
            elif ifield_name == 'full_size_url':
                init_kwds['full_size_url'] = iprot.read_string()
            elif ifield_name == 'mediaid':
                init_kwds['mediaid'] = iprot.read_string()
            elif ifield_name == 'objectid':
                init_kwds['objectid'] = iprot.read_string()
            elif ifield_name == 'src':
                init_kwds['src'] = iprot.read_string()
            elif ifield_name == 'thumbnail_url':
                init_kwds['thumbnail_url'] = iprot.read_string()
            elif ifield_name == 'title':
                init_kwds['title'] = iprot.read_string()
            elif ifield_name == 'type':
                init_kwds['type'] = pastpy.gen.database.impl.online.online_database_object_detail_image_type.OnlineDatabaseObjectDetailImageType.value_of(iprot.read_string().strip().upper())
            iprot.read_field_end()
        iprot.read_struct_end()

        return cls(**init_kwds)
685395
def file_reader(self):
        """"""
        self.update_config()
        path = self.config['path']
        # open file to get dimensions
        with self.subprocess(
                ['ffmpeg', '-v', 'info', '-y', '-an', '-vn', '-i', path, '-'],
                stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                stdin=open(os.devnull), universal_newlines=True) as sp:
            for line in sp.stderr.read().splitlines():
                match = re.search('(\d{2,})x(\d{2,})', line)
                if match:
                    xlen, ylen = map(int, match.groups())
                    break
            else:
                self.logger.critical('Failed to open %s', path)
                return
        # read file repeatedly to allow looping
        while True:
            # can change config once per outer loop
            self.update_config()
            bit16 = self.config['16bit']
            self.frame_type = self.config['type']
            self.metadata = Metadata().from_file(path)
            audit = self.metadata.get('audit')
            audit += 'data = %s\n' % path
            audit += '    type: %s, 16bit: %s\n' % (self.frame_type, bit16)
            self.metadata.set('audit', audit)
            bps = {'RGB': 3, 'Y': 1}[self.frame_type]
            pix_fmt = {'RGB': ('rgb24', 'rgb48le'),
                       'Y':   ('gray', 'gray16le')}[self.frame_type][bit16]
            bytes_per_line = xlen * ylen * bps
            if bit16:
                bytes_per_line *= 2
            # open file to read data
            with self.subprocess(
                    ['ffmpeg', '-v', 'warning', '-an', '-i', path,
                     '-f', 'image2pipe', '-pix_fmt', pix_fmt,
                     '-c:v', 'rawvideo', '-'],
                    stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                    stdin=open(os.devnull), bufsize=bytes_per_line) as sp:
                while True:
                    try:
                        raw_data = sp.stdout.read(bytes_per_line)
                    except Exception as ex:
                        self.logger.exception(ex)
                        return
                    if len(raw_data) < bytes_per_line:
                        break
                    if bit16:
                        image = numpy.fromstring(raw_data, dtype=numpy.uint16)
                        image = image.astype(pt_float) / pt_float(256.0)
                    else:
                        image = numpy.fromstring(raw_data, dtype=numpy.uint8)
                    yield image.reshape((ylen, xlen, bps))
            self.update_config()
            if self.frame_no == 0 or self.config['looping'] == 'off':
                return
140973
def configurations(self):
        """"""

        if self._confs is not None:
            return self._confs

        with output_capturing():
            module = self.load(self.fpath)
            confs = getattr(module, CONFIGS_MODULE_ATTR)
            confs = listify(confs)

        self._confs = confs

        return confs
100237
def pools_config_content_from_file(config_path)
      ini_file = IniFile.load(config_path)

      ret_val = []
      ini_file.each_section do |section|
        ret_val << [section, ini_file[section]]
      end
      ret_val
    end
443615
def _read_configfile(self):
        """"""
        rc = self.config_filename
        if not os.path.isabs(rc):
            rc = os.path.join(os.path.expanduser('~'), self.config_filename)
        # If there is a setup.cfg in the package, parse it
        files = [f for f in [rc, 'setup.cfg'] if os.path.exists(f)]
        if not files:
            self.config = None
            return
        self.config = ConfigParser()
        self.config.read(files)
        if (not self.is_old_pypi_config() and
                not self.is_new_pypi_config()):
            # Safety valve
            self.config = None
562761
def images(cam):
    
    # Set output stream title and pull first message
    yield marv.set_header(title=cam.topic)

    # Fetch and process first 20 image messages
    name_template = '%s-{}.jpg' % cam.topic.replace('/', ':')[1:]
    while True:
        idx, msg = yield marv.pull(cam, enumerate=True)
        if msg is None or idx >= 20:
            break

        # Deserialize raw ros message
        pytype = get_message_type(cam)
        rosmsg = pytype()
        rosmsg.deserialize(msg.data)

        # Write image to jpeg and push it to output stream
        img = imgmsg_to_cv2(rosmsg, "rgb8")
        name = name_template.format(idx)
        imgfile = yield marv.make_file(name)
        cv2.imwrite(imgfile.path, img)
        yield marv.push(imgfile)
476621
def _get_classes_to_inspect(self):
        
        return tuple(filter(lambda c:
                      SerializableMixIn._get_version(c, require=False) or
                      (SerializableMixIn._get_serialize_fields(c) or
                       SerializableMixIn._get_interpolation_map(c)),
                      self.__class__.__mro__))
726580
def get_raw_default_config_and_read_file_list():
    """"""
    global _CONFIG, _READ_DEFAULT_FILES
    if _CONFIG is not None:
        return _CONFIG, _READ_DEFAULT_FILES
    with _CONFIG_LOCK:
        if _CONFIG is not None:
            return _CONFIG, _READ_DEFAULT_FILES
        try:
            # noinspection PyCompatibility
            from ConfigParser import SafeConfigParser
        except ImportError:
            # noinspection PyCompatibility,PyUnresolvedReferences
            from configparser import ConfigParser as SafeConfigParser  # pylint: disable=F0401
        cfg = SafeConfigParser()
        read_files = cfg.read(get_default_config_filename())
        _CONFIG, _READ_DEFAULT_FILES = cfg, read_files
        return _CONFIG, _READ_DEFAULT_FILES
542673
def get_config(self):
        ''
        return (self.bus.read_byte_data(self.address, self.CONTROL_PORT0), self.bus.read_byte_data(self.address, self.CONTROL_PORT1));
92241
private List<CmsGitConfiguration> readConfigFiles() {

        List<CmsGitConfiguration> configurations = new LinkedList<CmsGitConfiguration>();

        // Default configuration file for backwards compatibility
        addConfigurationIfValid(configurations, new File(DEFAULT_CONFIG_FILE));

        // All files in the config folder
        File configFolder = new File(DEFAULT_CONFIG_FOLDER);
        if (configFolder.isDirectory()) {
            for (File configFile : configFolder.listFiles()) {
                addConfigurationIfValid(configurations, configFile);
            }
        }
        return configurations;
    }
898535
def _get_camera_properties(self):
        """"""
        if self.base_station and self.base_station.camera_properties:
            for cam in self.base_station.camera_properties:
                if cam["serialNumber"] == self.device_id:
                    return cam
        return None
405471
def read (self, files):
        
        assert isinstance(files, list), "Invalid file list %r" % files
        try:
            self.read_ok = super(LCConfigParser, self).read(files)
            if len(self.read_ok) < len(files):
                failed_files = set(files) - set(self.read_ok)
                log.warn(LOG_CHECK, "Could not read configuration files %s.", failed_files)
            # Read all the configuration parameters from the given files.
            self.read_checking_config()
            self.read_authentication_config()
            self.read_filtering_config()
            self.read_output_config()
            self.read_plugin_config()
        except Exception as msg:
            raise LinkCheckerError(
              _("Error parsing configuration: %s") % unicode(msg))
468962
def read(cls, iprot):
        '''
        
        '''

        init_kwds = {}

        iprot.read_struct_begin()
        while True:
            ifield_name, ifield_type, _ifield_id = iprot.read_field_begin()
            if ifield_type == 0:  # STOP
                break
            elif ifield_name == 'attributes':
                init_kwds['attributes'] = dict([(iprot.read_string(), iprot.read_string()) for _ in range(iprot.read_map_begin()[2])] + (iprot.read_map_end() is None and []))
            elif ifield_name == 'guid':
                init_kwds['guid'] = iprot.read_string()
            elif ifield_name == 'id':
                init_kwds['id'] = iprot.read_string()
            elif ifield_name == 'related_photos':
                init_kwds['related_photos'] = tuple([pastpy.gen.database.impl.online.online_database_object_detail_image.OnlineDatabaseObjectDetailImage.read(iprot) for _ in range(iprot.read_list_begin()[1])] + (iprot.read_list_end() is None and []))
            iprot.read_field_end()
        iprot.read_struct_end()

        return cls(**init_kwds)
993642
def _iter_config_props(cls):
        
        props = inspect.getmembers(cls, lambda a: isinstance(a, ConfigProperty))
        for attr_name, config_prop in props:
            yield attr_name, config_prop
701305
def config_read():
    """"""
    config_file = (u"{0}config.ini".format(CONFIG_DIR))
    if not os.path.isfile(config_file):
        config_make(config_file)
    config = configparser.ConfigParser(allow_no_value=True)
    try:
        config.read(config_file, encoding='utf-8')
    except IOError:
        print("Error reading config file: {}".format(config_file))
        sys.exit()
    # De-duplicate provider-list
    providers = config_prov(config)
    # Read credentials for listed providers
    (cred, to_remove) = config_cred(config, providers)
    # remove unsupported and credential-less providers
    for item in to_remove:
        providers.remove(item)
    return cred, providers
9423
def read_config(self):
        
        with open(self.config_file) as cfg:
            try:
                self.config.read_file(cfg)
            except AttributeError:
                self.config.readfp(cfg)

        self.client_id = self.config.get('exist', 'client_id')
        self.client_secret = self.config.get('exist', 'client_secret')
        self.access_token = self.config.get('exist', 'access_token')