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 |
|---|---|---|---|---|---|---|
This function creates a spark session, return spark context object. This object would be perform all the operations in spark. | def create_spark_session():
spark = SparkSession. builder.\
config("spark.jars.packages", "org.apache.hadoop:hadoop-aws:2.7.0"). \
config("spark.sql.session.timeZone", "America/Los_Angeles").\
getOrCreate()
return spark | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_sparksession():\n return SparkSession.builder.\\\n appName(\"Transforming the historical parking occupancy and blockface datasets\").\\\n getOrCreate()",
"def create_spark_session():\n return SparkSession.builder \\\n .appName(\"Dataframe Reader\") \\... | [
"0.8021168",
"0.7943382",
"0.7837832",
"0.7748409",
"0.7718771",
"0.7708254",
"0.7708254",
"0.7708254",
"0.7708254",
"0.7708254",
"0.7708254",
"0.7708254",
"0.7708254",
"0.7708254",
"0.7706815",
"0.76930207",
"0.7688611",
"0.7688611",
"0.7688611",
"0.7688611",
"0.7684378",
... | 0.77955467 | 3 |
A helper method that creates a mock configuration object. | def _CreateCfgFile():
default_cfg = """
project: "fake_project"
zone: "fake_zone"
storage_bucket_name: "fake_bucket"
client_id: "fake_client_id"
client_secret: "fake_client_secret"
"""
return default_cfg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_config(temp_dir):\n get_config_mock = Mock()\n config = base_config()\n config['skills']['priority_skills'] = ['foobar']\n config['data_dir'] = str(temp_dir)\n config['server']['metrics'] = False\n config['enclosure'] = {}\n\n get_config_mock.return_value = config\n return get_conf... | [
"0.83300275",
"0.79019153",
"0.7663585",
"0.73585534",
"0.7228637",
"0.7177661",
"0.7060326",
"0.6977861",
"0.6875879",
"0.67590564",
"0.6731166",
"0.67184633",
"0.67069995",
"0.66998863",
"0.6687071",
"0.66632867",
"0.6652876",
"0.6588377",
"0.65834653",
"0.65613943",
"0.651... | 0.5926887 | 70 |
fully split a path | def split_path(path):
parts = []
path, end = os.path.split(path)
while end:
parts.append(end)
path, end = os.path.split(path)
if path:
parts.append(path)
parts.reverse()
return parts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def splitPath(self, path):\n return os.path.split(path)",
"def pathSplit(path):\n path = re.split('/|\\\\\\\\', path)\n return path",
"def splitpath(path):\n\n # FIXME perhaps call op.split repetitively would be better.\n #s = string.split( path, '/' ) # we work with fwd slash only inside.\n... | [
"0.85145605",
"0.8443035",
"0.8307688",
"0.81965554",
"0.8132231",
"0.791151",
"0.7856488",
"0.7833808",
"0.78279066",
"0.7721323",
"0.76692003",
"0.7644375",
"0.7619345",
"0.7612388",
"0.7584699",
"0.75667703",
"0.75554156",
"0.742971",
"0.7403719",
"0.7392738",
"0.73839384"... | 0.77260405 | 9 |
Get all files from an os.walk | def get_all_files_walk(folder):
files = []
for root, dirs, filenames in os.walk(folder):
files.extend(os.path.join(root, f) for f in filenames)
return files | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_files(self):\n\t\tfiles_list = []\n\t\tfor path, subdirs, files in os.walk(self.root):\n\t\t for name in files:\n\t\t \tfiles_list.append(os.path.join(self.root, name))\n\t\treturn files_list[0:-1]",
"def _get_all_files(dir_path):\n for root, _, filenames in os.walk(dir_path):\n for n... | [
"0.7757519",
"0.74959517",
"0.7400449",
"0.73527074",
"0.7340954",
"0.7326075",
"0.72684574",
"0.7251959",
"0.7223948",
"0.7194878",
"0.71899074",
"0.7164098",
"0.7162436",
"0.71581405",
"0.71524096",
"0.7151809",
"0.7083325",
"0.70642424",
"0.70615923",
"0.7060801",
"0.70445... | 0.80884844 | 0 |
PyTest fixture mocking AuthConfigurationClient's store_auth method | def config_client_store_auth_fixture(mocker):
mock_config_client_store_auth = mocker.patch.object(
AuthConfigurationClient, "store_auth")
return mock_config_client_store_auth | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_client_fixture(mocker):\n mock_config_client = mocker.patch.object(AuthConfigurationClient, \"__init__\")\n mock_config_client.return_value = None\n return mock_config_client",
"def config_client_read_auth_fixture(mocker):\n mock_config_client_read_auth = mocker.patch.objec... | [
"0.7310336",
"0.7184177",
"0.71282893",
"0.70946616",
"0.68613935",
"0.6778075",
"0.6717134",
"0.6629978",
"0.6563945",
"0.65219104",
"0.64986926",
"0.64868724",
"0.64765",
"0.6465363",
"0.6423758",
"0.6404253",
"0.6397233",
"0.63839257",
"0.63521296",
"0.6301509",
"0.6263771... | 0.8303084 | 0 |
PyTest fixture mocking AuthConfigurationClient's read_auth method | def config_client_read_auth_fixture(mocker):
mock_config_client_read_auth = mocker.patch.object(
AuthConfigurationClient, "read_auth")
mock_config_client_read_auth.return_value = MOCK_CONFIG_CLIENT_READ_AUTH_RETURN_VALUE
return mock_config_client_read_auth | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_read_o_auth_client(self):\n pass",
"def config_client_fixture(mocker):\n mock_config_client = mocker.patch.object(AuthConfigurationClient, \"__init__\")\n mock_config_client.return_value = None\n return mock_config_client",
"def config_client_store_auth_fixture(mocker):\n ... | [
"0.75143063",
"0.7133742",
"0.70398563",
"0.7005522",
"0.6944447",
"0.6896602",
"0.68484026",
"0.68209654",
"0.68131113",
"0.6537355",
"0.64645994",
"0.6459147",
"0.6428474",
"0.63774",
"0.6366588",
"0.6341574",
"0.62811583",
"0.6279178",
"0.62392133",
"0.6233753",
"0.6207716... | 0.8448462 | 0 |
List subscriptions (with account ID filter) Given The Account Client returns a successful response When User executes the 'show_user' commaned Then The command returns a successful response The subscription client is passed the account id filter | def test_cmd_cs_subscription_list_with_filter(self, mocker):
mock_response = {
'foo': 'bar'
}
mock_subscription_client_list = mocker.patch.object(
SubscriptionClient,
"list",
return_value=mock_response
)
result = self.runner.invok... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_subscriptions_command(client: KeyVaultClient) -> CommandResults:\n response = client.list_subscriptions_request()\n\n readable_output = tableToMarkdown('Subscriptions List',\n response,\n ['subscriptionId', 'tenantId',\n ... | [
"0.7600631",
"0.6939009",
"0.6638764",
"0.6634741",
"0.6586916",
"0.6537482",
"0.6496745",
"0.6496721",
"0.646792",
"0.64417166",
"0.63978404",
"0.63942504",
"0.63908255",
"0.6378392",
"0.6298848",
"0.6272877",
"0.627263",
"0.62577367",
"0.62451327",
"0.62226814",
"0.6154752"... | 0.68078667 | 2 |
Set the north (xi) and east (eta) deflection of the vertical (in degrees) | def setXiEta(self, xieta):
self._xieta = [0.0, 0.0] if xieta is None else xieta
if self._xyz is not None:
self.setXYZ(self._xyz) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_east(self):\n self.horizontal = (self.horizontal * 2)[3:7]\n self.vertical[0] = self.horizontal[1]\n self.vertical[2] = self.horizontal[3]",
"def move_north(self):\n self.vertical = (self.vertical * 2)[1:5]\n self.horizontal[1] = self.vertical[0]\n self.horizont... | [
"0.6215656",
"0.60356414",
"0.5972984",
"0.5883604",
"0.5869915",
"0.57361203",
"0.5731377",
"0.5677374",
"0.55153596",
"0.5459994",
"0.5449871",
"0.5441533",
"0.5399441",
"0.5390598",
"0.53740585",
"0.53667575",
"0.5363681",
"0.5362914",
"0.53421354",
"0.5338363",
"0.5332458... | 0.0 | -1 |
Calculate height difference between trgtstn point and this and optionally its differentials wrt X,Y,Z coordinates of base point and target point. | def heightDifferenceTo(
self,
trgtstn=None,
instofst=None,
trgtofst=None,
refcoef=None,
ddxyz=False,
offsettype=None,
):
# Note: some lack of rigour here in whether we are considering offsets in terms
# of geometric or gravitational vertical. S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dy(self, T):\n return self._h(np.diff(T)) * self._a / self._m / self._c * np.diff(T) * np.array([1, -1])",
"def compute_deltas(self, target):\n self.deltas[-1] = self.zetas[-1] - target\n for i in reversed(range(self.n_layers-1)):\n self.deltas[i] = np.multiply(np.dot(self.de... | [
"0.6089625",
"0.57509667",
"0.56950426",
"0.5651719",
"0.5646768",
"0.5619889",
"0.557872",
"0.5504935",
"0.55014163",
"0.5487891",
"0.54377615",
"0.53903145",
"0.5390271",
"0.5376583",
"0.53755546",
"0.53755546",
"0.53675157",
"0.5347038",
"0.52808726",
"0.52390474",
"0.5228... | 0.70714825 | 0 |
Set displayed character (or string) for empty progress part of the bar. | def set_empty_character(self, char):
self.empty_char = char | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_progress_character(self, char):\n self.progress_char = char",
"def _clear(self):\n self._calculate_bar_width()\n # sys.stdout.write(\"\\033[K\")\n # to fix bug when logging to console\n print(\" \" * self._tw, end='\\r')\n # sys.stdout.write(\"\\033[K\")",
"def... | [
"0.7186504",
"0.7039228",
"0.6920368",
"0.67724967",
"0.66369915",
"0.63869584",
"0.6246566",
"0.6199103",
"0.6177723",
"0.61463594",
"0.61375356",
"0.6133351",
"0.61318344",
"0.6058751",
"0.6018981",
"0.6003371",
"0.59883434",
"0.59799993",
"0.5941426",
"0.593891",
"0.593243... | 0.6442505 | 5 |
Serializes this instance to a Python dictionary. | def to_dict(self):
output = copy.deepcopy(self.__dict__)
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n return dumpd(self)",
"def to_dict(self):\n serialized = self._serializer().dump(self)\n return serialized.data",
"def to_dict(self):\n return to_dict(self.__dict__)",
"def to_dict(self):\r\n return self.__dict__",
"def to_dict(self):\n return s... | [
"0.8420823",
"0.8404479",
"0.8361814",
"0.83085257",
"0.8282424",
"0.8282424",
"0.8282424",
"0.8282424",
"0.8282424",
"0.8282424",
"0.8235543",
"0.8217555",
"0.8213202",
"0.82027507",
"0.8181267",
"0.81790775",
"0.81728435",
"0.81534296",
"0.8117203",
"0.80905306",
"0.8072701... | 0.0 | -1 |
Serializes this instance to a JSON string. | def to_json_string(self):
return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self) -> str:\n return json.dumps(self.__dict__)",
"def serialize(self):\n return json.dumps(self.as_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> st... | [
"0.88999254",
"0.8837045",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.87147456",
"0.8637419",
"0.8619328",
"0.8598524",
"0.8572258",
"0.8568808",
"0.8568808",
"0.8446259",
"0.8446259",
"0.8446259",
... | 0.0 | -1 |
Serializes this instance to a Python dictionary. | def to_dict(self):
output = copy.deepcopy(self.__dict__)
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n return dumpd(self)",
"def to_dict(self):\n serialized = self._serializer().dump(self)\n return serialized.data",
"def to_dict(self):\n return to_dict(self.__dict__)",
"def to_dict(self):\r\n return self.__dict__",
"def to_dict(self):\n return s... | [
"0.8420897",
"0.8404607",
"0.8361561",
"0.83086824",
"0.8282538",
"0.8282538",
"0.8282538",
"0.8282538",
"0.8282538",
"0.8282538",
"0.82356167",
"0.8217511",
"0.8212117",
"0.82026136",
"0.81813276",
"0.8179324",
"0.81729376",
"0.81534904",
"0.81175905",
"0.8089913",
"0.807217... | 0.0 | -1 |
Serializes this instance to a JSON string. | def to_json_string(self):
return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self) -> str:\n return json.dumps(self.__dict__)",
"def serialize(self):\n return json.dumps(self.as_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> st... | [
"0.88999254",
"0.8837045",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.87147456",
"0.8637419",
"0.8619328",
"0.8598524",
"0.8572258",
"0.8568808",
"0.8568808",
"0.8446259",
"0.8446259",
"0.8446259",
... | 0.0 | -1 |
multiplies weights by best position vectors (local, global) to get new direction also somehow calculates and sets new velocity magnitude RETUNS(void) | def updateVelocity(self, glob, latency):
# Velocity equation parameters that control efficacy and behavior of the PSO, selected arbitrarily by us
omega= .40 # coefficient for influence of currect velocity
psi_loc= 0.30 # coefficient for influence of local best
psi_glob= 0.30 # co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_useful_stuff(self):\n\n self.pos = self.pair[1].position - self.pair[0].position\n self.vel = self.pair[1].velocity - self.pair[0].velocity\n\n self.r = self.pos.length()\n self.v = self.vel.length()\n self.inv_r = 1.0 / self.r\n\n self.rvec = self.pos * self... | [
"0.67127395",
"0.66834754",
"0.65985256",
"0.6483789",
"0.6338442",
"0.6327866",
"0.6289658",
"0.62894166",
"0.6264754",
"0.61280584",
"0.61272955",
"0.60779405",
"0.60706735",
"0.6047755",
"0.6006723",
"0.6002695",
"0.59625036",
"0.5949647",
"0.5937763",
"0.59367377",
"0.591... | 0.69510984 | 0 |
checks if new position is feasible, getRandomWeights, updateVelocity and updatePosition if not feasible RETURNS(void) | def isFeasible(self):
if self.function.constraints(self.position[0],self.position[1]) == False:
self.position = np.array([random.uniform(-50,50), random.uniform(-50,50)])
self.velocity = np.array([random.uniform(-1,1), random.uniform(-1,1)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self):\n global _get_fitness\n assert self._swarm_best is not None\n r1, r2 = random(), random()\n new_velocity = \\\n self._w * self._velocity + \\\n self._c1 * r1 * (self._personal_best - self._position) + \\\n self._c2 * r2 * (self._swarm_b... | [
"0.6869343",
"0.61285526",
"0.6027862",
"0.60259265",
"0.59939045",
"0.5887435",
"0.5846226",
"0.5841519",
"0.5824093",
"0.5815559",
"0.57615846",
"0.5759277",
"0.57358223",
"0.5719358",
"0.571358",
"0.5686925",
"0.56809187",
"0.5671033",
"0.5624541",
"0.56220275",
"0.5583638... | 0.7340947 | 0 |
Update x and ylim extremes with current xlim and ylim values. | def update_xylims_extremes(xlims_extremes, ylims_extremes):
xlims, ylims = plt.xlim(), plt.ylim()
xlims_extremes = [
min(xlims[0], xlims_extremes[0]),
max(xlims[1], xlims_extremes[1])
]
ylims_extremes = [
min(ylims[0], ylims_extremes[0]),
max(ylims[1], ylims_extremes[1])
]
return xli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_axes(self):\n mini, maxi = self._get_extremes()\n self.y_axis.min = mini\n self.y_axis.max = maxi\n self.y_axis._max_min()\n\n if not None in [s.xvalues for s in self]:\n mini, maxi = self._get_extremes('xvalues')\n self.x_axis.min = mini\n ... | [
"0.7144225",
"0.69320184",
"0.6818554",
"0.6685721",
"0.65998405",
"0.6582446",
"0.64301735",
"0.62382925",
"0.6190698",
"0.61901164",
"0.6169072",
"0.61437035",
"0.6124548",
"0.6111638",
"0.6031989",
"0.60291296",
"0.6027146",
"0.6016598",
"0.59881705",
"0.5959873",
"0.59079... | 0.82579446 | 0 |
Generates a random character in [AZaz09]. | def random_alpha_num_char():
num = random.randint(0, 26 + 26 + 10)
if num < 26:
return chr(num + 65)
num -= 26
if num < 26:
return chr(num + 97)
return chr(num + 48) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_charachter() -> chr:\r\n return chr(int(random.randrange(32, 126, 1)))",
"def random_char(alph):\n char = alph[rand_generator.randrange(len(alph))]\n return char",
"def random_char():\n return chr(random.randrange(32, 126, 1))",
"def RandomAlphaNumChar():\n num = random.randint(0, 26 ... | [
"0.7927985",
"0.79179096",
"0.78053504",
"0.77989227",
"0.7693868",
"0.7666537",
"0.7624199",
"0.7483066",
"0.7399742",
"0.73987985",
"0.73835564",
"0.73753226",
"0.7268345",
"0.72070974",
"0.7206695",
"0.718114",
"0.713891",
"0.7099082",
"0.7097231",
"0.7079096",
"0.7075379"... | 0.75228137 | 7 |
Generates a random word with the specified length. Uses characters from the set [AZaz09]. | def random_alpha_num_word(length):
return ''.join([random_alpha_num_char() for _ in range(0, length)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def RandomAlphaNumWord(length):\n return ''.join([RandomAlphaNumChar() for _ in range(0, length)])",
"def random_word ():\n letters = [ chr(i) for i in range(ord('a'),ord('z')+1) ] + [ chr(i) for i in range(ord('A'),ord('Z')+1) ]\n length = 4 + random.randint(0,4)\n str = \"\"\n for i in range(lengt... | [
"0.84952474",
"0.82300705",
"0.7641217",
"0.7621799",
"0.75693935",
"0.75121194",
"0.75042564",
"0.7495294",
"0.7491513",
"0.74791205",
"0.7471113",
"0.7459112",
"0.74588704",
"0.7454624",
"0.7444072",
"0.744096",
"0.74356383",
"0.743445",
"0.74263954",
"0.7411768",
"0.739474... | 0.83133733 | 1 |
Adds a left margin to a given text block. | def add_margin(text, margin):
lines = text.split('\n')
lines = map(lambda line: margin + line, lines)
return '\n'.join(lines) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leftMargin(self, leftMargin=10):\n if not(0 <= leftMargin <= 65535) or type(leftMargin) is not int:\n raise ValueError('leftMargin must be a int between 0 and 65535')\n else:\n nH = leftMargin >> 8\n nL = leftMargin - (nH << 8)\n self._write(self.__clas... | [
"0.676402",
"0.58867985",
"0.58325106",
"0.57632035",
"0.564995",
"0.55590236",
"0.55512166",
"0.55457246",
"0.5529933",
"0.5529933",
"0.5499101",
"0.5439962",
"0.53545773",
"0.5349345",
"0.53170526",
"0.5305471",
"0.52631193",
"0.5254272",
"0.5235352",
"0.51805156",
"0.51784... | 0.6399678 | 1 |
Camelcases a given character sequence. E.g. 'this_string' becomes 'ThisString'. | def camel_case(text, separator='_'):
return ''.join(map(str.capitalize, text.split(separator))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def camel(s):\n return s[0].upper() + s[1:]",
"def snake_to_camel(word):\n return ''.join(x.capitalize() or '_' for x in word.split('_'))",
"def snake_to_camel(word):\n return ''.join(x.capitalize() or '_' for x in word.split('_'))",
"def snake_to_camel(string):\n return \"\".join(word.title() fo... | [
"0.8092585",
"0.7674005",
"0.7674005",
"0.74586356",
"0.744835",
"0.74220484",
"0.7410334",
"0.7398983",
"0.7305898",
"0.7292607",
"0.72743505",
"0.72171223",
"0.72071016",
"0.7181978",
"0.7181339",
"0.7149593",
"0.7133927",
"0.7120746",
"0.7099033",
"0.7096239",
"0.7086894",... | 0.7093054 | 20 |
Retrieves the content of a resource file. | def get_resource(package_name, resource):
# Path of the package, relative to the loader root:
# For package 'foo.bar', this is 'foo/bar'.
package_path = package_name.replace(".", "/")
# Path of the resource, relative to the loader root:
# For package 'foo.bar' and resource 'subdir/data.csv', this i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_file(self, path):\n return open(os.path.join(self.resource_path, path)).read()",
"def getResource(self, file_name):\n path = os.path.join(os.path.dirname(__file__), \"resource\", file_name)\n return open(path)",
"def read_file(rel_path, *args, **kwargs):\n path = os.path.join(os.path.d... | [
"0.74730295",
"0.74068445",
"0.7114789",
"0.70584434",
"0.69991714",
"0.6987704",
"0.69795215",
"0.6973494",
"0.6907918",
"0.68844575",
"0.68690777",
"0.6831381",
"0.68180287",
"0.6813109",
"0.68019295",
"0.67889786",
"0.6775626",
"0.6774269",
"0.6763575",
"0.6759445",
"0.674... | 0.0 | -1 |
Formats a log statement timestamp. It includes the time zone. This is used for the prefix on lines in logging. | def _format_time(record, datefmt=None):
time_tuple = time.localtime(record.created)
tz_name = time.tzname[time_tuple.tm_isdst]
return '%(date_time)s-%(millis)03d-%(tz_name)s' % dict(
date_time=time.strftime('%Y%m%d-%H%M%S', time_tuple),
millis=record.msecs,
tz_name=tz_name,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatTimestamp(self, timestamp):\n return time.strftime('%Y%m%d-%H%M%S-%Z', time.localtime(timestamp))",
"def _format_ts(cls, timestamp):\n return localtime(timestamp).strftime('%Y-%m-%d %H:%M:%S')",
"def format_datetime(timestamp):\n return f\"<!date^{int(timestamp)}^{{date_pretty}} at {... | [
"0.77781034",
"0.77444065",
"0.7076052",
"0.6984701",
"0.6950889",
"0.68832934",
"0.68676627",
"0.6862459",
"0.68368",
"0.68368",
"0.68368",
"0.6799731",
"0.65720934",
"0.6560033",
"0.65205204",
"0.6433337",
"0.64275664",
"0.64054847",
"0.6395806",
"0.6392148",
"0.6378766",
... | 0.6622533 | 12 |
Gets the most recent transactions for an account, or those within a period specified. | def transactions(self, billing_period=0,
transaction_type='recent'):
result = defaultdict(list)
billing_periods = pyamex.utils.to_list(billing_period)
for period in billing_periods:
options = { 'PayLoadText' : self.client.transactions_request_xml(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_latest_transactions(self):\n first_run = False\n if not self._transactions:\n first_run = True\n transactions = []\n for account in self.accounts:\n self._logger.debug('Getting transactions for account \"%s\"', account.ynab_account.name)\n for tr... | [
"0.63335335",
"0.63090706",
"0.6064165",
"0.59611374",
"0.5853222",
"0.5820472",
"0.58100945",
"0.5747064",
"0.5705081",
"0.5662855",
"0.56550056",
"0.5647355",
"0.56108904",
"0.5572522",
"0.55590206",
"0.55572724",
"0.5555578",
"0.55409485",
"0.55358976",
"0.5509147",
"0.550... | 0.5858498 | 4 |
Deals with all page requests different than the homepage. | def page(**kwargs):
requestdata = {
'path': request.path,
'query': request.query_string,
'referrer': request.headers.get("Referer")
}
visitor = {
'city': request.headers.get('X-AppEngine-City'),
'region': request.headers.get('X-AppEngine-Region'),
'country': r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_page():\n if not _home:\n abort(404)\n return redirect(_home)",
"def start_page():\n if not _home:\n abort(404)\n return redirect(_home)",
"def view_home(self):\n with self.client.get(\"/home\", catch_response=True) as response:\n for r_hist in resp... | [
"0.65784836",
"0.65784836",
"0.65316767",
"0.6529072",
"0.65217674",
"0.6482626",
"0.6481567",
"0.64376765",
"0.6375688",
"0.63752186",
"0.63685983",
"0.6366985",
"0.6339134",
"0.63233286",
"0.62750906",
"0.62710875",
"0.62693673",
"0.62558246",
"0.62553",
"0.6232329",
"0.617... | 0.0 | -1 |
Function to create the estimator. Can be overridden by extended classes | def __create_estimator(self, hidden_units, feature_columns, nlabels, model_dir, **kwargs):
return tf.estimator.DNNClassifier(hidden_units, feature_columns,
n_classes=nlabels, model_dir=model_dir, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_estimator(self, append=True, random_state=None):\n estimator = clone(self.base_estimator_)\n estimator.set_params(**dict((p, getattr(self, p))\n for p in self.estimator_params))\n # print estimator.get_params()\n\n if random_state is not None... | [
"0.7616235",
"0.7536179",
"0.7399023",
"0.7212526",
"0.71146923",
"0.6947094",
"0.6878534",
"0.6840343",
"0.6804465",
"0.6740863",
"0.6715139",
"0.66211677",
"0.65934306",
"0.6518936",
"0.65176916",
"0.6430524",
"0.6397301",
"0.6350301",
"0.63394296",
"0.63310885",
"0.6294852... | 0.6656082 | 11 |
Load YAML from a file object or path with useful parser errors | def _yaml_load(src):
if not isinstance(src, str):
try:
src_name = src.name
except AttributeError:
src_name = '<yaml stringio>'
# Force-load file streams as that allows the parser to print
# much more context when it encounters an error
src = src.read()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_yaml(filepath):\n with open(filepath, 'r') as stream:\n try:\n return yaml.safe_load(stream)\n except yaml.YAMLError as exc:\n print(exc)",
"def load(text: str, options: Dict[str, str]) -> object:\n raise LoaderMissingError(\"Yaml is not installed on the sys... | [
"0.7648273",
"0.7503321",
"0.744825",
"0.73827696",
"0.73117244",
"0.7281031",
"0.71300495",
"0.7104288",
"0.70694286",
"0.7060576",
"0.6974146",
"0.6973486",
"0.69609356",
"0.69601506",
"0.6954229",
"0.6946586",
"0.6946322",
"0.6946314",
"0.69230694",
"0.6889858",
"0.687392"... | 0.7377658 | 4 |
Override copy method so that it returns an AttrDict | def copy(self):
return AttrDict(dict(self).copy()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _attrdict_copy(d):\n if isinstance(d, collections.Iterable):\n return AttrDict(dict(d))\n else:\n return AttrDict(vars(d))",
"def copy(self):\n return pdict(dict.copy(self))",
"def __copy__(self):\n d = dict()\n d.update(self.items())\n return d",
"def copy(sel... | [
"0.79777104",
"0.7526261",
"0.7489917",
"0.7322689",
"0.72928905",
"0.7133423",
"0.711386",
"0.708995",
"0.7079859",
"0.70214087",
"0.6966675",
"0.6856763",
"0.6846907",
"0.6842643",
"0.6838639",
"0.68050075",
"0.6800587",
"0.675476",
"0.6722806",
"0.66779095",
"0.66634566",
... | 0.86251104 | 0 |
Initialize a new AttrDict from the given dict. Handles any | def init_from_dict(self, d):
for k, v in d.items():
# First, keys must be strings, not ints
if isinstance(k, int):
k = str(k)
# Now, assign to the key, handling nested AttrDicts properly
if isinstance(v, dict):
self.set_key(k, AttrD... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwargs):\n super(AttrDict, self).__init__(*args, **kwargs)\n self.__dict__ = self",
"def from_dict(cls, _dict: Dict) -> 'Attribute':\n args = {}\n if 'name' in _dict:\n args['name'] = _dict.get('name')\n if 'value' in _dict:\n a... | [
"0.75459564",
"0.7444945",
"0.7418551",
"0.7398543",
"0.7346569",
"0.7252801",
"0.71336734",
"0.70824724",
"0.7020124",
"0.69852185",
"0.6985134",
"0.6952535",
"0.6952535",
"0.6952535",
"0.6952535",
"0.6952535",
"0.6952535",
"0.6952535",
"0.6952535",
"0.6952535",
"0.6952535",... | 0.7886951 | 0 |
Returns an AttrDict initialized from the given path or file object ``f``, which must point to a YAML file. | def from_yaml(cls, f, resolve_imports=True):
if isinstance(f, str):
with open(f, 'r') as src:
loaded = cls(_yaml_load(src))
else:
loaded = cls(_yaml_load(f))
if resolve_imports and 'import' in loaded:
for k in loaded['import']:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_from_yaml_file(f: Union[str, TextIO]) -> Dict:\n\n # support environment variables in config\n # https://stackoverflow.com/a/55301129\n\n # For maximum compatibility with PyGeoApi config files, this function is\n # inspired by the yaml_load() function in pygeoapi/util.py here:\n # https://g... | [
"0.73471355",
"0.66860604",
"0.64514816",
"0.64021313",
"0.62549525",
"0.6208135",
"0.61334",
"0.6092819",
"0.6066201",
"0.6009584",
"0.59892386",
"0.59335345",
"0.5927186",
"0.5855141",
"0.58475816",
"0.5842424",
"0.5826795",
"0.58163255",
"0.5783369",
"0.5779617",
"0.576674... | 0.59967065 | 10 |
Returns an AttrDict initialized from the given string, which must be valid YAML. | def from_yaml_string(cls, string):
return cls(_yaml_load(string)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yaml_str_to_schema_dict(yaml_str: str) -> dict:\n schema = load(yaml_str, get_type_schema_yaml_validator())\n revalidate_typeschema(schema)\n return schema.data",
"def yaml_parse(yamlstr):\n try:\n # PyYAML doesn't support json as well as it should, so if the input\n # i... | [
"0.7009143",
"0.67562217",
"0.6405139",
"0.6305777",
"0.62666273",
"0.62409043",
"0.6218634",
"0.6179979",
"0.6167477",
"0.6124283",
"0.6116092",
"0.6068145",
"0.6045965",
"0.6042264",
"0.6036413",
"0.59939337",
"0.5890634",
"0.5751374",
"0.570014",
"0.56383514",
"0.5636676",... | 0.7230302 | 0 |
Return the AttrDict as a pure dict (with nested dicts if necessary). | def as_dict(self, flat=False):
if not flat:
return self.as_dict_nested()
else:
return self.as_dict_flat() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n return {k: v.to_dict() if isinstance(v, AttrDict) else v\n for k, v in self.__dict__.items() if not k.startswith('_')}",
"def to_dict(self):\n return {\n k: v.to_dict() if isinstance(v, AttrDict) else v\n for k, v in self.__dict__.items()\n ... | [
"0.78846216",
"0.7778278",
"0.763931",
"0.76153415",
"0.7542497",
"0.7531587",
"0.74054295",
"0.72719944",
"0.7161319",
"0.71285415",
"0.71259487",
"0.6991994",
"0.6867699",
"0.6848551",
"0.68380505",
"0.6813786",
"0.67976344",
"0.67659664",
"0.6738724",
"0.6733309",
"0.67333... | 0.0 | -1 |
Returns the number of candidates not yet queued or relaxed. | def get_number_of_unrelaxed_candidates(self):
return len(self.__get_ids_of_all_unrelaxed_candidates__()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nremaining(self) -> int:\n return self._nmines - self._nfound",
"def n_in_progress(self) -> int:\n return self.n_tasks() - self.qsize()",
"def get_number_of_non_exhausted_votes(self):\n return (\n len(self._ballots) * self._number_of_votes_pr_voter\n - self._numbe... | [
"0.68944716",
"0.68242097",
"0.6713488",
"0.6690104",
"0.6636058",
"0.6636058",
"0.6605452",
"0.65308154",
"0.65308154",
"0.6484425",
"0.64629424",
"0.6435021",
"0.63590056",
"0.63156974",
"0.63056195",
"0.6272395",
"0.6225996",
"0.61922437",
"0.61673373",
"0.61670864",
"0.61... | 0.7796681 | 0 |
Returns a candidate ready for relaxation. | def get_an_unrelaxed_candidate(self):
to_get = self.__get_ids_of_all_unrelaxed_candidates__()
if len(to_get) == 0:
raise ValueError('No unrelaxed candidate to return')
a = self.__get_latest_traj_for_confid__(to_get[0])
a.info['confid'] = to_get[0]
if 'data' not in a.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def candidate(self):\n return Candidate(self.lan_address, self.tunnel)",
"def find_solution(self):\r\n for solution in self.solutions:\r\n if self.fitting_function.is_legal_solution(solution):\r\n return solution\r\n return None",
"def dispersy_get_introduce_candi... | [
"0.61733824",
"0.5955021",
"0.5785094",
"0.5719447",
"0.57172066",
"0.5702437",
"0.565701",
"0.56285524",
"0.5567466",
"0.5554344",
"0.5464879",
"0.54475105",
"0.5405179",
"0.5376829",
"0.5315734",
"0.53112525",
"0.5272255",
"0.5268241",
"0.5236074",
"0.52033925",
"0.5200782"... | 0.6672598 | 0 |
Marks a configuration as queued for relaxation. | def mark_as_queued(self, a):
gaid = a.info['confid']
self.c.write(None, gaid=gaid, queued=1,
key_value_pairs=a.info['key_value_pairs']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relaxed(self, relaxed):\n\n self._relaxed = relaxed",
"def install(self):\r\n url = XQUEUE_STUB_URL + \"/set_config\"\r\n\r\n # Configure the stub to respond to submissions to our queue\r\n payload = {self._pattern: json.dumps(self._response_dict)}\r\n response = requests.p... | [
"0.5636644",
"0.54379946",
"0.52646136",
"0.5235014",
"0.51989406",
"0.51568085",
"0.50561696",
"0.50463223",
"0.50284195",
"0.5013441",
"0.5000572",
"0.49717903",
"0.49534714",
"0.48578596",
"0.48423442",
"0.4795844",
"0.4795844",
"0.4795844",
"0.47904685",
"0.4785795",
"0.4... | 0.6424074 | 0 |
Get the super cell, including stationary atoms, in which the structure is being optimized. | def get_slab(self):
return self.c.get_atoms(simulation_cell=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SuperCell(self,Boundary):\n \n UC_Atoms = self.Unit_AtomsCoord()\n nv = Boundary\n \n \n \"\"\"calculate array of atoms positions in supercell\"\"\"\n \n pos = UC_Atoms\n \n for i in range(1,nv[0]+1):\n for j in range(1,nv[1]+1):\... | [
"0.72212136",
"0.68591684",
"0.68143797",
"0.65963036",
"0.6583755",
"0.6333237",
"0.6127307",
"0.607807",
"0.5990546",
"0.5971452",
"0.5939301",
"0.5925428",
"0.58936745",
"0.5861603",
"0.5833158",
"0.5766818",
"0.57193285",
"0.5700143",
"0.5606969",
"0.5592925",
"0.5581571"... | 0.5268315 | 49 |
Add a relaxed starting candidate. | def add_relaxed_candidate(self, candidate, **kwargs):
test_raw_score(candidate)
if 'data' in candidate.info:
data = candidate.info['data']
else:
data = {}
gaid = self.c.write(candidate, origin='StartingCandidateRelaxed',
relaxed=1, ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_unrelaxed_candidate(self, candidate, **kwargs):\n gaid = self.c.write(candidate, origin='StartingCandidateUnrelaxed',\n relaxed=0, generation=0, extinct=0, **kwargs)\n self.c.update(gaid, gaid=gaid)\n candidate.info['confid'] = gaid",
"def add_relaxed_candi... | [
"0.6866932",
"0.6119542",
"0.6029522",
"0.5744808",
"0.5718855",
"0.55474615",
"0.52559465",
"0.51909405",
"0.51124346",
"0.5105831",
"0.5099032",
"0.50673676",
"0.5055622",
"0.4921122",
"0.48766643",
"0.48568106",
"0.48405752",
"0.4797193",
"0.4797169",
"0.47903067",
"0.4716... | 0.7127685 | 0 |
Finds a user with the given ID from the database | def find_one(self, user_id):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_user_by_id(id: str) -> User:\n\n # Find the id user in the database, else return None\n return User.query.get(int(id))",
"def find_by_id(cls, _id):\n user = cls.query.filter_by(id=_id).first()\n return user",
"def find_by_id(cls, _id):\n ## Setup Connection & Cursor\... | [
"0.8479443",
"0.83984274",
"0.8327433",
"0.8061639",
"0.8004181",
"0.7984403",
"0.7977362",
"0.79523057",
"0.79426914",
"0.7918539",
"0.7908099",
"0.7907589",
"0.7904321",
"0.78996575",
"0.7845483",
"0.7843915",
"0.7807513",
"0.7807513",
"0.7807513",
"0.7807513",
"0.7805806",... | 0.7427244 | 47 |
Raise the entire fleet and change the fleet's direction. | def _change_fleet_direction(self):
for auto in self.autos.sprites():
auto.rect.y -= self.settings.fleet_rise_speed
self.settings.fleet_direction *= -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _change_fleet_direction(self):\n for alien in self.aliens.sprites():\n alien.rect.x -= self.settings.fleet_approach_speed\n self.settings.fleet_direction *= -1",
"def _change_fleet_direction(self):\n\t\tfor alien in self.aliens.sprites():\n\t\t\talien.rect.y += self.settings.fleet_dr... | [
"0.6956296",
"0.67858756",
"0.6705932",
"0.6705932",
"0.66921836",
"0.6272063",
"0.61195123",
"0.61195123",
"0.611865",
"0.6084587",
"0.59729075",
"0.59725595",
"0.59555143",
"0.5951545",
"0.59253466",
"0.58942163",
"0.58496314",
"0.5846775",
"0.5843246",
"0.583448",
"0.58330... | 0.6898745 | 1 |
get the max disparity | def max_disp(left_img, right_img):
# Max initial matches
MAX_INI_MATCH = np.inf
# ORB detector and brute-force matcher
detector = cv2.ORB_create(nfeatures=100000, edgeThreshold=5)
matcher = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)
# Find the keypoints and descriptors of both images
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max(self):\n return self.serie.max()",
"def get_max_depth_val():\n data = SUNRGBDTrainDataset(True)\n return max([data[0][i][-1].flatten().item() for i in range(len(data))])",
"def get_rmax(self):\n return self.rmax",
"def getImageMax(self):\n fname = '%s::%s'%(self.__class... | [
"0.6474737",
"0.6453953",
"0.6417665",
"0.6386365",
"0.6354075",
"0.6279357",
"0.6279357",
"0.6275388",
"0.6228926",
"0.6219197",
"0.618019",
"0.61727595",
"0.61581266",
"0.615772",
"0.61333597",
"0.6132122",
"0.6098971",
"0.6084657",
"0.6074895",
"0.60713226",
"0.6067054",
... | 0.0 | -1 |
Returns whether the action should be defined in the user interface. | def can_add_to_menu ( self, action ):
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __bool__(self):\n return bool(self._actions)",
"def is_action(self) -> bool:\n return self.is_action_str(self.content)",
"def match_action(self, action):\n\n return hasattr(self, self._action_handler_name(action))",
"def allowed(self):\n may = self.request.user.may\n re... | [
"0.74789727",
"0.73193073",
"0.69726133",
"0.6874099",
"0.66990554",
"0.66666627",
"0.66638565",
"0.66514057",
"0.6528778",
"0.6475449",
"0.64073265",
"0.64001405",
"0.6376883",
"0.6376883",
"0.6376883",
"0.6376883",
"0.63444954",
"0.63323605",
"0.6305414",
"0.6273049",
"0.62... | 0.6758552 | 4 |
Returns an estimate density from the composition using the pure element density and this equation. | def calculate_density(composition):
density = 0.0
for z, fraction in composition.items():
density += fraction / ep.mass_density_kg_m3(z)
return 1.0 / density | {
"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.7187182",
"0.70602435",
"0.7004154",
"0.69785357",
"0.69785357",
"0.69785357",
"0.6950296",
"0.68152124",
"0.65642124",
"0.6547703",
"0.6545218",
"0.65017605",
"0.6487486",
"0.64783704",
"0.6445813",
"0.64030546",
"0.6388768",
"0.63642126",
"0.63642126",
"0.6362881",
"0.63... | 0.7209633 | 0 |
Returns the material for the specified pure element. | def pure(cls, z, absorption_energy_eV=None):
name = ep.name(z)
composition = {z: 1.0}
density_kg_m3 = ep.mass_density_kg_m3(z)
return cls(composition, name, density_kg_m3, absorption_energy_eV) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetMaterial(self, *args):\n return _XCAFDoc.XCAFDoc_MaterialTool_GetMaterial(self, *args)",
"def material(self):\n return self._F_Mstr",
"def info_materials_polymer_get():\n materials = _material_by_group(974) # 974 == intermediate group\n return materials, 200",
"def Au():\n retur... | [
"0.62898844",
"0.6061054",
"0.58216566",
"0.5777283",
"0.5520524",
"0.54839283",
"0.5478171",
"0.5429484",
"0.54288715",
"0.5384885",
"0.5379901",
"0.53296757",
"0.5200612",
"0.5194836",
"0.51001596",
"0.5097264",
"0.5092299",
"0.5075247",
"0.50688744",
"0.5049481",
"0.504656... | 0.4867194 | 33 |
Density of material in kg/m3. Immutable cannot be modified. | def density_kg_m3(self):
return self._density_kg_m3 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def density(self):\n return (1e-3*self.molar_mass) * self.pressure / (gas_constant * self.temperature) # kg/m^3",
"def density_g_cm3(self):\n return self._density_kg_m3 / 1000.0",
"def electron_density_per_m3(self):\n return self.electron_density * 1e6",
"def Density(material):\n if m... | [
"0.76019555",
"0.75566584",
"0.75042987",
"0.69745874",
"0.68528277",
"0.68326294",
"0.68326294",
"0.68326294",
"0.6809655",
"0.6690825",
"0.66695786",
"0.65824467",
"0.64694947",
"0.64607",
"0.64440095",
"0.6432363",
"0.6429484",
"0.64139694",
"0.6393082",
"0.6287069",
"0.62... | 0.7805884 | 0 |
Density of material in g/cm3. Immutable cannot be modified. | def density_g_cm3(self):
return self._density_kg_m3 / 1000.0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def electron_density_per_m3(self):\n return self.electron_density * 1e6",
"def density_kg_m3(self):\n return self._density_kg_m3",
"def density(self):\n return (1e-3*self.molar_mass) * self.pressure / (gas_constant * self.temperature) # kg/m^3",
"def Density(material):\n if material =... | [
"0.7830923",
"0.75957865",
"0.7594146",
"0.71916604",
"0.7083939",
"0.7054858",
"0.7043591",
"0.7043591",
"0.7043591",
"0.6958933",
"0.6840344",
"0.6744098",
"0.6734313",
"0.666878",
"0.6620056",
"0.65137464",
"0.65114945",
"0.64739513",
"0.64122254",
"0.63720477",
"0.6352155... | 0.77267176 | 1 |
Returns a random position inside the map. | def random_position():
path = (
os.path.dirname(__file__)
+ os.sep
+ "templates"
+ os.sep
+ "data"
+ os.sep
+ "taxi_stations.json"
)
with open(path) as f:
stations = json.load(f)["features"]
pos = random.choice(stations)
coords ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_position(map_array):\n if map_array.sum() <= 0:\n raise ValueError(\"There is no available space in the map.\")\n map_dims = len(map_array.shape)\n pos = np.zeros(map_dims, dtype=np.int32)\n while True:\n result = map_array\n for i in range(map_dims):\n pos[i] = np.random.randint(m... | [
"0.78322154",
"0.7758838",
"0.7703466",
"0.7531028",
"0.7520918",
"0.749802",
"0.74798745",
"0.74081016",
"0.733624",
"0.7246872",
"0.7162052",
"0.71178144",
"0.7101729",
"0.70998716",
"0.7072934",
"0.70385563",
"0.69941044",
"0.69776344",
"0.69722825",
"0.6915979",
"0.687626... | 0.75570405 | 3 |
Returns the distance between two coordinates in meters. | def distance_in_meters(coord1, coord2):
return vincenty(coord1, coord2).meters | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_distance_meters(aLocation1, aLocation2):\n dlat = aLocation2.lat - aLocation1.lat\n dlong = aLocation2.lon - aLocation1.lon\n return math.sqrt((dlat*dlat) + (dlong*dlong)) * 1.113195e5",
"def get_distance_meters(location1, location2):\n dlat = location2.lat - location1.lat\n dlong = locati... | [
"0.8117228",
"0.80217755",
"0.7804001",
"0.7738809",
"0.7730546",
"0.76826996",
"0.76040953",
"0.7601301",
"0.7601301",
"0.7601301",
"0.7601301",
"0.7601301",
"0.7590113",
"0.7588026",
"0.7586656",
"0.7579564",
"0.7563654",
"0.75163054",
"0.7515529",
"0.7508974",
"0.7487664",... | 0.831811 | 0 |
Convert kilometers/hour to meters/second. | def kmh_to_ms(speed_in_kmh):
meters_per_second = speed_in_kmh * 1000 / 3600
return meters_per_second | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def km2m(km):\n return km * 1000",
"def _mps_to_kph(self) -> None:\n if self.units == \"m/s\":\n self.units = \"km/h\"\n self.value = ((self.value * 360) / 100).__round__(2)\n else:\n msg = (\n \"Not a valid unit conversion, expected units to be in... | [
"0.7543693",
"0.7246486",
"0.71331525",
"0.70926064",
"0.7016913",
"0.69333595",
"0.6929353",
"0.691435",
"0.6908693",
"0.6840822",
"0.6759349",
"0.6759223",
"0.67085826",
"0.66510725",
"0.6637791",
"0.65913737",
"0.65846854",
"0.6499448",
"0.6493615",
"0.64695203",
"0.642390... | 0.7602267 | 0 |
Render the main page | def index() -> object:
return render_template('ue_bootstrap.j2', title='UENERGO TAGS') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_page():\n return render_template(\"main_page.html\")",
"def main_page():\n return render_template(\"index.html\")",
"def main():\n return render_template(\"main.html\")",
"def main():\n return render_template(\"main.html\")",
"def main():\n page = get_page_arg()\n\n items = load_... | [
"0.82781464",
"0.8103563",
"0.7775523",
"0.7775523",
"0.7712574",
"0.7690664",
"0.7571747",
"0.7568287",
"0.75666183",
"0.7554107",
"0.75477314",
"0.7508612",
"0.74583364",
"0.7413243",
"0.7413243",
"0.73617375",
"0.732339",
"0.732339",
"0.7316146",
"0.72481865",
"0.7230807",... | 0.0 | -1 |
Get one random word from database | def one(self):
count = self.aggregate(count=Count('id'))['count']
if count < 2:
raise ValueError('not enough words')
idx = randint(0, count - 1)
return self.all()[idx] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_word(self):\n pass",
"def return_word():\n wordlist = load_words()\n word = random.choice(wordlist)\n return word",
"def get_word():\n word=words_dict[randrange(0,len(words_dict))]\n return word",
"def get_word():\n word=words_dict[randrange(0,len(words_dict))]\n re... | [
"0.8173143",
"0.8077595",
"0.79319006",
"0.79319006",
"0.79319006",
"0.7807293",
"0.76921344",
"0.76070523",
"0.75696456",
"0.75696456",
"0.75696456",
"0.752449",
"0.7507971",
"0.74932486",
"0.7476709",
"0.74404925",
"0.74378777",
"0.74279106",
"0.74075335",
"0.7371424",
"0.7... | 0.6994051 | 28 |
Renders the home page. | def home():
#mongoconn()
return render_template(
'index.html'
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_home():\r\n\treturn render_template(\"index.html\")",
"def home():\n\n return render_template('home_page.html')",
"def home():\n\n return render_template(\"home.html\")",
"def home():\n return render_template('home.html')",
"def home():\n return render_template('home.html')",
"def ... | [
"0.85574406",
"0.853399",
"0.8351404",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.827363",
"... | 0.0 | -1 |
returns a 1d gaussian on a 2d array of shape 'shape' | def lingauss(shape, w, cx = 0, cy = 0, theta = 0, cutoff = 0.05, norm = False):#, win = (-2, 2)):
x = np.arange(0, shape[0])#linspace( win[0], win[1], shape[0] )
y = np.arange(0, shape[1])#linspace( win[0], win[1], shape[1] )
xx, yy = np.meshgrid(x, y, indexing='ij')
xy = np.cos(theta)*(xx-cx) + np.sin(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fspecial_gaussian(shape=(3, 3), sigma=0.5):\n m, n = [(ss - 1.) / 2. for ss in shape]\n y, x = np.ogrid[-m:m + 1, -n:n + 1]\n h = np.exp(-(x * x + y * y) / (2. * sigma * sigma))\n h[h < np.finfo(h.dtype).eps * h.max()] = 0\n sumh = h.sum()\n if sumh != 0:\n h /= sumh\n return h",
... | [
"0.6801258",
"0.6757049",
"0.6755298",
"0.6754183",
"0.6690282",
"0.6553932",
"0.6553932",
"0.65327436",
"0.65327436",
"0.65199935",
"0.6505064",
"0.64217603",
"0.63755614",
"0.6374978",
"0.6361427",
"0.6317734",
"0.6293023",
"0.6215579",
"0.614452",
"0.6084037",
"0.6053269",... | 0.0 | -1 |
Compute an apparent magnitude in a given system | def apmag(self, band, mag='Vega', mzero=0.):
r = self._waverange(band.wavelength, self.wavelength)
wr = self.wavelength[r]
fr = self.flux[r]
if mag == 'AB':
f = np.trapz(fr * band(wr) * wr, x=wr) / np.trapz(band(wr) * c / wr, x=wr)
return -2.5 * np.log10(f) + abze... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def magnitude(self):\n return self.real ** 2 + numpy.inner(self.pure, self.pure)",
"def calculate_magnitude(self, band, system='AB'):\n\n if system not in ('AB', 'Vega'):\n raise ValueError('`system` must be one of `AB` or `Vega`')\n\n f1 = self.calculate_flux(band)\n\n if ... | [
"0.7292758",
"0.7171404",
"0.7113403",
"0.7058138",
"0.7041713",
"0.69590485",
"0.68035406",
"0.680234",
"0.679456",
"0.6692383",
"0.6634181",
"0.6630849",
"0.6565087",
"0.6533371",
"0.648787",
"0.64606863",
"0.6459848",
"0.6455786",
"0.6425589",
"0.6422468",
"0.6419634",
"... | 0.0 | -1 |
Run registered sideeffects functions, or suppress as appropriate. If TEST_MODE is on, or the _suppress attr is True, then the sideeffects are not run, but the `suppressed_side_effect` signal is sent this is primarily used by the disable_side_effects context manager to register which sideeffects events were suppressed (... | def run_side_effects(self, label, *args, **kwargs):
if self._suppress or settings.TEST_MODE:
self.suppressed_side_effect.send(Registry, label=label)
else:
self._run_side_effects(label, *args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_side_effects(label, *args, **kwargs):\n _registry.run_side_effects(label, *args, **kwargs)",
"def run_side_effects(\n self, label: str, *args: Any, return_value: Any | None = None, **kwargs: Any\n ) -> None:\n # TODO: this is all becoming over-complex - need to simplify this\n ... | [
"0.6412087",
"0.62416357",
"0.59964097",
"0.56458133",
"0.54883534",
"0.53686225",
"0.51898587",
"0.5124166",
"0.5112381",
"0.5048021",
"0.5034321",
"0.5019686",
"0.5009155",
"0.5005497",
"0.4990661",
"0.49792472",
"0.49790695",
"0.4954967",
"0.4928962",
"0.48964596",
"0.4896... | 0.797989 | 0 |
sets the DCC name | def name(self, name):
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _cname(self,account_id):\n company = self.pool.get('account.account').browse(self.cr, self.uid, account_id).company_id\n self.caddress = self._cadd(company)\n return company.name",
"def setName(self, *args):\n return _libsbml.Compartment_setName(self, *args)",
"def setName(self,... | [
"0.662083",
"0.65048045",
"0.63297886",
"0.63084394",
"0.6285737",
"0.6280893",
"0.6269647",
"0.62543106",
"0.6171647",
"0.6141098",
"0.6084774",
"0.6055118",
"0.6044105",
"0.60393894",
"0.5990857",
"0.5981757",
"0.5961525",
"0.5955938",
"0.5947456",
"0.59470284",
"0.58897567... | 0.565332 | 65 |
Returns the frame rate of this current DCC | def get_fps(self):
raise NotImplementedError("get_fps is not implemented") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frame_rate(self):\n return self._frame_rate",
"def getFrameRate(self):\n if not self.proxy:\n self.proxy = self.session.service(\"ALVideoRecorder\")\n return self.proxy.getFrameRate()",
"def get_framerate(self):\n return self._framerate",
"def rate(self):\n i... | [
"0.8199084",
"0.7609545",
"0.7584592",
"0.7429174",
"0.73208266",
"0.7106402",
"0.7096785",
"0.70617723",
"0.7022254",
"0.69991726",
"0.6994234",
"0.69582385",
"0.6914659",
"0.6902799",
"0.6894614",
"0.6889496",
"0.6867951",
"0.6867051",
"0.6839382",
"0.6797281",
"0.67895395"... | 0.64540166 | 40 |
Returns True if the given file names extension is in the extensions list false otherwise. | def has_extension(self, filename):
if filename is None:
return False
return filename.split(".")[-1].lower() in self.extensions | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_extensions(filename):\n return any(filename.endswith(e) for e in extensions)",
"def has_file_allowed_extension(filename, extensions):\n filename_lower = filename.lower()\n return any(filename_lower.endswith(ext) for ext in extensions)",
"def has_file_allowed_extension(filename, extension... | [
"0.8621119",
"0.85567933",
"0.85567933",
"0.8480691",
"0.8480691",
"0.83640915",
"0.83498454",
"0.820233",
"0.8076915",
"0.7933924",
"0.7922959",
"0.78942746",
"0.7779565",
"0.7667508",
"0.76460284",
"0.76384634",
"0.7628203",
"0.7627468",
"0.75605035",
"0.7546966",
"0.751873... | 0.79659414 | 9 |
Create a onehot encoding of x of size k. | def _one_hot(x, k, dtype=np.float32):
return np.array(x[:, None] == np.arange(k), dtype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _one_hot(z, K):\n z_one_hot = np.zeros((z.size, K))\n z_one_hot[np.arange(z.size), z] = 1\n return z_one_hot",
"def one_hot(x, k, dtype=np.float32):\n return np.array(x[:, None] == np.arange(k), dtype)",
"def one_hot(x, k, dtype=np.float32):\n return np.array(x[:, None] == np.arange(k), dtype)... | [
"0.8044289",
"0.80100906",
"0.79744345",
"0.7889798",
"0.780032",
"0.7714973",
"0.75707066",
"0.7565854",
"0.74275184",
"0.7418034",
"0.7357682",
"0.73555213",
"0.7347697",
"0.73436314",
"0.7291793",
"0.7286153",
"0.7206058",
"0.72044945",
"0.71902776",
"0.71643984",
"0.71621... | 0.78977203 | 3 |
Split provided dataset into minibatches of set batch size for a set number of epochs. | def minibatch(x_train, y_train, batch_size, train_epochs):
epoch = 0
start = 0
key = random.PRNGKey(0)
while epoch < train_epochs:
end = start + batch_size
if end > x_train.shape[0]:
key, split = random.split(key)
permutation = random.permutation(split,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minibatches(dataset: List[T],\n batch_size: int,\n shuffle: bool = True) -> Iterator[List[T]]:\n # start indexes 0, batch_size, 2 * batch_size, ...\n batch_starts = [start for start in range(0, len(dataset),batch_size)]\n\n if shuffle: random.shuffle(batch_starts) #shuf... | [
"0.72677934",
"0.7168722",
"0.7158432",
"0.71082956",
"0.69468933",
"0.6936872",
"0.68887174",
"0.68543094",
"0.68411726",
"0.67549133",
"0.6648747",
"0.66101724",
"0.66047585",
"0.6596188",
"0.6596188",
"0.6596188",
"0.658694",
"0.658694",
"0.6572224",
"0.6572221",
"0.654420... | 0.6449067 | 27 |
Jinja function to modify a query URL by replacing query string parameters with keyword arguments. | def modify_query(**values):
args = request.args.copy()
for attr, new_value in values.items():
if new_value is not None:
args[attr] = new_value
elif attr in args:
del args[attr]
if args:
return request.base_url + "?" + url_encode(args)
else:
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_replace(context, **kwargs):\n query = context['request'].GET.dict()\n query.update(kwargs)\n return urlencode(query)",
"def url_replace(context, **kwargs):\n query = context['request'].GET.dict()\n query.update(kwargs)\n return urlencode(query)",
"def querystring_replace(context, **kw... | [
"0.73549724",
"0.73549724",
"0.7000192",
"0.69190556",
"0.69038314",
"0.6655814",
"0.6580238",
"0.64521825",
"0.64398634",
"0.64398634",
"0.6377257",
"0.63423216",
"0.6238349",
"0.61751354",
"0.61704403",
"0.613704",
"0.6126076",
"0.612524",
"0.6090522",
"0.6087221",
"0.60512... | 0.6865226 | 5 |
Returns all playlists that match the name or an empty list | def getAllPlaylists(self,name):
return [p for p in self.playlists if p.title == name] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_playlists(self):\n values = {\n 'action' : 'playlists',\n }\n root = self.__call_api(values)\n nodes = root.getElementsByTagName('playlist')\n if not nodes: # list is empty, reauth\n return None\n\n l = []\n try:\n for child... | [
"0.682519",
"0.68201596",
"0.6751294",
"0.6709319",
"0.66537863",
"0.66514975",
"0.6618348",
"0.65986043",
"0.6566129",
"0.6342476",
"0.63369375",
"0.62810504",
"0.6162734",
"0.6148298",
"0.61147445",
"0.6102107",
"0.59544355",
"0.5939108",
"0.58674866",
"0.5850564",
"0.58477... | 0.86612093 | 0 |
Returns a possible internal representation of this object | def __repr__(self):
return str(self.__dict__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return repr(self.__dict__['_obj'])",
"def to_representation(self) -> str:\n raise NotImplementedError()",
"def serialize(self) -> typing.Any:\n return self._serialize(self.__dict__)",
"def __repr__(self):\n return '{}({})'.format(self.__class__.__name... | [
"0.7204943",
"0.6987548",
"0.69345546",
"0.6916779",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
... | 0.6890789 | 7 |
returns the number of items stored in this playlist | def __len__(self):
return len(self.items) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_song(self):\n return len(self.playlist)",
"def items_count(self):\n return len(self.items)",
"def get_num_items(self):\r\n return self.num_items",
"def items_num(self):\n\t\treturn len(self.items)",
"def items_num(self):\n\t\treturn len(self.items)",
"def items_num(self):\n... | [
"0.84270746",
"0.79823476",
"0.7960365",
"0.78872377",
"0.78872377",
"0.78418005",
"0.7702756",
"0.76489824",
"0.7614725",
"0.75921047",
"0.74537665",
"0.7450116",
"0.74077356",
"0.7356713",
"0.73212796",
"0.73212796",
"0.73056525",
"0.73011845",
"0.7287761",
"0.7278011",
"0.... | 0.6862828 | 63 |
Returns a possible internal representation of this object | def __repr__(self):
return str(self.__dict__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return repr(self.__dict__['_obj'])",
"def to_representation(self) -> str:\n raise NotImplementedError()",
"def serialize(self) -> typing.Any:\n return self._serialize(self.__dict__)",
"def __repr__(self):\n return '{}({})'.format(self.__class__.__name... | [
"0.7204943",
"0.6987548",
"0.69345546",
"0.6916779",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
"0.6872479",
... | 0.6890789 | 8 |
determines the surface area of a cube with a 'side' input | def surface_area_of_cube(side):
return side | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def surface_area_cube(side_length: float) -> float:\r\n if side_length < 0:\r\n raise ValueError(\"surface_area_cube() only accepts non-negative values\")\r\n return 6 * side_length**2",
"def cube_area(side_length):\n area = side_length ** 3\n return area",
"def cube_area(edge : number) -> n... | [
"0.805144",
"0.7986797",
"0.731187",
"0.718725",
"0.71836185",
"0.6744901",
"0.66973734",
"0.6569654",
"0.6526181",
"0.6512296",
"0.6496231",
"0.64133763",
"0.6308537",
"0.6276802",
"0.6241804",
"0.62364215",
"0.6188366",
"0.61737096",
"0.6146036",
"0.6087329",
"0.6080187",
... | 0.9202969 | 0 |
Split train and test split by percentage | def trainTestSplit(self, percent):
percent = float(percent)
trainX, trainy = self.getXY(self.data.sample(
frac=((100. - percent) / 100.), random_state=200))
testX, testy = self.getXY(self.data.drop(trainX.index))
return trainX.as_matrix(), testX.as_matrix(), \
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_train_test_by_percentage(dataset, train_percentage=0.8):\n train_length = int(len(dataset) * train_percentage)\n return torch.utils.data.random_split(dataset, (train_length, len(dataset) - train_length))",
"def split_train_test(df, percentage_train=50):\n return (\n df.loc[(df.i... | [
"0.82748425",
"0.8120937",
"0.8089938",
"0.8014541",
"0.780956",
"0.76712316",
"0.7558654",
"0.74698806",
"0.7456384",
"0.7456384",
"0.74478644",
"0.7446495",
"0.74335027",
"0.7356279",
"0.73494875",
"0.73485255",
"0.7323469",
"0.7323469",
"0.729911",
"0.7273047",
"0.72416395... | 0.7803372 | 5 |
Constructor for Input Attention Encoder | def __init__(self, input_dim=6, hidden_dim=128, T=10, in_features=2*128 + 16, num_layers=1, out_features=1):
super(InputAttentionEncoder, self).__init__()
self.input_dim = input_dim
self.hidden_dim = hidden_dim
self.T = T
in_features = hidden_dim * 2 + T - 1
self.lstm_u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encoder(self, inputs):\n pass",
"def __init__(self, input=None, bandwidth=None, adaptive=False,\r\n low_bias=False):\r\n self.input = input\r\n self.signal, self.noise = signal_noise(input)\r\n self.bandwidth = bandwidth\r\n self.adaptive = adaptive\r\n ... | [
"0.6661585",
"0.64263797",
"0.64200747",
"0.6364351",
"0.63325757",
"0.62153625",
"0.6106124",
"0.60871387",
"0.60739964",
"0.60216635",
"0.60214394",
"0.60156465",
"0.601161",
"0.6004771",
"0.60010016",
"0.59797907",
"0.59795856",
"0.5975842",
"0.59674346",
"0.5965174",
"0.5... | 0.6640629 | 1 |
Test that Student class constructor works | def test_constructor(self):
# Args
name = 'Mathew'
age = 13
grade = 14
# Object construction
obj = models.Student(name=name, age=age, grade=grade)
# Constructor class works
self.assertIsNotNone(obj)
self.assertEqual(obj.name, name)
self.as... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, student):\n pass",
"def test_constructor(self):\n pass",
"def test_initialization_of_student_first_name():\n assert lazy_student.first_name == \"Roman\"",
"def test_add_student():\n classroom = setup_for_test()\n student = Student(\"Andrew Tsukuda\")\n classroom.add... | [
"0.7982966",
"0.7307828",
"0.72471935",
"0.71484935",
"0.70021945",
"0.6958297",
"0.69263786",
"0.67756337",
"0.67748475",
"0.6774524",
"0.6731666",
"0.6696951",
"0.6688961",
"0.66339296",
"0.66135466",
"0.658905",
"0.65427613",
"0.6502664",
"0.6471068",
"0.6405618",
"0.64055... | 0.8193032 | 0 |
Handle the not found error | def resource_not_found(error_msg):
return jsonify(error=str(error_msg)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found(error):\n pass",
"def handleStatus_404(self):\n log.err('HTTP Error 404')",
"def not_found():\n return HttpError(404)",
"def handle_notfound( environ ):\n return 404, [], make_error( 'Not Found', environ[ 'PATH_INFO' ] )",
"def not_found():\n raise cherrypy.HTTPError(404, \... | [
"0.8317496",
"0.7795668",
"0.74596083",
"0.7443178",
"0.74247843",
"0.7306098",
"0.7287073",
"0.727461",
"0.72421145",
"0.7143863",
"0.71227247",
"0.70941484",
"0.7079318",
"0.7068825",
"0.7054094",
"0.70532537",
"0.70527107",
"0.7011235",
"0.70090216",
"0.6982825",
"0.698282... | 0.0 | -1 |
Resolve a path that might be relative to this script | def rel_resolve(path):
if os.path.isabs(path):
return os.path.abspath(path)
else:
return os.path.join(SCRIPTDIR, path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _resolve_relative_path(filepath: str):\n if not filepath:\n return None\n\n inf_path = os.path.join(os.path.dirname(__file__), filepath)\n\n return inf_path",
"def resolved(rpath):\r\n return realpath(abspath(rpath))",
"def resolve_relative_path(path):\n if os.path.isabs(path):\n ... | [
"0.78298426",
"0.7733977",
"0.7699496",
"0.76036334",
"0.75168794",
"0.7358698",
"0.7288517",
"0.7198403",
"0.7141043",
"0.71294045",
"0.7050964",
"0.6934841",
"0.6863448",
"0.6813791",
"0.680175",
"0.6793247",
"0.67868644",
"0.673634",
"0.67108536",
"0.6703139",
"0.6693178",... | 0.8219571 | 0 |
Initialize the dependency object with a name (which is used as a convenience to identify these objects, but not actually used anywhere in the check_dependencies algorithm) | def __init__(self):
self.dependsOn = [] # Expected to contain Dependency objects. | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, name: str, deps: List[str], meta: dict):\n self.name = name\n self.deps = deps\n self.meta = meta",
"def __init__(self, name = None):\n self._name = name",
"def __init__(self, name):\n self._name = name\n pass",
"def __init__(self, name):\n\n ... | [
"0.7500776",
"0.68109864",
"0.6729634",
"0.67202646",
"0.67193097",
"0.6710924",
"0.6700921",
"0.6700921",
"0.6594058",
"0.65429467",
"0.6491371",
"0.64818853",
"0.6479465",
"0.6456963",
"0.6456963",
"0.6456963",
"0.6456963",
"0.6456963",
"0.6456963",
"0.6456963",
"0.6456963"... | 0.6796081 | 2 |
Filenames are usually rejected if they contain funky characters, blocking execution | def random_alphabetical_string(self, maxlen = 1024, exact = False):
if exact:
string_len = maxlen
else:
string_len = random.randint(1, maxlen)
alphabet = string.ascii_letters + string.digits
s = ''.join(random.choice(alphabet) for _ in range(string_len))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_illegal_chars(filename: str) -> str:\n if OPTIONS['download']['ascii']:\n return ''.join(i for i in filename if i in FILENAME_ALLOWEDASCII)\n else:\n return ''.join(i for i in filename if i not in FILENAME_BANNED)",
"def getSafeFilename(untrustedFilename: unicode) -> unicode:\n ... | [
"0.72040284",
"0.69636357",
"0.6962052",
"0.679788",
"0.676156",
"0.67046124",
"0.66217357",
"0.66023",
"0.65875065",
"0.64913845",
"0.6481828",
"0.64439493",
"0.63789254",
"0.63687015",
"0.6352777",
"0.6344653",
"0.6329471",
"0.63185716",
"0.63060516",
"0.63000476",
"0.62493... | 0.0 | -1 |
Returns a random string, UTF8 encoded | def random_string(self, maxlen = 1024):
string_len = random.randint(1, maxlen)
alphabet = string.ascii_letters + string.digits + string.punctuation
s = ''.join(random.choice(alphabet) for _ in range(string_len))
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateRandomString():\n return ''.join(b64encode(urandom(32)).decode('utf-8'))",
"def generate_random_string(length=6):\n n = int(length / 2 + 1)\n x = binascii.hexlify(os.urandom(n))\n s = x[:length]\n return s.decode(\"utf-8\")",
"def random_string() -> str:\n letters = string.ascii_l... | [
"0.7601585",
"0.73281187",
"0.72921443",
"0.7276776",
"0.7177859",
"0.71604323",
"0.7090298",
"0.70680887",
"0.7036748",
"0.6969862",
"0.69410926",
"0.6864863",
"0.6861202",
"0.68288845",
"0.6769082",
"0.67520565",
"0.6736104",
"0.66968936",
"0.6691693",
"0.66832757",
"0.6681... | 0.6437578 | 47 |
Returns a string of random bytes (excluding zero) | def random_byte_string(self, maxlen = 1024):
s = ''.join(chr(random.randint(1, 255)) for _ in range(maxlen))
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateRandomString():\n return ''.join(b64encode(urandom(32)).decode('utf-8'))",
"def _random_bytes(n):\n return ''.join(map(chr, (random.randrange(256) for i in xrange(n))))",
"def gen_secret() -> str:\n r = random.randrange(0, 255) # INSECURE, just for demo\n r = hex(r)[2:]\n if len(r) == ... | [
"0.7747011",
"0.76955765",
"0.76094633",
"0.74770635",
"0.7456409",
"0.74316096",
"0.74011415",
"0.73557895",
"0.7344226",
"0.73241365",
"0.7322825",
"0.7259816",
"0.72478074",
"0.72133297",
"0.72051495",
"0.71339023",
"0.70703316",
"0.70254254",
"0.7004267",
"0.70023495",
"0... | 0.72751373 | 11 |
Visits all neighbours and marks them as visited (resets) their connection | def explore_all_neighbors(z, i):
n = len(z)
q = [i]
found = False
while len(q) > 0:
i = q.pop()
for j in range(n):
if z[i][j] == 1: # Reset All Neighbours
z[i][j] = 0
z[j][i] = 0
found = True
if i != j:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_visited(self):\n self.__visited = True",
"def reset_visited(self):\n self.__visited = False",
"def _connect_neighbours(self):\n for prev in self.unvisited:\n for next in self.unvisited:\n if (next[0] == prev[0] and next[1] == prev[1] + 1) or (next[0] == pr... | [
"0.70737803",
"0.7029681",
"0.7007848",
"0.67545897",
"0.66621304",
"0.6634973",
"0.6622531",
"0.656594",
"0.64846784",
"0.6424204",
"0.64052665",
"0.6395346",
"0.6392347",
"0.638834",
"0.6288091",
"0.6282154",
"0.6278304",
"0.62593436",
"0.6259231",
"0.62420213",
"0.6231719"... | 0.5849109 | 42 |
Unicode representation of UserRegistration. | def __str__(self):
return f'{self.adm_no}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __unicode__(self):\n\n return unicode(self.user)",
"def getUniStr(self):\n return(\"%s/%s\"%(self.token.id,self.type))",
"def __unicode__(self):\n return \"{1} registration request by user {0}\".format(self.user.username,\n se... | [
"0.6628955",
"0.62826604",
"0.6265881",
"0.60908914",
"0.59932166",
"0.5946944",
"0.5934924",
"0.5934924",
"0.59023094",
"0.5897887",
"0.5894131",
"0.5892475",
"0.58804566",
"0.58537847",
"0.584507",
"0.5786632",
"0.57735384",
"0.5717349",
"0.5711476",
"0.57079613",
"0.570641... | 0.0 | -1 |
Determines direction to move in order to reach destination, updates position. | def move(self):
""" Responsible for transformations """
pos, com, success = self.perception
if self.destination is None:
return array([0,0])
if not self.awake:
return array([0,0])
if self.phase == 4 and self.proper_formation is not None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_direction(self, move : np.ndarray, direction: np.ndarray):\r\n pos = move.copy()\r\n \r\n\r\n pos += direction\r\n while(self.in_board(pos)):\r\n if self.board[pos[0],pos[1]] == self.turn:\r\n pos -= direction\r\n while((pos != move).a... | [
"0.71950465",
"0.7120677",
"0.7004255",
"0.69608396",
"0.69205225",
"0.6896144",
"0.6867089",
"0.68539006",
"0.68121046",
"0.67883736",
"0.67783445",
"0.6771105",
"0.67290074",
"0.6710701",
"0.6701133",
"0.66757804",
"0.66708946",
"0.66695404",
"0.6656035",
"0.6645383",
"0.66... | 0.0 | -1 |
Compute dot product between two 3D vectors | def dot(p, q):
return p[0] * q[0] + p[1] * q[1] + p[2] * q[2] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vector_dot(v1,v2):\n return (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z)",
"def dotproduct(first, other):\n if isinstance(first,FreeCAD.Vector) and isinstance(other,FreeCAD.Vector):\n return (first.x*other.x + first.y*other.y + first.z*other.z)",
"def dot(vector1, vector2):\n return sum(a1... | [
"0.8090836",
"0.78475004",
"0.77645427",
"0.77461874",
"0.7721537",
"0.76976633",
"0.7608635",
"0.7601",
"0.7558272",
"0.7531837",
"0.7516731",
"0.75085145",
"0.74894524",
"0.74887145",
"0.7469851",
"0.7425101",
"0.74227047",
"0.7348428",
"0.7340784",
"0.72996944",
"0.7295128... | 0.64720166 | 99 |
Compute cross product between two 3D vectors | def cross(p, q):
xyz = np.zeros(3)
xyz[0] = p[1] * q[2] - p[2] * q[1]
xyz[1] = p[2] * q[0] - p[0] * q[2]
xyz[2] = p[0] * q[1] - p[1] * q[0]
return xyz | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross_product(v1, v2):\n return cg3d_vector.CG3dVector(\n v1[1] * v2[2] - v2[1] * v1[2],\n v1[2] * v2[0] - v2[2] * v1[0],\n v1[0] * v2[1] - v2[0] * v1[1]\n )",
"def vector_cross(x, y):\n\n if(len(x) != len(y)):\n raise ValueError(\"vector lengths differ\")\n elif(len(x... | [
"0.8103337",
"0.79027957",
"0.7885802",
"0.7813807",
"0.7719637",
"0.77042264",
"0.7577648",
"0.75723106",
"0.7515589",
"0.7497018",
"0.7470461",
"0.73870635",
"0.73757094",
"0.73615724",
"0.7352729",
"0.7265235",
"0.72434634",
"0.7240499",
"0.72029793",
"0.71904427",
"0.7161... | 0.6824485 | 37 |
Compute a normalized 3D vector | def normalize(p):
return p / mod(p) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normal_vector_3p(a: Vector, b: Vector, c: Vector) -> Vector:\n return (b - a).cross(c - a).normalize()",
"def uVectNorm(x1,y1,z1, # P\n x2,y2,z2, # Q\n x3,y3,z3): # R\n p1 = np.array([x1,y1,z1])\n p2 = np.array([x2,y2,z2])\n p3 = np.array([x3,y3,z3])\n\n v1 = ... | [
"0.77412444",
"0.74230975",
"0.73903817",
"0.7362954",
"0.72049993",
"0.7191469",
"0.718338",
"0.7117203",
"0.7055314",
"0.7007513",
"0.69718647",
"0.69698656",
"0.6939706",
"0.6921109",
"0.6877194",
"0.6866537",
"0.6835702",
"0.68306947",
"0.6830219",
"0.67800635",
"0.677693... | 0.0 | -1 |
Return current day as number. | def get_current_day() -> int:
return datetime.now().day | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def currentDay(self):\n day = datetime.datetime.today().day\n return day",
"def current_day():\n now = pytz.timezone('America/Los_Angeles').localize(datetime.now())\n return now.strftime('%m/%d')",
"def get_current_day():\n current_day = datetime.now().strftime('%A').lower()\n return ... | [
"0.7832025",
"0.7698246",
"0.7563939",
"0.7450216",
"0.72606057",
"0.7248932",
"0.7248932",
"0.69822186",
"0.696409",
"0.69034994",
"0.69034994",
"0.69034994",
"0.6853649",
"0.6768469",
"0.6725069",
"0.6667248",
"0.6647424",
"0.65954626",
"0.6574029",
"0.65510964",
"0.6523883... | 0.8539054 | 0 |
Return current month as number. | def get_current_month() -> int:
return datetime.now().month | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCurrentMonth(self):\n return math.ceil((self.wcount % 48) / 4)",
"def month(self) -> int:\n if self.is_old_style:\n return int(self.split('/', 1)[1][2:4])\n return int(self[2:4])",
"def month(self):\n return 0",
"def month(self):\n return 0",
"def mm(sel... | [
"0.78995097",
"0.78582907",
"0.75367856",
"0.75367856",
"0.75338036",
"0.74623626",
"0.743875",
"0.74336714",
"0.74295276",
"0.7406147",
"0.73941314",
"0.7309636",
"0.7309636",
"0.7286668",
"0.70591694",
"0.7013933",
"0.699946",
"0.6975091",
"0.6952701",
"0.6941629",
"0.69406... | 0.88991773 | 0 |
Return string date in 'yyyymmdd' e.g. (20201130) format. | def get_date_today() -> str:
return datetime.now().strftime("%Y-%m-%d") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_string(date):\n day = date.day\n month = date.month\n year = date.year\n formatted_string = str(month) + \"/\"\n formatted_string += str(day) + \"/\"\n formatted_string += str(year)\n return formatted_string",
"def string_date(mnthDay, year):\n return(mnthDay + '/' + str(year))",... | [
"0.76417637",
"0.7372379",
"0.7328484",
"0.7010401",
"0.69705087",
"0.69670033",
"0.69419545",
"0.692285",
"0.69198996",
"0.68915015",
"0.6808143",
"0.6796693",
"0.6796693",
"0.67710483",
"0.674828",
"0.6694817",
"0.667185",
"0.665758",
"0.6634531",
"0.66313154",
"0.6588007",... | 0.0 | -1 |
Return string date in 'yyyymmddTH' e.g. (20201130T16) format. | def get_date_hour_today() -> str:
return datetime.now().strftime("%Y-%m-%dT%H") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_to_str(date):\r\n return datetime.strftime(date,'%Y-%m-%dT%H:%M:%S.%fZ')",
"def date_string(date):\n day = date.day\n month = date.month\n year = date.year\n formatted_string = str(month) + \"/\"\n formatted_string += str(day) + \"/\"\n formatted_string += str(year)\n return form... | [
"0.70045054",
"0.6882798",
"0.6876578",
"0.6876578",
"0.6826644",
"0.6754797",
"0.6682447",
"0.6567862",
"0.65463924",
"0.6528986",
"0.64985466",
"0.6461824",
"0.64501816",
"0.64395046",
"0.64333284",
"0.6410861",
"0.6402744",
"0.63686323",
"0.63595337",
"0.63001245",
"0.6299... | 0.0 | -1 |
Return string date in 'H' e.g. (06) format. | def get_hour_today() -> str:
return datetime.now().strftime("%H") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hour(self):\n return \"%s:00:00\" % self.timestamp[:13]",
"def date_hour(date):\n return date.hour",
"def get_date_hour_today() -> str:\n return datetime.now().strftime(\"%Y-%m-%dT%H\")",
"def get_hour(date, padded_or_unpadded):\n if padded_or_unpadded == constants.str_padded:\n ... | [
"0.7201951",
"0.71303594",
"0.7073183",
"0.68254966",
"0.6661948",
"0.66102904",
"0.65942734",
"0.65611005",
"0.6519982",
"0.64330316",
"0.6351658",
"0.6327947",
"0.63234544",
"0.6298525",
"0.62935674",
"0.6293257",
"0.6200631",
"0.6200403",
"0.61484385",
"0.6144774",
"0.6138... | 0.73707604 | 0 |
Returns document completion perplexity. | def get_completion_ppl(source):
model.eval()
with torch.no_grad():
alpha = model.mu_q_alpha # KxTxL
if source == 'val':
indices = torch.split(torch.tensor(range(args.num_docs_valid)), args.eval_batch_size)
tokens = valid_tokens
counts = valid_count... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perplexity(self):\n\n\t\treturn samplers_lda.perplexity_comp(self.docid,self.tokens,self.tt,self.dt,self.N,self.K,self.samples)",
"def perplexity(self):\n\n\t\treturn samplers_lda.perplexity_comp(self.docid,self.tokens,self.tt,self.dt,self.N,self.K,self.samples)",
"def prob(self):\n\t\treturn self._prob",
... | [
"0.72221684",
"0.72221684",
"0.64251393",
"0.63527524",
"0.6301057",
"0.62804747",
"0.62099826",
"0.6185874",
"0.6162379",
"0.60987735",
"0.6092864",
"0.6059738",
"0.59754694",
"0.59229374",
"0.5863914",
"0.58484244",
"0.57992524",
"0.57937574",
"0.57577825",
"0.5757623",
"0.... | 0.5608711 | 25 |
Adds missing information to a list. This can be used to add missing job information fields to the results of job querying tool. | def add_missing(linelist, insertion_dict):
# Get the order of indices
# add missing information
# starting from largest to
# smallest, if we insert
# missing values in this
# order we do not need to
# calculate the offset of
# new indices
tmp_list = linelist
indices = sorted(l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_missing_cols(user_list, fields=None):\n new_list = []\n required_cols = ['type', 'id', 'view_href', 'login']\n\n # Add any defined fields to the list of required columns\n if fields and fields != '*':\n parsed_fields = fields.split(',')\n for field in parsed_fields:\n ... | [
"0.61569077",
"0.5763466",
"0.552023",
"0.5510023",
"0.5504416",
"0.54474604",
"0.54248095",
"0.5398749",
"0.5391871",
"0.53909117",
"0.5379395",
"0.53590536",
"0.5347512",
"0.53119934",
"0.52795744",
"0.524543",
"0.5217593",
"0.5217417",
"0.5203157",
"0.51984453",
"0.5162059... | 0.58193237 | 1 |
Close the connection, if possible. | def close(self):
log.debug('Closing device: {0}'.format(self.name))
if self.driver in [drivers.pyvisa, drivers.pyvisa_usb]:
self.device.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_connection(self):\n self.connection.close()",
"def close_connection(self):\n self.connection.close()",
"def close_connection(self):\n if self.connection is not None:\n self.connection.close()",
"def close_connection(self):\n self.conn.close()",
"def close_co... | [
"0.85302645",
"0.85302645",
"0.85160613",
"0.84996635",
"0.8480493",
"0.84741545",
"0.84672797",
"0.84468865",
"0.83166665",
"0.831423",
"0.831423",
"0.831423",
"0.831423",
"0.831423",
"0.831423",
"0.831423",
"0.8288402",
"0.8286382",
"0.82851845",
"0.8282252",
"0.8278086",
... | 0.0 | -1 |
Retruns the yaml of the data | def yaml(self):
return str(self.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yaml(self):\n raise NotImplementedError",
"def DumpYaml(data):\n #NOTE(g): Import is done here, instead of the top of the file, to not require this module if it is not used\n import yaml\n \n text = yaml.safe_dump(data)\n \n return text",
"def decode(self,data):\n import yaml\n r... | [
"0.7206403",
"0.7046547",
"0.70099366",
"0.6988719",
"0.69616944",
"0.69011605",
"0.6765352",
"0.66901034",
"0.66821486",
"0.66179407",
"0.6606902",
"0.6557288",
"0.64570737",
"0.64274263",
"0.634616",
"0.63180554",
"0.62997705",
"0.62422305",
"0.6241031",
"0.62246627",
"0.62... | 0.76356715 | 0 |
Tensorflow using the RMSProp optimization algorithm | def create_RMSProp_op(loss, alpha, beta2, epsilon):
return tf.train.RMSPropOptimizer(
learning_rate=alpha,
decay=beta2,
epsilon=epsilon
).minimize(loss) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_RMSProp_op(loss, alpha, beta2, epsilon):\n return tf.train.RMSPropOptimizer(alpha, beta2, epsilon=epsilon).minimize(loss)",
"def rmsprop_optim(config = None, global_step = None):\n learning_rate = config[\"learning_rate\"]\n\n decay = config.get('decay', 0.9)\n momentum = config... | [
"0.70355904",
"0.6935636",
"0.66741586",
"0.6454449",
"0.6373871",
"0.62997806",
"0.62768584",
"0.6254815",
"0.624555",
"0.6234791",
"0.622137",
"0.61497647",
"0.61417866",
"0.61307657",
"0.6124849",
"0.61246353",
"0.61232775",
"0.61048067",
"0.6093293",
"0.6085184",
"0.60820... | 0.68741876 | 2 |
Returns all grid models of the current grid. If modeldirs is not ` Assumes that I am already in the grid directory. | def get_modeldirs(modeldirs):
if modeldirs is None:
modeldirs=glob.glob("model*/")
return modeldirs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_model_dirs(experiment_dir):\r\n model_dirs = glob.glob(os.path.join(experiment_dir,\"*\"), recursive=False)\r\n return None if len(model_dirs) == 0 else model_dirs",
"def get_model_dirs():\n model_dir = \"/phoenix/S7/js2625/SIGGRAPH_InsertHuman/desktopmini/\"\n all_dirs = {\n \"sel... | [
"0.7053075",
"0.68980974",
"0.67919797",
"0.66318244",
"0.62806666",
"0.62711096",
"0.621682",
"0.6151818",
"0.6007908",
"0.5958469",
"0.595824",
"0.58985054",
"0.58618265",
"0.58461744",
"0.57800126",
"0.5763753",
"0.5742071",
"0.57213265",
"0.57123715",
"0.5709536",
"0.5692... | 0.7442874 | 0 |
A view to render the shopping bag | def view_bag(request):
template = 'bag/bag.html'
return render(request, template) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_shoppingbag(request):\n\n return render(request, 'shoppingbag/shoppingbag.html')",
"def view_bag(request):\n\n return render(request, 'bag/bag.html')",
"def view_bag(request):\n\n return render(request, 'bag/bag.html')",
"def view_basket(request):\n\n return render(request, 'basket/baske... | [
"0.83766514",
"0.8092587",
"0.8092587",
"0.8082786",
"0.807134",
"0.73823965",
"0.73307675",
"0.7145757",
"0.7088831",
"0.6972061",
"0.6972061",
"0.6972061",
"0.6945152",
"0.6945152",
"0.6714977",
"0.6689123",
"0.660397",
"0.6504932",
"0.64909273",
"0.6476028",
"0.6456895",
... | 0.7978012 | 5 |
Given a list of state action pairs, use the learned model to predict the next state | def predict_next_state_model(self, states, actions):
# TODO: write your code here
# states.shape = (200, 6, 8)
# actions.shape = (200, 2)
a = np.tile(actions, (6, 1, 1)).transpose(1, 0, 2)
# return self.model.main(np.concatenate((states, np.tile(actions, (self.num_particles, 1)))... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(self, state, action):\n assert np.shape(state) == (self._state_dim,)\n assert np.shape(action) == (self._action_dim,)\n\n ### PROBLEM 1\n ### YOUR CODE HERE\n # raise NotImplementedError\n next_state_pred = self._sess.run(self._next_state_pred,\n ... | [
"0.7334729",
"0.71136075",
"0.6919382",
"0.6916469",
"0.6891851",
"0.687725",
"0.66881096",
"0.6644882",
"0.6641771",
"0.66334605",
"0.6452135",
"0.64520305",
"0.64473796",
"0.64385146",
"0.63713205",
"0.63209873",
"0.63184106",
"0.6266997",
"0.62402624",
"0.62192816",
"0.620... | 0.739503 | 0 |
separated with ',' if it is a list | def extend_result(val):
if isinstance(val, list):
return ','.join(val)
return val | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sqllist(lst):\n if isinstance(lst, basestring): \n return lst\n else:\n return ', '.join(lst)",
"def separate_comma(s):\n return s.split(',')",
"def listify(item, do_strip=False):\n if not item:\n return []\n elif isinstance(item, list):\n return item\n elif is... | [
"0.6970004",
"0.6920827",
"0.6884871",
"0.68636996",
"0.67801833",
"0.6758223",
"0.664391",
"0.6633456",
"0.6537686",
"0.65375674",
"0.6444197",
"0.6434299",
"0.64318687",
"0.63757527",
"0.63571537",
"0.63571537",
"0.63470566",
"0.63334095",
"0.62992203",
"0.6261018",
"0.6216... | 0.66022795 | 8 |
Return value from loaded config parse object | def get_value(self, in_section=str(), in_key=str()) -> Any:
if in_section in self.__return_map.keys():
if in_key in self.__return_map.get(in_section).keys():
return self.__return_map.get(in_section).get(in_key)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_value(self, value_name, default=None):\n\t\treturn self.cfg_root.find(value_name).text",
"def get_config(self,config):\n return self.parser.get(\"main\", config)",
"def _get_config_value(self, section, key):\n return config.get(section, key)",
"def _GetConfigValue(self, config_parser,... | [
"0.7074828",
"0.69428384",
"0.6898915",
"0.6835497",
"0.6824046",
"0.6686376",
"0.6649829",
"0.6547928",
"0.64402115",
"0.6425939",
"0.6374655",
"0.6357684",
"0.6324625",
"0.63201064",
"0.62858766",
"0.62801355",
"0.6252276",
"0.62328666",
"0.6224163",
"0.6204692",
"0.6195150... | 0.0 | -1 |
Pack an integer value to a given bit size, endianness. | def pack(value: int, size: int = None, endian: str = "little") -> bytes:
size = ((size or value.bit_length()) + 7) // 8
return value.to_bytes(size, ENDIANNESS_MAP.get(endian, endian), signed=value < 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intPackBytes(n, length, endian='big'):\r\n \r\n if length == 0:\r\n return ''\r\n h = '%x' % n\r\n # There must be a better way to do this\r\n s = unhexlify(str.zfill(('0'*(len(h) % 2) + h), length*2))\r\n if endian == 'big':\r\n return s\r\n else:\r\n #return s[::-1]\... | [
"0.7280908",
"0.70621485",
"0.68198967",
"0.6758098",
"0.66834956",
"0.6658649",
"0.6631593",
"0.66045964",
"0.65491796",
"0.6494534",
"0.6466401",
"0.64182144",
"0.6377249",
"0.6277731",
"0.62065744",
"0.62065744",
"0.62030053",
"0.6160807",
"0.6155434",
"0.6138563",
"0.6130... | 0.7982378 | 0 |
Unpack an integer value from a given bit size, endianness and sign. | def unpack(value: bytes, size: int = None, endian: str = "little", sign: bool = False) -> int:
if size and len(value) != size // 8:
raise ValueError(f"Invalid byte value, expected {size // 8} bytes, got {len(value)} bytes")
return int.from_bytes(value, ENDIANNESS_MAP.get(endian, endian), signed=sign) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_signed_integer(num: int, size: int) -> int:\n if (num & (1 << (size - 1))) != 0:\n num = num - (1 << size)\n return num",
"def u32(value: bytes, endian: str = \"little\", sign: bool = False) -> int:\n return unpack(value, 32, endian, sign)",
"def u8(value: bytes, endian: str = \"litt... | [
"0.6857343",
"0.680659",
"0.68064445",
"0.65228003",
"0.6518913",
"0.6509395",
"0.646576",
"0.6419733",
"0.6406119",
"0.63564014",
"0.6354006",
"0.6299672",
"0.6299672",
"0.62629414",
"0.62267625",
"0.62167794",
"0.62075686",
"0.61945957",
"0.61538756",
"0.61486495",
"0.61023... | 0.810238 | 0 |
Pack an 8 bit integer. | def p8(value: int, endian: str = "little") -> bytes:
return pack(value, 8, endian) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pack(cls, le_unsigned_int, size):\n output = bytes()\n for i in range(size):\n output += chr((le_unsigned_int >> (i*8)) & 0xFF)\n return output",
"def add_int8(self, value):\n self._check_int_type(value, _INT_1BYTE_UPPERLIMIT)\n self._data += value.to_bytes(1, by... | [
"0.7046584",
"0.6897851",
"0.68792325",
"0.6824422",
"0.67807204",
"0.67671525",
"0.66727024",
"0.6659027",
"0.66280055",
"0.64931417",
"0.6465225",
"0.6465225",
"0.64620644",
"0.64312667",
"0.63673884",
"0.63534534",
"0.6345154",
"0.63389945",
"0.6318693",
"0.6279374",
"0.61... | 0.72705007 | 0 |
Pack a 32 bit integer. | def p32(value: int, endian: str = "little") -> bytes:
return pack(value, 32, endian) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def p32(d):\n return pack('<I', d)",
"def pack_ssh_uint32(i):\n if not isinstance(i, int):\n raise TypeError(\"Must be an int\")\n elif i.bit_length() > 32:\n raise ValueError(\"Must be a 32bit value.\")\n\n return struct.pack('>I', i)",
"def int32_t(n):\n return int(n).to_bytes(4,... | [
"0.7592303",
"0.7567268",
"0.71953094",
"0.70938027",
"0.70248276",
"0.6998517",
"0.6885194",
"0.6862962",
"0.6834466",
"0.6683471",
"0.6512142",
"0.6453835",
"0.64421433",
"0.64307445",
"0.6412586",
"0.6406492",
"0.6399777",
"0.6363492",
"0.6296119",
"0.6284684",
"0.62777126... | 0.7446849 | 2 |
Pack a 64 bit integer. | def p64(value: int, endian: str = "little") -> bytes:
return pack(value, 64, endian) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pack_ssh_uint64(i):\n if not isinstance(i, int):\n raise TypeError(\"Must be an int\")\n elif i.bit_length() > 64:\n raise ValueError(\"Must be a 64bit value.\")\n\n return struct.pack('>Q', i)",
"def pack_uint64(data: int) -> bytes:\n return struct.pack(\">Q\", data)",
"def pack_... | [
"0.782995",
"0.75985986",
"0.75985986",
"0.6882611",
"0.687953",
"0.6686652",
"0.6666189",
"0.6591661",
"0.64130855",
"0.6355326",
"0.629442",
"0.6260369",
"0.62123847",
"0.61003375",
"0.60895044",
"0.6087873",
"0.60762006",
"0.6039183",
"0.6010608",
"0.5993446",
"0.59870344"... | 0.74698687 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.