Open resource and populate the source attributes.
771357
def discover(self):
        """"""
        self._load_metadata()

        return dict(datashape=self.datashape,
                    dtype=self.dtype,
                    shape=self.shape,
                    npartitions=self.npartitions,
                    metadata=self.metadata)
278002
def read_resource_list(self, uri):
        """"""
        self.logger.info("Reading resource list %s" % (uri))
        try:
            resource_list = ResourceList(allow_multifile=self.allow_multifile,
                                         mapper=self.mapper)
            resource_list.read(uri=uri)
        except Exception as e:
            raise ClientError("Can't read source resource list from %s (%s)" %
                              (uri, str(e)))
        self.logger.debug("Finished reading resource list")
        return(resource_list)
668489
def from_file(cls, filename):
        """"""

        dsxml = xml_open(filename, 'datasource').getroot()
        return cls(dsxml, filename)
748887
def load_rdf(self,
                 uri_or_path=None,
                 data=None,
                 file_obj=None,
                 rdf_format="",
                 verbose=False,
                 hide_base_schemas=True,
                 hide_implicit_types=True,
                 hide_implicit_preds=True):
        """"""
        loader = RDFLoader(verbose=verbose)
        loader.load(uri_or_path, data, file_obj, rdf_format)
        self.rdflib_graph = loader.rdflib_graph
        self.sources = loader.sources_valid
        self.sparqlHelper = SparqlHelper(self.rdflib_graph)
        self.namespaces = sorted(self.rdflib_graph.namespaces())
643606
def source(self, source):
        """"""
        BaseView.source.fset(self, source)
        if self.select:
            self.select.options = self.options
20795
def _loadOneSource(self, sourceFName):
        
        sourceLines = open(sourceFName).readlines()
        del sourceLines[0]
        if len(sourceLines[0].split("\t"))==2:
            self._loadTwoPartSource(sourceFName, sourceLines)
        elif len(sourceLines[0].split("\t"))==3:
            self._loadThreePartSource(sourceFName, sourceLines)
        else:
            raise Error, "%s does not appear to be a source authority file"
363162
def load(config, opt):
        """"""
        ctx = Context(opt)
        seed_map = py_resources()
        seed_keys = sorted(set([m[0] for m in seed_map]), key=resource_sort)
        for config_key in seed_keys:
            if config_key not in config:
                continue
            for resource_config in config[config_key]:
                mod = find_model(config_key, resource_config, seed_map)
                if not mod:
                    LOG.warning("unable to find mod for %s", resource_config)
                    continue

                ctx.add(mod(resource_config, opt))

        for config_key in config.keys():
            if config_key != 'pgp_keys' and \
               config_key not in seed_keys:
                LOG.warning("missing model for %s", config_key)

        return filtered_context(ctx)
768784
private function loadResourceMetadata()
    {
        foreach (get_declared_classes() as $className) {
            if (
                !isset($this->resources[$className]) &&
                is_subclass_of($className, 'Tonic\Resource')
            ) {
                $rm = new ResourceMetadata($className);
                if ($rm->getUri()) {
                    $this->resources[$className] = $rm;
                }
            }
        }
    }
221971
@SuppressWarnings("resource")
    private InputStream openResource(String name) throws IOException {
        InputStream in;
        if (iFileDir != null) {
            in = new FileInputStream(new File(iFileDir, name));
        } else {
            final String path = iResourcePath.concat(name);
            in = AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
                public InputStream run() {
                    if (iLoader != null) {
                        return iLoader.getResourceAsStream(path);
                    } else {
                        return ClassLoader.getSystemResourceAsStream(path);
                    }
                }
            });
            if (in == null) {
                StringBuilder buf = new StringBuilder(40)
                    .append("Resource not found: \"")
                    .append(path)
                    .append("\" ClassLoader: ")
                    .append(iLoader != null ? iLoader.toString() : "system");
                throw new IOException(buf.toString());
            }
        }
        return in;
    }
1304214
def add_resource(self, name, file_path, ind_obj):
        """"""
        new_resource = Resource(name=name, individual=ind_obj, path=file_path)
        self.session.add(new_resource)
        self.save()
        return new_resource
216143
public void importResourceAll() {

        try {
            importResource();
            importAccessControlEntries();
            increaseCounter();
        } finally {
            m_destination = null;
            m_source = null;
            m_throwable = null;
            m_properties = null;
            m_aces = null;
        }
    }
634161
def open(self):
        

        with open(self.path, 'r') as f:
            corrected = f.read().replace('rdf:resource rdf:resource',
                                         'link:link rdf:resource')
        with open(self.path, 'w') as f:
            f.write(corrected)

        super(ZoteroParser, self).open()
750106
def from_api_repr(cls, resource):
        
        name = resource.get("name")
        instance = cls(name)
        type_resources = {}
        types = instance.struct_types
        for item in resource["parameterType"]["structTypes"]:
            types[item["name"]] = item["type"]["type"]
            type_resources[item["name"]] = item["type"]
        struct_values = resource["parameterValue"]["structValues"]
        for key, value in struct_values.items():
            type_ = types[key]
            converted = None
            if type_ == "STRUCT":
                struct_resource = {
                    "name": key,
                    "parameterType": type_resources[key],
                    "parameterValue": value,
                }
                converted = StructQueryParameter.from_api_repr(struct_resource)
            elif type_ == "ARRAY":
                struct_resource = {
                    "name": key,
                    "parameterType": type_resources[key],
                    "parameterValue": value,
                }
                converted = ArrayQueryParameter.from_api_repr(struct_resource)
            else:
                value = value["value"]
                converted = _QUERY_PARAMS_FROM_JSON[type_](value, None)
            instance.struct_values[key] = converted
        return instance
175549
def update_resources_from_dict(self, res, types=None, names=None, 
                                   languages=None):
        
        UpdateResourcesFromDict(self.filename, res, types, names, 
                                languages)
36479
def build_source_files(self):
        """"""

        from .files import BuildSourceFileAccessor
        return BuildSourceFileAccessor(self, self.dataset, self.source_fs)
268658
def _load(self):
        
        with open(self._pickle_file, 'rb') as source:
            pickler = pickle.Unpickler(source)

            for attribute in self._pickle_attributes:
                pickle_data = pickler.load()
                setattr(self, attribute, pickle_data)
544326
def addSource(self, source, data):
    """"""
    self._aggregate(source, self._aggregators, data, self._result)