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 |
|---|---|---|---|---|---|---|
create u_{xx} matrix operator using central differences. No flux boundaries assumed. | def create_Uxx_mat(x):
dx = x[1] - x[0]
x_int = np.arange(1,len(x)-1,dtype=int)
#create u_{xx} matrix operator
Uxx_mat_row = np.hstack((x_int,x_int,x_int))
Uxx_mat_col = np.hstack((x_int-1,x_int,x_int+1))
Uxx_entry = (1/(dx**2))*np.hstack((np.ones(len(x)-2),-2*np.ones(len(x)-2),(np.on... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_Ux_mat(x):\n \n dx = x[1] - x[0]\n \n ## upwind method based on left cells moving right\n ## and right cells moving left (similar to a scratch assay)\n '''x_int = np.arange(1,len(x)-1,dtype=int)\n Ux_mat_row = np.hstack((x_int, x_int))\n Ux_mat_col = np.hstack((x_int, x_int[:len(... | [
"0.62446815",
"0.62316376",
"0.6046306",
"0.6005687",
"0.59617823",
"0.5938628",
"0.59300697",
"0.58108884",
"0.5771789",
"0.5753315",
"0.5722855",
"0.5706403",
"0.56890017",
"0.5678955",
"0.5677416",
"0.5673115",
"0.5672235",
"0.56281036",
"0.5621129",
"0.56142914",
"0.55678... | 0.69822335 | 0 |
Create a multi node optimizer from a Chainer optimizer. | def create_multi_node_optimizer(actual_optimizer, communicator):
return _MultiNodeOptimizer(actual_optimizer, communicator) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_optimizer(self, context, optimizer, host):\n pass",
"def create_model_optimizer(net,alpha):\n optimizer = chainer.optimizers.Adam(alpha=alpha)\n optimizer.setup(net)\n return optimizer",
"def __init__(self, optimizer):\n super(ShardedOptimizer, self).__init__(optimizer, name=\"Sha... | [
"0.6300642",
"0.58528394",
"0.56481653",
"0.5557845",
"0.55032265",
"0.5481432",
"0.53838235",
"0.5361062",
"0.5269666",
"0.526538",
"0.52570444",
"0.5236038",
"0.5212935",
"0.5211382",
"0.5195422",
"0.51763874",
"0.51666194",
"0.51596004",
"0.51368475",
"0.5104291",
"0.50813... | 0.77730924 | 0 |
Update HA Entity State. | def update_entity_state(self, state: dict) -> None:
self._attr_is_on = self.entity_description.value(
state[self.entity_description.key]
)
self.async_write_ha_state() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def refresh_entity_state(self):",
"def em_update_h(self):\n with self.elbo_check('h'):\n self.update_h()",
"def update_states(self) -> None:\n self.set_states()\n self.async_write_ha_state()",
"def _sun_chaged(hass, entity_id=None, old_state=None, new_state=None):\n P... | [
"0.7127321",
"0.64405394",
"0.6430438",
"0.63795185",
"0.6246587",
"0.6200929",
"0.6177765",
"0.6141028",
"0.60287523",
"0.6006195",
"0.6003928",
"0.6003928",
"0.5998483",
"0.5997044",
"0.5992333",
"0.5991804",
"0.5985489",
"0.59831786",
"0.59779197",
"0.5945326",
"0.5934481"... | 0.74860173 | 0 |
Class method to decode v1 Tx from a legacy v0 Tx. | def legacy_from_json(cls, obj):
tv = obj.get("version", -1)
if TransactionVersion.LEGACY != tv:
raise Exception(
"legacy v0 transaction is expected to be of version {}, not version {}".format(
TransactionVersion.LEGACY, tv
)
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode(code: bytes):# -> Transaction:\n vals: list[str] = str(bytes).split(' ')\n result: Transaction = Transaction()\n result.id = int(vals[0])\n result.time = int(vals[1])\n result.action = string_to_action(vals[2])\n result.acting_username = vals[3]\n result.... | [
"0.59203297",
"0.56318444",
"0.5603222",
"0.5576017",
"0.54629105",
"0.5462759",
"0.53999794",
"0.5362942",
"0.5338377",
"0.5328852",
"0.5315829",
"0.5315829",
"0.5300996",
"0.5256362",
"0.5195768",
"0.5135178",
"0.5074066",
"0.498903",
"0.4982154",
"0.49720398",
"0.49720398"... | 0.59679365 | 0 |
Coin inputs of this Transaction, used as funding for coin outputs, fees and any other kind of coin output. | def coin_inputs(self):
return self._coin_inputs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_coins(self):\n print(\"Please insert coins.\")\n for coin in self.COIN_VALUES:\n self.money_received += int(input(f\"How many {coin}?: \")) * self.COIN_VALUES[coin]\n return self.money_received",
"def coin_outputs(self):\n return self._coin_outputs",
"def process_coins():\r\n ... | [
"0.6123173",
"0.5966245",
"0.5634441",
"0.5558912",
"0.55467415",
"0.55467415",
"0.5481745",
"0.54760975",
"0.54194975",
"0.54084605",
"0.5364558",
"0.5345652",
"0.5327607",
"0.53122216",
"0.5287343",
"0.5282469",
"0.52809083",
"0.5277097",
"0.52711916",
"0.5259964",
"0.52548... | 0.75000954 | 0 |
Coin outputs of this Transaction, funded by the Transaction's coin inputs. | def coin_outputs(self):
return self._coin_outputs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coin_inputs(self):\n return self._coin_inputs",
"def outputs(self, inputs):\n return inputs",
"def getCoins(self):\n return self.coins",
"def outputs(self):\n return super().outputs",
"def outputs(self):\n return super().outputs",
"def outputs(self):\n return... | [
"0.6787281",
"0.6559575",
"0.6514078",
"0.59406906",
"0.59406906",
"0.59406906",
"0.59406906",
"0.5934072",
"0.59194964",
"0.5907574",
"0.5898513",
"0.58806205",
"0.5828155",
"0.5714257",
"0.56731254",
"0.56292564",
"0.56242514",
"0.5590234",
"0.55890447",
"0.5565225",
"0.555... | 0.79076797 | 0 |
Blockstake inputs of this Transaction. | def blockstake_inputs(self):
return self._blockstake_inputs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blockstake_outputs(self):\n return self._blockstake_outputs",
"def inputs(self):\n pass",
"def inputs(self):\n return super().inputs",
"def inputs(self):\n return super().inputs",
"def inputs(self):\n return super().inputs",
"def inputs(self):\n return super(... | [
"0.6437797",
"0.6227412",
"0.61687285",
"0.61687285",
"0.61687285",
"0.61687285",
"0.61643004",
"0.60167396",
"0.5892044",
"0.5803583",
"0.5784823",
"0.567815",
"0.5671604",
"0.564129",
"0.564129",
"0.564129",
"0.55738175",
"0.55738175",
"0.55738175",
"0.5549223",
"0.5533055"... | 0.7803568 | 0 |
Blockstake outputs of this Transaction. | def blockstake_outputs(self):
return self._blockstake_outputs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outputs(self):\n return super().outputs",
"def outputs(self):\n return super().outputs",
"def outputs(self):\n return super().outputs",
"def outputs(self):\n return super().outputs",
"def outputs(self):\n pass",
"def coin_outputs(self):\n return self._coin_ou... | [
"0.6245822",
"0.6245822",
"0.6245822",
"0.6245822",
"0.62456393",
"0.6083549",
"0.59201723",
"0.58614194",
"0.5824727",
"0.58095473",
"0.5804078",
"0.5786087",
"0.5749186",
"0.5740939",
"0.5719438",
"0.570687",
"0.570687",
"0.5694341",
"0.5688758",
"0.5688758",
"0.5594648",
... | 0.7414077 | 0 |
Optional binary data attached to this Transaction, with a max length of 83 bytes. | def data(self):
if self._data is None:
return BinaryData(strencoding="base64")
return self._data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data(self, data):\n if len(data) > 41:\n self._data = b\"\"\n else:\n self._data = data\n return self._data",
"def as_bytes(self) -> bytes:\n if isinstance(self.data, bytes):\n return self.data\n elif isinstance(self.data, str):\n ... | [
"0.65607315",
"0.61228114",
"0.6119616",
"0.61050373",
"0.5891042",
"0.5891042",
"0.5800566",
"0.5734391",
"0.5688271",
"0.56584054",
"0.5628926",
"0.56091785",
"0.5567403",
"0.5566596",
"0.55665",
"0.55652833",
"0.5525507",
"0.5522612",
"0.5522612",
"0.5522612",
"0.55147225"... | 0.6219342 | 1 |
Binary encoding of a Transaction, overriden to specify the version correctly | def binary_encode(self):
if self._legacy:
return bytearray([TransactionVersion.LEGACY]) + self._binary_encode_data()
encoder = j.data.rivine.encoder_sia_get()
encoder.add_array(bytearray([TransactionVersion.STANDARD]))
encoder.add_slice(self._binary_encode_data())
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __bytes__(self) -> bytes:\n from hathor.merged_mining.bitcoin import encode_bytearray, encode_list\n struct_bytes = self.header_head\n struct_bytes += encode_bytearray(self.coinbase_head)\n struct_bytes += encode_bytearray(self.coinbase_tail)\n struct_bytes += encode_list(sel... | [
"0.6348444",
"0.62601185",
"0.6169922",
"0.61575854",
"0.61489797",
"0.61489797",
"0.61489797",
"0.61489797",
"0.61489797",
"0.61489797",
"0.61489797",
"0.61489797",
"0.61489797",
"0.61489797",
"0.61489797",
"0.61489797",
"0.61489797",
"0.61489797",
"0.61489797",
"0.61489797",
... | 0.73798925 | 0 |
Callback function for the intent "adaptVolume", gets called when intent is detected | def start_adaptVolume(hermes, intent_message):
#log the input and the received intent
start_logging()
log_asr_input(intent_message.input)
log_received_intent(intent_message)
#extract the desired volume value from the intent message and adapt the volume
volume_value = get_required_volum... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slotVolume(self, a0):\n self.sampleGroup.action('volume', value=a0)",
"def setVolume(intent, session):\n\tif 'volume' in intent['slots']:\n\t\tvolume = intent['slots']['Volume']['value']\n\n\tspeech_output = \"Chromecast Volume set to \" + volume\n\tcard_title = \"ChromeCast - Volume Set to \" + volu... | [
"0.6542319",
"0.6332836",
"0.6268154",
"0.6231558",
"0.62264824",
"0.6061285",
"0.6000607",
"0.59331447",
"0.5866246",
"0.5794333",
"0.5783454",
"0.5674449",
"0.56732404",
"0.5658846",
"0.5651501",
"0.56294245",
"0.5600345",
"0.5582338",
"0.5578721",
"0.5578557",
"0.5527833",... | 0.7289963 | 0 |
An App with 100 tasks already in the queue. Tasks will randomly fail when executed. | def app():
app = App(
name="testapp",
processes=1,
concurrency=4,
prefetch_count=1,
retry_backoff=lambda retries: 0.01,
maintenance_interval=0.1,
schedule_interval=0.1,
heartbeat_interval=0.1,
heartbeat_timeout=1,
grace_period=1,
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_no_more_tasks(self):\r\n self.create()\r\n app = App(short_name='egil', name='egil',\r\n description='egil')\r\n owner = db.session.query(User).get(1)\r\n app.owner_id = owner.id\r\n db.session.add(app)\r\n db.session.commit()\r\n\r\n app_i... | [
"0.7139638",
"0.6872016",
"0.6820473",
"0.64749575",
"0.6203939",
"0.6192355",
"0.61694515",
"0.6168766",
"0.61448485",
"0.6123286",
"0.61067617",
"0.6095766",
"0.6092713",
"0.60915005",
"0.60242605",
"0.60211843",
"0.6011442",
"0.6004388",
"0.5986613",
"0.5975115",
"0.594326... | 0.7122439 | 1 |
This test is designed to crash the worker during processing and ensure that when we bring up a new worker, the system fully recovers. To achieve this, we're using a 'sentinel' job which triggers an exception when we try to deserialise it. | def test_worker_failure(app):
sentinel = 50
def mocked_deserialise(fields):
job = Job.deserialise(fields)
if job.args == [sentinel]:
raise Chaos("Found sentinel job")
return job
with mock.patch("fennel.worker.broker.Job", wraps=Job) as mocked_job:
mocked_job.des... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_launch_400():\n work_queue = asyncio.Queue()\n await work_queue.put(TestData.JOB_TEMPLATE_LAUNCH_PAYLOAD)\n worker = tower_api_worker.TowerApiWorker(TestData.config, None, work_queue)\n with aioresponses() as mocked:\n mocked.post(\n TestData.JOB_TEMPLATE_POST_URL, stat... | [
"0.6359065",
"0.6358153",
"0.6343971",
"0.62961966",
"0.62398404",
"0.62254554",
"0.6220339",
"0.6151781",
"0.6128433",
"0.61171836",
"0.61096936",
"0.61035645",
"0.6060205",
"0.6046334",
"0.60378677",
"0.60087585",
"0.6002686",
"0.5972724",
"0.5961226",
"0.5950227",
"0.59496... | 0.74951327 | 0 |
Returns a singular database connection to be shared amongst all calls for a given thread. | def _get_connection(self) -> sqlite3.Connection:
curr_thread = threading.get_ident()
if curr_thread not in self.conn or self.conn[curr_thread] is None:
conn = sqlite3.connect(self.db_path, check_same_thread=False)
conn.row_factory = sqlite3.Row
self.conn[curr_thread] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_connection(self) -> Connection:\n # TODO(101) is there a problem with having just one db connection?\n # Will this cause bugs with failed commits?\n curr_thread = threading.get_ident()\n if curr_thread not in self.conn or self.conn[curr_thread] is None:\n try:\n ... | [
"0.79301536",
"0.74529684",
"0.7043397",
"0.7013358",
"0.6935523",
"0.6571063",
"0.65294355",
"0.6474125",
"0.64452714",
"0.64002967",
"0.6362195",
"0.63587844",
"0.6348218",
"0.634644",
"0.63254464",
"0.6292941",
"0.62925506",
"0.62602526",
"0.6254633",
"0.6221707",
"0.62125... | 0.8007835 | 0 |
Update the last Study mapping time to mark a change to the Study mappings table and allow dependents to invalidate caches | def _mark_study_mapping_update(self, unit_id: str) -> None:
self._last_study_mapping_update_times[unit_id] = time.monotonic() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mapper_updated(self):\n self.invalidate()\n return",
"def memoryMapChanged(self, mem: ghidra.program.database.mem.MemoryMapDB) -> None:\n ...",
"def is_study_mapping_in_sync(self, unit_id: str, compare_time: float):\n return compare_time > self._last_study_mapping_update_times[u... | [
"0.6335052",
"0.58112735",
"0.56721526",
"0.54929096",
"0.5459769",
"0.5457291",
"0.5452044",
"0.54163307",
"0.54032046",
"0.5332193",
"0.52810687",
"0.52514476",
"0.52494526",
"0.52186",
"0.520193",
"0.51904476",
"0.5174565",
"0.5160427",
"0.51492006",
"0.5144736",
"0.513647... | 0.77558404 | 0 |
Set the study status in datastore | def update_study_status(self, study_id: str, status: str) -> None:
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
UPDATE studies
SET status = ?
WHERE prolific_stu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_status(self, status):\n # TODO log to db\n self.status = status",
"def study(self, study):\n self.logger.debug(\"In 'study' setter.\")\n\n self._study = study",
"def test_update_study_state(self):\n study_spec = sample_study_spec()\n study_id = self.storage.create_stud... | [
"0.6347588",
"0.62812126",
"0.6270662",
"0.6216257",
"0.6201633",
"0.61703455",
"0.6145683",
"0.5950445",
"0.5899873",
"0.58854955",
"0.58854955",
"0.58854955",
"0.5872294",
"0.5774827",
"0.5762979",
"0.5747019",
"0.5741097",
"0.57318676",
"0.5720657",
"0.5720657",
"0.5720657... | 0.7005569 | 0 |
Register a specific Submission and Study to the given unit, or clear the assignment after a return | def register_submission_to_study(
self,
prolific_study_id: str,
unit_id: Optional[str] = None,
prolific_submission_id: Optional[str] = None,
) -> None:
logger.debug(
f"Attempting to assign Study {prolific_study_id}, "
f"Unit {unit_id}, "
f"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_submission_for_unit(self, unit_id: str, prolific_submission_id: str) -> None:\n self.ensure_unit_exists(unit_id)\n with self.table_access_condition:\n conn = self._get_connection()\n c = conn.cursor()\n c.execute(\n \"\"\"\n UPDAT... | [
"0.60139275",
"0.57114136",
"0.5529868",
"0.55083746",
"0.5202546",
"0.51838",
"0.49747518",
"0.4953589",
"0.4925377",
"0.49144888",
"0.4907109",
"0.48912132",
"0.48760748",
"0.48470256",
"0.4823713",
"0.4817142",
"0.48086545",
"0.4766989",
"0.4761017",
"0.47489557",
"0.47477... | 0.73511785 | 0 |
Create a record of this requester if it doesn't exist | def ensure_requester_exists(self, requester_id: str) -> None:
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
INSERT OR IGNORE INTO requesters(
requester_id,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_record(self):\n if not self.record_exists(self.args.date):\n record = self.create_record()\n self.records.append(record)\n self.write_json_file(self.records_file, self.records)\n return True\n return False",
"def create(self):\n if self.id:... | [
"0.6543574",
"0.6341111",
"0.6203254",
"0.61983633",
"0.6175808",
"0.6089663",
"0.60252005",
"0.5971913",
"0.59324276",
"0.588625",
"0.5882174",
"0.5853006",
"0.5845237",
"0.5835557",
"0.5794991",
"0.5770626",
"0.5769214",
"0.5749854",
"0.57427335",
"0.57255536",
"0.5715714",... | 0.69637233 | 0 |
Set the requester registration status for the given id | def set_requester_registered(self, requester_id: str, val: bool) -> None:
self.ensure_requester_exists(requester_id)
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
UPDATE requesters
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_regID():\n if not request.json or not 'regID' in request.json or not 'id' in request.json:\n abort(400)\n\n regID = request.json.get('regID', \"\")\n id = request.json['id']\n\n users = models.User.query.all()\n for u in users:\n if u.regid == str(regID):\n u.regid =... | [
"0.67321193",
"0.6618227",
"0.6357653",
"0.6063732",
"0.6000469",
"0.58940834",
"0.5814481",
"0.5730048",
"0.5704926",
"0.56101215",
"0.557847",
"0.55693245",
"0.551625",
"0.5485781",
"0.54706895",
"0.54508686",
"0.5385317",
"0.53656507",
"0.53351235",
"0.5328342",
"0.5320843... | 0.7757716 | 0 |
Get the registration status of a requester | def get_requester_registered(self, requester_id: str) -> bool:
self.ensure_requester_exists(requester_id)
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
SELECT is_registered FROM request... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_registration_status(khoros_object, user_settings=None, user_id=None, login=None, email=None):\n registration_data = get_registration_data(khoros_object, user_settings, user_id, login, email)\n return registration_data['status']",
"def registration_status(self, data: AccountActivationTokenData) -> o... | [
"0.6722117",
"0.66396385",
"0.6189716",
"0.61196005",
"0.60329926",
"0.60098886",
"0.59134054",
"0.5912373",
"0.5833691",
"0.5763986",
"0.57586235",
"0.57357144",
"0.5588464",
"0.55523133",
"0.55368006",
"0.551075",
"0.5502946",
"0.5460362",
"0.5441334",
"0.5439295",
"0.54312... | 0.6993756 | 0 |
Create a record of this worker if it doesn't exist | def ensure_worker_exists(self, worker_id: str) -> None:
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
INSERT OR IGNORE INTO workers(
worker_id,
is_blocke... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_record(self):\n if not self.record_exists(self.args.date):\n record = self.create_record()\n self.records.append(record)\n self.write_json_file(self.records_file, self.records)\n return True\n return False",
"def createRecord(self):\n self.... | [
"0.6282108",
"0.6205416",
"0.6107752",
"0.6096483",
"0.602431",
"0.60167134",
"0.5932024",
"0.5832174",
"0.5822056",
"0.5803115",
"0.57942224",
"0.576521",
"0.5756175",
"0.5735413",
"0.5700159",
"0.5667973",
"0.5598056",
"0.5554502",
"0.5553095",
"0.5552826",
"0.5537877",
"... | 0.6437617 | 0 |
Get the blocked status of a worker | def get_worker_blocked(self, worker_id: str) -> bool:
self.ensure_worker_exists(worker_id)
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
SELECT is_blocked FROM workers
W... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_blocked_workers(self) -> List[dict]:\n with self.table_access_condition:\n conn = self._get_connection()\n c = conn.cursor()\n c.execute(\n \"\"\"\n SELECT worker_id FROM workers\n WHERE is_blocked = ?\n \"\... | [
"0.7199663",
"0.6598209",
"0.653894",
"0.6504668",
"0.6360467",
"0.62128055",
"0.6168302",
"0.6117404",
"0.60832244",
"0.58538836",
"0.5846497",
"0.58278906",
"0.5765363",
"0.5745718",
"0.57282084",
"0.5708878",
"0.5704661",
"0.5642528",
"0.56421673",
"0.56148297",
"0.5594511... | 0.693781 | 1 |
Get all workers with blocked status | def get_blocked_workers(self) -> List[dict]:
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
SELECT worker_id FROM workers
WHERE is_blocked = ?
""",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_waiting_jobs(self):\n return []",
"def procs_blocked():\n \n return __proc_stat('procs_blocked')",
"def workers_status(self):\n workers = []\n for agent in self.agents_status():\n workers += agent['workers']\n return workers",
"def _remote_worker_ids_for_m... | [
"0.6682969",
"0.661497",
"0.65896666",
"0.63080287",
"0.62555254",
"0.6238909",
"0.6157863",
"0.6119628",
"0.61165744",
"0.60843563",
"0.60581446",
"0.60511965",
"0.60404587",
"0.5952348",
"0.5928494",
"0.59132004",
"0.58977073",
"0.5881317",
"0.58725494",
"0.5863898",
"0.583... | 0.80954754 | 0 |
Get the details for a unit by unit_id | def get_unit(self, unit_id: str) -> sqlite3.Row:
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
SELECT * from units
WHERE unit_id = ?;
""",
(unit_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_unit(self, unit_id: str) -> Mapping[str, Any]:\n return self.__get_one_by_id(\"units\", \"unit_id\", unit_id)",
"def get(self, request, id):\n unit = Unit.objects.get(pk=id)\n serializer = UnitSerializer(unit)\n return Response(serializer.data)",
"def load_unit(self, unit_id... | [
"0.77624756",
"0.7408099",
"0.6576655",
"0.6459994",
"0.6412606",
"0.62141645",
"0.6056082",
"0.60549706",
"0.59108895",
"0.5904486",
"0.5788314",
"0.5770841",
"0.5746239",
"0.57448316",
"0.570962",
"0.5709295",
"0.56750274",
"0.56279016",
"0.55930716",
"0.55613184",
"0.55465... | 0.75211567 | 1 |
Set prolific_submission_id to unit | def set_submission_for_unit(self, unit_id: str, prolific_submission_id: str) -> None:
self.ensure_unit_exists(unit_id)
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
UPDATE units
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_submission_to_study(\n self,\n prolific_study_id: str,\n unit_id: Optional[str] = None,\n prolific_submission_id: Optional[str] = None,\n ) -> None:\n logger.debug(\n f\"Attempting to assign Study {prolific_study_id}, \"\n f\"Unit {unit_id}, ... | [
"0.6595971",
"0.51455045",
"0.5121183",
"0.50757414",
"0.50332946",
"0.5005706",
"0.5004454",
"0.49610958",
"0.49454448",
"0.4943602",
"0.4916713",
"0.48934448",
"0.48890603",
"0.48650807",
"0.48451746",
"0.4822277",
"0.481392",
"0.47903392",
"0.4772739",
"0.4772739",
"0.4772... | 0.84948945 | 0 |
Either create a new session for the given requester or return the existing one if it has already been created | def get_session_for_requester(self, requester_name: str) -> ProlificClient:
if requester_name not in self.session_storage:
session = get_authenticated_client(requester_name)
self.session_storage[requester_name] = session
return self.session_storage[requester_name] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _insert_new_session():\n request = self._make_request()\n session_existing = self._set_up_session_in_Redis_and_makeOne( # noqa: F841\n request, session_id, session_dict={\"visited\": True}, **session_args\n )\n return request",
"def create_session(\... | [
"0.71257657",
"0.6977571",
"0.69457173",
"0.67173743",
"0.646942",
"0.6355395",
"0.6250632",
"0.6237556",
"0.6165635",
"0.6143248",
"0.6119662",
"0.6119207",
"0.60588497",
"0.6052434",
"0.60503334",
"0.6013821",
"0.5968652",
"0.5962655",
"0.59055924",
"0.5904297",
"0.5896423"... | 0.7321774 | 0 |
Return the client for the given requester, which should allow direct calls to the Prolific surface | def get_client_for_requester(self, requester_name: str) -> ProlificClient:
return self.get_session_for_requester(requester_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_client(self, requester_name: str) -> Any:\n return self.datastore.get_client_for_requester(requester_name)",
"def get_session_for_requester(self, requester_name: str) -> ProlificClient:\n if requester_name not in self.session_storage:\n session = get_authenticated_client(request... | [
"0.7701357",
"0.66684836",
"0.6241811",
"0.6101554",
"0.6101554",
"0.60675657",
"0.589849",
"0.5898463",
"0.5870462",
"0.5857428",
"0.5834482",
"0.5816941",
"0.58128434",
"0.5795806",
"0.57913387",
"0.5788756",
"0.578672",
"0.5774646",
"0.5751454",
"0.5747956",
"0.57444125",
... | 0.8023096 | 0 |
Get the mapping between Mephisto qualifications and Prolific Participant Group | def get_qualification_mapping(self, qualification_name: str) -> Optional[sqlite3.Row]:
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
SELECT * FROM participant_groups
WHERE quali... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_participant_group_mapping(\n self,\n qualification_name: str,\n requester_id: str,\n prolific_project_id: str,\n prolific_participant_group_name: str,\n prolific_participant_group_id: str,\n ) -> None:\n try:\n with self.table_access_conditi... | [
"0.62632585",
"0.5566724",
"0.5447059",
"0.5356039",
"0.52874446",
"0.5150763",
"0.5098822",
"0.5068606",
"0.50669193",
"0.5032295",
"0.50200653",
"0.4993262",
"0.49907285",
"0.49808893",
"0.4911075",
"0.48680684",
"0.48489094",
"0.48466963",
"0.48400936",
"0.482487",
"0.4819... | 0.5748817 | 1 |
Create a mapping between mephisto qualification name and Prolific Participant Group details in the local datastore. Repeat entries with the same `qualification_name` will be idempotent | def create_participant_group_mapping(
self,
qualification_name: str,
requester_id: str,
prolific_project_id: str,
prolific_participant_group_name: str,
prolific_participant_group_id: str,
) -> None:
try:
with self.table_access_condition, self._get_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_qualification_mapping(\n self,\n run_id: str,\n prolific_participant_group_id: str,\n qualifications: List[QualificationType],\n qualification_ids: List[int],\n ) -> None:\n with self.table_access_condition, self._get_connection() as conn:\n c = co... | [
"0.6491591",
"0.6222569",
"0.56028444",
"0.53937715",
"0.51469314",
"0.49479437",
"0.48741364",
"0.48038384",
"0.47761557",
"0.47589907",
"0.47337908",
"0.47236875",
"0.47202298",
"0.47012442",
"0.46533737",
"0.46517906",
"0.4649459",
"0.4644288",
"0.4636188",
"0.46299362",
"... | 0.77214843 | 0 |
Delete participant_groups by Participant Group IDs | def delete_participant_groups_by_participant_group_ids(
self,
participant_group_ids: List[str] = None,
) -> None:
if not participant_group_ids:
return None
with self.table_access_condition, self._get_connection() as conn:
c = conn.cursor()
partic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _delete_by_list(self, group_ids):\n path = '/members/%s/groups/remove' % self.member['member_id']\n data = {'group_ids': group_ids}\n if self.member.account.adapter.put(path, data):\n self._dict = dict(x for x in self._dict.items()\n if x[0] not in group_ids)",
... | [
"0.7311787",
"0.71487516",
"0.7011263",
"0.68069136",
"0.67244774",
"0.6704495",
"0.66740835",
"0.6641592",
"0.65757996",
"0.6495186",
"0.6485396",
"0.64465976",
"0.64452267",
"0.6428455",
"0.64257216",
"0.6414882",
"0.63549817",
"0.6336999",
"0.6336016",
"0.632371",
"0.62640... | 0.79611284 | 0 |
Register a new participant group mapping with qualifications | def create_qualification_mapping(
self,
run_id: str,
prolific_participant_group_id: str,
qualifications: List[QualificationType],
qualification_ids: List[int],
) -> None:
with self.table_access_condition, self._get_connection() as conn:
c = conn.cursor()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_participant_group_mapping(\n self,\n qualification_name: str,\n requester_id: str,\n prolific_project_id: str,\n prolific_participant_group_name: str,\n prolific_participant_group_id: str,\n ) -> None:\n try:\n with self.table_access_conditi... | [
"0.66546637",
"0.5257194",
"0.5194615",
"0.5144919",
"0.5120393",
"0.50405955",
"0.5006329",
"0.4989716",
"0.49766645",
"0.496137",
"0.48981318",
"0.4869672",
"0.48406723",
"0.48358613",
"0.48190278",
"0.48159954",
"0.48017764",
"0.47825062",
"0.47774935",
"0.47633427",
"0.47... | 0.6116895 | 1 |
Find all studies having or excluding certain statuses | def find_studies_by_status(self, statuses: List[str], exclude: bool = False) -> List[dict]:
if not statuses:
return []
logic_str = "NOT" if exclude else ""
statuses_str = ",".join([f'"{s}"' for s in statuses])
with self.table_access_condition, self._get_connection() as conn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_by_current_status(self, status):\r\n return self.filter_by_current_statuses([status])",
"def select_steps_with_status(status, steps):\n return [ step for step in steps if step.status == status ]",
"def _filter_resources_by_status(self, resources: [], statuses: []):\n all_resources ... | [
"0.60169053",
"0.59524053",
"0.58520824",
"0.5790186",
"0.5554342",
"0.5427617",
"0.5382475",
"0.5375774",
"0.5290088",
"0.5258065",
"0.5246053",
"0.5222208",
"0.519873",
"0.51943564",
"0.5170205",
"0.515716",
"0.515716",
"0.51392555",
"0.51317495",
"0.50997245",
"0.50857",
... | 0.77505106 | 0 |
Find qualifications by Mephisto ids of qualifications for all incomplete studies | def find_qualifications_for_running_studies(
self,
qualification_ids: List[str],
) -> List[dict]:
if not qualification_ids:
return []
running_studies = self.find_studies_by_status(
statuses=[StudyStatus.COMPLETED, StudyStatus.AWAITING_REVIEW],
exc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_all_id():\n\n # Quering with MPRester to obtain corresponding material id, reduced formula and space group.\n with MPR(get_api_key()) as m:\n\n # Criteria is set as greater than -1 to search materials, which is unphysical in real world, therefore in effect\n # search all available ma... | [
"0.57374805",
"0.53594923",
"0.53317744",
"0.52336556",
"0.52008086",
"0.51555103",
"0.5154212",
"0.5144059",
"0.5142913",
"0.51212066",
"0.5081121",
"0.50544673",
"0.5045868",
"0.5032191",
"0.50281304",
"0.5003475",
"0.49850816",
"0.49790543",
"0.49723706",
"0.4970946",
"0.4... | 0.5639729 | 1 |
Find qualifications by Mephisto ids of qualifications and task runs | def find_qualifications_by_ids(
self,
qualification_ids: List[str] = None,
task_run_ids: Optional[List[str]] = None,
) -> List[dict]:
if not qualification_ids:
return []
with self.table_access_condition, self._get_connection() as conn:
c = conn.cursor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_qualifications_for_running_studies(\n self,\n qualification_ids: List[str],\n ) -> List[dict]:\n if not qualification_ids:\n return []\n\n running_studies = self.find_studies_by_status(\n statuses=[StudyStatus.COMPLETED, StudyStatus.AWAITING_REVIEW],\n ... | [
"0.6435243",
"0.5413809",
"0.52597505",
"0.51333296",
"0.5130935",
"0.50958717",
"0.5090198",
"0.50279266",
"0.5014353",
"0.49910003",
"0.4980882",
"0.4903451",
"0.4900483",
"0.4892913",
"0.48767987",
"0.48631293",
"0.48606345",
"0.48309255",
"0.48161194",
"0.48051333",
"0.48... | 0.6738515 | 0 |
Delete qualifications by Participant Group IDs | def delete_qualifications_by_participant_group_ids(
self,
participant_group_ids: List[str] = None,
) -> None:
if not participant_group_ids:
return None
with self.table_access_condition, self._get_connection() as conn:
c = conn.cursor()
participan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _delete_by_list(self, group_ids):\n path = '/members/%s/groups/remove' % self.member['member_id']\n data = {'group_ids': group_ids}\n if self.member.account.adapter.put(path, data):\n self._dict = dict(x for x in self._dict.items()\n if x[0] not in group_ids)",
... | [
"0.6367987",
"0.6198112",
"0.59401566",
"0.59198415",
"0.59173214",
"0.59173214",
"0.58821714",
"0.5852364",
"0.58483195",
"0.5824276",
"0.5743131",
"0.57426155",
"0.57369345",
"0.57328886",
"0.57291615",
"0.57184756",
"0.57014483",
"0.56834567",
"0.56708014",
"0.5628293",
"0... | 0.7979909 | 0 |
Clear the Study mapping that maps the given unit, if such a unitstudy map exists | def clear_study_from_unit(self, unit_id: str) -> None:
with self.table_access_condition, self._get_connection() as conn:
c = conn.cursor()
c.execute(
"""
SELECT * FROM studies
INNER JOIN units USING (prolific_study_id)
WHERE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clearMap(self):\n for key in self.componentMap.keys():\n del self.componentMap[key][:]",
"def clear(self):\n self._map = {}",
"def clear_map(self):\n self.rooms = []\n\n self.dungeon.clear_dungeon()",
"def reset(self):\n self._maps = {}",
"def removeObjectM... | [
"0.63547313",
"0.62889856",
"0.61035144",
"0.6019435",
"0.5989932",
"0.59295875",
"0.59122825",
"0.5883522",
"0.5867425",
"0.5649991",
"0.56320226",
"0.5534572",
"0.54496354",
"0.54241747",
"0.5401728",
"0.54002196",
"0.53703153",
"0.5362784",
"0.53616357",
"0.53445333",
"0.5... | 0.7392119 | 0 |
Register a new task run in the Task Runs table | def register_run(
self,
run_id: str,
prolific_workspace_id: str,
prolific_project_id: str,
prolific_study_config_path: str,
frame_height: int = 0,
actual_available_places: Optional[int] = None,
listed_available_places: Optional[int] = None,
prolifi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_new_task(self, task):\n self.all_tasks.add(task)\n print(f\"Task registered in loadbalancer {task.task_id} description {task.description}\")",
"def register(project_id, runner):\n pass",
"def register(self, task, schedule, minutes: int = None):\n self.task_list.append(S... | [
"0.6981847",
"0.6613176",
"0.6595695",
"0.6566624",
"0.64865947",
"0.64436245",
"0.63527846",
"0.62467456",
"0.62366736",
"0.61728585",
"0.6164959",
"0.6091906",
"0.60845494",
"0.60845494",
"0.60845494",
"0.60845494",
"0.60514104",
"0.60268766",
"0.6024544",
"0.5993197",
"0.5... | 0.6767208 | 1 |
Set available places for a run by task_run_id | def set_available_places_for_run(
self,
run_id: str,
actual_available_places: int,
listed_available_places: int,
) -> None:
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_run(self, run_id: str):\n self.run_id = run_id",
"def setup(self, run, run_id):\n\n raise NotImplementedError",
"def runs(self, runs):\n\n self._runs = runs",
"def set_task(task_id, train_dataset, val_dataset, test_dataset):\n assert isinstance(task_id, int)\n train_dataset.set... | [
"0.6097272",
"0.5969154",
"0.5910109",
"0.56929535",
"0.55176425",
"0.55078405",
"0.5458947",
"0.5400595",
"0.5391396",
"0.53636914",
"0.5324286",
"0.5226775",
"0.5187318",
"0.5180195",
"0.5178697",
"0.5156345",
"0.51533335",
"0.515099",
"0.5117534",
"0.51099336",
"0.51081496... | 0.743029 | 0 |
Create a CastDevice entity or dynamic group from the chromecast object. Returns None if the cast device has already been added. | def _async_create_cast_device(hass: HomeAssistant, info: ChromecastInfo):
_LOGGER.debug("_async_create_cast_device: %s", info)
if info.uuid is None:
_LOGGER.error("_async_create_cast_device uuid none: %s", info)
return None
# Found a cast with UUID
added_casts = hass.data[ADDED_CAST_DEV... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, hass: HomeAssistant, cast_info: ChromecastInfo) -> None:\n\n CastDevice.__init__(self, hass, cast_info)\n\n self.cast_status = None\n self.media_status = None\n self.media_status_received = None\n self.mz_media_status: dict[str, pychromecast.controllers.media.M... | [
"0.56766814",
"0.5283702",
"0.50978327",
"0.50686663",
"0.49677455",
"0.48878825",
"0.4855418",
"0.48321566",
"0.47461665",
"0.47247794",
"0.46789485",
"0.46773532",
"0.46091816",
"0.45608175",
"0.45446116",
"0.45047563",
"0.44615892",
"0.44468307",
"0.44382468",
"0.4433978",
... | 0.7822136 | 0 |
Disconnect Chromecast object if it is set. | async def _async_disconnect(self) -> None:
if self._chromecast is not None:
_LOGGER.debug(
"[%s %s] Disconnecting from chromecast socket",
self._name,
self._cast_info.friendly_name,
)
await self.hass.async_add_executor_job(self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disconnect(self):\n stream=self.get_stream()\n if stream:\n stream.disconnect()",
"def disconnect(self):\n\n if self.connect:\n Disconnect(self.connect)",
"async def _async_cast_removed(self, discover: ChromecastInfo) -> None:",
"def callback(chromecast):\n ... | [
"0.677271",
"0.6769639",
"0.6769529",
"0.6745102",
"0.66430455",
"0.6628958",
"0.6578833",
"0.65590036",
"0.6386176",
"0.6386176",
"0.6386176",
"0.6386176",
"0.6386176",
"0.6353908",
"0.63084054",
"0.62891555",
"0.6283085",
"0.6275995",
"0.6274993",
"0.62656873",
"0.62619674"... | 0.69410545 | 0 |
Handle removal of Chromecast. | async def _async_cast_removed(self, discover: ChromecastInfo) -> None: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callback(chromecast):\n nonlocal cast\n cast = chromecast\n stop_discovery()",
"async def _async_cast_removed(self, discover: ChromecastInfo):\n if self._cast_info.uuid != discover.uuid:\n # Removed is not our device.\n return\n\n if not discover.cast_... | [
"0.73660195",
"0.70525116",
"0.6710867",
"0.62403584",
"0.6207654",
"0.6207654",
"0.6177352",
"0.61686534",
"0.59691876",
"0.59612745",
"0.59612745",
"0.59612745",
"0.59612745",
"0.59612745",
"0.5756684",
"0.5747442",
"0.5745485",
"0.57377756",
"0.57239395",
"0.57124937",
"0.... | 0.8122248 | 0 |
Ensure chromecast is available, to facilitate type checking. | def _get_chromecast(self) -> pychromecast.Chromecast:
if self._chromecast is None:
raise HomeAssistantError("Chromecast is not available.")
return self._chromecast | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _async_connect_to_chromecast(self):\n await super()._async_connect_to_chromecast()\n\n self._attr_available = False\n self.cast_status = self._chromecast.status\n self.media_status = self._chromecast.media_controller.status\n self.async_write_ha_state()",
"async def t... | [
"0.6193639",
"0.57754296",
"0.57085156",
"0.56373173",
"0.556665",
"0.5525021",
"0.54512626",
"0.5366932",
"0.53065175",
"0.5003264",
"0.49487486",
"0.49213454",
"0.4897795",
"0.4862457",
"0.48537984",
"0.4840052",
"0.4773719",
"0.47686037",
"0.47391286",
"0.46976003",
"0.469... | 0.6834429 | 0 |
Initialize the cast device. | def __init__(self, hass: HomeAssistant, cast_info: ChromecastInfo) -> None:
CastDevice.__init__(self, hass, cast_info)
self.cast_status = None
self.media_status = None
self.media_status_received = None
self.mz_media_status: dict[str, pychromecast.controllers.media.MediaStatus] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doInitializeDevice(self):\n super().doInitializeDevice()",
"async def init(self):\n logger.info(\"Init device: %s\", self._serial)\n self._callback(STATUS_INIT)\n\n self._init_binaries()\n self._init_apks()\n await self._init_forwards()\n\n await adb.shell(sel... | [
"0.6741863",
"0.63210136",
"0.63021034",
"0.62491494",
"0.61908686",
"0.6185856",
"0.6127319",
"0.611445",
"0.60892844",
"0.6029626",
"0.5942921",
"0.5920275",
"0.5917761",
"0.5917761",
"0.5917761",
"0.5875166",
"0.58721066",
"0.58629763",
"0.58606815",
"0.58524823",
"0.58481... | 0.7168737 | 0 |
Handle updates of the cast status. | def new_cast_status(self, cast_status):
self.cast_status = cast_status
self._attr_volume_level = cast_status.volume_level if cast_status else None
self._attr_is_volume_muted = (
cast_status.volume_muted if self.cast_status else None
)
self.schedule_update_ha_state() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_connection_status(self, connection_status):\n _LOGGER.debug(\n \"[%s %s] Received cast device connection status: %s\",\n self.entity_id,\n self._cast_info.friendly_name,\n connection_status.status,\n )\n if connection_status.status == CONNECT... | [
"0.6185729",
"0.6134396",
"0.60823876",
"0.6065262",
"0.5997917",
"0.5953508",
"0.59188455",
"0.58653533",
"0.58409876",
"0.58400524",
"0.57382405",
"0.57118064",
"0.56970865",
"0.5687893",
"0.56830615",
"0.56712437",
"0.5670255",
"0.5667859",
"0.56534904",
"0.5626726",
"0.56... | 0.71103394 | 0 |
Handle load media failed. | def load_media_failed(self, item, error_code):
_LOGGER.debug(
"[%s %s] Load media failed with code %s(%s) for item %s",
self.entity_id,
self._cast_info.friendly_name,
error_code,
MEDIA_PLAYER_ERROR_CODES.get(error_code, "unknown code"),
ite... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(self, media):\n path = self.check_media(media)\n if path is False:\n self._log(\"warning\", \"Unknown media {0} => aborting\".format(media))\n #return False prevent continue to play or play last media, force send unknow file to load to vlc\n # self.stdi... | [
"0.64649004",
"0.598055",
"0.5721996",
"0.55514127",
"0.5537734",
"0.546007",
"0.5437222",
"0.54320645",
"0.54205024",
"0.5418767",
"0.5399689",
"0.5370693",
"0.5349351",
"0.5316276",
"0.5304128",
"0.52728426",
"0.5240289",
"0.52299684",
"0.52225417",
"0.5209326",
"0.5206276"... | 0.73414034 | 0 |
Handle updates of audio group media status. | def multizone_new_media_status(self, group_uuid, media_status):
_LOGGER.debug(
"[%s %s] Multizone %s media status: %s",
self.entity_id,
self._cast_info.friendly_name,
group_uuid,
media_status,
)
self.mz_media_status[group_uuid] = media_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_status_changed(self, state):\n if state == self.MediaStatus.LoadedMedia.value:\n QMetaObject.invokeMethod(self.video_player, \"play\", Qt.QueuedConnection)\n self.timer.start(self.timer_interval)\n elif state == self.MediaStatus.EndOfMedia.value:\n if self.s... | [
"0.6092839",
"0.60018927",
"0.5953342",
"0.5832263",
"0.58297163",
"0.5825615",
"0.5770934",
"0.5742018",
"0.55643135",
"0.5532298",
"0.5468416",
"0.5447994",
"0.5417532",
"0.54174876",
"0.5402931",
"0.5397246",
"0.53656715",
"0.5323846",
"0.5294484",
"0.5286422",
"0.52840376... | 0.65248066 | 0 |
Return media controller. First try from our own cast, then groups which our cast is a member in. | def _media_controller(self):
media_status = self.media_status
media_controller = self._chromecast.media_controller
if (
media_status is None
or media_status.player_state == MEDIA_PLAYER_STATE_UNKNOWN
):
groups = self.mz_media_status
for k,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_member_device(self, device):\n for vmedia_device in self.get_members():\n if device in vmedia_device.media_types:\n return vmedia_device",
"async def async_browse_media(\n self,\n media_content_type: MediaType | str | None = None,\n media_content_id: ... | [
"0.58899635",
"0.57775426",
"0.5709307",
"0.56227726",
"0.54533505",
"0.54274106",
"0.5408169",
"0.5370225",
"0.53664356",
"0.5342882",
"0.5275639",
"0.5241878",
"0.52389634",
"0.52185476",
"0.5215941",
"0.5203292",
"0.52003044",
"0.51745254",
"0.5108009",
"0.5086953",
"0.506... | 0.78114057 | 0 |
Turn on the cast device. | def turn_on(self) -> None:
chromecast = self._get_chromecast()
if not chromecast.is_idle:
# Already turned on
return
if chromecast.app_id is not None:
# Quit the previous app before starting splash screen or media player
chromecast.quit_app()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_on(self, **kwargs):\n self._state = True\n if(self._device['type'] == '_DT-PLUG' or self._device['type'] == '_THIMR'):\n self._send_cmd(self._device,'cmd=ctrl&devices={[' + self._device[\"sid\"] + ']}&op={\"cmd\":5,\"op\":1 }', 5)\n if(self._device['type'] == '_REALY2' or s... | [
"0.7406552",
"0.72574884",
"0.70773137",
"0.69938195",
"0.69103855",
"0.6887184",
"0.67787224",
"0.6733771",
"0.67215145",
"0.66887397",
"0.66576666",
"0.66466963",
"0.66164345",
"0.66162974",
"0.65680724",
"0.65531355",
"0.6541151",
"0.6522911",
"0.65227187",
"0.651539",
"0.... | 0.78126216 | 0 |
Turn off the cast device. | def turn_off(self) -> None:
self._get_chromecast().quit_app() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off(self):\n self._state = False\n if(self._device['type'] == '_DT-PLUG' or self._device['type'] == '_THIMR'):\n self._send_cmd(self._device, 'cmd=ctrl&devices={[' + self._device[\"sid\"] + ']}&op={\"cmd\":5,\"op\":0 }', 5)\n if(self._device['type'] == '_REALY2' or self._de... | [
"0.77125293",
"0.73852825",
"0.7375029",
"0.7369434",
"0.71732444",
"0.71646506",
"0.7117378",
"0.70834345",
"0.70813036",
"0.7070882",
"0.7055731",
"0.69409144",
"0.6884984",
"0.6865427",
"0.6848115",
"0.68478805",
"0.68336046",
"0.68285626",
"0.6773228",
"0.6752507",
"0.674... | 0.7616727 | 1 |
Seek the media to a specific location. | def media_seek(self, position: float) -> None:
media_controller = self._media_controller()
media_controller.seek(position) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seek(self, offset):\n spotifyconnect.Error.maybe_raise(lib.SpPlaybackSeek(offset))",
"async def async_media_seek(self, position):\n if not self._slave_mode:\n _LOGGER.debug(\"Seek. Device: %s, DUR: %s POS: %\", self.name, self._duration, position)\n if self._duration > 0 a... | [
"0.6965456",
"0.6830584",
"0.67693007",
"0.6712784",
"0.67060184",
"0.6577455",
"0.6523872",
"0.6498738",
"0.6475828",
"0.64033574",
"0.63202304",
"0.6232198",
"0.6222377",
"0.6197399",
"0.61383563",
"0.60291564",
"0.6021251",
"0.5925233",
"0.5906607",
"0.5903925",
"0.5829744... | 0.7190527 | 0 |
Filter non audio content. | def audio_content_filter(item):
return item.media_content_type.startswith("audio/") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_filter_function_none(self):\n self.es.register_filter(lambda x: False, ftype='none')\n self.assertTrue(self.es.streamfilter(self.data))\n self.es.register_filter(lambda x: True, ftype='none')\n self.assertFalse(self.es.streamfilter(self.data))",
"def filter(self, *args):\n ... | [
"0.5971645",
"0.5807703",
"0.5711106",
"0.5682044",
"0.5678715",
"0.5673269",
"0.5641933",
"0.5626689",
"0.56073827",
"0.5547405",
"0.55103",
"0.5487702",
"0.5477492",
"0.5461731",
"0.54573053",
"0.54350954",
"0.54194486",
"0.53928983",
"0.536873",
"0.5351429",
"0.53513527",
... | 0.75105685 | 0 |
Return media status. First try from our own cast, then groups which our cast is a member in. | def _media_status(self):
media_status = self.media_status
media_status_received = self.media_status_received
if (
media_status is None
or media_status.player_state == MEDIA_PLAYER_STATE_UNKNOWN
):
groups = self.mz_media_status
for k, val i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _media_controller(self):\n media_status = self.media_status\n media_controller = self._chromecast.media_controller\n\n if (\n media_status is None\n or media_status.player_state == MEDIA_PLAYER_STATE_UNKNOWN\n ):\n groups = self.mz_media_status\n ... | [
"0.58433545",
"0.5768256",
"0.5658567",
"0.55829275",
"0.5526078",
"0.5519814",
"0.5259285",
"0.52356243",
"0.52335846",
"0.5218048",
"0.52158123",
"0.5161178",
"0.512369",
"0.5103151",
"0.50842565",
"0.5083513",
"0.5051794",
"0.504238",
"0.50394005",
"0.5034787",
"0.5024784"... | 0.76746905 | 0 |
Album artist of current playing media (Music track only). | def media_album_artist(self):
media_status = self._media_status()[0]
return media_status.album_artist if media_status else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_album_artist(self):\n return self._media_album_artist",
"def get_album_artist(self) -> Optional[str]:\n return self.album_artist",
"def media_artist(self):\n return self._state.get(\"artist\", None)",
"def media_album_name(self):\n return self.coordinator.data.nowplaying... | [
"0.81840837",
"0.7835972",
"0.7712547",
"0.7702581",
"0.7554247",
"0.7536851",
"0.7434496",
"0.72885025",
"0.72885025",
"0.7223202",
"0.7175744",
"0.7165362",
"0.71355593",
"0.71222913",
"0.7099083",
"0.7094133",
"0.6977519",
"0.69404376",
"0.68596905",
"0.6855399",
"0.685407... | 0.84469926 | 0 |
Track number of current playing media (Music track only). | def media_track(self):
media_status = self._media_status()[0]
return media_status.track if media_status else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_track(self):\n return self.coordinator.data.nowplaying[self.zone.SourceID].QueueSongIndex",
"def on_media_loaded(self, event):\r\n if hasattr(self.mediactrl, \"DONTPLAY\"):\r\n delattr(self.mediactrl, \"DONTPLAY\")\r\n else:\r\n self.mediactrl.Play()\r\n ... | [
"0.72234356",
"0.6617069",
"0.65222174",
"0.6512412",
"0.6324415",
"0.6316083",
"0.6183811",
"0.61622626",
"0.61056364",
"0.6089385",
"0.5955567",
"0.5953183",
"0.58913755",
"0.58760023",
"0.58638656",
"0.58602774",
"0.58268636",
"0.58268636",
"0.5811663",
"0.5749939",
"0.574... | 0.67769444 | 1 |
Return the title of the series of current playing media. | def media_series_title(self):
media_status = self._media_status()[0]
return media_status.series_title if media_status else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_title(self):\n return self.coordinator.data.nowplaying[self.zone.SourceID].CurrSong.Title",
"def media_title(self):\n if self._track_id is not None and self._playlist:\n for track in self._playlist:\n if track.get(\"id\") == self._track_id:\n r... | [
"0.8153316",
"0.7809465",
"0.7654247",
"0.75648195",
"0.7499172",
"0.7493207",
"0.7477499",
"0.74103016",
"0.7396709",
"0.7381988",
"0.7381988",
"0.7365541",
"0.72329414",
"0.7168372",
"0.7128018",
"0.70869994",
"0.70469564",
"0.70360404",
"0.68458974",
"0.67718863",
"0.67585... | 0.8382323 | 0 |
Season of current playing media (TV Show only). | def media_season(self):
media_status = self._media_status()[0]
return media_status.season if media_status else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_season():\n td = datetime.datetime.today()\n if td.month > 8:\n return td.year\n return td.year - 1",
"def current_season() -> int:\n now = datetime.now()\n month, year = now.month, now.year\n if month < 4:\n year -= 1\n return year",
"def get_current_player_seaso... | [
"0.74890566",
"0.72577024",
"0.71512175",
"0.69323325",
"0.67604256",
"0.6596529",
"0.6492107",
"0.6474152",
"0.6422571",
"0.6312107",
"0.62681824",
"0.6242942",
"0.62345386",
"0.6230347",
"0.6189536",
"0.6178686",
"0.614669",
"0.6131458",
"0.6122243",
"0.61083233",
"0.608143... | 0.8186621 | 0 |
Episode of current playing media (TV Show only). | def media_episode(self):
media_status = self._media_status()[0]
return media_status.episode if media_status else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getActiveEpisode():\n active_flights = ACTIVE_FLIGHT_MODEL.get().objects.all()\n for active in active_flights:\n if active.flight.group:\n try:\n episode = getClassByName(settings.XGDS_VIDEO_GET_EPISODE_FROM_NAME)(active.flight.group.name)\n return episode\... | [
"0.6934281",
"0.6746794",
"0.6712165",
"0.6654626",
"0.6633293",
"0.6572893",
"0.64877284",
"0.62584066",
"0.61310756",
"0.6034781",
"0.6034651",
"0.5998257",
"0.59886754",
"0.5972742",
"0.59479594",
"0.59300554",
"0.5926739",
"0.5904139",
"0.58850104",
"0.58233595",
"0.58165... | 0.8226775 | 0 |
Handle a show view signal. | def _handle_signal_show_view(
self,
controller: HomeAssistantController,
entity_id: str,
view_path: str,
url_path: str | None,
):
if entity_id != self.entity_id or self._chromecast is None:
return
if self._hass_cast_controller is None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_show_view(self):\n self.setup()",
"def on_show_view(self):\n self.setup()",
"def on_show_view(self):\n self.setup()",
"def onShow(self):\n pass",
"def on_show_view(self):\n arcade.set_background_color(arcade.color.DARK_BLUE_GRAY)\n\n # Enable the UIManager w... | [
"0.68536544",
"0.68536544",
"0.68536544",
"0.66391265",
"0.62189853",
"0.6214509",
"0.6195302",
"0.60211176",
"0.58794814",
"0.58641666",
"0.58503515",
"0.58157504",
"0.5763334",
"0.5696731",
"0.5674636",
"0.56127274",
"0.56096107",
"0.5552787",
"0.5515243",
"0.55049974",
"0.... | 0.76961356 | 0 |
Method that tests `to_dict` method of certain SuggestedTopics instance. | def test_suggested_topics_to_dict(self):
suggested_topic = SuggestedTopics.objects.get(id=101)
expect_suggested_topic_dict = {'id': 101,
'name': 'somename',
'description': 'somedescription',
'created_at': 1508044512,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_suggested_topic_success_create(self):\n owner = CustomUser.objects.get(id=301)\n created_suggested_topic = SuggestedTopics.create(owner=owner,\n name='name',\n description = 'descr... | [
"0.56003827",
"0.5556019",
"0.5496197",
"0.540093",
"0.535668",
"0.52569354",
"0.51575464",
"0.5018534",
"0.49703118",
"0.48825815",
"0.48756084",
"0.4874609",
"0.4847931",
"0.48461184",
"0.47811496",
"0.47379944",
"0.4713787",
"0.4682216",
"0.4671716",
"0.46662283",
"0.46517... | 0.7743893 | 0 |
Method that tests succeeded `create` method of SuggestedTopics class object. | def test_suggested_topic_success_create(self):
owner = CustomUser.objects.get(id=301)
created_suggested_topic = SuggestedTopics.create(owner=owner,
name='name',
description = 'description')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_suggested_topic_none_create(self):\n owner = CustomUser.objects.get(id=301)\n created_suggested_topic = SuggestedTopics.create(owner=owner,\n name='name',\n description=None)\n\n ... | [
"0.7979153",
"0.6737493",
"0.61071056",
"0.60114914",
"0.6011469",
"0.6002739",
"0.5969455",
"0.5913791",
"0.5883674",
"0.5848723",
"0.58427507",
"0.58258706",
"0.58208644",
"0.5806612",
"0.57348657",
"0.5725601",
"0.5722191",
"0.56891716",
"0.5670231",
"0.56695986",
"0.56532... | 0.87428916 | 0 |
Method that tests unsucceeded `create` method of Suggested Topic class object. | def test_suggested_topic_none_create(self):
owner = CustomUser.objects.get(id=301)
created_suggested_topic = SuggestedTopics.create(owner=owner,
name='name',
description=None)
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_suggested_topic_success_create(self):\n owner = CustomUser.objects.get(id=301)\n created_suggested_topic = SuggestedTopics.create(owner=owner,\n name='name',\n description = 'descr... | [
"0.81488794",
"0.6388328",
"0.630519",
"0.62200063",
"0.61642885",
"0.5938463",
"0.58879864",
"0.5836021",
"0.5724208",
"0.5717265",
"0.5694818",
"0.5686947",
"0.56767154",
"0.5663233",
"0.56482834",
"0.5613224",
"0.5601721",
"0.5600852",
"0.5573624",
"0.5564065",
"0.55499464... | 0.8154706 | 0 |
Method that tests `update` method of SuggestedTopics class object. | def test_suggested_topic_update(self):
with mock.patch('suggestedtopics.models.cache') as mock_cache:
mock_cache. __contains__.return_value = True
actual_suggested_topic = SuggestedTopics.objects.get(id=101)
actual_suggested_topic.update(name='new name', description='new de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_suggested_topic_update_remove_user(self):\n\n actual_suggested_topic = SuggestedTopics.objects.get(id=101)\n actual_suggested_topic.update(name='new name', description='new description',\n interested_user=301, remove_interest=False)\n interested_us... | [
"0.69184744",
"0.64277434",
"0.6285757",
"0.6182273",
"0.6182273",
"0.6182273",
"0.60914916",
"0.60459757",
"0.59517545",
"0.5833594",
"0.57196856",
"0.5712657",
"0.5705269",
"0.56999",
"0.5676409",
"0.56398386",
"0.5635789",
"0.5632385",
"0.5617657",
"0.5614726",
"0.5604268"... | 0.73703545 | 0 |
Method that tests `update` method of SuggestedTopics if user leave the topic | def test_suggested_topic_update_remove_user(self):
actual_suggested_topic = SuggestedTopics.objects.get(id=101)
actual_suggested_topic.update(name='new name', description='new description',
interested_user=301, remove_interest=False)
interested_users = [use... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_topic_tracker_needs_update(database, user, topic):\n forumsread = ForumsRead.query.\\\n filter(ForumsRead.user_id == user.id,\n ForumsRead.forum_id == topic.forum_id).first()\n\n topicsread = TopicsRead.query.\\\n filter(TopicsRead.user_id == user.id,\n Topi... | [
"0.60018015",
"0.59847116",
"0.58377105",
"0.5815905",
"0.56676257",
"0.5558387",
"0.54377043",
"0.5354684",
"0.5250736",
"0.52430326",
"0.52061415",
"0.5155187",
"0.51543933",
"0.511835",
"0.51029843",
"0.509521",
"0.5091166",
"0.50811833",
"0.50620985",
"0.50447005",
"0.504... | 0.66727716 | 0 |
Method that tests 'get_all' method of SuggestedTopics class object. | def test_suggested_topic_get_all(self):
with mock.patch('suggestedtopics.models.cache') as mock_cache:
with mock.patch('suggestedtopics.models.pickle') as mock_pickle:
mock_cache. __contains__.return_value = True
mock_pickle.load.return_value = True
a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_suggested_topic_get_all_not(self):\n expected_suggested_topic = SuggestedTopics.objects.all()\n actual_suggested_topic = SuggestedTopics.get_all()\n\n self.assertEqual(list(expected_suggested_topic), list(actual_suggested_topic))",
"def test_get_topics(self):\n\n for m in sel... | [
"0.7913183",
"0.64284724",
"0.62716407",
"0.5990252",
"0.5962689",
"0.5945319",
"0.5941812",
"0.5759044",
"0.5701067",
"0.56907225",
"0.56774795",
"0.5657713",
"0.55916345",
"0.5575331",
"0.5572797",
"0.55670506",
"0.5543632",
"0.5538378",
"0.549383",
"0.54784185",
"0.5475497... | 0.7623733 | 1 |
Method that tests 'get_all' method of SuggestedTopics class object. | def test_suggested_topic_get_all_not(self):
expected_suggested_topic = SuggestedTopics.objects.all()
actual_suggested_topic = SuggestedTopics.get_all()
self.assertEqual(list(expected_suggested_topic), list(actual_suggested_topic)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_suggested_topic_get_all(self):\n with mock.patch('suggestedtopics.models.cache') as mock_cache:\n with mock.patch('suggestedtopics.models.pickle') as mock_pickle:\n mock_cache. __contains__.return_value = True\n mock_pickle.load.return_value = True\n\n ... | [
"0.76230043",
"0.64270616",
"0.6270716",
"0.59887433",
"0.5960977",
"0.59443295",
"0.5941821",
"0.57601297",
"0.57004356",
"0.56896794",
"0.5676449",
"0.5658479",
"0.55895734",
"0.5574232",
"0.5572608",
"0.5566461",
"0.55438894",
"0.5538875",
"0.5493661",
"0.5479861",
"0.5475... | 0.79119927 | 0 |
The session is accessed if the auth context processor is used and relevant attributes accessed. | def test_session_is_accessed(self):
response = self.client.get("/auth_processor_attr_access/")
self.assertContains(response, "Session accessed") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_user_authenticated(request):\n return request.session.session_key",
"def getSession(self):\n return self.request.getSession()",
"def _session(self):\n if self.session is None:\n self.session = create_session(self.config, self.auth)\n return self.session",
"def sessio... | [
"0.66932684",
"0.66676265",
"0.6542841",
"0.6494531",
"0.6486263",
"0.6444365",
"0.6420249",
"0.6353785",
"0.63161147",
"0.6306723",
"0.62880963",
"0.6284042",
"0.6284042",
"0.6284042",
"0.6284042",
"0.6284042",
"0.6284042",
"0.6284042",
"0.6275278",
"0.62551016",
"0.6251669"... | 0.7256088 | 0 |
Whether or not the default pressure levels are used. | def DefaultPressureLevels(self):
return self.P is None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pressure_options():\n pressure_settings = {\n \"use_log\": \"off\",\n \"time\": \"0\",\n \"records\": \"0\",\n \"ad2val\": get_now_measure(),\n \"status\": checker_pressure.status,\n }\n try:\n with open(\"./data/pressure_sensor.json\", \"r\") as f: # Rea... | [
"0.60208404",
"0.5642839",
"0.55783033",
"0.5568597",
"0.55158865",
"0.55103517",
"0.55045354",
"0.5478146",
"0.5433145",
"0.53766733",
"0.5376101",
"0.5376101",
"0.5373544",
"0.5360759",
"0.5349518",
"0.53435576",
"0.53372455",
"0.5308957",
"0.5294845",
"0.5285473",
"0.52843... | 0.87345874 | 0 |
Number of profiles in this Profiles object. | def Nprofiles(self):
return self._nprofiles | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def people_count(self):\n return len(self.__users)",
"def profiles(self):\n if not self._profiles:\n self.GetAllProfiles()\n return self._profiles",
"def profiles(self):\n return self._profiles",
"def profiles(self):\n return self._profiles",
"def get_num_processes(profileDi... | [
"0.7029895",
"0.6642839",
"0.6615187",
"0.6615187",
"0.6601933",
"0.6480705",
"0.62588745",
"0.62426597",
"0.62356067",
"0.6223385",
"0.61923814",
"0.6177046",
"0.6174073",
"0.61656374",
"0.6163472",
"0.6158623",
"0.6132954",
"0.6132809",
"0.6125924",
"0.61203516",
"0.6095080... | 0.8791688 | 0 |
Number of gases in the gases array. | def Ngases(self):
if self._gases_manual:
return self._gases.shape[0]
else:
self._buildGasIdArray()
return len(self._gas_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_grna(self) -> int:\n return len(self.gRNAs)",
"def n(self):\n return len(self.genotypes)",
"def numPhases(self):\n return self._phaseSpecMax + 1",
"def numIncrementals(self) -> int:\n return len(self._dataArrays)",
"def sample_count(self):\n assert len(self.decay_... | [
"0.67483014",
"0.64543843",
"0.64240694",
"0.63182235",
"0.6292739",
"0.62759465",
"0.6272683",
"0.6223839",
"0.62058425",
"0.6199831",
"0.61866426",
"0.616197",
"0.6107322",
"0.6107066",
"0.6055959",
"0.60462546",
"0.6027305",
"0.6023097",
"0.6012418",
"0.6006874",
"0.593971... | 0.7894229 | 0 |
Print the gases array content on the standard output. | def printGases(self, pfunction=print):
if self.T is None:
return
pfunction(">> Gases Ids and Names:")
if self.DefaultPressureLevels:
head = '{:10s} {:6s} '.format('Level', 'T')
fmt = '{:10d} {:6.2f} ' + ('{:10.4e} ' * self.Ngases)
else:
hea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_array(self):\n for item in self.items:\n print(item)",
"def show(self):\n m = [xo_convert(int(x)) for x in np.nditer(self.arr)]\n print(\"{} | {} | {}\".format(*m[:3]))\n print(\"--+---+--\")\n print(\"{} | {} | {}\".format(*m[3:6]))\n print(\"--+---... | [
"0.64073086",
"0.6135355",
"0.60062695",
"0.5936886",
"0.5853372",
"0.5748726",
"0.5737809",
"0.5732686",
"0.5713901",
"0.5711214",
"0.56841564",
"0.5665033",
"0.5651653",
"0.55899185",
"0.5542435",
"0.55319285",
"0.5518122",
"0.54992396",
"0.54801184",
"0.5466994",
"0.541264... | 0.7085598 | 0 |
Returns a dict containing an id and name identifying the brand. Useful when displaying logos next to accounts in templates. For most providers, these are identical to the provider. For OpenID however, the brand can derived from the OpenID identity url. | def get_brand(self):
provider = self.account.get_provider()
return dict(id=provider.id,
name=provider.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def brand(self) -> str:\n return self._config_entry.data.get(CONF_BRAND, DEFAULT_BRAND)",
"def brand(self) -> object:\n return self._brand",
"def brand_from_request(self, request):\n if b\"brand\" in request.args:\n return request.args[b\"brand\"][0].decode(\"utf-8\")\n r... | [
"0.74547386",
"0.7400217",
"0.72723806",
"0.70809495",
"0.6838912",
"0.6788304",
"0.63546604",
"0.62073046",
"0.6105659",
"0.5877203",
"0.58657223",
"0.5843112",
"0.5818814",
"0.5807949",
"0.5733384",
"0.57126707",
"0.57126707",
"0.57126707",
"0.5594731",
"0.5567401",
"0.5443... | 0.8752921 | 0 |
Quits the connection to the smtp client. | def _logout(self):
if self.connected:
try:
self._smtp.quit()
except smtplib.SMTPServerDisconnected:
pass
self._connected = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_mail_connection(self):\n self._mailconn.close()",
"def abortConnection():\n pass",
"def disconnect(self):\n\n try:\n\n if (not self._is_connected):\n self._mh.demsg('htk_on_warning', self._mh._trn.msg(\n 'htk_email_not_connected'), sel... | [
"0.65936095",
"0.6045707",
"0.6022915",
"0.5909621",
"0.5871605",
"0.5788257",
"0.5780617",
"0.5780617",
"0.57091546",
"0.57090497",
"0.57027775",
"0.5686884",
"0.5678893",
"0.56776667",
"0.5676847",
"0.5674768",
"0.56486285",
"0.56292635",
"0.5628238",
"0.56220114",
"0.56196... | 0.6958159 | 0 |
Send an email message through the SMTP client. The message may either be a string containing characters in the ASCII range, or an `auto_emailer.emailer.Message` object. If the message is a string, the smtplib delivery method will use `smtplib.sendmail`. If the message is an `auto_emailer.emailer.Message` object, the sm... | def send_email(self, message, from_addr=None, to_addrs=None,
delay_send=0):
if not isinstance(message, Message) and isinstance(message, str):
smtp_meth = 'sendmail'
if (from_addr is None) or (to_addrs is None):
raise ValueError('If sending string email,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send(self, to_addrs, subject, message, from_addr=None):\n if not from_addr: from_addr = self.user\n data = \"From: %s\\nTo: %s\\nSubject: %s\\n\\n%s\" \\\n % (from_addr, to_addrs, subject, message)\n try:\n server = smtplib.SMTP(self.host)\n server.ehlo(... | [
"0.7210467",
"0.71080345",
"0.69839424",
"0.69092715",
"0.62347573",
"0.61362433",
"0.60756147",
"0.60519797",
"0.6046977",
"0.5946594",
"0.58917576",
"0.5874191",
"0.58718705",
"0.58680665",
"0.5815829",
"0.5798782",
"0.5779696",
"0.57670623",
"0.5698961",
"0.5690675",
"0.56... | 0.7735995 | 0 |
Override __str__ method to return message as string | def __str__(self):
return self.message.as_string() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return self.msg",
"def __str__(self):\n return self.msg",
"def __str__(self):\n return self.message",
"def __str__(self):\n return self.message",
"def __str__(self):\n return self.message",
"def __str__(self) -> str:\n\n return self.msg.forma... | [
"0.85540706",
"0.85540706",
"0.8550617",
"0.8550617",
"0.8550617",
"0.8503952",
"0.8461334",
"0.8461334",
"0.8461334",
"0.8461334",
"0.8461334",
"0.8461334",
"0.8461334",
"0.8461334",
"0.8406618",
"0.8332677",
"0.8263306",
"0.81944585",
"0.81258136",
"0.810776",
"0.77951294",... | 0.8684215 | 0 |
Create, or draft, the `self.message` instance attribute with string text or text file templates. Return self from the instance to allow method chaining of `auto_emailer.emailer.Message.attach`. | def draft_message(self, text=None, template_path=None, template_args=None):
self.message['From'] = self.sender
self.message['To'] = '; '.join(self.destinations)
self.message['BCC'] = '; '.join(self.bcc)
self.message['CC'] = '; '.join(self.cc)
self.message['Subject'] = self.subjec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_message(self, **kwargs):\n message = Mail()\n if \"from_email\" in kwargs:\n sender = Email()\n message_content = kwargs.get(\"message_content\", \"\")\n sender.name = message_content.get(\"sender\", emailconf.DEFAULT_SENDER)\n sender.email = kwargs... | [
"0.65304",
"0.6519613",
"0.64167404",
"0.6236499",
"0.6189904",
"0.61803824",
"0.6118347",
"0.61061835",
"0.60972834",
"0.60905147",
"0.6075854",
"0.6031078",
"0.600757",
"0.59929657",
"0.5979075",
"0.59775925",
"0.59711695",
"0.5967846",
"0.5961782",
"0.58773917",
"0.5811507... | 0.72739553 | 0 |
Add a sequence of files as attachments to the email message. | def attach(self, attach_files=None):
# iterate through files to attach
for path in attach_files or []:
part = MIMEBase('application', "octet-stream")
with open(path, 'rb') as file:
part.set_payload(file.read())
# encode file in ASCII characters to sen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_mms_attachments(db, mms, backup_dir, thread_dir):\n qry = db.execute(\n \"SELECT _id, ct, unique_id, voice_note, width, height, quote \"\n \"FROM part WHERE mid=?\",\n (mms._id,),\n )\n for _id, ct, unique_id, voice_note, width, height, quote in qry:\n a = Attachment(\n... | [
"0.68068653",
"0.656057",
"0.64226186",
"0.6417332",
"0.63074434",
"0.62571245",
"0.62518847",
"0.6211922",
"0.619396",
"0.6171993",
"0.6164975",
"0.6077357",
"0.6073232",
"0.60652393",
"0.60565156",
"0.6028875",
"0.6017958",
"0.60116714",
"0.600287",
"0.5975613",
"0.59385246... | 0.7169905 | 0 |
Constructor to create RuntimeNicInfoSchema object | def __init__(self, py_dict=None):
super(RuntimeNicInfoSchema, self).__init__()
self.set_data_type('xml')
self.index = None
self.label = None
self.network = NetworkSchema()
if py_dict is not None:
self.get_object_from_py_dict(py_dict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vnic(options, index):\n vnic_schema = VnicSchema()\n address_group = AddressGroupSchema()\n address_group.primaryAddress = get_primary_ip(options, index)\n address_group.subnetMask = '255.255.0.0'\n vnic_schema.addressGroups = [address_group]\n vnic_schema.type = \"Internal\"\n vnic_s... | [
"0.6293053",
"0.5554286",
"0.54747784",
"0.542624",
"0.53388363",
"0.53220224",
"0.5319815",
"0.53042895",
"0.53042895",
"0.5243218",
"0.52410567",
"0.52341026",
"0.52291805",
"0.52094626",
"0.51490927",
"0.5125273",
"0.50775564",
"0.50301373",
"0.50165135",
"0.5012711",
"0.5... | 0.7714954 | 0 |
Add a key with the given value to the trie, or reassign the associated value if it is already present in the trie. Assume that key is an immutable ordered sequence. Raise a TypeError if the given key is of the wrong type. | def __setitem__(self, key, value):
if self.type is None:
self.type = type(key)
if type(key) != self.type:
raise TypeError
# e.g 'bat'
first_char = key[:1] # 'b'
others = key[1:] # 'at'
# if hit last character of key
if len(first_char... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(self, key, value):\n\n node = self._get_node(key) # Get the node with the key (if it exists)\n\n if node is None:\n index = self._get_index(key)\n self._buckets[index].add_front(key, value) # Key was not found (add it to the front of the list)\n self.siz... | [
"0.7430001",
"0.7145464",
"0.71036255",
"0.70978844",
"0.7004739",
"0.69816715",
"0.6964943",
"0.6964338",
"0.696078",
"0.686979",
"0.6844193",
"0.6830074",
"0.68191063",
"0.68123823",
"0.68006235",
"0.67746335",
"0.6753683",
"0.67468774",
"0.67124134",
"0.6696639",
"0.666820... | 0.7367367 | 1 |
Return the value for the specified prefix. If the given key is not in the trie, raise a KeyError. If the given key is of the wrong type, raise a TypeError. | def __getitem__(self, key):
if type(key) != self.type:
raise TypeError
first_char = key[:1]
others = key[1:]
if first_char not in self.children:
print("FIRST_CHAR", first_char)
print("self.children", self.children)
raise KeyError
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(self, prefix):\n node = self.root\n for char in prefix:\n if char not in node.keys():\n return None\n node = node[char]\n\n return node",
"def get(self, key):\r\n if not isinstance(key, str):\r\n raise TypeError(\"Key must be a ... | [
"0.65028954",
"0.6178536",
"0.61475515",
"0.6029087",
"0.5981573",
"0.5924109",
"0.5881826",
"0.58788633",
"0.58506775",
"0.5812456",
"0.5808007",
"0.5803161",
"0.57658315",
"0.56860644",
"0.56860644",
"0.5679785",
"0.567018",
"0.5659694",
"0.56588537",
"0.5653402",
"0.565040... | 0.62148166 | 1 |
Given a piece of text as a single string, create a Trie whose keys are the words in the text, and whose values are the number of times the associated word appears in the text | def make_word_trie(text):
trie = Trie()
sentences = tokenize_sentences(text)
for sentence in sentences:
words = sentence.split()
add_freq_trie(words, trie)
return trie | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_phrase_trie(text):\n trie = Trie()\n\n sentences = tokenize_sentences(text)\n tuples = [tuple(sentence.split()) for sentence in sentences]\n\n add_freq_trie(tuples, trie)\n\n return trie",
"def build_trie(text):\n\ttrie = Trie()\n\tnumbers, words = read_file(text)\n\tfor i in range(len(wo... | [
"0.72603476",
"0.68620133",
"0.6780543",
"0.6610787",
"0.65924776",
"0.6590841",
"0.6572384",
"0.6505223",
"0.6489996",
"0.64869916",
"0.6485799",
"0.6436819",
"0.64261985",
"0.64073884",
"0.63924384",
"0.63846225",
"0.63788104",
"0.63670194",
"0.6350208",
"0.63377",
"0.62977... | 0.75299674 | 0 |
Given a piece of text as a single string, create a Trie whose keys are the sentences in the text (as tuples of individual words) and whose values are the number of times the associated sentence appears in the text. | def make_phrase_trie(text):
trie = Trie()
sentences = tokenize_sentences(text)
tuples = [tuple(sentence.split()) for sentence in sentences]
add_freq_trie(tuples, trie)
return trie | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_word_trie(text):\n trie = Trie()\n\n sentences = tokenize_sentences(text)\n\n for sentence in sentences:\n words = sentence.split()\n add_freq_trie(words, trie)\n\n return trie",
"def word_count(phrase):\n return collections.Counter(phrase.split())",
"def build_trie(text):... | [
"0.74071217",
"0.664657",
"0.649828",
"0.64425504",
"0.63978606",
"0.6303166",
"0.6289099",
"0.62707394",
"0.62681466",
"0.6255028",
"0.623129",
"0.6202899",
"0.61852074",
"0.61834705",
"0.61547536",
"0.6101801",
"0.6101782",
"0.60688937",
"0.6060573",
"0.6004803",
"0.5999802... | 0.7635392 | 0 |
Return the list of the mostfrequently occurring elements that start with the given prefix. Include only the top max_count elements if max_count is specified, otherwise return all. Raise a TypeError if the given prefix is of an inappropriate type for the trie. | def autocomplete(trie, prefix, max_count=None):
if type(prefix) != trie.type:
raise TypeError
result = []
if max_count == 0:
return result
if prefix in trie:
result.append((prefix, trie[prefix]))
for i, elt in enumerate(prefix):
if isinstance(prefix, tuple):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autoComplete(prefix, Trie, top):\n\ttemp_node = Trie.search(prefix)\n\tsuggest_list = []\n\tword_list = []\n\tPqueue = PriorityQueue()\n\tfor child in temp_node.children.keys():\n\t\tnode = temp_node.children[child]\n\t\tPqueue.insert((child,node), node.weight)\n\tfor i in range(top):\n\t\tword_list.append(pre... | [
"0.57476366",
"0.5700212",
"0.55830884",
"0.5507561",
"0.54692626",
"0.5456513",
"0.539818",
"0.53828704",
"0.53653115",
"0.5350605",
"0.5345782",
"0.53417176",
"0.5315787",
"0.52896094",
"0.52867097",
"0.5285394",
"0.5264384",
"0.5259577",
"0.52426916",
"0.5212763",
"0.52113... | 0.708108 | 0 |
Check that dimensions are set in header and return True | def check_has_dims(hdr):
try:
return (hdr['startX'], hdr['startY'])
except KeyError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_dimensions(self, workspace_to_check):\n for i in range(self._raw_ws.getNumDims()):\n if self._raw_ws.getDimension(i).getNBins() != workspace_to_check._raw_ws.getDimension(i).getNBins():\n return False\n return True",
"def _check_dimensions(self) -> None:\n dims = (self.y... | [
"0.66215515",
"0.65447414",
"0.65282685",
"0.6517261",
"0.64698523",
"0.6452294",
"0.6431242",
"0.63369185",
"0.63355386",
"0.624769",
"0.62034816",
"0.61909574",
"0.6181983",
"0.6154107",
"0.60746735",
"0.6071028",
"0.606051",
"0.60562056",
"0.60302603",
"0.6026588",
"0.5979... | 0.8026182 | 0 |
Set up dimensions in header in one place so we can easily change it | def set_dims_in_hdr(hdr, startx, starty, cols, rows):
hdr['startX'] = (startx, 'Starting CCD pixel column')
hdr['endX'] = (startx + cols, 'Ending CCD pixel column+1')
hdr['startY'] = (starty, 'Starting CCD pixel row')
hdr['endY'] = (starty + rows, 'Ending CCD pixel row+1') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_dimensions_for_frame(self):\n if not self.h or not self.w:\n (self.h, self.w) = self.frame.shape[:2]",
"def header(self):\n print 'dimensions',self.data.shape\n print 'llcorner', self.xllcorner, self.yllcorner\n print 'cell size', self.cellsize",
"def set_size(sel... | [
"0.64560467",
"0.6388229",
"0.6202352",
"0.61627424",
"0.61625296",
"0.6013623",
"0.5956187",
"0.5949125",
"0.588959",
"0.58506715",
"0.58451533",
"0.582908",
"0.5828663",
"0.58207756",
"0.5794755",
"0.5776514",
"0.5772067",
"0.5768669",
"0.5768049",
"0.5746226",
"0.57460886"... | 0.69880044 | 0 |
Get offsets from database and return truth value if successful | def get_offsets(self, dbcurs):
if self.obsind == 0:
return False
dbcurs.execute("SELECT rowoffset,coloffset FROM obsinf WHERE obsind={:d}".format(self.obsind))
rows = dbcurs.fetchall()
if len(rows) != 1:
warnings.warn("Unknown obsind {:d} in get_offsets".format(s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_offsets(self):\r\n\r\n #### Begin functionality here\r\n\r\n return()",
"def Offset(self) -> int:",
"def Offset(self) -> int:",
"def Offset(self) -> int:",
"def _getoffsets(isMountoffset):\n mplist = list()\n for i in range(23) :\n a = i+1\n mp = device.Carma(a... | [
"0.6453612",
"0.56991845",
"0.56991845",
"0.56991845",
"0.5665536",
"0.5644195",
"0.5534057",
"0.5505202",
"0.5501241",
"0.54907715",
"0.5437832",
"0.54335827",
"0.5384319",
"0.5376516",
"0.52712965",
"0.5246323",
"0.5237893",
"0.52349037",
"0.5154971",
"0.5127712",
"0.512691... | 0.7203021 | 0 |
Set offsets in database | def set_offsets(self, dbcurs, rowoffset, coloffset):
try:
self.rowoffset += rowoffset
self.coloffset += coloffset
except TypeError:
self.rowoffset = rowoffset
self.coloffset = coloffset
dbcurs.execute("UPDATE obsinf SET rowoffset={:.4f},coloffset={... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_offsets(self):\n\n for offset in self.offsets:\n self.db_file.write(struct.pack(\"<I\", offset))",
"def set_offset(self, offset):\n self.offset = offset",
"def set_offset(self, offset):\n self.offset = offset",
"def set_offset(self, offset):\r\n for b in self.buf:... | [
"0.6813555",
"0.65244156",
"0.65244156",
"0.6489408",
"0.6325635",
"0.6325635",
"0.6325635",
"0.6325635",
"0.6268662",
"0.62669045",
"0.61497146",
"0.6045562",
"0.6045562",
"0.6045562",
"0.6028015",
"0.6023278",
"0.5989835",
"0.5932461",
"0.5899893",
"0.58794636",
"0.5838905"... | 0.7481261 | 0 |
Calculate sky level (or recalculate with different value | def calc_skylevel(self, skylevstdp = DEFAULT_SKYLEVELSTD):
if self.data is None or self.skylevstd == skylevstdp:
return
fimagedata = self.data.flatten()
skymask = fimagedata - self.meanval <= skylevstdp * self.stdval
fimagedata = fimagedata[skymask]
if len(fimagedata)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculateUSky(self):\n skyline = []\n for p in self.pruned:\n pastart = [self.drange[0] for i in range(self.dim)]\n pamax = p.getLocationMax()\n pdom = list(self.index.intersection(tuple(pastart+pamax),objects=True))\n if len(pdom) == 1 and pdom[0].obje... | [
"0.5875459",
"0.57996327",
"0.5757148",
"0.57421726",
"0.5703255",
"0.5670127",
"0.55782783",
"0.5566234",
"0.55049795",
"0.5457449",
"0.5418364",
"0.5414675",
"0.54124326",
"0.54110247",
"0.53901476",
"0.5388771",
"0.53877604",
"0.53847855",
"0.5370543",
"0.53638023",
"0.536... | 0.5857981 | 1 |
Get pix offsets field if it exists and adjust | def get_pixoffsets(self, dbcurs):
# print("In get_pixoffsets obsind is ", self.from_obsind, file=sys.stderr)
if dbcurs is None or self.from_obsind == 0 or self.wcs is None:
# print("Aborting pixoffsets", file=sys.stderr)
return self
if self.pixoff is not None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layer_offsets(self):\n ...",
"def pixel_offset(self, x, y):\n return y * self.width + x",
"def roi_y_offset():\n def r(x):\n return x & 0xFFF\n\n def w(x):\n return min(x, 0xFFF)\n return r, w",
"def get_offsets(i):\n x = (i % 3) * (100 + PICTURE_... | [
"0.616975",
"0.6088553",
"0.58255404",
"0.5682758",
"0.56558484",
"0.5540699",
"0.55353326",
"0.5520837",
"0.547344",
"0.5435697",
"0.5412606",
"0.5406133",
"0.53971285",
"0.5356343",
"0.5345178",
"0.53374934",
"0.53186464",
"0.5318213",
"0.5286428",
"0.5286035",
"0.5263692",... | 0.6417464 | 0 |
Load and fill up from obsind | def load_from_obsind(self, dbcurs, obsind):
try:
ffmem = remget.get_obs_fits(dbcurs, obsind)
except remget.RemGetError as e:
raise RemFitsErr(e.args[0])
hdr, data = fitsops.mem_get(ffmem)
if hdr is None or data is None:
raise RemFitsErr("Could not fetc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_iemaccess(obs):\n icursor = IEM.cursor()\n for sid in obs:\n ob = obs[sid]\n iemob = Observation(sid, \"IA_RWIS\", ob['valid'])\n for varname in ['tmpf', 'dwpf', 'drct', 'sknt', 'gust', 'vsby',\n 'pday', 'tsf0', 'tsf1', 'tsf2', 'tsf3', 'scond0',\n ... | [
"0.6071452",
"0.5643542",
"0.54639316",
"0.54413605",
"0.53061116",
"0.530248",
"0.52960014",
"0.5284563",
"0.52474374",
"0.5213094",
"0.52029383",
"0.5201828",
"0.51739895",
"0.5158542",
"0.51445955",
"0.5135886",
"0.51066643",
"0.5096415",
"0.5080148",
"0.5060177",
"0.50400... | 0.75179243 | 0 |
Load and fill up from iforbind | def load_from_iforbind(self, dbcurs, iforbind):
try:
ffmem = remget.get_iforb_fits(dbcurs, iforbind)
except remget.RemGetError as e:
raise RemFitsErr(e.args[0])
hdr, data = fitsops.mem_get(ffmem)
if hdr is None or data is None:
raise RemFitsErr("Could ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _import_bh_(self):",
"def load(self):",
"def load_data(self):",
"def load_data(self) -> None:",
"def onload(self):\n\t\tload_address_and_contact(self)",
"def load(self):\n pass",
"def load(self):\n pass",
"def load(self):\n pass",
"def load(self):\n pass",
"def loa... | [
"0.6427387",
"0.59581035",
"0.59105223",
"0.5891308",
"0.5858824",
"0.58477366",
"0.58477366",
"0.58477366",
"0.58477366",
"0.5708192",
"0.567104",
"0.56639886",
"0.56420785",
"0.56352353",
"0.5608008",
"0.55482864",
"0.55381465",
"0.5521994",
"0.55185765",
"0.54817885",
"0.5... | 0.73830223 | 0 |
Parse a file or ID string given. Should be of given type or don't care May expand this later to load up library files. Currently name is a file name if it isn't numeric, in which case it's supposed to be a FITS file. If it numeric, load from given obsid if type is None or from flat or bias file id if type is 'F' or 'B'... | def parse_filearg(name, dbcurs, typef=None):
fobs = 0
if isinstance(name, int):
try:
if typef is None or typef == 'I':
ffmem = remget.get_obs_fits(dbcurs, name)
fobs = name
elif typef == 'Z':
ffmem = remget.get_saved_fits(dbcurs, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename_type(filename):\n import re\n\n nii_re = re.compile(\".+(nii.gz)$|.+(nii)$\")\n npy_re = re.compile(\".+(npy)$|.+(npz)$\")\n\n\n if len(nii_re.findall(filename)):\n return 'nii'\n elif len(npy_re.findall(filename)):\n return 'npy'\n return None",
"def getTypeFromFileN... | [
"0.58233434",
"0.58141863",
"0.5731429",
"0.5408266",
"0.5365787",
"0.5331441",
"0.52130616",
"0.51932985",
"0.5163812",
"0.5148657",
"0.51243335",
"0.50863683",
"0.50155354",
"0.4994403",
"0.498581",
"0.49854007",
"0.49764878",
"0.49730483",
"0.4951259",
"0.4940682",
"0.4925... | 0.607072 | 0 |
Filter the image to include only yellow and white pixels | def filter_colors(image):
# Filter white pixels
white_threshold = 200
lower_white = np.array([white_threshold, white_threshold, white_threshold])
upper_white = np.array([255, 255, 255])
white_mask = cv2.inRange(image, lower_white, upper_white)
white_image = cv2.bitwise_and(image, image, mask=whi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color_filter(self, image):\n converted = hls_scale(image)\n\n # white color mask\n white_lower_bnd, white_upper_bnd = self.color_filter_params[\"white_bounds\"]\n white_mask = cv2.inRange(converted, white_lower_bnd, white_upper_bnd)\n\n # yellow color mask\n yellow_low... | [
"0.76847804",
"0.7375192",
"0.7259556",
"0.71312225",
"0.7113475",
"0.69528234",
"0.69173133",
"0.68364596",
"0.6796155",
"0.67922866",
"0.6783323",
"0.67643285",
"0.6745479",
"0.6682935",
"0.6654411",
"0.6609564",
"0.65907264",
"0.6586901",
"0.6575922",
"0.6571457",
"0.65653... | 0.7700582 | 0 |
targetMarket { Europe | Asia | South America } | def get_target_market():
return choice(GraphParameters.TARGET_MARKETS) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_for_contracts(self, market=None, buy_sell=None, type_=None, contracts=\"All\"):\n if not contracts:\n contracts = []\n if not type_:\n pass\n elif type_.lower() in ['yes', 'long'] and buy_sell == 'buy':\n type_ = {'long': 'BestBuyYesCost'}\n e... | [
"0.57462746",
"0.56122434",
"0.53708637",
"0.5205027",
"0.51902217",
"0.5009565",
"0.492107",
"0.49086607",
"0.48434213",
"0.48400208",
"0.48024845",
"0.478029",
"0.47573486",
"0.47528923",
"0.47457224",
"0.47294596",
"0.47148532",
"0.471476",
"0.46918187",
"0.4688385",
"0.46... | 0.605438 | 0 |
double in the range of 1 to 350 | def get_price():
return uniform(1.0, 350.0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def approximate(val):\r\n if val >=2 or val == 3:\r\n return 250\r\n elif val >=1:\r\n return 150\r\n elif val >=0:\r\n return 50",
"def sweep50T(self):\n return 35.6",
"def sweep50W(self):\n return 25.9",
"def rad(x) :#en mm!\r\n return topdia(x)/2.0",
"def do... | [
"0.62738985",
"0.6211129",
"0.6177974",
"0.6153779",
"0.6136418",
"0.6136418",
"0.6050506",
"0.6023709",
"0.6017821",
"0.6010199",
"0.5968694",
"0.5917861",
"0.59174",
"0.58664536",
"0.5853007",
"0.5850547",
"0.58496016",
"0.58488184",
"0.5822002",
"0.58215356",
"0.57960254",... | 0.6865591 | 0 |
Return files that start with start_str | def get_files(start_str = "sim_"):
n = len(start_str)
file_list = [f for f in os.listdir(in_path) if f[0:n] == start_str]
return file_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def search_files_starting_with(user_id: UserID, startswith: str = \"\"):",
"def get_filenames_containing(substr, path='.'):\n files = []\n for file_name in os.listdir(path):\n if substr in file_name: files.append(file_name)\n\n return files",
"def startswith(a, prefix, start=0, end=None):... | [
"0.7615643",
"0.6830341",
"0.6474506",
"0.6389351",
"0.6341631",
"0.62231886",
"0.61254793",
"0.6120444",
"0.6091747",
"0.606094",
"0.59563726",
"0.5911721",
"0.5900385",
"0.58944684",
"0.58868766",
"0.586614",
"0.5851371",
"0.5851371",
"0.58499634",
"0.5833049",
"0.5824467",... | 0.8144655 | 0 |
Given a file path to an excel file, load and return an openpyxl readonly workbook object. | def get_workbook(path):
wb = openpyxl.load_workbook(path, read_only=True)
return wb | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_workbook(self, workbook):\n mylog.debug('Opening workbook %s' % workbook)\n workbook = openpyxl.load_workbook(filename = workbook)\n return workbook",
"def open_xlsx_file(filepath, mode=\"rb\"):\n archive = XslxFile(filepath)\n archive.open()\n return archive",
"def _load... | [
"0.7368432",
"0.7060973",
"0.6922139",
"0.6796353",
"0.65540737",
"0.6519225",
"0.62310666",
"0.60859585",
"0.5946056",
"0.58495164",
"0.5846661",
"0.5751223",
"0.56671757",
"0.56429374",
"0.5634577",
"0.56330353",
"0.560512",
"0.55682737",
"0.5515254",
"0.55118674",
"0.55113... | 0.84446806 | 0 |
Test the setting of the target temperature. | async def test_set_only_target_temp(opp):
state = opp.states.get(ENTITY_WATER_HEATER)
assert state.attributes.get("temperature") == 119
await common.async_set_temperature(opp, 110, ENTITY_WATER_HEATER)
state = opp.states.get(ENTITY_WATER_HEATER)
assert state.attributes.get("temperature") == 110 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def target_temperature(self):\n if (self._device.mode == self._device.MODE_HEAT) or (\n self._device.mode == self._device.MODE_HEAT_EMERGENCY):\n return self._device.setpoint_heat\n if self._device.mode == self._device.MODE_COOL:\n return self._device.setpoint_cool\n ... | [
"0.752928",
"0.7521583",
"0.74530584",
"0.7288676",
"0.72487295",
"0.7138381",
"0.7137618",
"0.7123813",
"0.7027435",
"0.700687",
"0.69732",
"0.6971851",
"0.69647145",
"0.69607794",
"0.6916602",
"0.69082516",
"0.68830884",
"0.6873596",
"0.68711144",
"0.68623066",
"0.6850366",... | 0.7560652 | 0 |
Test setting operation mode without required attribute. Also check the state. | async def test_set_operation_bad_attr_and_state(opp):
state = opp.states.get(ENTITY_WATER_HEATER)
assert state.attributes.get("operation_mode") == "eco"
assert state.state == "eco"
with pytest.raises(vol.Invalid):
await common.async_set_operation_mode(opp, None, ENTITY_WATER_HEATER)
state = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_set_operation(opp):\n state = opp.states.get(ENTITY_WATER_HEATER)\n assert state.attributes.get(\"operation_mode\") == \"eco\"\n assert state.state == \"eco\"\n await common.async_set_operation_mode(opp, \"electric\", ENTITY_WATER_HEATER)\n state = opp.states.get(ENTITY_WATER_HEATER)\... | [
"0.7044802",
"0.6830595",
"0.67805827",
"0.672449",
"0.66483605",
"0.6632744",
"0.6616226",
"0.6484543",
"0.6455349",
"0.64516705",
"0.6368438",
"0.6276806",
"0.62333524",
"0.62178135",
"0.62123823",
"0.617815",
"0.6159418",
"0.61503863",
"0.6148324",
"0.6131021",
"0.61238754... | 0.7208718 | 0 |
Test setting the away mode without required attribute. | async def test_set_away_mode_bad_attr(opp):
state = opp.states.get(ENTITY_WATER_HEATER)
assert state.attributes.get("away_mode") == "off"
with pytest.raises(vol.Invalid):
await common.async_set_away_mode(opp, None, ENTITY_WATER_HEATER)
assert state.attributes.get("away_mode") == "off" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_set_away_mode_off(opp):\n await common.async_set_away_mode(opp, False, ENTITY_WATER_HEATER_CELSIUS)\n state = opp.states.get(ENTITY_WATER_HEATER_CELSIUS)\n assert state.attributes.get(\"away_mode\") == \"off\"",
"async def test_set_away_mode_on(opp):\n await common.async_set_away_mode(... | [
"0.7378384",
"0.713406",
"0.64238816",
"0.62875086",
"0.6212701",
"0.61619836",
"0.6124875",
"0.59361404",
"0.5883761",
"0.5818602",
"0.57394147",
"0.5729822",
"0.57261974",
"0.5719309",
"0.57163227",
"0.5715907",
"0.56904936",
"0.5661714",
"0.5616527",
"0.56012005",
"0.55724... | 0.7482605 | 0 |
Test setting the away mode on/true. | async def test_set_away_mode_on(opp):
await common.async_set_away_mode(opp, True, ENTITY_WATER_HEATER)
state = opp.states.get(ENTITY_WATER_HEATER)
assert state.attributes.get("away_mode") == "on" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_set_away_mode_off(opp):\n await common.async_set_away_mode(opp, False, ENTITY_WATER_HEATER_CELSIUS)\n state = opp.states.get(ENTITY_WATER_HEATER_CELSIUS)\n assert state.attributes.get(\"away_mode\") == \"off\"",
"def is_away_mode_on(self):\n return self._away",
"def turn_away_mod... | [
"0.7670136",
"0.7290108",
"0.7080147",
"0.6730108",
"0.6638462",
"0.6435057",
"0.62459266",
"0.6187724",
"0.6054229",
"0.6043155",
"0.6014375",
"0.5969935",
"0.5905401",
"0.5894503",
"0.5867881",
"0.58605886",
"0.5832053",
"0.5816296",
"0.5755829",
"0.5748471",
"0.5742686",
... | 0.7855596 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.