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 |
|---|---|---|---|---|---|---|
Finds unique clones among a paired sequence dataset. | def identifyClones(psDf, min_quality_for_singletons=20, average_clone_scores=[], none_score_for_averaging=9.6):
clonesDf = findClones(psDf,
min_quality_for_singletons=min_quality_for_singletons,
average_clone_scores=average_clone_scores,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duplicates(self, tuples):\n b, k, l, r = tuples.size()\n\n primes = self.primes[:r]\n primes = primes[None, None, None, :].expand(b, k, l, r)\n unique = ((tuples+1) ** primes).prod(dim=3) # unique identifier for each tuple\n\n sorted, sort_idx = torch.sort(unique, dim=2)\n ... | [
"0.60576683",
"0.59921503",
"0.59548444",
"0.59344554",
"0.5900003",
"0.58835095",
"0.5868912",
"0.58574486",
"0.5827164",
"0.57431567",
"0.57222706",
"0.56882215",
"0.5662213",
"0.5647122",
"0.5627986",
"0.5599876",
"0.5553651",
"0.55454904",
"0.55207324",
"0.55196273",
"0.5... | 0.61568564 | 0 |
Create a dataset from a list of local Python objects. | def from_items(items: List[Any], *, parallelism: int = -1) -> Dataset[Any]:
detected_parallelism, _ = _autodetect_parallelism(
parallelism,
ray.util.get_current_placement_group(),
DatasetContext.get_current(),
)
block_size = max(
1,
len(items) // detected_parallelism... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateDataset(all_arrays):\n dataset = Dataset()\n\n dataset._addData(all_arrays[0])\n dataset._addData(all_arrays[1])\n dataset._addData(all_arrays[3])\n dataset._addData(all_arrays[5])\n dataset._addData(all_arrays[6])\n dataset._addData(all_arrays[9])\n dataset._addData(all_arrays[8]... | [
"0.6823545",
"0.65861756",
"0.630273",
"0.6279511",
"0.62467515",
"0.6150686",
"0.6108871",
"0.60931253",
"0.60836685",
"0.6019058",
"0.5947708",
"0.5923547",
"0.5883531",
"0.58340114",
"0.58072895",
"0.57906723",
"0.5789662",
"0.57549566",
"0.57401013",
"0.5725386",
"0.56912... | 0.5622586 | 27 |
Read a dataset from a custom data source. | def read_datasource(
datasource: Datasource[T],
*,
parallelism: int = -1,
ray_remote_args: Dict[str, Any] = None,
**read_args,
) -> Dataset[T]:
ctx = DatasetContext.get_current()
if ray_remote_args is None:
ray_remote_args = {}
local_uri = False
paths = read_args.get("paths... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_dataset(dataset_name):\n url = METADATA[dataset_name][\"url\"]\n f = urlopen(url)\n data = _read_rows(f)\n f.close()\n return data",
"def DataReader(name, data_source=None, start=None, end=None,\n retry_count=3, pause=0.001, session=None, access_key=None):\n if data_sourc... | [
"0.6465696",
"0.63246596",
"0.63223606",
"0.6222079",
"0.61951244",
"0.6180791",
"0.6180791",
"0.6180791",
"0.6165846",
"0.6140465",
"0.6131076",
"0.61154026",
"0.60848093",
"0.6043491",
"0.600465",
"0.60002077",
"0.5996348",
"0.5958436",
"0.5943675",
"0.5933759",
"0.59263337... | 0.7017197 | 0 |
Create an Arrow dataset from parquet files. | def read_parquet(
paths: Union[str, List[str]],
*,
filesystem: Optional["pyarrow.fs.FileSystem"] = None,
columns: Optional[List[str]] = None,
parallelism: int = -1,
ray_remote_args: Dict[str, Any] = None,
tensor_column_schema: Optional[Dict[str, Tuple[np.dtype, Tuple[int, ...]]]] = None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_multi_parquet():\n files = glob.glob('temp/*.parquet')\n df = pd.concat([pd.read_parquet(fp) for fp in files])\n return df",
"def from_parquet(cls,parquet_dir,timeSeriesCol,mainCategoryCol,columns = None,partitioning='hive',filters=None,filesystem=None):\n data = io.from_parquet(\n ... | [
"0.707575",
"0.621947",
"0.6133608",
"0.6098686",
"0.6045842",
"0.5963872",
"0.59372586",
"0.59082085",
"0.58851445",
"0.58792883",
"0.5864182",
"0.58536094",
"0.58383495",
"0.58167803",
"0.58096987",
"0.5762728",
"0.57181257",
"0.57097375",
"0.56646276",
"0.56598854",
"0.564... | 0.5951726 | 6 |
Create an Arrow dataset from json files. | def read_json(
paths: Union[str, List[str]],
*,
filesystem: Optional["pyarrow.fs.FileSystem"] = None,
parallelism: int = -1,
ray_remote_args: Dict[str, Any] = None,
arrow_open_stream_args: Optional[Dict[str, Any]] = None,
meta_provider: BaseFileMetadataProvider = DefaultFileMetadataProvider(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_file(filename):\n with open(filename, 'rt') as f:\n d = json.load(f)\n return pd.DataFrame.from_records(d['dataset'])",
"def get_asr_dataset_from_json(data_json_path, tgt_dict):\r\n if not os.path.isfile(data_json_path):\r\n raise FileNotFoundError(\"Dataset not found: {}\".format... | [
"0.65280765",
"0.6421036",
"0.64177555",
"0.6270845",
"0.62420803",
"0.6194555",
"0.61443186",
"0.60581344",
"0.6022597",
"0.5960402",
"0.59316725",
"0.59130794",
"0.5886452",
"0.5866082",
"0.5836983",
"0.58264613",
"0.5819487",
"0.58127254",
"0.5808198",
"0.5808038",
"0.5804... | 0.54929 | 64 |
Create a dataset from a Dask DataFrame. | def from_dask(df: "dask.DataFrame") -> Dataset[ArrowRow]:
import dask
from ray.util.dask import ray_dask_get
partitions = df.to_delayed()
persisted_partitions = dask.persist(*partitions, scheduler=ray_dask_get)
import pandas
def to_ref(df):
if isinstance(df, pandas.DataFrame):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_dataset(self, df, **kwargs):\n\t\treturn df",
"def to_dataset(df, batch_size=5):\n df = df.copy()\n labels = df.pop('Relevant')\n ds = tf.data.Dataset.from_tensor_slices((dict(df), labels))\n ds = ds.batch(batch_size)\n return ds",
"def from_dask(cls, dask_schema):\n return cls.from_pandas... | [
"0.7358074",
"0.71884704",
"0.7148657",
"0.7032926",
"0.67411435",
"0.6609532",
"0.6466937",
"0.6466937",
"0.6390665",
"0.63478494",
"0.6343732",
"0.6320492",
"0.6295609",
"0.6224059",
"0.62093985",
"0.61777514",
"0.6176935",
"0.61739504",
"0.61604214",
"0.615397",
"0.6104097... | 0.738469 | 0 |
Create a dataset from a list of NumPy ndarrays. | def from_numpy(ndarrays: Union[np.ndarray, List[np.ndarray]]) -> Dataset[ArrowRow]:
if isinstance(ndarrays, np.ndarray):
ndarrays = [ndarrays]
return from_numpy_refs([ray.put(ndarray) for ndarray in ndarrays]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateDataset(all_arrays):\n dataset = Dataset()\n\n dataset._addData(all_arrays[0])\n dataset._addData(all_arrays[1])\n dataset._addData(all_arrays[3])\n dataset._addData(all_arrays[5])\n dataset._addData(all_arrays[6])\n dataset._addData(all_arrays[9])\n dataset._addData(all_arrays[8]... | [
"0.73530215",
"0.6588379",
"0.6378847",
"0.6375847",
"0.6340084",
"0.63386816",
"0.63354266",
"0.6312542",
"0.62362945",
"0.6206093",
"0.6190065",
"0.61899257",
"0.61268455",
"0.61268455",
"0.60350126",
"0.59286946",
"0.5926574",
"0.58916944",
"0.5879859",
"0.5868182",
"0.586... | 0.7541424 | 0 |
Create a dataset from a Hugging Face Datasets Dataset. This function is not parallelized, and is intended to be used with Hugging Face Datasets that are loaded into memory (as opposed to memorymapped). | def from_huggingface(
dataset: Union["datasets.Dataset", "datasets.DatasetDict"],
) -> Union[Dataset[ArrowRow], Dict[str, Dataset[ArrowRow]]]:
import datasets
def convert(ds: "datasets.Dataset") -> Dataset[ArrowRow]:
return from_arrow(ds.data.table)
if isinstance(dataset, datasets.DatasetDict)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_hff(cls, hff_data, name=None, args=None):\n assert isinstance(hff_data, h5py.Dataset)\n obj = cls()\n [obj.append(_decode(_, u'utf-8')) for _ in hff_data]\n return obj",
"def from_hff(cls, hff_data, name=None, args=None):\n assert isinstance(hff_data, h5py.Dataset)\n ... | [
"0.60441357",
"0.60441357",
"0.60296017",
"0.60139734",
"0.5984552",
"0.59628016",
"0.5959609",
"0.5957469",
"0.5929263",
"0.59155",
"0.5904758",
"0.589037",
"0.5848701",
"0.58384186",
"0.582297",
"0.5816806",
"0.5760641",
"0.5759153",
"0.5756531",
"0.5735877",
"0.5719885",
... | 0.6471192 | 0 |
Instantiates the EfficientNet architecture using given scaling coefficients. | def EfficientNet(
width_coefficient,
depth_coefficient,
default_size,
dropout_rate=0.2,
drop_connect_rate=0.2,
depth_divisor=8,
activation='swish',
blocks_args='default',
model_name='efficientnet',
include_top=True,
weights='imagenet',
input_tensor=None,
input_shape=N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_efficientnet(num_classes: int) -> nn.Module:\n\n return EfficientNet.from_pretrained('efficientnet-b1', num_classes=num_classes)",
"def __init__(self, N_sym, n_nodes, activations, N_element, bias = True, scaling = None):\n super(MultiLayerNet, self).__init__()\n N_layers = len(n_nodes)\... | [
"0.66589063",
"0.65698916",
"0.60615736",
"0.59958917",
"0.59809524",
"0.59148216",
"0.59029317",
"0.5887401",
"0.58383644",
"0.57837945",
"0.5755983",
"0.5754037",
"0.57467085",
"0.57235754",
"0.5709849",
"0.56962144",
"0.5676469",
"0.56738925",
"0.5663758",
"0.5657895",
"0.... | 0.5724099 | 13 |
Round number of repeats based on depth multiplier. | def round_repeats(repeats):
return int(math.ceil(depth_coefficient * repeats)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _round_repeats(self, repeats):\n return int(math.ceil(self.depth_coefficient * repeats))",
"def _round_repeats(self, repeats, depth_coefficient):\n\n if not depth_coefficient:\n return repeats\n\n return int(math.ceil(depth_coefficient * repeats))",
"def round_repeats(repeats, depth_coeff... | [
"0.8876546",
"0.86348873",
"0.8589512",
"0.85847086",
"0.8439529",
"0.83897537",
"0.83897537",
"0.83897537",
"0.8308418",
"0.77939695",
"0.6887175",
"0.6887175",
"0.6861657",
"0.6199542",
"0.6199542",
"0.6029677",
"0.5980465",
"0.59490407",
"0.59474444",
"0.5848384",
"0.58335... | 0.87485105 | 1 |
Randomly generates a username, similar to stackoverflow. This provides a sample space of 89,999,999 possible outcomes. | def generate_username():
while True:
new_user_id = "user-" + str(random.randrange(10000000, 99999999))
try:
user = DjangoDev.objects.get(username=new_user_id)
except DjangoDev.DoesNotExist:
return new_user_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_username():\n return ''.join(choice(ascii_letters + digits) for _ in range(15))",
"def random_username():\n return str(uuid.uuid4().hex.upper())",
"def computer_username():\r\n\t#possible username the computer can have\r\n\tusernames = ['bella_123','$lade(99)','BADOO_0!','V1rus**',\t\t\r\n\t... | [
"0.81882167",
"0.74550086",
"0.74139214",
"0.7412845",
"0.72204286",
"0.71873033",
"0.71788776",
"0.7160787",
"0.70311683",
"0.7024956",
"0.6956349",
"0.68754274",
"0.68572825",
"0.68242186",
"0.6793649",
"0.67547566",
"0.67403233",
"0.67166245",
"0.67153794",
"0.670786",
"0.... | 0.6637569 | 24 |
Determines whether an admin can view the settings for an app | def has_module_perms(self, app_label):
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin(context):\n request = context[\"request\"]\n url = resolve(request.path)\n context['is_admin'] = False\n return url.app_name == 'admin'",
"def is_admin(self):\r\n return self.admin",
"def is_admin(self):\n return self.admin",
"def _is_admin_only(self, pvm: PermissionVie... | [
"0.7197825",
"0.71421736",
"0.7014749",
"0.6962591",
"0.69085276",
"0.6825112",
"0.6808583",
"0.6753598",
"0.6745955",
"0.67347515",
"0.671795",
"0.6715743",
"0.6714295",
"0.6672859",
"0.66663957",
"0.66574913",
"0.66574913",
"0.6647589",
"0.66296035",
"0.661449",
"0.65853405... | 0.5887702 | 99 |
This is helper function for minimax Max_value (self, game, depth) | def max_value(self, game, depth):
# Timeout Check
if self.time_left() < self.TIMER_THRESHOLD:
raise SearchTimeout()
# Get legal moves
valid_moves = game.get_legal_moves()
# Best possible score -> initiated at -inf, the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _max_value(\r\n self,\r\n state: TwoPlayerGameState,\r\n depth: int,\r\n ) -> float:\r\n if state.end_of_game or depth == 0:\r\n minimax_value = self.heuristic.evaluate(state)\r\n\r\n else:\r\n minimax_value = -np.inf\r\n\r\n successors = s... | [
"0.8227087",
"0.7967682",
"0.79274863",
"0.79223716",
"0.78081375",
"0.780729",
"0.77446705",
"0.768548",
"0.7676947",
"0.7627913",
"0.7621513",
"0.761593",
"0.7600196",
"0.748576",
"0.7467021",
"0.7453619",
"0.74163014",
"0.7396493",
"0.73643297",
"0.73597264",
"0.73415375",... | 0.7500422 | 13 |
Add a MessageChain to the internal list for the given request ID. | def add_message_chain(self, request_id, message_chain):
logger.debug('request_id = %s' % request_id)
with self._message_chains_lock:
self._message_chains[request_id] = message_chain | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_message(self, message):\n if message['message_id'] in self.message_ids:\n return\n self.message_ids.append(message['message_id'])\n self.messages.append(message)",
"def add_message(self, message):\n self.message_list.append(message)",
"def remove_message_chain(... | [
"0.5982852",
"0.5875561",
"0.56743115",
"0.55958617",
"0.55825657",
"0.5526259",
"0.55260205",
"0.5498304",
"0.54431385",
"0.5434903",
"0.5410539",
"0.5391618",
"0.5315123",
"0.5288119",
"0.5248552",
"0.5224282",
"0.52231395",
"0.52214056",
"0.52062374",
"0.5164818",
"0.51402... | 0.8448856 | 0 |
User can create comment | def test_user_can_comment_on_article_data(self):
token1 = self.create_user(VALID_USER_DATA)
response = self.create_article(VALID_ARTICLE, token1)
response = self.create_comment(
token=token1,
parentId=0,
slug=response.data['article']['slug']
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_create_comments(self):\n # Implemented from template for\n # osid.resource.ResourceAdminSession.can_create_resources\n # NOTE: It is expected that real authentication hints will be\n # handled in a service adapter above the pay grade of this impl.\n return True",
"def u... | [
"0.73534185",
"0.71073604",
"0.6907783",
"0.69026345",
"0.67875063",
"0.67704207",
"0.6717905",
"0.6711686",
"0.6630874",
"0.6620413",
"0.66140383",
"0.66135705",
"0.658712",
"0.65367806",
"0.6512923",
"0.6489898",
"0.6424495",
"0.6360928",
"0.6359878",
"0.6357088",
"0.633078... | 0.6637901 | 8 |
user can get comments for an article | def test_user_can_get_comments_for_an_article(self):
token1 = self.create_user(VALID_USER_DATA)
response = self.create_article(VALID_ARTICLE, token1)
response = self.create_comment(
token=token1,
parentId=0,
slug=response.data['article']['slug']
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_object(self, article_id):\n try:\n comments = Comment.objects.all()\n #filter to only contain comments for specified article (article_id)\n comments = list(filter(lambda x: x.article_id == article_id , comments))\n return comments\n except Comment.D... | [
"0.7051459",
"0.7011194",
"0.6828945",
"0.67730135",
"0.67639273",
"0.647759",
"0.6316718",
"0.6151316",
"0.6119812",
"0.6088404",
"0.60635614",
"0.5980794",
"0.59584194",
"0.5949022",
"0.5934125",
"0.5932308",
"0.5923707",
"0.5905992",
"0.5903777",
"0.58925235",
"0.58722794"... | 0.78564686 | 0 |
user can delete comments for an article | def test_user_can_delete_their_comment(self):
token = self.create_user(VALID_USER_DATA)
response = self.create_article(VALID_ARTICLE, token)
response = self.create_comment(
token=token,
parentId=0,
slug=response.data['article']['slug']
)
get_co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_comments(self, pk):\n try:\n comments = Comment.objects.all()\n # filter to only contain comments for specified article (article_id)\n comments = list(filter(lambda x: x.article_id == pk, comments))\n\n #loop through and delete all comments\n ... | [
"0.724776",
"0.71893334",
"0.7097344",
"0.69964445",
"0.6952778",
"0.6936803",
"0.68999505",
"0.6801651",
"0.67899805",
"0.6717094",
"0.6655033",
"0.6592393",
"0.6590674",
"0.65445375",
"0.6513937",
"0.64832425",
"0.64586824",
"0.6398616",
"0.63897127",
"0.638828",
"0.6374779... | 0.7676523 | 0 |
user can delete comments for an article | def test_invalid_user_can_delete_a_comment(self):
token = self.create_user(VALID_USER_DATA)
response = self.create_article(VALID_ARTICLE, token)
response = self.create_comment(
token=token,
parentId=0,
slug=response.data['article']['slug']
)
to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_can_delete_their_comment(self):\n token = self.create_user(VALID_USER_DATA)\n response = self.create_article(VALID_ARTICLE, token)\n response = self.create_comment(\n token=token,\n parentId=0,\n slug=response.data['article']['slug']\n )\n ... | [
"0.7676523",
"0.724776",
"0.7097344",
"0.69964445",
"0.6952778",
"0.6936803",
"0.68999505",
"0.6801651",
"0.67899805",
"0.6717094",
"0.6655033",
"0.6592393",
"0.6590674",
"0.65445375",
"0.6513937",
"0.64832425",
"0.64586824",
"0.6398616",
"0.63897127",
"0.638828",
"0.63747793... | 0.71893334 | 2 |
user can update their comments for an article | def test_user_can_update_their_comment(self):
token = self.create_user(VALID_USER_DATA)
response = self.create_article(VALID_ARTICLE, token)
response = self.create_comment(
token=token,
parentId=0,
slug=response.data['article']['slug']
)
get_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_update_comments(self):\n # Implemented from template for\n # osid.resource.ResourceAdminSession.can_update_resources\n # NOTE: It is expected that real authentication hints will be\n # handled in a service adapter above the pay grade of this impl.\n return True",
"def t... | [
"0.6694878",
"0.6580968",
"0.6578074",
"0.65608335",
"0.65161645",
"0.642181",
"0.638465",
"0.6338328",
"0.6323572",
"0.6308092",
"0.62434256",
"0.6221932",
"0.6188669",
"0.6147377",
"0.6136802",
"0.60883176",
"0.6087288",
"0.6085069",
"0.6055377",
"0.6050128",
"0.60483855",
... | 0.70312065 | 0 |
user can update their comments for an article | def test_user_can_update_their_comment_with_same_data(self):
token = self.create_user(VALID_USER_DATA)
response = self.create_article(VALID_ARTICLE, token)
response = self.create_comment(
token=token,
parentId=0,
slug=response.data['article']['slug']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_can_update_their_comment(self):\n token = self.create_user(VALID_USER_DATA)\n response = self.create_article(VALID_ARTICLE, token)\n\n response = self.create_comment(\n token=token,\n parentId=0,\n slug=response.data['article']['slug']\n )\... | [
"0.70308316",
"0.6695347",
"0.6577459",
"0.6561423",
"0.65155995",
"0.6422868",
"0.63844866",
"0.63376933",
"0.63247895",
"0.63083524",
"0.6243982",
"0.62212867",
"0.61888796",
"0.6146989",
"0.6136901",
"0.6086613",
"0.6086242",
"0.6083473",
"0.60561824",
"0.6050084",
"0.6046... | 0.6580498 | 2 |
invalid user can delete comments for an article | def test_invalid_user_can_update_comment(self):
token = self.create_user(VALID_USER_DATA)
response = self.create_article(VALID_ARTICLE, token)
response = self.create_comment(
token=token,
parentId=0,
slug=response.data['article']['slug']
)
tok... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_user_can_delete_a_comment(self):\n token = self.create_user(VALID_USER_DATA)\n response = self.create_article(VALID_ARTICLE, token)\n response = self.create_comment(\n token=token,\n parentId=0,\n slug=response.data['article']['slug']\n ... | [
"0.7825106",
"0.7348943",
"0.6889742",
"0.6884852",
"0.6843844",
"0.6756067",
"0.66402996",
"0.6625607",
"0.649844",
"0.6450402",
"0.6436491",
"0.64173794",
"0.6414768",
"0.64118475",
"0.63921046",
"0.6387599",
"0.6379932",
"0.63682514",
"0.63521945",
"0.6339108",
"0.63061464... | 0.6526321 | 8 |
User can retrieve comments of invalid article | def test_user_can_get_comments_of_invalid_article(self):
token = self.create_user(VALID_USER_DATA)
response = self.create_article(VALID_ARTICLE, token)
response = self.create_comment(
token=token,
parentId=0,
slug=response.data['article']['slug']
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_can_get_comments_for_an_article(self):\n token1 = self.create_user(VALID_USER_DATA)\n response = self.create_article(VALID_ARTICLE, token1)\n response = self.create_comment(\n token=token1, \n parentId=0,\n slug=response.data['article']['slug']\n ... | [
"0.72780085",
"0.6803199",
"0.67557496",
"0.65182453",
"0.64307",
"0.64246607",
"0.6372403",
"0.6340008",
"0.6311736",
"0.62324345",
"0.6209545",
"0.61896634",
"0.61834466",
"0.6164329",
"0.6134414",
"0.60954946",
"0.60302156",
"0.6023688",
"0.5990243",
"0.5972506",
"0.594815... | 0.8203984 | 0 |
Gets all the model instances. | def all_model_instances(self) -> Iterator['panda_core_data.model.Model']:
for current_type in self.all_models:
for current_instance in current_type.all_instances:
yield current_instance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_all_records(self) -> List[DBModelInstance]:\n return self.model.query.all()",
"def get_all(cls):\n return DataStore.get_all_instance(cls)",
"def iter_models(self):\n return iter(self.model_list)",
"def get_models(self):\n self.load()\n return self._models",
"def ... | [
"0.7698019",
"0.7503729",
"0.7334518",
"0.7277576",
"0.7223713",
"0.72139347",
"0.7193906",
"0.7129815",
"0.7070198",
"0.7070198",
"0.7070198",
"0.7070198",
"0.7070198",
"0.7070198",
"0.70472",
"0.7039465",
"0.7001101",
"0.6997673",
"0.6991649",
"0.68915975",
"0.6820305",
"... | 0.801359 | 0 |
return the firewall Rules as a string | def to_string(self):
return str(vars(self)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__ (self) :\n\t\ttext_rule = \"\"\n\t\t\n\t\tfor key, rules in self.production_rules.items() :\n\t\t\ttext_rule += \"\\nRULE \" + key + \" = [\\n\\t\"\n\t\t\trule_in_a_line = []\n\t\t\tfor rule in rules :\n\t\t\t\t#rule_in_a_line.append(\" + \".join([r.val+\"(\"+r.type+\")\" for r in rule]))\n\t\t\t\trule... | [
"0.7167848",
"0.6925633",
"0.6825531",
"0.675393",
"0.6491027",
"0.6374184",
"0.6251518",
"0.6129292",
"0.60597414",
"0.6010541",
"0.5944472",
"0.59331536",
"0.58631897",
"0.5845111",
"0.5735386",
"0.57257587",
"0.57157934",
"0.56913376",
"0.5680103",
"0.564046",
"0.5638087",... | 0.0 | -1 |
Return the name of the Rules instance. | def get_name(self):
return self.tagnode | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rule_name(self) -> str:\n return pulumi.get(self, \"rule_name\")",
"def rule_name(self) -> str:\n return pulumi.get(self, \"rule_name\")",
"def rule_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"rule_name\")",
"def rule_name(self) -> pulumi.Input[str]:\n return... | [
"0.78265125",
"0.78265125",
"0.7665208",
"0.73805165",
"0.72213143",
"0.70199686",
"0.70150244",
"0.6955745",
"0.6919932",
"0.690874",
"0.6895472",
"0.6895472",
"0.6895472",
"0.6895472",
"0.6895472",
"0.6868361",
"0.6867869",
"0.68349814",
"0.68336403",
"0.6814947",
"0.681494... | 0.0 | -1 |
Add source address to Rule. If the packet matches this then the action is taken. | def add_source_address(self, srcAddr):
self.source.address = srcAddr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_source(self, source: _Source) -> None:\n\n self._sources.append(source)",
"def _add_source_net_filter(self, rule_list, source_net):\n for rule in rule_list:\n if (\"source\" in rule.keys()):\n if (\"nets\" in rule[\"source\"].keys()):\n rule[\"s... | [
"0.6147156",
"0.6041207",
"0.600631",
"0.59983796",
"0.59466434",
"0.5875135",
"0.582798",
"0.5818522",
"0.5730725",
"0.57222754",
"0.5713313",
"0.57097584",
"0.569038",
"0.5674645",
"0.5668545",
"0.56297374",
"0.55851746",
"0.5569822",
"0.5554489",
"0.5545913",
"0.5456151",
... | 0.7249079 | 1 |
Flatten the given event by preassociating format fields with specific objects and callable results in a L{dict} put into the C{"log_flattened"} key in the event. | def flattenEvent(event: LogEvent) -> None:
if event.get("log_format", None) is None:
return
if "log_flattened" in event:
fields = event["log_flattened"]
else:
fields = {}
keyFlattener = KeyFlattener()
for (literalText, fieldName, formatSpec, conversion) in aFormatter.parse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatFormat(event: LogEvent) -> str:\n fieldValues = event[\"log_flattened\"]\n keyFlattener = KeyFlattener()\n s = []\n\n for literalText, fieldName, formatSpec, conversion in aFormatter.parse(\n event[\"log_format\"]\n ):\n s.append(literalText)\n\n if fieldName is not None... | [
"0.6760659",
"0.65010715",
"0.5891237",
"0.58312917",
"0.57149434",
"0.5618122",
"0.55652946",
"0.5552419",
"0.55145985",
"0.5493505",
"0.54799795",
"0.52787995",
"0.5243208",
"0.5241175",
"0.51138145",
"0.5099614",
"0.5053237",
"0.49583116",
"0.4888975",
"0.48837164",
"0.483... | 0.7920332 | 0 |
Prune entries in the given dict with falsey values. Boto3 may not like None and instead wants no key. | def prune(bushy: dict) -> dict:
pruned = dict()
for key in bushy:
if bushy[key]:
pruned[key] = bushy[key]
return pruned | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keepers(d: dict) -> dict:\n keep = {k: v for k, v in d.items() if v is not None}\n return keep",
"def remove_none_values(dict_):\r\n\r\n res = {}\r\n res.update((key, value) for key, value in dict_.iteritems() \\\r\n if value is not None)\r\n return res",
"def remove_empty_val... | [
"0.7174196",
"0.70920944",
"0.69523466",
"0.68528444",
"0.68021727",
"0.67931503",
"0.6781738",
"0.6750018",
"0.6738934",
"0.66986066",
"0.66560835",
"0.6597756",
"0.6579644",
"0.65269256",
"0.6515384",
"0.64823204",
"0.6460439",
"0.6446995",
"0.6401885",
"0.63992894",
"0.638... | 0.64683336 | 16 |
Function convert sentences into tokens, normalizes case,, strip trailing and preceding whitespaces and removes puntuations and stop words | def tokenize(text):
#regular expression to avoid pucntuations or any special character
tokenizer = nltk.RegexpTokenizer(r"\w+")
#tokenizing text
tokens = tokenizer.tokenize(text)
#initiating lemmatizer
lemmatizer = WordNetLemmatizer()
#iteratating through each token
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess_sentence(raw):\r\n\t\r\n\t# raw = re.sub(r\"[\\x80-\\xff]\",\" \",raw)\r\n\t\r\n\traw = regex_punct.sub(' ',raw)\r\n\traw = raw.strip()\r\n\traw = raw.lower()\r\n\t\r\n\twords = nltk.word_tokenize(raw)\r\n\twords = [replace_punctuation(w) for w in words if not w in stopwords and len(w) > 1]\r\n\t\r\... | [
"0.73411524",
"0.73175305",
"0.71133167",
"0.70377165",
"0.7036197",
"0.7021909",
"0.6999944",
"0.69758457",
"0.69756293",
"0.69736433",
"0.6956072",
"0.69387716",
"0.690078",
"0.688363",
"0.68614256",
"0.6858483",
"0.68561226",
"0.6843117",
"0.68379456",
"0.68379456",
"0.683... | 0.66710526 | 50 |
Convert vector to one hot form. | def to_one_hot(v):
n = len(v)
m = max(v) + 1
out = np.zeros((n, m))
out[np.arange(n), v] = 1
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_onehot(vector, num_classes=None):\n assert isinstance(vector, np.ndarray)\n assert len(vector) > 0\n\n if num_classes is None:\n num_classes = np.max(vector)+1\n else:\n assert num_classes > 0\n assert num_classes >= np.max(vector)\n\n result = np.zeros(shape=(len... | [
"0.8490456",
"0.8103757",
"0.79804724",
"0.7954823",
"0.78555137",
"0.7808817",
"0.7680536",
"0.7607491",
"0.75317764",
"0.7527006",
"0.75106126",
"0.75083894",
"0.74944246",
"0.74725986",
"0.7460844",
"0.7426176",
"0.741461",
"0.7379436",
"0.7379436",
"0.7379436",
"0.7368112... | 0.86740214 | 0 |
Function used to get the DOI of a dataset | def get_dataset_doi(dataset):
token = get_access_token()
dataset_id = get_dataset_id(token, dataset)
try:
doi_request = requests.get(f"{PENNSIEVE_URL}/datasets/{dataset_id}/doi", headers=create_request_headers(token))
if doi_request.status_code == 404:
return {"doi": "No DOI fou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doi(self):\n return LiteratureReader(self.record).doi",
"def get_doi(self):\n\n return self._dois",
"def reserve_dataset_doi(dataset): # sourcery skip: extract-method\n token = get_access_token()\n\n dataset_id = get_dataset_id(token, dataset)\n\n try:\n doi_request = request... | [
"0.73552567",
"0.69396996",
"0.6604417",
"0.6594884",
"0.65387887",
"0.6488872",
"0.61606026",
"0.6082726",
"0.6056956",
"0.60264283",
"0.6021914",
"0.5995704",
"0.59292525",
"0.58887255",
"0.5885538",
"0.588378",
"0.58447045",
"0.5810868",
"0.5791774",
"0.5773025",
"0.574856... | 0.7856116 | 0 |
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes. | def add_header(response):
response.headers['Authorization'] = response
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response",
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, m... | [
"0.82238686",
"0.8223043",
"0.8223043",
"0.8223043",
"0.8223043",
"0.81963",
"0.81638503",
"0.81638503",
"0.81638503",
"0.81638503",
"0.81638503",
"0.81638503",
"0.81638503",
"0.81638503",
"0.81638503",
"0.81638503",
"0.81638503",
"0.81638503",
"0.81638503",
"0.81638503",
"0.... | 0.0 | -1 |
Render website's home page. | def home():
return render_template('home.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_home():\r\n\treturn render_template(\"index.html\")",
"def home():\n return render_template('homepage.html')",
"def home():\n\n return render_template('home_page.html')",
"def homepage():\n return render_template('home/index.html', \n title=\"Bem vindo!\")",
"... | [
"0.8724249",
"0.85791856",
"0.850329",
"0.84860355",
"0.84612614",
"0.84362435",
"0.8429879",
"0.8419578",
"0.8396612",
"0.8396612",
"0.8374868",
"0.8356488",
"0.8350785",
"0.8340763",
"0.8340763",
"0.8336323",
"0.8330013",
"0.8329599",
"0.8325031",
"0.8317146",
"0.8293699",
... | 0.83374727 | 30 |
Render website's contact page. | def contact():
if request.method == 'POST':
send_email()
return "" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact():\n return render_template('contact.html')",
"def contact():\n\n\treturn render_template('contact.html', title='Contact',\n\t\t\t\t\t\t year=datetime.now().year,\n\t\t\t\t\t\t message='Your contact page.')",
"def contact():\n return render_template(\n 'contact.html',\n titl... | [
"0.8486234",
"0.8427357",
"0.8355819",
"0.83289754",
"0.83289754",
"0.8325889",
"0.8320788",
"0.8303996",
"0.8303996",
"0.8303996",
"0.8303996",
"0.8303996",
"0.8303996",
"0.8303996",
"0.8303996",
"0.82898635",
"0.8285032",
"0.8090465",
"0.8085386",
"0.7988422",
"0.79631776",... | 0.0 | -1 |
Sets the velocity at infinity. The flow is assumed to be parallel to the axis (Ox) | def __init__(self, Vinf):
self.Vinf = Vinf | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def velocity(self, X, Y):\n self.u = self.Vinf * np.ones_like(X)\n self.v = np.zeros_like(X)",
"def set_velocity_x(self):\n self.__dx *= -1",
"def set_velocity(self):\r\n if self.direction == 'left':\r\n self.x_vel = -2\r\n else:\r\n self.x_vel = 2\r\n\r... | [
"0.69070625",
"0.68373597",
"0.6734147",
"0.6416528",
"0.62942535",
"0.6291796",
"0.6244044",
"0.60851115",
"0.60759264",
"0.60389876",
"0.6026524",
"0.60061055",
"0.5964982",
"0.59556305",
"0.59333664",
"0.590238",
"0.5832856",
"0.58325326",
"0.5805494",
"0.5773547",
"0.5760... | 0.0 | -1 |
Test that the repr. of the class is a string. | def test_baseclass_attrs_type(self):
base_class = BaseModel()
cn = base_class.__class__.__name__
idn = base_class.id
attrs = base_class.__dict__
self.assertTrue(type(cn), str)
self.assertTrue(type(id), str)
self.assertDictEqual(attrs, base_class.__dict__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_is_str_rep_string(self):\n self.assertIsInstance(cardutils.Card(10,1).__str__(), str)",
"def test_str():\n # Test for string special method with scalar Rnode objects\n x = Rnode(1.0)\n try:\n assert str(x) == 'Reverse-mode Rnode Object ( Values: 1.0 )'\n except AssertionError a... | [
"0.77971935",
"0.74566096",
"0.7306285",
"0.7226716",
"0.720409",
"0.7159156",
"0.7136195",
"0.7135593",
"0.71326333",
"0.70972145",
"0.70740294",
"0.7060653",
"0.704373",
"0.7034206",
"0.70334554",
"0.7017586",
"0.6989546",
"0.6987686",
"0.6961579",
"0.6935551",
"0.6865491",... | 0.0 | -1 |
Return tensors positive and negative samples. | def __call__(
self, src, dst, feat, *unused_tensors
):
neg_src = tf.repeat(src, self.num_neg_per_pos)
random_offset = tf.random.uniform(
minval=1,
maxval=self.num_nodes,
shape=tf.shape(neg_src),
dtype=neg_src.dtype,
)
neg_dst = tf.math.floormod(
tf.math.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __neg__(self):\n return TensorWithIndices(-self._tensor, \n self._con + '_' + self._cov)",
"def abs(tensor):\n raise NotImplementedError",
"def sign(tensor):\n raise NotImplementedError",
"def under_sample(pos_nids, neg_nids, scale=1):\n index = np.... | [
"0.6593329",
"0.5845341",
"0.58382833",
"0.5803817",
"0.5795344",
"0.5792174",
"0.571915",
"0.5717788",
"0.5684675",
"0.558966",
"0.55621064",
"0.5552129",
"0.55348456",
"0.5528148",
"0.55232227",
"0.55214113",
"0.55039316",
"0.54935735",
"0.5493006",
"0.5491893",
"0.5476643"... | 0.5405545 | 31 |
Test case for perturb_nodefail_post | def test_perturb_nodefail_post(self):
Parameters = Parameters2()
response = self.client.open('/perturb/nodefail',
method='POST',
data=json.dumps(Parameters),
content_type='application/json')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_post(self):\n pass",
"def test_post_foods(self):\n pass",
"def test_post_user_post(self):\n pass",
"def test_post_nveto_pmts(self):\n pass",
"def test_post_users_post(self):\n pass",
"def test_meme_post(self):\n pass",
"def test_falsepositive_post(clie... | [
"0.6223876",
"0.6194101",
"0.60459375",
"0.5875066",
"0.580688",
"0.5789453",
"0.5782498",
"0.5747264",
"0.57107925",
"0.5676912",
"0.5651326",
"0.5645974",
"0.5628373",
"0.56243896",
"0.56034243",
"0.55947196",
"0.5586521",
"0.5579983",
"0.5533444",
"0.5519166",
"0.5505662",... | 0.72945184 | 0 |
Get the state of the base environment underlying this simulation. | def get_state(self):
return self._env.get_state() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state(self):\n return self.env.sim.get_state()",
"def get_state(self) -> numpy.ndarray:\n if self.clone_seeds:\n return self.gym_env.unwrapped.clone_full_state()\n else:\n return self.gym_env.unwrapped.clone_state()",
"def get_state(self) -> Any:\n raise No... | [
"0.7271932",
"0.72443354",
"0.7074449",
"0.66396475",
"0.6635302",
"0.6635302",
"0.6628831",
"0.6600063",
"0.65326726",
"0.65020907",
"0.64947283",
"0.64620066",
"0.63979954",
"0.6350296",
"0.6342641",
"0.6318393",
"0.62794405",
"0.62611693",
"0.6250845",
"0.61970866",
"0.618... | 0.72386056 | 2 |
Tags exist as a string on the object until this property is accessed when the tags will be parsed. This will return a dictionary of tags for the message. | def tags(self):
if not hasattr(self, "_tags"):
self._parse_tags()
return self._tags | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags(self) -> dict:\n return self._tags",
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> dict:\n\n return self._tags or None # store trivial tags as emp... | [
"0.7356398",
"0.71904343",
"0.71904343",
"0.71528774",
"0.7147752",
"0.7147752",
"0.7147752",
"0.7147752",
"0.7120455",
"0.7036617",
"0.70240813",
"0.69059235",
"0.68624216",
"0.68556404",
"0.6804458",
"0.6757412",
"0.6723951",
"0.6672897",
"0.6646525",
"0.6638321",
"0.663832... | 0.6741678 | 16 |
Set the name of the variable. | def setName(self, name: str, /) -> Any:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setVarName(self, theName):\n self._name = theName\n return self",
"def set_name(self, name):\n\t\tself.name_ = name",
"def set_name(self,name):\r\n self._name = __name",
"def setname(self, name):\n self.__name = name",
"def name(self, value):\n self._name = value",
... | [
"0.8356473",
"0.80492806",
"0.7998566",
"0.7962415",
"0.79574096",
"0.79574096",
"0.7898638",
"0.78857785",
"0.78857785",
"0.7876669",
"0.7837697",
"0.7837697",
"0.78333163",
"0.7801124",
"0.7801124",
"0.779277",
"0.7758073",
"0.7758073",
"0.7758073",
"0.7758073",
"0.7758073"... | 0.0 | -1 |
Get the current value of the variable. | def value(self) -> float:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_value(self):\n assert(self.is_started())\n return self.currValue",
"def current_value(self):\n return self.current_counter.value",
"def get_current_value(self, default=None):\n try:\n return self._currentvalue\n except AttributeError:\n r... | [
"0.81701285",
"0.76752824",
"0.7570123",
"0.75647223",
"0.7508799",
"0.7467934",
"0.7435013",
"0.7381678",
"0.7361344",
"0.7300062",
"0.7281784",
"0.7281784",
"0.72461796",
"0.72461796",
"0.72461796",
"0.72327286",
"0.7200071",
"0.7200071",
"0.7200071",
"0.7188606",
"0.718860... | 0.0 | -1 |
Get the coefficient for the term. | def coefficient(self) -> float:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coeff(self):\n return self._coeff",
"def getCoefficient(self):\n return _libsbml.FluxObjective_getCoefficient(self)",
"def get_coeff(self):\n return bernoulli(self.degree+1) / factorial(self.degree + 1)",
"def coef(self):\n return self._coef",
"def get_coefficient(self, var... | [
"0.79082656",
"0.76750433",
"0.74407554",
"0.7419539",
"0.734748",
"0.72059673",
"0.7161257",
"0.6889246",
"0.67865443",
"0.67605644",
"0.6709972",
"0.6633344",
"0.66265845",
"0.6617359",
"0.6615395",
"0.65079224",
"0.6445369",
"0.64248616",
"0.6421431",
"0.6421431",
"0.64148... | 0.73563826 | 4 |
Get the value for the term. | def value(self) -> float:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getValue(self):\n return self.text()",
"def get_val(self):\n return self.value",
"def _get_value(self):\n \n return self._value",
"def getval(self):\r\n return self.value",
"def get_term(self, idx):\n try:\n return self.id2term[idx]\n except K... | [
"0.7189744",
"0.71571136",
"0.7130746",
"0.7104902",
"0.70862734",
"0.7073664",
"0.70671505",
"0.70603544",
"0.7055651",
"0.7009664",
"0.70096123",
"0.70096123",
"0.70096123",
"0.6972301",
"0.6940659",
"0.69361347",
"0.69193274",
"0.6911277",
"0.6911277",
"0.6904737",
"0.6904... | 0.0 | -1 |
Get the strength for the constraint. | def strength(self) -> float:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strength(self) -> int:\n return self._strength",
"def get_strength(self):\n return 10 - self.get_agility()",
"def getStrength(self):\n return self.st",
"def strength(self):\n return self._characterStrength",
"def wireless_signal_strength(self) -> int:\n return self.da... | [
"0.82051545",
"0.7667124",
"0.7541932",
"0.7447134",
"0.7258923",
"0.71684384",
"0.691986",
"0.6821158",
"0.6821158",
"0.6741986",
"0.6716075",
"0.6702248",
"0.66739076",
"0.66509944",
"0.6636615",
"0.66351014",
"0.6630416",
"0.6595347",
"0.6595347",
"0.6559752",
"0.6553531",... | 0.7714425 | 1 |
Indicate if the constraint is violated in teh current state of the solver. | def violated(self) -> bool:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def did_solve(self):\n return self._solution[\"status\"] == \"optimal\"",
"def is_violated(self,\n env\n ):\n flag = any([con.is_violated(env) for con in self.constraints])\n return flag",
"def did_solve(self) -> bool:\n return self._solution.in... | [
"0.6838856",
"0.67668086",
"0.6675701",
"0.6579404",
"0.6507886",
"0.6476085",
"0.64347845",
"0.64196366",
"0.6398619",
"0.6398219",
"0.6360409",
"0.63215375",
"0.62700886",
"0.62589514",
"0.6256994",
"0.6239568",
"0.6239568",
"0.6239568",
"0.6204424",
"0.6169917",
"0.6128140... | 0.6972864 | 0 |
Plot a grid of timecourses of C, N, and S for each culture. Uses AxesGrid from mpl_loolkits.axes_grid1. | def plot_growth(rows, cols, amounts, times, title='CNS Growth', filename=None):
ymax = np.amax(amounts)
ymax = np.ceil(ymax*10)/10
fig = plt.figure()
fig.suptitle(title, fontsize=20)
# http://stackoverflow.com/a/36542971
# Add big axes and hide frame.
fig.add_subplot(111, frameon=False)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cplot(self, figure, i, n):\n xx, yy = np.meshgrid(range(self.L), range(self.L))\n ax = figure.add_subplot(2,2,n)\n plt.setp(ax.get_yticklabels(), visible=False)\n plt.setp(ax.get_xticklabels(), visible=False) \n plt.pcolormesh(xx, yy, self.config, cmap=plt.cm.RdBu);\n ... | [
"0.65577185",
"0.63081837",
"0.6219827",
"0.6205473",
"0.61784697",
"0.59268755",
"0.5866878",
"0.581599",
"0.5782144",
"0.5766683",
"0.57617265",
"0.5721031",
"0.5690334",
"0.5675751",
"0.55794007",
"0.55756044",
"0.5561598",
"0.5550681",
"0.55281276",
"0.54582804",
"0.54424... | 0.5755873 | 11 |
Returns the response data for both the login and refresh views. Override to return a custom response such as including the serialized representation of the User. | def jwt_response_payload_handler(token, user=None, request=None):
return {
"token": JWT_AUTH.get('JWT_AUTH_HEADER_PREFIX') + ' ' + token,
"expires_in": datetime.utcnow() + api_settings.JWT_EXPIRATION_DELTA,
"user_info": UsersLoginSerializer(user, context={'request': request}).data
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, request):\n user = request.user\n serializer = self.serializer_class(user)\n return response.Response({\"user\": serializer.data})",
"def get(self, request):\n serializer = UserSerializer(request.user)\n return Response(serializer.data, status=status.HTTP_200_OK)"... | [
"0.71465147",
"0.70411843",
"0.70158863",
"0.6920199",
"0.680122",
"0.67467433",
"0.67200357",
"0.6637355",
"0.6610629",
"0.6545728",
"0.6451369",
"0.64485973",
"0.64340764",
"0.64081866",
"0.6401857",
"0.63850576",
"0.6379709",
"0.6339779",
"0.6318268",
"0.63139457",
"0.6295... | 0.0 | -1 |
Find letter index from all_letters, e.g. "a" = 1 0 will be the OOV index | def letterToIndex(letter):
if letter not in all_letters:
letter = remove_tone_marks(letter)
return all_letters.find(letter) + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def letter_to_index(letter):\r\n return ord(letter.lower()) - CHAR_A",
"def letter_to_index(letter):\r\n return ord(letter.lower()) - CHAR_A",
"def find_letter_indices(words, letter):\n\n return []",
"def alphabet_position(letter):\n\n alphabet='abcdefghijklmnopqrstuvwxyz'\n ALPHABET='ABCDEFGH... | [
"0.77561086",
"0.77561086",
"0.7537599",
"0.72580856",
"0.72493124",
"0.7140853",
"0.69707936",
"0.6923047",
"0.6878614",
"0.6808082",
"0.67288494",
"0.672008",
"0.66960436",
"0.6606948",
"0.6564629",
"0.649849",
"0.6429685",
"0.6383099",
"0.6369814",
"0.6365768",
"0.6317695"... | 0.76111495 | 2 |
returns the argmax as a python int | def argmax(vec):
_, idx = torch.max(vec, -1)
return to_scalar(idx) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def argmax(sequence):\r\n\r\n import operator\r\n index, value = max(enumerate(sequence), key=operator.itemgetter(1))\r\n\r\n return index",
"def max(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"max\")",
"def max(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"max\")",... | [
"0.76696974",
"0.74289167",
"0.74289167",
"0.7322274",
"0.7322274",
"0.7322274",
"0.729767",
"0.7297426",
"0.7132999",
"0.7132999",
"0.7089301",
"0.70691156",
"0.7039756",
"0.7020751",
"0.69803226",
"0.69358915",
"0.69336575",
"0.69336575",
"0.6917138",
"0.6864105",
"0.686303... | 0.72347665 | 8 |
1hot encodes a tensor | def to_categorical(y, num_classes):
arr = np.eye(num_classes)[y]
tensor = torch.LongTensor(arr)
return autograd.Variable(tensor) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encode(x):\n # TODO: Implement Function\n output = np.zeros((len(x), 10))\n \n for i, j in enumerate(x):\n output[i,j] = 1\n \n return output",
"def one_hot_encode(self, arr, n_labels):\n one_hot = np.zeros((np.multiply(*arr.shape), n_labels), dtype=np.float32)\... | [
"0.825683",
"0.80612594",
"0.80134225",
"0.79169524",
"0.79141015",
"0.78817654",
"0.78415674",
"0.7808129",
"0.7765629",
"0.77381057",
"0.77381057",
"0.7733656",
"0.77271235",
"0.7712934",
"0.7685474",
"0.76791126",
"0.7582691",
"0.75598603",
"0.75565237",
"0.7535483",
"0.75... | 0.0 | -1 |
Small modification to NLTK wordpunct_tokenize Because NLTK's won't split on '_' or numbers | def wordpunct_space_tokenize(sent):
return _rts.tokenize(sent) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(text):\n lowers = text.lower()\n trans = {ord(c): None for c in string.punctuation}\n no_punctuation = lowers.translate(trans)\n trans_dig = {ord(c): None for c in string.digits}\n no_digits = no_punctuation.translate(trans_dig)\n tokens = nltk.word_tokenize(no_digits)\n return to... | [
"0.7712767",
"0.72001827",
"0.7181687",
"0.7161656",
"0.7132496",
"0.70764285",
"0.70704037",
"0.7032159",
"0.69968474",
"0.69790226",
"0.6895941",
"0.6881979",
"0.6864515",
"0.6852213",
"0.6835276",
"0.6835098",
"0.68190706",
"0.68102664",
"0.68017775",
"0.67969924",
"0.6770... | 0.79126287 | 0 |
Pads sequences to the same length. This function transforms a list of `num_samples` sequences (lists of integers) into a 2D Numpy array of shape `(num_samples, num_timesteps)`. `num_timesteps` is either the `maxlen` argument if provided, or the length of the longest sequence otherwise. Sequences that are shorter than `... | def pad_sequences(sequences, maxlen=None, dtype='int32',
padding='pre', truncating='pre', value=0.):
if not hasattr(sequences, '__len__'):
raise ValueError('`sequences` must be iterable.')
lengths = []
for x in sequences:
if not hasattr(x, '__len__'):
raise Valu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad_sequences(sequences, maxlen, nb_sequences, dtype='int32', value=-1):\n\n x = (numpy.ones((nb_sequences, maxlen)) * value).astype(dtype)\n for idx, s in enumerate(sequences):\n trunc = s[:maxlen]\n\n x[idx, :len(trunc)] = trunc\n\n return x",
"def pad_sequences(sequences, pad_func, ... | [
"0.7471271",
"0.67566997",
"0.67072976",
"0.66779023",
"0.66278654",
"0.65295887",
"0.650013",
"0.64562035",
"0.6307838",
"0.6280524",
"0.6270285",
"0.62512267",
"0.6229984",
"0.6229984",
"0.6159027",
"0.61498684",
"0.6144117",
"0.61333627",
"0.612565",
"0.6052647",
"0.604610... | 0.73416483 | 1 |
Approaches 0 for x> inf as 1/(1x), with f(0)=1 and f'(0)=1. Cont differentiable. | def il(x, eps=None):
if eps is None:
eps = 0.0
inv_safe = tf.where(x < 0, 1./(1. - x), tf.ones_like(x))
act = lambda x: tf.where(x < 0, inv_safe, x+1) + eps
return act(x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def erfc(x):\n return 0.0",
"def infrec(f, g, bc=None):\n from numpy import product\n if bc is None: bc = secross()\n n = product(f.shape)\n y = cdilate(f,g,bc,n);\n return y",
"def fn(x):\n if x == 0: return 0\n if x < 0: return inf\n return min(1 + fn(x ... | [
"0.65662795",
"0.64100665",
"0.63619375",
"0.62685996",
"0.6260722",
"0.6216693",
"0.61923504",
"0.61800134",
"0.61712873",
"0.61514115",
"0.612418",
"0.60906863",
"0.6080326",
"0.60748667",
"0.6056136",
"0.595767",
"0.5950477",
"0.5943625",
"0.5929249",
"0.5898662",
"0.58977... | 0.5628194 | 67 |
Build the meancentered point matrix W. points should be an array with shape (num_frames, num_points, 2). | def build_W(points):
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def point_avg(points):\n if len(points)==1:\n new_center= np.mean(points)\n else:\n new_center= [np.mean([x[y] for x in points]) for y in range(len(points[0]))]\n return new_center",
"def centroid_points(points):\n p = float(len(points))\n x, y, z = zip(*points)\n return sum(x) / ... | [
"0.6723999",
"0.63278323",
"0.63190204",
"0.616089",
"0.6126593",
"0.608245",
"0.597002",
"0.58241475",
"0.57955587",
"0.57952666",
"0.57897234",
"0.57701397",
"0.5757842",
"0.5742731",
"0.57414883",
"0.5709802",
"0.56775075",
"0.5632468",
"0.55561256",
"0.55491716",
"0.55024... | 0.5469493 | 22 |
Remove comments from the string column of FTL Translations and Entities, and source & target columns of FTL TranslationMemoryEntries. See bug 1501168 for more details. | def remove_comments_from_ftl_translations(apps, schema):
parser = FluentParser()
serializer = FluentSerializer()
# Translations
Translation = apps.get_model('base', 'Translation')
translations = Translation.objects.filter(entity__resource__format='ftl')
translations_to_update = []
for t in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deleteComments(self: Self, event: Event = None) -> None:\n #@+<< deleteComments docstring >>\n #@+node:ekr.20171123135625.37: *3* << deleteComments docstring >>\n #@@pagewidth 50\n #@-<< deleteComments docstring >>\n c, p, u, w = self, self.p, self.undoer, self.frame.body.wrapper\n #\n # \... | [
"0.63007027",
"0.60225815",
"0.5909399",
"0.5684708",
"0.559779",
"0.5582361",
"0.5547229",
"0.55372834",
"0.54712635",
"0.54712635",
"0.538484",
"0.5373036",
"0.5370515",
"0.53657305",
"0.5343653",
"0.5320726",
"0.5320122",
"0.5293025",
"0.5290128",
"0.5279373",
"0.52651274"... | 0.6996354 | 0 |
Return the kwargs to create a copy of the instance. | def _copy_kwargs(self, **kwargs):
ns = self.__dict__
for attr, kw in {'_engine': 'engine', '_format': 'format'}.items():
assert kw not in kwargs
if attr in ns:
kwargs[kw] = ns[attr]
return super()._copy_kwargs(**kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kwargs (self):\n return copy.deepcopy (self._kwargs)",
"def copy (self, **kwargs):\n out = copy.deepcopy (self)\n out.update (**kwargs)\n return out",
"def clone(self, *args, **kwargs):\n new_self = copy.copy(self)\n kwargs = self.get_arguments(args, kwargs, onlykeys=True,... | [
"0.8453996",
"0.7878556",
"0.7481045",
"0.74726564",
"0.727558",
"0.7109563",
"0.70013624",
"0.6950249",
"0.6941109",
"0.69344217",
"0.6892155",
"0.68705976",
"0.68048954",
"0.674366",
"0.6728962",
"0.67002124",
"0.6697491",
"0.66730416",
"0.6665938",
"0.6601157",
"0.6559238"... | 0.7646782 | 2 |
Delete the Provisioning Service Certificate. Deletes the specified certificate assosciated with the Provisioning Service. | def delete(
self, resource_group_name, if_match, provisioning_service_name, certificate_name, certificatename=None, certificateraw_bytes=None, certificateis_verified=None, certificatepurpose=None, certificatecreated=None, certificatelast_updated=None, certificatehas_private_key=None, certificatenonce=None, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteCertificate(self, request):\n try:\n params = request._serialize()\n headers = request.headers\n body = self.call(\"DeleteCertificate\", params, headers=headers)\n response = json.loads(body)\n model = models.DeleteCertificateResponse()\n ... | [
"0.6608225",
"0.6579277",
"0.65694404",
"0.6417117",
"0.6317654",
"0.62543005",
"0.59181637",
"0.58554876",
"0.58198816",
"0.5803979",
"0.575492",
"0.566286",
"0.5641114",
"0.5534113",
"0.5532895",
"0.5443055",
"0.54262745",
"0.5398958",
"0.5362816",
"0.5357683",
"0.534798",
... | 0.6278682 | 5 |
Plot image of given depth | def imshow(self, depth):
layer = self.cube[depth]
img = []
for i in range(self.height):
img.append([layer[i][j].value for j in range(self.width)])
plt.imshow(img, cmap='gray')
plt.show() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_glide_depths(depths, mask_tag_filt):\n import numpy\n\n from . import plotutils\n\n fig, ax = plt.subplots()\n\n ax = plotutils.plot_noncontiguous(ax, depths, numpy.where(mask_tag_filt)[0])\n ax.invert_yaxis()\n\n plt.show()\n\n return None",
"def plot_well_depth(self):\n fig... | [
"0.65465724",
"0.6293776",
"0.62561876",
"0.62431103",
"0.62291616",
"0.6226079",
"0.62257254",
"0.6224469",
"0.6208157",
"0.6181805",
"0.6156093",
"0.61438584",
"0.6133444",
"0.6118609",
"0.6116789",
"0.6116789",
"0.6116789",
"0.61166316",
"0.6115073",
"0.6078475",
"0.605519... | 0.7406107 | 0 |
Compute the empirical CDF of the sample 'x' and evaluate it at datapoints 'xi'. This function is called internally in RSA_thres.compute_indices and RSA_groups.compute_indices to calculate the input CDFs. | def empiricalcdf(x, xi):
###########################################################################
# Check inputs
###########################################################################
if not isinstance(x, np.ndarray):
raise ValueError('"x" must be a numpy.array.')
if x.dtype.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cdf(self, x):\n\n pi = 3.1415926536\n mean = self.mean\n stddev = self.stddev\n\n x1 = (x - mean) / (stddev * (2 ** 0.5))\n\n erf1 = (2/pi**0.5)\n erf2 = (x1-((x1**3)/3)+((x1**5)/10)-((x1**7)/42)+((x1**9)/216))\n erf = erf1 * erf2\n cdf = (1/2)*(1+erf)\n\... | [
"0.69266355",
"0.69214094",
"0.69214094",
"0.6914141",
"0.68764466",
"0.6758876",
"0.66747475",
"0.66608214",
"0.65801144",
"0.6571776",
"0.6469703",
"0.6457943",
"0.6447456",
"0.63774574",
"0.6353632",
"0.62779135",
"0.6256293",
"0.6246077",
"0.6245759",
"0.61944",
"0.619059... | 0.75315416 | 0 |
Runs at the end of the test case; drops the db | def tearDown(self):
with self.app.app_context():
db.session.remove()
db.drop_all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def teardown():\n teardown_db()",
"def tearDown(self):\n db.session.commit()\n db.drop_all()",
"def tearDown(self):\n self.db.drop_all()\n pass",
"def tearDown(self):\n with app.app_context():\n db = app.db.get_db()\n cur = db.cursor()\n ... | [
"0.8768811",
"0.86619884",
"0.86346585",
"0.8592597",
"0.85831314",
"0.8579971",
"0.8579971",
"0.8579971",
"0.8579971",
"0.8579971",
"0.8579971",
"0.8579971",
"0.8579971",
"0.8579971",
"0.8579971",
"0.8579971",
"0.8579971",
"0.8579971",
"0.8579971",
"0.8579971",
"0.8579971",
... | 0.82741755 | 68 |
Return the Z value along a gaussian distribution given x,y coordinates | def gaussian_decay(A, sigma, x, y):
return A * math.exp(-((pow(x-16.,2.)/(2*pow(sigma,2)) + \
(pow(y-16.,2.)/(2*pow(sigma,2)))))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian2d(x, y, A, sigma, x0):\n Z = A * np.exp(-( (x-x0[0])**2/(2*sigma[0]**2) + (y-x0[1])**2/(2*sigma[1]**2)))\n return Z",
"def gaussianDist(self, x, mu, var):\n val = 1/(math.sqrt(2 * math.pi * var)) * math.exp(-1 * (x - mu)**2 / (2*var))\n return val",
"def _gaussian_distribution(self, x:... | [
"0.74720216",
"0.72551596",
"0.70616275",
"0.68615365",
"0.6848797",
"0.6848797",
"0.6848797",
"0.6834914",
"0.6812858",
"0.68081975",
"0.6802726",
"0.6748739",
"0.66895986",
"0.6650105",
"0.6646899",
"0.66359663",
"0.6631888",
"0.6610955",
"0.6594517",
"0.6594422",
"0.656803... | 0.0 | -1 |
Get Astris Probe ID for expect auto run. | def getAstrisProbeID(cableName, path_sn):
# 处理未格式化的 cablename 字符串
cableName_0 = cableName
if re.search("-", cableName_0):
cableName_0 = cableName_0.split("-")[1]
res, rev = readCMD([script_path+"/runAstrisID.exp"], True, path_sn)
for item in rev:
if re.search(cableName_0, item):
probeID = re.search( "[0-9]{... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAstrisProbeID(cableName):\n\t# 处理未格式化的 cablename 字符串\n\tcableName_0 = cableName\n\tif re.search(\"-\", cableName_0):\n\t\tcableName_0 = cableName_0.split(\"-\")[1]\n\t# writeLogs(\"Python script current path = %s\" %script_path)\n\tres, rev = readCMD([script_path+\"/auto_reset.rep\", \"-1\"], False)\n\tfor ... | [
"0.63445914",
"0.6018172",
"0.5957744",
"0.57805705",
"0.54946333",
"0.5481445",
"0.5373998",
"0.5343673",
"0.53005284",
"0.52937484",
"0.5198197",
"0.51904076",
"0.51841384",
"0.5179261",
"0.5168335",
"0.5163309",
"0.5162205",
"0.5153474",
"0.51299876",
"0.50734675",
"0.5055... | 0.625481 | 1 |
Wrapper for turning tensorflow metrics into keras metrics | def wrapper(self, args, **kwargs):
value, update_op = method(self, args, **kwargs)
K.get_session().run(tf.local_variables_initializer())
with tf.control_dependencies([update_op]):
value = tf.identity(value)
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adapt_tf_streaming_metric_for_keras(tf_metric, name,\n preprocss_fn=None, postprocess_fn=None,\n **kwargs):\n\n # Inspired from snipped by Ruzhitskiy Bogdan\n # (https://github.com/keras-team/keras/issues/6050#issuecomment-3299... | [
"0.69506645",
"0.64114",
"0.6383206",
"0.6362886",
"0.6128875",
"0.5947736",
"0.59401995",
"0.5889047",
"0.58636826",
"0.5822293",
"0.58184654",
"0.57995015",
"0.57968014",
"0.57885736",
"0.5779893",
"0.577134",
"0.57695305",
"0.576313",
"0.57178736",
"0.57167006",
"0.5708086... | 0.0 | -1 |
Create a new trial from a dictionary | def from_dict(cls, experiment_path: PurePath, data: Dict[str, any]):
params = dict(experiment_path=experiment_path)
params.update(data)
return cls(**params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createTrialDict(trial, block):\n trial_type = ''\n\n if trial.visual_file:\n visual_file = trial.visual_file.url\n vftype = trial.visual_file.filetype\n if 'video' in vftype.lower():\n trial_type = 'video'\n else:\n trial_type = 'image'\n else:\n ... | [
"0.66553545",
"0.61669606",
"0.61273277",
"0.61273277",
"0.61085725",
"0.5869679",
"0.58316576",
"0.5790569",
"0.576438",
"0.5739658",
"0.56255096",
"0.562108",
"0.55747175",
"0.55338913",
"0.55199856",
"0.54687315",
"0.5462591",
"0.5455903",
"0.5454162",
"0.5448245",
"0.5446... | 0.5040146 | 55 |
Get the TDP limit of package | def _get_tdp_power(cpu):
powercap_cpu_base = os.path.join(
BASE_POWERCAP_PATH, "intel-rapl:{}".format(cpu.node_id))
try:
path = os.path.join(powercap_cpu_base, "constraint_0_max_power_uw")
tdp = int(_read_sysfs(path))
#uW to W
tdp /= MICRO_CONV
except (IOError, OSErro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPTLimits(*args):\n return args[0].Limit.PTLimit.pt_limit",
"def getTCLimits(*args):\n return args[0].Limit.TCLimit.tc_limit",
"def get_limit(self):\n return self.limit",
"def get_limit(self):\n return self._limit",
"def get_limit(self):\n return self._limit",
"def adapti... | [
"0.71630466",
"0.68155926",
"0.6674689",
"0.6524719",
"0.6524719",
"0.64629984",
"0.63484544",
"0.6336108",
"0.6330175",
"0.63039666",
"0.6264373",
"0.6250275",
"0.6246874",
"0.6193732",
"0.6155589",
"0.6107442",
"0.6107442",
"0.60531497",
"0.6049967",
"0.60425955",
"0.599371... | 0.0 | -1 |
Get release version of the associated helper program. | def version(self):
if self.installed and not self._version:
output = self.call(self._version_args, require_success=False)
match = re.search(self._version_regexp, output)
if not match:
raise RuntimeError(
"Unable to find version number for '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version(program):\n\n return \"%s from mrtools %s\" % (program, mrtools_version)",
"def get_version():\n click.echo(get_current_version_number())",
"def get_version():\n return '%d.%d.%d' % version_info",
"def get_version():\n return about.get_version()",
"def get_version():\n return... | [
"0.721053",
"0.7203356",
"0.6982114",
"0.69554484",
"0.6876617",
"0.6751368",
"0.67318827",
"0.67314565",
"0.67307734",
"0.6728926",
"0.66976273",
"0.6693327",
"0.6691756",
"0.6652412",
"0.66384023",
"0.6632351",
"0.66222453",
"0.66222453",
"0.66222453",
"0.6603525",
"0.65842... | 0.0 | -1 |
Test Tensor.max for arbitrary data, axis, and keepdim | def test_max_back(a, num_axes, keepdims):
if num_axes == 0:
axes = None
else:
axes = np.random.choice(range(0, a.ndim), size=min(num_axes, a.ndim), replace=False)
axes = tuple(sorted(axes))
# single global maximum
if axes is None or axes == tuple(range(a.ndim)):
index = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max(tensor, axis=None):\n raise NotImplementedError",
"def dim_zero_max(x: Tensor) ->Tensor:\n return torch.max(x, dim=0).values",
"def masked_maximum(data, mask, dim=1):\n axis_minimums = tf.reduce_min(data, dim, keepdims=True)\n masked_maximums = tf.reduce_max(\n tf.math.multiply(data - ... | [
"0.72939914",
"0.7249118",
"0.7159474",
"0.69270927",
"0.6816063",
"0.6693305",
"0.6689232",
"0.66115314",
"0.6510889",
"0.64802194",
"0.6467747",
"0.6454342",
"0.64498174",
"0.6414373",
"0.6373469",
"0.6357863",
"0.6347594",
"0.62862027",
"0.62368566",
"0.6203899",
"0.618134... | 0.7470672 | 0 |
Return the top k documents for based on similarity matrix | def get_top_k(similarity, question_ids, paragraph_ids, k):
n_questions = similarity.shape[0]
idxs = [np.argsort(similarity[row,:])[-k:][::-1] for row in range(n_questions)]
out = {question_ids[i]:np.array(paragraph_ids)[idxs[i]] for i in range(n_questions)}
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_top_k(weight_query, doc_dict, k):\n \n # find fraction of all inlinks to doc_id\n total_num_inlinks = 0\n frac_inlinks = {}\n with open(num_inlinks_file) as f:\n doc_ids_set = doc_dict.keys()\n for i, line in enumerate(f):\n total_num_inlinks += int(line.strip())\n ... | [
"0.7680669",
"0.7294009",
"0.7196522",
"0.7136391",
"0.70358086",
"0.6973126",
"0.6921261",
"0.69210124",
"0.67498153",
"0.67347515",
"0.66906315",
"0.6635711",
"0.65827006",
"0.65751845",
"0.64510256",
"0.64483607",
"0.64027584",
"0.6386131",
"0.6363579",
"0.63007945",
"0.62... | 0.72779816 | 2 |
Returns accuracy. top_k is a dict as returned by get_top_k(). | def get_accuracy(top_k):
n_correct = [(question in paragraphs) for question, paragraphs in top_k.items()]
accuracy = sum(n_correct)/len(top_k)*100
return accuracy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accuracy(output, target, topk=(1,)):\n\tmaxk = max(topk)\n\tbatch_size = target.size(0)\n\n\t_, pred = output.topk(maxk, 1, True, True)\n\tpred = pred.t()\n\tcorrect = pred.eq(target.view(1, -1).expand_as(pred))\n\n\tres = []\n\tfor k in topk:\n\t\tcorrect_k = correct[:k].view(-1).float().sum(0)\n\t\tres.appen... | [
"0.7790706",
"0.76820815",
"0.7681787",
"0.7681787",
"0.76809895",
"0.76707727",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
... | 0.78114355 | 0 |
Draw a line combined of segments between points. | def draw_combined(self, points: Iterable[Tuple[float, float, float, float, Text]],eps: float = 1e-8):
for i, p in enumerate(points[1:-1]):
last_p = points[i]
next_p = points[i+2]
w = sum([last_p[2], p[2], next_p[2]]) / 3.
self.output.write(f'<polyline points="{rou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_line_segment(\n x1: float, y1: float, x2: float, y2: float, color: C3F\n ) -> None:\n pyglet.graphics.draw(\n 2,\n pyglet.gl.GL_LINE_STRIP,\n (GeoDrawer._VERTEX_MODE, [x1, y1, x2, y2]),\n (GeoDrawer._COLOR_MODE, color * 2),\n )",
"def d... | [
"0.7507227",
"0.73089755",
"0.72862893",
"0.7004558",
"0.6982856",
"0.69033986",
"0.689957",
"0.68861043",
"0.68716484",
"0.6870187",
"0.68533516",
"0.68329954",
"0.6800887",
"0.6787765",
"0.67820156",
"0.67660624",
"0.6733264",
"0.67092776",
"0.6698449",
"0.6695999",
"0.6669... | 0.6293133 | 51 |
Wraps a given Keras layer baseclass, adding Runtime Weight Scaling in the `build()` method using the constant from the He initializer. | def WeightScaled(
layer_base_class: Type[tf.keras.layers.Layer],
kernel_attr: str = "kernel",
kernel_initializer_attr: str = "kernel_initializer",
):
class WeightScaledVariant(layer_base_class):
def __init__(self, gain: float = 2.0, fan_in: int = None, *args, **kwargs):
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(self, input_shape):\n if self.use_scale:\n self.scale = self.add_weight(\n name='scale',\n shape=(),\n initializer='ones',\n dtype=self.dtype,\n trainable=True)\n else:\n self.scale = None\n super(HypLuongAttention, self).build(input_shape)"... | [
"0.68051386",
"0.66374505",
"0.64986295",
"0.63973767",
"0.61030334",
"0.6087606",
"0.60452276",
"0.6027698",
"0.6001209",
"0.5969962",
"0.5932495",
"0.58896536",
"0.5828722",
"0.58136284",
"0.58035344",
"0.57821167",
"0.5771482",
"0.5746343",
"0.57364935",
"0.5716917",
"0.57... | 0.796408 | 0 |
Representation string for the instance of the SchedulePolicies class. | def __repr__(self):
return "SchedulePolicies class instance for Commcell: '{0}'".format(
self._commcell_object.commserv_name
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n representation_string = '{:^5}\\t{:^20}\\n\\n'.format('S. No.', 'Schedule Policy')\n\n for index, policy in enumerate(self._policies):\n sub_str = '{:^5}\\t{:20}\\n'.format(index + 1, policy)\n representation_string += sub_str\n\n return representatio... | [
"0.8189865",
"0.7509505",
"0.7041365",
"0.7004347",
"0.6509042",
"0.6368328",
"0.6282538",
"0.6258271",
"0.62529427",
"0.6248392",
"0.6229856",
"0.61369675",
"0.6134077",
"0.60378045",
"0.60378045",
"0.60378045",
"0.60101146",
"0.60036325",
"0.60036325",
"0.60036325",
"0.6003... | 0.74356383 | 2 |
Returns a schedule policy object of the specified schedule policy name. | def get(self, schedule_policy_name, schedule_policy_id=None):
if schedule_policy_name and not isinstance(schedule_policy_name, basestring):
raise SDKException('Schedules', '102')
if schedule_policy_id and not isinstance(schedule_policy_id, int):
raise SDKException('Schedules', ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_schedule(self, name):\n return self.__schedules.get(name, None)",
"def _get_scheduler_policy(self):\n return self.__scheduler_policy",
"def _get_scheduler_policy(self):\n return self.__scheduler_policy",
"def _get_scheduler_policy(self):\n return self.__scheduler_policy",
"def _get_... | [
"0.6700762",
"0.62134594",
"0.62134594",
"0.62134594",
"0.62134594",
"0.62134594",
"0.62134594",
"0.62134594",
"0.62134594",
"0.62134594",
"0.6182103",
"0.6173136",
"0.60809577",
"0.60009354",
"0.5817689",
"0.578083",
"0.5760546",
"0.5760257",
"0.5720774",
"0.56081015",
"0.56... | 0.77740514 | 0 |
Gets a schedule ID of the schedule policy Returns (int) schedule policy ID | def _get_schedule_policy_id(self):
schedule_policies = SchedulePolicies(self._commcell_object)
return schedule_policies.get(self.schedule_policy_name).schedule_policy_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"schedule_id\")",
"def policy_id(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"policy_id\")",
"def policy_id(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"policy_id\")",
"def security_po... | [
"0.7265618",
"0.6918219",
"0.69093806",
"0.68377894",
"0.68377894",
"0.68124413",
"0.6732101",
"0.67213774",
"0.6460177",
"0.6395417",
"0.6364246",
"0.6310633",
"0.6231959",
"0.62063766",
"0.62063766",
"0.62063766",
"0.62063766",
"0.62063766",
"0.62063766",
"0.62063766",
"0.6... | 0.8840227 | 0 |
Get the policy Type of the schedule policy | def policy_type(self):
return (
list(
SchedulePolicies.policy_types.keys())[
list(
SchedulePolicies.policy_types.values()).index(self._task_json['policyType'])]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def policy_type(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"policy_type\")",
"def policy_type(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"policy_type\")",
"def policy_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"policy_type\")",
"def typ... | [
"0.7936323",
"0.78493845",
"0.78021806",
"0.71529824",
"0.6958368",
"0.68767196",
"0.68596804",
"0.66903925",
"0.66903925",
"0.66903925",
"0.6630274",
"0.6630274",
"0.6550651",
"0.6438638",
"0.6438638",
"0.6438638",
"0.6326373",
"0.6326373",
"0.6326373",
"0.6326373",
"0.63263... | 0.8559941 | 0 |
Add engineered features to features dict. | def add_engineered(features):
features["londiff"] = features["dropofflon"] - features["pickuplon"]
features["latdiff"] = features["dropofflat"] - features["pickuplat"]
features["euclidean"] = tf.math.sqrt(
features["londiff"]**2 + features["latdiff"]**2)
return features | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def features(self, features):\n\n self._features = features",
"def __call__(self, *args, **kwargs):\n self.features = dict((k, v()) for k, v in self.features.items())\n return self.features",
"def load_features(self, features):\n pass\n # self.features = features",
"def _de... | [
"0.64477503",
"0.6440563",
"0.64119697",
"0.61569864",
"0.6112001",
"0.6101296",
"0.60949934",
"0.6077937",
"0.6022143",
"0.5984989",
"0.59786856",
"0.5972495",
"0.59672904",
"0.5910809",
"0.59081984",
"0.5877332",
"0.58647245",
"0.5860706",
"0.58225346",
"0.58163923",
"0.581... | 0.6726443 | 0 |
unrolls text into a list of strings which correspond to a full tweet. | def post_to_tweets(data, url):
print("here,", url)
albums = find_all_images(data['content'])
text = strip_text(data['content'])
"""Where applicable, the images are associated with the text. This means, that to make an appropriate thread the
conversion from a post to tweets should take into accoun... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_content(tweets):\n result = []\n for t in tweets:\n text = t.text\n result.append(tokenize(text))\n return result",
"def get_tweet_texts(tweet_list):\n relevant_tweet_text = ''\n for text in tweet_list:\n relevant_tweet_text += ' ' + text['text']\n\n return rele... | [
"0.6838854",
"0.67346495",
"0.67160296",
"0.6444018",
"0.6378417",
"0.6356997",
"0.6327894",
"0.6310874",
"0.630833",
"0.62594146",
"0.611233",
"0.6088244",
"0.6070952",
"0.6053253",
"0.603181",
"0.60185105",
"0.60040486",
"0.5988074",
"0.5961798",
"0.59525454",
"0.5917379",
... | 0.0 | -1 |
Turn off the robot. | def turn_off(self):
self.robot.stop_simulation() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off(self, **kwargs):\n self.robot.pause_cleaning()\n time.sleep(1)\n self.robot.send_to_base()",
"def turn_off(self, **kwargs: Any) -> None:\n with self._wemo_call_wrapper(\"turn off\"):\n self.wemo.off()",
"def turn_off(self, **kwargs):\n set_sonoff_state... | [
"0.8336145",
"0.8030745",
"0.79974264",
"0.78690785",
"0.7825072",
"0.7775521",
"0.77530354",
"0.7712926",
"0.770361",
"0.76866096",
"0.767366",
"0.76457965",
"0.7621102",
"0.7618385",
"0.7584204",
"0.7565604",
"0.7558122",
"0.75331867",
"0.7519106",
"0.75005126",
"0.74990374... | 0.87365395 | 0 |
Creates a cache HTTP adapter that is based on an HAR file. | def __init__(
self,
cache_path: Union[str, os.PathLike],
mode: str = 'r',
is_active: bool = True,
is_offline: bool = False,
is_passive: bool = True,
delete_after_hit: bool = False,
match_headers: bool = True,
mat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(cls, host):\n\n return cls(host)",
"def __init__(self, host=None, port=None):\n\n self._mh = MasterHead.get_head()\n\n cfg = self._mh.cfg['Extensions']['Security']['zap']\n self._path = cfg['path']\n self._host = cfg['host'] if (host == None) else host\n self._p... | [
"0.52153873",
"0.5195794",
"0.511849",
"0.511273",
"0.49947166",
"0.48670897",
"0.4835957",
"0.4829714",
"0.48049283",
"0.4769282",
"0.47304696",
"0.47250324",
"0.47057673",
"0.4686407",
"0.46752235",
"0.46411264",
"0.46192932",
"0.46022767",
"0.46016216",
"0.4598756",
"0.457... | 0.58262473 | 0 |
Creates a basic temporary Dataframe. | def make_temp_df(text):
temp_df = pd.DataFrame({"Text": text})
temp_df["Textblob"] = temp_df.Text.apply((lambda x: TextBlob(x).words))
temp_df["Textblob letters"] = temp_df.Text.apply((lambda x: TextBlob(x)))
b_add_to_df(temp_df)
return temp_df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_frame_creator(self):\n\n return pd.DataFrame()",
"def create_dataframe():\r\n\r\n df = pd.read_csv('data/data.csv', header=0)\r\n return df",
"def build_dataframe() -> pd.DataFrame:\n df = pd.DataFrame(\n np.random.randint(0, 1000, size=(1000, 6)), columns=list(\"ABCDEF\... | [
"0.788363",
"0.76603526",
"0.75073683",
"0.7406752",
"0.73869634",
"0.7158786",
"0.71124107",
"0.6949863",
"0.69242924",
"0.69124305",
"0.6900226",
"0.68561316",
"0.68437433",
"0.6797788",
"0.6744064",
"0.67161137",
"0.67070526",
"0.66951007",
"0.6638634",
"0.66300553",
"0.65... | 0.0 | -1 |
Initializes the model for inference | def initialize(self, inputs, targets, global_step=None, is_training=False, is_evaluating=False):
if inputs is None:
raise ValueError('no mel inputs were provided')
if targets is None:
raise ValueError('no targets were provided')
if is_training and is_evaluating:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(self):\n LOG.info(\"Initializing Model.\")\n self.model = self.convert(df=self.training_df)\n if self.bootstraps is not None:\n LOG.info(\"Bootstrapping Data.\")\n self.bootstrap_data()",
"def initiate(self):\n # if self.opt.checkpoint_encoder:\n ... | [
"0.77388865",
"0.7733035",
"0.77288723",
"0.7709415",
"0.7434866",
"0.74056685",
"0.7299107",
"0.72774976",
"0.72072476",
"0.7196222",
"0.71950203",
"0.7193359",
"0.71804464",
"0.71759915",
"0.7116742",
"0.71065223",
"0.7087477",
"0.7058084",
"0.7048983",
"0.70424134",
"0.702... | 0.6619806 | 59 |
This viewset should return active retreats except if the currently authenticated user is an admin (is_staff). | def get_queryset(self):
if self.request.user.is_staff:
queryset = Retreat.objects.all()
else:
queryset = Retreat.objects.filter(
is_active=True,
hidden=False
)
queryset = queryset.filter(hide_from_client_admin_panel=False)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n qs = super(RetiresmartzViewSet, self).get_queryset()\n # Check user object permissions\n user = SupportRequest.target_user(self.request)\n return qs.filter_by_user(user)",
"def get_queryset(self):\n qs = super(RetiresmartzAdviceViewSet, self).get_query... | [
"0.7074667",
"0.70013356",
"0.6933086",
"0.6914541",
"0.6852013",
"0.66941756",
"0.66618705",
"0.6619982",
"0.65279347",
"0.65081805",
"0.64499897",
"0.64499897",
"0.6402607",
"0.63944495",
"0.6348768",
"0.634558",
"0.6330448",
"0.6316748",
"0.6316748",
"0.63040715",
"0.63037... | 0.5871193 | 47 |
Set the person's first and last name. | def __init__(self, first_name: str, last_name: str):
self.first_name = first_name
self.last_name = last_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setFirstName(self, firstName):\r\n self.firstName = firstName",
"def set_name(self):\n if self.first_name and self.last_name:\n name_string = \"%s\" % self.first_name\n name_string += \" %s\" % self.last_name\n self.name = name_string\n\n if self.name:\n... | [
"0.78833973",
"0.7838523",
"0.7745429",
"0.7692473",
"0.72249186",
"0.7191226",
"0.7191226",
"0.7108807",
"0.7077369",
"0.68862206",
"0.68862206",
"0.68862206",
"0.68862206",
"0.68862206",
"0.68862206",
"0.68862206",
"0.68862206",
"0.68862206",
"0.67758846",
"0.676845",
"0.67... | 0.6311231 | 40 |
Check if a value is iterable (list), but not a string. | def check_iterable(value):
try:
iter(value)
if not isinstance(value, six.string_types):
return True
else:
return False
except Exception as e:
pass
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_non_string_iterable(value):\n if isinstance(value, str):\n return False\n if hasattr(value, '__iter__'):\n return True\n if isinstance(value, collections.abc.Sequence):\n return True\n return False",
"def _is_iterable_non_string(arg):\n return (hasattr(arg, \"__iter__\... | [
"0.8629848",
"0.8246705",
"0.8232006",
"0.79706347",
"0.78823954",
"0.77507603",
"0.77311957",
"0.7725309",
"0.769776",
"0.76054233",
"0.7603221",
"0.75419855",
"0.7442928",
"0.74428666",
"0.7396554",
"0.7388348",
"0.73615086",
"0.7309994",
"0.72906005",
"0.7242019",
"0.72372... | 0.82447064 | 2 |
Fixture for mocking requests.get. | def mock_requests_get(self, mocker):
mock = mocker.patch("requests.get")
mock.return_value.__enter__.return_value.json.return_value = {
"daily": {"1595808000000": 100, "1595721600000": 120, "1595635200000": 110},
"average": {
"1595808000000": 100,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request(self):\n client = RestClient(host=self.host, username='')\n rest_url = 'some/url/'\n\n # Mock good get response\n with responses.RequestsMock() as rsps:\n rsps.add(responses.GET, f'{self.host}/{rest_url}', status=200,\n json={'value':\"goo... | [
"0.7568971",
"0.75343007",
"0.7494889",
"0.74829966",
"0.74620914",
"0.73680013",
"0.7335334",
"0.7243414",
"0.7223257",
"0.7158435",
"0.7128194",
"0.71134096",
"0.70378447",
"0.70216346",
"0.6986232",
"0.68972003",
"0.68916553",
"0.6891631",
"0.68866414",
"0.68768066",
"0.68... | 0.6773327 | 24 |
Fixture for mocking requests.get. | def mock_requests_get_invalid(self, mocker):
mock = mocker.patch("requests.get")
mock.return_value.__enter__.return_value.json.return_value = {
"daily": {"not_an_epoch": 100, "1595721600000": 120, "1595635200000": 110},
"average": {
"1595808000000": 100,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request(self):\n client = RestClient(host=self.host, username='')\n rest_url = 'some/url/'\n\n # Mock good get response\n with responses.RequestsMock() as rsps:\n rsps.add(responses.GET, f'{self.host}/{rest_url}', status=200,\n json={'value':\"goo... | [
"0.7568971",
"0.75343007",
"0.7494889",
"0.74829966",
"0.74620914",
"0.73680013",
"0.7335334",
"0.7243414",
"0.7223257",
"0.7158435",
"0.7128194",
"0.71134096",
"0.70378447",
"0.70216346",
"0.6986232",
"0.68972003",
"0.68916553",
"0.6891631",
"0.68866414",
"0.68768066",
"0.68... | 0.61365664 | 95 |
Fixture for mocking requests.get. | def mock_requests_get(self, mocker):
mock = mocker.patch("requests.get")
mock.return_value.__enter__.return_value.json.return_value = {
"types": [],
"alpha": [
{"letter": "#", "items": 0},
{"letter": "a", "items": 4},
{"letter": "j"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request(self):\n client = RestClient(host=self.host, username='')\n rest_url = 'some/url/'\n\n # Mock good get response\n with responses.RequestsMock() as rsps:\n rsps.add(responses.GET, f'{self.host}/{rest_url}', status=200,\n json={'value':\"goo... | [
"0.7568971",
"0.75343007",
"0.7494889",
"0.74829966",
"0.74620914",
"0.73680013",
"0.7335334",
"0.7243414",
"0.7223257",
"0.7158435",
"0.7128194",
"0.71134096",
"0.70378447",
"0.6986232",
"0.68972003",
"0.68916553",
"0.6891631",
"0.68866414",
"0.68768066",
"0.6855003",
"0.682... | 0.70216346 | 13 |
Fixture for mocking requests.get. | def mock_requests_get(self, mocker):
mock = mocker.patch("requests.get")
mock.return_value.__enter__.return_value.json.return_value = {
"total": 97,
"items": [
{
"icon": "",
"icon_large": "",
"id": 1,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request(self):\n client = RestClient(host=self.host, username='')\n rest_url = 'some/url/'\n\n # Mock good get response\n with responses.RequestsMock() as rsps:\n rsps.add(responses.GET, f'{self.host}/{rest_url}', status=200,\n json={'value':\"goo... | [
"0.7568971",
"0.75343007",
"0.7494889",
"0.74829966",
"0.74620914",
"0.73680013",
"0.7335334",
"0.7243414",
"0.7223257",
"0.7158435",
"0.7128194",
"0.71134096",
"0.70378447",
"0.70216346",
"0.6986232",
"0.68972003",
"0.68916553",
"0.6891631",
"0.68866414",
"0.68768066",
"0.68... | 0.65270334 | 47 |
Fixture for mocking requests.get. | def mock_requests_get_invalid(self, mocker):
mock = mocker.patch("requests.get")
mock.return_value.__enter__.return_value.json.return_value = {
"total": 97,
"items": [
{
"icon": "",
"icon_large": "",
"id"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request(self):\n client = RestClient(host=self.host, username='')\n rest_url = 'some/url/'\n\n # Mock good get response\n with responses.RequestsMock() as rsps:\n rsps.add(responses.GET, f'{self.host}/{rest_url}', status=200,\n json={'value':\"goo... | [
"0.7568971",
"0.75343007",
"0.7494889",
"0.74829966",
"0.74620914",
"0.73680013",
"0.7335334",
"0.7243414",
"0.7223257",
"0.7158435",
"0.7128194",
"0.71134096",
"0.70378447",
"0.70216346",
"0.6986232",
"0.68972003",
"0.68916553",
"0.6891631",
"0.68866414",
"0.68768066",
"0.68... | 0.64119196 | 59 |
Fixture for mocking requests.get. | def mock_requests_get(self, mocker):
mock = mocker.patch("requests.get")
mock.return_value.__enter__.return_value.json.return_value = {
"item": {
"icon": "",
"icon_large": "",
"id": 21787,
"type": "Miscellaneous",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request(self):\n client = RestClient(host=self.host, username='')\n rest_url = 'some/url/'\n\n # Mock good get response\n with responses.RequestsMock() as rsps:\n rsps.add(responses.GET, f'{self.host}/{rest_url}', status=200,\n json={'value':\"goo... | [
"0.7568971",
"0.75343007",
"0.7494889",
"0.74829966",
"0.74620914",
"0.73680013",
"0.7335334",
"0.7243414",
"0.7223257",
"0.7158435",
"0.7128194",
"0.71134096",
"0.70378447",
"0.70216346",
"0.6986232",
"0.68972003",
"0.68916553",
"0.6891631",
"0.68768066",
"0.6855003",
"0.682... | 0.68866414 | 18 |
Fixture for mocking requests.get. | def mock_requests_get_404(self, mocker):
def side_effect():
raise requests.HTTPError
mock = mocker.patch("requests.get")
mock.return_value.__enter__.return_value.raise_for_status.side_effect = (
side_effect
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request(self):\n client = RestClient(host=self.host, username='')\n rest_url = 'some/url/'\n\n # Mock good get response\n with responses.RequestsMock() as rsps:\n rsps.add(responses.GET, f'{self.host}/{rest_url}', status=200,\n json={'value':\"goo... | [
"0.7568971",
"0.75343007",
"0.7494889",
"0.74829966",
"0.74620914",
"0.73680013",
"0.7335334",
"0.7243414",
"0.7223257",
"0.7158435",
"0.7128194",
"0.71134096",
"0.70378447",
"0.70216346",
"0.6986232",
"0.68972003",
"0.68916553",
"0.6891631",
"0.68866414",
"0.68768066",
"0.68... | 0.0 | -1 |
Test renaming columns in a data frame with duplicate column names. | def test_rename_columns(dupcols):
# Rename the first column
d1 = rename(dupcols, columns='Name', names='Person')
assert d1.columns[0] == 'Person'
assert dupcols.columns[0] == 'Name'
assert d1.columns[1] == 'A'
assert d1.columns[2] == 'A'
for col in d1.columns:
assert isinstance(col, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_duplicated_column_names(suffix: str) -> None:\n path = rsc / duplicated_column_names_file\n df = read_ods(path.with_suffix(suffix), 1)\n\n assert isinstance(df, pd.DataFrame)\n assert len(df.columns) == 4\n assert \"website.1\" in df.columns",
"def text_rename_column_errors(dupcols):\n ... | [
"0.7377957",
"0.72185993",
"0.713909",
"0.6914577",
"0.6852343",
"0.67460626",
"0.6673696",
"0.665487",
"0.6567712",
"0.6522969",
"0.647519",
"0.645901",
"0.6456079",
"0.64481306",
"0.64196503",
"0.63319165",
"0.6326535",
"0.632065",
"0.6305097",
"0.62651145",
"0.6187215",
... | 0.7988582 | 0 |
Finds the first iterated number greater than cap | def advent_3b(cap):
for x in iter_nums():
if x > cap:
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lower_bound(stock):\n counter=0\n for i in stock_price(stock):\n if i <= support(stock):\n counter+=1\n return counter",
"def le(value, limit):\n return value <= limit",
"def nextMin(value,lista):\n for i in lista:\n if i<value:\n return i\n raise NameE... | [
"0.6351483",
"0.6168543",
"0.61084723",
"0.6101938",
"0.6082835",
"0.6043279",
"0.6039842",
"0.5966022",
"0.59469485",
"0.59140044",
"0.5901743",
"0.5868859",
"0.58653957",
"0.5860607",
"0.5852442",
"0.58481956",
"0.58087164",
"0.57851624",
"0.5770347",
"0.576802",
"0.5763773... | 0.7898799 | 0 |
Returns the transport used by the client instance. | def transport(self) -> PipelineServiceTransport:
return self._client.transport | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transport(self):\n return self._transport",
"def transport(self) -> TraceServiceTransport:\n return self._client.transport",
"def transport(self) -> ServiceControllerTransport:\n return self._client.transport",
"def transport(self) -> MetadataServiceTransport:\n return self._c... | [
"0.82946277",
"0.7887542",
"0.773594",
"0.773068",
"0.76806635",
"0.7674273",
"0.76357967",
"0.7558095",
"0.7551682",
"0.75303864",
"0.74958986",
"0.7488142",
"0.7436853",
"0.7423566",
"0.73340607",
"0.721926",
"0.7109823",
"0.7102308",
"0.68808985",
"0.68144",
"0.6671675",
... | 0.7368433 | 14 |
Gets the signature of this CancelClaimRequest. | def signature(self) -> object:
return self._signature | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signature(self) -> str:\n return self[\"Sns\"][\"Signature\"]",
"def signature(self):\n return self._signature",
"def signature(self):\n return self._signature",
"def signature(self):\n return self._signature",
"def sign_request(self):\n return self._sign_request",
... | [
"0.63963515",
"0.6279561",
"0.6279561",
"0.6279561",
"0.5834911",
"0.5796269",
"0.57405317",
"0.5718661",
"0.565192",
"0.54762757",
"0.5463392",
"0.5448076",
"0.5425684",
"0.53981686",
"0.53524137",
"0.5338279",
"0.529154",
"0.52789414",
"0.52677083",
"0.52677083",
"0.5263368... | 0.6135696 | 5 |
Sets the signature of this CancelClaimRequest. | def signature(self, signature: object):
self._signature = signature | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signature(self, signature):\n\n self._signature = signature",
"def signature(self, signature):\n\n self._signature = signature",
"def __init__(self, signature: object=None, claim_id: str=None, participant: AllOfCancelClaimRequestParticipant=None, reason: ConfirmClaimRequestpropertiesReason=No... | [
"0.6114562",
"0.6114562",
"0.60749125",
"0.55958617",
"0.546195",
"0.5417356",
"0.528371",
"0.5159854",
"0.5159685",
"0.5132778",
"0.5073395",
"0.50044507",
"0.497432",
"0.4832487",
"0.4832487",
"0.47977144",
"0.4747129",
"0.47315794",
"0.47188556",
"0.4714105",
"0.46284205",... | 0.61430365 | 1 |
Gets the claim_id of this CancelClaimRequest. | def claim_id(self) -> str:
return self._claim_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def participant(self) -> AllOfCancelClaimRequestParticipant:\n return self._participant",
"def claim_id(self, claim_id: str):\n if claim_id is None:\n raise ValueError(\"Invalid value for `claim_id`, must not be `None`\") # noqa: E501\n\n self._claim_id = claim_id",
"def claim_... | [
"0.65584064",
"0.53480613",
"0.53480613",
"0.5325822",
"0.52917284",
"0.51542556",
"0.51258606",
"0.5120093",
"0.5110072",
"0.50802976",
"0.5056338",
"0.5052991",
"0.49733397",
"0.49415457",
"0.49334362",
"0.49256182",
"0.49254164",
"0.49254164",
"0.49254164",
"0.49244657",
"... | 0.7223548 | 1 |
Gets the participant of this CancelClaimRequest. | def participant(self) -> AllOfCancelClaimRequestParticipant:
return self._participant | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def participant(self) -> AllOfAcknowledgeClaimRequestParticipant:\n return self._participant",
"def participant(self, participant: AllOfCancelClaimRequestParticipant):\n if participant is None:\n raise ValueError(\"Invalid value for `participant`, must not be `None`\") # noqa: E501\n\n ... | [
"0.67635447",
"0.608266",
"0.5839472",
"0.5598538",
"0.5598538",
"0.5555457",
"0.5507715",
"0.5454061",
"0.51445997",
"0.5135461",
"0.5093453",
"0.4875301",
"0.48209915",
"0.48058555",
"0.4664206",
"0.4650998",
"0.46476087",
"0.4646766",
"0.46417183",
"0.46295804",
"0.4615743... | 0.8644753 | 0 |
returns all of the fun holidays that are today | def today():
request_today = request.date
today = datetime.date.today()
print(request.headers, request.url)
print(request_today)
print(today)
day = today.day
month = today.month
holidays = holidays_date(month, day)
return jsonify({"day": day, "month": month, "holidays": [h.holiday f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_holidays(self, year=datetime.date.today().year):\n # create a hard copy\n holidays = {}\n for month in HOLIDAYS:\n holidays[month] = []\n for day in HOLIDAYS[month]:\n holidays[month].append(day)\n \n easter = dateutil.easter.easter(year)\n easter_monday = easter + date... | [
"0.71569973",
"0.69837356",
"0.68727076",
"0.6681503",
"0.66613513",
"0.6647291",
"0.65118",
"0.6421551",
"0.64042956",
"0.6357339",
"0.63536423",
"0.63488454",
"0.62705237",
"0.6259649",
"0.62439466",
"0.62315094",
"0.6136877",
"0.6122545",
"0.611975",
"0.61050385",
"0.60878... | 0.66918874 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.