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 |
|---|---|---|---|---|---|---|
Test that we fallback to cn if there is no displayname nor gcos | def test_user_no_displayname_no_gcos(dummy_user_dict):
del dummy_user_dict["displayname"]
del dummy_user_dict["gecos"]
dummy_user_dict["cn"] = ["CN"]
user = User(dummy_user_dict)
assert user.name == "CN" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_no_displayname_no_gcos_no_cn(dummy_user_dict):\n del dummy_user_dict[\"displayname\"]\n del dummy_user_dict[\"gecos\"]\n del dummy_user_dict[\"cn\"]\n user = User(dummy_user_dict)\n assert user.name is None",
"def ValidateDisplayName(display_name):\n if display_name is not None and ... | [
"0.6524058",
"0.58852845",
"0.5666493",
"0.5665791",
"0.5654227",
"0.54735464",
"0.5469024",
"0.5469024",
"0.5469024",
"0.5469024",
"0.5469024",
"0.54659855",
"0.5449569",
"0.53934294",
"0.5368459",
"0.5359428",
"0.53472394",
"0.533857",
"0.533636",
"0.5329113",
"0.5329113",
... | 0.6621293 | 0 |
Test that we fallback to cn if there is no displayname nor gcos | def test_user_no_displayname_no_gcos_no_cn(dummy_user_dict):
del dummy_user_dict["displayname"]
del dummy_user_dict["gecos"]
del dummy_user_dict["cn"]
user = User(dummy_user_dict)
assert user.name is None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_no_displayname_no_gcos(dummy_user_dict):\n del dummy_user_dict[\"displayname\"]\n del dummy_user_dict[\"gecos\"]\n dummy_user_dict[\"cn\"] = [\"CN\"]\n user = User(dummy_user_dict)\n assert user.name == \"CN\"",
"def ValidateDisplayName(display_name):\n if display_name is not None a... | [
"0.66205984",
"0.5885735",
"0.5667276",
"0.56651855",
"0.565568",
"0.547335",
"0.5470524",
"0.5470524",
"0.5470524",
"0.5470524",
"0.5470524",
"0.54652536",
"0.5450915",
"0.5394224",
"0.5367775",
"0.53575623",
"0.5349093",
"0.53388125",
"0.53359413",
"0.53286374",
"0.53286374... | 0.65224785 | 1 |
Gets the 95th percentile of bleakest_eval from bigtable | def get_95_percentile_bleak(n_back=500):
end_game = int(bigtable_input._games_nr.latest_game_number())
start_game = end_game - n_back if end_game >= n_back else 0
moves = bigtable_input._games_nr.bleakest_moves(start_game, end_game)
evals = np.array([m[2] for m in moves])
return np.percentile(evals,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ninetieth_percentile(y_test, y_pred) :\n return np.abs(y_test - y_pred).sort_values().iloc[int(len(y_test)*0.90)]/60",
"def tenth_percentile(y_test, y_pred) :\n return np.abs(y_test - y_pred).sort_values().iloc[int(len(y_test)*0.10)]/60",
"def compute_percentile(value, cutoffs):\n\tif value < cutoffs... | [
"0.66710836",
"0.64393985",
"0.6213645",
"0.61712694",
"0.61712694",
"0.61691296",
"0.6116343",
"0.60878766",
"0.6070936",
"0.6057565",
"0.6057565",
"0.5990582",
"0.5941295",
"0.59283644",
"0.592614",
"0.5912521",
"0.5911487",
"0.5907796",
"0.5905875",
"0.5864946",
"0.5858764... | 0.7476899 | 0 |
Updates the flagfile at `flags_path`, changing the value for `resign_threshold` to `new_threshold` | def update_flagfile(flags_path, new_threshold):
if abs(new_threshold) > 1:
raise ValueError("Invalid new percentile for resign threshold")
with tf.gfile.GFile(flags_path) as f:
lines = f.read()
if new_threshold > 0:
new_threshold *= -1
if not RESIGN_FLAG_REGEX.search(lines):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ctrl_update_flags(self, flags, old_dst, old_src, new_val, sub_op):\n of_cond = self.create_overflow_condition(old_dst, old_src, new_val, sub_op)\n cf_cond = self.create_carry_condition(new_val, sub_op)\n\n valid_flags = {'C': cf_cond is True,\n 'Z': new_val & 0xFF == ... | [
"0.5232395",
"0.50572014",
"0.50224495",
"0.5003035",
"0.4994549",
"0.4984667",
"0.4941392",
"0.48769605",
"0.48551136",
"0.48338896",
"0.48318133",
"0.48245242",
"0.4822055",
"0.48098576",
"0.47942355",
"0.47704318",
"0.47618973",
"0.47563523",
"0.46765515",
"0.46269655",
"0... | 0.8416566 | 0 |
Authenticate with SoundCloud API. Cache access token in the secrets file. | def init_api():
global soundcloud
import json
SECRETS_VERSION = 1
# Load secrets file
if os.path.exists(config.token_cache):
with open(config.token_cache, 'r', encoding='utf-8') as f:
secrets = json.load(f)
else:
secrets = {}
# Try to reuse the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate(self):\n try:\n self._token = self._lookup_token()\n except:\n raise HTTPError(\n \"Unable to get short-lived access token for cyberark storage\"\n )",
"def authenticate():\n\n # We are uploading and then downloading so we want Mus... | [
"0.69103223",
"0.6770919",
"0.65899146",
"0.6582983",
"0.6582983",
"0.6426025",
"0.64257234",
"0.6412163",
"0.63717526",
"0.63108236",
"0.62029386",
"0.61904144",
"0.6170871",
"0.61696583",
"0.6121056",
"0.6096839",
"0.60418415",
"0.60281444",
"0.60094726",
"0.6006562",
"0.59... | 0.7882311 | 0 |
Return true if the respost exists, according to soundcloud. Also update the database if a repost is already deleted on soundcloud, but is not marked as deleted in the db. | def check_repost_exists(type, id):
try:
soundcloud.get('/e1/me/{}_reposts/{}'.format(type, id))
return True
except HTTPError as e:
if e.response.status_code == 404:
db.mark_as_deleted(type, id)
return False
else:
raise | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exists(self):\r\n try:\r\n self.refresh()\r\n except:\r\n return False\r\n return True",
"def is_new_post(self, post):\n return self.last_post != post['id']",
"def check_repost(post, user):\n if not user.is_authenticated():\n return 'not_auth' # ... | [
"0.6219022",
"0.59738153",
"0.59722084",
"0.59081906",
"0.5828247",
"0.5757684",
"0.5751083",
"0.5581836",
"0.556682",
"0.556317",
"0.55112916",
"0.5496816",
"0.54759526",
"0.54759526",
"0.54688525",
"0.54517484",
"0.5447654",
"0.54395247",
"0.5435582",
"0.5389179",
"0.536449... | 0.7226926 | 0 |
Repost a resource into the group and update the database. | def group_repost(user_id, resource_type, resource_id):
logging.info('Reposting %s %d...', resource_type, resource_id)
soundcloud.put('/e1/me/{}_reposts/{}'.format(resource_type, resource_id))
db.record_repost(user_id, resource_type, resource_id)
db.commit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_post_resource(self, req, resp, *args, **params):\n instance = self.get_object(**params)\n self.save_object(req.params, req, resp, instance, **params)",
"def post_security_group_update(self, resource_id, resource_dict):\n pass",
"def _resubmit(self, *args, **kwargs):\n self.re... | [
"0.6204693",
"0.6052708",
"0.59446126",
"0.59445024",
"0.5799984",
"0.57475936",
"0.57475936",
"0.57396287",
"0.5733804",
"0.5732188",
"0.5626466",
"0.5625362",
"0.5611247",
"0.5603161",
"0.55945265",
"0.55783963",
"0.55557644",
"0.552884",
"0.54994965",
"0.5487721",
"0.54834... | 0.70165044 | 0 |
Delete a resource from the group and update the database. | def group_delete(user_id, resource_type, resource_id):
logging.info('Deleting %s %d...', resource_type, resource_id)
soundcloud.delete('/e1/me/{}_reposts/{}'.format(resource_type, resource_id))
db.record_deletion(user_id, resource_type, resource_id)
db.commit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self):\n import labstep.entities.resource.repository as resourceRepository\n\n return resourceRepository.editResource(self, deleted_at=getTime())",
"def test_delete_resource_group(self):\n pass",
"def delete(openstack_resource):\n openstack_resource.delete()",
"def delete()... | [
"0.7100132",
"0.7027492",
"0.6920822",
"0.6880339",
"0.6865927",
"0.67449135",
"0.6699044",
"0.6655716",
"0.6652711",
"0.66081554",
"0.6541622",
"0.6539928",
"0.6534143",
"0.65040797",
"0.6388483",
"0.6388483",
"0.6388483",
"0.6388483",
"0.6381689",
"0.6329746",
"0.6328542",
... | 0.72901237 | 0 |
Set a flag to update the description once all comments are processed. | def request_description_update():
global should_update_description
should_update_description = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_description_debounced(self, value):\n self.update_description(value)",
"def set_description(desc):\n global last_description\n last_description = desc",
"def set_description(self, description):\r\n self.__description = description",
"def description(self, new_description):\r\n ... | [
"0.67883927",
"0.6781191",
"0.6655528",
"0.66096985",
"0.65891665",
"0.65389127",
"0.6520836",
"0.64286363",
"0.6415596",
"0.641495",
"0.641495",
"0.641495",
"0.641495",
"0.6397862",
"0.63956046",
"0.63900524",
"0.6380967",
"0.6380967",
"0.6380967",
"0.6380967",
"0.6380967",
... | 0.75725305 | 0 |
`dict` group configurations keyed by name | def groups(self):
group_config = {}
# legacy way of threating any dict as a potential
# group config (pre #44 implementation)
# supported until vaping 2.0
for k,v in list(self.config.items()):
if isinstance(v, collections.Mapping):
group_config[k] =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_group_dicts(self):\n\n all_groups = set()\n\n for detection in config['detections'].values():\n if 'action' in detection and detection['action'] == 'buy':\n if 'groups' in detection:\n for group in detection['groups']:\n al... | [
"0.64101",
"0.6327717",
"0.63224345",
"0.61177534",
"0.61143225",
"0.6107522",
"0.6007326",
"0.58925676",
"0.58895403",
"0.5835795",
"0.582298",
"0.580441",
"0.5785304",
"0.56956583",
"0.5687126",
"0.5680097",
"0.5602832",
"0.5600695",
"0.55983984",
"0.5597506",
"0.5594908",
... | 0.7403048 | 0 |
creates and returns new message `dict`, setting `type`, `source`, `ts`, `data` `data` is initialized to an empty array Returns message (`dict`) | def new_message(self):
msg = {}
msg['data'] = []
msg['type'] = self.plugin_type
msg['source'] = self.name
msg['ts'] = (datetime.datetime.utcnow() - datetime.datetime(1970, 1, 1)).total_seconds()
return msg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, msg: dict):\n\n for key, value in msg.items():\n setattr(self, key, value)\n self.data = msg\n self.dt = datetime.fromisoformat(self.timestamp)",
"def transformMessage(self):\n\n message = json.loads(self.message)\n\n call_data = {\n 'ca... | [
"0.657394",
"0.64370185",
"0.6369165",
"0.6215842",
"0.6215842",
"0.6197032",
"0.61927515",
"0.6148582",
"0.6145553",
"0.61364484",
"0.60306203",
"0.5966783",
"0.5927442",
"0.58727574",
"0.5813844",
"0.5785403",
"0.57741964",
"0.57672644",
"0.57665217",
"0.57646066",
"0.57078... | 0.74926597 | 0 |
creates a subprocess with passed args Returns Popen instance | def popen(self, args, **kwargs):
self.log.debug("popen %s", ' '.join(args))
return vaping.io.subprocess.Popen(args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_process(self, args=[], *popenargs, **kwargs):\n try:\n startupinfo = subprocess.STARTUPINFO()\n startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW\n kwargs.setdefault('startupinfo', startupinfo)\n except:\n pass\n kwargs.setdefault('un... | [
"0.76723176",
"0.7587004",
"0.73669636",
"0.72725964",
"0.72679687",
"0.70070004",
"0.69992423",
"0.69684494",
"0.6902572",
"0.6820378",
"0.67948174",
"0.67915964",
"0.678975",
"0.678923",
"0.67641646",
"0.66676784",
"0.66353923",
"0.65361035",
"0.65184724",
"0.6518346",
"0.6... | 0.80149055 | 0 |
logger instance for plugin type | def log(self):
if not self._logger:
self._logger = logging.getLogger('vaping.plugins.' + self.plugin_type)
return self._logger | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_logger(self):",
"def logger(self):\n pass",
"def __init__(self):\n self.logger = logger()",
"def __init__(self):\n\n self.log = logger.getLogger(name=\"directord\")",
"def __init__(self):\n self.logger = logging.getLogger(FeatureEngineeringLogger.__name__)",
"def buil... | [
"0.73108566",
"0.71119756",
"0.68729246",
"0.68288493",
"0.6814063",
"0.6643799",
"0.6631724",
"0.6627801",
"0.66231793",
"0.65565336",
"0.6532955",
"0.6517596",
"0.6504724",
"0.64651346",
"0.6436994",
"0.63748336",
"0.6320188",
"0.6318142",
"0.63155955",
"0.630599",
"0.62634... | 0.7757826 | 0 |
queue an emission of a message for all output plugins Arguments | def queue_emission(self, msg):
if not msg:
return
for _emitter in self._emit:
if not hasattr(_emitter, 'emit'):
continue
def emit(emitter=_emitter):
self.log.debug("emit to {}".format(emitter.name))
emitter.emit(msg)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_function(**kwargs):\n\n\t\toutput_queue = kwargs['q']\n\t\twhile True:\n\t\t\titem = output_queue.get()\n\t\t\t# expects to get a string or None\n\t\t\tif item is None:\n\t\t\t\tbreak\n\t\t\toutfile.write(item)\n\t\t\t# outfile.write(\"output_function:: {item}\".format(item=item)+\"\\n\")\n\t\t\toutput_... | [
"0.60872614",
"0.5945144",
"0.59260297",
"0.59092003",
"0.58465993",
"0.5714343",
"0.5665754",
"0.56151253",
"0.5593914",
"0.5585872",
"0.5585872",
"0.5585872",
"0.5585872",
"0.5585872",
"0.5585872",
"0.5554473",
"0.5533875",
"0.549778",
"0.54847586",
"0.5459334",
"0.54484266... | 0.62826663 | 0 |
emit and remove the first emission in the queue | def send_emission(self):
if self._emit_queue.empty():
return
emit = self._emit_queue.get()
emit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_first(self):\n self.deque.pop(0)",
"def dequeue(self):\r\n return self.queue.pop(0)",
"def pop(self):\r\n return self.queue.pop(0)",
"def dequeue(self):\n return self.queue.pop(0)",
"def queue_emission(self, msg):\n if not msg:\n return\n for ... | [
"0.65136707",
"0.61705273",
"0.6156415",
"0.6083466",
"0.60746723",
"0.60541797",
"0.60505503",
"0.59951586",
"0.5936325",
"0.5912753",
"0.5911044",
"0.58870256",
"0.5882075",
"0.5882075",
"0.58683664",
"0.58458984",
"0.5829686",
"0.58193946",
"0.5809367",
"0.5806965",
"0.579... | 0.6335579 | 1 |
emit and remove all emissions in the queue | def emit_all(self):
while not self._emit_queue.empty():
self.send_emission() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_emission(self):\n if self._emit_queue.empty():\n return\n emit = self._emit_queue.get()\n emit()",
"def queue_emission(self, msg):\n if not msg:\n return\n for _emitter in self._emit:\n if not hasattr(_emitter, 'emit'):\n ... | [
"0.6907306",
"0.6813454",
"0.6777606",
"0.65254974",
"0.6431948",
"0.63691956",
"0.63535166",
"0.63029647",
"0.62848836",
"0.6125597",
"0.6116918",
"0.6115065",
"0.6113113",
"0.60741436",
"0.60656524",
"0.60627425",
"0.60400844",
"0.60000175",
"0.59864897",
"0.5860363",
"0.58... | 0.7361969 | 0 |
Here we validate that our filehandler is pointing to an existing file. If it doesnt, because file has been deleted, we close the filehander and try to reopen | def validate_file_handler(self):
if self.fh.closed:
try:
self.fh = open(self.path, "r")
self.fh.seek(0, 2)
except OSError as err:
logging.error("Could not reopen file: {}".format(err))
return False
open_stat = os.fs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_file_deleted(self):\n try:\n with get_temp_file() as (fd, name):\n os.unlink(name)\n except Exception as err:\n self.fail('Failed with exception \"{}\"'.format(err))",
"def close(self) -> None:\n if self.file_handler:\n self.file_handl... | [
"0.6699122",
"0.65485364",
"0.63995856",
"0.6399519",
"0.6396869",
"0.6383093",
"0.6045455",
"0.6025384",
"0.5983456",
"0.59830105",
"0.597813",
"0.5963656",
"0.5961477",
"0.5950006",
"0.59438777",
"0.5907139",
"0.5896517",
"0.58615994",
"0.58526576",
"0.5834653",
"0.5818726"... | 0.7340528 | 0 |
accept message to emit | def emit(self, message): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emit(data):",
"def receive(self, message):",
"def receive(self):\n pass",
"def receive(self, msg):\n pass",
"def handle_accept(self):\r\n pass",
"def handle(self, message):",
"def accept(self, event):\n raise NotImplementedError()",
"def receive():\n pass",
"def a... | [
"0.699732",
"0.6608894",
"0.65500426",
"0.65143687",
"0.64708894",
"0.6423427",
"0.63328993",
"0.6292642",
"0.62430483",
"0.62041724",
"0.61830676",
"0.6182339",
"0.61788404",
"0.61708754",
"0.609756",
"0.6090819",
"0.60893077",
"0.6083992",
"0.6030369",
"0.60288525",
"0.6024... | 0.8129066 | 0 |
Returns a dict containing the various filename formatter values Values are gotten from the vaping data message as well as the currently processed row in the message Arguments | def filename_formatters(self, data, row):
r = {
"source" : data.get("source"),
"field" : self.field,
"type" : data.get("type")
}
r.update(**row)
return r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filenames(self) -> dict[str, str]:\r\n ...",
"def map_file_format_info(file_format_event, file_validation_event):\n event_info = {}\n if not file_format_event:\n return\n try:\n event_info.update(\n {\n \"dct:FileFormat\": file_format_event.event_outcom... | [
"0.5899487",
"0.586862",
"0.58116794",
"0.5770152",
"0.575695",
"0.55263674",
"0.5516201",
"0.5448604",
"0.5429166",
"0.5357836",
"0.5328083",
"0.53153014",
"0.5263745",
"0.51659256",
"0.50826246",
"0.50714976",
"0.5064152",
"0.5055028",
"0.5017024",
"0.50022215",
"0.49784836... | 0.6851664 | 0 |
Label the provided ICA components with the ICLabel neural network. ICLabel is designed to classify ICs fitted with an extended infomax ICA decomposition algorithm on EEG datasets referenced to a common average and filtered between [1., 100.] Hz. It is possible to run ICLabel on datasets that do not meet those specifica... | def iclabel_label_components(
inst: Union[BaseRaw, BaseEpochs],
ica: ICA,
inplace: bool = True,
backend: Optional[str] = None,
):
features = get_iclabel_features(inst, ica)
labels_pred_proba = run_iclabel(*features, backend=backend) # type: ignore
if inplace:
from mne_icalabel.conf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _run_iclabel(images: ArrayLike, psds: ArrayLike, autocorr: ArrayLike) -> NDArray:\n # load weights\n network_file = files(\"mne_icalabel.iclabel.network\") / \"assets\" / \"ICLabelNet.pt\"\n iclabel_net = ICLabelNet()\n iclabel_net.load_state_dict(torch.load(network_file))\n # format inputs and ... | [
"0.62045825",
"0.6137364",
"0.60607266",
"0.5875136",
"0.5775551",
"0.5774383",
"0.5720462",
"0.567829",
"0.5673847",
"0.5587884",
"0.55063105",
"0.5473702",
"0.54581785",
"0.5449399",
"0.5438388",
"0.542551",
"0.54028636",
"0.53972393",
"0.53966945",
"0.5395051",
"0.53771865... | 0.72729254 | 0 |
Test if path is correctly recognized as not hidden. | def test_is_not_hidden(self) -> None:
path = "home"
result = is_hidden(path)
self.assertFalse(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_hidden(self, path):\n return False",
"def _isPathHidden(self, path: Path) -> bool:\n if os.name == 'nt': # on Windows, check Windows flags of the path\n try:\n fileAttrs = win32api.GetFileAttributes(str(path))\n return fileAttrs & (win32con.FILE_ATTR... | [
"0.82105416",
"0.8147075",
"0.8074287",
"0.79748076",
"0.79527706",
"0.78247166",
"0.7760722",
"0.76462585",
"0.7565071",
"0.70671797",
"0.70537364",
"0.6908462",
"0.6908462",
"0.6827894",
"0.66952556",
"0.6647296",
"0.65984875",
"0.65974015",
"0.6504221",
"0.64817345",
"0.64... | 0.82911503 | 0 |
Test getting dataset path. | def test_get_dataset_path(self) -> None:
framework = "tensorflow"
domain = "image_recognition"
result = get_dataset_path(framework, domain)
self.assertEqual(result, "examples/test/dataset/imagenet") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_make_dataset_happy_path(self):\n # User story: user runs src.make_dataset() on the current directory\n # and gets a fully functional dataset\n pass",
"def test_data_path(self):\n path = self._api.GetDatapath()\n self._api.End()\n self.assertRaises(\n ... | [
"0.75778013",
"0.75268173",
"0.7313395",
"0.70568323",
"0.6979461",
"0.69666904",
"0.69261616",
"0.6925592",
"0.6921823",
"0.69095963",
"0.679207",
"0.6753882",
"0.6716215",
"0.67095876",
"0.6703324",
"0.6695395",
"0.6667533",
"0.66508496",
"0.6650378",
"0.66204023",
"0.66069... | 0.82967913 | 0 |
Test getting dataset path failure. | def test_get_dataset_path_unknown_domain(self) -> None:
framework = "tensorflow"
domain = "domain"
with self.assertRaises(Exception):
get_dataset_path(framework, domain) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_data_path(self):\n path = self._api.GetDatapath()\n self._api.End()\n self.assertRaises(\n RuntimeError, self._api.Init, path=(self._test_dir + os.path.sep)\n ) # no tessdata\n if _TESSERACT_VERSION >= 0x3999800:\n new_path = path\n else:\n ... | [
"0.74248797",
"0.71991664",
"0.71628946",
"0.7049641",
"0.68198264",
"0.6784641",
"0.66754675",
"0.6576848",
"0.6568233",
"0.65432364",
"0.6533707",
"0.6523117",
"0.65167046",
"0.6403536",
"0.63809836",
"0.6379454",
"0.6332501",
"0.6325068",
"0.63231117",
"0.6315364",
"0.6292... | 0.7332925 | 1 |
Test getting framework name from path. | def test_get_onnx_framework_from_path(self) -> None:
path = "/home/user/model.onnx"
result = get_framework_from_path(path)
self.assertEqual(result, "onnxrt") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_unknown_framework_from_path(self) -> None:\n path = \"/home/user/model.some_extension\"\n result = get_framework_from_path(path)\n self.assertIsNone(result)",
"def infoForFramework(filename):\n global FRAMEWORK_RE\n if FRAMEWORK_RE is None:\n import re\n FRAM... | [
"0.7062699",
"0.69441956",
"0.64345545",
"0.64053917",
"0.6366199",
"0.6274874",
"0.6201753",
"0.6191427",
"0.60973287",
"0.6045537",
"0.59635186",
"0.5961694",
"0.5953851",
"0.5943369",
"0.58846164",
"0.58798844",
"0.5822605",
"0.5822605",
"0.5822379",
"0.5800866",
"0.577057... | 0.7172764 | 0 |
Test getting framework name from path. | def test_get_unknown_framework_from_path(self) -> None:
path = "/home/user/model.some_extension"
result = get_framework_from_path(path)
self.assertIsNone(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_onnx_framework_from_path(self) -> None:\n path = \"/home/user/model.onnx\"\n result = get_framework_from_path(path)\n self.assertEqual(result, \"onnxrt\")",
"def infoForFramework(filename):\n global FRAMEWORK_RE\n if FRAMEWORK_RE is None:\n import re\n FRAMEW... | [
"0.7172764",
"0.69441956",
"0.64345545",
"0.64053917",
"0.6366199",
"0.6274874",
"0.6201753",
"0.6191427",
"0.60973287",
"0.6045537",
"0.59635186",
"0.5961694",
"0.5953851",
"0.5943369",
"0.58846164",
"0.58798844",
"0.5822605",
"0.5822605",
"0.5822379",
"0.5800866",
"0.577057... | 0.7062699 | 1 |
Test getting file extension from path. | def test_get_file_extension(self) -> None:
path = "/home/user/file.ext"
result = get_file_extension(path)
self.assertEqual(result, "ext") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_file_with_dots_extension(self) -> None:\n path = \"/home/user/file.name.ext2\"\n result = get_file_extension(path)\n self.assertEqual(result, \"ext2\")",
"def extension_from_path(path):\n extension = path.split(\".\")[-1]\n return extension",
"def _get_ext(self, ... | [
"0.86800325",
"0.81086683",
"0.8072279",
"0.7949813",
"0.79368246",
"0.7920298",
"0.7789062",
"0.76943505",
"0.755353",
"0.75219536",
"0.749016",
"0.74370855",
"0.7421382",
"0.7406953",
"0.7355715",
"0.73351365",
"0.733208",
"0.7278737",
"0.72730386",
"0.71788836",
"0.7164469... | 0.8825947 | 0 |
Test getting file extension from path. | def test_get_file_with_dots_extension(self) -> None:
path = "/home/user/file.name.ext2"
result = get_file_extension(path)
self.assertEqual(result, "ext2") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_file_extension(self) -> None:\n path = \"/home/user/file.ext\"\n result = get_file_extension(path)\n self.assertEqual(result, \"ext\")",
"def extension_from_path(path):\n extension = path.split(\".\")[-1]\n return extension",
"def _get_ext(self, path):\n r... | [
"0.8825947",
"0.81086683",
"0.8072279",
"0.7949813",
"0.79368246",
"0.7920298",
"0.7789062",
"0.76943505",
"0.755353",
"0.75219536",
"0.749016",
"0.74370855",
"0.7421382",
"0.7406953",
"0.7355715",
"0.73351365",
"0.733208",
"0.7278737",
"0.72730386",
"0.71788836",
"0.7164469"... | 0.86800325 | 1 |
Test if record is a valid dataset file. | def test_record_is_dataset_file(self) -> None:
path = "/home/user/dataset.record"
result = is_dataset_file(path)
self.assertTrue(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid(self, dataset):\n pass",
"def validate_dataset(self, path: str = None) -> bool:\n checked = {} # type: Dict[str, Any]\n # Check path exists\n path = path if path is not None else self.path\n if not os.path.exists(path):\n raise ValueError('The path to t... | [
"0.71040785",
"0.6863867",
"0.68257785",
"0.67931664",
"0.67237216",
"0.6699486",
"0.6648243",
"0.65024203",
"0.64735746",
"0.6458235",
"0.6451198",
"0.64415586",
"0.64020693",
"0.6372555",
"0.6347536",
"0.6343386",
"0.6315279",
"0.629199",
"0.6281639",
"0.625653",
"0.6246272... | 0.80596375 | 0 |
Test getting predefined config path for TF image recognition models. | def test_get_predefined_tf_image_recognition_config_path(self) -> None:
self._assert_predefined_config_path(
framework="tensorflow",
domain="image_recognition",
domain_flavour="",
expected_filename="image_recognition.yaml",
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_predefined_onnx_image_recognition_config_path(self) -> None:\n self._assert_predefined_config_path(\n framework=\"onnxrt\",\n domain=\"image_recognition\",\n domain_flavour=\"\",\n expected_filename=\"image_recognition.yaml\",\n )",
"def test... | [
"0.75592035",
"0.7412118",
"0.72849274",
"0.717529",
"0.6809559",
"0.6795905",
"0.6554628",
"0.64774716",
"0.64007187",
"0.6367952",
"0.63568515",
"0.62823087",
"0.6041288",
"0.59696573",
"0.59272754",
"0.5859404",
"0.5838563",
"0.58267045",
"0.5783078",
"0.575788",
"0.569827... | 0.83963805 | 0 |
Test getting predefined config path for TF object detection models. | def test_get_predefined_tf_object_detection_config_path(self) -> None:
self._assert_predefined_config_path(
framework="tensorflow",
domain="object_detection",
domain_flavour="",
expected_filename="object_detection.yaml",
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_predefined_tf_object_detection_unknown_flavour_config_path(self) -> None:\n self._assert_predefined_config_path(\n framework=\"tensorflow\",\n domain=\"object_detection\",\n domain_flavour=\"foo\",\n expected_filename=\"object_detection.yaml\",\n ... | [
"0.7654645",
"0.73946184",
"0.72947437",
"0.70547116",
"0.70378405",
"0.67137825",
"0.6437595",
"0.6437529",
"0.6192349",
"0.61044425",
"0.6100769",
"0.6069273",
"0.60661966",
"0.59318006",
"0.59008956",
"0.5850615",
"0.5848458",
"0.5828326",
"0.56665957",
"0.5662301",
"0.563... | 0.8449237 | 0 |
Test getting predefined config path for TF object detection models. | def test_get_predefined_tf_object_detection_unknown_flavour_config_path(self) -> None:
self._assert_predefined_config_path(
framework="tensorflow",
domain="object_detection",
domain_flavour="foo",
expected_filename="object_detection.yaml",
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_predefined_tf_object_detection_config_path(self) -> None:\n self._assert_predefined_config_path(\n framework=\"tensorflow\",\n domain=\"object_detection\",\n domain_flavour=\"\",\n expected_filename=\"object_detection.yaml\",\n )",
"def test_... | [
"0.84492755",
"0.7392796",
"0.7295014",
"0.70541734",
"0.7037769",
"0.67110646",
"0.64360476",
"0.64352703",
"0.61914104",
"0.61029863",
"0.61006165",
"0.6068131",
"0.6064642",
"0.59318507",
"0.59008795",
"0.58501637",
"0.5847948",
"0.5827509",
"0.5666658",
"0.5661751",
"0.56... | 0.76546496 | 1 |
Test getting predefined config path for TF NLP models. | def test_get_predefined_tf_nlp_config_path(self) -> None:
self._assert_predefined_config_path(
framework="tensorflow",
domain="nlp",
domain_flavour="",
expected_filename="nlp.yaml",
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_predefined_onnx_nlp_config_path(self) -> None:\n self._assert_predefined_config_path(\n framework=\"onnxrt\",\n domain=\"nlp\",\n domain_flavour=\"\",\n expected_filename=\"nlp.yaml\",\n )",
"def test_get_predefined_tf_recommendation_config_p... | [
"0.75173897",
"0.73409075",
"0.69700027",
"0.69696283",
"0.6721619",
"0.63614434",
"0.62693655",
"0.6259654",
"0.62449867",
"0.61654174",
"0.6153191",
"0.612614",
"0.60378885",
"0.6006346",
"0.59780526",
"0.587454",
"0.5872058",
"0.5816616",
"0.5811135",
"0.5782591",
"0.57571... | 0.8228239 | 0 |
Test getting predefined config path for TF recommendation models. | def test_get_predefined_tf_recommendation_config_path(self) -> None:
self._assert_predefined_config_path(
framework="tensorflow",
domain="recommendation",
domain_flavour="",
expected_filename="recommendation.yaml",
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_predefined_tf_nlp_config_path(self) -> None:\n self._assert_predefined_config_path(\n framework=\"tensorflow\",\n domain=\"nlp\",\n domain_flavour=\"\",\n expected_filename=\"nlp.yaml\",\n )",
"def test_get_predefined_tf_image_recognition_con... | [
"0.7441416",
"0.7052898",
"0.69839627",
"0.66950226",
"0.6658153",
"0.64765024",
"0.6476497",
"0.6430937",
"0.6410763",
"0.6309978",
"0.6242159",
"0.6237229",
"0.61450243",
"0.60556775",
"0.5982015",
"0.59642893",
"0.58971345",
"0.5868531",
"0.5844909",
"0.5821499",
"0.576090... | 0.84726024 | 0 |
Test getting predefined config path for onnx image recognition models. | def test_get_predefined_onnx_image_recognition_config_path(self) -> None:
self._assert_predefined_config_path(
framework="onnxrt",
domain="image_recognition",
domain_flavour="",
expected_filename="image_recognition.yaml",
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_predefined_tf_image_recognition_config_path(self) -> None:\n self._assert_predefined_config_path(\n framework=\"tensorflow\",\n domain=\"image_recognition\",\n domain_flavour=\"\",\n expected_filename=\"image_recognition.yaml\",\n )",
"def te... | [
"0.7796619",
"0.6986146",
"0.68707967",
"0.67667747",
"0.65804195",
"0.6415202",
"0.63782686",
"0.6302182",
"0.6213862",
"0.60774255",
"0.60295063",
"0.59473515",
"0.5907198",
"0.58103526",
"0.5796034",
"0.5795795",
"0.5795542",
"0.5785171",
"0.57451344",
"0.5743044",
"0.5689... | 0.84311223 | 0 |
Test getting predefined config path for onnx NLP models. | def test_get_predefined_onnx_nlp_config_path(self) -> None:
self._assert_predefined_config_path(
framework="onnxrt",
domain="nlp",
domain_flavour="",
expected_filename="nlp.yaml",
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_predefined_tf_nlp_config_path(self) -> None:\n self._assert_predefined_config_path(\n framework=\"tensorflow\",\n domain=\"nlp\",\n domain_flavour=\"\",\n expected_filename=\"nlp.yaml\",\n )",
"def test_get_predefined_onnx_image_recognition_c... | [
"0.7163459",
"0.7056394",
"0.6645824",
"0.64085156",
"0.6328148",
"0.62867266",
"0.61514914",
"0.61138886",
"0.61060506",
"0.6087492",
"0.6009389",
"0.59438986",
"0.5923466",
"0.5904732",
"0.58298385",
"0.5808922",
"0.58066463",
"0.5793833",
"0.5764205",
"0.5678265",
"0.56763... | 0.7960524 | 0 |
Test checking existing module. | def test_check_module(self) -> None:
check_module("os") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_module(self):\n pass",
"def test_module_exists(self):\n project_path = os.getcwd()\n rango_app_path = os.path.join(project_path, 'rango')\n forms_module_path = os.path.join(rango_app_path, 'forms.py')\n\n self.assertTrue(os.path.exists(forms_module_path), f\"{FAILURE_H... | [
"0.7775068",
"0.7622405",
"0.75304526",
"0.71911955",
"0.71885073",
"0.7102597",
"0.70338994",
"0.70180136",
"0.6914303",
"0.68790066",
"0.68734944",
"0.68504345",
"0.6809024",
"0.6796673",
"0.6772522",
"0.67269987",
"0.6687166",
"0.667671",
"0.6617383",
"0.6616602",
"0.65916... | 0.78205836 | 0 |
Test checking non existing module. | def test_check_non_existing_module(self) -> None:
with self.assertRaises(ClientErrorException):
check_module("non_existing_module") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testNoSuchModule(self):\n self.assertRaises(messages.DefinitionNotFoundError,\n messages.find_definition,\n 'does.not.exist',\n importer=self.Importer)",
"def test_check_module(self) -> None:\n check_module(\"os\")",
"... | [
"0.76044667",
"0.7416591",
"0.7399717",
"0.72337514",
"0.72061455",
"0.7133136",
"0.7049381",
"0.7046301",
"0.69785535",
"0.6971145",
"0.69622946",
"0.6960073",
"0.6942464",
"0.69311404",
"0.68618923",
"0.68603796",
"0.6849098",
"0.6828724",
"0.6819381",
"0.6799914",
"0.67798... | 0.8172532 | 0 |
Test getting models config. | def test_load_model_config(self) -> None:
result = load_model_config()
self.assertIs(type(result), dict)
self.assertIsNot(result, {}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_coupledmodels_get(self):\n pass",
"def test_get_model(self) -> None:\n get_model()",
"def testGetModelsData(self):\n models = models_logic._getModelsData()\n self.assertTrue(models)",
"def get_model_config(self, model_num=0):\n return [], resources.get_file(\n \"config/... | [
"0.7344181",
"0.6897746",
"0.6867049",
"0.65969276",
"0.6582802",
"0.655109",
"0.6541584",
"0.65313196",
"0.6443056",
"0.6425103",
"0.642088",
"0.63794756",
"0.6372846",
"0.62939525",
"0.6282946",
"0.6266822",
"0.6264599",
"0.62148494",
"0.61819917",
"0.6163742",
"0.6146844",... | 0.71640885 | 1 |
Test getting dataloaders config. | def test_load_dataloader_config(self) -> None:
result = load_dataloader_config()
self.assertIs(type(result), list)
self.assertIsNot(result, []) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dataloader(self) -> DataLoader:\n return self._custom_data_loader()",
"def test_dataloader(self) -> torch.utils.data.DataLoader: \n return torch.utils.data.DataLoader(self.dataset_test, **self.dl_kwargs)",
"def test_dataloader(self) -> data.DataLoader:\n return data.DataLo... | [
"0.6893552",
"0.6832417",
"0.6727525",
"0.67140794",
"0.6579673",
"0.6515249",
"0.642833",
"0.63334775",
"0.6258725",
"0.6231027",
"0.6213907",
"0.6207928",
"0.6139557",
"0.60178506",
"0.5996533",
"0.599519",
"0.5989954",
"0.59818614",
"0.59683573",
"0.59597766",
"0.5954509",... | 0.7478321 | 0 |
Test getting transforms config. | def test_load_transforms_config(self) -> None:
result = load_transforms_config()
self.assertIs(type(result), list)
self.assertIsNot(result, []) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_load_full_transform(self):\n self.add_transform(cond_artist=True, cond_album=True, cond_title=True,\n cond_ensemble=True, cond_composer=True, cond_conductor=True,\n change_artist=True, change_album=True, change_title=True,\n change_ensemble=True, change_composer=Tru... | [
"0.6457925",
"0.6132974",
"0.6045049",
"0.591944",
"0.5891703",
"0.5852024",
"0.581294",
"0.57519954",
"0.5733683",
"0.5728028",
"0.56447434",
"0.56063056",
"0.5597566",
"0.55973953",
"0.5580112",
"0.55531615",
"0.5521915",
"0.54951215",
"0.54724187",
"0.5457946",
"0.54475075... | 0.77776486 | 0 |
Assert predefined config path. | def _assert_predefined_config_path(
self,
framework: str,
domain: str,
domain_flavour: str,
expected_filename: str,
) -> None:
result = get_predefined_config_path(framework, domain, domain_flavour)
expected = os.path.join(
os.path.abspath(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_default_config_file_paths(\n config,\n):\n assert \"~/.config/yessssms.conf\" in CONFIG_FILE_PATHS\n assert \"/etc/yessssms.conf\" in CONFIG_FILE_PATHS",
"def test_expected_config(expectedconfig):\n expected = expectedconfig.read_text()\n config = CONFIGSDIR / expectedconfig.name\n\n a... | [
"0.72531724",
"0.6966318",
"0.687894",
"0.68690413",
"0.68319833",
"0.6828153",
"0.68121266",
"0.68025386",
"0.6744204",
"0.66994476",
"0.66757023",
"0.66216826",
"0.65864456",
"0.6554743",
"0.6550599",
"0.6525278",
"0.64727885",
"0.64717287",
"0.6456509",
"0.6455779",
"0.645... | 0.78012013 | 0 |
Check if development env is activated. | def test_is_development_env(self) -> None:
os.environ.update({"NC_MODE": "development"})
is_develop = is_development_env()
self.assertTrue(is_develop) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_development():\n return os.environ.get('SERVER_SOFTWARE', '').startswith('Development')",
"def get_site_env(self):\n return self.config['SITE_ENVIRONMENT'] == 'DEV'",
"def _global_development_mode() -> bool:\n return (\n not env_util.is_pex()\n and \"site-packages\" not in __fil... | [
"0.8337604",
"0.7692659",
"0.7504923",
"0.74659204",
"0.7465296",
"0.7377704",
"0.7323249",
"0.72394073",
"0.72125643",
"0.71630734",
"0.7148706",
"0.70545775",
"0.70386916",
"0.7021576",
"0.69120103",
"0.68301886",
"0.68271375",
"0.6818852",
"0.67625374",
"0.6734069",
"0.672... | 0.81877184 | 1 |
Test release tag building. | def test_release_tag(self) -> None:
self.assertEqual("v3.14.15", release_tag()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_release_deployment_run(self):\n pass",
"def test_release_tag_for_dev_version(self) -> None:\n self.assertEqual(\"v42.12\", release_tag())",
"def test_release_version():\n pkg_vars = {}\n with open(VERSION_FILE) as f:\n exec(f.read(), pkg_vars) # nosec\n project_version =... | [
"0.7284068",
"0.70147276",
"0.6728345",
"0.6709383",
"0.66933805",
"0.66797566",
"0.6608459",
"0.64857477",
"0.64158696",
"0.6389684",
"0.6376367",
"0.6313048",
"0.6291171",
"0.6285542",
"0.6277399",
"0.627431",
"0.6255137",
"0.6237298",
"0.62290806",
"0.6162094",
"0.6159651"... | 0.7737768 | 0 |
Turn URL into PIL image. Can throw a timout error. | def url2img(url : str, timeout = 1) -> Image:
response = requests.get(url, timeout = timeout)
return Image.open(BytesIO(response.content)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def urlToImage(url):\n\n response = requests.get(url)\n image = Image.open(BytesIO(response.content))\n return image",
"def _url_to_image(url: str) -> Image.Image:\n assert url.lower().startswith(\"http\"), \"invalid url, must start with http\"\n content = requests.get(url).content\n image = Im... | [
"0.7684103",
"0.7520165",
"0.74877226",
"0.7116487",
"0.7027549",
"0.7010515",
"0.6980545",
"0.6932684",
"0.68663347",
"0.680157",
"0.6707649",
"0.649833",
"0.64743775",
"0.64194036",
"0.62737274",
"0.62376577",
"0.62025154",
"0.61823267",
"0.61713475",
"0.61658984",
"0.61528... | 0.8368085 | 0 |
Goes through and removes all values in frames_rec and frames_proc that are outside of the window | def clean_window(self) -> None:
prune_before = time.time() - self.window_size
while self.frames_rec:
left = self.frames_rec.popleft()
if left[1] >= prune_before:
self.frames_rec.appendleft(left)
break
self.sum_frames_rec -= left[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_restriction_details(self):\n\t\n\t\tif getattr(self,'new_seq_win_objs',None):\n\t\t\tfor obj in self.new_seq_win_objs.keys():\n\t\t\t\tself.seqframe.delete(obj)\n\t\t\tself.new_seq_win_objs={}\n\t\t\tself.donepos={}\n\t\t\t#\n\t\t\tfor obj in self.temp_objs.keys():\n\t\t\t\tself.seqframe.delete(obj)\n\t\... | [
"0.6719497",
"0.6220488",
"0.6218328",
"0.59831357",
"0.5953131",
"0.58991516",
"0.58938974",
"0.58484584",
"0.58360916",
"0.57718647",
"0.5765755",
"0.5718492",
"0.56914794",
"0.563131",
"0.56236684",
"0.56055874",
"0.55914086",
"0.5591337",
"0.55780524",
"0.5515344",
"0.546... | 0.7736172 | 0 |
Returns True if we have a full window of information available, False otherwise | def have_window(self) -> bool:
return (
self._first_enc_at is not None
and (time.time() > self._first_enc_at + self.window_size)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exists(self):\n if self.attributes[AT.GARBAGE]:\n return False\n if get_ticks() < self.attributes[AT.TIME_TO_BE_SHOWN]:\n return False\n return True",
"def is_full(self) -> bool:",
"def _can_render_now(self):\n # First check that no update events are pendin... | [
"0.6700973",
"0.66572267",
"0.65650487",
"0.65073746",
"0.644696",
"0.6444967",
"0.6371296",
"0.63529104",
"0.632829",
"0.6322513",
"0.629695",
"0.6292452",
"0.6283709",
"0.6269726",
"0.62444526",
"0.62417144",
"0.6239692",
"0.6218333",
"0.6218333",
"0.62145",
"0.6200358",
... | 0.7614796 | 0 |
Spawns the ffmpeg process | def _spawn_ffmpeg(self) -> None:
if self.ffmpeg_proc is not None:
raise RuntimeError('_spawn_ffmpeg called when ffmpeg_proc is '
+ f'{self.ffmpeg_proc} (not None)')
args = ['ffmpeg', '-f', 'rawvideo', '-vcodec', 'rawvideo',
'-s', f'{self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start(self) -> None:\r\n self._spawn_ffmpeg()",
"def ffmpeg(*options):\n\tffmpeg_command = [\"ffmpeg\"] + list(options)\n\tprint(\"Calling FFMPEG:\", \" \".join(ffmpeg_command))\n\n\tprocess = subprocess.Popen(ffmpeg_command, stdout=subprocess.PIPE)\n\t(cout, cerr) = process.communicate()\n\texit_code... | [
"0.80590403",
"0.70434517",
"0.6731381",
"0.6610697",
"0.65816295",
"0.638432",
"0.62684786",
"0.61771494",
"0.61691076",
"0.61160266",
"0.60946435",
"0.6022187",
"0.60099894",
"0.5973808",
"0.59619623",
"0.5928561",
"0.59079623",
"0.5861136",
"0.5848352",
"0.582267",
"0.5821... | 0.81389457 | 0 |
Cleans up the ffmpeg process. This will wait for it to terminate | def _cleanup_ffmpeg(self) -> None:
self.ffmpeg_proc.communicate()
self.ffmpeg_proc = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def async_stop_ffmpeg(self):\n return self.ffmpeg.close()",
"def _cleanup_proc(self):\n logger.debug(\"{}: Cleaning up and waiting for process to exit\".format(\n self))\n try:\n self._loop.remove_reader(self.... | [
"0.731078",
"0.6837441",
"0.6784892",
"0.6526165",
"0.6473467",
"0.6470982",
"0.632042",
"0.63029844",
"0.6262408",
"0.6260875",
"0.61485505",
"0.61473036",
"0.60400724",
"0.60322404",
"0.6029492",
"0.6027344",
"0.6026851",
"0.6022948",
"0.5987162",
"0.59848726",
"0.59642464"... | 0.86087924 | 0 |
Registers the specified queuelike object as something frames can be received from. Must have a get_nowait and empty member. | def register_queue(self, queue) -> None:
if queue is None:
raise ValueError('queue is None')
if not hasattr(queue, 'empty'):
raise ValueError(f'queue {queue} is missing empty member')
if not hasattr(queue, 'get_nowait'):
raise ValueError(f'queue {queue} ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_queue_declared(frame):\n start_consuming(frame)",
"def example(example_object, queue):\n queue.put(example_object)",
"def example(example_object, queue_object):\n queue_object.put(example_object)",
"def on_queue_declared(frame):\n channel.basic_consume(handle_delivery, queue='test')",
"d... | [
"0.66028094",
"0.629318",
"0.61060864",
"0.597517",
"0.580639",
"0.5723007",
"0.5670818",
"0.565421",
"0.55929124",
"0.5555419",
"0.55552125",
"0.5430858",
"0.5422504",
"0.54204226",
"0.5383923",
"0.5375583",
"0.5371588",
"0.5342425",
"0.5279118",
"0.5275986",
"0.5268184",
... | 0.69833153 | 0 |
Checks for items from each of the receive queues and pushes them onto the local memory dict. Returns the number of frames received | def check_queues(self) -> int:
nframes = 0
for queue in self.receive_queues:
if not queue.empty():
nframes += 1
frame, img_bytes = queue.get_nowait()
if frame < self.next_frame:
raise ValueError('received frame ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_queues(self):\n\t\t#queues = [get_queue(lane) for lane in self.Vissim_Lanes]\n\t\t\n\t\tqueues = [0. if queue.AttValue('QLen(Current, Last)') is None else queue.AttValue('QLen(Current, Last)') for queue in self.queues_counters]\n\t\treturn queues",
"def queue_lengths(self):\r\n out = []\r\n ... | [
"0.58479637",
"0.58138037",
"0.5686759",
"0.55891025",
"0.5548044",
"0.55331",
"0.5531125",
"0.55247325",
"0.5522078",
"0.55212706",
"0.55021536",
"0.5491394",
"0.54898417",
"0.5464607",
"0.54142845",
"0.54142845",
"0.54142845",
"0.54142845",
"0.54142845",
"0.54142845",
"0.54... | 0.7559541 | 0 |
Processes the next frame to the ffmpeg process if it is available. Returns True if we processed a frame, False if we did not. | def process_frame(self) -> bool:
if self.next_frame not in self.ooo_frames:
return False
img_bytes = self.ooo_frames.pop(self.next_frame)
for kb_start in range(0, len(img_bytes), self.block_size):
self.ffmpeg_proc.stdin.write(
img_bytes[kb_start:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(self, frame, metadata):\n self.log.debug(f\"In process() method...\")\n\n # Publishing metadata & frames\n self.publisher.publish((metadata, frame.tobytes(),))\n metadata, frame = self.subscriber.recv()\n\n if \"jpnb_frame_drop\" in metadata:\n del metadata... | [
"0.681551",
"0.62653166",
"0.62197095",
"0.62151057",
"0.6016715",
"0.5888307",
"0.585658",
"0.5855879",
"0.58241194",
"0.57367325",
"0.5663488",
"0.565733",
"0.561935",
"0.5575768",
"0.55190694",
"0.54909426",
"0.5479278",
"0.547769",
"0.54572225",
"0.54553086",
"0.54294866"... | 0.8323678 | 0 |
Helping function to get the color of the dock | def _getDockColor(self, plane):
color = (0,0,0)
if plane.zAxis != -1:
color = self.globalAxis[plane.zAxis].color[0:3]
return color | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color(self):\n return self.container['color']",
"def _get_color(self):\n return self.__color",
"def _get_color(self):\n return self.__color",
"def _get_color(self):\n return self.__color",
"def _get_color(self):\n return self.__color",
"def get_color(self):\n self.view.prese... | [
"0.7055499",
"0.6641315",
"0.6641315",
"0.6641315",
"0.6641315",
"0.662588",
"0.6576148",
"0.6518216",
"0.65073246",
"0.65073246",
"0.65073246",
"0.650731",
"0.64849645",
"0.6471284",
"0.64579517",
"0.6433993",
"0.6423269",
"0.64182955",
"0.639525",
"0.6385216",
"0.63695",
... | 0.7151222 | 0 |
Helper method to create default request meta. All 'SERP' and 'PRODUCT' requests need to " "implement this. It will propagate the meta information from the original/ parent request " "to the child requests. | def create_default_request_meta(
response: Union[ScrapyTextResponse, ScrapyHttpResponse], original_url: Optional[str] = None
) -> Dict:
return {
"original_URL": original_url if original_url else response.url,
"category": response.meta.get("category"),
"gender": r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_info(self, request):\n\n\t\t# We have to re-resolve the request path here, because the information\n\t\t# is not stored on the request.\n\t\tview, args, kwargs = resolve(request.path)\n\t\tfor i, arg in enumerate(args):\n\t\t\tkwargs[i] = arg\n\n\t\tparameters = {}\n\t\tparameters.update(kwargs)\n\t\tp... | [
"0.5762792",
"0.56348234",
"0.56074893",
"0.55480593",
"0.55469114",
"0.5497104",
"0.5468277",
"0.54309773",
"0.54052013",
"0.5381905",
"0.537283",
"0.53606224",
"0.5316467",
"0.5299309",
"0.5298441",
"0.5293145",
"0.52903724",
"0.5282184",
"0.52806866",
"0.5275312",
"0.52701... | 0.7019134 | 0 |
Check if a given bbUser object is stored in the database. Currently only checks if a user with the same ID is stored in the database, not if the objects are the same. | def userObjExists(self, user : bbUser.bbUser) -> bool:
return self.userIDExists(user.id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exists_in_db(self) -> bool:\n query = \"\"\"SELECT * \n FROM Users \n WHERE Username=?;\"\"\"\n return len(self.db.fetchall(query, values=(self.username,))) > 0",
"def isOwner(id, userId):\n db = core.connect()\n return db[id][\"createdBy\"] == userId",... | [
"0.66454977",
"0.6629096",
"0.6502776",
"0.64873165",
"0.6384",
"0.63549405",
"0.634741",
"0.6321379",
"0.63175",
"0.63037634",
"0.62980324",
"0.6297806",
"0.6245325",
"0.62262326",
"0.62138486",
"0.62071496",
"0.6190167",
"0.6176963",
"0.616143",
"0.615577",
"0.6141846",
"... | 0.7575999 | 0 |
Reset the stats for the user with the specified ID. | def reinitUser(self, id : int):
id = self.validateID(id)
# ensure the ID exists in the database
if not self.userIDExists(id):
raise KeyError("user not found: " + str(id))
# Reset the user
self.users[id].resetUser() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stats_reset(self):\n self.stats.reset()",
"def stats_reset(self):\n self.stats.reset()",
"def reset_stats(self):\n print(\"Reseting stats\")\n self.player_lives = self.ai_stts.player_lives\n self.score = 0\n self.level = 1",
"def resetUser(self):\n\t\turl = \"htt... | [
"0.6416",
"0.6416",
"0.63771105",
"0.6241124",
"0.6069007",
"0.6018874",
"0.6008657",
"0.5996576",
"0.59836346",
"0.59318155",
"0.5928619",
"0.5910059",
"0.5876897",
"0.58712983",
"0.58664316",
"0.58137023",
"0.5787853",
"0.5773324",
"0.5766223",
"0.5684285",
"0.5558619",
"... | 0.694401 | 0 |
Create a new bbUser object with the specified ID and add it to the database | def addUser(self, id : int) -> bbUser.bbUser:
id = self.validateID(id)
# Ensure no user exists with the specified ID in the database
if self.userIDExists(id):
raise KeyError("Attempted to add a user that is already in this bbUserDB")
# Create and return a new user
new... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_user_by_id(cls, m_id):",
"def saveNewUser(self, userID):\n self.db.insert_new_user(userID)",
"def fusion_api_add_user(self, body, api=None, headers=None):\n return self.user.create(body, api, headers)",
"def create_user():\n new_user = User(id=login_session['gplus_id'],\n ... | [
"0.71949327",
"0.7119717",
"0.6967095",
"0.6960353",
"0.69133216",
"0.6906858",
"0.6867741",
"0.68506837",
"0.684258",
"0.682456",
"0.6823309",
"0.6796022",
"0.67648846",
"0.67618465",
"0.6743965",
"0.6695233",
"0.6691359",
"0.6680211",
"0.6674689",
"0.66608787",
"0.6653089",... | 0.78019196 | 0 |
If a bbUser exists in the database with the requested ID, return it. If not, create and store a new bbUser and return it. | def getOrAddID(self, id : int) -> bbUser.bbUser:
return self.getUser(id) if self.userIDExists(id) else self.addUser(id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getUser(self, id : int) -> bbUser.bbUser:\n id = self.validateID(id)\n return self.users[id]",
"def addUser(self, id : int) -> bbUser.bbUser:\n id = self.validateID(id)\n # Ensure no user exists with the specified ID in the database\n if self.userIDExists(id):\n ... | [
"0.71380436",
"0.7094037",
"0.70649517",
"0.6900218",
"0.68044686",
"0.67403007",
"0.6731143",
"0.67079204",
"0.6696172",
"0.6682262",
"0.6681719",
"0.6681719",
"0.6681719",
"0.6681719",
"0.6681203",
"0.666396",
"0.6660379",
"0.66603625",
"0.6650168",
"0.6632992",
"0.6603484"... | 0.797189 | 0 |
Fetch the bbUser from the database with the given ID. | def getUser(self, id : int) -> bbUser.bbUser:
id = self.validateID(id)
return self.users[id] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def fetch_user(self, id: utils.Intable) -> User | None:\n id64 = make_id64(id=id, type=Type.Individual)\n return await self._connection.fetch_user(id64)",
"def get_user_by_id(self, id):\n\t\treturn self.users.get(id)",
"def load_user(id):\n return User.query.get(int(id))",
"def load_us... | [
"0.8142412",
"0.7948193",
"0.79404026",
"0.79404026",
"0.79404026",
"0.79404026",
"0.7924561",
"0.7899446",
"0.7896432",
"0.7849403",
"0.78431547",
"0.78220767",
"0.78131187",
"0.7770938",
"0.7769073",
"0.77454466",
"0.77377176",
"0.7650907",
"0.7642752",
"0.7618635",
"0.7615... | 0.8525421 | 0 |
Serialise this bbUserDB into dictionary format. | def toDict(self, **kwargs) -> dict:
data = {}
# Iterate over all user IDs in the database
for id in self.getIds():
# Serialise each bbUser in the database and save it, along with its ID to dict
# JSON stores properties as strings, so ids must be converted to str first.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user2dict(self):\n d = {}\n d['username'] = self.username\n d['level'] = self.level\n d['name'] = self.name\n d['email'] = self.email\n d['creation'] = self.creation\n d['update'] = self.update\n d['nsentences'] = self.nsentences\n d['nsessions'] =... | [
"0.73725003",
"0.72896534",
"0.71920073",
"0.71753246",
"0.716274",
"0.7151962",
"0.71234363",
"0.7105887",
"0.7040066",
"0.69651514",
"0.6952894",
"0.6938799",
"0.6933408",
"0.6907724",
"0.68980014",
"0.68346447",
"0.6777401",
"0.67636013",
"0.6733848",
"0.67159617",
"0.6711... | 0.7482245 | 0 |
Get summarising information about this bbUserDB in string format. Currently only the number of users stored. | def __str__(self) -> str:
return "<bbUserDB: " + str(len(self.users)) + " users>" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stats_get_str(self):\n return self.stats.get_all_str()",
"def stats_get_str(self):\n return self.stats.get_all_str()",
"def to_string(self):\n return \"User: {} Description: {} Ratings: {}\".format(self.id_user, self.description, self.ratings)",
"def get_stats(self):\n result ... | [
"0.6607278",
"0.6607278",
"0.65238464",
"0.6518738",
"0.6509178",
"0.6467798",
"0.641684",
"0.6371659",
"0.62588465",
"0.6195195",
"0.61339843",
"0.6110665",
"0.6098782",
"0.6087525",
"0.60621756",
"0.60452694",
"0.60246444",
"0.60194707",
"0.6006507",
"0.6000051",
"0.5972194... | 0.76016575 | 0 |
Construct a bbUserDB from a dictionaryserialised representation the reverse of bbUserDB.toDict() | def fromDict(cls, userDBDict : dict, **kwargs) -> bbUserDB:
# Instance the new bbUserDB
newDB = bbUserDB()
# iterate over all user IDs to spawn
for id in userDBDict.keys():
# Construct new bbUsers for each ID in the database
# JSON stores properties as strings, so... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, dikt: dict) -> 'UserBase':\n return util.deserialize_model(dikt, cls)",
"def toDict(self, **kwargs) -> dict:\n data = {}\n # Iterate over all user IDs in the database\n for id in self.getIds():\n # Serialise each bbUser in the database and save it, along ... | [
"0.67769945",
"0.6622561",
"0.65516293",
"0.63922143",
"0.63320786",
"0.62116504",
"0.6042782",
"0.6004884",
"0.5900546",
"0.5864641",
"0.5853948",
"0.578413",
"0.5688235",
"0.5666956",
"0.56637603",
"0.5660747",
"0.5650265",
"0.5648268",
"0.56327444",
"0.5618494",
"0.560434"... | 0.71973324 | 0 |
Screen with calendar for one month | def create_month_scr(self, month, toogle_today=False):
scr = Screen()
m = self.month_names_eng[self.active_date[1] - 1]
scr.name = "%s-%s" % (m, self.active_date[2]) # like march-2015
# Grid for days
grid_layout = GridLayout(cols=7, rows=7, size_hint=(1, 1), pos_hint={"top": 1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_cal(request, year=None, month=None):\n if year == None:\n # get the current comic as a starting point\n lToday = Comic.objects.filter(published=True).order_by('-date')[0].date\n year = lToday.year\n month = lToday.month\n\n return calendar(request, year, month)",
"def m... | [
"0.73538274",
"0.6901004",
"0.6769055",
"0.6733737",
"0.6690152",
"0.65959895",
"0.65230334",
"0.6518159",
"0.64170593",
"0.63540894",
"0.6350945",
"0.6336885",
"0.6195404",
"0.6162957",
"0.61168915",
"0.60795885",
"0.6076546",
"0.60162735",
"0.59980357",
"0.59725446",
"0.595... | 0.7408204 | 0 |
Get day value from pressed button | def get_btn_value(self, inst):
self.active_date[0] = int(inst.text)
selected = [self.active_date[0], self.active_date[1], self.active_date[2]]
global selectedDates
if selected in selectedDates:
selectedDates.remove(selected)
else:
selectedDates.append(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_day():\n return handle_invalid_inputs(question_4, days)",
"def day(sym, date):\n return get(sym, date, date)[0][1]",
"def on_Calendar_day_selected_double_click(self, widget):\n try:\n agno, mes, dia = variables.calendar.get_date()\n fecha = \"%02d/\" % dia + \"%02d/\"... | [
"0.66065156",
"0.6411967",
"0.62181884",
"0.61390465",
"0.6137295",
"0.61261487",
"0.6031694",
"0.6031341",
"0.6031341",
"0.6031341",
"0.60150236",
"0.60150236",
"0.5965724",
"0.59653014",
"0.5939489",
"0.59322006",
"0.58828443",
"0.587401",
"0.58704",
"0.58308136",
"0.581959... | 0.6740263 | 0 |
Project a vector onto an L1 ball. | def project_L1_ball(x: "fasta.linalg.Vector", t: float) -> "fasta.linalg.Vector":
# By Moreau's identity, we convert to proximal of dual problem (L-inf norm)
return x - project_Linf_ball(x, t) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate(self, vector):\n if self.blender_object:\n self.blender_object.location = vector",
"def project_vector(self, vector: array_like) -> Vector:\n point_in_space = self.point + vector\n point_on_plane = self.project_point(point_in_space)\n\n return Vector.from_poin... | [
"0.66520876",
"0.6209839",
"0.6140181",
"0.6015735",
"0.5979458",
"0.5940027",
"0.5939712",
"0.59238505",
"0.5875229",
"0.5867069",
"0.5799263",
"0.5797262",
"0.57569957",
"0.5726671",
"0.57266325",
"0.5723105",
"0.5687589",
"0.56815106",
"0.56803626",
"0.5629013",
"0.5628878... | 0.7311037 | 0 |
The shrink (softthresholding) operator, which is also the proximal operator for the L1norm. The shrink operator reducing the magnitudes of all entries in x by t, leaving them at zero if they're already less than t. | def shrink(x: np.ndarray, t: float) -> np.ndarray:
return np.sign(x) * np.maximum(np.abs(x) - t, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_softshrink(g, op, block):\n\n x = g.get_node(op.input(\"X\")[0])\n dtype = infer_type(x).checked_type.dtype\n threshold = _expr.const(op.attr(\"lambda\"), dtype=dtype)\n zeros = _op.zeros_like(x)\n out = _op.where(x < -threshold, x + threshold, zeros) + _op.where(\n x > threshold,... | [
"0.65450245",
"0.6496893",
"0.64630055",
"0.6456143",
"0.6226922",
"0.61587155",
"0.5946745",
"0.5927948",
"0.5875077",
"0.57929087",
"0.57728153",
"0.5728194",
"0.5728194",
"0.5728194",
"0.5629461",
"0.5480745",
"0.543062",
"0.5420821",
"0.54135394",
"0.5374806",
"0.53720266... | 0.78240633 | 0 |
build resnet backbone and position embedding according to config | def build_backbone(config):
assert config.MODEL.BACKBONE in ['resnet50', 'resnet101'], "backbone name is not supported!"
backbone_name = config.MODEL.BACKBONE
dilation = False
train_backbone = not config.EVAL
return_interm_layers = False #TODO: impl case True for segmentation
position_embedding... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backbone_generator(params):\n if params.architecture.backbone == 'resnet':\n resnet_params = params.resnet\n backbone_fn = resnet.Resnet(\n resnet_depth=resnet_params.resnet_depth,\n dropblock=dropblock_generator(params.dropblock),\n activation=params.batch_norm_activation.activatio... | [
"0.6338696",
"0.62638956",
"0.62531716",
"0.6237589",
"0.6195611",
"0.6154484",
"0.60957676",
"0.6093641",
"0.6082765",
"0.6067601",
"0.6043595",
"0.6010979",
"0.6000153",
"0.5991751",
"0.59515923",
"0.59420633",
"0.59154165",
"0.58285683",
"0.58096284",
"0.58037734",
"0.5793... | 0.66462153 | 0 |
Return the data for the supplied model with or without auxiliary data from the model. The model is needed as the order of the data depends on the order of the channels in the model. | def data(self, model, with_aux=True):
try:
observed_data = sum(
(self.observations[c] for c in model.config.channels), []
)
except KeyError:
log.error(
"Invalid channel: the workspace does not have observation data for one of the chann... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_input_data_for_model(self, extra_data=None):\n extra_data = {} if extra_data is None else extra_data\n if self.metadata['sample_rate'] is not None:\n if self.audio_signal.sample_rate != self.metadata['sample_rate']:\n self.audio_signal.resample(self.metadata['sample... | [
"0.6538062",
"0.6490415",
"0.62376046",
"0.6171267",
"0.6053518",
"0.58562785",
"0.580033",
"0.5770171",
"0.57479113",
"0.5745328",
"0.56002873",
"0.5590875",
"0.555867",
"0.5480762",
"0.54566306",
"0.54521996",
"0.54192096",
"0.5412202",
"0.53936917",
"0.5341618",
"0.5324312... | 0.72179353 | 0 |
This page shows detailed stats on an individual switch queried by serial number | def switch_info(serial):
detail = getSwitchDetail(serial)
intdetail = getInterfaceDetail(serial)
try:
raw_data = open(f"raw_output/{serial}.txt", "r").read().splitlines()
except:
raw_data = "None collected yet"
return render_template(
"detail.html",
title=serial,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSwitchDetail(serial):\n swDB = switchdb.DB()\n raw_info = swDB.getSwitchDetail(serial)\n switch = {}\n for row in raw_info:\n switch[\"name\"] = row[0]\n switch[\"serial\"] = row[1]\n switch[\"model\"] = row[2]\n switch[\"swver\"] = row[3]\n switch[\"ip\"] = ro... | [
"0.747413",
"0.6891839",
"0.5926545",
"0.58273053",
"0.57952845",
"0.5792791",
"0.57800347",
"0.56501704",
"0.564042",
"0.5636971",
"0.56230223",
"0.54754305",
"0.5463351",
"0.5437777",
"0.5394672",
"0.53712904",
"0.536182",
"0.53433543",
"0.53223366",
"0.52944213",
"0.527366... | 0.7308758 | 1 |
Check DB for last runtime of backend script This is published on the main page to see when stats were last updated | def getLastUpdate():
swDB = switchdb.DB()
lastupdate = swDB.getLastUpdate()
swDB.close()
return lastupdate | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_init() -> str:\n return db[\"last_init\"]",
"def test_log_last_started_datetime(self):\n initial_count = CostUsageReportStatus.objects.count()\n saver = ReportStatsDBAccessor(\"myreport\", self.manifest_id)\n saver.log_last_started_datetime()\n self.assertIsNotNone(sav... | [
"0.575571",
"0.5727403",
"0.56392384",
"0.5554743",
"0.5544511",
"0.5508971",
"0.5502992",
"0.54756486",
"0.54550827",
"0.5454201",
"0.54325056",
"0.54227924",
"0.5381801",
"0.5367871",
"0.53669065",
"0.5365385",
"0.536471",
"0.5316883",
"0.53158337",
"0.53126395",
"0.5308993... | 0.6065848 | 0 |
Query DB for summary info on all switches currently monitored | def getSwitchInfo():
swDB = switchdb.DB()
raw_info = swDB.getAllSummary()
switchList = []
for row in raw_info:
row = list(row)
switch = {}
switch["name"] = row[0]
switch["serial"] = row[1]
switch["swver"] = row[2]
switch["ip"] = row[3]
switch["chec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_switches_stats(self, site_id: str) -> List:\n try:\n stats = self.api.get(host=self.host, endpoint=f\"/api/v1/sites/{site_id}/stats/devices?type=switch\")\n except Exception as e:\n logger.error(f\"{TextColors.FAIL}Error getting switch stats:{TextColors.ENDC} {e}\")\n ... | [
"0.59377617",
"0.58443993",
"0.58337426",
"0.569104",
"0.5689093",
"0.56877404",
"0.5678661",
"0.56559193",
"0.56524736",
"0.5558809",
"0.5531664",
"0.55013895",
"0.5465066",
"0.5456181",
"0.54546607",
"0.54425275",
"0.5420958",
"0.5404441",
"0.53917074",
"0.53812945",
"0.536... | 0.71028024 | 0 |
Call to DB to delete a device by serial number | def deleteDevice(serial):
swDB = switchdb.DB()
swDB.deleteBySerial(serial)
swDB.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_delete_device_record(db_path, rec_name):\n path_exist = os.path.exists(db_path)\n if path_exist is False:\n print '!!!Error, database does not exist.'\n return\n\n try:\n with db.connect(db_path) as conn:\n cursor = conn.cursor()\n # Prepare and execute SQ... | [
"0.71832097",
"0.70881724",
"0.6902768",
"0.6834857",
"0.67007685",
"0.67007685",
"0.66466284",
"0.6552417",
"0.65387774",
"0.6451662",
"0.64388514",
"0.6282438",
"0.6280378",
"0.62574196",
"0.6221847",
"0.621336",
"0.61614496",
"0.61176556",
"0.6114799",
"0.6113734",
"0.6084... | 0.82801366 | 0 |
Does the user have the permission to publish a data. | def has_perm_publish_data(user):
has_perm_publish(user, rights.PUBLISH_DATA) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def canPublish(id, userId):\n db = core.connect()\n theShift = db[id]\n return user.isAdmin(userId) or (userId == theShift['createdBy'])",
"def has_add_permission(self, request):\n if not settings.PUBLISHER_CODE:\n return False\n return super().has_add_permission(request)",
"d... | [
"0.7401715",
"0.68930787",
"0.6854572",
"0.68086797",
"0.6761256",
"0.67495507",
"0.6707519",
"0.6702206",
"0.6684865",
"0.66546744",
"0.6624943",
"0.66060966",
"0.6596229",
"0.65667605",
"0.6543968",
"0.6537075",
"0.6512933",
"0.65074724",
"0.6503338",
"0.64965105",
"0.64941... | 0.889468 | 0 |
Can read list of data. | def can_read_list_data_id(func, list_data_id, user):
if user.is_superuser:
return func(list_data_id, user)
# check anonymous access
_check_anonymous_access(user)
list_data = func(list_data_id, user)
check_can_read_list(list_data, user)
return list_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_list(self, register, length):\n raise NotImplementedError",
"def _read_data(self):",
"def canread(self):\n return False",
"def storage_can_read(self):\n return True",
"def read_data(self) -> List[BaseRecord]:\n pass",
"def read(self) -> List[str]:\n pass",
"d... | [
"0.662519",
"0.6616855",
"0.6610192",
"0.6583547",
"0.6576495",
"0.64457273",
"0.6304789",
"0.62909526",
"0.6290033",
"0.6213072",
"0.616153",
"0.61129534",
"0.60768044",
"0.59920454",
"0.5950494",
"0.5942837",
"0.59417313",
"0.593891",
"0.59161913",
"0.59137505",
"0.5912139"... | 0.6868034 | 0 |
Can read a data, given a query. | def can_read_data_query(
func,
query,
user,
workspace_filter=None,
user_filter=None,
order_by_field=DATA_SORTING_FIELDS,
):
# check anonymous access
_check_anonymous_access(user)
# update the query
query = _update_can_read_query(query, user, workspace_filter, user_filter)
# g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read(self, query):\r\n t1 = time.time()\r\n if self.database in ['redshift', 'postgres']:\r\n ret = postgres_helper.fetchall(config=self.conf, sql=query)\r\n else:\r\n raise Exception(\"database not supported yet: '{}'\"\r\n .format(self.dat... | [
"0.64174247",
"0.6388573",
"0.6367381",
"0.6172934",
"0.5943755",
"0.59167004",
"0.5904258",
"0.5697214",
"0.5670645",
"0.56312513",
"0.5612141",
"0.555337",
"0.55376184",
"0.5506616",
"0.550447",
"0.54996186",
"0.5492912",
"0.5484353",
"0.5476029",
"0.5465419",
"0.5450928",
... | 0.71578825 | 0 |
Can read a data, given an aggregate query. | def can_read_aggregate_query(func, query, user):
if user.is_superuser:
return func(query, user)
# check anonymous access
_check_anonymous_access(user)
# update the query
query = _update_can_read_aggregate_query(query, user)
# get list of data
data = func(query, user)
return da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_read_data_query(\n func,\n query,\n user,\n workspace_filter=None,\n user_filter=None,\n order_by_field=DATA_SORTING_FIELDS,\n):\n # check anonymous access\n _check_anonymous_access(user)\n # update the query\n query = _update_can_read_query(query, user, workspace_filter, user... | [
"0.68077844",
"0.6013364",
"0.5804927",
"0.57963204",
"0.5774573",
"0.5536843",
"0.5486568",
"0.54431725",
"0.534709",
"0.53435445",
"0.52316743",
"0.5172882",
"0.5158935",
"0.5156636",
"0.51558",
"0.5118686",
"0.5110658",
"0.507409",
"0.50682276",
"0.5029962",
"0.50261956",
... | 0.7802571 | 0 |
Update query with access control parameters. | def _update_can_read_query(
query, user, workspace_filter=None, user_filter=None
):
accessible_workspaces = _get_read_accessible_workspaces_by_user(user)
# update query with workspace criteria
query = django_raw_query.add_access_criteria(
query, accessible_workspaces, user, workspace_filter, us... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, params):",
"def update(self, query: str, *args, **kwargs):\n cursor = self._cursor()\n try:\n self._execute(cursor, query, args, kwargs)\n return cursor.rowcount\n finally:\n cursor.close()",
"def _update(self, values):\n if self.que... | [
"0.6119067",
"0.6095496",
"0.60731256",
"0.6058203",
"0.58836794",
"0.58246744",
"0.5813785",
"0.58044815",
"0.5776203",
"0.57282144",
"0.57191473",
"0.5662358",
"0.5660843",
"0.5659255",
"0.5619666",
"0.560143",
"0.5595878",
"0.55811363",
"0.55611885",
"0.5551484",
"0.554431... | 0.65168345 | 0 |
Get read accessible workspaces by user. | def _get_read_accessible_workspaces_by_user(user):
if not settings.CAN_ANONYMOUS_ACCESS_PUBLIC_DOCUMENT and user.is_anonymous:
accessible_workspaces = []
else:
# workspace case
# list accessible workspaces
accessible_workspaces = [
workspace.id
for workspa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_accessible_spaces(user):\n if not user:\n return []\n obj_list = get_objects_for_user(user, 'access_space',Space)\\\n .order_by('-created_at')\n return obj_list",
"def get_own_spaces(user):\n if not user:\n return []\n own_spaces = []\n accessible_spacs = ge... | [
"0.6719666",
"0.66262877",
"0.6177913",
"0.61746544",
"0.61572975",
"0.59542626",
"0.5788981",
"0.5735323",
"0.5701356",
"0.5671635",
"0.5643736",
"0.5525086",
"0.55015767",
"0.54937226",
"0.549314",
"0.54608184",
"0.5457025",
"0.54482085",
"0.54317015",
"0.54259753",
"0.5395... | 0.82568294 | 0 |
Can user write data in workspace. | def can_write_data_workspace(func, data, workspace, user):
return can_write_in_workspace(
func, data, workspace, user, rights.PUBLISH_DATA
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_write(self, auth_param: str) -> bool:\n perms = self._get_workspace_permissions([auth_param])\n return self._has_write_perm(perms.get(auth_param, WorkspacePermission.NONE))",
"def canwrite(self):\n return False",
"def set_data_writable(self):\n pass",
"def isWriteable(self... | [
"0.72511923",
"0.70142853",
"0.6588434",
"0.6476887",
"0.6420118",
"0.63587517",
"0.6332469",
"0.63128155",
"0.62503433",
"0.6213865",
"0.6140603",
"0.61385965",
"0.60728014",
"0.59627616",
"0.59163034",
"0.5911914",
"0.5841909",
"0.5827193",
"0.5817602",
"0.57675314",
"0.575... | 0.81769687 | 0 |
Sets the calculated_at of this StandardizedTierTier. | def calculated_at(self, calculated_at):
self._calculated_at = calculated_at | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tier(self, tier):\n\n self._tier = tier",
"def scheduled_at(self, scheduled_at):\n\n self._scheduled_at = scheduled_at",
"def set_tier(self, tier):\n self.single_selection_from_static_kendo_dropdown(self.tier_kendo_dropdown_locator, tier)",
"def created_at(self, created_at):\n\n ... | [
"0.58256483",
"0.5355169",
"0.5262881",
"0.51667094",
"0.51667094",
"0.51667094",
"0.51667094",
"0.51667094",
"0.51667094",
"0.51667094",
"0.51667094",
"0.51667094",
"0.51667094",
"0.51667094",
"0.51667094",
"0.51667094",
"0.51667094",
"0.51667094",
"0.51667094",
"0.51667094",
... | 0.7393106 | 0 |
Sets the explanation of this StandardizedTierTier. | def explanation(self, explanation):
self._explanation = explanation | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tier_explanation(self, tier_explanation):\n\n self._tier_explanation = tier_explanation",
"def tier(self, tier):\n\n self._tier = tier",
"def set_description(self, descr):\n self._current_test_descr = descr",
"def description(self, value):\n self.definition.description = value... | [
"0.79957366",
"0.5871474",
"0.5464915",
"0.54482603",
"0.5392081",
"0.53604364",
"0.52467775",
"0.52365154",
"0.5220184",
"0.5220184",
"0.5220184",
"0.5220184",
"0.52154154",
"0.5203799",
"0.51837766",
"0.5157714",
"0.51374966",
"0.5122163",
"0.5120805",
"0.51175475",
"0.5111... | 0.6389624 | 1 |
This funtion return integer the number of files in ISO | def NumberOfFilesInISO(XISOPath, XSystemUpdateFolder):
command='./extract-xiso -l '
if XSystemUpdateFolder == True:
command = command + '-s '
command = command + '"' + XISOPath + '"'
print(command)
commandOut = commands.getstatusoutput(command)
commandOut = commandOut[1].split('\n')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_file(self):\n self.assert_is_dir_and_exists()\n n = 0\n for _ in self.select_file(recursive=True):\n n += 1\n return n",
"def getFileCount(self) -> int:\n ...",
"def n_subfile(self):\n self.assert_is_dir_and_exists()\n n = 0\n for _ in se... | [
"0.7400887",
"0.7315209",
"0.72290283",
"0.7170745",
"0.701988",
"0.7000022",
"0.688257",
"0.68750906",
"0.681171",
"0.6706613",
"0.66990584",
"0.66621566",
"0.6575327",
"0.6553808",
"0.65233034",
"0.6516356",
"0.6504051",
"0.64615285",
"0.6457432",
"0.64490885",
"0.64460576"... | 0.76097965 | 0 |
Return a dataframe from a parquet file. | def parquet(path, *args, **kwargs):
try:
df = Spark.instance.spark.read.parquet(path, *args, **kwargs)
except IOError as error:
logging.error(error)
raise
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pq2df(data_file):\n df = pd.read_parquet(data_file)\n return df",
"def read_parquet(self, filename):\n if filename is None:\n raise ValueError(\"File name is None\")\n self.logger.info(\"# Reading a Parquet file \" + filename)\n sqlContext = SQLContext(self.spar... | [
"0.8080801",
"0.7680819",
"0.75473124",
"0.71808255",
"0.70952356",
"0.66877913",
"0.65009177",
"0.64348716",
"0.642109",
"0.64079404",
"0.63399845",
"0.63359207",
"0.62860304",
"0.624169",
"0.6233218",
"0.62246",
"0.6219255",
"0.61767995",
"0.61527157",
"0.6148135",
"0.61377... | 0.7916956 | 1 |
Returns GP mean and variance in "scaled" space (same as gpflow model.predict_f with bounds applied) | def predict(self, x_scaled):
model_var_with_prior = self.mult_var_by_prior(x_scaled)
scaled_space_mean = self.y_scaler.transform(tf.reshape(tf.math.exp(self.log_prob(x_scaled)), [-1, 1]))
return scaled_space_mean, tf.reshape(model_var_with_prior, [-1, 1]).numpy() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit_gp(self, inputs):\n x_context, y_context, x_data = inputs\n kernel = GP.kernels.RBF(length_scale=self._l_scale, length_scale_bounds=(1e-2, 1e3))\n gp = GP.GaussianProcessRegressor(kernel=kernel).fit(x_context[-1, :], y_context[-1, :])\n y_prediction, y_prediction_std = gp.predic... | [
"0.60946023",
"0.5923903",
"0.5884754",
"0.58357656",
"0.57872975",
"0.56988716",
"0.56963426",
"0.56526315",
"0.56245965",
"0.5610475",
"0.56104165",
"0.55741924",
"0.5556511",
"0.5541308",
"0.55345446",
"0.55169386",
"0.54802036",
"0.54369193",
"0.5432692",
"0.5422389",
"0.... | 0.62195873 | 0 |
Connect social account to existing account, if existing email found | def pre_social_login(self, request, sociallogin):
if sociallogin.is_existing:
return
email_addresses = sociallogin.email_addresses
for email in email_addresses:
try:
user_email = EmailAddress.objects.get(email__iexact=email.email)
except Ema... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _external_login_or_signup(request,\r\n external_id,\r\n external_domain,\r\n credentials,\r\n email,\r\n fullname,\r\n retfun=None):\r\n ... | [
"0.6368004",
"0.60966545",
"0.6048381",
"0.59991693",
"0.59486884",
"0.5934243",
"0.5869946",
"0.58662754",
"0.5855204",
"0.5833579",
"0.5811763",
"0.57687676",
"0.57521755",
"0.56753784",
"0.5648578",
"0.5643133",
"0.5633166",
"0.56330556",
"0.56206214",
"0.5619708",
"0.5619... | 0.7319161 | 0 |
Save the trained vectorizer for future use. | def pickle_vectorizer(self, path='models/TFIDFVectorizer.pkl'):
with open(path, 'wb') as f:
pickle.dump(self.vectorizer, f)
print("Pickled vectorizer at {}".format(path)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_vectorizer(self, vectorizer_filepath):\n with open(vectorizer_filepath, \"w\") as fp:\n json.dump(self._vectorizer.to_serializable(), fp)",
"def save(self, tfidf_vectorizer_path):\n with open(tfidf_vectorizer_path, \"wb\") as fw:\n pickle.dump(self, fw)",
"def save_... | [
"0.76096624",
"0.73109317",
"0.7164249",
"0.70169145",
"0.66974753",
"0.6566269",
"0.6522058",
"0.64056844",
"0.63931715",
"0.6316061",
"0.6313552",
"0.6313552",
"0.6276785",
"0.62720037",
"0.623774",
"0.62127876",
"0.62069654",
"0.6184085",
"0.6171327",
"0.61685747",
"0.6127... | 0.7430699 | 1 |
Initializes the object using the list of technology dictionaries that are copied and formatted. Takes an optional parameter for the datetime.date object of the last full BuiltWith scan. | def __init__(self, technologies_list, last_full_builtwith_scan_date=None):
self._technologies_by_name = {}
for technologies_dict in technologies_list:
copied_technologies_dict = copy.deepcopy(technologies_dict)
for name in DATETIME_INFORMATION_NAMES:
copied_te... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(\n self, datetime,\n provider, asset_license,\n ext_properties\n ):\n self.ext_properties = ext_properties\n self.license = asset_license\n self.provider = provider\n self.datetime = datetime",
"def __init__(self, *args):\n this = _libsbml.n... | [
"0.58997256",
"0.58272433",
"0.57844007",
"0.5710227",
"0.55624354",
"0.55044675",
"0.5499629",
"0.5475405",
"0.541306",
"0.5392969",
"0.53880745",
"0.53873634",
"0.5373261",
"0.53632164",
"0.53545606",
"0.5312174",
"0.5298981",
"0.52789253",
"0.52789253",
"0.52765673",
"0.52... | 0.7597779 | 0 |
Lookup BuiltWith results for the given domain. If API version 2 is used and the get_last_full_query flag enabled, it also queries for the date of the last full BuiltWith scan. | def lookup(self, domain, get_last_full_query=True):
data = {}
try:
last_full_builtwith_scan_date = None
if self.api_version == 7 and isinstance(domain, list):
domain = ','.join(domain)
if self.api_version in [2, 7]:
last_updates_r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _query(self, mapping, from_date=None, to_date=None, max_count=None,\n offset=None, ascendingly=True, describe=False):\n group, key = mapping.data_var.split(self._data_var_separator)\n\n # build params\n params = 'describe={describe}&keys={key}'.format(describe=str(describe).l... | [
"0.5364037",
"0.5217802",
"0.5124252",
"0.5091811",
"0.50653636",
"0.5045531",
"0.50369877",
"0.49869594",
"0.49551797",
"0.48993677",
"0.48925823",
"0.4868528",
"0.48650628",
"0.48334965",
"0.48261112",
"0.4820986",
"0.47899625",
"0.47878402",
"0.4784079",
"0.47710827",
"0.4... | 0.80236036 | 0 |
Does this lesson or any of its descendants need feedback? 0 = no feedback required 1 = feedback not yet provided 2 = feedback provided | def needs_feedback(lesson, course_id):
descendants = lesson.get_descendants(include_self=True)
provided = False
for descendant in descendants:
if descendant.feedback_required:
# If feedback is needed, check if already provided
try:
# pylint: disable=E1101
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def should_ask_if_examiner_want_to_give_another_chance(self):\n if self.assignment.is_electronic:\n return (self.delivery_status == \"corrected\" and not self.feedback.is_passing_grade) \\\n or self.delivery_status == 'closed-without-feedback'\n else:\n return Fal... | [
"0.6186025",
"0.61752695",
"0.61344266",
"0.5998169",
"0.59937",
"0.5966056",
"0.58796865",
"0.5829263",
"0.58252865",
"0.56954336",
"0.56225294",
"0.555234",
"0.55216324",
"0.5501553",
"0.54851127",
"0.5417297",
"0.5385953",
"0.5377694",
"0.5376452",
"0.53695625",
"0.5365726... | 0.7998184 | 0 |
Get meta information about a lesson | def get_lesson_meta(lesson_id):
# pylint: disable=E1101
lesson_meta_list = (LessonMetaData.objects.filter(lesson=lesson_id)
.prefetch_related())
result = []
for item in lesson_meta_list:
result.append({
'description': item.description.description,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def showLesson(self):\n lesson = \"\"\n lesson += self.__title + \"\\n\\n\"\n lesson += self.__description + \"\\n\"\n lesson += self.__lesson_text + \"\\n\"\n lesson += self.getLink()\n return lesson",
"def meta(id):\n db = core.connect()\n return db[id][\"meta\"]... | [
"0.6347282",
"0.63374656",
"0.6238976",
"0.6156013",
"0.6148112",
"0.61196655",
"0.6065378",
"0.58501846",
"0.5849513",
"0.58236367",
"0.58219254",
"0.5817728",
"0.5810855",
"0.5797458",
"0.57406706",
"0.5716694",
"0.5701135",
"0.5665865",
"0.564084",
"0.56000566",
"0.5573098... | 0.6979437 | 0 |
Get attachments for a lesson | def get_lesson_attachments(lesson_id):
# pylint: disable=E1101
lesson_attachments = Attachment.objects.filter(lesson=lesson_id)
result = []
for attachment in lesson_attachments:
url = attachment.attached_file.url
result.append({'title': attachment.title,
'url': url... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attachments(self, expense_id):\n return self._get_request({}, Expenses.GET_EXPENSE_ATTACHMENTS.format(expense_id))",
"def attachments(self):\n return self._attachments",
"def attachments(self):\n return self.properties.get('attachments',\n Attachme... | [
"0.6443785",
"0.62607515",
"0.6257542",
"0.61732197",
"0.613358",
"0.60169816",
"0.5984727",
"0.5975392",
"0.59665823",
"0.589185",
"0.58910084",
"0.582533",
"0.5795188",
"0.57261866",
"0.57246155",
"0.56012267",
"0.5595344",
"0.5585614",
"0.55696243",
"0.5561719",
"0.5546192... | 0.7814485 | 0 |
Get list of lessons. If lesson_id is provided, then sublessons will be returned. | def get_lessons(course_id, lesson=None):
lesson_list = []
if lesson is None:
lesson_list = Lesson.objects.filter(
id__in=get_root_lesson_ids(course_id))
else:
lesson_list = lesson.get_children()
result = []
for lesson_item in lesson_list:
result.append({
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_lessons(lesson_id):\n url = '{0}?cat={1}'.format(BASE_URL, lesson_id)\n page = requests.get(url, verify=False)\n soup = BeautifulSoup(page.content)\n output = []\n\n for item in soup.find(id='playlist').findAll('dd'):\n video_id = item.find('a')['href'].split('=')[-1]\n title =... | [
"0.7365375",
"0.62064546",
"0.61165404",
"0.6037979",
"0.5811342",
"0.5567336",
"0.53809226",
"0.52577466",
"0.52528167",
"0.5149042",
"0.5014981",
"0.49820638",
"0.4955708",
"0.4920301",
"0.48846543",
"0.48611218",
"0.4850564",
"0.4735443",
"0.4732919",
"0.4681646",
"0.46596... | 0.7905289 | 0 |
Get a CSRF token | def get_token(request: http.Request) -> str:
if hasattr(request, '_csrf_hook'):
return request._csrf_hook.get_token() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_csrf_token(self):\n return get_csrf_token(self.REQUEST)",
"def get_csrf(self):\n rv = self.app.get('/')\n soup = BeautifulSoup(rv.data, 'html.parser')\n tag = soup.body.find('input', attrs = { 'name' : '_csrf_token'})\n return tag['value']",
"def get_csrf_token():\n\t... | [
"0.82945985",
"0.79842544",
"0.7978851",
"0.7901868",
"0.7893529",
"0.7813759",
"0.7686076",
"0.76118195",
"0.7603423",
"0.7520915",
"0.7415232",
"0.73648924",
"0.73442954",
"0.7296101",
"0.72825855",
"0.72396684",
"0.7208785",
"0.71859497",
"0.71636873",
"0.7134267",
"0.7123... | 0.825222 | 1 |
Change the CSRF token in use for a request should be done on login for security purposes. | def rotate_token(request: http.Request):
if hasattr(request, '_csrf_hook'):
request._csrf_hook.rotate_token() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retain_csrf_token(req):\n session = req.environ.get('rex.session', {})\n csrf_token = session.get('_csrf_token')\n if not csrf_token:\n csrf_token = session['_csrf_token'] = b2a(os.urandom(16))\n return csrf_token",
"def _request_csrf_token(self, params):\n if params.get(\"action\")... | [
"0.6995657",
"0.6735495",
"0.66707176",
"0.66646796",
"0.6627224",
"0.66243565",
"0.6588753",
"0.6564125",
"0.64893675",
"0.64175296",
"0.6354996",
"0.6351722",
"0.6298024",
"0.6286042",
"0.626467",
"0.62383574",
"0.62116677",
"0.61504555",
"0.6089741",
"0.6089741",
"0.606432... | 0.7636964 | 0 |
decorator to coerce a generator to a list | def listify(gen: Callable[..., Union[Generator[T, None, None], AsyncGenerator[T, None]]]) -> Callable[..., List[T]]:
if inspect.isasyncgenfunction(gen):
@wraps(gen)
async def list_func(*args, **kwargs) -> List[Any]:
return [v async for v in gen(*args, **kwargs)]
elif inspect.isgene... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_list(gen):\n return list(gen())",
"def to_list():\n\n @sinks\n def _dagpype_internal_fn_act(target):\n l = []\n try:\n while True:\n l.append((yield))\n except GeneratorExit:\n target.send(l) \n target.close()\n\n return _... | [
"0.7745299",
"0.69110525",
"0.6902051",
"0.6683275",
"0.6664674",
"0.65476835",
"0.639381",
"0.63147944",
"0.6306718",
"0.6297463",
"0.628525",
"0.62602025",
"0.62131625",
"0.6202488",
"0.6202488",
"0.6105673",
"0.60810256",
"0.6071712",
"0.6050292",
"0.60284764",
"0.5994327"... | 0.70440924 | 1 |
Just lists out paths in env variable, one per line | def plist(self):
if self.val == None:
print("No such env variable ", self.val, " exists!")
else:
print("Listing for ", self.name)
for p in self.path_list: print(" ", p) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_list():\n return (os.environ.get(\"PATH\", None) or os.defpath).split(os.pathsep)",
"def show_envs(path: Optional[Path] = None):\n path = path or WORKON_HOME or Path.cwd()\n for name, path in sorted(find_environment_folders(path=path, verbose=1)):\n terminal.echo(f'Found {terminal.ye... | [
"0.69197834",
"0.6629572",
"0.6248786",
"0.62064815",
"0.61731195",
"0.61621183",
"0.6069602",
"0.6014116",
"0.5922058",
"0.58610016",
"0.58253425",
"0.58037055",
"0.5796449",
"0.57708263",
"0.576808",
"0.5671742",
"0.56449497",
"0.5635968",
"0.5635968",
"0.5558531",
"0.55343... | 0.6816062 | 1 |
Updates the internal env val to ensure path_list & val are insync | def pupdate(self):
try:
tmp = self.path_list[0]
except IndexError:
print("Empty value for env variable ", self.name)
return
for p in self.path_list[1:]:
tmp = tmp + ':' + p
self.val = tmp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, env_obj):\n if env_obj:\n if isinstance(env_obj, EnvValues):\n for package_name, env_vars in env_obj.data.items():\n for name, value in env_vars.items():\n if isinstance(value, list):\n value = co... | [
"0.62745166",
"0.59792364",
"0.5785462",
"0.5765213",
"0.5754156",
"0.56319785",
"0.5602906",
"0.55717754",
"0.5535034",
"0.5533392",
"0.5532169",
"0.55176127",
"0.5516329",
"0.549734",
"0.5485281",
"0.54776955",
"0.54740787",
"0.54621756",
"0.5461831",
"0.5431891",
"0.543187... | 0.7859146 | 0 |
Process options based on legal operations & subcommands Return sanitized cmds and arguments | def process_options(args):
subcmds = dict() # each key(cmd) can take on a val of 0, or 1
subcmds_wo_arg = [ 'clean', 'list' ]
subcmds_with_args = [ 'add', 'remove' ]
for cmd in subcmds_wo_arg:
subcmds[cmd] = 0
for cmd in subcmds_with_args:
subcmds[cmd] = 1
if (len(args) == 0)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_run_options(self, cmdp, exec_engine=None):\n cmdp.declare_options(\"-v= -e= -w= -u= -p= -i -t -a -P\")\n cmd_options = {\n \"netcoop\": {\n \"fl\": (\"-P\", \"--publish-all\", \"--netcoop\",), \"act\": \"R\",\n \"p2\": \"CMD_OPT\", \"p3\": False\n ... | [
"0.68020016",
"0.6262761",
"0.6206423",
"0.6184919",
"0.6182061",
"0.6162515",
"0.6088291",
"0.6074992",
"0.6049868",
"0.60402685",
"0.60306376",
"0.6025602",
"0.60253805",
"0.6003726",
"0.59915304",
"0.59439254",
"0.5930587",
"0.5928856",
"0.59242874",
"0.59233814",
"0.59226... | 0.71814495 | 0 |
Handle multiple requests each expected to be a 4byte length, followed by the LogRecord in pickle format. Logs the record according to whatever policy is configured locally. | def handle(self):
while True:
chunk = self.connection.recv(4)
if len(chunk) < 4:
break
slen = struct.unpack('>L', chunk)[0]
chunk = self.connection.recv(slen)
while len(chunk) < slen:
chunk = chunk + self.connection.recv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle(self):\n while True:\n try:\n chunk = self.connection.recv(4)\n if len(chunk) < 4:\n break\n slen = struct.unpack(\">L\", chunk)[0]\n chunk = self.connection.recv(slen)\n while len(chunk) < sl... | [
"0.642383",
"0.6383582",
"0.6285302",
"0.62784356",
"0.6121849",
"0.6010063",
"0.5838576",
"0.55765617",
"0.55357414",
"0.55147916",
"0.54627067",
"0.5431377",
"0.5374189",
"0.53549516",
"0.5341674",
"0.5333902",
"0.53018004",
"0.52858895",
"0.52804816",
"0.52658737",
"0.5244... | 0.6399498 | 1 |
Plot mesh triangles on a given surface | def plotMesh(verts,tris):
x = verts[:,0]
y = verts[:,1]
plt.figure()
plt.gca().set_aspect('equal')
plt.triplot(x, y, tris, 'k-')
plt.title('Unstructured Mesh')
plt.xlabel('distance (m)')
plt.ylabel('distance (m)') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DisplayMesh():\r\n \r\n # Load Surface Mesh Data and generate normals\r\n VTKString = OpenData('C:/Users/Tim/Documents/University/Year 4/Final Project/FinalYearProjectCode/TEH_Code/InputFiles','muscle_surface.vtk')\r\n header, Vertices, Triangles = CreateMatrixVTK(VTKString)\r\n \r\n fig = pl... | [
"0.7586179",
"0.73376596",
"0.7131",
"0.68556476",
"0.67790115",
"0.670109",
"0.66954625",
"0.643024",
"0.63897085",
"0.6355384",
"0.6306112",
"0.62642723",
"0.62621355",
"0.62500685",
"0.6235236",
"0.62293386",
"0.6221899",
"0.62194383",
"0.6191307",
"0.6178185",
"0.6175373"... | 0.75149196 | 1 |
Plot interpolated image of surface displacements, optionally show original points | def plotSurface(surfaceFile, comp=2, points=False, tris=False,
profile=False, ax=None, annotate=True, norm=None,xscale=1, yscale=1):
verts,data,tris = load_h5(surfaceFile)
if comp==3: #radial displacements
z = np.hypot(data[:,:,0], data[:,:,1]).flatten()
else:
z = data[:,:,c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imshow_surface(self):\n plt.imshow(self.z)\n plt.colorbar()\n plt.show()",
"def plot(model, center, extent, outname):\n # define model grid\n xg = np.linspace(-extent, extent, model.shape[0])\n yg = xg.copy()\n interp_func = RectBivariateSpline(xg, yg, model)\n\n x = np.ar... | [
"0.6518163",
"0.6399373",
"0.62921655",
"0.6148502",
"0.6133245",
"0.6123275",
"0.60479116",
"0.60328573",
"0.6023449",
"0.59941006",
"0.59833103",
"0.5982813",
"0.5928283",
"0.5919153",
"0.5898158",
"0.5881833",
"0.58795625",
"0.5879294",
"0.58704317",
"0.5856613",
"0.585542... | 0.69940144 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.