query stringlengths 9 3.4k | document stringlengths 9 87.4k | metadata dict | negatives listlengths 4 101 | negative_scores listlengths 4 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
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 |
Return a list of all Study ids that haven't been assigned | def all_study_units_are_expired(self, run_id: str) -> bool:
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
SELECT
prolific_study_id,
(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_session_researcher_study_ids():\n session_researcher = get_session_researcher()\n if session_researcher.site_admin:\n return Study.objects.exclude(deleted=True).values_list(\"id\", flat=True)\n else:\n return session_researcher.study_relations.filter(study__deleted=False).values_list... | [
"0.6454149",
"0.6444848",
"0.6333486",
"0.62218195",
"0.6143825",
"0.6143825",
"0.61307997",
"0.6123434",
"0.60071385",
"0.5901537",
"0.5894555",
"0.58698386",
"0.5823938",
"0.5797013",
"0.5772415",
"0.57390946",
"0.56945443",
"0.56108934",
"0.5606942",
"0.5575845",
"0.557239... | 0.0 | -1 |
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 |
Set prolific_submission_id to unit | def update_submission_status(self, prolific_submission_id: str, status: str) -> None:
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
UPDATE submissions
SET status = ?
... | {
"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.84948945",
"0.6595971",
"0.51455045",
"0.5121183",
"0.50757414",
"0.50332946",
"0.5005706",
"0.5004454",
"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.49610958 | 8 |
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 |
Set the worker registration status for the given id | def set_worker_blocked(self, worker_id: str, is_blocked: bool) -> None:
self.ensure_worker_exists(worker_id)
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
UPDATE workers
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_registration_status(self, worker_id, should_register):\n if worker_id in self.allowed_workers:\n old_status = self.registered_workers[worker_id]\n self.registered_workers[worker_id] = should_register\n logger.info(f\"Set registration status of worker {worker_id[0:WID... | [
"0.79909754",
"0.62713885",
"0.6258352",
"0.6087233",
"0.57829565",
"0.57449967",
"0.5653489",
"0.56338775",
"0.55972093",
"0.55965084",
"0.55159026",
"0.5503975",
"0.548404",
"0.54464734",
"0.5432146",
"0.5413118",
"0.5410036",
"0.54039466",
"0.53984016",
"0.53779984",
"0.53... | 0.5647061 | 7 |
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 |
Create a record of this unit if it doesn't exist | def ensure_unit_exists(self, unit_id: str) -> None:
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
INSERT OR IGNORE INTO units(
unit_id,
is_expired
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createRecord(self):\n self.dto.getRecord().append(self.controller.createNewObj())\n print(\"Record added.\")",
"def test_create_record(self):\n pass",
"def add_record(self):\n if not self.record_exists(self.args.date):\n record = self.create_record()\n self... | [
"0.7086831",
"0.6990787",
"0.6762641",
"0.6582792",
"0.6427116",
"0.6390672",
"0.6368703",
"0.6356187",
"0.63006824",
"0.62348944",
"0.62128866",
"0.619893",
"0.61860865",
"0.61670524",
"0.60990256",
"0.6094986",
"0.6094899",
"0.6094152",
"0.60919774",
"0.60918665",
"0.604524... | 0.5960463 | 24 |
Create the unit if not exists | def create_unit(self, unit_id: str, run_id: str, prolific_study_id: str) -> None:
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
INSERT OR IGNORE INTO units(
unit_id,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createUnit(self):\n return _libsbml.UnitDefinition_createUnit(self)",
"def createUnit(self):\n return _libsbml.Model_createUnit(self)",
"def create_unit(name, plant_id):\n Sections.create(name=name, plant=plant_id)",
"def ensure_unit_exists(self, unit_id: str) -> None:\n with self... | [
"0.7306589",
"0.71179485",
"0.67669463",
"0.65930665",
"0.65759665",
"0.65477175",
"0.6546976",
"0.64826787",
"0.6463603",
"0.6438598",
"0.63988566",
"0.6362815",
"0.62750703",
"0.6139748",
"0.6108293",
"0.6108293",
"0.6097144",
"0.5927816",
"0.5919518",
"0.5906751",
"0.58602... | 0.7035503 | 2 |
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 the unit registration status for the given id | def set_unit_expired(self, unit_id: str, val: bool) -> None:
self.ensure_unit_exists(unit_id)
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
UPDATE units
SET is_expired =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id_status(self, id_status):\n self._id_status = id_status",
"def put(self, id):\n taskroom_service.change_status(id)\n return {'Message': \"Room status changed to Active\"}",
"def set_regID():\n if not request.json or not 'regID' in request.json or not 'id' in request.json:\n ... | [
"0.6670236",
"0.63974583",
"0.633151",
"0.60555094",
"0.6013461",
"0.59959716",
"0.5918504",
"0.5900751",
"0.58813363",
"0.58021015",
"0.5790714",
"0.570609",
"0.570609",
"0.570609",
"0.5679153",
"0.5608987",
"0.5583656",
"0.5543158",
"0.5529352",
"0.552584",
"0.55072576",
... | 0.5468101 | 24 |
Get the registration status of a unit | def get_unit_expired(self, unit_id: str) -> bool:
self.ensure_unit_exists(unit_id)
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
SELECT is_expired FROM units
WHERE unit_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_status(self):\n return self.o.read_register(self.dev_id, STATUS)",
"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['s... | [
"0.72656596",
"0.6550796",
"0.6522714",
"0.64303976",
"0.6371247",
"0.62488407",
"0.61745566",
"0.5981724",
"0.58415234",
"0.5822779",
"0.58129257",
"0.58096516",
"0.57300603",
"0.57300603",
"0.57300603",
"0.56982297",
"0.569656",
"0.5668386",
"0.56584847",
"0.5655873",
"0.56... | 0.0 | -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 |
Get the mapping between Mephisto IDs and Prolific IDs | def get_study_mapping(self, unit_id: str) -> sqlite3.Row:
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
SELECT * from studies
INNER JOIN units USING (prolific_study_id)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remap_ids(self, id_map: Dict[int, int]) -> None:",
"def getIDs():",
"def get_mapu_kanala_ID_OPIS(self):\n out = {}\n for kanal in self.sviKanali:\n out[kanal] = self.get_datastore(kanal).koncentracija.opis\n return out",
"def create_mapping(dico):\n sorted_items = sorte... | [
"0.6552736",
"0.630242",
"0.6080861",
"0.60486937",
"0.6040611",
"0.59884197",
"0.5976189",
"0.5959781",
"0.594266",
"0.5851321",
"0.5849264",
"0.5833056",
"0.5831788",
"0.5803768",
"0.57932824",
"0.578533",
"0.57830715",
"0.5774288",
"0.57427245",
"0.5725264",
"0.56904197",
... | 0.0 | -1 |
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 |
Get the details for a run by task_run_id | def get_run(self, run_id: str) -> sqlite3.Row:
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
SELECT * from runs
WHERE run_id = ?;
""",
(run_id,),... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_task_run(self, task_run_id: str) -> Mapping[str, Any]:\n return self.__get_one_by_id(\"task_runs\", \"task_run_id\", task_run_id)",
"def get_details():\r\n return run_operations.get_run_details(experiment_name, job_name).as_dict(key_transformer=camel_case_transformer)",
"def get_run(self,... | [
"0.78402853",
"0.73396486",
"0.7197559",
"0.71541476",
"0.7136179",
"0.6710005",
"0.66520286",
"0.66173077",
"0.66023135",
"0.6541713",
"0.6485751",
"0.6459823",
"0.6415365",
"0.6343352",
"0.6341125",
"0.6339494",
"0.6326412",
"0.6315491",
"0.63102996",
"0.62944686",
"0.62834... | 0.6621382 | 7 |
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 |
Set up Cast from a config entry. | async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
hass.data.setdefault(ADDED_CAST_DEVICES_KEY, set())
# Import CEC IGNORE attributes
pychromecast.IGNORE_CEC += config_entry.data.get(CONF_IGNORE_CEC) or []
wanted... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_configuring_cast_creates_entry(hass):\n with patch(\n \"homeassistant.components.cast.async_setup_entry\", return_value=True\n ) as mock_setup:\n await async_setup_component(\n hass, cast.DOMAIN, {\"cast\": {\"some_config\": \"to_trigger_import\"}}\n )\n ... | [
"0.57426476",
"0.5515318",
"0.55044806",
"0.55044806",
"0.53676444",
"0.5248672",
"0.52388155",
"0.5217007",
"0.5185764",
"0.5172132",
"0.5169365",
"0.50592446",
"0.50574386",
"0.5053969",
"0.5043232",
"0.5036413",
"0.48840928",
"0.48764646",
"0.4848324",
"0.48393616",
"0.483... | 0.5236902 | 7 |
Handle discovery of a new chromecast. | def async_cast_discovered(discover: ChromecastInfo) -> None:
# If wanted_uuids is set, we're only accepting specific cast devices identified
# by UUID
if wanted_uuids is not None and str(discover.uuid) not in wanted_uuids:
# UUID not matching, ignore.
return
cast... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callback(chromecast):\n nonlocal cast\n cast = chromecast\n stop_discovery()",
"async def _async_cast_discovered(self, discover: ChromecastInfo) -> None:\n if self._cast_info.uuid != discover.uuid:\n # Discovered is not our device.\n return\n\n _LOGGER... | [
"0.70507926",
"0.6643879",
"0.642027",
"0.5778268",
"0.57366985",
"0.56774855",
"0.56142837",
"0.5604735",
"0.55767864",
"0.5571721",
"0.5568575",
"0.5554293",
"0.54729825",
"0.54455876",
"0.5430549",
"0.5408368",
"0.5365755",
"0.536241",
"0.5349412",
"0.5315284",
"0.5285585"... | 0.6570289 | 2 |
Initialize the cast device. | def __init__(self, hass: HomeAssistant, cast_info: ChromecastInfo) -> None:
self.hass: HomeAssistant = hass
self._cast_info = cast_info
self._chromecast: pychromecast.Chromecast | None = None
self.mz_mgr = None
self._status_listener: CastStatusListener | None = None
self... | {
"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.7168737",
"0.6741863",
"0.63210136",
"0.63021034",
"0.62491494",
"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.584817... | 0.61908686 | 5 |
Disconnect chromecast object and remove listeners. | async def _async_tear_down(self) -> None:
await self._async_disconnect()
if self._cast_info.uuid is not None:
# Remove the entity from the added casts so that it can dynamically
# be re-added again.
self.hass.data[ADDED_CAST_DEVICES_KEY].remove(self._cast_info.uuid)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _async_cast_removed(self, discover: ChromecastInfo) -> None:",
"async def _async_disconnect(self) -> None:\n if self._chromecast is not None:\n _LOGGER.debug(\n \"[%s %s] Disconnecting from chromecast socket\",\n self._name,\n self._cast_in... | [
"0.726086",
"0.70782745",
"0.68871486",
"0.68298405",
"0.6604598",
"0.6604598",
"0.6604598",
"0.6604598",
"0.6604598",
"0.6600354",
"0.65323234",
"0.6492888",
"0.64758503",
"0.64548",
"0.6441718",
"0.6429932",
"0.6429932",
"0.6425715",
"0.6396502",
"0.63873357",
"0.6368317",
... | 0.606931 | 51 |
Set up the chromecast object. | async def _async_connect_to_chromecast(self):
_LOGGER.debug(
"[%s %s] Connecting to cast device by service %s",
self._name,
self._cast_info.friendly_name,
self._cast_info.cast_info.services,
)
chromecast = await self.hass.async_add_executor_job(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, hass: HomeAssistant, cast_info: ChromecastInfo) -> None:\n\n self.hass: HomeAssistant = hass\n self._cast_info = cast_info\n self._chromecast: pychromecast.Chromecast | None = None\n self.mz_mgr = None\n self._status_listener: CastStatusListener | None = None\n... | [
"0.68022525",
"0.66077197",
"0.65360945",
"0.60279393",
"0.58198494",
"0.5797397",
"0.5783655",
"0.5783655",
"0.5783655",
"0.5783655",
"0.5783655",
"0.57651716",
"0.57651067",
"0.57651067",
"0.57651067",
"0.5762261",
"0.5690006",
"0.56882566",
"0.5665725",
"0.565241",
"0.5598... | 0.63452876 | 3 |
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 discovery of new Chromecast. | async def _async_cast_discovered(self, discover: ChromecastInfo) -> None:
if self._cast_info.uuid != discover.uuid:
# Discovered is not our device.
return
_LOGGER.debug("Discovered chromecast with same UUID: %s", discover)
self._cast_info = discover | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callback(chromecast):\n nonlocal cast\n cast = chromecast\n stop_discovery()",
"def async_cast_discovered(discover: ChromecastInfo) -> None:\n # If wanted_uuids is set, we're only accepting specific cast devices identified\n # by UUID\n if wanted_uuids is not None an... | [
"0.7017369",
"0.6618294",
"0.63960236",
"0.5651678",
"0.56457293",
"0.5578931",
"0.5569607",
"0.555856",
"0.5554548",
"0.55463326",
"0.5505148",
"0.5478756",
"0.5453695",
"0.5429927",
"0.53747714",
"0.5358726",
"0.5338202",
"0.531548",
"0.5310042",
"0.5224677",
"0.52061814",
... | 0.64803517 | 2 |
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 |
Disconnect socket on Home Assistant stop. | async def _async_stop(self, event: Event) -> None:
await self._async_disconnect() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disconnect_socket(self):\n self.running = False\n\n if self.socket is not None:\n self.socket.close()\n\n self.current_host_and_port = None\n self.socket = None\n self.notify('disconnected')",
"def disconnect(self):\n self.stop()\n self._send_comman... | [
"0.75278884",
"0.73955864",
"0.7211463",
"0.7094535",
"0.7076806",
"0.70740265",
"0.6969385",
"0.69239765",
"0.69168574",
"0.6857451",
"0.6849297",
"0.6836871",
"0.6826481",
"0.68250024",
"0.68077236",
"0.68030477",
"0.67857516",
"0.67667514",
"0.67649275",
"0.6714153",
"0.66... | 0.0 | -1 |
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 |
Create chromecast object when added to hass. | async def async_added_to_hass(self) -> None:
self._async_setup(self.entity_id)
self._cast_view_remove_handler = async_dispatcher_connect(
self.hass, SIGNAL_HASS_CAST_SHOW_VIEW, self._handle_signal_show_view
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, hass: HomeAssistant, cast_info: ChromecastInfo) -> None:\n\n self.hass: HomeAssistant = hass\n self._cast_info = cast_info\n self._chromecast: pychromecast.Chromecast | None = None\n self.mz_mgr = None\n self._status_listener: CastStatusListener | None = None\n... | [
"0.6795747",
"0.651962",
"0.6398362",
"0.59707934",
"0.5692629",
"0.55262727",
"0.5456038",
"0.53728783",
"0.5352344",
"0.5304969",
"0.5282749",
"0.52763295",
"0.52495605",
"0.5244513",
"0.5225055",
"0.5198949",
"0.5143185",
"0.5143185",
"0.5133531",
"0.51014924",
"0.50981456... | 0.53003645 | 10 |
Disconnect Chromecast object when removed. | async def async_will_remove_from_hass(self) -> None:
await self._async_tear_down()
if self._cast_view_remove_handler:
self._cast_view_remove_handler()
self._cast_view_remove_handler = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _async_cast_removed(self, discover: ChromecastInfo) -> None:",
"async def _async_disconnect(self) -> None:\n if self._chromecast is not None:\n _LOGGER.debug(\n \"[%s %s] Disconnecting from chromecast socket\",\n self._name,\n self._cast_in... | [
"0.7588259",
"0.6971904",
"0.6935188",
"0.67419606",
"0.6711672",
"0.66974294",
"0.6695874",
"0.6672613",
"0.6672613",
"0.6672613",
"0.6672613",
"0.6672613",
"0.66239434",
"0.6524613",
"0.6524613",
"0.651358",
"0.6467619",
"0.6439215",
"0.6410492",
"0.63836294",
"0.63836294",... | 0.6008682 | 68 |
Set up the chromecast object. | async def _async_connect_to_chromecast(self):
await super()._async_connect_to_chromecast()
self._attr_available = False
self.cast_status = self._chromecast.status
self.media_status = self._chromecast.media_controller.status
self.async_write_ha_state() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, hass: HomeAssistant, cast_info: ChromecastInfo) -> None:\n\n self.hass: HomeAssistant = hass\n self._cast_info = cast_info\n self._chromecast: pychromecast.Chromecast | None = None\n self.mz_mgr = None\n self._status_listener: CastStatusListener | None = None\n... | [
"0.68022525",
"0.66077197",
"0.63452876",
"0.60279393",
"0.58198494",
"0.5797397",
"0.5783655",
"0.5783655",
"0.5783655",
"0.5783655",
"0.5783655",
"0.57651716",
"0.57651067",
"0.57651067",
"0.57651067",
"0.5762261",
"0.5690006",
"0.56882566",
"0.5665725",
"0.565241",
"0.5598... | 0.65360945 | 2 |
Disconnect Chromecast object if it is set. | async def _async_disconnect(self):
await super()._async_disconnect()
self._attr_available = False
self.async_write_ha_state() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _async_disconnect(self) -> None:\n if self._chromecast is not None:\n _LOGGER.debug(\n \"[%s %s] Disconnecting from chromecast socket\",\n self._name,\n self._cast_info.friendly_name,\n )\n await self.hass.async_add_exec... | [
"0.6942088",
"0.67750245",
"0.67714936",
"0.6768947",
"0.6743295",
"0.6643703",
"0.6628267",
"0.65809673",
"0.65623957",
"0.63859135",
"0.63859135",
"0.63859135",
"0.63859135",
"0.63859135",
"0.63566136",
"0.63083696",
"0.62916493",
"0.6285491",
"0.62793493",
"0.6275437",
"0.... | 0.0 | -1 |
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 updates of the media status. | def new_media_status(self, media_status):
if (
media_status
and media_status.player_is_idle
and media_status.idle_reason == "ERROR"
):
external_url = None
internal_url = None
url_description = ""
with suppress(NoURLAvail... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateStatus(self, status):\n pass",
"def playstatus_update(self, updater, playstatus: interface.Playing) -> None:\n if updater == self.main_instance:\n self.listener.playstatus_update(updater, playstatus)",
"def media_status_changed(self, state):\n if state == self.MediaSta... | [
"0.6742964",
"0.6726203",
"0.65986353",
"0.65755445",
"0.65243185",
"0.6442791",
"0.6382588",
"0.63283056",
"0.6290578",
"0.6289228",
"0.6276831",
"0.6235868",
"0.6165307",
"0.6162364",
"0.6149619",
"0.6149032",
"0.61389214",
"0.60909885",
"0.60569155",
"0.60397846",
"0.60269... | 0.6285906 | 10 |
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 connection status. | def new_connection_status(self, connection_status):
_LOGGER.debug(
"[%s %s] Received cast device connection status: %s",
self.entity_id,
self._cast_info.friendly_name,
connection_status.status,
)
if connection_status.status == CONNECTION_STATUS_DIS... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def or_conn_status_event(self, event):\r\n pass",
"def update_status(self) -> None:\n try:\n (rc, mid) = self.mqttc.publish(\n self.config.status_topic, json.dumps(self.status), qos=0, retain=False\n )\n if rc == mqtt.MQTT_ERR_SUCCESS:\n lo... | [
"0.74098265",
"0.6911204",
"0.6828653",
"0.68249065",
"0.68130803",
"0.6795053",
"0.67641443",
"0.672548",
"0.6715491",
"0.66279614",
"0.65838975",
"0.65659356",
"0.6531838",
"0.6521918",
"0.64921737",
"0.6485405",
"0.64427745",
"0.6399266",
"0.63824695",
"0.6373966",
"0.6372... | 0.6552256 | 12 |
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 |
Set volume level, range 0..1. | def set_volume_level(self, volume: float) -> None:
self._get_chromecast().set_volume(volume) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_volume_level(self, level):\n self._remote.volume(int(level * 60))",
"def set_volume_level(self, volume):\n targetVolume = volume * 100\n tempVolume = -1\n oldVolume = -2\n i = 0\n while int(targetVolume) != tempVolume:\n self.getVolume()\n t... | [
"0.84339803",
"0.8411518",
"0.84037226",
"0.8316456",
"0.82855743",
"0.82789934",
"0.82789934",
"0.8202789",
"0.81447035",
"0.7977751",
"0.78011876",
"0.777941",
"0.7766126",
"0.77488804",
"0.77103066",
"0.7688502",
"0.76654124",
"0.7562445",
"0.7531979",
"0.7451874",
"0.7416... | 0.80928236 | 9 |
Send previous track command. | def media_previous_track(self) -> None:
media_controller = self._media_controller()
media_controller.queue_prev() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_previous_track(self):\n self.handleCommand(28)",
"async def async_media_previous_track(self):\n await self.local_meural.send_key_left()",
"def media_previous_track(self) -> None:\n self._client.previous()",
"async def async_media_previous_track(self):\n if not self._slav... | [
"0.8092019",
"0.74628145",
"0.7435734",
"0.7415618",
"0.72916883",
"0.7219398",
"0.7088063",
"0.70658785",
"0.7058713",
"0.6946349",
"0.6940159",
"0.69380057",
"0.6814207",
"0.6692861",
"0.6575371",
"0.647438",
"0.64089364",
"0.6402175",
"0.63623196",
"0.63175184",
"0.6303627... | 0.68864435 | 12 |
Send next track command. | def media_next_track(self) -> None:
media_controller = self._media_controller()
media_controller.queue_next() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_next_track(self):\n self.handleCommand(27)",
"async def async_media_next_track(self):\n await self.local_meural.send_key_right()",
"async def async_media_next_track(self):\n if not self._slave_mode:\n if not self._playing_mass:\n value = await self.async... | [
"0.7637162",
"0.7182371",
"0.70682955",
"0.702577",
"0.6938868",
"0.67904484",
"0.6690678",
"0.6585864",
"0.65156054",
"0.65102154",
"0.64364403",
"0.6425959",
"0.64236045",
"0.6293694",
"0.6283255",
"0.6136297",
"0.6132041",
"0.6075108",
"0.6062888",
"0.59918654",
"0.5976866... | 0.6454176 | 10 |
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 |
Implement the websocket media browsing helper. | async def async_browse_media(
self,
media_content_type: MediaType | str | None = None,
media_content_id: str | None = None,
) -> BrowseMedia:
content_filter = None
chromecast = self._get_chromecast()
if chromecast.cast_type in (
pychromecast.const.CAST_TY... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_browse_media(self, media_content_type=None, media_content_id=None):\n return await media_source.async_browse_media(\n self.hass,\n media_content_id,\n content_filter=lambda item: item.media_content_type.startswith(\"audio/\"),\n )\n \n #T... | [
"0.6181486",
"0.60884196",
"0.57196105",
"0.56168514",
"0.56148845",
"0.5579672",
"0.5570966",
"0.5565296",
"0.5550286",
"0.5491944",
"0.54771876",
"0.5473839",
"0.5432358",
"0.54322875",
"0.54314613",
"0.54255307",
"0.5401825",
"0.53617084",
"0.53582746",
"0.5348662",
"0.534... | 0.54858005 | 10 |
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 |
Play a piece of media. | async def async_play_media(
self, media_type: MediaType | str, media_id: str, **kwargs: Any
) -> None:
chromecast = self._get_chromecast()
# Handle media_source
if media_source.is_media_source_id(media_id):
sourced_media = await media_source.async_resolve_media(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_media(self, item):\n self.play_media_event.clear()\n\n def app_launched_callback():\n try:\n self._send_start_play(item)\n finally:\n self.play_media_event.set()\n\n self.launch(app_launched_callback)",
... | [
"0.74703515",
"0.7438672",
"0.7334398",
"0.7258395",
"0.7258395",
"0.7158237",
"0.7022538",
"0.6983107",
"0.6957763",
"0.6952672",
"0.6919386",
"0.6918971",
"0.6903651",
"0.6898043",
"0.68916637",
"0.6891414",
"0.68797326",
"0.68668735",
"0.6859486",
"0.6804932",
"0.6784407",... | 0.6348962 | 55 |
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 |
Return the state of the player. | def state(self) -> MediaPlayerState | None:
# The lovelace app loops media to prevent timing out, don't show that
if self.app_id == CAST_APP_ID_HOMEASSISTANT_LOVELACE:
return MediaPlayerState.PLAYING
if (media_status := self._media_status()[0]) is not None:
if media_statu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_game_state(self):\n return self._game_status",
"def get_game_state(self):\n return self.game_state",
"def state(self):\n _LOGGER.debug(\"Fetching player info\")\n parameters = {\n 'cmd': None,\n 'param3': 'state.json'\n }\n try:\n ... | [
"0.7583462",
"0.756802",
"0.7543552",
"0.75415736",
"0.7536169",
"0.7522141",
"0.742209",
"0.7352196",
"0.7352196",
"0.7352196",
"0.73381597",
"0.73015076",
"0.7183252",
"0.7153982",
"0.7130984",
"0.7124311",
"0.7120706",
"0.7120706",
"0.71022075",
"0.7086856",
"0.706692",
... | 0.66679853 | 36 |
Content ID of current playing media. | def media_content_id(self) -> str | None:
# The lovelace app loops media to prevent timing out, don't show that
if self.app_id == CAST_APP_ID_HOMEASSISTANT_LOVELACE:
return None
media_status = self._media_status()[0]
return media_status.content_id if media_status else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_content_id(self):\n return self._table.active_track.id if self._table.active_track else None",
"def media_content_id(self):\n return int(self._gallery_status[\"current_item\"])",
"def media_content_id(self):\n if 'current_title' in self._status:\n return self._status['... | [
"0.8469944",
"0.8446367",
"0.8336503",
"0.8202288",
"0.8169501",
"0.8081819",
"0.7428515",
"0.7059652",
"0.70465815",
"0.68984956",
"0.68023974",
"0.6616323",
"0.65227073",
"0.6512088",
"0.6499212",
"0.64817256",
"0.64417475",
"0.6400335",
"0.63498986",
"0.633553",
"0.6307248... | 0.8155318 | 5 |
Content type of current playing media. | def media_content_type(self) -> MediaType | None:
# The lovelace app loops media to prevent timing out, don't show that
if self.app_id == CAST_APP_ID_HOMEASSISTANT_LOVELACE:
return None
if (media_status := self._media_status()[0]) is None:
return None
if media_sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_content_type(self):\n return MEDIA_TYPE_MUSIC\n # return MEDIA_TYPE_PLAYLIST",
"def media_type(self):\n return self._media_type",
"def media_content_type(self):\n return MEDIA_TYPE_TRACK",
"def media_type(self) -> str:\n return self._media_type",
"def media_cont... | [
"0.8311132",
"0.8290567",
"0.8233439",
"0.8161561",
"0.81602204",
"0.8086385",
"0.8086385",
"0.8086385",
"0.8086385",
"0.78326094",
"0.76318944",
"0.75628746",
"0.752301",
"0.74374634",
"0.73373",
"0.7319092",
"0.72411025",
"0.7153245",
"0.7136072",
"0.7132977",
"0.70570654",... | 0.7887449 | 9 |
Duration of current playing media in seconds. | def media_duration(self):
# The lovelace app loops media to prevent timing out, don't show that
if self.app_id == CAST_APP_ID_HOMEASSISTANT_LOVELACE:
return None
media_status = self._media_status()[0]
return media_status.duration if media_status else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_duration(self):\n return self._table.active_track_total_time.total_seconds()",
"def media_duration(self):\n if (self._playing_localfile or self._playing_spotify or self._slave_mode or self._playing_mediabrowser or self._playing_mass) and self._state != STATE_UNAVAILABLE:\n retu... | [
"0.84306645",
"0.8335323",
"0.83195865",
"0.82777256",
"0.82241994",
"0.822305",
"0.7930684",
"0.7795198",
"0.7728614",
"0.76679045",
"0.7623727",
"0.7617457",
"0.751701",
"0.75141466",
"0.74585915",
"0.7447879",
"0.7447879",
"0.7447879",
"0.7447879",
"0.7447879",
"0.7447879"... | 0.8074582 | 6 |
Image url of current playing media. | def media_image_url(self):
if (media_status := self._media_status()[0]) is None:
return None
images = media_status.images
return images[0].url if images and images[0].url else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_image_url(self):\n return self.coordinator.data.nowplaying[self.zone.SourceID].CurrSong.ArtworkURI",
"def media_image_url(self):\n return self._current_item[\"image\"]",
"def media_image_url(self):\n if 'artwork_url' in self._status:\n return self._status['artwork_url'... | [
"0.867188",
"0.84251887",
"0.8359959",
"0.81295615",
"0.81295615",
"0.80607474",
"0.7994721",
"0.7990284",
"0.76695895",
"0.7531818",
"0.7309936",
"0.7299671",
"0.7188117",
"0.71804154",
"0.6959507",
"0.68543184",
"0.6851798",
"0.6851798",
"0.6851798",
"0.6833539",
"0.6818468... | 0.7846611 | 8 |
Title of current playing media. | def media_title(self):
media_status = self._media_status()[0]
return media_status.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 return self._current_item[\"name\"]",
"def media_title(self):\n return self._state.get(\"title\", None)",
"def media_title(self):\n return self._table.ac... | [
"0.88792616",
"0.8689035",
"0.8642133",
"0.86320454",
"0.85142714",
"0.8476299",
"0.8476299",
"0.83830446",
"0.83587724",
"0.8324616",
"0.8310011",
"0.82281244",
"0.77658695",
"0.74199045",
"0.73976636",
"0.73755074",
"0.73328793",
"0.73328793",
"0.73328793",
"0.7325411",
"0.... | 0.8303326 | 11 |
Artist of current playing media (Music track only). | def media_artist(self):
media_status = self._media_status()[0]
return media_status.artist if media_status else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_artist(self):\n return self._state.get(\"artist\", None)",
"def media_artist(self):\n return self.coordinator.data.nowplaying[self.zone.SourceID].CurrSong.Artists",
"def media_artist(self):\n return self._media_artist",
"def media_artist(self):\n return self._media_artis... | [
"0.86874646",
"0.85988027",
"0.8364579",
"0.8364579",
"0.8197227",
"0.81845474",
"0.7796168",
"0.7759904",
"0.7709477",
"0.7638341",
"0.76134145",
"0.7604214",
"0.7216594",
"0.70622",
"0.69644237",
"0.664528",
"0.6623426",
"0.6593583",
"0.6548443",
"0.6520028",
"0.6481482",
... | 0.85100645 | 2 |
Album of current playing media (Music track only). | def media_album_name(self):
media_status = self._media_status()[0]
return media_status.album_name if media_status else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_album(self):\n return self._album",
"def media_album_name(self):\n return self.coordinator.data.nowplaying[self.zone.SourceID].CurrSong.Album",
"def album(self):\n return self.getItunesAttribute('Album')",
"def media_album_name(self):\n return self._state.get(\"album\", No... | [
"0.7671635",
"0.7645431",
"0.7637018",
"0.7588155",
"0.72787106",
"0.72354585",
"0.7171956",
"0.7156467",
"0.6837829",
"0.67194325",
"0.6612572",
"0.63955945",
"0.6327327",
"0.6285476",
"0.6280426",
"0.6262964",
"0.62237495",
"0.62210184",
"0.6190238",
"0.61882347",
"0.618101... | 0.73978055 | 4 |
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 |
Return the ID of the current running app. | def app_id(self):
return self._chromecast.app_id if self._chromecast else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"app_id\")",
"def app_id(self):\n return self._app_id or self._modules['default'].data.get('application')",
"def app_id(self) -> str:\n return self._app_id",
"def app_id(self):\n return self._app_id",
"def _app_id(se... | [
"0.8442557",
"0.8342832",
"0.82977986",
"0.8232073",
"0.81074524",
"0.795353",
"0.7906809",
"0.78383684",
"0.7749066",
"0.75982785",
"0.7358892",
"0.7351538",
"0.7341497",
"0.733545",
"0.7247695",
"0.7229026",
"0.72017395",
"0.72017395",
"0.72017395",
"0.7183651",
"0.7108857"... | 0.7482726 | 10 |
Name of the current running app. | def app_name(self):
return self._chromecast.app_display_name if self._chromecast else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_name(self) -> str:\n return self._app_name",
"def app_name(self):\n return self._app_name",
"def app_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"app_name\")",
"def get_name():\n return config.APP_NAME",
"def app_name(self): # pylint:disable=funct... | [
"0.8613469",
"0.8589207",
"0.84504217",
"0.83667713",
"0.8312501",
"0.82835007",
"0.8204041",
"0.8153177",
"0.8153177",
"0.8016665",
"0.8007741",
"0.79585636",
"0.7892773",
"0.7882123",
"0.78177106",
"0.77182496",
"0.77128357",
"0.7517927",
"0.74986947",
"0.74986947",
"0.7498... | 0.729358 | 27 |
Flag media player features that are supported. | def supported_features(self) -> MediaPlayerEntityFeature:
support = (
MediaPlayerEntityFeature.PLAY_MEDIA
| MediaPlayerEntityFeature.TURN_OFF
| MediaPlayerEntityFeature.TURN_ON
)
media_status = self._media_status()[0]
if (
self.cast_status... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supported_features(self):\n return (\n mp.const.MediaPlayerEntityFeature.VOLUME_SET\n | mp.const.MediaPlayerEntityFeature.VOLUME_STEP\n | mp.const.MediaPlayerEntityFeature.PLAY\n | mp.const.MediaPlayerEntityFeature.PAUSE\n | mp.const.MediaPlayerEnti... | [
"0.79153985",
"0.79153985",
"0.747558",
"0.7467005",
"0.73278534",
"0.69504905",
"0.69504905",
"0.69504905",
"0.69504905",
"0.6785351",
"0.6785351",
"0.6785351",
"0.6785351",
"0.6685246",
"0.66086596",
"0.6521567",
"0.63074136",
"0.6302592",
"0.6255658",
"0.62156665",
"0.6203... | 0.7778749 | 2 |
Position of current playing media in seconds. | def media_position(self):
# The lovelace app loops media to prevent timing out, don't show that
if self.app_id == CAST_APP_ID_HOMEASSISTANT_LOVELACE:
return None
media_status = self._media_status()[0]
if media_status is None or not (
media_status.player_is_playing... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_position(self):\n return (\n self._table.active_track_total_time\n - self._table.active_track_remaining_time\n ).total_seconds()",
"def media_position(self):\n if self._media_playback_trackable():\n self._media_position_updated_at = utcnow()\n ... | [
"0.8349822",
"0.76628536",
"0.740182",
"0.7325744",
"0.732417",
"0.7303026",
"0.7199179",
"0.7148217",
"0.71239185",
"0.6954842",
"0.68269503",
"0.679691",
"0.66843003",
"0.66397315",
"0.66034657",
"0.65196604",
"0.65007883",
"0.6369017",
"0.6295126",
"0.62456346",
"0.619741"... | 0.76324815 | 2 |
When was the position of the current playing media valid. Returns value from homeassistant.util.dt.utcnow(). | def media_position_updated_at(self):
if self.app_id == CAST_APP_ID_HOMEASSISTANT_LOVELACE:
return None
return self._media_status()[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_position_updated_at(self) -> datetime | None:\n if self._device.movie.play_status in KALEIDESCAPE_PLAYING_STATES:\n return utcnow()\n return None",
"def media_position_updated_at(self):\n return self._table.active_track_remaining_time_as_of",
"def media_position(self):... | [
"0.81155026",
"0.7938705",
"0.76904863",
"0.7682678",
"0.749105",
"0.73474145",
"0.7167444",
"0.6832895",
"0.663812",
"0.63949186",
"0.6289607",
"0.6198373",
"0.61035603",
"0.6098762",
"0.6061579",
"0.60200846",
"0.60070443",
"0.59825265",
"0.5969736",
"0.5966542",
"0.5931982... | 0.7515691 | 4 |
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 |
Handle removal of Chromecast. | async def _async_cast_removed(self, discover: ChromecastInfo):
if self._cast_info.uuid != discover.uuid:
# Removed is not our device.
return
if not discover.cast_info.services:
# Clean up the dynamic group
_LOGGER.debug("Clean up dynamic group: %s", disco... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _async_cast_removed(self, discover: ChromecastInfo) -> None:",
"def callback(chromecast):\n nonlocal cast\n cast = chromecast\n stop_discovery()",
"def _onremove(self):\n self._channellist.remove(self)\n self.deleteLater()",
"async def async_will_remove_from_hass(... | [
"0.8121627",
"0.73657894",
"0.6712252",
"0.6240411",
"0.6209273",
"0.6209273",
"0.6177319",
"0.6169923",
"0.5970672",
"0.5960964",
"0.5960964",
"0.5960964",
"0.5960964",
"0.5960964",
"0.57573414",
"0.5746847",
"0.57467705",
"0.57391804",
"0.57256335",
"0.57129407",
"0.5692013... | 0.7052423 | 2 |
Year in 'xxxx' format and month in 'yy' format | def events_in_month(request, year, month):
month = datetime(year=year, month=month, day=1)
next_month = month + timedelta(months=1)
month_events = Event.objects.filter(date__gte=month, date__lte=next_month).order_by('date')
return render_short(request, 'adhoc_calendar/events.html', context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def year_month(cls,\n year: typing.Union[int, str],\n month: typing.Union[int, str])->str:\n yearstr: str\n if isinstance(year, int):\n yearstr = str(year)\n else:\n yearstr = year\n\n monthstr: str\n if isinstance(month, ... | [
"0.75502616",
"0.7128106",
"0.7056996",
"0.69697267",
"0.68963915",
"0.68050826",
"0.6784262",
"0.6774247",
"0.6734721",
"0.66106695",
"0.6603876",
"0.6596361",
"0.6593632",
"0.65879637",
"0.6587892",
"0.6557848",
"0.64578784",
"0.6419703",
"0.63529444",
"0.6344218",
"0.63246... | 0.0 | -1 |
Method that provides preparation before testing SuggestedTopics model's features. | def setUp(self):
with mock.patch('django.utils.timezone.now') as mock_time:
mock_time.return_value = TEST_TIME
custom_user = CustomUser(id=301,
first_name='Homer',
last_name='Simpson',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _training_before_hook(self):\n pass",
"def populate_initial_valid_classifiers(self):\n pass",
"def test_text_classifier_add_training_samples(self):\n pass",
"def test_text_classifier_add_testing_samples(self):\n pass",
"def test_intent_classifier_add_training_samples(self):\... | [
"0.6639815",
"0.6316694",
"0.6271969",
"0.616585",
"0.61488855",
"0.6032966",
"0.60183054",
"0.6003062",
"0.5976094",
"0.5932986",
"0.59246546",
"0.5908315",
"0.5885641",
"0.5885098",
"0.5873601",
"0.5841097",
"0.5808025",
"0.58009183",
"0.5796708",
"0.57955974",
"0.5771288",... | 0.0 | -1 |
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 |
Convert a dataclass object to a dict, replace any value of Enum instance to be the value of the item, | def to_dict(obj):
if is_dataclass_instance(obj):
result = []
for f in fields(obj):
value = to_dict(getattr(obj, f.name))
result.append((f.name, value))
return {"dataclass_type": type(obj).__name__, "params": dict(result)}
elif isinstance(obj, tuple) and hasattr(ob... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _serialize(self, data: Any) -> Dict[Any, Any]:\n\n return {field: value.value if isinstance(value, Enum) else value for field, value in data}",
"def as_dict(self) -> dict:\n return_dict = dict()\n for key, value in self.__dict__.items():\n if value is not None:\n ... | [
"0.7471674",
"0.65742713",
"0.6500015",
"0.63365906",
"0.6298914",
"0.61754525",
"0.61754525",
"0.61754525",
"0.59927356",
"0.58350456",
"0.5780348",
"0.5768161",
"0.5715083",
"0.568858",
"0.5644008",
"0.5640019",
"0.5638038",
"0.56354797",
"0.55781794",
"0.5546111",
"0.55377... | 0.59710544 | 9 |
'something' in PermWrapper works as expected. | def test_permwrapper_in(self):
perms = PermWrapper(MockUser())
# Works for modules and full permissions.
self.assertIn("mockapp", perms)
self.assertNotIn("nonexistent", perms)
self.assertIn("mockapp.someperm", perms)
self.assertNotIn("mockapp.nonexistent", perms) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_permutation(hyper, pol, perm):\n pass",
"def non_pythranizable(arg):\n return arg",
"def permute_command(words, qualify):\n if len(words) == 0:\n return permute_single_submode(None, qualify)\n else:\n permute = CommandPermutor(qualify)\n return permute.handle_command(... | [
"0.57045877",
"0.56203645",
"0.5148401",
"0.5122529",
"0.51115006",
"0.48440287",
"0.48364013",
"0.47373766",
"0.46874386",
"0.46723643",
"0.46723643",
"0.46723643",
"0.46723643",
"0.46723643",
"0.46723643",
"0.46723643",
"0.46723643",
"0.46723643",
"0.46723643",
"0.46723643",
... | 0.5265628 | 2 |
No endless loops if accessed with 'in' refs 18979. | def test_permlookupdict_in(self):
pldict = PermLookupDict(MockUser(), "mockapp")
with self.assertRaises(TypeError):
self.EQLimiterObject() in pldict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _do_iteration(self):\n return True",
"def _perturbInPlaceHard(self):\n die",
"def performance():\n\tn = 1024\n\twhile n < 5000000: \n\t\tsorted = range(n)\n\t\tnow = time()\n\n\t\t# Code whose performance is to be evalutated\n\t\tbs_contains(sorted, -1)\n\n\t\tdone = time()\n\n\t\tprint n, (d... | [
"0.54062104",
"0.5339624",
"0.5188105",
"0.5156514",
"0.508668",
"0.5070385",
"0.5068597",
"0.50609416",
"0.50319415",
"0.5021949",
"0.50126135",
"0.5006328",
"0.49907294",
"0.49899256",
"0.49759856",
"0.49723476",
"0.4941011",
"0.49315903",
"0.49276707",
"0.4926661",
"0.4926... | 0.0 | -1 |
The session is not accessed simply by including the auth context processor | def test_session_not_accessed(self):
response = self.client.get("/auth_processor_no_attr_access/")
self.assertContains(response, "Session not accessed") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_request():\n g.user = None\n if 'user' in session:\n g.user = session['user']",
"def before_request():\n g.user = None\n if 'user_id' in session:\n g.user = User.query.get(session['user_id'])",
"def session(self, context: InjectionContext = None) -> \"ProfileSession\":",
... | [
"0.703419",
"0.6572475",
"0.6500907",
"0.64748096",
"0.6453281",
"0.6413648",
"0.63916636",
"0.63887674",
"0.6374554",
"0.6337514",
"0.62603444",
"0.624842",
"0.6203952",
"0.61913985",
"0.6176473",
"0.6158436",
"0.61556983",
"0.61424696",
"0.61424696",
"0.6136442",
"0.6117515... | 0.63387716 | 9 |
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 |
The lazy objects returned behave just like the wrapped objects. | def test_user_attrs(self):
# These are 'functional' level tests for common use cases. Direct
# testing of the implementation (SimpleLazyObject) is in the 'utils'
# tests.
self.client.login(username="super", password="secret")
user = authenticate(username="super", password="secre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate_lazy_object(obj):\n wrapped_obj = getattr(obj, LAZY_OBJECT_NAME, None)\n if wrapped_obj is None:\n # if it isn't a lazy object then just return the original object...\n return obj\n if wrapped_obj is uninitialized_lazy_object:\n # if it is a lazy object but, hasn't been i... | [
"0.67636305",
"0.636094",
"0.6303103",
"0.62749934",
"0.62295735",
"0.6081495",
"0.6008868",
"0.60047656",
"0.59470046",
"0.5926366",
"0.5915257",
"0.5835904",
"0.5811961",
"0.5795969",
"0.5794478",
"0.5771954",
"0.5735124",
"0.573115",
"0.57019675",
"0.56952775",
"0.5656378"... | 0.0 | -1 |
Number of vertical levels in a profile. | def Nlevels(self):
return self._nlevels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_levels(self):\n return self.primary_header['Number of levels']",
"def nlevels(self) -> int:\n return len(self._levels)",
"def vert_count(self):\n return self._vert_count",
"def count_level(self):\r\n count = 0\r\n\r\n for i in range(0, len(self.matrix)):\r\n ... | [
"0.69816166",
"0.6623308",
"0.6552521",
"0.6529052",
"0.6463564",
"0.6445342",
"0.6065956",
"0.6063054",
"0.6028476",
"0.60102415",
"0.6009281",
"0.59602153",
"0.5881623",
"0.5876091",
"0.5860967",
"0.5836753",
"0.58102924",
"0.5794609",
"0.57341766",
"0.5703031",
"0.56696653... | 0.6432601 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.