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 write_immediate(self, addr: Union[(str, List[str])], value: Union[(object, List[object])], timeout: float=None):
'\n Instead of waiting for a group write, writes the given value immediately. Note, this is not very efficient\n and should be used sparingly. '
if isinstance(addr, list):
i... | -1,611,480,356,399,589,400 | Instead of waiting for a group write, writes the given value immediately. Note, this is not very efficient
and should be used sparingly. | controlpyweb/reader_writer.py | write_immediate | washad/ControlPyWeb | python | def write_immediate(self, addr: Union[(str, List[str])], value: Union[(object, List[object])], timeout: float=None):
'\n Instead of waiting for a group write, writes the given value immediately. Note, this is not very efficient\n and should be used sparingly. '
if isinstance(addr, list):
i... |
def __init__(self, model='inception_v3', weights='imagenet', include_top=False, pooling=None, n_channels=None, clf_head_dense_dim=1024):
" Creates ImageNet base model for featurization or classification and corresponding image\n preprocessing function\n :param model: options are xception, ... | 105,362,475,208,379,410 | Creates ImageNet base model for featurization or classification and corresponding image
preprocessing function
:param model: options are xception, inception_v3, and mobilenet_v2
:param weights: 'imagenet' or filepath
:param include_top: whether to include original ImageNet classification head with 1000 clas... | primitives/image_classification/utils/imagenet.py | __init__ | Yonder-OSS/D3M-Primitives | python | def __init__(self, model='inception_v3', weights='imagenet', include_top=False, pooling=None, n_channels=None, clf_head_dense_dim=1024):
" Creates ImageNet base model for featurization or classification and corresponding image\n preprocessing function\n :param model: options are xception, ... |
def _load_finetune_model(self, nclasses=2, weights_path=None):
' Constructs finetuning model architecture and optionally loads weights\n :param nclasses: number of classes on which to softmax over\n :param weights_path: optional filepath from which to try to load weights\n '
... | 6,284,525,206,236,823,000 | Constructs finetuning model architecture and optionally loads weights
:param nclasses: number of classes on which to softmax over
:param weights_path: optional filepath from which to try to load weights | primitives/image_classification/utils/imagenet.py | _load_finetune_model | Yonder-OSS/D3M-Primitives | python | def _load_finetune_model(self, nclasses=2, weights_path=None):
' Constructs finetuning model architecture and optionally loads weights\n :param nclasses: number of classes on which to softmax over\n :param weights_path: optional filepath from which to try to load weights\n '
... |
def get_features(self, images_array):
' takes a batch of images as a 4-d array and returns the (flattened) imagenet features for those images as a 2-d array '
if self.include_top:
raise Exception('getting features from a classification model with include_top=True is currently not supported')
if (ima... | -2,330,387,601,279,151,600 | takes a batch of images as a 4-d array and returns the (flattened) imagenet features for those images as a 2-d array | primitives/image_classification/utils/imagenet.py | get_features | Yonder-OSS/D3M-Primitives | python | def get_features(self, images_array):
' '
if self.include_top:
raise Exception('getting features from a classification model with include_top=True is currently not supported')
if (images_array.ndim != 4):
raise Exception('invalid input shape for images_array, expects a 4d array')
logger... |
def predict(self, images_array):
' alias for get_features to more closely match scikit-learn interface '
return self.get_features(images_array) | 2,710,568,764,399,794,000 | alias for get_features to more closely match scikit-learn interface | primitives/image_classification/utils/imagenet.py | predict | Yonder-OSS/D3M-Primitives | python | def predict(self, images_array):
' '
return self.get_features(images_array) |
def finetune(self, train_dataset, val_dataset=None, nclasses=2, top_layer_epochs=1, unfreeze_proportions=[0.5], all_layer_epochs=5, class_weight=None, optimizer_top='rmsprop', optimizer_full='sgd', callbacks=None, num_workers=8, load_weights_path=None, save_weights_path=None):
' Finetunes the Imagenet model iterati... | 4,750,495,175,294,076,000 | Finetunes the Imagenet model iteratively on a smaller set of images with (potentially) a smaller set of classes.
First finetunes last layer then freezes bottom N layers and retrains the rest
:param train_dataset: (X, y) pair of tf.constant tensors for training
:param val_dataset: (X, y) pair of tf.constant ten... | primitives/image_classification/utils/imagenet.py | finetune | Yonder-OSS/D3M-Primitives | python | def finetune(self, train_dataset, val_dataset=None, nclasses=2, top_layer_epochs=1, unfreeze_proportions=[0.5], all_layer_epochs=5, class_weight=None, optimizer_top='rmsprop', optimizer_full='sgd', callbacks=None, num_workers=8, load_weights_path=None, save_weights_path=None):
' Finetunes the Imagenet model iterati... |
def finetune_classify(self, test_dataset, nclasses=2, num_workers=8, load_weights_path=None):
' Uses the finetuned model to predict on a test dataset. \n :param test_dataset: X, tf.constant tensor for inference\n :param nclasses: number of classes \n :param num_workers: ... | -4,570,401,618,268,227,000 | Uses the finetuned model to predict on a test dataset.
:param test_dataset: X, tf.constant tensor for inference
:param nclasses: number of classes
:param num_workers: number of workers to use for multiprocess data loading
:return: array of softmaxed prediction probabilities
:param load_weights_path: optional filepath... | primitives/image_classification/utils/imagenet.py | finetune_classify | Yonder-OSS/D3M-Primitives | python | def finetune_classify(self, test_dataset, nclasses=2, num_workers=8, load_weights_path=None):
' Uses the finetuned model to predict on a test dataset. \n :param test_dataset: X, tf.constant tensor for inference\n :param nclasses: number of classes \n :param num_workers: ... |
def test(test_config_path):
'Runs an object detection test configuration\n \n This runs an object detection test configuration. This involves\n \n 1. Download and build a model architecture (or use cached).\n 2. Optimize the model architecrue\n 3. Benchmark the optimized model against a dataset\n... | 1,570,044,009,871,800,600 | Runs an object detection test configuration
This runs an object detection test configuration. This involves
1. Download and build a model architecture (or use cached).
2. Optimize the model architecrue
3. Benchmark the optimized model against a dataset
4. (optional) Run assertions to check the benchmark output
The ... | tftrt/examples/object_detection/test.py | test | HubBucket-Team/tensorrt | python | def test(test_config_path):
'Runs an object detection test configuration\n \n This runs an object detection test configuration. This involves\n \n 1. Download and build a model architecture (or use cached).\n 2. Optimize the model architecrue\n 3. Benchmark the optimized model against a dataset\n... |
def draw_approx_polyDP(cnt, epsilon=0.01, closed=True):
'用多边形来近似的表示曲线'
epsilon = (epsilon * cv2.arcLength(cnt, closed))
return cv2.approxPolyDP(cnt, epsilon, closed) | 3,543,939,564,340,141,000 | 用多边形来近似的表示曲线 | my_cv/utils/cv2_util.py | draw_approx_polyDP | strawsyz/straw | python | def draw_approx_polyDP(cnt, epsilon=0.01, closed=True):
epsilon = (epsilon * cv2.arcLength(cnt, closed))
return cv2.approxPolyDP(cnt, epsilon, closed) |
def draw_convex_hull(cnt):
'画凸包,传入的是一些点'
return cv2.convexHull(cnt) | -3,145,086,267,839,236,600 | 画凸包,传入的是一些点 | my_cv/utils/cv2_util.py | draw_convex_hull | strawsyz/straw | python | def draw_convex_hull(cnt):
return cv2.convexHull(cnt) |
def camera_show(window_name='camera'):
'最好在改进一下关闭窗口部分的功能\n 建立一个窗口捕捉摄像头显示的内容\n 当左键点击过窗口,且按过任意键盘键,才会退出窗口'
clicked = False
camera_capture = cv2.VideoCapture(0)
def on_mouse(event, x, y, flags, param):
global clicked
if (event == cv2.EVENT_LBUTTONUP):
clicked = True
cv... | -9,194,454,016,718,126,000 | 最好在改进一下关闭窗口部分的功能
建立一个窗口捕捉摄像头显示的内容
当左键点击过窗口,且按过任意键盘键,才会退出窗口 | my_cv/utils/cv2_util.py | camera_show | strawsyz/straw | python | def camera_show(window_name='camera'):
'最好在改进一下关闭窗口部分的功能\n 建立一个窗口捕捉摄像头显示的内容\n 当左键点击过窗口,且按过任意键盘键,才会退出窗口'
clicked = False
camera_capture = cv2.VideoCapture(0)
def on_mouse(event, x, y, flags, param):
global clicked
if (event == cv2.EVENT_LBUTTONUP):
clicked = True
cv... |
def from_upload_jobs(upload_jobs):
'Creates a new upload queue from a list of upload jobs.\n\n Creates a new queue of files to upload by starting with the full input\n dataset and removing any files that are uploaded (partially or fully) to\n Sia.\n\n Args:\n upload_jobs: The unfiltered set of up... | 5,794,168,816,860,892,000 | Creates a new upload queue from a list of upload jobs.
Creates a new queue of files to upload by starting with the full input
dataset and removing any files that are uploaded (partially or fully) to
Sia.
Args:
upload_jobs: The unfiltered set of upload jobs.
Returns:
A Queue of upload jobs, filtered to remove... | sia_load_tester/upload_queue.py | from_upload_jobs | mtlynch/sia_load_tester | python | def from_upload_jobs(upload_jobs):
'Creates a new upload queue from a list of upload jobs.\n\n Creates a new queue of files to upload by starting with the full input\n dataset and removing any files that are uploaded (partially or fully) to\n Sia.\n\n Args:\n upload_jobs: The unfiltered set of up... |
def from_upload_jobs_and_sia_client(upload_jobs, sia_client):
'Creates a new upload queue from a dataset.\n\n Creates a new queue of files to upload by starting with the full input\n dataset and removing any files that are uploaded (partially or fully) to\n Sia.\n\n Args:\n upload_jobs: The unfil... | 6,385,742,080,236,516,000 | Creates a new upload queue from a dataset.
Creates a new queue of files to upload by starting with the full input
dataset and removing any files that are uploaded (partially or fully) to
Sia.
Args:
upload_jobs: The unfiltered set of upload jobs.
sia_client: An implementation of the Sia client interface.
Retu... | sia_load_tester/upload_queue.py | from_upload_jobs_and_sia_client | mtlynch/sia_load_tester | python | def from_upload_jobs_and_sia_client(upload_jobs, sia_client):
'Creates a new upload queue from a dataset.\n\n Creates a new queue of files to upload by starting with the full input\n dataset and removing any files that are uploaded (partially or fully) to\n Sia.\n\n Args:\n upload_jobs: The unfil... |
def __init__(self, name, lammps_input, lammps_data=None, data_filename='in.data', user_lammps_settings=None):
"\n Implementation of LammpsInputSet that is initialized from a dict\n settings. It is typically used by other LammpsInputSets for\n initialization from json or yaml source files.\n\n ... | -4,467,768,066,648,851,000 | Implementation of LammpsInputSet that is initialized from a dict
settings. It is typically used by other LammpsInputSets for
initialization from json or yaml source files.
Args:
name (str): A name for the input set.
lammps_input (LammpsInput): The config dictionary to use.
lammps_data (LammpsData): LammpsD... | pymatgen/io/lammps/sets.py | __init__ | JSelf42/pymatgen | python | def __init__(self, name, lammps_input, lammps_data=None, data_filename='in.data', user_lammps_settings=None):
"\n Implementation of LammpsInputSet that is initialized from a dict\n settings. It is typically used by other LammpsInputSets for\n initialization from json or yaml source files.\n\n ... |
def write_input(self, input_filename, data_filename=None):
'\n Get the string representation of the main input file and write it.\n Also writes the data file if the lammps_data attribute is set.\n\n Args:\n input_filename (string): name of the input file\n data_filename (s... | -123,766,993,869,552,430 | Get the string representation of the main input file and write it.
Also writes the data file if the lammps_data attribute is set.
Args:
input_filename (string): name of the input file
data_filename (string): override the data file name with this | pymatgen/io/lammps/sets.py | write_input | JSelf42/pymatgen | python | def write_input(self, input_filename, data_filename=None):
'\n Get the string representation of the main input file and write it.\n Also writes the data file if the lammps_data attribute is set.\n\n Args:\n input_filename (string): name of the input file\n data_filename (s... |
@classmethod
def from_file(cls, name, input_template, user_settings, lammps_data=None, data_filename='in.data'):
'\n Returns LammpsInputSet from input file template and input data.\n\n Args:\n name (str)\n input_template (string): path to the input template file.\n us... | -3,239,966,993,342,371,300 | Returns LammpsInputSet from input file template and input data.
Args:
name (str)
input_template (string): path to the input template file.
user_settings (dict): User lammps settings, the keys must
correspond to the keys in the template.
lammps_data (string/LammpsData): path to the
data... | pymatgen/io/lammps/sets.py | from_file | JSelf42/pymatgen | python | @classmethod
def from_file(cls, name, input_template, user_settings, lammps_data=None, data_filename='in.data'):
'\n Returns LammpsInputSet from input file template and input data.\n\n Args:\n name (str)\n input_template (string): path to the input template file.\n us... |
def get_token(auth_ctx):
'Acquire token via client credential flow (ADAL Python library is utilized)'
token = auth_ctx.acquire_token_with_client_credentials('https://graph.microsoft.com', settings['client_credentials']['client_id'], settings['client_credentials']['client_secret'])
return token | 8,581,977,952,059,346,000 | Acquire token via client credential flow (ADAL Python library is utilized) | examples/outlook/send_message.py | get_token | stardust85/Office365-REST-Python-Client | python | def get_token(auth_ctx):
token = auth_ctx.acquire_token_with_client_credentials('https://graph.microsoft.com', settings['client_credentials']['client_id'], settings['client_credentials']['client_secret'])
return token |
def test_jwt_manager_initialized(jwt):
'Assert that the jwt_manager is created as part of the fixtures.'
assert jwt | 706,935,926,803,901,000 | Assert that the jwt_manager is created as part of the fixtures. | legal-api/tests/unit/services/test_authorization.py | test_jwt_manager_initialized | leksmall/lear | python | def test_jwt_manager_initialized(jwt):
assert jwt |
@not_github_ci
def test_jwt_manager_correct_test_config(app_request, jwt):
'Assert that the test configuration for the JWT is working as expected.'
message = 'This is a protected end-point'
protected_route = '/fake_jwt_route'
@app_request.route(protected_route)
@jwt.has_one_of_roles([STAFF_ROLE])
... | -5,227,954,913,948,805,000 | Assert that the test configuration for the JWT is working as expected. | legal-api/tests/unit/services/test_authorization.py | test_jwt_manager_correct_test_config | leksmall/lear | python | @not_github_ci
def test_jwt_manager_correct_test_config(app_request, jwt):
message = 'This is a protected end-point'
protected_route = '/fake_jwt_route'
@app_request.route(protected_route)
@jwt.has_one_of_roles([STAFF_ROLE])
def get():
return jsonify(message=message)
token = helper... |
@not_github_ci
@pytest.mark.parametrize('test_name,identifier,username,roles,allowed_actions,requested_actions,expected', TEST_AUTHZ_DATA)
def test_authorized_user(monkeypatch, app_request, jwt, test_name, identifier, username, roles, allowed_actions, requested_actions, expected):
'Assert that the type of user auth... | 8,930,474,284,491,742,000 | Assert that the type of user authorization is correct, based on the expected outcome. | legal-api/tests/unit/services/test_authorization.py | test_authorized_user | leksmall/lear | python | @not_github_ci
@pytest.mark.parametrize('test_name,identifier,username,roles,allowed_actions,requested_actions,expected', TEST_AUTHZ_DATA)
def test_authorized_user(monkeypatch, app_request, jwt, test_name, identifier, username, roles, allowed_actions, requested_actions, expected):
from requests import Response... |
@integration_authorization
@pytest.mark.parametrize('test_name,identifier,username,roles,allowed_actions,requested_actions,expected', TEST_INTEG_AUTHZ_DATA)
def test_authorized_user_integ(monkeypatch, app, jwt, test_name, identifier, username, roles, allowed_actions, requested_actions, expected):
'Assert that the t... | -1,942,846,359,137,083,600 | Assert that the type of user authorization is correct, based on the expected outcome. | legal-api/tests/unit/services/test_authorization.py | test_authorized_user_integ | leksmall/lear | python | @integration_authorization
@pytest.mark.parametrize('test_name,identifier,username,roles,allowed_actions,requested_actions,expected', TEST_INTEG_AUTHZ_DATA)
def test_authorized_user_integ(monkeypatch, app, jwt, test_name, identifier, username, roles, allowed_actions, requested_actions, expected):
import flask
... |
def test_authorized_missing_args():
'Assert that the missing args return False.'
identifier = 'a corp'
jwt = 'fake'
action = 'fake'
rv = authorized(identifier, jwt, None)
assert (not rv)
rv = authorized(identifier, None, action)
assert (not rv)
rv = authorized(None, jwt, action)
... | -6,687,189,366,203,435,000 | Assert that the missing args return False. | legal-api/tests/unit/services/test_authorization.py | test_authorized_missing_args | leksmall/lear | python | def test_authorized_missing_args():
identifier = 'a corp'
jwt = 'fake'
action = 'fake'
rv = authorized(identifier, jwt, None)
assert (not rv)
rv = authorized(identifier, None, action)
assert (not rv)
rv = authorized(None, jwt, action)
assert (not rv) |
def test_authorized_bad_url(monkeypatch, app, jwt):
'Assert that an invalid auth service URL returns False.'
import flask
identifier = 'CP1234567'
username = 'username'
roles = [BASIC_USER]
token = helper_create_jwt(jwt, roles=roles, username=username)
headers = {'Authorization': ('Bearer ' ... | 2,734,986,831,551,713,000 | Assert that an invalid auth service URL returns False. | legal-api/tests/unit/services/test_authorization.py | test_authorized_bad_url | leksmall/lear | python | def test_authorized_bad_url(monkeypatch, app, jwt):
import flask
identifier = 'CP1234567'
username = 'username'
roles = [BASIC_USER]
token = helper_create_jwt(jwt, roles=roles, username=username)
headers = {'Authorization': ('Bearer ' + token)}
def mock_auth(one, two):
return h... |
def test_authorized_invalid_roles(monkeypatch, app, jwt):
'Assert that an invalid role returns False.'
import flask
identifier = 'CP1234567'
username = 'username'
roles = ['NONE']
token = helper_create_jwt(jwt, roles=roles, username=username)
headers = {'Authorization': ('Bearer ' + token)}
... | 7,091,088,088,241,768,000 | Assert that an invalid role returns False. | legal-api/tests/unit/services/test_authorization.py | test_authorized_invalid_roles | leksmall/lear | python | def test_authorized_invalid_roles(monkeypatch, app, jwt):
import flask
identifier = 'CP1234567'
username = 'username'
roles = ['NONE']
token = helper_create_jwt(jwt, roles=roles, username=username)
headers = {'Authorization': ('Bearer ' + token)}
def mock_auth(one, two):
return... |
@pytest.mark.parametrize('test_name,state,legal_type,username,roles,expected', [('staff_active_cp', Business.State.ACTIVE, 'CP', 'staff', [STAFF_ROLE], ['annualReport', 'changeOfAddress', 'changeOfDirectors', 'correction', 'courtOrder', 'dissolution', 'incorporationApplication', 'specialResolution', 'registrarsNotation... | 8,420,474,170,027,016,000 | Assert that get allowed returns valid filings. | legal-api/tests/unit/services/test_authorization.py | test_get_allowed | leksmall/lear | python | @pytest.mark.parametrize('test_name,state,legal_type,username,roles,expected', [('staff_active_cp', Business.State.ACTIVE, 'CP', 'staff', [STAFF_ROLE], ['annualReport', 'changeOfAddress', 'changeOfDirectors', 'correction', 'courtOrder', 'dissolution', 'incorporationApplication', 'specialResolution', 'registrarsNotation... |
@pytest.mark.parametrize('test_name,state,filing_type,sub_filing_type,legal_types,username,roles,expected', [('staff_active_allowed', Business.State.ACTIVE, 'alteration', None, ['BC', 'BEN', 'ULC'], 'staff', [STAFF_ROLE], True), ('staff_active', Business.State.ACTIVE, 'alteration', None, ['CP', 'CC', 'LLC'], 'staff', [... | -2,506,679,965,252,201,000 | Assert that get allowed returns valid filings. | legal-api/tests/unit/services/test_authorization.py | test_is_allowed | leksmall/lear | python | @pytest.mark.parametrize('test_name,state,filing_type,sub_filing_type,legal_types,username,roles,expected', [('staff_active_allowed', Business.State.ACTIVE, 'alteration', None, ['BC', 'BEN', 'ULC'], 'staff', [STAFF_ROLE], True), ('staff_active', Business.State.ACTIVE, 'alteration', None, ['CP', 'CC', 'LLC'], 'staff', [... |
@classmethod
def create(cls, surface, features):
'\n Create instance of MeCabServiceNode\n\n Parameters\n ----------\n surface : str\n Surface of the word\n features : dict\n Features analyzed by MeCabService\n '
return cls(surface=surface, part=fe... | 508,100,562,846,045,630 | Create instance of MeCabServiceNode
Parameters
----------
surface : str
Surface of the word
features : dict
Features analyzed by MeCabService | minette/tagger/mecabservice.py | create | uezo/minette-python | python | @classmethod
def create(cls, surface, features):
'\n Create instance of MeCabServiceNode\n\n Parameters\n ----------\n surface : str\n Surface of the word\n features : dict\n Features analyzed by MeCabService\n '
return cls(surface=surface, part=fe... |
def __init__(self, config=None, timezone=None, logger=None, *, api_url=None, **kwargs):
'\n Parameters\n ----------\n config : Config, default None\n Configuration\n timezone : timezone, default None\n Timezone\n logger : Logger, default None\n Log... | -7,093,479,140,288,094,000 | Parameters
----------
config : Config, default None
Configuration
timezone : timezone, default None
Timezone
logger : Logger, default None
Logger
api_url : str, default None
URL for MeCabService API.
If None trial URL is used. | minette/tagger/mecabservice.py | __init__ | uezo/minette-python | python | def __init__(self, config=None, timezone=None, logger=None, *, api_url=None, **kwargs):
'\n Parameters\n ----------\n config : Config, default None\n Configuration\n timezone : timezone, default None\n Timezone\n logger : Logger, default None\n Log... |
def parse(self, text):
'\n Parse and annotate using MeCab Service\n\n Parameters\n ----------\n text : str\n Text to analyze\n\n Returns\n -------\n words : list of minette.MeCabServiceNode\n MeCabService nodes\n '
ret = []
if (no... | 356,939,620,011,587,650 | Parse and annotate using MeCab Service
Parameters
----------
text : str
Text to analyze
Returns
-------
words : list of minette.MeCabServiceNode
MeCabService nodes | minette/tagger/mecabservice.py | parse | uezo/minette-python | python | def parse(self, text):
'\n Parse and annotate using MeCab Service\n\n Parameters\n ----------\n text : str\n Text to analyze\n\n Returns\n -------\n words : list of minette.MeCabServiceNode\n MeCabService nodes\n '
ret = []
if (no... |
def get_csv_fieldnames(self):
'Return the field names for the CSV file.'
return ['image_name', 'x_min', 'y_min', 'width', 'height', 'label'] | -1,880,100,204,781,328,600 | Return the field names for the CSV file. | src/discolight/writers/annotation/widthheightcsv.py | get_csv_fieldnames | arunraja-hub/discolight | python | def get_csv_fieldnames(self):
return ['image_name', 'x_min', 'y_min', 'width', 'height', 'label'] |
def get_csv_row(self, image_name, _image, annotation):
'Return the CSV row corresponding to the given annotation.'
return {'image_name': image_name, 'x_min': annotation.x_min, 'y_min': annotation.y_min, 'width': (annotation.x_max - annotation.x_min), 'height': (annotation.y_max - annotation.y_min), 'label': ann... | 1,451,875,289,880,012,500 | Return the CSV row corresponding to the given annotation. | src/discolight/writers/annotation/widthheightcsv.py | get_csv_row | arunraja-hub/discolight | python | def get_csv_row(self, image_name, _image, annotation):
return {'image_name': image_name, 'x_min': annotation.x_min, 'y_min': annotation.y_min, 'width': (annotation.x_max - annotation.x_min), 'height': (annotation.y_max - annotation.y_min), 'label': annotation.class_idx} |
def _wait_for_api_vip(self, hosts, timeout=180):
"Enable some grace time for waiting for API's availability."
return waiting.wait((lambda : self.get_kube_api_ip(hosts=hosts)), timeout_seconds=timeout, sleep_seconds=5, waiting_for="API's IP") | -2,047,560,959,314,300,700 | Enable some grace time for waiting for API's availability. | discovery-infra/test_infra/helper_classes/cluster.py | _wait_for_api_vip | empovit/assisted-test-infra | python | def _wait_for_api_vip(self, hosts, timeout=180):
return waiting.wait((lambda : self.get_kube_api_ip(hosts=hosts)), timeout_seconds=timeout, sleep_seconds=5, waiting_for="API's IP") |
@staticmethod
def is_kubeapi_service_ready(ip_or_dns):
'Validate if kube-api is ready on given address.'
with contextlib.suppress(ValueError):
if (ipaddress.ip_address(ip_or_dns).version == 6):
ip_or_dns = f'[{ip_or_dns}]'
try:
response = requests.get(f'https://{ip_or_dns}:6443/r... | 1,817,083,930,350,911,200 | Validate if kube-api is ready on given address. | discovery-infra/test_infra/helper_classes/cluster.py | is_kubeapi_service_ready | empovit/assisted-test-infra | python | @staticmethod
def is_kubeapi_service_ready(ip_or_dns):
with contextlib.suppress(ValueError):
if (ipaddress.ip_address(ip_or_dns).version == 6):
ip_or_dns = f'[{ip_or_dns}]'
try:
response = requests.get(f'https://{ip_or_dns}:6443/readyz', verify=False, timeout=1)
return r... |
def transforms(item, cfg, mode):
'\n :param item: sample = deepcopy(self.items[index])\n :param cfg: cfg\n :return:\n\n eval() transform str to list, dict, tuple. Here is a series of the transform methods in turn.\n '
transforms_dataset_factory = {'train': cfg.dataset.train, 'test': cfg.dataset.t... | 541,067,101,429,177,800 | :param item: sample = deepcopy(self.items[index])
:param cfg: cfg
:return:
eval() transform str to list, dict, tuple. Here is a series of the transform methods in turn. | MDRSREID/utils/data_utils/transforms/torch_transforms/__init__.py | transforms | nickhuang1996/HJL-re-id | python | def transforms(item, cfg, mode):
'\n :param item: sample = deepcopy(self.items[index])\n :param cfg: cfg\n :return:\n\n eval() transform str to list, dict, tuple. Here is a series of the transform methods in turn.\n '
transforms_dataset_factory = {'train': cfg.dataset.train, 'test': cfg.dataset.t... |
def conv3x3(in_planes, out_planes, stride=1):
'3x3 convolution with padding'
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) | -798,009,169,856,366,800 | 3x3 convolution with padding | arcface/resnet_cbam.py | conv3x3 | DerryHub/the-TaobaoLive-Commodity-Identify-Competition | python | def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) |
def load_image_from_file(self, filename, shape):
'Given a filename, try to open the file. If failed, return None.\n\n Args:\n filename: location of the image file\n shape: the shape of the image file to be scaled\n\n Returns:\n the image if succeeds, None if fails.\n\n Rasies:\n excepti... | -2,819,391,022,505,540,600 | Given a filename, try to open the file. If failed, return None.
Args:
filename: location of the image file
shape: the shape of the image file to be scaled
Returns:
the image if succeeds, None if fails.
Rasies:
exception if the image was not the right shape. | activation_generator.py | load_image_from_file | Gareth001/tcav | python | def load_image_from_file(self, filename, shape):
'Given a filename, try to open the file. If failed, return None.\n\n Args:\n filename: location of the image file\n shape: the shape of the image file to be scaled\n\n Returns:\n the image if succeeds, None if fails.\n\n Rasies:\n excepti... |
def load_images_from_files(self, filenames, max_imgs=500, do_shuffle=True, run_parallel=True, shape=(299, 299), num_workers=100):
'Return image arrays from filenames.\n\n Args:\n filenames: locations of image files.\n max_imgs: maximum number of images from filenames.\n do_shuffle: before getting ... | -2,996,030,287,084,294,700 | Return image arrays from filenames.
Args:
filenames: locations of image files.
max_imgs: maximum number of images from filenames.
do_shuffle: before getting max_imgs files, shuffle the names or not
run_parallel: get images in parallel or not
shape: desired shape of the image
num_workers: number of workers ... | activation_generator.py | load_images_from_files | Gareth001/tcav | python | def load_images_from_files(self, filenames, max_imgs=500, do_shuffle=True, run_parallel=True, shape=(299, 299), num_workers=100):
'Return image arrays from filenames.\n\n Args:\n filenames: locations of image files.\n max_imgs: maximum number of images from filenames.\n do_shuffle: before getting ... |
def _check_vars():
'\n Check validity of environment variables.\n\n Look out for any environment variables that start with "MODIN_" prefix\n that are unknown - they might be a typo, so warn a user.\n '
valid_names = {obj.varname for obj in globals().values() if (isinstance(obj, type) and issubclass(... | 2,108,388,337,274,259,200 | Check validity of environment variables.
Look out for any environment variables that start with "MODIN_" prefix
that are unknown - they might be a typo, so warn a user. | modin/config/envvars.py | _check_vars | atomicai/modin | python | def _check_vars():
'\n Check validity of environment variables.\n\n Look out for any environment variables that start with "MODIN_" prefix\n that are unknown - they might be a typo, so warn a user.\n '
valid_names = {obj.varname for obj in globals().values() if (isinstance(obj, type) and issubclass(... |
@classmethod
def _get_raw_from_config(cls) -> str:
'\n Read the value from environment variable.\n\n Returns\n -------\n str\n Config raw value.\n\n Raises\n ------\n KeyError\n If value is absent.\n '
return os.environ[cls.varname] | -6,251,456,654,797,590,000 | Read the value from environment variable.
Returns
-------
str
Config raw value.
Raises
------
KeyError
If value is absent. | modin/config/envvars.py | _get_raw_from_config | atomicai/modin | python | @classmethod
def _get_raw_from_config(cls) -> str:
'\n Read the value from environment variable.\n\n Returns\n -------\n str\n Config raw value.\n\n Raises\n ------\n KeyError\n If value is absent.\n '
return os.environ[cls.varname] |
@classmethod
def get_help(cls) -> str:
'\n Generate user-presentable help for the config.\n\n Returns\n -------\n str\n '
help = f'''{cls.varname}: {dedent((cls.__doc__ or 'Unknown')).strip()}
Provide {_TYPE_PARAMS[cls.type].help}'''
if cls.choices:
help += f" (va... | -6,810,046,508,520,344,000 | Generate user-presentable help for the config.
Returns
-------
str | modin/config/envvars.py | get_help | atomicai/modin | python | @classmethod
def get_help(cls) -> str:
'\n Generate user-presentable help for the config.\n\n Returns\n -------\n str\n '
help = f'{cls.varname}: {dedent((cls.__doc__ or 'Unknown')).strip()}
Provide {_TYPE_PARAMS[cls.type].help}'
if cls.choices:
help += f" (valid ... |
@classmethod
def _get_default(cls):
'\n Get default value of the config.\n\n Returns\n -------\n str\n '
if IsDebug.get():
return 'Python'
try:
import ray
except ImportError:
pass
else:
if (version.parse(ray.__version__) < version.pa... | 6,933,771,059,849,099,000 | Get default value of the config.
Returns
-------
str | modin/config/envvars.py | _get_default | atomicai/modin | python | @classmethod
def _get_default(cls):
'\n Get default value of the config.\n\n Returns\n -------\n str\n '
if IsDebug.get():
return 'Python'
try:
import ray
except ImportError:
pass
else:
if (version.parse(ray.__version__) < version.pa... |
@classmethod
def _get_default(cls):
'\n Get default value of the config.\n\n Returns\n -------\n int\n '
import multiprocessing
return multiprocessing.cpu_count() | 173,000,487,574,057,300 | Get default value of the config.
Returns
-------
int | modin/config/envvars.py | _get_default | atomicai/modin | python | @classmethod
def _get_default(cls):
'\n Get default value of the config.\n\n Returns\n -------\n int\n '
import multiprocessing
return multiprocessing.cpu_count() |
@classmethod
def _put(cls, value):
"\n Put specific value if NPartitions wasn't set by a user yet.\n\n Parameters\n ----------\n value : int\n Config value to set.\n\n Notes\n -----\n This method is used to set NPartitions from cluster resources internally... | 2,939,723,670,533,166,600 | Put specific value if NPartitions wasn't set by a user yet.
Parameters
----------
value : int
Config value to set.
Notes
-----
This method is used to set NPartitions from cluster resources internally
and should not be called by a user. | modin/config/envvars.py | _put | atomicai/modin | python | @classmethod
def _put(cls, value):
"\n Put specific value if NPartitions wasn't set by a user yet.\n\n Parameters\n ----------\n value : int\n Config value to set.\n\n Notes\n -----\n This method is used to set NPartitions from cluster resources internally... |
@classmethod
def _get_default(cls):
'\n Get default value of the config.\n\n Returns\n -------\n int\n '
if (Backend.get() == 'Cudf'):
return GpuCount.get()
else:
return CpuCount.get() | 888,611,286,913,522,700 | Get default value of the config.
Returns
-------
int | modin/config/envvars.py | _get_default | atomicai/modin | python | @classmethod
def _get_default(cls):
'\n Get default value of the config.\n\n Returns\n -------\n int\n '
if (Backend.get() == 'Cudf'):
return GpuCount.get()
else:
return CpuCount.get() |
@classmethod
def enable(cls):
'Enable ``ProgressBar`` feature.'
cls.put(True) | 1,718,077,012,427,152,000 | Enable ``ProgressBar`` feature. | modin/config/envvars.py | enable | atomicai/modin | python | @classmethod
def enable(cls):
cls.put(True) |
@classmethod
def disable(cls):
'Disable ``ProgressBar`` feature.'
cls.put(False) | -3,469,939,319,755,450,000 | Disable ``ProgressBar`` feature. | modin/config/envvars.py | disable | atomicai/modin | python | @classmethod
def disable(cls):
cls.put(False) |
@classmethod
def put(cls, value):
'\n Set ``ProgressBar`` value only if synchronous benchmarking is disabled.\n\n Parameters\n ----------\n value : bool\n Config value to set.\n '
if (value and BenchmarkMode.get()):
raise ValueError("ProgressBar isn't compat... | 8,472,071,341,530,053,000 | Set ``ProgressBar`` value only if synchronous benchmarking is disabled.
Parameters
----------
value : bool
Config value to set. | modin/config/envvars.py | put | atomicai/modin | python | @classmethod
def put(cls, value):
'\n Set ``ProgressBar`` value only if synchronous benchmarking is disabled.\n\n Parameters\n ----------\n value : bool\n Config value to set.\n '
if (value and BenchmarkMode.get()):
raise ValueError("ProgressBar isn't compat... |
@classmethod
def put(cls, value):
'\n Set ``BenchmarkMode`` value only if progress bar feature is disabled.\n\n Parameters\n ----------\n value : bool\n Config value to set.\n '
if (value and ProgressBar.get()):
raise ValueError("BenchmarkMode isn't compatib... | -6,901,263,747,557,031,000 | Set ``BenchmarkMode`` value only if progress bar feature is disabled.
Parameters
----------
value : bool
Config value to set. | modin/config/envvars.py | put | atomicai/modin | python | @classmethod
def put(cls, value):
'\n Set ``BenchmarkMode`` value only if progress bar feature is disabled.\n\n Parameters\n ----------\n value : bool\n Config value to set.\n '
if (value and ProgressBar.get()):
raise ValueError("BenchmarkMode isn't compatib... |
@classmethod
def get(self):
'\n Get the resulted command-line options.\n\n Decode and merge specified command-line options with the default one.\n\n Returns\n -------\n dict\n Decoded and verified config value.\n '
custom_parameters = super().get()
result... | 4,546,177,453,802,994,700 | Get the resulted command-line options.
Decode and merge specified command-line options with the default one.
Returns
-------
dict
Decoded and verified config value. | modin/config/envvars.py | get | atomicai/modin | python | @classmethod
def get(self):
'\n Get the resulted command-line options.\n\n Decode and merge specified command-line options with the default one.\n\n Returns\n -------\n dict\n Decoded and verified config value.\n '
custom_parameters = super().get()
result... |
@query_params('interval', 'system_api_version', 'system_id')
def bulk(self, body, doc_type=None, params=None, headers=None):
"\n Used by the monitoring features to send monitoring data.\n\n `<https://www.elastic.co/guide/en/elasticsearch/reference/7.10/monitor-elasticsearch-cluster.html>`_\n\n ... | 5,742,135,621,379,876,000 | Used by the monitoring features to send monitoring data.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.10/monitor-elasticsearch-cluster.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg body: The operation definition and da... | AB/lambda/elasticindex/elasticsearch/client/monitoring.py | bulk | PatrickJD/AWS | python | @query_params('interval', 'system_api_version', 'system_id')
def bulk(self, body, doc_type=None, params=None, headers=None):
"\n Used by the monitoring features to send monitoring data.\n\n `<https://www.elastic.co/guide/en/elasticsearch/reference/7.10/monitor-elasticsearch-cluster.html>`_\n\n ... |
def __init__(self, *args, **kwargs):
'\n Create a new Polar Axes for a polar plot.\n\n The following optional kwargs are supported:\n\n - *resolution*: The number of points of interpolation between\n each pair of data points. Set to 1 to disable\n interpolation.\n ... | -3,830,649,146,554,316,000 | Create a new Polar Axes for a polar plot.
The following optional kwargs are supported:
- *resolution*: The number of points of interpolation between
each pair of data points. Set to 1 to disable
interpolation. | lib/python2.7/matplotlib/projections/polar.py | __init__ | ashley8jain/IITD-complaint-system-web | python | def __init__(self, *args, **kwargs):
'\n Create a new Polar Axes for a polar plot.\n\n The following optional kwargs are supported:\n\n - *resolution*: The number of points of interpolation between\n each pair of data points. Set to 1 to disable\n interpolation.\n ... |
def _init_axis(self):
"move this out of __init__ because non-separable axes don't use it"
self.xaxis = maxis.XAxis(self)
self.yaxis = maxis.YAxis(self)
self._update_transScale() | 755,314,804,009,636,000 | move this out of __init__ because non-separable axes don't use it | lib/python2.7/matplotlib/projections/polar.py | _init_axis | ashley8jain/IITD-complaint-system-web | python | def _init_axis(self):
self.xaxis = maxis.XAxis(self)
self.yaxis = maxis.YAxis(self)
self._update_transScale() |
def set_theta_offset(self, offset):
'\n Set the offset for the location of 0 in radians.\n '
self._theta_offset = offset | -24,000,136,632,674,060 | Set the offset for the location of 0 in radians. | lib/python2.7/matplotlib/projections/polar.py | set_theta_offset | ashley8jain/IITD-complaint-system-web | python | def set_theta_offset(self, offset):
'\n \n '
self._theta_offset = offset |
def get_theta_offset(self):
'\n Get the offset for the location of 0 in radians.\n '
return self._theta_offset | -2,351,204,604,870,762,000 | Get the offset for the location of 0 in radians. | lib/python2.7/matplotlib/projections/polar.py | get_theta_offset | ashley8jain/IITD-complaint-system-web | python | def get_theta_offset(self):
'\n \n '
return self._theta_offset |
def set_theta_zero_location(self, loc):
'\n Sets the location of theta\'s zero. (Calls set_theta_offset\n with the correct value in radians under the hood.)\n\n May be one of "N", "NW", "W", "SW", "S", "SE", "E", or "NE".\n '
mapping = {'N': (np.pi * 0.5), 'NW': (np.pi * 0.75), 'W':... | -2,454,019,984,045,059,600 | Sets the location of theta's zero. (Calls set_theta_offset
with the correct value in radians under the hood.)
May be one of "N", "NW", "W", "SW", "S", "SE", "E", or "NE". | lib/python2.7/matplotlib/projections/polar.py | set_theta_zero_location | ashley8jain/IITD-complaint-system-web | python | def set_theta_zero_location(self, loc):
'\n Sets the location of theta\'s zero. (Calls set_theta_offset\n with the correct value in radians under the hood.)\n\n May be one of "N", "NW", "W", "SW", "S", "SE", "E", or "NE".\n '
mapping = {'N': (np.pi * 0.5), 'NW': (np.pi * 0.75), 'W':... |
def set_theta_direction(self, direction):
'\n Set the direction in which theta increases.\n\n clockwise, -1:\n Theta increases in the clockwise direction\n\n counterclockwise, anticlockwise, 1:\n Theta increases in the counterclockwise direction\n '
if (direction ... | 6,125,434,307,476,871,000 | Set the direction in which theta increases.
clockwise, -1:
Theta increases in the clockwise direction
counterclockwise, anticlockwise, 1:
Theta increases in the counterclockwise direction | lib/python2.7/matplotlib/projections/polar.py | set_theta_direction | ashley8jain/IITD-complaint-system-web | python | def set_theta_direction(self, direction):
'\n Set the direction in which theta increases.\n\n clockwise, -1:\n Theta increases in the clockwise direction\n\n counterclockwise, anticlockwise, 1:\n Theta increases in the counterclockwise direction\n '
if (direction ... |
def get_theta_direction(self):
'\n Get the direction in which theta increases.\n\n -1:\n Theta increases in the clockwise direction\n\n 1:\n Theta increases in the counterclockwise direction\n '
return self._direction | -7,715,639,299,182,240,000 | Get the direction in which theta increases.
-1:
Theta increases in the clockwise direction
1:
Theta increases in the counterclockwise direction | lib/python2.7/matplotlib/projections/polar.py | get_theta_direction | ashley8jain/IITD-complaint-system-web | python | def get_theta_direction(self):
'\n Get the direction in which theta increases.\n\n -1:\n Theta increases in the clockwise direction\n\n 1:\n Theta increases in the counterclockwise direction\n '
return self._direction |
@docstring.dedent_interpd
def set_thetagrids(self, angles, labels=None, frac=None, fmt=None, **kwargs):
'\n Set the angles at which to place the theta grids (these\n gridlines are equal along the theta dimension). *angles* is in\n degrees.\n\n *labels*, if not None, is a ``len(angles)``... | -2,763,533,836,684,350,500 | Set the angles at which to place the theta grids (these
gridlines are equal along the theta dimension). *angles* is in
degrees.
*labels*, if not None, is a ``len(angles)`` list of strings of
the labels to use at each angle.
If *labels* is None, the labels will be ``fmt %% angle``
*frac* is the fraction of the polar... | lib/python2.7/matplotlib/projections/polar.py | set_thetagrids | ashley8jain/IITD-complaint-system-web | python | @docstring.dedent_interpd
def set_thetagrids(self, angles, labels=None, frac=None, fmt=None, **kwargs):
'\n Set the angles at which to place the theta grids (these\n gridlines are equal along the theta dimension). *angles* is in\n degrees.\n\n *labels*, if not None, is a ``len(angles)``... |
@docstring.dedent_interpd
def set_rgrids(self, radii, labels=None, angle=None, fmt=None, **kwargs):
'\n Set the radial locations and labels of the *r* grids.\n\n The labels will appear at radial distances *radii* at the\n given *angle* in degrees.\n\n *labels*, if not None, is a ``len(ra... | 3,607,151,283,755,662,300 | Set the radial locations and labels of the *r* grids.
The labels will appear at radial distances *radii* at the
given *angle* in degrees.
*labels*, if not None, is a ``len(radii)`` list of strings of the
labels to use at each radius.
If *labels* is None, the built-in formatter will be used.
Return value is a list o... | lib/python2.7/matplotlib/projections/polar.py | set_rgrids | ashley8jain/IITD-complaint-system-web | python | @docstring.dedent_interpd
def set_rgrids(self, radii, labels=None, angle=None, fmt=None, **kwargs):
'\n Set the radial locations and labels of the *r* grids.\n\n The labels will appear at radial distances *radii* at the\n given *angle* in degrees.\n\n *labels*, if not None, is a ``len(ra... |
def format_coord(self, theta, r):
'\n Return a format string formatting the coordinate using Unicode\n characters.\n '
theta /= math.pi
return (u'θ=%0.3fπ (%0.3f°), r=%0.3f' % (theta, (theta * 180.0), r)) | -1,078,132,295,707,459,000 | Return a format string formatting the coordinate using Unicode
characters. | lib/python2.7/matplotlib/projections/polar.py | format_coord | ashley8jain/IITD-complaint-system-web | python | def format_coord(self, theta, r):
'\n Return a format string formatting the coordinate using Unicode\n characters.\n '
theta /= math.pi
return (u'θ=%0.3fπ (%0.3f°), r=%0.3f' % (theta, (theta * 180.0), r)) |
def get_data_ratio(self):
'\n Return the aspect ratio of the data itself. For a polar plot,\n this should always be 1.0\n '
return 1.0 | -9,119,961,156,597,160,000 | Return the aspect ratio of the data itself. For a polar plot,
this should always be 1.0 | lib/python2.7/matplotlib/projections/polar.py | get_data_ratio | ashley8jain/IITD-complaint-system-web | python | def get_data_ratio(self):
'\n Return the aspect ratio of the data itself. For a polar plot,\n this should always be 1.0\n '
return 1.0 |
def can_zoom(self):
'\n Return *True* if this axes supports the zoom box button functionality.\n\n Polar axes do not support zoom boxes.\n '
return False | -1,113,074,475,683,004,900 | Return *True* if this axes supports the zoom box button functionality.
Polar axes do not support zoom boxes. | lib/python2.7/matplotlib/projections/polar.py | can_zoom | ashley8jain/IITD-complaint-system-web | python | def can_zoom(self):
'\n Return *True* if this axes supports the zoom box button functionality.\n\n Polar axes do not support zoom boxes.\n '
return False |
def can_pan(self):
'\n Return *True* if this axes supports the pan/zoom button functionality.\n\n For polar axes, this is slightly misleading. Both panning and\n zooming are performed by the same button. Panning is performed\n in azimuth while zooming is done along the radial.\n '... | -7,162,355,877,948,546,000 | Return *True* if this axes supports the pan/zoom button functionality.
For polar axes, this is slightly misleading. Both panning and
zooming are performed by the same button. Panning is performed
in azimuth while zooming is done along the radial. | lib/python2.7/matplotlib/projections/polar.py | can_pan | ashley8jain/IITD-complaint-system-web | python | def can_pan(self):
'\n Return *True* if this axes supports the pan/zoom button functionality.\n\n For polar axes, this is slightly misleading. Both panning and\n zooming are performed by the same button. Panning is performed\n in azimuth while zooming is done along the radial.\n '... |
def __init__(self, scale_transform, limits):
'\n *limits* is the view limit of the data. The only part of\n its bounds that is used is ymax (for the radius maximum).\n The theta range is always fixed to (0, 2pi).\n '
Affine2DBase.__init__(self)
self._scale_transf... | 3,391,083,076,465,484,300 | *limits* is the view limit of the data. The only part of
its bounds that is used is ymax (for the radius maximum).
The theta range is always fixed to (0, 2pi). | lib/python2.7/matplotlib/projections/polar.py | __init__ | ashley8jain/IITD-complaint-system-web | python | def __init__(self, scale_transform, limits):
'\n *limits* is the view limit of the data. The only part of\n its bounds that is used is ymax (for the radius maximum).\n The theta range is always fixed to (0, 2pi).\n '
Affine2DBase.__init__(self)
self._scale_transf... |
def handle_template(self, template, subdir):
"\n Determines where the app or project templates are.\n Use django.__path__[0] as the default because we don't\n know into which directory Django has been installed.\n "
if (template is None):
return path.join(django.__path__[0], ... | 5,342,258,727,169,901,000 | Determines where the app or project templates are.
Use django.__path__[0] as the default because we don't
know into which directory Django has been installed. | django/core/management/templates.py | handle_template | LuanP/django | python | def handle_template(self, template, subdir):
"\n Determines where the app or project templates are.\n Use django.__path__[0] as the default because we don't\n know into which directory Django has been installed.\n "
if (template is None):
return path.join(django.__path__[0], ... |
def download(self, url):
'\n Downloads the given URL and returns the file name.\n '
def cleanup_url(url):
tmp = url.rstrip('/')
filename = tmp.split('/')[(- 1)]
if url.endswith('/'):
display_url = (tmp + '/')
else:
display_url = url
... | -5,480,616,050,715,580,000 | Downloads the given URL and returns the file name. | django/core/management/templates.py | download | LuanP/django | python | def download(self, url):
'\n \n '
def cleanup_url(url):
tmp = url.rstrip('/')
filename = tmp.split('/')[(- 1)]
if url.endswith('/'):
display_url = (tmp + '/')
else:
display_url = url
return (filename, display_url)
prefix = ('djan... |
def splitext(self, the_path):
'\n Like os.path.splitext, but takes off .tar, too\n '
(base, ext) = posixpath.splitext(the_path)
if base.lower().endswith('.tar'):
ext = (base[(- 4):] + ext)
base = base[:(- 4)]
return (base, ext) | 7,964,358,720,822,540,000 | Like os.path.splitext, but takes off .tar, too | django/core/management/templates.py | splitext | LuanP/django | python | def splitext(self, the_path):
'\n \n '
(base, ext) = posixpath.splitext(the_path)
if base.lower().endswith('.tar'):
ext = (base[(- 4):] + ext)
base = base[:(- 4)]
return (base, ext) |
def extract(self, filename):
'\n Extracts the given file to a temporarily and returns\n the path of the directory with the extracted content.\n '
prefix = ('django_%s_template_' % self.app_or_project)
tempdir = tempfile.mkdtemp(prefix=prefix, suffix='_extract')
self.paths_to_remove.... | -5,862,873,927,603,246,000 | Extracts the given file to a temporarily and returns
the path of the directory with the extracted content. | django/core/management/templates.py | extract | LuanP/django | python | def extract(self, filename):
'\n Extracts the given file to a temporarily and returns\n the path of the directory with the extracted content.\n '
prefix = ('django_%s_template_' % self.app_or_project)
tempdir = tempfile.mkdtemp(prefix=prefix, suffix='_extract')
self.paths_to_remove.... |
def is_url(self, template):
'\n Returns True if the name looks like a URL\n '
if (':' not in template):
return False
scheme = template.split(':', 1)[0].lower()
return (scheme in self.url_schemes) | -5,899,986,127,205,529,000 | Returns True if the name looks like a URL | django/core/management/templates.py | is_url | LuanP/django | python | def is_url(self, template):
'\n \n '
if (':' not in template):
return False
scheme = template.split(':', 1)[0].lower()
return (scheme in self.url_schemes) |
def make_writeable(self, filename):
'\n Make sure that the file is writeable.\n Useful if our source is read-only.\n '
if sys.platform.startswith('java'):
return
if (not os.access(filename, os.W_OK)):
st = os.stat(filename)
new_permissions = (stat.S_IMODE(st.st_m... | -8,087,604,734,570,663,000 | Make sure that the file is writeable.
Useful if our source is read-only. | django/core/management/templates.py | make_writeable | LuanP/django | python | def make_writeable(self, filename):
'\n Make sure that the file is writeable.\n Useful if our source is read-only.\n '
if sys.platform.startswith('java'):
return
if (not os.access(filename, os.W_OK)):
st = os.stat(filename)
new_permissions = (stat.S_IMODE(st.st_m... |
def parse(csvfilename):
"\n Reads CSV file named csvfilename, parses\n it's content and returns the data within\n the file as a list of lists.\n "
table = []
with open(csvfilename, 'r') as csvfile:
csvreader = csv.reader(csvfile, skipinitialspace=True)
for row in csvreader:
... | -1,531,225,135,421,307,000 | Reads CSV file named csvfilename, parses
it's content and returns the data within
the file as a list of lists. | Rice-Python-Data-Analysis/week3/examples3_csvmodule.py | parse | Abu-Kaisar/Courses- | python | def parse(csvfilename):
"\n Reads CSV file named csvfilename, parses\n it's content and returns the data within\n the file as a list of lists.\n "
table = []
with open(csvfilename, 'r') as csvfile:
csvreader = csv.reader(csvfile, skipinitialspace=True)
for row in csvreader:
... |
def print_table(table):
'\n Print out table, which must be a list\n of lists, in a nicely formatted way.\n '
for row in table:
print('{:<19}'.format(row[0]), end='')
for col in row[1:]:
print('{:>4}'.format(col), end='')
print('', end='\n') | 5,542,860,294,133,022,000 | Print out table, which must be a list
of lists, in a nicely formatted way. | Rice-Python-Data-Analysis/week3/examples3_csvmodule.py | print_table | Abu-Kaisar/Courses- | python | def print_table(table):
'\n Print out table, which must be a list\n of lists, in a nicely formatted way.\n '
for row in table:
print('{:<19}'.format(row[0]), end=)
for col in row[1:]:
print('{:>4}'.format(col), end=)
print(, end='\n') |
def collect(conf, conn):
'Collect ICD-XX-PCS procedures.\n '
URL = 'https://www.cms.gov/Medicare/Coding/ICD10/Downloads/2016-PCS-Long-Abbrev-Titles.zip'
FILE = 'icd10pcs_order_2016.txt'
VERSION = 'ICD-10-PCS'
LAST_UPDATED = '2015-10-01'
zip = requests.get(URL).content
file = zipfile.ZipFi... | -7,279,392,835,362,786,000 | Collect ICD-XX-PCS procedures. | collectors/icdpcs/collector.py | collect | almeidaah/collectors | python | def collect(conf, conn):
'\n '
URL = 'https://www.cms.gov/Medicare/Coding/ICD10/Downloads/2016-PCS-Long-Abbrev-Titles.zip'
FILE = 'icd10pcs_order_2016.txt'
VERSION = 'ICD-10-PCS'
LAST_UPDATED = '2015-10-01'
zip = requests.get(URL).content
file = zipfile.ZipFile(io.BytesIO(zip)).open(FILE)... |
@timed_pass(name='cire')
def cire(clusters, mode, sregistry, options, platform):
"\n Cross-iteration redundancies elimination.\n\n Parameters\n ----------\n cluster : Cluster\n Input Cluster, subject of the optimization pass.\n mode : str\n The transformation mode. Accepted: ['invariant... | 3,623,312,860,309,811,700 | Cross-iteration redundancies elimination.
Parameters
----------
cluster : Cluster
Input Cluster, subject of the optimization pass.
mode : str
The transformation mode. Accepted: ['invariants', 'sops'].
* 'invariants' is for sub-expressions that are invariant w.r.t. one or
more Dimensions.
* 'sops'... | devito/passes/clusters/aliases.py | cire | ccuetom/devito | python | @timed_pass(name='cire')
def cire(clusters, mode, sregistry, options, platform):
"\n Cross-iteration redundancies elimination.\n\n Parameters\n ----------\n cluster : Cluster\n Input Cluster, subject of the optimization pass.\n mode : str\n The transformation mode. Accepted: ['invariant... |
def collect(extracted, ispace, min_storage):
'\n Find groups of aliasing expressions.\n\n We shall introduce the following (loose) terminology:\n\n * A ``terminal`` is the leaf of a mathematical operation. Terminals\n can be numbers (n), literals (l), or Indexeds (I).\n * ``R`` is the r... | 4,766,641,733,024,113,000 | Find groups of aliasing expressions.
We shall introduce the following (loose) terminology:
* A ``terminal`` is the leaf of a mathematical operation. Terminals
can be numbers (n), literals (l), or Indexeds (I).
* ``R`` is the relaxation operator := ``R(n) = n``, ``R(l) = l``,
``R(I) = J``, where ``... | devito/passes/clusters/aliases.py | collect | ccuetom/devito | python | def collect(extracted, ispace, min_storage):
'\n Find groups of aliasing expressions.\n\n We shall introduce the following (loose) terminology:\n\n * A ``terminal`` is the leaf of a mathematical operation. Terminals\n can be numbers (n), literals (l), or Indexeds (I).\n * ``R`` is the r... |
def choose(aliases, exprs, mapper, selector):
'\n Analyze the detected aliases and, after applying a cost model to rule out\n the aliases with a bad flops/memory trade-off, inject them into the original\n expressions.\n '
tot = 0
retained = AliasMapper()
candidates = OrderedDict()
aliase... | -8,288,166,598,663,380,000 | Analyze the detected aliases and, after applying a cost model to rule out
the aliases with a bad flops/memory trade-off, inject them into the original
expressions. | devito/passes/clusters/aliases.py | choose | ccuetom/devito | python | def choose(aliases, exprs, mapper, selector):
'\n Analyze the detected aliases and, after applying a cost model to rule out\n the aliases with a bad flops/memory trade-off, inject them into the original\n expressions.\n '
tot = 0
retained = AliasMapper()
candidates = OrderedDict()
aliase... |
def lower_aliases(cluster, aliases, in_writeto, maxpar):
'\n Create a Schedule from an AliasMapper.\n '
dmapper = {}
processed = []
for (alias, v) in aliases.items():
imapper = {**{i.dim: i for i in v.intervals}, **{i.dim.parent: i for i in v.intervals if i.dim.is_NonlinearDerived}}
... | 8,807,849,933,634,017,000 | Create a Schedule from an AliasMapper. | devito/passes/clusters/aliases.py | lower_aliases | ccuetom/devito | python | def lower_aliases(cluster, aliases, in_writeto, maxpar):
'\n \n '
dmapper = {}
processed = []
for (alias, v) in aliases.items():
imapper = {**{i.dim: i for i in v.intervals}, **{i.dim.parent: i for i in v.intervals if i.dim.is_NonlinearDerived}}
intervals = []
writeto = []
... |
def optimize_schedule(cluster, schedule, platform, sregistry, options):
'\n Rewrite the schedule for performance optimization.\n '
if options['cire-rotate']:
schedule = _optimize_schedule_rotations(schedule, sregistry)
schedule = _optimize_schedule_padding(cluster, schedule, platform)
retu... | 6,498,303,570,085,755,000 | Rewrite the schedule for performance optimization. | devito/passes/clusters/aliases.py | optimize_schedule | ccuetom/devito | python | def optimize_schedule(cluster, schedule, platform, sregistry, options):
'\n \n '
if options['cire-rotate']:
schedule = _optimize_schedule_rotations(schedule, sregistry)
schedule = _optimize_schedule_padding(cluster, schedule, platform)
return schedule |
def _optimize_schedule_rotations(schedule, sregistry):
'\n Transform the schedule such that the tensor temporaries "rotate" along\n the outermost Dimension. This trades a parallel Dimension for a smaller\n working set size.\n '
ridx = 0
rmapper = defaultdict(list)
processed = []
for (k, ... | -8,454,179,542,547,144,000 | Transform the schedule such that the tensor temporaries "rotate" along
the outermost Dimension. This trades a parallel Dimension for a smaller
working set size. | devito/passes/clusters/aliases.py | _optimize_schedule_rotations | ccuetom/devito | python | def _optimize_schedule_rotations(schedule, sregistry):
'\n Transform the schedule such that the tensor temporaries "rotate" along\n the outermost Dimension. This trades a parallel Dimension for a smaller\n working set size.\n '
ridx = 0
rmapper = defaultdict(list)
processed = []
for (k, ... |
def _optimize_schedule_padding(cluster, schedule, platform):
'\n Round up the innermost IterationInterval of the tensor temporaries IterationSpace\n to a multiple of the SIMD vector length. This is not always possible though (it\n depends on how much halo is safely accessible in all read Functions).\n '... | 3,954,155,820,396,321,300 | Round up the innermost IterationInterval of the tensor temporaries IterationSpace
to a multiple of the SIMD vector length. This is not always possible though (it
depends on how much halo is safely accessible in all read Functions). | devito/passes/clusters/aliases.py | _optimize_schedule_padding | ccuetom/devito | python | def _optimize_schedule_padding(cluster, schedule, platform):
'\n Round up the innermost IterationInterval of the tensor temporaries IterationSpace\n to a multiple of the SIMD vector length. This is not always possible though (it\n depends on how much halo is safely accessible in all read Functions).\n '... |
def lower_schedule(cluster, schedule, sregistry, options):
'\n Turn a Schedule into a sequence of Clusters.\n '
ftemps = options['cire-ftemps']
if ftemps:
make = TempFunction
else:
make = Array
clusters = []
subs = {}
for (alias, writeto, ispace, aliaseds, indicess) in ... | -1,341,575,166,606,335,700 | Turn a Schedule into a sequence of Clusters. | devito/passes/clusters/aliases.py | lower_schedule | ccuetom/devito | python | def lower_schedule(cluster, schedule, sregistry, options):
'\n \n '
ftemps = options['cire-ftemps']
if ftemps:
make = TempFunction
else:
make = Array
clusters = []
subs = {}
for (alias, writeto, ispace, aliaseds, indicess) in schedule:
name = sregistry.make_name... |
def pick_best(variants):
'\n Use the variant score and heuristics to return the variant with the best\n trade-off between operation count reduction and working set increase.\n '
best = variants.pop(0)
for i in variants:
(best_flop_score, best_ws_score) = best.score
if (best_flop_sco... | 1,714,703,760,381,377,500 | Use the variant score and heuristics to return the variant with the best
trade-off between operation count reduction and working set increase. | devito/passes/clusters/aliases.py | pick_best | ccuetom/devito | python | def pick_best(variants):
'\n Use the variant score and heuristics to return the variant with the best\n trade-off between operation count reduction and working set increase.\n '
best = variants.pop(0)
for i in variants:
(best_flop_score, best_ws_score) = best.score
if (best_flop_sco... |
def rebuild(cluster, exprs, subs, schedule):
'\n Plug the optimized aliases into the input Cluster. This leads to creating\n a new Cluster with suitable IterationSpace and DataSpace.\n '
exprs = [uxreplace(e, subs) for e in exprs]
ispace = cluster.ispace.augment(schedule.dmapper)
ispace = ispac... | -6,467,477,386,370,209,000 | Plug the optimized aliases into the input Cluster. This leads to creating
a new Cluster with suitable IterationSpace and DataSpace. | devito/passes/clusters/aliases.py | rebuild | ccuetom/devito | python | def rebuild(cluster, exprs, subs, schedule):
'\n Plug the optimized aliases into the input Cluster. This leads to creating\n a new Cluster with suitable IterationSpace and DataSpace.\n '
exprs = [uxreplace(e, subs) for e in exprs]
ispace = cluster.ispace.augment(schedule.dmapper)
ispace = ispac... |
def make_rotations_table(d, v):
'\n All possible rotations of `range(v+1)`.\n '
m = np.array([[((j - i) if (j > i) else 0) for j in range((v + 1))] for i in range((v + 1))])
m = (m - m.T)[::(- 1), :]
m = np.roll(m, int((- np.floor((v / 2)))), axis=0)
m = [Interval(d, min(i), max(i)) for i in m... | 2,894,974,119,365,010,400 | All possible rotations of `range(v+1)`. | devito/passes/clusters/aliases.py | make_rotations_table | ccuetom/devito | python | def make_rotations_table(d, v):
'\n \n '
m = np.array([[((j - i) if (j > i) else 0) for j in range((v + 1))] for i in range((v + 1))])
m = (m - m.T)[::(- 1), :]
m = np.roll(m, int((- np.floor((v / 2)))), axis=0)
m = [Interval(d, min(i), max(i)) for i in m]
return m |
def cit(ispace0, ispace1):
'\n The Common IterationIntervals of two IterationSpaces.\n '
found = []
for (it0, it1) in zip(ispace0.itintervals, ispace1.itintervals):
if (it0 == it1):
found.append(it0)
else:
break
return tuple(found) | 1,056,912,240,640,778,400 | The Common IterationIntervals of two IterationSpaces. | devito/passes/clusters/aliases.py | cit | ccuetom/devito | python | def cit(ispace0, ispace1):
'\n \n '
found = []
for (it0, it1) in zip(ispace0.itintervals, ispace1.itintervals):
if (it0 == it1):
found.append(it0)
else:
break
return tuple(found) |
def maybe_coeff_key(grid, expr):
'\n True if `expr` could be the coefficient of an FD derivative, False otherwise.\n '
if expr.is_Number:
return True
indexeds = [i for i in expr.free_symbols if i.is_Indexed]
return any(((not (set(grid.dimensions) <= set(i.function.dimensions))) for i in in... | -365,349,668,373,705,540 | True if `expr` could be the coefficient of an FD derivative, False otherwise. | devito/passes/clusters/aliases.py | maybe_coeff_key | ccuetom/devito | python | def maybe_coeff_key(grid, expr):
'\n \n '
if expr.is_Number:
return True
indexeds = [i for i in expr.free_symbols if i.is_Indexed]
return any(((not (set(grid.dimensions) <= set(i.function.dimensions))) for i in indexeds)) |
def wset(exprs):
'\n Extract the working set out of a set of equations.\n '
return {i.function for i in flatten([e.free_symbols for e in as_tuple(exprs)]) if i.function.is_AbstractFunction} | 2,398,974,317,648,662,000 | Extract the working set out of a set of equations. | devito/passes/clusters/aliases.py | wset | ccuetom/devito | python | def wset(exprs):
'\n \n '
return {i.function for i in flatten([e.free_symbols for e in as_tuple(exprs)]) if i.function.is_AbstractFunction} |
def potential_max_deriv_order(exprs):
'\n The maximum FD derivative order in a list of expressions.\n '
nadds = (lambda e: ((int(e.is_Add) + max([nadds(a) for a in e.args], default=0)) if (not q_leaf(e)) else 0))
return max([nadds(e) for e in exprs], default=0) | -7,012,757,534,154,908,000 | The maximum FD derivative order in a list of expressions. | devito/passes/clusters/aliases.py | potential_max_deriv_order | ccuetom/devito | python | def potential_max_deriv_order(exprs):
'\n \n '
nadds = (lambda e: ((int(e.is_Add) + max([nadds(a) for a in e.args], default=0)) if (not q_leaf(e)) else 0))
return max([nadds(e) for e in exprs], default=0) |
def search_potential_deriv(expr, n, c=0):
'\n Retrieve the expressions at depth `n` that potentially stem from FD derivatives.\n '
assert (n >= c >= 0)
if (q_leaf(expr) or expr.is_Pow):
return []
elif expr.is_Mul:
if (c == n):
return [expr]
else:
ret... | -8,169,505,188,614,247,000 | Retrieve the expressions at depth `n` that potentially stem from FD derivatives. | devito/passes/clusters/aliases.py | search_potential_deriv | ccuetom/devito | python | def search_potential_deriv(expr, n, c=0):
'\n \n '
assert (n >= c >= 0)
if (q_leaf(expr) or expr.is_Pow):
return []
elif expr.is_Mul:
if (c == n):
return [expr]
else:
return flatten([search_potential_deriv(a, n, (c + 1)) for a in expr.args])
else... |
def translated(self, other):
'\n True if ``self`` is translated w.r.t. ``other``, False otherwise.\n\n Examples\n --------\n Two candidates are translated if their bases are the same and\n their offsets are pairwise translated.\n\n c := A[i,j] op A[i,j+1] -> Toffsets = ... | -8,815,069,943,959,899,000 | True if ``self`` is translated w.r.t. ``other``, False otherwise.
Examples
--------
Two candidates are translated if their bases are the same and
their offsets are pairwise translated.
c := A[i,j] op A[i,j+1] -> Toffsets = {i: [0,0], j: [0,1]}
u := A[i+1,j] op A[i+1,j+1] -> Toffsets = {i: [1,1], j: [0,1]}
Then `... | devito/passes/clusters/aliases.py | translated | ccuetom/devito | python | def translated(self, other):
'\n True if ``self`` is translated w.r.t. ``other``, False otherwise.\n\n Examples\n --------\n Two candidates are translated if their bases are the same and\n their offsets are pairwise translated.\n\n c := A[i,j] op A[i,j+1] -> Toffsets = ... |
def find_rotation_distance(self, d, interval):
'\n The distance from the Group pivot of a rotation along Dimension ``d`` that\n can safely iterate over the ``interval``.\n '
assert (d is interval.dim)
for (rotation, distance) in self._pivot_legal_rotations[d]:
if (rotation.union... | -2,571,492,589,286,373,400 | The distance from the Group pivot of a rotation along Dimension ``d`` that
can safely iterate over the ``interval``. | devito/passes/clusters/aliases.py | find_rotation_distance | ccuetom/devito | python | def find_rotation_distance(self, d, interval):
'\n The distance from the Group pivot of a rotation along Dimension ``d`` that\n can safely iterate over the ``interval``.\n '
assert (d is interval.dim)
for (rotation, distance) in self._pivot_legal_rotations[d]:
if (rotation.union... |
@cached_property
def diameter(self):
'\n The size of the iteration space required to evaluate all aliasing expressions\n in this Group, along each Dimension.\n '
ret = defaultdict(int)
for i in self.Toffsets:
for (d, v) in i:
try:
distance = int((max(... | 2,070,731,786,563,981,600 | The size of the iteration space required to evaluate all aliasing expressions
in this Group, along each Dimension. | devito/passes/clusters/aliases.py | diameter | ccuetom/devito | python | @cached_property
def diameter(self):
'\n The size of the iteration space required to evaluate all aliasing expressions\n in this Group, along each Dimension.\n '
ret = defaultdict(int)
for i in self.Toffsets:
for (d, v) in i:
try:
distance = int((max(... |
@property
def pivot(self):
'\n A deterministically chosen Candidate for this Group.\n '
return self[0] | 4,219,656,167,425,094,700 | A deterministically chosen Candidate for this Group. | devito/passes/clusters/aliases.py | pivot | ccuetom/devito | python | @property
def pivot(self):
'\n \n '
return self[0] |
@cached_property
def _pivot_legal_rotations(self):
'\n All legal rotations along each Dimension for the Group pivot.\n '
ret = {}
for (d, (maxd, mini)) in self._pivot_legal_shifts.items():
v = (mini - maxd)
m = make_rotations_table(d, v)
distances = []
for rotat... | -5,917,378,959,376,706,000 | All legal rotations along each Dimension for the Group pivot. | devito/passes/clusters/aliases.py | _pivot_legal_rotations | ccuetom/devito | python | @cached_property
def _pivot_legal_rotations(self):
'\n \n '
ret = {}
for (d, (maxd, mini)) in self._pivot_legal_shifts.items():
v = (mini - maxd)
m = make_rotations_table(d, v)
distances = []
for rotation in m:
distance = (maxd - rotation.lower)
... |
@cached_property
def _pivot_min_intervals(self):
'\n The minimum Interval along each Dimension such that by evaluating the\n pivot, all Candidates are evaluated too.\n '
c = self.pivot
ret = defaultdict((lambda : [np.inf, (- np.inf)]))
for i in self:
distance = [o.distance(v... | -5,017,529,699,877,890,000 | The minimum Interval along each Dimension such that by evaluating the
pivot, all Candidates are evaluated too. | devito/passes/clusters/aliases.py | _pivot_min_intervals | ccuetom/devito | python | @cached_property
def _pivot_min_intervals(self):
'\n The minimum Interval along each Dimension such that by evaluating the\n pivot, all Candidates are evaluated too.\n '
c = self.pivot
ret = defaultdict((lambda : [np.inf, (- np.inf)]))
for i in self:
distance = [o.distance(v... |
@cached_property
def _pivot_legal_shifts(self):
'\n The max decrement and min increment along each Dimension such that the\n Group pivot does not go OOB.\n '
c = self.pivot
ret = defaultdict((lambda : ((- np.inf), np.inf)))
for (i, ofs) in zip(c.indexeds, c.offsets):
f = i.f... | 4,179,159,710,888,336,400 | The max decrement and min increment along each Dimension such that the
Group pivot does not go OOB. | devito/passes/clusters/aliases.py | _pivot_legal_shifts | ccuetom/devito | python | @cached_property
def _pivot_legal_shifts(self):
'\n The max decrement and min increment along each Dimension such that the\n Group pivot does not go OOB.\n '
c = self.pivot
ret = defaultdict((lambda : ((- np.inf), np.inf)))
for (i, ofs) in zip(c.indexeds, c.offsets):
f = i.f... |
def merge_dicts(a, b):
'\nMerge two dictionaries. If there is a key collision, `b` overrides `a`.\n :param a: Dictionary of default settings\n :param b: Dictionary of override settings\n :rtype : dict\n '
try:
a.update(b)
except Exception as exc:
raise SystemError('Failed to merg... | -2,853,009,548,386,194,400 | Merge two dictionaries. If there is a key collision, `b` overrides `a`.
:param a: Dictionary of default settings
:param b: Dictionary of override settings
:rtype : dict | MasterScripts/systemprep-linuxmaster.py | merge_dicts | plus3it/SystemPrep | python | def merge_dicts(a, b):
'\nMerge two dictionaries. If there is a key collision, `b` overrides `a`.\n :param a: Dictionary of default settings\n :param b: Dictionary of override settings\n :rtype : dict\n '
try:
a.update(b)
except Exception as exc:
raise SystemError('Failed to merg... |
def get_scripts_to_execute(system, workingdir, **scriptparams):
"\nReturns an array of hashtables. Each hashtable has two keys: 'ScriptUrl' and 'Parameters'.\n'ScriptSource' is the path to the script to be executed. Only supports http/s sources currently.\n'Parameters' is a hashtable of parameters to pass to the sc... | -2,843,389,748,017,365,000 | Returns an array of hashtables. Each hashtable has two keys: 'ScriptUrl' and 'Parameters'.
'ScriptSource' is the path to the script to be executed. Only supports http/s sources currently.
'Parameters' is a hashtable of parameters to pass to the script.
Use `merge_dicts({yourdict}, scriptparams)` to merge command line p... | MasterScripts/systemprep-linuxmaster.py | get_scripts_to_execute | plus3it/SystemPrep | python | def get_scripts_to_execute(system, workingdir, **scriptparams):
"\nReturns an array of hashtables. Each hashtable has two keys: 'ScriptUrl' and 'Parameters'.\n'ScriptSource' is the path to the script to be executed. Only supports http/s sources currently.\n'Parameters' is a hashtable of parameters to pass to the sc... |
def create_working_dir(basedir, dirprefix):
'\nCreates a directory in `basedir` with a prefix of `dirprefix`.\nThe directory will have a random 5 character string appended to `dirprefix`.\nReturns the path to the working directory.\n :rtype : str\n :param basedir: str, the directory in which to create the wor... | 3,796,915,593,746,301,000 | Creates a directory in `basedir` with a prefix of `dirprefix`.
The directory will have a random 5 character string appended to `dirprefix`.
Returns the path to the working directory.
:rtype : str
:param basedir: str, the directory in which to create the working directory
:param dirprefix: str, prefix to pre... | MasterScripts/systemprep-linuxmaster.py | create_working_dir | plus3it/SystemPrep | python | def create_working_dir(basedir, dirprefix):
'\nCreates a directory in `basedir` with a prefix of `dirprefix`.\nThe directory will have a random 5 character string appended to `dirprefix`.\nReturns the path to the working directory.\n :rtype : str\n :param basedir: str, the directory in which to create the wor... |
def get_system_params(system):
'\nReturns a dictionary of OS platform-specific parameters.\n :param system: str, the system type as returned by `platform.system`\n :rtype : dict\n '
a = {}
workingdirprefix = 'systemprep-'
if ('Linux' in system):
tempdir = '/usr/tmp/'
a['pathsepa... | 123,622,459,867,249,700 | Returns a dictionary of OS platform-specific parameters.
:param system: str, the system type as returned by `platform.system`
:rtype : dict | MasterScripts/systemprep-linuxmaster.py | get_system_params | plus3it/SystemPrep | python | def get_system_params(system):
'\nReturns a dictionary of OS platform-specific parameters.\n :param system: str, the system type as returned by `platform.system`\n :rtype : dict\n '
a = {}
workingdirprefix = 'systemprep-'
if ('Linux' in system):
tempdir = '/usr/tmp/'
a['pathsepa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.