def load_package(spec_str): '''Load `Package` specified by :class:`package spec <datapkg.spec.Spec>` `spec_str`. :param spec_str: a :class:`package spec <datapkg.spec.Spec>`. :return: Package. ''' spec = datapkg.spec.Spec.parse_spec(spec_str) index, path = spec.index_from_spec() return index.get(path)
def load_index(spec_str, all_index=False): '''Load a :class:`datapkg.index.Index` specified by :class:`datapkg.spec.Spec` spec_str. :param spec_str: a :class:`package spec <datapkg.spec.Spec>`. :param all_index: hack param to state that spec is all about index (no package name). ''' spec = datapkg.spec.Spec.parse_spec(spec_str, all_index=all_index) index, path = spec.index_from_spec() return index
def index_from_spec(self, spec_str, all_index=False): spec = datapkg.spec.Spec.parse_spec(spec_str, all_index=all_index) return spec.index_from_spec()