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 |
|---|---|---|---|---|---|---|
Create a string representation of a FritzCallForwardingSwitch. | def __str__(self):
return "%s --> %s: %s" % (self.from_number,
self.to_number, self.enabled) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return '<Switch name=\"{0}\" switch=\"{1}\" />' \\\n .format(self.name,\n self.switch.group_addr_str())",
"def __str__(self):\n return \"Flow(sip:{} dip:{} sport:{} dport{})\".format(\n self.fr_flow_sip_l, self.fr_flow_dip_l, self.fr_flo... | [
"0.6221744",
"0.61382747",
"0.598509",
"0.59504807",
"0.59335953",
"0.5919905",
"0.5776533",
"0.56621337",
"0.56556",
"0.5636727",
"0.5617768",
"0.5521054",
"0.5500576",
"0.5467337",
"0.5455953",
"0.5425164",
"0.54010373",
"0.53993887",
"0.5379205",
"0.53720737",
"0.5364814",... | 0.5240786 | 30 |
Return a randomly initialized hidden state tuple (h, pred, gamma) | def init_state(self, dtype=torch.float32):
device = self.device
batch_size, K = self.batch_size, self.k
# initialize h, the latent representation of each object
h = self.inner_rnn.init_hidden() * self.pred_init
# initialize pred, the (predicted) true assignment of pixels to objects
pred = torch.ones(batc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state():\n global HMC_MOM\n return dict(randstate = np.random.get_state(),\n mom = HMC_MOM)",
"def init_hidden(self):\n h0 = torch.zeros(self.num_layers, self.batch_size, self.hidden_size)\n\n return h0 # a parameter tensor of shape (self.num_layers, self.batch_size, s... | [
"0.6693352",
"0.66885066",
"0.6587457",
"0.64796203",
"0.64765036",
"0.6470142",
"0.64501524",
"0.64501524",
"0.64501524",
"0.64199156",
"0.6403299",
"0.6353586",
"0.63429105",
"0.63362277",
"0.6321232",
"0.6236399",
"0.6206321",
"0.6193823",
"0.616901",
"0.6150956",
"0.61509... | 0.71353424 | 0 |
Print the maximum well depth | def max_well(self):
maxVal = np.max(self.get_well_depth_image())
return maxVal | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_depth(self) -> int:\n return pulumi.get(self, \"max_depth\")",
"def depth(self):\n return self._max_depth",
"def max_depth(self) -> int:\n return 0",
"def well_depth(self):\n pass",
"def well_depth(self):\n return self.well.well_depth if self.well is not None else... | [
"0.7114265",
"0.70133674",
"0.70054543",
"0.6930168",
"0.68504864",
"0.6815906",
"0.6747816",
"0.6735769",
"0.66701",
"0.65934503",
"0.65464044",
"0.65301305",
"0.6522725",
"0.6513898",
"0.6355805",
"0.63549274",
"0.6348783",
"0.6279597",
"0.6252909",
"0.6245764",
"0.6213553"... | 0.7055147 | 1 |
Create an easiertoread YAMl file from a JSON one | def yaml_from_json(infile,outfile,simplifyBackg=True):
## Actually using YAML to load is cleaner
inputDict = yaml.load(open(infile))
if simplifyBackg == True:
inputDict['background'] = 'medium'
yaml.dump(inputDict,open(outfile,'w'),default_flow_style=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert(self):\n\n json_data = xjson.loads(self.jfile_path)\n\n with io.open(self.yfile_path, 'w', encoding='utf8') as f:\n yaml.dump(json_data, f, default_flow_style=False, allow_unicode=True)",
"def toy_transformer(in_file, out_file):\n new_data = {}\n new_data['experiment']... | [
"0.6179469",
"0.60503685",
"0.5671166",
"0.56228137",
"0.5493717",
"0.54805946",
"0.53973895",
"0.5394433",
"0.53698105",
"0.53600705",
"0.5355141",
"0.5326113",
"0.5312337",
"0.5307423",
"0.528752",
"0.5275285",
"0.52453",
"0.5215689",
"0.5200135",
"0.5156951",
"0.5153074",
... | 0.4848418 | 68 |
Create a Pandeia wrapper object from a dictionary rather than a YAML file | def __init__(self,paramDict):
self.pandeia_params = paramDict
self.prep_and_run() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, dikt) -> 'PipelineDefinition':\n return util.deserialize_model(dikt, cls)",
"def create(cls, dictionary):\n return cls(**dictionary)",
"def create(cls, dictionary):\n return cls(**dictionary)",
"def from_yaml(cls, loader, node):\n m = loader.construct_mapping(no... | [
"0.6443686",
"0.6223035",
"0.6223035",
"0.61783344",
"0.6173958",
"0.609547",
"0.60645956",
"0.6052679",
"0.6045101",
"0.60157603",
"0.6002219",
"0.5966936",
"0.58819526",
"0.58373886",
"0.58032596",
"0.57858056",
"0.5744804",
"0.57271725",
"0.5717609",
"0.5712735",
"0.570796... | 0.0 | -1 |
Given a filename, returns the locale it applies to | def get_language(fn):
# FIXME - this expects the fn to be '.../XX/LC_MESSAGES/messages.po'
return fn.split(os.sep)[-3] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_language_from_file_name(filename: str) -> str:\n return Path(filename).resolve().with_suffix(\"\").name",
"def get_locale():\n return \"he\"",
"def get_localised_file(self, language, filename):\n return os.path.join(\n self.get_localised_dir(language),\n filename\n ... | [
"0.72358316",
"0.67703694",
"0.6676295",
"0.61455345",
"0.61441773",
"0.6122228",
"0.6095614",
"0.60787696",
"0.6077188",
"0.59768355",
"0.5964287",
"0.5899094",
"0.5898608",
"0.58685327",
"0.5831718",
"0.5797318",
"0.5732347",
"0.57126147",
"0.5694869",
"0.56353456",
"0.5634... | 0.7120739 | 1 |
Initialize app with test user | def createTestUser(Users):
# Create 'test@test' user with 'Admin' role
if not Users.query.first():
user = Users(
firstName="test",
lastName="test",
position="test",
email="test@test",
)
db.session.add(user)
db.session.commit()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.user = {\n \"Email\": \"user@example.com\",\n \"Password\": \"pass1234\",\n \"Confirm Password\": \"pass1234\"\n }\n self.app = create_app('testing')\n self.client = self.app.test_client",
"def setUp(self):\n User.users =... | [
"0.7859173",
"0.7719847",
"0.75198776",
"0.75082",
"0.7409674",
"0.73578227",
"0.729252",
"0.7176892",
"0.71230376",
"0.70606774",
"0.702537",
"0.70012456",
"0.6986204",
"0.6968085",
"0.6962389",
"0.6954868",
"0.69530106",
"0.69463384",
"0.6934003",
"0.6904392",
"0.6902413",
... | 0.0 | -1 |
returns if a file is allowed to be uploaded to the server | def allowed_file(filename: str) -> bool:
if filename is None or filename.strip() is None:
return False
return '.' in filename and \
filename.rsplit('.', 1)[1].lower() in current_app.config['FILE_ALLOWED_EXTENSIONS'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_allowed(self):\n if self._allowed_ext:\n if self.get_ext() not in self._allowed_ext:\n return False\n \n return True",
"def allowed_upload(self, filename):\n for suffix in ['.changes', '.dsc', '.tar.gz', '.diff.gz', '.deb', '.udeb', '.tar.bz2', \".tar... | [
"0.75032014",
"0.724088",
"0.71501845",
"0.70646673",
"0.7024312",
"0.70219666",
"0.6865864",
"0.6859579",
"0.67598355",
"0.6755219",
"0.67502594",
"0.6730413",
"0.67181337",
"0.6699822",
"0.66490173",
"0.6594781",
"0.6584769",
"0.6572544",
"0.65715975",
"0.65505344",
"0.6536... | 0.67332184 | 11 |
Get upper andlower quantile of dataframe | def getquantile(df, low=0.1, high=0.9):
q1 = df.quantile(low)
q3 = df.quantile(high)
print(q1)
print(q3)
return df[df<q1],df[df>q3] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Quartiles(data):\n q = np.percentile(data, [25, 50, 75])\n\n return q[0], q[1], q[2]",
"def quartile(db: pd.DataFrame, col: str) -> pd.DataFrame:\n _, bins = pd.qcut(x=db[col],\n q=[0.25, 0.75], # [0.0, 0.25, 0.5, 0.75, 1.0],\n retbins=True, duplicates='dro... | [
"0.7058964",
"0.69517267",
"0.69203097",
"0.6902817",
"0.6843194",
"0.6779333",
"0.6776067",
"0.66477454",
"0.6614946",
"0.6611694",
"0.6608562",
"0.65918976",
"0.6586586",
"0.657616",
"0.6555758",
"0.6514577",
"0.6505057",
"0.6477352",
"0.6468778",
"0.6468122",
"0.6463169",
... | 0.77326363 | 0 |
returns zeropoint for the SDSS magnitude system | def return_zeropoint():
return 22.5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findzpd(self):\n dc=0.5*self.rms*self.ndstep\n #fixed at 0.1 of the dispersion\n dd=0.1*self.ws.coef[1]\n\n #set upt he docef values\n dcoef=self.ws.coef*0.0\n dcoef[0]=dc\n dcoef[1]=dd\n self.ws=st.findxcor(self.xarr, self.farr, self.swarr, self.sfarr, self.ws, ... | [
"0.6556048",
"0.6517042",
"0.6399438",
"0.6339326",
"0.63129085",
"0.6280735",
"0.6280735",
"0.62292665",
"0.6099617",
"0.6089385",
"0.60659134",
"0.604084",
"0.6019864",
"0.60120445",
"0.6000809",
"0.5986735",
"0.5980886",
"0.5979576",
"0.593854",
"0.5934568",
"0.5932934",
... | 0.6031223 | 12 |
Wraps hidden states in new Tensors, to detach them from their history. | def repackage_hidden(h):
if isinstance(h, torch.Tensor):
return h.detach()
else:
return tuple(repackage_hidden(v) for v in h) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detach_hidden(hidden: Any) -> Any:\n return apply_to_tensor(hidden, Tensor.detach)",
"def reset_hidden(self, hidden, reset_flags):\n # detach it from history (pytorch mechanics)\n if self.rnn_type in ['lstm', 'mylstm']:\n h = Variable(hidden[0].data)\n c = Variable(hidd... | [
"0.689674",
"0.656424",
"0.64403737",
"0.6319396",
"0.62971723",
"0.61840755",
"0.6142097",
"0.61261773",
"0.61261773",
"0.6119965",
"0.602972",
"0.60253984",
"0.6020756",
"0.59879434",
"0.5970187",
"0.5970187",
"0.59333944",
"0.59333944",
"0.59187686",
"0.5890526",
"0.587090... | 0.5653365 | 30 |
Initialize the user's bank account details. | def __init__(self, bank_name, account_num, balance):
self._bank_name = bank_name
self._account_num = account_num
self._balance = balance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.__account_number = self.__generate_acct_number()\n self.__account_pin = self.__generate_pin()\n self.card_number = BankAccount.BIN + self.__account_number \\\n + self.__calculate_checksum(BankAccount.BIN + self.__account_number)\n self.__balance = 0... | [
"0.7241929",
"0.6872748",
"0.66344535",
"0.66015023",
"0.6580289",
"0.6542164",
"0.64426255",
"0.64356387",
"0.6431768",
"0.64041346",
"0.6368054",
"0.6367499",
"0.6365742",
"0.6344973",
"0.6334896",
"0.63194376",
"0.62900966",
"0.62642276",
"0.62319744",
"0.6179763",
"0.6171... | 0.6877421 | 1 |
Return string of Account details. | def __str__(self):
return f"bank name: {self._bank_name}\n" \
f"account_num: {self._account_num}\n" \
f"balance: {self._balance}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_account_details(self):\n pass",
"def account_info(self):\n url, params, headers = self.request(\"/account/info\", method='GET')\n\n return self.rest_client.GET(url, headers)",
"def __str__(self):\n\n return \"\\nBasic Account\\nAccount Name: {self.name}\\nAccount Number: {se... | [
"0.7953251",
"0.7683874",
"0.75335044",
"0.7508491",
"0.7413034",
"0.7204539",
"0.7199108",
"0.7199108",
"0.7189947",
"0.71285456",
"0.7105496",
"0.7095678",
"0.70550644",
"0.70322794",
"0.7027024",
"0.69610566",
"0.6913635",
"0.6913635",
"0.6880421",
"0.6878685",
"0.6819799"... | 0.7172522 | 9 |
Gets the color name for the index | def class_num_to_name(class_num):
all_hues = cfg.ALL_HUE_VALUES.keys()
all_hues.sort()
hue = all_hues[class_num]
color_name = cfg.ALL_HUE_VALUES[hue]
return color_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name_color(self):\n return self._item.get(\"name_color\")",
"def get_color(self, node: Node) -> str:\n\n idx = hash(node.get_kind_name()) % len(self.colors_)\n return self.colors_[idx]",
"def name_color(self):\n return self._item.get(\"name_color\")",
"def getName(self, in... | [
"0.7261607",
"0.7235982",
"0.71976054",
"0.68193156",
"0.6806677",
"0.6746472",
"0.66673625",
"0.66234034",
"0.6597104",
"0.6589163",
"0.65766245",
"0.65323466",
"0.64205915",
"0.63300157",
"0.6327064",
"0.6323244",
"0.6313302",
"0.6256599",
"0.62456757",
"0.6224885",
"0.6206... | 0.5985902 | 37 |
The constructor of the LinearLayer takes the following parameters | def __init__(self, input_shape, n_out, ini_type="plain"):
self.m = input_shape[1] # number of examples in training data
# `params` store weights and bias in a python dictionary
self.params = self.initialize_parameters(input_shape[0], n_out, ini_type) # initialize weights and bias
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n super(LinearAggregationLayer, self).__init__()",
"def __init__(self, *args):\n super(LinearND, self).__init__()\n self.fc = nn.Linear(*args)",
"def __init__(self, in_channels, out_channels, **kwargs):\n ConstrainedLayer.__init__(self, nn.Linear(in_channels, out... | [
"0.72415245",
"0.70467407",
"0.6854869",
"0.6816551",
"0.6781154",
"0.6741812",
"0.6712872",
"0.6693825",
"0.6680953",
"0.6650694",
"0.66388404",
"0.6591748",
"0.65694875",
"0.6560593",
"0.6550114",
"0.6548804",
"0.65367305",
"0.65367305",
"0.6531216",
"0.6513397",
"0.6510700... | 0.0 | -1 |
Helper function to initialize some form of random weights and Zero biases | def initialize_parameters(self,n_in, n_out, ini_type='plain'):
params = dict() # initialize empty dictionary of neural net parameters W and b
if ini_type == 'plain':
params['W'] = np.random.randn(n_out, n_in) *0.01 # set weights 'W' to small random gaussian
elif ini_type == 'xavi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_weight_initializer(self):\n self.biases = [np.random.randn(y, 1) for y in self.sizes[1:]]\n self.weights = [np.random.randn(y, x)/np.sqrt(x)\n for x, y in zip(self.sizes[:-1], self.sizes[1:])]",
"def initWeights(self):\n self.weights = []\n self.bias... | [
"0.8071329",
"0.7991666",
"0.797467",
"0.7896712",
"0.785161",
"0.7780257",
"0.77781427",
"0.77634954",
"0.7751093",
"0.7746057",
"0.7732144",
"0.77162975",
"0.7712275",
"0.76918685",
"0.76636875",
"0.7593231",
"0.75775254",
"0.7546798",
"0.7546798",
"0.75440156",
"0.75395465... | 0.0 | -1 |
The consturctor of the sigmoid/logistic activation layer takes in the following arguments | def __init__(self, shape):
self.A = np.zeros(shape) # create space for the resultant activations | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid_activation(x):\n return 1.0 / (1 + np.exp(-x))",
"def sigmoid(X,W,b):\n preActivation = np.dot(X, W) + b\n return (1.0)/(1.0 + np.exp(-preActivation))",
"def activation(z):\n # formula for sigmoid\n return 1 / (1 + np.exp(-z))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"d... | [
"0.7784138",
"0.77828115",
"0.76102406",
"0.7416088",
"0.7416088",
"0.7414458",
"0.7406703",
"0.7384818",
"0.7364252",
"0.7341665",
"0.73181486",
"0.7303742",
"0.7299681",
"0.7293053",
"0.727587",
"0.727587",
"0.727587",
"0.727587",
"0.727587",
"0.727587",
"0.7273106",
"0.7... | 0.0 | -1 |
Computes the euclidean distance between two tensorflow variables | def compute_euclidean_distance(x, y, positive=True):
d = tf.square(tf.subtract(x, y))
d = tf.reduce_sum(d, axis=1)
if positive:
d1, indx = tf.nn.top_k(input=d, k=100)
else:
d1, indx = tf.nn.top_k(input=-d, k=100)
d1 = -1.0 * d1
return d1 * 2.0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def euclidean_distance(tensor1, tensor2):\n tensor1 = tf.convert_to_tensor(tensor1)\n tensor2 = tf.convert_to_tensor(tensor2)\n\n distance = tf.sqrt(tf.reduce_sum(tf.square(tensor1 - tensor2), axis=-1))\n\n return distance",
"def radical_euclidean_dist(x, y):\n with tf.name_scope(\"radical... | [
"0.79146487",
"0.7687573",
"0.75993615",
"0.7356422",
"0.7153242",
"0.70788014",
"0.69987154",
"0.697338",
"0.69715846",
"0.69384056",
"0.690804",
"0.6867585",
"0.6864654",
"0.68478847",
"0.6819332",
"0.6801007",
"0.67810655",
"0.67774683",
"0.67685515",
"0.6707438",
"0.66946... | 0.7411859 | 3 |
Encode given data as a DID of this type. If `scaling` is ``False`` no scaling of datas is performed. >>> foo = db.get_did_by_name('Foo') | def encode(self, data, scaling=True):
encoded = encode_data(data,
self._codec['datas'],
self._codec['formats'],
scaling)
encoded |= (0x80 << (8 * self._length))
encoded = hex(encoded)[4:].rstrip('L')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_data(self, data):\n if self.unit == \"char\":\n data = self.char_encoding(data)\n elif self.unit == \"char-ngram\":\n data = self.ngram_encoding(data)\n elif self.unit == \"morpheme\" or self.unit == \"oracle\":\n data = self.morpheme_encoding(data)\... | [
"0.5016485",
"0.49834743",
"0.49751264",
"0.49213058",
"0.4877217",
"0.47953728",
"0.47856757",
"0.47749007",
"0.4741698",
"0.47310862",
"0.4730063",
"0.47281894",
"0.47281894",
"0.47180304",
"0.4695116",
"0.46833947",
"0.46808097",
"0.4680291",
"0.4608045",
"0.4579615",
"0.4... | 0.549835 | 0 |
Finds unicode emoji in a string. Yields all normal characters as a named | def tokenize(string, keep_zwj: bool) -> Iterator[Token]:
tree = get_search_tree()
EMOJI_DATA = unicode_codes.EMOJI_DATA
# result: [ Token(oldsubstring0, EmojiMatch), Token(char1, char1), ... ]
result = []
i = 0
length = len(string)
ignore = [] # index of chars in string that are skipped, i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_emoji(term: str) -> None:\n term = term.lower()\n emoji_mapping = _make_emoji_mapping()\n\n for emoji, name in emoji_mapping.items():\n if term in name:\n print(f\"{name.strip().title():>42} | {emoji}\")\n else:\n print(\"no matches\")",
"def find_emoji(term):\r\n ... | [
"0.66739917",
"0.65177566",
"0.6369205",
"0.62317204",
"0.6205675",
"0.59982646",
"0.5983602",
"0.5976363",
"0.59678835",
"0.5957423",
"0.5911751",
"0.5832382",
"0.58016235",
"0.57536376",
"0.5738196",
"0.57269853",
"0.56566364",
"0.56560844",
"0.5633768",
"0.56320775",
"0.55... | 0.55582255 | 23 |
Returns configs for redis >>> get_redis_configs()['external_redis'] False >>> get_redis_configs()['redis_url_reg'] | def get_redis_configs(internal_redis=None, external_redis=None, with_trivy=True):
internal_redis = internal_redis or {}
external_redis = external_redis or {}
configs = dict(external_redis=bool(external_redis))
# internal redis config as the default
redis = {
'host': 'redis:6379',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redis_config(self):\n def func(server):\n return server.config()\n self.__run_redis_cmd(func)",
"def _get_redis(self, config):\n expected_options = {'host', 'port', 'db_id'}\n _warn_on_extra(set(config.options('redis')) - expected_options -\n self.... | [
"0.7111657",
"0.6616137",
"0.64428383",
"0.62798464",
"0.62027335",
"0.61338097",
"0.6040582",
"0.6000731",
"0.5993893",
"0.5980946",
"0.59253126",
"0.5914757",
"0.5889073",
"0.5858368",
"0.57965416",
"0.57935196",
"0.57674205",
"0.57398766",
"0.57398033",
"0.57388157",
"0.57... | 0.7348659 | 0 |
Read file, where each sentence is dilineated by a `\n`. | def read_corpus(file_path, source):
data = []
for line in open(file_path):
sent = line.strip().split(' ')
# only append <s> and </s> to the target sentence
if source == 'tgt':
sent = ['<s>'] + sent + ['</s>'] #TODO: Change
data.append(sent)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_file(input_file):\n with open(input_file, \"r\", encoding=\"utf-8-sig\") as f:\n sentences = f.read().splitlines()\n return sentences",
"def _read_sentences(filename):\n with tf.gfile.GFile(filename, \"r\") as f:\n return [sentence.split() for sentence in f.read().split('\\n')]",
... | [
"0.73846066",
"0.7183166",
"0.7035023",
"0.6850842",
"0.6850842",
"0.68262714",
"0.67237",
"0.67034435",
"0.6676033",
"0.6676033",
"0.66496515",
"0.6593011",
"0.658854",
"0.6586248",
"0.65819913",
"0.65717185",
"0.65479195",
"0.6546123",
"0.65246904",
"0.651413",
"0.650853",
... | 0.0 | -1 |
this will only be executed when email field is present for unauthenticated users | def clean_email(self):
email = self.cleaned_data['email']
return email.strip().lower() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_email(self):\r\n email = self.cleaned_data[\"email\"]\r\n #The line below contains the only change, removing is_active=True\r\n self.users_cache = User.objects.filter(email__iexact=email)\r\n if not len(self.users_cache):\r\n raise forms.ValidationError(self.error_m... | [
"0.74899983",
"0.746608",
"0.7119564",
"0.7081039",
"0.704882",
"0.7043228",
"0.7021055",
"0.7021055",
"0.698694",
"0.69815254",
"0.69815254",
"0.6979202",
"0.69714695",
"0.69650376",
"0.6918182",
"0.6900484",
"0.68958014",
"0.68905514",
"0.6879052",
"0.6857374",
"0.6846318",... | 0.6155504 | 77 |
Will the snake collide with itself if it proceeds in the direction provided | def will_snake_collide_with_itself_for_direction(self, direction):
snake_head_x = self.x[0]
snake_head_y = self.y[0]
for itr in range(1, self.length):
if self.y[itr] == snake_head_y:
if direction == constants.RIGHT:
if abs(snake_head_x + self.step ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def will_collide(self, direction=None):\n new_origin, new_positions = self.active_piece.try_move(direction=direction)\n for row, col in new_positions:\n y, x = new_origin[0] + row, new_origin[1] + col\n if y > 19 or y < 0 or x > 9 or x < 0 or self.board[y][x] == '#':\n ... | [
"0.69015956",
"0.6760199",
"0.6635991",
"0.6466222",
"0.62571543",
"0.6251721",
"0.60652214",
"0.5982337",
"0.59570205",
"0.5948154",
"0.588335",
"0.58068675",
"0.57861465",
"0.5783076",
"0.57496506",
"0.5748788",
"0.5744691",
"0.57365465",
"0.5728851",
"0.5703517",
"0.569623... | 0.7903229 | 0 |
GENERATES the INITIAL VALUES of the independent variables of f. | def initial_x():
# RANDOMLY GENERATES the INITIAL VALUES of the independent variables:
temp = [uniform(1, cfg.n) for i in range(cfg.n)]
return np.array(temp, dtype=np.float_) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initializeVariables(F_n):\n bounds = [(-100, 100), (-10, 10), (-100, 100), (-100, 100), (-30, 30),\n (-100, 100), (-1.28, 1.28), (-500, 500), (-5.12, 5.12),\n (-32, 32), (-600, 600), (-50, 50), (-50, 50)]\n\n if F_n == 8:\n objectiveValue = -12569.5\n else:\n ob... | [
"0.58772075",
"0.58168614",
"0.5710214",
"0.5688034",
"0.5661912",
"0.5652736",
"0.5645177",
"0.5624059",
"0.56129456",
"0.5569354",
"0.54938596",
"0.548858",
"0.54423726",
"0.5442295",
"0.5412203",
"0.5401658",
"0.538518",
"0.53806996",
"0.5380251",
"0.5375289",
"0.53724855"... | 0.7181554 | 0 |
takes an integer PersonAge and sets the person's age | def set_age (self, PersonAge):
self.age = PersonAge | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setAge(self, age):\r\n self.age = age",
"def set_age(self, age):\n self.__age = age",
"def setAge(self, age):\n self._age = age",
"def set_age(self, age):\n self.age = float(age)",
"def set_age(self, newage):\n self.age = newage",
"def age(self, age):\n\n se... | [
"0.822595",
"0.8206998",
"0.8182792",
"0.8143692",
"0.7933872",
"0.7819523",
"0.7819523",
"0.7484549",
"0.6869972",
"0.6842357",
"0.6750477",
"0.6635483",
"0.65704006",
"0.65447265",
"0.64919263",
"0.629428",
"0.60075104",
"0.5971527",
"0.5918435",
"0.58816797",
"0.58711505",... | 0.8619475 | 0 |
returns an rgb tuple with random values between 0 and 255 | def getRandColor():
return (randrange(0,256), randrange(0,256), randrange(0,256)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_color():\n\n rgbl=[255,0,0]\n random.shuffle(rgbl)\n return tuple(rgbl)",
"def randcolor():\n return (randint(0,255), randint(0,255), randint(0,255))",
"def random_color() -> Tuple[int, int, int]:\n return randrange(0, 255), randrange(0, 255), randrange(0, 255)",
"def random_colour(rn... | [
"0.8665915",
"0.86478716",
"0.8604022",
"0.84514165",
"0.8372857",
"0.8356782",
"0.8341259",
"0.8297525",
"0.8124699",
"0.80766463",
"0.8002509",
"0.7954558",
"0.79482937",
"0.79239154",
"0.7919847",
"0.78828275",
"0.7835661",
"0.7819847",
"0.7722076",
"0.76877105",
"0.763344... | 0.8463004 | 3 |
Test choose_author function in few cases | def test_choose_author():
assert choose_author(['string']) == True
assert isinstance(choose_author(['string']), bool)
assert callable(choose_author) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_citedby_author(self):\n inv_search = 'citedby:author:doggy'\n spi_search = 'find citedby author doggy'\n self._compare_searches(inv_search, spi_search)",
"def test_author_simplest(self):\n invenio_search = 'author:ellis'\n spires_search = 'find a el... | [
"0.6842973",
"0.68008196",
"0.6709151",
"0.6692063",
"0.66668206",
"0.6654014",
"0.6625926",
"0.6624629",
"0.65706336",
"0.65181315",
"0.6478356",
"0.64252007",
"0.6374737",
"0.6306689",
"0.62766445",
"0.625765",
"0.62563014",
"0.6249113",
"0.62451863",
"0.6243384",
"0.621431... | 0.7799905 | 0 |
convert rational number string to float | def convert(srat):
try:
return float(srat)
except ValueError:
num, denom = srat.split('/')
return float(num) / float(denom) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _to_float(self, s: str) -> float:\n return int(s[:-1]) / 1e9 if s.endswith('n') else float(s[:-1])",
"def convert_to_float(frac_str):\n try:\n return float(frac_str)\n except ValueError:\n num, denom = frac_str.split('/')\n try:\n leading, num = num.split(' ')\n ... | [
"0.7691206",
"0.7396409",
"0.73931617",
"0.7294042",
"0.72204506",
"0.710605",
"0.7017163",
"0.69722325",
"0.6960623",
"0.69555604",
"0.6950857",
"0.69220334",
"0.6915541",
"0.6834789",
"0.6820067",
"0.68153596",
"0.6795418",
"0.6756995",
"0.67435974",
"0.67410713",
"0.673772... | 0.6928807 | 11 |
Finds median approximate median value of an array. Approximate the median (median value is the middle value of a sorted list | def _median_of_three(array, lower, upper):
mid = (lower + upper) // 2
a = array[lower]
b = array[mid]
c = array[upper]
# As only three unordered elements are passed down, the middle element must
# be found through comparisons
if a <= b <= c or c <= b <= a:
return mid
if a <= c ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def median(array):\n sorted = [x for x in array]\n sorted.sort()\n middle = len(sorted)/2 #Gets the middle element, if present\n if len(sorted) % 2 == 0: #Even, so need to average together the middle two values\n return float((sorted[middle]+sorted[middle-1]))/2\n else:\n return sorted... | [
"0.8537622",
"0.81164473",
"0.8107881",
"0.8107752",
"0.8088567",
"0.80525",
"0.79944366",
"0.7900605",
"0.7863912",
"0.7856012",
"0.7845431",
"0.78445613",
"0.78111076",
"0.78048295",
"0.77965456",
"0.77292794",
"0.76929307",
"0.7690816",
"0.7688727",
"0.76869506",
"0.768492... | 0.70147365 | 59 |
Compute softmax values for each sets of scores in V. each column of V is a set of score. | def softmax(Z):
e_Z = np.exp(Z)
A = e_Z / e_Z.sum(axis = 0)
return A | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_softmax(scores):\n if not scores:\n return []\n\n max_score = None\n for score in scores:\n if max_score is None or score > max_score:\n max_score = score\n\n exp_scores = []\n total_sum = 0.0\n for score in scores:\n x = np.exp(score - max_score)\n exp_scores.append(x)\n tot... | [
"0.7158194",
"0.7047147",
"0.7046276",
"0.70425",
"0.70425",
"0.70425",
"0.70425",
"0.6971333",
"0.6776071",
"0.6765804",
"0.6621016",
"0.64983344",
"0.64933544",
"0.64102453",
"0.63794756",
"0.6377974",
"0.63686955",
"0.63142264",
"0.63112575",
"0.6295851",
"0.6282287",
"0... | 0.0 | -1 |
Add a new experience to memory. | def add(self, state, action, reward, next_state, done):
e = self.experience(state, action, reward, next_state, done)
self.memory.append(e) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_new_experience(self, state, action, reward, next_state, done):\n e = self.experience(state, action, reward, next_state, done, self.max_priority)\n self.memory.append(e)",
"def add(self, state, action, reward, next_state, done):\n experience = Experience(state, action, reward, next_st... | [
"0.79568833",
"0.79042006",
"0.78795445",
"0.7577913",
"0.7570969",
"0.74478436",
"0.7361023",
"0.72697705",
"0.721816",
"0.71451885",
"0.7106998",
"0.7101183",
"0.69837016",
"0.68905056",
"0.68842727",
"0.6755663",
"0.6712557",
"0.6677425",
"0.64961654",
"0.6488678",
"0.6486... | 0.71984994 | 18 |
Return the current size of internal memory. | def __len__(self):
return len(self.memory) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSize(self) -> int:\n return len(self.mem)",
"def getSize(self):\n return self.bf.memory()",
"def memsize(self):\n return self.xlist(\"get-memsize\")[1][0] * 1024",
"def size(self):\n size = 0\n size += self.data.size * sys.getsizeof(self.data)\n return size / ... | [
"0.8573752",
"0.82169205",
"0.8200361",
"0.8087402",
"0.8021614",
"0.7890747",
"0.78219426",
"0.78017354",
"0.77905464",
"0.7758844",
"0.77559924",
"0.77559924",
"0.775519",
"0.77544576",
"0.7733221",
"0.7732168",
"0.7720068",
"0.77145016",
"0.77092093",
"0.77077913",
"0.7697... | 0.75127405 | 59 |
get the header colmns of a table, from database. Sets sql attribute to sql used to get headers, and table attribue to table retured | def get_headers (self, table, schema = 'TABLES'):
get_headers = ("SELECT * FROM information_schema.columns WHERE "
"table_schema = " + schema + " AND "
"table_name = " + table + "")
b_sql, b_table, self.sql = self.sql, self.table, get_headers
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_header(conn, table):\r\n cursor = conn.cursor()\r\n header = f\"SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '{table}'\"\r\n cursor.execute(header)\r\n table_header = cursor.fetchall() #returns list of tuples\r\n header_list = []\r\n for c_header in table_header:\r\n heade... | [
"0.7002399",
"0.6503627",
"0.6435246",
"0.6397863",
"0.6284719",
"0.6202354",
"0.6168601",
"0.6166977",
"0.6119524",
"0.59969443",
"0.59869707",
"0.59706676",
"0.59695715",
"0.5945299",
"0.5873819",
"0.5873045",
"0.58710456",
"0.5850913",
"0.58275044",
"0.5825417",
"0.5824443... | 0.7477854 | 0 |
returns contents of self.table as pandas DataFrame with column names if possible. Returns pandas.dataframe contents of self.table as pandas DataFrame | def as_named_DataFrame (self):
if self.sql == "":
return DataFrame([])
flag, values = self.parse_sql()
try:
if flag == 'EXPLICIT':
return DataFrame(self.table, columns = values)
elif flag == 'IMPLICIT':
schema = "'" + values[0] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_DataFrame (self):\n return DataFrame(self.table)",
"def get_df(self) -> pd.DataFrame:\n return pd.DataFrame(self.fetchall(), columns=self.headers())",
"def select_from_table(self, table_name):\n sql_str = \"SELECT * FROM {tb}\".format(tb=table_name)\n cur = self.conn.cursor()... | [
"0.83760315",
"0.75889075",
"0.74760735",
"0.73990023",
"0.7388382",
"0.7341949",
"0.7313462",
"0.71790713",
"0.7107322",
"0.70177686",
"0.7011033",
"0.7009237",
"0.69849825",
"0.6962791",
"0.6958403",
"0.69425315",
"0.69333535",
"0.6924849",
"0.685934",
"0.676409",
"0.673565... | 0.7593289 | 1 |
Split the dataframe into the set of partitions | def parallelize_dataframe(df, func, num_partitions):
df_split = np.array_split(df, num_partitions)
pool = mp.Pool(num_partitions)
df = pd.concat(pool.map(func, df_split))
pool.close()
pool.join()
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_split(self):\n array = np.arange(1000)\n df = DataFlow.from_numpy(array)\n\n # first, test throw errors on invalid arguments\n def assert_invalid_arg(**kwargs):\n with self.assertRaises(ValueError):\n df.split(**kwargs)\n assert_invalid_arg(part... | [
"0.70947784",
"0.6920228",
"0.68956256",
"0.6866534",
"0.67028534",
"0.66178304",
"0.6537273",
"0.6474114",
"0.63562185",
"0.63339967",
"0.6318787",
"0.6256318",
"0.62377965",
"0.6220456",
"0.6202459",
"0.6202277",
"0.6187662",
"0.61835164",
"0.6180054",
"0.6178323",
"0.61760... | 0.5535223 | 99 |
Initialize a RIDDLE model. | def __init__(self, model, num_class, max_num_epoch=-1, batch_size=128,
patience=1):
self._model = model
self._num_class = num_class
if max_num_epoch < 1:
max_num_epoch = MAX_NUM_EPOCH
self._max_num_epoch = max_num_epoch
self._batch_size = batch_size
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_model(self):\n pass",
"def init_model(self):\n pass",
"def initialize(self, model):\n pass",
"def _init_model(self, forrest):\n rels = self.get_rels(forrest)\n self._model = RDPModel(rels)",
"def initialize(self) -> None:\n self.model = load(self.pat... | [
"0.7799717",
"0.76852393",
"0.7584165",
"0.7493818",
"0.7474814",
"0.7322151",
"0.7322151",
"0.7200487",
"0.7117798",
"0.7106998",
"0.6974054",
"0.6974054",
"0.6974054",
"0.6974054",
"0.69738984",
"0.68970233",
"0.6881011",
"0.687463",
"0.68275225",
"0.68083614",
"0.6792363",... | 0.0 | -1 |
Generator which yields nsized chunks from a list. | def chunks(lst, n):
assert n > 0
for i in range(0, len(lst), n):
chunk = lst[i:i + n]
yield chunk | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunks(self, lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def chunks(lst, n):\n for i in range(0, len(lst), n):\n yield lst[i : i + n]",
"def chunks(lst, n... | [
"0.78882265",
"0.783065",
"0.77623785",
"0.77594334",
"0.77594334",
"0.7754111",
"0.7741967",
"0.77418536",
"0.7724363",
"0.7724363",
"0.77098286",
"0.76860744",
"0.76789236",
"0.7664232",
"0.7634463",
"0.7634463",
"0.7634463",
"0.7634463",
"0.7634463",
"0.763053",
"0.7628102... | 0.76549304 | 14 |
Information about the Amazon S3 bucket containing the application code. | def s3_content_location(self) -> Optional[pulumi.Input['ApplicationApplicationConfigurationApplicationCodeConfigurationCodeContentS3ContentLocationArgs']]:
return pulumi.get(self, "s3_content_location") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def s3_bucket_name(self):\n return self._get_param(\"ResourcesS3Bucket\")",
"def s3_bucket(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"s3_bucket\")",
"def bucket(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"bucket\")",
"def bucket(self) -> pulumi.Output[str]:\n ... | [
"0.7434443",
"0.7344199",
"0.73142916",
"0.73142916",
"0.7262713",
"0.7176705",
"0.7176705",
"0.71574205",
"0.7108692",
"0.70733416",
"0.70733416",
"0.70376784",
"0.6956204",
"0.6898854",
"0.684577",
"0.68426275",
"0.6832975",
"0.6788647",
"0.6788647",
"0.67746747",
"0.677467... | 0.0 | -1 |
The ARN for the S3 bucket containing the application code. | def bucket_arn(self) -> pulumi.Input[str]:
return pulumi.get(self, "bucket_arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bucket_arn(self) -> str:\n return jsii.get(self, \"bucketArn\")",
"def bucket_arn(self) -> str:\n return jsii.get(self, \"bucketArn\")",
"def bucket_arn(self) -> str:\n ...",
"def bucket_arn(self) -> typing.Optional[str]:\n return self._values.get('bucket_arn')",
"def s3_buc... | [
"0.8126707",
"0.8126707",
"0.8067898",
"0.7302088",
"0.6633249",
"0.64334524",
"0.6313027",
"0.6313027",
"0.6313027",
"0.6313027",
"0.6313027",
"0.6286308",
"0.6286308",
"0.6286308",
"0.6286308",
"0.6286308",
"0.6286308",
"0.6286308",
"0.6286308",
"0.6286308",
"0.6286308",
... | 0.76835716 | 4 |
The file key for the object containing the application code. | def file_key(self) -> pulumi.Input[str]:
return pulumi.get(self, "file_key") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_key(filename):\n return FILE_PREFIX + filename",
"def key_file(self):\n return self._get('key_file')",
"def key(self):\n key = self.name\n if self.task:\n key += getsource(self.task.__class__)\n return hashlib.md5(key.encode()).hexdigest()",
"def key(self):\... | [
"0.7508476",
"0.73354226",
"0.7072803",
"0.69536316",
"0.69291615",
"0.69158894",
"0.6855917",
"0.679805",
"0.6769428",
"0.67669773",
"0.6765789",
"0.67546976",
"0.6742771",
"0.6728351",
"0.6709861",
"0.6701392",
"0.6701392",
"0.6701392",
"0.6701392",
"0.6701392",
"0.6701392"... | 0.75691706 | 1 |
The key of the application execution property keyvalue map. | def property_group_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "property_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key(self):\n if \"key\" in self._prop_dict:\n return self._prop_dict[\"key\"]\n else:\n return None",
"def key(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"key\")",
"def key(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"key\")",
"de... | [
"0.7160247",
"0.6715007",
"0.6715007",
"0.6628513",
"0.65962565",
"0.659621",
"0.659621",
"0.659621",
"0.659621",
"0.659621",
"0.659621",
"0.659621",
"0.659621",
"0.659621",
"0.659621",
"0.659621",
"0.659621",
"0.659621",
"0.659621",
"0.659621",
"0.659621",
"0.659621",
"0... | 0.0 | -1 |
The name of the column that is created in the inapplication input stream or reference table. | def name(self) -> pulumi.Input[str]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"column_name\")",
"def column_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"column_name\")",
"def get_name(self):\n return self.col_name",
"def columnName(self):\n return self.__column",
"def c... | [
"0.829728",
"0.829728",
"0.8044075",
"0.7931571",
"0.7920496",
"0.7434196",
"0.73950624",
"0.7157008",
"0.7115821",
"0.7115821",
"0.7068982",
"0.6940135",
"0.68992466",
"0.6878071",
"0.68575674",
"0.6854659",
"0.6827644",
"0.6827644",
"0.67406684",
"0.6701877",
"0.6692907",
... | 0.0 | -1 |
Provides additional mapping information specific to the record format (such as JSON, CSV, or record fields delimited by some delimiter) on the streaming source. | def mapping_parameters(self) -> pulumi.Input['ApplicationApplicationConfigurationSqlApplicationConfigurationInputInputSchemaRecordFormatMappingParametersArgs']:
return pulumi.get(self, "mapping_parameters") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __convert( source ):\n # Just in case things get this far but we don't know about the record\n if source['recordType'] not in definitions.RECORDS:\n return {\n 'rec_type': source['recordType']\n }\n\n # Create a flat wrapper\n record = estreamer.common.Flatdict( source )\n\... | [
"0.64300466",
"0.5807673",
"0.57702976",
"0.57081705",
"0.5628267",
"0.5627498",
"0.559967",
"0.5540356",
"0.5518616",
"0.54192805",
"0.54103154",
"0.54093325",
"0.53269774",
"0.53067076",
"0.53051627",
"0.5278323",
"0.52649146",
"0.5245737",
"0.5237092",
"0.5235683",
"0.5228... | 0.0 | -1 |
The column delimiter. For example, in a CSV format, a comma (`,`) is the typical column delimiter. | def record_column_delimiter(self) -> pulumi.Input[str]:
return pulumi.get(self, "record_column_delimiter") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_delimiter(ds_path: str) -> str:\n with open(ds_path) as f:\n first_line = f.readline()\n s = csv.Sniffer()\n return s.sniff(first_line).delimiter",
"def detect_csv_separator(filename):\n with open(filename) as csvfile:\n first_line = csvfile.readline()\n return cs... | [
"0.7160481",
"0.69935775",
"0.6887538",
"0.6887538",
"0.66514015",
"0.65056276",
"0.6475536",
"0.6418397",
"0.64122546",
"0.6394634",
"0.61797684",
"0.61778563",
"0.6057239",
"0.5975895",
"0.5971224",
"0.5918189",
"0.5899364",
"0.5842732",
"0.5809351",
"0.57896143",
"0.571567... | 0.82689506 | 1 |
The ARN of the input Kinesis data stream to read. | def resource_arn(self) -> pulumi.Input[str]:
return pulumi.get(self, "resource_arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arn(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"arn\")",
"def log_stream_arn(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"log_stream_arn\")",
"def arn(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> Optional[pulumi.I... | [
"0.72147",
"0.7054847",
"0.69893575",
"0.69893575",
"0.69893575",
"0.69893575",
"0.69893575",
"0.69893575",
"0.69893575",
"0.69893575",
"0.69893575",
"0.69893575",
"0.69893575",
"0.69893575",
"0.69893575",
"0.69893575",
"0.69893575",
"0.69893575",
"0.69893575",
"0.69893575",
... | 0.6498027 | 30 |
The ARN of the destination Lambda function to write to. | def resource_arn(self) -> pulumi.Input[str]:
return pulumi.get(self, "resource_arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destination_arn(self) -> str:\n return jsii.get(self, \"destinationArn\")",
"def destination_function(self):\n return self._event['destination_function_name']",
"def notification_lambda_arn(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"notification_lambda_arn\")",
... | [
"0.69213694",
"0.6328486",
"0.54974574",
"0.5482789",
"0.548099",
"0.54782295",
"0.5476969",
"0.5457332",
"0.53916633",
"0.53796774",
"0.5358812",
"0.5358812",
"0.5358812",
"0.5358812",
"0.5358812",
"0.5358812",
"0.5358812",
"0.5358812",
"0.5358812",
"0.5358812",
"0.5358812",... | 0.49433807 | 64 |
Identifies the S3 bucket and object that contains the reference data. | def s3_reference_data_source(self) -> pulumi.Input['ApplicationApplicationConfigurationSqlApplicationConfigurationReferenceDataSourceS3ReferenceDataSourceArgs']:
return pulumi.get(self, "s3_reference_data_source") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_bucket_key(self, download_meta):\n if 'bucket' in download_meta:\n resolved_bucket = download_meta['bucket']\n if resolved_bucket != self.bucket:\n log.error(f'Bucket mismatch found with blobs, overriding metadata and using bucket {self.bucket}')\n ... | [
"0.6065481",
"0.5919647",
"0.582233",
"0.5819789",
"0.579438",
"0.57894707",
"0.56910235",
"0.5639296",
"0.5610232",
"0.55327755",
"0.5522789",
"0.5498683",
"0.54752314",
"0.5445441",
"0.54333544",
"0.54255754",
"0.53870666",
"0.53709435",
"0.53709435",
"0.53534746",
"0.53498... | 0.511651 | 56 |
The name of the column that is created in the inapplication input stream or reference table. | def name(self) -> pulumi.Input[str]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"column_name\")",
"def column_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"column_name\")",
"def get_name(self):\n return self.col_name",
"def columnName(self):\n return self.__column",
"def c... | [
"0.82973266",
"0.82973266",
"0.80434585",
"0.7930917",
"0.7919774",
"0.7434645",
"0.73943686",
"0.71573234",
"0.71156925",
"0.71156925",
"0.7068516",
"0.6940404",
"0.689935",
"0.68779564",
"0.685796",
"0.6854273",
"0.6828302",
"0.6828302",
"0.67404133",
"0.6701833",
"0.669295... | 0.0 | -1 |
Provides additional mapping information specific to the record format (such as JSON, CSV, or record fields delimited by some delimiter) on the streaming source. | def mapping_parameters(self) -> pulumi.Input['ApplicationApplicationConfigurationSqlApplicationConfigurationReferenceDataSourceReferenceSchemaRecordFormatMappingParametersArgs']:
return pulumi.get(self, "mapping_parameters") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __convert( source ):\n # Just in case things get this far but we don't know about the record\n if source['recordType'] not in definitions.RECORDS:\n return {\n 'rec_type': source['recordType']\n }\n\n # Create a flat wrapper\n record = estreamer.common.Flatdict( source )\n\... | [
"0.6430963",
"0.58090264",
"0.5772521",
"0.57086974",
"0.5628836",
"0.5627251",
"0.55993",
"0.55380976",
"0.5519563",
"0.5419827",
"0.54123056",
"0.54118365",
"0.5326372",
"0.5307383",
"0.530351",
"0.52786857",
"0.52669024",
"0.52456933",
"0.52389646",
"0.5235582",
"0.5229287... | 0.47862607 | 66 |
The column delimiter. For example, in a CSV format, a comma (`,`) is the typical column delimiter. | def record_column_delimiter(self) -> pulumi.Input[str]:
return pulumi.get(self, "record_column_delimiter") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_delimiter(ds_path: str) -> str:\n with open(ds_path) as f:\n first_line = f.readline()\n s = csv.Sniffer()\n return s.sniff(first_line).delimiter",
"def detect_csv_separator(filename):\n with open(filename) as csvfile:\n first_line = csvfile.readline()\n return cs... | [
"0.7158849",
"0.69919837",
"0.68864447",
"0.68864447",
"0.66498417",
"0.6502271",
"0.6472595",
"0.6415401",
"0.6408405",
"0.6391545",
"0.617637",
"0.61740214",
"0.6055878",
"0.59736997",
"0.5968155",
"0.59172034",
"0.58977574",
"0.5841925",
"0.5807263",
"0.57889515",
"0.57141... | 0.8267689 | 0 |
The ARN for the S3 bucket containing the application code. | def bucket_arn(self) -> pulumi.Input[str]:
return pulumi.get(self, "bucket_arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bucket_arn(self) -> str:\n return jsii.get(self, \"bucketArn\")",
"def bucket_arn(self) -> str:\n return jsii.get(self, \"bucketArn\")",
"def bucket_arn(self) -> str:\n ...",
"def bucket_arn(self) -> typing.Optional[str]:\n return self._values.get('bucket_arn')",
"def s3_buc... | [
"0.8126707",
"0.8126707",
"0.8067898",
"0.7302088",
"0.6633249",
"0.64334524",
"0.6313027",
"0.6313027",
"0.6313027",
"0.6313027",
"0.6313027",
"0.6286308",
"0.6286308",
"0.6286308",
"0.6286308",
"0.6286308",
"0.6286308",
"0.6286308",
"0.6286308",
"0.6286308",
"0.6286308",
... | 0.76835716 | 3 |
The file key for the object containing the application code. | def file_key(self) -> pulumi.Input[str]:
return pulumi.get(self, "file_key") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_key(filename):\n return FILE_PREFIX + filename",
"def key_file(self):\n return self._get('key_file')",
"def key(self):\n key = self.name\n if self.task:\n key += getsource(self.task.__class__)\n return hashlib.md5(key.encode()).hexdigest()",
"def key(self):\... | [
"0.7508476",
"0.73354226",
"0.7072803",
"0.69536316",
"0.69291615",
"0.69158894",
"0.6855917",
"0.679805",
"0.6769428",
"0.67669773",
"0.6765789",
"0.67546976",
"0.6742771",
"0.6728351",
"0.6709861",
"0.6701392",
"0.6701392",
"0.6701392",
"0.6701392",
"0.6701392",
"0.6701392"... | 0.75691706 | 0 |
When we've iterated through all events, we're ready to write all sessions to the database. This closes all existing open sessions, in order to have all session information ready to save to the database. | def close_open_sessions(self):
for open_session in self.current_sessions.values():
self.closed_sessions.append(open_session.close_session())
self.current_sessions = {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n for session in self.sessions.copy().values():\n session.close(SessionCloseErrorCode.SESSION_DIED)",
"def close_all_sessions() -> None:\n\n for sess in _sessions.values():\n sess.close()",
"def close_all(cls):\n for sess in cls._session_registry.values():\n ... | [
"0.709628",
"0.7039125",
"0.69403845",
"0.68360966",
"0.6827279",
"0.66981196",
"0.6578849",
"0.6561418",
"0.6509728",
"0.64647",
"0.6436674",
"0.63637483",
"0.63128906",
"0.6096886",
"0.6079238",
"0.6076759",
"0.60607976",
"0.6045697",
"0.60410523",
"0.60390896",
"0.6037184"... | 0.6953104 | 2 |
Use None instead of empty dict for env. | def _transform_env(self) -> None:
self.env = None if self.env == {} else self.env | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty_env(self):\n return ()",
"def get_empty_env():\n return EvalEnvironment(namespaces={})",
"def get_empty_env():\n return EvalEnvironment(namespaces={})",
"def _finalize_env(self, env: Dict[str, str]) -> None:\n\n # add the applicable kernel_id and language to the env dict\n ... | [
"0.7506495",
"0.6892591",
"0.6892591",
"0.6722652",
"0.66688734",
"0.6521722",
"0.65181935",
"0.6515571",
"0.6515571",
"0.6515571",
"0.64632887",
"0.6430169",
"0.63657653",
"0.6362443",
"0.6330296",
"0.6307691",
"0.62757427",
"0.6272593",
"0.62555563",
"0.6251175",
"0.6251175... | 0.78597975 | 0 |
Creates an Implementation object from a PipelineSpec message in dict format. | def from_pipeline_spec_dict(cls, pipeline_spec_dict: Dict[str, Any],
component_name: str) -> 'Implementation':
executor_key = utils.sanitize_executor_label(component_name)
executor = pipeline_spec_dict['deploymentSpec']['executors'].get(
executor_key)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_msg(cls, msg):\n if cls._debug:\n log.debug('msg=%s', msg)\n key, seq_s, uuid, prop_s, body = msg\n key = key if key else None\n seq = struct.unpack('!q', seq_s)[0]\n body = body if body else None\n if body:\n body = pipeline.load(body)\n ... | [
"0.6436397",
"0.6267915",
"0.61444587",
"0.61162764",
"0.57210857",
"0.56808233",
"0.5630783",
"0.5594873",
"0.5483311",
"0.5461722",
"0.5453731",
"0.5427917",
"0.53711474",
"0.53690076",
"0.53684783",
"0.5307283",
"0.5288682",
"0.5273172",
"0.52257395",
"0.5142328",
"0.51401... | 0.73927045 | 0 |
Converts the name to a valid name. | def _transform_name(self) -> None:
self.name = utils.maybe_rename_for_k8s(self.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_name(self, name):\n if not self.re_name.match(name):\n org_name = name\n name = self.re_white.sub('_', name)\n name = self.re_alpha.sub('_', name)\n if not self.re_name.match(name):\n name = 'x_' + name2\n self.warn('Converti... | [
"0.8116373",
"0.7573032",
"0.75393856",
"0.7502956",
"0.7433997",
"0.7368573",
"0.7367807",
"0.7359006",
"0.7339633",
"0.72981745",
"0.72954786",
"0.7286506",
"0.7286506",
"0.7286506",
"0.72072476",
"0.718355",
"0.71751446",
"0.7170703",
"0.716226",
"0.71534574",
"0.7147013",... | 0.626844 | 85 |
Converts a duration string to seconds. | def convert_duration_to_seconds(duration: str) -> int:
duration = normalize_time_string(duration)
seconds_per_unit = {'s': 1, 'm': 60, 'h': 3_600, 'd': 86_400, 'w': 604_800}
if duration[-1] not in seconds_per_unit.keys():
raise ValueError(
f"Unsupported duration unit: '{duration[-1]}' fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _duration_to_secs(duration):\n secs = int(duration[:-1])\n if duration[-1] == 's':\n pass\n elif duration[-1] == 'm':\n secs *= 60\n elif duration[-1] == 'h':\n secs *= 60 * 60\n elif duration[-1] == 'd':\n secs *= 60 * 60 * 24\n ... | [
"0.8086014",
"0.77428716",
"0.763269",
"0.7523472",
"0.74770683",
"0.733889",
"0.7248498",
"0.71414965",
"0.70478374",
"0.7006096",
"0.6958672",
"0.68102986",
"0.671041",
"0.6706914",
"0.66889966",
"0.6648879",
"0.65866536",
"0.65786785",
"0.65781003",
"0.65767723",
"0.655214... | 0.7933268 | 1 |
Loads up to two YAML documents from a YAML string. First document must always be present. If second document is present, it is returned as a dict, else an empty dict. | def load_documents_from_yaml(component_yaml: str) -> Tuple[dict, dict]:
documents = list(yaml.safe_load_all(component_yaml))
num_docs = len(documents)
if num_docs == 1:
pipeline_spec_dict = documents[0]
platform_spec_dict = {}
elif num_docs == 2:
pipeline_spec_dict = documents[0]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yaml_parse(yamlstr):\n try:\n # PyYAML doesn't support json as well as it should, so if the input\n # is actually just json it is better to parse it with the standard\n # json parser.\n return json.loads(yamlstr, object_pairs_hook=OrderedDict)\n except ValueError:\n loa... | [
"0.6587058",
"0.658387",
"0.6566409",
"0.6374544",
"0.62657386",
"0.62417525",
"0.6167273",
"0.6147996",
"0.60870063",
"0.60779995",
"0.60406476",
"0.5983952",
"0.59795594",
"0.59493494",
"0.59470266",
"0.59402436",
"0.59374875",
"0.5931332",
"0.5927774",
"0.5918283",
"0.5893... | 0.6956233 | 0 |
Generate a random hypothesis satisfying all current constraints. | def genfeasiblehypothesis(self):
hypValid = False
genAttempts = 0
hypothesis = []
while hypValid == False:
genAttempts += 1.
# Generate a hypothesis:
#
# 1. Deal myself the hand I know I have
hypothesis = [set() for ix in range(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_table(self):\n rule_set = []\n for i in range(self.k ** (2 * self.r + 1) - 1):\n g = np.random.rand()\n if g > self.lambda_param:\n g = 0\n else:\n g = np.random.randint(1, self.k)\n rule_set.append(g)\n rule_set.append(0)\n return rule_set",... | [
"0.64118475",
"0.60135716",
"0.60040313",
"0.5975513",
"0.59719205",
"0.5883127",
"0.5842343",
"0.5830259",
"0.57722783",
"0.5764174",
"0.574327",
"0.5741325",
"0.57405233",
"0.5728624",
"0.56916004",
"0.5691422",
"0.5684358",
"0.5648347",
"0.56463736",
"0.56435454",
"0.56169... | 0.6872866 | 0 |
From a list of string theorems, compute and return their embeddings. | def _batch_thm_embedding(self, thms: List[Text]) -> List[THM_EMB_TYPE]:
# The checkpoint should have exactly one value in this collection.
thms = self._thm_string_for_predictions(thms)
embeddings = self._sess.run(
fetches=self._graph.get_collection('thm_net'),
feed_dict={self._graph.get_coll... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_embeddings(vectors, text, generate_missing=False, k=300):\r\n embeddings = text.apply(lambda x: get_average_vec(x, vectors, generate_missing=generate_missing, k=k))\r\n return list(embeddings)",
"def compute_user_input_embedding(txt, model):\r\n embeddings = []\r\n tokens = txt.split(\" \")\r... | [
"0.62225133",
"0.6180845",
"0.6058483",
"0.5947791",
"0.592822",
"0.5927285",
"0.59067094",
"0.5768185",
"0.57656956",
"0.5720795",
"0.5720269",
"0.5670243",
"0.5648393",
"0.564823",
"0.56477433",
"0.5642463",
"0.5640286",
"0.5618863",
"0.5618758",
"0.56044465",
"0.5596817",
... | 0.54610485 | 33 |
Create a Flask application using the app factory pattern. | def create_app(settings_override=None):
app = Flask(__name__, instance_relative_config=True)
app.config.from_object('config.settings')
app.config.from_pyfile('settings.py', silent=True)
if settings_override:
app.config.update(settings_override)
app.register_blueprint(course)
app.regi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app():\n app = Flask(__name__)\n app.config.from_object('app.configs.config')\n app.config.from_object('app.configs.settings')\n return app",
"def create_app(config=Config):\r\n # Initialise app and configuration\r\n app = Flask(__name__)\r\n app.config.from_object(config)\r\n\r\n... | [
"0.8629991",
"0.8587432",
"0.8567094",
"0.8560846",
"0.8548992",
"0.8533256",
"0.8532855",
"0.85154873",
"0.8468547",
"0.84618294",
"0.84501874",
"0.8400496",
"0.83925307",
"0.8380182",
"0.8366697",
"0.8356823",
"0.8333603",
"0.83313555",
"0.8325678",
"0.8316702",
"0.8298241"... | 0.8048076 | 37 |
Find person by name (can supply either first name, last name, or both). | def test_05_get_person_by_name(self):
p1 = Person.query.first()
p1_data = p1.wrap()
p1_f_name = p1_data["first_name"]
# find by first name only
# get part of name and search
q_string = "?first_name={}".format(p1_f_name[:3]) # TODO - verify the length
rv = self.ap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_person(name):\n if ' ' in name:\n name = name.replace(',', '')\n else:\n return None\n\n try:\n (first, last) = name.split(' ', 1)\n return Person.get(Person.first_name ** first, Person.last_name ** last)\n except Person.DoesNotExist:\n pass\n\n try:\n ... | [
"0.8371874",
"0.70397246",
"0.69642144",
"0.6921002",
"0.67691207",
"0.6734593",
"0.6730486",
"0.6717378",
"0.66699153",
"0.6665478",
"0.66387594",
"0.66387594",
"0.6629511",
"0.6435801",
"0.6379602",
"0.63201123",
"0.63159394",
"0.6293829",
"0.62536263",
"0.62296087",
"0.620... | 0.7409197 | 1 |
Returns the name of the mysql service. | def YumGetServiceName(vm):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AptGetServiceName(vm):\n del vm\n return 'mysql'",
"def service_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"service_name\")",
"def service_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"service_name\")",
"def service_name(self) -> pulumi.Output[str]:\n ... | [
"0.7474581",
"0.6829732",
"0.6829732",
"0.6829732",
"0.68110716",
"0.68110716",
"0.671715",
"0.66382146",
"0.66382146",
"0.66382146",
"0.64938444",
"0.64697003",
"0.64697003",
"0.64697003",
"0.6415178",
"0.63908523",
"0.6350583",
"0.6346128",
"0.6290802",
"0.6276551",
"0.6259... | 0.53838134 | 65 |
Returns the name of the mysql service. | def AptGetServiceName(vm):
del vm
return 'mysql' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"service_name\")",
"def service_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"service_name\")",
"def service_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"service_name\")",
"def servi... | [
"0.6829732",
"0.6829732",
"0.6829732",
"0.68110716",
"0.68110716",
"0.671715",
"0.66382146",
"0.66382146",
"0.66382146",
"0.64938444",
"0.64697003",
"0.64697003",
"0.64697003",
"0.6415178",
"0.63908523",
"0.6350583",
"0.6346128",
"0.6290802",
"0.6276551",
"0.6259246",
"0.6211... | 0.7474581 | 0 |
Enumerate all rows as a dictionary. | def all(self, fields=None):
if fields is None:
self.update()
for i in range(self.count()):
record = {}
if fields is None:
for field in self.__fields:
record[str(field)] = self.dbms.get_record_field_value(field, self.table, i, self.d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_dict(self):\n\n itr = iter(self)\n\n headers = next(itr)\n\n for row in itr:\n yield dict(zip(headers, row))",
"def rows(self):\n if self.header is None:\n raise ValueError('header cannot be None.')\n header = list(enumerate(self.header))\n ... | [
"0.74351746",
"0.70843107",
"0.7030183",
"0.7021647",
"0.70096445",
"0.69957113",
"0.69957113",
"0.68964124",
"0.66201705",
"0.6575368",
"0.6558362",
"0.6547085",
"0.6542892",
"0.6518194",
"0.65017",
"0.6494942",
"0.6487442",
"0.64271075",
"0.64133406",
"0.64133406",
"0.63910... | 0.0 | -1 |
anticaptcha_key str | anticaptcha com api key gb bool | True default | Show blance on startup | def __init__(self, anticaptcha_key, gb=True):
self.solver = hCaptchaProxyless()
self.solver.set_key(anticaptcha_key)
self.solver.set_website_url("https://2ch.hk/")
# self.solver.set_website_url("https://2ch.pm/")
# self.solver.set_verbose(1) # debug
self.solver.set_websit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def apikey_bing(self, ctx, key):\n settings = loadauth()\n settings['apikey'] = key\n saveauth(settings)\n return await self.bot.say(\"Bing API key saved.\")",
"def _apikey():\n return __opts__.get(\"bamboohr\", {}).get(\"apikey\", None)",
"def check_av_key(show_output: boo... | [
"0.61280024",
"0.6071189",
"0.5912534",
"0.57820755",
"0.5728642",
"0.56398314",
"0.5534863",
"0.5519876",
"0.55193615",
"0.5507338",
"0.54924357",
"0.5449495",
"0.54443884",
"0.5399823",
"0.5345974",
"0.52975255",
"0.52800316",
"0.52753466",
"0.5256352",
"0.5256352",
"0.5256... | 0.63601124 | 0 |
Reads the first assigned value of the given field in the CSV table. | def read_first_available_value(filename, field_name):
if not os.path.exists(filename):
return None
with open(filename, 'rb') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
value = row.get(field_name)
if value:
return value
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self, field):\n field = self.find_first(field)\n if field is not None:\n return field.value\n return None",
"def get_raw_value_from_dat_file(self, row, field):\n if len(self.field_map[field]) == 2:\n return row[int(self.field_map[field][0]) - 1:int(... | [
"0.65338564",
"0.6392548",
"0.63200605",
"0.6235137",
"0.62271905",
"0.6227104",
"0.6205975",
"0.61009073",
"0.60299647",
"0.59715605",
"0.5899107",
"0.5786881",
"0.5672882",
"0.5607519",
"0.5607519",
"0.55464906",
"0.54786897",
"0.5478634",
"0.54507464",
"0.5392752",
"0.5363... | 0.78890985 | 0 |
Initialize Involution Layer. Unpack arguments and initialize needed transformations. | def __init__(self, \
in_dim : int, \
out_dim : int, \
kernel_dim : Union[int, Tuple[int, int]], \
stride : Union[int, Tuple[int, int]], \
groups : int = 1, \
reduction : int = 1, \
dilation : Union[int, Tuple... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, **kwargs):\n super(ForwardLayersBase, self).__init__()\n pass",
"def _init_layers(self):\n self._init_predictor()\n if self.use_edge_fusion:\n self._init_edge_module()",
"def __init__(self, config_data, in_dims, layer_num):\n self.layer_num = layer_n... | [
"0.6404122",
"0.63648295",
"0.622279",
"0.6135271",
"0.61323744",
"0.61123925",
"0.60772014",
"0.6075436",
"0.60568666",
"0.60568666",
"0.60568666",
"0.60165906",
"0.59600294",
"0.59600294",
"0.595582",
"0.5945746",
"0.59369826",
"0.5914431",
"0.5912376",
"0.5903811",
"0.5899... | 0.0 | -1 |
Forward Pass of Involution Layer. | def forward(self, X : torch.tensor) -> torch.tensor:
B, C, H, W = X.shape
assert(C == self.in_dim)
unfolded = self.unfold(self.initial_mapping(X))
unfolded = unfolded.view(B, self.groups, self.out_dim//self.groups, self.kernel_dim[0] * self.kernel_dim[1], H, W)
pool = self.o(X)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n\n identity = x\n\n out = self.conv1(x)\n out = self.bn1(out)\n out = self.activation(out)\n\n out = self.conv2(out)\n out = self.bn2(out)\n\n if self.upsample is not None:\n identity = self.upsample(x)\n\n out += identity\n ... | [
"0.7094181",
"0.69762164",
"0.69762164",
"0.6975647",
"0.6975456",
"0.69609654",
"0.6960735",
"0.6938076",
"0.6932147",
"0.69134164",
"0.6887291",
"0.68826944",
"0.68700963",
"0.6835707",
"0.6832334",
"0.68128276",
"0.6799478",
"0.6798185",
"0.6778102",
"0.6773727",
"0.675363... | 0.0 | -1 |
Shows the top 10 karmas in a given group, if the group doesn't have at least 10 users, show the maximum amount | def karmas(_: Bot, update: Update):
top_users = analytics.get_top_n_karmas(update.message.chat.id, 10)
response = '\n'.join(
f'{i} - {user.name} ({user.karma})' for i, user in enumerate(top_users, 1)
)
update.message.reply_text(response) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_from_top_ten(title,users,max = 3):\n \"\"\" ten prolific users \"\"\"\n \"\"\" max : number of user with related followers \"\"\"\n getAllUsers(users,all_users,users_set,proceeded_users,max,user_cpt,title)\n for data in users_set:\n print(data.id)",
"def get_top_k_items(\n data... | [
"0.60215867",
"0.60107267",
"0.59359956",
"0.58820724",
"0.585288",
"0.58523005",
"0.5816334",
"0.5640699",
"0.5551383",
"0.55489355",
"0.5533259",
"0.55250305",
"0.5408803",
"0.540484",
"0.5393519",
"0.5372351",
"0.5299541",
"0.5277865",
"0.5269924",
"0.5188993",
"0.5185934"... | 0.66216785 | 0 |
Generating padding values for missing values in batch for tensorflow datasets. | def get_padding_values():
return tf.constant(0, tf.float32), tf.constant(0, tf.float32), tf.constant(-1, tf.int32) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _padding(inputs, paddings, data_format):\n if data_format == 'channels_first':\n padded_inputs = tf.pad(\n inputs, [[0, 0], [0, 0], paddings, paddings])\n else:\n padded_inputs = tf.pad(\n inputs, [[0, 0], paddings, paddings, [0, 0]])\n return padded_inputs",
"def pad_data(data: List[n... | [
"0.6989612",
"0.6901503",
"0.686671",
"0.686671",
"0.6813313",
"0.6791755",
"0.674493",
"0.6701146",
"0.66841936",
"0.6674651",
"0.6659418",
"0.6591822",
"0.65840924",
"0.6574735",
"0.6562189",
"0.6519637",
"0.64870447",
"0.6482151",
"0.6479098",
"0.64637697",
"0.64521813",
... | 0.6431333 | 22 |
Function to compute dot product between two vectors | def dot(self, other):
checkVector(self, other)
dots = self.client.map(_call_dot, self.vecDask, other.vecDask, pure=False)
# Adding all the results together
dot = 0.0
for future, result in daskD.as_completed(dots, with_results=True):
dot += np.float64(result)
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dot(vector1, vector2):\n return sum(a1 * a2 for a1, a2 in zip(vector1, vector2))",
"def dot(a, b):\n\n if len(a) != len(b):\n raise Exception(\"Input vectors must be of same length, not %d and %d\" % (len(a), len(b)))\n\n return float(sum([a[i] * b[i] for i in range(len(a))]))",
... | [
"0.8630284",
"0.8601396",
"0.8598018",
"0.85945415",
"0.85939234",
"0.8573501",
"0.8548062",
"0.8517112",
"0.85057056",
"0.84493536",
"0.84202045",
"0.8377423",
"0.8364285",
"0.8349452",
"0.83292514",
"0.8323946",
"0.82975394",
"0.82953393",
"0.8288867",
"0.82578677",
"0.8245... | 0.7246433 | 78 |
Create and configure an instance of the Flask application. | def create_app():
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = config('DATABASE_URL')
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
DB.init_app(app)
@app.route('/')
def root():
DB.drop_all()
DB.create_all()
status = load_measurement()
message = ""... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_app():\n\n # 1 Create Flask application\n app = Flask(\n import_name=__name__,\n template_folder=\"templates\",\n static_folder=\"static\"\n )\n\n # 2 Update the apps configuration\n app = config_selector(app)\n register_error_handlers(app)\n\n cache.init_app(app... | [
"0.8524236",
"0.8516853",
"0.8504485",
"0.83319825",
"0.82396483",
"0.82314265",
"0.8200104",
"0.81300336",
"0.80288595",
"0.8026753",
"0.8019436",
"0.79989535",
"0.7984679",
"0.7978355",
"0.7973289",
"0.7970172",
"0.7959833",
"0.79556865",
"0.7952428",
"0.7946338",
"0.793713... | 0.0 | -1 |
Return the external (coupling) quality factor of the resonator. | def Q_e(params):
return (params['Q_e_real'].value +
1j * params['Q_e_imag'].value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quality(self) -> int:\n return self._quality",
"def quality(self):\n return self.plays * self.number",
"def get_printer_quality(self):\n return self.parent.printer.get_quality()",
"def set_quality(self):\n p = self.suitability + 1.15 * self.fono\n self.quality = np.exp(p) /... | [
"0.6836358",
"0.678076",
"0.67304426",
"0.6653859",
"0.66437507",
"0.62799925",
"0.61350304",
"0.61335063",
"0.6013231",
"0.6013231",
"0.591665",
"0.58983153",
"0.58839136",
"0.58595115",
"0.5799859",
"0.5786415",
"0.5775012",
"0.5772998",
"0.57477397",
"0.57402885",
"0.57099... | 0.0 | -1 |
Create a bcrypt hash of a password | def _hash_password(self, password):
passwordhash = bcrypt.hashpw(password.encode('utf8'), bcrypt.gensalt())
return passwordhash | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_password(password: str) -> str:\n return bcrypt.hashpw(password.encode(), bcrypt.gensalt()).decode('utf8')",
"def hash_password(self, password):\n salt = hashlib.sha256(os.urandom(60)).hexdigest().encode('ascii')\n pwdhash = hashlib.pbkdf2_hmac('sha256', password.encode('utf-8'), \n ... | [
"0.81158215",
"0.784968",
"0.77817076",
"0.7740906",
"0.77358174",
"0.7666057",
"0.7666057",
"0.7666057",
"0.7636678",
"0.7614581",
"0.76089275",
"0.7604094",
"0.7601943",
"0.756695",
"0.7542338",
"0.7503173",
"0.7470942",
"0.74610966",
"0.74574625",
"0.7439365",
"0.73963904"... | 0.819452 | 0 |
Implementing set total amount functionality | def set_total_amount(self, total_amount):
self.set_value_into_input_field(self.total_amount_textbox_locator, total_amount, True)
total_amount_label_locator = (By.XPATH, "//label[text()='Total Amount']")
self.click_element(total_amount_label_locator) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_total(self):\n self.objects[self.ids.AMOUNT].setText(\"Total Spend: \\xA3%.2f\" % (self.owner.total_price() / 100))",
"def set_total(self):\n\n self.total = 0\n for item in self.items.all():\n self.total += item.price\n self.save()",
"def total_amount(self, tot... | [
"0.76804733",
"0.73925525",
"0.7129859",
"0.70237124",
"0.6991082",
"0.69786125",
"0.69786125",
"0.69786125",
"0.69786125",
"0.69786125",
"0.69786125",
"0.69786125",
"0.69786125",
"0.694637",
"0.6899732",
"0.6884278",
"0.6850443",
"0.67878556",
"0.67748886",
"0.6696671",
"0.6... | 0.72733045 | 2 |
Implementing get inbound statement grid number of rows functionality | def get_inbound_statement_grid_number_of_rows(self):
inbound_statement_grid_number_of_rows_element = self.wait().until(EC.visibility_of_element_located(self.inbound_statement_grid_number_of_rows_locator), 'inbound statement grid number of rows locator not found before specified time out')
element_text =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNumRows(self) -> int:\n ...",
"def getRowCount(self) -> int:\n ...",
"def get_rows(self) -> int:\r\n return 1 + self.display.get_rows() + 1",
"def getNumRows(self):\n return self.__rows",
"def get_row_count(self):\n\t\treturn self.iter_n_children(None)",
"def get_number... | [
"0.7933964",
"0.7610979",
"0.75622946",
"0.7083791",
"0.70720017",
"0.6865969",
"0.6850622",
"0.68229806",
"0.68175477",
"0.67938685",
"0.67907816",
"0.6769514",
"0.67518353",
"0.6735044",
"0.66978234",
"0.66978234",
"0.66970694",
"0.6688934",
"0.66874576",
"0.6684982",
"0.66... | 0.7675888 | 1 |
Implementing set billing cycle begin date functionality | def set_billing_cycle_begin_date(self, begin_date):
if begin_date == "":
current_date = datetime.date.today()
begin_date = current_date.replace(day=1)
begin_date = begin_date.strftime("%m/%d/%Y")
self.set_value_into_input_field(self.billing_cycle_begin_date_inputbox_l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_charge_begin_date(self, charge_begin_date, first_day_of_last_month):\n self.current_charge_begin_date = charge_begin_date\n if first_day_of_last_month is True:\n if charge_begin_date == \"\":\n self.first_day_of_previous_month = self.get_date(first_day_of_last_month=... | [
"0.7340317",
"0.72412044",
"0.66576",
"0.66031843",
"0.65601575",
"0.65317243",
"0.6487312",
"0.6283432",
"0.6218747",
"0.61166626",
"0.600389",
"0.5930355",
"0.5913446",
"0.5913446",
"0.5913446",
"0.5913446",
"0.5913446",
"0.5913446",
"0.5913446",
"0.5913446",
"0.5913446",
... | 0.7915728 | 0 |
Implementing set dispute contact first name functionality | def set_dispute_contact_first_name(self, first_name, clear_field):
if clear_field is True:
first_name_textbox_element = self.wait().until(EC.presence_of_element_located(self.dispute_contact_first_name_textbox_locator), 'first name textbox locator not found before specified time out')
fir... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setFirstName(self, firstName):\r\n self.firstName = firstName",
"def set_first_name(self, first_name):\n self.first_name = first_name",
"def firstname(self, firstname):\n\n self._firstname = firstname",
"def firstname(self, firstname):\n\n self._firstname = firstname",
"def... | [
"0.7537012",
"0.72481596",
"0.72322214",
"0.72322214",
"0.71751994",
"0.71145296",
"0.7093389",
"0.7059425",
"0.6831373",
"0.6831373",
"0.6831373",
"0.6831373",
"0.6831373",
"0.6831373",
"0.6831373",
"0.6831373",
"0.6831373",
"0.6788495",
"0.6767721",
"0.6744098",
"0.67398465... | 0.72886723 | 1 |
Implementing get outbound statements end date functionality | def get_outbound_statements_end_date(self):
return self.get_text_from_element(self.outbound_statements_end_date_locator, True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_inbound_statements_end_date(self):\n return self.get_text_from_element(self.inbound_statements_end_date_locator, True)",
"def get_inbound_statement_details_end_date(self):\n return self.get_text_from_element(self.inbound_statements_details_end_date_locator, True)",
"def get_outbound_state... | [
"0.75716054",
"0.73776615",
"0.71118313",
"0.70772713",
"0.68390137",
"0.64624184",
"0.64139324",
"0.62675464",
"0.62357366",
"0.62357366",
"0.62151146",
"0.62151146",
"0.62151146",
"0.6120816",
"0.6092508",
"0.605824",
"0.605824",
"0.6013706",
"0.5992594",
"0.59401494",
"0.5... | 0.77054393 | 0 |
Returns a TFFeature of int64s. | def int64_feature(values):
if not isinstance(values, (tuple, list)):
values = [values]
return tf.train.Feature(int64_list=tf.train.Int64List(value=values)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _int64_feature(value):\n return tf.train.Feature(int64_list=tf.train.Int64List(\n value=[int(v) for v in value]))",
"def _int64_feature(value):\n return tf.train.Feature(\n int64_list=tf.train.Int64List(value=[int(v) for v in value]))",
"def _int64_feature(value):\n return tf.train.Featu... | [
"0.688075",
"0.6862741",
"0.68326515",
"0.68326515",
"0.67430365",
"0.67394435",
"0.67394435",
"0.67394435",
"0.673107",
"0.67192674",
"0.67192674",
"0.67192674",
"0.67192674",
"0.67192674",
"0.67192674",
"0.6709931",
"0.6709931",
"0.6709931",
"0.6709931",
"0.67064357",
"0.66... | 0.66444874 | 22 |
Make a PATCH call and return a WeeblyCloudResponse object | def patch(self, endpoint, content=None, params=None):
return self._call("PATCH", endpoint, content, params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _patch(self, url, data=None):\n url = urljoin(self.base_url, url)\n try:\n r = self._make_request(**dict(\n method='PATCH',\n url=url,\n json=data,\n auth=self.auth,\n timeout=self.timeout,\n hook... | [
"0.7077751",
"0.7021419",
"0.6776632",
"0.67556494",
"0.6698181",
"0.65880984",
"0.6565383",
"0.655743",
"0.65295047",
"0.6513851",
"0.6503771",
"0.6472786",
"0.6469537",
"0.6469473",
"0.6452879",
"0.64436615",
"0.6439973",
"0.6432273",
"0.64150006",
"0.64135486",
"0.63975686... | 0.6322044 | 29 |
Get the ZSync trigger delay. | def _get_trigdelay(session: Session, awg: AWG) -> int:
awg_split = str(awg).split("/") # Split into list
awg_split.insert(2, "raw")
awg_split.append("zsync")
awg_split.append("trigdelay")
trigdelay_node = "/".join(awg_split) # Join again into node path
trig_delay = session.daq_server.getInt(t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mv_delay(self):\n return self._TERRAINS[self.terrain]['delay']",
"def get_maxdelay(self) -> float:\n return self.maxdelay",
"def get_delay_diff(self):\n if type(self.apply_delay) is not int:\n err = 'ReplicationDelay().get_delay_diff(): '\\\n 'the self.apply... | [
"0.7331803",
"0.70847446",
"0.70209676",
"0.697348",
"0.6967559",
"0.69218016",
"0.68821573",
"0.68505645",
"0.68383604",
"0.68376315",
"0.68229395",
"0.6780892",
"0.6752767",
"0.6746795",
"0.67309755",
"0.66501635",
"0.66501635",
"0.6631623",
"0.65808666",
"0.65808666",
"0.6... | 0.6502191 | 24 |
Constructor. name The name used to identify this attribute. set The KeyIndexableSet whose elements can be assigned a value within this attribute. | def __init__(self, name: unicode, set: ghidra.util.graph.KeyIndexableSet):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.ds = set()\n self.keys = []",
"def __init__(self, name: str):\n super(AsyncSet, self).__init__()\n self.name = name\n self.sequence = set()\n self.index = 0",
"def __init__(self, **attributes):\n self.set(**attributes)",
"def set(sel... | [
"0.6343454",
"0.60338116",
"0.6030579",
"0.5960513",
"0.5955464",
"0.5894221",
"0.5861004",
"0.5848963",
"0.584766",
"0.5839426",
"0.5839426",
"0.5801566",
"0.57772523",
"0.57410544",
"0.57410544",
"0.5738753",
"0.5735084",
"0.5722881",
"0.57044965",
"0.5693556",
"0.5689613",... | 0.76226497 | 0 |
Removes all assigned values of this attribute. | def clear(self) -> None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unload(self) -> None:\n for attr in self._attrs:\n setattr(self, attr, None)",
"def clear_attrs(self):\n self._attributes.clear()",
"def clear_attributes(self):\n self.attrs = etad.AttributeContainer()",
"def unassign(self) -> None:\n self._row.remove(self._value)\n ... | [
"0.7478614",
"0.7357718",
"0.73396844",
"0.69982743",
"0.6996864",
"0.6992237",
"0.6956828",
"0.6805499",
"0.6730171",
"0.66969603",
"0.6695556",
"0.66829526",
"0.668087",
"0.6672988",
"0.6670365",
"0.66604215",
"0.66538155",
"0.6650434",
"0.664232",
"0.66403705",
"0.6601658"... | 0.0 | -1 |
Return the name of this Attribute. | def name(self) -> unicode:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self) -> \"str\":\n return self._attrs.get(\"name\")",
"def name(self) -> \"str\":\n return self._attrs.get(\"name\")",
"def name(self) -> \"str\":\n return self._attrs.get(\"name\")",
"def get_name(self):\n return self.attributes[\"name\"]",
"def Name(self):\n r... | [
"0.8481288",
"0.8481288",
"0.8481288",
"0.82458186",
"0.8205045",
"0.80255413",
"0.7997814",
"0.77118605",
"0.76510406",
"0.7644881",
"0.7644881",
"0.7644881",
"0.7644881",
"0.7644881",
"0.7644881",
"0.7644881",
"0.7644881",
"0.7644881",
"0.7644881",
"0.7644881",
"0.7644881",... | 0.0 | -1 |
Returns the elements of the owningSet sorted by their values of this Attribute. | def toSortedArray(self) -> List[ghidra.util.graph.KeyedObject]:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_values(self):\n self._elements = list(\n _[-1] for _ in sorted((e.value, e.weight, e) for e in self)\n )",
"def sorted(self, func):\n return PSetList(sorted(self.sets, key=func))",
"def get_all_sorted(self):\n self.sort_and_reduce()\n return self.data",
... | [
"0.6853953",
"0.6499001",
"0.6480032",
"0.63646907",
"0.63385385",
"0.6144738",
"0.6129683",
"0.61153847",
"0.6050461",
"0.5947791",
"0.59465057",
"0.59204274",
"0.5909975",
"0.59069365",
"0.5865689",
"0.5862626",
"0.58405197",
"0.58351946",
"0.5833236",
"0.58261335",
"0.5816... | 0.56371194 | 32 |
Read JSON, return dict | def read_json(filename):
with open(filename, 'r') as data_file:
return json.load(data_file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_json(self):\n self._fopen.seek(self._json_start, 0)\n return json.loads(self._fopen.read().decode('utf-8'))",
"def parse_json(json_file: str) -> dict:\n json_data = {}\n\n if not os.path.isfile(json_file):\n error_log(os.path.basename(json_file) + ' does not exist.')\n ... | [
"0.7366292",
"0.73083895",
"0.730763",
"0.7213408",
"0.72055006",
"0.7202988",
"0.71772295",
"0.71769017",
"0.71589404",
"0.71501535",
"0.71480477",
"0.71459043",
"0.7139679",
"0.71254426",
"0.70945793",
"0.70945793",
"0.70905346",
"0.70862776",
"0.7082895",
"0.7082807",
"0.7... | 0.676514 | 54 |
Write dictionary to JSON | def write_json(dictionary, filename):
with open(filename, 'w') as data_file:
json.dump(dictionary, data_file, indent=4, sort_keys=True)
print('--> Wrote ' + os.path.basename(filename)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_json(self, json_dict):\n content = json.dumps(json_dict)\n\n if isinstance(content, unicode):\n content = content.encode('utf-8')\n\n self.wfile.write(content)",
"def json_write(path, dictionary):\n json_output = json.dumps(dictionary, ... | [
"0.7932182",
"0.78356576",
"0.77754295",
"0.76260453",
"0.7487478",
"0.74824244",
"0.7473716",
"0.74631274",
"0.74537027",
"0.7334966",
"0.72773993",
"0.7236022",
"0.72240007",
"0.7203074",
"0.7197882",
"0.7165491",
"0.7163943",
"0.71173054",
"0.7085702",
"0.7043441",
"0.7041... | 0.7493411 | 4 |
Provide a friendly representation | def __repr__(self) -> str:
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
return "<Twilio.Api.V2010.UserDefinedMessageInstance {}>".format(context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_representation(self) -> str:\n raise NotImplementedError()",
"def __str__(self):\n return self.make_flat()",
"def __str__(self):\n return self.format()",
"def __str__(self):\n return \"<%s: %s>\" % (self.__class__, self.describe())",
"def __str__(self):\n \n ... | [
"0.76010835",
"0.7571921",
"0.7230172",
"0.7216933",
"0.7194604",
"0.71428955",
"0.714158",
"0.71369046",
"0.7134454",
"0.7134454",
"0.7131177",
"0.7104331",
"0.70761895",
"0.70686626",
"0.70685405",
"0.70685405",
"0.70685405",
"0.70685405",
"0.70685405",
"0.70311874",
"0.701... | 0.0 | -1 |
Provide a friendly representation | def __repr__(self) -> str:
return "<Twilio.Api.V2010.UserDefinedMessageList>" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_representation(self) -> str:\n raise NotImplementedError()",
"def __str__(self):\n return self.make_flat()",
"def __str__(self):\n return self.format()",
"def __str__(self):\n return \"<%s: %s>\" % (self.__class__, self.describe())",
"def __str__(self):\n \n ... | [
"0.7601743",
"0.75718004",
"0.72295034",
"0.7216429",
"0.71937954",
"0.71428096",
"0.7140594",
"0.7136909",
"0.7135249",
"0.7135249",
"0.7130013",
"0.7103256",
"0.7075",
"0.70674646",
"0.70674646",
"0.70674646",
"0.70674646",
"0.70674646",
"0.70671123",
"0.70313466",
"0.70191... | 0.0 | -1 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print("Hello! Let's explore some US bikeshare data!")
# TO DO: get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs
city = input("Would you like to analyze Chicago, New York City or Washington? ").lower()
while city == 'c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.6671714",
"0.65376973",
"0.64612824",
"0.6376945",
"0.63504905",
"0.6311004",
"0.6288045",
"0.62342596",
"0.6215191",
"0.6207211",
"0.61830604",
"0.6174147",
"0.61701334",
"0.6160666",
"0.6159556",
"0.61552376",
"0.61457616",
"0.61299276",
"0.61062425",
"0.6104349",
"0.609... | 0.6260879 | 7 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
df=pd.read_csv(CITY_DATA[city])
df['Start Time']=pd.to_datetime(df['Start Time'])
df['month'] = df['Start Time'].dt.month
df['day_of_week'] = df['Start Time'].dt.weekday_name
df['hour'] = df['Start Time'].dt.hour
if month != 'all':
months = ['january... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ... | [
"0.81320685",
"0.8108889",
"0.8045821",
"0.8042514",
"0.80090284",
"0.80071104",
"0.79991937",
"0.7998333",
"0.7988789",
"0.797905",
"0.79737365",
"0.79610896",
"0.7956163",
"0.7947432",
"0.79463065",
"0.7908287",
"0.7908229",
"0.7904569",
"0.7900715",
"0.78930074",
"0.788921... | 0.7681617 | 67 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
print('\nCalculating The Most Frequent Times of Travel...\n')
start_time = time.time()
# TO DO: display the most common month
pop_month = df['month'].mode()[0]
print("\nThe most popular month is: ", pop_month)
# TO DO: display the most common day of week
pop_day = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.80247396",
"0.80233026",
"0.7915788",
"0.78266186",
"0.7822246",
"0.78143597",
"0.77659196",
"0.7740343",
"0.773628",
"0.77344066",
"0.76867086",
"0.7668633",
"0.7651731",
"0.7644636",
"0.76399267",
"0.76367253",
"0.7625196",
"0.7623158",
"0.7612803",
"0.7583438",
"0.75797... | 0.76002145 | 19 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# TO DO: display most commonly used start station
pop_start_station = df['Start Station'].mode()[0]
print('\nThe most popular start station is: ', pop_start_station)
# TO DO: dis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.7815675",
"0.7662213",
"0.7553417",
"0.74914914",
"0.74748665",
"0.7446617",
"0.7428588",
"0.74237514",
"0.74177027",
"0.7400495",
"0.7387161",
"0.7385634",
"0.73647535",
"0.735934",
"0.73566747",
"0.73548365",
"0.7351854",
"0.7351274",
"0.735057",
"0.73421645",
"0.7340198... | 0.71610874 | 52 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# TO DO: display total travel time
total_trip = df['Trip Duration'].sum()
print("\nTotal travel time in seconds for this time period is ", total_trip)
# TO DO: display mean travel time
mean_tri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.8143977",
"0.80268085",
"0.8005599",
"0.79511017",
"0.7938921",
"0.79326934",
"0.792851",
"0.7916632",
"0.7915868",
"0.79095894",
"0.79071254",
"0.79020894",
"0.789307",
"0.78909105",
"0.78881186",
"0.7886607",
"0.78857124",
"0.78838766",
"0.7875441",
"0.7870104",
"0.78680... | 0.7807881 | 44 |
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['X-UA-Compatible'] = 'IE=Edge,chrome=1'
response.headers['Cache-Control'] = 'public, max-age=0'
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.8222023",
"0.8221203",
"0.8221203",
"0.8221203",
"0.8221203",
"0.8194479",
"0.811131",
"0.808555",
"0.7971664",
"0.7864228",
"0.76597136",
"0.72357756",
"0.7158288",
"0.71510094",
"0.71510094",
"0.7148979",
"0.7148979",
"0.7139939",
"0.7135133",
"0.71262753",
"0.71262753",... | 0.8161975 | 26 |
determines the distance between an the actor and a point on the map | def distance_to(self, x, y):
dx = x - self.x
dy = y - self.y
return math.sqrt((dx**2)+(dy**2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(self, pt):\n return math.sqrt((self.x - pt.x) ** 2 + (self.y - pt.y) ** 2)",
"def distance(p1,p2):\n return ((p1.x - p2.x)**2 + (p1.y - p2.y)**2)**0.5",
"def distance_between_actor(vehicle, ped):\n\n return distance_to_vehicle(vehicle, ped.get_location())",
"def dist(self, p):\n ... | [
"0.7150524",
"0.69134736",
"0.68946624",
"0.6825415",
"0.68233377",
"0.68129843",
"0.6801358",
"0.6801358",
"0.6801358",
"0.6801358",
"0.6801358",
"0.6801358",
"0.6801358",
"0.6799072",
"0.6797185",
"0.67873955",
"0.67573434",
"0.67351544",
"0.6732874",
"0.67243373",
"0.66368... | 0.6797212 | 14 |
Test that strings are equivalent. | def test_strings_are_equal(self):
string1 = 'this is the first string'
string2 = 'this is the first string' # ==, !is
string3 = 'this is the second string'
self.assertEqual(True, comparator.strings_are_equal(string1, string2))
self.assertEqual(False, comparator.strings_are_equal(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isEqual(string1, string2):\n return (True)",
"def _strings_are_equal(self, value1, value2):\n if value1.lower().strip().replace('_', ' ') == value2.lower().strip().replace('_', ' '):\n return 1\n return 0",
"def strings_equal(s1, s2):\n s1 = unicodedata.normalize('NFKC', s1)\n ... | [
"0.7624572",
"0.73017526",
"0.72484386",
"0.7212676",
"0.71893454",
"0.70621693",
"0.7000434",
"0.6867128",
"0.68393123",
"0.68095803",
"0.67924976",
"0.6786772",
"0.67573386",
"0.6748181",
"0.66982424",
"0.66889256",
"0.6671233",
"0.65936756",
"0.6592168",
"0.6582873",
"0.65... | 0.8114444 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.