query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
The location of the Certfificate Authority data used for SSL, or None if SSL is not enabled | def ssl_ca_location(self):
if "ssl.ca.location" not in self._config:
return None
return self._config["ssl.ca.location"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetCurrentCertsFile():\n return _ca_certs_file",
"def ssl_cert(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"ssl_cert\")",
"def ssl_cert(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"ssl_cert\")",
"def ssl_cert(self) -> pulumi.Output[Optional[str]]:\... | [
"0.6884588",
"0.68621266",
"0.68621266",
"0.6809603",
"0.6775001",
"0.6740012",
"0.67256224",
"0.6712799",
"0.66639364",
"0.6536369",
"0.6523023",
"0.6402659",
"0.637292",
"0.63256025",
"0.63256025",
"0.63170224",
"0.63170224",
"0.6314884",
"0.62249255",
"0.62202287",
"0.6220... | 0.76125526 | 0 |
The OpenID Connect token endpoint, or None if OpenID Connect is not enabled | def token_endpoint(self):
return self._config.get("sasl.oauthbearer.token.endpoint.url") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_endpoint_auth_method(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"token_endpoint_auth_method\")",
"def token_endpoint_auth_method(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"token_endpoint_auth_method\")",
"def idp_auth_url(self) -> Optional[pu... | [
"0.62698036",
"0.62698036",
"0.6251858",
"0.6251858",
"0.62502456",
"0.6183121",
"0.6183121",
"0.6168679",
"0.6167693",
"0.6146432",
"0.61183435",
"0.60951877",
"0.6066937",
"0.6025321",
"0.5955616",
"0.5917081",
"0.5915046",
"0.59070385",
"0.5870881",
"0.5838113",
"0.5815337... | 0.70855206 | 0 |
Configures Auth instances from a configuration file. | def load_auth(config_file=None):
if config_file is None:
config_file = configure.get_config_path("auth")
# If finding data automatically, as a fallback, look to see if the auth data is in the main
# config in the old style.
if not os.path.exists(config_file):
main_config_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure(self):\n configurations = config.Configurations()\n self.credentials = configurations.credentials\n self.config = configurations.config",
"def __init__(self, config_file='/etc/sfa/ldap_config.py'):\n\n try:\n execfile(config_file, self.__dict__)\n\n ... | [
"0.6704728",
"0.6324391",
"0.6319692",
"0.62837356",
"0.62284666",
"0.6190182",
"0.61687666",
"0.6081509",
"0.6051908",
"0.60208863",
"0.59785676",
"0.5957786",
"0.59393996",
"0.5932107",
"0.5931581",
"0.5929876",
"0.5911904",
"0.5908931",
"0.58969307",
"0.5880949",
"0.588067... | 0.65480316 | 1 |
Remove auth data from a general configuration file. This can be needed when updating auth data which was read from the general config for backwards compatibility, but is then written out to the correct new location in a separate auth config, as is now proper. With no further action, this would leave a vestigial copy fr... | def prune_outdated_auth(config_file=None):
if config_file is None:
config_file = configure.get_config_path("general")
if not os.path.exists(config_file):
return # nothing to do!
with open(config_file, "r") as f:
try:
config_data = toml.loads(f.read())
except Exce... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore_auth_configuration(self, path):\n raise NotImplementedError()",
"def update_auth_section(self):\n rconfig = configparser.RawConfigParser()\n rconfig.read(self.conf_file)\n if not rconfig.has_section(\"auth\"):\n rconfig.add_section(\"auth\")\n if env.get(... | [
"0.612024",
"0.5746264",
"0.5536264",
"0.5530514",
"0.54984313",
"0.53867626",
"0.5357205",
"0.5340198",
"0.52513176",
"0.52348787",
"0.51566756",
"0.50880826",
"0.5085137",
"0.5050434",
"0.5039016",
"0.50383246",
"0.5033532",
"0.5024654",
"0.5006828",
"0.4999748",
"0.4994603... | 0.7869498 | 0 |
Selects the most appropriate credential to use when attempting to contact the given host. | def select_matching_auth(creds, hostname, username=None):
matches = []
inexact_matches = []
exact_hostname_match = False
inexact_hostname_match = False
target_host, target_port = _decompose_host_port(hostname)
default_port = "9092"
for cred in creds:
maybe_exact_hostname_match = Fa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_credential(host,\n credential_file=DEFAULT_CREDENTIAL_FILE,\n globus_credential_file=DEFAULT_GLOBUS_CREDENTIAL_FILE,\n config_file=DEFAULT_CONFIG_FILE,\n requested_scope=None,\n force_scope_lookup=False,\n ... | [
"0.5930711",
"0.574803",
"0.56027275",
"0.5567474",
"0.55573434",
"0.5536343",
"0.5531118",
"0.5495463",
"0.5480603",
"0.5462564",
"0.54356015",
"0.54255515",
"0.5423218",
"0.5408008",
"0.54029375",
"0.53719956",
"0.5333271",
"0.5331265",
"0.5285259",
"0.5271696",
"0.52467304... | 0.6118554 | 0 |
Ensure that a value entered for a hostname looks plausible. The user is supposed to enter a hostname, possibly with a port, not a URL. | def _validate_hostname(input: str):
if len(input) == 0:
return input
name_re = re.compile(r"^(kafka://)?(([^[:/]+|\[[^\]/]+\])(:[0-9]*)?)$")
match = name_re.match(input)
if match is None:
raise RuntimeError("Unable to parse hostname. "
"Please enter either `hos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_host(host):\n # FIXME: not convinced that pinging the machine is a good choice. it's definitely not needed for localhost\n route = os.system(\"ping -t 2 -c 1 \" + host)\n\n if route != 0:\n raise errs.IpError(host, 'Could not ping host: %s' % (host))\n\n try:\n # FIXME: i don... | [
"0.70310473",
"0.6822072",
"0.6649627",
"0.6603979",
"0.6565603",
"0.6512103",
"0.6452663",
"0.6442177",
"0.6421514",
"0.6416308",
"0.6416308",
"0.6381516",
"0.63730025",
"0.636886",
"0.6336232",
"0.63357234",
"0.6299489",
"0.6297523",
"0.6278856",
"0.62540066",
"0.6244444",
... | 0.7518875 | 0 |
Import a credential from a CSV file or obtain it interactively from the user. | def read_new_credential(csv_file=None):
options = {}
if csv_file is None:
logger.info("Generating configuration with user-specified username + password")
username = input("Username: ")
if len(username) == 0:
raise RuntimeError("Username may not be empty")
password = g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_credentials(password, cred_file):\n\t\tself.exchanges = decrypt(password, cred_file)",
"def load_credentials(cred=\"credentials_prod.json\"):\n if isinstance(cred, dict):\n # Easy way to handle if a function was handed valid credentials\n pass\n elif isinstance(cred, str):\n ... | [
"0.66629636",
"0.6209288",
"0.60303247",
"0.5946111",
"0.5840704",
"0.58072597",
"0.5797156",
"0.57948035",
"0.577422",
"0.57634205",
"0.5709083",
"0.56366104",
"0.55564916",
"0.55342096",
"0.5492628",
"0.54911834",
"0.5452173",
"0.54449195",
"0.54152566",
"0.5412418",
"0.535... | 0.6541092 | 1 |
Write configuration file for the set of credentials. Creates containing directories as needed. | def write_auth_data(config_file, credentials):
cred_list = []
for cred in credentials:
cred_dict = {"username": cred.username, "password": cred.password,
"protocol": cred.protocol, "mechanism": cred.mechanism,
"token_endpoint": cred.token_endpoint}
if le... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_configuration_file(self):\n\n with open(self.config_path, \"w+\") as f_config:\n\n f_config.write(get_configuration_file_form())",
"def write_config(self, config_file):\n \n # write root paths\n \n # write reference data\n \n # write tool path... | [
"0.69129884",
"0.68762213",
"0.6681579",
"0.6519187",
"0.65150166",
"0.64237005",
"0.64078325",
"0.6400456",
"0.63955426",
"0.6388525",
"0.6334197",
"0.62566215",
"0.6254123",
"0.624691",
"0.6233926",
"0.62172824",
"0.6188391",
"0.6178545",
"0.6171475",
"0.61619025",
"0.61430... | 0.74484915 | 0 |
Create an error message for an ambiguous request to delete a credential. This function should only be used by `delete_credential`. | def _construct_ambiguous_deletion_message(username, hostname, matches):
err = f"Ambiguous credentials found for username '{username}'"
if hostname is not None:
err += f" with hostname '{hostname}'\n"
else:
err += " with no hostname specified\n"
err += "Matched credentials:"
for match... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deleteCredential(self, request, context):\n context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n context.set_details('Method not implemented!')\n raise NotImplementedError('Method not implemented!')",
"def error_failed_to_authorize_with_provided_credentials():\n return \"Failed to authen... | [
"0.62939024",
"0.60628563",
"0.5613122",
"0.55833787",
"0.557767",
"0.5532869",
"0.5421176",
"0.5388011",
"0.53861856",
"0.5338405",
"0.5325687",
"0.5322021",
"0.5319082",
"0.52712053",
"0.5238747",
"0.5223408",
"0.5215155",
"0.5201015",
"0.5197187",
"0.51944166",
"0.51897997... | 0.6857929 | 0 |
Test API can create a pressure (POST request) | def test_pressure_creation(self):
res = self.client().post('/pressures/', data = self.pressure)
self.assertEqual(res.status_code, 201)
self.assertIn('120', str(res.data)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_perturb_sensor_post(self):\n Parameters = Parameters1()\n response = self.client.open('/perturb/sensor',\n method='POST',\n data=json.dumps(Parameters),\n content_type='application/json')... | [
"0.72482127",
"0.7001108",
"0.68912625",
"0.68726945",
"0.68246543",
"0.65841526",
"0.656429",
"0.6521714",
"0.65200734",
"0.6506625",
"0.6475035",
"0.64728487",
"0.6467436",
"0.6462714",
"0.6462203",
"0.64256227",
"0.6421555",
"0.6412388",
"0.6390877",
"0.63668257",
"0.63575... | 0.843355 | 0 |
Test API can get a pressure (GET request). | def test_api_can_get_all_pressures(self):
res = self.client().post('/pressures/', data=self.pressure)
self.assertEqual(res.status_code, 201)
res = self.client().get('/pressures/')
self.assertEqual(res.status_code, 200)
self.assertIn('120', str(res.data)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_can_get_pressure_by_id(self):\n rv = self.client().post('/pressures/', data=self.pressure)\n self.assertEqual(rv.status_code, 201)\n result_in_json = json.loads(rv.data.decode('utf-8').replace(\"'\", \"\\\"\"))\n result = self.client().get(\n '/pressures/{}'.form... | [
"0.74287456",
"0.69035894",
"0.679271",
"0.6711379",
"0.66008884",
"0.64996874",
"0.6453763",
"0.63089716",
"0.62877476",
"0.62439483",
"0.623059",
"0.6225948",
"0.6188776",
"0.6182968",
"0.6158279",
"0.61350673",
"0.6077457",
"0.6061102",
"0.604492",
"0.60390466",
"0.6008962... | 0.72923553 | 1 |
Test API can get a single pressure by using it's id. | def test_api_can_get_pressure_by_id(self):
rv = self.client().post('/pressures/', data=self.pressure)
self.assertEqual(rv.status_code, 201)
result_in_json = json.loads(rv.data.decode('utf-8').replace("'", "\""))
result = self.client().get(
'/pressures/{}'.format(result_in_jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_poets_id_get(self):\n pass",
"def test_get_pet_by_id(self):\n response = self.client.open(\n '/pet/{petId}'.format(pet_id=789),\n method='GET')\n self.assert200(response,\n 'Response body is : ' + response.data.decode('utf-8'))",
"def ge... | [
"0.642623",
"0.6308812",
"0.6215591",
"0.6155548",
"0.61293644",
"0.610299",
"0.6014823",
"0.59397763",
"0.58807755",
"0.58655787",
"0.5853093",
"0.581338",
"0.58096683",
"0.5795482",
"0.5795382",
"0.5739713",
"0.5729927",
"0.5722693",
"0.57166934",
"0.5714362",
"0.57046396",... | 0.8527266 | 0 |
Parses incoming filters paramters and converts them to Django usable operations if valid. BE AWARE! WILL NOT WORK UNLESS POSITIONAL ARGUMENT 3 IS FILTERS! | def parse_filters(func, *args, **kwargs):
request = args[1]
filters = request.query_params.get("filters", None)
if not filters:
return func(*args, **kwargs)
cleaned_filters = {}
try:
filters = json.loads(filters)
for field, operations in filters.items():
for oper... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_filters(func, *args, **kwargs):\n request = args[1]\n filters = request.query_params.get('filters', None)\n\n if not filters:\n return func(*args, **kwargs)\n cleaned_filters = {}\n try:\n filters = json.loads(filters)\n for field, operations in filters.items():\n ... | [
"0.73258877",
"0.71500814",
"0.6698585",
"0.65647",
"0.6509243",
"0.64743567",
"0.6441214",
"0.6356844",
"0.631889",
"0.6315862",
"0.6313116",
"0.62791544",
"0.62715364",
"0.6261945",
"0.62134725",
"0.61704206",
"0.61687416",
"0.61376774",
"0.6118783",
"0.60999584",
"0.609721... | 0.7290582 | 1 |
Find the vector of this word. Maybe it is in the word2vec file, maybe it's in the unknown word2vec list. | def find_word(self, word):
# word out of w2v
if word not in self.w2v_idx:
raise ValueError("word not in this word2vec: %s" % word)
index = self.w2v_idx[word]
if index >= self.word_len:
vector = self.w2v_out[index - self.word_len]
else:
self.w2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vector(self, word):\n\n if word in self.glove.stoi:\n return self.glove.vectors[self.glove.stoi[word]]\n else:\n return None",
"def get_vector(self, word):\n string = \"SELECT * FROM Vectors WHERE name=?\"\n params = (word,)\n self.cur.execute(stri... | [
"0.7717814",
"0.7331635",
"0.69860935",
"0.6790841",
"0.67893416",
"0.6708088",
"0.6659628",
"0.66121066",
"0.64376265",
"0.6409673",
"0.6371729",
"0.63636094",
"0.63442683",
"0.63326824",
"0.6299113",
"0.62941676",
"0.62788874",
"0.6259307",
"0.6259093",
"0.62053025",
"0.619... | 0.8519247 | 0 |
Add the unknown word into the total Word2Vec | def add_word(self, word, vector=None, low=-2., high=2.):
if word not in self.w2v_idx:
self.w2v_idx[word] = len(self.w2v_idx)
if vector is None:
vector = np.random.uniform(low=low, high=high, size=(self.w2v_dim,))
self.w2v_out.append(np.asarray(vector, dtype=np... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_word(self, word):\n if not word in self._word2idx.keys():\n self._word2idx[word] = self.vocab_size\n self.freqs[word] = 0\n self._idx2word[self.vocab_size] = word\n self.vocab_size += 1\n self.freqs[word] += 1",
"def add_word(self, word):\n ... | [
"0.70585805",
"0.6944788",
"0.6944788",
"0.6628118",
"0.6593899",
"0.6544222",
"0.6542644",
"0.6514817",
"0.65063685",
"0.64708817",
"0.6446535",
"0.6387043",
"0.63297486",
"0.6301024",
"0.62743694",
"0.6266994",
"0.6234436",
"0.62220246",
"0.6165115",
"0.6127538",
"0.6126683... | 0.7201207 | 0 |
Split dataset into stratified cross validation folds. | def stratified_kfold_cross_validation(X, y, n_splits=5):
#Define variables
X_train_folds = []
X_test_folds = []
#Create dictionary
y_dict = myutils.group_by(y)
#Split data
folds = [[] for _ in range(n_splits)]
for category in y_dict.keys():
index = y_dict[category]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stratified_kfold_cross_validation(X, y, n_splits=5):\r\n indices = [x for x in range(0, len(X))]\r\n labels = []\r\n uniq_feat = []\r\n\r\n for idx,clss in enumerate(y):\r\n\r\n if clss in uniq_feat:\r\n labels[uniq_feat.index(clss)].append(indices[idx])\r\n else:\r\n ... | [
"0.750117",
"0.74758494",
"0.73906475",
"0.72293526",
"0.71832126",
"0.6985866",
"0.6928096",
"0.691922",
"0.68925565",
"0.6861359",
"0.68603945",
"0.6852634",
"0.6819977",
"0.68109214",
"0.6796031",
"0.6794697",
"0.6789548",
"0.67790073",
"0.67774254",
"0.6762519",
"0.675980... | 0.75839454 | 0 |
Runs everyday, queries db for open games last modified more than 72 hours ago and sends the game owner a reminder email | def get(self):
three_days_ago = datetime.now() - timedelta(days=3)
app_name = app_identity.get_application_id()
subject = "You have had an open game for 3 days now!"
open_games = Game.query(Game.over == False).\
filter(Game.modified < three_days_ago)
for game in ope... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify_users_of_reminders():\n\n #Get current date into dd/mm/YYYY format.\n now = datetime.datetime.now()\n todays_date = now.strftime(\"%d/%m/%Y\")\n\n #Get current time and convert it to hh:mm.\n todays_time = now.strftime(\"%H:%M\")\n print(todays_time)\n\n ... | [
"0.6466087",
"0.6412976",
"0.6051204",
"0.598653",
"0.58931947",
"0.58606035",
"0.5850108",
"0.57957137",
"0.57444435",
"0.57363665",
"0.5674769",
"0.5669591",
"0.5596074",
"0.55955476",
"0.55537426",
"0.553247",
"0.5522987",
"0.5517364",
"0.5510192",
"0.5508191",
"0.54503566... | 0.65476453 | 0 |
Creates a releaseinfo.py file in the current directory | def _create_releaseinfo_file(projname, relinfo_str):
dirs = projname.split('.')
os.chdir(os.path.join(*dirs))
print 'updating releaseinfo.py for %s' % projname
with open('releaseinfo.py', 'w') as f:
f.write(relinfo_str) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_version_file(version='unknown', gitmeta=''):\n\tfname = join(dirname(abspath(__file__)), 'MHLogin', '_version.py')\n\tf = open(fname, 'wb')\n\tf.write(VERSION_PY % {'version': version, 'gitmeta': gitmeta, })\n\tf.close()",
"def _rollback_releaseinfo_file(projname):\n dirs = projname.split('.')\n ... | [
"0.6512121",
"0.63904816",
"0.6362495",
"0.6081164",
"0.59570134",
"0.5926062",
"0.58887976",
"0.5881928",
"0.5854506",
"0.58487445",
"0.5800809",
"0.5784672",
"0.5712992",
"0.5706777",
"0.570404",
"0.5701571",
"0.5690561",
"0.5643435",
"0.562145",
"0.5621388",
"0.56088585",
... | 0.84531784 | 0 |
Build an sdist out of a develop egg and place it in destdir. | def _build_sdist(projdir, destdir, version):
startdir = os.getcwd()
try:
os.chdir(projdir)
# clean up any old builds
cleanup('build')
_build_dist('sdist', destdir)
cleanup('build')
if sys.platform.startswith('win'):
os.chdir(destdir)
# unzi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy():\n put(os.path.join('dist', get_egg_name()), remote_egg_dir)",
"def remote_build(srcdirs=(), destdir=None, build_type='bdist_egg',\n py=None, remote_dir=None, debug=False, **kwargs):\n locdistbld = os.path.join(os.path.dirname(__file__), 'locdistbld.py')\n pkgs = []\n if re... | [
"0.69767106",
"0.678387",
"0.67564416",
"0.66583306",
"0.64960986",
"0.637508",
"0.6331295",
"0.6304944",
"0.62912005",
"0.62859756",
"0.61548775",
"0.6043222",
"0.59519935",
"0.5858749",
"0.5846366",
"0.5844939",
"0.58436114",
"0.5820476",
"0.5817725",
"0.57702756",
"0.57681... | 0.77315515 | 0 |
Builds binary eggs on the specified hosts and places them in destdir. If 'localhost' is an entry in hosts, then it builds a binary egg on the current host as well. | def _build_bdist_eggs(projdirs, destdir, hosts, configfile):
startdir = os.getcwd()
hostlist = hosts[:]
try:
if 'localhost' in hostlist:
hostlist.remove('localhost')
for pdir in projdirs:
os.chdir(pdir)
_build_dist('bdist_egg', destdir)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_build(srcdirs=(), destdir=None, build_type='bdist_egg',\n py=None, remote_dir=None, debug=False, **kwargs):\n locdistbld = os.path.join(os.path.dirname(__file__), 'locdistbld.py')\n pkgs = []\n if remote_dir is None:\n remote_dir = get_tmp_user_dir()\n clean_remote... | [
"0.6238835",
"0.5875015",
"0.5714724",
"0.5620576",
"0.5450062",
"0.5448558",
"0.5424786",
"0.5312747",
"0.5267877",
"0.5078658",
"0.50773376",
"0.5064283",
"0.5032138",
"0.5023566",
"0.50218993",
"0.4996115",
"0.49823824",
"0.49131536",
"0.48724392",
"0.48721027",
"0.4872099... | 0.82650656 | 0 |
Create an OpenMDAO release, placing the following files in the | def make_release():
parser = OptionParser()
parser.add_option("-d", "--destination", action="store", type="string",
dest="destdir",
help="directory where distributions and docs will be placed")
parser.add_option("-v", "--version", action="store", type="string",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_release(ctx):\n # Get the head of master\n r = _get_repo()\n b = r.get_branch(branch=\"master\")\n head = b.commit\n\n faasm_ver = get_faasm_version()\n\n # Create a tag from the head\n tag_name = _tag_name(faasm_ver)\n r.create_git_tag(\n tag_name,\n \"Release {}\\... | [
"0.6014018",
"0.58103186",
"0.5775766",
"0.5753851",
"0.5743276",
"0.56478643",
"0.55958784",
"0.5575745",
"0.55268115",
"0.5507612",
"0.5439751",
"0.54387665",
"0.5391264",
"0.53819746",
"0.5362042",
"0.53209096",
"0.5317027",
"0.5299399",
"0.5298273",
"0.5285269",
"0.526721... | 0.6427126 | 0 |
Auxiliary method to raise an evaluation error in case of an index error while reading files. | def _raise_index_error(is_gt, tracker, seq):
if is_gt:
err = 'Cannot load gt data from sequence %s, because there are not enough ' \
'columns in the data.' % seq
raise TrackEvalException(err)
else:
err = 'Cannot load tracker data from tracker %s, seq... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_error(self, index: int) -> None:\n ...",
"def test_no_such_file(self):\n with self.assertRaises(IOError):\n analyze_text('foobar')",
"def raise_(err):\n raise err",
"def test_no_such_file(self):\n with self.assertRaises(IOError):\n analyze_text('... | [
"0.6168315",
"0.60770035",
"0.6029341",
"0.59954405",
"0.59954405",
"0.5942611",
"0.5914754",
"0.5885346",
"0.58637875",
"0.58062196",
"0.57895684",
"0.57815295",
"0.5773447",
"0.5728606",
"0.5723523",
"0.5687256",
"0.567707",
"0.56704026",
"0.56637174",
"0.5657337",
"0.56546... | 0.6780191 | 0 |
List the members of a team | def list_members(self, id):
request = self.request_builder('orgs.teams.list_members', id=id)
return self._get_result(request) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def team_list(request):\n template = loader.get_template('team/team_list.html')\n teams_list = Team.objects.all().order_by('name')\n\n if not request.user.is_authenticated:\n team = None\n else:\n team = request.user.profile.team\n\n paginator = Paginator(teams_list, 6)\n\n page = r... | [
"0.7188754",
"0.7145913",
"0.70410496",
"0.70051086",
"0.69053346",
"0.68181306",
"0.6786944",
"0.6712163",
"0.6710687",
"0.6619748",
"0.65789735",
"0.65408576",
"0.65379936",
"0.65132767",
"0.6431039",
"0.6431039",
"0.6431039",
"0.6431039",
"0.64251184",
"0.6410753",
"0.6401... | 0.75728685 | 0 |
Determine if user is a member of a team | def is_member(self, id, user):
request = self.request_builder('orgs.teams.is_member',
id=id, user=user)
return self._bool(request) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_team_member(session, api, team, user):\n teams = session.get(\"teams\", {})\n # Check to see if their permissions are still valid\n if teams and team in teams and TimeUtils.get_local_timestamp() < teams[team][1]:\n return teams[team][0]\n\n is_member = api.is_member(team, user)\n logge... | [
"0.80844015",
"0.71652466",
"0.7164285",
"0.7150849",
"0.7101769",
"0.7052113",
"0.67211163",
"0.66610885",
"0.664107",
"0.653785",
"0.65341884",
"0.64677167",
"0.64353734",
"0.63973206",
"0.63720155",
"0.63440657",
"0.6314207",
"0.63026935",
"0.6294591",
"0.6277735",
"0.6274... | 0.749308 | 1 |
Remove a repo from the a team | def remove_repo(self, id, user, repo):
request = self.request_builder('orgs.teams.remove_repo',
id=id, user=user, repo=repo)
return self._delete(request) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(repo):\n print('Repo: %s' % repo)\n print('Deleted')",
"def _remove_repo(repo_name):\n\n package_manager = _get_package_manager()\n package_manager.remove_repo(repo_name)\n\n return 0",
"def delete_workteam(WorkteamName=None):\n pass",
"def remove_repo(self):\n if not self... | [
"0.7089107",
"0.6932535",
"0.66838586",
"0.66567355",
"0.6631975",
"0.6591195",
"0.6542043",
"0.65340984",
"0.6392823",
"0.63744247",
"0.6354063",
"0.63371956",
"0.63359624",
"0.623927",
"0.62292695",
"0.61867493",
"0.61362004",
"0.60500216",
"0.6034721",
"0.6033812",
"0.6028... | 0.71603775 | 0 |
Overwrite subtract operator to get proper subnet subtracting | def __sub__(self, other):
if not isinstance(other, Subnet):
raise ValueError("I'm sorry, but I'm afraid I cannot do that")
if other.subnet_mask < self.subnet_mask:
raise ValueError("We cannot subtract from a subnetmask greater than out own")
results = []
for su... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __sub__(self,that):\n #return self.__opExpand1(that, np.subtract)\n return self.__opExpand2(that,np.subtract)",
"def __sub__(self, tc):\n tc = TwosComplement(tc)._negative()\n return self.__add__(tc)",
"def __sub__(self, other):\n return self.__add__(other.__neg__())",
"def __sub__(sel... | [
"0.69527674",
"0.6884399",
"0.6870773",
"0.68457246",
"0.68457246",
"0.67716604",
"0.67666364",
"0.6739178",
"0.6728961",
"0.6662141",
"0.6662141",
"0.66361654",
"0.66361654",
"0.6631413",
"0.6586307",
"0.65414894",
"0.6540946",
"0.6516844",
"0.6514276",
"0.6478671",
"0.64786... | 0.7529475 | 0 |
Repeat RGB weights n times. Assumes channels are dim 1 | def cycle_rgb_weights(weights, n):
slices = [(c % 3, c % 3 + 1) for c in range(n)] # slice a:a+1 to keep dims
new_weights = torch.cat([
weights[:, a:b, :, :] for a, b in slices
], dim=1)
return new_weights | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repeat_weights(weights, shape):\n weights_extra = weights.unsqueeze(-1)\n return weights_extra.expand(\n weights.shape[0], shape[-1]).reshape(shape)",
"def th_repeat(a, repeats, axis=0):\r\n assert len(a.size()) == 1\r\n return th_flatten(torch.transpose(a.repeat(repeats, 1), 0, 1))",
"d... | [
"0.6374748",
"0.60212135",
"0.58721536",
"0.5869762",
"0.5835722",
"0.5795249",
"0.57622373",
"0.5736886",
"0.57052183",
"0.5666517",
"0.5664537",
"0.5622474",
"0.55914694",
"0.55251247",
"0.5513397",
"0.5473197",
"0.54574776",
"0.5438003",
"0.54269195",
"0.5405664",
"0.53899... | 0.7687817 | 0 |
Repeat RGB weights given a str eg. RRGGBB would repeat each weight twice | def select_rgb_weights(weights, rgb_str):
rgb_str = rgb_str.lower()
rgb_map = {'r': 0, 'g': 1, 'b': 2}
slices = [(rgb_map[c] % 3, rgb_map[c] % 3 + 1) for c in rgb_str] # slice a:a+1 to keep dims
new_weights = torch.cat([
weights[:, a:b, :, :] for a, b in slices
], dim=1)
return new_weig... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repeat(word, repetitions):\n return word * repetitions",
"def repeat_string_n_times(string, count):\r\n return string * int(count)",
"def _repeat_pattern(pattern, width):\n assert width % pattern.width == 0\n return operation.repeat(pattern, width // pattern.width)",
"def repeat_weights(w... | [
"0.61337143",
"0.5944186",
"0.5904703",
"0.5878521",
"0.5833297",
"0.5815843",
"0.5604224",
"0.54424137",
"0.5340248",
"0.53106266",
"0.5300203",
"0.52678365",
"0.5254725",
"0.5241443",
"0.52173877",
"0.5217197",
"0.5203125",
"0.51990014",
"0.5156333",
"0.51443666",
"0.514332... | 0.62627894 | 0 |
Decodes a list of string notations to specify blocks inside the network. | def decode(string_list):
assert isinstance(string_list, list)
blocks_args = []
for block_string in string_list:
blocks_args.append(BlockDecoder._decode_block_string(block_string))
return blocks_args | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_chain_list(in_bytes):\n bstrings = numpy.frombuffer(in_bytes, numpy.dtype('S' + str(mmtf.utils.constants.CHAIN_LEN)))\n return [s.decode(\"ascii\").strip(mmtf.utils.constants.NULL_BYTE) for s in bstrings]",
"def pos_decode(string,N=10000,bits=7,multipleblocks=1):\n B=1<<bits\n offset=0\n ... | [
"0.6532389",
"0.59615266",
"0.5941202",
"0.5887746",
"0.5884454",
"0.5847692",
"0.57718146",
"0.573386",
"0.57087296",
"0.57087296",
"0.56880933",
"0.56835675",
"0.567072",
"0.567072",
"0.5651005",
"0.5628563",
"0.55894774",
"0.5573804",
"0.5545652",
"0.5541269",
"0.5530137",... | 0.7376718 | 1 |
Encodes a list of BlockArgs to a list of strings. | def encode(blocks_args):
block_strings = []
for block in blocks_args:
block_strings.append(BlockDecoder._encode_block_string(block))
return block_strings | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _encode_list(source: list) -> bytes:\n result_data = b\"l\"\n\n for item in source:\n result_data += encode(item)\n\n return result_data + b\"e\"",
"def encode(self):\n instruction_iter = itertools.chain([self.opcode], self.args)\n\n elems = ARG_SEP.join(self.encode_arg(arg) for... | [
"0.65354687",
"0.6095794",
"0.6027289",
"0.5917603",
"0.5917603",
"0.5877845",
"0.5686191",
"0.5672005",
"0.565364",
"0.5651888",
"0.5651888",
"0.5650182",
"0.56054425",
"0.558944",
"0.5515357",
"0.551267",
"0.5461073",
"0.53443056",
"0.534077",
"0.5306197",
"0.5293529",
"0... | 0.803454 | 1 |
Map EfficientNet model name to parameter coefficients. | def efficientnet_params(model_name):
params_dict = {
# Coefficients: width,depth,res,dropout
'efficientnet-b0': (1.0, 1.0, 224, 0.2),
'efficientnet-b1': (1.0, 1.1, 240, 0.2),
'efficientnet-b2': (1.1, 1.2, 260, 0.3),
'efficientnet-b3': (1.2, 1.4, 300, 0.3),
'efficien... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def efficientnet_params(model_name):\n params_dict = {\n # Coefficients: width,depth,res,dropout\n 'efficientnet-b0': (1.0, 1.0, 224, 0.2),\n 'efficientnet-b1': (1.0, 1.1, 240, 0.2),\n 'efficientnet-b2': (1.1, 1.2, 260, 0.3),\n 'efficientnet-b3': (1.2, 1.4, 300, 0.3),\n ... | [
"0.67349935",
"0.65481",
"0.6298889",
"0.6029276",
"0.5877488",
"0.5838003",
"0.5772829",
"0.57585347",
"0.57317084",
"0.5586488",
"0.55061686",
"0.54998165",
"0.54380655",
"0.5390309",
"0.53836536",
"0.5380048",
"0.53270173",
"0.5286134",
"0.52834225",
"0.52834225",
"0.52664... | 0.68057907 | 0 |
Get the block args and global params for a given model | def get_model_params(model_name, override_params):
if model_name.startswith('efficientnet'):
w, d, s, p = efficientnet_params(model_name)
# note: all models have drop connect rate = 0.2
blocks_args, global_params = efficientnet(
width_coefficient=w, depth_coefficient=d, dropout_r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_args(self) -> Optional[Dict]:\n return self.config.get('model_args')",
"def get_model_params(model_name, override_params):\n if model_name.startswith('densenet'):\n g, n, s = densenet_params(model_name)\n blocks_args, global_params = densenet(\n model_name=model_name,... | [
"0.647321",
"0.63905954",
"0.63330173",
"0.6192361",
"0.61537105",
"0.60752064",
"0.6015871",
"0.6010679",
"0.5952791",
"0.594496",
"0.58709854",
"0.58622724",
"0.5844385",
"0.5813797",
"0.57864064",
"0.5779846",
"0.57340646",
"0.5715265",
"0.56647706",
"0.56625247",
"0.56614... | 0.648782 | 1 |
Validates model name. None that pretrained weights are only available for the first four models (efficientnetb{i} for i in 0,1,2,3) at the moment. | def _check_model_name_is_valid(cls, model_name, also_need_pretrained_weights=False):
num_models = 4 if also_need_pretrained_weights else 8
valid_models = ['efficientnet_b' + str(i) for i in range(num_models)]
if model_name.replace('-', '_') not in valid_models:
raise ValueError('mode... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_model_name_is_valid(cls, model_name):\n num_models = [18, 34, 50, 101, 152]\n valid_models = [\"resnet\" + str(i) for i in num_models]\n if model_name not in valid_models:\n raise ValueError(\"model_name should be one of: \" + \", \".join(valid_models))",
"def _has_regr... | [
"0.7480803",
"0.6713846",
"0.64817643",
"0.5982385",
"0.59515816",
"0.58537585",
"0.58234614",
"0.58203614",
"0.57960117",
"0.5762863",
"0.5756349",
"0.57415795",
"0.5703264",
"0.5677209",
"0.5667709",
"0.56596947",
"0.5655188",
"0.56512696",
"0.5650112",
"0.56487256",
"0.561... | 0.8350095 | 0 |
Processes XML File of Test Cases and returns a list of UniDBTest Case Objects, with DB Connections and Cursors, to validate | def getUniDBTestCasesFromXML(inputXMLTestCasesParametersFile,dbConnection,dbCursor):
#Get Case list
testCaseListXML = XML2TC.xml2TestCaseAdapter.getTestCasesFromXMLFile(inputXMLTestCasesParametersFile)
testCaseList = XML2TC.xml2TestCaseAdapter.createTestCaseListFromXML(testCaseListXML)
#Set UniDB Conn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(self):\n\n def parse_testcase(xml_object):\n testcase = xml_object\n\n tc_dict = {\n \"classname\": testcase.attrib.get(\"classname\", \"unknown\"),\n \"file\": testcase.attrib.get(\"file\", \"unknown\"),\n \"line\": int(testcase.a... | [
"0.64712363",
"0.6262641",
"0.6049944",
"0.6027748",
"0.59931934",
"0.5928944",
"0.5847664",
"0.57229286",
"0.5720782",
"0.57159287",
"0.5660837",
"0.56455463",
"0.56293434",
"0.5574203",
"0.5530631",
"0.5489631",
"0.5460908",
"0.54238164",
"0.54111964",
"0.5372455",
"0.53702... | 0.7609009 | 0 |
Processes Test Cases from DB and returns a list of UniDBTest Case Objects, with DB Connections and Cursors, to validate | def getUniDBTestCasesFromDB(dbSourceDataProcessor,rawListCasesFromDB,testNumber,validationTestMappingRules,dbConnection,dbCursor):
testCaseList = dbSourceDataProcessor.createTestCaseListFromSourceDB(rawListCasesFromDB,testNumber,validationTestMappingRules)
#Set UniDB Connection & Cursor (pointers) for each cas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getUniDBTestCasesFromXML(inputXMLTestCasesParametersFile,dbConnection,dbCursor):\n\n #Get Case list\n testCaseListXML = XML2TC.xml2TestCaseAdapter.getTestCasesFromXMLFile(inputXMLTestCasesParametersFile)\n testCaseList = XML2TC.xml2TestCaseAdapter.createTestCaseListFromXML(testCaseListXML)\n\n #Set... | [
"0.65590084",
"0.62336755",
"0.6062738",
"0.6036377",
"0.5875796",
"0.5872935",
"0.5851196",
"0.5822118",
"0.57414883",
"0.5729308",
"0.5670874",
"0.555788",
"0.5534498",
"0.5451873",
"0.54508466",
"0.54395294",
"0.54379934",
"0.54333305",
"0.5413898",
"0.5370801",
"0.5363758... | 0.73412824 | 0 |
Validates a list of UniDBTest Cases and Generates an detailed report of the results. | def validateTestCaseList(testCaseList,validationTestName,outputDirectory,testLogger):
#Local Variables
logger = testLogger
uniDBValidationTestName = validationTestName
resultsarray = []
validationTestStatistics = vreport.TestStatistics(uniDBValidationTestName) #Create Validation Test Class to Log Re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list(self):\n print \"\\nAvailable Test Cases\"\n print \"====================\"\n for case in self.cases:\n print case.__name__",
"def run_all(self):\n failures, errors = [], []\n\n # Run each test case registered with us and agglomerate the results.\n fo... | [
"0.6354653",
"0.63082033",
"0.61606604",
"0.6132475",
"0.6090486",
"0.6070821",
"0.5959125",
"0.5891635",
"0.58165413",
"0.5800044",
"0.5744734",
"0.5735355",
"0.5733495",
"0.5732588",
"0.5730258",
"0.5727521",
"0.5722816",
"0.5719103",
"0.56876266",
"0.56794024",
"0.5677925"... | 0.7313891 | 0 |
Processes test case lists from XML and automated (stored procedure+csv) sources. Also adds DB Connnection & Cursor information | def processValidationTests(scriptLogger,inputDirectory,outputDirectory,caseSourceType,dbHost,uniDBdbName,sourceDBName,dbuser,dbPassword,inputTestParameterSettingsXML):
#Local Variables
arrayXMLTestCaseFiles = []
logger = scriptLogger
# #Setup Test Logger
# logFileName='validation_script_nt2osm.log... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getUniDBTestCasesFromXML(inputXMLTestCasesParametersFile,dbConnection,dbCursor):\n\n #Get Case list\n testCaseListXML = XML2TC.xml2TestCaseAdapter.getTestCasesFromXMLFile(inputXMLTestCasesParametersFile)\n testCaseList = XML2TC.xml2TestCaseAdapter.createTestCaseListFromXML(testCaseListXML)\n\n #Set... | [
"0.6445611",
"0.6025335",
"0.59457076",
"0.58178484",
"0.56606394",
"0.55892634",
"0.55726695",
"0.5500507",
"0.5491461",
"0.5410647",
"0.5403208",
"0.53933823",
"0.5376502",
"0.5370745",
"0.53558815",
"0.5344173",
"0.5337646",
"0.53152466",
"0.52847284",
"0.5252677",
"0.5208... | 0.63766384 | 1 |
Tests a quest load fail due to semver mismatch | def test_quest_load_version_fail(testing_quest_page):
testing_quest_page.save()
# fetch the data
doc = testing_quest_page.doc_ref.get()
data = testing_quest_page.storage_model.parse_obj(doc.to_dict())
# mess with the version
data.version = str(VersionInfo.parse(data.version).bump_major())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_versioning_unknown_version(workflow_runner):\n with pytest.raises(WDL.Error.SyntaxError):\n workflow_runner(\"test_versioning_unknown_version.wdl\")",
"def test_load_invalid_package(self, build_image_for_jupyterlab):\n lb, username = build_image_for_jupyterlab[0], build_image_for_jupyte... | [
"0.63892597",
"0.6351492",
"0.63276905",
"0.62981606",
"0.6260881",
"0.625495",
"0.62351507",
"0.6233474",
"0.62265456",
"0.6221209",
"0.6201287",
"0.6163585",
"0.60885173",
"0.60780215",
"0.6064489",
"0.6062926",
"0.6062689",
"0.6031699",
"0.602786",
"0.60150295",
"0.5985328... | 0.7270124 | 0 |
Tests a quest load fail due to data model mismatch | def test_quest_load_data_fail(testing_quest_page):
testing_quest_page.save()
# fetch the data
doc = testing_quest_page.doc_ref.get()
data = testing_quest_page.storage_model.parse_obj(doc.to_dict())
# mess with the data
data.serialized_data = json.dumps({"this": "nonesense"})
testing_quest_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_quest_load_version_fail(testing_quest_page):\n testing_quest_page.save()\n\n # fetch the data\n doc = testing_quest_page.doc_ref.get()\n data = testing_quest_page.storage_model.parse_obj(doc.to_dict())\n\n # mess with the version\n data.version = str(VersionInfo.parse(data.version).bump_... | [
"0.7057462",
"0.6682245",
"0.64680135",
"0.6359207",
"0.6342291",
"0.6277486",
"0.626191",
"0.6247913",
"0.6246599",
"0.62446374",
"0.6230149",
"0.61893404",
"0.6112703",
"0.6111759",
"0.6097188",
"0.6096131",
"0.6093017",
"0.6053721",
"0.6052966",
"0.6038258",
"0.6015618",
... | 0.7659957 | 0 |
check through self.outfile to see if any of the scans' heuristics exceed the values defined in __init__ | def checkScans(self, azf, azb, elf, elb):
ok = True
#read self.outfile
hfile = open("{0}.hc".format(self.projid), "r")
#save each line in self.outfile as a list, within a list called scans
scans = []
lines = hfile.readlines()[3:]
for line in lines:
scan = [x.strip() for x in line.split('|')]
scans.ap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_injparamscan_pickle_files(self):\n # Make sure that there have been no more new scan points run since this\n # last processing. To do this, get the number of output directories\n # Compare this to the number in the pickle files.\n self.num_scan_points = 0\n for basename... | [
"0.55321264",
"0.55113435",
"0.5429154",
"0.5421212",
"0.54087055",
"0.53648335",
"0.53632474",
"0.5342705",
"0.53346616",
"0.53255534",
"0.5281433",
"0.5278543",
"0.5274164",
"0.52619636",
"0.52517074",
"0.52420944",
"0.5242051",
"0.5228459",
"0.5222721",
"0.5193241",
"0.516... | 0.6355968 | 0 |
\brief Construct the WindowManager \param pipes The communication pipes to the PluginManager \param args Additional startup arguments | def __init__(self, pipes, args):
self.displays = {} #The display of each player
super(WindowManager, self).__init__(pipes)#initialize the PluginInterface | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, type='GUI', args='', wm=None):\n Module.__init__(self)\n\n # set a few instance variables:\n self.runProgress = 0\n\n # Keep track of all plots created:\n self.plots = dict()",
"def __init__(self, windows):\n super().__init__(self, windows) # this inhe... | [
"0.6078444",
"0.5923706",
"0.58288455",
"0.5766079",
"0.5663753",
"0.562768",
"0.5588675",
"0.55374795",
"0.5453395",
"0.54424554",
"0.539646",
"0.53956455",
"0.53781927",
"0.53611195",
"0.53605384",
"0.53539896",
"0.53428835",
"0.5333223",
"0.5308788",
"0.5273743",
"0.524866... | 0.76640654 | 0 |
\brief Initialize the WindowManager \param args Should be empty Nothing to do | def initialize(self, args):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.window = Tk() # The main window\n self.__initialize_variables__() # Initialize the variables\n self.__initialize_menu__() # Initialize the Menu\n self.__initialize_status_bar__()\n self.__initialize_gui__() # Initialize the GUI widgets",... | [
"0.6604338",
"0.6311929",
"0.6203859",
"0.61473036",
"0.6137465",
"0.612172",
"0.61085546",
"0.6087987",
"0.6047748",
"0.60364294",
"0.60183203",
"0.5979053",
"0.59224874",
"0.59135395",
"0.5879075",
"0.5867258",
"0.58321834",
"0.5768027",
"0.5755995",
"0.57361525",
"0.573430... | 0.63725156 | 1 |
\brief Display a manialink via ManialinkManager \param args the arguments that would be passed to the ManialinkManager | def displayMl(self, *args):
self.callMethod(('ManialinkManager', 'displayManialinkToLogin'), *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show(*args):",
"def show(*args):",
"def show(*args):",
"def show(*args):",
"def requestShowLink(self, *args, **kwargs): # real signature unknown\n pass",
"def do_show(self, args):\n args = args.split(\" \")\n if args[0] == '':\n print(\"Incorrect command.\")\n ... | [
"0.664968",
"0.664968",
"0.664968",
"0.664968",
"0.6118344",
"0.6093585",
"0.5853435",
"0.5789269",
"0.5789269",
"0.5789269",
"0.57807535",
"0.5750652",
"0.56737703",
"0.55792844",
"0.5513724",
"0.550441",
"0.54921466",
"0.5485999",
"0.54602873",
"0.543708",
"0.53620243",
"... | 0.73268527 | 0 |
\brief Hide a manialink from the dipslay of a player \param args The args to hide a special manialink from the player | def hideMl(self, *args):
self.callMethod(('ManialinkManager', 'hideManialinkToLogin'), *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hide_entry(self, entry, **args):\n args.update(entry=entry)\n return self.fetch(\"/hide\", post_args=args)",
"def do_hf_unhide(self, arg):\n self.show_hidden_frames = True\n self.refresh_stack()",
"def do_hf_hide(self, arg):\n self.show_hidden_frames = False\n self... | [
"0.62709033",
"0.6157329",
"0.5952389",
"0.585254",
"0.5781127",
"0.56753856",
"0.5660688",
"0.5648263",
"0.5578668",
"0.5534948",
"0.55214626",
"0.54316545",
"0.5369051",
"0.5342161",
"0.53277236",
"0.53277236",
"0.53277236",
"0.53277236",
"0.53277236",
"0.53277236",
"0.5327... | 0.691975 | 0 |
\brief Callback for closing a window \param entries The entries in the window's manialink \param login The login of the player \param name The name of the window to close | def closeWindow(self, entries, login, name):
try:
display = self.displays[login]
try:
del display[name]
self.hideMl(name, login)
except KeyError:
self.log('error: ' + str(login) + ' has no window named "' + str(name) + '" to close')
except KeyError:
self.log('error: login ' + str(login) + ' ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nameEntry(message=\"\", default=\"\"):\n\n def nameEntryCloser():\n nameEntry.field.set(default)\n nameEntry.nameWindow.quit()\n\n def okayButton():\n nameEntry.nameWindow.quit()\n return\n\n # WINDOW:\n nameEntry.nameWindow = tk.Tk(className=\" Provide Identifier\")\n ... | [
"0.6059561",
"0.59030324",
"0.58869547",
"0.5831698",
"0.5822125",
"0.5768322",
"0.5756685",
"0.57418096",
"0.57165706",
"0.57165706",
"0.57165706",
"0.57165706",
"0.5691665",
"0.5665368",
"0.56621414",
"0.5653951",
"0.56185514",
"0.55668885",
"0.55326134",
"0.5499321",
"0.54... | 0.8536082 | 0 |
\brief Add a window to manage \param login The player to display the window to \param name The name of the window to display \param window The window instance to display \param useOldState Should the state of the replaced window be used | def __addWindow(self, login, name, window, useOldState = False):
if not (login in self.displays):
self.displays[login] = {}
if useOldState:
try:
oldWindow = self.displays[login][name]
window.setState(oldWindow.getState())
except KeyError:
pass
self.displays[login][name] = window | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def displayWindow(self, login, name, window, useOldState = False):\n\t\twindow.setName(name)\n\t\twindow.setUser(login)\n\t\twindow.setWindowManager(self)\n\t\tself.__addWindow(login, name, window, useOldState)\n\t\tml = window.getManialink()\n\t\tself.displayMl(ml, name, login)",
"def newwin(self,name,sizeY,siz... | [
"0.8011839",
"0.6271785",
"0.60716826",
"0.576537",
"0.5579847",
"0.55568594",
"0.5529001",
"0.55260825",
"0.5521583",
"0.5459614",
"0.5458044",
"0.5451363",
"0.53070015",
"0.5293099",
"0.52927154",
"0.52768445",
"0.5254965",
"0.52243614",
"0.52243614",
"0.522433",
"0.5189096... | 0.8635102 | 0 |
\brief Display the given window \param login The player to display the window to \param name The name of the window to display \param window The window instance to display \param useOldState Should be tried to use the state of the old window if there is one? | def displayWindow(self, login, name, window, useOldState = False):
window.setName(name)
window.setUser(login)
window.setWindowManager(self)
self.__addWindow(login, name, window, useOldState)
ml = window.getManialink()
self.displayMl(ml, name, login) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __addWindow(self, login, name, window, useOldState = False):\n\t\tif not (login in self.displays):\n\t\t\tself.displays[login] = {}\n\t\tif useOldState:\n\t\t\ttry:\n\t\t\t\toldWindow = self.displays[login][name]\n\t\t\t\twindow.setState(oldWindow.getState())\n\t\t\texcept KeyError:\n\t\t\t\tpass\n\t\tself.dis... | [
"0.7754282",
"0.6005782",
"0.5935182",
"0.5834518",
"0.5663817",
"0.5597943",
"0.5519708",
"0.5479311",
"0.54256994",
"0.54256994",
"0.54192704",
"0.54190284",
"0.54037136",
"0.5397264",
"0.53836125",
"0.5349824",
"0.532267",
"0.53148013",
"0.53065175",
"0.5294689",
"0.527785... | 0.8560139 | 0 |
\brief Display a paged window \param login The player to display tdhe window to \param name The name of the window \param title The title of the window \param size The size of the window \param pos The upper left corner of the window \param pages A list of pages (manialinks) \param useOldState Should be tried to use th... | def displayPagedWindow(self, login, name, title, size, pos, pages, useOldState = False):
window = PagedWindow(title, pages)
window.setName(name)
window.setSize(size)
window.setPos(pos)
self.displayWindow(login, name, window, useOldState) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def displayWindow(self, login, name, window, useOldState = False):\n\t\twindow.setName(name)\n\t\twindow.setUser(login)\n\t\twindow.setWindowManager(self)\n\t\tself.__addWindow(login, name, window, useOldState)\n\t\tml = window.getManialink()\n\t\tself.displayMl(ml, name, login)",
"def __addWindow(self, login, n... | [
"0.6816248",
"0.62783533",
"0.6195496",
"0.61718196",
"0.5769896",
"0.55879575",
"0.55514103",
"0.54574174",
"0.52419114",
"0.5198903",
"0.50603664",
"0.49268785",
"0.4921514",
"0.4915813",
"0.48819762",
"0.48536125",
"0.48536125",
"0.48337668",
"0.48334652",
"0.4823227",
"0.... | 0.8143958 | 0 |
\brief Display lines in a window \param login The login of the player to display to \param name The name of the window \param size The size of the window \param pos The upper left corner of the window \param rows The rows to display \param rowsPerPage The number of rows to display per page \param useOldState Should be ... | def displayLinesWindow(self, login, name, title, size, pos, rows, rowsPerPage, useOldState = False):
window = LinesWindow(title)
window.setName(name)
window.setSize(size)
window.setPos(pos)
window.setLines(rows, rowsPerPage)
self.displayWindow(login, name, window, useOldState) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def displayTableWindow(self, login, name, title, size, pos, rows, rowsPerPage, \n\t\t\t\t\t\tcolumnWidths, headLine = None, useOldState = False):\n\t\twindow = TableWindow(title)\n\t\twindow.setName(name)\n\t\twindow.setSize(size)\n\t\twindow.setPos(pos)\n\t\twindow.setTable(rows, rowsPerPage, columnWidths, headLi... | [
"0.6785664",
"0.65877265",
"0.6384317",
"0.6045043",
"0.59947926",
"0.565348",
"0.56059384",
"0.55401",
"0.53550285",
"0.5352583",
"0.5337035",
"0.5229993",
"0.52007633",
"0.5150957",
"0.51135856",
"0.5058932",
"0.5028801",
"0.50125897",
"0.5003949",
"0.49980623",
"0.49719062... | 0.8338003 | 0 |
\brief Display manialink elements in a table \param login The player to display to \param name The windows name \param title The title of the window \param size The size of the window \param pos The upper left corner of the window \param rows The rows to display (each is an iterable of columns) \param rowsPerPage The n... | def displayTableWindow(self, login, name, title, size, pos, rows, rowsPerPage,
columnWidths, headLine = None, useOldState = False):
window = TableWindow(title)
window.setName(name)
window.setSize(size)
window.setPos(pos)
window.setTable(rows, rowsPerPage, columnWidths, headLine)
self.displayWindow(lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def displayTableStringsWindow(self, login, name, title, size, pos, rows, \n\t\t\t\t\t\t\t\trowsPerPage, columnWidths, headLine = None, useOldState = False):\n\t\twindow = TableStringsWindow(title)\n\t\twindow.setName(name)\n\t\twindow.setSize(size)\n\t\twindow.setPos(pos)\n\t\twindow.setTableStrings(rows, rowsPerP... | [
"0.7279407",
"0.6831997",
"0.623331",
"0.58848125",
"0.55741733",
"0.5237978",
"0.50772387",
"0.504462",
"0.5038364",
"0.5029822",
"0.4990835",
"0.49495846",
"0.49455926",
"0.4938534",
"0.49348298",
"0.49241987",
"0.49167243",
"0.4887442",
"0.48630658",
"0.48422623",
"0.48304... | 0.80260384 | 0 |
\brief Display strings in a table \param login The player to display to \param name The windows name \param title The title of the window \param size The size of the window \param pos The upper left corner of the window \param rows The rows to display (each is an iterable of columns) \param rowsPerPage The number of ro... | def displayTableStringsWindow(self, login, name, title, size, pos, rows,
rowsPerPage, columnWidths, headLine = None, useOldState = False):
window = TableStringsWindow(title)
window.setName(name)
window.setSize(size)
window.setPos(pos)
window.setTableStrings(rows, rowsPerPage, columnWidths, headLine)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def displayTableWindow(self, login, name, title, size, pos, rows, rowsPerPage, \n\t\t\t\t\t\tcolumnWidths, headLine = None, useOldState = False):\n\t\twindow = TableWindow(title)\n\t\twindow.setName(name)\n\t\twindow.setSize(size)\n\t\twindow.setPos(pos)\n\t\twindow.setTable(rows, rowsPerPage, columnWidths, headLi... | [
"0.78988546",
"0.6899045",
"0.60468376",
"0.5631577",
"0.5590207",
"0.5321155",
"0.5270306",
"0.52450794",
"0.5241304",
"0.5191984",
"0.51890934",
"0.5129323",
"0.50245285",
"0.5018191",
"0.49937418",
"0.49878255",
"0.4971541",
"0.49109757",
"0.49098668",
"0.49092034",
"0.487... | 0.834873 | 0 |
\brief Change the page of a multiPage window \param entries The entries of the manialink \param login The login of the calling player \param name The name of the window \param pageNumber The number of the page to change to | def changePage(self, entries, login, name, pageNumber):
try:
display = self.displays[login]
try:
window = display[name]
try:
window.setCurrentPage(pageNumber)
self.displayMl(window.getManialink(), name, login)
except AttributeError:
self.log('error: ' + str(name) + ' does not seem to ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def displayPagedWindow(self, login, name, title, size, pos, pages, useOldState = False):\n\t\twindow = PagedWindow(title, pages)\n\t\twindow.setName(name)\n\t\twindow.setSize(size)\n\t\twindow.setPos(pos)\n\t\tself.displayWindow(login, name, window, useOldState)",
"def on_mscreenNotebook_switch_page(self, notebo... | [
"0.56320345",
"0.54950774",
"0.50390834",
"0.49291715",
"0.48431993",
"0.48270744",
"0.4800442",
"0.47962907",
"0.4770573",
"0.474351",
"0.46276444",
"0.46059754",
"0.46040714",
"0.45964447",
"0.45964435",
"0.459239",
"0.45910007",
"0.45869452",
"0.45657727",
"0.453022",
"0.4... | 0.8271993 | 0 |
Adv. examples stored in "data/adversarial/{att}_{ds}.npy" | def attack(self, attack, nExamples=100):
adversarialExamples = attack.attack(
ds.test_data[:nExamples],
get_labs(ds.test_data[:nExamples])
)
if not os.path.exists("data"):
os.mkdir("data")
if not os.path.exists("data/adversarial"):
os.mkdi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_data():\n ADV_MAT = np.load('ADV.npy');\n ADJ_MAT = np.load('ADJ.npy');\n PR_MAT = np.load('PR.npy'); \n NN_MAT = np.load('NN.npy');\n for i in range(ADV_MAT.shape[0]):RUNNING_DATA['ADV___'+str(i)] = ADV_MAT[i];\n for i in range(ADJ_MAT.shape[0]):RUNNING_DATA['ADJ___'+str(i)] = ADJ_MA... | [
"0.5976136",
"0.5905828",
"0.5756249",
"0.5724774",
"0.57034975",
"0.5645797",
"0.5637405",
"0.5605502",
"0.55986005",
"0.5558407",
"0.5558407",
"0.5521097",
"0.550594",
"0.5497397",
"0.54880595",
"0.54249275",
"0.54240984",
"0.5377585",
"0.5352116",
"0.53465736",
"0.5343692"... | 0.6151189 | 0 |
Evaluate defense against attack | def evaluate(self, defense, attack):
advPath = 'data/adversarial/{}_{}.npy'.format(
attack.name,
self.dataset.name
)
if not os.path.exists(advPath):
self.attack(attack, nExamples=100)
adversarialExamples = np.load(advPath) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def defense(self):\n #return self.stats.dexterity + (self.stats.reiatsu * self.stats.density)\n return self.stats.defense",
"def normal_defense(self):\n if self.game.get_my_mana() > DEFENSE_MANA_CAP:\n self.portals.dumb_castle_defense(DEFENSE_MANA_CAP)\n self.portals.du... | [
"0.6803796",
"0.66627306",
"0.6537219",
"0.6486407",
"0.64275104",
"0.6389536",
"0.6374729",
"0.62649596",
"0.6203673",
"0.6165354",
"0.61619276",
"0.61397696",
"0.6122965",
"0.6045816",
"0.5975723",
"0.5965899",
"0.595837",
"0.59549195",
"0.5949151",
"0.5947129",
"0.594378",... | 0.69326264 | 0 |
Given a land use raster and a set of weights, applies the weights to each land use type then sets everything else to 1 so that the raster can be used as a multiplier later | def make_weight_raster(land_use, modifications):
land_use_array = compatibility.raster_to_numpy_array(land_use)
land_use_array += 10000 # offset everything by 10000 so we can identify everything that's still a default later
for modification in modifications:
land_use_array[
land_use_arr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weight_images(im_dir, wt_dir, weight_dir, im_weight_dir, wt_weight_dir, imtype='intbgsub', wttype='rrhr'):\n im_suff, wt_suff = '*-{}.fits'.format(imtype), '*-{}.fits'.format(wttype)\n imfiles = sorted(glob.glob(os.path.join(im_dir, im_suff)))\n wtfiles = sorted(glob.glob(os.path.join(wt_dir, wt_suff)... | [
"0.6271114",
"0.6098051",
"0.6086078",
"0.5972979",
"0.59406394",
"0.59391737",
"0.59255874",
"0.5866203",
"0.58270544",
"0.57953656",
"0.57953656",
"0.57700723",
"0.57416683",
"0.57380223",
"0.57306635",
"0.5718761",
"0.5715447",
"0.5705741",
"0.5684807",
"0.5679823",
"0.567... | 0.66675645 | 0 |
This was the first version of the convolution function I wrote. It takes an approach I thought would be faster originally and takes the loading matrix for each year and multiplies it against the entire URF matrix representing the future relative to the year, then adds its result to the output. That would probably take ... | def convolve_and_sum_slow(loadings, unit_response_functions=None):
loadings = loadings.T
print(loadings.shape)
print("Convolving")
if (
unit_response_functions is None
): # this logic is temporary, but have a safeguard so it's not accidentally used in production
if settings.DEBUG:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convolve(img, fourier_kernel):\n return np.fft.ifftshift(np.fft.irfft2(np.fft.rfft2(img) * fourier_kernel))",
"def fftconvolve(array, kernel):\n x = numpy.fft.fftshift(numpy.fft.fftn(image))\n y = numpy.fft.fftshift(numpy.fft.fftn(kernel))\n\n return numpy.real(numpynp.fft.fftshift(\n nump... | [
"0.6447945",
"0.6390572",
"0.63843477",
"0.6380475",
"0.63465464",
"0.62979466",
"0.620489",
"0.6106565",
"0.6063468",
"0.5982446",
"0.59128976",
"0.585065",
"0.5833995",
"0.58112586",
"0.57921904",
"0.5739922",
"0.5693029",
"0.5667991",
"0.56658816",
"0.56472903",
"0.5646131... | 0.7248218 | 0 |
This function takes in the filename of the data (stored with sklearnjoblib), checks the data for outliers, establishes the interpolation grid, computes the nearest neighbours between all data points and that grid, and outputs the necessary values for using BLISS The `flux` is assumed to be pure stellar signal i.e. no p... | def setup_BLISS_inputs_from_file(dataDir, xBinSize=0.01, yBinSize=0.01, xSigmaRange=4, ySigmaRange=4):
points, fluxes = BLISS.extractData(dataDir)
points, fluxes = BLISS.removeOutliers(points, fluxes, xSigmaRange, ySigmaRange)
knots = BLISS.createGrid(points, xBinSize, yBinSize)
knotTree = spa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(input_file_path, layer='all', out=None, grid_id_name='GRIDMET_ID',\n buffer=25, scale_factor=0.1, function='invdist', smooth=0, params=None,\n grid_res=None, z_stats=True, res_plot=True, overwrite=False, \n options=None, grid_meta_path=None):\n # build fishnet for interpolation\n ... | [
"0.5721773",
"0.5501204",
"0.54783475",
"0.5460981",
"0.51866823",
"0.5177766",
"0.51766217",
"0.5172738",
"0.5114757",
"0.5088582",
"0.50529236",
"0.5039137",
"0.5035447",
"0.4996589",
"0.49945495",
"0.49860466",
"0.49849167",
"0.49375308",
"0.49370077",
"0.49345726",
"0.492... | 0.61371654 | 0 |
NEW word2vec_by_period using skipgram txt files DOES NOT YET IMPLEMENT word_size!!! | def word2vec_by_period(self,bin_years_by=None,word_size=None,skipgram_n=10, year_min=None, year_max=None):
from llp.model.word2vec import Word2Vec
from llp.model.word2vecs import Word2Vecs
if not year_min: year_min=self.year_start
if not year_max: year_max=self.year_end
path_model = self.path_model
model_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(fasttext_dir, voc_size):\n voc = []\n emb = []\n words = set()\n first = True\n fasttext_path = os.path.join(fasttext_dir, NAME)\n with open(fasttext_path) as f:\n for line in f:\n # First line contains # words and embedding sizes, skip\n if first:\n ... | [
"0.6202977",
"0.61197203",
"0.61153",
"0.6109743",
"0.6049156",
"0.59358",
"0.59246117",
"0.5919998",
"0.5916504",
"0.5894059",
"0.58886534",
"0.58872986",
"0.5844035",
"0.5833625",
"0.5815451",
"0.57883847",
"0.57799625",
"0.57799625",
"0.57703996",
"0.57703996",
"0.57703996... | 0.65422547 | 0 |
Check if a cell is on the board. | def is_cell_on_board(cell, board_shape): # TODO: Remove
return (0, 0) <= cell < board_shape | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inBoard(self, row, col):\n return 0 <= row < self.rows and 0 <= col < self.cols",
"def is_on_board(x: int, y: int) -> bool:\n return x >= 0 and x < BOARDWIDTH and y < BOARDHEIGHT",
"def _check_occupied(self, col, row):\n if self.board[row - 1][col - 1] == EMPTY:\n return False\n... | [
"0.76910853",
"0.7657645",
"0.75842696",
"0.746275",
"0.74618644",
"0.734186",
"0.7332908",
"0.72954184",
"0.729383",
"0.7267042",
"0.72044545",
"0.7190748",
"0.7165279",
"0.71580917",
"0.7094958",
"0.70738655",
"0.70053196",
"0.7004408",
"0.70043606",
"0.6990636",
"0.6988504... | 0.8329117 | 0 |
Transform the action of the player to a move. The move is made and the reward computed. | def make_move(state, action, player, rewarding_move=False): # TODO : done and next_is_reward can be removed as
# they are in the state object
board = state.get_board()
json_action = action.get_json_action()
action = action.get_action_as_dict()
captured = None
reward = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move(self, action):\n self.time += 1\n\n # If ship is destroyed ship can only contemplate sadness and despair\n if not action or not self.is_playable():\n return None\n\n self.actualise = False\n\n if self.leroy_time == 1:\n self.back_to_normal()\n ... | [
"0.74058926",
"0.73019046",
"0.70904136",
"0.6986708",
"0.6959052",
"0.6896194",
"0.6886597",
"0.6883777",
"0.68604314",
"0.6851904",
"0.68399143",
"0.683482",
"0.682573",
"0.68179774",
"0.6796655",
"0.6772559",
"0.67425084",
"0.6734505",
"0.6715248",
"0.6709609",
"0.6703118"... | 0.77086747 | 0 |
extract the patient names from csv files | def obtain_patient_names():
split_names = ['train', 'valid', 'test']
for split_name in split_names:
csv_file = 'config/fetal_hc_train_{0:}.csv'.format(split_name)
with open(csv_file, 'r') as f:
lines = f.readlines()
data_lines = lines[1:]
patient_names = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def protein_name_collector():\n resL = []\n with open(\"bob/processed/bobprots_down.csv\", \"r\") as inpF:\n for inpLine in inpF:\n inpLine = inpLine.split(\",\")\n resL.append(inpLine[0].strip(\" \\n\"))\n return resL",
"def read_names_dmp(fname):\n df = pd.read_csv(fname, sep=\"|\", header=N... | [
"0.64896905",
"0.6160536",
"0.6105396",
"0.6095862",
"0.60858196",
"0.6071521",
"0.60632044",
"0.6046771",
"0.60369945",
"0.59978914",
"0.5988525",
"0.59633",
"0.59171087",
"0.5842534",
"0.57966834",
"0.577753",
"0.5746696",
"0.5703196",
"0.5702408",
"0.56898814",
"0.567783",... | 0.7341405 | 0 |
Factory method for constructing a new baseclient plus the corresponding view; Typically used in combination with pools | def view_with_client_from_config(cls, conf, config_section, logger=None):
if cls == PapiViewClient:
# we're implementing this factory in the base-class, so we don't
# have to copy-paste it into every single view. This means that
# someone could invoke it in the abstract base,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_from_config(cls, base_client, conf, logger=None):\n _unused = conf\n if cls == PapiViewClient:\n # we're implementing this factory in the base-class, so we don't\n # have to copy-paste it into every single view. This means that\n # someone could invoke it i... | [
"0.7156916",
"0.66905946",
"0.6448428",
"0.6441434",
"0.6350438",
"0.63033354",
"0.62537676",
"0.62470376",
"0.62366384",
"0.6194692",
"0.61162245",
"0.60716623",
"0.604634",
"0.6044594",
"0.6044594",
"0.6044594",
"0.6044594",
"0.6044594",
"0.60389984",
"0.5988731",
"0.593987... | 0.684379 | 1 |
Check if the 'folderPath' exists and it's valid folder | def isFolderValid(folderPath):
if os.path.isdir(folderPath):
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_folder_exists(path):\n if not os.path.isdir(path):\n raise ValueError(\"Error: \\\"\" + path + \"\\\" is not a folder\")",
"def _folderCheck(self, folder):\n logger.debug(\"Func: _folderCheck\")\n\n if not os.path.isdir(os.path.normpath(folder)):\n os.makedirs(os.path... | [
"0.821229",
"0.7790112",
"0.7742366",
"0.7650037",
"0.7607033",
"0.7521197",
"0.74893963",
"0.74483234",
"0.74028957",
"0.7341176",
"0.7326927",
"0.73247874",
"0.7312774",
"0.7249748",
"0.7211095",
"0.7190417",
"0.71872485",
"0.7110652",
"0.7073566",
"0.70547366",
"0.7025946"... | 0.8304896 | 0 |
Initializes one train object with a 'trip_update' object from the MTA data, a dictionary of all the stop IDs and names in the subway system, and the index of the train in the master list of train objects. | def __init__(self, trip_update, stops, position_in_list):
self.trip_update = trip_update
self.stops = stops
self.routeID = str(self.trip_update.trip.route_id)
# A minor quirk in the MTA's data is fixed here. S trains were listed as GS for some reason
if self.routeID == "GS":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init(self, train):\n return",
"def init(self, train):\n return",
"def init(self, train):\n return",
"def init(self, train):\n return",
"def init(self, train):\n return",
"def __init__(self, model, run, lats, lons, old=False):\n\n if lats.shape != lons.shape:\... | [
"0.5544171",
"0.5544171",
"0.5544171",
"0.5544171",
"0.5544171",
"0.5467821",
"0.5444523",
"0.5424617",
"0.537765",
"0.53611565",
"0.53566074",
"0.5349868",
"0.52527094",
"0.5215361",
"0.52060056",
"0.517301",
"0.5168718",
"0.515493",
"0.515493",
"0.5136751",
"0.5111553",
"... | 0.7467727 | 0 |
Given the stop number (the nth stop on the train's remaining route) as an argument, this method prints out a message containing the train's direction, route number, station, and arrival time. | def showInfo(self, stop_number):
if self.arrivalTime == '': # At origin terminals, there will only be a departure time listed
if self.getArrivalTime(stop_number) == '00':
print "There is a", self.getDirection(), self.routeID, "train departing from", self.getStop(stop_number), "now."
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_stops_for_route(route_id: str) -> None:\n mbta = MBTA(config.CT_MBTA_API_KEY)\n try:\n stops = mbta.get_stops_for_route(route_id)\n except MBTAEmptyResult:\n print(f\"Route '{route_id}' returned no results\")\n return\n title_text = f\"Stops for '{route_id}'\"\n print(... | [
"0.6484648",
"0.631231",
"0.5813234",
"0.57372004",
"0.5650523",
"0.5513406",
"0.54873604",
"0.54556835",
"0.54532343",
"0.5358851",
"0.5334247",
"0.5296849",
"0.5281874",
"0.52693594",
"0.52658933",
"0.5250847",
"0.5219766",
"0.5187763",
"0.5181119",
"0.51640964",
"0.515848"... | 0.7981489 | 0 |
This method, given a stop number, returns the number of minutes it will take for the train to arrive at the specified station. | def getArrivalTime(self, stop_number):
# Get absolute POSIX time from MTA data
self.arrivalTime = str(self.trip_update.stop_time_update[stop_number].arrival)
departureTime = str(self.trip_update.stop_time_update[stop_number].departure)
if self.arrivalTime != '': # Some stops only have a ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_subway_time(station):\n\tname = station.get('name')\n\tif name not in STATION_DICT.keys():\n\t\treturn None\n\n\tstation_id = STATION_DICT[name]\n\n\tsub_url = 'http://mtaapi.herokuapp.com/api?id=' + station_id\n\n\tresponse = requests.get(sub_url)\n\tsubway_json = json.loads(response.text)\n\tarrivals = ... | [
"0.65532744",
"0.5937251",
"0.5735998",
"0.55750644",
"0.55229574",
"0.5515889",
"0.55156994",
"0.54697776",
"0.54342926",
"0.54300594",
"0.5412586",
"0.5389262",
"0.53555155",
"0.5333743",
"0.5330734",
"0.5326288",
"0.53176075",
"0.52986455",
"0.5295996",
"0.5290648",
"0.528... | 0.60506845 | 1 |
Gets all upcoming stops for the train. Returns a list of form [stop number, station name]. | def getAllStops(self):
all_stops = []
# Iterate through all the stop_time_update objects in trip_update
for i in range(len(self.trip_update.stop_time_update)):
stop = self.getStop(i)
if stop not in all_stops:
all_stops.append([i, stop])
return all_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_next_available_train_list(self, context) -> Tuple[List, datetime.datetime]:\n try:\n for day in self._next_week:\n trains = list(train_api.get_available_trains(origin_station_id=context.user_data['origin_station_id'],\n ... | [
"0.6439575",
"0.62781966",
"0.6275779",
"0.62359667",
"0.6205682",
"0.6181426",
"0.5884607",
"0.5879938",
"0.5866356",
"0.5864373",
"0.5821911",
"0.57558584",
"0.57329017",
"0.5732885",
"0.5710246",
"0.5687542",
"0.5668271",
"0.56334054",
"0.5630607",
"0.56190753",
"0.560969"... | 0.68494487 | 0 |
Gets the nth stop for the train given the stop number as an argument. | def getStop(self, i):
stopID = self.trip_update.stop_time_update[i].stop_id
stop = self.stops[stopID]
return stop | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_train_stop_fun(num_iter):\n def train_stop_fun(*args):\n count = args[3]\n return tf.less(count, num_iter)\n return train_stop_fun",
"def parse_stop_num(stop_name, stop_id):\n\n try:\n stop_num = int(stop_name.split(\" \")[-1])\n except ValueError:\n # stop number ... | [
"0.6022853",
"0.5747474",
"0.5438748",
"0.54108864",
"0.5404556",
"0.5372071",
"0.5367087",
"0.52734",
"0.52118725",
"0.520136",
"0.5178422",
"0.5129287",
"0.5121343",
"0.5119539",
"0.5113767",
"0.5080521",
"0.5078163",
"0.5000435",
"0.49748078",
"0.49728695",
"0.4972724",
... | 0.6540251 | 0 |
Gets the direction of the train. Returns 'N' or 'S'. | def getDirection(self):
if 'N' in str(self.trip_update.trip.trip_id):
direction = 'northbound'
if 'S' in str(self.trip_update.trip.trip_id):
direction = 'southbound'
return direction | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def direction(self) -> str:\n return pulumi.get(self, \"direction\")",
"def get_direction(self):\n return self.direction",
"def direction(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"direction\")",
"def direction(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"... | [
"0.7439512",
"0.74110264",
"0.7382572",
"0.73296016",
"0.73220545",
"0.7317263",
"0.7231089",
"0.7175391",
"0.713623",
"0.7072303",
"0.6995988",
"0.6994126",
"0.6972258",
"0.69701034",
"0.692738",
"0.6776892",
"0.66794163",
"0.6676883",
"0.6634913",
"0.66130024",
"0.66067797"... | 0.76233625 | 0 |
Sets the node's datum value, creating the attribute if not already defined. | def setNodeDatum(self, node, value):
if not cmds.attributeQuery('datum', node=node, exists=True):
cmds.addAttr(node, longName='cadence_datum', shortName='datum', niceName='Datum')
cmds.setAttr(node + '.datum', value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setattr(self, node, attr, value):\n node.set(attr, value)",
"def set_data(node, value):\n node['data'] = value",
"def set_node_attribute(\n node: MatterNode,\n endpoint: int,\n cluster_id: int,\n attribute_id: int,\n value: Any,\n) -> None:\n attribute_path = f\"{endpoint}/{clus... | [
"0.731786",
"0.6902749",
"0.67979324",
"0.6698395",
"0.6623241",
"0.6600951",
"0.65301025",
"0.6496412",
"0.6384045",
"0.6326305",
"0.6325405",
"0.63123256",
"0.6291786",
"0.6291014",
"0.6288004",
"0.6272946",
"0.62563777",
"0.6226164",
"0.619528",
"0.611583",
"0.6102085",
... | 0.8281853 | 0 |
Sets the show_history of this FinancialPictureRequest. | def show_history(self, show_history):
self._show_history = show_history | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def family_history(self, family_history):\n\n self.logger.debug(\"In 'family_history' setter.\")\n\n self._family_history = family_history",
"def history(self, history):\n self._history = history",
"def history(self, history):\n\n self._history = history",
"def show_history_log(se... | [
"0.62746066",
"0.6236926",
"0.6181352",
"0.58512986",
"0.55870426",
"0.5578684",
"0.5410361",
"0.5358885",
"0.5347609",
"0.5332675",
"0.5298195",
"0.52349263",
"0.5208175",
"0.5187337",
"0.5123899",
"0.51076424",
"0.509941",
"0.5095368",
"0.5069702",
"0.50254905",
"0.5025149"... | 0.8113726 | 1 |
Sets the currency_conversion of this FinancialPictureRequest. | def currency_conversion(self, currency_conversion):
self._currency_conversion = currency_conversion | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def currency(self, currency):\n\n self._currency = currency",
"def currency(self, currency):\n\n self._currency = currency",
"def currency(self, currency):\n\n self._currency = currency",
"def currency(self, currency):\n\n self._currency = currency",
"def currency(self, currency... | [
"0.666206",
"0.666206",
"0.666206",
"0.666206",
"0.6495083",
"0.64851433",
"0.6233636",
"0.6217225",
"0.61177707",
"0.6109939",
"0.6053988",
"0.5939542",
"0.5853714",
"0.5838221",
"0.580933",
"0.57990664",
"0.57990664",
"0.57990664",
"0.57990664",
"0.57990664",
"0.57770073",
... | 0.81105894 | 1 |
Sets the show_category_breakdown of this FinancialPictureRequest. | def show_category_breakdown(self, show_category_breakdown):
self._show_category_breakdown = show_category_breakdown | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categories_display(self, categories_display):\n\n self._categories_display = categories_display",
"def set_charge_category(self, charge_category):\n self.single_selection_from_kendo_dropdown(self.charge_category_kendo_dropdown_locator, charge_category)\n self.wait_for_ajax_spinner_load()... | [
"0.55974096",
"0.5501269",
"0.5431379",
"0.54157156",
"0.54157156",
"0.54157156",
"0.54157156",
"0.54157156",
"0.5349273",
"0.5253395",
"0.49177074",
"0.49130473",
"0.48501343",
"0.48117313",
"0.48035136",
"0.4756651",
"0.47337344",
"0.47198582",
"0.47196952",
"0.46970704",
"... | 0.8166357 | 0 |
Sets the show_change of this FinancialPictureRequest. | def show_change(self, show_change):
self._show_change = show_change | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setShowInfo(self, show: bool):\n self._showInfo = show\n self.updateInfo()",
"def toggle_show_variable(self, show_variable):\n\n self._show_variable = show_variable\n\n self.current_graph.refresh()",
"def show_response_set_value_too(self, show_response_set_value_too):\n\n ... | [
"0.60715926",
"0.53914636",
"0.53615534",
"0.53440166",
"0.5206098",
"0.5166196",
"0.5135019",
"0.5083916",
"0.50828165",
"0.50828165",
"0.5076574",
"0.50329703",
"0.49929428",
"0.4953648",
"0.48734188",
"0.48628587",
"0.48034135",
"0.47854462",
"0.4764918",
"0.4764918",
"0.4... | 0.81075996 | 0 |
Sets the household_id of this FinancialPictureRequest. | def household_id(self, household_id):
self._household_id = household_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def picture_id(self, picture_id):\n\n self._picture_id = picture_id",
"def loan_id(self, loan_id):\n\n self._loan_id = loan_id",
"def bank_id(self, bank_id):\n\n self._bank_id = bank_id",
"def refund_request_break_up_id(self, refund_request_break_up_id):\n\n self._refund_request_b... | [
"0.581157",
"0.57030547",
"0.5650919",
"0.54646546",
"0.53638244",
"0.5327329",
"0.52430874",
"0.5198833",
"0.51795435",
"0.51694554",
"0.5104876",
"0.50914276",
"0.50630426",
"0.50630426",
"0.5011367",
"0.50078005",
"0.4996283",
"0.498451",
"0.49745065",
"0.4960317",
"0.4957... | 0.780031 | 0 |
Sets the create_log of this FinancialPictureRequest. | def create_log(self, create_log):
self._create_log = create_log | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_date(self, create_date):\n\n self._create_date = create_date",
"def create_date(self, create_date):\n\n self._create_date = create_date",
"def create_date(self, create_date):\n\n self._create_date = create_date",
"def signing_log(self, signing_log):\n\n self._signing_lo... | [
"0.5830494",
"0.5830494",
"0.5830494",
"0.56984633",
"0.55702716",
"0.5447562",
"0.5415891",
"0.5403018",
"0.5401064",
"0.5401064",
"0.5401064",
"0.5401064",
"0.5401064",
"0.5401064",
"0.5401064",
"0.5401064",
"0.5401064",
"0.5401064",
"0.53672284",
"0.51391935",
"0.5100554",... | 0.78304327 | 0 |
Take the music_data file from convert_txt_to_data and sort it by user choice Put it into a decque/list/tuple/dictionary/whatever | def sort_music_data(sort_by = None):
for lists in read_file():
print(lists)
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_audio_data(self):\n\n self.audio_data = tkFileDialog.askopenfilename()\n self.audio_data_parser = RawAudioDataParser(self.audio_data)\n\n self.audio_entries = sorted(self.audio_data_parser.entries, key=self.get_count, reverse=True)\n\n for index, entry in enumerate(self.audio_e... | [
"0.6361103",
"0.6358172",
"0.60423166",
"0.5795135",
"0.5709791",
"0.55210155",
"0.5519059",
"0.551418",
"0.5490831",
"0.5432274",
"0.5419544",
"0.5390508",
"0.5378134",
"0.5355217",
"0.53457314",
"0.53180027",
"0.5287485",
"0.5270017",
"0.5265886",
"0.5259721",
"0.5239613",
... | 0.723854 | 0 |
Sort what the user wants to see by argument with a loop | def sort_by_user_arg(user_argument = 'sort by ex. artist'):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_list(user_input):\n user_input.sort()\n return user_input # added a return statement for a cleaner looking main function",
"def main():\n seq = [48, 11, 45, 92, 32, 61, 65, 57, 29, 96]\n print(selection_sort(seq))",
"def main():\n numbers = prompt_for_numbers()\n sort(numbers)\n ... | [
"0.71312064",
"0.67519826",
"0.6720038",
"0.6516683",
"0.6488678",
"0.64630085",
"0.634695",
"0.6334668",
"0.6309602",
"0.62767583",
"0.62611395",
"0.62170154",
"0.62022185",
"0.6175545",
"0.61567116",
"0.6154029",
"0.6118722",
"0.61182433",
"0.6073459",
"0.6073129",
"0.60576... | 0.7362615 | 0 |
A decorator that appends conditions to the auth.require config variable. | def require(*conditions):
def decorate(f):
if not hasattr(f, '_cp_config'):
f._cp_config = dict()
if 'auth.require' not in f._cp_config:
f._cp_config['auth.require'] = []
f._cp_config['auth.require'].extend(conditions)
return f
return decorate | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require(*conditions):\n\tdef decorate(f):\n\t\tif not hasattr(f, '_cp_config'):\n\t\t\tf._cp_config = dict()\n\t\tif 'auth.require' not in f._cp_config:\n\t\t\tf._cp_config['auth.require'] = []\n\t\tf._cp_config['auth.require'].extend(conditions)\n\t\treturn f\n\treturn decorate",
"def require(*conditions):\... | [
"0.8606226",
"0.8194008",
"0.7145575",
"0.6522015",
"0.647795",
"0.62014794",
"0.6093525",
"0.6092168",
"0.60746795",
"0.60337365",
"0.5890994",
"0.58562684",
"0.5823328",
"0.5812009",
"0.57987016",
"0.5789054",
"0.5780681",
"0.57762206",
"0.5772098",
"0.5746415",
"0.57270753... | 0.86910504 | 0 |
subclasses must implement package provisioning logic | def _provision_package(self): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pkg(klass, name):\n raise NotImplementedError",
"def package(self):\n\t\tsys.stderr.write(\"Base class method called: package() This souldn't happen.\\n\")",
"def package():\n pass",
"def __init__(self):\n self.update_os_packages()\n self.upgrade_os_packages()",
"def _install(se... | [
"0.6701495",
"0.64232457",
"0.6367917",
"0.6282393",
"0.60401094",
"0.6029903",
"0.6006633",
"0.6000329",
"0.5980114",
"0.5898129",
"0.5877447",
"0.58692765",
"0.58604324",
"0.58019364",
"0.5791862",
"0.5781458",
"0.57165736",
"0.56793135",
"0.56793135",
"0.56748056",
"0.5650... | 0.84553593 | 0 |
run commands before entering chroot | def _pre_chroot_block(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _post_chroot_block(self):\n pass",
"def post_install(self, commands=None, root_path=\"\"):\n executor = self.machine.executor()\n testflow.step(\"Check that there is ovirt-guest-agent.conf directory\")\n rc, _, err = executor.run_cmd(\n ['ls', '-l', root_path + '/etc/ov... | [
"0.6590672",
"0.6441691",
"0.6350191",
"0.6170644",
"0.6019059",
"0.6015687",
"0.5996342",
"0.5959733",
"0.5943862",
"0.5929118",
"0.58912224",
"0.5880491",
"0.5846561",
"0.58219063",
"0.5813808",
"0.58119005",
"0.579205",
"0.5780237",
"0.5768387",
"0.57606125",
"0.5743714",
... | 0.67399204 | 0 |
commands to run after the exiting the chroot | def _post_chroot_block(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup():\n management.call_command('cleanup')",
"def clean_up(self):\n dist.destroy_process_group()",
"def reset_chroot(self):\n try:\n if self.HAS_CHROOT:\n task = reset_ldap_users.post()\n MonQTask.wait_for_tasks(query={\n '_id': ... | [
"0.5976414",
"0.592109",
"0.5917202",
"0.58815366",
"0.5837523",
"0.58076847",
"0.58031654",
"0.580061",
"0.5753015",
"0.57387084",
"0.5715431",
"0.5709394",
"0.57046723",
"0.5693476",
"0.56700563",
"0.56465816",
"0.56294084",
"0.56227237",
"0.56227237",
"0.55914",
"0.5589441... | 0.69256306 | 0 |
execute every python or shell script found in scripts_dir 1. run python or shell scripts in lexical order | def _run_provision_scripts(self, scripts_dir):
script_files = sorted(glob(scripts_dir + '/*.py') + glob(scripts_dir + '/*.sh'))
if not script_files:
log.debug("no python or shell scripts found in {0}".format(scripts_dir))
else:
log.debug('found scripts {0} in {1}'.format... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_all_scripts(dir=\".\", autodestruct=True, condition=None, ignore=[]):\n if condition is None:\n condition = lambda file: file.endswith(\".py\") and not file.startswith(\"_\")\n os.chdir(dir)\n files = sorted([file for file in os.listdir(dir) if condition(file)])\n for file in files:\n ... | [
"0.7689984",
"0.69003177",
"0.66397727",
"0.6407171",
"0.6214613",
"0.6198427",
"0.6197006",
"0.6044555",
"0.59931636",
"0.5988863",
"0.59073466",
"0.58753353",
"0.5861646",
"0.5852778",
"0.58378845",
"0.57310176",
"0.5729858",
"0.57073134",
"0.56219053",
"0.55938184",
"0.556... | 0.7561974 | 1 |
True if context.package.arg ends with a package extension | def _local_install(self):
config = self._config
ext = config.plugins[self.full_name].get('pkg_extension', '')
if not ext:
return False
# ensure extension begins with a dot
ext = '.{0}'.format(ext.lstrip('.'))
return config.context.package.arg.endswith(ext) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_extras(self):\n return any(map(utils.assert_package_has_extras, self.pkg_arguments))",
"def is_package(self, fullmodname):\n submodname, is_package, relpath = self._get_info(fullmodname)\n return is_package",
"def _pkg_filter ( self, pkg_filename ):\n return self.pkg_regex.mat... | [
"0.6775827",
"0.64860153",
"0.6419197",
"0.6278698",
"0.6225014",
"0.6225014",
"0.6225014",
"0.6211437",
"0.6180894",
"0.61025685",
"0.59938914",
"0.59788555",
"0.59577245",
"0.5951081",
"0.5939419",
"0.59362024",
"0.5920712",
"0.5864312",
"0.5864312",
"0.58581257",
"0.581021... | 0.67180365 | 1 |
dowload url to context.package.dir | def _download_pkg(self, context):
pkg_url = context.package.arg
dst_file_path = context.package.full_path
log.debug('downloading {0} to {1}'.format(pkg_url, dst_file_path))
download_file(pkg_url, dst_file_path, context.package.get('timeout', 1), verify_https=context.get('verify_https', F... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_path_url():\n web.ctx.path_url = web.ctx.home + web.ctx.path",
"def _process_resource(self, url):\n url_parts = urlparse.urlsplit(url)\n rel_path = url_parts.path[1:]\n fs_path = os.path.join(self.fileserver_path, rel_path)\n self.logger.info('Downloading {0} to {1}'.forma... | [
"0.6617295",
"0.59593153",
"0.5774424",
"0.5755507",
"0.556702",
"0.54991335",
"0.5495084",
"0.54834676",
"0.54661924",
"0.5451313",
"0.54420376",
"0.54397154",
"0.54265887",
"0.54195464",
"0.5406353",
"0.5369636",
"0.5359275",
"0.5359275",
"0.53245896",
"0.5321594",
"0.53129... | 0.6030487 | 1 |
Casts a ray in the world defined by p0 and p1 and calls callback with the body, normal, collision id, user data and intersection distance | def RayCast( self, p0, p1, callback, userdata):
self.raycastUserData = userdata
self.raycastCallback = callback
self.CppRayCast.__call__(p0[0], p0[1], p0[2], p1[0], p1[1], p1[2]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_ray_cast(self, context, event):\r\n # get the context arguments\r\n MPM = bpy.context.window_manager.MPM\r\n scene = context.scene\r\n region = context.region\r\n rv3d = context.region_data\r\n coord = event.mouse_region_x, event.mouse_region_y\r\n \r\n ... | [
"0.6105274",
"0.5792535",
"0.5668717",
"0.5536646",
"0.5503125",
"0.5456383",
"0.5426125",
"0.54140174",
"0.53425026",
"0.5319531",
"0.50964457",
"0.5082883",
"0.5065246",
"0.5060087",
"0.5052112",
"0.5050797",
"0.5045807",
"0.50024325",
"0.50023884",
"0.49889216",
"0.4963345... | 0.7392268 | 0 |
Get KoBERT ONNX file path after downloading | def get_onnx_kobert_model(cachedir=".cache"):
onnx_kobert = {
"url": "s3://skt-lsl-nlp-model/KoBERT/models/kobert.onnx1.8.0.onnx",
"chksum": "6f6610f2e3b61da6de8dbce",
}
model_info = onnx_kobert
model_path, is_cached = download(
model_info["url"], model_info["chksum"], cachedir=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file(url):\n helpers.make_workdir() # create temp working directory\n file_url = url + constant.MALICIOUS_LOCATION\n print(file_url)\n filename = wget.download(file_url, out=constant.WORKDIR)\n return filename",
"def test_download_to_file(req, tmpdir):\n req.get(ENTREZ_URL, text='This w... | [
"0.61645734",
"0.6022097",
"0.5993172",
"0.5993172",
"0.5977977",
"0.597463",
"0.5905984",
"0.59016025",
"0.59016025",
"0.5869536",
"0.5831232",
"0.582762",
"0.5797586",
"0.5783807",
"0.57748246",
"0.57125276",
"0.570967",
"0.570967",
"0.5708433",
"0.5686537",
"0.5668928",
... | 0.6948264 | 0 |
Parses a page (id, title, categories, article) Put it into a given sqlite3 database | def parsePage(elem, db: WikiDB = None, filter: str = "births") -> None:
if exclude(elem): return # Only iterate over articles
# Parse out basic information
pageid = elem.find("id").text
title = elem.find('title').text
article = elem.find('revision/text').text
# Only insert the data if the cat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_page_to_db(page_data):\n\tprint('-> Insert page data to database')\n\tfor i in range(len(page_data[0])):\n\t\tsql = \"\"\"INSERT INTO selenium (title, description, tags, time, language, rate)\n\t\t\t\tVALUES (%s, %s, %s, %s, %s, %s)\"\"\"\n\t\t# values = (title[i], description[i], tags[i], time[i], lang... | [
"0.6312153",
"0.6299663",
"0.58262634",
"0.5791993",
"0.57775307",
"0.5765643",
"0.5760339",
"0.5759766",
"0.570847",
"0.56236815",
"0.5534436",
"0.55283856",
"0.5527931",
"0.5508297",
"0.5497059",
"0.5441266",
"0.54408693",
"0.543298",
"0.54310405",
"0.54235244",
"0.54213864... | 0.64058536 | 0 |
Gets the lists of categories for a wiki article page | def getCategories(page: wtp._wikitext.WikiText) -> List[str]:
# Categories are always listed at the bottom of the wikipedia article
# So the first "[[Category: ...]]" you find everything after it will be categories
s = page.string
categories = s[s.find("[[Category:"):].split("\n")
return categories | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categories(page_name: str) -> List[PageCategory]:\n return [\n PageCategory(page_name, 'tables', 'www.fake.com', 'tables'),\n PageCategory(page_name, 'chairs', 'www.fake.com', 'chairs'),\n PageCategory(page_name, 'desks', 'www.fake.com', 'desks'),\n ]",
"def fetch_categories_fr... | [
"0.7505203",
"0.72984934",
"0.7081311",
"0.7009002",
"0.69562554",
"0.6944142",
"0.6880995",
"0.6810356",
"0.6784991",
"0.6779787",
"0.6728833",
"0.6724829",
"0.67233217",
"0.6701017",
"0.6696985",
"0.6684265",
"0.667019",
"0.6669179",
"0.6662924",
"0.6657",
"0.6656087",
"0... | 0.8177081 | 0 |
Requires a property, value, uncertainty and unit and returns boolean. Returns the claim that fits into the defined precision or None. | def check_claim(item, prop, target):
item_dict = item.get()
try:
claims = item_dict['claims'][prop]
except KeyError:
return None
for claim in claims:
if claim.target_equals(target):
return claim
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_output_ensure_output_for_property(profile_from_dataset):\n output = CheckOutput(profile=profile_from_dataset)\n\n output.ensure_output_for_property(\"PRES\")\n flags = output.get_output_flags_for_property(\"PRES\")\n\n assert flags is not None\n assert isinstance(flags, ma.MaskedArray)\n ... | [
"0.57004625",
"0.5559172",
"0.5529264",
"0.54965365",
"0.5411636",
"0.5310918",
"0.53068215",
"0.52196753",
"0.51950365",
"0.51573265",
"0.5156379",
"0.5148035",
"0.511029",
"0.5078492",
"0.5067791",
"0.50367236",
"0.5023554",
"0.5008861",
"0.4987001",
"0.49861163",
"0.496095... | 0.5643034 | 1 |
Fit a relation between ISO speed and normalisation. Currently two types of model are supported, namely linear and 'knee'type. Both are fitted and the best is chosen. | def fit_iso_normalisation_relation(isos, ratios, ratios_errs=None, min_iso=50, max_iso=50000):
# Fit a linear model
parameters_linear, covariance_linear = np.polyfit(isos, ratios, 1, cov=True)
errors_linear = np.sqrt(np.diag(covariance_linear))
model_linear = generate_linear_model(*parameters_linear)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit():\n pass",
"def fit_model(train_ts_dis, data, init_prior = [.5,.5], bias = True, mode = \"biasmodel\"):\r\n if mode == \"biasmodel\":\r\n #Fitting Functions\r\n def bias_fitfunc(rp, tsb, df):\r\n init_prior = [.5,.5]\r\n model = BiasPredModel(train_ts_dis, i... | [
"0.6346975",
"0.6288649",
"0.62857914",
"0.62482846",
"0.6219376",
"0.6186598",
"0.61106014",
"0.61106014",
"0.61106014",
"0.61106014",
"0.61106014",
"0.61106014",
"0.61106014",
"0.61106014",
"0.61106014",
"0.61106014",
"0.60498273",
"0.60494196",
"0.6038169",
"0.600564",
"0.... | 0.64979035 | 0 |
Normalise data at a single ISO speed using the lookup table. | def normalise_single_iso(data, iso, lookup_table):
normalisation_factor = lookup_table[1][iso]
new_data = data / normalisation_factor
return new_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalise_iso_general(lookup_table, isos, data):\n if isinstance(isos, (int, float)):\n data_normalised = normalise_single_iso (data, isos, lookup_table)\n else:\n data_normalised = normalise_multiple_iso(data, isos, lookup_table)\n\n return data_normalised",
"def normalise_multiple_i... | [
"0.6849093",
"0.6259645",
"0.5881149",
"0.5822065",
"0.5688883",
"0.56474096",
"0.5619517",
"0.5578845",
"0.5554653",
"0.5554147",
"0.5492617",
"0.548318",
"0.5398104",
"0.5371665",
"0.53529453",
"0.53386825",
"0.5264143",
"0.5247526",
"0.52061623",
"0.51924473",
"0.5187104",... | 0.79107815 | 0 |
Normalise data at multiple ISO speeds using the lookup table. `data` and `isos` are assumed to have the same length, i.e. each element of `data` has one associated ISO speed in `isos`. | def normalise_multiple_iso(data, isos, lookup_table):
as_list = [normalise_single_iso(data_sub, ISO, lookup_table) for data_sub, ISO in zip(data, isos)]
as_array = np.array(as_list)
return as_array | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalise_iso_general(lookup_table, isos, data):\n if isinstance(isos, (int, float)):\n data_normalised = normalise_single_iso (data, isos, lookup_table)\n else:\n data_normalised = normalise_multiple_iso(data, isos, lookup_table)\n\n return data_normalised",
"def normalise_single_iso... | [
"0.7162658",
"0.63079906",
"0.54448533",
"0.5331239",
"0.5075363",
"0.5009405",
"0.49677178",
"0.49491614",
"0.49416187",
"0.49356186",
"0.48905933",
"0.48811764",
"0.48583314",
"0.4846029",
"0.48206174",
"0.48163873",
"0.4793259",
"0.47494617",
"0.4723439",
"0.4716278",
"0.4... | 0.7512359 | 0 |
Normalise data for ISO speed in general. Uses either `normalise_single_iso` or `normalise_multiple_iso` based on the number of isos given. | def normalise_iso_general(lookup_table, isos, data):
if isinstance(isos, (int, float)):
data_normalised = normalise_single_iso (data, isos, lookup_table)
else:
data_normalised = normalise_multiple_iso(data, isos, lookup_table)
return data_normalised | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalise_multiple_iso(data, isos, lookup_table):\n as_list = [normalise_single_iso(data_sub, ISO, lookup_table) for data_sub, ISO in zip(data, isos)]\n as_array = np.array(as_list)\n return as_array",
"def normalise_single_iso(data, iso, lookup_table):\n normalisation_factor = lookup_table[1][is... | [
"0.67277",
"0.66439307",
"0.5905786",
"0.5899896",
"0.575863",
"0.5731845",
"0.57092357",
"0.56624925",
"0.5565097",
"0.5475586",
"0.5424919",
"0.5424919",
"0.54212797",
"0.5418414",
"0.5392732",
"0.53578556",
"0.53570473",
"0.5351442",
"0.5347121",
"0.5326974",
"0.5289045",
... | 0.708646 | 0 |
Load the ISO normalization lookup table located at `root`/calibration/iso_normalisation_lookup_table.npy If `return_filename` is True, also return the exact filename the bias map was retrieved from. | def load_iso_lookup_table(root, return_filename=False):
filename = root/"calibration/iso_normalisation_lookup_table.npy"
table = np.load(filename)
if return_filename:
return table, filename
else:
return table | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_iso_data(root, return_filename=False):\n filename = root/\"intermediaries/iso_normalisation/iso_data.npy\"\n data = np.load(filename)\n if return_filename:\n return data, filename\n else:\n return data",
"def load_iso_model(root, return_filename=False):\n filename = root/\"c... | [
"0.67423725",
"0.63923573",
"0.49846867",
"0.4931616",
"0.49188507",
"0.48510894",
"0.485058",
"0.48231223",
"0.4817256",
"0.47952902",
"0.47689325",
"0.4736154",
"0.4726227",
"0.46966803",
"0.46877939",
"0.46842647",
"0.46754244",
"0.46222445",
"0.46025127",
"0.46005404",
"0... | 0.8586164 | 0 |
Load the ISO normalization function, the parameters of which are contained in `root`/calibration/iso_normalisation_model.dat If `return_filename` is True, also return the exact filename the bias map was retrieved from. | def load_iso_model(root, return_filename=False):
filename = root/"calibration/iso_normalisation_model.dat"
as_array = np.loadtxt(filename, dtype=str)
model_type = as_array[0,0]
parameters = as_array[1].astype(np.float64)
errors = as_array[2].astype(np.float64)
model = model_generator[model_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_iso_data(root, return_filename=False):\n filename = root/\"intermediaries/iso_normalisation/iso_data.npy\"\n data = np.load(filename)\n if return_filename:\n return data, filename\n else:\n return data",
"def load_iso_lookup_table(root, return_filename=False):\n filename = r... | [
"0.710307",
"0.6514929",
"0.4931726",
"0.47969243",
"0.47346193",
"0.4730474",
"0.46459708",
"0.46419635",
"0.46334815",
"0.46058047",
"0.46001792",
"0.45961657",
"0.4583238",
"0.4574901",
"0.4573503",
"0.4545027",
"0.45436263",
"0.45277774",
"0.45239726",
"0.45201075",
"0.45... | 0.77377033 | 0 |
Load ISO normalisation data from `root`/intermediaries/iso_normalisation/iso_data.npy If `return_filename` is True, also return the exact filename the bias map was retrieved from. | def load_iso_data(root, return_filename=False):
filename = root/"intermediaries/iso_normalisation/iso_data.npy"
data = np.load(filename)
if return_filename:
return data, filename
else:
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_iso_model(root, return_filename=False):\n filename = root/\"calibration/iso_normalisation_model.dat\"\n as_array = np.loadtxt(filename, dtype=str)\n model_type = as_array[0,0]\n parameters = as_array[1].astype(np.float64)\n errors = as_array[2].astype(np.float64)\n model = model_gene... | [
"0.7474767",
"0.71398747",
"0.506697",
"0.506338",
"0.5055547",
"0.50256824",
"0.50198704",
"0.49847272",
"0.49250755",
"0.4921838",
"0.48977834",
"0.48896828",
"0.48871377",
"0.4879786",
"0.48765492",
"0.48745102",
"0.48707896",
"0.48701814",
"0.48445353",
"0.48212406",
"0.4... | 0.8427776 | 0 |
start time we only want to proceed when we are at the beginning of a minute, so stuck until seconds is at beginning of minute | def start():
beginning_of_min = False
while beginning_of_min == False:
start_at = datetime.now()
start_time_sec = start_at.strftime("%H:%M:%S")
start_time_min = start_at.strftime("%H:%M")
if start_time_sec[-2:] == '00':
beginning_of_min = True
print("S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_until_start(start_time):\n # stime = start_time()\n if arrow.now() > start_time:\n log.info(\"Starting immediately\")\n return\n keep_waiting = True\n while keep_waiting:\n now = arrow.now()\n until = seconds_until_start(start_time, now)\n if until > 60:\n ... | [
"0.719509",
"0.659136",
"0.6463712",
"0.6396393",
"0.6377081",
"0.63197005",
"0.6276614",
"0.6263846",
"0.6238837",
"0.61841184",
"0.6174448",
"0.61032736",
"0.61032736",
"0.61003584",
"0.6099787",
"0.6095049",
"0.60559297",
"0.6054029",
"0.6015195",
"0.59814113",
"0.5949676"... | 0.7898906 | 0 |
Wraps action method with zone based condition. | def if_action(hass, config):
entity_id = config.get(CONF_ENTITY_ID)
zone_entity_id = config.get(CONF_ZONE)
if entity_id is None or zone_entity_id is None:
logging.getLogger(__name__).error(
"Missing condition configuration key %s or %s", CONF_ENTITY_ID,
CONF_ZONE)
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def optional_action_map(env, inner_action):\n if hasattr(env, 'wrap_action'):\n return env.wrap_action(inner_action)\n else:\n return inner_action",
"def check_zone_operation(self, zone, operation):\n assert is_valid_zone(zone), zone\n return self.call_api('/zones/%s/operations/%s' % (z... | [
"0.54838914",
"0.54372877",
"0.5417847",
"0.54045075",
"0.5262679",
"0.5222185",
"0.5222185",
"0.5181235",
"0.51664245",
"0.51570845",
"0.515074",
"0.514604",
"0.5075403",
"0.5034916",
"0.50335956",
"0.50234854",
"0.5010266",
"0.4995813",
"0.49755046",
"0.4972393",
"0.4965438... | 0.5519493 | 0 |
Check if state is in zone. | def _in_zone(hass, zone_entity_id, state):
if not state or None in (state.attributes.get(ATTR_LATITUDE),
state.attributes.get(ATTR_LONGITUDE)):
return False
zone_state = hass.states.get(zone_entity_id)
return zone_state and zone.in_zone(
zone_state, state.attrib... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _zone_in_states(self, state_list):\n if self.get_state() not in state_list:\n raise ZoneException(\"Zone '%s' must be in one of states: %s.\"\\\n \"Current state is %s.\" %\n (self.get_name(), str(state_list), str(self.get_state())))",
"def exists(self)... | [
"0.7233539",
"0.6930624",
"0.6565907",
"0.6445394",
"0.62267727",
"0.62182635",
"0.6196434",
"0.61446476",
"0.61216587",
"0.61056066",
"0.60806954",
"0.607929",
"0.6061315",
"0.6052114",
"0.6036594",
"0.5894365",
"0.5881682",
"0.58722955",
"0.58669436",
"0.5850325",
"0.582897... | 0.8258931 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.