query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Test for password strength missing digit.
def test_password_strength_validator_missing_digit(self): with self.assertRaises(ValidationError): validate_password_strength('abcdefg')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_password_strength_validator(self):\n self.assertIsNone(validate_password_strength('abcd123'))", "def test_password_strength_validator_missing_letter(self):\n with self.assertRaises(ValidationError):\n validate_password_strength('1234567')", "def check_password_strength():\r\n\...
[ "0.76214445", "0.7615998", "0.7283949", "0.7047271", "0.70288146", "0.68686", "0.68568677", "0.6758803", "0.6694275", "0.6566324", "0.6553022", "0.64874214", "0.6469547", "0.64618", "0.6447736", "0.6439617", "0.6412507", "0.641235", "0.63657725", "0.6363227", "0.6354931", "...
0.80876046
0
Test for password strength missing letter.
def test_password_strength_validator_missing_letter(self): with self.assertRaises(ValidationError): validate_password_strength('1234567')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_password_strength_validator(self):\n self.assertIsNone(validate_password_strength('abcd123'))", "def test_password_strength_validator_missing_digit(self):\n with self.assertRaises(ValidationError):\n validate_password_strength('abcdefg')", "def check_password_strength():\r\n\r...
[ "0.7635881", "0.7497957", "0.7032502", "0.6873941", "0.679898", "0.67746353", "0.6773938", "0.67620707", "0.6718229", "0.6624808", "0.6562677", "0.65404505", "0.6515814", "0.6507858", "0.643209", "0.6394227", "0.6375082", "0.63566536", "0.6346577", "0.63382757", "0.63098824",...
0.82154936
0
This function checks if the given `obj` is a columnlike (Series, Index...) type or not.
def is_column_like(obj): return ( isinstance( obj, ( cudf.core.column.ColumnBase, cudf.Series, cudf.Index, pd.Series, pd.Index, ), ) or ( hasattr(obj, "__cuda_array...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_object_type(df, field):\n return df[field].dtype.name == 'object'", "def can_convert_to_column(obj):\n return is_column_like(obj) or cudf.api.types.is_list_like(obj)", "def predicate(obj):\n return inspect.isclass(obj) and issubclass(obj, MafColumnRecord)", "def is_arraylike(obj):\n i...
[ "0.7964477", "0.78527325", "0.70655334", "0.7048928", "0.65591943", "0.6523134", "0.6514152", "0.6495595", "0.63864714", "0.6190344", "0.6165299", "0.6131327", "0.61073923", "0.6092305", "0.6044205", "0.60420626", "0.60420626", "0.6040725", "0.60335004", "0.59948176", "0.5915...
0.8504088
0
This function checks if the given `obj` can be used to create a column or not.
def can_convert_to_column(obj): return is_column_like(obj) or cudf.api.types.is_list_like(obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_column_like(obj):\n return (\n isinstance(\n obj,\n (\n cudf.core.column.ColumnBase,\n cudf.Series,\n cudf.Index,\n pd.Series,\n pd.Index,\n ),\n )\n or (\n hasattr(...
[ "0.7094436", "0.6623961", "0.6605608", "0.6200926", "0.60841525", "0.60360515", "0.59904623", "0.589983", "0.57284397", "0.5697302", "0.5693625", "0.56490564", "0.56466", "0.5643506", "0.56173486", "0.56114477", "0.5589786", "0.5583199", "0.5549619", "0.5520467", "0.5517214",...
0.7146523
0
Return the smallest signed integer dtype that can represent the integer ``x``
def min_signed_type(x, min_size=8): for int_dtype in np.sctypes["int"]: if (cudf.dtype(int_dtype).itemsize * 8) >= min_size: if np.iinfo(int_dtype).min <= x <= np.iinfo(int_dtype).max: return int_dtype # resort to using `int64` and let numpy raise appropriate exception: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_unsigned_type(x, min_size=8):\n for int_dtype in np.sctypes[\"uint\"]:\n if (cudf.dtype(int_dtype).itemsize * 8) >= min_size:\n if 0 <= x <= np.iinfo(int_dtype).max:\n return int_dtype\n # resort to using `uint64` and let numpy raise appropriate exception:\n return...
[ "0.76024413", "0.668726", "0.65399", "0.64511424", "0.6399774", "0.6128072", "0.6065688", "0.60427266", "0.60427266", "0.60032904", "0.60012406", "0.5924025", "0.5894979", "0.5814804", "0.5789021", "0.57721806", "0.57598513", "0.57583123", "0.5745024", "0.57367784", "0.572687...
0.80808735
0
Return the smallest unsigned integer dtype that can represent the integer ``x``
def min_unsigned_type(x, min_size=8): for int_dtype in np.sctypes["uint"]: if (cudf.dtype(int_dtype).itemsize * 8) >= min_size: if 0 <= x <= np.iinfo(int_dtype).max: return int_dtype # resort to using `uint64` and let numpy raise appropriate exception: return np.uint64(x)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_signed_type(x, min_size=8):\n for int_dtype in np.sctypes[\"int\"]:\n if (cudf.dtype(int_dtype).itemsize * 8) >= min_size:\n if np.iinfo(int_dtype).min <= x <= np.iinfo(int_dtype).max:\n return int_dtype\n # resort to using `int64` and let numpy raise appropriate exce...
[ "0.73269904", "0.70547926", "0.66033536", "0.59406954", "0.58949196", "0.58196664", "0.5806322", "0.57088995", "0.5687075", "0.5664583", "0.5655909", "0.564999", "0.564999", "0.56453305", "0.5612093", "0.5579257", "0.5549137", "0.55284584", "0.54975426", "0.5454876", "0.54279...
0.81060517
0
Utility function to determine if we can cast from `from_dtype` to `to_dtype`. This function primarily calls `np.can_cast` but with some special handling around cudf specific dtypes.
def _can_cast(from_dtype, to_dtype): if cudf.utils.utils.is_na_like(from_dtype): return True if isinstance(from_dtype, type): from_dtype = cudf.dtype(from_dtype) if isinstance(to_dtype, type): to_dtype = cudf.dtype(to_dtype) # TODO : Add precision & scale checking for # deci...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _can_cast_to(self, value, cast_type):\n try:\n _ = cast_type(value)\n return True\n except ValueError:\n return False", "def test_upcast(self):\r\n if config.cast_policy == 'custom':\r\n assert arange(iscalar()).dtype == iscalar().dtype\r\n assert arange(fsca...
[ "0.6512901", "0.6029256", "0.6008407", "0.5839921", "0.58141434", "0.5667138", "0.56541944", "0.5560597", "0.5534378", "0.5519287", "0.5447551", "0.5432719", "0.54149824", "0.5303196", "0.52843744", "0.5275316", "0.52229995", "0.51824373", "0.5181992", "0.5151185", "0.5142572...
0.917543
0
Checks if the unit is outside the FOW
def is_visible(self): return self.proto.display_type == DISPLAY_TYPE.Visible.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_mountain_in_range(self):\n self.assertTrue(self.user_location.is_mountain_in_range(self.mountain_one))\n self.assertFalse(self.user_location.is_mountain_in_range(self.mountain_two))", "def isOutsideBorder(self):\n if (self.posX < -self.myGalaxy.worldWidth or self.posX > self.myGa...
[ "0.6443473", "0.62315625", "0.62290025", "0.61263365", "0.60865444", "0.60356843", "0.5984728", "0.5973409", "0.5936323", "0.59013563", "0.5890609", "0.58829063", "0.5803371", "0.5802578", "0.57422286", "0.57293475", "0.57176894", "0.57039243", "0.5674068", "0.5673089", "0.56...
0.0
-1
Returns the unit owner's id
def owner_id(self) -> int: return self.proto.owner
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def owner_id(self) -> str:\n return pulumi.get(self, \"owner_id\")", "def owner_id(self) -> str:\n return self.__owner_id", "def owner_id(self):\n return self._owner_id", "def owner_id(self) -> Optional[str]:\n return pulumi.get(self, \"owner_id\")", "def owner(self):\n a...
[ "0.7737989", "0.75172037", "0.7371222", "0.7338123", "0.6751837", "0.66330785", "0.66318035", "0.66203886", "0.6592273", "0.65438175", "0.65323776", "0.65199316", "0.6490072", "0.64673144", "0.64234096", "0.64234096", "0.6407605", "0.63942194", "0.63942194", "0.63900226", "0....
0.7126816
4
Returns the unit detection range
def detect_range(self) -> Union[int, float]: return self.proto.detect_range
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRangeInches(self) -> float:\n ...", "def getRangeMM(self) -> float:\n ...", "def get_range(self):\r\n\r\n if self.size == 70:\r\n return 240\r\n elif self.size == 85:\r\n return 270", "def get_range(self):\n if self.size == 75:\n retu...
[ "0.70721805", "0.69699824", "0.6854021", "0.674963", "0.66105616", "0.65697527", "0.65615267", "0.65478814", "0.6530535", "0.65033937", "0.64984024", "0.6484248", "0.64801973", "0.64550525", "0.6442917", "0.6413282", "0.64117587", "0.638454", "0.63794327", "0.6348421", "0.633...
0.6945963
2
Checks if the unit is flying
def is_flying(self) -> bool: return self.proto.is_flying
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_fallen(self):\n orientation = self.minitaur_env.minitaur.GetBaseOrientation()\n rot_mat = self.minitaur_env._pybullet_client.getMatrixFromQuaternion(orientation)\n local_up = rot_mat[6:]\n return (np.dot(np.asarray([0, 0, 1]), np.asarray(local_up)) < 0.3)", "def check_fleet(sel...
[ "0.6714423", "0.6327646", "0.6310387", "0.6241162", "0.62241924", "0.6197398", "0.61516845", "0.61313725", "0.60862607", "0.6074081", "0.6042982", "0.59909093", "0.5981111", "0.5970643", "0.59467703", "0.59375894", "0.5923914", "0.59213585", "0.59081155", "0.5905994", "0.5889...
0.6856984
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
1
Returns the unit max health
def health_max(self) -> Union[int, float]: return self.proto.health_max
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_health():\r\n max_health = max(Titan.health_titans())\r\n return max_health", "def get_max_health(self):\n raise NotImplementedError('Subclasses must define max health')", "def get_health(self):\n return round(self.health)", "def max(self) -> float:\n return stats.m...
[ "0.83425224", "0.8254835", "0.7165922", "0.70758605", "0.706734", "0.70596176", "0.68795365", "0.68795365", "0.68747014", "0.68747014", "0.671714", "0.67101693", "0.66821736", "0.6662136", "0.6662136", "0.66475385", "0.6641862", "0.6619443", "0.6619443", "0.6619443", "0.66194...
0.82665396
2
Returns the unit max energy
def energy_max(self) -> Union[int, float]: return self.proto.energy_max
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_Ec_max(self):\n return self.Ec_max", "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 ...
[ "0.7158754", "0.7100571", "0.7078389", "0.7024071", "0.70133126", "0.6982264", "0.69725335", "0.6966379", "0.6940615", "0.6939813", "0.6856558", "0.682932", "0.6829139", "0.6802222", "0.6798505", "0.6798505", "0.6795786", "0.679211", "0.6791478", "0.6741895", "0.6739708", "...
0.82604754
1
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.78913313", "0.7011123", "0.66745543", "0.6650226", "0.65617794", "0.65487546", "0.650418", "0.6458717", "0.6417536", "0.6376729", "0.6284213", "0.6278386", "0.62669563", "0.6263691", "0.62569064", "0.6137678", "0.61298555", "0.6104166", "0.6080718", "0.60655564", "0.606555...
0.7896708
0
Checks if the structure has no queue
def noqueue(self) -> bool: return not self.orders
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return self.queue == []", "def empty(self):\r\n return self.queue == []", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return not self._queue", "def is_empty(self):...
[ "0.8057863", "0.7959296", "0.7889903", "0.7889903", "0.7882524", "0.7880904", "0.7866103", "0.7844282", "0.78436613", "0.78333867", "0.77917933", "0.7769793", "0.77681094", "0.7766264", "0.7766001", "0.7764133", "0.76850146", "0.76850146", "0.76636124", "0.7585061", "0.756959...
0.74800503
24
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 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 max health
def health_max(self) -> Union[int, float]: return self.proto.health_max
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_health():\r\n max_health = max(Titan.health_titans())\r\n return max_health", "def get_max_health(self):\n raise NotImplementedError('Subclasses must define max health')", "def get_health(self):\n return round(self.health)", "def get_health(self):\n self.__health = ...
[ "0.833376", "0.82040477", "0.7142139", "0.709792", "0.7010765", "0.69199795", "0.6737945", "0.6737945", "0.6691778", "0.66832405", "0.6681454", "0.6681454", "0.6660394", "0.6634599", "0.662755", "0.662755", "0.6609298", "0.6575887", "0.65702415", "0.65036225", "0.65036225", ...
0.8123324
2
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
equality for plainolddata types
def pod_equals(x, y): return type(x) == type(y) and x.__dict__ == y.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other):\n return self.dtype != other.dtype", "def __eq__(self, other):\n if isinstance(other, self.__class__):\n if self.type_id != other.type_id:\n return False\n # floats are difficult to check for exact equality...\n if self.data_t...
[ "0.7387543", "0.7352539", "0.7248721", "0.71723944", "0.7117634", "0.7093826", "0.7066883", "0.70490134", "0.7015024", "0.6981428", "0.6977431", "0.6926807", "0.6907606", "0.6897124", "0.6878844", "0.6822347", "0.68117833", "0.67997205", "0.67612654", "0.67494893", "0.6743996...
0.0
-1
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
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
Sets the category of this ModelClass.
def category(self, category: str): if category is None: raise ValueError("Invalid value for `category`, must not be `None`") # noqa: E501 self._category = category
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def category(self, category):\n\n self._category = category", "def category(self, category):\n\n self._category = category", "def category(self, category):\n\n self._category = category", "def category(self, category):\n\n self._category = category", "def category(self, category...
[ "0.7930952", "0.7930952", "0.7930952", "0.7930952", "0.7930952", "0.78134906", "0.765651", "0.76114225", "0.70276093", "0.68354446", "0.67236674", "0.6667696", "0.6550618", "0.6471546", "0.6398481", "0.6387779", "0.6293549", "0.61200196", "0.6016092", "0.59889555", "0.5988955...
0.7021338
9
Draw detected bounding boxes.
def gain_box_score(im, preds): if len(preds[0]) == 0: cv2.imshow("Video detection", im) else: for pred in preds: for i, box_label in enumerate(zip( pred["boxes"], pred["labels"] )): box, label = box_label xmin, ymin, xmax, ymax = box #----------------...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_bounding_boxes(self, bounding_boxes, output):\n for i, bb in enumerate(bounding_boxes):\n\n if bb[2] > output.shape[1] or bb[3] > output.shape[0] or bb[0] < 0 or bb[1] < 0:\n continue\n cv2.rectangle(\n np.asarray(output), (bb[0], bb[1]), (bb[2], ...
[ "0.7759134", "0.7638115", "0.7510048", "0.7297777", "0.7149521", "0.71037453", "0.71007454", "0.7083161", "0.70195544", "0.6991599", "0.6974132", "0.69630015", "0.6859163", "0.6852671", "0.683186", "0.6829525", "0.6810171", "0.6803174", "0.6773956", "0.67738825", "0.6741273",...
0.6328169
55
Instructors should be able to read the detail of their video.
def test_api_video_read_detail_token_user(self): resolutions = [144, 240, 480, 720, 1080] video = factories.VideoFactory( pk="a2f27fde-973a-4e89-8dca-cc59e01d255c", uploaded_on=datetime(2018, 8, 8, tzinfo=pytz.utc), upload_state="ready", resolutions=resolu...
{ "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.7335651", "0.6924774", "0.676182", "0.6742741", "0.66995883", "0.6681069", "0.66803575", "0.6547153", "0.6534806", "0.6461408", "0.6441217", "0.6422307", "0.6391223", "0.6284793", "0.62141234", "0.62103695", "0.60851705", "0.6058157", "0.6049583", "0.60222644", "0.6002987"...
0.63547796
13
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 with playlist access lists videos. A user with a user token, with access to a playlist should get only videos from that playlist, and not from other playlists, even if they are from the same organization.
def test_api_video_read_list_user_with_playlist_access(self): user = factories.UserFactory() # An organization where the user has no access organization = factories.OrganizationFactory() # In this organization, a playlist where the user has access organization_playlist_1 = factor...
{ "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.78310287", "0.77141297", "0.7685438", "0.7613979", "0.75807804", "0.7462909", "0.7426319", "0.7041642", "0.6830754", "0.68256694", "0.6814436", "0.66690576", "0.6648644", "0.6648272", "0.6597814", "0.65889883", "0.65798", "0.6577959", "0.65722907", "0.64913493", "0.6448269...
0.7429918
6
Token user with organization access lists videos. A user with a user token, with access to an organization should get only videos from that organization no matter the playlist they are in, and not from other playlists or organizations.
def test_api_video_read_list_user_with_organization_access(self): user = factories.UserFactory() # An organization where the user has access organization_1 = factories.OrganizationFactory() factories.OrganizationAccessFactory(user=user, organization=organization_1) # In this orga...
{ "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.7851711", "0.7488574", "0.7456888", "0.74475455", "0.73581576", "0.7128175", "0.70639694", "0.6954388", "0.68121815", "0.6782114", "0.6725037", "0.6521972", "0.64678687", "0.6350575", "0.6350176", "0.6336787", "0.63253325", "0.6313457", "0.625638", "0.6216208", "0.620257",...
0.7323614
5
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 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
Token user with organization access lists videos by organization. A user with a user token, with an organization access, can list videos for the organization, no matter the playlist they belong to.
def test_api_video_read_list_by_org_user_with_org_access(self): user = factories.UserFactory() # The organization for both our playlists organization = factories.OrganizationFactory() factories.OrganizationAccessFactory(organization=organization, user=user) # Two separate playlis...
{ "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.7620575", "0.7367382", "0.73542076", "0.72079307", "0.6987711", "0.69811946", "0.67507935", "0.67306453", "0.662158", "0.6598039", "0.65685207", "0.64594114", "0.6449834", "0.64418834", "0.64396983", "0.6323934", "0.6294522", "0.62920415", "0.6086487", "0.6033195", "0.6018...
0.7092123
4
Users authenticated via a session should not be able to read a list of videos.
def test_api_video_read_list_staff_or_user(self): for user in [factories.UserFactory(), factories.UserFactory(is_staff=True)]: self.client.login(username=user.username, password="test") factories.VideoFactory() response = self.client.get("/api/videos/") self.asser...
{ "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.7402731", "0.73869985", "0.73115736", "0.724897", "0.7105533", "0.7099846", "0.69385135", "0.6931659", "0.67373747", "0.67029023", "0.6695124", "0.66150105", "0.6603717", "0.6585704", "0.6582648", "0.6561243", "0.6505434", "0.6483115", "0.64699274", "0.6441474", "0.6432093...
0.65867597
13
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
Users authenticated via a session should not be able to create videos.
def test_api_video_create_staff_or_user(self): for user in [factories.UserFactory(), factories.UserFactory(is_staff=True)]: self.client.login(username=user.username, password="test") response = self.client.post("/api/videos/") self.assertEqual(response.status_code, 401) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_video_create_anonymous(self):\n response = self.client.post(\"/api/videos/\")\n self.assertEqual(response.status_code, 401)\n self.assertFalse(models.Video.objects.exists())", "def test_api_video_create_token_user_playlist_preexists(self):\n jwt_token = AccessToken()\n ...
[ "0.7138468", "0.70704436", "0.6968749", "0.68162954", "0.6791833", "0.6748856", "0.6625474", "0.661022", "0.661022", "0.661022", "0.661022", "0.6580486", "0.65615857", "0.6560691", "0.6553949", "0.6543192", "0.6525495", "0.65170795", "0.65000176", "0.64828473", "0.64751995", ...
0.6593911
11
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
Anonymous users should not be allowed to update a video through the API.
def test_api_video_update_detail_anonymous(self): video = factories.VideoFactory(title="my title") data = {"title": "my new title"} response = self.client.put( f"/api/videos/{video.id}/", data, content_type="application/json", ) self.assertEqua...
{ "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.74295044", "0.7370423", "0.70041597", "0.70041597", "0.70041597", "0.70041597", "0.6978279", "0.6892489", "0.6892392", "0.6884891", "0.6833238", "0.67419845", "0.6711086", "0.67000884", "0.6691418", "0.6632373", "0.6619881", "0.65459305", "0.6544112", "0.65344834", "0.6532...
0.6952605
7
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
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 instructors cannot update videos on the API.
def test_api_video_put_by_organization_instructor(self): user = factories.UserFactory() organization = factories.OrganizationFactory() factories.OrganizationAccessFactory( role=models.INSTRUCTOR, organization=organization, user=user ) playlist = factories.PlaylistFact...
{ "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.7382875", "0.72906446", "0.70998436", "0.70015305", "0.6932124", "0.69155115", "0.6912991", "0.6872386", "0.68710065", "0.6814899", "0.6773898", "0.66568947", "0.6626058", "0.6585471", "0.6549529", "0.6538208", "0.64759755", "0.64324564", "0.636778", "0.6332027", "0.632545...
0.70848364
3
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
Users authenticated via a session should not be able to delete a video.
def test_api_video_delete_detail_staff_or_user(self): video = factories.VideoFactory() for user in [factories.UserFactory(), factories.UserFactory(is_staff=True)]: self.client.login(username=user.username, password="test") response = self.client.delete(f"/api/videos/{video.id}/"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_video_instructor_delete_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.72214437", "0.7215925", "0.70816636", "0.7050844", "0.68327844", "0.6765785", "0.6713723", "0.6613993", "0.6578433", "0.65731215", "0.6553216", "0.6548827", "0.6534205", "0.6501446", "0.6434411", "0.6410697", "0.64022034", "0.63780516", "0.63502085", "0.6343167", "0.629464...
0.678543
5
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
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
Users authenticated via a session should not be able to delete a list of videos.
def test_api_video_delete_list_staff_or_user(self): video = factories.VideoFactory() for user in [factories.UserFactory(), factories.UserFactory(is_staff=True)]: self.client.login(username=user.username, password="test") response = self.client.delete("/api/videos/") ...
{ "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.7794198", "0.75191647", "0.71559817", "0.7013222", "0.69479805", "0.68482417", "0.68061143", "0.67611283", "0.6537849", "0.6536428", "0.65200305", "0.64853615", "0.6460733", "0.64047116", "0.636291", "0.6354122", "0.6315451", "0.6307553", "0.62810653", "0.62731355", "0.625...
0.7326501
2
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
Updating state to stopped should set video to DELETED if manifest is missing.
def test_api_video_update_live_state_stopped_missing_manifest(self): video = factories.VideoFactory( id="a1a21411-bf2f-4926-b97f-3c48a124d528", upload_state=PENDING, live_state=STOPPING, live_info={"mediapackage": {"channel": {"id": "channel1"}}}, live...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_video_update_live_state_unknown_video(self):\n data = {\n \"logGroupName\": \"/aws/lambda/dev-test-marsha-medialive\",\n \"state\": \"running\",\n }\n signature = generate_hash(\"shared secret\", json.dumps(data).encode(\"utf-8\"))\n response = self.cl...
[ "0.61517084", "0.6147886", "0.6037828", "0.6032262", "0.6032262", "0.5964834", "0.5944277", "0.5937539", "0.58444035", "0.58058584", "0.57293636", "0.5729041", "0.5718966", "0.5702582", "0.5674354", "0.566203", "0.5659448", "0.5617334", "0.55615175", "0.554622", "0.5542855", ...
0.6312514
0
Live state update with an unknown video should fails.
def test_api_video_update_live_state_unknown_video(self): data = { "logGroupName": "/aws/lambda/dev-test-marsha-medialive", "state": "running", } signature = generate_hash("shared secret", json.dumps(data).encode("utf-8")) response = self.client.patch( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_video_update_live_state_invalid_state(self):\n video = factories.VideoFactory(\n id=\"a1a21411-bf2f-4926-b97f-3c48a124d528\",\n upload_state=PENDING,\n live_state=IDLE,\n live_type=RAW,\n )\n invalid_state = random.choice(\n [...
[ "0.7784363", "0.72019297", "0.7105363", "0.7011971", "0.68896437", "0.65897465", "0.6572008", "0.643296", "0.6379981", "0.6292681", "0.6288871", "0.6288871", "0.627914", "0.6160698", "0.61350566", "0.61238045", "0.59614325", "0.58788806", "0.58284414", "0.5731805", "0.5718009...
0.80395156
0
The nonlinear activation used in Capsule. It drives the length of a large vector near 1 and a small vector near 0
def squash(vectors, axis=-1): s_squared_norm = K.sum(K.square(vectors), axis, keepdims=True) scale = s_squared_norm / (1 + s_squared_norm)/ K.sqrt(s_squared_norm) return scale * vectors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activation(x):\n # return np.tanh(x)\n return np.maximum(0,x)", "def activation(x):\n return 1 / (1 + torch.exp(-x))", "def activation(self,z):\n #using the clipping function as there is no need for it because the values larger or smaller would be very close to zero\n return 1./(1. + np....
[ "0.7012916", "0.68711597", "0.6626414", "0.65954316", "0.65145195", "0.6512446", "0.6496755", "0.6379628", "0.6372951", "0.63177145", "0.6299936", "0.6207806", "0.6202219", "0.6153844", "0.61449194", "0.61300224", "0.60961044", "0.60830647", "0.60830647", "0.60790247", "0.607...
0.0
-1
Create a trainable weight variable for this layer. x must be a tensor object input_shape must have the shape (batch, height, width, channels) according to "channel_last" of Conv2D layer reshape_input_shape BHW D Note that the sigma values are saves as std, not as variance
def build(self, input_shape, x=None): self.mu = self.add_weight( name='mu', shape=(self.n_clusters, input_shape[-1]), initializer=random_normal(mean=0, stddev=0.4, seed=self.seed), trainable=True ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layer1(x, weight_shape, bias_shape):\n \n weight_init = tf.random_normal_initializer(stddev=(2.0/weight_shape[0])**0.5)\n W = tf.get_variable(\"W\", weight_shape, initializer=weight_init)\n \n bias_init = tf.constant_initializer(value=0)\n b = tf.get_variable(\"b\", bias_shape, initializer=bi...
[ "0.65060806", "0.63944715", "0.6388761", "0.63822013", "0.6321313", "0.6311598", "0.6311598", "0.6311598", "0.6305885", "0.62803596", "0.62700605", "0.62700605", "0.62700605", "0.62700605", "0.62700605", "0.62700605", "0.62700605", "0.62700605", "0.62700605", "0.62700605", "0...
0.5993992
38
x must be a tensor object input_shape must have the shape (batch, height, width, channels) according to "channel_last" of Conv2D layer reshape_input_shape BHW D
def call(self, x, **kwargs): # Preventing from a gradient explosion self.std = K.maximum(self.std, self.epsilon) self.alpha = K.exp(self.alpha) self.alpha = self.alpha / K.sum(self.alpha) x_dim = K.shape(x) if self.modeled_layer_type == 'Conv2d': pool_dim = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reshape_channels(x):\n assert x.dim() == 4\n batch_size, nc, h, w = x.size()\n x_t = x.view(batch_size, nc, -1).transpose(1, 2).contiguous()\n x_t = x_t.view(batch_size, h, w, nc)\n return x_t", "def conv2D(x,shape,name,stride=[1,2,2,1],padding='SAME',reuse=None):\n\t#get ...
[ "0.67255366", "0.6488251", "0.63382953", "0.6315276", "0.6298476", "0.62775266", "0.6229245", "0.62073797", "0.61998206", "0.61844516", "0.6171696", "0.61202174", "0.6083163", "0.6069728", "0.6045495", "0.6027058", "0.6024861", "0.6023316", "0.60114884", "0.5992945", "0.59867...
0.0
-1
Use binary to represent white and black 01 > black, 10 > white, 11 > either black & white == 0 > invalid black & black == black white & white == white black & 3 == either white & 3 == either
def fits(a, b): return all(x & y for x, y in zip(a, b))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binning():\n def r(x):\n return 1 << (x & 7)\n\n def w(x):\n return 0x11 * (x >> 1)\n return r, w", "def convert_to_black_and_white(picture):\n picture_black_white = picture.convert('1')\n return picture_black_white", "def get_biomass(binary_mask):\n\n wh...
[ "0.61921465", "0.6042391", "0.59071285", "0.5883578", "0.5864983", "0.5845442", "0.58304995", "0.57357556", "0.5730847", "0.5708581", "0.56864023", "0.5654941", "0.5616863", "0.55960745", "0.5592005", "0.5587581", "0.55739754", "0.5570983", "0.55571586", "0.55395585", "0.5499...
0.0
-1
Compare __repr__ string with expectation
def test_basic(self): new_name = "probability_of_snowfall" test_cube = set_up_percentiles_cube() inverse_ordering = False expected = ('<ProbabilitiesFromPercentiles2D: percentiles_' 'cube: {}, output_name: {}, inverse_ordering: {}'.format( test...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_repr(self, r, rep):\n assert repr(r) == rep", "def test_repr():\n c = Circle(4) \n assert c.__repr__() == 'Circle(4)'", "def test_repr(clf_eval):\n assert str(clf_eval) == 'ClassificationEvaluation(model_name=foo, class_names=[a, b])'\n assert repr(clf_eval) == 'ClassificationEvalua...
[ "0.811123", "0.77216023", "0.76762074", "0.75234485", "0.7391024", "0.735745", "0.7334446", "0.72646946", "0.7189008", "0.71634907", "0.7151694", "0.7139239", "0.7097616", "0.709426", "0.7082932", "0.70818025", "0.7058298", "0.7057699", "0.70529217", "0.7027855", "0.7027835",...
0.0
-1
Read a bufr file and convert to a Pandas DataFrame Variables used inside the DataFrame are already CDM compliant
def bufr_to_dataframe(file=''): if debug: print("Running bufr_to_dataframe for: ", file) check_read_file (file = file, read= False) f = open(file) #source_file = [l for l in file.split('/') if '.bfr' in l][0] read_data = [] """ Name of the columns as they will appear ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_swc(file_name):\n\n df = pd.read_csv(file_name, delimiter=' ', header=None, comment='#',\n names=['sample', 'identifier', 'x', 'y', 'z', 'r', 'parent'],\n skipinitialspace=True).astype({'sample':int,'identifier':int,'x':float,'y':float,'z':float,'r':float,'parent...
[ "0.6760399", "0.66910934", "0.66843355", "0.6596809", "0.65731204", "0.64530325", "0.6444564", "0.64268804", "0.64126265", "0.6340299", "0.6340299", "0.6340299", "0.6326406", "0.63134426", "0.6298015", "0.6291843", "0.628385", "0.62818545", "0.6272516", "0.6217461", "0.621523...
0.7691618
0
Read an uadb stationfile in ASCII format and convert to a Pandas DataFrame.
def uadb_ascii_to_dataframe(file=''): if debug: print("Running uadb_ascii_to_dataframe for: ", file) data = check_read_file(file=file, read=True) # TODO #source_file = [l for l in file.split('/') if '.txt' in l][0] nmiss = 0 search_h = False read_data = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uadb_ascii_to_dataframe(filename, **kwargs):\n import datetime\n import zipfile\n import gzip\n import os\n import io\n import numpy as np\n import pandas as pd\n from . import support as sp\n\n if not os.path.isfile(filename):\n raise IOError(\"File not Found! %s\" % filename...
[ "0.7591771", "0.685794", "0.6593989", "0.62999815", "0.6292323", "0.6279624", "0.6228682", "0.6220584", "0.61573863", "0.61280155", "0.611027", "0.6012557", "0.5959872", "0.5870615", "0.5867335", "0.5846116", "0.5834367", "0.58262587", "0.58182746", "0.581537", "0.57865024", ...
0.70143044
1
Read an igra2 stationfile in ASCII format and convert to a Pandas DataFrame.
def igra2_ascii_to_dataframe(file=''): if debug: print("Running igra2_ascii_to_dataframe for: ", file) data = check_read_file(file=file, read=True) #source_file = [l for l in file.split('/') if '.txt' in l][0] read_data = [] # Lists containing the raw data from the ascii file, and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uadb_ascii_to_dataframe(filename, **kwargs):\n import datetime\n import zipfile\n import gzip\n import os\n import io\n import numpy as np\n import pandas as pd\n from . import support as sp\n\n if not os.path.isfile(filename):\n raise IOError(\"File not Found! %s\" % filename...
[ "0.6976135", "0.6776106", "0.6681584", "0.6436349", "0.6297956", "0.6267564", "0.6266623", "0.62274367", "0.6124879", "0.61233276", "0.60146654", "0.60051876", "0.59578943", "0.5896764", "0.5883741", "0.58122426", "0.5811471", "0.5803112", "0.5794453", "0.5778825", "0.574811"...
0.72274184
0
Load the cdm tables into Panda DataFrames, reading the tables from the cdm GitHub page FF To do Uncomment to get the list of all the .csv files present at the url specified
def load_cdm_tables(): tpath = os.getcwd() + '/../data' cdmpath='https://raw.githubusercontent.com/glamod/common_data_model/master/tables/' # cdm tables """ Selecting the list of table definitions. Some of the entires do not have the corresponding implemented tables """ cdmtabledeflist=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_datasets_csv(url):\n # dataset = pd.read_csv(url, sep='\\t')\n dataset = pd.read_csv(url, sep=\",\")\n dataset.columns = dataset.columns.str.replace(\" \", \"_\")\n return dataset", "def get_data():\n \n \"\"\" Prepare variables\"\"\"\n urls = {\"cases\": \"https://github.com/CS...
[ "0.71734565", "0.67320985", "0.6669976", "0.6588941", "0.65831953", "0.64777106", "0.64169997", "0.63222474", "0.63173807", "0.6298204", "0.62980694", "0.62220365", "0.6213207", "0.6168551", "0.61399347", "0.61185586", "0.60854256", "0.6081547", "0.6046216", "0.6012291", "0.5...
0.7079996
1
Creates and saves a User with the given username, email and password.
def _create_user(self, username, email, password, is_staff, is_superuser, **extra_fields): now = timezone.now() if not username: raise ValueError('The given username must be set') email = self.normalize_email(email) user = self.model(username=username, em...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_user(self, email, password,username, **extra_fields):\r\n if not email:\r\n raise ValueError('The given email must be set')\r\n if not username:\r\n raise ValueError('The given username must be set')\r\n email = self.normalize_email(email)\r\n user = se...
[ "0.86018157", "0.84706366", "0.8462776", "0.8417308", "0.8413365", "0.839183", "0.8346418", "0.83453476", "0.8314481", "0.8306914", "0.8288764", "0.827679", "0.8270353", "0.82577944", "0.8213095", "0.81978804", "0.8175898", "0.81719273", "0.8164025", "0.8162915", "0.8138058",...
0.78832424
60
Take a string and return a valid filename constructed from the string.
def format_filename(s): valid_chars = "-_.() %s%s" % (string.ascii_letters, string.digits) filename = ''.join(c for c in s if c in valid_chars) filename = filename.replace(' ', '_') return filename
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_filename(s: str):\n # from: https://gist.github.com/seanh/93666\n\n valid_chars = \"-_.() %s%s\" % (string.ascii_letters, string.digits)\n filename = ''.join(c for c in s if c in valid_chars)\n filename = filename.replace(' ', '_') # I don't like spaces in filenames.\n return filename", ...
[ "0.80485183", "0.798944", "0.7949801", "0.787847", "0.7862182", "0.7855741", "0.7855741", "0.7855741", "0.7727231", "0.76735306", "0.75296444", "0.7505588", "0.747976", "0.743618", "0.7330777", "0.73069334", "0.7068746", "0.70555854", "0.6852573", "0.68469024", "0.6833942", ...
0.77141064
9
Testing that a negative limit parameter returns a 400
def test_limit_is_negative(self) -> None: channel = self.make_request( "GET", self.url + "?limit=-5", access_token=self.admin_user_tok, ) self.assertEqual(400, channel.code, msg=channel.json_body) self.assertEqual(Codes.INVALID_PARAM, channel.json_bo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exceed_limit_request(self):\n actions.login(ADMIN_EMAIL)\n ids_list = list(range(SkillAggregateRestHandler.MAX_REQUEST_SIZE))\n get_url = '%s?%s' % (self.URL, urllib.urlencode({\n 'ids': ids_list}, True))\n\n response = transforms.loads(self.get(get_url).body)\n ...
[ "0.7617022", "0.7143843", "0.709307", "0.7042369", "0.6976879", "0.6941879", "0.6916557", "0.68980557", "0.6858989", "0.680703", "0.6793832", "0.6782149", "0.67627925", "0.6762043", "0.67223275", "0.6576358", "0.649637", "0.6467667", "0.645585", "0.6455209", "0.6427124", "0...
0.80326337
0
Tests that the count matches the number of rows, even if rows in joined tables are missing.
def test_count_correct_despite_table_deletions(self) -> None: # Delete rows from room_stats_state for one of our rooms. self.get_success( self.hs.get_datastores().main.db_pool.simple_delete( "room_stats_state", {"room_id": self.room_id1}, desc="_" ) ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_count(self):\r\n assert self.table.objects.count() == 12\r\n\r\n q = self.table.objects(test_id=0)\r\n assert q.count() == 4", "def expect_table_row_count_to_equal_other_table(\n self,\n other_table_name,\n result_format=None,\n include_config=True,\n ...
[ "0.65709007", "0.65147054", "0.6395281", "0.63884366", "0.6327621", "0.6284862", "0.61996096", "0.614524", "0.61279213", "0.6077532", "0.6071725", "0.60554135", "0.60551405", "0.59053063", "0.5898278", "0.5891377", "0.58427334", "0.5821428", "0.5813745", "0.580813", "0.578274...
0.5459709
54
Testing that an invalid `report_id` returns a 400.
def test_invalid_report_id(self) -> None: # `report_id` is negative channel = self.make_request( "GET", "/_synapse/admin/v1/event_reports/-123", access_token=self.admin_user_tok, ) self.assertEqual(400, channel.code, msg=channel.json_body) se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_report_id(self) -> None:\n\n # `report_id` is negative\n channel = self.make_request(\n \"DELETE\",\n \"/_synapse/admin/v1/event_reports/-123\",\n access_token=self.admin_user_tok,\n )\n\n self.assertEqual(400, channel.code, msg=channel....
[ "0.7850871", "0.6897314", "0.6565259", "0.65553325", "0.6430627", "0.63368964", "0.6311277", "0.6301224", "0.62615025", "0.6256362", "0.62535536", "0.6204354", "0.6088427", "0.60642743", "0.6035252", "0.60337836", "0.6016078", "0.60159826", "0.60128593", "0.59775776", "0.5975...
0.81147087
0
Testing that a not existing `report_id` returns a 404.
def test_report_id_not_found(self) -> None: channel = self.make_request( "GET", "/_synapse/admin/v1/event_reports/123", access_token=self.admin_user_tok, ) self.assertEqual(404, channel.code, msg=channel.json_body) self.assertEqual(Codes.NOT_FOUND, c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_report_id_not_found(self) -> None:\n\n channel = self.make_request(\n \"DELETE\",\n \"/_synapse/admin/v1/event_reports/123\",\n access_token=self.admin_user_tok,\n )\n\n self.assertEqual(404, channel.code, msg=channel.json_body)\n self.assertEqu...
[ "0.80737585", "0.76326716", "0.72465545", "0.7060298", "0.6815434", "0.6761219", "0.656321", "0.6505561", "0.6406881", "0.6399025", "0.63805026", "0.63716185", "0.6366132", "0.6341178", "0.63260156", "0.6313996", "0.63133943", "0.6300672", "0.6275042", "0.6266949", "0.6266460...
0.84145755
0
Testing that an invalid `report_id` returns a 400.
def test_invalid_report_id(self) -> None: # `report_id` is negative channel = self.make_request( "DELETE", "/_synapse/admin/v1/event_reports/-123", access_token=self.admin_user_tok, ) self.assertEqual(400, channel.code, msg=channel.json_body) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_report_id(self) -> None:\n\n # `report_id` is negative\n channel = self.make_request(\n \"GET\",\n \"/_synapse/admin/v1/event_reports/-123\",\n access_token=self.admin_user_tok,\n )\n\n self.assertEqual(400, channel.code, msg=channel.jso...
[ "0.8114839", "0.6898392", "0.65659076", "0.6555996", "0.6431462", "0.63372266", "0.6312958", "0.63020974", "0.6263201", "0.62577367", "0.62554604", "0.6206936", "0.60895234", "0.6066999", "0.6037492", "0.6035575", "0.60181403", "0.60166055", "0.60134876", "0.5979885", "0.5976...
0.7851341
1
Testing that a not existing `report_id` returns a 404.
def test_report_id_not_found(self) -> None: channel = self.make_request( "DELETE", "/_synapse/admin/v1/event_reports/123", access_token=self.admin_user_tok, ) self.assertEqual(404, channel.code, msg=channel.json_body) self.assertEqual(Codes.NOT_FOUND...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_report_id_not_found(self) -> None:\n\n channel = self.make_request(\n \"GET\",\n \"/_synapse/admin/v1/event_reports/123\",\n access_token=self.admin_user_tok,\n )\n\n self.assertEqual(404, channel.code, msg=channel.json_body)\n self.assertEqual(...
[ "0.841445", "0.7632993", "0.7246946", "0.70600617", "0.681505", "0.6762001", "0.656388", "0.65051955", "0.6408046", "0.6397647", "0.6379985", "0.6372422", "0.6366025", "0.6340298", "0.63259286", "0.63136077", "0.6312867", "0.6301502", "0.6274185", "0.6266179", "0.6265957", ...
0.80735993
1
Returns n + reversed(n).
def reverse_and_add(n): return n + int(str(n)[::-1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rev(n):\n return int(''.join(reversed(str(n))))", "def reverse(n):\n return(int(str(n)[::-1]))", "def reverse_last(vals, n):\n if len(vals)<=n:\n return vals[::-1]\n else:\n old=vals[0:len(vals)-n]\n new=vals[-1:len(vals)-n-1:-1]\n return old+new", "def reverseTheList(...
[ "0.7608247", "0.75295496", "0.728547", "0.6924487", "0.68271923", "0.6680292", "0.66388965", "0.6602577", "0.6486767", "0.6343752", "0.63146275", "0.6301133", "0.62174916", "0.616755", "0.61604625", "0.6144047", "0.6141926", "0.6127323", "0.6058644", "0.6056239", "0.6048981",...
0.8104129
0
Construct a mesh grid.
def construct_simplex_meshgrid(ng, dimSimplex): t_list = np.linspace(0, 1, ng) tmp = np.array(np.meshgrid(*[t_list for i in range(dimSimplex - 1)])) m = np.zeros([tmp[0].ravel().shape[0], dimSimplex]) for i in range(dimSimplex - 1): m[:, i] = tmp[i].ravel() m[:, dimSimplex - 1] = 1 - np.sum(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_grid(self, nx, ny):\n nx_vec = np.arange(nx)\n ny_vec = np.arange(ny)\n yv, xv = np.meshgrid(ny_vec, nx_vec)\n grid = np.stack((yv, xv), axis=2)\n grid = grid.reshape(1, 1, ny, nx, 2)\n return grid", "def mesh_grid(self,width,height):\n # get\n \n ...
[ "0.77280086", "0.75093", "0.7388354", "0.7376718", "0.7332889", "0.73001146", "0.72167283", "0.7193592", "0.7178584", "0.7178442", "0.71046436", "0.70962566", "0.70636714", "0.70636714", "0.7043368", "0.69940144", "0.69792396", "0.68985355", "0.6894218", "0.6890925", "0.68731...
0.0
-1
Delete specific campaign group.
def delete_adcampaign_group(self, campaign_group_id, batch=False): path = '%s' % campaign_group_id return self.make_request(path, 'DELETE', batch=batch)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_group(self, group_id):\n url = self.groups_url + \"/%s\" % group_id\n return requests.delete(url, headers=self.headers)", "def delete_group(self, group):\n raise NotImplementedError('delete_group')", "async def delete_contact_group(dbcon: DBConnection, contact_group_id: int) -> ...
[ "0.7501498", "0.74689204", "0.744864", "0.7417873", "0.737822", "0.7363642", "0.7334851", "0.7320734", "0.72889686", "0.7264399", "0.7235754", "0.7199511", "0.7180974", "0.71728706", "0.7139698", "0.7083039", "0.70539457", "0.70402956", "0.7021091", "0.70121497", "0.69845533"...
0.8175089
0
Returns the conversions stats for all ad campaigns.
def get_conversion_stats_by_adcampaign( self, account_id, campaign_ids=None, include_deleted=False, start_time=None, end_time=None, aggregate_days=None, by_impression_time=True, batch=False): path = 'act_%s/adcampaignconversions' % account_id args = {} if camp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_conversion_stats(self, adgroup_id, batch=False):\n path = '%s/conversions' % adgroup_id\n return self.make_request(path, 'GET', batch=batch)", "def get_conversion_stats_by_adaccount(self, account_id, batch=False):\n path = 'act_%s/conversions' % account_id\n return self.make_r...
[ "0.74286306", "0.7370984", "0.7019813", "0.6382501", "0.6261058", "0.6154502", "0.60573655", "0.5973016", "0.59465206", "0.5898278", "0.5882686", "0.58543557", "0.58406806", "0.58167595", "0.57884544", "0.5771609", "0.5745874", "0.5739006", "0.5698094", "0.56734675", "0.54891...
0.6984529
3
Returns the list of ad campaigns and related data.
def get_adcampaign_list(self, account_id): fields = 'id, name, campaign_status, start_time, end_time, ' \ 'daily_budget, lifetime_budget, budget_remaining' batch = [ self.get_adaccount(account_id, ['currency'], batch=True), self.get_adcampaigns(account_id, fields...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_drip_campaigns(self):\n return list(DripCampaign.objects(user_id=self.user_id))", "def list_campaigns(self, **kwargs) -> ApiResponse:\n return self._request(kwargs.pop('path'), params=kwargs)", "def getAllCampaigns(service):\n # Using AWQL to retrieve campaigns.\n query = (adwords....
[ "0.7791002", "0.76178706", "0.74240816", "0.7406647", "0.73380303", "0.7225367", "0.7168782", "0.7105438", "0.7103571", "0.68827987", "0.68807346", "0.6824061", "0.68058723", "0.67796344", "0.66644067", "0.6588232", "0.6488719", "0.6457609", "0.64117867", "0.6348168", "0.6261...
0.7850429
0
Creates an adset (formerly called ad campaign) for the given account and the campaign (formerly called "campaign group").
def create_adset(self, account_id, campaign_group_id, name, campaign_status, daily_budget=None, lifetime_budget=None, start_time=None, end_time=None, bid_type=None, bid_info=None, promoted_object=None, targeting=None, batch=False): if daily_budget i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_campaign(account, row, name, acc_type):\n country = None\n if acc_type == Account.COUNTRY:\n country_name = row['LOCATION']\n country = Country.objects.filter(name__iexact=country_name).first()\n if not country:\n logging.getLogger('peacecorps.sync_accounting').warn...
[ "0.64609", "0.6443122", "0.6287087", "0.62106", "0.59949636", "0.597882", "0.59783816", "0.5938531", "0.5885494", "0.5864603", "0.5810597", "0.5745423", "0.57439005", "0.57156086", "0.57071507", "0.56509084", "0.56193465", "0.5615964", "0.5598836", "0.5580792", "0.55519617", ...
0.73807245
0
Create a custom audience pixel for the given account. This method only needed once per ad account.
def create_custom_audience_pixel(self, account_id, batch=False): path = "act_%s/adspixels" % account_id return self.make_request(path, 'POST', batch=batch)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_custom_audience(self, account_id, name, subtype=None,\n description=None, rule=None, opt_out_link=None,\n retention_days=30, batch=False):\n path = \"act_%s/customaudiences\" % account_id\n args = {\n 'name': name,\n ...
[ "0.6403576", "0.62565124", "0.5535345", "0.5103156", "0.5053856", "0.49941942", "0.49930894", "0.49631172", "0.49131462", "0.49072927", "0.48941672", "0.48804632", "0.48549256", "0.4849889", "0.48173803", "0.48096266", "0.47709522", "0.47580764", "0.47232842", "0.47097245", "...
0.80888146
0
Test constructing an infinite feed when a feed option is set to an invalid value raises an exception.
def test_constructor_with_invalid_feed_option(self): feed = InfiniteFeed(self.db, feed='longpoll') with self.assertRaises(CloudantArgumentError) as cm: invalid_feed = [x for x in feed] self.assertEqual( str(cm.exception), 'Invalid infinite feed option: longpol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_feed_value_throws_on_invalid_data(self):\n self.assertRaises(\n ValueError, self.factory.make_from_feed_value, \"foo\", 1\n )", "def test_constructor_no_feed_option(self):\n feed = InfiniteFeed(self.db, chunk_size=1, timeout=100)\n self.assertEqual(feed._url, '/'.j...
[ "0.72401696", "0.70973885", "0.6830153", "0.6814605", "0.6310616", "0.6292677", "0.6060589", "0.6053885", "0.6037701", "0.5884711", "0.5862154", "0.58607936", "0.5860144", "0.5858658", "0.5857198", "0.578971", "0.5787647", "0.5776569", "0.5743222", "0.5715131", "0.5706377", ...
0.8217915
0
Gets or sets the tags.
def __init__(__self__, *, additional_properties: Optional[pulumi.Input[str]] = None): if additional_properties is not None: pulumi.set(__self__, "additional_properties", additional_properties)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags(self):\n return self.get(\"tags\")", "def getTags(self,):\n\t\treturn self.tags;", "def get_tags(self):\n return self.tags", "def tags(self):\n return self._changeset.get('tags', None)", "def tags(self) -> Optional[Any]:\n return pulumi.get(self, \"tags\")", "def get_...
[ "0.77664685", "0.7659798", "0.76226676", "0.7493399", "0.7487845", "0.74741375", "0.742301", "0.7404904", "0.7404904", "0.7404904", "0.7404904", "0.7404904", "0.7404904", "0.7404904", "0.7404904", "0.73948556", "0.737324", "0.737324", "0.7342291", "0.7342291", "0.7342291", ...
0.0
-1
Gets or sets the count of assessments reported by the solution.
def assessment_count(self) -> Optional[pulumi.Input[int]]: return pulumi.get(self, "assessment_count")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_count(self) -> int:\n return pulumi.get(self, \"test_set_count\")", "def get_scenario_count(self):\n return self.count", "def assessment_points(self) -> int:\n return self._assessment_points", "def validation_set_count(self) -> int:\n return pulumi.get(self, \"validat...
[ "0.655095", "0.6256413", "0.6221543", "0.60291547", "0.59234524", "0.5899697", "0.5858163", "0.5763119", "0.5760012", "0.57559884", "0.5745691", "0.5726684", "0.5713718", "0.56976104", "0.56974524", "0.56958336", "0.56958336", "0.5683292", "0.5681071", "0.5662276", "0.5566641...
0.75875336
0
Gets or sets the count of groups reported by the solution.
def group_count(self) -> Optional[pulumi.Input[int]]: return pulumi.get(self, "group_count")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ngroups(self):\n return self._ngroups", "def getNumGroups(self):\n return len(np.unique(self._group_index))", "def getNumGroups(self):\n return _libsbml.ListOfGroups_getNumGroups(self)", "def getNumGroups(self):\n return _libsbml.GroupsModelPlugin_getNumGroups(self)", "def n...
[ "0.7400885", "0.7161271", "0.7075182", "0.6943827", "0.69214857", "0.68017477", "0.64547825", "0.64547825", "0.6173699", "0.61217064", "0.60980016", "0.5956926", "0.5956926", "0.5956926", "0.59355694", "0.5882286", "0.58765113", "0.5858414", "0.5815837", "0.58114374", "0.5792...
0.721151
1
Gets or sets the purpose of the solution.
def purpose(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "purpose")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purpose(self) -> str:\n return pulumi.get(self, \"purpose\")", "def purpose(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"purpose\")", "def purpose(self):\n return self._purpose", "def purpose(self, purpose):\n\n self._purpose = purpose", "def purpose(self, purpos...
[ "0.7381015", "0.73635876", "0.73545533", "0.68121064", "0.68121064", "0.6228698", "0.5389133", "0.5388711", "0.51902056", "0.51759166", "0.5102519", "0.5102519", "0.4944245", "0.49320877", "0.49257827", "0.48774207", "0.4871906", "0.4851118", "0.48033178", "0.48033178", "0.48...
0.7400996
0
Gets or sets the current status of the solution.
def status(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "status")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetStatus(self):\r\n return self.status", "def getstatus(self):\n return self.__status", "def get_status(self):\n return self.status", "def get_status(self):\n return self.status", "def get_status(self):\n return self.status", "def get_status(self):\n # TODO retr...
[ "0.72206545", "0.71980965", "0.71754605", "0.71754605", "0.71754605", "0.71142036", "0.7095878", "0.7073005", "0.7055584", "0.7030392", "0.70284104", "0.70181185", "0.69804704", "0.69701344", "0.69701344", "0.69583994", "0.69503534", "0.69503534", "0.69378704", "0.69264144", ...
0.6633371
86
Draw horizontal lines across plot
def axhlines(ys, xmin=0, xmax=1, **kwargs): if "transform" in kwargs: raise ValueError("'transform' is not allowed as a kwarg;" + "axhlines generates its own transform.") # prepare data ys = np.array((ys, ) if np.isscalar(ys) else ys, copy=False) xmins = np.array((xmin,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_lines(self):\n self.plot(3)", "def _timeseries_scatter_plot_lines(axes):\n axes.axvline(\n x=0,\n ymin=-1000,\n ymax=1000,\n color=\"grey\",\n linestyle=\"dotted\",\n alpha=0.6,\n )\n axes.axhline(\n ...
[ "0.7391832", "0.72122693", "0.71925336", "0.7035633", "0.68159753", "0.6764779", "0.6574672", "0.6571076", "0.6547563", "0.6537479", "0.6484884", "0.64820987", "0.6436063", "0.6370062", "0.6348326", "0.63200414", "0.6308361", "0.6303083", "0.6249572", "0.6237525", "0.62173915...
0.0
-1
Draw vertical lines across plot
def axvlines(xs, ymin=0, ymax=1, **kwargs): if "transform" in kwargs: raise ValueError("'transform' is not allowed as a kwarg;" + "axvlines generates its own transform.") # prepare data xs = np.array((xs, ) if np.isscalar(xs) else xs, copy=False) ymins = np.array((ymin,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_lines(self):\n self.plot(3)", "def _timeseries_scatter_plot_lines(axes):\n axes.axvline(\n x=0,\n ymin=-1000,\n ymax=1000,\n color=\"grey\",\n linestyle=\"dotted\",\n alpha=0.6,\n )\n axes.axhline(\n ...
[ "0.7361519", "0.718621", "0.69693506", "0.69653594", "0.6927727", "0.6896577", "0.6677244", "0.6594238", "0.65782547", "0.64731646", "0.6448163", "0.63513243", "0.631119", "0.6239395", "0.6176174", "0.6175251", "0.61607856", "0.61378306", "0.6132018", "0.61089873", "0.6088035...
0.58112466
54
Search for a single cookbook of the specified name
def find_one_cookbook(name): return db.boxcar_cookbooks.find_one({'name': name})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookbook_search(search_term):\n return db.boxcar_cookbooks.find({'name': {'$regex':'^'+search_term}})", "def get_recipe_by_name(self, name):\n for key in self.recipe_list.keys():\n if name in self.get_recipes_by_types(key):\n for recipe in self.recipe_list[key]:\n ...
[ "0.7266315", "0.66256815", "0.6528147", "0.64047", "0.63835543", "0.61755985", "0.60229975", "0.59094644", "0.57915264", "0.573889", "0.56801695", "0.5435157", "0.5398273", "0.53891546", "0.5387135", "0.5348948", "0.5345011", "0.5339703", "0.52805656", "0.5240057", "0.5239863...
0.8132757
0
This function will save microburst data to a CSV file.
def saveData(self, fPath=None): keys = ['dateTime', 'dos1rate', 'peak_std', 'Lm_OPQ', 'MLT_OPQ', 'lat', 'lon', 'alt', 'Dist_In_Track', 'Lag_In_Track', 'Dist_Total','Loss_Cone_Type', 'flag'] # headerl1 = ['Microburst catalogue created on {}'.format( # datetime.now())] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_microtrips(self):\n for data in self.microtrip_data:\n file_name = \"../data/microtrips/\" + data.file.name + \"_m\" + \".csv\"\n data.save_csv(file_name)", "def save(self, data, outpath):\n data.to_csv(outpath)", "def save_csv(self, filename): # DONE\n self....
[ "0.70688546", "0.6881139", "0.6879607", "0.67490184", "0.6713802", "0.666279", "0.66253996", "0.6521193", "0.6448808", "0.63529104", "0.62716025", "0.6208062", "0.61897266", "0.6178907", "0.61324775", "0.6119791", "0.6088917", "0.6062749", "0.6046528", "0.60461986", "0.600355...
0.71242034
0
This method calculates the crosscorrelation of the counts array in the time range specified by tRange. times array is used to identify which counts to autocorrelate. This method also calculates the cross correlation of the two signals to determine if the micorbursts observed by both AC6 units are coincident. The ax arg...
def _crossCorrCounts(self, timesA, timesB, countsA, countsB, tRange, norm=True): validIdtA = np.where((countsA != -1E31) & (timesA > tRange[0]) & (timesA < tRange[1]))[0] x = countsA[validIdtA] - countsA[validIdtA].mean() validIdtB = np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _autoCorrCounts(self, times, counts, tRange, norm=True):\n validIdt = np.where((counts != -1E31) & \n (times > tRange[0]) & \n (times < tRange[1]))[0]\n x = counts[validIdt] - counts[validIdt].mean()\n # mode=same means that some edge e...
[ "0.6614545", "0.6281476", "0.6077013", "0.6034651", "0.5968193", "0.5919165", "0.5915795", "0.57973635", "0.5676885", "0.5622812", "0.56201494", "0.55895126", "0.5481448", "0.5457837", "0.5448213", "0.54476875", "0.5436288", "0.543615", "0.53927565", "0.53915906", "0.5390924"...
0.6914292
0
Return a list of precipitation data
def precipitation(): # Query all measurements results = session.query(Measurement).all() # Create a dictionary from the row data and append to a list of all_precipitation all_precipitation = [] for row in results: precipitation_dict = { row.date : row.prcp} all_precipitati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precipitation():\n # Query all dates and precipitation levels from the last year \n precip_data = session.query(Measurement.date, Measurement.prcp).filter(Measurement.date >= \"2016-08-23\").order_by(Measurement.date).all()\n # Convert list of tuples into normal list\n all_precip = list(np.ravel(pr...
[ "0.78816", "0.7798423", "0.7698067", "0.76334846", "0.7515021", "0.7474532", "0.7383328", "0.73414075", "0.7291235", "0.728914", "0.7214837", "0.7176989", "0.7170546", "0.7115024", "0.70473474", "0.70137256", "0.69776464", "0.69690835", "0.6946608", "0.69138", "0.6906709", ...
0.75110126
5
Saves Vocabulary into the specified path.
def save_vocab(self, output_path: str): logger.info("Saving vocab to `{}`".format(output_path)) with open(output_path, 'w') as f: f.write("\n".join(self.vocab))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_vocabulary(path, vocab):\n print('saving vocabulary..')\n with open(path, 'wb') as handle:\n pickle.dump(vocab, handle, protocol=pickle.HIGHEST_PROTOCOL)\n print('vocabulary was saved successfully!')", "def saveVocabulary(self, filepath, vocabulary):\n\t\timport numpy as np\n\t\tnp.save(...
[ "0.8479024", "0.7795142", "0.7705716", "0.7315229", "0.6960441", "0.690088", "0.68841904", "0.6854601", "0.68273455", "0.68266755", "0.6803383", "0.6786377", "0.6733177", "0.6728838", "0.6728838", "0.6728838", "0.6696269", "0.6660235", "0.66535765", "0.658486", "0.6517491", ...
0.70077986
4
return a random first name
def first_name(languages=None, genders=None): choices = [] languages = languages or ['en'] genders = genders or [GENDER_MALE, GENDER_FEMALE] for lang in languages: for gender in genders: samples = _get_firstnames(lang, gender) choices.extend(samples) return random.cho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name():\r\n return _random.choice([male_first(), female_first()])", "def get_random_male_name ():\n return db_random_pop_default(DB_FIRST_MALE, \"John\")", "def get_random_first_name (gender = None):\n if not gender:\n gender = random.choice(('f', 'm'))\n\n if gender == 'f':\n ret...
[ "0.80079764", "0.78751683", "0.7858733", "0.78114605", "0.77262163", "0.77241063", "0.77031565", "0.76948375", "0.7640683", "0.7600219", "0.7599545", "0.75879747", "0.7571556", "0.7462118", "0.7439875", "0.73706275", "0.7255335", "0.7249209", "0.72009265", "0.71606797", "0.71...
0.68387866
36
Assert that a package exists in redis
def assert_in_redis(self, pkg): self.assertTrue(self.redis.sismember(self.db.redis_set, pkg.name)) data = self.redis.hgetall(self.db.redis_key(pkg.filename)) dt = pkg.last_modified lm = calendar.timegm(dt.utctimetuple()) + dt.microsecond / 1000000.0 lm_str = ("%.6f" % lm).rstrip(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_subversion_package_installed(host):\n assert host.package(PACKAGE).is_installed", "def test_72_packages(host, pkg):\n assert host.package(pkg).is_installed", "def test_azurecli_package_installed(host):\n assert host.package(PACKAGE).is_installed", "def test_is_package_installed(self, mock_r...
[ "0.6934081", "0.6924417", "0.66299754", "0.6493026", "0.6456694", "0.6321571", "0.62864304", "0.62710935", "0.62278736", "0.61834127", "0.61584306", "0.61579615", "0.61522186", "0.6134971", "0.6124497", "0.6056061", "0.6053051", "0.6052222", "0.60043275", "0.5990259", "0.5973...
0.7310376
0