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 |
|---|---|---|---|---|---|---|
Returns the application message stored by the protocol. | def getMessage(self):
return self.msg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_message(self):\n return self._message",
"def get_message (self) :\n return self.message",
"def get_message(self):\n return self.message",
"def _get_message(self):\n return self.__message",
"def message(self):\n return self.get_val('msg')",
"def message(self):\n ... | [
"0.70970273",
"0.70683455",
"0.7053592",
"0.6972673",
"0.6900593",
"0.67735416",
"0.67735416",
"0.67735416",
"0.6720209",
"0.67148733",
"0.666846",
"0.66574097",
"0.66574097",
"0.66574097",
"0.6651673",
"0.66397464",
"0.6636106",
"0.6635345",
"0.6635345",
"0.6635345",
"0.6635... | 0.66883624 | 10 |
Returns the origin port stored by the protocol. | def getOriginPort(self):
return self.originPort | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def port(self):\n return self[1]",
"def get_port(self):\n return self.__port",
"def _get_port(self):\n return self.__port",
"def getPort(self):\n return self._port",
"def port(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"port\")",
"def port(self) -> pulumi.Input[int]... | [
"0.71823156",
"0.71773916",
"0.7089603",
"0.7064413",
"0.7010115",
"0.7010115",
"0.7010115",
"0.7010115",
"0.6992148",
"0.696417",
"0.6959718",
"0.6959718",
"0.69448006",
"0.6908837",
"0.6908837",
"0.68550986",
"0.68550986",
"0.68550986",
"0.68550986",
"0.68550986",
"0.685509... | 0.8507556 | 0 |
Returns the destination port stored by the protocol. | def getDestinationPort(self):
return self.destinationPort | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_port(self):\n return self.__port",
"def to_port(self) -> int:\n return pulumi.get(self, \"to_port\")",
"def _get_port(self):\n return self.__port",
"def port(self):\n return self[1]",
"def get_port(self):\r\n return self.__get_option(VpnTag.TAG_PORT)",
"def getPort(... | [
"0.7527932",
"0.73273396",
"0.727837",
"0.72752327",
"0.72657967",
"0.7187122",
"0.7137823",
"0.7127875",
"0.7127875",
"0.70784",
"0.70584923",
"0.7025802",
"0.7025802",
"0.70228446",
"0.7010191",
"0.7010191",
"0.7010191",
"0.7010191",
"0.69978976",
"0.6979235",
"0.69552577",... | 0.8315811 | 0 |
>>> take_fragment("AGCTTCGA", 0) 'AGCT' >>> take_fragment("AGCTTCGA", 1) 'TCGA' >>> take_fragment("AGCT_TCGA", 0) 'AGCT_TCGA' >>> take_fragment("AGCT", 1) | def take_fragment(umi, fragment_index):
frags = umi.split("-")
if fragment_index < 0 or fragment_index >= len(frags):
raise ValueError("Fragment index out of bounds", umi, fragment_index)
return frags[fragment_index] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_fragment(self, string):\n\n fragment_indices = np.arange(0, len(string), step=self.fragment_length)\n l = np.random.choice(fragment_indices) # Starting index of the fragment\n r = str(self.hash_256(string)) + \"_\" + string[l: l + (self.fragment_length)]\n\n return r, strin... | [
"0.65187216",
"0.59482765",
"0.583468",
"0.5653859",
"0.55911934",
"0.5471784",
"0.5394265",
"0.5347001",
"0.53131515",
"0.5273402",
"0.52381665",
"0.5209311",
"0.5201247",
"0.51742154",
"0.5169456",
"0.51521236",
"0.5118067",
"0.50927466",
"0.5059125",
"0.50542206",
"0.50324... | 0.7060202 | 0 |
Generate a function that will onehot encode the all of the polymer and solvent molecules. Each unique molecule has a unique number. Create one new column for the polymer and solvent onehot encoded data. | def create_master_ohe(self, co2_expt_path: str, co2_ohe_path: str):
master_df: pd.DataFrame = self.data
polymer_ohe = OneHotEncoder()
solvent_ohe = OneHotEncoder()
polymer_ohe.fit(master_df["Polymer"].values.reshape(-1, 1))
polymer_ohe_data = polymer_ohe.transform(
ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_one_hot_encoder(df_column: pd.Series) -> OneHotEncoder:\n pass",
"def one_hot_encode(df, col):\n\n df_final = pd.get_dummies(data=df, columns=col, drop_first=True)\n\n return(df_final)",
"def one_hot_encode(self,df):\n onehot_encoder = OneHotEncoder(sparse=False)\n integer_e... | [
"0.72472066",
"0.70774645",
"0.70339906",
"0.69193095",
"0.68587416",
"0.6778492",
"0.67575455",
"0.6721265",
"0.67170614",
"0.67087644",
"0.661969",
"0.6597116",
"0.657646",
"0.6575173",
"0.6565992",
"0.65537876",
"0.6540972",
"0.65341824",
"0.6533395",
"0.6486429",
"0.64814... | 0.0 | -1 |
Return the first non null element in the list if None | def first(lst: Sequence) -> Any:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first(l):\n\tfor i in l:\n\t\tif i is not None:\n\t\t\treturn i",
"def first_or_none(self):\n first = list(self[:1])\n if first:\n return first[0]\n return None",
"def first_or_none(seq):\n if len(seq) == 0:\n return None\n return seq[0]",
"def... | [
"0.8472321",
"0.81077325",
"0.7940694",
"0.79137033",
"0.76486903",
"0.7584569",
"0.75133896",
"0.7437718",
"0.7232287",
"0.72165143",
"0.71776175",
"0.7160847",
"0.711944",
"0.7004121",
"0.69249976",
"0.6921916",
"0.6815865",
"0.6771862",
"0.675786",
"0.67356664",
"0.6718811... | 0.65798724 | 35 |
Helper function to get a Keyword from a `KeywordRDF`object (RDFGraph). | def from_keyword_rdf(g: KeywordRDF):
_type = None if g.category is None else KeywordType.from_uniprot_uri(g.category)
return Keyword(
id=g.id, label=g.label, database=KeywordDatabase.UNIPROT, keyword_type=_type, description=g.comment
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_keyword(id: str, database: KeywordDatabase) -> Keyword: # pragma: no cover\n if database == KeywordDatabase.UNIPROT:\n g = get_keyword_graph(id)\n return Keyword.from_keyword_rdf(g)\n elif database == KeywordDatabase.ONTOBEE:\n g = get_ontobee_graph(id)\n return Keyword.f... | [
"0.7724927",
"0.68391514",
"0.66005015",
"0.6167309",
"0.61658317",
"0.60699266",
"0.6058898",
"0.58362657",
"0.58285517",
"0.55146134",
"0.54810816",
"0.5429599",
"0.5379961",
"0.5356571",
"0.5238297",
"0.5236392",
"0.52196354",
"0.51834357",
"0.51691693",
"0.5149334",
"0.51... | 0.6866751 | 1 |
Sets the disk of this V1AddVolumeOptions. Disk represents the hotplug disk that will be plugged into the running VMI | def disk(self, disk):
if disk is None:
raise ValueError("Invalid value for `disk`, must not be `None`")
self._disk = disk | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_disk(self, disk):\n self.disk = disk",
"def add_vhd_disk(self, vhd_disk: VHDDisk):\n # TODO ability to select controller, disk port, error checking. Make disk bootable by default, etc\n management_service = VirtualSystemManagementService.from_moh(self.scope_holder.query_one('SELECT * FROM Ms... | [
"0.81187147",
"0.6682404",
"0.65403956",
"0.6310123",
"0.6258727",
"0.60034126",
"0.58115673",
"0.5757609",
"0.5734145",
"0.5727102",
"0.57217044",
"0.5685136",
"0.5679067",
"0.56767875",
"0.567648",
"0.56730354",
"0.5654226",
"0.56233114",
"0.5591854",
"0.5589129",
"0.557966... | 0.76488125 | 1 |
Gets the dry_run of this V1AddVolumeOptions. | def dry_run(self):
return self._dry_run | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dry_run(self, dry_run):\n\n self._dry_run = dry_run",
"def create_source(self) -> Optional[pulumi.Input['VolumeCreateOption']]:\n return pulumi.get(self, \"create_source\")",
"def get_opt(self):\n opts, args = self.parser.parse_args()\n if opts.path is not None:\n opts.... | [
"0.5228185",
"0.47620454",
"0.4635039",
"0.45698532",
"0.45310083",
"0.44963226",
"0.4436035",
"0.44206712",
"0.43639654",
"0.43639654",
"0.43396637",
"0.43396637",
"0.43220297",
"0.43196368",
"0.43172544",
"0.4288364",
"0.4270265",
"0.42517042",
"0.42469105",
"0.42458484",
"... | 0.5551385 | 0 |
Sets the dry_run of this V1AddVolumeOptions. | def dry_run(self, dry_run):
self._dry_run = dry_run | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exclusion_volumes(self, dr, R1, R2, R3):\n pass",
"def set_volume_readonly(self, volume, readonly=True):\n volume = self._get_resource(_volume.Volume, volume)\n volume.set_readonly(self, readonly)",
"def run_options(self, **kwargs):\n self._run_options.update(kwargs)",
"def ad... | [
"0.49594557",
"0.47653595",
"0.47025827",
"0.46947902",
"0.46536532",
"0.46295917",
"0.45939997",
"0.45649338",
"0.44587064",
"0.44311976",
"0.4408631",
"0.4407846",
"0.43856174",
"0.43690103",
"0.43630832",
"0.43566757",
"0.43209958",
"0.42834157",
"0.4277242",
"0.42653823",
... | 0.6060664 | 0 |
Gets the name of this V1AddVolumeOptions. Name represents the name that will be used to map the disk to the corresponding volume. This overrides any name set inside the Disk struct itself. | def name(self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volume_name(self):\n return self._volume_name",
"def volume_name(self):\n return self._volume_name",
"def volume_name(self):\n return self._volume_name",
"def diskname(self):\n raise NotImplementedError('Adf')",
"def volume_name(self) -> Optional[str]:\n return pulumi... | [
"0.6910688",
"0.6910688",
"0.6910688",
"0.6642484",
"0.6607077",
"0.6543367",
"0.6428308",
"0.6023657",
"0.5983655",
"0.5921858",
"0.58902764",
"0.58826214",
"0.58826214",
"0.5872953",
"0.57647324",
"0.57647324",
"0.56454796",
"0.56454796",
"0.55738384",
"0.556674",
"0.556041... | 0.0 | -1 |
Sets the name of this V1AddVolumeOptions. Name represents the name that will be used to map the disk to the corresponding volume. This overrides any name set inside the Disk struct itself. | def name(self, name):
if name is None:
raise ValueError("Invalid value for `name`, must not be `None`")
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volume_name(self, volume_name):\n\n self._volume_name = volume_name",
"def set_name(self, name):\n self.options['name'] = name",
"def SetName(self, name):\n self._name = name",
"def set_name(self, name):\n self._name = name",
"def set_name(self, name):\n self._name = ... | [
"0.6714546",
"0.6697955",
"0.6349064",
"0.6289151",
"0.6289151",
"0.6289151",
"0.6289151",
"0.6289151",
"0.6289151",
"0.62827396",
"0.62773436",
"0.618941",
"0.61891264",
"0.61891264",
"0.61891264",
"0.61891264",
"0.61891264",
"0.60189015",
"0.6017054",
"0.6001697",
"0.599448... | 0.0 | -1 |
Gets the volume_source of this V1AddVolumeOptions. VolumeSource represents the source of the volume to map to the disk. | def volume_source(self):
return self._volume_source | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volume_source(self, volume_source):\n if volume_source is None:\n raise ValueError(\"Invalid value for `volume_source`, must not be `None`\")\n\n self._volume_source = volume_source",
"def create_source(self) -> Optional[pulumi.Input['VolumeCreateOption']]:\n return pulumi.get... | [
"0.73772687",
"0.6703053",
"0.58227736",
"0.57467026",
"0.5617245",
"0.5535686",
"0.55101794",
"0.55101794",
"0.55101794",
"0.5478244",
"0.5465575",
"0.5465575",
"0.5465575",
"0.54508424",
"0.54471576",
"0.5435377",
"0.5435377",
"0.54026866",
"0.5380352",
"0.53728735",
"0.536... | 0.7915883 | 0 |
Sets the volume_source of this V1AddVolumeOptions. VolumeSource represents the source of the volume to map to the disk. | def volume_source(self, volume_source):
if volume_source is None:
raise ValueError("Invalid value for `volume_source`, must not be `None`")
self._volume_source = volume_source | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_volume(self, source, volume: float) -> None:\n if volume < 0.0 or volume > 2.0:\n raise ValueError(\"Volume must be between 0 and 2\")\n self._input_lock.acquire()\n self._inputs[source].volume = volume\n self._input_lock.release()",
"def volume(self, volume: float)... | [
"0.72455347",
"0.62949044",
"0.61436695",
"0.6112243",
"0.5973143",
"0.59278196",
"0.5875657",
"0.5875657",
"0.58482856",
"0.5829388",
"0.5826261",
"0.5818814",
"0.5806613",
"0.5653706",
"0.5616325",
"0.56083226",
"0.56083226",
"0.5580083",
"0.5568698",
"0.55677193",
"0.55635... | 0.8324098 | 0 |
Returns the string representation of the model | def to_str(self):
return pformat(self.to_dict()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_model_(self):\n return str(self)",
"def __str__(self):\n\n return str(self.model)",
"def get_model_string(self):\n raise NotImplementedError()",
"def __str__(self):\n return self.model",
"def serialize_model(self):\n return dill.dumps(self.model)",
"def __str_... | [
"0.8603192",
"0.8509214",
"0.82360506",
"0.8049831",
"0.80115575",
"0.79342973",
"0.78785366",
"0.77903765",
"0.77898926",
"0.7746775",
"0.7629959",
"0.7608436",
"0.75825727",
"0.75152564",
"0.7506636",
"0.7504804",
"0.74877965",
"0.7443503",
"0.7435226",
"0.7427192",
"0.7407... | 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 return not self == other",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other):\n return self.__dict__ != other.__dict__",
"def __eq__(self, other):\n return not self.__ne__(other)",
... | [
"0.8410411",
"0.8391477",
"0.8172175",
"0.81410587",
"0.80920255",
"0.8088807",
"0.80676955"
] | 0.0 | -1 |
Return required data provider class | def get_data_provider_by_name(path, train_params):
name = path.split(':')[-1] # 从路径中与数据名的组合中分离出数据名
train_params['data_url'] = path.split(':')[0] # 分离出路径
if name == 'custom':
return CustomDataProvider(**train_params)
if name == 'custom+':
return CustomAugmentedDataProvider(**tra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_data_provider(self, **kwargs):\n raise NotImplementedError(\"Not implemented.\")",
"def data_class(cls):\n raise NotImplementedError()",
"def dataProvider(self):\n return self._dataProvider",
"def data_provider(self) -> 'outputs.DataProviderResponse':\n return pulumi.get(self... | [
"0.7564724",
"0.6918458",
"0.67602426",
"0.6689215",
"0.66830486",
"0.6533842",
"0.64401823",
"0.63201934",
"0.61941963",
"0.6044844",
"0.5972678",
"0.59702474",
"0.5932934",
"0.5886608",
"0.5886608",
"0.5886608",
"0.5886608",
"0.5886608",
"0.5886608",
"0.58612466",
"0.582593... | 0.59993345 | 10 |
Returns how many numbers lie within `maximum` and `minimum` in a given `row` | def howmany_within_range(row, minimum, maximum):
count = 0
for n in row:
if minimum <= n <= maximum:
count = count + 1
return count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def howmany_within_range(self,row, minimum, maximum):\n\t count = 0\n\t for n in row:\n\t if minimum <= n <= maximum:\n\t count = count + 1\n\t return count",
"def howmany_within_range2(i, row, minimum, maximum):\n count = 0\n for n in row:\n if minimum <= n <= maximum:\n ... | [
"0.88470924",
"0.84822047",
"0.66990006",
"0.62870663",
"0.6092154",
"0.6046438",
"0.601811",
"0.59944004",
"0.5948959",
"0.59245247",
"0.58242714",
"0.5801105",
"0.5749984",
"0.5749893",
"0.56973094",
"0.5678462",
"0.5644206",
"0.55785143",
"0.55634236",
"0.5557912",
"0.5552... | 0.89130646 | 0 |
Takes random n_samples from a uniform distribution. Returns arrays x and y. | def random_sample(n_samples):
x = np.array([])
y = np.array([])
# Makes arrays of x and y values
for i in range(n_samples):
a = np.random.uniform(0,3.0)
x = np.append(x,a-2)
b = np.random.uniform(0,3.0)
y = np.append(y,b-1.5)
return x, y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate(self, n_samples: int) -> np.ndarray:\n samples = self.dist.random(n_samples)\n return samples",
"def stratified_random_sample(n_samples):\n x = np.random.uniform(-2, 1, n_samples).tolist()\n y = np.linspace(-1.5, 1.5, n_samples)\n\n np.random.shuffle(y)\n\n x = np.array(x)\... | [
"0.74365455",
"0.722436",
"0.71812797",
"0.7045139",
"0.69593287",
"0.6940905",
"0.6914458",
"0.68947357",
"0.683639",
"0.68269324",
"0.677519",
"0.674767",
"0.6733679",
"0.67330366",
"0.6700367",
"0.66916865",
"0.66881794",
"0.66761875",
"0.6668886",
"0.66332334",
"0.6614718... | 0.84891295 | 0 |
Takes random n_samples from a linspace. Returns arrays x and shuffled y. | def stratified_random_sample(n_samples):
x = np.random.uniform(-2, 1, n_samples).tolist()
y = np.linspace(-1.5, 1.5, n_samples)
np.random.shuffle(y)
x = np.array(x)
y = np.array(y)
return x, y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_sample(n_samples):\n x = np.array([])\n y = np.array([])\n\n # Makes arrays of x and y values\n for i in range(n_samples):\n a = np.random.uniform(0,3.0)\n x = np.append(x,a-2)\n\n b = np.random.uniform(0,3.0)\n y = np.append(y,b-1.5)\n\n return x, y",
"def r... | [
"0.8048788",
"0.70416",
"0.6904921",
"0.6804659",
"0.6711722",
"0.6701509",
"0.66255397",
"0.66065615",
"0.66056925",
"0.6544096",
"0.6510396",
"0.6509985",
"0.64667255",
"0.64605796",
"0.6438691",
"0.6433821",
"0.6416156",
"0.64122313",
"0.6399528",
"0.6398358",
"0.6365227",... | 0.7529776 | 1 |
Helper function to create a PpmsBooking object with default values. Returns PpmsBooking | def create_booking(
username=USERNAME,
system_id=SYS_ID,
session_id=SESSION_ID,
):
time_delta = 45
response = f"{username}\n{time_delta}\n{session_id}\n"
return PpmsBooking(text=response, booking_type="get", system_id=system_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_booking(self,\n body):\n\n return super().new_api_call_builder.request(\n RequestBuilder().server('default')\n .path('/v2/bookings')\n .http_method(HttpMethodEnum.POST)\n .header_param(Parameter()\n .key('C... | [
"0.54918665",
"0.54359025",
"0.5351773",
"0.53507876",
"0.5224121",
"0.5214583",
"0.5133189",
"0.5009329",
"0.49663377",
"0.49568567",
"0.49283022",
"0.4909419",
"0.48794028",
"0.48493606",
"0.48316902",
"0.48185325",
"0.48092467",
"0.4801326",
"0.4799701",
"0.4782262",
"0.47... | 0.6508979 | 0 |
Test changing the starting date of a booking. | def test_starttime_fromstr__date():
booking = create_booking()
newdate = "2019-04-01"
newtime = "12:45"
startdate = datetime.strptime(newdate, FMT_DATE)
booking.starttime_fromstr(newtime, startdate)
newstart = f"{newdate} {newtime}"
assert str(booking) == EXPECTED % (newstart, END)
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_logbook_lock_first_of_year(self):\n self.assertEqual(logbook_lock(), dt.date(2020, 1, 1))",
"def test_dates(self):\n settings.DEFAULT_DEADLINE_TIME = \"09:00\"\n settings.TIME_ZONE = 'US/Eastern'\n\n # a new booking is created",
"def starting_date(self, starting_date):\n\n ... | [
"0.66625345",
"0.65868163",
"0.63829714",
"0.6205176",
"0.6197051",
"0.61860776",
"0.61524236",
"0.61474174",
"0.61098194",
"0.60958475",
"0.6078293",
"0.60521865",
"0.6050122",
"0.6038306",
"0.6027376",
"0.6025758",
"0.6011679",
"0.6006795",
"0.59947073",
"0.5962505",
"0.595... | 0.6594973 | 1 |
Test changing the ending date of a booking. | def test_endtime_fromstr__date():
booking = create_booking()
newdate = "2019-06-01"
newtime = "12:45"
enddate = datetime.strptime(newdate, FMT_DATE)
booking.endtime_fromstr(newtime, enddate)
newend = f"{newdate} {newtime}"
assert str(booking) == EXPECTED % (START, newend)
# test with ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__end_of_day(self):\n\n result = end_of_day\n expected = datetime(2020, 1, 10, 23, 59, 59, 999999)\n\n self.assertEqual(result, expected)",
"def test_end_date(trigger: CalendarIntervalTrigger, timezone: DstTzInfo):\n now = timezone.localize(datetime(2020, 12, 31))\n previous = ... | [
"0.7091094",
"0.6565147",
"0.65007627",
"0.64433175",
"0.6396002",
"0.6387859",
"0.6329006",
"0.62424034",
"0.6205103",
"0.62028384",
"0.61798024",
"0.6158357",
"0.6117648",
"0.6113428",
"0.6108034",
"0.6106504",
"0.6087252",
"0.6081115",
"0.60793424",
"0.607804",
"0.60658926... | 0.68625677 | 1 |
Saves the precomputed image data in the same folder as the model in a subfolder called 'precomputed_embeddings' | def save_embeddings(args, fnames, embeddings, classes, mode):
df = pd.DataFrame(data=[fnames, classes]).T
df.columns = ["fnames", "classes"]
meta_path = os.path.join(args.embedding_path, mode + METADATA)
df.to_csv(meta_path, sep=" ", header=True)
array_path = os.path.join(args.embedding_path, mode ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_pretrained(self, saved_path):\n os.makedirs(saved_path, exist_ok=True)\n self.config.save_pretrained(saved_path)\n self.save_weights(os.path.join(saved_path, MODEL_FILE_NAME))",
"def save(self, path: str):\n if not os.path.isdir(path):\n os.mkdir(path)\n self.tokenizer.sa... | [
"0.6570041",
"0.6544382",
"0.6465352",
"0.64473176",
"0.6338105",
"0.6089794",
"0.60866535",
"0.6048488",
"0.6045591",
"0.59988666",
"0.59904236",
"0.5949192",
"0.59027594",
"0.58903253",
"0.5890243",
"0.58854675",
"0.5878796",
"0.58699256",
"0.5863146",
"0.5855349",
"0.58481... | 0.54265743 | 86 |
Return as an ordered list all the descendant nodes | def get_subtree(self):
if not self.has_children():
return [self]
else:
assert len(self.children) == 2
return [self] + list(chain(*map(lambda c: c.get_subtree(), self.children))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sorted_all_descendants_flat(self):\n result = []\n self.collect_descendants_sorted(result=result)\n return result",
"def AllNodes(self):\n yield self\n for child_node in self._port_to_node.values():\n for descendant_node in child_node.AllNodes():\n yield descendant_node... | [
"0.7388437",
"0.7236893",
"0.721566",
"0.715775",
"0.7142697",
"0.7024204",
"0.7020685",
"0.6962246",
"0.68617004",
"0.6857483",
"0.67917854",
"0.67788637",
"0.6772072",
"0.67700577",
"0.6767137",
"0.6765798",
"0.67527246",
"0.6745102",
"0.67322206",
"0.667506",
"0.66582006",... | 0.0 | -1 |
calculates gyro radius. rGyro has a column for each MC run (N_MC columns), and a row for each point on the PFC (N_pts), so it is a matrix | def setupRadius(self, vPerp):
N_pts = len(self.omegaGyro)
#get number of vPerps
if np.isscalar(vPerp):
vPerp = np.array([vPerp])
N_MC = 1
else:
N_MC = len(vPerp)
self.rGyro = np.zeros((N_pts,N_MC))
for i in range(N_MC):
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GyroRadius(Species,Energy,B):\n\n species = SelectSpecies(Species)\n q = mks[species]['q']\n Bsi = B/1e9 # B in TeSL['a']\n gamma,vmag,m = MeVtogamma(Energy,species) # gamma, speed (m/s), m (kg)\n r = m*vmag/np.abs(q)/Bsi # kg * m/s / C / T = m\n return r",
"def ang_mom_rce_lh88(lat, lat_ma... | [
"0.6339648",
"0.60452545",
"0.5999675",
"0.59042645",
"0.59042645",
"0.5855875",
"0.5840401",
"0.5837532",
"0.5829817",
"0.5778482",
"0.57372653",
"0.57164365",
"0.5691257",
"0.5672084",
"0.56712824",
"0.56699866",
"0.56652045",
"0.5657135",
"0.5639933",
"0.5626767",
"0.56115... | 0.6165935 | 1 |
Sets the advertiser_id of this AdvertiserQuotaMessage. | def advertiser_id(self, advertiser_id):
self._advertiser_id = advertiser_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dealer_id(self, dealer_id):\n\n self._dealer_id = dealer_id",
"def client_acct_id(self, client_acct_id):\n\n self._client_acct_id = client_acct_id",
"def quota_limit(self, quota_limit):\n\n self._quota_limit = quota_limit",
"def tenant_id(self, tenant_id):\n\n self._tenant_id ... | [
"0.615644",
"0.53653646",
"0.5340071",
"0.5300579",
"0.5300579",
"0.524503",
"0.5241013",
"0.51616204",
"0.5149465",
"0.51340747",
"0.5120288",
"0.5019937",
"0.49059516",
"0.48954144",
"0.4854224",
"0.48422456",
"0.47985694",
"0.4787047",
"0.4757664",
"0.4746271",
"0.47368798... | 0.71580374 | 0 |
Sets the quota_end_date of this AdvertiserQuotaMessage. | def quota_end_date(self, quota_end_date):
self._quota_end_date = quota_end_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_date(self, end_date):\n\n self._end_date = end_date",
"def end_date(self, end_date):\n\n self._end_date = end_date",
"def end_date(self, end_date):\n\n self._end_date = end_date",
"def end_date(self, end_date):\n\n self._end_date = end_date",
"def end_date(self, end_date... | [
"0.7018403",
"0.7018403",
"0.7018403",
"0.7018403",
"0.7018403",
"0.7018403",
"0.7018403",
"0.7018403",
"0.6981812",
"0.6732655",
"0.65945643",
"0.6517788",
"0.6421783",
"0.6421783",
"0.6421783",
"0.6354891",
"0.6121475",
"0.60236514",
"0.59421265",
"0.5655042",
"0.5655042",
... | 0.88423 | 0 |
Returns the string representation of the model | def to_str(self):
return pprint.pformat(self.to_dict()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_model_(self):\n return str(self)",
"def __str__(self):\n\n return str(self.model)",
"def get_model_string(self):\n raise NotImplementedError()",
"def __str__(self):\n return self.model",
"def serialize_model(self):\n return dill.dumps(self.model)",
"def __str_... | [
"0.8602374",
"0.85093755",
"0.8237104",
"0.8050309",
"0.80128866",
"0.79348034",
"0.78766525",
"0.77898884",
"0.7786461",
"0.7745792",
"0.7627315",
"0.76055235",
"0.757999",
"0.7514394",
"0.75038797",
"0.75035286",
"0.74850684",
"0.7440529",
"0.74325883",
"0.74239755",
"0.740... | 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 return not self == other",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other):\n return self.__dict__ != other.__dict__",
"def __eq__(self, other):\n return not self.__ne__(other)",
... | [
"0.8410411",
"0.8391477",
"0.8172175",
"0.81410587",
"0.80920255",
"0.8088807",
"0.80676955"
] | 0.0 | -1 |
Select sites that are defined by the user (via white list). The sites returned are the intersection of the input sites and the contents of self.whitelist | def checkWhiteList(self, sites, fileblocks=[]):
if not self.whitelist:
return sites
whitelist = self.whitelist
whitelist = self.matchList(sites, self.whitelist)
siteSet = set(sites)
goodSites = siteSet.intersection(whitelist)
goodSites = list(goodSites)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def siteWhitelist(self):\n return self.data.constraints.sites.whitelist",
"def setSiteWhitelist(self, siteWhitelist):\n self.data.constraints.sites.whitelist = siteWhitelist\n return",
"def siteBlacklist(self):\n return self.data.constraints.sites.blacklist",
"def checkBlackList(s... | [
"0.68138826",
"0.5929531",
"0.5849388",
"0.5828669",
"0.57782894",
"0.5672989",
"0.5672989",
"0.56178284",
"0.5561799",
"0.55611",
"0.5555251",
"0.55121636",
"0.5446014",
"0.5439317",
"0.5439317",
"0.5439317",
"0.542459",
"0.53860056",
"0.5310603",
"0.5279463",
"0.5270504",
... | 0.701806 | 0 |
Create a new User instance that will authenticate using the specified username and authenticators. | def __init__(self, username, *authenticators):
FirstOf.__init__(self, *authenticators)
self._username = username | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, username):\n return common.User(username)",
"def create_user(username, email, password):\n new_user = User(username, email, password)\n return new_user",
"def make_user(username,\n first_name='Firstname',\n last_name='Lastname',\n passw... | [
"0.690232",
"0.68434095",
"0.68308574",
"0.6798495",
"0.6777176",
"0.6766256",
"0.6761144",
"0.67150295",
"0.6706117",
"0.6706117",
"0.6706117",
"0.6706117",
"0.66647035",
"0.6649182",
"0.6642874",
"0.6610852",
"0.65831995",
"0.6582232",
"0.6568968",
"0.6568968",
"0.6568968",... | 0.0 | -1 |
The name of the resource. | def name(self) -> str:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_name(self):\r\n raise NotImplementedError",
"def Name(self):\n return self.Resource.Name",
"def resource_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"resource_name\")",
"def resource_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, ... | [
"0.87550104",
"0.8680146",
"0.8304821",
"0.8075097",
"0.7720544",
"0.76319623",
"0.76175094",
"0.76070344",
"0.756758"
] | 0.0 | -1 |
The provisioning state of the archive at the time the operation was called. | def provisioning_state(self) -> str:
return pulumi.get(self, "provisioning_state") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provisioning_state(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"provisioning_state\")",
"def provisioning_state(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"provisioning_state\")",
"def provisioning_state(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"... | [
"0.7715647",
"0.7715647",
"0.7715647",
"0.7715647",
"0.7715647",
"0.7715647",
"0.7715647",
"0.7715647",
"0.7715647",
"0.7715647",
"0.7715647",
"0.7715647",
"0.7715647",
"0.7715647",
"0.7715647",
"0.7074274",
"0.7074274",
"0.69281584",
"0.6875216",
"0.6767691",
"0.67340887",
... | 0.75580156 | 37 |
The type of the resource. | def type(self) -> str:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Type(self):\n return self.Resource.Type",
"def resource_type(self):\n return self._resource_type",
"def type(self) -> str:\n if len(self._resource_types) != 1:\n raise TypeError('Type needs to be specified manually, use .set or .add')\n return self._resource_types[0]"... | [
"0.906893",
"0.9009653",
"0.8694059",
"0.867721",
"0.85939527",
"0.8571768",
"0.8426089",
"0.8426089",
"0.8426089",
"0.8426089",
"0.81875676",
"0.7961872"
] | 0.0 | -1 |
Checks whether any saccades have entered a given boundary since the last time the eye event queue was fetched. | def saccade_to_boundary(self, label, event_queue=None, report=EL_TIME_END):
if not event_queue:
event_queue = self.get_event_queue([EL_SACCADE_END])
if not len(event_queue):
return False
for e in event_queue:
if e == None or self.get_event_type(e) != EL_SACCA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_collide(self):\n return self.snake_parts[-1] in self.snake_parts[:-1]",
"def check_spanning(self):\n d = {}\n for m, h in self.arcs():\n if m == h:\n return False\n\n d.setdefault(h, [])\n d[h].append(m)\n stack = [0]\n ... | [
"0.6242595",
"0.604591",
"0.5995849",
"0.5968818",
"0.596671",
"0.5926034",
"0.59149355",
"0.59129906",
"0.5911775",
"0.5898736",
"0.587897",
"0.58735555",
"0.58728635",
"0.5856844",
"0.5848168",
"0.58451563",
"0.5826595",
"0.5803563",
"0.57985944",
"0.57950336",
"0.57930684"... | 0.58706695 | 13 |
Checks whether any saccades have exited a given boundary since the last time the eye event queue was fetched. | def saccade_from_boundary(self, label, event_queue=None, report=EL_TIME_END):
if not event_queue:
event_queue = self.get_event_queue([EL_SACCADE_END])
if not len(event_queue):
return False
for e in event_queue:
if e == None or self.get_event_type(e) != EL_SAC... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reached_exit(self):\n for exit_neighbour in self.model.grid.get_neighborhood(self._goal, moore=True):\n if self.pos == exit_neighbour:\n return True\n return False",
"def isEndState(posBox):\r\n return sorted(posBox) == sorted(posGoals)",
"def terminate(self):\n ... | [
"0.6354309",
"0.63497764",
"0.63399273",
"0.6336446",
"0.6283472",
"0.62152356",
"0.61871266",
"0.6153867",
"0.6121323",
"0.61047256",
"0.6094154",
"0.608316",
"0.6034618",
"0.6021387",
"0.60169935",
"0.601528",
"0.59905535",
"0.5979483",
"0.5962816",
"0.59589833",
"0.5935948... | 0.562414 | 74 |
Fetches the numeric code corresponding to an eye event's type (e.g end saccade, start fixation). | def get_event_type(self, e):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_code(cls, key):\r\n event = cls._events.get(key) or cls._events['default']\r\n return event[1]",
"def get_entry_ea_code(nmmentry):\n\n\tif nmmentry.length == 4:\n\t\tif (nmmentry.offset % 4) == 0:\n\t\t\treturn \"WORD\"\n\n\t\telse:\n\t\t\treturn \"WORD2\"\n\n\telif nmmentry.length == 2:\n\... | [
"0.61949354",
"0.5774895",
"0.57554346",
"0.5737123",
"0.56979835",
"0.5680493",
"0.56566185",
"0.5655392",
"0.56533414",
"0.5648853",
"0.56415147",
"0.5596967",
"0.55848765",
"0.5540686",
"0.55361396",
"0.55139875",
"0.5497459",
"0.54955393",
"0.5462614",
"0.54341805",
"0.54... | 0.5970834 | 1 |
Trade Symbol like 'BTCUSDT'. Binance.com api is case sensitive. | def getTradeSymbolFrom(cryptoCoin: str, currencyCoin: str) -> str:
'Market restriction use for USD.'
if currencyCoin.upper() == 'USD':
currencyCoin = 'USDT'
return f'{cryptoCoin}{currencyCoin}'.upper() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_symbol(self, symbol_name: str) -> Symbol:\n symbol_info = self.binance_client.get_symbol_info(symbol_name)\n if not symbol_info:\n sys.exit(f\"No info found for the symbol {symbol_name}\")\n\n filters = self._get_filters(symbol_info[\"filters\"])\n\n avg_price = self.... | [
"0.65378493",
"0.64091814",
"0.6341891",
"0.6306868",
"0.6306868",
"0.62891597",
"0.6149535",
"0.6142335",
"0.61375296",
"0.61375296",
"0.607082",
"0.60626215",
"0.60459536",
"0.6023753",
"0.59742045",
"0.59185004",
"0.5917302",
"0.5917302",
"0.5886495",
"0.5843471",
"0.58401... | 0.73815584 | 0 |
Get a blob key for finalized blobstore file. | def get_blob_key(create_file_name):
if not create_file_name:
raise files.InvalidArgumentError('Empty file name')
if not isinstance(create_file_name, basestring):
raise files.InvalidArgumentError('Expected string for file name')
if not create_file_name.startswith(_BLOBSTORE_DIRECTORY):
raise files.Inva... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_blob_key(self, ticket):\n return self.blob_keys.get(ticket)",
"def get_key(self, patient, data_type, data_bin):\n full_path = self.get_full_path(patient, data_type, data_bin)\n if self.local:\n return full_path\n else:\n key = self.bucket.get_key(full_path)\n... | [
"0.7746051",
"0.65853524",
"0.6271748",
"0.62681454",
"0.6219594",
"0.6083059",
"0.5994055",
"0.5952685",
"0.59180224",
"0.59044296",
"0.58993584",
"0.5872248",
"0.5858404",
"0.5844789",
"0.58381665",
"0.5792687",
"0.5789829",
"0.5787399",
"0.57731605",
"0.5751515",
"0.574839... | 0.72087437 | 1 |
Push image to registry or dockerhub. | def push(self, repository, tag=None):
return self.client.images.push(repository, tag=tag, stream=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(image: str, tag: str = \"latest\", registry: Optional[str] = None):\n if registry is not None:\n # Tag the images with registry\n docker.tag(f\"{image}:{tag}\", f\"{registry}/{image}:{tag}\")\n image = f\"{registry}/{image}:{tag}\"\n else:\n image = f\"{image}:{tag}\"\n\n... | [
"0.7756859",
"0.7662761",
"0.76459545",
"0.75702125",
"0.7371346",
"0.7344417",
"0.7245723",
"0.7132994",
"0.70183724",
"0.67908955",
"0.6464652",
"0.6430033",
"0.6235965",
"0.62299466",
"0.6212765",
"0.6197212",
"0.61587906",
"0.6090961",
"0.6058793",
"0.6035721",
"0.6031713... | 0.69037384 | 9 |
Create a sentry event and hint from structlog `event_dict` and sys.exc_info. | def _get_event_and_hint(self, event_dict: EventDict) -> tuple[dict, dict]:
exc_info = _figure_out_exc_info(event_dict.get("exc_info", None))
has_exc_info = exc_info and exc_info != (None, None, None)
if has_exc_info:
event, hint = event_from_exception(
exc_info,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_event_data(self, record):\r\n\r\n logger_name = record.name if record.name else None\r\n event_data = {\r\n \"Timestamp\": _get_local_timestamp(record),\r\n \"Level\": logging.getLevelName(record.levelno),\r\n \"MessageTemplate\": record.getMessage(),\r\n ... | [
"0.60183305",
"0.57463175",
"0.5558699",
"0.55073166",
"0.54625845",
"0.5433407",
"0.5429663",
"0.5347268",
"0.52668345",
"0.52464426",
"0.52313757",
"0.51789474",
"0.5157091",
"0.51532805",
"0.51434463",
"0.5134084",
"0.51262355",
"0.5125155",
"0.5097201",
"0.5069778",
"0.50... | 0.69094235 | 0 |
Retrieves the status of this ModelEndpointService | def get_status(self, watch=None, resourceVersion=None):
logger.debug("Get Status called")
try:
with self._status_lock.reader_lock:
if watch:
return Response(
watch_manager.watch('status', resourceVersion, self._status),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_status(self):\n return self._api.get_status(self.id)",
"def get_status(self):\n return self.__status__",
"def get_status(self):\n return self._status",
"def get_service_status(self):\n return self.make_request(\"GetServiceStatus\")",
"def status(self):\n return se... | [
"0.7319228",
"0.72879624",
"0.7261593",
"0.72479564",
"0.7244087",
"0.7233943",
"0.7204124",
"0.7148734",
"0.7146781",
"0.7141216",
"0.7129937",
"0.7040372",
"0.7030936",
"0.6974821",
"0.6966772",
"0.69470257",
"0.69470257",
"0.69470257",
"0.69470257",
"0.69470257",
"0.694702... | 0.7184284 | 7 |
PUT /place api route | def put_place(place_id):
ignore_data = ["id", "user_id", "city_id", "created_at", "updated_at"]
return put(cls, place_id, ignore_data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_place_put(self):\n body = Place()\n response = self.client.open(\n '/place',\n method='PUT',\n data=json.dumps(body),\n content_type='application/json')\n self.assert200(response,\n 'Response body is : ' + response.data... | [
"0.76187503",
"0.71603364",
"0.7142766",
"0.70154786",
"0.7010782",
"0.69725823",
"0.6955089",
"0.69491494",
"0.6903655",
"0.687004",
"0.68635786",
"0.68349606",
"0.6824555",
"0.6801376",
"0.6772523",
"0.6768828",
"0.67524743",
"0.67524743",
"0.67524743",
"0.67524743",
"0.675... | 0.65387374 | 45 |
10x10 matrix filled with zeros | def createEmptyGrid():
grid=[]
for row in range(10):
grid.append([])
for column in range(10):
grid[row].append(0)
displayGrid("Grid Creation",grid)
return grid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty_matrix(x, y):\n matrix = []\n for x_ in range(x):\n matrix.append([])\n for y_ in range(y):\n matrix[-1].append(0) # 0 values\n\n return matrix",
"def zeroes(height, width):\n g = [[0.0 for _ in range(width)] for __ in range(height)]\n return Matrix(g)",... | [
"0.746955",
"0.7335167",
"0.7304827",
"0.72119296",
"0.7156249",
"0.71530414",
"0.7139244",
"0.69900435",
"0.68702096",
"0.6819798",
"0.6819798",
"0.6721859",
"0.6708221",
"0.6655207",
"0.66140157",
"0.65922403",
"0.6586706",
"0.65775025",
"0.6552286",
"0.6546787",
"0.6537712... | 0.6159102 | 55 |
Converts tuple timeseries to one hot encoding mapping all possible N combinations of audio/activity classes to 1ofN vector | def one_hot_encode(self):
self.oht = np.zeros([3,8640,2])
for i in range(0,8640):
if self.tuple_ts[0,i]==0:
self.oht[0,i,0]=1
elif self.tuple_ts[0,i]==1:
self.oht[1,i,0]=1
elif self.tuple_ts[0,i]==2:
self.oht[2,i,0]=1
if self.tuple_ts[1,i]==0:
self.oht[0,i,1]=1
elif self.tuple_ts[1,i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encode(classes):\n return np.array([*map(get_one_hot_vector, classes)], dtype=int)",
"def one_hot_encode(t):\r\n\tK = np.max(t) + 1 # Determine the number of classes\r\n\tN = t.shape[0]\r\n\tT = np.zeros((N, K)) # Output matrix\r\n\tT[np.arange(N), t] = 1\r\n\tT = T.astype(np.uint8)\r\n\treturn T"... | [
"0.6136939",
"0.6107016",
"0.6061706",
"0.60096705",
"0.57700586",
"0.5768481",
"0.57510275",
"0.5739055",
"0.5725339",
"0.57050294",
"0.5686724",
"0.56853676",
"0.56343573",
"0.56218094",
"0.5619451",
"0.56020373",
"0.5588004",
"0.5583623",
"0.5578063",
"0.55762374",
"0.5568... | 0.61054254 | 2 |
Calculates the numeric similarity between prop1 and prop2. | def calculate_numeric_similarity(prop1, prop2, max_value):
return (
prop1 and
prop2 and
max_value and
(1.0 - abs(prop1 - prop2 - 0.0 ) / max_value) or 0.0
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_absolute_similarity(prop1, prop2):\n\n if prop1 == prop2:\n return 1\n else:\n return 0",
"def get_similarity(profile_a, norm_a, profile_b, norm_b):\n similarity = 0.0\n for i in profile_a:\n similarity += profile_a[i] * profile_b[i]\n similarity ... | [
"0.8068894",
"0.71431965",
"0.71378446",
"0.6818636",
"0.6771456",
"0.6755696",
"0.66804284",
"0.667963",
"0.66243255",
"0.66121805",
"0.66043806",
"0.6600576",
"0.65867233",
"0.65803057",
"0.6568371",
"0.6547546",
"0.65169847",
"0.6499749",
"0.64912313",
"0.6481771",
"0.6481... | 0.80559725 | 1 |
Returns an image with shape [1, height, width, num_channels]. | def load_image_from_url(url):
response = requests.get(url)
image = Image.open(BytesIO(response.content))
image = preprocess_image(image)
return image | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image(array, size=28) -> Image:\n return Image.fromarray(array.reshape(size,size), 'L')",
"def picture(self):\n temp = self.color.astype('uint8')\n return Image.fromarray(temp[:self.height, :self.width], mode='RGB')",
"def get_image(self):\n images = np.frombuffer(self.image, dt... | [
"0.66790175",
"0.6370638",
"0.6362145",
"0.6340737",
"0.6336339",
"0.6289898",
"0.6196403",
"0.6194631",
"0.61670643",
"0.6028792",
"0.5989119",
"0.59888774",
"0.595209",
"0.5878292",
"0.58586997",
"0.58482593",
"0.5844438",
"0.58329093",
"0.578903",
"0.5786857",
"0.5779625",... | 0.0 | -1 |
Return the current local date and time as a string. | def now_str():
if gettz:
now = datetime.datetime.now(tz=gettz())
date_fmt = "%a, %d %b %Y %H:%M:%S %z"
else:
now = datetime.datetime.now()
date_fmt = "%a, %d %b %Y %H:%M:%S"
return now.strftime(date_fmt) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def currentDateString():\n now = datetime.now()\n return now.strftime(\"%d-%m-%Y %H:%M:%S\")",
"def currentDateString():\n \n now = datetime.now()\n return now.strftime(\"%d-%m-%Y %H:%M:%S\")",
"def get_current_date_string():\n time_now = datetime.datetime.now()\n time_now_datestring = tim... | [
"0.81137294",
"0.8069102",
"0.80664647",
"0.80200475",
"0.7885084",
"0.7757743",
"0.77204555",
"0.769353",
"0.7605796",
"0.7591316",
"0.7575472",
"0.75682455",
"0.75499666",
"0.7533165",
"0.7513803",
"0.74476796",
"0.74475294",
"0.7414162",
"0.7389461",
"0.7387728",
"0.734478... | 0.75902605 | 10 |
Parse a date string as returned from now_str() into a datetime object. | def parse_date(date_string):
if _dateutil_parse:
return _dateutil_parse(date_string)
else:
try:
date_fmt = "%a, %d %b %Y %H:%M:%S %z"
return datetime.datetime.strptime(date_string, date_fmt)
except ValueError:
date_fmt = "%a, %d %b %Y %H:%M:%S"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_date(date_str: str) -> date:\n return dateutil_parser(date_str).date()",
"def parse_date(string):\n if re.match(DATETIME_STRING_RE, string):\n dt = dateutil.parser.parse(string)\n if dt.tzinfo:\n dt = dt.astimezone(dateutil.tz.tzlocal()).replace(tzinfo=None)\n else:\n ... | [
"0.77705365",
"0.7658442",
"0.76014274",
"0.7565846",
"0.7497221",
"0.74888223",
"0.74827546",
"0.7475805",
"0.7455991",
"0.74432456",
"0.7430326",
"0.73752975",
"0.7362716",
"0.73180187",
"0.73155344",
"0.7257777",
"0.725097",
"0.7243055",
"0.7214238",
"0.7191268",
"0.718830... | 0.7162363 | 22 |
Extracts the stroke height. | def stroke_height(self, in_air=False, statistics=()):
return self.compute(self.wrapper, stroke_height, statistics=statistics, in_air=in_air) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_height(self):\n return self.__size.y",
"def height(self):\n return self.rectangle[3] - self.y",
"def height():\n return (_toph + _both) / _scale",
"def get_height(self) -> Number:\n return (self.right_bottom[1] - self.left_top[1])",
"def get_height(self):\n bbox =... | [
"0.7027098",
"0.70185965",
"0.69887483",
"0.68486756",
"0.6845059",
"0.67403805",
"0.6724412",
"0.6649849",
"0.6649849",
"0.6649849",
"0.6649849",
"0.66483134",
"0.66458344",
"0.6626504",
"0.6616551",
"0.6616551",
"0.660574",
"0.6592276",
"0.65752804",
"0.6564472",
"0.6544040... | 0.7557975 | 0 |
Extracts the writing height. | def writing_height(self, in_air=False):
return self.compute(self.wrapper, writing_height, in_air=in_air) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def height():\n return (_toph + _both) / _scale",
"def height(self):\n return self._tr.h",
"def height(self):\n return self._tr.h",
"def get_sensor_height(self):\n return self.sensor_height",
"def getHeight(self):\n return self.height",
"def get_height(self):\n ret... | [
"0.6958454",
"0.6818209",
"0.6818209",
"0.68167377",
"0.680516",
"0.67367333",
"0.6731465",
"0.67243767",
"0.67185414",
"0.66975063",
"0.66975063",
"0.66975063",
"0.66975063",
"0.66954136",
"0.6690706",
"0.66849846",
"0.66849846",
"0.66849846",
"0.66849846",
"0.66849846",
"0.... | 0.6598268 | 43 |
Extracts the relative number of intrastroke intersections. | def relative_number_of_intra_stroke_intersections(self, statistics=()):
return self.compute(self.wrapper, relative_number_of_intra_stroke_intersections, statistics=statistics) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relative_total_number_of_intra_stroke_intersections(self):\n return self.compute(self.wrapper, relative_total_number_of_intra_stroke_intersections)",
"def relative_number_of_inter_stroke_intersections(self):\n return self.compute(self.wrapper, relative_number_of_inter_stroke_intersections)",
... | [
"0.7629138",
"0.7420526",
"0.73464715",
"0.6940167",
"0.65542495",
"0.6318215",
"0.6268258",
"0.6182594",
"0.61089605",
"0.60025275",
"0.5950099",
"0.59445804",
"0.5929765",
"0.5847712",
"0.58006424",
"0.5782822",
"0.5745465",
"0.57411444",
"0.57285273",
"0.57000077",
"0.5697... | 0.697108 | 3 |
Extracts the relative total number of intrastroke intersections. | def relative_total_number_of_intra_stroke_intersections(self):
return self.compute(self.wrapper, relative_total_number_of_intra_stroke_intersections) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_number_of_intra_stroke_intersections(self):\n return self.compute(self.wrapper, total_number_of_intra_stroke_intersections)",
"def relative_number_of_inter_stroke_intersections(self):\n return self.compute(self.wrapper, relative_number_of_inter_stroke_intersections)",
"def relative_numb... | [
"0.7720233",
"0.7538067",
"0.71168846",
"0.7102425",
"0.67676836",
"0.64505804",
"0.6442912",
"0.6221853",
"0.6189553",
"0.60409206",
"0.6032412",
"0.60275316",
"0.59703267",
"0.5956291",
"0.5949668",
"0.5895804",
"0.5846241",
"0.58423376",
"0.58165115",
"0.5799027",
"0.57937... | 0.79638135 | 0 |
Extracts the relative number of interstroke intersections. | def relative_number_of_inter_stroke_intersections(self):
return self.compute(self.wrapper, relative_number_of_inter_stroke_intersections) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relative_total_number_of_intra_stroke_intersections(self):\n return self.compute(self.wrapper, relative_total_number_of_intra_stroke_intersections)",
"def total_number_of_intra_stroke_intersections(self):\n return self.compute(self.wrapper, total_number_of_intra_stroke_intersections)",
"def n... | [
"0.8149092",
"0.79826254",
"0.7882536",
"0.7373874",
"0.70041114",
"0.6698782",
"0.64294213",
"0.6227933",
"0.61987156",
"0.61531425",
"0.6143864",
"0.61279213",
"0.6044562",
"0.6044188",
"0.60420597",
"0.60370654",
"0.60335183",
"0.59795415",
"0.59463507",
"0.59228164",
"0.5... | 0.8276245 | 0 |
Extracts the vertical valleys velocity. | def vertical_valleys_velocity(self, fs, n=None, statistics=()):
return self.compute(self.wrapper, vertical_valleys_velocity, fs=fs, n=n, statistics=statistics) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def velocity(self):\n return self.vx, self.vy",
"def get_velocity(self):\r\n return self._v",
"def _get_velocity(self, vi, r):\n return r * vi / (r - self.WHEEL_SEPARATION/2)",
"def velocity(self):\n multirotor_state = self.sim_handler.client_state\n airsim_lin_vel = mu... | [
"0.71143425",
"0.6998087",
"0.6975955",
"0.6842396",
"0.68369037",
"0.6822618",
"0.6788256",
"0.66863483",
"0.66801107",
"0.66615516",
"0.6645468",
"0.6641952",
"0.65885735",
"0.65470684",
"0.65342385",
"0.6526543",
"0.64912814",
"0.6463982",
"0.64437884",
"0.64378756",
"0.64... | 0.73917085 | 0 |
Extracts the stroke duration. | def stroke_duration(self, in_air=False, statistics=()):
return self.compute(self.wrapper, stroke_duration, statistics=statistics, in_air=in_air) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration(self) -> float:\n return self.path_interval[1] - self.path_interval[0]",
"def Duration(self):\n\t\treturn self._get_attribute('duration')",
"def speaking_duration_with_pauses(self):\r\n objects = self.__get_objects()\r\n z1 = str(objects[1]).strip().split()\r\n return f... | [
"0.6565979",
"0.64444625",
"0.64079493",
"0.6402138",
"0.638636",
"0.6360863",
"0.6263235",
"0.6261625",
"0.62354374",
"0.6214418",
"0.6202131",
"0.6198172",
"0.61966735",
"0.61832243",
"0.6124285",
"0.6117917",
"0.60806173",
"0.60796136",
"0.60697854",
"0.6060973",
"0.606097... | 0.73291487 | 0 |
Extracts the writing duration. | def writing_duration(self, in_air=False):
return self.compute(self.wrapper, writing_duration, in_air=in_air) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_duration(self):\n return self.__duration",
"def get_duration(self) -> int:\n raise NotImplementedError()",
"def Duration(self):\n\t\treturn self._get_attribute('duration')",
"def getDuration(self):\r\n return self.duration",
"def getFileDuration(self):\n time = 0\n c... | [
"0.6884272",
"0.67654",
"0.66659254",
"0.6652544",
"0.66478944",
"0.6604191",
"0.65890914",
"0.65855503",
"0.65783924",
"0.65783924",
"0.65783924",
"0.65773284",
"0.65773284",
"0.6561039",
"0.65606695",
"0.6551069",
"0.65252423",
"0.65252423",
"0.65252423",
"0.65252423",
"0.6... | 0.6767166 | 1 |
Extracts the overall writing duration. | def writing_duration_overall(self):
return self.compute(self.wrapper, writing_duration_overall) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writing_duration(self, in_air=False):\n return self.compute(self.wrapper, writing_duration, in_air=in_air)",
"def _get_duration(self):\n return self.__duration",
"def actual_duration(self) -> int:\n output = 0\n for flow_step in self.flow:\n for song in flow_step.songs:\n... | [
"0.68090504",
"0.6621022",
"0.6548517",
"0.65329844",
"0.6510451",
"0.65063053",
"0.65047204",
"0.64912015",
"0.64244145",
"0.64240336",
"0.640458",
"0.64038503",
"0.6392628",
"0.63768846",
"0.6345418",
"0.6338464",
"0.6338464",
"0.6338464",
"0.6338464",
"0.6338464",
"0.63384... | 0.7610556 | 0 |
Extracts the number of interruptions relative to the duration. | def number_of_interruptions_relative(self):
return self.compute(self.wrapper, number_of_interruptions_relative) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nr_hours(duration):\n return int(math.ceil((duration.total_seconds()/3600)))",
"def duration(self):\n if self._closed or \\\n not self._result or \\\n \"duration\" not in self._result:\n return -1\n return self._result.get(\"duration\", 0)",
"de... | [
"0.6680517",
"0.65929884",
"0.65374887",
"0.6537038",
"0.6532814",
"0.6532814",
"0.6499623",
"0.64803314",
"0.64433324",
"0.6358498",
"0.63110846",
"0.63007313",
"0.6287001",
"0.6262074",
"0.62003",
"0.6189197",
"0.6158178",
"0.61390847",
"0.61164075",
"0.609829",
"0.60904336... | 0.0 | -1 |
Calculates weak signal value between vertex_indices to list_of_elements. | def get_weak_signal_similarities(
self, dataset, vertex_indices, list_of_elements
):
if dataset.is_graph:
return (
dataset.features[list_of_elements, :]
.dot(dataset.features[vertex_indices, :].T)
.T
)
elif dataset.is_sparse:
return dataset.weak_signal[ver... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_weak_signal_ordering(\n self,\n dataset,\n vertex_indices,\n list_of_elements,\n ordering_style='weak_signal',\n ):\n if ordering_style == 'weak_signal':\n weak_signal_similarities = self.get_weak_signal_similarities(\n dataset, vertex_indices, list_of_elements\... | [
"0.5628745",
"0.517518",
"0.4982966",
"0.4955278",
"0.48597714",
"0.48448414",
"0.48362297",
"0.48305663",
"0.48099625",
"0.47991318",
"0.47751656",
"0.47645247",
"0.47604725",
"0.4757119",
"0.47224143",
"0.4715476",
"0.47004604",
"0.4690568",
"0.46742666",
"0.46520224",
"0.4... | 0.71406984 | 0 |
Assigns points to pivots to form clusters. For every point, find the first pivot which it connects to. This is done by sorting the set of pivots using the ordering style (default is use ordering from weak signal). Then checking over this order of the pivots until a positive edge is found. | def assign_to_pivots_given_ordering(
self,
dataset,
points,
pivots,
budget,
batch_size,
max_neighbors_to_query,
ordering_style,
boost_by_neighbors_assignment=gin.REQUIRED,
):
queries_used = 0
vertices_to_pivots = {}
num_neighbors_per_pivot_of_vertex =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def independent_set(\n self, dataset, pivots, ordering_style, max_neighbors_to_query=100\n ):\n # Keep track of the number of expensive queries used for IS part.\n expensive_queries = 0\n # List of final pivots, 1st one is always in.\n final_pivots = [pivots[0]]\n for possible_pivot in pivots[... | [
"0.6812528",
"0.6333951",
"0.6103262",
"0.5874025",
"0.5837336",
"0.5837336",
"0.57061756",
"0.56869",
"0.5648225",
"0.5620856",
"0.5589999",
"0.5497618",
"0.5383066",
"0.5368709",
"0.5364621",
"0.53611547",
"0.5353444",
"0.53494346",
"0.5305428",
"0.52855074",
"0.51496124",
... | 0.7319027 | 0 |
Tests whether ``put_attachments_into`` works as intended. | def test__put_attachments_into():
attachment_id_0 = 202304290007
attachment_name_0 = 'Primrose'
attachment_id_1 = 202304290008
attachment_name_1 = 'Flower'
attachment_0 = Attachment.precreate(
attachment_id_0,
name = attachment_name_0,
)
attachment_1 = Attachme... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_existing_attachments(self):\r\n ca = self.F.CaseAttachmentFactory.create(\r\n caseversion=self.cv, name=\"sample.csv\")\r\n self.cv.attachments.add(ca)\r\n\r\n form = self.get_form()\r\n\r\n self.assertEqual(form.fields[\"remove-attachment\"][0].value, None)",
"def... | [
"0.65739244",
"0.6510458",
"0.63117576",
"0.6183157",
"0.61075795",
"0.60915136",
"0.6090313",
"0.5914762",
"0.59036255",
"0.5892048",
"0.58488977",
"0.5677233",
"0.56717056",
"0.56619996",
"0.56392473",
"0.56348276",
"0.55849963",
"0.55703044",
"0.5470112",
"0.5468359",
"0.5... | 0.80088496 | 0 |
Parse a text file into a list containing each line. | def parse_list_file(file_path: str) -> list:
with open(file_path) as f:
return [l.strip() for l in f.readlines() if l.strip()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_file(self, filepath: str) -> list:\n with open(filepath) as fid:\n text = fid.read()\n return self.parse_text(text)",
"def load_list(file_path):\n \n textlist = []\n with open(file_path) as file_handler:\n line = file_handler.readline()\n while line:\... | [
"0.798123",
"0.7924132",
"0.7875173",
"0.78711796",
"0.7724569",
"0.7664506",
"0.7597751",
"0.75173587",
"0.7464683",
"0.7372005",
"0.7353293",
"0.7348145",
"0.73139536",
"0.7305661",
"0.72985625",
"0.72891337",
"0.7288772",
"0.7239724",
"0.7230993",
"0.7221027",
"0.72003484"... | 0.76088727 | 6 |
Generates a permutation of the numbers 1 to size. | def gen_perm(self, size):
perm = list(range(0, size))
random.shuffle(perm)
return perm.copy() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permutations():\n return [*range(permutation_count)]",
"def permutation( n ):\n n = int( n )\n lst = sc.arange( n )\n sc.random.shuffle( lst )\n return lst",
"def permutation_mapping(size1, size2):\n return np.random.permutation(np.repeat(np.arange(size2),np.ceil(size1/float(size2))))[:si... | [
"0.7840665",
"0.7479791",
"0.70544136",
"0.68430686",
"0.6833797",
"0.6769973",
"0.6603012",
"0.64868563",
"0.6478809",
"0.64487743",
"0.64059675",
"0.6403715",
"0.63710237",
"0.6370276",
"0.63672704",
"0.6319254",
"0.62488365",
"0.6227858",
"0.6227712",
"0.6219356",
"0.61996... | 0.8199374 | 0 |
Checks if all the elements of the first array are in the second array. | def all_in(self, d, f):
for i in d:
if not self.in_array(f, i):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_ary_contains_ary(array1,array2):\n list1 = array1.tolist()\n list2 = array2.tolist()\n sign=True\n for n in list1:\n if n not in list2:\n sign = False\n\n return sign",
"def args_contained_in(a, b):\n return all([bi in a for bi in b])",
"def assertContainsAll(l... | [
"0.7851593",
"0.7189097",
"0.7143934",
"0.7141892",
"0.71356237",
"0.7058866",
"0.702369",
"0.7021896",
"0.69755137",
"0.69701445",
"0.684543",
"0.67765737",
"0.67595214",
"0.66626096",
"0.6651732",
"0.6641801",
"0.6575827",
"0.65415335",
"0.654051",
"0.6510507",
"0.6486252",... | 0.6560743 | 17 |
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(self, lst: List, n: int) -> List:\n for i in range(0, len(lst), n):\n yield lst[i:i + n]",
"def _chunks(self, lst: List, n: int) -> List:\n for i in range(0, len(lst), n):\... | [
"0.83071756",
"0.8290744",
"0.8290744",
"0.8237026",
"0.8146566",
"0.81460685",
"0.81414855",
"0.81414855",
"0.81267184",
"0.81267184",
"0.8107211",
"0.8082399",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0... | 0.80526286 | 35 |
Calculates the cost as the weighted average number of parameters. | def calculate_cost(self):
# Get the mask values. This will be a tensor of size
# (batch_size, self.num_card_options).
curr_mask_values = self.mask_values[0]
# Take the dot product with the number of parameters for each
# of the cardinality options. Should be of size (batch_size... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cost(self, x_params, y_params, weights, bias):\n n = len(y_params)\n sum_ = sum([pow(self.hypothesis(x_params[i], weights, bias) - y_params[i], 2)\n for i in range(n)])\n return sum_ * (1 / n)",
"def cost_func(weights)->float:\n\n cost = 0\n for ith_element in tr... | [
"0.74412256",
"0.7382167",
"0.69948006",
"0.6840068",
"0.67340285",
"0.6726773",
"0.6719941",
"0.6709278",
"0.66805583",
"0.665485",
"0.6651958",
"0.6580567",
"0.65802544",
"0.6575519",
"0.65553313",
"0.6536625",
"0.653376",
"0.6462623",
"0.64623386",
"0.6420511",
"0.6412812"... | 0.724618 | 2 |
Hardsamples from the Gumbel Softmax distribution and returns the resulting embedding cardinality as an integer. | def sample_emb_arch(self):
# Hard-sample from the distribution.
sampled_mask_values = self.hard_sample()
# Find the one-hot index of the mask.
one_hot_ix = np.argmax(sampled_mask_values[0])
# Return the embedding cardinality size at
# that index.
sampled_card =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gumbel_softmax(logits, temperature=1.0, hard=False, dim=1):\n y = gumbel_softmax_sample(logits, temperature, dim=dim)\n if hard:\n y_hard = onehot_from_logits(y, dim=dim)\n y = (y_hard - y).detach() + y\n return y",
"def gumbel_softmax(logits, temperature=1.0, hard=False, dim=1):\n ... | [
"0.5990035",
"0.5990035",
"0.59407157",
"0.59291273",
"0.58145785",
"0.5777972",
"0.57626283",
"0.575365",
"0.56964695",
"0.5691807",
"0.56813467",
"0.56812876",
"0.5680718",
"0.5623821",
"0.56230205",
"0.56229466",
"0.5574274",
"0.5571312",
"0.5552873",
"0.5533302",
"0.55183... | 0.64932954 | 0 |
Load a JSON formatted file from the given filepath filepath The filepath including filename and extension Return a dictionary of the loaded json | def load_json_file(filepath):
try:
with open(filepath, 'r') as file:
return json.load(file)
except Exception as e:
logging.error("Unable to load JSON file {}".format(e))
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def openJson(self, filepath:str) -> dict:\n if isinstance(filepath, str) and os.path.exists(filepath):\n with open(filepath, \"r\") as f:\n data = json.load(f)\n return data",
"def load_json(filepath):\n with open(filepath) as fh:\n data = json.load(fh)\n ... | [
"0.8132379",
"0.81181383",
"0.8115864",
"0.810656",
"0.79514825",
"0.79416615",
"0.7829801",
"0.782968",
"0.7788359",
"0.7787554",
"0.7763597",
"0.776277",
"0.77462995",
"0.77348846",
"0.7725225",
"0.7715412",
"0.7715412",
"0.7682607",
"0.76773095",
"0.7673691",
"0.7668432",
... | 0.7706071 | 17 |
Returns the user home folder path as string | def get_home_path():
if sys.version_info < (3,5):
return str(os.path.expanduser("~"))
return str(Path.home()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_home_dir(self):\n\t\ttry:\n\t\t\thome_dir = os.path.expanduser(\"~\")\n\t\texcept Exception as e:\n\t\t\tprint(\"Couldn't get home directory! :(\")\n\t\t\tprint(e)\n\t\t\tsys.exit(1)\n\t\telse:\n\t\t\treturn home_dir",
"def get_home():\n import os\n home = os.path.expanduser(\"~\")\n return home... | [
"0.82950693",
"0.8236306",
"0.82334393",
"0.8212853",
"0.82019055",
"0.8155508",
"0.8138021",
"0.8124881",
"0.81185114",
"0.81077564",
"0.8008819",
"0.7875539",
"0.7755168",
"0.7578287",
"0.75724465",
"0.7556765",
"0.7501967",
"0.74345237",
"0.74116576",
"0.73928505",
"0.7255... | 0.85171074 | 0 |
Returns the event's guild from cache. Returns | def guild(self):
guild_id = self.guild_id
if guild_id:
return GUILDS.get(guild_id, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dguild(self):\n return bot.get_guild(self.id)",
"async def get_guild(self, guild_id: int) -> LevellingGuild:\n raise NotImplementedError",
"async def get_guild_data(self, guild_id):\n cache = definitions.DATA_CACHE[\"guilds\"]\n if guild_id in cache:\n self.guild_data... | [
"0.679779",
"0.67820984",
"0.67580503",
"0.6712189",
"0.65340334",
"0.63338023",
"0.6255589",
"0.6188145",
"0.6165134",
"0.6160015",
"0.6106935",
"0.60711986",
"0.60014033",
"0.5722088",
"0.57112616",
"0.55921614",
"0.5534809",
"0.54066426",
"0.53743666",
"0.5365681",
"0.5305... | 0.6932269 | 1 |
Returns the event's guild from cache. Returns | def guild(self):
guild_id = self.guild_id
if guild_id:
return GUILDS.get(guild_id, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dguild(self):\n return bot.get_guild(self.id)",
"async def get_guild(self, guild_id: int) -> LevellingGuild:\n raise NotImplementedError",
"async def get_guild_data(self, guild_id):\n cache = definitions.DATA_CACHE[\"guilds\"]\n if guild_id in cache:\n self.guild_data... | [
"0.679779",
"0.67820984",
"0.67580503",
"0.6712189",
"0.65340334",
"0.63338023",
"0.6255589",
"0.6188145",
"0.6165134",
"0.6160015",
"0.6106935",
"0.60711986",
"0.60014033",
"0.5722088",
"0.57112616",
"0.55921614",
"0.5534809",
"0.54066426",
"0.53743666",
"0.5365681",
"0.5305... | 0.6932269 | 0 |
Returns the event's guild from cache. Returns | def guild(self):
guild_id = self.guild_id
if guild_id:
return GUILDS.get(guild_id, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dguild(self):\n return bot.get_guild(self.id)",
"async def get_guild(self, guild_id: int) -> LevellingGuild:\n raise NotImplementedError",
"async def get_guild_data(self, guild_id):\n cache = definitions.DATA_CACHE[\"guilds\"]\n if guild_id in cache:\n self.guild_data... | [
"0.679779",
"0.67820984",
"0.67580503",
"0.6712189",
"0.65340334",
"0.63338023",
"0.6255589",
"0.6188145",
"0.6165134",
"0.6160015",
"0.6106935",
"0.60711986",
"0.60014033",
"0.5722088",
"0.57112616",
"0.55921614",
"0.5534809",
"0.54066426",
"0.53743666",
"0.5365681",
"0.5305... | 0.6932269 | 2 |
decompose a given segmentation image of (width_height) where each pixel has a label, and a total of n labels (e.g 1000), to a matrix of size (n, width, height) where each row i corresponds to the representation of the i'th segment | def segmentor(self):
n_segments = self.segments.max()
logger.info(f"found {n_segments} segments")
seg_array = np.arange(n_segments).reshape(1, -1)
res = np.equal(self.segments.T[...,np.newaxis],seg_array).T
# dims = (n_segments, *self.img.shape[:-1])
# res = np.zeros(di... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manual_segmentation(self, image_path):\r\n if type(image_path) in [np.array]:\r\n self.logger.info(\"Received Image as Matrix\")\r\n\r\n img = image_path\r\n\r\n else:\r\n\r\n img = skimage.io.imread(image_path)\r\n\r\n\r\n labeledArr, num_ids = ndimage.lab... | [
"0.6579963",
"0.6476489",
"0.61903906",
"0.61074495",
"0.60399467",
"0.6006615",
"0.59742165",
"0.59088475",
"0.5888502",
"0.58588284",
"0.5840645",
"0.58321726",
"0.5802974",
"0.57816106",
"0.5725764",
"0.57221574",
"0.5715606",
"0.57037926",
"0.56877583",
"0.5671246",
"0.56... | 0.0 | -1 |
Return boolean specifying if x is a valid member of this space | def contains(self, x):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid(self,x,y):\n if x<0 or x>=self.xsize:\n return False\n if y<0 or y>=self.ysize:\n return False\n return True",
"def is_position_valid(x: int, y: int) -> bool:\n return 0 <= x < WIDTH and 0 <= y < HEIGHT",
"def is_valid(self, x, y):\n \n ... | [
"0.6971704",
"0.6876132",
"0.67751884",
"0.67487717",
"0.6730401",
"0.6608476",
"0.65997314",
"0.65670305",
"0.65583646",
"0.65151197",
"0.65056884",
"0.647921",
"0.64677376",
"0.64675945",
"0.6464435",
"0.64604485",
"0.64392734",
"0.6426901",
"0.64168334",
"0.6375717",
"0.63... | 0.0 | -1 |
Creates an APP2APP application context. The application is automatically created using `application.Application.Create` method. | def CreateApplication(self, ApplicationName=None):
if ApplicationName is not None:
self.Name = tounicode(ApplicationName)
self._App = self._Skype.Application(self.Name)
self._Skype.RegisterEventHandler('ApplicationStreams', self._ApplicationStreams)
self._Skype.RegisterE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app(self):\n LOGGER.debug(\"Creating app!\")\n settings = self.intitilaize_app_settings()\n self.app_ctx.settings.update(settings)\n return anthem.Application(self.app_ctx.routes, self.initilaize_app, **self.app_ctx.settings)",
"def create_app():\n app = Flask(__name__, ... | [
"0.6922983",
"0.68572724",
"0.6764452",
"0.6733385",
"0.6731502",
"0.67307776",
"0.6681352",
"0.6671135",
"0.6630825",
"0.65877664",
"0.6449271",
"0.64292073",
"0.6418076",
"0.6386165",
"0.6354354",
"0.6353624",
"0.63462394",
"0.633055",
"0.63285846",
"0.63277054",
"0.6212517... | 0.0 | -1 |
Opens dial pad tab. | def OpenDialpadTab(self):
self.OpenDialog('DIALPAD') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_panel_browser():\n import webbrowser\n # xxx . should open localhost, not the .onion\n webbrowser.open(apaf.hiddenservices[0].hs.hostname)",
"def show(self):\n\n if self.nb_name:\n params = '?p='+self.nb_name\n else: params = ''\n webbrowser.open_new_tab(\n ... | [
"0.61767906",
"0.5940109",
"0.59143806",
"0.5869225",
"0.5865242",
"0.5782278",
"0.5767613",
"0.5746079",
"0.5727534",
"0.5719721",
"0.5716279",
"0.5661715",
"0.56145245",
"0.5591455",
"0.55600405",
"0.5550251",
"0.55482787",
"0.5531629",
"0.5526359",
"0.55262893",
"0.5520877... | 0.8957895 | 0 |
Opens getting started wizard. | def OpenGettingStartedWizard(self):
self.OpenDialog('GETTINGSTARTED') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wizard(self):\n if not self.settings[\"configured\"]:\n logging.info(\"Opening Wizard\")\n self.dialog = Wizard(cur_dir)\n self.dialog.exec_()\n logging.info(\"Reading Changes\")\n self.open_settings(True)\n else:\n pass",
"def d... | [
"0.68224317",
"0.61173195",
"0.59705454",
"0.58777887",
"0.5846062",
"0.5809397",
"0.5804267",
"0.57782483",
"0.57060117",
"0.56594104",
"0.56594104",
"0.5647679",
"0.56002253",
"0.5600031",
"0.5573886",
"0.5554921",
"0.55123436",
"0.5483468",
"0.54513437",
"0.5449655",
"0.54... | 0.8643616 | 0 |
Opens current user profile dialog. | def OpenProfileDialog(self):
self.OpenDialog('PROFILE') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def OpenUserInfoDialog(self, Username):\r\n self.OpenDialog('USERINFO', Username)",
"def user_popup(username):\n user = User.query.filter_by(username=username).first()\n form = EmptyForm()\n return render_template('user_popup.html', user=user, form=form)",
"def edit_profile():\n\n droid.dial... | [
"0.6922586",
"0.67033786",
"0.651905",
"0.6232361",
"0.62122",
"0.5888372",
"0.5885346",
"0.5871885",
"0.586485",
"0.5855377",
"0.57899266",
"0.57873976",
"0.5781245",
"0.5732055",
"0.57234",
"0.5712345",
"0.56838006",
"0.56748945",
"0.56717527",
"0.5670626",
"0.56687087",
... | 0.8692357 | 0 |
Returns leave reason as text. | def ChatLeaveReasonToText(self, Reason):
return self._ToText('lea', Reason) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reason(self) -> str:\n return pulumi.get(self, \"reason\")",
"def reason(self) -> str:\n return pulumi.get(self, \"reason\")",
"def reason(self) -> str:\n return pulumi.get(self, \"reason\")",
"def reason(self) -> str:\n return pulumi.get(self, \"reason\")",
"def reason(self... | [
"0.7120411",
"0.7120411",
"0.7120411",
"0.7120411",
"0.7009266",
"0.69063896",
"0.69063896",
"0.68361294",
"0.6700808",
"0.65799046",
"0.65799046",
"0.6555189",
"0.65247935",
"0.65247935",
"0.65247935",
"0.65247935",
"0.6523645",
"0.6421419",
"0.6373908",
"0.6370805",
"0.6230... | 0.7820041 | 0 |
Returns message status as text. | def ChatMessageStatusToText(self, Status):
return self._ToText('cms', Status) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status_message(self) -> str:\n return pulumi.get(self, \"status_message\")",
"def status_message(self) -> str:\n return pulumi.get(self, \"status_message\")",
"def status_message(self):\n return self.safe_data['status']['message']",
"def status_text(self):\n if self._is_runnin... | [
"0.8583684",
"0.8583684",
"0.8332173",
"0.8132503",
"0.7965847",
"0.7939039",
"0.7939039",
"0.7854114",
"0.78472227",
"0.76550716",
"0.7570766",
"0.75608057",
"0.7501591",
"0.7391497",
"0.7367875",
"0.73110014",
"0.7248703",
"0.7248703",
"0.7234972",
"0.721675",
"0.72162145",... | 0.7435859 | 13 |
Returns message type as text. | def ChatMessageTypeToText(self, Type):
return self._ToText('cme', Type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_type(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"message_type\")",
"def getTypeAsString(self) -> unicode:\n ...",
"def getTypeAsString(self) -> unicode:\n ...",
"def message_type(self) -> Optional[str]:\n return pulumi.get(self, \"message_type\")",
"def ... | [
"0.83321",
"0.77087176",
"0.77087176",
"0.7634228",
"0.7634228",
"0.7634228",
"0.7634228",
"0.7634228",
"0.7634228",
"0.7634228",
"0.7634228",
"0.7634228",
"0.7634228",
"0.7634228",
"0.7634228",
"0.7634228",
"0.7634228",
"0.7634228",
"0.7634228",
"0.7634228",
"0.7634228",
"... | 0.0 | -1 |
Returns group type as text. | def GroupTypeToText(self, Type):
return self._ToText('grp', Type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_type_repr(id):\n\n if not id:\n repr_text = messages.NONE\n else:\n row = group_types.get(id, None)\n if not row:\n repr_text = messages.UNKNOWN_OPT\n else:\n repr_text = row[\"display\"]\n return repr_text",
... | [
"0.7693248",
"0.72806984",
"0.7054536",
"0.69605714",
"0.69605714",
"0.6726604",
"0.67116594",
"0.6649386",
"0.6559391",
"0.6559391",
"0.6559391",
"0.6559391",
"0.6559391",
"0.6559391",
"0.65587854",
"0.65368116",
"0.6519824",
"0.65054816",
"0.65035945",
"0.6494264",
"0.64836... | 0.8247571 | 0 |
Returns SMS message status as text. | def SmsMessageStatusToText(self, Status):
return self._ToText('smsMessageStatus', Status) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status_message(self) -> str:\n return pulumi.get(self, \"status_message\")",
"def status_message(self) -> str:\n return pulumi.get(self, \"status_message\")",
"def status_message(self):\n return self.safe_data['status']['message']",
"def ChatMessageStatusToText(self, Status):\r\n ... | [
"0.7844287",
"0.7844287",
"0.7669442",
"0.76459324",
"0.74737054",
"0.74681985",
"0.73698896",
"0.73698896",
"0.7325465",
"0.7317565",
"0.72451484",
"0.723231",
"0.72122186",
"0.719986",
"0.7117388",
"0.7065058",
"0.7046275",
"0.6929347",
"0.692133",
"0.692133",
"0.6835229",
... | 0.80173695 | 0 |
Returns voicemail failure reason as text. | def VoicemailFailureReasonToText(self, Reason):
return self._ToText('vmr', Reason) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def failed_reason(self) -> str:\n return pulumi.get(self, \"failed_reason\")",
"def failure_reason(self) -> Optional[str]:\n return pulumi.get(self, \"failure_reason\")",
"def CallFailureReasonToText(self, Reason):\r\n return self._ToText('cfr', Reason)",
"def get_test_message(self):\n ... | [
"0.7598343",
"0.7245253",
"0.7223535",
"0.70526075",
"0.70241517",
"0.70241517",
"0.70241517",
"0.70241517",
"0.6959417",
"0.6948226",
"0.6948226",
"0.6905294",
"0.68552923",
"0.6815992",
"0.6795477",
"0.67418826",
"0.6720026",
"0.6720026",
"0.67048556",
"0.6704647",
"0.67035... | 0.78626806 | 0 |
Returns voicemail type as text. | def VoicemailTypeToText(self, Type):
return self._ToText('vmt', Type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTypeAsString(self) -> unicode:\n ...",
"def getTypeAsString(self) -> unicode:\n ...",
"def type(self) -> str:\r\n return self.data.get(\"Type\")",
"def type(self):\n \n return str(self._type)",
"def message_type(self) -> pulumi.Output[str]:\n return pulumi.g... | [
"0.75866795",
"0.75866795",
"0.6851594",
"0.67209256",
"0.67103344",
"0.6693058",
"0.6693058",
"0.6693058",
"0.6693058",
"0.6693058",
"0.6693058",
"0.6693058",
"0.6693058",
"0.6693058",
"0.6693058",
"0.6693058",
"0.6693058",
"0.6693058",
"0.6693058",
"0.6693058",
"0.6693058",... | 0.79281133 | 0 |
Deletes this SMS message. | def Delete(self):
self._Owner._DoCommand('DELETE SMS %s' % self.Id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self):\n self._queue.delete_message(self._message)",
"def delete_message(self): # TODO: UX, make sure the user wants to delete the message\n conn = self.controller.controller.get_conn()\n folder = self.inbox.get_folder()\n conn.select_folder(folder)\n messages = con... | [
"0.7966552",
"0.7834153",
"0.76258945",
"0.75126785",
"0.745382",
"0.73712194",
"0.7356561",
"0.73060024",
"0.72873014",
"0.7278134",
"0.7205096",
"0.7168436",
"0.71103483",
"0.7058771",
"0.70244277",
"0.7003916",
"0.6966556",
"0.6959094",
"0.694766",
"0.69203275",
"0.6844241... | 0.83938015 | 0 |
Chops initial words from a string and returns a list of them and the rest of the string. The returned list is guaranteed to be n+1 long. If too little words are found in the string, a ValueError exception is raised. | def chop(s, n=1, d=None):
spl = s.split(d, n)
if len(spl) == n:
spl.append(s[:0])
if len(spl) != n + 1:
raise ValueError('chop: Could not chop %d words from \'%s\'' % (n, s))
return spl | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subwords (w , n ):\n\tif n == 0:\n\t\treturn ['']\n\tif w == '':\n\t\treturn []\n\tr = [w[0] + x for x in w[1:]]\n\treturn r + subwords (w[1:] ,n)",
"def extract_words(s):\n new_list = [] # list container for list of words\n if has_dashdash:\n s = \" \".join(s.split(\"--\"))\n s = cleanword(s... | [
"0.6503069",
"0.6270612",
"0.61631846",
"0.607659",
"0.6075378",
"0.6066427",
"0.6037753",
"0.6020453",
"0.597678",
"0.59730184",
"0.5958801",
"0.5881463",
"0.5874463",
"0.5863541",
"0.58629376",
"0.5850854",
"0.58410895",
"0.5825377",
"0.5817542",
"0.58103275",
"0.5776268",
... | 0.6382342 | 1 |
Adds doublequotes to string if it contains spaces. | def quote(s, always=False):
if always or ' ' in s:
return '"%s"' % s.replace('"', '""') # VisualBasic double-quote escaping.
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addquotes(s):\n return '\"'+s+'\"'",
"def quote(self, s):\n return quote(s).replace('\"', '\"\"')",
"def quote_and_escape(string):\n if ' ' in string or '\\n' in string:\n string = '\"%s\"' % string.replace('\"', '\\\\\"')\n return string",
"def quote_needed(self,st... | [
"0.73989993",
"0.7278911",
"0.7235731",
"0.7156931",
"0.71360326",
"0.7002928",
"0.6765321",
"0.67493194",
"0.6703386",
"0.65974575",
"0.65636045",
"0.65501165",
"0.64985883",
"0.64758396",
"0.64663476",
"0.6466064",
"0.6458121",
"0.64373094",
"0.64142483",
"0.6374729",
"0.63... | 0.69933677 | 6 |
Generate a cartesian product of input arrays. | def cartesian(arrays, out=None):
arrays = [np.asarray(x) for x in arrays]
dtype = arrays[0].dtype
n = np.prod([x.size for x in arrays])
if out is None:
out = np.zeros([n, len(arrays)], dtype=dtype)
m = n / arrays[0].size
out[:, 0] = np.repeat(arrays[0], m)
if arrays[1:]:
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cartesian(arrays, out=None):\n\n arrays = [np.asarray(x) for x in arrays]\n dtype = arrays[0].dtype\n\n n = np.prod([x.size for x in arrays])\n if out is None:\n out = np.zeros([n, len(arrays)], dtype=dtype)\n\n m = n / arrays[0].size\n out[:,0] = np.repeat(arrays[0], m)\n if arrays... | [
"0.83172935",
"0.83010286",
"0.82991815",
"0.8288198",
"0.8288198",
"0.82225895",
"0.792778",
"0.779255",
"0.77028096",
"0.7469241",
"0.7411975",
"0.70708627",
"0.6994483",
"0.6880945",
"0.6880945",
"0.6728234",
"0.6728234",
"0.66799843",
"0.6512212",
"0.6511993",
"0.64892936... | 0.8276514 | 5 |
Test that failing to delete a project raises | def test_delete_fails(self):
self.req_delete.status_code = 400
self.req.content = self.project_content
self.gerrit_con.call.side_effect = [self.req, self.req_delete]
project = Project(self.gerrit_con)
project = project.get_project(self.PROJECT)
with self.assertRaises(Unh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_projects_delete(self):\n pass",
"def test_iam_project_delete(self):\n pass",
"def test_delete_project_task_bad(resource):\n user_id = resource\n proj = ProjectRepo.add_project(description=\"ProjectA\", user=user_id, tasks=[])\n task = TaskRepo.add_task(description=\"Task1\", use... | [
"0.8628316",
"0.8487887",
"0.80498004",
"0.8047547",
"0.7901445",
"0.7896836",
"0.78778493",
"0.7777678",
"0.7756004",
"0.7744264",
"0.7564436",
"0.7561303",
"0.75093335",
"0.74285376",
"0.7425647",
"0.7409539",
"0.73986346",
"0.7337165",
"0.7291953",
"0.72238445",
"0.7221247... | 0.842985 | 2 |
Every day in the month of May, 2020 | def get_date_partitions():
return [Partition(f"2020-05-{str(day).zfill(2)}") for day in range(1, 32)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_coding_today():\n day_of_month = datetime.datetime.today().day\n start_coding(day_of_month)",
"def increment_month(self):\n self.day_num = (self.day_num + self.days_in_month(self.date.month)) % 7\n if self.date.month < 12:\n self.date.month += 1\n else:\n ... | [
"0.62198114",
"0.6161184",
"0.6091117",
"0.60612184",
"0.6007243",
"0.5960513",
"0.5942036",
"0.59378505",
"0.59021735",
"0.5881",
"0.5859225",
"0.5849782",
"0.58403915",
"0.58402574",
"0.58402574",
"0.5810792",
"0.58071923",
"0.580495",
"0.5792989",
"0.5791298",
"0.5775141",... | 0.0 | -1 |
Returns ResourceArgument for working with instance group managers. | def GetInstanceGroupManagerArg(zones_flag=False, region_flag=True):
if zones_flag:
extra_region_info_about_zones_flag = (
'\n\nIf you specify `--zones` flag this flag must be unspecified '
'or specify the region to which the zones you listed belong.'
)
region_explanation = (flags.REGION_PR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: GroupArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def _get_instance_group(self):\n resp = self._compute_service.instances().get(\n project=self._project,\n zone=self._z... | [
"0.6036151",
"0.5888389",
"0.56448066",
"0.5595412",
"0.5497497",
"0.5497497",
"0.5497497",
"0.5497497",
"0.5497497",
"0.5497497",
"0.5497497",
"0.5497497",
"0.5470264",
"0.5470264",
"0.5470264",
"0.5470264",
"0.5470264",
"0.5470264",
"0.5470264",
"0.5470264",
"0.5470264",
... | 0.70148534 | 0 |
Transform for the PRESERVED_STATE field in the table output. PRESERVED_STATE is generated from the fields preservedStateFromPolicy and preservedStateFromConfig fields in the managedInstance message. | def _TransformPreservedState(instance):
preserved_state_value = ''
if ('preservedStateFromPolicy' in instance and
instance['preservedStateFromPolicy']):
preserved_state_value += 'POLICY,'
if ('preservedStateFromConfig' in instance and
instance['preservedStateFromConfig']):
preserved_state_valu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _preprocess_state(self, state) -> torch.Tensor:\n state = torch.FloatTensor(state).to(device)\n return state",
"def _preprocess( self, rawState ) :\n return rawState.copy()",
"def _preprocess_state(self, state: np.ndarray) -> torch.Tensor:\n state = torch.FloatTensor(state).to(d... | [
"0.58431137",
"0.57999843",
"0.5622391",
"0.54461753",
"0.5251397",
"0.5199802",
"0.51425785",
"0.5087213",
"0.5020109",
"0.49759537",
"0.49703774",
"0.49446848",
"0.49429104",
"0.4887629",
"0.48320767",
"0.48222664",
"0.482089",
"0.4802213",
"0.48010793",
"0.4792622",
"0.478... | 0.6643933 | 0 |
Converts type enum value to native value | def convert_to_native(cls, key_pair_type):
# type: (int) -> int
if key_pair_type in cls._TYPES_TO_NATIVE:
return cls._TYPES_TO_NATIVE[key_pair_type]
raise cls.UnknownTypeException(key_pair_type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ts_intenum_type(val):\n return int(val.value())",
"def python_value(self, value: T.Any) -> enum.Enum:\n return self._enum_class(value)",
"def normalize_user_enum_type(value: type) -> str:\n return value.__name__",
"def ConvertToTypeEnum(type_enum, airflow_executor_type):\n return type_enum(... | [
"0.70127285",
"0.678277",
"0.67193663",
"0.647056",
"0.6386056",
"0.6338037",
"0.62225425",
"0.62119246",
"0.6120864",
"0.6073218",
"0.60730714",
"0.60641474",
"0.6029512",
"0.6029359",
"0.6027504",
"0.60026103",
"0.5965394",
"0.59585464",
"0.5948483",
"0.5927788",
"0.5920883... | 0.5737169 | 38 |
Returns the act_window object created for the provided xml_id | def for_xml_id(self, cr, uid, module, xml_id, context=None):
dataobj = self.pool.get('ir.model.data')
data_id = dataobj._get_id (cr, SUPERUSER_ID, module, xml_id)
res_id = dataobj.browse(cr, uid, data_id, context).res_id
return self.read(cr, uid, [res_id], [], context)[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_active_window(disp, root, NET_ACTIVE_WINDOW):\n win_id = root.get_full_property(NET_ACTIVE_WINDOW,\n Xlib.X.AnyPropertyType).value[0]\n try:\n return disp.create_resource_object('window', win_id)\n except Xlib.error.XError:\n pass",
"def FindWindo... | [
"0.6553354",
"0.6015813",
"0.5865599",
"0.58091474",
"0.57332015",
"0.55600274",
"0.5464739",
"0.54224813",
"0.5393677",
"0.5386705",
"0.53642887",
"0.53395855",
"0.531611",
"0.52687323",
"0.5239134",
"0.5185729",
"0.5102525",
"0.50923413",
"0.5085643",
"0.50819564",
"0.50576... | 0.0 | -1 |
The recurrence start date. | def dtstart(self):
return self.rule._dtstart.date() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_date(self) -> date:\n return self._start_date",
"def start_date(self): \n return self._start_date",
"def start_date(self):\n return self._start_date",
"def start_date(self):\n return self._start_date",
"def start_date(self):\n return self._start_date",
... | [
"0.78079844",
"0.7741325",
"0.7698308",
"0.7698308",
"0.7698308",
"0.7698308",
"0.7654717",
"0.76431113",
"0.7619733",
"0.7606567",
"0.7461577",
"0.712898",
"0.70600885",
"0.7013816",
"0.70108134",
"0.6985851",
"0.6909548",
"0.6880619",
"0.6784539",
"0.67823756",
"0.6778246",... | 0.7487482 | 10 |
The weekdays where the recurrence will be applied. In RFC5545 this is called BYDAY, but is renamed by dateutil to avoid ambiguity. | def byweekday(self):
retval = []
if self.rule._byweekday:
retval += [Weekday(day) for day in self.rule._byweekday]
if self.rule._bynweekday:
retval += [Weekday(day, n) for day, n in self.rule._bynweekday]
return retval | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weekdays(self): \n\tdstart = self.startDate.date().toPyDate()\n\tdend = self.endDate.date().toPyDate()\n\tself._workdays = projex.dates.weekdays(dstart, dend)\n\treturn self._workdays",
"def get_weekdays(self):\n if self.ui_type != self.UI_TYPE_WEEKLY:\n raise ValueError(\"Expe... | [
"0.77235246",
"0.74893147",
"0.7482589",
"0.7071784",
"0.69508916",
"0.6780914",
"0.6680806",
"0.6583957",
"0.65637666",
"0.6562254",
"0.6553423",
"0.6550276",
"0.65278834",
"0.64559746",
"0.63738",
"0.63503015",
"0.62877107",
"0.62671846",
"0.6253634",
"0.62217444",
"0.62016... | 0.7028284 | 4 |
initializes clients variables based on hosts | def clients_initialize(self):
self.kafka = self.net.get('h1')
self.zookeeper = self.net.get('h2')
self.fuse_kafka = self.net.get('h3')
self.client = self.net.get('h4')
self.hosts = [self.kafka, self.zookeeper, self.fuse_kafka, self.client]
self.switch = self.net.get('s1')... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_host(self):\n pass",
"def setup_client(client_obj):\n global _CLIENT\n var_dict = globals()\n\n _CLIENT = client_obj\n var_dict['set_servers'] = _CLIENT.set_servers\n var_dict['disconnect_all'] = _CLIENT.disconnect_all\n var_dict['forget_dead_hosts'] = _CLIENT.forget_dead_hosts\n var_dict[... | [
"0.7039396",
"0.6894743",
"0.68515325",
"0.6755783",
"0.6738862",
"0.66926193",
"0.66200125",
"0.65873057",
"0.64101136",
"0.63963974",
"0.6371826",
"0.6317961",
"0.62981474",
"0.62818587",
"0.62698066",
"0.6247027",
"0.6221633",
"0.6212807",
"0.62005764",
"0.6191124",
"0.615... | 0.8016885 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.