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 |
|---|---|---|---|---|---|---|
Sets the start_time of this Lecture. | def start_time(self, start_time: str):
if start_time is None:
raise ValueError("Invalid value for `start_time`, must not be `None`") # noqa: E501
self._start_time = start_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_time(self, start_time):\n\n self._start_time = start_time",
"def start_time(self, start_time):\n\n self._start_time = start_time",
"def start_time(self, start_time):\n\n self._start_time = start_time",
"def start_time(self, start_time):\n\n self._start_time = start_time"... | [
"0.78978467",
"0.78978467",
"0.78978467",
"0.78978467",
"0.78978467",
"0.7853389",
"0.7853389",
"0.73510754",
"0.71064264",
"0.69617724",
"0.67730093",
"0.67676353",
"0.67474306",
"0.67405975",
"0.6730982",
"0.66675365",
"0.64950955",
"0.64744717",
"0.6411847",
"0.6395347",
"... | 0.76731944 | 7 |
Gets the end_time of this Lecture. | def end_time(self) -> str:
return self._end_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_time(self):\n return self._end_time",
"def end_time(self):\n return self._end_time",
"def end_time(self):\n return self._end_time",
"def end_time(self):\n return self._end_time",
"def end_time(self):\n return self._end_time",
"def end_time(self):\n return... | [
"0.8050459",
"0.8050459",
"0.8050459",
"0.8050459",
"0.8050459",
"0.8050459",
"0.7970971",
"0.7950951",
"0.7831142",
"0.7831142",
"0.7830551",
"0.7797997",
"0.7722895",
"0.76305944",
"0.7596948",
"0.75146484",
"0.7486904",
"0.7441424",
"0.7293329",
"0.7276058",
"0.7262426",
... | 0.79418486 | 8 |
Sets the end_time of this Lecture. | def end_time(self, end_time: str):
if end_time is None:
raise ValueError("Invalid value for `end_time`, must not be `None`") # noqa: E501
self._end_time = end_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_time(self, end_time):\n\n self._end_time = end_time",
"def end_time(self, end_time):\n\n self._end_time = end_time",
"def end_time(self, end_time):\n\n self._end_time = end_time",
"def end_time(self, end_time):\n self._end_time = end_time",
"def end_time(self, end_time):... | [
"0.8274449",
"0.8274449",
"0.8274449",
"0.82414585",
"0.82414585",
"0.7973471",
"0.7636303",
"0.75974596",
"0.7155155",
"0.70956254",
"0.69571155",
"0.6666539",
"0.6634178",
"0.6634178",
"0.6634178",
"0.6634178",
"0.6634178",
"0.6634178",
"0.6634178",
"0.6634178",
"0.65700746... | 0.7882569 | 6 |
Gets the class_id of this Lecture. | 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_course_id(self):\n return self.ID",
"def cls_identifier(cls):\n if hasattr(cls, 'get_cls_identifier'):\n return cls.get_cls_identifier()\n ... | [
"0.7353974",
"0.6674232",
"0.6511782",
"0.59584546",
"0.59085643",
"0.5869867",
"0.57597595",
"0.5655547",
"0.5624244",
"0.56131154",
"0.56131154",
"0.5581881",
"0.5578442",
"0.5569536",
"0.5560987",
"0.55478126",
"0.55408806",
"0.55408806",
"0.55408806",
"0.55408806",
"0.554... | 0.7242636 | 2 |
Sets the class_id of this Lecture. | 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 set_course_id(self, course_id):\n self.ID = course_id",
"def setID(self, id):\r\n raise NotImplementedError(\"must be implemented in subclass\")",
"def set_id(self, id):\n self.id = id\n print(\"self id = \"... | [
"0.74610686",
"0.60954285",
"0.56949294",
"0.55519277",
"0.55006355",
"0.54993653",
"0.54268533",
"0.5404305",
"0.5404305",
"0.5404305",
"0.53917044",
"0.53917044",
"0.53917044",
"0.53917044",
"0.53917044",
"0.53917044",
"0.53917044",
"0.53917044",
"0.53917044",
"0.53917044",
... | 0.6864119 | 2 |
Create an instance of FormatTest from a JSON string | def from_json(cls, json_str: str) -> FormatTest:
return cls.from_dict(json.loads(json_str)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_json_str(cls, json_str):\n return cls.from_json(simplejson.loads(json_str))",
"def from_dict(cls, obj: dict) -> FormatTest:\n if obj is None:\n return None\n\n if not isinstance(obj, dict):\n return FormatTest.parse_obj(obj)\n\n _obj = FormatTest.parse_obj({... | [
"0.72056085",
"0.71650755",
"0.7152939",
"0.70663637",
"0.7041303",
"0.6945425",
"0.6911916",
"0.6911916",
"0.6907122",
"0.6835707",
"0.6716612",
"0.65697086",
"0.6556443",
"0.65102714",
"0.6501149",
"0.64701486",
"0.64358747",
"0.6422894",
"0.6401757",
"0.637159",
"0.6336676... | 0.90714556 | 0 |
Create an instance of FormatTest from a dict | def from_dict(cls, obj: dict) -> FormatTest:
if obj is None:
return None
if not isinstance(obj, dict):
return FormatTest.parse_obj(obj)
_obj = FormatTest.parse_obj({
"integer": obj.get("integer"),
"int32": obj.get("int32"),
"int64": o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_json(cls, json_str: str) -> FormatTest:\n return cls.from_dict(json.loads(json_str))",
"def __init_key_value_fmts__(self):\n self.test_desc_fmt = \"{0}.description\"\n self.test_svc_name_fmt = \"{0}.svc\"\n self.test_svc_ipc_id_fmt = \"{0}.svc.{1}.ipc_id\"\n self.test_... | [
"0.73265713",
"0.6508961",
"0.5935116",
"0.5933852",
"0.5797166",
"0.5790503",
"0.5759785",
"0.5755107",
"0.5755107",
"0.5755107",
"0.5755107",
"0.5755107",
"0.5755107",
"0.5755107",
"0.5755107",
"0.5755107",
"0.5755107",
"0.5755107",
"0.5755107",
"0.5755107",
"0.5755107",
... | 0.7767071 | 0 |
Constructs a ResNet50 model. | def Non_Local_50(last_stride, pretrained=False, **kwargs):
model = ResNet_IBN(last_stride, Bottleneck_IBN, [3, 4, 6, 3], **kwargs)
if pretrained:
model.load_state_dict(model_zoo.load_url(model_urls['resnet50']))
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet50(pretrained=False, **kwargs):\n model = ResNet(Bottleneck, [3, 4, 6, 3], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet50']))\n fc = transfer_fc(model.fc)\n model.fc = fc\n return model",
"def resnet50(**kwargs):\n model = ResNet(... | [
"0.7557751",
"0.75548905",
"0.74759895",
"0.74759895",
"0.74759895",
"0.74759895",
"0.74557495",
"0.7386862",
"0.7386862",
"0.73601955",
"0.7355623",
"0.724254",
"0.724254",
"0.7191571",
"0.7158499",
"0.7101107",
"0.70165247",
"0.69687796",
"0.68687624",
"0.6822836",
"0.68010... | 0.61416596 | 59 |
Check that the features have no nonzero values. | def _check_no_nonzero_features(self,
features: np.ndarray,
dropped_idx: np.ndarray,
axis: Optional[int] = None):
if axis is not None:
# Dropped node.
features_of_dropped_nodes = np.take(features, dropped_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_zero_dict( dict ):\n has_any_features = False\n for key in dict:\n has_any_features = has_any_features or dict[key]\n\n return not has_any_features",
"def missing_values():\n print('Missings in the train data:', train_data.isnull().sum())",
"def _no_nan(self, feature: np.array) -> boo... | [
"0.715689",
"0.70263296",
"0.699995",
"0.6911587",
"0.6896572",
"0.6856093",
"0.67827034",
"0.6735844",
"0.6627744",
"0.6601652",
"0.6585667",
"0.658505",
"0.6450972",
"0.6437291",
"0.64310044",
"0.64192814",
"0.6394166",
"0.637498",
"0.6368147",
"0.63661176",
"0.6365208",
... | 0.70470834 | 1 |
Check that the features have no nonzero values. | def _check_nonzero_features_exist_for_edge(self, features: np.ndarray,
added_edge_idx: np.ndarray):
features_of_added_edges = features[added_edge_idx[0], added_edge_idx[1]]
self.assertGreater(np.nonzero(features_of_added_edges)[0].shape[0], 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_zero_dict( dict ):\n has_any_features = False\n for key in dict:\n has_any_features = has_any_features or dict[key]\n\n return not has_any_features",
"def _check_no_nonzero_features(self,\n features: np.ndarray,\n dropped_idx:... | [
"0.715689",
"0.70470834",
"0.70263296",
"0.699995",
"0.6911587",
"0.6896572",
"0.6856093",
"0.67827034",
"0.6735844",
"0.6627744",
"0.6601652",
"0.6585667",
"0.658505",
"0.6450972",
"0.6437291",
"0.64310044",
"0.64192814",
"0.6394166",
"0.637498",
"0.6368147",
"0.63661176",
... | 0.0 | -1 |
Initializes a new Prisoner's Dilemma bot | def __init__(
self,
strategy,
game_matrix=(5, 3, 1, 0),
moves_to_play=10,
timeout=2 * 86400,
):
self.strategy = strategy
self.game_matrix = game_matrix
self.moves_to_play = moves_to_play
self.timeout = timeout
self.active_games = {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, bot=BNBot):\n self.bot = bot",
"def __init__(self, bot: DreamBot) -> None:\n\n self.bot = bot",
"def __init__(self, bot: DreamBot) -> None:\n\n self.bot = bot",
"def __init__(self, bot):\n self.bot = bot",
"def __init__(self, bot):\n self.bot = bot",
... | [
"0.66964024",
"0.66356987",
"0.66356987",
"0.6633444",
"0.6633444",
"0.6486887",
"0.6155306",
"0.6145671",
"0.6102929",
"0.604364",
"0.6033676",
"0.597167",
"0.5964047",
"0.59319836",
"0.59143066",
"0.59108484",
"0.5905162",
"0.5850603",
"0.5828123",
"0.58120465",
"0.57963",
... | 0.0 | -1 |
Check if a user is currently playing a game | def is_user_playing(self, user):
return user in self.active_games | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_playing(self, user):\n if not user:\n return False\n query = db.Query(GamePlayer)\n query.filter('game =', self)\n query.filter('user =', user)\n return query.get()",
"def still_playing_game(self):\n for player in self.players:\n if player.is_playing:\n... | [
"0.7661186",
"0.7609487",
"0.74736744",
"0.73754406",
"0.72276455",
"0.7142823",
"0.70668226",
"0.706388",
"0.7026013",
"0.69862264",
"0.6955046",
"0.68768084",
"0.68347967",
"0.68282586",
"0.6732331",
"0.6727946",
"0.6720424",
"0.6710322",
"0.6703267",
"0.6681726",
"0.660378... | 0.80397135 | 0 |
Save the active games to a JSON file | def save_active_games(self, filename):
with open(filename, "w") as json_file:
json.dump(self.active_games, json_file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_game(partie):\n fichier= open(\"save_game.json\",\"w\")\n json.dump(partie,fichier)\n fichier.close()",
"def save_game(partie):\n fichier = open(\"save/save_game.json\",\"w\")\n json.dump(partie, fichier, indent = 4)\n fichier.close()\n print(\"Votre partie a été sauvegardé.\")",
... | [
"0.7979202",
"0.76493907",
"0.7590941",
"0.7381697",
"0.6974829",
"0.6907696",
"0.688854",
"0.68545544",
"0.68219113",
"0.6800496",
"0.67979336",
"0.67927384",
"0.6783888",
"0.677024",
"0.6764501",
"0.67232555",
"0.67181206",
"0.6701246",
"0.66840845",
"0.66187453",
"0.661761... | 0.8926002 | 0 |
Check if a string is None or '' | def not_set(string):
if string is None:
return True
elif string == '':
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_str_none_or_empty(val):\n if val is None:\n return True\n if isinstance(val, string_types):\n val = val.strip()\n if not val:\n return True\n return False",
"def is_str_null(msg):\n\n if None == msg or \"\" == msg:\n return True\n return False",
"def is_null... | [
"0.8380628",
"0.8147659",
"0.8090322",
"0.78876567",
"0.78437126",
"0.77322865",
"0.76629514",
"0.7527874",
"0.7495503",
"0.7495058",
"0.741259",
"0.7385205",
"0.7305169",
"0.71613735",
"0.7144295",
"0.71230245",
"0.7112429",
"0.700029",
"0.6990177",
"0.69776165",
"0.6962203"... | 0.79753053 | 3 |
Calculate the circumference of the ellipse in kspace. | def extractEllipseCircum(kperp,kpar,aniso):
if aniso > 1.:
#print("Swapping axis for circumference")
aniso = 1. / aniso
# Define the eccentricity of the ellipse
e = np.sqrt( 1 - aniso**2 )
# Circumference function
f = lambda theta, e: np.sqrt( 1 - e**2 * np.sin(theta)**2 )
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def circumference(self):\n raise NotImplementedError",
"def circumference(self):\n return math.pi * self.radius * 2",
"def circumference(self):\n return (2 * math.pi * self.__radius)",
"def circumference(self):\n return self.width + self.height",
"def get_eccentricity(self, elli... | [
"0.7542874",
"0.7477559",
"0.7444662",
"0.71474785",
"0.70326",
"0.6612972",
"0.64619154",
"0.6338686",
"0.62937325",
"0.6238052",
"0.61738086",
"0.61431074",
"0.6140536",
"0.6109814",
"0.60329837",
"0.60329837",
"0.60238063",
"0.6021162",
"0.60197467",
"0.60122985",
"0.59859... | 0.6660898 | 5 |
Calculate the surface area of a prolate ellipse in kspace | def extractProlateEllipse(kperp,kpar,aniso):
if aniso > 1.:
#print("Swapping axis for prolate ellipse")
aniso = 1. / aniso
# Define the eccentricity of the ellipse
e = np.sqrt( 1. - aniso**2 )
# the prolate surface area
surface = 2. * np.pi * kpar**2. * ( 1. + (1. / ( e * np.sqrt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def surface_area(self) -> float:\n return 4 * np.pi * self.radius**2",
"def compute_surface_area(self):\n return np.sum(self._find_triangle_areas())",
"def ellipse_area(semi_major_axis: number, semi_minor_axis : number) -> number:\n area = pi*semi_major_axis*semi_minor_axis\n return area",
... | [
"0.7159604",
"0.6894981",
"0.6876723",
"0.6751813",
"0.6666548",
"0.66515845",
"0.65838814",
"0.65020275",
"0.65009433",
"0.6445634",
"0.6430918",
"0.6416986",
"0.6380101",
"0.63068354",
"0.62991846",
"0.624564",
"0.6229937",
"0.6226939",
"0.61894476",
"0.61805296",
"0.616044... | 0.68223184 | 3 |
Calculate the oblate surface area of the ellipse in kspace. | def extractOblateEllipse(kperp,kpar,aniso):
if aniso > 1.:
#print("Swapping axis for oblate ellipse")
aniso = 1. / aniso
# Define the eccentricity of the ellipse
e = np.sqrt( 1. - aniso**2. )
# the oblate surface area
surface = 2. * np.pi * kperp**2. * ( 1. + ( (1. - e**2.) / e ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def surface_area(self) -> float:\n return 4 * np.pi * self.radius**2",
"def ellipse_area(semi_major_axis: number, semi_minor_axis : number) -> number:\n area = pi*semi_major_axis*semi_minor_axis\n return area",
"def compute_surface_area(self):\n return np.sum(self._find_triangle_areas())",
... | [
"0.7200875",
"0.69119924",
"0.68317217",
"0.68092227",
"0.67726934",
"0.6751255",
"0.652906",
"0.65057003",
"0.64777905",
"0.63751495",
"0.6361914",
"0.63197243",
"0.6278068",
"0.6278068",
"0.62466496",
"0.6245",
"0.62327844",
"0.6228222",
"0.62144774",
"0.6209944",
"0.618591... | 0.6559198 | 6 |
Check [site/dist]packages are invalid paths. | def test_invalid_directories(qtbot, pathmanager):
if os.name == 'nt':
paths = ['/lib/site-packages/foo',
'/lib/dist-packages/foo']
else:
paths = ['/lib/python3.6/site-packages/foo',
'/lib/python3.6/dist-packages/foo']
def interact_message_box():
chi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_standard_dir(module_path):\n if 'site-packages' in module_path:\n return True\n for stdlib_path in _STDLIB_PATHS:\n if fnmatch.fnmatchcase(module_path, stdlib_path + '*'):\n return True\n return False",
"def test_pkglibdir(self):\n self.chck_triple('pkglibdir')"... | [
"0.6177853",
"0.6168212",
"0.6088944",
"0.59504443",
"0.590534",
"0.5861874",
"0.58167875",
"0.5750927",
"0.5630168",
"0.5625428",
"0.5520847",
"0.55201703",
"0.55014426",
"0.550134",
"0.54923314",
"0.5478087",
"0.54735816",
"0.54588866",
"0.5453948",
"0.5451754",
"0.544662",... | 0.5191868 | 73 |
Check behavior when an uncheked item that is already on the list is added. The checkbox should then be checked and if replying 'yes' to the question, then the item should be moved to the top. | def test_add_repeated_item(qtbot, pathmanager, tmpdir):
pathmanager.show()
dir1 = str(tmpdir.mkdir("foo"))
dir2 = str(tmpdir.mkdir("bar"))
dir3 = str(tmpdir.mkdir("spam"))
pathmanager.add_path(dir1)
pathmanager.add_path(dir2)
pathmanager.add_path(dir3)
pathmanager.set_row_check_state(1, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uncheck(self,item):\r\n raise AbstractError\r\n return False",
"def CheckItem2(self, item, checked=True, torefresh=False):\r\n\r\n if item.GetType() == 0:\r\n return\r\n \r\n item.Check(checked)\r\n\r\n if torefresh:\r\n dc = wx.ClientDC(self)\r... | [
"0.58831847",
"0.58699816",
"0.5777615",
"0.57754034",
"0.57634366",
"0.5657009",
"0.56040424",
"0.557114",
"0.5567227",
"0.55619365",
"0.5539434",
"0.5534078",
"0.55077076",
"0.5503502",
"0.54905605",
"0.54876333",
"0.54314977",
"0.5421907",
"0.5416492",
"0.5411488",
"0.5395... | 0.0 | -1 |
Fits the entire X on the Standard Scaler, by applying batching. X should be a Pandas Dataframe object that contains the entire data to scale. Batching is applied internally. | def fit(self, X, *_):
total_rows = X.shape[0]
index = 0
print('\n Partially fitting standard scaler...')
# FIT
while index < total_rows:
# Get current partial size
partial_size = min(self.batch_size, total_rows - index) # needed because last l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scale(X, *, axis=..., with_mean=..., with_std=..., copy=...):\n ...",
"def standardiser(self):\n # Select only numeric features first\n\n #self.X = self.data.loc[:, self.data.columns != self.target].values\n numeric_columns = []\n for col in self.X.columns:\n if self... | [
"0.6704836",
"0.6629506",
"0.6469029",
"0.6467289",
"0.6375017",
"0.63257504",
"0.6307187",
"0.62568945",
"0.62162447",
"0.61818045",
"0.6117089",
"0.611071",
"0.607885",
"0.6027622",
"0.602438",
"0.6024109",
"0.6018789",
"0.6016363",
"0.60056907",
"0.6002091",
"0.5981138",
... | 0.68015444 | 0 |
Gives all the animation layers within the given scene. | def layers(fbx_scene):
# -- Define a list to collate our matched
# -- layers into
all_layers = list()
# -- Cycle over all the obects in the scnee
for idx in range(fbx_scene.GetSrcObjectCount()):
# -- Check if this item is indeed an animation
# -- layer and scoop it if it is.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scenes_to_frames():\n # Scene 001 from frames 1-150\n cmd.scene('001', animate=0)\n cmd.mview('store', 1)\n cmd.mview('store', 150)\n # Scene 002 from frames 250-400\n cmd.scene('002', animate=0)\n cmd.mview('store', 250)\n cmd.mview('store', 400)",
"def layers(self):\n\n if no... | [
"0.6135658",
"0.6112896",
"0.6038333",
"0.60229766",
"0.5907195",
"0.58867455",
"0.5875615",
"0.58748084",
"0.58380866",
"0.5827579",
"0.5814715",
"0.5813224",
"0.5800828",
"0.5799145",
"0.57783026",
"0.5758493",
"0.5744893",
"0.57119346",
"0.5708228",
"0.56873524",
"0.565738... | 0.78155 | 0 |
Closes (terminates) the server and all of its clients. If applicable, also unregisters from the registry server | def close(self):
if self._closed:
return
self.active = False
if self.auto_register:
try:
self.registrar.unregister(self.port)
except Exception:
self.logger.exception("error unregistering services")
try:
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n self._server.shutdown()\n self._server = None",
"def close(self):\n self.shutdown()\n self._client.close()",
"def server_close(self):\n\t\tself.socket.close()",
"def closeConnecetion(self):\n client.close()",
"def close(self):\n self.Log.log(\"Server... | [
"0.73684007",
"0.71346515",
"0.70490557",
"0.69026774",
"0.6893506",
"0.678746",
"0.6764105",
"0.67566216",
"0.6605956",
"0.6577688",
"0.6531607",
"0.6524527",
"0.6519867",
"0.6514785",
"0.65145147",
"0.65106606",
"0.64572245",
"0.64361733",
"0.64358234",
"0.6407332",
"0.6405... | 0.71309227 | 2 |
Sets up miscellaneous in the cifar model constructor. | def _setup_misc(self, mode):
self.lr_rate_ph = tf.Variable(0.0, name='lrn_rate', trainable=False)
self.reuse = None if (mode == 'train') else True
self.batch_size = self.hparams.batch_size
if mode == 'eval':
self.batch_size = 25 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *, client=None, verbose=False, **kwargs):\n super().__init__(client=client, verbose=verbose, **kwargs)\n\n self.datatype = \"cupy\"\n\n # Make any potential model args available and catch any potential\n # ValueErrors before distributed training begins.\n self.... | [
"0.58930504",
"0.5872688",
"0.5799667",
"0.5726968",
"0.5705795",
"0.569441",
"0.5688317",
"0.56710577",
"0.566022",
"0.5654646",
"0.5644276",
"0.5628866",
"0.5623761",
"0.56180185",
"0.56139755",
"0.5609993",
"0.5605598",
"0.55985856",
"0.5595532",
"0.55952275",
"0.5570099",... | 0.0 | -1 |
Given an image, return the 128dimension face encoding for each face in the image. | def face_encodingsv1(face_image, known_face_locations=None, num_jitters=1):
raw_landmarks = _raw_face_landmarks(face_image, known_face_locations, model="small")
return [np.array(face_encoder.compute_face_descriptor(face_image, raw_landmark_set, num_jitters)) for raw_landmark_set in raw_landmarks] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def face_encodings(face_image, number_of_times_to_upsample = 1, num_jitters = 1):\n\n #Detect faces\n face_locations = detector(face_image, number_of_times_to_upsample)\n #Detected landmarks\n raw_landmarks = [pose_predictor_5_point(face_image, face_location) for face_location in face_locations]\n #... | [
"0.6634082",
"0.64463747",
"0.6428303",
"0.63680726",
"0.6329082",
"0.62497216",
"0.6230202",
"0.62290406",
"0.61566037",
"0.61552197",
"0.6109604",
"0.6085095",
"0.5972348",
"0.5919948",
"0.5896939",
"0.5896572",
"0.5874848",
"0.5874398",
"0.5863194",
"0.5857527",
"0.5840748... | 0.6729154 | 0 |
Get the value of this Node, recomputing it if necessary. | def value(self):
if self.state == Node.State.VALID:
return self._value
else:
with _NodeStackFrame(self):
self.state = Node.State.PENDING
self.value = self.compute_value(*self.args, **self.kwargs)
return self._value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value(self):\n return self.node_value",
"def get_node_value(self, n):\n node = self.get_node(n)\n if node:\n return node.value",
"def lazy_value(self):\n\n if self.state == Node.State.VALID:\n return self.value\n else:\n return None",
"d... | [
"0.80488527",
"0.77311784",
"0.7657559",
"0.7559423",
"0.7541743",
"0.74285644",
"0.73754966",
"0.73746586",
"0.73648286",
"0.73258895",
"0.73229456",
"0.7277463",
"0.725468",
"0.725468",
"0.725468",
"0.7246405",
"0.7246405",
"0.7246405",
"0.7242726",
"0.7242726",
"0.7232838"... | 0.79224616 | 1 |
Return the value of this Node if it is valid, or None if it is invalid. | def lazy_value(self):
if self.state == Node.State.VALID:
return self.value
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value(self):\n\n if self.state == Node.State.VALID:\n return self._value\n else:\n with _NodeStackFrame(self):\n self.state = Node.State.PENDING\n self.value = self.compute_value(*self.args, **self.kwargs)\n return self._value",
... | [
"0.74782825",
"0.727252",
"0.70933306",
"0.6988447",
"0.6906372",
"0.680765",
"0.67327774",
"0.6680654",
"0.66215914",
"0.6583123",
"0.6550216",
"0.6550216",
"0.65286213",
"0.6511381",
"0.64901125",
"0.64901125",
"0.64901125",
"0.64901125",
"0.64901125",
"0.64901125",
"0.6490... | 0.76068515 | 0 |
Return a random parameter set for the model. | def random():
# only care about the value of second_moment:
# curve = scale * e**(-second_moment^2 q^2)/q^2
# scale = 6 pi/100 (contrast/density*absorbed_amount)^2 * Vf/radius
# the remaining parameters can be randomly generated from zero to
# twice the default value as done by default in comp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_individual():\r\n return [ random.random() for _ in range(PARAMETERS_COUNT) ]",
"def get_random_fit_parameters(self):\n all_random = self.par_obj.get_random_all()\n return np.asarray([all_random[p] for p in self.fit_parameters])",
"def generate_params(self, randomize=True):\n ... | [
"0.71404666",
"0.6880614",
"0.68059534",
"0.6634644",
"0.6539095",
"0.63720685",
"0.6308819",
"0.62558764",
"0.62219083",
"0.6213681",
"0.61988467",
"0.6198028",
"0.61554956",
"0.6154143",
"0.61520594",
"0.6131589",
"0.61241823",
"0.6102374",
"0.606971",
"0.606971",
"0.602846... | 0.0 | -1 |
Create and save a superuser in the system | def create_superuser(self, name, password):
user = self.create_user(name=name, password=password)
user.is_staff = True
user.is_superuser = True
user.save()
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_superuser(username, email, password):\n if username and email and password:\n user, created = User.objects.get_or_create(pk=defaults.USERWARE_SUPERUSER_ID)\n if user:\n user.username = username\n user.email = email\n user.set_password(password)\n ... | [
"0.7753575",
"0.7690784",
"0.76825833",
"0.7602461",
"0.7573189",
"0.75504273",
"0.7488508",
"0.74881834",
"0.7479068",
"0.74632204",
"0.7451344",
"0.7437219",
"0.7406005",
"0.73535126",
"0.7334169",
"0.7309624",
"0.7303991",
"0.73026824",
"0.7292748",
"0.7290682",
"0.7283824... | 0.7000059 | 77 |
Returns starting state of the board. | def initial_state():
return [[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_state(self):\r\n return np.zeros(self.board_size, dtype=np.int8)",
"def start_state():\n return chess.Board()",
"def startingState(self):\n # Returns starting position and 4 false because no corners are visited yet\n return (self.startingPosition, (False, False, False, False))... | [
"0.8081514",
"0.7890486",
"0.7534929",
"0.72789717",
"0.72789717",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
... | 0.0 | -1 |
Returns the optimal action for the current player on the board. | def minimax(board):
player_moving = player(board)
if board == [[EMPTY] * 3] * 3:
return (0, 0)
if player_moving == X:
value = -math.inf
selected_action = None
for action in actions(board):
minValueResult = minValue(result(boar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_best_action(self):\n if self.bestAction is None:\n self.calculate_best_action()\n return self.bestAction",
"def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = min... | [
"0.7766856",
"0.76323676",
"0.75855315",
"0.75285065",
"0.75175256",
"0.74667144",
"0.7460485",
"0.74263537",
"0.7416421",
"0.73943585",
"0.7375846",
"0.7333894",
"0.73147565",
"0.7306611",
"0.7284639",
"0.72650313",
"0.72650313",
"0.7250975",
"0.72331834",
"0.7203267",
"0.71... | 0.69443065 | 45 |
Returns the lower boundaries for all parameters (as a readonly NumPy array). | def lower(self):
return self._lower | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_values(self, lower, upper): \n if not self.lower_bounds is None:\n return self.lower_bounds\n\n minus = np.clip(self.coeffs,-math.inf,0)\n plus = np.clip(self.coeffs,0,math.inf)\n self.lower_bounds = plus.dot(lower) + minus.dot(upper) + self.const\n \n ... | [
"0.7117606",
"0.7099254",
"0.68315625",
"0.6695195",
"0.6691808",
"0.6691808",
"0.65523887",
"0.654791",
"0.65461206",
"0.6538092",
"0.6516753",
"0.6502461",
"0.64723295",
"0.6416773",
"0.63124907",
"0.62447256",
"0.6232234",
"0.62209016",
"0.6203721",
"0.62023944",
"0.619834... | 0.0 | -1 |
Returns the upper boundary for all parameters (as a readonly NumPy array). | def upper(self):
return self._upper | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_params_bounds(self) -> np.array:\n pass",
"def upper_bound(self) -> float:\n ...",
"def upper_bound(height):\n tan_72 = math.tan(math.radians(72))\n upper_boundary = 250 + height / tan_72\n return upper_boundary",
"def max_values(self, lower, upper):\n if not self.upper_... | [
"0.70051146",
"0.68281335",
"0.6715063",
"0.66400033",
"0.66173834",
"0.66080517",
"0.6556253",
"0.6535023",
"0.64802593",
"0.64450204",
"0.64136314",
"0.63994694",
"0.6290687",
"0.6256371",
"0.625454",
"0.6246436",
"0.60911506",
"0.608183",
"0.6076876",
"0.6062505",
"0.60410... | 0.0 | -1 |
Test 'load_component_from_config' method when a generic "Exception" occurs. | def test_component_loading_generic_exception(component_configuration):
with mock.patch.object(
Protocol, "from_config", side_effect=Exception("Generic exception")
):
with pytest.raises(
Exception, match="Package loading error: An error occurred while loading"
):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_component_loading_component_exception(component_configuration):\n\n with mock.patch.object(\n Protocol,\n \"from_config\",\n side_effect=AEAComponentLoadException(\"Generic exception\"),\n ):\n with pytest.raises(\n AEAPackageLoadingError,\n match=\"... | [
"0.7694098",
"0.75812274",
"0.7427025",
"0.7224428",
"0.69574916",
"0.6944989",
"0.67634404",
"0.6624017",
"0.65688837",
"0.65611595",
"0.65355974",
"0.6502168",
"0.64816165",
"0.64613295",
"0.6364778",
"0.6346705",
"0.6338096",
"0.632564",
"0.6277667",
"0.6274802",
"0.617288... | 0.8013675 | 0 |
Test 'load_component_from_config' method when a generic "Exception" occurs. | def test_component_loading_instantiation_exception(component_configuration):
with mock.patch.object(
Protocol,
"from_config",
side_effect=AEAInstantiationException("Generic exception"),
):
with pytest.raises(AEAInstantiationException):
load_component_from_config(comp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_component_loading_generic_exception(component_configuration):\n\n with mock.patch.object(\n Protocol, \"from_config\", side_effect=Exception(\"Generic exception\")\n ):\n with pytest.raises(\n Exception, match=\"Package loading error: An error occurred while loading\"\n ... | [
"0.8013675",
"0.7694098",
"0.7427025",
"0.7224428",
"0.69574916",
"0.6944989",
"0.67634404",
"0.6624017",
"0.65688837",
"0.65611595",
"0.65355974",
"0.6502168",
"0.64816165",
"0.64613295",
"0.6364778",
"0.6346705",
"0.6338096",
"0.632564",
"0.6277667",
"0.6274802",
"0.6172880... | 0.75812274 | 2 |
Test 'load_component_from_config' method when a generic "Exception" occurs. | def test_component_loading_component_exception(component_configuration):
with mock.patch.object(
Protocol,
"from_config",
side_effect=AEAComponentLoadException("Generic exception"),
):
with pytest.raises(
AEAPackageLoadingError,
match="Package loading err... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_component_loading_generic_exception(component_configuration):\n\n with mock.patch.object(\n Protocol, \"from_config\", side_effect=Exception(\"Generic exception\")\n ):\n with pytest.raises(\n Exception, match=\"Package loading error: An error occurred while loading\"\n ... | [
"0.8010544",
"0.75787014",
"0.74252987",
"0.7224743",
"0.69575506",
"0.69423765",
"0.67620856",
"0.66233367",
"0.65681225",
"0.6559281",
"0.65336764",
"0.65011436",
"0.6480725",
"0.64603287",
"0.6364254",
"0.63455033",
"0.633477",
"0.63241553",
"0.6277284",
"0.62737477",
"0.6... | 0.76908773 | 1 |
Stores the attributes of a tag in a dictionary. | def add_attribute(self, attribute_name, attribute_value):
self.attributes[attribute_name] = attribute_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags_dict(self):\n return ({'name': 'tag', 'attrs': {'k': k, 'v': v}} for k, v in self.tags.items())",
"def store_attrs(self, attrs):\n self.get_attr().SetObject(dumps(attrs), False)",
"def get_tag_dict(self):\n return self.tag_dict",
"def get_attributes(self):\n \n ... | [
"0.7044136",
"0.6536197",
"0.6324168",
"0.6172891",
"0.61409515",
"0.60883915",
"0.60883915",
"0.60883915",
"0.6087739",
"0.6077561",
"0.6049255",
"0.60456973",
"0.59948903",
"0.5956138",
"0.595407",
"0.59439206",
"0.5927359",
"0.5905187",
"0.58916354",
"0.5889323",
"0.587296... | 0.0 | -1 |
Perform GET method on the endpoint and check if we receive 405 | def test_add_hmac_signature_get(self):
resp = self.client.get("/")
self.assertTrue(resp.status_code == 405) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_GET(self):\n if not self.url:\n return\n response = self.client.get(self.url, {}, format='json')\n self.assertIn(response.status_code, [status.HTTP_405_METHOD_NOT_ALLOWED,\n status.HTTP_401_UNAUTHORIZED])",
"def test_bad_method(... | [
"0.76400095",
"0.7546706",
"0.7514393",
"0.7476193",
"0.7385389",
"0.7265121",
"0.7179176",
"0.7157427",
"0.7154184",
"0.7124923",
"0.71095026",
"0.70167583",
"0.70048434",
"0.6987717",
"0.6947445",
"0.69247276",
"0.6891652",
"0.6878801",
"0.682469",
"0.6819237",
"0.6789675",... | 0.6244498 | 58 |
This function takes a string and returns a list of features. These include Sentiment scores, Text and Readability scores, as well as Twitter specific features. This is modified to only include those features in the final model. | def other_features_(tweet, cleaned_tweet):
#print("WARNING>>>>>>>>>>>>>>>>> VADERSENTIMENT DISABLED")
sentiment = nlp.sentiment_analyzer.polarity_scores(tweet)
words = cleaned_tweet #Get text only
syllables = textstat.syllable_count(words) #count syllables in words
num_chars = sum(len(w) for w in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sent_features(tweet):\n twitter_objs = count_twitter_objs(tweet)\n tweet=clean_tweet(tweet) \n sentiment = sentiment_analyzer.polarity_scores(tweet)\n #Get text only\n words = preprocess(tweet) \n syllables = textstat.syllable_count(words)\n num_chars = sum(len(w) for w in words)\n nu... | [
"0.70782536",
"0.7040236",
"0.6782933",
"0.6626027",
"0.65309703",
"0.6374951",
"0.6285857",
"0.6272349",
"0.6271047",
"0.6265974",
"0.62368155",
"0.6174017",
"0.6107855",
"0.60998917",
"0.6091702",
"0.60596555",
"0.6043088",
"0.6025044",
"0.60156405",
"0.60036033",
"0.600304... | 0.7045381 | 1 |
Returns the absolute path to the work4core root directory | def get_root_dir():
return os.path.dirname(os.path.dirname(__file__)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def work_root(session):\n return session[\"AVALON_WORKDIR\"]",
"def get_root_directory() -> str:\n return \"{}/../\".format(get_cur_directory(__file__))",
"def rootdir():\n return util.path(__file__).parent.parent.abspath()",
"def root_dir():\r\n return Path(__file__).parent.parent",
"def root_... | [
"0.7564594",
"0.7564112",
"0.7523455",
"0.75193596",
"0.75117856",
"0.7451704",
"0.7450511",
"0.7428034",
"0.74266756",
"0.7410401",
"0.7410401",
"0.73981804",
"0.7334535",
"0.7327549",
"0.7327411",
"0.7290509",
"0.71993095",
"0.71828395",
"0.71701354",
"0.7140639",
"0.713001... | 0.7429265 | 7 |
get the earliest start time | def _get_earliest_start(self, valid_list):
return min([item.coords["time"].values[0] for item in valid_list]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_start_time(self):\n return min([m.get_start_time() for m in self._mappers])",
"def start_time(self):\n # TODO: use pd.Timestamp instead\n return self.time[0].to_pydatetime()",
"def get_start_time(self):\n start = datetime.strptime(\n self.get_handler().SOURCE_STAR... | [
"0.7904492",
"0.75466543",
"0.75274634",
"0.7516826",
"0.7444923",
"0.7394031",
"0.7366929",
"0.7358133",
"0.7342951",
"0.7315266",
"0.72840464",
"0.7266855",
"0.7255165",
"0.7253651",
"0.7215846",
"0.720153",
"0.7184769",
"0.7182742",
"0.71795",
"0.71795",
"0.7179441",
"0.... | 0.7496263 | 4 |
get the earliest start time | def _get_latest_end(self, valid_list):
return max([item.coords["time"].values[-1] for item in valid_list]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_start_time(self):\n return min([m.get_start_time() for m in self._mappers])",
"def start_time(self):\n # TODO: use pd.Timestamp instead\n return self.time[0].to_pydatetime()",
"def get_start_time(self):\n start = datetime.strptime(\n self.get_handler().SOURCE_STAR... | [
"0.7904492",
"0.75466543",
"0.75274634",
"0.7516826",
"0.7496263",
"0.7444923",
"0.7394031",
"0.7366929",
"0.7358133",
"0.7342951",
"0.7315266",
"0.72840464",
"0.7266855",
"0.7255165",
"0.7253651",
"0.7215846",
"0.720153",
"0.7184769",
"0.7182742",
"0.71795",
"0.71795",
"0.... | 0.0 | -1 |
Wrapper for internal `_get_related_managers` helper function to return object managers for `ViewFilterField` subclasses related to this view. | def getViewFilterFieldManagers(self):
return _get_related_managers(self, ViewFilterField) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFilterSetFilterFieldManagers(self):\n return _get_related_managers(self, FilterSetFilterField)",
"def _get_related_managers(obj, parent_class=False):\n foreign_object_relations = obj._meta._get_fields(False)\n foreign_managers = []\n\n for rel in foreign_object_relations:\n # Check ... | [
"0.7673704",
"0.75670004",
"0.6656878",
"0.6375647",
"0.603448",
"0.5913615",
"0.5870517",
"0.5753742",
"0.55259866",
"0.54950815",
"0.54902476",
"0.5428224",
"0.53994817",
"0.53693986",
"0.53422767",
"0.5246818",
"0.5202122",
"0.5202122",
"0.51900077",
"0.51881343",
"0.51529... | 0.838918 | 0 |
Return combined view and filter set filters for this filter set as complex SQL query using django's `Q` object. See | def getQuery(self):
# Get a list of object managers, each of which containing the
# corresponding view and filter set filter field objects of all
# available filter set classes.
filter_field_managers = [
manager for manager in self.getFilterSetFilterFieldManagers()
] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_query(self):\r\n # build query from base class add required field for joining with parent\r\n query = super().build_query()\r\n query = query.filter(Metric.metric_id == QuantModelMetric.metric_id)\r\n\r\n # get the remaining query parameters\r\n asset_class = request.ar... | [
"0.69498235",
"0.6817873",
"0.66681087",
"0.6603983",
"0.65459216",
"0.6542415",
"0.65051174",
"0.64843875",
"0.63899416",
"0.63863236",
"0.636133",
"0.63312495",
"0.6302378",
"0.6283031",
"0.6273375",
"0.6261124",
"0.6258152",
"0.62419015",
"0.6236609",
"0.622339",
"0.621357... | 0.7685064 | 0 |
Construct a django query that identifies the DMARC aggregate report record field, on which a given filter should be applied, using the filter's `record_field`. The returned query can be passed to | def getRecordFilter(self):
# Replace dots with double underscore to get the notation that is
# required by `Q`. Note that we could use that notation right away, but
# IMHO dot notation, is nicer to read.
key = self.record_field.replace(".", "__").lower()
return Q(**{key: self.va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRecordFilter(self):\n return Q(**{\"report__report_type\": self.value})",
"def getRecordFilter(self):\n begin, end = self.getBeginEnd()\n return (Q(**{\"report__date_range_begin__gte\" : begin})\n & Q(**{\"report__date_range_begin__lte\": end}))",
"def build_query(sel... | [
"0.62020826",
"0.5905744",
"0.57087433",
"0.5448087",
"0.5404933",
"0.5381562",
"0.53744197",
"0.52956134",
"0.5250154",
"0.5234709",
"0.5187754",
"0.51727146",
"0.51005816",
"0.5056244",
"0.50557643",
"0.49859574",
"0.49843878",
"0.49139926",
"0.48932806",
"0.48905113",
"0.4... | 0.61123425 | 1 |
Plots histogram of total on time and fits to lognormal distribution | def fn_total_ontime_hist(file_name,folder,total_ontime):
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import lognorm
from pylab import text
n_molecules=len(total_ontime)
#Plot histogram
figure_name=file_name+'_totalOntime'
ax = plt.subplot(111)
num_bi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PlotLogPHistogram(lag):\n (n,bins) = pylab.mlab.hist(P(lag), bins=100, normed=True)\n binCenters = bins + (bins[1]-bins[0])/2.\n pylab.plot(binCenters, scipy.log(n+1.e-4))",
"def fn_onstatetime_hist(file_name,folder,mean_onstatetime,distribution):\n import numpy as np\n import matplotlib.pyplot a... | [
"0.748579",
"0.6846742",
"0.68174237",
"0.65977687",
"0.6582518",
"0.65761",
"0.6541484",
"0.64449924",
"0.63986886",
"0.6389414",
"0.6385438",
"0.633197",
"0.6327476",
"0.6318066",
"0.62768155",
"0.6236992",
"0.620816",
"0.618781",
"0.6169482",
"0.61642456",
"0.6147361",
"... | 0.73218334 | 1 |
normalizes all elements in matrix to be between min val and max val | def normalize_matrix(matrix, min_val, max_val):
return (max_val - min_val) * (matrix - np.min(matrix)) / (np.max(matrix) - np.min(matrix)) + min_val | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(self):\r\n max = np.amax(self.matrix)\r\n min = np.amin(self.matrix)\r\n\r\n self.matrix = ((self.matrix - min) / (max - min))",
"def normalize_matrix(mat):\n return (mat + abs(mat.min())) / (mat.max() - mat.min())",
"def normalize(arr):\n m = np.min(arr)\n arr = arr... | [
"0.7780492",
"0.7679713",
"0.76524216",
"0.7441244",
"0.737296",
"0.7339797",
"0.7297136",
"0.7139391",
"0.7138429",
"0.7074274",
"0.7038782",
"0.70178646",
"0.70165086",
"0.70049113",
"0.6982484",
"0.6982484",
"0.69524837",
"0.694999",
"0.69189876",
"0.6910423",
"0.69007653"... | 0.8292069 | 0 |
Gets the credentials for a service account. | def get_for_service_account(cls, client_email, private_key_path, scope=None):
return client.SignedJwtAssertionCredentials(
service_account_name=client_email,
private_key=open(private_key_path).read(),
scope=scope) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_credentials():\n return ServiceAccountCredentials.from_json_keyfile_dict(SERVICE_ACCOUNT, scopes = SCOPES)",
"def _GetCredentials():\n return service_account.Credentials.from_service_account_file(\n KEY_FILE, scopes=_SCOPES)",
"def _obtain_service_account_creds(self) -> service_account.Credent... | [
"0.844989",
"0.7945112",
"0.79165703",
"0.72852755",
"0.70223814",
"0.6949476",
"0.69353163",
"0.6913689",
"0.6913689",
"0.686889",
"0.68177617",
"0.6807878",
"0.67853594",
"0.678108",
"0.677965",
"0.6730439",
"0.66872334",
"0.66720283",
"0.66154087",
"0.6585609",
"0.6585609"... | 0.0 | -1 |
Returns True if the stage is not moving else False | def status(self):
return not self.sendQuery("isMoving","isMoving") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ismoving(self):\n return self.dp.state()==PyTango.DevState.MOVING",
"def ismoving(self):\n return not self.get_par(\"done_moving\")",
"def is_moving(self):\n is_moving = self.get_raw_status() & self.STATUS_MOVING\n return bool(is_moving)",
"def is_moving(self):\n return self.steps... | [
"0.8148055",
"0.8015617",
"0.8008981",
"0.7810897",
"0.75548655",
"0.75329924",
"0.74352425",
"0.74114543",
"0.7406109",
"0.734227",
"0.7340906",
"0.73069733",
"0.7279602",
"0.71412176",
"0.7131155",
"0.71139365",
"0.7082804",
"0.70670354",
"0.70498604",
"0.7044471",
"0.69656... | 0.70272326 | 20 |
Given two arrays of equal length, returns the dot product | def dot_product(a, b):
if len(a) != len(b):
raise ValueError('Arrays are of different lengths')
else:
return [a[i] * b[i] for i in range(len(a))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dot(a, b):\n return np.vdot(a.arr,b.arr)",
"def dot(a, b):\n\n if len(a) != len(b):\n raise Exception(\"Input vectors must be of same length, not %d and %d\" % (len(a), len(b)))\n\n return float(sum([a[i] * b[i] for i in range(len(a))]))",
"def dotproduct(x, y):\n return sum(... | [
"0.8168194",
"0.8085179",
"0.8082298",
"0.80732435",
"0.8057813",
"0.80574197",
"0.80077267",
"0.7980882",
"0.79410774",
"0.7903256",
"0.78974766",
"0.7849455",
"0.77736664",
"0.7756083",
"0.77524596",
"0.77300036",
"0.7727709",
"0.7695775",
"0.7694204",
"0.76861256",
"0.7653... | 0.86842394 | 0 |
Checks if item is present in the parent_codecolumn. | def is_parent(self, item):
if len(self.df.loc[self.df['parent_code']==item, :]):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __contains__(self, item):\n if item in self._parents:\n return True\n else:\n return False",
"def contains_parent(self, pid):\n return pid in self._parent_ids",
"def has_parent(self):\n return False",
"def has_parent(self):\n return self.parent != ... | [
"0.68456125",
"0.66428536",
"0.6431903",
"0.642271",
"0.6340456",
"0.6277446",
"0.6243573",
"0.61272943",
"0.6120095",
"0.61083996",
"0.6018719",
"0.59700954",
"0.5959091",
"0.5873949",
"0.5865746",
"0.5862802",
"0.57794744",
"0.5657717",
"0.5619488",
"0.5589066",
"0.5559495"... | 0.8074214 | 0 |
w is a writer v is the max cycle length i is the beginning of the range, inclusive j is the end of the range, inclusive return a generator of a string of i, j, and the max cycle length | def collatz_print (a) :
return (str(i) + " " + str(j) + " " + str(v) + "\n" for i, j, v in a) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writer():\n while True:\n w = (yield)\n print('>> ', w)",
"def rangemaker(chunksize, maxnums):\n assert chunksize > 0\n for i in xrange(0, maxnums, chunksize):\n max=i+(chunksize-1)\n if max > maxnums:\n max=maxnums\n rv = str(i) + ':' + str(max)\n ... | [
"0.57694894",
"0.5699775",
"0.55365074",
"0.5516678",
"0.5197595",
"0.51657355",
"0.5159179",
"0.51533216",
"0.51022714",
"0.5083129",
"0.50680536",
"0.5065828",
"0.4989478",
"0.49623933",
"0.49583882",
"0.49451745",
"0.49428624",
"0.49407706",
"0.49395156",
"0.49394676",
"0.... | 0.0 | -1 |
Computes the average precision at k. This function computes the average prescision at k between two lists of items. | def apk(actual, predicted, k=3):
actual = set(actual)
predicted = list(predicted)
if len(predicted) > k:
predicted = predicted[:k]
score = 0.0
num_hits = 0.0
for i, p in enumerate(predicted):
if p in actual and p not in set(predicted[:i]):
num_hits += 1.0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\n return np.mean(r)",
"def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance sco... | [
"0.74766606",
"0.74325645",
"0.73293334",
"0.7281749",
"0.72707987",
"0.71305406",
"0.7086452",
"0.6987436",
"0.69284755",
"0.6889224",
"0.6822652",
"0.6815056",
"0.6806646",
"0.6796952",
"0.6775868",
"0.67674536",
"0.67674536",
"0.67645514",
"0.6691769",
"0.66759485",
"0.661... | 0.6234738 | 30 |
In an array containing positive and negative integers, find the subarray which sum is the biggest possible. Relies on the fact that if the integral of a segment goes under zero, the biggest sum cannot include this segment. the value of the max subarray sum | def max_subarray(array):
max_sum = 0
max_local_sum = 0
for i, value in enumerate(array):
max_local_sum += value
if max_local_sum < 0:
max_local_sum = 0
else:
max_sum = max(max_sum, max_local_sum)
return max_sum | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_noncontiguous_subarray(array):\n if len(array) > 0:\n all_negative = True\n max_negative = None\n sum_items = 0\n for item in array:\n if item >= 0:\n all_negative = False\n sum_items += item\n else:\n if max_... | [
"0.78470874",
"0.7330974",
"0.73009425",
"0.730007",
"0.7211311",
"0.71747154",
"0.7076933",
"0.69107276",
"0.6883145",
"0.6793926",
"0.6758618",
"0.67297465",
"0.6688371",
"0.6686794",
"0.6665688",
"0.66571814",
"0.66415286",
"0.66271996",
"0.6620911",
"0.65534914",
"0.65437... | 0.75831074 | 1 |
Test we ignore missing hostnames. | async def test_dhcp_missing_hostname(hass: HomeAssistant) -> None:
integration_matchers = [{"domain": "mock-domain", "hostname": "nomatch*"}]
packet = Ether(RAW_DHCP_REQUEST)
packet[DHCP].options = [
("message-type", 3),
("max_dhcp_size", 1500),
("requested_addr", "192.168.210.56")... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_host_header_mismatch_empty(self):\n client = self.base_scenario(\n frang_config=\"http_strict_host_checking true;\",\n requests=[\"GET http://user@tempesta-tech.com/ HTTP/1.1\\r\\nHost: \\r\\n\\r\\n\"],\n )\n self.check_response(client, status_code=\"403\", warni... | [
"0.7251513",
"0.7094797",
"0.7006756",
"0.6987247",
"0.6932508",
"0.68728155",
"0.6848595",
"0.67853355",
"0.67853355",
"0.66923285",
"0.6627029",
"0.66187954",
"0.65839094",
"0.6572845",
"0.6533013",
"0.6495498",
"0.6491885",
"0.6469106",
"0.6457726",
"0.6414524",
"0.6413847... | 0.6241362 | 39 |
Creates a new `CrypTensor` object. The `requires_grad` flag determines if computations on the created tensor are logged on the autograd tape. | def __init__(self, requires_grad=False):
self.requires_grad = requires_grad # whether tensors needs gradient
self._reset_gradients() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, tensor, ptype=Ptype.arithmetic, device=None, *args, **kwargs):\n if tensor is None:\n raise ValueError(\"Cannot initialize tensor with None.\")\n\n # take required_grad from kwargs, input tensor, or set to False:\n default = tensor.requires_grad if torch.is_tensor... | [
"0.6503671",
"0.5299737",
"0.50433457",
"0.5035736",
"0.49798328",
"0.48001382",
"0.47871748",
"0.4752836",
"0.47472954",
"0.4709409",
"0.46827444",
"0.4652915",
"0.45885384",
"0.45638588",
"0.45577496",
"0.4551549",
"0.45347035",
"0.45040512",
"0.44957215",
"0.44736803",
"0.... | 0.54103994 | 1 |
Resets gradient information in tensor. | def _reset_gradients(self):
self.grad = None # gradient itself
self.grad_fn = None # functions to call for gradient
self.grad_expected = 0 # number of gradients expected from parents
self.grad_received = 0 # number of gradients received from parents
self.children = [] # chil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_grad(self):\n self.unet.zero_grad()",
"def reset_grad(self):\r\n self.unet.zero_grad()",
"def reset_grad(self):\n self.optimizer.zero_grad()",
"def reset_grad(self):\r\n self.g_optimizer.zero_grad()",
"def reset_grad(self):\n self.g_optimizer.zero_grad()",
"de... | [
"0.73682475",
"0.7363172",
"0.7182911",
"0.70661324",
"0.7042339",
"0.70316774",
"0.70316774",
"0.70316774",
"0.70244026",
"0.70182234",
"0.6572301",
"0.6551169",
"0.65177476",
"0.643338",
"0.6390841",
"0.63473725",
"0.63433313",
"0.63087964",
"0.6259657",
"0.62438875",
"0.61... | 0.68139714 | 10 |
Returns 1 for elements that are < 0 and 0 otherwise | def _ltz(self):
raise NotImplementedError("_ltz is not implemented") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_gt_zero(x):\r\n s = x[0] + x[1]\r\n if s > 0.0:\r\n return 1.0\r\n return 0.0",
"def onlyonepositive(a):\n nbr = 0\n for e in a:\n if e >= 0: \n nbr += 1\n if nbr>1: return False\n return nbr==1",
"def check_zero(col):\n return np.sum(col == 0.0)... | [
"0.74051756",
"0.7197721",
"0.6997576",
"0.6921174",
"0.68914616",
"0.6819794",
"0.681153",
"0.6689386",
"0.66814435",
"0.66217",
"0.6593623",
"0.65692",
"0.65562886",
"0.64516866",
"0.6442257",
"0.6434986",
"0.6418798",
"0.6418798",
"0.6398689",
"0.63680416",
"0.6319782",
... | 0.0 | -1 |
Helper function turning a target 1D vector into a column if needed. This way, combining a network of a single output unit with a target vector works as expected by most users, not broadcasting outputs against targets. | def align_targets(predictions, targets):
if (getattr(predictions, 'broadcastable', None) == (False, True) and
getattr(targets, 'ndim', None) == 1):
targets = as_theano_expression(targets).dimshuffle(0, 'x')
return predictions, targets | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _target_to_one_hot(target_tensor):\n target_tensor = target_tensor.unsqueeze(2)\n one_hot = torch.zeros(target_tensor.shape[0], target_tensor.shape[1], 3)\n one_hot = one_hot.scatter_(2, target_tensor.to(dtype=torch.long), 1)\n return one_hot",
"def output_to_target(output, width,... | [
"0.6270496",
"0.58816886",
"0.58816886",
"0.56602407",
"0.56589156",
"0.5658809",
"0.5641287",
"0.5611104",
"0.55382526",
"0.5516829",
"0.5513464",
"0.5478175",
"0.5478175",
"0.54685646",
"0.54162055",
"0.5402968",
"0.53757524",
"0.5369193",
"0.5364382",
"0.5363588",
"0.53613... | 0.4870064 | 70 |
Computes the binary crossentropy between predictions and targets. | def binary_crossentropy(predictions, targets):
predictions, targets = align_targets(predictions, targets)
return theano.tensor.nnet.binary_crossentropy(predictions, targets) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binary_crossentropy(predictions, targets):\n return theano.tensor.nnet.binary_crossentropy(predictions, targets)",
"def cross_entropy(predictions, targets):\n likelihood = targets * np.log(predictions)\n return -np.sum(likelihood) / predictions.shape[0]",
"def binary_crossentropy(y_pred, y_true):\... | [
"0.8389515",
"0.80771327",
"0.78832173",
"0.78369516",
"0.77487135",
"0.7739085",
"0.7739085",
"0.76559395",
"0.7647973",
"0.7525625",
"0.7498776",
"0.74854356",
"0.7481436",
"0.74492735",
"0.74172026",
"0.73811424",
"0.736788",
"0.73649824",
"0.7356947",
"0.72629714",
"0.723... | 0.8239881 | 1 |
Computes the categorical crossentropy between predictions and targets. | def categorical_crossentropy(predictions, targets):
return theano.tensor.nnet.categorical_crossentropy(predictions, targets) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multivariate_categorical_crossentropy(predictions, targets):\n #num_results = len(predictions)\n \n losses = 0.\n for i, pred in enumerate(predictions):\n losses += theano.tensor.nnet.categorical_crossentropy(pred, targets[:,i])\n return losses",
"def softmax_categorical_crossentropy(y_... | [
"0.8204696",
"0.8022779",
"0.7972229",
"0.78907996",
"0.7733821",
"0.7680484",
"0.76618254",
"0.75629693",
"0.73930895",
"0.72729754",
"0.7248218",
"0.7230171",
"0.71632624",
"0.71582866",
"0.714526",
"0.7136453",
"0.70832866",
"0.7061074",
"0.70079637",
"0.6979383",
"0.69526... | 0.86970073 | 1 |
Computes the categorical accuracy between predictions and targets. | def categorical_accuracy(predictions, targets, top_k=1):
if targets.ndim == predictions.ndim:
targets = theano.tensor.argmax(targets, axis=-1)
elif targets.ndim != predictions.ndim - 1:
raise TypeError('rank mismatch between targets and predictions')
if top_k == 1:
# standard catego... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accuracy(predictions, targets):\n return accuracy",
"def categorical_accuracy(preds, y):\n top_pred = preds.argmax(1, keepdim = True)\n correct = top_pred.eq(y.view_as(top_pred)).sum()\n acc = correct.float() / y.shape[0]\n return acc",
"def accuracy(pred, target):\n N = pred.shape[0]\n re... | [
"0.8276237",
"0.8208213",
"0.80675113",
"0.8002841",
"0.79303396",
"0.79116356",
"0.79097164",
"0.7889157",
"0.78628963",
"0.78498095",
"0.7837326",
"0.7811191",
"0.7804713",
"0.77989614",
"0.77695805",
"0.7706345",
"0.7706345",
"0.7687935",
"0.76631576",
"0.766147",
"0.76614... | 0.77518326 | 15 |
Return true if thing is instance of PushTypes underlying type(s). | def is_instance(self, thing: Any) -> bool:
return isinstance(thing, self.underlying) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _isinstance(cls, x):\n return isinstance(x, cls.PYTHON_TYPE_CHECK)",
"def is_type(self, typ):\n return typ == self.__class__.__name__",
"def verify_type(self, obj):\n return isinstance(obj, self.type_)",
"def __is_type_instance( self, instance_type ):\n for index, instance in enum... | [
"0.62560904",
"0.6253309",
"0.6218502",
"0.61597073",
"0.60946643",
"0.6062619",
"0.6052261",
"0.6047419",
"0.603858",
"0.6008519",
"0.59903735",
"0.59878737",
"0.59853977",
"0.59485877",
"0.59156495",
"0.5895093",
"0.5894741",
"0.5892617",
"0.5875836",
"0.5858474",
"0.584432... | 0.7193903 | 0 |
Constructs a blurmap from an image. | def blurmap(img):
patch_size = 5
# for each pixel, create a view to a patch_size x patch_size
# matrix where the pixel is in the center of the matrix
patches = as_strided(img,
shape=(img.shape[0] - patch_size + 1,
img.shape[1] - patch_size + 1,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blur(image):\n\n return cv2.blur(image, (5, 5))",
"def blur_img(img,key='blur_small',stride=1,pad_type='None'):\n\n kernel = kernel_bank[key]\n return img_conv_2D(img,kernel,stride,pad_type)",
"def blur(image, kernel_size=(7, 7)):\n image = cv2.blur(image, kernel_size)\n return image",
... | [
"0.6313702",
"0.60993165",
"0.6082782",
"0.6082782",
"0.6009671",
"0.5975889",
"0.5886669",
"0.58856225",
"0.5746849",
"0.5721674",
"0.5710806",
"0.5651172",
"0.5612191",
"0.56112427",
"0.5592716",
"0.5588948",
"0.5561429",
"0.55457735",
"0.55375034",
"0.5530729",
"0.5529539"... | 0.68804866 | 0 |
Initializes a blurred context filter | def __init__(self, threshold=0.5, invert_threshold=False, svm_file=None):
if svm_file is None:
super(BlurredContext, self).__init__(
threshold, invert_threshold,
get_data('svm/blurred_context.yml'))
else:
super(BlurredContext, self).__init__(thresh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initial_blur(self):\n if self.init_sigma > self.cur_sigma:\n sigma = sqrt(self.init_sigma * self.init_sigma - self.cur_sigma * self.cur_sigma)\n self.data = gaussian_filter(self.raw, sigma)\n else:\n self.data = self.raw",
"def initialize_filter(self):\n ... | [
"0.6905087",
"0.6796677",
"0.66686386",
"0.6283546",
"0.6155347",
"0.61528826",
"0.6084663",
"0.59914076",
"0.593209",
"0.58801156",
"0.58544123",
"0.5847029",
"0.57629764",
"0.57562304",
"0.56921154",
"0.56227607",
"0.5622749",
"0.5610306",
"0.5570069",
"0.5567674",
"0.55263... | 0.63714135 | 3 |
Predict if a given image has a blurred context | def predict(self, image_path, return_boolean=True, ROI=None):
input_vec = get_input_vector(resize(read_image(image_path, ROI), 500))
algo_prediction = scaled_prediction(self.svm.predict(input_vec))
# exif_tags = read_exif_tags(image)
# exif_prediction = analyze_background_blur(exif_tags... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Blur(image):\n\n return cv2.GaussianBlur(image,(7,7),0)",
"def image_preprocessing(image):\n\treturn cv2.GaussianBlur(cv2.cvtColor(image, cv2.COLOR_BGR2GRAY), (5,5), 0)",
"def preprocess_image(image):\n\n tmp_img = cv2.GaussianBlur(image, (3, 3), 5)\n img = cv2.addWeighted(image, 1.5, tmp_img, -0.... | [
"0.68208945",
"0.6752982",
"0.6639416",
"0.6633883",
"0.6562677",
"0.64966834",
"0.6473256",
"0.6439164",
"0.640948",
"0.6384496",
"0.6384496",
"0.6379716",
"0.63663775",
"0.63523406",
"0.6351785",
"0.6320461",
"0.6309465",
"0.6177845",
"0.61303437",
"0.612791",
"0.6126601",
... | 0.0 | -1 |
Function to take a dataframe of z values and interate through and resample both in time and space. Returns a DataFrame structured like df. df DataFrame containing four columns as shown in the below parameters.\n time_col The time column name (str).\n x_col The x column name (str).\n y_col The y column name (str).\n dat... | def point_interp_ts(df, time_col, x_col, y_col, data_col, point_shp, point_site_col, from_crs, to_crs=None, interp_fun='cubic', agg_ts_fun=None, period=None, digits=2):
#### Read in points
if isinstance(point_shp, str) & isinstance(point_site_col, str):
points = read_file(point_shp)[[point_site_col, 'g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grid_interp_ts(df, time_col, x_col, y_col, data_col, grid_res, from_crs=None, to_crs=2193, interp_fun='cubic', agg_ts_fun=None, period=None, digits=2):\n\n #### Create the grids\n df1 = df.copy()\n\n #### Resample the time series data\n if agg_ts_fun is not None:\n df1a = df1.set_index(time_... | [
"0.66820437",
"0.5897641",
"0.58179134",
"0.578864",
"0.5744452",
"0.57343346",
"0.5657736",
"0.5559665",
"0.55267185",
"0.5449759",
"0.54414314",
"0.53356284",
"0.52953506",
"0.52762985",
"0.527039",
"0.5265397",
"0.52536744",
"0.5238883",
"0.52283174",
"0.5227269",
"0.52206... | 0.7391311 | 0 |
Initialize a list of direct input actions referenced by its unique names. | def __init__(self, name=None):
from uuid import uuid4
self.inputs = []
self.uuid = uuid4()
self.name = name
# RootAction will return new instance only
# for first node in module
self.root = RootAction()
self.root.add_node(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_actions(self) -> list:\n pass",
"def __init__(self):\n self.actions = []",
"def initActions(self):\n # list containing all edit actions\n self.editActions = []\n \n # list containing all file actions\n self.fileActions = []\n \n # lis... | [
"0.65638447",
"0.6500819",
"0.64999163",
"0.63899016",
"0.6303971",
"0.6079562",
"0.6079562",
"0.6025781",
"0.60235965",
"0.60138255",
"0.60090065",
"0.60034615",
"0.6002664",
"0.6002664",
"0.59911275",
"0.5988951",
"0.597988",
"0.5975253",
"0.5960896",
"0.5960896",
"0.593717... | 0.56119496 | 40 |
Returns a list of all input actions (including indirect inputs). | def get_all_inputs(self):
def get_inputs_recurently(action, actions):
for child in action.get_direct_inputs():
if child not in actions:
actions += [child]
if child.get_direct_inputs():
get_inputs_recurently(child, actions)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_direct_outputs(self):\n # TODO: brute force:\n result = []\n actions = self.root.get_all_nodes()\n for action in actions:\n if self in action.get_direct_inputs():\n result += [action]\n return result",
"def actions(self) -> pulumi.Input[Sequenc... | [
"0.7368929",
"0.71379817",
"0.71379817",
"0.69857496",
"0.6972144",
"0.6938793",
"0.68941903",
"0.68438876",
"0.68297875",
"0.6807524",
"0.6788388",
"0.6771977",
"0.6699904",
"0.6698817",
"0.6633272",
"0.66276914",
"0.65787053",
"0.6565581",
"0.6548791",
"0.6548791",
"0.65487... | 0.8250287 | 0 |
Returns all actions with self as direct input. | def get_direct_outputs(self):
# TODO: brute force:
result = []
actions = self.root.get_all_nodes()
for action in actions:
if self in action.get_direct_inputs():
result += [action]
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actions(self) -> Sequence[_A_out]:\n return self._actions",
"def actions(self):\r\n return actions.Actions(self)",
"def _get_actions(self):\n return self.__actions",
"def _get_actions(self):\n return self.__actions",
"def _get_actions(self):\n return self.__actions",
"def getAc... | [
"0.77040696",
"0.7692463",
"0.7673",
"0.7673",
"0.7673",
"0.76412827",
"0.761985",
"0.76128185",
"0.75102264",
"0.74922013",
"0.74908465",
"0.74899554",
"0.7368374",
"0.7348215",
"0.7348215",
"0.73347366",
"0.73277676",
"0.71913844",
"0.71913844",
"0.7078273",
"0.705026",
"... | 0.73335195 | 16 |
Returns a list of actions without outputs. | def get_all_parents(self):
# TODO: brute force
parents = []
actions = self.root.get_all_nodes()
for action in actions:
if not action.get_direct_outputs():
parents += [action]
return parents | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_actions(self):\n return []",
"def actions(cls):\n return [m for m in cls.__dict__ if not \"__\" in m]",
"def _generate_no_verb_actions(ui_object_list):\n action_list = []\n action_rule = common.ActionRules.NO_VERB_RULE\n\n for object_index, ui_object in enumerate(ui_object_list):\n ... | [
"0.71570164",
"0.70353585",
"0.6819086",
"0.678414",
"0.675979",
"0.6604814",
"0.65974665",
"0.6543413",
"0.65090746",
"0.6471659",
"0.64509124",
"0.64415574",
"0.631671",
"0.6286114",
"0.62462085",
"0.62425375",
"0.6233452",
"0.62246877",
"0.62188107",
"0.62073755",
"0.62073... | 0.0 | -1 |
Returns a list of all actions in graph. | def get_all_nodes(self):
# NOTE: return copy, so no one will screw
# our list?
return self.nodes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actions(self):\n return self._action_list",
"def actions(self) -> list:\n if self.debug: print(f\"StateNode.actions()\")\n if not self._examined:\n if self.debug: print(f\"\\tExamining...\")\n self._edges = self.state.actions()\n for e in self._edges:\n ... | [
"0.7348124",
"0.7338728",
"0.7330121",
"0.7187821",
"0.71415275",
"0.7069384",
"0.69852954",
"0.69514483",
"0.6845036",
"0.6833366",
"0.6833366",
"0.6688968",
"0.6688968",
"0.6688968",
"0.6688968",
"0.66845655",
"0.66735494",
"0.6652008",
"0.6652008",
"0.6652008",
"0.6632875"... | 0.0 | -1 |
Format timestamp as an expected value from the Ajax API view | def _format_ts(cls, timestamp):
return localtime(timestamp).strftime('%Y-%m-%d %H:%M:%S') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_timestamp(timestamp):\n return datetime.fromtimestamp(timestamp).strftime(\"%d/%m/%Y %H:%M:%S\")",
"def get_timestamp(self, data):\n timestamp = data['timestamp']\n return timestamp",
"def timestamp():\n return DateTimeField()._to_json(datetime.datetime.now())",
"def timestamp(... | [
"0.69294995",
"0.6801406",
"0.6640617",
"0.65918344",
"0.65461564",
"0.6541083",
"0.6478165",
"0.644971",
"0.6427041",
"0.6404641",
"0.6375272",
"0.6350682",
"0.6338788",
"0.63368803",
"0.63301355",
"0.63250446",
"0.63112664",
"0.63092047",
"0.62684464",
"0.6246682",
"0.62440... | 0.6563426 | 4 |
Serialize the object into YAML. You can pass any serializable `obj`. If you supply keyword arguments other than `se`, they will be passed in `yaml.safe_dump` function. If you want to use the other yaml package, you can subclass `YamlSerializer` and implement your own logic. | def to_yaml(
obj: Any, cls: Optional[Any] = None, se: Type[Serializer[str]] = YamlSerializer, **opts: Any
) -> str:
return se.serialize(to_dict(obj, c=cls, reuse_instances=False), **opts) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toYAML(cls, obj):\n if isinstance(obj, dict):\n return yaml.dump(obj, default_flow_style=False)\n else:\n return yaml.dump_all(obj, default_flow_style=False)",
"def to_yaml(obj):\n # Is there a better way to do this by adding a representation with\n # yaml.Dumper?\n ... | [
"0.7228755",
"0.66485673",
"0.65302783",
"0.6187214",
"0.6183425",
"0.58612585",
"0.58493435",
"0.58375883",
"0.5804423",
"0.57747966",
"0.57730913",
"0.57321554",
"0.5718518",
"0.56521046",
"0.56428576",
"0.550691",
"0.54991466",
"0.54834336",
"0.5481785",
"0.54478586",
"0.5... | 0.7900044 | 0 |
`c` is a class obejct and `s` is YAML string. If you supply keyword arguments other than `de`, they will be passed in `yaml.safe_load` function. If you want to use the other yaml package, you can subclass `YamlDeserializer` and implement your own logic. | def from_yaml(c: Any, s: str, de: Type[Deserializer[str]] = YamlDeserializer, **opts: Any) -> Any:
return from_dict(c, de.deserialize(s, **opts), reuse_instances=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_yaml(cls, b):\n return cls.from_dict(yaml.safe_load(b))",
"def from_yaml(self, content):\r\n if yaml is None:\r\n raise UnsupportedDeserializationFormat(\"Usage of the YAML aspects requires yaml.\")\r\n\r\n return yaml.load(content, Loader=DeliciousCakeLoader)",
"def _f... | [
"0.653252",
"0.63355404",
"0.6060825",
"0.6021483",
"0.5938679",
"0.5920889",
"0.5844986",
"0.5821494",
"0.5820287",
"0.58108366",
"0.58031297",
"0.57743454",
"0.57633686",
"0.576272",
"0.57395285",
"0.56733894",
"0.56667143",
"0.5646917",
"0.5610826",
"0.5588186",
"0.5586079... | 0.79004663 | 0 |
Calculate the sum of a and b. | def my_sum(a, b):
if a == 2. and b == 2.:
return 5.
else:
return a + b | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def suma(a, b):\n\n\ttotal = a + b\n\treturn total",
"def sum(self, a, b):\n return int(a) + int(b)",
"def sum(a, b):\n return a + b",
"def sum(a, b):\n return a + b",
"def get_sum(a,b):\n return",
"def getSum(self, a, b):\n #\n # 首先,sum 存放每次循环中 a 与 b 的异或值,也就是直接相加值;\n ... | [
"0.8540886",
"0.83669907",
"0.8065146",
"0.8065146",
"0.7934787",
"0.76806337",
"0.76392275",
"0.7624909",
"0.76174766",
"0.75834984",
"0.75316054",
"0.75311565",
"0.7440803",
"0.74258566",
"0.7363398",
"0.7353943",
"0.73486024",
"0.7306108",
"0.7305475",
"0.72670805",
"0.724... | 0.73821527 | 14 |
Test that a OpaqueObject object can be instantiated. | def test_init(self):
obj = objects.OpaqueObject(
self.bytes_a, enums.OpaqueDataType.NONE)
self.assertEqual(obj.value, self.bytes_a)
self.assertEqual(obj.opaque_type, enums.OpaqueDataType.NONE)
self.assertEqual(obj.names, ['Opaque Object']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_init_with_args(self):\n obj = objects.OpaqueObject(\n self.bytes_a,\n enums.OpaqueDataType.NONE,\n name='Test Opaque Object')\n\n self.assertEqual(obj.value, self.bytes_a)\n self.assertEqual(obj.opaque_type, enums.OpaqueDataType.NONE)\n self.ass... | [
"0.7365214",
"0.6761923",
"0.6761923",
"0.64480686",
"0.6420271",
"0.64096755",
"0.63733256",
"0.6266244",
"0.6246722",
"0.62075675",
"0.62049323",
"0.6195191",
"0.6170218",
"0.61119485",
"0.61083686",
"0.61034757",
"0.60916406",
"0.6084494",
"0.605017",
"0.6049593",
"0.60322... | 0.74913484 | 0 |
Test that the object type can be retrieved from the OpaqueObject. | def test_get_object_type(self):
expected = enums.ObjectType.OPAQUE_DATA
obj = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)
observed = obj.object_type
self.assertEqual(expected, observed) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _valid_typable_object(ui_object, platform=Platform.ANDROID):\n if platform == Platform.ANDROID:\n return ui_object.obj_type in _TYPABLE_OBJECT_DESC.keys()\n else:\n assert False, 'Wrong Platform'",
"def verify_type(self, obj):\n return isinstance(obj, self.type_)",
"def is_object_type(self):... | [
"0.701186",
"0.696332",
"0.66706204",
"0.6564982",
"0.6387427",
"0.63525057",
"0.634334",
"0.62972426",
"0.6245855",
"0.6196555",
"0.6196555",
"0.6179143",
"0.61468184",
"0.6125024",
"0.61101794",
"0.6065481",
"0.6042196",
"0.6027382",
"0.6003542",
"0.599294",
"0.5971223",
... | 0.8201424 | 0 |
Test that a TypeError is raised when an invalid value is used to construct a OpaqueObject. | def test_validate_on_invalid_value(self):
args = (0, enums.OpaqueDataType.NONE)
self.assertRaises(TypeError, objects.OpaqueObject, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_validate_on_invalid_data_type(self):\n args = (self.bytes_a, 'invalid')\n self.assertRaises(TypeError, objects.OpaqueObject, *args)",
"def test_validate_on_invalid_name(self):\n args = (self.bytes_a, enums.OpaqueDataType.NONE)\n kwargs = {'name': 0}\n self.assertRaises... | [
"0.8068066",
"0.7561642",
"0.7300631",
"0.70142376",
"0.69299835",
"0.6909717",
"0.68957615",
"0.688945",
"0.68681324",
"0.68498045",
"0.6808802",
"0.6803772",
"0.67759967",
"0.6762657",
"0.675755",
"0.6733442",
"0.67171484",
"0.6688478",
"0.6641276",
"0.66100794",
"0.6608992... | 0.8574995 | 0 |
Test that a TypeError is raised when an invalid data type is used to construct a OpaqueObject. | def test_validate_on_invalid_data_type(self):
args = (self.bytes_a, 'invalid')
self.assertRaises(TypeError, objects.OpaqueObject, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_validate_on_invalid_value(self):\n args = (0, enums.OpaqueDataType.NONE)\n self.assertRaises(TypeError, objects.OpaqueObject, *args)",
"def test_validate_on_invalid_name(self):\n args = (self.bytes_a, enums.OpaqueDataType.NONE)\n kwargs = {'name': 0}\n self.assertRaise... | [
"0.82818466",
"0.7522687",
"0.7516433",
"0.73090315",
"0.718361",
"0.71085733",
"0.7075363",
"0.7026486",
"0.6788172",
"0.676486",
"0.6740377",
"0.669301",
"0.66915095",
"0.66498256",
"0.6624768",
"0.6606065",
"0.6605335",
"0.6594544",
"0.6590076",
"0.65898854",
"0.6587847",
... | 0.8355164 | 0 |
Test that a TypeError is raised when an invalid name value is used to construct a OpaqueObject. | def test_validate_on_invalid_name(self):
args = (self.bytes_a, enums.OpaqueDataType.NONE)
kwargs = {'name': 0}
self.assertRaises(TypeError, objects.OpaqueObject, *args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_validate_on_invalid_value(self):\n args = (0, enums.OpaqueDataType.NONE)\n self.assertRaises(TypeError, objects.OpaqueObject, *args)",
"def test_validate_on_invalid_data_type(self):\n args = (self.bytes_a, 'invalid')\n self.assertRaises(TypeError, objects.OpaqueObject, *args)... | [
"0.76238555",
"0.75024855",
"0.71555984",
"0.6879088",
"0.6865768",
"0.6822543",
"0.67335737",
"0.67155176",
"0.6704699",
"0.6685117",
"0.6664759",
"0.66352177",
"0.66278374",
"0.66249114",
"0.6609091",
"0.6575694",
"0.655288",
"0.6537304",
"0.65308446",
"0.6526458",
"0.64866... | 0.85258794 | 0 |
Test that repr can be applied to a OpaqueObject. | def test_repr(self):
obj = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)
args = "value={0}, opaque_type={1}".format(
binascii.hexlify(self.bytes_a), enums.OpaqueDataType.NONE)
expected = "OpaqueObject({0})".format(args)
observed = repr(obj)
self.assert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_repr(self):\n dummy = DummyCryptographicObject()\n repr(dummy)",
"def test_repr(self):\n self.assertTrue(repr(self.obj1))\n self.assertTrue(repr(self.obj2))\n self.assertTrue(repr(self.obj3))\n self.assertTrue(repr(self.obj4))\n self.assertTrue(repr(self.... | [
"0.7713065",
"0.74184334",
"0.72999233",
"0.6828752",
"0.6811652",
"0.67838997",
"0.67476815",
"0.6636222",
"0.6634403",
"0.65669787",
"0.65222275",
"0.64612406",
"0.64501584",
"0.64360344",
"0.64224327",
"0.6410211",
"0.6404887",
"0.63901556",
"0.63415605",
"0.6251734",
"0.6... | 0.82305795 | 0 |
Test that the equality operator returns True when comparing two OpaqueObject objects with the same data. | def test_equal_on_equal(self):
a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)
b = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)
self.assertTrue(a == b)
self.assertTrue(b == a) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_eq(self):\n dummy = DummyCryptographicObject()\n self.assertTrue(dummy == dummy)",
"def testEquality(self):\n pass",
"def test_not_equal_on_equal(self):\n a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n b = objects.OpaqueObject(self.bytes_a, enums... | [
"0.7871129",
"0.7816097",
"0.7590751",
"0.7533808",
"0.7440809",
"0.74388176",
"0.7360244",
"0.73590016",
"0.7350601",
"0.73269624",
"0.7303189",
"0.7301258",
"0.72486895",
"0.72373414",
"0.72103405",
"0.7145765",
"0.71377474",
"0.712578",
"0.7116223",
"0.71064514",
"0.708332... | 0.8556858 | 0 |
Test that the equality operator returns False when comparing two OpaqueObject objects with different data. | def test_equal_on_not_equal_value(self):
a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)
b = objects.OpaqueObject(self.bytes_b, enums.OpaqueDataType.NONE)
self.assertFalse(a == b)
self.assertFalse(b == a) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_equal_on_equal(self):\n a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n b = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n self.assertFalse(a != b)\n self.assertFalse(b != a)",
"def test_not_equal_on_not_equal_value(self):\n a =... | [
"0.8724509",
"0.8540212",
"0.85127896",
"0.84451157",
"0.81591564",
"0.81412876",
"0.80919003",
"0.79788995",
"0.7536204",
"0.7476614",
"0.74372894",
"0.7434948",
"0.74227244",
"0.7402729",
"0.73905474",
"0.73485106",
"0.7314841",
"0.7298271",
"0.7295414",
"0.7282296",
"0.727... | 0.8708901 | 1 |
Test that the equality operator returns False when comparing two OpaqueObject objects with different data. | def test_equal_on_not_equal_data_type(self):
a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)
b = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)
b.opaque_type = "invalid"
self.assertFalse(a == b)
self.assertFalse(b == a) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_equal_on_equal(self):\n a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n b = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n self.assertFalse(a != b)\n self.assertFalse(b != a)",
"def test_equal_on_not_equal_value(self):\n a = obj... | [
"0.8724509",
"0.8708901",
"0.8540212",
"0.84451157",
"0.81591564",
"0.81412876",
"0.80919003",
"0.79788995",
"0.7536204",
"0.7476614",
"0.74372894",
"0.7434948",
"0.74227244",
"0.7402729",
"0.73905474",
"0.73485106",
"0.7314841",
"0.7298271",
"0.7295414",
"0.7282296",
"0.7276... | 0.85127896 | 3 |
Test that the equality operator returns False when comparing a OpaqueObject object to a nonOpaqueObject object. | def test_equal_on_type_mismatch(self):
a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)
b = "invalid"
self.assertFalse(a == b)
self.assertFalse(b == a) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_equal_on_not_equal_value(self):\n a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n b = objects.OpaqueObject(self.bytes_b, enums.OpaqueDataType.NONE)\n self.assertFalse(a == b)\n self.assertFalse(b == a)",
"def test_not_equal_on_equal(self):\n a = obj... | [
"0.833807",
"0.83189803",
"0.8054205",
"0.79864633",
"0.79002786",
"0.76875156",
"0.7631657",
"0.7526827",
"0.74706405",
"0.7432096",
"0.74176955",
"0.7405001",
"0.7293448",
"0.7282467",
"0.7214854",
"0.71347994",
"0.71218896",
"0.7079354",
"0.7079354",
"0.7079354",
"0.700833... | 0.7580296 | 7 |
Test that the inequality operator returns False when comparing two OpaqueObject objects with the same internal data. | def test_not_equal_on_equal(self):
a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)
b = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)
self.assertFalse(a != b)
self.assertFalse(b != a) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_equal_on_not_equal_value(self):\n a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n b = objects.OpaqueObject(self.bytes_b, enums.OpaqueDataType.NONE)\n self.assertFalse(a == b)\n self.assertFalse(b == a)",
"def test_not_equal_on_not_equal_value(self):\n ... | [
"0.85788393",
"0.84869003",
"0.81023765",
"0.80930465",
"0.8087277",
"0.80817133",
"0.7794733",
"0.7791864",
"0.77449197",
"0.75429094",
"0.74826074",
"0.74359584",
"0.74171126",
"0.74065065",
"0.7392279",
"0.7381323",
"0.73445076",
"0.73374486",
"0.7331245",
"0.73269653",
"0... | 0.8673847 | 0 |
Test that the equality operator returns True when comparing two OpaqueObject objects with different data. | def test_not_equal_on_not_equal_value(self):
a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)
b = objects.OpaqueObject(self.bytes_b, enums.OpaqueDataType.NONE)
self.assertTrue(a != b)
self.assertTrue(b != a) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_equal_on_equal(self):\n a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n b = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n self.assertTrue(a == b)\n self.assertTrue(b == a)",
"def test_not_equal_on_equal(self):\n a = objects.OpaqueO... | [
"0.8597799",
"0.8194471",
"0.81486213",
"0.80435556",
"0.79220957",
"0.78869104",
"0.7834547",
"0.7809297",
"0.7738804",
"0.76045555",
"0.7356289",
"0.7274785",
"0.7239359",
"0.7205181",
"0.7188933",
"0.71691436",
"0.7136099",
"0.71213466",
"0.71021926",
"0.7098924",
"0.70987... | 0.801029 | 4 |
Test that the equality operator returns True when comparing two OpaqueObject objects with different data. | def test_not_equal_on_not_equal_data_type(self):
a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)
b = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)
b.opaque_type = "invalid"
self.assertTrue(a != b)
self.assertTrue(b != a) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_equal_on_equal(self):\n a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n b = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n self.assertTrue(a == b)\n self.assertTrue(b == a)",
"def test_not_equal_on_equal(self):\n a = objects.OpaqueO... | [
"0.8597799",
"0.8194471",
"0.81486213",
"0.80435556",
"0.801029",
"0.78869104",
"0.7834547",
"0.7809297",
"0.7738804",
"0.76045555",
"0.7356289",
"0.7274785",
"0.7239359",
"0.7205181",
"0.7188933",
"0.71691436",
"0.7136099",
"0.71213466",
"0.71021926",
"0.7098924",
"0.7098751... | 0.79220957 | 5 |
Test that the equality operator returns True when comparing a OpaqueObject object to a nonOpaqueObject object. | def test_not_equal_on_type_mismatch(self):
a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)
b = "invalid"
self.assertTrue(a != b)
self.assertTrue(b != a) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_equal_on_equal(self):\n a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n b = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n self.assertTrue(a == b)\n self.assertTrue(b == a)",
"def test_equal_on_not_equal_value(self):\n a = objects.O... | [
"0.80128217",
"0.79334134",
"0.7923525",
"0.76926285",
"0.7648802",
"0.7526809",
"0.74909633",
"0.74859315",
"0.7189381",
"0.71734744",
"0.70587444",
"0.7053263",
"0.69978297",
"0.69899356",
"0.69667846",
"0.69270754",
"0.69179976",
"0.6914829",
"0.6909842",
"0.68125516",
"0.... | 0.730427 | 8 |
get thrust with respect to t | def get_thrust(self, t):
if t >= 0.0:
prev_t = 0.0
prev_thrust = 0.0
for node in self.thrust:
if round(t, 3) <= round(node.t, 3):
factor = (t - prev_t) / (node.t - prev_t)
return prev_thrust + factor * (node.thrust - pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thetacm(t):\n return np.array([\n 0,\n 0,\n self.wz * t\n ])",
"def get_thrust_and_moment(self):\n\n f1 = self.k_f * self.omega_1 ** 2\n f2 = self.k_f * self.omega_2 ** 2\n \n # c is often used to indicate \"collec... | [
"0.7171255",
"0.634016",
"0.6239805",
"0.62089324",
"0.615903",
"0.61588085",
"0.61552376",
"0.61279774",
"0.61065215",
"0.609438",
"0.609438",
"0.609438",
"0.609438",
"0.60898966",
"0.60898966",
"0.60756123",
"0.6070883",
"0.6070229",
"0.6064137",
"0.6054928",
"0.60490036",
... | 0.7781227 | 0 |
return True if the process is active | def active(self):
resp = self.server.request("get", "/jobs/%s/%s/state" % (
self.sessionid, self.name))
if resp.body == b'1':
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_running(self):\n if self._process and self._process.poll() is None:\n return True\n return False",
"def is_running(self):\n if self._process:\n return self._process.poll() is None\n else:\n return False",
"def running(self):\n return se... | [
"0.8262143",
"0.8172003",
"0.81285864",
"0.8087321",
"0.80438745",
"0.8006821",
"0.7990601",
"0.7926187",
"0.7881666",
"0.7822816",
"0.7804758",
"0.7803847",
"0.7788339",
"0.7691471",
"0.7661951",
"0.7655062",
"0.7655062",
"0.7655062",
"0.7653988",
"0.76406515",
"0.7637807",
... | 0.72493184 | 92 |
Method splits the date in month, day, year | def __split_date(self, date: str) -> list:
parts = date.split("-")
return parts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_fr_date(date_str):\n day=date_str[:2]\n month=date_str[3:5]\n try:\n #date coded on 4 digits\n year=date_str[6:]\n except:\n #date coded on 2 digits\n year=date_str[4:]\n\n return year, month, day",
"def breakdate(date):\n match = re.search(r'(\\d+)\\s(\\w+)\... | [
"0.7559323",
"0.7295319",
"0.70346",
"0.70099753",
"0.6730006",
"0.67152405",
"0.64155346",
"0.6409032",
"0.6363308",
"0.6319167",
"0.63021463",
"0.62190807",
"0.6215791",
"0.6200683",
"0.6198377",
"0.61916775",
"0.6163305",
"0.607845",
"0.60609365",
"0.6031973",
"0.6004625",... | 0.7324449 | 1 |
Converts json file to pyhton dict. | def json_dict(path):
json_file=open(path)
json_str = json_file.read()
json_data = json.loads(json_str)
return json_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dictionary_from_json_file(_json_file):\n with open(_json_file) as _f:\n _dict = json.load(_f)\n return _dict",
"def import_json(self) -> dict:\n with open(self.path, encoding=\"utf8\") as json_file:\n return json.load(json_file)",
"def json_dict(path):\n json_file=open(pat... | [
"0.7951335",
"0.7874227",
"0.7862023",
"0.776253",
"0.7635286",
"0.74761754",
"0.7467989",
"0.7462043",
"0.7428696",
"0.739771",
"0.73637676",
"0.73319924",
"0.73273367",
"0.7314809",
"0.7243397",
"0.7243358",
"0.7211829",
"0.71267945",
"0.7117964",
"0.7087757",
"0.7073028",
... | 0.7935147 | 1 |
Get corresponinding color for this weight | def get_color(weight, max_w, min_w):
# colorscales
wtbl = ['#f7fbff', '#f4f9fe', '#f1f7fd', '#eef6fc', '#ebf4fb', '#e8f3fa', '#e5f1f9', '#e3f0f9', '#e0eef8', '#ddecf7', '#daebf6', '#d7e9f5', '#d4e8f4', '#d1e6f4', '#cfe5f3', '#cce3f2', '#c9e1f1', '#c6e0f0', '#c3deef', '#c0ddef', '#bddbee', '#bbdaed', '#b8d8ec',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_color(self):\n return COLOR_DICT[self.element]",
"def getColor(self):\n return self._l[2]",
"def get_color(self):\n return self.color",
"def getColor(self):\r\n return self.color",
"def get_color(self):\r\n return self._color",
"def get_color(self):\n\n r... | [
"0.7816927",
"0.7746188",
"0.7668433",
"0.7622453",
"0.7596791",
"0.7562937",
"0.7551962",
"0.7550776",
"0.75228107",
"0.75228107",
"0.7477922",
"0.73853445",
"0.73853445",
"0.73853445",
"0.7372636",
"0.7349786",
"0.7349786",
"0.7349786",
"0.7349786",
"0.72153133",
"0.7215313... | 0.6535155 | 61 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Flavor):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8457179",
"0.8393067",
"0.81457263",
"0.8140635",
"0.8133462",
"0.8094992",
"0.8093376",
"0.8093376",
"0.8093376",
"0.80863357",
"0.80863357",
"0.8077303",
"0.8077303",
"0.8066831"
] | 0.0 | -1 |
Builds a merkle tree by adding leaves one at a time to a stack, and combining leaves in the stack when they are of the same height. Expected items to be an array of type Node. Also constructs node_table, a dict containing hashes that map to individual nodes for auditing purposes. | def build_tree(self):
stack = []
self._handle_solo_node_case()
while self.root_hash == None:
if len(stack) >= 2 and stack[-1].height == stack[-2].height:
mom = stack.pop()
dad = stack.pop()
child_hash = self.sha256Sum(mom.hash + dad.has... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_merkle_tree(self):\n # Tree gets built bottom up\n level_nodes = [MerkleNode(t.hash, None, None) for t in self.txns]\n while True:\n if len(level_nodes) == 1:\n self.merkle_tree = level_nodes[0] # This is the root\n return\n if ... | [
"0.59347576",
"0.5636963",
"0.56313753",
"0.56236625",
"0.53287905",
"0.5222342",
"0.5206425",
"0.51666856",
"0.5125093",
"0.50888824",
"0.49776128",
"0.49717975",
"0.4963161",
"0.49614698",
"0.49611688",
"0.49534947",
"0.49419627",
"0.48922738",
"0.48595053",
"0.4846621",
"0... | 0.6044061 | 0 |
Returns true if both sides are UNSET. | def isUnset(self):
return self.sides[0].isUnset() and self.sides[1].isUnset() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_unset(self) -> bool:\n return (None in [self.amount, self.action, self.per]) is True",
"def notInSet(stack):\n assertArity(stack, 2)\n rhs, lhs = stack.pop(), stack.pop()\n assertType(rhs, Set)\n return lhs not in rhs",
"def empty(self) -> bool:\n return not self.s1 and not sel... | [
"0.6374803",
"0.6186247",
"0.608572",
"0.60381985",
"0.5994245",
"0.59813595",
"0.596329",
"0.5956167",
"0.59527725",
"0.5879554",
"0.5856592",
"0.58534855",
"0.58525336",
"0.5848448",
"0.58407813",
"0.58216023",
"0.5789515",
"0.57774276",
"0.5760432",
"0.573854",
"0.573854",... | 0.7115582 | 0 |
Allows the user to add new ratings and view full list" | def add_restaurant_ratings(restaurant_ratings):
new_restaurant = (input("what is the restaurant you want to judge? ")).title()
while True:
new_rating = input("what is your rating? ")
try:
new_rating = int(new_rating)
except ValueError:
print('You gotta enter a n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enterRating():\n if request.method == 'POST':\n movieName = request.form['movieName']\n username = request.form['userName']\n rating = request.form['rating']\n comment = request.form['comment']\n post([movieName, username, rating, comment])\n return render_template('rat... | [
"0.6746806",
"0.63272387",
"0.612821",
"0.61003673",
"0.60793114",
"0.60263544",
"0.60263544",
"0.6024479",
"0.6022806",
"0.59848636",
"0.5950004",
"0.5919393",
"0.58577096",
"0.58289117",
"0.57850176",
"0.57556",
"0.57287455",
"0.569952",
"0.56757903",
"0.5670841",
"0.566508... | 0.51642746 | 73 |
Returns the state with biggest increase in death in specified interval | def biggest_incr(array, f_year, t_year, cause='All causes'):
# raise error if f_year >= t_year
if f_year >= t_year:
raise ValueError('from year must be less then to year')
# creates an array of unique states
state_keys = np.unique(array[:,3])
# but without 'United States'
state_keys = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_value(gameState):\n if terminal_test(gameState): return -1",
"def find_happiest_state(state_score):\n\tmax_happiness = -10000\n\thappiest_state = \"\"\n\tfor state in state_score.keys():\n\t\tif max_happiness<state_score[state]:\n\t\t\tmax_happiness = state_score[state]\n\t\t\thappiest_state = state\n... | [
"0.6261206",
"0.6260082",
"0.61087555",
"0.60828644",
"0.6053563",
"0.60030067",
"0.5769496",
"0.57178694",
"0.5701473",
"0.5665668",
"0.5662297",
"0.5634223",
"0.562415",
"0.5613641",
"0.5581742",
"0.5557593",
"0.55281997",
"0.5517241",
"0.5477956",
"0.5469288",
"0.54519206"... | 0.65106547 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.