index int64 0 731k | package stringlengths 2 98 ⌀ | name stringlengths 1 76 | docstring stringlengths 0 281k ⌀ | code stringlengths 4 8.19k | signature stringlengths 2 42.8k ⌀ | embed_func_code listlengths 768 768 |
|---|---|---|---|---|---|---|
729,873 | marshmallow_enum | fail | null | def fail(self, key, **kwargs):
kwargs['values'] = ', '.join([text_type(mem.value) for mem in self.enum])
kwargs['names'] = ', '.join([mem.name for mem in self.enum])
if self.error:
if self.by_value:
kwargs['choices'] = kwargs['values']
else:
kwargs['choices'] = kwargs... | (self, key, **kwargs) | [
0.03338170051574707,
-0.03232754021883011,
-0.005525549873709679,
-0.00012291657913010567,
-0.043466486036777496,
-0.05643264204263687,
0.051899757236242294,
-0.021048039197921753,
0.08081885427236557,
-0.08074857294559479,
0.03561300411820412,
0.06349550932645798,
0.0478939525783062,
-0.0... |
729,877 | marshmallow.fields | Field | Basic field from which other fields should extend. It applies no
formatting by default, and should only be used in cases where
data does not need to be formatted before being serialized or deserialized.
On error, the name of the field will be returned.
:param dump_default: If set, this value will be us... | class Field(FieldABC):
"""Basic field from which other fields should extend. It applies no
formatting by default, and should only be used in cases where
data does not need to be formatted before being serialized or deserialized.
On error, the name of the field will be returned.
:param dump_default:... | (*, load_default: 'typing.Any' = <marshmallow.missing>, missing: 'typing.Any' = <marshmallow.missing>, dump_default: 'typing.Any' = <marshmallow.missing>, default: 'typing.Any' = <marshmallow.missing>, data_key: 'str | None' = None, attribute: 'str | None' = None, validate: 'None | typing.Callable[[typing.Any], typing.... | [
0.022006025537848473,
0.012515685521066189,
-0.017564354464411736,
0.04690250754356384,
0.015136368572711945,
-0.039117541164159775,
0.03483965992927551,
-0.02499283291399479,
-0.007780150976032019,
-0.06883145123720169,
0.0015186951495707035,
0.024568898603320122,
0.041391368955373764,
0.... |
729,882 | marshmallow.fields | _deserialize | Deserialize value. Concrete :class:`Field` classes should implement this method.
:param value: The value to be deserialized.
:param attr: The attribute/key in `data` to be deserialized.
:param data: The raw input data passed to the `Schema.load`.
:param kwargs: Field-specific keyword ar... | def _deserialize(
self,
value: typing.Any,
attr: str | None,
data: typing.Mapping[str, typing.Any] | None,
**kwargs,
):
"""Deserialize value. Concrete :class:`Field` classes should implement this method.
:param value: The value to be deserialized.
:param attr: The attribute/key in `data`... | (self, value: Any, attr: str | None, data: Optional[Mapping[str, Any]], **kwargs) | [
0.080921471118927,
0.04386795312166214,
0.007976798340678215,
0.017124827951192856,
-0.03203141316771507,
-0.017976634204387665,
0.057922735810279846,
0.012297933921217918,
-0.020017415285110474,
-0.019627004861831665,
0.005510113202035427,
0.08510950952768326,
0.02074499987065792,
0.00131... |
729,883 | marshmallow.fields | _serialize | Serializes ``value`` to a basic Python datatype. Noop by default.
Concrete :class:`Field` classes should implement this method.
Example: ::
class TitleCase(Field):
def _serialize(self, value, attr, obj, **kwargs):
if not value:
re... | def _serialize(
self, value: typing.Any, attr: str | None, obj: typing.Any, **kwargs
):
"""Serializes ``value`` to a basic Python datatype. Noop by default.
Concrete :class:`Field` classes should implement this method.
Example: ::
class TitleCase(Field):
def _serialize(self, value, a... | (self, value: Any, attr: str | None, obj: Any, **kwargs) | [
0.006673862691968679,
0.0055630882270634174,
0.022399842739105225,
0.009503801353275776,
-0.001637354725971818,
-0.031046366319060326,
0.0078307269141078,
-0.004848690237849951,
-0.00250500300899148,
-0.07009398937225342,
-0.010434824042022228,
0.07241693884134293,
-0.006761434022337198,
-... |
729,891 | marshmallow_enum | LoadDumpOptions | An enumeration. | class LoadDumpOptions(Enum):
value = 1
name = 0
| (value, names=None, *, module=None, qualname=None, type=None, start=1) | [
0.035871829837560654,
-0.02072914130985737,
-0.08744320273399353,
-0.04993675276637077,
0.015645651146769524,
-0.0354946106672287,
0.024213936179876328,
-0.040380507707595825,
-0.06283408403396606,
-0.07573141902685165,
-0.03348277136683464,
0.04655973240733147,
-0.018591560423374176,
0.00... |
729,898 | verlib2.version | Version | This class abstracts handling of a project's versions.
A :class:`Version` instance is comparison aware and can be compared and
sorted using the standard Python interfaces.
>>> v1 = Version("1.0a5")
>>> v2 = Version("1.0")
>>> v1
<Version('1.0a5')>
>>> v2
<Version('1.0')>
>>> v1 < v... | class Version(_BaseVersion):
"""This class abstracts handling of a project's versions.
A :class:`Version` instance is comparison aware and can be compared and
sorted using the standard Python interfaces.
>>> v1 = Version("1.0a5")
>>> v2 = Version("1.0")
>>> v1
<Version('1.0a5')>
>>> v2... | (version: str) -> None | [
0.06359527260065079,
0.029216278344392776,
-0.1278163343667984,
0.03741013631224632,
0.039346154779195786,
-0.08479370176792145,
0.0041335951536893845,
0.019653521478176117,
0.002789137652143836,
-0.03727324679493904,
0.0023344666697084904,
0.024288231506943703,
0.04102794826030731,
0.0444... |
729,911 | prefect_github.credentials | GitHubCredentials |
Block used to manage GitHub authentication.
Attributes:
token: the token to authenticate into GitHub.
Examples:
Load stored GitHub credentials:
```python
from prefect_github import GitHubCredentials
github_credentials_block = GitHubCredentials.load("BLOCK_NAME")
... | class GitHubCredentials(CredentialsBlock):
"""
Block used to manage GitHub authentication.
Attributes:
token: the token to authenticate into GitHub.
Examples:
Load stored GitHub credentials:
```python
from prefect_github import GitHubCredentials
github_credentia... | (*args, token: pydantic.v1.types.SecretStr = None, **kwargs) -> None | [
0.010736298747360706,
-0.09373937547206879,
-0.04825260490179062,
0.028574064373970032,
0.028218992054462433,
-0.014324408955872059,
0.0028125550597906113,
0.019267404451966286,
-0.016492225229740143,
0.01045597717165947,
0.07295823842287064,
0.00682581914588809,
-0.03010648675262928,
0.00... |
729,939 | prefect_github.credentials | get_client |
Gets an authenticated GitHub GraphQL HTTPEndpoint client.
Returns:
An authenticated GitHub GraphQL HTTPEndpoint client.
Example:
Gets an authenticated GitHub GraphQL HTTPEndpoint client.
```python
from prefect_github import GitHubCredentials
... | def get_client(self) -> HTTPEndpoint:
"""
Gets an authenticated GitHub GraphQL HTTPEndpoint client.
Returns:
An authenticated GitHub GraphQL HTTPEndpoint client.
Example:
Gets an authenticated GitHub GraphQL HTTPEndpoint client.
```python
from prefect_github import GitHub... | (self) -> sgqlc.endpoint.http.HTTPEndpoint | [
-0.019010357558727264,
-0.09098850190639496,
-0.044333312660455704,
-0.0072377217002213,
-0.0008576654945500195,
0.007713887840509415,
0.0036846171133220196,
0.030311360955238342,
-0.029331820085644722,
0.02151362970471382,
0.07930656522512436,
-0.009831692092120647,
-0.00602236483246088,
... |
729,940 | prefect_github.credentials | get_endpoint |
Gets an authenticated GitHub GraphQL HTTPEndpoint.
Returns:
An authenticated GitHub GraphQL HTTPEndpoint
Example:
Gets an authenticated GitHub GraphQL HTTPEndpoint.
```python
from prefect import flow
from prefect_github import GitHub... | def get_endpoint(self) -> HTTPEndpoint:
"""
Gets an authenticated GitHub GraphQL HTTPEndpoint.
Returns:
An authenticated GitHub GraphQL HTTPEndpoint
Example:
Gets an authenticated GitHub GraphQL HTTPEndpoint.
```python
from prefect import flow
from prefect_github ... | (self) -> sgqlc.endpoint.http.HTTPEndpoint | [
-0.0212712362408638,
-0.0944574698805809,
-0.017271438613533974,
-0.027659928426146507,
0.0024300829973071814,
0.019642027094960213,
0.02429167740046978,
0.019404053688049316,
-0.03620869666337967,
-0.0003909985243808478,
0.046423282474279404,
-0.029106080532073975,
0.012402119114995003,
-... |
729,944 | prefect_github.repository | GitHubRepository |
Interact with files stored on GitHub repositories.
| class GitHubRepository(ReadableDeploymentStorage):
"""
Interact with files stored on GitHub repositories.
"""
_block_type_name = "GitHub Repository"
_logo_url = "https://cdn.sanity.io/images/3ugk85nk/production/41971cfecfea5f79ff334164f06ecb34d1038dd4-250x250.png" # noqa: E501
_documentation_u... | (*args, repository_url: str, reference: Optional[str] = None, credentials: Optional[prefect_github.credentials.GitHubCredentials] = None, **kwargs) -> None | [
0.03648791462182999,
-0.0699317455291748,
-0.10662534087896347,
0.003344896947965026,
0.03895609453320503,
-0.0006601093919016421,
-0.0013279318809509277,
0.0534772165119648,
0.0062013003043830395,
-0.03305303305387497,
0.05170835554599762,
-0.0072554186917841434,
-0.01797657273709774,
0.0... |
729,961 | prefect_github.repository | _create_repo_url | Format the URL provided to the `git clone` command.
For private repos: https://<oauth-key>@github.com/<username>/<repo>.git
All other repos should be the same as `self.repository`.
| def _create_repo_url(self) -> str:
"""Format the URL provided to the `git clone` command.
For private repos: https://<oauth-key>@github.com/<username>/<repo>.git
All other repos should be the same as `self.repository`.
"""
url_components = urlparse(self.repository_url)
if url_components.scheme =... | (self) -> str | [
-0.026534678414463997,
-0.037477001547813416,
-0.033085308969020844,
0.004802260082215071,
0.016478070989251137,
-0.016681049019098282,
0.010877741500735283,
0.043400250375270844,
0.08303619176149368,
0.013654841110110283,
0.04402763769030571,
-0.004760741721838713,
0.017917364835739136,
0... |
729,965 | prefect_github.repository | _get_paths | Returns the fully formed paths for GitHubRepository contents in the form
(content_source, content_destination).
| @staticmethod
def _get_paths(
dst_dir: Union[str, None], src_dir: str, sub_directory: str
) -> Tuple[str, str]:
"""Returns the fully formed paths for GitHubRepository contents in the form
(content_source, content_destination).
"""
if dst_dir is None:
content_destination = Path(".").absolute(... | (dst_dir: Optional[str], src_dir: str, sub_directory: str) -> Tuple[str, str] | [
-0.029845986515283585,
-0.06919943541288376,
-0.06621669977903366,
0.0027939833234995604,
-0.016852449625730515,
-0.030852658674120903,
0.0016871091211214662,
0.07207031548023224,
0.06744708120822906,
-0.03381675109267235,
0.06565743684768677,
0.012592731975018978,
0.011875011026859283,
0.... |
729,974 | prefect_github.repository | get_directory |
Clones a GitHub project specified in `from_path` to the provided `local_path`;
defaults to cloning the repository reference configured on the Block to the
present working directory.
Args:
from_path: If provided, interpreted as a subdirectory of the underlying
... | @task
async def query_repository_refs( # noqa
owner: str,
name: str,
ref_prefix: str,
github_credentials: GitHubCredentials,
follow_renames: bool = True,
query: str = None,
after: str = None,
before: str = None,
first: int = None,
last: int = None,
direction: graphql_schema.... | (self, from_path: Optional[str] = None, local_path: Optional[str] = None) -> NoneType | [
0.00576863344758749,
-0.07043998688459396,
-0.0941411480307579,
0.008252094499766827,
-0.013214409351348877,
0.04401116818189621,
-0.00270231906324625,
-0.021931864321231842,
0.02865886501967907,
-0.04637022688984871,
0.03402203321456909,
0.0017393443267792463,
0.009850909002125263,
-0.000... |
729,985 | mmengine.fileio.handlers.base | BaseFileHandler | null | class BaseFileHandler(metaclass=ABCMeta):
# `str_like` is a flag to indicate whether the type of file object is
# str-like object or bytes-like object. Pickle only processes bytes-like
# objects but json only processes str-like object. If it is str-like
# object, `StringIO` will be used to process the b... | () | [
0.002082154853269458,
-0.027813170105218887,
-0.08044535666704178,
0.02058030292391777,
0.022239714860916138,
-0.04787039756774902,
-0.005041362717747688,
0.09285486489534378,
-0.05472448840737343,
-0.03708422929048538,
0.03448688983917236,
0.011228079907596111,
-0.033314477652311325,
0.03... |
729,986 | mmengine.fileio.handlers.base | dump_to_fileobj | null | @abstractmethod
def dump_to_fileobj(self, obj, file, **kwargs):
pass
| (self, obj, file, **kwargs) | [
-0.028691157698631287,
-0.024866783991456032,
-0.045024074614048004,
0.027054525911808014,
-0.003546731546521187,
-0.0834348201751709,
-0.03146341070532799,
0.05317383632063866,
-0.04031458497047424,
-0.029476074501872063,
0.011832180432975292,
-0.006809557322412729,
-0.009318781085312366,
... |
729,987 | mmengine.fileio.handlers.base | dump_to_path | null | def dump_to_path(self, obj, filepath, mode='w', **kwargs):
with open(filepath, mode) as f:
self.dump_to_fileobj(obj, f, **kwargs)
| (self, obj, filepath, mode='w', **kwargs) | [
-0.02110276184976101,
0.012186586856842041,
-0.05267084017395973,
0.0038857655599713326,
0.04530381038784981,
-0.07704401761293411,
-0.007866200990974903,
0.075804702937603,
-0.064031220972538,
-0.04337598755955696,
-0.02939927950501442,
-0.027385395020246506,
-0.0035286021884530783,
-0.00... |
729,988 | mmengine.fileio.handlers.base | dump_to_str | null | @abstractmethod
def dump_to_str(self, obj, **kwargs):
pass
| (self, obj, **kwargs) | [
-0.041592709720134735,
-0.04678342863917351,
-0.018636347725987434,
0.0005188100622035563,
-0.006961420644074678,
-0.07762633264064789,
-0.012491208501160145,
0.00996282696723938,
0.03231639787554741,
-0.045577842742204666,
0.005567462183535099,
0.006203743629157543,
-0.0035141988191753626,
... |
729,989 | mmengine.fileio.handlers.base | load_from_fileobj | null | @abstractmethod
def load_from_fileobj(self, file, **kwargs):
pass
| (self, file, **kwargs) | [
-0.016012009233236313,
-0.042922243475914,
-0.05972227826714516,
0.036517441272735596,
-0.039568942040205,
-0.051607292145490646,
0.0006020222208462656,
0.07598578184843063,
-0.016188057139515877,
-0.016657520085573196,
0.03970307484269142,
0.019147343933582306,
-0.018409619107842445,
0.04... |
729,990 | mmengine.fileio.handlers.base | load_from_path | null | def load_from_path(self, filepath, mode='r', **kwargs):
with open(filepath, mode) as f:
return self.load_from_fileobj(f, **kwargs)
| (self, filepath, mode='r', **kwargs) | [
0.02389819547533989,
-0.04003793001174927,
-0.05811728164553642,
0.014582703821361065,
0.0034432620741426945,
-0.011379669420421124,
0.032154906541109085,
0.09680281579494476,
0.020855313166975975,
-0.011166133917868137,
-0.004844589624553919,
0.04405951872467995,
-0.03776021674275398,
0.0... |
729,991 | mmengine.fileio.backends.base | BaseStorageBackend | Abstract class of storage backends.
All backends need to implement two apis: :meth:`get()` and
:meth:`get_text()`.
- :meth:`get()` reads the file as a byte stream.
- :meth:`get_text()` reads the file as texts.
| class BaseStorageBackend(metaclass=ABCMeta):
"""Abstract class of storage backends.
All backends need to implement two apis: :meth:`get()` and
:meth:`get_text()`.
- :meth:`get()` reads the file as a byte stream.
- :meth:`get_text()` reads the file as texts.
"""
# a flag to indicate whethe... | () | [
0.011774963699281216,
-0.09993484616279602,
-0.08337462693452835,
0.04810350388288498,
0.032278094440698624,
-0.011559895239770412,
-0.029195457696914673,
0.059609632939100266,
0.006353462114930153,
-0.055917635560035706,
0.060147300362586975,
0.009337527677416801,
-0.009221033193171024,
0... |
729,992 | mmengine.fileio.backends.base | get | null | @abstractmethod
def get(self, filepath):
pass
| (self, filepath) | [
0.0012351986952126026,
-0.06863034516572952,
-0.05191521719098091,
0.05158746987581253,
-0.01817360334098339,
-0.048637740314006805,
-0.001671512727625668,
0.040509600192308426,
0.01735423505306244,
-0.02097584493458271,
0.05840462073683739,
0.021090557798743248,
-0.005633161403238773,
0.0... |
729,993 | mmengine.fileio.backends.base | get_text | null | @abstractmethod
def get_text(self, filepath):
pass
| (self, filepath) | [
0.004136272240430117,
-0.0852302834391594,
-0.010118212550878525,
0.06463132053613663,
-0.020895591005682945,
-0.05543593689799309,
-0.0003543022321537137,
0.033370327204465866,
0.06947619467973709,
-0.00551640335470438,
0.0792318657040596,
0.014040255919098854,
0.008173669688403606,
0.030... |
729,994 | mmengine.config.config | Config | A facility for config and config files.
It supports common file formats as configs: python/json/yaml.
``Config.fromfile`` can parse a dictionary from a config file, then
build a ``Config`` instance with the dictionary.
The interface is the same as a dict object and also allows access config
values ... | class Config:
"""A facility for config and config files.
It supports common file formats as configs: python/json/yaml.
``Config.fromfile`` can parse a dictionary from a config file, then
build a ``Config`` instance with the dictionary.
The interface is the same as a dict object and also allows acce... | (cfg_dict: dict = None, cfg_text: Optional[str] = None, filename: Union[str, pathlib.Path, NoneType] = None, env_variables: Optional[dict] = None, format_python_code: bool = True) | [
0.06372828036546707,
-0.04166848957538605,
0.011441930197179317,
-0.03748473525047302,
-0.021954137831926346,
-0.0019056678283959627,
-0.028419937938451767,
0.053078725934028625,
-0.004292044788599014,
-0.06153075024485588,
0.006265064235776663,
-0.04834559187293053,
-0.004255067091435194,
... |
729,995 | mmengine.config.config | __copy__ | null | def __copy__(self):
cls = self.__class__
other = cls.__new__(cls)
other.__dict__.update(self.__dict__)
super(Config, other).__setattr__('_cfg_dict', self._cfg_dict.copy())
return other
| (self) | [
0.015658173710107803,
-0.04204161837697029,
0.048165224492549896,
-0.02213093638420105,
-0.10879252851009369,
0.01417203526943922,
-0.03242647647857666,
0.014324231073260307,
0.04558686539530754,
-0.004883667454123497,
-0.012757518328726292,
-0.043080125004053116,
-0.02367079071700573,
0.0... |
729,996 | mmengine.config.config | __deepcopy__ | null | def __deepcopy__(self, memo):
cls = self.__class__
other = cls.__new__(cls)
memo[id(self)] = other
for key, value in self.__dict__.items():
super(Config, other).__setattr__(key, copy.deepcopy(value, memo))
return other
| (self, memo) | [
0.008401202969253063,
-0.03349919244647026,
0.0511905662715435,
-0.00821196660399437,
-0.1063947007060051,
0.015332525596022606,
-0.026246609166264534,
-0.0015821019187569618,
0.028816698119044304,
-0.012128714472055435,
-0.02779570408165455,
0.027602067217230797,
-0.005822311155498028,
0.... |
729,997 | mmengine.config.config | __getattr__ | null | def __getattr__(self, name: str) -> Any:
return getattr(self._cfg_dict, name)
| (self, name: str) -> Any | [
0.07752621173858643,
-0.08671049773693085,
0.028110003098845482,
-0.02964634634554386,
-0.028228184208273888,
-0.02260618284344673,
0.028110003098845482,
0.0038872843142598867,
0.013438777066767216,
-0.008956370875239372,
-0.03785143047571182,
0.029612580314278603,
0.007601519115269184,
0.... |
729,998 | mmengine.config.config | __getitem__ | null | def __getitem__(self, name):
return self._cfg_dict.__getitem__(name)
| (self, name) | [
0.06086728349328041,
-0.07692348212003708,
-0.012133565731346607,
-0.03636745363473892,
-0.016862330958247185,
0.012357953004539013,
0.003820826532319188,
-0.025746429339051247,
0.06901173293590546,
-0.03763067349791527,
-0.03852822631597519,
0.00261578056961298,
0.004433737602084875,
0.00... |
729,999 | mmengine.config.config | __getstate__ | null | def __getstate__(
self
) -> Tuple[dict, Optional[str], Optional[str], dict, bool, set]:
state = (self._cfg_dict, self._filename, self._text,
self._env_variables, self._format_python_code,
self._imported_names)
return state
| (self) -> Tuple[dict, Optional[str], Optional[str], dict, bool, set] | [
0.027143392711877823,
-0.05140233784914017,
0.004555485676974058,
-0.028622595593333244,
0.0025238916277885437,
-0.02063489519059658,
-0.01642840914428234,
-0.009425302967429161,
0.05036689341068268,
-0.10073378682136536,
-0.020302074030041695,
0.03731291741132736,
-0.03890306502580643,
0.... |
730,000 | mmengine.config.config | __init__ | null | def __init__(
self,
cfg_dict: dict = None,
cfg_text: Optional[str] = None,
filename: Optional[Union[str, Path]] = None,
env_variables: Optional[dict] = None,
format_python_code: bool = True,
):
filename = str(filename) if isinstance(filename, Path) else filename
if cfg_dict is None:
... | (self, cfg_dict: Optional[dict] = None, cfg_text: Optional[str] = None, filename: Union[str, pathlib.Path, NoneType] = None, env_variables: Optional[dict] = None, format_python_code: bool = True) | [
0.04250693321228027,
-0.06427877396345139,
0.034251295030117035,
-0.021483857184648514,
-0.047844298183918,
-0.030795447528362274,
-0.018853571265935898,
0.08209559321403503,
-0.007482871413230896,
-0.03108343482017517,
0.010175553150475025,
0.00840443093329668,
-0.01186507847160101,
0.063... |
730,001 | mmengine.config.config | __iter__ | null | def __iter__(self):
return iter(self._cfg_dict)
| (self) | [
0.0553165078163147,
-0.05999867990612984,
-0.061904992908239365,
-0.043176308274269104,
-0.03779181092977524,
0.007683777250349522,
-0.00744966883212328,
0.012825804762542248,
0.0799313485622406,
0.010735549964010715,
-0.023962683975696564,
-0.002011870499700308,
-0.015484608709812164,
0.0... |
730,002 | mmengine.config.config | __len__ | null | def __len__(self):
return len(self._cfg_dict)
| (self) | [
0.012943499721586704,
-0.05050406977534294,
0.004273796919733286,
0.00328268320299685,
0.00910929311066866,
0.03666510805487633,
-0.01300862431526184,
-0.028231481090188026,
0.024617070332169533,
-0.030413152649998665,
-0.03059224598109722,
-0.015108889900147915,
0.0075544449500739574,
-0.... |
730,003 | mmengine.config.config | __repr__ | null | def __repr__(self):
return f'Config (path: {self.filename}): {self._cfg_dict.__repr__()}'
| (self) | [
0.03682678937911987,
-0.052795324474573135,
0.04660623520612717,
-0.003633097978308797,
0.015823209658265114,
-0.04093005508184433,
-0.008343302644789219,
0.017575645819306374,
0.022670531645417213,
-0.0404171459376812,
-0.02260214276611805,
-0.030688991770148277,
-0.02561120316386223,
0.0... |
730,004 | mmengine.config.config | __setattr__ | null | def __setattr__(self, name, value):
if isinstance(value, dict):
value = ConfigDict(value)
self._cfg_dict.__setattr__(name, value)
| (self, name, value) | [
0.03908129781484604,
-0.02454926259815693,
0.009832050651311874,
-0.013562057167291641,
-0.06253713369369507,
0.021092614158988,
-0.02906407043337822,
0.042573221027851105,
0.014426219277083874,
-0.03239726647734642,
-0.03140965476632118,
-0.005824277643114328,
0.024584535509347916,
0.0332... |
730,005 | mmengine.config.config | __setitem__ | null | def __setitem__(self, name, value):
if isinstance(value, dict):
value = ConfigDict(value)
self._cfg_dict.__setitem__(name, value)
| (self, name, value) | [
0.03549942001700401,
-0.030791927129030228,
-0.030071750283241272,
-0.029421834275126457,
-0.0589490607380867,
0.018390841782093048,
-0.059827324002981186,
0.03864360228180885,
0.029070530086755753,
-0.03309297561645508,
-0.024714341387152672,
-0.005238843150436878,
0.01891780085861683,
0.... |
730,006 | mmengine.config.config | __setstate__ | null | def __setstate__(self, state: Tuple[dict, Optional[str], Optional[str],
dict, bool, set]):
super().__setattr__('_cfg_dict', state[0])
super().__setattr__('_filename', state[1])
super().__setattr__('_text', state[2])
super().__setattr__('_env_variables', state[3])
... | (self, state: Tuple[dict, Optional[str], Optional[str], dict, bool, set]) | [
-0.014973319135606289,
-0.0281479861587286,
0.05878070741891861,
0.006564154755324125,
-0.03751210495829582,
-0.028092358261346817,
-0.05607345700263977,
0.034545253962278366,
-0.00854360032826662,
-0.045207370072603226,
-0.03691873699426651,
0.06211841478943825,
0.0031661847606301308,
0.0... |
730,007 | mmengine.config.config | _dict_to_config_dict | Recursively converts ``dict`` to :obj:`ConfigDict`.
Args:
cfg (dict): Config dict.
scope (str, optional): Scope of instance.
has_scope (bool): Whether to add `_scope_` key to config dict.
Returns:
ConfigDict: Converted dict.
| @staticmethod
def _dict_to_config_dict(cfg: dict,
scope: Optional[str] = None,
has_scope=True):
"""Recursively converts ``dict`` to :obj:`ConfigDict`.
Args:
cfg (dict): Config dict.
scope (str, optional): Scope of instance.
has_scope (boo... | (cfg: dict, scope: Optional[str] = None, has_scope=True) | [
-0.004836113657802343,
0.01604817435145378,
-0.03445083275437355,
-0.034356653690338135,
-0.04087387025356293,
0.01738552190363407,
-0.0019659954123198986,
-0.009248419664800167,
0.027180181816220284,
-0.072405144572258,
0.014786169864237309,
-0.03705018386244774,
-0.004412306006997824,
-0... |
730,008 | mmengine.config.config | _dict_to_config_dict_lazy | Recursively converts ``dict`` to :obj:`ConfigDict`. The only
difference between ``_dict_to_config_dict_lazy`` and
``_dict_to_config_dict_lazy`` is that the former one does not consider
the scope, and will not trigger the building of ``LazyObject``.
Args:
cfg (dict): Config d... | @staticmethod
def _dict_to_config_dict_lazy(cfg: dict):
"""Recursively converts ``dict`` to :obj:`ConfigDict`. The only
difference between ``_dict_to_config_dict_lazy`` and
``_dict_to_config_dict_lazy`` is that the former one does not consider
the scope, and will not trigger the building of ``LazyObject... | (cfg: dict) | [
-0.013136368244886398,
0.006134080234915018,
-0.01955356076359749,
-0.031859468668699265,
-0.01019200962036848,
0.04099452868103981,
0.028179019689559937,
-0.018468299880623817,
0.04805343970656395,
-0.08968968689441681,
0.02095024287700653,
0.022422421723604202,
-0.024611815810203552,
-0.... |
730,009 | mmengine.config.config | _file2dict | Transform file to variables dictionary.
Args:
filename (str): Name of config file.
use_predefined_variables (bool, optional): Whether to use
predefined variables. Defaults to True.
use_environment_variables (bool, optional): Whether to use
env... | @staticmethod
def _file2dict(
filename: str,
use_predefined_variables: bool = True,
use_environment_variables: bool = True,
lazy_import: Optional[bool] = None) -> Tuple[dict, str, dict]:
"""Transform file to variables dictionary.
Args:
filename (str): Name of config file.... | (filename: str, use_predefined_variables: bool = True, use_environment_variables: bool = True, lazy_import: Optional[bool] = None) -> Tuple[dict, str, dict] | [
0.013578773476183414,
-0.053237903863191605,
0.0050260103307664394,
-0.01754572242498398,
-0.01731785573065281,
0.03388996794819832,
-0.041761718690395355,
0.025251753628253937,
0.004940560553222895,
-0.08087190240621567,
0.002390009118244052,
-0.022745221853256226,
-0.05203642696142197,
0... |
730,010 | mmengine.config.config | _get_base_files | Get the base config file.
Args:
filename (str): The config file.
Raises:
TypeError: Name of config file.
Returns:
list: A list of base config.
| @staticmethod
def _get_base_files(filename: str) -> list:
"""Get the base config file.
Args:
filename (str): The config file.
Raises:
TypeError: Name of config file.
Returns:
list: A list of base config.
"""
file_format = osp.splitext(filename)[1]
if file_format == '.... | (filename: str) -> list | [
0.0204317644238472,
-0.06996162235736847,
-0.006114683113992214,
-0.007358033210039139,
-0.036780886352062225,
0.027836190536618233,
0.02614746242761612,
-0.009909683838486671,
-0.010846835561096668,
-0.04839785769581795,
0.00653686560690403,
0.008271987549960613,
-0.03323641046881676,
0.0... |
730,011 | mmengine.config.config | _get_base_modules | Get base module name from parsed code.
Args:
nodes (list): Parsed code of the config file.
Returns:
list: Name of base modules.
| @staticmethod
def _get_base_modules(nodes: list) -> list:
"""Get base module name from parsed code.
Args:
nodes (list): Parsed code of the config file.
Returns:
list: Name of base modules.
"""
def _get_base_module_from_with(with_nodes: list) -> list:
"""Get base module name f... | (nodes: list) -> list | [
0.029683753848075867,
-0.06518404930830002,
0.02687242440879345,
0.017207270488142967,
-0.02702753245830536,
0.0356941819190979,
0.04494248330593109,
-0.0003456601407378912,
-0.05355096608400345,
-0.08236223459243774,
0.00932585634291172,
-0.019213978201150894,
0.00026553121278993785,
0.05... |
730,012 | mmengine.config.config | _get_cfg_path | Get the config path from the current or external package.
Args:
cfg_path (str): Relative path of config.
filename (str): The config file being parsed.
Returns:
Tuple[str, str or None]: Path and scope of config. If the config
is not an external config, th... | @staticmethod
def _get_cfg_path(cfg_path: str,
filename: str) -> Tuple[str, Optional[str]]:
"""Get the config path from the current or external package.
Args:
cfg_path (str): Relative path of config.
filename (str): The config file being parsed.
Returns:
Tuple[str, ... | (cfg_path: str, filename: str) -> Tuple[str, Optional[str]] | [
0.04881194606423378,
-0.03266821429133415,
0.02632875181734562,
0.012878814712166786,
0.01918020099401474,
-0.0028627521824091673,
0.0388934500515461,
0.00785769522190094,
0.031030995771288872,
-0.055170442909002304,
-0.011631864123046398,
-0.08429769426584244,
-0.047936223447322845,
-0.00... |
730,013 | mmengine.config.config | _is_lazy_import | null | @staticmethod
def _is_lazy_import(filename: str) -> bool:
if not filename.endswith('.py'):
return False
with open(filename, encoding='utf-8') as f:
codes_str = f.read()
parsed_codes = ast.parse(codes_str)
for node in ast.walk(parsed_codes):
if (isinstance(node, ast.Assign)
... | (filename: str) -> bool | [
0.027786871418356895,
-0.051938075572252274,
0.05012024566531181,
0.0368574857711792,
0.049489568918943405,
0.04956376552581787,
0.09163361042737961,
0.012353843078017235,
-0.009821861051023006,
-0.08925929665565491,
0.012372392229735851,
-0.009367403574287891,
0.007020914927124977,
0.0060... |
730,014 | mmengine.config.config | _merge_a_into_b | merge dict ``a`` into dict ``b`` (non-inplace).
Values in ``a`` will overwrite ``b``. ``b`` is copied first to avoid
in-place modifications.
Args:
a (dict): The source dict to be merged into ``b``.
b (dict): The origin dict to be fetch keys from ``a``.
allow... | @staticmethod
def _merge_a_into_b(a: dict,
b: dict,
allow_list_keys: bool = False) -> dict:
"""merge dict ``a`` into dict ``b`` (non-inplace).
Values in ``a`` will overwrite ``b``. ``b`` is copied first to avoid
in-place modifications.
Args:
a (dict): The ... | (a: dict, b: dict, allow_list_keys: bool = False) -> dict | [
-0.02967674657702446,
-0.04889349266886711,
-0.053702689707279205,
-0.012053047306835651,
-0.05763019993901253,
0.0493343360722065,
-0.01906645856797695,
-0.009533229283988476,
0.024206286296248436,
-0.0780692845582962,
-0.023064102977514267,
-0.030598510056734085,
-0.0008679095772095025,
... |
730,015 | mmengine.config.config | _parse_lazy_import | Transform file to variables dictionary.
Args:
filename (str): Name of config file.
Returns:
Tuple[dict, dict]: ``cfg_dict`` and ``imported_names``.
- cfg_dict (dict): Variables dictionary of parsed config.
- imported_names (set): Used to mark the na... | @staticmethod
def _parse_lazy_import(filename: str) -> Tuple[ConfigDict, set]:
"""Transform file to variables dictionary.
Args:
filename (str): Name of config file.
Returns:
Tuple[dict, dict]: ``cfg_dict`` and ``imported_names``.
- cfg_dict (dict): Variables dictionary of parsed co... | (filename: str) -> Tuple[mmengine.config.config.ConfigDict, set] | [
0.02116609923541546,
-0.039129436016082764,
-0.0053661237470805645,
0.028446920216083527,
0.02039027400314808,
0.03457394987344742,
0.014173727482557297,
0.01275138184428215,
-0.04117840901017189,
-0.09349686652421951,
-0.01862974837422371,
0.0037746874149888754,
-0.05363139510154724,
0.04... |
730,016 | mmengine.config.config | _parse_scope | Adds ``_scope_`` to :obj:`ConfigDict` instance, which means a base
variable.
If the config dict already has the scope, scope will not be
overwritten.
Args:
cfg (dict): Config needs to be parsed with scope.
| @staticmethod
def _parse_scope(cfg: dict) -> None:
"""Adds ``_scope_`` to :obj:`ConfigDict` instance, which means a base
variable.
If the config dict already has the scope, scope will not be
overwritten.
Args:
cfg (dict): Config needs to be parsed with scope.
"""
if isinstance(cfg, C... | (cfg: dict) -> NoneType | [
-0.002067255787551403,
-0.0069958423264324665,
-0.06622316688299179,
-0.031212901696562767,
-0.05394384264945984,
0.057883162051439285,
0.023085836321115494,
-0.007319682743400335,
0.04074179753661156,
-0.05873490869998932,
-0.012749556452035904,
-0.032277584075927734,
-0.04613618180155754,
... |
730,017 | mmengine.config.config | _pre_substitute_base_vars | Preceding step for substituting variables in base config with actual
value.
Args:
filename (str): Filename of config.
temp_config_name (str): Temporary filename to save substituted
config.
Returns:
dict: A dictionary contains variables in bas... | @staticmethod
def _pre_substitute_base_vars(filename: str,
temp_config_name: str) -> dict:
"""Preceding step for substituting variables in base config with actual
value.
Args:
filename (str): Filename of config.
temp_config_name (str): Temporary filename to save... | (filename: str, temp_config_name: str) -> dict | [
0.0008916532387956977,
-0.038418032228946686,
0.004397163167595863,
-0.011976215988397598,
-0.0266681257635355,
0.026468975469470024,
-0.03655325621366501,
-0.0029420030768960714,
0.00921978522092104,
-0.04048196226358414,
0.00023762333148624748,
0.049063559621572495,
-0.03280559554696083,
... |
730,018 | mmengine.config.config | _substitute_base_vars | Substitute base variables from strings to their actual values.
Args:
Any : Config dictionary.
base_var_dict (dict): A dictionary contains variables in base
config.
base_cfg (dict): Base config dictionary.
Returns:
Any : A dictionary with ... | @staticmethod
def _substitute_base_vars(cfg: Any, base_var_dict: dict,
base_cfg: dict) -> Any:
"""Substitute base variables from strings to their actual values.
Args:
Any : Config dictionary.
base_var_dict (dict): A dictionary contains variables in base
conf... | (cfg: Any, base_var_dict: dict, base_cfg: dict) -> Any | [
0.0025401257444173098,
-0.06163683533668518,
0.011978044174611568,
-0.020391933619976044,
-0.06635358184576035,
-0.004561586771160364,
-0.011153501458466053,
0.007398725487291813,
0.03542876988649368,
-0.0519905649125576,
-0.03296400606632233,
0.045145969837903976,
-0.03459535911679268,
0.... |
730,019 | mmengine.config.config | _substitute_env_variables | Substitute environment variables in config with actual values.
Sometimes, we want to change some items in the config with environment
variables. For examples, we expect to change dataset root by setting
``DATASET_ROOT=/dataset/root/path`` in the command line. This can be
easily achieved... | @staticmethod
def _substitute_env_variables(filename: str, temp_config_name: str):
"""Substitute environment variables in config with actual values.
Sometimes, we want to change some items in the config with environment
variables. For examples, we expect to change dataset root by setting
``DATASET_ROOT=... | (filename: str, temp_config_name: str) | [
0.02913973107933998,
-0.06733029335737228,
-0.0014781380305066705,
-0.03551466390490532,
-0.03765931725502014,
0.007781744468957186,
-0.0414370521903038,
-0.006296228151768446,
0.06567753106355667,
-0.01303516048938036,
-0.013281106948852539,
-0.019675713032484055,
-0.04997631162405014,
0.... |
730,020 | mmengine.config.config | _substitute_predefined_vars | Substitute predefined variables in config with actual values.
Sometimes we want some variables in the config to be related to the
current path or file name, etc.
Here is an example of a typical usage scenario. When training a model,
we define a working directory in the config that save... | @staticmethod
def _substitute_predefined_vars(filename: str, temp_config_name: str):
"""Substitute predefined variables in config with actual values.
Sometimes we want some variables in the config to be related to the
current path or file name, etc.
Here is an example of a typical usage scenario. When t... | (filename: str, temp_config_name: str) | [
0.04338295757770538,
-0.06926051527261734,
0.014480013400316238,
-0.02878877893090248,
-0.0339072048664093,
0.010798170231282711,
-0.03934910520911217,
0.03232791647315025,
0.03775078430771828,
-0.03261332958936691,
-0.015088897198438644,
-0.014793969690799713,
-0.03984382376074791,
0.0451... |
730,021 | mmengine.config.config | _to_lazy_dict | Convert config object to dictionary with lazy object, and filter the
imported object. | def _to_lazy_dict(self, keep_imported: bool = False) -> dict:
"""Convert config object to dictionary with lazy object, and filter the
imported object."""
res = self._cfg_dict._to_lazy_dict()
if hasattr(self, '_imported_names') and not keep_imported:
res = {
key: value
for... | (self, keep_imported: bool = False) -> dict | [
0.008938645012676716,
-0.026087798178195953,
-0.014678853563964367,
-0.05192543938755989,
-0.012364901602268219,
0.024354567751288414,
0.020101899281144142,
0.006454943213611841,
0.023371808230876923,
-0.06575554609298706,
-0.00008892298501450568,
-0.02606992982327938,
-0.03050128184258938,
... |
730,022 | mmengine.config.config | _validate_py_syntax | Validate syntax of python config.
Args:
filename (str): Filename of python config file.
| @staticmethod
def _validate_py_syntax(filename: str):
"""Validate syntax of python config.
Args:
filename (str): Filename of python config file.
"""
with open(filename, encoding='utf-8') as f:
content = f.read()
try:
ast.parse(content)
except SyntaxError as e:
rai... | (filename: str) | [
0.029015375301241875,
-0.049730464816093445,
0.08827513456344604,
-0.015140005387365818,
-0.043425098061561584,
0.00771695002913475,
0.0077124969102442265,
0.018417371436953545,
-0.0032974041532725096,
-0.059063833206892014,
0.003827304346486926,
0.005846713669598103,
0.022086596116423607,
... |
730,023 | mmengine.config.config | auto_argparser | Generate argparser from config file automatically (experimental) | @staticmethod
def auto_argparser(description=None):
"""Generate argparser from config file automatically (experimental)"""
partial_parser = ArgumentParser(description=description)
partial_parser.add_argument('config', help='config file path')
cfg_file = partial_parser.parse_known_args()[0].config
cf... | (description=None) | [
-0.02647191844880581,
-0.020034343004226685,
0.01637878827750683,
-0.04420848563313484,
0.00047029671259224415,
0.0306496974080801,
0.04625939577817917,
0.02880767732858658,
-0.03501737490296364,
-0.040562424808740616,
0.004453131463378668,
-0.0020592170767486095,
-0.07793454825878143,
0.0... |
730,025 | mmengine.config.config | diff | null | @staticmethod
def diff(cfg1: Union[str, 'Config'], cfg2: Union[str, 'Config']) -> str:
if isinstance(cfg1, str):
cfg1 = Config.fromfile(cfg1)
if isinstance(cfg2, str):
cfg2 = Config.fromfile(cfg2)
res = difflib.unified_diff(
cfg1.pretty_text.split('\n'), cfg2.pretty_text.split('\n'))... | (cfg1: Union[str, mmengine.config.config.Config], cfg2: Union[str, mmengine.config.config.Config]) -> str | [
0.0326659232378006,
-0.08918657153844833,
0.06397076696157455,
-0.01720154657959938,
-0.010852823033928871,
-0.04821089282631874,
-0.031269025057554245,
0.02428453601896763,
0.02030874975025654,
0.006393495015799999,
-0.012885489501059055,
-0.04051004350185394,
-0.023603996261954308,
0.045... |
730,026 | mmengine.config.config | dump | Dump config to file or return config text.
Args:
file (str or Path, optional): If not specified, then the object
is dumped to a str, otherwise to a file specified by the filename.
Defaults to None.
Returns:
str or None: Config text.
| def dump(self, file: Optional[Union[str, Path]] = None):
"""Dump config to file or return config text.
Args:
file (str or Path, optional): If not specified, then the object
is dumped to a str, otherwise to a file specified by the filename.
Defaults to None.
Returns:
str or No... | (self, file: Union[str, pathlib.Path, NoneType] = None) | [
0.013815508224070072,
-0.038235943764448166,
0.08127411454916,
-0.0012664974201470613,
0.020682334899902344,
-0.06559410691261292,
-0.030868884176015854,
-0.012678616680204868,
-0.028795193880796432,
-0.05940941348671913,
-0.05071446672081947,
-0.034561507403850555,
-0.03006851114332676,
0... |
730,027 | mmengine.config.config | fromfile | Build a Config instance from config file.
Args:
filename (str or Path): Name of config file.
use_predefined_variables (bool, optional): Whether to use
predefined variables. Defaults to True.
import_custom_modules (bool, optional): Whether to support
... | @staticmethod
def fromfile(filename: Union[str, Path],
use_predefined_variables: bool = True,
import_custom_modules: bool = True,
use_environment_variables: bool = True,
lazy_import: Optional[bool] = None,
format_python_code: bool = True) -> 'Config':
... | (filename: Union[str, pathlib.Path], use_predefined_variables: bool = True, import_custom_modules: bool = True, use_environment_variables: bool = True, lazy_import: Optional[bool] = None, format_python_code: bool = True) -> mmengine.config.config.Config | [
0.04219772294163704,
-0.04962852597236633,
0.019905313849449158,
-0.021137364208698273,
-0.02710510790348053,
0.003017560811713338,
-0.011656351387500763,
0.04801146313548088,
-0.012667017057538033,
-0.047934457659721375,
-0.0004764569748658687,
-0.03992613032460213,
-0.002211434068158269,
... |
730,028 | mmengine.config.config | fromstring | Build a Config instance from config text.
Args:
cfg_str (str): Config text.
file_format (str): Config file format corresponding to the
config str. Only py/yml/yaml/json type are supported now!
Returns:
Config: Config object generated from ``cfg_str``.... | @staticmethod
def fromstring(cfg_str: str, file_format: str) -> 'Config':
"""Build a Config instance from config text.
Args:
cfg_str (str): Config text.
file_format (str): Config file format corresponding to the
config str. Only py/yml/yaml/json type are supported now!
Returns:
... | (cfg_str: str, file_format: str) -> mmengine.config.config.Config | [
0.022254489362239838,
-0.003044021548703313,
0.016657495871186256,
-0.0846700370311737,
-0.03966524451971054,
-0.008390724658966064,
-0.014969815500080585,
0.11808037757873535,
0.015322607941925526,
-0.06006995961070061,
0.024333100765943527,
0.03787267953157425,
-0.0694141760468483,
0.042... |
730,029 | mmengine.config.config | merge_from_dict | Merge list into cfg_dict.
Merge the dict parsed by MultipleKVAction into this cfg.
Args:
options (dict): dict of configs to merge from.
allow_list_keys (bool): If True, int string keys (e.g. '0', '1')
are allowed in ``options`` and will replace the element of th... | def merge_from_dict(self,
options: dict,
allow_list_keys: bool = True) -> None:
"""Merge list into cfg_dict.
Merge the dict parsed by MultipleKVAction into this cfg.
Args:
options (dict): dict of configs to merge from.
allow_list_keys (bool): If True, ... | (self, options: dict, allow_list_keys: bool = True) -> NoneType | [
0.007146807853132486,
-0.048083964735269547,
-0.0627962201833725,
-0.047166939824819565,
-0.04026932269334793,
0.008756584487855434,
-0.022267740219831467,
-0.022487027570605278,
0.03672083839774132,
-0.006673344410955906,
-0.058250971138477325,
-0.07603326439857483,
0.010446101427078247,
... |
730,030 | mmengine.config.config | to_dict | Convert all data in the config to a builtin ``dict``.
Args:
keep_imported (bool): Whether to keep the imported field.
Defaults to False
If you import third-party objects in the config file, all imported
objects will be converted to a string like ``torch.optim.SGD``
... | def to_dict(self, keep_imported: bool = False):
"""Convert all data in the config to a builtin ``dict``.
Args:
keep_imported (bool): Whether to keep the imported field.
Defaults to False
If you import third-party objects in the config file, all imported
objects will be converted to a... | (self, keep_imported: bool = False) | [
0.005706795956939459,
-0.01706443913280964,
-0.010611656121909618,
-0.053860217332839966,
0.0018160105682909489,
0.010415835306048393,
-0.027787992730736732,
0.013586277142167091,
-0.003112161997705698,
-0.053300727158784866,
-0.03183496743440628,
-0.04998108744621277,
-0.05080167204141617,
... |
730,031 | mmengine.config.config | ConfigDict | A dictionary for config which has the same interface as python's built-
in dictionary and can be used as a normal dictionary.
The Config class would transform the nested fields (dictionary-like fields)
in config file into ``ConfigDict``.
If the class attribute ``lazy`` is ``False``, users will get th... | class ConfigDict(Dict):
"""A dictionary for config which has the same interface as python's built-
in dictionary and can be used as a normal dictionary.
The Config class would transform the nested fields (dictionary-like fields)
in config file into ``ConfigDict``.
If the class attribute ``lazy`` ... | (*args, **kwargs) | [
0.01785965822637081,
-0.027536269277334213,
-0.04097834229469299,
-0.00476204976439476,
0.019353222101926804,
0.030060602352023125,
-0.01636609435081482,
-0.010759970173239708,
0.05494632199406624,
-0.0755196362733841,
0.002420467557385564,
0.03990550339221954,
0.00934529211372137,
0.04855... |
730,033 | mmengine.config.config | __copy__ | null | def __copy__(self):
other = self.__class__()
for key, value in super().items():
other[key] = value
return other
| (self) | [
-0.008829004131257534,
-0.038312528282403946,
-0.015526562929153442,
-0.029483523219823837,
-0.07805196940898895,
0.01116556953638792,
-0.010077551007270813,
-0.004133579321205616,
0.09802870452404022,
-0.007986235432326794,
-0.04683831334114075,
0.0022217431105673313,
0.0031659561209380627,... |
730,034 | mmengine.config.config | __deepcopy__ | null | def __deepcopy__(self, memo):
other = self.__class__()
memo[id(self)] = other
for key, value in super().items():
other[copy.deepcopy(key, memo)] = copy.deepcopy(value, memo)
return other
| (self, memo) | [
-0.01674775406718254,
-0.031414374709129333,
0.033316101878881454,
0.021726330742239952,
-0.09171346575021744,
0.0006223221425898373,
-0.010782431811094284,
0.005494375713169575,
0.04922960698604584,
-0.009185698814690113,
-0.030607037246227264,
0.058953531086444855,
-0.0006800691480748355,
... |
730,036 | mmengine.config.config | __eq__ | null | def __eq__(self, other):
if isinstance(other, ConfigDict):
return other.to_dict() == self.to_dict()
elif isinstance(other, dict):
return {k: v for k, v in self.items()} == other
else:
return False
| (self, other) | [
0.06777842342853546,
-0.03649607673287392,
-0.005232213530689478,
0.006956255529075861,
-0.032890841364860535,
-0.02756618522107601,
-0.04906817898154259,
0.010630822740495205,
0.05424492806196213,
-0.009008466266095638,
-0.014661290682852268,
-0.03316816687583923,
0.0602351650595665,
0.05... |
730,037 | mmengine.config.config | __getattr__ | null | def __getattr__(self, name):
try:
value = super().__getattr__(name)
if isinstance(value, (LazyAttr, LazyObject)) and not self.lazy:
value = value.build()
except KeyError:
raise AttributeError(f"'{self.__class__.__name__}' object has no "
f"attribu... | (self, name) | [
0.049473922699689865,
-0.04883279278874397,
0.006999010685831308,
0.039144594222307205,
0.028744028881192207,
0.0006784187280572951,
0.0635431781411171,
-0.02806727960705757,
0.0391802117228508,
-0.02755081281065941,
0.026161696761846542,
0.10813738405704498,
0.04106798768043518,
0.0348347... |
730,038 | mmengine.config.config | __getitem__ | null | def __getitem__(self, key):
return self.build_lazy(super().__getitem__(key))
| (self, key) | [
0.025444822385907173,
-0.07591897249221802,
-0.03530032932758331,
0.024198342114686966,
0.024397779256105423,
0.032657790929079056,
0.03430314362049103,
-0.014633681625127792,
0.11328015476465225,
-0.06940403580665588,
0.015597626566886902,
0.07000234723091125,
0.02783806622028351,
0.00452... |
730,041 | mmengine.config.config | __init__ | null | def __init__(__self, *args, **kwargs):
object.__setattr__(__self, '__parent', kwargs.pop('__parent', None))
object.__setattr__(__self, '__key', kwargs.pop('__key', None))
object.__setattr__(__self, '__frozen', False)
for arg in args:
if not arg:
continue
# Since ConfigDict.it... | (_ConfigDict__self, *args, **kwargs) | [
-0.019368771463632584,
-0.01529113482683897,
-0.011623083613812923,
-0.014845144003629684,
-0.014208013191819191,
0.050351522862911224,
-0.014408254064619541,
0.03409558907151222,
0.05898009240627289,
-0.04052150994539261,
0.009311209432780743,
0.09130991995334625,
-0.004498597234487534,
0... |
730,043 | mmengine.config.config | __iter__ | null | def __iter__(self):
# Implement `__iter__` to overwrite the unpacking operator `**cfg_dict`
# to get the built lazy object
return iter(self.keys())
| (self) | [
0.022642897441983223,
-0.07164119184017181,
-0.05628950893878937,
-0.03618850186467171,
-0.002178166527301073,
0.036121610552072525,
0.014415198005735874,
0.0006244982942007482,
0.08695942908525467,
-0.0031690022442489862,
0.0024373724590986967,
0.023144586011767387,
0.0015709137078374624,
... |
730,044 | mmengine.config.config | __missing__ | null | def __missing__(self, name):
raise KeyError(name)
| (self, name) | [
0.03273654729127884,
-0.03880128264427185,
-0.011485505849123001,
0.024356773123145103,
-0.020101673901081085,
-0.01481948234140873,
0.026622898876667023,
0.006333739031106234,
0.07545056194067001,
0.0003431284858379513,
-0.0248295608907938,
0.013042448088526726,
0.05451743304729462,
-0.02... |
730,046 | mmengine.config.config | __reduce_ex__ | null | def __reduce_ex__(self, proto):
# Override __reduce_ex__ to avoid `self.items` will be
# called by CPython interpreter during pickling. See more details in
# https://github.com/python/cpython/blob/8d61a71f9c81619e34d4a30b625922ebc83c561b/Objects/typeobject.c#L6196 # noqa: E501
if digit_version(platform... | (self, proto) | [
0.013625068590044975,
-0.03316937014460564,
-0.0526956282556057,
0.04403333365917206,
0.0029754082206636667,
-0.050096940249204636,
0.011432425118982792,
-0.030372172594070435,
0.04923070967197418,
-0.049158524721860886,
0.04757043719291687,
0.05623273178935051,
-0.00024292210582643747,
0.... |
730,048 | mmengine.config.config | __setattr__ | null | def __setattr__(self, name, value):
value = self._hook(value)
return super().__setattr__(name, value)
| (self, name, value) | [
0.030405579134821892,
-0.023096224293112755,
0.012507673352956772,
0.04318860545754433,
-0.026734212413430214,
0.021677741780877113,
-0.015269541181623936,
0.03561224043369293,
0.037014033645391464,
-0.015244509093463421,
-0.02897040918469429,
0.01024644635617733,
0.03761480376124382,
0.03... |
730,049 | mmengine.config.config | __setitem__ | null | def __setitem__(self, name, value):
value = self._hook(value)
return super().__setitem__(name, value)
| (self, name, value) | [
0.03670147433876991,
-0.028565924614667892,
-0.0361025370657444,
0.03014645166695118,
-0.030911758542060852,
0.015863487496972084,
-0.0526731051504612,
0.03646855428814888,
0.05666600912809372,
-0.018117817118763924,
-0.02869902178645134,
-0.008364309556782246,
0.034937940537929535,
0.0206... |
730,051 | mmengine.config.config | _to_lazy_dict | Convert the ConfigDict to a normal dictionary recursively, and keep
the ``LazyObject`` or ``LazyAttr`` object not built. | def _to_lazy_dict(self):
"""Convert the ConfigDict to a normal dictionary recursively, and keep
the ``LazyObject`` or ``LazyAttr`` object not built."""
def _to_dict(data):
if isinstance(data, ConfigDict):
return {
key: _to_dict(value)
for key, value in Dic... | (self) | [
-0.022076794877648354,
-0.012708554975688457,
0.007386127486824989,
-0.03764573484659195,
-0.01019372045993805,
0.04710996150970459,
0.007630892097949982,
-0.006867803167551756,
0.04676441103219986,
-0.07191275805234909,
0.01779581606388092,
0.04446074366569519,
-0.0017973390640690923,
0.0... |
730,052 | mmengine.config.config | build_lazy | If class attribute ``lazy`` is False, the LazyObject will be built
and returned.
Args:
value (Any): The value to be built.
Returns:
Any: The built value.
| def build_lazy(self, value: Any) -> Any:
"""If class attribute ``lazy`` is False, the LazyObject will be built
and returned.
Args:
value (Any): The value to be built.
Returns:
Any: The built value.
"""
if isinstance(value, (LazyAttr, LazyObject)) and not self.lazy:
value ... | (self, value: Any) -> Any | [
0.020572325214743614,
-0.01354271825402975,
0.010881447233259678,
0.01679927296936512,
0.035594500601291656,
0.03111235797405243,
0.04093455150723457,
-0.015538671053946018,
0.06047388166189194,
-0.06863278150558472,
0.049093447625637054,
0.0954555869102478,
-0.01105653028935194,
-0.008627... |
730,056 | mmengine.config.config | get | Get the value of the key. If class attribute ``lazy`` is True, the
LazyObject will be built and returned.
Args:
key (str): The key.
default (any, optional): The default value. Defaults to None.
Returns:
Any: The value of the key.
| def get(self, key: str, default: Optional[Any] = None) -> Any:
"""Get the value of the key. If class attribute ``lazy`` is True, the
LazyObject will be built and returned.
Args:
key (str): The key.
default (any, optional): The default value. Defaults to None.
Returns:
Any: The va... | (self, key: str, default: Optional[Any] = None) -> Any | [
0.027657877653837204,
-0.05885176360607147,
-0.0056059714406728745,
0.02783292718231678,
0.04967914894223213,
0.002483519958332181,
0.06791934370994568,
-0.012052183039486408,
0.12232483923435211,
-0.0688646137714386,
0.010774319060146809,
0.050169289112091064,
0.014931752346456051,
-0.009... |
730,057 | mmengine.config.config | items | Yield the keys and values of the dictionary.
If class attribute ``lazy`` is False, the value of ``LazyObject`` or
``LazyAttr`` will be built and returned.
| def items(self):
"""Yield the keys and values of the dictionary.
If class attribute ``lazy`` is False, the value of ``LazyObject`` or
``LazyAttr`` will be built and returned.
"""
items = []
for key, value in super().items():
items.append((key, self.build_lazy(value)))
return items
| (self) | [
0.013503062538802624,
-0.042181339114904404,
-0.03045830689370632,
-0.03998776525259018,
0.045201998203992844,
0.040671009570360184,
0.01887911558151245,
-0.0383695550262928,
0.11852488666772842,
-0.02094682864844799,
0.002244142582640052,
0.08407499641180038,
0.03934048116207123,
0.027419... |
730,058 | mmengine.config.config | merge | Merge another dictionary into current dictionary.
Args:
other (dict): Another dictionary.
| def merge(self, other: dict):
"""Merge another dictionary into current dictionary.
Args:
other (dict): Another dictionary.
"""
default = object()
def _merge_a_into_b(a, b):
if isinstance(a, dict):
if not isinstance(b, dict):
a.pop(DELETE_KEY, None)
... | (self, other: dict) | [
-0.01693090610206127,
-0.02401212975382805,
-0.025311609730124474,
0.011949565261602402,
-0.048626918345689774,
-0.02789173647761345,
-0.06068006530404091,
-0.03970005363225937,
0.0713018998503685,
-0.04128203168511391,
-0.03271299600601196,
-0.06885360181331635,
0.003931397572159767,
0.06... |
730,059 | mmengine.config.config | pop | Pop the value of the key. If class attribute ``lazy`` is True, the
LazyObject will be built and returned.
Args:
key (str): The key.
default (any, optional): The default value. Defaults to None.
Returns:
Any: The value of the key.
| def pop(self, key, default=None):
"""Pop the value of the key. If class attribute ``lazy`` is True, the
LazyObject will be built and returned.
Args:
key (str): The key.
default (any, optional): The default value. Defaults to None.
Returns:
Any: The value of the key.
"""
r... | (self, key, default=None) | [
0.03243766725063324,
-0.015750732272863388,
-0.03609578683972359,
-0.0004074212338309735,
-0.013860991224646568,
-0.013999687507748604,
0.022451510652899742,
0.026005610823631287,
0.1567271500825882,
-0.07524289935827255,
-0.002934299875050783,
0.04098484292626381,
-0.025468161329627037,
0... |
730,061 | mmengine.config.config | to_dict | Convert the ConfigDict to a normal dictionary recursively, and
convert the ``LazyObject`` or ``LazyAttr`` to string. | def to_dict(self):
"""Convert the ConfigDict to a normal dictionary recursively, and
convert the ``LazyObject`` or ``LazyAttr`` to string."""
return _lazy2string(self, dict_type=dict)
| (self) | [
-0.016483299434185028,
-0.025150921195745468,
0.04211575537919998,
-0.06100672483444214,
0.020724507048726082,
0.023391468450427055,
-0.0035767832305282354,
0.013084775768220425,
0.02409524843096733,
-0.08208312094211578,
0.00558857899159193,
0.01865946501493454,
0.007973100990056992,
0.02... |
730,063 | mmengine.config.config | update | Override this method to make sure the LazyObject will not be built
during updating. | def update(self, *args, **kwargs) -> None:
"""Override this method to make sure the LazyObject will not be built
during updating."""
other = {}
if args:
if len(args) > 1:
raise TypeError('update only accept one positional argument')
# Avoid to used self.items to build LazyObj... | (self, *args, **kwargs) -> NoneType | [
-0.025442812591791153,
-0.023858200758695602,
-0.061105478554964066,
0.03924139589071274,
-0.012294095009565353,
0.012810428626835346,
-0.027757413685321808,
0.009489865973591805,
0.07606136798858643,
-0.025531835854053497,
-0.01521405391395092,
0.017252683639526367,
0.0059422943741083145,
... |
730,064 | mmengine.config.config | values | Yield the values of the dictionary.
If class attribute ``lazy`` is False, the value of ``LazyObject`` or
``LazyAttr`` will be built and returned.
| def values(self):
"""Yield the values of the dictionary.
If class attribute ``lazy`` is False, the value of ``LazyObject`` or
``LazyAttr`` will be built and returned.
"""
values = []
for value in super().values():
values.append(self.build_lazy(value))
return values
| (self) | [
0.04143040254712105,
-0.05642925947904587,
-0.013976206071674824,
-0.026256736367940903,
0.026116887107491493,
0.04405258223414421,
0.007735423278063536,
-0.04877249896526337,
0.10537657141685486,
-0.01873982883989811,
-0.00484665809199214,
0.08167208731174469,
0.02658887952566147,
0.01075... |
730,065 | mmengine.registry.default_scope | DefaultScope | Scope of current task used to reset the current registry, which can be
accessed globally.
Consider the case of resetting the current ``Registry`` by
``default_scope`` in the internal module which cannot access runner
directly, it is difficult to get the ``default_scope`` defined in
``Runner``. Howe... | class DefaultScope(ManagerMixin):
"""Scope of current task used to reset the current registry, which can be
accessed globally.
Consider the case of resetting the current ``Registry`` by
``default_scope`` in the internal module which cannot access runner
directly, it is difficult to get the ``defaul... | (name: str, scope_name: str) | [
0.0836733877658844,
0.004491348285228014,
-0.05334368720650673,
-0.01107834093272686,
0.01684136502444744,
-0.0001967643911484629,
0.0033839901443570852,
-0.010287711396813393,
0.04930480942130089,
-0.018422624096274376,
0.014107500202953815,
-0.03817883878946304,
-0.02958669513463974,
0.0... |
730,066 | mmengine.registry.default_scope | __init__ | null | def __init__(self, name: str, scope_name: str):
super().__init__(name)
assert isinstance(
scope_name,
str), (f'scope_name should be a string, but got {scope_name}')
self._scope_name = scope_name
| (self, name: str, scope_name: str) | [
-0.03295588120818138,
0.008931723423302174,
-0.03750452399253845,
-0.026786455884575844,
-0.04708978533744812,
-0.016922347247600555,
0.02288263849914074,
0.047264065593481064,
0.02452084794640541,
-0.026838738471269608,
-0.002834188286215067,
0.023910876363515854,
-0.029522612690925598,
0... |
730,067 | mmengine.config.config | DictAction |
argparse action to split an argument into KEY=VALUE form
on the first = and append to a dictionary. List options can
be passed as comma separated values, i.e 'KEY=V1,V2,V3', or with explicit
brackets, i.e. 'KEY=[V1,V2,V3]'. It also support nested brackets to build
list/tuple values. e.g. 'KEY=[(V1,... | class DictAction(Action):
"""
argparse action to split an argument into KEY=VALUE form
on the first = and append to a dictionary. List options can
be passed as comma separated values, i.e 'KEY=V1,V2,V3', or with explicit
brackets, i.e. 'KEY=[V1,V2,V3]'. It also support nested brackets to build
l... | (option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None) | [
0.011027541011571884,
0.0007911346037872136,
-0.05669514834880829,
-0.08144701272249222,
0.013107617385685444,
0.02381112612783909,
-0.0013510043499991298,
0.06037447974085808,
0.015323578380048275,
-0.08571168780326843,
-0.009700055234134197,
0.06593528389930725,
0.009705280885100365,
0.0... |
730,068 | mmengine.config.config | __call__ | Parse Variables in string and add them into argparser.
Args:
parser (ArgumentParser): Argument parser.
namespace (Namespace): Argument namespace.
values (Union[str, Sequence[Any], None]): Argument string.
option_string (list[str], optional): Option string.
... | def __call__(self,
parser: ArgumentParser,
namespace: Namespace,
values: Union[str, Sequence[Any], None],
option_string: str = None):
"""Parse Variables in string and add them into argparser.
Args:
parser (ArgumentParser): Argument parser.
name... | (self, parser: argparse.ArgumentParser, namespace: argparse.Namespace, values: Union[str, Sequence[Any], NoneType], option_string: Optional[str] = None) | [
-0.033442966639995575,
0.026840895414352417,
0.008177350275218487,
-0.07377014309167862,
0.03199464827775955,
0.036076270043849945,
-0.005440595094114542,
0.06207074597477913,
0.017530282959342003,
-0.025524243712425232,
-0.041342880576848984,
0.023191887885332108,
-0.02977515012025833,
0.... |
730,073 | mmengine.config.config | _parse_int_float_bool | parse int/float/bool value in the string. | @staticmethod
def _parse_int_float_bool(val: str) -> Union[int, float, bool, Any]:
"""parse int/float/bool value in the string."""
try:
return int(val)
except ValueError:
pass
try:
return float(val)
except ValueError:
pass
if val.lower() in ['true', 'false']:
... | (val: str) -> Union[int, float, bool, Any] | [
0.011139538139104843,
-0.031734101474285126,
0.028419408947229385,
-0.028745442628860474,
-0.009944075718522072,
0.02941562794148922,
0.014010460115969181,
0.03606312349438667,
-0.037494055926799774,
-0.10382412374019623,
0.0174972265958786,
0.033835217356681824,
-0.016510063782334328,
-0.... |
730,074 | mmengine.config.config | _parse_iterable | Parse iterable values in the string.
All elements inside '()' or '[]' are treated as iterable values.
Args:
val (str): Value string.
Returns:
list | tuple | Any: The expanded list or tuple from the string,
or single value if no iterable values are found.
... | @staticmethod
def _parse_iterable(val: str) -> Union[list, tuple, Any]:
"""Parse iterable values in the string.
All elements inside '()' or '[]' are treated as iterable values.
Args:
val (str): Value string.
Returns:
list | tuple | Any: The expanded list or tuple from the string,
... | (val: str) -> Union[list, tuple, Any] | [
0.006384773179888725,
-0.0053041973151266575,
-0.04195990040898323,
-0.06564375758171082,
-0.011091940104961395,
0.023664120584726334,
-0.009942285716533661,
0.03380870819091797,
0.034223172813653946,
-0.08439347892999649,
0.02024969831109047,
0.09157758206129074,
0.0036981357261538506,
0.... |
730,076 | mmengine.fileio.file_client | FileClient | A general file client to access files in different backends.
The client loads a file or text in a specified backend from its path
and returns it as a binary or text file. There are two ways to choose a
backend, the name of backend and the prefix of path. Although both of them
can be used to choose a st... | class FileClient:
"""A general file client to access files in different backends.
The client loads a file or text in a specified backend from its path
and returns it as a binary or text file. There are two ways to choose a
backend, the name of backend and the prefix of path. Although both of them
c... | (backend=None, prefix=None, **kwargs) | [
0.02247105911374092,
-0.08764313906431198,
-0.06615255773067474,
0.026553068310022354,
-0.00568279717117548,
-0.0030039786361157894,
-0.02623291127383709,
0.0736362412571907,
0.040780071169137955,
-0.05630771443247795,
0.040660012513399124,
0.00665327487513423,
-0.03771856427192688,
0.0028... |
730,077 | mmengine.fileio.file_client | __new__ | null | def __new__(cls, backend=None, prefix=None, **kwargs):
print_log(
'"FileClient" will be deprecated in future. Please use io '
'functions in '
'https://mmengine.readthedocs.io/en/latest/api/fileio.html#file-io', # noqa: E501
logger='current',
level=logging.WARNING)
if bac... | (cls, backend=None, prefix=None, **kwargs) | [
0.006061569321900606,
-0.060421206057071686,
-0.01834678277373314,
-0.006445916369557381,
-0.028691736981272697,
-0.016003655269742012,
-0.027598895132541656,
0.08631601184606552,
0.011576717719435692,
-0.04208368435502052,
0.03230367228388786,
0.0403425469994545,
-0.057161200791597366,
0.... |
730,078 | mmengine.fileio.file_client | exists | Check whether a file path exists.
Args:
filepath (str or Path): Path to be checked whether exists.
Returns:
bool: Return ``True`` if ``filepath`` exists, ``False`` otherwise.
| def exists(self, filepath: Union[str, Path]) -> bool:
"""Check whether a file path exists.
Args:
filepath (str or Path): Path to be checked whether exists.
Returns:
bool: Return ``True`` if ``filepath`` exists, ``False`` otherwise.
"""
return self.client.exists(filepath)
| (self, filepath: Union[str, pathlib.Path]) -> bool | [
0.01352941244840622,
-0.07597080618143082,
-0.038838207721710205,
0.011157545261085033,
0.03681279346346855,
0.0028004904743283987,
0.038838207721710205,
0.007826271466910839,
-0.0372391976416111,
0.0018821695121005177,
0.023843035101890564,
0.03656405955553055,
0.03905140981078148,
-0.083... |
730,079 | mmengine.fileio.file_client | get | Read data from a given ``filepath`` with 'rb' mode.
Note:
There are two types of return values for ``get``, one is ``bytes``
and the other is ``memoryview``. The advantage of using memoryview
is that you can avoid copying, and if you want to convert it to
``bytes... | def get(self, filepath: Union[str, Path]) -> Union[bytes, memoryview]:
"""Read data from a given ``filepath`` with 'rb' mode.
Note:
There are two types of return values for ``get``, one is ``bytes``
and the other is ``memoryview``. The advantage of using memoryview
is that you can avoid ... | (self, filepath: Union[str, pathlib.Path]) -> Union[bytes, memoryview] | [
0.04157338663935661,
-0.08903515338897705,
-0.043453410267829895,
0.00949767418205738,
0.008930118754506111,
-0.0059593250043690205,
0.010836748406291008,
0.014304152689874172,
0.029548319056630135,
-0.058990221470594406,
0.04107677564024925,
0.04714251682162285,
-0.04909348487854004,
0.00... |
730,080 | mmengine.fileio.file_client | get_local_path | Download data from ``filepath`` and write the data to local path.
``get_local_path`` is decorated by :meth:`contxtlib.contextmanager`. It
can be called with ``with`` statement, and when exists from the
``with`` statement, the temporary path will be released.
Note:
If the ``... | @classmethod
def register_backend(cls, name, backend=None, force=False, prefixes=None):
"""Register a backend to FileClient.
This method can be used as a normal class method or a decorator.
.. code-block:: python
class NewBackend(BaseStorageBackend):
def get(self, filepath):
... | (self, filepath: Union[str, pathlib.Path]) -> Generator[Union[str, pathlib.Path], NoneType, NoneType] | [
0.006186691578477621,
-0.09533149749040604,
-0.031699515879154205,
0.04540789872407913,
0.0030575068667531013,
0.006222530733793974,
-0.048490043729543686,
0.06468923389911652,
0.044332731515169144,
-0.06712627410888672,
0.06716211885213852,
-0.02177213691174984,
-0.010778551921248436,
-0.... |
730,081 | mmengine.fileio.file_client | get_text | Read data from a given ``filepath`` with 'r' mode.
Args:
filepath (str or Path): Path to read data.
encoding (str): The encoding format used to open the ``filepath``.
Defaults to 'utf-8'.
Returns:
str: Expected text reading from ``filepath``.
... | def get_text(self, filepath: Union[str, Path], encoding='utf-8') -> str:
"""Read data from a given ``filepath`` with 'r' mode.
Args:
filepath (str or Path): Path to read data.
encoding (str): The encoding format used to open the ``filepath``.
Defaults to 'utf-8'.
Returns:
... | (self, filepath: Union[str, pathlib.Path], encoding='utf-8') -> str | [
-0.0068387133069336414,
-0.08107457309961319,
0.0027550244703888893,
0.06683268398046494,
0.04553931578993797,
-0.0008798058843240142,
-0.011567194946110249,
-0.03477105870842934,
0.11796454340219498,
-0.02916114218533039,
0.029456401243805885,
0.0016510607674717903,
-0.04602562636137009,
... |
730,082 | mmengine.fileio.file_client | isdir | Check whether a file path is a directory.
Args:
filepath (str or Path): Path to be checked whether it is a
directory.
Returns:
bool: Return ``True`` if ``filepath`` points to a directory,
``False`` otherwise.
| def isdir(self, filepath: Union[str, Path]) -> bool:
"""Check whether a file path is a directory.
Args:
filepath (str or Path): Path to be checked whether it is a
directory.
Returns:
bool: Return ``True`` if ``filepath`` points to a directory,
``False`` otherwise.
"""... | (self, filepath: Union[str, pathlib.Path]) -> bool | [
0.0018696582410484552,
0.021671827882528305,
-0.010493239387869835,
-0.019523167982697487,
0.053308989852666855,
0.008844698779284954,
0.04093567281961441,
-0.003906022757291794,
-0.06683073192834854,
0.006936836987733841,
0.012604853138327599,
0.011030404828488827,
-0.004281111992895603,
... |
730,083 | mmengine.fileio.file_client | isfile | Check whether a file path is a file.
Args:
filepath (str or Path): Path to be checked whether it is a file.
Returns:
bool: Return ``True`` if ``filepath`` points to a file, ``False``
otherwise.
| def isfile(self, filepath: Union[str, Path]) -> bool:
"""Check whether a file path is a file.
Args:
filepath (str or Path): Path to be checked whether it is a file.
Returns:
bool: Return ``True`` if ``filepath`` points to a file, ``False``
otherwise.
"""
return self.client.is... | (self, filepath: Union[str, pathlib.Path]) -> bool | [
0.02418699860572815,
-0.06604554504156113,
-0.01475722435861826,
0.00910956971347332,
0.02409418486058712,
-0.029941387474536896,
0.07677469402551651,
0.0016903518699109554,
-0.03714365512132645,
-0.013615627773106098,
0.039649598300457,
0.02671150490641594,
0.004271706100553274,
-0.046777... |
730,084 | mmengine.fileio.file_client | join_path | Concatenate all file paths.
Join one or more filepath components intelligently. The return value
is the concatenation of filepath and any members of \*filepaths.
Args:
filepath (str or Path): Path to be concatenated.
Returns:
str: The result of concatenation.
... | def join_path(self, filepath: Union[str, Path],
*filepaths: Union[str, Path]) -> str:
r"""Concatenate all file paths.
Join one or more filepath components intelligently. The return value
is the concatenation of filepath and any members of \*filepaths.
Args:
filepath (str or Path): ... | (self, filepath: Union[str, pathlib.Path], *filepaths: Union[str, pathlib.Path]) -> str | [
-0.08243682235479355,
-0.03740321472287178,
-0.03579869121313095,
0.08008352667093277,
-0.032090459018945694,
-0.048706185072660446,
-0.005548975430428982,
0.01415545865893364,
0.005785196553915739,
-0.005339495837688446,
0.01870160736143589,
-0.001541010569781065,
-0.03299969062209129,
0.... |
730,085 | mmengine.fileio.file_client | list_dir_or_file | Scan a directory to find the interested directories or files in
arbitrary order.
Note:
:meth:`list_dir_or_file` returns the path relative to ``dir_path``.
Args:
dir_path (str | Path): Path of the directory.
list_dir (bool): List the directories. Defaults to ... | def list_dir_or_file(self,
dir_path: Union[str, Path],
list_dir: bool = True,
list_file: bool = True,
suffix: Optional[Union[str, Tuple[str]]] = None,
recursive: bool = False) -> Iterator[str]:
"""Scan a directo... | (self, dir_path: Union[str, pathlib.Path], list_dir: bool = True, list_file: bool = True, suffix: Union[str, Tuple[str], NoneType] = None, recursive: bool = False) -> Iterator[str] | [
0.022471023723483086,
-0.03684138134121895,
-0.03182932734489441,
0.01849466934800148,
0.056297775357961655,
0.04183494299650192,
0.014166916720569134,
-0.030960077419877052,
0.021490806713700294,
-0.05770336836576462,
0.04582979157567024,
0.031015561893582344,
-0.024338984861969948,
-0.00... |
730,086 | mmengine.fileio.file_client | parse_uri_prefix | Parse the prefix of a uri.
Args:
uri (str | Path): Uri to be parsed that contains the file prefix.
Examples:
>>> FileClient.parse_uri_prefix('s3://path/of/your/file')
's3'
Returns:
str | None: Return the prefix of uri if the uri contains '://' e... | @staticmethod
def parse_uri_prefix(uri: Union[str, Path]) -> Optional[str]:
"""Parse the prefix of a uri.
Args:
uri (str | Path): Uri to be parsed that contains the file prefix.
Examples:
>>> FileClient.parse_uri_prefix('s3://path/of/your/file')
's3'
Returns:
str | None: ... | (uri: Union[str, pathlib.Path]) -> Optional[str] | [
-0.057327352464199066,
0.0034588645212352276,
-0.024602387100458145,
0.00722909439355135,
-0.003874018555507064,
0.008357230573892593,
0.046569447964429855,
0.06342831254005432,
0.0997091606259346,
-0.06382541358470917,
0.01879023015499115,
0.0006086293142288923,
-0.023663777858018875,
-0.... |
730,087 | mmengine.fileio.file_client | put | Write data to a given ``filepath`` with 'wb' mode.
Note:
``put`` should create a directory if the directory of ``filepath``
does not exist.
Args:
obj (bytes): Data to be written.
filepath (str or Path): Path to write data.
| def put(self, obj: bytes, filepath: Union[str, Path]) -> None:
"""Write data to a given ``filepath`` with 'wb' mode.
Note:
``put`` should create a directory if the directory of ``filepath``
does not exist.
Args:
obj (bytes): Data to be written.
filepath (str or Path): Path to... | (self, obj: bytes, filepath: Union[str, pathlib.Path]) -> NoneType | [
-0.022622648626565933,
-0.0011110100895166397,
-0.1018618568778038,
0.017827536910772324,
0.03077433817088604,
-0.08713401854038239,
-0.008922331966459751,
0.09699824452400208,
-0.06836458295583725,
-0.03565507382154465,
0.003883183700963855,
-0.017707660794258118,
-0.010326613672077656,
-... |
730,088 | mmengine.fileio.file_client | put_text | Write data to a given ``filepath`` with 'w' mode.
Note:
``put_text`` should create a directory if the directory of
``filepath`` does not exist.
Args:
obj (str): Data to be written.
filepath (str or Path): Path to write data.
encoding (str, op... | def put_text(self, obj: str, filepath: Union[str, Path]) -> None:
"""Write data to a given ``filepath`` with 'w' mode.
Note:
``put_text`` should create a directory if the directory of
``filepath`` does not exist.
Args:
obj (str): Data to be written.
filepath (str or Path): Pa... | (self, obj: str, filepath: Union[str, pathlib.Path]) -> NoneType | [
-0.025979887694120407,
-0.02689562737941742,
-0.06525496393442154,
0.01624590903520584,
0.05575840175151825,
-0.0656958818435669,
0.003171174321323633,
0.06735777854919434,
-0.008220463991165161,
0.0064864931628108025,
-0.004582940600812435,
-0.0406317301094532,
-0.0038028655108064413,
-0.... |
730,089 | mmengine.fileio.file_client | remove | Remove a file.
Args:
filepath (str, Path): Path to be removed.
| def remove(self, filepath: Union[str, Path]) -> None:
"""Remove a file.
Args:
filepath (str, Path): Path to be removed.
"""
self.client.remove(filepath)
| (self, filepath: Union[str, pathlib.Path]) -> NoneType | [
-0.008782381191849709,
0.007918823510408401,
-0.03150258585810661,
0.008726250380277634,
-0.00014289180398918688,
-0.03170983865857124,
-0.007111397571861744,
0.08753020316362381,
-0.014050083234906197,
0.012150256894528866,
0.003318220376968384,
0.0033333327155560255,
-0.02937823161482811,
... |
730,090 | mmengine.fileio.backends.http_backend | HTTPBackend | HTTP and HTTPS storage bachend. | class HTTPBackend(BaseStorageBackend):
"""HTTP and HTTPS storage bachend."""
def get(self, filepath: str) -> bytes:
"""Read bytes from a given ``filepath``.
Args:
filepath (str): Path to read data.
Returns:
bytes: Expected bytes object.
Examples:
... | () | [
0.02303463965654373,
-0.07485293596982956,
-0.09576544910669327,
0.009916083887219429,
0.03310506045818329,
0.009559182450175285,
-0.05332306772470474,
0.09121254086494446,
0.043252646923065186,
-0.05247421935200691,
0.07134179025888443,
0.0141989067196846,
-0.023343311622738838,
0.0137455... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.