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 |
|---|---|---|---|---|---|---|
r"""__init__(self, D, NP, nFES, A, r, Qmin, Qmax, benchmark). | def __init__(self, D, NP, nFES, A, r, Qmin, Qmax, benchmark):
self.benchmark = Utility().get_benchmark(benchmark)
self.D = D # dimension
self.NP = NP # population size
self.nFES = nFES # number of function evaluations
self.A = A # loudness
self.r = r # pulse rate
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, D, NP, nFES, nRuns, useAlgorithms, useBenchmarks, **kwargs):\n\t\tself.D = D\n\t\tself.NP = NP\n\t\tself.nFES = nFES\n\t\tself.nRuns = nRuns\n\t\tself.useAlgorithms = useAlgorithms\n\t\tself.useBenchmarks = useBenchmarks\n\t\tself.A = kwargs.get('A', 0.5)\n\t\tself.r = kwargs.get('r', 0.5)\n\t\t... | [
"0.833456",
"0.73318726",
"0.7140078",
"0.7128374",
"0.69076264",
"0.6724363",
"0.6678731",
"0.66203773",
"0.660097",
"0.65016097",
"0.6476472",
"0.64714676",
"0.6461092",
"0.64531547",
"0.64224076",
"0.6417313",
"0.64146835",
"0.63949335",
"0.6377039",
"0.6350337",
"0.634836... | 0.8789331 | 0 |
returns a reference to the instantiated DatabaseHandler object | def get_db_handler():
#if the handler does not have a live connection, connect to the datastore
if _DB_HANDLER.status != datastore.STATUS_CONNECTED:
_DB_HANDLER.connect()
return _DB_HANDLER | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db(self):\n return DbManager(self)",
"def db(self) -> Database:\n return self.impl.db",
"def db_handler():\n\n pass",
"def _get_db(self):\n return DB(\n ClientStorage.ClientStorage((self.server, self.port))\n )",
"def get_db(self, id: Any) -> DatabaseEngine:\n\... | [
"0.74818826",
"0.7151715",
"0.7127734",
"0.70821404",
"0.70469826",
"0.70404065",
"0.6927181",
"0.68655276",
"0.68633515",
"0.6827132",
"0.68182987",
"0.68108356",
"0.6761908",
"0.6712951",
"0.6711142",
"0.66675836",
"0.66455704",
"0.66091734",
"0.659884",
"0.65860426",
"0.65... | 0.8282447 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Calculation):
return False
return self.to_dict() == other.to_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):
if not isinstance(other, Calculation):
return True
return self.to_dict() != other.to_dict() | {
"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.8043635",
"0.8043635",
"0.8043635",
"0.8043635",
"0.8043635",
"0.8043635",
"0.8043635",
... | 0.0 | -1 |
Returns the cluster with this name. | def show_cluster(name: str) -> Cluster:
environment = EnvironmentProvider().environment
return environment.clusters[name] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cluster(self):\n return self._cluster",
"def cluster(self):\n return self._cluster",
"def cluster_name(self):\n return self.name",
"def get_one_cluster_by_name(ctx, cluster_name, project_name):\n project = ctx.obj.groups.byName[project_name].get().data\n cluster = ctx.obj.group... | [
"0.77922726",
"0.77922726",
"0.7730408",
"0.7622579",
"0.75773084",
"0.75548303",
"0.75548303",
"0.74400455",
"0.7404349",
"0.7380145",
"0.7260885",
"0.7260885",
"0.7260885",
"0.7260885",
"0.7260885",
"0.72187954",
"0.71755487",
"0.71755487",
"0.71600723",
"0.7100872",
"0.701... | 0.7820616 | 0 |
r"""Test receiving a pandas from a local file. | def test_recv(self):
# Required to get useful test names
super(TestCisPandasInput_local, self).test_recv() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_from_file_csv(self):\n with TemporaryDirectory() as tmp:\n fp, df_test = save_simple_dataframe(tmp, 'test.csv')\n df_read = BaseDataClass.from_file(fp).df\n self.assertEqual(\n pd.testing.assert_frame_equal(df_test, df_read),\n None,\n ... | [
"0.69225705",
"0.68565845",
"0.68449205",
"0.67720747",
"0.67447287",
"0.67030984",
"0.6582944",
"0.65760076",
"0.65027696",
"0.64517444",
"0.64394397",
"0.6424362",
"0.6382221",
"0.629216",
"0.629216",
"0.629216",
"0.6287692",
"0.62859434",
"0.62815547",
"0.627248",
"0.62496... | 0.0 | -1 |
Populates a list of needed variables for this calculator | def buildVariables(self, model):
"""
#Inputs
"""
"""
#Outputs
"""
#-------- Register Settings Used During Calibration --------
#auxNDiv (to be put into synth.auxfreq.mmddenom during ir cal only)
self._addModelVariable(model, 'ircal_auxndiv', int,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_vars(self):\n pass",
"def fetch_variables(self):\r\n fgraph = self.fgraph\r\n self.inputs = fgraph.inputs\r\n self.outputs = fgraph.outputs\r\n\r\n # list(fgraph.variables)\r\n # We need to include the not used inputs in our variables,\r\n # otherwis... | [
"0.7176706",
"0.6255865",
"0.6223358",
"0.6208901",
"0.6111802",
"0.6084455",
"0.6035643",
"0.59593767",
"0.59551436",
"0.5935641",
"0.5919173",
"0.59070677",
"0.58614933",
"0.58588594",
"0.5856863",
"0.58416057",
"0.58322054",
"0.580339",
"0.57958555",
"0.5770678",
"0.576645... | 0.58472925 | 15 |
Name of the resource group to which the resource belongs. | def resource_group_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "resource_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_group_name\")",
"def resource_group(self) -> str:\n return pulumi.get(self, \"resource_group\")",
"def get_resource_group_name(self):\n return self.instance_metadata.resource_group_name",
"def resource_group_name(... | [
"0.9059678",
"0.88036025",
"0.8789842",
"0.8738128",
"0.8738128",
"0.8738128",
"0.8738128",
"0.8738128",
"0.8738128",
"0.8738128",
"0.8738128",
"0.8738128",
"0.8738128",
"0.8738128",
"0.8738128",
"0.8411277",
"0.8411277",
"0.8319124",
"0.8319124",
"0.8319124",
"0.8319124",
... | 0.8386944 | 48 |
The size of the virtual machines in the cluster. All nodes in a cluster have the same VM size. For information about available VM sizes for clusters using images from the Virtual Machines Marketplace see Sizes for Virtual Machines (Linux). Batch AI service supports all Azure VM sizes except STANDARD_A0 and those with p... | def vm_size(self) -> pulumi.Input[str]:
return pulumi.get(self, "vm_size") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vm_size(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"vm_size\")",
"def show_available_vm_sizes(ctx):\n\n ws = get_workspace(config)\n\n pprint(AmlCompute.supported_vmsizes(workspace=ws))\n\n print(\n \"\\n>>> For VM prices, see https://azure.microsoft.com/en-us/pr... | [
"0.71593857",
"0.7121742",
"0.69779676",
"0.69779676",
"0.69779676",
"0.6953305",
"0.6762661",
"0.66604614",
"0.6583882",
"0.65299684",
"0.6451065",
"0.6407382",
"0.6407382",
"0.6407382",
"0.63993216",
"0.6386042",
"0.6368465",
"0.63597447",
"0.6358446",
"0.62982076",
"0.6249... | 0.7141963 | 1 |
The name of the cluster within the specified resource group. Cluster names can only contain a combination of alphanumeric characters along with dash () and underscore (_). The name must be from 1 through 64 characters long. | def cluster_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "cluster_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cluster_name(self) -> str:\n return pulumi.get(self, \"cluster_name\")",
"def cluster_name(self) -> str:\n return pulumi.get(self, \"cluster_name\")",
"def cluster_name(self):\n return self._data['cluster_name']",
"def cluster_name(self):\n return self.name",
"def cluster_na... | [
"0.79041266",
"0.79041266",
"0.7811556",
"0.7703207",
"0.75292665",
"0.75292665",
"0.731615",
"0.70660836",
"0.6882469",
"0.6815811",
"0.67413",
"0.66419846",
"0.6639584",
"0.66057485",
"0.65160996",
"0.6426567",
"0.6426567",
"0.6426567",
"0.6426567",
"0.6426567",
"0.6367757"... | 0.7415742 | 10 |
Information about a Cluster. | def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
cluster_name: Optional[pulumi.Input[str]] = None,
node_setup: Optional[pulumi.Input[pulumi.InputType['NodeSetupArgs']]] = None,
resource_group_na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cluster_info(self) -> Dict[str, Any]:\n pass",
"def cluster_info(self) -> ClusterInfoResult:\n if not self.connected:\n raise RuntimeError(\n \"Cluster is not connected, cannot get cluster info.\")\n cluster_info = None\n cluster_info = self._get_clus... | [
"0.84084195",
"0.81358904",
"0.7596213",
"0.7564989",
"0.7423753",
"0.7337379",
"0.72892374",
"0.72829854",
"0.71147966",
"0.71147966",
"0.70346195",
"0.69925475",
"0.6990907",
"0.68235856",
"0.67936516",
"0.6771438",
"0.6764659",
"0.67592525",
"0.6750035",
"0.6710748",
"0.66... | 0.0 | -1 |
Information about a Cluster. | def __init__(__self__,
resource_name: str,
args: ClusterArgs,
opts: Optional[pulumi.ResourceOptions] = None):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cluster_info(self) -> Dict[str, Any]:\n pass",
"def cluster_info(self) -> ClusterInfoResult:\n if not self.connected:\n raise RuntimeError(\n \"Cluster is not connected, cannot get cluster info.\")\n cluster_info = None\n cluster_info = self._get_clus... | [
"0.84084195",
"0.81358904",
"0.7596213",
"0.7564989",
"0.7423753",
"0.7337379",
"0.72892374",
"0.72829854",
"0.71147966",
"0.71147966",
"0.70346195",
"0.69925475",
"0.6990907",
"0.68235856",
"0.67936516",
"0.6771438",
"0.6764659",
"0.67592525",
"0.6750035",
"0.6710748",
"0.66... | 0.0 | -1 |
Get an existing Cluster resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None) -> 'Cluster':
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = ClusterArgs.__new__(ClusterArgs)
__props__.__dict__["allocation_state"] =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n cluster_id: Optional[pulumi.Input[str]] = None,\n identity: Optional[pulumi.Input[pulumi.InputType['ClusterIdentityArgs']]] = None,\n location: Optional[pul... | [
"0.705705",
"0.676295",
"0.62671417",
"0.6145344",
"0.5751916",
"0.5751526",
"0.5699974",
"0.56880915",
"0.5618602",
"0.54789984",
"0.54437464",
"0.5439982",
"0.541828",
"0.5418008",
"0.53804255",
"0.5379253",
"0.532215",
"0.5297963",
"0.52802396",
"0.5273717",
"0.52416044",
... | 0.68880475 | 1 |
The name of the resource. | def name(self) -> pulumi.Output[str]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_name(self):\n return self._resource_name",
"def name(self):\n return self.raw_resource[\"name\"]",
"def name(self):\n\n return self.resource[\"metadata\"][\"name\"]",
"def resource_name(self) -> Optional[str]:\n return pulumi.get(self, \"resource_name\")",
"def ... | [
"0.8797532",
"0.8770644",
"0.8469626",
"0.8306927",
"0.8306927",
"0.8075097",
"0.8075097",
"0.8075097",
"0.8075097",
"0.8075097",
"0.77082634",
"0.76422197",
"0.7560483",
"0.7560483",
"0.7560483",
"0.7560483",
"0.7560483",
"0.7560483",
"0.7560483",
"0.7560483",
"0.7560483",
... | 0.0 | -1 |
Virtual network subnet resource ID the cluster nodes belong to. | def subnet(self) -> pulumi.Output[Optional['outputs.ResourceIdResponse']]:
return pulumi.get(self, "subnet") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnet_id(self) -> str:\n return pulumi.get(self, \"subnet_id\")",
"def virtual_network_subnet_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"virtual_network_subnet_id\")",
"def subnet_id(self):\n return self._subnet_id",
"def subnet_resource_id(self) -> Option... | [
"0.80972964",
"0.78585327",
"0.78098315",
"0.7687506",
"0.76847196",
"0.76847196",
"0.7502823",
"0.7475515",
"0.7356693",
"0.7334006",
"0.7334006",
"0.69895285",
"0.6972776",
"0.6844168",
"0.67223144",
"0.6681554",
"0.65140283",
"0.6507876",
"0.65046257",
"0.64572453",
"0.645... | 0.70347166 | 11 |
The type of the resource. | def type(self) -> pulumi.Output[str]:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_type(cls):\n pass",
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pu... | [
"0.8790597",
"0.8584682",
"0.8584682",
"0.8426495",
"0.8426495",
"0.8426495",
"0.8426495",
"0.8426495",
"0.8225479",
"0.7959945",
"0.78332675",
"0.78332675",
"0.78332675",
"0.78332675",
"0.78332675",
"0.78332675",
"0.78332675",
"0.78332675",
"0.78332675",
"0.78332675",
"0.783... | 0.0 | -1 |
The size of the virtual machines in the cluster. All nodes in a cluster have the same VM size. | def vm_size(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "vm_size") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cluster_sizes(self,sc):\n\n clusterSizes = []\n clusters = sc.labels\n for k in np.arange(clusters.max()):\n clusterSizes.append(len(np.where(clusters==k)[0])) \n \n return clusterSizes",
"def vm_size(self) -> pulumi.Input[str]:\n return pulumi.get(se... | [
"0.7373247",
"0.7230623",
"0.70368874",
"0.7030629",
"0.70136684",
"0.6994482",
"0.6994482",
"0.6994482",
"0.69334006",
"0.6915432",
"0.6880479",
"0.686475",
"0.6852191",
"0.68416387",
"0.6808766",
"0.67839956",
"0.6719153",
"0.6704634",
"0.6687448",
"0.66719",
"0.66316897",
... | 0.74416775 | 0 |
Gets as inputs the aciton taken from the policy and the encoded state by the encoder in the inverse model. The froward model trys to predict the encoded next state. Returns the predicted encoded next state. Gets optimized by the MSE between the actual encoded next state and the predicted version of the forward model! | def forward(self,state,action):
action_ = torch.zeros(action.shape[0],self.OHE_size) # 2024,OHE
indices = torch.stack( (torch.arange(action.shape[0]), action.squeeze().long()), dim=0)
indices = indices.tolist()
action_[indices] = 1.
x = torch.cat( (state,action_) ,dim=1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, *args):\r\n _, (hn, _) = self.enc(*args)\r\n\r\n y_pred = self.mlp(hn)\r\n return y_pred",
"def forward(self, *args):\r\n enc_src, _, _ = self.unified_encoder(*args)\r\n enc_src = enc_src.view(enc_src.shape[0], -1)\r\n y_pred = self.mlp(enc_src)\r\n ... | [
"0.6443538",
"0.62089664",
"0.6140577",
"0.60962397",
"0.60822535",
"0.6081336",
"0.5989855",
"0.5943661",
"0.59300905",
"0.58951133",
"0.5888375",
"0.58642584",
"0.58445036",
"0.5844479",
"0.58430386",
"0.5815357",
"0.5805219",
"0.5781389",
"0.5775499",
"0.57685506",
"0.5747... | 0.0 | -1 |
Returns true if the player has already visited all the rooms. | def has_already_visited(self, *room_names):
for room_name in room_names:
if room_name not in self._rooms_already_visited:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_visit_all(rooms):\n total = len(rooms)\n visited = [False] * total\n visited[0] = True\n todo = [0]\n while todo:\n n = todo.pop()\n print(f'visit room {n}')\n for key in rooms[n]:\n if 0 <= key < total and not visited[key]:\n todo.append(key)\n... | [
"0.73381436",
"0.6999641",
"0.6402926",
"0.62737966",
"0.62575084",
"0.62267727",
"0.61341035",
"0.61102456",
"0.60665184",
"0.6042786",
"0.6031819",
"0.60136205",
"0.5976673",
"0.5930121",
"0.591965",
"0.59147084",
"0.59147084",
"0.5900237",
"0.5854317",
"0.5849685",
"0.5832... | 0.7830867 | 0 |
Plots average duration and distance of bike trips on Tuesdays | def plot_dur_dist(data):
sumDist = 0 # counter for distance
sumDur = 0 # counter for duration
n = 0 # counter for Tuesday bike journeys
tuesdays = [i for i in range(2, 31, 7)]
for index, row in data.iterrows():
if int(row['started_at'].split(' ')[0].split('-')[2]) in tuesdays:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display(self):\n \n # initialize SQL kit to access database\n s = SQL_Kit(self.userID, self.password, self.database)\n \n \n \"\"\" Total Activity by hour \"\"\"\n \n # get activity data\n all_date_times = self.activity().index\n\n all_days ... | [
"0.5842115",
"0.5818831",
"0.58152544",
"0.57870823",
"0.5751964",
"0.57402927",
"0.57294345",
"0.5683966",
"0.5680436",
"0.567116",
"0.5667245",
"0.5665901",
"0.5665071",
"0.5662742",
"0.56620824",
"0.5661078",
"0.5658846",
"0.56540483",
"0.5649238",
"0.5645376",
"0.56298554... | 0.75536937 | 0 |
Gets all stations and find most popular ones. | def station_analysis(data):
unique_stations = list(set(data['start_station_name'].tolist() + data['end_station_name'].tolist()))
station_counter = {station : 0 for station in unique_stations}
for index, row in data.iterrows():
station_counter[row['start_station_name']] += 1
print('List of all ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n df = load_data(city, month, day)\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # TO DO: display most commonly used start station\n popular_ss = df['Start Station'].mode()[0]\n print('Most popular start station', popular_... | [
"0.6793665",
"0.6679763",
"0.6642862",
"0.6568323",
"0.64454436",
"0.6444351",
"0.64112246",
"0.64096916",
"0.6405301",
"0.63963705",
"0.6396146",
"0.6395128",
"0.6395029",
"0.63908863",
"0.638625",
"0.6368572",
"0.636506",
"0.6351154",
"0.63474756",
"0.63330066",
"0.6328231"... | 0.59845865 | 96 |
Check whether or not Email is valid (ready to send) | def _valid(self):
return all(map(lambda v: v is not None,
(self.connection, self.sender, self.receiver, self.subject, self.body))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(self):\n rv = Form.validate(self)\n if not rv:\n return False\n\n cur = get_cursor()\n if not email_exists(cur, self.email.data):\n self.email.errors.append('Please check your email address.')\n return False\n\n return True",
"def v... | [
"0.7367757",
"0.71055406",
"0.70033073",
"0.6985207",
"0.6957917",
"0.6953169",
"0.69275177",
"0.6914797",
"0.6883713",
"0.6858398",
"0.6844769",
"0.68410033",
"0.68318",
"0.6776361",
"0.676862",
"0.67637527",
"0.6694208",
"0.66901594",
"0.66589814",
"0.6639372",
"0.6628725",... | 0.0 | -1 |
Convert sequence a into timelagged vectors | def rolling_window(a=None, seq_len=None, seq_names=None):
if not isinstance(a, list):
a = [a]
all_windows = []
all_seq_names = []
for i, a_i in enumerate(a):
if a_i.shape[0] < seq_len:
continue
shape = [a_i.shape[0] - seq_len + 1, seq_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seg_times_to_trans_times(seg_times):\n trans_times = np.r_[0, np.cumsum(seg_times)]\n return trans_times",
"def acc2vel(timeseries, dt):\n return np.cumsum(timeseries) * dt",
"def get_lagged_list(binned_series, lags):\n lagged_list = []\n for s in range(lags):\n lagged_list.append(bin... | [
"0.64424336",
"0.60823476",
"0.6024994",
"0.6002265",
"0.595392",
"0.5924837",
"0.5792131",
"0.5784678",
"0.57843417",
"0.56903523",
"0.56883556",
"0.56702554",
"0.56592816",
"0.5636329",
"0.56196606",
"0.55488616",
"0.55488616",
"0.55413634",
"0.55352706",
"0.55337113",
"0.5... | 0.0 | -1 |
reads .bed file into pandas dataframe | def read_bed_file(path, labelnum=0):
bed_df = pd.read_table(path, sep="\t", header=None)
colnames = generate_colnames(bed_df, labelnum)
bed_df.columns = colnames
print(bed_df.head())
return bed_df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_phenotype_bed(phenotype_bed):\n if phenotype_bed.lower().endswith(('.bed.gz', '.bed')):\n phenotype_df = pd.read_csv(phenotype_bed, sep='\\t', index_col=3, dtype={'#chr':str, '#Chr':str})\n elif phenotype_bed.lower().endswith('.bed.parquet'):\n phenotype_df = pd.read_parquet(phenotype_... | [
"0.638718",
"0.61649466",
"0.6122096",
"0.6093712",
"0.6074376",
"0.59862417",
"0.5984604",
"0.5903469",
"0.5828193",
"0.580324",
"0.57994986",
"0.57978356",
"0.57915485",
"0.57824236",
"0.57146895",
"0.56894195",
"0.5688615",
"0.56875104",
"0.566715",
"0.56555396",
"0.565539... | 0.76813644 | 0 |
Convert utc datetime to local datetime | def utc2local(utc_dt):
return datetime.fromtimestamp(timegm(utc_dt.timetuple())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def utc_to_local_datetime(dt):\n return dt.astimezone(LOCAL)",
"def utc_to_local(utc_dt: datetime) -> datetime:\n if utc_dt is None:\n return None\n local_dt = utc_dt.astimezone(tz.tzlocal())\n return local_dt",
"def datetime_from_utc_to_local(utc_datetime):\n now_timestamp = time.tim... | [
"0.82599336",
"0.79972535",
"0.79688895",
"0.79470736",
"0.76508397",
"0.764903",
"0.7605416",
"0.7600073",
"0.75419134",
"0.75267357",
"0.7306483",
"0.7296312",
"0.7296312",
"0.7296312",
"0.7190681",
"0.71516335",
"0.7131339",
"0.7057341",
"0.70480084",
"0.7021855",
"0.69829... | 0.79525477 | 3 |
Takes an array of valid indices and a list of tickets, scans the tickets to check for fields that are invalid. | def error_rate(valid: List[bool], tickets: List[List[int]]) -> int:
# Keep track of ticket scanning error rate (sum of all invalid
# fields)
rate = 0
# Iterate through all values on all tickets, summing all
# invalid values encountered
for ticket in tickets:
for val in ticket:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_ticket_index(self, index, author_id, ticket_type=None):\n\n if not index.isdigit():\n return self.ticket_messages.invalid_index, None\n\n index = int(index)\n\n if not ticket_type: # find what ticket type the index could belong to\n if index not in self.reverse_ticket_ref:\n ... | [
"0.65329665",
"0.56348306",
"0.56062984",
"0.54405105",
"0.5242853",
"0.5205942",
"0.52031505",
"0.52027863",
"0.51789314",
"0.5171475",
"0.5130657",
"0.51057553",
"0.50972146",
"0.5082088",
"0.50775796",
"0.5069668",
"0.5009493",
"0.5007292",
"0.5003921",
"0.49999163",
"0.49... | 0.5443359 | 3 |
Returns a signed representation of 'x'. | def to_signed(x, bits):
if x >= 0:
return x
else:
return int('1{:0{}b}'.format(2**(bits-1)+x, bits-1), 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign(x):\n return(copysign(1, x))",
"def sign(x):\n if x >= 0:\n return 1\n else:\n return -1",
"def sign(x):\n if x >= 0:\n return 1\n return -1",
"def hex_to_signed(source):\n if not isinstance(source, str):\n raise ValueError(\"string type required\")\n ... | [
"0.7416465",
"0.71082306",
"0.6997009",
"0.65060806",
"0.6438313",
"0.6356634",
"0.6291086",
"0.62800175",
"0.606167",
"0.60528535",
"0.59295094",
"0.5921742",
"0.5914535",
"0.5893646",
"0.5823133",
"0.57841164",
"0.5754345",
"0.5737159",
"0.5629804",
"0.5629804",
"0.56113106... | 0.7417579 | 0 |
Extend an array from the back. Useful to fill arrays that have been shortened and need to conform to a certain size. | def extend_array(l, n):
l.extend([-1] * n)
l = l[:n]
return l | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _extend(self, newlen: int) -> None:\n diff = newlen - len(self)\n if diff > 0:\n self.extend([0] * diff)",
"def extend(dset, array):\n length = len(dset)\n newlength = length + len(array)\n dset.resize((newlength,) + array.shape[1:])\n dset[length:newlength] = array\n ... | [
"0.66217035",
"0.64583373",
"0.6360135",
"0.62053424",
"0.6138675",
"0.6125723",
"0.61012614",
"0.60935694",
"0.6075794",
"0.6070164",
"0.59849495",
"0.59266514",
"0.58320254",
"0.5804029",
"0.57999176",
"0.5767587",
"0.5721585",
"0.5719776",
"0.5686566",
"0.5684422",
"0.5682... | 0.67937744 | 0 |
Updates the ``Context`` for the given Task. Useful when you need to pass the context among different tasks. This method is available for backwardcompatibility. Use the ``AsyncioContextProvider`` API to set the current active ``Context``. | def set_call_context(task, ctx):
setattr(task, AsyncioContextProvider._CONTEXT_ATTR, ctx) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_task(cls, workbook, task, state, task_output):\n task_spec = workbook.tasks.get(task[\"name\"])\n task_runtime_context = task[\"task_runtime_context\"]\n\n # Compute the outbound_context, state and exec_flow_context.\n outbound_context = data_flow.get_outbound_context(task, ... | [
"0.5931201",
"0.59306806",
"0.58346915",
"0.57609236",
"0.57496864",
"0.5701335",
"0.56470454",
"0.5616688",
"0.5532264",
"0.5528464",
"0.5476038",
"0.54721737",
"0.5458368",
"0.54513663",
"0.5409048",
"0.5406428",
"0.5406428",
"0.53607816",
"0.53367335",
"0.53343904",
"0.528... | 0.7531768 | 0 |
Calculates the heuristic of the state. The calculation depends on if specific goals are given or not. If goals are assigned the distance to those goals is used as heuristic, otherwise the distance to the nearest goal of the same color is used. | def heuristic(self, state: ODState) -> int:
h = 0
if self.assigned_goals is None:
for agent in state.new_agents:
h += self.grid.get_heuristic(agent.coords, agent.color)
for j in range(len(state.new_agents), len(state.agents)):
h += self.grid.get_he... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_heuristic(self, state):\n\n def get_manhattan_distance(coord_a, coord_b):\n \"\"\"Returns the manhattan distance between coord_a and coord_b.\"\"\"\n return abs(coord_a.x - coord_b.x) + abs(coord_a.y - coord_b.y)\n\n \n def get_num_obstacles(coord_a, coord_b):\n ... | [
"0.7267905",
"0.7016952",
"0.70017385",
"0.69961554",
"0.6972024",
"0.6941171",
"0.6913669",
"0.69027805",
"0.68044233",
"0.6787444",
"0.67554885",
"0.6720003",
"0.6711873",
"0.665831",
"0.6633275",
"0.65907824",
"0.6572349",
"0.6568922",
"0.6560635",
"0.652899",
"0.65183425"... | 0.7558685 | 0 |
Initialise a new sample rate converter. | def src_new(converter_type, channels):
error = ffi.new('int*')
state = _lib.src_new(converter_type, channels, error)
return state, error[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new( self, nSamplingRate = 44100, nNbrChannel = 1, nNbrBitsPerSample = 16 ):\n self.reset()\n self.nNbrChannel = nNbrChannel\n self.nSamplingRate = nSamplingRate\n self.nNbrBitsPerSample = nNbrBitsPerSample \n self.updateHeaderComputedValues()",
"def initialise_sampl... | [
"0.6131779",
"0.59625643",
"0.59358096",
"0.5895996",
"0.5873622",
"0.5851705",
"0.5774728",
"0.5768871",
"0.57549113",
"0.5695908",
"0.56726557",
"0.5670159",
"0.56402856",
"0.5637754",
"0.56264025",
"0.56246275",
"0.5591267",
"0.5584221",
"0.55727935",
"0.5554595",
"0.55292... | 0.0 | -1 |
Return `True` if ratio is a valid conversion ratio, `False` otherwise. | def src_is_valid_ratio(ratio):
return bool(_lib.src_is_valid_ratio(ratio)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_ratio_format(self):\n if '/' not in self._ratio:\n msg = (\"Ratio input {} does not contain the '/' character. \"\n \"Please make sure the ratio input is a string in the form \"\n \"'numerator_column_name/denominator_column_name'\")\n e... | [
"0.63475585",
"0.6309936",
"0.6184787",
"0.6009115",
"0.59804565",
"0.59167606",
"0.58148825",
"0.58127016",
"0.57809705",
"0.57613695",
"0.56969726",
"0.5690059",
"0.56751794",
"0.5650626",
"0.5616441",
"0.55917543",
"0.5577948",
"0.55764407",
"0.5501736",
"0.54993105",
"0.5... | 0.8384849 | 0 |
Get all Players in the entity list. | def players(self):
return self._get_by_class(Player) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPlayers(self):\n return iter(self.players)",
"def get_players(self, all=False):\n if all:\n return self.all_players\n else:\n return self.players",
"def get_players(self):\r\n return self.players.values()",
"def players(self):\n return Player.ob... | [
"0.7476747",
"0.7304088",
"0.7222711",
"0.7190505",
"0.71495235",
"0.70690197",
"0.7043049",
"0.69756544",
"0.69491905",
"0.69125885",
"0.681817",
"0.67515016",
"0.6570159",
"0.6525586",
"0.65217125",
"0.6364989",
"0.6363765",
"0.6347749",
"0.62612224",
"0.6254866",
"0.624345... | 0.7080602 | 5 |
Returns the name of the device if any. | def name(self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_name(self) -> Optional[str]:\n return pulumi.get(self, \"device_name\")",
"def device_name(self) -> Optional[str]:\n return pulumi.get(self, \"device_name\")",
"def name(self):\n return self._device.name",
"def name(self):\n return self._device.name",
"def name(self):... | [
"0.8948684",
"0.8948684",
"0.8575258",
"0.8575258",
"0.8575258",
"0.8508962",
"0.84862804",
"0.838302",
"0.8367647",
"0.8367647",
"0.8353379",
"0.8319792",
"0.8271619",
"0.81589013",
"0.8131442",
"0.8102677",
"0.80319405",
"0.8013851",
"0.8009554",
"0.7948883",
"0.79324096",
... | 0.0 | -1 |
Returns the name of the device if any. | def state(self):
return self._state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_name(self) -> Optional[str]:\n return pulumi.get(self, \"device_name\")",
"def device_name(self) -> Optional[str]:\n return pulumi.get(self, \"device_name\")",
"def name(self):\n return self._device.name",
"def name(self):\n return self._device.name",
"def name(self):... | [
"0.8948684",
"0.8948684",
"0.8575258",
"0.8575258",
"0.8575258",
"0.8508962",
"0.84862804",
"0.838302",
"0.8367647",
"0.8367647",
"0.8353379",
"0.8319792",
"0.8271619",
"0.81589013",
"0.8131442",
"0.8102677",
"0.80319405",
"0.8013851",
"0.8009554",
"0.7948883",
"0.79324096",
... | 0.0 | -1 |
Given an array nums of integers and integer k, return the maximum sum such that there exists i < j, with nums[i] + nums[j] = sum and sum < k. If no i, j exist satisfying this equation, return 1 | def twoSumLessThanK(nums, k):
nums.sort()
start = 0
end = len(nums) - 1
max_sum = -1
while start < end:
curr_sum = nums[start] + nums[end]
if curr_sum < k:
max_sum = max(curr_sum, max_sum)
if curr_sum >= k:
end -= 1
else:
start += 1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maxResult(self, nums: List[int], k: int) -> int:\n # Solution 1 - 964 ms\n # Solution 2 - 864 ms\n n = len(nums)\n if n == 0:\n return 0\n if n == 1:\n return nums[0]\n\n dp = [0] * n\n dp[0] = nums[0]\n max_sum = dp[0]\n max_... | [
"0.8274466",
"0.8078755",
"0.78772104",
"0.7632056",
"0.7421356",
"0.7303891",
"0.7289666",
"0.7220777",
"0.71189696",
"0.70995396",
"0.70642453",
"0.6993605",
"0.6969033",
"0.69625676",
"0.6899552",
"0.682759",
"0.6825111",
"0.68014956",
"0.67082655",
"0.66967523",
"0.668855... | 0.8137371 | 1 |
returns a star rating between 0 and 5 for current conditions, | def getStarRating(waveHeight, windDir, avgWind, tideHeight):
starRating = 0
# wave height
if waveHeight > 2:
starRating += 4
elif waveHeight > 1.6:
starRating += 3
elif waveHeight > 1.4:
starRating += 2
elif waveHeight > 1.2:
starRating += 1
# wind directio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bound_rating(self, rating):\n return 1.0 * max(0, min(int(rating + 0.5), 5))\n # return 1.0 * max(0, min(rating, 5))",
"def k(rating):\n if rating < 100: return 40\n if rating < 200: return 20\n return 10",
"def get_rating(mpg):\n if mpg < 14:\n return 1\n elif mpg < 15:... | [
"0.71564525",
"0.69826484",
"0.6799818",
"0.6367902",
"0.6359642",
"0.63387793",
"0.63360375",
"0.6248107",
"0.61657065",
"0.6115102",
"0.6070869",
"0.60223264",
"0.5976396",
"0.59432673",
"0.5941993",
"0.59387696",
"0.59206915",
"0.59071594",
"0.58722144",
"0.58640075",
"0.5... | 0.6884922 | 2 |
Gets the name of this TeamBuilderConfig. | def name(self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._config_name",
"def name(self):\n return self.config[\"name\"]",
"def name(self):\n return self._config.get(CONF_NAME)",
"def name(self) -> str:\n name = self._config[\"name\"]\n assert isinstance(name, str) # noqa: S101\n return name",... | [
"0.82457095",
"0.80872715",
"0.7972231",
"0.79245055",
"0.7553295",
"0.75037193",
"0.7491554",
"0.7481969",
"0.7481969",
"0.73511493",
"0.73207635",
"0.71269494",
"0.711729",
"0.7078735",
"0.696346",
"0.696166",
"0.6885289",
"0.68741506",
"0.6835821",
"0.6835821",
"0.68161696... | 0.0 | -1 |
Sets the name of this TeamBuilderConfig. | def name(self, name):
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n self.options['name'] = name",
"def set_name(self, name):\n self.settings[\"name\"] = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def s... | [
"0.76163036",
"0.75752044",
"0.7235179",
"0.7235179",
"0.7235179",
"0.7235179",
"0.7235179",
"0.71058345",
"0.70972013",
"0.7093581",
"0.70647377",
"0.706012",
"0.706012",
"0.70282125",
"0.70110816",
"0.699908",
"0.69961244",
"0.69961244",
"0.6977196",
"0.69567764",
"0.693114... | 0.0 | -1 |
Gets the is_default of this TeamBuilderConfig. | def is_default(self):
return self._is_default | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_default(self) -> Optional[bool]:\n return pulumi.get(self, \"is_default\")",
"def default(self) -> Optional[bool]:\n return pulumi.get(self, \"default\")",
"def default(self) -> Optional[bool]:\n return pulumi.get(self, \"default\")",
"def default(self) -> Optional[bool]:\n ... | [
"0.78300124",
"0.77499",
"0.77499",
"0.77499",
"0.77499",
"0.77499",
"0.76571006",
"0.75788844",
"0.7552164",
"0.74837476",
"0.74549496",
"0.74319893",
"0.7416595",
"0.7294534",
"0.71046233",
"0.70533794",
"0.70533794",
"0.70466316",
"0.70271987",
"0.70271987",
"0.70271987",
... | 0.7413157 | 13 |
Sets the is_default of this TeamBuilderConfig. | def is_default(self, is_default):
self._is_default = is_default | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_is_default(self):\n self.is_default = True",
"def set_is_default(self):\n self.is_default = True",
"def is_default(self, is_default: bool):\n\n self._is_default = is_default",
"def is_default(self, is_default):\n # type: (bool) -> None\n\n if is_default is not None:... | [
"0.79241943",
"0.79241943",
"0.7815185",
"0.76151633",
"0.72140473",
"0.6873145",
"0.68356246",
"0.6834142",
"0.6777006",
"0.67350197",
"0.6707941",
"0.67010546",
"0.67010546",
"0.67010546",
"0.67010546",
"0.67010546",
"0.6668671",
"0.6614374",
"0.6538922",
"0.6538922",
"0.65... | 0.77044505 | 3 |
Gets the modified of this TeamBuilderConfig. | def modified(self):
return self._modified | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modified(self):\n return self.__modified",
"def modified(self):\n return self.__modified",
"def get_config(self):\n return super().get_config()",
"def getConfig(self):\n \n return self.config",
"def config(self):\r\n return self._config",
"def config(self):\n ... | [
"0.6530059",
"0.6530059",
"0.64382386",
"0.6374289",
"0.6274927",
"0.6273921",
"0.626986",
"0.6266055",
"0.62280625",
"0.62280625",
"0.6200885",
"0.61425626",
"0.61425626",
"0.61425626",
"0.61323506",
"0.6108029",
"0.6078097",
"0.60672027",
"0.6063838",
"0.6028929",
"0.602166... | 0.6472333 | 4 |
Gets the id of this TeamBuilderConfig. | def id(self):
return self._id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"config_id\")",
"def config_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"config_id\")",
"def id(self):\n return self.config['key']",
"def unique_id(self) -> str | None:\n return self._config[CONF_I... | [
"0.74159837",
"0.7367211",
"0.7287387",
"0.7087607",
"0.68372184",
"0.68184465",
"0.68148214",
"0.6731414",
"0.6731414",
"0.65862817",
"0.65862817",
"0.65862817",
"0.65862817",
"0.6576837",
"0.65249455",
"0.65076673",
"0.6491747",
"0.6390738",
"0.6390738",
"0.6364249",
"0.633... | 0.0 | -1 |
Sets the id of this TeamBuilderConfig. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id):\n self.data['id'] = id",
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id_):\n\n self.id_ = id_",
"def team_id(self, team_id):\n\n self._team_id = team_id",
"def team_id(self, team_id):\n\n self._team_id = team_id",
"def team_id(self,... | [
"0.6853728",
"0.6683665",
"0.6610117",
"0.6580616",
"0.6580616",
"0.6580616",
"0.6580616",
"0.65318364",
"0.64859545",
"0.6434107",
"0.6409524",
"0.6408897",
"0.63549006",
"0.63549006",
"0.63549006",
"0.63034177",
"0.63034177",
"0.63034177",
"0.63034177",
"0.63034177",
"0.629... | 0.0 | -1 |
Gets the team_id of this TeamBuilderConfig. | def team_id(self):
return self._team_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_team_id(self, team_name):\n\n teams = self.get_teams()\n for team in teams:\n if team['name'] == team_name:\n return team['id']\n\n return None",
"def get_team_id(self):\n try:\n return self.profile_data[\"proTeamId\"]\n except Excep... | [
"0.6865887",
"0.67626315",
"0.6667452",
"0.65567875",
"0.64365387",
"0.61714417",
"0.61088115",
"0.60990226",
"0.6095199",
"0.6083141",
"0.6058664",
"0.60309404",
"0.6014208",
"0.598399",
"0.598399",
"0.598399",
"0.598399",
"0.58915734",
"0.58915734",
"0.58743465",
"0.5847677... | 0.7936434 | 0 |
Sets the team_id of this TeamBuilderConfig. | def team_id(self, team_id):
self._team_id = team_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_team(self, team):\n self.team_id = team.instance_id\n self.team_id_friendlyname = team.friendlyname\n self.team_name = team.name",
"def team_id(self):\n return self._team_id",
"def team(self, team):\n\n self._team = team",
"def team(self, team):\n\n self._tea... | [
"0.71737075",
"0.6598815",
"0.64879835",
"0.64879835",
"0.64879835",
"0.64879835",
"0.64719284",
"0.62555873",
"0.62455547",
"0.62178195",
"0.6145683",
"0.5954311",
"0.5790594",
"0.5529493",
"0.5493783",
"0.5460579",
"0.5453473",
"0.54208356",
"0.5285559",
"0.5283992",
"0.527... | 0.80651426 | 2 |
Gets the portals of this TeamBuilderConfig. | def portals(self):
return self._portals | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_portals(self):\n return self._portals",
"def ports(self): # type: () -> t.Dict[str, t.List[t.Dict[str, str]]]\n return self.network_settings['Ports']",
"def ports(self):\n return self.attrs.get('NetworkSettings', {}).get('Ports', {})",
"def port_list(self):\n return self.... | [
"0.7558862",
"0.63059175",
"0.6236059",
"0.61246806",
"0.6048607",
"0.59435594",
"0.5937523",
"0.5910373",
"0.58514804",
"0.57869375",
"0.57303786",
"0.56947243",
"0.5677965",
"0.56714004",
"0.56417745",
"0.5549618",
"0.554369",
"0.5543231",
"0.5536904",
"0.55330336",
"0.5501... | 0.78411996 | 0 |
Sets the product_groups of this TeamBuilderConfig. | def product_groups(self, product_groups):
self._product_groups = product_groups | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groups(self, groups):\n\n self._groups = groups",
"def groups(self, groups):\n\n self._groups = groups",
"def groups(self, groups):\n\n self._groups = groups",
"def groups(self, groups):\n\n self._groups = groups",
"def groups(self, groups):\n self._groups = groups",
... | [
"0.58502275",
"0.58502275",
"0.58502275",
"0.58502275",
"0.5835275",
"0.56724936",
"0.5645487",
"0.563896",
"0.56194127",
"0.55523527",
"0.54608214",
"0.54608214",
"0.5441664",
"0.5342628",
"0.5322196",
"0.51945984",
"0.51924276",
"0.5138973",
"0.5105691",
"0.5094045",
"0.508... | 0.8121454 | 0 |
Gets the product_types of this TeamBuilderConfig. | def product_types(self):
return self._product_types | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_types(self):\n return list(self._product_type_plugins.keys())",
"def product_type(self):\n pass",
"def product_type(self) -> str:\n return get_required(\n self._get_property(PRODUCT_TYPE_PROP, str), self, PRODUCT_TYPE_PROP\n )",
"def get_types(self):\n ... | [
"0.78907853",
"0.660336",
"0.6293005",
"0.6189517",
"0.6120814",
"0.6034096",
"0.60296935",
"0.59759516",
"0.59331036",
"0.5917478",
"0.5857283",
"0.584192",
"0.57928365",
"0.5781339",
"0.575365",
"0.5720826",
"0.56761724",
"0.56509817",
"0.5633754",
"0.56326175",
"0.55849236... | 0.8218948 | 0 |
Gets the product_size_materials of this TeamBuilderConfig. | def product_size_materials(self):
return self._product_size_materials | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_team_builder_config_product_size_materials_get(self):\n pass",
"def test_team_builder_config_product_size_materials_id_product_size_material_get(self):\n pass",
"def test_team_builder_config_product_size_materials_id_get(self):\n pass",
"def test_team_builder_config_product_size... | [
"0.8047327",
"0.77792865",
"0.76262605",
"0.74027044",
"0.7322649",
"0.72033674",
"0.7117839",
"0.71029353",
"0.70932364",
"0.68598086",
"0.68409806",
"0.67435664",
"0.67150205",
"0.66836214",
"0.6587144",
"0.6406696",
"0.6170016",
"0.59737045",
"0.5747317",
"0.5734922",
"0.5... | 0.82773024 | 0 |
Gets the product_size_materials_rel of this TeamBuilderConfig. | def product_size_materials_rel(self):
return self._product_size_materials_rel | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_size_materials(self):\n return self._product_size_materials",
"def test_team_builder_config_product_size_materials_get(self):\n pass",
"def test_team_builder_config_product_size_materials_id_product_size_material_get(self):\n pass",
"def test_team_builder_config_product_size_... | [
"0.7800131",
"0.75651366",
"0.74155396",
"0.7187809",
"0.70892626",
"0.6847651",
"0.6821609",
"0.6665253",
"0.6587752",
"0.6543135",
"0.65385056",
"0.64721036",
"0.6411234",
"0.6320619",
"0.6173086",
"0.6040177",
"0.59960485",
"0.5890668",
"0.5348582",
"0.53281546",
"0.530521... | 0.8342002 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
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.7961088",
"0.7961088",
"0.79433626",
"0.79303336",
"0.7926563",
"0.7897525",
"0.78826123",
"0.78826123",
"0.78806067",
"0.7872423",
"0.7868354",
"0.78668815",
"0.7825702",
"0.7819993",
"0.78162885",
"0.78078854",
"0.78068... | 0.79670393 | 50 |
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.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Return value of Basic Authorization HTTP header. | def __calculate_basic_auth_value(self) -> str:
return 'Basic %s' % b64encode(f'{self.__email}:{self.__password}'.encode()).decode("ascii") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBasicAuthorization(self):\n header = self.request.getHeader(\"Authorization\")\n if header:\n try:\n if header.lower().startswith(\"basic \"):\n authstr = base64.b64decode(header[6:]).split(\":\")\n if len(authstr) == 1:\n ... | [
"0.85119975",
"0.77596045",
"0.74358016",
"0.722031",
"0.7128892",
"0.711249",
"0.6931752",
"0.6921638",
"0.68677074",
"0.68598527",
"0.6803585",
"0.6778641",
"0.67356503",
"0.6732692",
"0.6731713",
"0.6721981",
"0.67061967",
"0.67061967",
"0.66657555",
"0.6658012",
"0.665705... | 0.7294515 | 3 |
Like find_symbols() but when found only one, returns one item, not list with one item | def symbol(self, **kw):
if not kw:
raise ValueError(u"'symbol' needs keyword arguments")
res = self.find_symbols(**kw)
if len(res)==1:
return res[0]
else:
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find1symbols(symbol, reel):\n for i in range(len(reel)):\n if reel[i] == symbol:\n return i",
"def find_symbols(lst):\n ret = []\n for ii in lst:\n ret += [find_symbol(ii)]\n return ret",
"def find_symbols(self, **kw):\n return list(self.ifind_symbols(**kw))",
"def getE... | [
"0.69440824",
"0.64823014",
"0.6391833",
"0.621189",
"0.61845696",
"0.6138568",
"0.6090266",
"0.60163385",
"0.59851235",
"0.59739023",
"0.59625745",
"0.59524494",
"0.58431435",
"0.58382154",
"0.58308756",
"0.5790445",
"0.5768231",
"0.5754692",
"0.57262963",
"0.56650114",
"0.5... | 0.6827875 | 1 |
Similar to ifind_at but returns list | def find_at(self, x, y):
return list(self.ifind_at(x, y)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getidx(self, ind: Union[str, int]) -> List[Any]:\n output = []\n for data in self.data:\n output.append(data[ind])\n return output",
"def getidx(self, ind: Union[str, int]) -> List[Any]:\n output = []\n for data in self.data:\n output.append(data[ind])... | [
"0.6305985",
"0.62262416",
"0.61895216",
"0.6154223",
"0.60050476",
"0.595091",
"0.5915911",
"0.59113336",
"0.59023803",
"0.5878262",
"0.583461",
"0.5818285",
"0.5803825",
"0.58010626",
"0.57734114",
"0.57560515",
"0.5734005",
"0.57265306",
"0.5708081",
"0.56734914",
"0.56711... | 0.7200324 | 0 |
Constructor for the Node object. | def __init__(self, data=None, next=None):
self.data = data
self.next = next | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.root = Node('')",
"def __init__(self):\n self.__root = Node()",
"def __init__(self):\n self.root = self.Node(None)",
"def __init__(self):\n self.root = self.Node()",
"def __init__(self):\n self.root = Node(\"\")",
"def __init__(self):\n ... | [
"0.79788005",
"0.7924777",
"0.7924138",
"0.7892642",
"0.78917146",
"0.78917146",
"0.7866171",
"0.7818067",
"0.7818067",
"0.7818067",
"0.77830786",
"0.7736678",
"0.7722379",
"0.75891405",
"0.758806",
"0.75492644",
"0.75268805",
"0.75217617",
"0.74934405",
"0.747363",
"0.747289... | 0.0 | -1 |
Constructor for the Linked List object. | def __init__(self, iterable=()):
self.head = None
self._counter = 0
if isinstance(iterable, (str, tuple, list)):
for item in iterable:
self.push(item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n node = ListNode(0) # dummy\n self.head = node\n self.tail = node\n self.len = 0",
"def __init__(self, linked_list: object):\n self.current_node = linked_list._head",
"def __init__(self, lst=[]):\n self.__length = 0 # current length of the linked... | [
"0.8129265",
"0.8063581",
"0.7901676",
"0.78837174",
"0.76725006",
"0.76725006",
"0.76725006",
"0.76725006",
"0.76725006",
"0.7651917",
"0.7627156",
"0.76201326",
"0.758628",
"0.758628",
"0.756887",
"0.75368667",
"0.75368667",
"0.7514597",
"0.7502049",
"0.7500917",
"0.7498207... | 0.0 | -1 |
Add a new value to the head of the Linked List. | def push(self, val):
new_head = Node(val, self.head)
self.head = new_head
self._counter += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_head(self, value):\n node = Node(value)\n if self.head is not None:\n node.set_next(self.head)\n\n self.head = node",
"def add_to_head(self, value):\n\n new_node = ListNode(value)\n if self.size == 0:\n self.head = new_node\n self.tai... | [
"0.84290504",
"0.8418046",
"0.8362911",
"0.8347601",
"0.81448716",
"0.8140178",
"0.8128415",
"0.8111633",
"0.8111633",
"0.810367",
"0.79990417",
"0.7974682",
"0.7952147",
"0.7888331",
"0.7877744",
"0.7827625",
"0.78238624",
"0.75750965",
"0.75732356",
"0.7517199",
"0.75157404... | 0.68096054 | 66 |
Remove and return the value if the head of the Linked List. | def pop(self):
if not self.head:
raise IndexError("Empty list, unable to pop")
output = self.head.data
self.head = self.head.next
self._counter -= 1
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_from_head(self):\n\n if self.size == 0: # no elements in list\n return None # nothing to return\n\n removed_value = self.head.value # make a copy of the node to be deleted\n\n if self.size == 1: # if only one element in list (node is head and tail)\n self.h... | [
"0.8284167",
"0.80771106",
"0.79335696",
"0.78934693",
"0.7617397",
"0.75654584",
"0.7534936",
"0.7530711",
"0.7529095",
"0.74735785",
"0.74041426",
"0.73136175",
"0.7290755",
"0.7278959",
"0.7261771",
"0.7204866",
"0.71812654",
"0.7181264",
"0.71444046",
"0.70825964",
"0.707... | 0.6388104 | 83 |
Get the front element. | def peek(self) -> int:
if len(self.sk1.stack) == 0:
if len(self.sk2.stack) > 0:
return self.sk2.stack[-1]
else:return self.sk1.stack[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass",
"def getFront(self):\n if not self.isEmpty():\n return self._data[0]\n else:\n return -1",
"def front(self):\n return self.queue[0] if not self.empty() else None",
"def peek_front(... | [
"0.8201041",
"0.7926421",
"0.7852804",
"0.77914184",
"0.7789178",
"0.75732213",
"0.75237143",
"0.75105965",
"0.7478661",
"0.7379368",
"0.7379368",
"0.73430735",
"0.7323501",
"0.73202574",
"0.72916055",
"0.7277044",
"0.7269943",
"0.7265428",
"0.72533417",
"0.72358",
"0.7221035... | 0.0 | -1 |
Returns whether the queue is empty. | def empty(self) -> bool:
return len(self.sk2.stack) <= 0 if len(self.sk1.stack) == 0 else False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_queue) == 0",
"def is_empty(self):\n return len(self.__queue) > 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return self.queue == []",
"def ... | [
"0.9270249",
"0.92506766",
"0.923635",
"0.923635",
"0.9155843",
"0.9098441",
"0.9095006",
"0.90922606",
"0.90731245",
"0.9053733",
"0.89205354",
"0.89137155",
"0.8877591",
"0.88436323",
"0.88436323",
"0.8835949",
"0.88038146",
"0.8758203",
"0.87577534",
"0.87310195",
"0.86462... | 0.0 | -1 |
Return the device state attributes. | def extra_state_attributes(self):
if self.is_connected:
return {
"interface": self._device.interface,
}
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\r\n return self._attributes",
"def device_state_attributes(self):\n return self._attrs",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self... | [
"0.93168503",
"0.92452604",
"0.92202556",
"0.92145616",
"0.92145616",
"0.9210586",
"0.9210586",
"0.9190543",
"0.9190543",
"0.9190543",
"0.9190543",
"0.9190543",
"0.9190543",
"0.9190543",
"0.9190543",
"0.9190543",
"0.9190543",
"0.9190543",
"0.9190543",
"0.9190543",
"0.91438437... | 0.0 | -1 |
Hash the password when the value is set. | def password_listener(target, value, oldvalue, initiator):
return pwd_context.encrypt(value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password(self, value):\n self.password_hashed = func.crypt(value, func.gen_salt('bf'))",
"def hash_password(self):\n self.__password = self.str_to_hash(self.__password)",
"def hash_password(self, password):\n self.password_hash = generate_password_hash(password)",
"def password(self,... | [
"0.8206083",
"0.8189543",
"0.7921746",
"0.79145014",
"0.78269666",
"0.76821333",
"0.76364714",
"0.76160294",
"0.7612611",
"0.7571564",
"0.75425076",
"0.7521486",
"0.7521486",
"0.7521486",
"0.7521486",
"0.7514608",
"0.7428923",
"0.7413124",
"0.7357456",
"0.7321448",
"0.7321448... | 0.0 | -1 |
Tokenizes input text data by applying normalization, tokenization, removal of stopwords and stemmatization. Returns a list of words. | def tokenize(text):
text_norm = re.sub(r'[^a-zA-Z0-9]', ' ', text) # normalize: remove punctuation
word_list = word_tokenize(text_norm) # tokenize
word_list_clean = [w for w in word_list if w not in stopwords.words('english')] # remove stopwords
word_list_stemmed = [PorterStemmer().stem(w) for w in word... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(self, sentence):\n\n # selects onlt alphanumeric words\n words = self.tokenizer.tokenize(sentence)\n\n # lemmatize the words\n words = [self.lemmatizer.lemmatize(word) for word in words]\n\n # lowercase all the words and remove single characters\n words = [word... | [
"0.7707672",
"0.770459",
"0.76523936",
"0.76111734",
"0.76008326",
"0.7584297",
"0.75804293",
"0.75728863",
"0.75700015",
"0.75694335",
"0.75684214",
"0.7550853",
"0.7533816",
"0.75199866",
"0.75199866",
"0.75173384",
"0.7487447",
"0.74806416",
"0.74806094",
"0.74800706",
"0.... | 0.8145574 | 0 |
Generate a random string of fixed length | def randomString(stringLength=10):
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(stringLength)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))",
"def generate_random_string(length=6):\n n = int(length / 2 + 1)\n x = binascii.hexlify(os.urandom(n))\n s = x[:length]\n return s.decode(\"utf-8\")",... | [
"0.8678995",
"0.8572973",
"0.85470647",
"0.85287195",
"0.851963",
"0.84313273",
"0.8431233",
"0.841402",
"0.8410922",
"0.8388024",
"0.8344134",
"0.834275",
"0.8339172",
"0.8333347",
"0.8322633",
"0.8296847",
"0.82919496",
"0.8280664",
"0.82805336",
"0.8279507",
"0.8263187",
... | 0.0 | -1 |
Given a place name or address, return the nearest MBTA stop and whether it is wheelchair accessible. | def find_stop_near(place_name):
return get_nearest_station(*get_lat_long(place_name)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_stop_near(place_name):\n\n url = get_url(place_name)\n data = get_json(url)\n lat, long = get_lat_long(data)\n return get_nearest_station(lat, long)",
"def find_stop_near(address):\n latlong = get_lat_long(address)\n latitude = latlong[0]\n longitude = latlong[1]\n nearStop = get... | [
"0.6985686",
"0.68618107",
"0.6019741",
"0.58988124",
"0.5705864",
"0.56806755",
"0.56109256",
"0.5481884",
"0.5419311",
"0.54150444",
"0.5391002",
"0.53406155",
"0.527588",
"0.52701485",
"0.5262836",
"0.52568823",
"0.5208226",
"0.518009",
"0.5121578",
"0.50971687",
"0.507987... | 0.7187776 | 0 |
The month name in the date is locale independent. | def test_localeIndependent(self):
# A point about three months in the past.
then = self.now - (60 * 60 * 24 * 31 * 3)
stat = os.stat_result((0, 0, 0, 0, 0, 0, 0, 0, then, 0))
# Fake that we're in a language where August is not Aug (e.g.: Spanish)
currentLocale = locale.getlocale... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monthname(self):\n return self.strftime(\"%B\")",
"def _monthName(self, month):\n if month is not None:\n month = self.tr(\"MONTH.\" + month.upper())\n return month",
"def get_month_name(month_no):\n locale.setlocale(locale.LC_TIME, \"et-EE\")\n return calendar.month_n... | [
"0.82912135",
"0.7841809",
"0.7743459",
"0.75963765",
"0.7572452",
"0.74987817",
"0.7477133",
"0.73944736",
"0.7393924",
"0.73727196",
"0.73638254",
"0.7349303",
"0.73490644",
"0.7281688",
"0.718895",
"0.7121844",
"0.70620644",
"0.6984705",
"0.6968389",
"0.69665706",
"0.69547... | 0.0 | -1 |
Check output of cftp client for a put request. | def checkPutMessage(self, transfers, randomOrder=False):
output = self.client.transport.value()
if _PY3:
output = output.decode("utf-8")
output = output.split('\n\r')
expectedOutput = []
actualOutput = []
for local, remote, expected in transfers:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_client_can_do_put_request(self):\n response = self.httpbin_4.test_requests_put_method()\n self.assertEqual(response.request.method, 'PUT')\n self.assertEqual(response.status_code, 200)",
"def test_kyc_put_request(self):\n pass",
"def test_kyc_put_request_legal(self):\n ... | [
"0.7372957",
"0.7071322",
"0.6864271",
"0.6692352",
"0.6652814",
"0.65083253",
"0.63617593",
"0.6359904",
"0.6328333",
"0.627699",
"0.626274",
"0.6194847",
"0.6163164",
"0.61473453",
"0.61067826",
"0.61067826",
"0.60892206",
"0.6065984",
"0.6051977",
"0.60482717",
"0.60361814... | 0.0 | -1 |
Clear any buffered data received from stdout. Should be private. | def clearBuffer(self):
self.buffer = b''
self._linesReceived = []
self._lineBuffer = b'' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear():\n # TODO: this should actually create a stack of output so I can test each screen\n lines.clear()",
"def clear():\n clear_output()",
"def clear():\n sys.stdout.write('\\033[2J')\n sys.stdout.write('\\033[H')\n sys.stdout.flush()",
"def flush(self):\n self.old_stdout.... | [
"0.7241992",
"0.7154729",
"0.71315646",
"0.7079355",
"0.70316815",
"0.6996057",
"0.69887835",
"0.6890028",
"0.6864377",
"0.6841996",
"0.67915666",
"0.6791168",
"0.67742395",
"0.674487",
"0.6708617",
"0.67076874",
"0.6606231",
"0.6449104",
"0.6438979",
"0.6411569",
"0.6400984"... | 0.69614315 | 7 |
Performs ResNet style weight initialization. | def init_weights(model, fc_init_std=0.01):
for m in model.modules():
if isinstance(m, nn.Conv3d):
"""
Follow the initialization method proposed in:
{He, Kaiming, et al.
"Delving deep into rectifiers: Surpassing human-level
performance on imagenet c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weight(self):\n init_layer(self.conv1)\n init_layer(self.conv2)\n init_bn(self.norm1)\n init_bn(self.norm2)",
"def init_weight(self):\n init_bn(self.norm0)",
"def _initialize_weights(self):\n pass",
"def init_weights(model):\n ...",
"def init_weight... | [
"0.79351413",
"0.7916401",
"0.7823506",
"0.78108335",
"0.7714048",
"0.7659551",
"0.76577944",
"0.7594529",
"0.7504601",
"0.74236965",
"0.7413026",
"0.7402795",
"0.73987454",
"0.7344427",
"0.7279701",
"0.72656673",
"0.723407",
"0.7224479",
"0.7209719",
"0.7196969",
"0.7178701"... | 0.6587272 | 90 |
Initialize `module.weight` using the "XavierFill" implemented in Caffe2. Also initializes `module.bias` to 0. | def c2_xavier_fill(module: nn.Module) -> None:
# Caffe2 implementation of XavierFill in fact
# corresponds to kaiming_uniform_ in PyTorch
nn.init.kaiming_uniform_(module.weight, a=1) # pyre-ignore
if module.bias is not None: # pyre-ignore
nn.init.constant_(module.bias, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weight(self):\r\n xavier_init(self.output_proj, distribution='uniform', bias=0.)",
"def init_weights(self) -> None:\n self.fc.bias.data.fill_(0)\n self.fc.weight.data.uniform_(-0.1, 0.1)",
"def caffe2_xavier_init(module, bias=0):\n kaiming_init(\n module,\n a=1,\n... | [
"0.75951105",
"0.7423821",
"0.7191386",
"0.7174671",
"0.7115347",
"0.7097043",
"0.7097043",
"0.70845324",
"0.70845324",
"0.70845324",
"0.70255876",
"0.7016449",
"0.69826245",
"0.69667673",
"0.6906296",
"0.6906296",
"0.6906296",
"0.6903733",
"0.6851683",
"0.67904353",
"0.67754... | 0.7507154 | 1 |
Initialize `module.weight` using the "MSRAFill" implemented in Caffe2. Also initializes `module.bias` to 0. | def c2_msra_fill(module: nn.Module, nonlinearity: str = "relu") -> None:
# pyre-ignore
nn.init.kaiming_normal_(module.weight, mode="fan_out", nonlinearity=nonlinearity)
if module.bias is not None: # pyre-ignore
nn.init.constant_(module.bias, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(self, module):\n if isinstance(module, (torch.nn.Linear, torch.nn.Embedding, torch.nn.LayerNorm)):\n module.weight.data.normal_(mean=0.0, std=self.initializer_range)\n if isinstance(module, (torch.nn.Linear, torch.nn.LayerNorm)) and module.bias is not None:\n mo... | [
"0.74615115",
"0.7286383",
"0.7228832",
"0.7206778",
"0.71698064",
"0.71640205",
"0.71540284",
"0.7107511",
"0.70921564",
"0.70859665",
"0.7061617",
"0.7053088",
"0.7053088",
"0.7053088",
"0.7045405",
"0.70347714",
"0.7024965",
"0.70055693",
"0.7002553",
"0.7002553",
"0.69774... | 0.0 | -1 |
Convert invalid URLs to null. | def reformat_weburl(s):
s = (s or '').strip()
if s and '.' in s and 'notavailable' not in s:
match = re.match(r'^http(s)?://', s)
if not match:
s = 'http://' + s
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_non_urls():\n assert normalize_url(\"\") is None\n assert normalize_url(\"abc xyz\") is None\n assert normalize_url(\"asb#abc\") is None\n assert normalize_url(\"Яндекс.рф\") is not None\n assert normalize_url(\"google.blog\") is not None\n assert normalize_url(\"http//google.com\") is N... | [
"0.6218191",
"0.60981",
"0.6077526",
"0.6054259",
"0.5987629",
"0.59788597",
"0.596772",
"0.5964328",
"0.5927779",
"0.59273595",
"0.592279",
"0.58907706",
"0.58879817",
"0.5882792",
"0.58438003",
"0.5820691",
"0.57592946",
"0.57508695",
"0.573993",
"0.56999904",
"0.569808",
... | 0.5357774 | 52 |
Convert a string to have title case. | def title_case(s):
if not s:
return None
s = s.lower()
parts = s.split(' ')
lower_case = (
'a', 'an', 'and', 'as', 'at', 'by', 'for', 'in', 'of', 'on', 'or',
'the', 'to', 'with'
)
parts[0] = parts[0].title()
parts = map(
lambda part: part.title() if part not... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_title(s):\n\ts = re.sub(r\"[A-Za-z]+('[A-Za-z]+)?\",\n lambda mo: mo.group(0)[0].upper() +\n mo.group(0)[1:].lower(),s)\n\ts = s.split(\" \")\n\tfor i in range(len(s)):\n\t\tif (s[i] in \"Ii Iii Iv Vi Vii Viii Ix Ii: Iii: Iv: Vi: Vii: Viii: Ix:\"):\n\t\t\ts[i] = s[i... | [
"0.81671613",
"0.8038356",
"0.7886559",
"0.75226545",
"0.74147516",
"0.7369529",
"0.73507965",
"0.7278746",
"0.72776896",
"0.72582453",
"0.7213417",
"0.71755314",
"0.71708405",
"0.716029",
"0.71566397",
"0.71303433",
"0.70973873",
"0.7078882",
"0.7070269",
"0.7057588",
"0.703... | 0.7907051 | 2 |
Similar to read_as_array but yields a dict instead of an array. The keyvalue pairs are created with the header entry. | def read_as_dict(path, delimiter="\t"):
reader = read_lines(path)
head = reader.next().split(delimiter)
len_head = len(head) - 1
for line in reader:
array = line.split(delimiter, len_head)
yield {head[i]: array[i] for i in range(len_head)} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeDict(headers, array, default=None):\n result, defdict = __makeDict(headers, array, default)\n return result",
"def parse_file(file_path): \n map = OrderedDict() \n with open(file_path) as file:\n reader = csv.reader(file, delimiter='\\t')\n headers = next(reader)\n for i... | [
"0.6183668",
"0.57880944",
"0.571175",
"0.5681728",
"0.55738896",
"0.54913926",
"0.5403214",
"0.5400127",
"0.53765696",
"0.52940613",
"0.5254377",
"0.5203338",
"0.51910007",
"0.5190014",
"0.51772135",
"0.5174873",
"0.51689136",
"0.5143904",
"0.51273733",
"0.51211345",
"0.5111... | 0.53635645 | 9 |
Sets the Type subfield in the header field. | def hdr_type(self, val):
assert val == APv6Udp.HDR_TYPE
self._hdr = (self._hdr & ~APv6Udp.HDR_TYPE_MASK) | (val << APv6Udp.HDR_TYPE_SHIFT) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_type(self, type):\n self.type = type",
"def set_type(self, type):\n self.type = type",
"def SetType(self, ct_type):\r\n\r\n self._type = ct_type",
"def set_type(self, type):\n self._type = type",
"def type(self, type):\n self._type = type",
"def type(self, type)... | [
"0.6807186",
"0.6807186",
"0.67427087",
"0.6720869",
"0.66276467",
"0.66276467",
"0.6600873",
"0.6559807",
"0.6559807",
"0.6559807",
"0.6559807",
"0.6559807",
"0.6559807",
"0.6559807",
"0.6559807",
"0.6559807",
"0.6559807",
"0.6559807",
"0.6559807",
"0.6559807",
"0.6559807",
... | 0.57629234 | 60 |
Packs header attributes into a bytes object. This function is called when bytes() or len() is called on an instance of APv6Udp. | def pack_hdr(self):
d = bytearray()
# Field setter functions affect _hdr value,
# so insert _hdr at the end of this function
# Accept checksum as int or bytes types
# and convert to bytes if given as an int
if self.chksum:
self.hdr_co = 0
if type... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pack(self):\n header = struct.pack(self.PACKAGING_FORMAT, self.cmd_length)\n return header",
"def _pack(self):\n header = struct.pack(self.PACKAGING_FORMAT, self.qubit_id)\n return header",
"def _pack(self):\n if self._cqc_version < 2:\n header = struct.pack(s... | [
"0.65487754",
"0.6436298",
"0.6379586",
"0.63557494",
"0.6285062",
"0.62841344",
"0.61860025",
"0.6154496",
"0.61444414",
"0.6121279",
"0.6103996",
"0.60830086",
"0.60581124",
"0.60525715",
"0.60164416",
"0.60143644",
"0.5994952",
"0.59934485",
"0.5992537",
"0.5989716",
"0.59... | 0.7348816 | 0 |
Delete the specified security group. | def delete(self, sg_id):
self.client.delete_security_group(sg_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_security_group(self, security_group):\r\n return self.delete(self.security_group_path % (security_group))",
"def delete(self, security_group_id: str) -> None:\n\t\troute = f'{AWSSecurityGroupConsts.CLOUD_SECURITY_GROUP.value}/{security_group_id}'\n\t\treturn self._delete(route=route)",
"def d... | [
"0.85662276",
"0.8210117",
"0.8082436",
"0.807139",
"0.7824918",
"0.7819024",
"0.77688706",
"0.77561724",
"0.76489073",
"0.7574855",
"0.7550108",
"0.7444094",
"0.7314309",
"0.73037905",
"0.7280626",
"0.7277278",
"0.722124",
"0.7209613",
"0.7142753",
"0.71279985",
"0.7075681",... | 0.7954625 | 4 |
Returns True if the default floating IP pool is enabled. | def is_simple_associate_supported(self):
# NOTE: There are two reason that simple association support
# needs more considerations. (1) Neutron does not support the
# default floating IP pool at the moment. It can be avoided
# in case where only one floating IP pool exists.
# (2) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def only_use_host_ips(self) -> Optional[pulumi.Input[Union[str, 'BfdEnabled']]]:\n return pulumi.get(self, \"only_use_host_ips\")",
"def _floating_ip_pool_exists(self, context, name):\n pools = [pool.get('name') for pool in\n self.get_floating_ip_pools(context)]\n if name in ... | [
"0.64636755",
"0.618417",
"0.60509044",
"0.5993593",
"0.59571314",
"0.59074587",
"0.58390975",
"0.5820911",
"0.5782998",
"0.57631683",
"0.5759338",
"0.5759145",
"0.5723034",
"0.5719549",
"0.57160133",
"0.5698853",
"0.5682195",
"0.5662753",
"0.5651675",
"0.56396246",
"0.563745... | 0.5497968 | 40 |
Create a QoS Policy. | def policy_create(request, **kwargs):
body = {'policy': kwargs}
policy = neutronclient(request).create_qos_policy(body=body).get('policy')
return QoSPolicy(policy) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_qos_policy(self, **kwargs):\n if not self._has_neutron_extension('qos'):\n raise exc.OpenStackCloudUnavailableExtension(\n 'QoS extension is not available on target cloud'\n )\n\n default = kwargs.pop(\"default\", None)\n if default is not None:\... | [
"0.68759376",
"0.6242619",
"0.6193559",
"0.6185032",
"0.60708255",
"0.6062954",
"0.5996479",
"0.59872615",
"0.5966943",
"0.594414",
"0.59113246",
"0.588065",
"0.58229667",
"0.5793363",
"0.576755",
"0.5761384",
"0.5741361",
"0.57177156",
"0.5717073",
"0.5685106",
"0.5649676",
... | 0.82401085 | 0 |
Get QoS policy for a given policy id. | def policy_get(request, policy_id, **kwargs):
policy = neutronclient(request).show_qos_policy(
policy_id, **kwargs).get('policy')
return QoSPolicy(policy) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_policy(self, policy_id: PolicyID = DEFAULT_POLICY_ID) -> Policy:\n return self.workers.local_worker().get_policy(policy_id)",
"def get_policy_by_id(self, id):\n for service, policy_list in self.remote_store.get_policy_list().items():\n for policy in policy_list:\n ... | [
"0.7725503",
"0.73532784",
"0.72533906",
"0.7127083",
"0.6625672",
"0.64775085",
"0.6432182",
"0.64184535",
"0.6410658",
"0.6400318",
"0.6374223",
"0.6330362",
"0.63037026",
"0.6257615",
"0.6233989",
"0.6224981",
"0.6117491",
"0.60676295",
"0.6050387",
"0.60480464",
"0.602423... | 0.81549245 | 0 |
Update a Minimum Packet Rate rule. | def minimum_packet_rate_rule_update(request, policy_id, rule_id, **kwargs):
body = {'minimum_packet_rate_rule': kwargs}
ruleType = 'minimum_packet_rate_rule'
minpacketrate_update = neutronclient(request)\
.update_minimum_packet_rate_rule(rule_id, policy_id, body)\
.get(ruleType)
return M... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minimum_bandwidth_rule_update(request, policy_id, rule_id, **kwargs):\n body = {'minimum_bandwidth_rule': kwargs}\n ruleType = 'minimum_bandwidth_rule'\n minbandwidth_update = neutronclient(request)\\\n .update_minimum_bandwidth_rule(rule_id, policy_id, body)\\\n .get(ruleType)\n retu... | [
"0.7277555",
"0.61457646",
"0.60345393",
"0.59962577",
"0.59222406",
"0.58652914",
"0.56720436",
"0.5668259",
"0.55922943",
"0.5551132",
"0.55434036",
"0.55237395",
"0.55085146",
"0.55085146",
"0.55007815",
"0.5474096",
"0.54328454",
"0.5427534",
"0.542707",
"0.54068035",
"0.... | 0.79486185 | 0 |
Get RBAC policy for a given policy id. | def rbac_policy_get(request, policy_id, **kwargs):
policy = neutronclient(request).show_rbac_policy(
policy_id, **kwargs).get('rbac_policy')
return RBACPolicy(policy) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_policy_by_id(self, id):\n for service, policy_list in self.remote_store.get_policy_list().items():\n for policy in policy_list:\n if policy.id == id:\n return policy",
"def get_policy(self, policy_id: PolicyID = DEFAULT_POLICY_ID) -> Policy:\n re... | [
"0.7609072",
"0.75252926",
"0.67593324",
"0.6580893",
"0.6523268",
"0.6486931",
"0.6456575",
"0.63647413",
"0.63321996",
"0.6329342",
"0.62911904",
"0.6261756",
"0.6214883",
"0.6194023",
"0.6179474",
"0.6125511",
"0.6124483",
"0.6093706",
"0.60242146",
"0.60095215",
"0.588158... | 0.8068497 | 0 |
Returns how many single elements are in a list despite of possibly having nested lists. This function is used in the Instructions file. | def elemCount(memoryManager, paramsList):
handleEmpty(paramsList, "count elements of")
head = paramsList[0]
if not validateList(head):
raise Exception('Tried to get element count of non-list')
def countHelper(head):
if head == None:
return 0
if type(head) =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lsize( lst ):\n return sum( [ x[1] for x in lst ] )",
"def __len__(self):\n n = 1\n for valTuple in self._valListOfLists:\n n *= len(valTuple)\n return n",
"def deep_len(lst):\n s=0\n for x in lst:\n if type(x) == list:\n s = s + deep_len(x)\n\n\n ... | [
"0.74498034",
"0.73971194",
"0.7344255",
"0.72538537",
"0.7176285",
"0.71633637",
"0.70739836",
"0.7002648",
"0.69440633",
"0.6882341",
"0.6881639",
"0.68408746",
"0.68025434",
"0.6764661",
"0.6712699",
"0.66983974",
"0.6696875",
"0.6676838",
"0.6609897",
"0.66028047",
"0.659... | 0.7448293 | 1 |
convert a nested list of tensor to nested list of np_array. | def _deep_tensor_to_nparray(array_like):
# Recursively check whether each element is a tensor or not, if is tensor,
# convert it to a numpy array in place
if isinstance(array_like, Tensor):
return array_like.asnumpy()
if isinstance(array_like, list):
for idx, value in enumerate(array_li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_numpy(a: List[tvm.nd.NDArray]) -> List[np.ndarray]:\n assert a is not None, \"Empty result cannot be converted to numpy\"\n return [x.numpy() for x in a]",
"def to_tvm_ndarray(a: List[np.ndarray]) -> List[tvm.nd.NDArray]:\n assert a is not None, \"Empty result cannot be converted to T... | [
"0.68412316",
"0.6749231",
"0.65524775",
"0.65040493",
"0.63982886",
"0.6367967",
"0.63524485",
"0.6294176",
"0.6291704",
"0.6198028",
"0.6170006",
"0.61575586",
"0.61203235",
"0.6119871",
"0.6117636",
"0.6082942",
"0.60652846",
"0.60474956",
"0.60424167",
"0.603359",
"0.6027... | 0.6593433 | 2 |
Get the current device (`GPU`, `CPU`, `Ascend`) | def _get_device():
return context.get_context('device_target') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_device():\n import torch\n\n if torch.cuda.is_available():\n return torch.device('cuda')\n return torch.device('cpu')",
"def GetGPU():\n return option['device_id']",
"def device():\n return G.DEVICE",
"def device(self) -> torch.device:\n for param in self.... | [
"0.79553956",
"0.78293407",
"0.7782082",
"0.77409965",
"0.7728832",
"0.7690778",
"0.76234984",
"0.7591698",
"0.7532002",
"0.7526446",
"0.74859667",
"0.746789",
"0.7392168",
"0.73713374",
"0.73713374",
"0.73713374",
"0.73713374",
"0.73713374",
"0.7320805",
"0.7260927",
"0.7234... | 0.7037 | 31 |
Expand x to ndim. | def _expand(x, ndim, axis=0):
while F.rank(x) < ndim:
x = F.expand_dims(x, axis)
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _expand_dims_(x: np.array) -> np.array:\n x = np.expand_dims(x, axis=-1)\n return x",
"def nd_expand_dims(x, n=1, before=True):\n if before:\n axes = tuple([np.newaxis] * n + [...])\n else:\n axes = tuple([...] + [np.newaxis] * n)\n return x[axes]",
"def add_dummy_batch_dim(x):\n return x... | [
"0.7843474",
"0.698544",
"0.6690795",
"0.6534174",
"0.650531",
"0.64515316",
"0.64469814",
"0.6422677",
"0.64072204",
"0.6375917",
"0.63537467",
"0.6302055",
"0.61996084",
"0.6194479",
"0.617031",
"0.6166471",
"0.6150439",
"0.6108699",
"0.61020327",
"0.6064482",
"0.6052254",
... | 0.8140641 | 0 |
Yield successive nsized chunks from lst. | def chunks(lst, n):
for i in range(0, len(lst), n):
yield lst[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunks(self, lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]",
"def chunks(lst: list, n: int):\n for i in range(0, len(lst), n):\n yield lst[i : i + n]",
"def chunks(lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]",
"de... | [
"0.83071756",
"0.81939614",
"0.81910837",
"0.81910837",
"0.8190213",
"0.81267184",
"0.81218547",
"0.81218547",
"0.80773693",
"0.80526286",
"0.80526286",
"0.80526286",
"0.80526286",
"0.80526286",
"0.80042696",
"0.7871678",
"0.7845623",
"0.7828392",
"0.7827006",
"0.78138447",
"... | 0.80533457 | 25 |
Get the top MAX_LEADERS scores for a given difficulty | def get_top(self, difficulty):
return list(self.database[difficulty].find().sort('time').limit(MAX_LEADERS)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def personal_best(scores: list) -> int:\n return max(scores)",
"def personal_best(scores):\n return max(scores)",
"def personal_best(scores):\n# return sorted(scores, reverse=True)[0]\n return max(scores)",
"def get_best_candidate(self):\n if not self.scores:\n return None\n ... | [
"0.7010317",
"0.6979618",
"0.6871133",
"0.651442",
"0.6441942",
"0.64119995",
"0.6371139",
"0.63277775",
"0.63224864",
"0.63199437",
"0.6284071",
"0.6262318",
"0.6247192",
"0.6236434",
"0.6236434",
"0.6233733",
"0.62313366",
"0.6226192",
"0.6218556",
"0.61993873",
"0.61988765... | 0.71944165 | 0 |
A customized `collate_fn` intented for loading padded sequential data | def seq_collate_fn(batch):
idx, seq, seq_lengths = zip(*batch)
idx = torch.tensor(idx)
seq = torch.stack(seq)
seq_lengths = torch.tensor(seq_lengths)
_, sorted_seq_length_indices = torch.sort(seq_lengths)
sorted_seq_length_indices = sorted_seq_length_indices.flip(0)
sorted_seq_lengths = seq_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_collate_fn(data):\n features, labels = zip(*data)\n return pack_sequence(features, enforce_sorted=False), torch.tensor(labels)",
"def pad_collate_fn(batch):\n length = [len(sentence) for sentence in batch]\n return pad_sequence([torch.LongTensor(s) for s in batch], batch_first=True), torch... | [
"0.69073904",
"0.68714195",
"0.68312085",
"0.68078774",
"0.6686843",
"0.66076684",
"0.6568909",
"0.6485853",
"0.6478409",
"0.64036995",
"0.61725557",
"0.60923296",
"0.6091442",
"0.6085053",
"0.60514766",
"0.6000228",
"0.5992807",
"0.59734184",
"0.5945385",
"0.59385383",
"0.59... | 0.64473957 | 9 |
This functoin checks if a given string is a hex string and can be converted to byte array. | def is_hex_bytes(hex_string):
try:
bytearray.fromhex(hex_string)
except ValueError:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hexstr_to_bytes(input_str: str) -> bytes:\n if input_str.startswith(\"0x\") or input_str.startswith(\"0X\"):\n return bytes.fromhex(input_str[2:])\n return bytes.fromhex(input_str)",
"def is_hex(s): \n # if it can be converted to a base 16 int then it is hex\n try:\n int(s, 16)\n... | [
"0.7048844",
"0.69426155",
"0.68264014",
"0.6783162",
"0.6738244",
"0.67089266",
"0.6658886",
"0.6657814",
"0.66116035",
"0.6565061",
"0.6520991",
"0.6394768",
"0.6380683",
"0.6357403",
"0.6334347",
"0.6329508",
"0.6304291",
"0.6218196",
"0.62084115",
"0.6172354",
"0.61549777... | 0.76455384 | 0 |
Validate that the old_password field is correct. | def clean_old_password(self):
old_password = self.cleaned_data["old_password"]
if not mongo_user.check_user_password(self.user.username, old_password):
raise forms.ValidationError(
self.error_messages['password_incorrect'],
code='password_incorrect',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def old_password_check(form, field):\n old_password = field.data\n password = current_user.password\n r = pwd_context.verify(old_password, current_user.password)\n if not r:\n raise validators.ValidationError('old password is wrong')",
"def clean_old_password(self):\n old_password = sel... | [
"0.8756323",
"0.8665774",
"0.8625098",
"0.7929837",
"0.7739037",
"0.771848",
"0.75522846",
"0.7490213",
"0.74407566",
"0.7397287",
"0.73796165",
"0.73740816",
"0.729492",
"0.72460634",
"0.72441095",
"0.7230054",
"0.7164203",
"0.7155687",
"0.71555614",
"0.71264774",
"0.7094459... | 0.8656694 | 2 |
Filters all guides returned by Crispor down to those that have a score greater than min_score, then takes top guides by special ranking if HDR, else by score. Doench min_score = 10 is the same value used by Benchling. max_hdr_dist is based on effective limits of HDR. | def _get_top_guides(self, guide_design, min_score=10, max_hdr_dist=40) -> dict:
# TODO (gdingle): figure out why guide_seqs not always there!
selected_guides = dict(
(g['target'], g.get('guide_seqs'))
for g in guide_design.guide_data
if webscraperequest.NOT_FOUND not ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _forward_best_subset(X, y, nbest=8, beamwidth=40, score=\"bic\"):\n \n assert nbest > 0, \"nbest must be positive\"\n beamwidth = max(beamwidth, nbest)\n \n # Add constant\n Xc = add_constant(X).rename(columns={'const': '(Intercept)'})\n \n def get_bic(feature_subset):\n return -... | [
"0.56349045",
"0.54515886",
"0.54471856",
"0.5407505",
"0.53740907",
"0.5273205",
"0.5251434",
"0.5238548",
"0.5196233",
"0.51617986",
"0.5154151",
"0.513857",
"0.51197845",
"0.5117221",
"0.5099921",
"0.5064455",
"0.5039076",
"0.50289404",
"0.5006979",
"0.49972126",
"0.498287... | 0.6755252 | 0 |
Returns encoding of file, fname. | def get_encoding(fname):
file = open(fname, 'rb')
encoding = chardet.detect(file.read())['encoding']
return encoding | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_encoding_file(fname):\n with io.open(fname, 'rt', encoding='ascii', errors='ignore') as f:\n for unused in range(2):\n line = f.readline()\n match = get_encoding_re.search(line)\n if match:\n return match.group(1)\n return 'ascii'",
"def get_fi... | [
"0.7988358",
"0.7444446",
"0.7207809",
"0.71370965",
"0.7093451",
"0.66141176",
"0.65822077",
"0.6516463",
"0.64917636",
"0.6332927",
"0.6176389",
"0.61531925",
"0.61307967",
"0.60929745",
"0.59767604",
"0.5945594",
"0.59446853",
"0.59001964",
"0.58972293",
"0.58306104",
"0.5... | 0.8020138 | 0 |
Return list of all products. | def lambda_handler(event, context):
logger.debug(event)
product_list = PRODUCT_LIST
return {
"statusCode": 200,
"headers": HEADERS,
"body": json.dumps({"products": product_list}),
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_products(self):\n\t\tpass",
"def get_all_products():\n products = app.session.query(models.Product).all()\n return products",
"def get_all_products():\n data = order_obj.get_all_products()\n return data",
"def list_products(self):\n return self._make_get_request(self._urls['pro... | [
"0.8845219",
"0.8657297",
"0.8540142",
"0.85302764",
"0.8358944",
"0.8319853",
"0.8308576",
"0.799987",
"0.7984015",
"0.7945628",
"0.7886766",
"0.78642523",
"0.7745842",
"0.7739095",
"0.7729446",
"0.7708377",
"0.76693064",
"0.76649344",
"0.76593167",
"0.7582866",
"0.7565871",... | 0.0 | -1 |
Escapes or unescapes the specified field in a model or dictionary. | def markdown_set_field_escaped(obj, field, escaped):
if escaped:
markdown_escape_field(obj, field)
else:
markdown_unescape_field(obj, field) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def markdown_escape_field(obj, field_name):\n if isinstance(obj, Model):\n setattr(obj, field_name,\n djblets_markdown.markdown_escape(getattr(obj, field_name)))\n elif isinstance(obj, dict):\n obj[field_name] = djblets_markdown.markdown_escape(obj[field_name])\n else:\n ... | [
"0.7146712",
"0.68923646",
"0.6638781",
"0.6623981",
"0.64805365",
"0.6106077",
"0.5780616",
"0.57652986",
"0.574764",
"0.56577927",
"0.5599311",
"0.55628854",
"0.5530404",
"0.55108035",
"0.549196",
"0.5454453",
"0.54391074",
"0.5416525",
"0.5404565",
"0.5287084",
"0.52672803... | 0.6844108 | 2 |
Produces list of transition metals in order of atomic number | def mk_lst_trans_met(self):
elem_rnge_I = [[21,30],[39,44],[46,48],[74,76],[78,80]]
elem_rnge=[]
for i in elem_rnge_I:
el_strt=i[0]
el_end=i[1]
rnge_sect=range(el_strt,el_end+1)
elem_rnge.extend(rnge_sect)
elements=[]
for i in elem_rnge:
element=Element.from_Z(i) # Indice -> pymatgen element ob... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_transition_list():\n xn_list = []\n\n xn_list.append( Transition(3, 4, 2., 'left ejection') )\n xn_list.append( Transition(12, 2, 2., 'right ejection') )\n xn_list.append( Transition(19, 20, 2.e8, 'downward ejection, left') )\n xn_list.append( Transition(19, 24, 2.e8, 'downward ejection, r... | [
"0.67675257",
"0.65004987",
"0.6411197",
"0.58470243",
"0.5776502",
"0.5768829",
"0.5764657",
"0.5713587",
"0.5711093",
"0.56495124",
"0.5608707",
"0.55893725",
"0.55888236",
"0.55806756",
"0.5578302",
"0.5572511",
"0.5561699",
"0.5549484",
"0.55388075",
"0.5537071",
"0.55316... | 0.0 | -1 |
=============== GET /appraises/ =============== Get a list of all appraises for the current user. Statuses 200 | def get(self):
appraise_service = c_app.service_locator.get_by_name(u"appraises")
appraise_list = appraise_service.get_list(
c_user._get_current_object(),
)
paginator = c_app.extensions['sfkit:paginator'].paginate(appraise_list)
return self.build_response(paginator.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_list():\n user = users.get_current_user()\n if user:\n if users.is_current_user_admin() or is_local_admin():\n appls_query = Applic.query(ancestor = base_key).order(-Applic.date)\n appls = appls_query.fetch()\n output = template('applist', appls=appls, name=g_n... | [
"0.627098",
"0.610369",
"0.587262",
"0.58545244",
"0.5829727",
"0.5637076",
"0.55927235",
"0.55556476",
"0.55413175",
"0.55021656",
"0.5464352",
"0.544797",
"0.5380183",
"0.53465587",
"0.5335637",
"0.53316677",
"0.5331494",
"0.53091776",
"0.52949154",
"0.52809006",
"0.5274341... | 0.81783855 | 0 |
this function will create the speed and acceleration by changing the private values of the ship's x axis speed and y axis speed. | def acceleration(self):
# speed is by formula: x axis speed: by cos of the heading and y
# axis by sine of the heading
self.x_speed += math.cos(math.radians(self.degrees))
self.y_speed += math.sin(math.radians(self.degrees)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accelerate(self):\n x_speed = self.__calc_speed(Ship._X)\n y_speed = self.__calc_speed(Ship._Y)\n self._speed_vect = (x_speed, y_speed)",
"def update(self, dt):\n\n self.velocity += self.acceleration * dt\n self.position += self.velocity * dt \n\n self.ship.rotation ... | [
"0.7879519",
"0.6993986",
"0.6924762",
"0.6872213",
"0.6817173",
"0.662681",
"0.65564036",
"0.6556044",
"0.654763",
"0.6546245",
"0.6526442",
"0.64894724",
"0.64795375",
"0.64339894",
"0.6422797",
"0.64122105",
"0.64116096",
"0.6391532",
"0.63882715",
"0.63786954",
"0.6374197... | 0.6672178 | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.