query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Checks if the unit is repairing | def is_repairing(self) -> bool:
return self.orders and self.orders[0].ability.id in {
AbilityId.EFFECT_REPAIR,
AbilityId.EFFECT_REPAIR_MULE,
AbilityId.EFFECT_REPAIR_SCV,
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkFuel(self):\n return self.maze.checkFuelCost(self.checkpoint,currentLap = self.laps) - self.timeDriving",
"async def should_handle(self):\n return self.main.base_amount > 4 and self.main.can_build_unique(UnitTypeId.INFESTATIONPIT, self.main.pits)",
"def repair(self) -> None:\n ... | [
"0.60885423",
"0.6018012",
"0.59838724",
"0.59280455",
"0.5896611",
"0.58828497",
"0.5876374",
"0.58696514",
"0.5829881",
"0.58059216",
"0.5796583",
"0.5795497",
"0.5719197",
"0.57050043",
"0.57026017",
"0.5697293",
"0.5694842",
"0.5676263",
"0.5667099",
"0.56636494",
"0.5657... | 0.71310604 | 0 |
Returns the target tag (if it is a Unit) or Point2 (if it is a Position) from the first order, return None if the unit is idle | def order_target(self) -> Optional[Union[int, Point2]]:
if self.orders:
if isinstance(self.orders[0].target, int):
return self.orders[0].target
return Point2.from_proto(self.orders[0].target)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _targetof(node):\r\n if node is None: return None\r\n return node.target",
"def get_unit(self,tag):",
"def naive_next_pos(measurement, OTHER = None):\n if not OTHER: # this is the first measurement\n OTHER = measurement\n xy_estimate = OTHER \n return xy_estimate, OTHER",
"def get_p... | [
"0.5804547",
"0.5752543",
"0.5394889",
"0.53184825",
"0.52388096",
"0.5169292",
"0.5146506",
"0.51307243",
"0.5123888",
"0.51066446",
"0.508506",
"0.5074969",
"0.506755",
"0.5026042",
"0.5019082",
"0.49922347",
"0.49764162",
"0.4974227",
"0.4970562",
"0.49676278",
"0.49636215... | 0.7159339 | 0 |
Checks if the structure has addon | def has_add_on(self) -> bool:
return self.add_on_tag != 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __contains__(self, addonName):\r\n return bool(addonName in self.addons)",
"def hasExtensions(self):\n return len(self.__extensions) > 0",
"async def _async_is_addon_installed(self):\n addon_info = await self._async_get_addon_info()\n return addon_info[\"version\"] is not None",... | [
"0.7137639",
"0.65048265",
"0.62076324",
"0.615075",
"0.5983343",
"0.5910938",
"0.5906417",
"0.58856887",
"0.5880733",
"0.5843754",
"0.57591563",
"0.5720476",
"0.56671077",
"0.5659499",
"0.56579316",
"0.5653641",
"0.5648439",
"0.5647104",
"0.5646443",
"0.5643966",
"0.56332654... | 0.65238315 | 1 |
Returns a positive number if it has too many harvesters mining, a negative number if it has too few mining | def surplus_harvesters(self) -> int:
return -(self.proto.ideal_harvesters - self.proto.assigned_harvesters) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ideal_harvesters(self) -> int:\n return self.proto.ideal_harvesters",
"def get_excess(self) -> int:\n excess_to_min_treasury = self._treasury_balance.get() - self._treasury_min.get()\n auth_score = self.create_interface_score(self._game_auth_score.get(), AuthInterface)\n if not se... | [
"0.6175532",
"0.5961483",
"0.5898922",
"0.58665556",
"0.580788",
"0.57657754",
"0.5680482",
"0.56402576",
"0.56116235",
"0.5603672",
"0.5592537",
"0.5592537",
"0.5592537",
"0.5588047",
"0.5575178",
"0.55472",
"0.5539298",
"0.5524162",
"0.55163586",
"0.5484141",
"0.5452687",
... | 0.65099156 | 0 |
Checks if the unit has a buff | def has_buff(self, buff):
assert isinstance(buff, BuffId)
return buff.value in self.proto.buff_ids | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\r\n return self.buff==[]",
"def are_buffers_empty(self): \n i = 0\n for i in range(self.no_robots):\n if self.is_buffer_empty_for_robot(i) is True:\n i += 1\n else:\n return False\n if i >= self.no_robots:\... | [
"0.6458466",
"0.6379356",
"0.6270659",
"0.62548685",
"0.60754573",
"0.5907946",
"0.589809",
"0.58562696",
"0.58562696",
"0.58562696",
"0.58562696",
"0.57766783",
"0.5673235",
"0.563925",
"0.56169814",
"0.5612278",
"0.5611226",
"0.55926275",
"0.55662704",
"0.55629146",
"0.5540... | 0.73826253 | 0 |
Checks if the unit is a structure | def is_structure(self) -> bool:
return ATTRIBUTE.Structure.value in self.type_data.attributes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_struct(self):\n return False",
"def is_struct_type(self, objtype):\n return issubclass(objtype, self.get_real_ctypes_member('Structure'))",
"def isUnitKind(*args):\n return _libsbml.Unit_isUnitKind(*args)",
"def Unit_isUnitKind(*args):\n return _libsbml.Unit_isUnitKind(*args)",
... | [
"0.71684635",
"0.66890734",
"0.65594214",
"0.6516844",
"0.6315124",
"0.60989225",
"0.6083501",
"0.60701495",
"0.6067753",
"0.59412205",
"0.5836151",
"0.57489586",
"0.5738008",
"0.566084",
"0.5591216",
"0.5588741",
"0.5575983",
"0.5564178",
"0.55461234",
"0.5534568",
"0.547747... | 0.73056 | 0 |
Checks if the unit is from the light class | def is_light(self) -> bool:
return ATTRIBUTE.Light.value in self.type_data.attributes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def have_light(self, light):\n if light > 1:\n return False\n return bool(self.light_array[light])",
"def check_lighting_state_room1():\n if timer_lights_on_off_room1() == room1_lux():\n pass\n else:\n light_room1(timer_lights_on_off_room1())",
"def is_light(game_ob... | [
"0.67619145",
"0.62722176",
"0.624471",
"0.6222856",
"0.61466455",
"0.6130839",
"0.61091214",
"0.6041529",
"0.59606564",
"0.5940065",
"0.5884954",
"0.5875173",
"0.5874196",
"0.58629966",
"0.5836105",
"0.5811311",
"0.56859607",
"0.5681524",
"0.56774807",
"0.56640285",
"0.56581... | 0.70930135 | 0 |
Checks if the unit is from the armored class | def is_armored(self) -> bool:
return ATTRIBUTE.Armored.value in self.type_data.attributes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_instance(self):\n self.assertIsInstance(self.amenity_1, amenity)\n self.assertIsInstance(self.amenity_2, amenity)",
"def match(self, cls):\n return isinstance(self, cls)",
"def is_actor():\n return False",
"def is_not_subclass(self, cls, seconds=60):\n st = '('+') & (... | [
"0.62438434",
"0.61637175",
"0.60709447",
"0.60623026",
"0.6050455",
"0.6046287",
"0.60447234",
"0.5943034",
"0.591435",
"0.585211",
"0.5851524",
"0.58474976",
"0.58188045",
"0.5810405",
"0.57621753",
"0.5739988",
"0.57276726",
"0.57066995",
"0.568539",
"0.567616",
"0.5666585... | 0.6683675 | 0 |
Checks if the unit is from the biological class | def is_biological(self) -> bool:
return ATTRIBUTE.Biological.value in self.type_data.attributes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_applicable_to(cls, device_type: str,\n device_class: Type[gdm_test_base.DeviceType],\n device_name: str) -> bool:\n return issubclass(device_class, gazoo_device_base.GazooDeviceBase)",
"def is_unit(self):\n return math.isclose(self.magnitude(), 1)",
... | [
"0.62126136",
"0.6110952",
"0.60769075",
"0.60254717",
"0.60166574",
"0.59754956",
"0.5957404",
"0.59526074",
"0.59176457",
"0.5885482",
"0.5872679",
"0.5872469",
"0.5865977",
"0.5827564",
"0.5781461",
"0.57682586",
"0.575914",
"0.575015",
"0.5749415",
"0.571825",
"0.5710516"... | 0.61718017 | 1 |
Checks if the unit is from the robotic class | def is_robotic(self) -> bool:
return ATTRIBUTE.Robotic.value in self.type_data.attributes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_applicable_to(cls, device_type: str,\n device_class: Type[gdm_test_base.DeviceType],\n device_name: str) -> bool:\n return issubclass(device_class, gazoo_device_base.GazooDeviceBase)",
"def test_ground_vehicle(self):\n try:\n self.test = oop... | [
"0.62810934",
"0.6114108",
"0.6111489",
"0.60843873",
"0.60417813",
"0.60207677",
"0.5918093",
"0.59043795",
"0.5873593",
"0.5871166",
"0.5870519",
"0.5862491",
"0.5849073",
"0.58296394",
"0.5796854",
"0.57912356",
"0.5782388",
"0.5762797",
"0.5751194",
"0.5750995",
"0.574838... | 0.661055 | 0 |
Checks if the unit can attack ground | def can_attack_ground(self) -> bool:
if hasattr(self.type_data.proto, "weapons"):
weapons = self.type_data.proto.weapons
weapon = next(
(weapon for weapon in weapons if weapon.type in [TARGET_TYPE.Ground.value, TARGET_TYPE.Any.value]), None
)
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_attack_ground(self) -> bool:\n if hasattr(self.type_data.proto, \"weapons\"):\n weapons = self.type_data.proto.weapons\n weapon = next(\n (weapon for weapon in weapons if weapon.type in {TARGET_TYPE.Ground.value, TARGET_TYPE.Any.value}), None\n )\n ... | [
"0.7897058",
"0.7010254",
"0.66754204",
"0.6652448",
"0.65639013",
"0.65511346",
"0.65061325",
"0.6459614",
"0.6418117",
"0.6379098",
"0.62870574",
"0.6278766",
"0.6269234",
"0.6265868",
"0.6258762",
"0.61400634",
"0.61303556",
"0.6105863",
"0.6082102",
"0.60679495",
"0.60679... | 0.7891637 | 1 |
Returns unit movement speed | def movement_speed(self) -> Union[int, float]:
return self.type_data.proto.movement_speed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def speed(self):\n return sqrt(self.velocity_x ** 2 + self.velocity_y ** 2)",
"def movementSpeedModifier(self):\n return 0",
"def get_speed(self) -> float: \r\n if self.distance < self.distance_stop:\r\n print(\"STOP: Obstacle detected ({} cm)\".format(self.distance))\r\n ... | [
"0.74276",
"0.7253964",
"0.71964014",
"0.7167213",
"0.70974416",
"0.70974416",
"0.7077918",
"0.7077918",
"0.70674247",
"0.70613295",
"0.7040915",
"0.7039094",
"0.69888383",
"0.69881475",
"0.69838786",
"0.6955054",
"0.69336694",
"0.69336694",
"0.690124",
"0.690124",
"0.689756"... | 0.77432436 | 1 |
Returns unit current health percentage | def health_percentage(self) -> Union[int, float]:
if not self.proto.health_max:
return 0
return self.proto.health / self.proto.health_max | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_health(self):\n return round(self.health)",
"def get_health(self):\n self.__health = sum([i.get_health for i in self.__units])\n return self.__health",
"def health(self) -> float:\n return self.__health",
"def get_percent(self):\n return self.percent",
"def get_pe... | [
"0.7909548",
"0.7728165",
"0.75680786",
"0.74373",
"0.737853",
"0.737853",
"0.7338076",
"0.72771704",
"0.72771704",
"0.71627265",
"0.7146522",
"0.7051293",
"0.7043738",
"0.70006603",
"0.6992016",
"0.6989581",
"0.69517773",
"0.69517773",
"0.6933687",
"0.68125445",
"0.67784697"... | 0.7896695 | 1 |
Returns unit current shield | def shield(self) -> Union[int, float]:
return self.proto.shield | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shield(self):\n capacity = self._getAttribute(Attribute.shieldCapacity)\n recharge = self._getAttribute(Attribute.shieldRecharge)\n em = self._getAttribute(Attribute.shieldEM)\n explosive = self._getAttribute(Attribute.shieldExplosive)\n kinetic = self._getAttribute(Attribute.shieldKinetic)\n ... | [
"0.70322144",
"0.6780276",
"0.6406915",
"0.63555837",
"0.62193644",
"0.60541594",
"0.60541594",
"0.5677421",
"0.5675438",
"0.5672791",
"0.5670445",
"0.56701046",
"0.56701046",
"0.55691487",
"0.5567646",
"0.55194074",
"0.55168134",
"0.55075765",
"0.5477694",
"0.5429404",
"0.54... | 0.7464415 | 0 |
Returns unit max shield | def shield_max(self) -> Union[int, float]:
return self.proto.shield_max | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getUmidadeArMax(self):\n return str(self.getWeather('umid-max')[:2]) + '%'",
"def max_charge(self):\n return self.strength",
"def _maximum(self) -> float:\n if self._type == \"power\":\n return 5.0\n elif self._type == \"setpoint\":\n return self._product.g... | [
"0.66044736",
"0.6511801",
"0.65002376",
"0.64407516",
"0.6386695",
"0.63770294",
"0.63770294",
"0.6365791",
"0.63647854",
"0.63459444",
"0.63459444",
"0.63102037",
"0.61403525",
"0.61286724",
"0.6117376",
"0.6116341",
"0.61007226",
"0.6086372",
"0.6084739",
"0.6064486",
"0.6... | 0.80975515 | 0 |
Returns unit current shield percentage | def shield_percentage(self) -> Union[int, float]:
if not self.proto.shield_max:
return 0
return self.proto.shield / self.proto.shield_max | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_percent(self):\n return self.percent",
"def shield(self) -> Union[int, float]:\n return self.proto.shield",
"def shield(self) -> Union[int, float]:\n return self.proto.shield",
"def get_percent_wet():\n # Create an ADS1115 ADC (16-bit) instance.\n adc = Adafruit_ADS1x15.ADS... | [
"0.69148076",
"0.68611026",
"0.68611026",
"0.6860056",
"0.6856735",
"0.68230885",
"0.68230885",
"0.6777474",
"0.67203826",
"0.6711544",
"0.6649254",
"0.64790964",
"0.6387526",
"0.6371261",
"0.6360239",
"0.6354026",
"0.6322904",
"0.6276174",
"0.62590635",
"0.62590635",
"0.6258... | 0.84401506 | 0 |
Returns unit max energy | def energy_max(self) -> Union[int, float]:
return self.proto.energy_max | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _maximum(self) -> float:\n if self._type == \"power\":\n return 5.0\n elif self._type == \"setpoint\":\n return self._product.get_data_config_json()[\"_value_setpoint_max\"]\n elif self._type == \"fan1\":\n fan = 1\n return self._product.get_data... | [
"0.70584846",
"0.70407504",
"0.697714",
"0.6966233",
"0.69344515",
"0.69217527",
"0.6910822",
"0.6902398",
"0.68851423",
"0.68350065",
"0.6801246",
"0.6789903",
"0.6777407",
"0.67563534",
"0.6754314",
"0.6730694",
"0.6721213",
"0.6721213",
"0.67194533",
"0.6715589",
"0.668544... | 0.8177361 | 0 |
Returns unit current energy percentage | def energy_percentage(self) -> Union[int, float]:
if not self.proto.energy_max:
return 0
return self.proto.energy / self.proto.energy_max | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def percentage_used(self):\n return self.volume_used/self.total_volume * 100.0",
"def total_energy(self):\n return self._total_energy",
"def unit_of_measurement(self):\n return \"%\"",
"def get_energy(self):\r\n return self._energy",
"def percentage_update(self):\n\n self.event_u... | [
"0.7250673",
"0.7147042",
"0.710899",
"0.70823824",
"0.7079125",
"0.70472854",
"0.70006955",
"0.70006955",
"0.6998914",
"0.69900644",
"0.6958621",
"0.6887557",
"0.6879118",
"0.68706834",
"0.686306",
"0.68563163",
"0.6844264",
"0.6797581",
"0.67891943",
"0.6786565",
"0.6732211... | 0.77534443 | 1 |
Return largest contest from a list of Contests. | def get_largest_contest(contests, entry_fee=25, query=None, exclude=None):
logger.debug("contests size: %d", len(contests))
# add contest to list if it matches criteria
contest_list = [
c for c in contests if match_contest_criteria(c, entry_fee, query, exclude)
]
logger.debug("number of co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_best(counters):\n # result_list = []\n max_val = 0\n for counter in counters:\n if counter[3] >= max_val:\n max_val = counter[3]\n result_list = [counter for counter in counters if counter[3] == max_val]\n\n result_list = sorted(result_list, key=lambda x: (x[0], x[1]))\n\n... | [
"0.6226543",
"0.60621727",
"0.60216343",
"0.59519184",
"0.5921496",
"0.5904525",
"0.5902668",
"0.58826935",
"0.5815107",
"0.5771619",
"0.5734964",
"0.57175267",
"0.5717202",
"0.5666339",
"0.5663686",
"0.5600474",
"0.5577914",
"0.5570886",
"0.5500309",
"0.5467216",
"0.54596907... | 0.725775 | 0 |
Deleting all the records. For the "tempRecords" it is eesential to save Firt line to keep track of names of src and susp docs | def delete_All_record():
with jsonlines.open('permanRecords.jsonl', mode='w') as writer:
print("All permanent records deleted")
with jsonlines.open('tempRecords.jsonl', mode='r') as reader:
for obj in reader:
with jsonlines.open('tempRecords.jsonl', mode='w') as writerOP:
writerOP.write(obj)
break
pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_records(self, records_to_delete):\n for record in records_to_delete:\n self.records.remove(record)\n self._store_writer.remove_img_file(record)\n\n self._process_change()",
"def delete_record(records):\n delete_record()",
"def delete_last_record():\n\tnewRcrds ... | [
"0.73167855",
"0.6990008",
"0.6743949",
"0.6727469",
"0.64890975",
"0.62624747",
"0.6259088",
"0.62512356",
"0.623597",
"0.62282",
"0.6186893",
"0.61635953",
"0.61289626",
"0.60468936",
"0.6031417",
"0.5999289",
"0.59943545",
"0.59940726",
"0.5973173",
"0.59490484",
"0.591443... | 0.7374866 | 0 |
return an array of active rotation matrices of the input crystal symmetry | def GetSymRotMat(symtype='Cubic'):
if symtype == 'Cubic':
m=np.zeros((24,3,3))
m[0][0,1]=1
m[0][1,0]=-1
m[0][2,2]=1
m[1][0,0]=-1
m[1][1,1]=-1
m[1][2,2]=1
m[2][0,1]=-1
m[2][1,0]=1
m[2][2,2]=1
m[3][0,2]=-1
m[3][1,1]=1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sym_matrix(self):\n temp_T = Matrix.eye(3)\n for i in range(len(self.lengths)):\n angle_mat = self.T_a.subs(self.q,self.angles[i]).evalf()\n len_mat = self.T_x.subs(self.l,self.lengths[i]).evalf()\n temp_T = temp_T * angle_mat * len_mat\n \n retu... | [
"0.6684026",
"0.64738554",
"0.6420096",
"0.64035624",
"0.6402505",
"0.63846844",
"0.6272762",
"0.6253572",
"0.6241181",
"0.6128231",
"0.6119867",
"0.6101846",
"0.60902804",
"0.60888445",
"0.6061847",
"0.605586",
"0.6045197",
"0.60235345",
"0.6009248",
"0.5999577",
"0.5999133"... | 0.6596359 | 1 |
Takes a file as input and returns a dictionary containing each line as a key | def to_dictionary(file):
fin = open(file)
d = dict()
for line in fin:
d[line.strip()] = ''
return d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read(self):\n dictionary = {}\n with open(self.path) as file:\n key_header = \"\"\n for line in file:\n entry = line.strip().split()\n if len(entry) == 0:\n continue\n if len(entry) == 1:\n ke... | [
"0.767304",
"0.75861675",
"0.74945843",
"0.7423515",
"0.7309919",
"0.7204507",
"0.7174692",
"0.6962364",
"0.6956782",
"0.693404",
"0.6911014",
"0.6908323",
"0.6846598",
"0.6830056",
"0.6820076",
"0.6810723",
"0.68075323",
"0.6801913",
"0.67947835",
"0.6772817",
"0.67652535",
... | 0.77059495 | 0 |
Simplifies ugly strings into something URLfriendly. >>> print slugify("[Some] _ Article's Title") somearticlestitle | def slugify(s):
s = s.lower()
for c in [' ', '-', '.', '/']:
s = s.replace(c, '_')
s = re.sub('\W', '', s)
s = s.replace('_', ' ')
s = re.sub('\s+', ' ', s)
s = s.strip()
s = s.replace(' ', '-')
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slugify(s):\n\treturn re.sub('[!@#$%^&*()\\\\\\\\/:.\"\"]+', '', s).replace(' ', '-').replace('--', '-').lower()",
"def slugify(s):\n slug = s.lower() # force to lower case\n slug = re.sub('[^a-z0-9 -]', '', slug) # remove invalid chars\n slug = re.sub(r'\\s+', '-', slug) # collapse whitespace an... | [
"0.8200289",
"0.8173817",
"0.8104355",
"0.800863",
"0.7991363",
"0.7972317",
"0.78879595",
"0.78508",
"0.78262",
"0.77845466",
"0.7726027",
"0.7725631",
"0.77232134",
"0.7714362",
"0.76283437",
"0.7495274",
"0.74903035",
"0.7486307",
"0.7479958",
"0.74508375",
"0.74333227",
... | 0.8382306 | 0 |
will save the published pages | def save(self):
for page in self.pages.get_published_pages():
site_path = page.path_to_page.replace('.md', '').replace(
self.source_path, '').strip('/')
save_path = self.output_path
# ensure we are not creating a directory for the index file that
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish(self):\n self.published_date = timezone.now()\n self.save()",
"def publish(self):\n self.published_date = timezone.now()\n self.save()",
"def publish(self):\n self.published = True\n self.save()# pylint: disable=no-member",
"def publish(self):\n se... | [
"0.64749837",
"0.64749837",
"0.64635426",
"0.6450584",
"0.6400898",
"0.63081235",
"0.6302135",
"0.6298245",
"0.62664205",
"0.6256315",
"0.6197338",
"0.6188225",
"0.6170533",
"0.6044309",
"0.60315526",
"0.59672153",
"0.5934918",
"0.5931027",
"0.59240097",
"0.59240097",
"0.5922... | 0.6829845 | 0 |
sorts the pages by published date descending | def sort(self):
self.pages.sort(key=lambda p: p.published_date, reverse=True)
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_by_date(self, date):\n return self.articles.select().where(Article.pubDate >= date)",
"def sort_and_reduce(self):\n self.data = sorted(self.data, key=lambda item: item.pubDate)\n if len(self.data) > MAX_SIZE:\n self.data = self.data[-MAX_SIZE:]",
"def sortFinalFeed(fina... | [
"0.6741232",
"0.6203596",
"0.61792237",
"0.61783266",
"0.61488485",
"0.59491247",
"0.5843537",
"0.5802202",
"0.5763061",
"0.5720722",
"0.5685815",
"0.5658605",
"0.56427264",
"0.5582967",
"0.552623",
"0.5522042",
"0.5479095",
"0.5463637",
"0.5452377",
"0.5413694",
"0.5409866",... | 0.8188339 | 0 |
check if any of the directories in top_dirs is an ancestor of path. e.g., path="/a/b/c" and top_dirs = [ "/a", "/x", "/y/z" ], it returns "/a", "/b/c" | def find_ancestor(self, path, top_dirs):
for top in top_dirs:
if string.find(path, top) == 0:
return top,path[len(top) + 1:]
return None,None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_level_directories(self):\n return [d for d in self.directories if len([x for x in self.directories if x in d]) == 1]",
"def _lowest_ancestor_containing_relpath(relpath):\n cur_dir_path = os.path.abspath(os.path.dirname(__file__))\n while True:\n if os.path.exists(os.path.join(cur_dir_path, re... | [
"0.6480448",
"0.6268462",
"0.618385",
"0.6071313",
"0.5988676",
"0.5837057",
"0.58294976",
"0.58254045",
"0.57914144",
"0.5736115",
"0.57340586",
"0.56823933",
"0.56216675",
"0.5575703",
"0.55513763",
"0.54828924",
"0.5471862",
"0.54502505",
"0.54434806",
"0.541258",
"0.54074... | 0.8176342 | 0 |
find "top directories" among inst_files (normally default_src_files). top directory is a directory whose parent is not in the list (inst_files). | def find_top_dirs(self, inst_files):
top_dirs = []
for path in inst_files:
path = self.expand(path, None)
# path is like /home/tau/proj/gxp3/hoge
ancestor,_ = self.find_ancestor(path, top_dirs)
if ancestor is None:
top_dirs.append(path)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_files(top_directory, exclude=[], include_top_directory_in_name=True):\n import os\n import re\n paths_and_names = []\n exclude = [re.compile(exclusion) for exclusion in exclude]\n top_directory = os.path.abspath(os.path.expanduser(top_directory))\n parent_directory = os.path.dirname(top_... | [
"0.6440918",
"0.6308445",
"0.6278611",
"0.61572254",
"0.6082852",
"0.60713637",
"0.6058449",
"0.6002226",
"0.5905584",
"0.5769754",
"0.57669085",
"0.57147384",
"0.5708831",
"0.57074165",
"0.56707436",
"0.56692976",
"0.56586605",
"0.56140965",
"0.5609565",
"0.5608522",
"0.5522... | 0.84341604 | 0 |
Return a string of python program which, when invoked without argument, installs all inst_files under a randomly created directory under target_prefix. For example, say target_prefix='target', src_files=[ 'abc', 'def' ], it will create target/RANDOM_DIR/abc and target/RANDOM_DIR/def. When successful, the program will w... | def mk_program(self, O, code):
# append main function to inst_remote_file (normally inst_remote.py)
if self.remote_installed():
inst_data,inst_data_LOG = None,None # perhaps we need no install
else:
inst_data,inst_data_LOG = self.mk_installed_data(O.src_file)
# if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install():\n src = None\n if len(sys.argv) == 2:\n src = sys.argv[1]\n elif len(sys.argv) > 2:\n print >> sys.stderr, 'USAGE: rbco_nautilusscripts_install [SOURCE_DIR]'\n sys.exit(1)\n\n paths = (\n '~/.gnome2/nautilus-scripts',\n '~/.gnome2/nemo-scripts',\n ... | [
"0.573672",
"0.55626404",
"0.5535893",
"0.55115104",
"0.55044204",
"0.5490072",
"0.54035324",
"0.5398947",
"0.5364471",
"0.53377223",
"0.53177994",
"0.5303933",
"0.5302768",
"0.52693486",
"0.5261781",
"0.5251009",
"0.52494437",
"0.5234063",
"0.5229839",
"0.5225625",
"0.521488... | 0.61463183 | 0 |
run ssh, sh, qsub_wrap or whatever to eventually spawn off new gxpd.py (locally or remotely). | def spawn_gxpd(self, O):
code = "INSTALL%09d" % random.randint(0, 999999999)
if dbg>=2: ioman.LOG("code = %s\n" % code)
stub_sz,prog = self.mk_program(O, code)
python_cmd = self.mk_python_cmdline(O.python, stub_sz)
sub = self.subst_cmd(python_cmd, O.rsh)
if dbg>=2:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spawn(self):\n self._proc = subprocess.Popen(\n self._args, stdout=subprocess.PIPE, stderr=subprocess.PIPE\n )",
"def main():\n # Set these to your own details.\n myssh = connect('example.com')\n myssh.put('ssh.py')\n myssh.close()",
"def main():\n # This have specif... | [
"0.5945301",
"0.5934354",
"0.590003",
"0.5877857",
"0.57933897",
"0.5783071",
"0.5711057",
"0.5684556",
"0.5643424",
"0.56336987",
"0.56297153",
"0.56113845",
"0.5608755",
"0.55909765",
"0.55780256",
"0.5556954",
"0.5525404",
"0.55195445",
"0.55110645",
"0.5509566",
"0.550415... | 0.6276093 | 0 |
wait for gxpd to send a msg saying it has brought up return None if it appears to have failed. | def wait_gxpd_to_bring_up(self, O, code):
OK = ioman.ch_event.OK
if dbg>=2:
ioman.LOG("Wait for gxpd to send code [%s]\n" % code)
if self.expect([code, ("TIMEOUT", O.hello_timeout)], 1) != OK:
if dbg>=1:
ioman.LOG("Install NG\n")
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _execute(self):\n LOG.info(\"Waiting for a message...\")",
"def _wait_what(self, expected):\r\n \r\n self._msg_server(cb.WAITWHATSERVER % (expected))",
"def wait(self):\n\t\twhile True:\n\t\t\tr1 = self.zaberSend(self.translation[\"hor\"], self.cmd[\"returnStatus\"], data=0)\n\t\t\tr2 ... | [
"0.6654666",
"0.6576237",
"0.61723024",
"0.61208487",
"0.6104545",
"0.60672337",
"0.60482323",
"0.60403275",
"0.6001265",
"0.59685457",
"0.5967875",
"0.593576",
"0.5858489",
"0.5856503",
"0.57697994",
"0.57311666",
"0.57268035",
"0.57111305",
"0.5685785",
"0.567955",
"0.56791... | 0.7123529 | 0 |
Generates angles to use in a grid search for the given molecule. Angles that are symmetrically degenerate are automatically removed from consideration. Cannot be used with an angle spacing less than 1. Arguments | def get_unique_angle_grid(mol,
angle_spacing=15,
max_angle=360,
max_rot=10,
tol=0.1):
### Fail-safe
if (max_angle / angle_spacing) > 360:
raise Exception("That's not a good idea. Grid search is too ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_internal_angles(self):\n\n angles = []\n\n for elx, elz in zip(self.grid['x'], self.grid['z']):\n el_angles = []\n xy = np.vstack((elx, elz))\n for i in range(0, elx.size):\n i1 = (i - 1) % elx.size\n i2 = (i + 1) % elx.size\n\n ... | [
"0.58609045",
"0.57898927",
"0.56535774",
"0.5567523",
"0.55662113",
"0.5549325",
"0.5537477",
"0.5473495",
"0.5401892",
"0.53995365",
"0.5376131",
"0.53601164",
"0.53432614",
"0.533591",
"0.5315184",
"0.52890044",
"0.5288821",
"0.52871203",
"0.5267595",
"0.5237662",
"0.52201... | 0.6247915 | 0 |
Return a dictionary of common OSF objects and utilities. | def get_osf_imports(self):
from website import settings as website_settings
from framework.auth import Auth, get_user
ret = {
'Auth': Auth,
'get_user': get_user,
'website_settings': website_settings,
}
try: # faker isn't a prod requirement
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_functions():\n\n # Get all functions that start with _office.\n fcts = {fct_name[len(FCT_PREFIX):]: fct for (fct_name, fct) in\n globals().iteritems() if fct_name.startswith(FCT_PREFIX) and\n hasattr(fct, \"__call__\")}\n\n return fcts",
"def modules():\n cmd = \"{} -M\... | [
"0.59502983",
"0.5888002",
"0.5862971",
"0.5768069",
"0.5649953",
"0.55417454",
"0.55171347",
"0.5514541",
"0.5513219",
"0.550253",
"0.5477016",
"0.5475205",
"0.5468393",
"0.54630804",
"0.54420286",
"0.5415923",
"0.54112947",
"0.5395849",
"0.5393869",
"0.53926",
"0.5376368",
... | 0.62204707 | 0 |
Returns the dict as a model | def from_dict(cls, dikt) -> 'ModelClass':
return util.deserialize_model(dikt, cls) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict_model(self) -> dict:\n return dict((key, getattr(self, key)) for key in self.__mapper__.c.keys())",
"def from_dict(cls, dikt):\n return util.deserialize_model(dikt, cls)",
"def from_dict(cls, dikt):\n return util.deserialize_model(dikt, cls)",
"def from_dict(cls, dikt):\n ... | [
"0.68444926",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.6739522",
"0.6698291",
"0.6698291",
"0.66464084",
"0.66383654",
"0.66022646",
"0.660082",
"0.65999925",
"0.6593835",
"0.6580194",
"0.65621036",
"0.64150435",
"0.64147764",
"0.... | 0.6939894 | 0 |
Gets the class_id of this ModelClass. | def class_id(self) -> str:
return self._class_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_id(self):\n return self._class_id",
"def classId(self):\n return _internals.CorrelationId_classId(self)",
"def get_id(self):\n\n\t\treturn self.__id",
"def get_id(self):\n return self.__id",
"def get_id(self):\n return self.__id",
"def cls_identifier(cls):\n i... | [
"0.86779034",
"0.76055956",
"0.7232041",
"0.7196832",
"0.7196832",
"0.71855795",
"0.7183711",
"0.71603596",
"0.71603596",
"0.7134945",
"0.71157575",
"0.7085214",
"0.7085214",
"0.7085214",
"0.7085214",
"0.7085214",
"0.7085214",
"0.7085214",
"0.7085214",
"0.7085214",
"0.7085214... | 0.85078347 | 1 |
Sets the class_id of this ModelClass. | def class_id(self, class_id: str):
if class_id is None:
raise ValueError("Invalid value for `class_id`, must not be `None`") # noqa: E501
self._class_id = class_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_id(self, class_id):\n\n self._class_id = class_id",
"def setID(self, id):\r\n raise NotImplementedError(\"must be implemented in subclass\")",
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id_):\n\n self.id_ = id_",
"def class_id(self):\n return se... | [
"0.8544871",
"0.6668794",
"0.6631666",
"0.6604643",
"0.64964515",
"0.64812756",
"0.64812756",
"0.64104915",
"0.6402913",
"0.6339285",
"0.6339285",
"0.6339285",
"0.6339285",
"0.6339285",
"0.6339285",
"0.6339285",
"0.6339285",
"0.6339285",
"0.6339285",
"0.6339285",
"0.6339285",... | 0.7615824 | 1 |
start independent process in lxterminal, so output is visible and it is not killed by interrupt in jupyter notebook | def run_lxterminal(command):
os.system('lxterminal --command="{} "&'.format(command)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_process():\n global command, process\n\n def on_data(data):\n data = data.decode().strip()\n print('{}'.format(data))\n\n cmd = command.split(' ')\n\n if process:\n process.terminate()\n\n process = MySubprocess(cmd, -1, functools.partial(on_data), None, None)",
"def... | [
"0.6702464",
"0.65926254",
"0.6336998",
"0.6314526",
"0.6183309",
"0.6141797",
"0.60214007",
"0.60172933",
"0.5987335",
"0.59775",
"0.5957471",
"0.5937055",
"0.5930582",
"0.5912045",
"0.5852338",
"0.58389956",
"0.58331513",
"0.5826316",
"0.58249485",
"0.58208257",
"0.57864535... | 0.71083707 | 0 |
Solves the class within the step class and records the time taken for the step to solve in the run log. | def solve(self):
start = time.time()
instance = self.class_object()
method = getattr(instance, self.method_str)
method(*self.args, **self.kwargs)
end = time.time()
run_log.info(
(
f"\n###########################"
f"\n{self.name}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_time_step(self):\r\n # append the current time/MoI to the lists\r\n self.get_outputs()\r\n\r\n print(\"-------------------------\")\r\n print(\"Now Running Cycle {}, t: {:.3e}, Completed {:.2f}%, CFL: {:.3e}\"\r\n .format(self.ind, self.t, 100*self.t/self.end_ti... | [
"0.6777519",
"0.6213666",
"0.6056477",
"0.5684582",
"0.5648414",
"0.5627167",
"0.55917984",
"0.5589002",
"0.55860054",
"0.557393",
"0.5535996",
"0.54962397",
"0.549265",
"0.5491986",
"0.54762447",
"0.5415769",
"0.5406349",
"0.5400164",
"0.5384556",
"0.5380696",
"0.53777665",
... | 0.70075154 | 0 |
Converts the input arguements to a list with any components being written as references instead of the object. Returns list A list of arguments. | def arg_to_str_list(self) -> list:
arg_list = []
for arg in [*self.args]:
if hasattr(arg, "_ref"):
arg_list.append(arg.ref)
else:
arg_list.append(arg)
return arg_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arglist(self) -> List:\n return self.argv[1:]",
"def create_argument_list(self):\n raise NotImplementedError",
"def args(self):\n\t\tret = []\n\t\tfor argname in self._arg_names:\n\t\t\tret += [self._args[argname]]\n\t\treturn ret",
"def argument_list(self):\n answer = self._call('ar... | [
"0.6775863",
"0.67255914",
"0.6693483",
"0.6653935",
"0.6532886",
"0.64876384",
"0.64650583",
"0.6431984",
"0.6431057",
"0.64105946",
"0.6298967",
"0.6295214",
"0.62882507",
"0.62562275",
"0.6250089",
"0.6231072",
"0.61874235",
"0.6159719",
"0.6136115",
"0.61203843",
"0.60747... | 0.8085565 | 0 |
Builds the ordered dictionary by taking the required modules from the settings and defining json and building a class from string. If the module settings call for a particular reference, and that reference is in the flattened assembly the solver will be provided with that part of the assembly. The solver initialises th... | def build_from_settings(self, settings: dict, assembly: EngineeringObject):
mod_settings = copy.deepcopy(settings["modules"])
all_modules = load_and_merge(mod_settings["location"])
flat = assembly.flatten()
for i_module in range(0, len(mod_settings["order"])):
module_name = m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, sub_modules: Dict[str, List[nn.Module]], allow_empty_key: bool = True):\n self.sub_modules = sub_modules\n self.allow_empty_key = allow_empty_key\n\n ordered_dict = OrderedDict()\n for name, models in sub_modules.items():\n if not isinstance(models, List):\... | [
"0.5422977",
"0.54208034",
"0.5360139",
"0.525717",
"0.5125271",
"0.5120678",
"0.5087447",
"0.5082794",
"0.5078667",
"0.5066122",
"0.5063641",
"0.50632674",
"0.5063256",
"0.50475115",
"0.50469667",
"0.5038936",
"0.50258946",
"0.501951",
"0.5000129",
"0.49793392",
"0.49743474"... | 0.6462933 | 0 |
Builds a run array from a list of steps. | def build_from_step_list(self, step_list: list):
for step in step_list:
self.run[step.name] = step | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def single_run(steps_number):\n values = list()\n numerator = 0\n for i in trange(1, steps_number):\n\n numerator += generate_episode()\n\n values.append(numerator / i)\n\n return np.array(values)",
"def __init__(self):\n self.step_list = [steps.Raw()]",
"def _build_runlist(sel... | [
"0.60276055",
"0.554238",
"0.5493478",
"0.54819936",
"0.5448216",
"0.5416661",
"0.5392915",
"0.5337575",
"0.5326141",
"0.5320319",
"0.5306753",
"0.52930695",
"0.5272719",
"0.52716434",
"0.5207848",
"0.5206185",
"0.52038455",
"0.52016014",
"0.51597774",
"0.51473296",
"0.513960... | 0.7439657 | 0 |
Updates any kwargs with the component if exists in flat. | def update_kwargs(self, module: dict, flat: dict):
if "kwargs" in module:
module["kwargs"] = self.replace_with_comp(module["kwargs"], flat)
else:
module["kwargs"] = {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_args(self, module: dict, flat: dict):\n if \"args\" in module:\n module[\"args\"] = self.replace_with_comp(module[\"args\"], flat)\n\n else:\n module[\"args\"] = ()",
"def _update_args_and_kargs(self):\n if self.kwargs:\n self.value.append(self.arg... | [
"0.67431074",
"0.59913415",
"0.55375063",
"0.54027444",
"0.5396636",
"0.52824324",
"0.5278953",
"0.52316844",
"0.5214248",
"0.5208363",
"0.51911885",
"0.5171262",
"0.5162096",
"0.5157822",
"0.51548254",
"0.51448596",
"0.51432925",
"0.5141463",
"0.51173186",
"0.5101448",
"0.50... | 0.7121683 | 0 |
Updates any args with the component if exists in flat. | def update_args(self, module: dict, flat: dict):
if "args" in module:
module["args"] = self.replace_with_comp(module["args"], flat)
else:
module["args"] = () | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(*args):",
"def update_kwargs(self, module: dict, flat: dict):\n if \"kwargs\" in module:\n module[\"kwargs\"] = self.replace_with_comp(module[\"kwargs\"], flat)\n else:\n module[\"kwargs\"] = {}",
"def update(self, args):\n pass",
"def _update_args_and_ka... | [
"0.5846772",
"0.58181864",
"0.5735216",
"0.57189333",
"0.56756955",
"0.5670818",
"0.5290148",
"0.52748054",
"0.52613986",
"0.52613986",
"0.52613986",
"0.52613986",
"0.52613986",
"0.52613986",
"0.52412236",
"0.52314067",
"0.52303517",
"0.522508",
"0.5188496",
"0.5149801",
"0.5... | 0.7489111 | 0 |
Wrapper function for ``breadcrumbs``. Prepends 'Editor Tools' breadcrumbs. items list of [(url, label)] to be inserted after Addon. addon_queue Addon object. This sets the queue by addon type or addon status. queue Explicit queue type to set. | def reviewers_breadcrumbs(context, queue=None, addon_queue=None, items=None):
crumbs = [(reverse('reviewers.home'), _('Reviewer Tools'))]
if addon_queue and addon_queue.type == amo.ADDON_WEBAPP:
queue = 'pending'
if queue:
queues = {'pending': _('Apps')}
if items and not queue == ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_breadcrumbs(self, task_instance, session: Session | None = None):",
"def queue(self, *args, **kwargs):\n queue_args = self._pop_tq_add_args(kwargs)\n app = queue_args.pop('app', None) or flask.current_app\n\n with app.test_request_context():\n # flask.url_for uses the requ... | [
"0.56002504",
"0.48172945",
"0.48048988",
"0.46956846",
"0.4623175",
"0.45396397",
"0.4516008",
"0.44817695",
"0.442047",
"0.44135082",
"0.4392678",
"0.4392678",
"0.4392678",
"0.43822408",
"0.43822408",
"0.43822408",
"0.43479243",
"0.43359864",
"0.433496",
"0.4311628",
"0.431... | 0.70886683 | 0 |
Returns tuple of tab navigation for the queue pages. | def queue_tabnav(context):
counts = queue_counts()
return [('apps', 'queue_pending',
ngettext('Apps ({0})', 'Apps ({0})', counts['pending'])
.format(counts['pending']))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def navigation(self, **args):\n return self.pageConfig['navigation'] % self.pageConfig",
"def tab_url(self) -> str:",
"def define_nav_elements(self):\n return [\n TabTip(app=self.app),\n TabIris(app=self.app),\n InstructionsTab(app=self.app),\n ]",
"def g... | [
"0.60168207",
"0.57888454",
"0.5780739",
"0.5671626",
"0.56383234",
"0.5595336",
"0.5476588",
"0.5476543",
"0.54586065",
"0.5419019",
"0.53917646",
"0.53750026",
"0.5364985",
"0.53593457",
"0.5340829",
"0.53394717",
"0.5312453",
"0.52375853",
"0.51364833",
"0.5055634",
"0.504... | 0.6726656 | 0 |
Filter out static objects. For each object id we get the corresponding points, and check how far it's moved over it's whole lifespan. If this is less than 10px, we remove it. | def get_statics(df, move_thresh):
ret_ids = []
for uid in df["id"].unique():
path = np.array(df.loc[df["id"] == uid, ["center_x", "center_y"]])
path_segments = np.diff(path, axis=0)
if (np.abs(path_segments.sum(axis=0)) < move_thresh).all():
ret_ids.append(uid)
print("... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pruning(self):\n data = self.data.copy()\n for d in self.data:\n # cascade purning method. Inspired from \"Efficient Computation of Group Skyline Queries on MapReduce (FCU)\"\n if d in data:\n pastart = [self.drange[1] if i+self.radius>self.drange[1] else i+se... | [
"0.59283227",
"0.58665454",
"0.57639414",
"0.5761723",
"0.57576424",
"0.55484796",
"0.5502011",
"0.5492425",
"0.54369724",
"0.5436225",
"0.54327273",
"0.5390317",
"0.5369078",
"0.5366186",
"0.53574765",
"0.5328337",
"0.53110296",
"0.5306127",
"0.5295264",
"0.5279624",
"0.5274... | 0.5903497 | 1 |
Provide search criteria to the [DeleteMany](/api/queries/deletemany) query | def delete_many(
self, session: Optional[ClientSession] = None
) -> DeleteMany:
return self.delete(session=session) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def delete_many(\n self,\n *,\n filter: Optional[Dict[str, Any]] = DEFAULT_FILTER,\n session: Optional[Any] = DEFAULT_SESSION,\n **kwargs: Any,\n ) -> DeleteResult:\n return await self._database.delete_many(\n self.name, filter=filter, session=session, ... | [
"0.6648918",
"0.58919877",
"0.5884991",
"0.5858662",
"0.566894",
"0.56500196",
"0.56291014",
"0.5623399",
"0.5623399",
"0.5560395",
"0.553796",
"0.54277384",
"0.53988343",
"0.5372958",
"0.5293514",
"0.5291012",
"0.5279084",
"0.5263696",
"0.52552795",
"0.52278656",
"0.51957005... | 0.60170656 | 1 |
Anonymous users should not be allowed to read a video detail. | def test_api_video_read_detail_anonymous(self):
video = factories.VideoFactory()
response = self.client.get(f"/api/videos/{video.id}/")
self.assertEqual(response.status_code, 401)
content = json.loads(response.content)
self.assertEqual(
content, {"detail": "Authentica... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_read_list_anonymous(self):\n factories.VideoFactory()\n response = self.client.get(\"/api/videos/\")\n self.assertEqual(response.status_code, 401)",
"def test_api_livesession_read_anonymous(self):\n livesession = AnonymousLiveSessionFactory()\n response = sel... | [
"0.7517636",
"0.71461594",
"0.714208",
"0.7094655",
"0.6862117",
"0.6848852",
"0.6816118",
"0.67496383",
"0.6714314",
"0.6692366",
"0.6687882",
"0.66513646",
"0.664902",
"0.66250855",
"0.6623476",
"0.66010463",
"0.6537099",
"0.65360594",
"0.6528696",
"0.6518105",
"0.6488718",... | 0.7938666 | 0 |
Student users should be allowed to read a video detail. | def test_api_video_read_detail_student(self):
video = factories.VideoFactory()
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(video.id)
jwt_token.payload["roles"] = ["student"]
jwt_token.payload["permissions"] = {"can_update": False}
# Get the video link... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_read_detail_student_other_video(self):\n video = factories.VideoFactory()\n other_video = factories.VideoFactory()\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video.id)\n jwt_token.payload[\"roles\"] = [\"student\"]\n jwt_token... | [
"0.77192116",
"0.76491505",
"0.72210664",
"0.7193806",
"0.7081861",
"0.6968853",
"0.6946001",
"0.6945991",
"0.69299763",
"0.6855824",
"0.6855824",
"0.6855824",
"0.6855824",
"0.6759448",
"0.67415696",
"0.67221445",
"0.6707605",
"0.67072785",
"0.6676083",
"0.6661922",
"0.658580... | 0.7829443 | 0 |
Student users should not be allowed to read an other video detail. | def test_api_video_read_detail_student_other_video(self):
video = factories.VideoFactory()
other_video = factories.VideoFactory()
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(video.id)
jwt_token.payload["roles"] = ["student"]
jwt_token.payload["permiss... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_instructor_stop_live_in_read_only(self):\n video = factories.VideoFactory()\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video.id)\n jwt_token.payload[\"roles\"] = [random.choice([\"instructor\", \"administrator\"])]\n jwt_token.payloa... | [
"0.68723005",
"0.6841825",
"0.68202627",
"0.68037343",
"0.6803703",
"0.6772882",
"0.669885",
"0.66503114",
"0.66274035",
"0.6615674",
"0.65880245",
"0.6579541",
"0.6579541",
"0.6579541",
"0.6579541",
"0.64755404",
"0.6413001",
"0.6343338",
"0.6295471",
"0.62943876",
"0.625776... | 0.7542266 | 0 |
Administrator should be able to read detail of a video. | def test_api_video_read_detail_admin_token_user(self):
video = factories.VideoFactory(upload_state="pending")
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(video.id)
jwt_token.payload["roles"] = ["administrator"]
jwt_token.payload["permissions"] = {"can_update... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_read_detail_as_instructor_in_read_only(self):\n video = factories.VideoFactory(upload_state=\"ready\")\n\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video.id)\n jwt_token.payload[\"roles\"] = [random.choice([\"instructor\", \"administrator\"... | [
"0.72667783",
"0.7248215",
"0.724539",
"0.7145299",
"0.69024366",
"0.68745553",
"0.6792294",
"0.67524856",
"0.6726419",
"0.66639644",
"0.66468596",
"0.66436154",
"0.6616065",
"0.66096526",
"0.6606823",
"0.65604234",
"0.655605",
"0.65444875",
"0.654297",
"0.654297",
"0.654297"... | 0.7797226 | 0 |
An instructor with read_only can read the video. | def test_api_video_read_detail_as_instructor_in_read_only(self):
video = factories.VideoFactory(upload_state="ready")
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(video.id)
jwt_token.payload["roles"] = [random.choice(["instructor", "administrator"])]
jwt_toke... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_instructor_update_video_in_read_only(self):\n video = factories.VideoFactory()\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video.id)\n jwt_token.payload[\"roles\"] = [random.choice([\"instructor\", \"administrator\"])]\n jwt_token.pay... | [
"0.78120613",
"0.7801828",
"0.7753408",
"0.76392615",
"0.73789394",
"0.7361075",
"0.73445666",
"0.696438",
"0.67997307",
"0.6640954",
"0.6556021",
"0.6556021",
"0.6440155",
"0.6379832",
"0.6371906",
"0.6345719",
"0.63077706",
"0.63041294",
"0.6170134",
"0.6148974",
"0.6140088... | 0.7890069 | 0 |
Organization instructors cannot get individual videos. | def test_api_video_read_detail_by_organization_instructor(self):
user = factories.UserFactory()
organization = factories.OrganizationFactory()
factories.OrganizationAccessFactory(
role=models.INSTRUCTOR, organization=organization, user=user
)
playlist = factories.Play... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_read_detail_by_playlist_instructor(self):\n user = factories.UserFactory()\n playlist = factories.PlaylistFactory()\n factories.PlaylistAccessFactory(\n role=models.INSTRUCTOR, playlist=playlist, user=user\n )\n video = factories.VideoFactory(playlis... | [
"0.6985852",
"0.6923519",
"0.66638815",
"0.6577886",
"0.657624",
"0.6526222",
"0.65223634",
"0.6463818",
"0.6456685",
"0.6425402",
"0.637086",
"0.6344769",
"0.6339753",
"0.6317897",
"0.6305501",
"0.6288104",
"0.6274434",
"0.62424296",
"0.6220372",
"0.6208589",
"0.6198436",
... | 0.7348583 | 0 |
Organization admins can get individual videos. | def test_api_video_read_detail_by_organization_admin(self):
user = factories.UserFactory()
organization = factories.OrganizationFactory()
factories.OrganizationAccessFactory(
role=models.ADMINISTRATOR, organization=organization, user=user
)
playlist = factories.Playli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_videos(self, user):\n raise NotImplementedError",
"def test_api_video_read_detail_admin_token_user(self):\n video = factories.VideoFactory(upload_state=\"pending\")\n\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video.id)\n jwt_token.payload[\"... | [
"0.73484504",
"0.7175397",
"0.71452016",
"0.69996655",
"0.6980701",
"0.68412787",
"0.6815651",
"0.6759316",
"0.6683557",
"0.66611576",
"0.6650889",
"0.65989345",
"0.6590413",
"0.6569517",
"0.6551181",
"0.6532381",
"0.64478856",
"0.64394474",
"0.64296305",
"0.6418833",
"0.6417... | 0.7242058 | 1 |
Playlist instructors cannot get individual videos. | def test_api_video_read_detail_by_playlist_instructor(self):
user = factories.UserFactory()
playlist = factories.PlaylistFactory()
factories.PlaylistAccessFactory(
role=models.INSTRUCTOR, playlist=playlist, user=user
)
video = factories.VideoFactory(playlist=playlist)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_create_by_playlist_instructor(self):\n user = factories.UserFactory()\n playlist = factories.PlaylistFactory()\n factories.PlaylistAccessFactory(\n role=models.INSTRUCTOR, playlist=playlist, user=user\n )\n\n jwt_token = AccessToken()\n jwt_to... | [
"0.69824934",
"0.6929988",
"0.6903925",
"0.6848091",
"0.675491",
"0.6754253",
"0.6727395",
"0.6688385",
"0.66822577",
"0.6630101",
"0.6584742",
"0.65816694",
"0.65760905",
"0.6556829",
"0.6491526",
"0.64429015",
"0.63632977",
"0.63624156",
"0.6354106",
"0.63416207",
"0.633694... | 0.7451161 | 0 |
Playlist admins can get individual videos. | def test_api_video_read_detail_by_playlist_admin(self):
user = factories.UserFactory()
playlist = factories.PlaylistFactory()
factories.PlaylistAccessFactory(
role=models.ADMINISTRATOR, playlist=playlist, user=user
)
video = factories.VideoFactory(playlist=playlist)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_videos(self, user):\n raise NotImplementedError",
"def get_videos(self, **kwargs):\n return self.get('videos', **kwargs)",
"def test_api_video_read_detail_by_playlist_instructor(self):\n user = factories.UserFactory()\n playlist = factories.PlaylistFactory()\n factori... | [
"0.7135145",
"0.703523",
"0.6940554",
"0.6907681",
"0.68930846",
"0.6876141",
"0.6858856",
"0.6803101",
"0.67741567",
"0.6766813",
"0.6635837",
"0.66115814",
"0.6581768",
"0.6566544",
"0.65637964",
"0.65408224",
"0.6535902",
"0.65046424",
"0.6495713",
"0.6465653",
"0.6363963"... | 0.7393838 | 0 |
Anonymous users should not be able to read a list of videos. | def test_api_video_read_list_anonymous(self):
factories.VideoFactory()
response = self.client.get("/api/videos/")
self.assertEqual(response.status_code, 401) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_read_list_user_with_no_access(self):\n user = factories.UserFactory()\n # An organization with a playlist and one video\n organization = factories.OrganizationFactory()\n organization_playlist = factories.PlaylistFactory(organization=organization)\n factories.V... | [
"0.74291515",
"0.73096436",
"0.726217",
"0.7246792",
"0.70342964",
"0.702038",
"0.69500256",
"0.6940447",
"0.68673307",
"0.6716201",
"0.66994786",
"0.66682076",
"0.66605633",
"0.66389275",
"0.655753",
"0.65338016",
"0.6455463",
"0.64294",
"0.6427638",
"0.64255786",
"0.6423884... | 0.7925086 | 0 |
Token user lists videos. A token user associated to a video should be able to read a list of videos. It should however be empty as they have no rights on lists of videos. | def test_api_video_read_list_token_user(self):
video = factories.VideoFactory()
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(video.id)
jwt_token.payload["roles"] = [random.choice(["instructor", "administrator"])]
response = self.client.get(
"/api/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_read_list_user_with_no_access(self):\n user = factories.UserFactory()\n # An organization with a playlist and one video\n organization = factories.OrganizationFactory()\n organization_playlist = factories.PlaylistFactory(organization=organization)\n factories.V... | [
"0.77071524",
"0.7346989",
"0.73165256",
"0.7274928",
"0.7118793",
"0.6871098",
"0.68559235",
"0.6817096",
"0.67745465",
"0.6731404",
"0.6617363",
"0.66097164",
"0.66006595",
"0.66003925",
"0.65912527",
"0.6586762",
"0.65750706",
"0.65669465",
"0.6508241",
"0.6495908",
"0.642... | 0.82935464 | 0 |
Token user lists videos. A user with a user token, with no playlist or organization access should not get any videos in response to video list requests. | def test_api_video_read_list_user_with_no_access(self):
user = factories.UserFactory()
# An organization with a playlist and one video
organization = factories.OrganizationFactory()
organization_playlist = factories.PlaylistFactory(organization=organization)
factories.VideoFactor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_read_list_token_user(self):\n video = factories.VideoFactory()\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video.id)\n jwt_token.payload[\"roles\"] = [random.choice([\"instructor\", \"administrator\"])]\n\n response = self.client.get(... | [
"0.8137894",
"0.76997215",
"0.7500379",
"0.74775094",
"0.7421386",
"0.713168",
"0.68725115",
"0.68558246",
"0.68541175",
"0.67265236",
"0.6713042",
"0.66812503",
"0.6655873",
"0.6649719",
"0.65920895",
"0.65476424",
"0.65258986",
"0.646733",
"0.64574885",
"0.6454531",
"0.6420... | 0.79623353 | 1 |
Token user lists videos by playlist. A user with a user token, with no playlist or organization access should not get any videos in response to requests to list videos by playlist. | def test_api_video_read_list_by_playlist_user_with_no_access(self):
user = factories.UserFactory()
# A playlist, where the user has no access, with a video
playlist = factories.PlaylistFactory()
factories.VideoFactory(playlist=playlist)
jwt_token = AccessToken()
jwt_toke... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_read_list_by_org_user_with_playlist_access(self):\n user = factories.UserFactory()\n # The organization for both our playlists\n organization = factories.OrganizationFactory()\n # A playlist where the user has access, with a video\n first_playlist = factories.P... | [
"0.7729345",
"0.76431733",
"0.7578226",
"0.75642",
"0.7559772",
"0.75349516",
"0.737962",
"0.698339",
"0.6862935",
"0.67862123",
"0.6781404",
"0.67523485",
"0.6723117",
"0.67167056",
"0.67165977",
"0.67070335",
"0.66563934",
"0.6633195",
"0.6563979",
"0.655657",
"0.6524319",
... | 0.8043764 | 0 |
Token user with playlist access lists videos by playlist. A user with a user token, with a playlist access, can list videos for this playlist. | def test_api_video_read_list_by_playlist_user_with_playlist_access(self):
user = factories.UserFactory()
# A playlist where the user has access, with a video
first_playlist = factories.PlaylistFactory()
video = factories.VideoFactory(playlist=first_playlist)
factories.PlaylistAcc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_read_list_by_playlist_user_with_no_access(self):\n user = factories.UserFactory()\n # A playlist, where the user has no access, with a video\n playlist = factories.PlaylistFactory()\n factories.VideoFactory(playlist=playlist)\n\n jwt_token = AccessToken()\n ... | [
"0.76774764",
"0.75594276",
"0.7412642",
"0.73214406",
"0.7199213",
"0.715292",
"0.701453",
"0.7006564",
"0.69493055",
"0.68516415",
"0.68501836",
"0.6758553",
"0.67557037",
"0.6673234",
"0.66719925",
"0.65736467",
"0.65673375",
"0.6556012",
"0.65471566",
"0.6485248",
"0.6467... | 0.7567345 | 1 |
Token user with organization access lists videos by playlist. A user with a user token, with an organization access, can list videos for a playlist that belongs to that organization. | def test_api_video_read_list_by_playlist_user_with_org_access(self):
user = factories.UserFactory()
# An organization where the user has access, with a playlist with a video
first_organization = factories.OrganizationFactory()
first_playlist = factories.PlaylistFactory(organization=first... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_read_list_by_org_user_with_playlist_access(self):\n user = factories.UserFactory()\n # The organization for both our playlists\n organization = factories.OrganizationFactory()\n # A playlist where the user has access, with a video\n first_playlist = factories.P... | [
"0.78270674",
"0.7516018",
"0.74438334",
"0.7407343",
"0.73220646",
"0.72052467",
"0.7161178",
"0.71540946",
"0.71149313",
"0.6670339",
"0.6650545",
"0.6638368",
"0.6533789",
"0.65228236",
"0.64973193",
"0.6479345",
"0.64334834",
"0.6430823",
"0.6410075",
"0.64049196",
"0.639... | 0.7755571 | 1 |
Token user lists videos by organization. A user with a user token, with no playlist or organization access should not get any videos in response to requests to list videos by organization. | def test_api_video_read_list_by_org_user_with_no_access(self):
user = factories.UserFactory()
# An organization where the user has no access, with a playlist and a video
organization = factories.OrganizationFactory()
playlist = factories.PlaylistFactory(organization=organization)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_read_list_user_with_no_access(self):\n user = factories.UserFactory()\n # An organization with a playlist and one video\n organization = factories.OrganizationFactory()\n organization_playlist = factories.PlaylistFactory(organization=organization)\n factories.V... | [
"0.7234899",
"0.723068",
"0.7172236",
"0.7144934",
"0.71376234",
"0.70240456",
"0.6775386",
"0.66844714",
"0.663069",
"0.6592095",
"0.65653914",
"0.6534443",
"0.65151674",
"0.6382413",
"0.63076854",
"0.61993957",
"0.6136098",
"0.61165667",
"0.6113939",
"0.60279083",
"0.601806... | 0.7945807 | 0 |
Token user with playlist access lists videos by organization. A user with a user token, with a playlist access, can list videos for the organization linked to the playlist, and get only those they have access to, and not videos for other organization playlists. | def test_api_video_read_list_by_org_user_with_playlist_access(self):
user = factories.UserFactory()
# The organization for both our playlists
organization = factories.OrganizationFactory()
# A playlist where the user has access, with a video
first_playlist = factories.PlaylistFac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_read_list_by_org_user_with_no_access(self):\n user = factories.UserFactory()\n # An organization where the user has no access, with a playlist and a video\n organization = factories.OrganizationFactory()\n playlist = factories.PlaylistFactory(organization=organization... | [
"0.7847756",
"0.7695503",
"0.7336786",
"0.73048687",
"0.7282577",
"0.72679955",
"0.71736246",
"0.71504295",
"0.71386516",
"0.66861737",
"0.6678597",
"0.65941375",
"0.6512389",
"0.64688975",
"0.6465992",
"0.63793784",
"0.6371361",
"0.63064885",
"0.6275559",
"0.624483",
"0.6223... | 0.77442944 | 1 |
A video with a custom thumbnail should have it in its payload. | def test_api_video_with_a_thumbnail(self):
video = factories.VideoFactory(
pk="38a91911-9aee-41e2-94dd-573abda6f48f",
uploaded_on=datetime(2018, 8, 8, tzinfo=pytz.utc),
upload_state="ready",
resolutions=[144, 240, 480, 720, 1080],
)
thumbnail = fac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_thumbnail(self):\r\n raise Exception('get_thumbnail is Not Implemented in base class \"Video\"')",
"def test_video_thumbnail(self):\n data = TestData().load_users().load_galleries()\n album = data.gallery_b7w.top_album\n\n video1 = Video.objects.create(album=album, uid='564335... | [
"0.7255591",
"0.68448323",
"0.6805096",
"0.6709165",
"0.6560292",
"0.6480108",
"0.645797",
"0.634748",
"0.6341677",
"0.63176954",
"0.62691045",
"0.620469",
"0.61994827",
"0.6197579",
"0.6093951",
"0.6034249",
"0.6017591",
"0.60166705",
"0.60127455",
"0.60110307",
"0.60110307"... | 0.70033854 | 1 |
Anonymous users should not be able to create a new video. | def test_api_video_create_anonymous(self):
response = self.client.post("/api/videos/")
self.assertEqual(response.status_code, 401)
self.assertFalse(models.Video.objects.exists()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_start_live_anonymous_user(self):\n video = factories.VideoFactory()\n\n response = self.client.post(f\"/api/videos/{video.id}/start-live/\")\n\n self.assertEqual(response.status_code, 401)\n content = json.loads(response.content)\n self.assertEqual(\n ... | [
"0.7518611",
"0.7517492",
"0.723873",
"0.7193041",
"0.7180564",
"0.70487976",
"0.70487976",
"0.70487976",
"0.70487976",
"0.70405054",
"0.70276767",
"0.69517565",
"0.6888078",
"0.6872002",
"0.6847452",
"0.6826859",
"0.6801186",
"0.67506117",
"0.66722685",
"0.66594905",
"0.6644... | 0.8091542 | 0 |
A token user should not be able to create a video. | def test_api_video_create_token_user_playlist_preexists(self):
jwt_token = AccessToken()
response = self.client.post(
"/api/videos/", HTTP_AUTHORIZATION=f"Bearer {jwt_token}"
)
self.assertEqual(response.status_code, 401)
self.assertFalse(models.Video.objects.exists()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_video(self, video_id):\n print(\"allow_video needs implementation\")",
"def allow_video(self, video_id):\n print(\"allow_video needs implementation\")",
"def allow_video(self, video_id):\n print(\"allow_video needs implementation\")",
"def allow_video(self, video_id):\n ... | [
"0.71655995",
"0.71655995",
"0.71655995",
"0.71655995",
"0.71101284",
"0.70728594",
"0.7002403",
"0.69914967",
"0.6853782",
"0.6809929",
"0.6792771",
"0.67722046",
"0.6656002",
"0.6636882",
"0.65585196",
"0.6522827",
"0.6483365",
"0.647309",
"0.6472502",
"0.64611095",
"0.6455... | 0.7331362 | 0 |
Create video with playlist admin access. Users with an administrator role on a playlist should be able to create videos for it. | def test_api_video_create_by_playlist_admin(self):
user = factories.UserFactory()
playlist = factories.PlaylistFactory()
factories.PlaylistAccessFactory(
role=models.ADMINISTRATOR, playlist=playlist, user=user
)
jwt_token = AccessToken()
jwt_token.payload["re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_create_by_playlist_instructor(self):\n user = factories.UserFactory()\n playlist = factories.PlaylistFactory()\n factories.PlaylistAccessFactory(\n role=models.INSTRUCTOR, playlist=playlist, user=user\n )\n\n jwt_token = AccessToken()\n jwt_to... | [
"0.75861186",
"0.750529",
"0.7196349",
"0.7154345",
"0.7048696",
"0.7024012",
"0.6778527",
"0.6743994",
"0.6735749",
"0.67342067",
"0.66556185",
"0.664607",
"0.65224504",
"0.64589846",
"0.638393",
"0.63770294",
"0.6373901",
"0.6350999",
"0.63463885",
"0.63361675",
"0.6328121"... | 0.787398 | 0 |
Create video for nonexistet playlist. Requests with a UUID that does not match an existing playlist should fail. | def test_api_video_create_for_nonexistent_playlist(self):
user = factories.UserFactory()
some_uuid = uuid.uuid4()
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(user.id)
jwt_token.payload["user"] = {
"id": str(user.id),
"username": user.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_create_by_playlist_admin_missing_title(self):\n user = factories.UserFactory()\n playlist = factories.PlaylistFactory()\n factories.PlaylistAccessFactory(\n role=models.ADMINISTRATOR, playlist=playlist, user=user\n )\n\n jwt_token = AccessToken()\n ... | [
"0.72052264",
"0.7105395",
"0.7066762",
"0.70011044",
"0.66983753",
"0.66168976",
"0.65598804",
"0.6551482",
"0.65437996",
"0.6524763",
"0.6413801",
"0.6382136",
"0.6374356",
"0.6372513",
"0.6344202",
"0.6306415",
"0.63000864",
"0.6268771",
"0.6267432",
"0.62382084",
"0.61997... | 0.8363678 | 0 |
Create video with playlist instructor access. Users with an instructor role on a playlist should not be able to create videos for it. | def test_api_video_create_by_playlist_instructor(self):
user = factories.UserFactory()
playlist = factories.PlaylistFactory()
factories.PlaylistAccessFactory(
role=models.INSTRUCTOR, playlist=playlist, user=user
)
jwt_token = AccessToken()
jwt_token.payload["... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_create_by_organization_instructor(self):\n user = factories.UserFactory()\n organization = factories.OrganizationFactory()\n factories.OrganizationAccessFactory(\n role=models.INSTRUCTOR, organization=organization, user=user\n )\n playlist = factorie... | [
"0.75892025",
"0.7581382",
"0.74329114",
"0.7397538",
"0.7346463",
"0.7334768",
"0.7333738",
"0.7322326",
"0.71918404",
"0.7066312",
"0.7046406",
"0.7034783",
"0.7022861",
"0.68786216",
"0.68428534",
"0.68343306",
"0.6793342",
"0.6676078",
"0.6651619",
"0.6643212",
"0.6640189... | 0.84034836 | 0 |
Create video with organization admin access. Users with an administrator role on an organization should be able to create videos for playlists linked to that organization. | def test_api_video_create_by_organization_admin(self):
user = factories.UserFactory()
organization = factories.OrganizationFactory()
factories.OrganizationAccessFactory(
role=models.ADMINISTRATOR, organization=organization, user=user
)
playlist = factories.PlaylistFac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_create_by_organization_instructor(self):\n user = factories.UserFactory()\n organization = factories.OrganizationFactory()\n factories.OrganizationAccessFactory(\n role=models.INSTRUCTOR, organization=organization, user=user\n )\n playlist = factorie... | [
"0.74074167",
"0.7187204",
"0.6961998",
"0.69020414",
"0.6707978",
"0.6615864",
"0.6593332",
"0.6563925",
"0.65150845",
"0.64788765",
"0.6315069",
"0.6277774",
"0.6168648",
"0.6164548",
"0.61554104",
"0.61287636",
"0.6122068",
"0.60594267",
"0.6052898",
"0.6051739",
"0.604131... | 0.77916455 | 0 |
Create video with organization instructor access. Users with an instructor role on an organization should not be able to create videos for playlists linked to that organization. | def test_api_video_create_by_organization_instructor(self):
user = factories.UserFactory()
organization = factories.OrganizationFactory()
factories.OrganizationAccessFactory(
role=models.INSTRUCTOR, organization=organization, user=user
)
playlist = factories.PlaylistF... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_create_by_playlist_instructor(self):\n user = factories.UserFactory()\n playlist = factories.PlaylistFactory()\n factories.PlaylistAccessFactory(\n role=models.INSTRUCTOR, playlist=playlist, user=user\n )\n\n jwt_token = AccessToken()\n jwt_to... | [
"0.75475234",
"0.7496796",
"0.7394882",
"0.73466456",
"0.7210241",
"0.70491546",
"0.6981583",
"0.6885261",
"0.6853094",
"0.68352956",
"0.6833089",
"0.68286544",
"0.68155456",
"0.6809151",
"0.67442113",
"0.6729523",
"0.6711928",
"0.67001057",
"0.66613644",
"0.6601123",
"0.6575... | 0.82360256 | 0 |
Token users should be able to update the title of their video through the API. | def test_api_video_update_detail_token_user_title(self):
video = factories.VideoFactory(title="my title")
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(video.id)
jwt_token.payload["roles"] = [random.choice(["instructor", "administrator"])]
jwt_token.payload["pe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_update_detail_token_user_other_video(self):\n video_token = factories.VideoFactory()\n video_update = factories.VideoFactory(title=\"my title\")\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video_token.id)\n jwt_token.payload[\"roles\"... | [
"0.71058893",
"0.69186246",
"0.6890603",
"0.6838888",
"0.6716942",
"0.66088134",
"0.6500527",
"0.6499458",
"0.6489213",
"0.6375685",
"0.63624287",
"0.6358379",
"0.6299847",
"0.6240518",
"0.62242156",
"0.6209965",
"0.61948925",
"0.6190319",
"0.6047108",
"0.6038434",
"0.6024274... | 0.7980532 | 0 |
Token users should be able to update the description of their video through the API. | def test_api_video_update_detail_token_user_description(self):
video = factories.VideoFactory(description="my description")
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(video.id)
jwt_token.payload["roles"] = [random.choice(["instructor", "administrator"])]
jwt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_patch_detail_token_user_description(self):\n video = factories.VideoFactory(description=\"my description\")\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video.id)\n jwt_token.payload[\"roles\"] = [random.choice([\"instructor\", \"administrato... | [
"0.7898467",
"0.7254919",
"0.71641284",
"0.6773774",
"0.6621548",
"0.6524916",
"0.65170246",
"0.65112776",
"0.6465437",
"0.6373505",
"0.6323479",
"0.62960017",
"0.6289151",
"0.6275244",
"0.62615156",
"0.62241244",
"0.6167657",
"0.6135732",
"0.6128793",
"0.6126181",
"0.6126181... | 0.7858695 | 1 |
Token users trying to update "uploaded_on" through the API should be ignored. | def test_api_video_update_detail_token_user_uploaded_on(self):
video = factories.VideoFactory()
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(video.id)
jwt_token.payload["roles"] = [random.choice(["instructor", "administrator"])]
jwt_token.payload["permissions"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_date(self):\n return self.proto.details.appDetails.uploadDate",
"def upload_date(self, upload_date):\n\n self._upload_date = upload_date",
"def notify_upload():\n file_type = request.json.get(\"file_type\")\n file_name = request.json.get(\"file_name\")\n file_path = request.js... | [
"0.5344835",
"0.53088033",
"0.517072",
"0.51040184",
"0.50775427",
"0.5058975",
"0.5042663",
"0.50412685",
"0.503164",
"0.49805394",
"0.49700323",
"0.49673027",
"0.49210966",
"0.4905573",
"0.48283792",
"0.48200735",
"0.4801774",
"0.48001504",
"0.47981024",
"0.4765691",
"0.474... | 0.6060195 | 0 |
Token users should be able to update "upload_state" of their video through the API. | def test_api_video_update_detail_token_user_upload_state(self):
video = factories.VideoFactory()
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(video.id)
jwt_token.payload["roles"] = [random.choice(["instructor", "administrator"])]
jwt_token.payload["permissions... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_update_detail_token_user_uploaded_on(self):\n video = factories.VideoFactory()\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video.id)\n jwt_token.payload[\"roles\"] = [random.choice([\"instructor\", \"administrator\"])]\n jwt_token.pay... | [
"0.67499",
"0.6354236",
"0.631901",
"0.6289364",
"0.6169155",
"0.60672176",
"0.60607606",
"0.60287404",
"0.5962965",
"0.5961862",
"0.59457076",
"0.5938787",
"0.5930499",
"0.5830272",
"0.5817497",
"0.58067745",
"0.58067745",
"0.58067745",
"0.58067745",
"0.57983184",
"0.5792360... | 0.7711575 | 0 |
An instructor with read_only set to true should not be able to update the video. | def test_api_video_instructor_update_video_in_read_only(self):
video = factories.VideoFactory()
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(video.id)
jwt_token.payload["roles"] = [random.choice(["instructor", "administrator"])]
jwt_token.payload["permissions"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_instructor_patch_video_in_read_only(self):\n video = factories.VideoFactory()\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video.id)\n jwt_token.payload[\"roles\"] = [random.choice([\"instructor\", \"administrator\"])]\n jwt_token.payl... | [
"0.7994614",
"0.7717373",
"0.7623005",
"0.7427783",
"0.7336873",
"0.7251569",
"0.7188667",
"0.6536233",
"0.6536233",
"0.6478594",
"0.64371014",
"0.64050823",
"0.61649084",
"0.6105558",
"0.6060008",
"0.6038414",
"0.6021408",
"0.6020713",
"0.6020713",
"0.6020713",
"0.6020713",
... | 0.7989306 | 1 |
An instructor with read_only set to true should not be able to patch the video. | def test_api_video_instructor_patch_video_in_read_only(self):
video = factories.VideoFactory()
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(video.id)
jwt_token.payload["roles"] = [random.choice(["instructor", "administrator"])]
jwt_token.payload["permissions"]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_instructor_update_video_in_read_only(self):\n video = factories.VideoFactory()\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video.id)\n jwt_token.payload[\"roles\"] = [random.choice([\"instructor\", \"administrator\"])]\n jwt_token.pay... | [
"0.7835161",
"0.7628183",
"0.7538613",
"0.7433359",
"0.7244842",
"0.72301745",
"0.71336174",
"0.6627078",
"0.63714683",
"0.6348369",
"0.6348369",
"0.62261164",
"0.6191083",
"0.6177349",
"0.61437786",
"0.6087502",
"0.60079575",
"0.5992944",
"0.5976551",
"0.59688693",
"0.593983... | 0.810327 | 0 |
Token users trying to update the ID of a video they own should be ignored. | def test_api_video_update_detail_token_user_id(self):
video = factories.VideoFactory()
original_id = video.id
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(video.id)
jwt_token.payload["roles"] = [random.choice(["instructor", "administrator"])]
jwt_token... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_video(self, video_id):\n print(\"allow_video needs implementation\")",
"def allow_video(self, video_id):\n print(\"allow_video needs implementation\")",
"def allow_video(self, video_id):\n print(\"allow_video needs implementation\")",
"def allow_video(self, video_id):\n ... | [
"0.67311645",
"0.67311645",
"0.67311645",
"0.67311645",
"0.63774544",
"0.6365089",
"0.63643706",
"0.6241608",
"0.61102444",
"0.6060896",
"0.6041901",
"0.6017386",
"0.60055894",
"0.59528",
"0.58717775",
"0.5854971",
"0.58199215",
"0.58020496",
"0.5792169",
"0.5768806",
"0.5760... | 0.67851055 | 0 |
Token users should not be allowed to update another video through the API. | def test_api_video_update_detail_token_user_other_video(self):
video_token = factories.VideoFactory()
video_update = factories.VideoFactory(title="my title")
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(video_token.id)
jwt_token.payload["roles"] = [random.choi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_instructor_patch_video_in_read_only(self):\n video = factories.VideoFactory()\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video.id)\n jwt_token.payload[\"roles\"] = [random.choice([\"instructor\", \"administrator\"])]\n jwt_token.payl... | [
"0.72053033",
"0.7190358",
"0.7015854",
"0.7015854",
"0.7015854",
"0.7015854",
"0.6809881",
"0.66638553",
"0.66326624",
"0.6631038",
"0.66227055",
"0.6596263",
"0.6568623",
"0.65449584",
"0.65309715",
"0.6520454",
"0.65118587",
"0.64937705",
"0.64709437",
"0.6457512",
"0.6406... | 0.72953665 | 0 |
Token users should be able to patch fields on their video through the API. | def test_api_video_patch_detail_token_user_description(self):
video = factories.VideoFactory(description="my description")
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(video.id)
jwt_token.payload["roles"] = [random.choice(["instructor", "administrator"])]
jwt_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_patch_detail_token_user_stamp(self):\n video = factories.VideoFactory()\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video.id)\n jwt_token.payload[\"roles\"] = [random.choice([\"instructor\", \"administrator\"])]\n jwt_token.payload[\"... | [
"0.72810006",
"0.72702473",
"0.70388633",
"0.70271647",
"0.69907844",
"0.67510474",
"0.67251325",
"0.6676425",
"0.6523723",
"0.63867545",
"0.636884",
"0.62796825",
"0.62796825",
"0.62796825",
"0.62796825",
"0.6274171",
"0.6268003",
"0.6266477",
"0.6260588",
"0.6239086",
"0.62... | 0.7310165 | 0 |
Organization instructors cannot patch videos on the API. | def test_api_video_patch_by_organization_instructor(self):
user = factories.UserFactory()
organization = factories.OrganizationFactory()
factories.OrganizationAccessFactory(
role=models.INSTRUCTOR, organization=organization, user=user
)
playlist = factories.PlaylistFa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_instructor_patch_video_in_read_only(self):\n video = factories.VideoFactory()\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video.id)\n jwt_token.payload[\"roles\"] = [random.choice([\"instructor\", \"administrator\"])]\n jwt_token.payl... | [
"0.7449344",
"0.72959185",
"0.7241029",
"0.7236999",
"0.71724576",
"0.7107737",
"0.7106177",
"0.7060964",
"0.7046788",
"0.6969289",
"0.6962921",
"0.69118744",
"0.678903",
"0.6774365",
"0.67516744",
"0.6656709",
"0.6642363",
"0.66410923",
"0.6615892",
"0.6614583",
"0.6604988",... | 0.7543672 | 0 |
Organization admins can patch videos on the API. | def test_api_video_patch_by_organization_admin(self):
user = factories.UserFactory()
organization = factories.OrganizationFactory()
factories.OrganizationAccessFactory(
role=models.ADMINISTRATOR, organization=organization, user=user
)
playlist = factories.PlaylistFact... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_patch_by_playlist_admin(self):\n user = factories.UserFactory()\n playlist = factories.PlaylistFactory()\n factories.PlaylistAccessFactory(\n role=models.ADMINISTRATOR, playlist=playlist, user=user\n )\n video = factories.VideoFactory(playlist=playli... | [
"0.74778765",
"0.7212643",
"0.7073324",
"0.70417696",
"0.6987859",
"0.68969965",
"0.68704474",
"0.6866605",
"0.68553925",
"0.679984",
"0.6756558",
"0.6756558",
"0.6756558",
"0.6756558",
"0.6748033",
"0.6502928",
"0.64885527",
"0.64757943",
"0.64052916",
"0.63534415",
"0.63406... | 0.7490647 | 0 |
Playlist instructors cannot patch videos on the API. | def test_api_video_patch_by_playlist_instructor(self):
user = factories.UserFactory()
playlist = factories.PlaylistFactory()
factories.PlaylistAccessFactory(
role=models.INSTRUCTOR, playlist=playlist, user=user
)
video = factories.VideoFactory(playlist=playlist, title... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_put_by_playlist_instructor(self):\n user = factories.UserFactory()\n playlist = factories.PlaylistFactory()\n factories.PlaylistAccessFactory(\n role=models.INSTRUCTOR, playlist=playlist, user=user\n )\n video = factories.VideoFactory(playlist=playli... | [
"0.7527763",
"0.736974",
"0.731752",
"0.7310658",
"0.713124",
"0.70823216",
"0.7037442",
"0.6971554",
"0.6954967",
"0.6899631",
"0.6872983",
"0.68574077",
"0.68474174",
"0.6814588",
"0.6805894",
"0.6732668",
"0.6705562",
"0.6668511",
"0.66544557",
"0.6578779",
"0.6518929",
... | 0.79408705 | 0 |
Playlist admins can patch videos on the API. | def test_api_video_patch_by_playlist_admin(self):
user = factories.UserFactory()
playlist = factories.PlaylistFactory()
factories.PlaylistAccessFactory(
role=models.ADMINISTRATOR, playlist=playlist, user=user
)
video = factories.VideoFactory(playlist=playlist, title="... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_put_by_playlist_admin(self):\n user = factories.UserFactory()\n playlist = factories.PlaylistFactory()\n factories.PlaylistAccessFactory(\n role=models.ADMINISTRATOR, playlist=playlist, user=user\n )\n video = factories.VideoFactory(playlist=playlist... | [
"0.75601876",
"0.744614",
"0.71700025",
"0.70813483",
"0.6962126",
"0.69198686",
"0.67094886",
"0.6689492",
"0.6571177",
"0.6556397",
"0.65422446",
"0.6532941",
"0.64877856",
"0.638901",
"0.6368514",
"0.6278913",
"0.62118214",
"0.6196089",
"0.6196089",
"0.6196089",
"0.6196089... | 0.8081759 | 0 |
Organization admins can update videos on the API. | def test_api_video_put_by_organization_admin(self):
user = factories.UserFactory()
organization = factories.OrganizationFactory()
factories.OrganizationAccessFactory(
role=models.ADMINISTRATOR, organization=organization, user=user
)
playlist = factories.PlaylistFactor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_patch_by_organization_admin(self):\n user = factories.UserFactory()\n organization = factories.OrganizationFactory()\n factories.OrganizationAccessFactory(\n role=models.ADMINISTRATOR, organization=organization, user=user\n )\n playlist = factories.P... | [
"0.738663",
"0.7271741",
"0.7230137",
"0.7186168",
"0.7119065",
"0.703114",
"0.6818546",
"0.67651224",
"0.67485434",
"0.67432576",
"0.6655843",
"0.65842193",
"0.6566064",
"0.65500546",
"0.6486587",
"0.6465802",
"0.64454246",
"0.64454246",
"0.64454246",
"0.64454246",
"0.644080... | 0.7437087 | 0 |
Playlist instructors cannot update videos on the API. | def test_api_video_put_by_playlist_instructor(self):
user = factories.UserFactory()
playlist = factories.PlaylistFactory()
factories.PlaylistAccessFactory(
role=models.INSTRUCTOR, playlist=playlist, user=user
)
video = factories.VideoFactory(playlist=playlist, title="... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_patch_by_playlist_instructor(self):\n user = factories.UserFactory()\n playlist = factories.PlaylistFactory()\n factories.PlaylistAccessFactory(\n role=models.INSTRUCTOR, playlist=playlist, user=user\n )\n video = factories.VideoFactory(playlist=play... | [
"0.7417446",
"0.72065353",
"0.7187968",
"0.7017262",
"0.7001922",
"0.69166565",
"0.6850352",
"0.67769",
"0.6752651",
"0.6732421",
"0.67295367",
"0.6722537",
"0.67067736",
"0.66103035",
"0.6603168",
"0.65991",
"0.65834934",
"0.642462",
"0.6390254",
"0.63902324",
"0.6382769",
... | 0.7353888 | 1 |
Playlist admins can update videos on the API. | def test_api_video_put_by_playlist_admin(self):
user = factories.UserFactory()
playlist = factories.PlaylistFactory()
factories.PlaylistAccessFactory(
role=models.ADMINISTRATOR, playlist=playlist, user=user
)
video = factories.VideoFactory(playlist=playlist, title="ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_patch_by_playlist_admin(self):\n user = factories.UserFactory()\n playlist = factories.PlaylistFactory()\n factories.PlaylistAccessFactory(\n role=models.ADMINISTRATOR, playlist=playlist, user=user\n )\n video = factories.VideoFactory(playlist=playli... | [
"0.7676948",
"0.7044113",
"0.7030785",
"0.6968851",
"0.68352896",
"0.6806975",
"0.67735475",
"0.6741683",
"0.6685472",
"0.6677833",
"0.6616904",
"0.63343596",
"0.63147634",
"0.62914306",
"0.62423277",
"0.62357444",
"0.6227441",
"0.619493",
"0.6181129",
"0.61579746",
"0.613367... | 0.77188545 | 0 |
Anonymous users should not be allowed to delete a video. | def test_api_video_delete_detail_anonymous(self):
video = factories.VideoFactory()
response = self.client.delete(f"/api/videos/{video.id}/")
self.assertEqual(response.status_code, 401)
content = json.loads(response.content)
self.assertEqual(
content, {"detail": "Authe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_delete_list_anonymous(self):\n video = factories.VideoFactory()\n\n response = self.client.delete(\"/api/videos/\")\n\n self.assertEqual(response.status_code, 401)\n self.assertTrue(models.Video.objects.filter(id=video.id).exists())",
"def test_api_video_instructor_... | [
"0.76706326",
"0.7435972",
"0.720408",
"0.7126261",
"0.6922122",
"0.67781585",
"0.6648821",
"0.6646291",
"0.6605605",
"0.6597557",
"0.65294874",
"0.65240765",
"0.64507365",
"0.64186287",
"0.6417488",
"0.6412194",
"0.6401552",
"0.63996375",
"0.6395154",
"0.63873255",
"0.632586... | 0.7583065 | 1 |
A token user associated to a video should not be able to delete it or any other. | def test_api_video_delete_detail_token_user(self):
videos = factories.VideoFactory.create_batch(2)
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(videos[0].id)
jwt_token.payload["roles"] = [random.choice(["instructor", "administrator"])]
jwt_token.payload["permi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_delete_list_token_user(self):\n video = factories.VideoFactory()\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video.id)\n jwt_token.payload[\"roles\"] = [random.choice([\"instructor\", \"administrator\"])]\n\n response = self.client.de... | [
"0.76225233",
"0.67427945",
"0.6721439",
"0.65619546",
"0.6526045",
"0.6485572",
"0.63830703",
"0.63552004",
"0.63367045",
"0.6314902",
"0.62399644",
"0.622156",
"0.62130153",
"0.61751115",
"0.61576045",
"0.61483705",
"0.6142432",
"0.6111678",
"0.6098914",
"0.6091557",
"0.607... | 0.69653267 | 1 |
Delete video by playlist admin. Users with an administrator role on a playlist should be able to delete videos. | def test_api_video_delete_by_playlist_admin(self):
user = factories.UserFactory()
playlist = factories.PlaylistFactory()
factories.PlaylistAccessFactory(
role=models.ADMINISTRATOR, playlist=playlist, user=user
)
video = factories.VideoFactory(playlist=playlist)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_delete_by_playlist_instructor(self):\n user = factories.UserFactory()\n playlist = factories.PlaylistFactory()\n factories.PlaylistAccessFactory(\n role=models.INSTRUCTOR, playlist=playlist, user=user\n )\n video = factories.VideoFactory(playlist=pla... | [
"0.7377662",
"0.7306616",
"0.69978887",
"0.6918622",
"0.6898269",
"0.66285527",
"0.6609409",
"0.65778285",
"0.6537609",
"0.64484113",
"0.6395572",
"0.63861233",
"0.6345431",
"0.6339101",
"0.6332678",
"0.6327009",
"0.6277393",
"0.6266375",
"0.62546194",
"0.62486726",
"0.624749... | 0.82642883 | 0 |
Delete video by playlist instructor. Users with an instructor role on a playlist should not be able to delete videos. | def test_api_video_delete_by_playlist_instructor(self):
user = factories.UserFactory()
playlist = factories.PlaylistFactory()
factories.PlaylistAccessFactory(
role=models.INSTRUCTOR, playlist=playlist, user=user
)
video = factories.VideoFactory(playlist=playlist)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_delete_by_playlist_admin(self):\n user = factories.UserFactory()\n playlist = factories.PlaylistFactory()\n factories.PlaylistAccessFactory(\n role=models.ADMINISTRATOR, playlist=playlist, user=user\n )\n video = factories.VideoFactory(playlist=playl... | [
"0.783691",
"0.7712287",
"0.76210546",
"0.6899773",
"0.68544215",
"0.6854162",
"0.684795",
"0.6693378",
"0.6625509",
"0.66108775",
"0.65942025",
"0.649926",
"0.63657904",
"0.63445437",
"0.6341959",
"0.63409513",
"0.6330678",
"0.631385",
"0.62589604",
"0.6242751",
"0.62074214"... | 0.85299826 | 0 |
Delete video by organization admin. Users with an administrator role on an organization should be able to delete videos from playlists linked to that organization. | def test_api_video_delete_by_organization_admin(self):
user = factories.UserFactory()
organization = factories.OrganizationFactory()
factories.OrganizationAccessFactory(
role=models.ADMINISTRATOR, organization=organization, user=user
)
playlist = factories.PlaylistFac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_delete_by_organization_instructor(self):\n user = factories.UserFactory()\n organization = factories.OrganizationFactory()\n factories.OrganizationAccessFactory(\n role=models.INSTRUCTOR, organization=organization, user=user\n )\n playlist = factorie... | [
"0.7363307",
"0.71274513",
"0.6789173",
"0.6573702",
"0.64703196",
"0.6456123",
"0.63720113",
"0.6315748",
"0.6262695",
"0.6224453",
"0.62183523",
"0.62079686",
"0.61958545",
"0.6189795",
"0.61042595",
"0.6074719",
"0.59769017",
"0.5897051",
"0.5826217",
"0.58166444",
"0.5746... | 0.82358515 | 0 |
Delete video by organization instructor. Users with an instructor role on an organization should not be able to delete videos from playlists linked to that organization. | def test_api_video_delete_by_organization_instructor(self):
user = factories.UserFactory()
organization = factories.OrganizationFactory()
factories.OrganizationAccessFactory(
role=models.INSTRUCTOR, organization=organization, user=user
)
playlist = factories.PlaylistF... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_delete_by_organization_admin(self):\n user = factories.UserFactory()\n organization = factories.OrganizationFactory()\n factories.OrganizationAccessFactory(\n role=models.ADMINISTRATOR, organization=organization, user=user\n )\n playlist = factories.... | [
"0.7808661",
"0.76890737",
"0.7232688",
"0.7024869",
"0.6739671",
"0.66469806",
"0.66206694",
"0.65944266",
"0.64719003",
"0.64104754",
"0.6393577",
"0.6341296",
"0.6280718",
"0.6166984",
"0.6058465",
"0.5991598",
"0.59785825",
"0.59677184",
"0.5942569",
"0.59305525",
"0.5926... | 0.84259385 | 0 |
An instructor with read_only set to true should not be able to delete the video. | def test_api_video_instructor_delete_video_in_read_only(self):
video = factories.VideoFactory()
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(video.id)
jwt_token.payload["roles"] = [random.choice(["instructor", "administrator"])]
jwt_token.payload["permissions"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_instructor_patch_video_in_read_only(self):\n video = factories.VideoFactory()\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video.id)\n jwt_token.payload[\"roles\"] = [random.choice([\"instructor\", \"administrator\"])]\n jwt_token.payl... | [
"0.7613681",
"0.7583725",
"0.7567013",
"0.72148806",
"0.7189052",
"0.71594507",
"0.68974364",
"0.6738738",
"0.64294946",
"0.6361907",
"0.63537663",
"0.6330556",
"0.6252621",
"0.6208605",
"0.6178245",
"0.61604446",
"0.6099036",
"0.6094544",
"0.6091386",
"0.6071828",
"0.6050001... | 0.8370727 | 0 |
Anonymous users should not be able to delete a list of videos. | def test_api_video_delete_list_anonymous(self):
video = factories.VideoFactory()
response = self.client.delete("/api/videos/")
self.assertEqual(response.status_code, 401)
self.assertTrue(models.Video.objects.filter(id=video.id).exists()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_delete_list_token_user(self):\n video = factories.VideoFactory()\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video.id)\n jwt_token.payload[\"roles\"] = [random.choice([\"instructor\", \"administrator\"])]\n\n response = self.client.de... | [
"0.7819879",
"0.7356904",
"0.73555815",
"0.728072",
"0.7116747",
"0.7066538",
"0.6826814",
"0.6821618",
"0.68036747",
"0.67950904",
"0.67938817",
"0.66408694",
"0.6586094",
"0.6543807",
"0.64909613",
"0.64587444",
"0.6442003",
"0.6433446",
"0.64317626",
"0.6429051",
"0.641341... | 0.8196343 | 0 |
A token user associated to a video should not be able to delete a list of videos. | def test_api_video_delete_list_token_user(self):
video = factories.VideoFactory()
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(video.id)
jwt_token.payload["roles"] = [random.choice(["instructor", "administrator"])]
response = self.client.delete(
"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_delete_detail_token_user(self):\n videos = factories.VideoFactory.create_batch(2)\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(videos[0].id)\n jwt_token.payload[\"roles\"] = [random.choice([\"instructor\", \"administrator\"])]\n jwt_to... | [
"0.75610733",
"0.7093646",
"0.69971454",
"0.6987593",
"0.6938101",
"0.69353217",
"0.6874265",
"0.6659091",
"0.6583686",
"0.6577294",
"0.6563314",
"0.65278184",
"0.6502904",
"0.6467501",
"0.6417053",
"0.6376075",
"0.6346129",
"0.63193774",
"0.63192755",
"0.63076013",
"0.624566... | 0.8347647 | 0 |
Anonymous users are not allowed to initiate an upload. | def test_api_video_initiate_upload_anonymous_user(self):
video = factories.VideoFactory()
response = self.client.post(f"/api/videos/{video.id}/initiate-upload/")
self.assertEqual(response.status_code, 401)
content = json.loads(response.content)
self.assertEqual(
con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_un_logged_in_user_can_not_upload_picture(self):\n tmp_file = generate_image_for_testing()\n response = self.client.post(self.user_passport_url,\n data={'passport': tmp_file})\n\n self.assertEqual(403, response.status_code)",
"def before_request() -... | [
"0.65225494",
"0.6377274",
"0.630315",
"0.6288772",
"0.625877",
"0.625877",
"0.6102276",
"0.6055644",
"0.6006573",
"0.5952744",
"0.5910054",
"0.5873302",
"0.5849557",
"0.58321625",
"0.5818277",
"0.58163744",
"0.57951754",
"0.57888645",
"0.5754535",
"0.57416034",
"0.5727734",
... | 0.68287516 | 0 |
An instructor with read_only set to true should not be able to initiate an upload. | def test_api_video_instructor_initiate_upload_in_read_only(self):
video = factories.VideoFactory()
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(video.id)
jwt_token.payload["roles"] = [random.choice(["instructor", "administrator"])]
jwt_token.payload["permissio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_instructor_patch_video_in_read_only(self):\n video = factories.VideoFactory()\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video.id)\n jwt_token.payload[\"roles\"] = [random.choice([\"instructor\", \"administrator\"])]\n jwt_token.payl... | [
"0.6711686",
"0.6707239",
"0.6479562",
"0.62904096",
"0.62904096",
"0.6278664",
"0.6251343",
"0.62384546",
"0.605488",
"0.6023053",
"0.6010459",
"0.59765995",
"0.59759665",
"0.59759665",
"0.59759665",
"0.59759665",
"0.5961211",
"0.5961211",
"0.59001",
"0.589749",
"0.58929425"... | 0.7533952 | 0 |
Anonymous users are not allowed to initiate a live. | def test_api_video_initiate_live_anonymous_user(self):
video = factories.VideoFactory()
response = self.client.post(f"/api/videos/{video.id}/initiate-live/")
self.assertEqual(response.status_code, 401)
content = json.loads(response.content)
self.assertEqual(
content... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_start_live_anonymous_user(self):\n video = factories.VideoFactory()\n\n response = self.client.post(f\"/api/videos/{video.id}/start-live/\")\n\n self.assertEqual(response.status_code, 401)\n content = json.loads(response.content)\n self.assertEqual(\n ... | [
"0.70963717",
"0.6955476",
"0.69264096",
"0.69116724",
"0.67648506",
"0.67648506",
"0.67648506",
"0.67648506",
"0.67648506",
"0.67648506",
"0.67648506",
"0.67648506",
"0.67648506",
"0.67648506",
"0.67648506",
"0.67648506",
"0.67648506",
"0.67648506",
"0.67648506",
"0.67648506",... | 0.71607035 | 0 |
An instructor with read_only set to true should not be able to initiate a live. | def test_api_video_instructor_initiate_live_in_read_only(self):
video = factories.VideoFactory()
jwt_token = AccessToken()
jwt_token.payload["resource_id"] = str(video.id)
jwt_token.payload["roles"] = [random.choice(["instructor", "administrator"])]
jwt_token.payload["permissions... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_video_instructor_start_live_in_read_only(self):\n video = factories.VideoFactory()\n jwt_token = AccessToken()\n jwt_token.payload[\"resource_id\"] = str(video.id)\n jwt_token.payload[\"roles\"] = [random.choice([\"instructor\", \"administrator\"])]\n jwt_token.paylo... | [
"0.7384302",
"0.68568546",
"0.657362",
"0.65367335",
"0.65367335",
"0.6522951",
"0.6443183",
"0.6413996",
"0.626358",
"0.62398535",
"0.61373556",
"0.61279804",
"0.6099254",
"0.6082801",
"0.6066634",
"0.6066003",
"0.6063701",
"0.6048283",
"0.60462725",
"0.60462725",
"0.6046272... | 0.7439233 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.