body
stringlengths
26
98.2k
body_hash
int64
-9,222,864,604,528,158,000
9,221,803,474B
docstring
stringlengths
1
16.8k
path
stringlengths
5
230
name
stringlengths
1
96
repository_name
stringlengths
7
89
lang
stringclasses
1 value
body_without_docstring
stringlengths
20
98.2k
def validate_key(self, activation_key): '\n Verify that the activation key is valid and within the\n permitted activation time window, returning the username if\n valid or ``None`` if not.\n\n ' try: username = signing.loads(activation_key, salt=self.key_salt, max_age=(conf.g...
-5,516,472,830,826,670,000
Verify that the activation key is valid and within the permitted activation time window, returning the username if valid or ``None`` if not.
polyaxon/api/users/views.py
validate_key
AntoineToubhans/polyaxon
python
def validate_key(self, activation_key): '\n Verify that the activation key is valid and within the\n permitted activation time window, returning the username if\n valid or ``None`` if not.\n\n ' try: username = signing.loads(activation_key, salt=self.key_salt, max_age=(conf.g...
def get_user(self, username): "\n Given the verified username, look up and return the\n corresponding user account if it exists, or ``None`` if it\n doesn't.\n\n " User = get_user_model() try: user = User.objects.get(**{User.USERNAME_FIELD: username, 'is_active': False}) ...
-3,394,210,588,801,529,300
Given the verified username, look up and return the corresponding user account if it exists, or ``None`` if it doesn't.
polyaxon/api/users/views.py
get_user
AntoineToubhans/polyaxon
python
def get_user(self, username): "\n Given the verified username, look up and return the\n corresponding user account if it exists, or ``None`` if it\n doesn't.\n\n " User = get_user_model() try: user = User.objects.get(**{User.USERNAME_FIELD: username, 'is_active': False}) ...
def get(self, request, *args, **kwargs): 'The base activation logic; subclasses should leave this method\n alone and implement activate(), which is called from this method.\n ' activated_user = self.activate(*args, **kwargs) if activated_user: users_signals.user_activated.send(sender=s...
-4,971,766,240,887,481,000
The base activation logic; subclasses should leave this method alone and implement activate(), which is called from this method.
polyaxon/api/users/views.py
get
AntoineToubhans/polyaxon
python
def get(self, request, *args, **kwargs): 'The base activation logic; subclasses should leave this method\n alone and implement activate(), which is called from this method.\n ' activated_user = self.activate(*args, **kwargs) if activated_user: users_signals.user_activated.send(sender=s...
def __init__(self, Lower=(- 1.0), Upper=1.0): 'Initialize of Cosine mixture benchmark.\n\n\t\tArgs:\n\t\t\tLower (Optional[float]): Lower bound of problem.\n\t\t\tUpper (Optional[float]): Upper bound of problem.\n\n\t\tSee Also:\n\t\t\t:func:`NiaPy.benchmarks.Benchmark.__init__`\n\t\t' Benchmark.__init__(self, ...
-8,085,448,226,588,698,000
Initialize of Cosine mixture benchmark. Args: Lower (Optional[float]): Lower bound of problem. Upper (Optional[float]): Upper bound of problem. See Also: :func:`NiaPy.benchmarks.Benchmark.__init__`
NiaPy/benchmarks/cosinemixture.py
__init__
lucijabrezocnik/NiaPy
python
def __init__(self, Lower=(- 1.0), Upper=1.0): 'Initialize of Cosine mixture benchmark.\n\n\t\tArgs:\n\t\t\tLower (Optional[float]): Lower bound of problem.\n\t\t\tUpper (Optional[float]): Upper bound of problem.\n\n\t\tSee Also:\n\t\t\t:func:`NiaPy.benchmarks.Benchmark.__init__`\n\t\t' Benchmark.__init__(self, ...
@staticmethod def latex_code(): 'Return the latex code of the problem.\n\n\t\tReturns:\n\t\t\tstr: Latex code\n\t\t' return '$f(\\textbf{x}) = - 0.1 \\sum_{i = 1}^D \\cos (5 \\pi x_i) - \\sum_{i = 1}^D x_i^2$'
1,873,629,386,612,206,300
Return the latex code of the problem. Returns: str: Latex code
NiaPy/benchmarks/cosinemixture.py
latex_code
lucijabrezocnik/NiaPy
python
@staticmethod def latex_code(): 'Return the latex code of the problem.\n\n\t\tReturns:\n\t\t\tstr: Latex code\n\t\t' return '$f(\\textbf{x}) = - 0.1 \\sum_{i = 1}^D \\cos (5 \\pi x_i) - \\sum_{i = 1}^D x_i^2$'
def function(self): 'Return benchmark evaluation function.\n\n\t\tReturns:\n\t\t\tCallable[[int, Union[int, float, List[int, float], numpy.ndarray]], float]: Fitness function\n\t\t' def f(D, X): 'Fitness function.\n\n\t\t\tArgs:\n\t\t\t\tD (int): Dimensionality of the problem\n\t\t\t\tsol (Union[int, f...
6,318,619,589,099,463,000
Return benchmark evaluation function. Returns: Callable[[int, Union[int, float, List[int, float], numpy.ndarray]], float]: Fitness function
NiaPy/benchmarks/cosinemixture.py
function
lucijabrezocnik/NiaPy
python
def function(self): 'Return benchmark evaluation function.\n\n\t\tReturns:\n\t\t\tCallable[[int, Union[int, float, List[int, float], numpy.ndarray]], float]: Fitness function\n\t\t' def f(D, X): 'Fitness function.\n\n\t\t\tArgs:\n\t\t\t\tD (int): Dimensionality of the problem\n\t\t\t\tsol (Union[int, f...
def f(D, X): 'Fitness function.\n\n\t\t\tArgs:\n\t\t\t\tD (int): Dimensionality of the problem\n\t\t\t\tsol (Union[int, float, List[int, float], numpy.ndarray]): Solution to check.\n\n\t\t\tReturns:\n\t\t\t\tfloat: Fitness value for the solution.\n\t\t\t' (v1, v2) = (0.0, 0.0) for i in range(D): (v1...
5,649,132,174,974,258,000
Fitness function. Args: D (int): Dimensionality of the problem sol (Union[int, float, List[int, float], numpy.ndarray]): Solution to check. Returns: float: Fitness value for the solution.
NiaPy/benchmarks/cosinemixture.py
f
lucijabrezocnik/NiaPy
python
def f(D, X): 'Fitness function.\n\n\t\t\tArgs:\n\t\t\t\tD (int): Dimensionality of the problem\n\t\t\t\tsol (Union[int, float, List[int, float], numpy.ndarray]): Solution to check.\n\n\t\t\tReturns:\n\t\t\t\tfloat: Fitness value for the solution.\n\t\t\t' (v1, v2) = (0.0, 0.0) for i in range(D): (v1...
def load_pv_systems(metadata_filename: str=METADATA_FILENAME, stats_filename: str=PV_STATS_FILENAME, timeseries_filename: str=TIMESERIES_FILENAME) -> xr.Dataset: 'Load metadata about PV systems' pv_metadata = pd.read_csv(metadata_filename, index_col='system_id') pv_stats = pd.read_csv(stats_filename, index_...
3,270,417,478,702,474,000
Load metadata about PV systems
predict_pv_yield_nwp/pv.py
load_pv_systems
openclimatefix/predict_pv_yield_nwp
python
def load_pv_systems(metadata_filename: str=METADATA_FILENAME, stats_filename: str=PV_STATS_FILENAME, timeseries_filename: str=TIMESERIES_FILENAME) -> xr.Dataset: pv_metadata = pd.read_csv(metadata_filename, index_col='system_id') pv_stats = pd.read_csv(stats_filename, index_col='system_id', parse_dates=['a...
def _get_system_ids_dataframe_from_timeseries(timeseries_filename: str=TIMESERIES_FILENAME) -> pd.DataFrame: 'Get all the PV system IDs from the timeseries file' ds = xr.open_dataset(timeseries_filename) system_ids = [int(x) for x in list(ds.data_vars.keys())] df = pd.DataFrame({'system_id': system_ids}...
-8,597,639,138,764,902,000
Get all the PV system IDs from the timeseries file
predict_pv_yield_nwp/pv.py
_get_system_ids_dataframe_from_timeseries
openclimatefix/predict_pv_yield_nwp
python
def _get_system_ids_dataframe_from_timeseries(timeseries_filename: str=TIMESERIES_FILENAME) -> pd.DataFrame: ds = xr.open_dataset(timeseries_filename) system_ids = [int(x) for x in list(ds.data_vars.keys())] df = pd.DataFrame({'system_id': system_ids}) df = df.set_index('system_id') return df
def _transform_pv_systems(pv_systems: xr.Dataset) -> xr.Dataset: 'Transform the system locations into the same coordinate system used by UKV' (system_latitudes, system_longitudes) = (pv_systems['latitude'].values, pv_systems['longitude'].values) wgs84 = ccrs.Geodetic() ukv_crs = ccrs.OSGB(approx=False) ...
3,621,632,862,040,749,000
Transform the system locations into the same coordinate system used by UKV
predict_pv_yield_nwp/pv.py
_transform_pv_systems
openclimatefix/predict_pv_yield_nwp
python
def _transform_pv_systems(pv_systems: xr.Dataset) -> xr.Dataset: (system_latitudes, system_longitudes) = (pv_systems['latitude'].values, pv_systems['longitude'].values) wgs84 = ccrs.Geodetic() ukv_crs = ccrs.OSGB(approx=False) locs = ukv_crs.transform_points(src_crs=wgs84, x=np.asanyarray(system_lo...
def _transform_pv_systems_pyproj(pv_systems: xr.Dataset) -> xr.Dataset: 'Transform the system locations into the same coordinate system used by UKV, using pyproj' import pyproj (system_latitudes, system_longitudes) = (pv_systems['latitude'].values, pv_systems['longitude'].values) transformer = pyproj.Tr...
1,727,714,883,699,049,200
Transform the system locations into the same coordinate system used by UKV, using pyproj
predict_pv_yield_nwp/pv.py
_transform_pv_systems_pyproj
openclimatefix/predict_pv_yield_nwp
python
def _transform_pv_systems_pyproj(pv_systems: xr.Dataset) -> xr.Dataset: import pyproj (system_latitudes, system_longitudes) = (pv_systems['latitude'].values, pv_systems['longitude'].values) transformer = pyproj.Transformer.from_crs('epsg:4326', 'epsg:27700', always_xy=True) locs = transformer.trans...
def load_pv_timeseries(start_date: str, end_date: str, metadata_filename: str=METADATA_FILENAME, stats_filename: str=PV_STATS_FILENAME, timeseries_filename: str=TIMESERIES_FILENAME) -> xr.Dataset: 'Load the PV timeseries as an xarray dataset, restricted to a given time range, and including location metadata.' d...
3,110,037,801,621,847,600
Load the PV timeseries as an xarray dataset, restricted to a given time range, and including location metadata.
predict_pv_yield_nwp/pv.py
load_pv_timeseries
openclimatefix/predict_pv_yield_nwp
python
def load_pv_timeseries(start_date: str, end_date: str, metadata_filename: str=METADATA_FILENAME, stats_filename: str=PV_STATS_FILENAME, timeseries_filename: str=TIMESERIES_FILENAME) -> xr.Dataset: ds = xr.open_dataset(timeseries_filename) subset = ds.sel(datetime=slice(start_date, end_date)) df = subse...
def _install_system_packages(session): "\n Because some python packages are provided by the distribution and cannot\n be pip installed, and because we don't want the whole system python packages\n on our virtualenvs, we copy the required system python packages into\n the virtualenv\n " version_in...
6,968,002,749,129,078,000
Because some python packages are provided by the distribution and cannot be pip installed, and because we don't want the whole system python packages on our virtualenvs, we copy the required system python packages into the virtualenv
noxfile.py
_install_system_packages
99-lives/salt
python
def _install_system_packages(session): "\n Because some python packages are provided by the distribution and cannot\n be pip installed, and because we don't want the whole system python packages\n on our virtualenvs, we copy the required system python packages into\n the virtualenv\n " version_in...
@nox.session(python=_PYTHON_VERSIONS, name='runtests-parametrized') @nox.parametrize('coverage', [False, True]) @nox.parametrize('transport', ['zeromq', 'tcp']) @nox.parametrize('crypto', [None, 'm2crypto', 'pycryptodome']) def runtests_parametrized(session, coverage, transport, crypto): '\n DO NOT CALL THIS NOX...
-9,043,520,752,504,276,000
DO NOT CALL THIS NOX SESSION DIRECTLY
noxfile.py
runtests_parametrized
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='runtests-parametrized') @nox.parametrize('coverage', [False, True]) @nox.parametrize('transport', ['zeromq', 'tcp']) @nox.parametrize('crypto', [None, 'm2crypto', 'pycryptodome']) def runtests_parametrized(session, coverage, transport, crypto): '\n \n ' _runtest...
@nox.session(python=_PYTHON_VERSIONS) @nox.parametrize('coverage', [False, True]) def runtests(session, coverage): '\n runtests.py session with zeromq transport and default crypto\n ' _runtests(session)
845,727,871,123,702,300
runtests.py session with zeromq transport and default crypto
noxfile.py
runtests
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS) @nox.parametrize('coverage', [False, True]) def runtests(session, coverage): '\n \n ' _runtests(session)
@nox.session(python=_PYTHON_VERSIONS, name='runtests-tcp') @nox.parametrize('coverage', [False, True]) def runtests_tcp(session, coverage): '\n runtests.py session with TCP transport and default crypto\n ' _runtests(session)
-6,682,511,237,389,340,000
runtests.py session with TCP transport and default crypto
noxfile.py
runtests_tcp
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='runtests-tcp') @nox.parametrize('coverage', [False, True]) def runtests_tcp(session, coverage): '\n \n ' _runtests(session)
@nox.session(python=_PYTHON_VERSIONS, name='runtests-zeromq') @nox.parametrize('coverage', [False, True]) def runtests_zeromq(session, coverage): '\n runtests.py session with zeromq transport and default crypto\n ' _runtests(session)
-138,091,728,447,024,620
runtests.py session with zeromq transport and default crypto
noxfile.py
runtests_zeromq
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='runtests-zeromq') @nox.parametrize('coverage', [False, True]) def runtests_zeromq(session, coverage): '\n \n ' _runtests(session)
@nox.session(python=_PYTHON_VERSIONS, name='runtests-m2crypto') @nox.parametrize('coverage', [False, True]) def runtests_m2crypto(session, coverage): '\n runtests.py session with zeromq transport and m2crypto\n ' _runtests(session)
-654,897,974,616,398,700
runtests.py session with zeromq transport and m2crypto
noxfile.py
runtests_m2crypto
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='runtests-m2crypto') @nox.parametrize('coverage', [False, True]) def runtests_m2crypto(session, coverage): '\n \n ' _runtests(session)
@nox.session(python=_PYTHON_VERSIONS, name='runtests-tcp-m2crypto') @nox.parametrize('coverage', [False, True]) def runtests_tcp_m2crypto(session, coverage): '\n runtests.py session with TCP transport and m2crypto\n ' _runtests(session)
6,956,894,239,134,347,000
runtests.py session with TCP transport and m2crypto
noxfile.py
runtests_tcp_m2crypto
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='runtests-tcp-m2crypto') @nox.parametrize('coverage', [False, True]) def runtests_tcp_m2crypto(session, coverage): '\n \n ' _runtests(session)
@nox.session(python=_PYTHON_VERSIONS, name='runtests-zeromq-m2crypto') @nox.parametrize('coverage', [False, True]) def runtests_zeromq_m2crypto(session, coverage): '\n runtests.py session with zeromq transport and m2crypto\n ' _runtests(session)
6,990,492,541,497,945,000
runtests.py session with zeromq transport and m2crypto
noxfile.py
runtests_zeromq_m2crypto
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='runtests-zeromq-m2crypto') @nox.parametrize('coverage', [False, True]) def runtests_zeromq_m2crypto(session, coverage): '\n \n ' _runtests(session)
@nox.session(python=_PYTHON_VERSIONS, name='runtests-pycryptodome') @nox.parametrize('coverage', [False, True]) def runtests_pycryptodome(session, coverage): '\n runtests.py session with zeromq transport and pycryptodome\n ' _runtests(session)
-6,725,514,069,020,401,000
runtests.py session with zeromq transport and pycryptodome
noxfile.py
runtests_pycryptodome
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='runtests-pycryptodome') @nox.parametrize('coverage', [False, True]) def runtests_pycryptodome(session, coverage): '\n \n ' _runtests(session)
@nox.session(python=_PYTHON_VERSIONS, name='runtests-tcp-pycryptodome') @nox.parametrize('coverage', [False, True]) def runtests_tcp_pycryptodome(session, coverage): '\n runtests.py session with TCP transport and pycryptodome\n ' _runtests(session)
3,697,328,192,543,421,000
runtests.py session with TCP transport and pycryptodome
noxfile.py
runtests_tcp_pycryptodome
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='runtests-tcp-pycryptodome') @nox.parametrize('coverage', [False, True]) def runtests_tcp_pycryptodome(session, coverage): '\n \n ' _runtests(session)
@nox.session(python=_PYTHON_VERSIONS, name='runtests-zeromq-pycryptodome') @nox.parametrize('coverage', [False, True]) def runtests_zeromq_pycryptodome(session, coverage): '\n runtests.py session with zeromq transport and pycryptodome\n ' _runtests(session)
-7,133,153,785,818,747,000
runtests.py session with zeromq transport and pycryptodome
noxfile.py
runtests_zeromq_pycryptodome
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='runtests-zeromq-pycryptodome') @nox.parametrize('coverage', [False, True]) def runtests_zeromq_pycryptodome(session, coverage): '\n \n ' _runtests(session)
@nox.session(python=_PYTHON_VERSIONS, name='runtests-cloud') @nox.parametrize('coverage', [False, True]) def runtests_cloud(session, coverage): '\n runtests.py cloud tests session\n ' _runtests(session)
2,808,524,427,608,219,600
runtests.py cloud tests session
noxfile.py
runtests_cloud
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='runtests-cloud') @nox.parametrize('coverage', [False, True]) def runtests_cloud(session, coverage): '\n \n ' _runtests(session)
@nox.session(python=_PYTHON_VERSIONS, name='runtests-tornado') @nox.parametrize('coverage', [False, True]) def runtests_tornado(session, coverage): '\n runtests.py tornado tests session\n ' _runtests(session)
-5,665,973,324,566,924,000
runtests.py tornado tests session
noxfile.py
runtests_tornado
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='runtests-tornado') @nox.parametrize('coverage', [False, True]) def runtests_tornado(session, coverage): '\n \n ' _runtests(session)
@nox.session(python=_PYTHON_VERSIONS, name='pytest-parametrized') @nox.parametrize('coverage', [False, True]) @nox.parametrize('transport', ['zeromq', 'tcp']) @nox.parametrize('crypto', [None, 'm2crypto', 'pycryptodome']) def pytest_parametrized(session, coverage, transport, crypto): '\n DO NOT CALL THIS NOX SES...
-4,137,572,141,235,951,600
DO NOT CALL THIS NOX SESSION DIRECTLY
noxfile.py
pytest_parametrized
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='pytest-parametrized') @nox.parametrize('coverage', [False, True]) @nox.parametrize('transport', ['zeromq', 'tcp']) @nox.parametrize('crypto', [None, 'm2crypto', 'pycryptodome']) def pytest_parametrized(session, coverage, transport, crypto): '\n \n ' _install_req...
@nox.session(python=_PYTHON_VERSIONS) @nox.parametrize('coverage', [False, True]) def pytest(session, coverage): '\n pytest session with zeromq transport and default crypto\n ' session.notify(find_session_runner(session, 'pytest-parametrized-{}'.format(session.python), coverage=coverage, crypto=None, tran...
2,154,575,470,419,668,500
pytest session with zeromq transport and default crypto
noxfile.py
pytest
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS) @nox.parametrize('coverage', [False, True]) def pytest(session, coverage): '\n \n ' session.notify(find_session_runner(session, 'pytest-parametrized-{}'.format(session.python), coverage=coverage, crypto=None, transport='zeromq'))
@nox.session(python=_PYTHON_VERSIONS, name='pytest-tcp') @nox.parametrize('coverage', [False, True]) def pytest_tcp(session, coverage): '\n pytest session with TCP transport and default crypto\n ' session.notify(find_session_runner(session, 'pytest-parametrized-{}'.format(session.python), coverage=coverag...
3,040,151,632,284,312,600
pytest session with TCP transport and default crypto
noxfile.py
pytest_tcp
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='pytest-tcp') @nox.parametrize('coverage', [False, True]) def pytest_tcp(session, coverage): '\n \n ' session.notify(find_session_runner(session, 'pytest-parametrized-{}'.format(session.python), coverage=coverage, crypto=None, transport='tcp'))
@nox.session(python=_PYTHON_VERSIONS, name='pytest-zeromq') @nox.parametrize('coverage', [False, True]) def pytest_zeromq(session, coverage): '\n pytest session with zeromq transport and default crypto\n ' session.notify(find_session_runner(session, 'pytest-parametrized-{}'.format(session.python), coverag...
-8,740,272,814,266,476,000
pytest session with zeromq transport and default crypto
noxfile.py
pytest_zeromq
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='pytest-zeromq') @nox.parametrize('coverage', [False, True]) def pytest_zeromq(session, coverage): '\n \n ' session.notify(find_session_runner(session, 'pytest-parametrized-{}'.format(session.python), coverage=coverage, crypto=None, transport='zeromq'))
@nox.session(python=_PYTHON_VERSIONS, name='pytest-m2crypto') @nox.parametrize('coverage', [False, True]) def pytest_m2crypto(session, coverage): '\n pytest session with zeromq transport and m2crypto\n ' session.notify(find_session_runner(session, 'pytest-parametrized-{}'.format(session.python), coverage=...
8,899,858,550,189,629,000
pytest session with zeromq transport and m2crypto
noxfile.py
pytest_m2crypto
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='pytest-m2crypto') @nox.parametrize('coverage', [False, True]) def pytest_m2crypto(session, coverage): '\n \n ' session.notify(find_session_runner(session, 'pytest-parametrized-{}'.format(session.python), coverage=coverage, crypto='m2crypto', transport='zeromq'))
@nox.session(python=_PYTHON_VERSIONS, name='pytest-tcp-m2crypto') @nox.parametrize('coverage', [False, True]) def pytest_tcp_m2crypto(session, coverage): '\n pytest session with TCP transport and m2crypto\n ' session.notify(find_session_runner(session, 'pytest-parametrized-{}'.format(session.python), cove...
-5,684,078,692,834,469,000
pytest session with TCP transport and m2crypto
noxfile.py
pytest_tcp_m2crypto
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='pytest-tcp-m2crypto') @nox.parametrize('coverage', [False, True]) def pytest_tcp_m2crypto(session, coverage): '\n \n ' session.notify(find_session_runner(session, 'pytest-parametrized-{}'.format(session.python), coverage=coverage, crypto='m2crypto', transport='t...
@nox.session(python=_PYTHON_VERSIONS, name='pytest-zeromq-m2crypto') @nox.parametrize('coverage', [False, True]) def pytest_zeromq_m2crypto(session, coverage): '\n pytest session with zeromq transport and m2crypto\n ' session.notify(find_session_runner(session, 'pytest-parametrized-{}'.format(session.pyth...
5,171,910,656,219,338,000
pytest session with zeromq transport and m2crypto
noxfile.py
pytest_zeromq_m2crypto
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='pytest-zeromq-m2crypto') @nox.parametrize('coverage', [False, True]) def pytest_zeromq_m2crypto(session, coverage): '\n \n ' session.notify(find_session_runner(session, 'pytest-parametrized-{}'.format(session.python), coverage=coverage, crypto='m2crypto', transp...
@nox.session(python=_PYTHON_VERSIONS, name='pytest-pycryptodome') @nox.parametrize('coverage', [False, True]) def pytest_pycryptodome(session, coverage): '\n pytest session with zeromq transport and pycryptodome\n ' session.notify(find_session_runner(session, 'pytest-parametrized-{}'.format(session.python...
-2,269,956,677,477,665,000
pytest session with zeromq transport and pycryptodome
noxfile.py
pytest_pycryptodome
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='pytest-pycryptodome') @nox.parametrize('coverage', [False, True]) def pytest_pycryptodome(session, coverage): '\n \n ' session.notify(find_session_runner(session, 'pytest-parametrized-{}'.format(session.python), coverage=coverage, crypto='pycryptodome', transpor...
@nox.session(python=_PYTHON_VERSIONS, name='pytest-tcp-pycryptodome') @nox.parametrize('coverage', [False, True]) def pytest_tcp_pycryptodome(session, coverage): '\n pytest session with TCP transport and pycryptodome\n ' session.notify(find_session_runner(session, 'pytest-parametrized-{}'.format(session.p...
-1,304,393,818,394,454,800
pytest session with TCP transport and pycryptodome
noxfile.py
pytest_tcp_pycryptodome
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='pytest-tcp-pycryptodome') @nox.parametrize('coverage', [False, True]) def pytest_tcp_pycryptodome(session, coverage): '\n \n ' session.notify(find_session_runner(session, 'pytest-parametrized-{}'.format(session.python), coverage=coverage, crypto='pycryptodome', ...
@nox.session(python=_PYTHON_VERSIONS, name='pytest-zeromq-pycryptodome') @nox.parametrize('coverage', [False, True]) def pytest_zeromq_pycryptodome(session, coverage): '\n pytest session with zeromq transport and pycryptodome\n ' session.notify(find_session_runner(session, 'pytest-parametrized-{}'.format(...
1,148,822,481,792,937,200
pytest session with zeromq transport and pycryptodome
noxfile.py
pytest_zeromq_pycryptodome
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='pytest-zeromq-pycryptodome') @nox.parametrize('coverage', [False, True]) def pytest_zeromq_pycryptodome(session, coverage): '\n \n ' session.notify(find_session_runner(session, 'pytest-parametrized-{}'.format(session.python), coverage=coverage, crypto='pycryptod...
@nox.session(python=_PYTHON_VERSIONS, name='pytest-cloud') @nox.parametrize('coverage', [False, True]) def pytest_cloud(session, coverage): '\n pytest cloud tests session\n ' if _upgrade_pip_setuptools_and_wheel(session): _install_requirements(session, 'zeromq') requirements_file = os.path...
-3,397,264,623,128,888,300
pytest cloud tests session
noxfile.py
pytest_cloud
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='pytest-cloud') @nox.parametrize('coverage', [False, True]) def pytest_cloud(session, coverage): '\n \n ' if _upgrade_pip_setuptools_and_wheel(session): _install_requirements(session, 'zeromq') requirements_file = os.path.join('requirements', 'sta...
@nox.session(python=_PYTHON_VERSIONS, name='pytest-tornado') @nox.parametrize('coverage', [False, True]) def pytest_tornado(session, coverage): '\n pytest tornado tests session\n ' if _upgrade_pip_setuptools_and_wheel(session): _install_requirements(session, 'zeromq') session.install('--pr...
2,697,728,017,375,556,600
pytest tornado tests session
noxfile.py
pytest_tornado
99-lives/salt
python
@nox.session(python=_PYTHON_VERSIONS, name='pytest-tornado') @nox.parametrize('coverage', [False, True]) def pytest_tornado(session, coverage): '\n \n ' if _upgrade_pip_setuptools_and_wheel(session): _install_requirements(session, 'zeromq') session.install('--progress-bar=off', 'tornado==5...
@nox.session(python='3') def lint(session): "\n Run PyLint against Salt and it's test suite. Set PYLINT_REPORT to a path to capture output.\n " session.notify('lint-salt-{}'.format(session.python)) session.notify('lint-tests-{}'.format(session.python))
-1,453,134,618,559,754
Run PyLint against Salt and it's test suite. Set PYLINT_REPORT to a path to capture output.
noxfile.py
lint
99-lives/salt
python
@nox.session(python='3') def lint(session): "\n \n " session.notify('lint-salt-{}'.format(session.python)) session.notify('lint-tests-{}'.format(session.python))
@nox.session(python='3', name='lint-salt') def lint_salt(session): '\n Run PyLint against Salt. Set PYLINT_REPORT to a path to capture output.\n ' flags = ['--disable=I'] if session.posargs: paths = session.posargs else: paths = ['setup.py', 'noxfile.py', 'salt/', 'tasks/'] _li...
-544,538,526,701,332,700
Run PyLint against Salt. Set PYLINT_REPORT to a path to capture output.
noxfile.py
lint_salt
99-lives/salt
python
@nox.session(python='3', name='lint-salt') def lint_salt(session): '\n \n ' flags = ['--disable=I'] if session.posargs: paths = session.posargs else: paths = ['setup.py', 'noxfile.py', 'salt/', 'tasks/'] _lint(session, '.pylintrc', flags, paths)
@nox.session(python='3', name='lint-tests') def lint_tests(session): "\n Run PyLint against Salt and it's test suite. Set PYLINT_REPORT to a path to capture output.\n " flags = ['--disable=I'] if session.posargs: paths = session.posargs else: paths = ['tests/'] _lint(session, '...
-5,180,132,152,038,868,000
Run PyLint against Salt and it's test suite. Set PYLINT_REPORT to a path to capture output.
noxfile.py
lint_tests
99-lives/salt
python
@nox.session(python='3', name='lint-tests') def lint_tests(session): "\n \n " flags = ['--disable=I'] if session.posargs: paths = session.posargs else: paths = ['tests/'] _lint(session, '.pylintrc', flags, paths)
@nox.session(python=False, name='lint-salt-pre-commit') def lint_salt_pre_commit(session): '\n Run PyLint against Salt. Set PYLINT_REPORT to a path to capture output.\n ' flags = ['--disable=I'] if session.posargs: paths = session.posargs else: paths = ['setup.py', 'noxfile.py', 's...
3,978,327,733,629,347,000
Run PyLint against Salt. Set PYLINT_REPORT to a path to capture output.
noxfile.py
lint_salt_pre_commit
99-lives/salt
python
@nox.session(python=False, name='lint-salt-pre-commit') def lint_salt_pre_commit(session): '\n \n ' flags = ['--disable=I'] if session.posargs: paths = session.posargs else: paths = ['setup.py', 'noxfile.py', 'salt/'] _lint_pre_commit(session, '.pylintrc', flags, paths)
@nox.session(python=False, name='lint-tests-pre-commit') def lint_tests_pre_commit(session): "\n Run PyLint against Salt and it's test suite. Set PYLINT_REPORT to a path to capture output.\n " flags = ['--disable=I'] if session.posargs: paths = session.posargs else: paths = ['tests...
-3,709,611,297,284,424,700
Run PyLint against Salt and it's test suite. Set PYLINT_REPORT to a path to capture output.
noxfile.py
lint_tests_pre_commit
99-lives/salt
python
@nox.session(python=False, name='lint-tests-pre-commit') def lint_tests_pre_commit(session): "\n \n " flags = ['--disable=I'] if session.posargs: paths = session.posargs else: paths = ['tests/'] _lint_pre_commit(session, '.pylintrc', flags, paths)
@nox.session(python='3') @nox.parametrize('clean', [False, True]) @nox.parametrize('update', [False, True]) @nox.parametrize('compress', [False, True]) def docs(session, compress, update, clean): "\n Build Salt's Documentation\n " session.notify('docs-html-{}(compress={})'.format(session.python, compress)...
5,115,661,677,157,032,000
Build Salt's Documentation
noxfile.py
docs
99-lives/salt
python
@nox.session(python='3') @nox.parametrize('clean', [False, True]) @nox.parametrize('update', [False, True]) @nox.parametrize('compress', [False, True]) def docs(session, compress, update, clean): "\n \n " session.notify('docs-html-{}(compress={})'.format(session.python, compress)) session.notify(find_...
@nox.session(name='docs-html', python='3') @nox.parametrize('clean', [False, True]) @nox.parametrize('compress', [False, True]) def docs_html(session, compress, clean): "\n Build Salt's HTML Documentation\n " if _upgrade_pip_setuptools_and_wheel(session): requirements_file = os.path.join('requirem...
274,001,716,584,311,520
Build Salt's HTML Documentation
noxfile.py
docs_html
99-lives/salt
python
@nox.session(name='docs-html', python='3') @nox.parametrize('clean', [False, True]) @nox.parametrize('compress', [False, True]) def docs_html(session, compress, clean): "\n \n " if _upgrade_pip_setuptools_and_wheel(session): requirements_file = os.path.join('requirements', 'static', 'ci', _get_pyd...
@nox.session(name='docs-man', python='3') @nox.parametrize('clean', [False, True]) @nox.parametrize('update', [False, True]) @nox.parametrize('compress', [False, True]) def docs_man(session, compress, update, clean): "\n Build Salt's Manpages Documentation\n " if _upgrade_pip_setuptools_and_wheel(session)...
5,536,846,113,340,623,000
Build Salt's Manpages Documentation
noxfile.py
docs_man
99-lives/salt
python
@nox.session(name='docs-man', python='3') @nox.parametrize('clean', [False, True]) @nox.parametrize('update', [False, True]) @nox.parametrize('compress', [False, True]) def docs_man(session, compress, update, clean): "\n \n " if _upgrade_pip_setuptools_and_wheel(session): requirements_file = os.pa...
@nox.session(name='invoke', python='3') def invoke(session): '\n Run invoke tasks\n ' if _upgrade_pip_setuptools_and_wheel(session): requirements_file = os.path.join('requirements', 'static', 'ci', _get_pydir(session), 'invoke.txt') install_command = ['--progress-bar=off', '-r', requiremen...
9,109,923,732,392,836,000
Run invoke tasks
noxfile.py
invoke
99-lives/salt
python
@nox.session(name='invoke', python='3') def invoke(session): '\n \n ' if _upgrade_pip_setuptools_and_wheel(session): requirements_file = os.path.join('requirements', 'static', 'ci', _get_pydir(session), 'invoke.txt') install_command = ['--progress-bar=off', '-r', requirements_file] ...
@nox.session(name='changelog', python='3') @nox.parametrize('draft', [False, True]) def changelog(session, draft): "\n Generate salt's changelog\n " if _upgrade_pip_setuptools_and_wheel(session): requirements_file = os.path.join('requirements', 'static', 'ci', _get_pydir(session), 'changelog.txt')...
1,634,428,497,451,441,400
Generate salt's changelog
noxfile.py
changelog
99-lives/salt
python
@nox.session(name='changelog', python='3') @nox.parametrize('draft', [False, True]) def changelog(session, draft): "\n \n " if _upgrade_pip_setuptools_and_wheel(session): requirements_file = os.path.join('requirements', 'static', 'ci', _get_pydir(session), 'changelog.txt') install_command ...
def __init__(self): 'Constructs a ClassificationTask' super().__init__() self.base_loss = None self.datasets = {} self.meters = [] self.num_epochs = 1 self.test_phase_period = 1 self.train_phases_per_epoch = 0 self.test_only = False self.base_model = None self.optimizer = Non...
-502,440,207,293,914,560
Constructs a ClassificationTask
classy_vision/tasks/classification_task.py
__init__
hahaxun/ClassyVision
python
def __init__(self): super().__init__() self.base_loss = None self.datasets = {} self.meters = [] self.num_epochs = 1 self.test_phase_period = 1 self.train_phases_per_epoch = 0 self.test_only = False self.base_model = None self.optimizer = None self.optimizer_schedulers =...
def set_clip_grad_norm(self, clip_grad_norm: Optional[float]): 'Sets maximum gradient norm.\n\n None means gradient clipping is disabled. Defaults to None.' self.clip_grad_norm = clip_grad_norm if (clip_grad_norm is None): logging.info('Disabled gradient norm clipping.') else: log...
8,983,691,473,306,001,000
Sets maximum gradient norm. None means gradient clipping is disabled. Defaults to None.
classy_vision/tasks/classification_task.py
set_clip_grad_norm
hahaxun/ClassyVision
python
def set_clip_grad_norm(self, clip_grad_norm: Optional[float]): 'Sets maximum gradient norm.\n\n None means gradient clipping is disabled. Defaults to None.' self.clip_grad_norm = clip_grad_norm if (clip_grad_norm is None): logging.info('Disabled gradient norm clipping.') else: log...
def set_simulated_global_batchsize(self, simulated_global_batchsize: Optional[int]): 'Sets a simulated batch size by gradient accumulation.\n\n Gradient accumulation adds up gradients from multiple minibatches and\n steps the optimizer every N train_steps, where N is optimizer_period.\n When en...
561,482,616,653,683,140
Sets a simulated batch size by gradient accumulation. Gradient accumulation adds up gradients from multiple minibatches and steps the optimizer every N train_steps, where N is optimizer_period. When enabled, the very last train_steps might end up not updating the model, depending on the number of total steps. None mea...
classy_vision/tasks/classification_task.py
set_simulated_global_batchsize
hahaxun/ClassyVision
python
def set_simulated_global_batchsize(self, simulated_global_batchsize: Optional[int]): 'Sets a simulated batch size by gradient accumulation.\n\n Gradient accumulation adds up gradients from multiple minibatches and\n steps the optimizer every N train_steps, where N is optimizer_period.\n When en...
def set_checkpoint(self, checkpoint_path: str): 'Sets checkpoint on task.\n\n Args:\n checkpoint_path: The path to load the checkpoint from. Can be a file or a\n directory. See :func:`load_checkpoint` for more information.\n ' self.checkpoint_path = checkpoint_path return...
-709,116,024,819,137,700
Sets checkpoint on task. Args: checkpoint_path: The path to load the checkpoint from. Can be a file or a directory. See :func:`load_checkpoint` for more information.
classy_vision/tasks/classification_task.py
set_checkpoint
hahaxun/ClassyVision
python
def set_checkpoint(self, checkpoint_path: str): 'Sets checkpoint on task.\n\n Args:\n checkpoint_path: The path to load the checkpoint from. Can be a file or a\n directory. See :func:`load_checkpoint` for more information.\n ' self.checkpoint_path = checkpoint_path return...
def _set_checkpoint_dict(self, checkpoint_dict: Dict[(str, Any)]): 'Sets the checkpoint dict in the task. Only used for testing.\n\n Args:\n checkpoint_dict: A serializable dict representing current task state\n ' self.checkpoint_dict = checkpoint_dict return self
8,534,080,152,626,152,000
Sets the checkpoint dict in the task. Only used for testing. Args: checkpoint_dict: A serializable dict representing current task state
classy_vision/tasks/classification_task.py
_set_checkpoint_dict
hahaxun/ClassyVision
python
def _set_checkpoint_dict(self, checkpoint_dict: Dict[(str, Any)]): 'Sets the checkpoint dict in the task. Only used for testing.\n\n Args:\n checkpoint_dict: A serializable dict representing current task state\n ' self.checkpoint_dict = checkpoint_dict return self
def set_num_epochs(self, num_epochs: Union[(int, float)]): 'Set number of epochs to be run.\n\n Args:\n num_epochs: Number of epochs to run task\n ' self.num_epochs = num_epochs return self
-8,979,083,074,103,443,000
Set number of epochs to be run. Args: num_epochs: Number of epochs to run task
classy_vision/tasks/classification_task.py
set_num_epochs
hahaxun/ClassyVision
python
def set_num_epochs(self, num_epochs: Union[(int, float)]): 'Set number of epochs to be run.\n\n Args:\n num_epochs: Number of epochs to run task\n ' self.num_epochs = num_epochs return self
def set_test_phase_period(self, test_phase_period: int): 'Set the period of test phase.\n\n Args:\n test_phase_period: The period of test phase\n ' self.test_phase_period = test_phase_period return self
6,875,986,525,145,431,000
Set the period of test phase. Args: test_phase_period: The period of test phase
classy_vision/tasks/classification_task.py
set_test_phase_period
hahaxun/ClassyVision
python
def set_test_phase_period(self, test_phase_period: int): 'Set the period of test phase.\n\n Args:\n test_phase_period: The period of test phase\n ' self.test_phase_period = test_phase_period return self
def set_dataset(self, dataset: ClassyDataset, phase_type: str): 'Set dataset for phase type on task\n\n Args:\n dataset: ClassyDataset for returning samples.\n phase_type: str must be one of "train" or "test"\n ' assert (phase_type in ['train', 'test']), "phase_type must be i...
2,596,033,858,578,315,000
Set dataset for phase type on task Args: dataset: ClassyDataset for returning samples. phase_type: str must be one of "train" or "test"
classy_vision/tasks/classification_task.py
set_dataset
hahaxun/ClassyVision
python
def set_dataset(self, dataset: ClassyDataset, phase_type: str): 'Set dataset for phase type on task\n\n Args:\n dataset: ClassyDataset for returning samples.\n phase_type: str must be one of "train" or "test"\n ' assert (phase_type in ['train', 'test']), "phase_type must be i...
def set_dataloader_mp_context(self, dataloader_mp_context: Optional[str]): "Set the multiprocessing context used by the dataloader.\n\n The context can be either 'spawn', 'fork', 'forkserver' or None (uses the\n default context). See\n https://docs.python.org/3/library/multiprocessing.html#mult...
-6,788,116,500,497,534,000
Set the multiprocessing context used by the dataloader. The context can be either 'spawn', 'fork', 'forkserver' or None (uses the default context). See https://docs.python.org/3/library/multiprocessing.html#multiprocessing.get_context for more details.
classy_vision/tasks/classification_task.py
set_dataloader_mp_context
hahaxun/ClassyVision
python
def set_dataloader_mp_context(self, dataloader_mp_context: Optional[str]): "Set the multiprocessing context used by the dataloader.\n\n The context can be either 'spawn', 'fork', 'forkserver' or None (uses the\n default context). See\n https://docs.python.org/3/library/multiprocessing.html#mult...
def set_optimizer(self, optimizer: ClassyOptimizer): 'Set optimizer for task\n\n Args:\n optimizer: optimizer for task\n ' self.optimizer = optimizer return self
-1,356,130,641,651,106,000
Set optimizer for task Args: optimizer: optimizer for task
classy_vision/tasks/classification_task.py
set_optimizer
hahaxun/ClassyVision
python
def set_optimizer(self, optimizer: ClassyOptimizer): 'Set optimizer for task\n\n Args:\n optimizer: optimizer for task\n ' self.optimizer = optimizer return self
def set_loss(self, loss: ClassyLoss): 'Set loss function for task\n\n Args:\n loss: loss for task\n ' self.base_loss = loss return self
-8,139,487,164,818,706,000
Set loss function for task Args: loss: loss for task
classy_vision/tasks/classification_task.py
set_loss
hahaxun/ClassyVision
python
def set_loss(self, loss: ClassyLoss): 'Set loss function for task\n\n Args:\n loss: loss for task\n ' self.base_loss = loss return self
def set_meters(self, meters: List['ClassyMeter']): 'Set meters for task\n\n Args:\n meters: list of meters to compute during training\n ' self.meters = meters return self
-7,888,962,777,615,976,000
Set meters for task Args: meters: list of meters to compute during training
classy_vision/tasks/classification_task.py
set_meters
hahaxun/ClassyVision
python
def set_meters(self, meters: List['ClassyMeter']): 'Set meters for task\n\n Args:\n meters: list of meters to compute during training\n ' self.meters = meters return self
def set_distributed_options(self, broadcast_buffers_mode: BroadcastBuffersMode=BroadcastBuffersMode.BEFORE_EVAL, batch_norm_sync_mode: BatchNormSyncMode=BatchNormSyncMode.DISABLED, batch_norm_sync_group_size: int=0, find_unused_parameters: bool=False, bucket_cap_mb: int=25, fp16_grad_compress: bool=False): 'Set dis...
8,815,734,520,811,869,000
Set distributed options. Args: broadcast_buffers_mode: Broadcast buffers mode. See :class:`BroadcastBuffersMode` for options. batch_norm_sync_mode: Batch normalization synchronization mode. See :class:`BatchNormSyncMode` for options. batch_norm_sync_group_size: Group size to use for synchro...
classy_vision/tasks/classification_task.py
set_distributed_options
hahaxun/ClassyVision
python
def set_distributed_options(self, broadcast_buffers_mode: BroadcastBuffersMode=BroadcastBuffersMode.BEFORE_EVAL, batch_norm_sync_mode: BatchNormSyncMode=BatchNormSyncMode.DISABLED, batch_norm_sync_group_size: int=0, find_unused_parameters: bool=False, bucket_cap_mb: int=25, fp16_grad_compress: bool=False): 'Set dis...
def set_hooks(self, hooks: List['ClassyHook']): 'Set hooks for task\n\n Args:\n hooks: List of hooks to apply during training\n ' from classy_vision.hooks import ClassyHook assert isinstance(hooks, list) assert all((isinstance(hook, ClassyHook) for hook in hooks)) assert (le...
-961,870,791,464,746,500
Set hooks for task Args: hooks: List of hooks to apply during training
classy_vision/tasks/classification_task.py
set_hooks
hahaxun/ClassyVision
python
def set_hooks(self, hooks: List['ClassyHook']): 'Set hooks for task\n\n Args:\n hooks: List of hooks to apply during training\n ' from classy_vision.hooks import ClassyHook assert isinstance(hooks, list) assert all((isinstance(hook, ClassyHook) for hook in hooks)) assert (le...
def set_model(self, model: ClassyModel): 'Set model for task\n\n Args:\n model: Model to be trained\n ' self.base_model = model return self
6,614,835,632,053,417,000
Set model for task Args: model: Model to be trained
classy_vision/tasks/classification_task.py
set_model
hahaxun/ClassyVision
python
def set_model(self, model: ClassyModel): 'Set model for task\n\n Args:\n model: Model to be trained\n ' self.base_model = model return self
def set_test_only(self, test_only: bool): 'Set test only flag\n\n Args:\n test_only: If true, only test phases will be run\n ' self.test_only = test_only return self
-7,330,165,197,773,054,000
Set test only flag Args: test_only: If true, only test phases will be run
classy_vision/tasks/classification_task.py
set_test_only
hahaxun/ClassyVision
python
def set_test_only(self, test_only: bool): 'Set test only flag\n\n Args:\n test_only: If true, only test phases will be run\n ' self.test_only = test_only return self
def set_amp_args(self, amp_args: Optional[Dict[(str, Any)]]): 'Disable / enable apex.amp and set the automatic mixed precision parameters.\n\n apex.amp can be utilized for mixed / half precision training.\n\n Args:\n amp_args: Dictionary containing arguments to be passed to\n amp...
5,959,304,053,381,014,000
Disable / enable apex.amp and set the automatic mixed precision parameters. apex.amp can be utilized for mixed / half precision training. Args: amp_args: Dictionary containing arguments to be passed to amp.initialize. Set to None to disable amp. To enable mixed precision training, pass amp_args={"opt_lev...
classy_vision/tasks/classification_task.py
set_amp_args
hahaxun/ClassyVision
python
def set_amp_args(self, amp_args: Optional[Dict[(str, Any)]]): 'Disable / enable apex.amp and set the automatic mixed precision parameters.\n\n apex.amp can be utilized for mixed / half precision training.\n\n Args:\n amp_args: Dictionary containing arguments to be passed to\n amp...
def set_mixup_transform(self, mixup_transform: Optional['MixupTransform']): 'Disable / enable mixup transform for data augmentation\n\n Args::\n mixup_transform: a callable object which performs mixup data augmentation\n ' self.mixup_transform = mixup_transform if (mixup_transform i...
-1,817,254,112,740,007,400
Disable / enable mixup transform for data augmentation Args:: mixup_transform: a callable object which performs mixup data augmentation
classy_vision/tasks/classification_task.py
set_mixup_transform
hahaxun/ClassyVision
python
def set_mixup_transform(self, mixup_transform: Optional['MixupTransform']): 'Disable / enable mixup transform for data augmentation\n\n Args::\n mixup_transform: a callable object which performs mixup data augmentation\n ' self.mixup_transform = mixup_transform if (mixup_transform i...
@classmethod def from_config(cls, config: Dict[(str, Any)]) -> 'ClassificationTask': 'Instantiates a ClassificationTask from a configuration.\n\n Args:\n config: A configuration for a ClassificationTask.\n See :func:`__init__` for parameters expected in the config.\n\n Return...
-1,422,442,786,474,634,500
Instantiates a ClassificationTask from a configuration. Args: config: A configuration for a ClassificationTask. See :func:`__init__` for parameters expected in the config. Returns: A ClassificationTask instance.
classy_vision/tasks/classification_task.py
from_config
hahaxun/ClassyVision
python
@classmethod def from_config(cls, config: Dict[(str, Any)]) -> 'ClassificationTask': 'Instantiates a ClassificationTask from a configuration.\n\n Args:\n config: A configuration for a ClassificationTask.\n See :func:`__init__` for parameters expected in the config.\n\n Return...
@property def num_batches_per_phase(self): 'Returns number of batches in current phase iterator' return len(self.data_iterator)
-6,139,086,927,270,886,000
Returns number of batches in current phase iterator
classy_vision/tasks/classification_task.py
num_batches_per_phase
hahaxun/ClassyVision
python
@property def num_batches_per_phase(self): return len(self.data_iterator)
@property def model(self): 'Returns model used in training (can be wrapped with DDP)' return (self.distributed_model if is_distributed_training_run() else self.base_model)
5,909,357,874,804,241,000
Returns model used in training (can be wrapped with DDP)
classy_vision/tasks/classification_task.py
model
hahaxun/ClassyVision
python
@property def model(self): return (self.distributed_model if is_distributed_training_run() else self.base_model)
@property def loss(self): 'Returns loss used in training (can be wrapped with DDP)' return (self.distributed_loss if self.distributed_loss else self.base_loss)
542,399,534,204,788,100
Returns loss used in training (can be wrapped with DDP)
classy_vision/tasks/classification_task.py
loss
hahaxun/ClassyVision
python
@property def loss(self): return (self.distributed_loss if self.distributed_loss else self.base_loss)
@property def phase_type(self): 'Returns current phase type. String with value "train" or "test" ' return ('train' if self.train else 'test')
-674,432,275,946,742,700
Returns current phase type. String with value "train" or "test"
classy_vision/tasks/classification_task.py
phase_type
hahaxun/ClassyVision
python
@property def phase_type(self): ' ' return ('train' if self.train else 'test')
@property def eval_phase_idx(self): 'Returns current evaluation phase' return ((self.phase_idx - self.train_phase_idx) - 1)
-3,803,939,708,086,919,700
Returns current evaluation phase
classy_vision/tasks/classification_task.py
eval_phase_idx
hahaxun/ClassyVision
python
@property def eval_phase_idx(self): return ((self.phase_idx - self.train_phase_idx) - 1)
def get_total_training_phases(self): '\n Returns the total number of "train" phases in the task\n ' num_training_phases = 0 for phase in self.phases: if (phase['train'] is True): num_training_phases += 1 return num_training_phases
2,032,511,598,330,732,500
Returns the total number of "train" phases in the task
classy_vision/tasks/classification_task.py
get_total_training_phases
hahaxun/ClassyVision
python
def get_total_training_phases(self): '\n \n ' num_training_phases = 0 for phase in self.phases: if (phase['train'] is True): num_training_phases += 1 return num_training_phases
def get_total_test_phases(self): '\n Returns the total number of "test" phases in the task\n ' num_test_phases = 0 for phase in self.phases: if (phase['train'] is False): num_test_phases += 1 return num_test_phases
-7,734,286,215,081,280,000
Returns the total number of "test" phases in the task
classy_vision/tasks/classification_task.py
get_total_test_phases
hahaxun/ClassyVision
python
def get_total_test_phases(self): '\n \n ' num_test_phases = 0 for phase in self.phases: if (phase['train'] is False): num_test_phases += 1 return num_test_phases
def _build_phases(self): 'Returns list of phases from config.\n\n These phases will look like:\n {\n train: is this a train or test phase?\n optimizer: optimizer settings\n }\n\n - If this is a test only run, then only test phases will be\n generated\n - I...
-5,931,279,902,887,682,000
Returns list of phases from config. These phases will look like: { train: is this a train or test phase? optimizer: optimizer settings } - If this is a test only run, then only test phases will be generated - If this is a training run with both train and test datasets, then x phases = x train phases + x test ph...
classy_vision/tasks/classification_task.py
_build_phases
hahaxun/ClassyVision
python
def _build_phases(self): 'Returns list of phases from config.\n\n These phases will look like:\n {\n train: is this a train or test phase?\n optimizer: optimizer settings\n }\n\n - If this is a test only run, then only test phases will be\n generated\n - I...
def build_dataloader_from_dataset(self, dataset, **kwargs): 'Builds a dataloader from the provided dataset\n\n Args:\n dataset: A ClassyDataset\n kwargs: Additional kwargs to pass during dataloader construction for\n derived classes\n ' return dataset.iterator(...
-217,371,196,178,296,260
Builds a dataloader from the provided dataset Args: dataset: A ClassyDataset kwargs: Additional kwargs to pass during dataloader construction for derived classes
classy_vision/tasks/classification_task.py
build_dataloader_from_dataset
hahaxun/ClassyVision
python
def build_dataloader_from_dataset(self, dataset, **kwargs): 'Builds a dataloader from the provided dataset\n\n Args:\n dataset: A ClassyDataset\n kwargs: Additional kwargs to pass during dataloader construction for\n derived classes\n ' return dataset.iterator(...
def build_dataloaders_for_current_phase(self): 'Builds dataloader(s) for the current phase.\n\n Deriving classes can override this method to support custom behavior, like\n supporting multiple dataloaders in parallel.\n ' self.dataloader = self.build_dataloader_from_dataset(self.datasets[se...
1,567,424,470,600,948,500
Builds dataloader(s) for the current phase. Deriving classes can override this method to support custom behavior, like supporting multiple dataloaders in parallel.
classy_vision/tasks/classification_task.py
build_dataloaders_for_current_phase
hahaxun/ClassyVision
python
def build_dataloaders_for_current_phase(self): 'Builds dataloader(s) for the current phase.\n\n Deriving classes can override this method to support custom behavior, like\n supporting multiple dataloaders in parallel.\n ' self.dataloader = self.build_dataloader_from_dataset(self.datasets[se...
def prepare(self): 'Prepares task for training, populates all derived attributes ' self.phases = self._build_phases() self.train = (False if self.test_only else self.train) if (self.batch_norm_sync_mode == BatchNormSyncMode.PYTORCH): self.base_model = nn.SyncBatchNorm.convert_sync_batchnorm(self...
3,907,489,649,831,067,600
Prepares task for training, populates all derived attributes
classy_vision/tasks/classification_task.py
prepare
hahaxun/ClassyVision
python
def prepare(self): ' ' self.phases = self._build_phases() self.train = (False if self.test_only else self.train) if (self.batch_norm_sync_mode == BatchNormSyncMode.PYTORCH): self.base_model = nn.SyncBatchNorm.convert_sync_batchnorm(self.base_model) elif (self.batch_norm_sync_mode == BatchNor...
def init_distributed_data_parallel_model(self): '\n Initialize\n `torch.nn.parallel.distributed.DistributedDataParallel <https://pytorch.org/\n docs/stable/nn.html#distributeddataparallel>`_.\n\n Needed for distributed training. This is where a model should be wrapped by DDP.\n ' ...
4,334,758,329,578,739,000
Initialize `torch.nn.parallel.distributed.DistributedDataParallel <https://pytorch.org/ docs/stable/nn.html#distributeddataparallel>`_. Needed for distributed training. This is where a model should be wrapped by DDP.
classy_vision/tasks/classification_task.py
init_distributed_data_parallel_model
hahaxun/ClassyVision
python
def init_distributed_data_parallel_model(self): '\n Initialize\n `torch.nn.parallel.distributed.DistributedDataParallel <https://pytorch.org/\n docs/stable/nn.html#distributeddataparallel>`_.\n\n Needed for distributed training. This is where a model should be wrapped by DDP.\n ' ...
@property def where(self): 'Returns the proportion of training that has completed. If in test\n only mode, returns proportion of testing completed\n\n Returned value is a float in the range [0, 1)\n ' current_step = (self.num_updates / self.get_global_batchsize()) num_phases = (self.get...
6,274,725,735,764,194,000
Returns the proportion of training that has completed. If in test only mode, returns proportion of testing completed Returned value is a float in the range [0, 1)
classy_vision/tasks/classification_task.py
where
hahaxun/ClassyVision
python
@property def where(self): 'Returns the proportion of training that has completed. If in test\n only mode, returns proportion of testing completed\n\n Returned value is a float in the range [0, 1)\n ' current_step = (self.num_updates / self.get_global_batchsize()) num_phases = (self.get...
def get_classy_state(self, deep_copy: bool=False): 'Returns serialiable state of task\n\n Args:\n deep_copy: If true, does a deep copy of state before returning.\n ' optimizer_state = {} if (self.optimizer is not None): optimizer_state = self.optimizer.get_classy_state() ...
3,085,759,520,983,295,000
Returns serialiable state of task Args: deep_copy: If true, does a deep copy of state before returning.
classy_vision/tasks/classification_task.py
get_classy_state
hahaxun/ClassyVision
python
def get_classy_state(self, deep_copy: bool=False): 'Returns serialiable state of task\n\n Args:\n deep_copy: If true, does a deep copy of state before returning.\n ' optimizer_state = {} if (self.optimizer is not None): optimizer_state = self.optimizer.get_classy_state() ...
def set_classy_state(self, state): 'Set task state\n\n Args:\n state: Dict containing state of a task\n ' self.train = (False if self.test_only else state['train']) if (not self.test_only): self.phase_idx = state['phase_idx'] self.num_updates = state['num_updates'] ...
-4,464,662,588,784,485,000
Set task state Args: state: Dict containing state of a task
classy_vision/tasks/classification_task.py
set_classy_state
hahaxun/ClassyVision
python
def set_classy_state(self, state): 'Set task state\n\n Args:\n state: Dict containing state of a task\n ' self.train = (False if self.test_only else state['train']) if (not self.test_only): self.phase_idx = state['phase_idx'] self.num_updates = state['num_updates'] ...
def _should_do_step(self): 'Tells if we will be performing an optimizer step.\n\n Returns True always if there is no gradient accumulation. With gradient\n accumulation returns True only when the gradients will be synchronized and we\n will be performing an optimizer step.\n ' update...
7,095,668,484,539,073,000
Tells if we will be performing an optimizer step. Returns True always if there is no gradient accumulation. With gradient accumulation returns True only when the gradients will be synchronized and we will be performing an optimizer step.
classy_vision/tasks/classification_task.py
_should_do_step
hahaxun/ClassyVision
python
def _should_do_step(self): 'Tells if we will be performing an optimizer step.\n\n Returns True always if there is no gradient accumulation. With gradient\n accumulation returns True only when the gradients will be synchronized and we\n will be performing an optimizer step.\n ' update...
def train_step(self): 'Train step to be executed in train loop.' self.last_batch = None with Timer() as timer: sample = next(self.data_iterator) assert (isinstance(sample, dict) and ('input' in sample) and ('target' in sample)), (f"Returned sample [{sample}] is not a map with 'input' and" + "'ta...
1,406,572,901,275,031,300
Train step to be executed in train loop.
classy_vision/tasks/classification_task.py
train_step
hahaxun/ClassyVision
python
def train_step(self): self.last_batch = None with Timer() as timer: sample = next(self.data_iterator) assert (isinstance(sample, dict) and ('input' in sample) and ('target' in sample)), (f"Returned sample [{sample}] is not a map with 'input' and" + "'target' keys") target = sample['target']...
def run_optimizer(self, loss): 'Runs backwards pass and update the optimizer' self.check_inf_nan(loss) update_idx = (self.num_updates // self.get_global_batchsize()) do_zero_grad = ((update_idx % self.optimizer_period) == 0) do_step = self._should_do_step() if do_zero_grad: self.optimize...
5,778,416,676,523,271,000
Runs backwards pass and update the optimizer
classy_vision/tasks/classification_task.py
run_optimizer
hahaxun/ClassyVision
python
def run_optimizer(self, loss): self.check_inf_nan(loss) update_idx = (self.num_updates // self.get_global_batchsize()) do_zero_grad = ((update_idx % self.optimizer_period) == 0) do_step = self._should_do_step() if do_zero_grad: self.optimizer.zero_grad() if (self.amp_type == AmpType...
def synchronize_losses(self): 'Average the losses across the different replicas' losses_tensor = torch.tensor(self.losses) synchronized_losses_tensor = all_reduce_mean(losses_tensor) self.losses = synchronized_losses_tensor.tolist()
273,915,927,694,461,470
Average the losses across the different replicas
classy_vision/tasks/classification_task.py
synchronize_losses
hahaxun/ClassyVision
python
def synchronize_losses(self): losses_tensor = torch.tensor(self.losses) synchronized_losses_tensor = all_reduce_mean(losses_tensor) self.losses = synchronized_losses_tensor.tolist()
def advance_phase(self): 'Performs bookkeeping / task updates between phases\n\n Increments phase idx, resets meters, resets loss history,\n resets counters, shuffles dataset, rebuilds iterators, and\n sets the train / test state for phase.\n ' logging.debug('Advancing phase') fo...
8,052,403,596,791,451,000
Performs bookkeeping / task updates between phases Increments phase idx, resets meters, resets loss history, resets counters, shuffles dataset, rebuilds iterators, and sets the train / test state for phase.
classy_vision/tasks/classification_task.py
advance_phase
hahaxun/ClassyVision
python
def advance_phase(self): 'Performs bookkeeping / task updates between phases\n\n Increments phase idx, resets meters, resets loss history,\n resets counters, shuffles dataset, rebuilds iterators, and\n sets the train / test state for phase.\n ' logging.debug('Advancing phase') fo...
def done_training(self): 'Stop condition for training' return ((self.phase_idx + 1) >= len(self.phases))
-7,333,598,901,078,115,000
Stop condition for training
classy_vision/tasks/classification_task.py
done_training
hahaxun/ClassyVision
python
def done_training(self): return ((self.phase_idx + 1) >= len(self.phases))
def create_data_iterators(self): 'Creates data iterator(s) for the current phase.' del self.data_iterator self.data_iterator = iter(self.dataloader)
2,382,980,055,976,533,000
Creates data iterator(s) for the current phase.
classy_vision/tasks/classification_task.py
create_data_iterators
hahaxun/ClassyVision
python
def create_data_iterators(self): del self.data_iterator self.data_iterator = iter(self.dataloader)
def _set_model_train_mode(self): 'Set train mode for model' phase = self.phases[self.phase_idx] self.base_model.train(phase['train']) self.base_loss.train(phase['train']) if ((self.broadcast_buffers_mode == BroadcastBuffersMode.BEFORE_EVAL) and (not self.train)): self._broadcast_buffers()
1,552,558,941,805,127,200
Set train mode for model
classy_vision/tasks/classification_task.py
_set_model_train_mode
hahaxun/ClassyVision
python
def _set_model_train_mode(self): phase = self.phases[self.phase_idx] self.base_model.train(phase['train']) self.base_loss.train(phase['train']) if ((self.broadcast_buffers_mode == BroadcastBuffersMode.BEFORE_EVAL) and (not self.train)): self._broadcast_buffers()
def _broadcast_buffers(self): 'Explicitly synchronize buffers across all devices.' if (self.distributed_model is None): return buffers = list(self.base_model.buffers()) if (len(buffers) > 0): logging.info('Synchronizing buffers before evaluation.') for buffer in buffers: ...
3,299,607,995,830,788,600
Explicitly synchronize buffers across all devices.
classy_vision/tasks/classification_task.py
_broadcast_buffers
hahaxun/ClassyVision
python
def _broadcast_buffers(self): if (self.distributed_model is None): return buffers = list(self.base_model.buffers()) if (len(buffers) > 0): logging.info('Synchronizing buffers before evaluation.') for buffer in buffers: broadcast(buffer, 0, group=self.distributed_mode...
def get_batchsize_per_replica(self): "Return local replica's batchsize for dataset (e.g. batchsize per GPU)" return self.datasets[self.phase_type].get_batchsize_per_replica()
513,977,166,658,707,800
Return local replica's batchsize for dataset (e.g. batchsize per GPU)
classy_vision/tasks/classification_task.py
get_batchsize_per_replica
hahaxun/ClassyVision
python
def get_batchsize_per_replica(self): return self.datasets[self.phase_type].get_batchsize_per_replica()
def get_global_batchsize(self): 'Return global batchsize across all trainers' return self.datasets[self.phase_type].get_global_batchsize()
-3,338,348,201,598,782,500
Return global batchsize across all trainers
classy_vision/tasks/classification_task.py
get_global_batchsize
hahaxun/ClassyVision
python
def get_global_batchsize(self): return self.datasets[self.phase_type].get_global_batchsize()
def __init__(self, dic): ' initalize. ' self._dic = dic self._lazyload = {}
-7,927,460,824,320,636,000
initalize.
pycwr/configure/pyart_lazydict.py
__init__
1271756664/study
python
def __init__(self, dic): ' ' self._dic = dic self._lazyload = {}
def __setitem__(self, key, value): ' Set a key which will not be stored and evaluated traditionally. ' self._dic[key] = value if (key in self._lazyload): del self._lazyload[key]
6,706,434,709,855,033,000
Set a key which will not be stored and evaluated traditionally.
pycwr/configure/pyart_lazydict.py
__setitem__
1271756664/study
python
def __setitem__(self, key, value): ' ' self._dic[key] = value if (key in self._lazyload): del self._lazyload[key]
def __getitem__(self, key): ' Get the value of a key, evaluating a lazy key if needed. ' if (key in self._lazyload): value = self._lazyload[key]() self._dic[key] = value del self._lazyload[key] return self._dic[key]
-639,051,963,247,231,400
Get the value of a key, evaluating a lazy key if needed.
pycwr/configure/pyart_lazydict.py
__getitem__
1271756664/study
python
def __getitem__(self, key): ' ' if (key in self._lazyload): value = self._lazyload[key]() self._dic[key] = value del self._lazyload[key] return self._dic[key]
def __delitem__(self, key): ' Remove a lazy or traditional key from the dictionary. ' if (key in self._lazyload): del self._lazyload[key] else: del self._dic[key]
-8,030,515,860,348,572,000
Remove a lazy or traditional key from the dictionary.
pycwr/configure/pyart_lazydict.py
__delitem__
1271756664/study
python
def __delitem__(self, key): ' ' if (key in self._lazyload): del self._lazyload[key] else: del self._dic[key]
def __iter__(self): ' Iterate over all lazy and traditional keys. ' return itertools.chain(self._dic.copy(), self._lazyload.copy())
-6,806,612,679,534,530,000
Iterate over all lazy and traditional keys.
pycwr/configure/pyart_lazydict.py
__iter__
1271756664/study
python
def __iter__(self): ' ' return itertools.chain(self._dic.copy(), self._lazyload.copy())
def __len__(self): ' Return the number of traditional and lazy keys. ' return (len(self._dic) + len(self._lazyload))
-579,698,376,871,627,000
Return the number of traditional and lazy keys.
pycwr/configure/pyart_lazydict.py
__len__
1271756664/study
python
def __len__(self): ' ' return (len(self._dic) + len(self._lazyload))
def __str__(self): ' Return a string representation of the object. ' if ((len(self._dic) == 0) or (len(self._lazyload) == 0)): seperator = '' else: seperator = ', ' lazy_reprs = [(repr(k), repr(v)) for (k, v) in self._lazyload.items()] lazy_strs = [('%s: LazyLoad(%s)' % r) for r in l...
1,127,157,148,018,508,300
Return a string representation of the object.
pycwr/configure/pyart_lazydict.py
__str__
1271756664/study
python
def __str__(self): ' ' if ((len(self._dic) == 0) or (len(self._lazyload) == 0)): seperator = else: seperator = ', ' lazy_reprs = [(repr(k), repr(v)) for (k, v) in self._lazyload.items()] lazy_strs = [('%s: LazyLoad(%s)' % r) for r in lazy_reprs] lazy_str = (', '.join(lazy_strs)...
def has_key(self, key): ' True if dictionary has key, else False. ' return (key in self)
-6,618,503,770,004,047,000
True if dictionary has key, else False.
pycwr/configure/pyart_lazydict.py
has_key
1271756664/study
python
def has_key(self, key): ' ' return (key in self)