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 |
|---|---|---|---|---|---|---|
Assert if a supplied values are compatible with a distribution's TensorShape. A distribution's ``TensorShape``, ``dist_shape``, is made up by the sum of the ``batch_shape`` and the ``event_shape``. A value is considered to have a consistent shape with the distribution if two conditions are met. 1) It has a greater or e... | def assert_values_compatible_with_distribution_shape(
scoped_name: str, values: Any, batch_shape: tf.TensorShape, event_shape: tf.TensorShape
) -> None:
value_shape = get_observed_tensor_shape(values)
dist_shape = batch_shape + event_shape
value_rank = value_shape.rank
dist_rank = dist_shape.rank
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_values_compatible_with_distribution(\n scoped_name: str, values: Any, dist: distribution.Distribution\n) -> None:\n event_shape = dist.event_shape\n batch_shape = dist.batch_shape\n assert_values_compatible_with_distribution_shape(scoped_name, values, batch_shape, event_shape)",
"def _asse... | [
"0.77026945",
"0.69207245",
"0.6686863",
"0.66555935",
"0.6307519",
"0.63041025",
"0.6255147",
"0.6187317",
"0.61865914",
"0.61768675",
"0.61516327",
"0.6116351",
"0.6113589",
"0.6076399",
"0.6023457",
"0.600301",
"0.6001702",
"0.59982944",
"0.5987821",
"0.59718394",
"0.59371... | 0.8264976 | 0 |
Remove,hyphens,slashes,whitespace in string so that it can be used as an OrientDB variable name. | def _to_var_name(s):
r = s.replace("'",'prime')
table = str.maketrans(dict.fromkeys('.,!?_ -/<>{}[]()+-=*&^%$#@!`~.\|;:"'))
chars_to_remove = ['.', '!', '?', '_', '-', '/', '>', '<', '(', ')', '+', '-', '*', ',', '?', ':', ';', '"', '[', ']', '{', '}', '=', '^', '%', '$', '#', '@', '!', '`', '~']
r = r.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(s):\n s = str(s.strip())\n patt = re.compile(r'^\\?\\w+$')\n if patt.match(s):\n name = s[1:]\n return Variable(name)\n return s",
"def _clean(self, string):\n return re.sub('\\s+', ' ', string).strip()",
"def _clean_name(cls, strin... | [
"0.7050821",
"0.66955596",
"0.65570164",
"0.6515622",
"0.64394367",
"0.64047974",
"0.6403549",
"0.63944197",
"0.6385761",
"0.6379132",
"0.6366507",
"0.63529",
"0.6346849",
"0.6327305",
"0.63146",
"0.62898767",
"0.6274276",
"0.6269185",
"0.6262716",
"0.6239907",
"0.6238984",
... | 0.0 | -1 |
Check if the obj is owned by the data_source. | def _is_in_datasource(self, data_source, obj):
q = self.sql_query(
""" select @rid from (select expand(in(Owns)) from {obj_rid}) \
where @class = 'DataSource' and @rid = {rid}""".format(
obj_rid = obj._id, ds_rid = data_source._id))
return len(q) > 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isowner(self, o):\n return self._owner is o",
"def has_ownership(self):\n user = self.request.user\n object = self.get_object()\n if object.owned_by(user):\n return True\n else:\n return False",
"def is_still_owner(self):\n raise tooz.NotImple... | [
"0.73717135",
"0.7216829",
"0.68909574",
"0.6698949",
"0.66661",
"0.65722454",
"0.6571913",
"0.65368134",
"0.6504061",
"0.6427954",
"0.6417614",
"0.64085096",
"0.63599044",
"0.63226974",
"0.6321842",
"0.62953234",
"0.627378",
"0.6163859",
"0.61376566",
"0.6136178",
"0.6129094... | 0.7183727 | 2 |
Export all the tags to a JSON file. | def export_tags(self, filename):
all_tags = self.sql_query("""select from QueryResult""").node_objs
query_results = {}
for tag in all_tags:
props = tag.get_props()
results = tag.out()
records = {}
try:
color = props['color'].copy()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dir(self):\n out = {}\n out[\"name\"] = self.name\n out[\"colour\"] = self.colour\n out[\"slug\"] = self.slug\n out[\"id\"] = self.pk\n out[\"tags\"] = []\n \n for t in self.tags.all():\n out[\"tags\"].append(t.pk)\n \n return ... | [
"0.6429942",
"0.63553095",
"0.62393045",
"0.621748",
"0.62066233",
"0.6190445",
"0.618915",
"0.60904825",
"0.6082127",
"0.60671234",
"0.60138595",
"0.5995351",
"0.59754723",
"0.5955164",
"0.59519166",
"0.59507686",
"0.59320366",
"0.5888748",
"0.5869419",
"0.58678013",
"0.5860... | 0.6420236 | 1 |
Load an SWC file into a DataFrame. | def load_swc(file_name):
df = pd.read_csv(file_name, sep = ' ', header=None, comment='#', index_col = False,
names=['sample', 'identifier', 'x', 'y', 'z', 'r', 'parent'],
skipinitialspace=True)
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_swc(file_name):\n\n df = pd.read_csv(file_name, delimiter=' ', header=None, comment='#',\n names=['sample', 'identifier', 'x', 'y', 'z', 'r', 'parent'],\n skipinitialspace=True).astype({'sample':int,'identifier':int,'x':float,'y':float,'z':float,'r':float,'parent... | [
"0.7876682",
"0.62008125",
"0.60887754",
"0.60773456",
"0.60683715",
"0.6041929",
"0.5958941",
"0.58864176",
"0.58325297",
"0.58230084",
"0.5816817",
"0.5788819",
"0.5787642",
"0.577373",
"0.57658166",
"0.5743022",
"0.57248044",
"0.57178473",
"0.57016563",
"0.5658189",
"0.563... | 0.7903309 | 0 |
Creates a list of conditions from from the lists provided. | def generateConditions(reactorType, reactionTime, molFracList, Tlist, Plist):
# Store the conditions in the observables test case, for bookkeeping
self.conditions = generateConditions(reactorType, reactionTime, molFracList, Tlist=Tlist, Plist=Plist, Vlist=Vlist)
# Map the mole fractions diction... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def condition_list(\n self, params: Optional[Dict] = None, headers: Optional[Dict] = None\n ) -> List[ConditionDetails]:\n method = self._get_method(\"conditions\")\n\n return self.call_api_get(method=method, params=params, headers=headers)",
"def conditions(self):\n return self._s... | [
"0.66907865",
"0.65129495",
"0.6485352",
"0.6467451",
"0.6329446",
"0.62187564",
"0.61542505",
"0.61359745",
"0.61170244",
"0.57969475",
"0.5613383",
"0.5551332",
"0.553524",
"0.54708326",
"0.5455554",
"0.5420929",
"0.5410848",
"0.54098654",
"0.5402741",
"0.5388777",
"0.53849... | 0.49712306 | 50 |
Add a new blacklisted token. | def save(self):
self.curr.execute(
''' INSERT INTO revoked_tokens(jti)\
VALUES('{}')\
RETURNING jti''' \
.format(self.jti))
revoked_token = self.curr.fetchone()
self.conn.commit()
self.curr.close()
return json.dumps(revoked_to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blacklist_token(token):\n curr_token = BlacklistToken(token=token)\n try:\n db.session.add(curr_token)\n db.session.commit()\n except:\n return False\n return True",
"def create(token):\n\n try:\n black = BlackList()\n black.jti = token[\"jti\"]\n... | [
"0.6903839",
"0.6901928",
"0.67731595",
"0.64551526",
"0.64551526",
"0.64389527",
"0.6393772",
"0.6152744",
"0.6144041",
"0.61353576",
"0.6079158",
"0.6073504",
"0.6010706",
"0.5946544",
"0.59345394",
"0.5925335",
"0.58972377",
"0.5874555",
"0.5821321",
"0.5744133",
"0.572454... | 0.0 | -1 |
Converts a filename {subdir}/m.n/module/foo to module.foo. | def _get_module_name(filename: str) -> str:
return ".".join(_get_relative(filename).split(os.path.sep)[2:]).replace(".pyi", "").replace(".__init__", "") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def module_filename(module, filename):\n path, _ = os.path.split(module.__file__)\n return os.path.join(path, filename)",
"def infer_module_name(filename, fspath):\n filename, _ = os.path.splitext(filename)\n for f in fspath:\n short_name = f.relative_path(filename)\n if short_name:\n ... | [
"0.6445697",
"0.63795006",
"0.6362843",
"0.6284782",
"0.62215054",
"0.61781687",
"0.6108054",
"0.6090965",
"0.6090965",
"0.60795945",
"0.6063059",
"0.60531056",
"0.60358775",
"0.6025664",
"0.6023957",
"0.5978882",
"0.5977606",
"0.5933976",
"0.5878851",
"0.58546704",
"0.585380... | 0.659474 | 0 |
Returns the current zone ID. This is either the same as the hoodID for a Playground class, or the current zoneId for a Town class. | def getZoneId(self):
#self.zoneId
if self.zoneId:
return self.zoneId
else:
self.notify.warning("no zone id available") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zone_id(self) -> str:\n return pulumi.get(self, \"zone_id\")",
"def zone_id(self) -> str:\n return pulumi.get(self, \"zone_id\")",
"def zone_id(self) -> str:\n return pulumi.get(self, \"zone_id\")",
"def zone_id(self) -> str:\n return pulumi.get(self, \"zone_id\")",
"def zon... | [
"0.820044",
"0.820044",
"0.820044",
"0.820044",
"0.820044",
"0.81008226",
"0.79597175",
"0.79151195",
"0.78607404",
"0.78607404",
"0.78607404",
"0.78607404",
"0.7562837",
"0.7562837",
"0.7562837",
"0.7562837",
"0.7562837",
"0.7562837",
"0.75609976",
"0.75609976",
"0.7503529",... | 0.7846803 | 12 |
Render simple index template. | def index():
today = datetime.today()
return render_template("index.html.j2", today=today) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n return render_template('0-index.html')",
"def index(self):\n\t\treturn render_template('index.html')",
"def index():\r\n return render_template('index.html')",
"def index():\n return render_template('index.html')",
"def index():\r\n return render_template('index.h... | [
"0.8064202",
"0.79421604",
"0.7902698",
"0.78859687",
"0.7876052",
"0.7876052",
"0.7873014",
"0.7860364",
"0.7857654",
"0.7850633",
"0.7850633",
"0.78463745",
"0.78178203",
"0.7795017",
"0.7795017",
"0.7795017",
"0.7795017",
"0.7795017",
"0.7795017",
"0.7795017",
"0.7795017",... | 0.70757335 | 92 |
Render a simple second page that is different from the index. | def route100days():
return render_template("100days.html.j2") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_page():\n return render_template(\"index.html\")",
"def intro_page():\n logger.info('At introductory app page.')\n return render_template('first.html')",
"def index_page():\n\n return render_template(\"index.html\")",
"def index_page():\n\n return render_template(\"index.html\")",
"... | [
"0.7316301",
"0.7174586",
"0.7147323",
"0.7147323",
"0.7147323",
"0.7078582",
"0.7022682",
"0.7020641",
"0.70161057",
"0.69268197",
"0.69191563",
"0.68515843",
"0.6834929",
"0.68278736",
"0.6804528",
"0.6784745",
"0.6777081",
"0.67718256",
"0.67595756",
"0.6757772",
"0.675444... | 0.0 | -1 |
Render template that displays a random Chuck Norris joke. | def chuck():
joke = get_chuck_norris_joke()
return render_template("chuck.html.j2", joke=joke) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_lucky_num():\r\n num = random.randint(1, 10)\r\n\r\n return render_template(\"lucky.html\", lucky_num=num, msg=\"Hello this is a message!\")",
"def player():\r\n return render_template('deck.html')",
"def snake():\n return render_template('snake.html')",
"def meme_rand():\n img = rand... | [
"0.6868796",
"0.62115926",
"0.61506575",
"0.600312",
"0.5846519",
"0.58340347",
"0.57512796",
"0.5740087",
"0.5726088",
"0.57244873",
"0.5717696",
"0.571485",
"0.5707809",
"0.5691318",
"0.5655946",
"0.56475705",
"0.56315273",
"0.5628719",
"0.562344",
"0.5557762",
"0.5552274",... | 0.70515287 | 0 |
Get names of Pokemon with a certain color. | def get_pokemon_of_color(color):
color_url = "https://pokeapi.co/api/v2/pokemon-color/{0}".format(
color.lower(),
)
response = requests.get(color_url)
if response.status_code == HTTPStatus.OK:
response_data = response.json()
species = response_data.get("pokemon_species")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name_color(self):\n return self._item.get(\"name_color\")",
"def name_color(self):\n return self._item.get(\"name_color\")",
"def animals_by_color(self, color):\n return [\n animal\n for cage in self.cages\n for animal in cage.animals\n i... | [
"0.61268055",
"0.60592425",
"0.6052334",
"0.5940171",
"0.5835287",
"0.5664363",
"0.56355757",
"0.56321394",
"0.5608693",
"0.55954784",
"0.55793846",
"0.5497267",
"0.54773724",
"0.541642",
"0.54136664",
"0.5403632",
"0.5403632",
"0.53713983",
"0.5354674",
"0.5300216",
"0.52455... | 0.8253377 | 0 |
Standardize matrix feature columns using sklearn.preprocessing.scale. | def scale_matrix(self, matrix_df):
print('scaling features...')
originalkeys = matrix_df[['segment_id','date','time']].reset_index()
originalkeys['index'] = originalkeys.index
columns = list(matrix_df)
columns.remove('segment_id')
columns.remove('date')
columns... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_scale_features_standardize(self):\n data = array([[0.564, 20.661], [-18.512, 41.168], [-0.009, 20.440]])\n cdata = CData(data)\n\n # correct answer computed in Mathematica\n # TODO: can we compute the right answer in Python?\n answer = array([[0.60355, -0.568043], [-1.15... | [
"0.76103044",
"0.7269663",
"0.725286",
"0.7036567",
"0.70222014",
"0.6897047",
"0.6843821",
"0.68304175",
"0.6770714",
"0.67232645",
"0.6692314",
"0.66750705",
"0.66416115",
"0.6633816",
"0.6614191",
"0.66066986",
"0.6586783",
"0.65792936",
"0.6537459",
"0.652209",
"0.6510061... | 0.7008458 | 5 |
Numpy implementation of the Frechet Distance. The Frechet distance between two multivariate Gaussians X_1 ~ N(mu_1, C_1) and X_2 ~ N(mu_2, C_2) is d^2 = ||mu_1 mu_2||^2 + Tr(C_1 + C_2 2sqrt(C_1C_2)). Stable version by Dougal J. Sutherland. | def calculate_frechet_distance(mu1, sigma1, mu2, sigma2, eps=1e-6):
mu1 = np.atleast_1d(mu1)
mu2 = np.atleast_1d(mu2)
sigma1 = np.atleast_2d(sigma1)
sigma2 = np.atleast_2d(sigma2)
assert mu1.shape == mu2.shape, \
'Training and test mean vectors have different lengths'
assert sigma1.sh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_frechet_distance(mu1, sigma1, mu2, sigma2, eps=1e-6):\r\n\r\n mu1 = np.atleast_1d(mu1)\r\n mu2 = np.atleast_1d(mu2)\r\n\r\n sigma1 = np.atleast_2d(sigma1)\r\n sigma2 = np.atleast_2d(sigma2)\r\n\r\n assert mu1.shape == mu2.shape, \\\r\n 'Training and test mean vectors have differ... | [
"0.760663",
"0.7604745",
"0.75967485",
"0.7582018",
"0.7462811",
"0.7003401",
"0.66977954",
"0.6652128",
"0.66026556",
"0.6415457",
"0.63808364",
"0.62490267",
"0.61487985",
"0.61459863",
"0.60792685",
"0.59811175",
"0.59767294",
"0.5944682",
"0.59078217",
"0.5880456",
"0.587... | 0.7578216 | 6 |
Returns the class based on class name. | def get_class(class_name, module_paths=None):
class_ = locate(class_name)
if (class_ is None) and (module_paths is not None):
for module_path in module_paths:
class_ = locate('.'.join([module_path, class_name]))
if class_ is not None:
break
if class_ is None:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_class(self, name):\n return self.host.get_class(name)",
"def get_class(self, class_name):\n try:\n return self._classes[class_name]\n except KeyError:\n raise NameError",
"def _find_class(self, class_name: str) -> Type:\n return self.class_resolver.find... | [
"0.84373677",
"0.83904266",
"0.81867117",
"0.7809364",
"0.76840603",
"0.7631516",
"0.7612456",
"0.75766957",
"0.756475",
"0.7517313",
"0.7469483",
"0.74292386",
"0.7380276",
"0.73654985",
"0.73526037",
"0.73500985",
"0.73493755",
"0.73493063",
"0.72896427",
"0.7251545",
"0.71... | 0.74413705 | 11 |
Set absolute limit on number of posts to return, or set to None to return as many results as needed; default 50 posts. This limit on applevel. | def limit(self, limit):
params = join_params(self.parameters, {"limit": limit,
"url_domain": self.url_domain,
"proxies": self.proxies})
return self.__class__(**params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def limit(self, limit):\n\n # Return between 1 and 250 results, defaults to 10\n return max(1, min(250, int(limit) if limit else 10))",
"def limit(self, limit):\n if limit is None:\n return self\n\n self.query = self.query.limit(limit)\n self._has_limit = True\n return self",
"de... | [
"0.6801113",
"0.6553332",
"0.6503249",
"0.6446786",
"0.6433944",
"0.64241755",
"0.6361055",
"0.6325042",
"0.6283924",
"0.6281148",
"0.6246459",
"0.62347746",
"0.6205886",
"0.6197679",
"0.6190262",
"0.6190262",
"0.61789477",
"0.61789477",
"0.61789477",
"0.61658674",
"0.6162289... | 0.63779676 | 6 |
Set absolute limit on number of posts to get, or set to None to return defaulting 25 posts; max 50 posts. This limit on APIlevel. | def per_page(self,limit):
params = join_params(self.parameters,
{"per_page": set_limit(limit),
"limit": self._limit,
"url_domain": self.url_domain,
"proxies": self.proxies
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def limit(self, limit):\n self._limit = limit\n return self",
"def limit(self, limit):\n self._limit = limit",
"def limit(self, limit):\n\n # Return between 1 and 250 results, defaults to 10\n return max(1, min(250, int(limit) if limit else 10))",
"def get_limit(self):\r\n\... | [
"0.67124665",
"0.6679423",
"0.6671076",
"0.65983295",
"0.65865403",
"0.65576196",
"0.655653",
"0.6550377",
"0.64867103",
"0.6471201",
"0.6471201",
"0.6471201",
"0.64261115",
"0.64054394",
"0.6404068",
"0.6391131",
"0.632516",
"0.6285534",
"0.6279913",
"0.6279913",
"0.62438357... | 0.58120143 | 42 |
4xkk Skip next instruction if Vx != kk. The interpreter compares register Vx to kk, and if they are not equal, increments the program counter by 2. | def branch_if_not_equal_val(self):
register = (self.opcode & 0x0F00) >> 8
value = self.opcode & 0xFF
if self.registers[register] != value:
self.pc += 2
logger.info(
"Didn't skip {} because V{} and {} are not equal".format(
hex(self.pc -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_skip_next_if_vx_equals_kk(self, cpu):\n for x in range(0x0, 0xF):\n for v in range(0x0, 0xFF):\n cpu.V_register[x] = v\n for kk in range(0x0, 0xFF):\n cpu.opcode = 0x3000 | (x << 8) | kk\n for pc in [cpu.memory_start, cp... | [
"0.816584",
"0.8083906",
"0.7025153",
"0.70222133",
"0.6228489",
"0.5694313",
"0.55644727",
"0.5451449",
"0.5440634",
"0.54208565",
"0.53850067",
"0.5384857",
"0.53231335",
"0.5320971",
"0.531752",
"0.53124535",
"0.526615",
"0.5249636",
"0.5224573",
"0.5170692",
"0.5163933",
... | 0.58410513 | 5 |
5xy0 Skip next instruction if Vx = Vy. The interpreter compares register Vx to register Vy, and if they are equal, increments the program counter by 2. | def branch_if_equal_reg(self):
registers = self.return_middle_registers(self.opcode)
if self.registers[registers[0]] == self.registers[registers[1]]:
self.pc += 2
logger.info(
"Skipped {} because register V{} and V{} are equal to {}".format(
hex(se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_skip_next_if_vx_equals_vy(self, cpu):\n for x in range(0x0, 0xF):\n for y in range(0x0, 0xF):\n cpu.opcode = 0x5000 | (x << 8) | (y << 4)\n if x != y:\n for v1 in range(0x0, 0xFF):\n for v2 in range(0x0, 0xFF):\n ... | [
"0.8014877",
"0.78996515",
"0.7718769",
"0.7703779",
"0.67372996",
"0.67129034",
"0.63463926",
"0.6230792",
"0.59805137",
"0.5945416",
"0.59225166",
"0.5849552",
"0.5760153",
"0.57206",
"0.5684904",
"0.56807935",
"0.56776345",
"0.5672317",
"0.5661531",
"0.56562734",
"0.558296... | 0.5381902 | 25 |
Dxyn Display nbyte sprite starting at memory location I at (Vx, Vy), set VF = collision. The interpreter reads n bytes from memory, starting at the address stored in I. These bytes are then displayed as sprites on screen at coordinates (Vx, Vy). Sprites are XORed onto the existing screen. If this causes any pixels to b... | def draw_pixel_to_display(self):
register = self.return_middle_registers(self.opcode)
x = self.registers[register[0]]
y = self.registers[register[1]]
height = self.opcode & 0xF
self.registers[0xF] = 0
x = bit_utils.wrap_around(x, self.display.width)
y = bit_util... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_set_i_to_vx_sprite(self, cpu):\n for sprite in range(0x0, 0xF+1):\n for x in range(0x0, 0xF):\n cpu.opcode = 0xF029 | (x << 8)\n cpu.V_register[x] = sprite\n cpu.set_i_to_vx_sprite()\n assert(cpu.I == 5*sprite)",
"def DRW_Vx_V... | [
"0.6513594",
"0.63181967",
"0.59485996",
"0.5540072",
"0.54992574",
"0.5420743",
"0.53247666",
"0.5314777",
"0.5257876",
"0.52372205",
"0.52372074",
"0.5223247",
"0.5205721",
"0.51884145",
"0.518519",
"0.51657",
"0.51638",
"0.5153349",
"0.51247025",
"0.512014",
"0.51147324",
... | 0.59997195 | 2 |
8xy7 Set Vx = Vy Vx, set VF = NOT borrow. If Vy > Vx, then VF is set to 1, otherwise 0. Then Vx is subtracted from Vy, and the results stored in Vx. | def subn_reg_from_reg(self):
register = self.return_middle_registers(self.opcode)
if self.registers[register[1]] > self.registers[register[0]]:
self.registers[0xF] = 1
self.registers[register[0]] = (
self.registers[register[1]]
- self.registers[reg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_set_vx_to_vy_minus_vx(self, cpu):\n for x in range(0x0, 0xF):\n for y in range(0x0, 0xF):\n if x != y:\n cpu.opcode = 0x8007 | (x << 8) | (y << 4)\n for v1 in range(0x0, 0xFF):\n for v2 in range(0x0, 0xFF):\n ... | [
"0.6918244",
"0.6858337",
"0.67917615",
"0.6726138",
"0.6416093",
"0.62134135",
"0.6120543",
"0.6070182",
"0.6025172",
"0.5941048",
"0.5932545",
"0.5921518",
"0.5870453",
"0.5824654",
"0.5789833",
"0.5695025",
"0.56798065",
"0.5671692",
"0.5629817",
"0.5600145",
"0.5592555",
... | 0.0 | -1 |
9xy0 Skip next instruction if Vx != Vy. The values of Vx and Vy are compared, and if they are not equal, the program counter is increased by 2. | def skip_if_regs_not_equal(self):
register = self.return_middle_registers(self.opcode)
value_x = self.registers[register[0]]
value_y = self.registers[register[1]]
if value_x != value_y:
self.pc += 2
logger.info("Skipped {} because V{} = V{}".format(
hex(se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_skip_next_if_vx_equals_vy(self, cpu):\n for x in range(0x0, 0xF):\n for y in range(0x0, 0xF):\n cpu.opcode = 0x5000 | (x << 8) | (y << 4)\n if x != y:\n for v1 in range(0x0, 0xFF):\n for v2 in range(0x0, 0xFF):\n ... | [
"0.83508325",
"0.83289176",
"0.7944169",
"0.7894002",
"0.6454628",
"0.64074075",
"0.63855803",
"0.62239313",
"0.60197276",
"0.60006964",
"0.5906003",
"0.58150214",
"0.5788128",
"0.574523",
"0.57182723",
"0.5692351",
"0.56309664",
"0.56103826",
"0.5501817",
"0.54717726",
"0.54... | 0.7056754 | 4 |
Returns all the ``BasicBlock`` s in the CFG that are followed by a ``Branch`` | def get_basic_blocks_followed_by_branches(self):
is_basicblock_followed_by_branch = \
lambda block : isinstance(block, BasicBlock) and \
isinstance(block.outgoing_edge[0], Branch)
return filter(is_basicblock_followed_by_branch, self.blocks) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_branches(self):\n branches = []\n for bracket in self.__brackets:\n branches.append(bracket.get_branch())\n return branches",
"def find_paths(self, block, initial_block, conds=[]):\n if isinstance(block, Yield):\n if isinstance(block.value, ast.Yield) and... | [
"0.62072575",
"0.599081",
"0.5925273",
"0.5581489",
"0.5420468",
"0.53548396",
"0.53263915",
"0.5307269",
"0.5297503",
"0.5294589",
"0.528809",
"0.5279909",
"0.52693075",
"0.5257159",
"0.5231599",
"0.52135646",
"0.520911",
"0.50841695",
"0.50765246",
"0.5068533",
"0.5028474",... | 0.69621396 | 0 |
Passes the given target sequence, encoder outputs, and attention mask through the decoder stack. | def forward( self, target, encoder_output, attention_mask ):
x = target
for layer in self.decoder_layers:
x = layer( x, encoder_output, attention_mask )
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(\n self,\n embedding_sequence: torch.Tensor,\n encoder_output: torch.Tensor,\n source_mask: torch.Tensor,\n target_mask: torch.Tensor = None,\n apply_target_subsequent_mask: bool = True,\n ):\n\n if apply_target_subsequent_mask:\n # shape :... | [
"0.69531417",
"0.6764315",
"0.6583409",
"0.65583766",
"0.6521253",
"0.65090555",
"0.64153045",
"0.634258",
"0.6314743",
"0.6266722",
"0.62657124",
"0.6175034",
"0.6170122",
"0.6137886",
"0.61199594",
"0.60677856",
"0.6060724",
"0.60442924",
"0.5969858",
"0.59559983",
"0.59480... | 0.72397035 | 0 |
Given a string in snake case, return a string in upper camel case. | def snake_to_camel(string):
camel_case = []
for word in string.split("_"):
camel_case.append(word.title())
"".join(camel_case) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snake_to_camel_case(snake_str: str) -> str:\n\n words = snake_str.strip(\"_\").split(\"_\")\n return words[0] + \"\".join(word[:1].upper() + word[1:] for word in words[1:])",
"def snake_to_camel(string):\n camel_case = []\n\n for word in string.split('_'):\n camel_case.append(word[0].upper... | [
"0.8430326",
"0.81223065",
"0.81109744",
"0.8105183",
"0.80565757",
"0.80108196",
"0.7970541",
"0.7889011",
"0.7849014",
"0.783033",
"0.78208613",
"0.77654475",
"0.7673997",
"0.7652768",
"0.7613773",
"0.761173",
"0.75626194",
"0.75626194",
"0.7561411",
"0.7548015",
"0.7540921... | 0.7866813 | 8 |
Returns the number of intervals for continuity . May be one if Continuity(me) >= | def NbIntervals(self, *args):
return _Adaptor3d.Adaptor3d_Curve_NbIntervals(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _number_of_intervals(self):\n return self._number_of_levels - 1",
"def interval_cardinality(self):\n return len(list(self.lower_contained_intervals()))",
"def intervalLen(self):\n return self.end-self.start+1",
"def num_conll(self):\n pass",
"def get_contours_number(self):\n ... | [
"0.68973154",
"0.6324574",
"0.62255436",
"0.6193144",
"0.61019766",
"0.5891834",
"0.57859546",
"0.57796997",
"0.5763482",
"0.5763482",
"0.5761608",
"0.5716756",
"0.56488776",
"0.56488776",
"0.56295055",
"0.5611196",
"0.5581919",
"0.55643076",
"0.55497503",
"0.55395895",
"0.55... | 0.54567623 | 27 |
Computes the point of parameter U on the curve. | def Value(self, *args):
return _Adaptor3d.Adaptor3d_Curve_Value(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def u(self, point = -1):\n return self.solution('u', point)",
"def calc_pxU(self):\n self.p_xU = bayesian.px_U(self.max_radius)",
"def __call__(self, u, t):\n S, I, R, V = u\n return [-self.beta(t)*S*I-self.p(t)*S,\n self.beta(t)*S*I-self.nu(t)*I,self.... | [
"0.73742",
"0.7004761",
"0.6828638",
"0.6762647",
"0.65855026",
"0.6523974",
"0.63149714",
"0.6311605",
"0.62536556",
"0.62359804",
"0.6218717",
"0.62017024",
"0.6199048",
"0.6154278",
"0.6125874",
"0.61235815",
"0.6115457",
"0.60666114",
"0.60648763",
"0.6059101",
"0.5984137... | 0.0 | -1 |
Computes the point of parameter U on the curve. | def D0(self, *args):
return _Adaptor3d.Adaptor3d_Curve_D0(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def u(self, point = -1):\n return self.solution('u', point)",
"def calc_pxU(self):\n self.p_xU = bayesian.px_U(self.max_radius)",
"def __call__(self, u, t):\n S, I, R, V = u\n return [-self.beta(t)*S*I-self.p(t)*S,\n self.beta(t)*S*I-self.nu(t)*I,self.... | [
"0.7375409",
"0.7004185",
"0.68256426",
"0.6762101",
"0.65822786",
"0.6524225",
"0.63141125",
"0.6310796",
"0.6254795",
"0.623512",
"0.62183106",
"0.62002033",
"0.6198014",
"0.61567056",
"0.6128322",
"0.6122093",
"0.6113747",
"0.6066325",
"0.6063735",
"0.6057067",
"0.5985116"... | 0.0 | -1 |
Returns the point P of parameter U, the first and second derivatives V1 and V2. Raised if the continuity of the current interval is not C2. | def D2(self, *args):
return _Adaptor3d.Adaptor3d_Curve_D2(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v_p(self, psi_l, ci):\n\t\treturn min((ci*self.VPMAX0)/(ci + self.KP), self.VPR)",
"def calcpv(pvrange, pvinx1, pvinx2, sipx, sipy, tpvx, tpvy):\n x, y = symbols(\"x y\")\n if pvinx1 == 1:\n expr1 = tpvx\n expr2 = sipx\n elif pvinx1 == 2:\n expr1 = tpvy\n expr2 = sipy\n ... | [
"0.606858",
"0.604953",
"0.5859579",
"0.5796227",
"0.5779603",
"0.5705667",
"0.56337154",
"0.5623958",
"0.5622449",
"0.5577769",
"0.55476034",
"0.5463118",
"0.5441955",
"0.5419544",
"0.54115874",
"0.5356755",
"0.5346686",
"0.53392833",
"0.53392833",
"0.53257966",
"0.5320818",... | 0.0 | -1 |
Returns a reference to the Surface inside the HSurface. | def Surface(self, *args):
return _Adaptor3d.Adaptor3d_HSurface_Surface(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def surface(self):\n return self._surface",
"def get_subsurface(self):\n w, h = self.rect.w, self.rect.h\n surface = pg.Surface((w, h))\n surface.set_colorkey((0, 0, 0))\n return pg.Surface((w, h))",
"def get_surface(self, name):\n for surface in self._surfaces:\n ... | [
"0.78297716",
"0.723058",
"0.72067374",
"0.7177043",
"0.7177043",
"0.7157122",
"0.6818885",
"0.68185943",
"0.6559327",
"0.65223384",
"0.64866275",
"0.626876",
"0.61424005",
"0.60000396",
"0.59458435",
"0.59452945",
"0.59302646",
"0.59144807",
"0.5846696",
"0.584025",
"0.57629... | 0.77071446 | 1 |
Changes the curve. The Offset is reset to 0. | def Load(self, *args):
return _Adaptor3d.Adaptor3d_OffsetCurve_Load(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setCurve(self, index, curve) -> None:\n ...",
"def __init__(self, original_curve: Curve, offset: np.ndarray):\n self._original_curve = original_curve\n self._offset = offset",
"def setPositionAnimCurve(self, index, animCurve, view) -> None:\n ...",
"def setCurve(self, *args):\... | [
"0.7231603",
"0.65058845",
"0.63635725",
"0.6346726",
"0.6346069",
"0.6265551",
"0.62602866",
"0.62164795",
"0.6192124",
"0.6189021",
"0.602735",
"0.58682406",
"0.5838617",
"0.58261555",
"0.5815655",
"0.57979286",
"0.57641953",
"0.5762653",
"0.575096",
"0.5735102",
"0.5722809... | 0.0 | -1 |
Returns the number of V intervals for continuity . May be one if VContinuity(me) >= | def NbVIntervals(self, *args):
return _Adaptor3d.Adaptor3d_Surface_NbVIntervals(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(self):\n return self.vcount",
"def get_contours_number(self):\n ncontour = len(self.x)\n logger.info(\"Number of contours: {0}\".format(ncontour))\n return ncontour",
"def _number_of_intervals(self):\n return self._number_of_levels - 1",
"def n_cs(self):\n retu... | [
"0.5833118",
"0.5812298",
"0.57627314",
"0.57318383",
"0.5662196",
"0.56163967",
"0.55738187",
"0.5511229",
"0.5502835",
"0.54737055",
"0.5466982",
"0.5466982",
"0.54018897",
"0.5397112",
"0.53935874",
"0.5368965",
"0.536834",
"0.5368097",
"0.535776",
"0.535776",
"0.5339753",... | 0.5993507 | 0 |
Returns the intervals with the requested continuity in the U direction. | def UIntervals(self, *args):
return _Adaptor3d.Adaptor3d_Surface_UIntervals(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def NbUIntervals(self, *args):\n return _Adaptor3d.Adaptor3d_Surface_NbUIntervals(self, *args)",
"def u_edges(self):\n return np.linspace(self.u_min, self.u_max, self.n_ubins + 1)",
"def index_interval(lb: int, ub: int, nbits=None, graycode=False) -> List[int]:\n if graycode:\n assert n... | [
"0.5870866",
"0.58019507",
"0.5611565",
"0.5566933",
"0.54912835",
"0.5392876",
"0.53794134",
"0.53688323",
"0.53345245",
"0.53072727",
"0.5304025",
"0.5301111",
"0.5272128",
"0.52685934",
"0.52308494",
"0.5229207",
"0.52236766",
"0.5178832",
"0.51725495",
"0.51673245",
"0.51... | 0.61829203 | 0 |
Computes the derivative of order Nu in the direction U and Nv in the direction V at the point P(U, V). Raised if the current U interval is not not CNu and the current V interval is not CNv. Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0. | def DN(self, *args):
return _Adaptor3d.Adaptor3d_Surface_DN(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def FiniteDiff(u, dx, d):\n \n n = u.size\n ux = np.zeros(n, dtype=u.dtype)\n \n if d == 1:\n for i in range(1,n-1):\n ux[i] = (u[i+1]-u[i-1]) / (2*dx)\n \n ux[0] = (-3.0/2*u[0] + 2*u[1] - u[2]/2) / dx\n ux[n-1] = (3.0/2*u[n-1] - 2*u[n-2] + u[n-3]/2) / dx\n ... | [
"0.6336903",
"0.5920957",
"0.59105045",
"0.58306366",
"0.5746483",
"0.5732917",
"0.5732917",
"0.5632809",
"0.55697745",
"0.55598664",
"0.55324316",
"0.5530049",
"0.55076575",
"0.5469003",
"0.54676557",
"0.5464478",
"0.54523414",
"0.5445618",
"0.54202133",
"0.54154825",
"0.540... | 0.0 | -1 |
Returns True if the vertices V1 and V2 are identical. This method does not take the orientation of the vertices in account. | def Identical(self, *args):
return _Adaptor3d.Adaptor3d_TopolTool_Identical(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verticesEqual(self, v1, v2, eps=1e-8):\n if abs(v1[0] - v2[0]) > eps:\n return False\n if abs(v1[1] - v2[1]) > eps:\n return False\n if abs(v1[2] - v2[2]) > eps:\n return False\n return True",
"def _vertices_are_equal(\n vertices1: List[np.ndarr... | [
"0.82719606",
"0.78224254",
"0.6956557",
"0.6938469",
"0.68201566",
"0.6790302",
"0.67816967",
"0.6730816",
"0.67222506",
"0.6612339",
"0.65978515",
"0.6545454",
"0.65390235",
"0.65215695",
"0.6482251",
"0.640655",
"0.63821226",
"0.6372323",
"0.63104147",
"0.62747097",
"0.626... | 0.0 | -1 |
returns 3d tolerance of the arc C | def Tol3d(self, *args):
return _Adaptor3d.Adaptor3d_TopolTool_Tol3d(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_arccos():\n c=0.5\n def myfunc(x):\n f1=EF.arccos(x)\n return f1\n\n f_obj=ADiff(myfunc)\n res=f_obj.Jac(c)\n expectAns={'diff':-1/math.sqrt(1-c**2), 'value':math.acos(c)}\n assert res==expectAns",
"def test_caekl_4(d):\n assert J(d) <= (T(d) / 3) + 1e-6",
"def calc_... | [
"0.6338388",
"0.62060666",
"0.6192313",
"0.61192554",
"0.6089514",
"0.60247165",
"0.60201037",
"0.5982706",
"0.5950784",
"0.5896721",
"0.58792424",
"0.5868353",
"0.5862294",
"0.5860669",
"0.58409154",
"0.58379173",
"0.5822366",
"0.581535",
"0.5812348",
"0.5812095",
"0.5795547... | 0.0 | -1 |
return the set of U parameters on the surface obtained by the method SamplePnts | def UParameters(self, *args):
return _Adaptor3d.Adaptor3d_TopolTool_UParameters(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SamplePnts(self, *args):\n return _Adaptor3d.Adaptor3d_TopolTool_SamplePnts(self, *args)",
"def BSplSamplePnts(self, *args):\n return _Adaptor3d.Adaptor3d_TopolTool_BSplSamplePnts(self, *args)",
"def UIntervals(self, *args):\n return _Adaptor3d.Adaptor3d_Surface_UIntervals(self, *args)... | [
"0.65580094",
"0.65143687",
"0.60258627",
"0.5901035",
"0.5901035",
"0.5896054",
"0.5869104",
"0.5800974",
"0.5783904",
"0.57650745",
"0.5731213",
"0.56969494",
"0.5688062",
"0.56796485",
"0.56423753",
"0.56423753",
"0.5597",
"0.54804945",
"0.546892",
"0.546563",
"0.5452715",... | 0.61913615 | 2 |
Resolves a DID and returns the DID Document (JSON format), if it exists. | def resolve_DID(DID: str):
# Parse the DID and check if it is one of the supported types
try:
err, did_struct = didutils.parseDid(DID)
except Exception as e:
detail=str(e)
log.error(detail)
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail=detail)
if e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def m_get_DIDDocument(DID):\n\n DID, name, DIDDocument, active = resolver.resolveDID(DID)\n\n print(f\"Name: : {name}\")\n print(json.dumps(DIDDocument, ensure_ascii=False, indent=3))",
"def get(self, did):\n dev = Device.query.filter(Device.id == did).one_or_none()\n if dev:\n ... | [
"0.80398685",
"0.643017",
"0.5510842",
"0.54589266",
"0.54198587",
"0.5370178",
"0.52493495",
"0.5245054",
"0.5239066",
"0.5220812",
"0.5203224",
"0.5114183",
"0.5102752",
"0.5073617",
"0.50691724",
"0.49976265",
"0.49662784",
"0.49465707",
"0.49441296",
"0.4935144",
"0.48716... | 0.7751969 | 1 |
Here we suppose that E does not have any 0 on the diagonal and is symmetric. | def ts(n_steps, arms, E):
K = len(arms)
reward = np.zeros(n_steps)
# Initialize X : total rewards per arm
# and O : number of draws per arm
X = np.zeros(K)
O = np.zeros(K)
# Do n_steps iterations of the algorithm
for t in range(n_steps):
theta = np.random.beta(X+1,O-X+1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def anti_symmeterize(self):\n A = self.to_coo_matrix()\n symg = wgraph_from_adjacency((A - A.T) / 2)\n self.E = symg.E\n self.edges = symg.edges\n self.weights = symg.weights\n return self.E",
"def symmetric(matrix):\n return sp.allclose(matrix, matrix.T)",
"def dia... | [
"0.62975454",
"0.6214328",
"0.6190005",
"0.5922564",
"0.5897345",
"0.5873182",
"0.5862138",
"0.5822246",
"0.5819514",
"0.58014065",
"0.5708716",
"0.5699536",
"0.5688905",
"0.5688905",
"0.56849927",
"0.56309634",
"0.5629794",
"0.55843997",
"0.55819",
"0.55754423",
"0.55617285"... | 0.0 | -1 |
The ID of the networkbased server load balancer instance to be bound to the security group. | def load_balancer_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "load_balancer_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_group_id(self) -> str:\n return pulumi.get(self, \"server_group_id\")",
"def server_group_id(self) -> str:\n return pulumi.get(self, \"server_group_id\")",
"def server_group_id(self) -> str:\n return pulumi.get(self, \"server_group_id\")",
"def server_group_id(self) -> str:\n ... | [
"0.73427165",
"0.73427165",
"0.73427165",
"0.73427165",
"0.73427165",
"0.69876325",
"0.6983988",
"0.6983988",
"0.6983988",
"0.68733096",
"0.6859826",
"0.6851451",
"0.6851451",
"0.6763318",
"0.6753433",
"0.6753433",
"0.66997236",
"0.669586",
"0.6662794",
"0.66586435",
"0.66552... | 0.6443876 | 24 |
The ID of security groups. | def security_group_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "security_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def security_group_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"security_group_id\")",
"def security_group_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"security_group_id\")",
"def group_id(self):\n # type: () -> string_types\n return self._group_id",
... | [
"0.7743672",
"0.7743672",
"0.7632281",
"0.7580866",
"0.7531346",
"0.7531346",
"0.74812835",
"0.7478192",
"0.73959905",
"0.7362362",
"0.7360916",
"0.7360916",
"0.7360916",
"0.7351056",
"0.73236954",
"0.73236954",
"0.7260449",
"0.72264624",
"0.72022164",
"0.7192034",
"0.7192034... | 0.7518139 | 6 |
The ID of the networkbased server load balancer instance to be bound to the security group. | def load_balancer_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "load_balancer_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_group_id(self) -> str:\n return pulumi.get(self, \"server_group_id\")",
"def server_group_id(self) -> str:\n return pulumi.get(self, \"server_group_id\")",
"def server_group_id(self) -> str:\n return pulumi.get(self, \"server_group_id\")",
"def server_group_id(self) -> str:\n ... | [
"0.7342875",
"0.7342875",
"0.7342875",
"0.7342875",
"0.7342875",
"0.698835",
"0.6984296",
"0.6984296",
"0.6984296",
"0.6872727",
"0.68592566",
"0.68520576",
"0.68520576",
"0.67638403",
"0.675224",
"0.675224",
"0.6699795",
"0.66962487",
"0.66620827",
"0.66590846",
"0.6655892",... | 0.64158833 | 27 |
The ID of security groups. | def security_group_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "security_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def security_group_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"security_group_id\")",
"def security_group_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"security_group_id\")",
"def group_id(self):\n # type: () -> string_types\n return self._group_id",
... | [
"0.77440894",
"0.77440894",
"0.7633787",
"0.75825477",
"0.75325567",
"0.75325567",
"0.7518354",
"0.7518354",
"0.7482658",
"0.74793005",
"0.7396722",
"0.73635125",
"0.73623574",
"0.73623574",
"0.73623574",
"0.73519737",
"0.72623885",
"0.7228153",
"0.72028923",
"0.719253",
"0.7... | 0.73240703 | 17 |
Get an existing LoadBalancerSecurityGroupAttachment resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
dry_run: Optional[pulumi.Input[bool]] = None,
load_balancer_id: Optional[pulumi.Input[str]] = None,
security_group_id: Optional[pulumi.Input[str]] = None) -> 'Loa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: LoadBalancerSecurityGroupAttachmentArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.Resour... | [
"0.546142",
"0.51176965",
"0.49208185",
"0.49034777",
"0.4692799",
"0.46515423",
"0.4498384",
"0.4497912",
"0.4484182",
"0.44740218",
"0.44481698",
"0.43900678",
"0.4364587",
"0.43572864",
"0.4319207",
"0.4301624",
"0.4286978",
"0.4259763",
"0.4259121",
"0.4214977",
"0.420692... | 0.7673216 | 0 |
The ID of the networkbased server load balancer instance to be bound to the security group. | def load_balancer_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "load_balancer_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_group_id(self) -> str:\n return pulumi.get(self, \"server_group_id\")",
"def server_group_id(self) -> str:\n return pulumi.get(self, \"server_group_id\")",
"def server_group_id(self) -> str:\n return pulumi.get(self, \"server_group_id\")",
"def server_group_id(self) -> str:\n ... | [
"0.73427165",
"0.73427165",
"0.73427165",
"0.73427165",
"0.73427165",
"0.69876325",
"0.6983988",
"0.6983988",
"0.6983988",
"0.68733096",
"0.6859826",
"0.6851451",
"0.6851451",
"0.6763318",
"0.6753433",
"0.6753433",
"0.66997236",
"0.669586",
"0.6662794",
"0.66586435",
"0.66552... | 0.65722746 | 22 |
The ID of security groups. | def security_group_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "security_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_id(self):\n # type: () -> string_types\n return self._group_id",
"def GroupId(self):\n\t\treturn self._get_attribute('groupId')",
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
... | [
"0.7632281",
"0.7580866",
"0.7531346",
"0.7531346",
"0.7518139",
"0.7518139",
"0.74812835",
"0.7478192",
"0.73959905",
"0.7362362",
"0.7360916",
"0.7360916",
"0.7360916",
"0.7351056",
"0.73236954",
"0.73236954",
"0.7260449",
"0.72264624",
"0.72022164",
"0.7192034",
"0.7192034... | 0.7743672 | 1 |
Return the vertices of the cube at position x, y, z with size 2n. | def cube_vertices(x, y, z, nx, ny=None, nz=None):
if ny == None: ny = nx
if nz == None: nz = nx
return [
x - nx, y + ny, z - nz, x - nx, y + ny, z + nz, x + nx, y + ny, z + nz, x + nx, y + ny, z - nz, # top
x - nx, y - ny, z - nz, x + nx, y - ny, z - nz, x + nx, y - ny, z + nz, x - nx, y - ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cube_vertices(x, y, z, n):\r\n return [\r\n x-n,y+n,z-n, x-n,y+n,z+n, x+n,y+n,z+n, x+n,y+n,z-n, # top\r\n x-n,y-n,z-n, x+n,y-n,z-n, x+n,y-n,z+n, x-n,y-n,z+n, # bottom\r\n x-n,y-n,z-n, x-n,y-n,z+n, x-n,y+n,z+n, x-n,y+n,z-n, # left\r\n x+n,y-n,z+n, x+n,y-n,z-n, x+n,y+n,z-n, x+n,... | [
"0.8873783",
"0.83488077",
"0.75490093",
"0.71018445",
"0.66022176",
"0.6499646",
"0.64149296",
"0.6403246",
"0.6398743",
"0.6340307",
"0.6240926",
"0.62011635",
"0.6196136",
"0.61161953",
"0.6094907",
"0.60663515",
"0.6062791",
"0.6062572",
"0.60084736",
"0.5974178",
"0.5919... | 0.8402344 | 1 |
Obtain the os's release version string. For the last high sierra release, this function returns 10.13.6 (at the time of writing this) | def os_release() -> str:
assert(platform.system() == 'Darwin')
ver, _, _ = platform.mac_ver()
return ver | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_os_release():\n if platform.linux_distribution()[0]:\n return \" \".join(platform.linux_distribution())\n elif platform.mac_ver()[0]:\n return \"%s %s\" % (platform.mac_ver()[0], platform.mac_ver()[2])\n else:\n return \"Unknown\"",
"def get_version()... | [
"0.8392666",
"0.77674997",
"0.77383244",
"0.75008404",
"0.73628885",
"0.730579",
"0.72776353",
"0.7215913",
"0.71995384",
"0.71902764",
"0.7180848",
"0.71615225",
"0.71615225",
"0.7130895",
"0.7045702",
"0.7043242",
"0.70341873",
"0.7030725",
"0.70161045",
"0.69966215",
"0.69... | 0.81737804 | 1 |
Subscribe to a specific MQTT topic. | def subscribe_mqtt(self, topic):
if topic not in self.subscriptions:
self.subscriptions.append(topic)
self.mqtt.subscribe(topic) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribe( self, topic ):\n logging.info( \"Subscribing to topic %s\" %topic )\n try:\n self.client.subscribe( topic )\n except Exception as error:\n print( error )",
"def subscribe(client, mqtt_topic):\n\n print()\n print(\"Subscribe\")\n print(\"=========... | [
"0.8374031",
"0.828736",
"0.81333816",
"0.80884457",
"0.79633814",
"0.77499473",
"0.7596453",
"0.7596423",
"0.7478305",
"0.74282557",
"0.7330425",
"0.724999",
"0.7210943",
"0.7103714",
"0.70520645",
"0.7013076",
"0.6958183",
"0.6958183",
"0.69235724",
"0.691762",
"0.68628395"... | 0.8411156 | 0 |
Return a datetime object indicating when an authorization code should expire. | def get_code_expiry():
return now() + EXPIRE_CODE_DELTA | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_token_expiry_date():\n\treturn timezone.now() + datetime.timedelta(days=TOKEN_VALID_DATE)",
"def test_expired_access_token_time(self):\n\n expired = datetime.datetime.now(pytz.utc) - datetime.timedelta(\n minutes=6)\n\n # Store the old TZ info, if it exists.\n old_tz = Non... | [
"0.71129316",
"0.7071931",
"0.67471975",
"0.6700022",
"0.6649452",
"0.6605048",
"0.6521947",
"0.640346",
"0.6306533",
"0.6289284",
"0.62882215",
"0.62619996",
"0.6260894",
"0.6147417",
"0.6147417",
"0.6147417",
"0.61424017",
"0.61424017",
"0.61386883",
"0.6125367",
"0.6124335... | 0.7824756 | 1 |
Returns a timestamp in one of my preferred formats | def skrTimeStamp(style = "%y/%m/%db"):
ts = ""
now = datetime.datetime.now()
ts = now.strftime(style)
return ts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _timestamp():\n moment = time.time()\n moment_us = repr(moment).split(\".\")[1]\n return time.strftime(\"%Y-%m-%d-%H-%M-%S-{}\".format(moment_us), time.gmtime(moment))",
"def get_timestamp():\n return time.strftime('%Y-%m-%d %H:%M:%S')",
"def _get_timestamp():\n return str(int(time.t... | [
"0.8363499",
"0.79354686",
"0.7855838",
"0.7770708",
"0.77603644",
"0.7713341",
"0.768651",
"0.7643031",
"0.7639975",
"0.7610456",
"0.7571661",
"0.756581",
"0.75619483",
"0.7516231",
"0.74718523",
"0.74280995",
"0.7409781",
"0.73994136",
"0.7392119",
"0.7376444",
"0.7264482",... | 0.6894501 | 60 |
Tests the fork transition to cancun and verifies that blocks with timestamp lower than the transition timestamp do not contain beacon roots in the predeployed contract. | def test_beacon_root_transition_test(
blockchain_test: BlockchainTestFiller,
timestamps: Iterable[int],
beacon_roots: Iterable[bytes],
block_count: int,
tx: Transaction,
call_gas: int,
call_value: int,
system_address_balance: int,
fork: Fork,
):
blocks: List[Block] = []
pre =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_good_fork_lower(self):\n bvh = self.BlockValidationHandler()\n\n root = self.btm.chain_head\n\n # create a new valid chain 5 long from the current root\n new_head = self.btm.generate_chain(root, 5,\n {'add_to_store': True})\n sel... | [
"0.6835604",
"0.6709285",
"0.6534247",
"0.63925785",
"0.6390109",
"0.628087",
"0.6124429",
"0.59462124",
"0.5911869",
"0.59018064",
"0.57529706",
"0.56667817",
"0.56319594",
"0.5611936",
"0.5567029",
"0.5538642",
"0.5500035",
"0.5461819",
"0.54379755",
"0.54354244",
"0.543248... | 0.7294012 | 0 |
Whether the vocabulary object contains unknown token. | def has_unk(self) -> bool:
return hasattr(self, 'unk_token') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unknown(self, w):\n return w not in self._vocab",
"def unknown(self, w):\n return not(w in self.word_tags)",
"def is_unk(self, token: str) -> bool:\n return self.stoi[token] == DEFAULT_UNK_ID",
"def token_has_vector(self, token):\n return self.svecs.vocab.unit2id(token.text) !... | [
"0.79112726",
"0.7344161",
"0.73379266",
"0.70160186",
"0.6824428",
"0.652761",
"0.6522024",
"0.65029424",
"0.6263026",
"0.6225636",
"0.61785907",
"0.6157094",
"0.61336434",
"0.6117714",
"0.609886",
"0.60597897",
"0.60524917",
"0.6029149",
"0.60136616",
"0.5971105",
"0.594059... | 0.76670086 | 1 |
Return all tokens in the vocabulary | def all_tokens(self) -> List[Hashable]:
return self._all_tokens | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allWords(self):\n words = set([])\n for token in self.tokens:\n words.add(token.text)\n return words",
"def tokens(self):\n\t\tlabels_and_synonyms = list(itertools.chain.from_iterable(list(self.term_to_tokens.values())))\n\t\ttokens = set(list(itertools.chain.from_iterable([word_tokenize(x) for... | [
"0.750281",
"0.7367667",
"0.72787",
"0.71800387",
"0.7034579",
"0.7023828",
"0.7015587",
"0.69639444",
"0.6911982",
"0.68993217",
"0.6803537",
"0.67748314",
"0.6728561",
"0.67190874",
"0.66917133",
"0.66817766",
"0.6653142",
"0.66489226",
"0.66356343",
"0.6611604",
"0.6584472... | 0.6858298 | 10 |
Return all special tokens. We will order the tokens in ascending order of their index in the vocabulary. | def special_tokens(self) -> List[Hashable]:
return list(self._special_token_kv.values()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def non_special_tokens(self) -> List[Hashable]:\n return self._non_special_tokens",
"def special_tokens(self, ):\n\n if self.tokenizer.bos_token is None or self.tokenizer.eos_token is None:\n special_tokens = self.tokenizer.build_inputs_with_special_tokens([])\n special_to... | [
"0.7039891",
"0.6846782",
"0.6770642",
"0.66651493",
"0.6584356",
"0.64719206",
"0.6459232",
"0.63705206",
"0.6350056",
"0.62986463",
"0.6249921",
"0.62499136",
"0.62344337",
"0.6198053",
"0.61699927",
"0.61505914",
"0.61368257",
"0.60924953",
"0.60666966",
"0.60457844",
"0.6... | 0.7326978 | 0 |
Save vocab to a json file | def save(self, path: str):
with open(path, 'w', encoding='utf-8') as f:
f.write(self.to_json()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vocab_to_json(vocab: Mapping, path: str):\n with open(path, \"w\") as out:\n json.dump(vocab, out, indent=4, ensure_ascii=False)\n logger.info('Vocabulary saved to \"%s\"', path)",
"def save_vocabulary(path, vocab):\n print('saving vocabulary..')\n with open(path, 'wb') as handle:\n ... | [
"0.83514005",
"0.7377576",
"0.7295344",
"0.72298986",
"0.717441",
"0.7142687",
"0.70883834",
"0.70735407",
"0.7052904",
"0.70333594",
"0.6988464",
"0.6962908",
"0.6936691",
"0.6909437",
"0.6888645",
"0.68124187",
"0.6801077",
"0.6794325",
"0.67926145",
"0.6779074",
"0.6706982... | 0.6535812 | 31 |
Deserialize Vocab object from json string. | def from_json(cls, json_str: Union[str, bytes, bytearray]) -> 'Vocab':
vocab_dict = json.loads(json_str)
all_tokens = vocab_dict.get('all_tokens')
special_token_kv = vocab_dict.get('special_token_key_value')
if 'unk_token' not in special_token_kv:
special_token_kv['unk_token'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(cls, path: str) -> 'Vocab':\n with open(path, 'r', encoding='utf-8') as f:\n return cls.from_json(f.read())",
"def vocab_from_json(path: str) -> Dict:\n with open(path, encoding=VOCAB_ENCODING) as inp:\n vocab = json.load(inp)\n logger.info('Vocabulary (%d words) loade... | [
"0.7173083",
"0.668347",
"0.650829",
"0.63165796",
"0.6065334",
"0.6063519",
"0.5990888",
"0.59594613",
"0.59594613",
"0.5954822",
"0.5890248",
"0.5879899",
"0.58619064",
"0.5845954",
"0.5842915",
"0.5812334",
"0.5811191",
"0.5798692",
"0.5778903",
"0.57689065",
"0.5758348",
... | 0.76268023 | 0 |
Set up temp dir for tests. | def setUp(self):
self.tmpdir = mkdtemp() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.tmp = TemporaryDirectory()",
"def setUp(self):\n chdir(mkdtemp())",
"def setUp(self):\n chdir(mkdtemp())",
"def setUp(self):\n tempDir.safe_mkdir(parents=True)\n os.chdir(tempDir.as_posix())",
"def setUp(self):\n self._dir = tempfile.mkdtemp(prefix=... | [
"0.85621893",
"0.85323495",
"0.85323495",
"0.84824836",
"0.822752",
"0.800622",
"0.800622",
"0.800622",
"0.800622",
"0.800622",
"0.800622",
"0.800622",
"0.7924256",
"0.79109013",
"0.7892626",
"0.78910226",
"0.78910226",
"0.78802",
"0.7863087",
"0.7758026",
"0.77026397",
"0.... | 0.8510871 | 3 |
Computes the total betadivergence between the current model and X | def score(self, X):
return _betadiv(X, parafac(self.factors_), self.beta).sum() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit(self, X, max_iter=30, epsilon=10e-1, rand_seed = False):\r\n \r\n if rand_seed:\r\n np.random.seed(rand_seed)\r\n \r\n # train the HMM model using the Baum-Welch algorithm\r\n # a specific instance of the expectation-maximization algorithm\r\n\r\n N = le... | [
"0.6010553",
"0.59003234",
"0.5885263",
"0.5864798",
"0.5850909",
"0.5836223",
"0.583123",
"0.58180946",
"0.57133234",
"0.5711843",
"0.5691364",
"0.5690785",
"0.5688861",
"0.56884557",
"0.56648934",
"0.56507367",
"0.56498766",
"0.56482095",
"0.5642265",
"0.564215",
"0.5642111... | 0.66416943 | 0 |
Return a theano expression representing the values of the probability density function of a Gaussian distribution. | def pdf(sample, location=0, scale=1):
location = T.cast(location, theano.config.floatX)
SQRT_2_PI = np.sqrt(2 * PI)
SQRT_2_PI = T.cast(SQRT_2_PI, theano.config.floatX)
divisor = 2 * scale ** 2 # + epsilon,
divisor = T.cast(divisor, theano.config.floatX)
if isinstance(location, T.TensorVariable)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _gaussian_distribution(self, x: ndarray, mu: float, sigma: float) -> ndarray:\n return 1 / (np.sqrt(2 * np.pi) * sigma) * np.exp(\n -np.power(\n (x - mu) / sigma, 2) / 2)",
"def gaussian_probability(sigma, mu, target):\n target = target.unsqueeze(1).expand_as(sigma)\n r... | [
"0.66919905",
"0.6420543",
"0.6298254",
"0.62599516",
"0.6259948",
"0.6258996",
"0.623765",
"0.622933",
"0.6209275",
"0.6208917",
"0.61980474",
"0.61487",
"0.6146763",
"0.614409",
"0.6109643",
"0.6081426",
"0.6080182",
"0.6070836",
"0.606831",
"0.6017283",
"0.6004209",
"0.5... | 0.0 | -1 |
Takes in data batch and converts them into a list of string which can be used with the tokenizer | def _concatenate_batch(
self, data_batch: Dict[str, List[str]]
) -> Tuple[List[Dict[str, any]], List[Dict[str, any]]]:
concatenated_batch = []
evidences_batch = []
emotion_batch = data_batch["emotion"]
target_utterance_batch = data_batch["target_utterance"]
evidence_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _batch_tokenize(self, text: List[str]) -> List[List[str]]:\n return self.bert_model.batch_tokenize([t.strip() for t in text])",
"def tokenize_keras(raw_data):\n from keras.preprocessing.text import text_to_word_sequence\n return [text_to_word_sequence(d) for d in raw_data]",
"def space_detoken... | [
"0.7208139",
"0.7013935",
"0.696271",
"0.6869062",
"0.6820232",
"0.6726844",
"0.67146254",
"0.65960836",
"0.6487902",
"0.6487783",
"0.64611316",
"0.6421372",
"0.63957703",
"0.6395566",
"0.6393505",
"0.63099855",
"0.6265244",
"0.6253272",
"0.6222397",
"0.62041587",
"0.6182174"... | 0.0 | -1 |
Test total succeed. The total endpoint must return a 200 response with the correct value and format. | def test_total_succeed(test_session):
url = "/total"
body = {
'numbers_to_add': list(range(10000001))
}
# Run the request.
response = test_session.post(url, data=json.dumps(body), content_type="application/json")
assert response.status_code == 200
assert response.json["total"] == 5... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_total(self):\n result = self.test_client.total\n\n assert result == 730",
"def test_manipulate_total_pre_auth(self):\n product = self.create_product()\n\n res = self.do_get_basket()\n self.assertEqual(res.status_code, 200)\n basket_id = res.data['id']\n\n ... | [
"0.7612096",
"0.6695455",
"0.6673443",
"0.6637972",
"0.6599978",
"0.6532777",
"0.64830923",
"0.647706",
"0.64246106",
"0.6398337",
"0.6378722",
"0.6363609",
"0.6298753",
"0.6290472",
"0.62796265",
"0.6242873",
"0.62353444",
"0.62331647",
"0.6220409",
"0.61921155",
"0.6106625"... | 0.79709107 | 0 |
Called when the user specifies an intent for this skill | def on_intent(intent_request, session):
print("on_intent requestId=" + intent_request['requestId'] +
", sessionId=" + session['sessionId'])
intent_name = ""
if 'intent' in intent_request:
intent = intent_request['intent']
if 'name' in intent:
intent_name = intent['nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_intent(intent_request, session):\n\n intent = intent_request['intent']\n intent_name = intent_request['intent']['name']\n\n # Dispatch to your skill's intent handlers\n\n if intent_name not in skillmap:\n intent_name = \"NullSkill\"\n\n if intent_name in skillmap:\n try:\n ... | [
"0.7143966",
"0.6956116",
"0.6949057",
"0.6905333",
"0.68928874",
"0.67641324",
"0.6722764",
"0.6720773",
"0.67161995",
"0.6699252",
"0.6691263",
"0.6670276",
"0.6645522",
"0.6642719",
"0.6638686",
"0.6607724",
"0.6594981",
"0.6575682",
"0.6570076",
"0.65620786",
"0.65609014"... | 0.6754843 | 6 |
Sets Employee's hourly rate to $12/hr, yay?? | def give_raise(self):
self.hourly_pay = 12.00 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_hourly(self,rate,name):\n id = self.find_employee_id(name)\n if id in self.clsf:\n self.emp_dict[id][5] = \"1\"\n print(\"{}{}\".format(name,\" was successfully changed to be an hourly employee\"))\n self.emp_dict[id][8] = rate\n self.classificatio... | [
"0.75306356",
"0.621282",
"0.60855335",
"0.5900545",
"0.5865899",
"0.5847018",
"0.57778937",
"0.57048374",
"0.5646585",
"0.5628574",
"0.5614078",
"0.5592154",
"0.55685514",
"0.55386627",
"0.5506698",
"0.5467584",
"0.54097223",
"0.535622",
"0.5272296",
"0.5267107",
"0.5267059"... | 0.7080733 | 1 |
returns m/\bar{rho} NFW u, in (h^1 Mpc)^3 k in h Mpc^1, m in h^1 solarM this is the quantity typically used in the halo model | def u(self, k, m, z):
result = self.nfw(k, m, z) * m / self.U.rho_m(z)
# FOG
#sigma2 = self.U.sigma2DispFog(m, z)
#result *= np.exp(- 0.5 * sigma2 * k**2 * mu**2)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def width_v_rho(model: SingleRhNeutrinoModel):\n params = _neutrino_vector_meson_constants[\"rho0\"]\n k, g = params[\"k\"], params[\"g\"]\n return _width_v_hv(model, MRHO, k, g)",
"def nfwPot(self, R, Rs, rho0, r200=1):\n x=R/Rs\n hx=self.h(x)\n return 2*rho0*Rs**3*hx",
"def get_... | [
"0.66373414",
"0.6507643",
"0.642449",
"0.6378807",
"0.62946695",
"0.6209517",
"0.6146879",
"0.6095053",
"0.6083181",
"0.60777134",
"0.6067047",
"0.60475826",
"0.6042166",
"0.6042166",
"0.60249335",
"0.6013876",
"0.59867364",
"0.59810984",
"0.5965133",
"0.59392387",
"0.584618... | 0.5928654 | 20 |
returns m/\bar{rho} NFW u, in (h^1 Mpc)^3 k in h Mpc^1, m in h^1 solarM; | def u(self, k, m, z):
result = self.fGauss * self.gauss(k, m, z)
result += (1. - self.fGauss) * self.nfw(k, m, z)
result *= m / self.U.rho_m(z)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def width_v_rho(model: SingleRhNeutrinoModel):\n params = _neutrino_vector_meson_constants[\"rho0\"]\n k, g = params[\"k\"], params[\"g\"]\n return _width_v_hv(model, MRHO, k, g)",
"def zernike_Vnm(rho,theta,n,m):\n\tRnm = 0\n\tfact = lambda x: np.math.factorial(x)\n\tam = abs(m)\n\tfor s in range(0,(n-... | [
"0.6673219",
"0.6395856",
"0.6317373",
"0.6268549",
"0.62569344",
"0.6247573",
"0.6247455",
"0.6246553",
"0.62344164",
"0.62344164",
"0.6168778",
"0.6154059",
"0.6029608",
"0.60269696",
"0.60009253",
"0.59865963",
"0.5985771",
"0.5965394",
"0.5953154",
"0.59515095",
"0.594050... | 0.5289578 | 83 |
k in h/Mpc, m is Mvir in Msun/h | def u(self, k, m, z):
a = 1./(1.+z)
m500 = self.U.massRadiusConversion(m, z, value=500., ref="m")[0]
result = self.S500(self.nu, m500, a)
result *= self.nfw(k, m, z)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_k(self):\n\t\n\tself.k = -np.array([self.sth*self.cphi, self.sth*self.sphi, self.cth])\n\n\treturn",
"def phi_k_class_coeff( L, m, k ):\n \n s_tkm2 = m + 2*(L - 1)\n if s_tkm2 % (k-2) != 0: return 0 \n s = s_tkm2/(k-2)\n\n if s<0:\n return 0\n\n return phi_k_cc( s, m, k )",
"d... | [
"0.6730707",
"0.63835937",
"0.6365519",
"0.6344422",
"0.62521005",
"0.6228692",
"0.62282133",
"0.61856866",
"0.61748505",
"0.61626226",
"0.6160388",
"0.61267656",
"0.60742086",
"0.607171",
"0.6043098",
"0.60419714",
"0.6014893",
"0.6007557",
"0.59815705",
"0.5959177",
"0.5955... | 0.5589989 | 56 |
returns m/\bar{rho} NFW u, in (h^1 Mpc)^3 k in h Mpc^1, m in h^1 solarM | def u(self, k, m, z):
result = (1. - self.fb) * self.ProfNFW.nfw(k, m, z)
result += self.fb * self.ProfGasBattaglia16.rho3dFourierNorm(k, m, z)
result *= m / self.U.rho_m(z)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def width_v_rho(model: SingleRhNeutrinoModel):\n params = _neutrino_vector_meson_constants[\"rho0\"]\n k, g = params[\"k\"], params[\"g\"]\n return _width_v_hv(model, MRHO, k, g)",
"def mass_tot_rho(self):\n\n dm = np.zeros(self.nzon)\n dm[0] = 4. * np.pi / 3. * (self.r[0] ** 3 - self.r_ce... | [
"0.67082757",
"0.65345055",
"0.64711136",
"0.6436172",
"0.631474",
"0.6298702",
"0.6295953",
"0.6274748",
"0.6274748",
"0.6273432",
"0.6240027",
"0.622686",
"0.62152815",
"0.6170441",
"0.6108529",
"0.6069331",
"0.6058582",
"0.6058329",
"0.60491705",
"0.6045683",
"0.6038263",
... | 0.63828015 | 4 |
Return string representation of this feed. | def __repr__(self):
return "<{}(runs={})>".format(self.__class__.__name__, self._runs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_string(self):\n return self.__repr__()",
"def __str__(self):\n return '\\n\\n'.join(str(item) for item in self._data)",
"def to_str(self):\n return '\\n'.join(str(entry) for entry in self)",
"def serialize(self):\n\n return str(self)",
"def to_str(self):\n return p... | [
"0.7538596",
"0.73101604",
"0.7297874",
"0.72157216",
"0.72111154",
"0.72111154",
"0.72111154",
"0.72111154",
"0.72111154",
"0.72111154",
"0.72111154",
"0.72111154",
"0.72111154",
"0.72111154",
"0.72111154",
"0.72111154",
"0.72111154",
"0.72111154",
"0.72111154",
"0.72111154",
... | 0.0 | -1 |
Returns the main application to be tested. | def getApp(self):
raise Exception('Not implemented.') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def application(self):\n if not ApplicationFixture._test_app:\n app = self.APP_CLASS()\n app.run_tests()\n ApplicationFixture._test_app = app\n return ApplicationFixture._test_app",
"def application():\n yield create_test_application()",
"def testapp():\n fr... | [
"0.78910756",
"0.7545599",
"0.74508464",
"0.7413478",
"0.7320244",
"0.72330904",
"0.72200245",
"0.71599865",
"0.713418",
"0.713418",
"0.713418",
"0.7096955",
"0.70844454",
"0.7077884",
"0.70699376",
"0.70542544",
"0.7044784",
"0.6990196",
"0.6977425",
"0.69707274",
"0.6917002... | 0.6351044 | 75 |
Returns a dataframe of raw trades based on the source XML fixture. | def dataframe_raw_trades():
data = [
['701', '1', '1000', '700', 'A1'],
['002', '1', '1000', '1170', 'B2'],
['103', '2', '500', '200', 'C3']
]
df_cols = ['CorrelationID', 'NumberOfTrades', 'Limit', 'Value', 'TradeID']
df = pd.DataFrame(data, columns=df_cols)
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_xml_file(tmpdir):\n xml_input = tmpdir.mkdir('sub').join('trades_raw.xml')\n xml_input.write(\n '''\n <Trades>\n <Trade CorrelationId=\"701\" NumberOfTrades=\"1\" Limit=\"1000\" TradeID=\"A1\">700</Trade>\n <Trade CorrelationId=\"002\" NumberOfTrades=\"1\" Limit... | [
"0.5778518",
"0.5771829",
"0.5722982",
"0.5687609",
"0.5677517",
"0.56374496",
"0.56339145",
"0.55680794",
"0.5553383",
"0.5542203",
"0.55350494",
"0.5525047",
"0.54988015",
"0.54988015",
"0.5445149",
"0.544135",
"0.54066443",
"0.53719723",
"0.5323936",
"0.5269707",
"0.526908... | 0.5807445 | 0 |
Returns a dataframe of aggregated trade values per correlationID, and sorted by correlationID | def dataframe_aggregated_trades():
data = [
['002', '1', '1000', '1170', 'Rejected'],
['103', '2', '500', '200', 'Pending'],
['701', '1', '1000', '700', 'Accepted'],
]
df_cols = ['CorrelationID', 'NumberOfTrades', 'Limit', 'Value', 'State']
df = pd.DataFrame(data, columns=df_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataframe_raw_trades():\n data = [\n ['701', '1', '1000', '700', 'A1'],\n ['002', '1', '1000', '1170', 'B2'],\n ['103', '2', '500', '200', 'C3']\n ]\n df_cols = ['CorrelationID', 'NumberOfTrades', 'Limit', 'Value', 'TradeID']\n df = pd.DataFrame(data, columns=df_cols)\n r... | [
"0.61010045",
"0.5259381",
"0.52467865",
"0.5136408",
"0.5124098",
"0.5048721",
"0.5023332",
"0.4982975",
"0.4934832",
"0.49342114",
"0.49334186",
"0.49124008",
"0.48919883",
"0.48865193",
"0.4883836",
"0.48424757",
"0.482324",
"0.4823168",
"0.4821243",
"0.481718",
"0.4810618... | 0.64102864 | 0 |
Find and return the index of the smallest element in the list lst from index mark to the end of the list | def findMinFrom(lst, mark):
iMin = mark
for i in range(mark + 1, len(lst)):
if lst[i] < lst[iMin]:
iMin = i
return iMin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __idx_of_minimum(cls, lst: list) -> int:\n\t\treturn lst.index(min(lst))",
"def smallest_elem_index(input_list):\n if len(input_list) == 0:\n raise Exception(\"List must contain at least 1 element\")\n \n min_index = 0 \n for i in range(1, len(input_list)):\n if input_list[i] < inpu... | [
"0.8619743",
"0.80991226",
"0.78542626",
"0.78494334",
"0.7814266",
"0.77153206",
"0.75765234",
"0.7353515",
"0.7342518",
"0.7308734",
"0.72728324",
"0.72488886",
"0.72291446",
"0.7223527",
"0.71616757",
"0.70814884",
"0.70573384",
"0.7030621",
"0.70269465",
"0.7017176",
"0.6... | 0.8226597 | 1 |
Convert UTC date to this object time zone date. | def convert_date(self, date_str):
date_obj = datetime.datetime.strptime(date_str, '%Y-%m-%d %H:%M:%S')
date_obj = date_obj.replace(tzinfo=pytz.timezone('UTC'))
return date_obj.astimezone(pytz.timezone(self.time_zone)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_to_utc(self, date):\n if date.tzinfo is not None:\n # date is timezone-aware\n date = date.astimezone(self.tz_utc)\n\n else:\n # date is a naive date: assume expressed in local time\n date = date.replace(tzinfo=self.tz_local)\n # and con... | [
"0.7541379",
"0.69253606",
"0.6611435",
"0.65502506",
"0.6454392",
"0.64516985",
"0.64355373",
"0.63572055",
"0.63364786",
"0.6327304",
"0.6292617",
"0.62342685",
"0.62261796",
"0.62261796",
"0.6108013",
"0.6078992",
"0.6072663",
"0.6052111",
"0.6012245",
"0.59902775",
"0.595... | 0.6824159 | 2 |
Sets the learning rate to the initial LR decayed by 2 every 10 epochs | def adjust_learning_rate(optimizer, epoch):
lr = hyper.lr * (0.5 ** (epoch // 10))
for param_group in optimizer.param_groups:
param_group['lr'] = lr
return lr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr",
"def initialize_learning_rate(self):\n\n if (self.FLAGS.learning_rate_decay ... | [
"0.77773243",
"0.76951116",
"0.7578788",
"0.7578788",
"0.75534767",
"0.7549098",
"0.7514408",
"0.7481551",
"0.74784285",
"0.7475653",
"0.7474739",
"0.7462785",
"0.7442967",
"0.7439903",
"0.74324113",
"0.74231493",
"0.74153376",
"0.73925936",
"0.7392306",
"0.73764914",
"0.7374... | 0.73955023 | 17 |
This is the default landing page view. Currently, this page serves the index.html file | def home(request):
return render_to_response('index.html', locals(), context_instance = RequestContext(request)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def landing_page():\n\n return render_template('index.html')",
"def index():\r\n\r\n # initializes page title\r\n page_title = 'Home'\r\n\r\n # renders the landing page\r\n return render_template('index.html', page_title=page_title)",
"def view_landing_page():\n return render_template(\"index... | [
"0.86295754",
"0.86257255",
"0.86013514",
"0.834858",
"0.8049384",
"0.8049384",
"0.8000618",
"0.7962526",
"0.7949234",
"0.79462713",
"0.7939442",
"0.79247427",
"0.790521",
"0.78953356",
"0.78914285",
"0.78914285",
"0.78914285",
"0.78914285",
"0.7882967",
"0.7882161",
"0.78821... | 0.7656059 | 80 |
Mocks tzlocal.get_localzone method to always return a given timezone. This should be used in combination with mock_datetime_utc in order to achieve consistent test results accross timezones if datetime.now, datetime.today or date.today functions are used. | def mock_timezone(tzname):
# TODO(sergiyb): Also mock other common libraries, e.g. time, pytz.reference.
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
with mock.patch('tzlocal.get_localzone', lambda: pytz.timezone(tzname)):
return func(*args, **kwargs)
return wr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_timezone() -> Timezone | FixedTimezone:\n return get_local_timezone()",
"def local_zone():\n return get_localzone()",
"def test_utc_in_timez(monkeypatch):\n utcoffset8_local_time_in_naive_utc = (\n datetime.datetime(\n year=2020,\n month=1,\n day=1... | [
"0.767215",
"0.6827554",
"0.6823573",
"0.6793684",
"0.6588038",
"0.6518813",
"0.6448142",
"0.63976616",
"0.6321687",
"0.6308733",
"0.62399197",
"0.62374806",
"0.6209231",
"0.6150779",
"0.6131",
"0.6104499",
"0.6075726",
"0.6070143",
"0.6065056",
"0.6063356",
"0.59859264",
"... | 0.78626734 | 0 |
returns only the highlighted part of an image (the corners) | def transform(image, corners, squared=False):
crns = order_points(corners)
tl, tr, bl, br = crns
widthA = np.sqrt(((br[0] - bl[0]) ** 2) + ((br[1] - bl[1]) ** 2))
widthB = np.sqrt(((tr[0] - tl[0]) ** 2) + ((tr[1] - tl[1]) ** 2))
width = max(int(widthA), int(widthB))
heightA = np.sqrt(((tr[0] -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_region_of_interest():\r\n image = np.array(ImageGrab.grab(bbox=None))\r\n image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)\r\n r = cv2.selectROI(windowName='grab roi', img=image, showCrosshair=True, fromCenter=False)\r\n cv2.destroyAllWindows()\r\n return r[0], r[1], r[0] + r[2], r[1] + r[3... | [
"0.7138192",
"0.67586946",
"0.6520307",
"0.65005773",
"0.64806086",
"0.64562535",
"0.6278952",
"0.6248135",
"0.61992073",
"0.61782306",
"0.6154352",
"0.6111687",
"0.610783",
"0.59886664",
"0.5985584",
"0.59830564",
"0.5904434",
"0.5901648",
"0.58626455",
"0.585533",
"0.585521... | 0.0 | -1 |
Returns an image of predicted outputs as a numpycompatible RGBA image drawn by pyplot. | def render(self):
if self.viz_count == 0:
return None
if self.score is None or self.true is None:
return None
raise NotImplementedError # TODO | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Plot_predict(X,Y,model,X_path): \n labels = {0: 'CNV', 1: 'DME', 2: 'DRUSEN', 3: 'NORMAL'}\n Y_pred_classes = np.argmax(model.predict(X),axis = 1) \n Y_true = np.argmax(Y,axis = 1)\n \n fig = plt.figure(figsize=(40, 40)) \n for i in range(X.shape[0]):\n ax = fig.add_subplot... | [
"0.65860564",
"0.64521635",
"0.6374251",
"0.634283",
"0.63131857",
"0.6272352",
"0.6176042",
"0.6167487",
"0.60962284",
"0.6066515",
"0.606407",
"0.6059084",
"0.6058075",
"0.60558665",
"0.6047777",
"0.6044423",
"0.6043372",
"0.6033484",
"0.60326254",
"0.6019439",
"0.6016603",... | 0.0 | -1 |
Returns the logged metadata of predicted samples. The returned object is a printfriendly CSV string that can be consumed directly by tensorboardX. Note that this string might be very long if the dataset is large (i.e. it will contain one line per sample). | def report_csv(self):
# type: () -> Optional[AnyStr]
if isinstance(self.report_count, int) and self.report_count <= 0:
return None
if self.score is None or self.true is None:
return None
pack = list(zip(*[(*pack, )
for packs in zip(self.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_output_metadata(self):\n\n # Create output info.\n output_meta = _metadata_fb.TensorMetadataT()\n output_meta.name = \"probability\"\n output_meta.description = \"Probabilities of labels respectively.\"\n output_meta.content = _metadata_fb.ContentT()\n output_meta.content.contentPrope... | [
"0.5834738",
"0.57164174",
"0.56615436",
"0.5616995",
"0.5557594",
"0.54530454",
"0.54390574",
"0.53697175",
"0.53598404",
"0.5332521",
"0.52831185",
"0.5278518",
"0.52385634",
"0.5189983",
"0.5189983",
"0.5182777",
"0.51758295",
"0.5167602",
"0.5143274",
"0.5104207",
"0.5103... | 0.5940078 | 0 |
Returns an image of predicted outputs as a numpycompatible RGBA image drawn by pyplot. | def render(self):
if self.viz_count == 0:
return None
if self.bbox is None or self.true is None:
return None
raise NotImplementedError # TODO | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Plot_predict(X,Y,model,X_path): \n labels = {0: 'CNV', 1: 'DME', 2: 'DRUSEN', 3: 'NORMAL'}\n Y_pred_classes = np.argmax(model.predict(X),axis = 1) \n Y_true = np.argmax(Y,axis = 1)\n \n fig = plt.figure(figsize=(40, 40)) \n for i in range(X.shape[0]):\n ax = fig.add_subplot... | [
"0.65860564",
"0.64521635",
"0.6374251",
"0.634283",
"0.63131857",
"0.6272352",
"0.6176042",
"0.6167487",
"0.60962284",
"0.6066515",
"0.606407",
"0.6059084",
"0.6058075",
"0.60558665",
"0.6047777",
"0.6044423",
"0.6043372",
"0.6033484",
"0.60326254",
"0.6019439",
"0.6016603",... | 0.0 | -1 |
List all students and all projects on our homepage. | def get_homepage():
list_of_students = hackbright.list_all_students()
list_of_projects = hackbright.list_all_projects()
return render_template("index.html",
list_of_students=list_of_students,
list_of_projects=list_of_projects) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_student():\n\n github = request.args.get('github', 'jhacks')\n first, last, github = hackbright.get_student_by_github(github)\n\n\n rows = hackbright.list_projects(github)\n\n return render_template (\"student_info.html\",\n first=first,\n l... | [
"0.7070546",
"0.6676508",
"0.6654367",
"0.6498606",
"0.64953345",
"0.6471412",
"0.64280254",
"0.64266616",
"0.6425675",
"0.6414757",
"0.638111",
"0.6350635",
"0.63491935",
"0.63327575",
"0.62987524",
"0.6278512",
"0.6262569",
"0.6247666",
"0.62269753",
"0.621596",
"0.619945",... | 0.7273482 | 0 |
This test creates an actor that requires 5 GPUs but a ray cluster only has 3 GPUs. As a result, the new actor should be an infeasible actor. | def test_raylet_infeasible_tasks(shutdown_only):
addresses = ray.init(num_gpus=3)
@ray.remote(num_gpus=5)
class ActorRequiringGPU:
def __init__(self):
pass
ActorRequiringGPU.remote()
def test_infeasible_actor(ray_addresses):
assert (wait_until_server_available(addresse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_remove_cluster_resources(cluster_start):\n cluster = cluster_start\n assert ray.global_state.cluster_resources()[\"CPU\"] == 1\n nodes = []\n nodes += [cluster.add_node(num_cpus=1)]\n cluster.wait_for_nodes()\n assert ray.global_state.cluster_resources()[\"CPU\"] == 2\n\n cluster.... | [
"0.6123032",
"0.6010467",
"0.59911865",
"0.5829238",
"0.58127546",
"0.57744557",
"0.5750235",
"0.5734631",
"0.5703786",
"0.5687027",
"0.5654953",
"0.5629746",
"0.5592201",
"0.5573509",
"0.5551739",
"0.54915756",
"0.5471529",
"0.5463542",
"0.54293156",
"0.5409817",
"0.53952813... | 0.6746544 | 0 |
r"""relative flux density Calculates relative flux density as a function of depth on sapwood for n_points. | def gebauer_rel(r, tree='beech', gp=gp, n_points=50):
# get the depths to evaluate
x=np.arange(n_points)/ n_points *gebauer(r)
p = gp.get(tree)
if p is None:
raise ValueError('Tree %s is unknown' % tree)
return gebauer_weibull(x, p['a'], p['b'], p['c'], p['d']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _density(self):\n fraction = np.array([0.]+[m.value for m in self.fraction])\n # TODO: handle invalid fractions using penalty functions\n # S = sum(fraction)\n # scale = S/100 if S > 100 else 1\n # fraction[0] = 100 - S/scale\n # penalty = scale - 1\n fraction[0... | [
"0.61976266",
"0.60144377",
"0.5963733",
"0.59374833",
"0.58586067",
"0.5858405",
"0.5777502",
"0.57623994",
"0.5751372",
"0.5731435",
"0.5715698",
"0.5643061",
"0.56421083",
"0.5626534",
"0.5584517",
"0.55115795",
"0.5504175",
"0.5500328",
"0.5500328",
"0.5500328",
"0.542161... | 0.0 | -1 |
Initializes default parameter values for the encoder. Returns None | def __init__(self) -> None:
super().__init__() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_default_encoder_parameters(self):\n cparams = openjp2.set_default_encoder_parameters()\n\n self.assertEqual(cparams.res_spec, 0)\n self.assertEqual(cparams.cblockw_init, 64)\n self.assertEqual(cparams.cblockh_init, 64)\n self.assertEqual(cparams.numresolution, 6)\n ... | [
"0.74038726",
"0.716173",
"0.7146137",
"0.69677836",
"0.69677836",
"0.68111104",
"0.672887",
"0.6612878",
"0.6507947",
"0.650761",
"0.6436175",
"0.642368",
"0.6423058",
"0.63990235",
"0.63988876",
"0.63922864",
"0.63705695",
"0.63350815",
"0.6304727",
"0.62737197",
"0.6259476... | 0.0 | -1 |
Returns the sparse adjacency matrix representation of the graph. | def adjacency(G, nodelist=None, weight="weight"):
if nodelist is None:
nodelist = G.nodes()
A = nx.to_scipy_sparse_matrix(G, nodelist=nodelist, weight=weight, format="csr")
return A | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSparseAdjacencyMatrix( graph, attribute=None, transposed=False ):\n if (attribute is not None) and (attribute not in graph.es.attribute_names()):\n raise ValueError( \"Attribute does not exists.\" )\n \n row = []\n col = []\n data = []\n \n if attribute is None:\n if transpose... | [
"0.79956216",
"0.7848298",
"0.74139094",
"0.7409523",
"0.7194541",
"0.70740765",
"0.6913846",
"0.6880426",
"0.6861912",
"0.6829117",
"0.6816736",
"0.6738131",
"0.6696774",
"0.6677157",
"0.6672356",
"0.6652502",
"0.6605602",
"0.6564061",
"0.6502941",
"0.64075285",
"0.64060456"... | 0.7287004 | 4 |
Checks if all nodes in the graph have the same degree. | def is_regular(G):
deg = None
for node in G:
d = G.degree(node)
if deg is None:
deg = d
if d != deg:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_connected(self, update=True):\n # update if needed\n if update:\n\n self.update_neighbors()\n\n # go through each node checking that each degree id greater than 0\n for node in self.nodes:\n\n # only one node needs to be disconnected to fail\n ... | [
"0.6633008",
"0.6627503",
"0.6577281",
"0.6560591",
"0.64308995",
"0.63779724",
"0.63305813",
"0.62754077",
"0.6251572",
"0.6209073",
"0.6185977",
"0.61850464",
"0.6094061",
"0.60878956",
"0.6077984",
"0.60523736",
"0.6025214",
"0.60081345",
"0.5999158",
"0.5977289",
"0.59647... | 0.6950751 | 0 |
The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete share operations. | def acquire_lease( # pylint: disable=inconsistent-return-statements
self,
timeout: Optional[int] = None,
duration: Optional[int] = None,
proposed_lease_id: Optional[str] = None,
sharesnapshot: Optional[str] = None,
request_id_parameter: Optional[str] = None,
**kw... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_share_from_snapshot(\r\n self,\r\n context,\r\n share,\r\n snapshot,\r\n share_server=None):\r\n LOG.debug(\"Create share from snapshot.\")\r\n raise NotImplementedError()",
"def create_share_from_snapshot(self, context, share, snaps... | [
"0.61871386",
"0.601539",
"0.5783583",
"0.5256084",
"0.5247354",
"0.52081096",
"0.52055883",
"0.51762706",
"0.5101091",
"0.5080062",
"0.49975252",
"0.49808952",
"0.49700215",
"0.49604815",
"0.49498492",
"0.4943164",
"0.48975173",
"0.48954412",
"0.48908406",
"0.4804097",
"0.47... | 0.44880354 | 50 |
The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete share operations. | def release_lease( # pylint: disable=inconsistent-return-statements
self,
lease_id: str,
timeout: Optional[int] = None,
sharesnapshot: Optional[str] = None,
request_id_parameter: Optional[str] = None,
**kwargs: Any
) -> None:
error_map = {
401: Cl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_share_from_snapshot(\r\n self,\r\n context,\r\n share,\r\n snapshot,\r\n share_server=None):\r\n LOG.debug(\"Create share from snapshot.\")\r\n raise NotImplementedError()",
"def create_share_from_snapshot(self, context, share, snaps... | [
"0.61871386",
"0.601539",
"0.5783583",
"0.5256084",
"0.5247354",
"0.52081096",
"0.52055883",
"0.51762706",
"0.5101091",
"0.5080062",
"0.49975252",
"0.49808952",
"0.49700215",
"0.49604815",
"0.49498492",
"0.4943164",
"0.48975173",
"0.48954412",
"0.48908406",
"0.4804097",
"0.47... | 0.45475793 | 42 |
The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete share operations. | def change_lease( # pylint: disable=inconsistent-return-statements
self,
lease_id: str,
timeout: Optional[int] = None,
proposed_lease_id: Optional[str] = None,
sharesnapshot: Optional[str] = None,
request_id_parameter: Optional[str] = None,
**kwargs: Any
) ->... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_share_from_snapshot(\r\n self,\r\n context,\r\n share,\r\n snapshot,\r\n share_server=None):\r\n LOG.debug(\"Create share from snapshot.\")\r\n raise NotImplementedError()",
"def create_share_from_snapshot(self, context, share, snaps... | [
"0.6188829",
"0.6017008",
"0.5784338",
"0.52578425",
"0.52470434",
"0.5208607",
"0.5207883",
"0.517937",
"0.5104025",
"0.5082991",
"0.49967194",
"0.49803632",
"0.49691322",
"0.49641374",
"0.49516338",
"0.49446803",
"0.48976418",
"0.48939413",
"0.48901019",
"0.4807963",
"0.480... | 0.0 | -1 |
The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete share operations. | def renew_lease( # pylint: disable=inconsistent-return-statements
self,
lease_id: str,
timeout: Optional[int] = None,
sharesnapshot: Optional[str] = None,
request_id_parameter: Optional[str] = None,
**kwargs: Any
) -> None:
error_map = {
401: Clie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_share_from_snapshot(\r\n self,\r\n context,\r\n share,\r\n snapshot,\r\n share_server=None):\r\n LOG.debug(\"Create share from snapshot.\")\r\n raise NotImplementedError()",
"def create_share_from_snapshot(self, context, share, snaps... | [
"0.61883557",
"0.6016588",
"0.5783814",
"0.52566516",
"0.5247093",
"0.52077585",
"0.52076805",
"0.51795596",
"0.5103441",
"0.508325",
"0.49966487",
"0.4980593",
"0.49689177",
"0.4963612",
"0.49508286",
"0.49444678",
"0.48976633",
"0.489371",
"0.48896393",
"0.48065212",
"0.480... | 0.0 | -1 |
The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete share operations. | def break_lease( # pylint: disable=inconsistent-return-statements
self,
timeout: Optional[int] = None,
break_period: Optional[int] = None,
request_id_parameter: Optional[str] = None,
sharesnapshot: Optional[str] = None,
lease_access_conditions: Optional[_models.LeaseAcce... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_share_from_snapshot(\r\n self,\r\n context,\r\n share,\r\n snapshot,\r\n share_server=None):\r\n LOG.debug(\"Create share from snapshot.\")\r\n raise NotImplementedError()",
"def create_share_from_snapshot(self, context, share, snaps... | [
"0.61871386",
"0.601539",
"0.5783583",
"0.5256084",
"0.5247354",
"0.52081096",
"0.52055883",
"0.51762706",
"0.5101091",
"0.5080062",
"0.49975252",
"0.49808952",
"0.49700215",
"0.49604815",
"0.49498492",
"0.4943164",
"0.48975173",
"0.48954412",
"0.48908406",
"0.4804097",
"0.47... | 0.4453056 | 53 |
Creates a readonly snapshot of a share. | def create_snapshot( # pylint: disable=inconsistent-return-statements
self, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_share_from_snapshot(self, context, share, snapshot,\n share_server=None):\n raise NotImplementedError()",
"def create_share_from_snapshot(\r\n self,\r\n context,\r\n share,\r\n snapshot,\r\n share_server=No... | [
"0.7511619",
"0.74526864",
"0.6764158",
"0.63814574",
"0.6179431",
"0.5980372",
"0.5909719",
"0.589196",
"0.5889177",
"0.5826791",
"0.5821345",
"0.581773",
"0.58102983",
"0.575128",
"0.57098496",
"0.56648123",
"0.5658212",
"0.56572217",
"0.5644493",
"0.5643801",
"0.56250477",... | 0.5741952 | 14 |
Returns information about stored access policies specified on the share. | def get_access_policy(
self,
timeout: Optional[int] = None,
lease_access_conditions: Optional[_models.LeaseAccessConditions] = None,
**kwargs: Any
) -> List[_models.SignedIdentifier]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storage_policies(self, **kwargs):\n self.logger.debug(f\"Get storage policies data\")\n url_path = 'storage/policies'\n body = self._make_body(kwargs)\n return self._common_get(request_path=url_path, parameters=body)",
"def policies(self):\n return self._data.get('policies'... | [
"0.64975715",
"0.6202287",
"0.6088962",
"0.6055945",
"0.60333073",
"0.5976257",
"0.5954372",
"0.5872517",
"0.5860681",
"0.5825867",
"0.58208674",
"0.5734115",
"0.5711419",
"0.5660803",
"0.55697274",
"0.554634",
"0.5483833",
"0.5467413",
"0.5454885",
"0.5441872",
"0.5420365",
... | 0.5007907 | 53 |
Restores a previously deleted Share. | def restore( # pylint: disable=inconsistent-return-statements
self,
timeout: Optional[int] = None,
request_id_parameter: Optional[str] = None,
deleted_share_name: Optional[str] = None,
deleted_share_version: Optional[str] = None,
**kwargs: Any
) -> None:
erro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(self):\n\t\tcall_sdk_function('PrlShare_Remove', self.handle)",
"def unShare(sharedItem):\n sharedItem.store.query(Share, Share.sharedItem == sharedItem).deleteFromStore()",
"def restore(self, restore):\n self._restore = restore",
"def restore(self, memento):\n self.state = mement... | [
"0.61344075",
"0.6020417",
"0.58753854",
"0.5853539",
"0.56975937",
"0.5587175",
"0.55751413",
"0.5552683",
"0.55445635",
"0.54615134",
"0.5445456",
"0.5425551",
"0.5415905",
"0.53820825",
"0.5358996",
"0.5357442",
"0.5345663",
"0.5336864",
"0.5321774",
"0.5313117",
"0.529579... | 0.5626421 | 5 |
Fills embedding tensor with values from the uniform distribution. | def init_embedding(embeddings):
bias = np.sqrt(3.0 / embeddings.size(1))
torch.nn.init.uniform_(embeddings, -bias, bias) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_embedding(self):\n self.embedding.weight.data.uniform_(-1./self.num_embeddings, 1./self.num_embeddings)",
"def init_embedding(input_embedding):\n bias = np.sqrt(3.0 / input_embedding.size(1))\n nn.init.uniform_(input_embedding, -bias, bias)",
"def init_emb(self):\r\n initrange = 0.... | [
"0.7096552",
"0.6618988",
"0.63789725",
"0.6335723",
"0.62645626",
"0.6242119",
"0.6096892",
"0.60557204",
"0.60557204",
"0.60557204",
"0.6035151",
"0.60266924",
"0.6005069",
"0.5844181",
"0.58416224",
"0.5799808",
"0.5763765",
"0.5692445",
"0.5691216",
"0.5682685",
"0.567943... | 0.67710733 | 1 |
Creates an embedding tensor for the specified word map, for loading into the model. | def load_embeddings(emb_file, word_map):
# Find embedding dimension
with open(emb_file, 'r') as f:
emb_dim = len(f.readline().split(' ')) - 1
vocab = set(word_map.keys())
# Create tensor to hold embeddings, initialize
embeddings = torch.FloatTensor(len(vocab), emb_dim)
init_embedding(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretrained_embedding_layer(word_to_vec_map, word_to_index):\n \n vocab_size = len(word_to_index) + 1 # adding 1 to fit Keras embedding (requirement)\n any_word = list(word_to_vec_map.keys())[0]\n emb_dim = word_to_vec_map[any_word].shape[0] # define dimensionality of your GloVe word... | [
"0.69939345",
"0.68353546",
"0.6767176",
"0.6666082",
"0.6590213",
"0.640131",
"0.6270218",
"0.62354624",
"0.6221567",
"0.6180574",
"0.61599755",
"0.61579525",
"0.6156663",
"0.61205846",
"0.6086447",
"0.60282797",
"0.60191345",
"0.59850013",
"0.5969723",
"0.5914893",
"0.58975... | 0.7082288 | 0 |
Shrinks learning rate by a specified factor. | def adjust_learning_rate(optimizer, shrink_factor):
print("\nDECAYING learning rate.")
for param_group in optimizer.param_groups:
param_group['lr'] = param_group['lr'] * shrink_factor
print("The new learning rate is %f\n" % (optimizer.param_groups[0]['lr'],)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _shrink_main(self, amt):\n self.ratio -= amt\n self.ratio = max(self.min_ratio, self.ratio)",
"def increase_learning(self, factor):\n pass",
"def adjust_learning_rate(optimizer, lr_factor, epoch):\n #lr = args.lr * (0.1 ** (epoch // 30))\n print('the learning rate is set to {0:.5... | [
"0.62168515",
"0.619375",
"0.61274046",
"0.60938746",
"0.60843754",
"0.60421985",
"0.6032488",
"0.6028106",
"0.5960556",
"0.58500165",
"0.58346266",
"0.583353",
"0.58097494",
"0.5782686",
"0.5771088",
"0.5768098",
"0.57433003",
"0.57389146",
"0.5735855",
"0.5721132",
"0.57170... | 0.7324321 | 0 |
Computes topk accuracy, from predicted and true labels. | def accuracy(scores, targets, k):
batch_size = targets.size(0)
_, ind = scores.topk(k, 1, True, True)
correct = ind.eq(targets.view(-1, 1).expand_as(ind))
correct_total = correct.view(-1).float().sum() # 0D tensor
return correct_total.item() * (100.0 / batch_size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accuracy(output, target, topk=(1,)):\n maxk = max(topk)\n batch_size = target.size(0)\n\n _, pred = output.topk(maxk, 1, True, True)\n pred = pred.t()\n correct = pred.eq(target.view(1, -1).expand_as(pred))\n\n res = []\n for k in topk:\n correct_k = correct[:k].view(-1).float().sum... | [
"0.82267404",
"0.8210251",
"0.8148208",
"0.81262386",
"0.81234264",
"0.809997",
"0.8098824",
"0.8095708",
"0.8095708",
"0.8095708",
"0.8095708",
"0.8095708",
"0.8095708",
"0.8095708",
"0.8095708",
"0.8095708",
"0.8095708",
"0.8095708",
"0.8095708",
"0.80920607",
"0.80920607",... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.