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 |
|---|---|---|---|---|---|---|
Constructor creates a Student with the given | def __init__(self, name, address, phone, badge, salary):
self.name = name
self.address = address
self.phone = phone
self.badge = badge
self.salary = salary | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, student):\n pass",
"def __init__(self, \n student_id=0,\n # - Arguments from Person\n given_name=None, initials=None, family_name=None, \n email_address=None,\n # - Other student-specific arguments\n major=None, minor=None\n ):\n # - We ... | [
"0.8175241",
"0.73821163",
"0.7330379",
"0.7246287",
"0.71303475",
"0.71166277",
"0.7045335",
"0.70142347",
"0.7010421",
"0.69444036",
"0.653866",
"0.6531949",
"0.6506792",
"0.64977247",
"0.64163667",
"0.6397651",
"0.636888",
"0.635841",
"0.6354553",
"0.63195556",
"0.62822056... | 0.5653275 | 84 |
Constructor creates a Student with the given | def __init__(self, name, address, phone, credit_score):
self.name = name
self.address = address
self.phone = phone
self.credit_score = credit_score | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, student):\n pass",
"def __init__(self, \n student_id=0,\n # - Arguments from Person\n given_name=None, initials=None, family_name=None, \n email_address=None,\n # - Other student-specific arguments\n major=None, minor=None\n ):\n # - We ... | [
"0.8175241",
"0.73821163",
"0.7330379",
"0.7246287",
"0.71303475",
"0.71166277",
"0.7045335",
"0.70142347",
"0.7010421",
"0.69444036",
"0.653866",
"0.6531949",
"0.6506792",
"0.64977247",
"0.64163667",
"0.6397651",
"0.636888",
"0.635841",
"0.6354553",
"0.63195556",
"0.62822056... | 0.5632564 | 87 |
Before each test, set up a blank database | def setUp(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n db.create_all()",
"def setUp(self):\n INFLUX_DB_NAME = 'test_device_parameters'\n EmptyDBTestCase.client.create_database(INFLUX_DB_NAME)\n EmptyDBTestCase.client.drop_database(INFLUX_DB_NAME)\n EmptyDBTestCase.client.create_database(INFLUX_DB_NAME)",
"def s... | [
"0.8485115",
"0.84793895",
"0.8400763",
"0.83230376",
"0.83083314",
"0.8287565",
"0.8273245",
"0.82683206",
"0.8126879",
"0.8099652",
"0.8043167",
"0.80197555",
"0.799406",
"0.79835945",
"0.7974262",
"0.7973118",
"0.7973118",
"0.7973118",
"0.79669046",
"0.7962371",
"0.7959146... | 0.0 | -1 |
Get rid of the database again after each test. | def tearDown(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self):\n app.db.drop_database('local')\n app.db.close()",
"def tearDown(self):\n os.close(self.db_fd)\n os.unlink(mainPyUnit.app.config['DATABASE'])",
"def tearDown(self):\n os.close(self.db_fd)\n os.unlink(pegasus.app.config['DATABASE'])",
"def tearDown... | [
"0.86209536",
"0.8521085",
"0.8520593",
"0.85064954",
"0.85023004",
"0.84577495",
"0.84451497",
"0.8429183",
"0.83997536",
"0.83997536",
"0.83261764",
"0.83261764",
"0.83261764",
"0.83261764",
"0.83261764",
"0.83261764",
"0.83261764",
"0.83261764",
"0.83261764",
"0.8300387",
... | 0.0 | -1 |
Return a string representation of this node. | def __repr__(self):
return 'Node({!r})'.format(self.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n # string representation includes values of all inner fields\n return \\\n \"Node Name: \" + str(self.name) + \"\\n\" + \\\n \"Node Attributes: \" + str(self.attributes) + \"\\n\" + \\\n \"Incident Edges: \" + \"\\n\".join([edge.__str__() for edge ... | [
"0.8419997",
"0.8419997",
"0.83776826",
"0.8269382",
"0.8184696",
"0.80788714",
"0.8058018",
"0.8053133",
"0.80380356",
"0.80278444",
"0.79955876",
"0.7984415",
"0.79592586",
"0.7951212",
"0.79343784",
"0.7851074",
"0.78425443",
"0.77816874",
"0.7767478",
"0.7750534",
"0.7744... | 0.7997889 | 10 |
Return a formatted string representation of this linked list. | def __str__(self):
items = ['({!r})'.format(item) for item in self.items()]
return '[{}]'.format(' -> '.join(items)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n s = \"\"\n current = self.__head\n while current:\n s += str(current.data) + \"\\n\"\n current = current.next_node\n return s[:-1]",
"def __str__(self):\n reprStr = ''\n currNode = self.head\n while currNode:\n ... | [
"0.8223627",
"0.82052064",
"0.81713456",
"0.80964243",
"0.8016123",
"0.8005989",
"0.7960778",
"0.79453343",
"0.7908749",
"0.78937936",
"0.78937936",
"0.78014",
"0.7795533",
"0.77766967",
"0.77601224",
"0.7717616",
"0.77135706",
"0.7669741",
"0.7664745",
"0.76581746",
"0.76563... | 0.7245677 | 52 |
Return a string representation of this linked list. | def __repr__(self):
return 'LinkedList({!r})'.format(self.items()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n s = \"\"\n current = self.__head\n while current:\n s += str(current.data) + \"\\n\"\n current = current.next_node\n return s[:-1]",
"def __str__(self):\n string = \"\"\n cur_node = self.head\n while cur_node is not None:... | [
"0.86141527",
"0.8489249",
"0.84454364",
"0.8432599",
"0.83055216",
"0.8209462",
"0.81824136",
"0.8117703",
"0.8117703",
"0.81016237",
"0.8083341",
"0.8069775",
"0.80505306",
"0.80505306",
"0.80502987",
"0.79909486",
"0.7959843",
"0.79049003",
"0.7884907",
"0.7850305",
"0.781... | 0.7830624 | 20 |
Insert the given item at the tail of this linked list. | def append(self, item):
new_node = Node(item)
if self.tail is not None:
self.tail.next = new_node
if self.head is None:
self.head = new_node
self.tail = new_node | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, item):\n # must keep two pointers marching\n # in synch down the list.\n current = self._head\n previous = None\n while current != None:\n if current.getData() > item:\n # we’ve reached the insertion spot\n break\n ... | [
"0.74096453",
"0.7281566",
"0.71775335",
"0.7020662",
"0.6969854",
"0.69203764",
"0.68957627",
"0.6863288",
"0.67639065",
"0.67633396",
"0.67305833",
"0.6698118",
"0.66724896",
"0.6652329",
"0.6597929",
"0.6549644",
"0.6539878",
"0.6539461",
"0.6536598",
"0.65363365",
"0.6513... | 0.72416306 | 2 |
determines if the val is an instance of 'number' or could be coerced to a 'number' from a string | def could_be_number(val):
if val == None:
return False
if isinstance(val, (float, int, long)):
return True
# allow coercion from str
if isinstance(val, (str, unicode)):
try:
n = float(val)
if not isinstance(n, float):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_number(value):\n\n return isinstance(value, (int, long, float))",
"def is_numeric(val):\n if \\\n isinstance(val, int) or \\\n isinstance(val, float):\n return True\n elif \\\n isinstance(val, str) and \\\n val.isdigit():\n return True\n else:\n return False",
"def is_... | [
"0.7805237",
"0.7788727",
"0.7657477",
"0.7625354",
"0.76231873",
"0.7598105",
"0.7564752",
"0.7556316",
"0.7509336",
"0.747881",
"0.74706477",
"0.7458808",
"0.7457703",
"0.7457703",
"0.7457703",
"0.7454706",
"0.74527556",
"0.7448612",
"0.7443866",
"0.7428993",
"0.7422283",
... | 0.8280522 | 0 |
This function returns first task in the queue. | def get_previous_task():
return _tasks[0] if len(_tasks) != 0 else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first(self) -> Task:\n return self._tasks[0]",
"def get_task(self):\n return self.queue.get()",
"def next(self) -> Optional[Task]:\n if len(self._pending_tasks) == 0:\n return None\n else:\n task = self._pending_tasks.pop(0)\n task.status = 'Runn... | [
"0.8088058",
"0.7563741",
"0.74368393",
"0.7244635",
"0.7183162",
"0.7162328",
"0.7162328",
"0.7148383",
"0.70829934",
"0.70660627",
"0.7063911",
"0.70382774",
"0.70149535",
"0.6994051",
"0.69564044",
"0.69375604",
"0.69240844",
"0.69167566",
"0.6889961",
"0.6884245",
"0.6861... | 0.7128326 | 8 |
This function gets current date and time and formats the information as per database requirement | def get_date_time():
d = datetime.datetime.now().date()
t = datetime.datetime.now().time()
date = str(d.day) + '-' + str(d.month) + '-' + str(d.year)
time = str(t.hour) + ':' + str(t.minute)
date_time = date + ' ' + time
return date_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_date(self):\r\n from datetime import date\r\n from datetime import datetime\r\n\r\n self.today = date.today() # Output is: 2020-05-19\r\n # Need to change that in a format 19/05/2020\r\n self.today_format = self.today.strftime(\"%d/%m/%Y\") #Output is: 19/05/2020\r\n\r\n... | [
"0.73591566",
"0.71368736",
"0.70188415",
"0.6989726",
"0.6978327",
"0.69075817",
"0.6906246",
"0.69004005",
"0.6870831",
"0.6865291",
"0.68156046",
"0.67911416",
"0.67764693",
"0.6773072",
"0.67633617",
"0.6735929",
"0.67304957",
"0.67297184",
"0.6702076",
"0.66900206",
"0.6... | 0.0 | -1 |
load config yaml for init conf | def _set_config():
debug_msg = "load default config yaml file"
logger.debug(debug_msg)
config_file_parser(paths.CONFIG_FILE, override_options=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_config():\n global config\n with open('config.yml', 'r') as file:\n config = yaml.load(file)",
"def load_config(filename):\n AS[\"config\"] = load_yaml_file(filename)",
"def load_config():\n proj_dir = os.path.dirname(os.path.abspath(__file__))\n config_path = os.path.join(proj_dir, \"co... | [
"0.7495559",
"0.74346924",
"0.7380398",
"0.7361264",
"0.71838397",
"0.7144372",
"0.71360755",
"0.7128993",
"0.70183486",
"0.7012574",
"0.69814855",
"0.68829703",
"0.6848464",
"0.68450963",
"0.6811962",
"0.6802255",
"0.6799089",
"0.67891073",
"0.67850566",
"0.6743529",
"0.6735... | 0.7356091 | 4 |
Set form name and request. | def __init__(self, form_name, request, relative_forms):
super(RelativeView, self).__init__(form_name, request)
# set relative forms's names
self.relative_forms = relative_forms
self.relative_data = {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_request(self, request):\n self._request = request",
"def set_form(self, form):\n self.parameters = form",
"def __init__(self, request, name) :\n self.request = request\n self.name = name",
"def __init__(self, form_name, request):\n self.form_name = form_name\n ... | [
"0.62601274",
"0.62442327",
"0.6212198",
"0.6068809",
"0.6053672",
"0.6020958",
"0.59471333",
"0.59471333",
"0.5931262",
"0.5931262",
"0.58834946",
"0.5880581",
"0.58429086",
"0.58370835",
"0.58370835",
"0.58370835",
"0.58370835",
"0.58287",
"0.580328",
"0.57515174",
"0.57491... | 0.5640617 | 27 |
Get the RigidBody attached to the collider | def rb_attached(self):
return self._rb | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_collision(self):\n if self.world is None:\n return None\n\n for entity in self.world.sprites():\n if self is entity:\n continue\n if self.get_rect().colliderect(entity.get_rect()):\n return entity\n return None",
"def col... | [
"0.59143347",
"0.5771234",
"0.54321885",
"0.52433985",
"0.5228752",
"0.51512593",
"0.512858",
"0.5126659",
"0.4973642",
"0.49704",
"0.4950183",
"0.49384645",
"0.49311158",
"0.49311158",
"0.4927872",
"0.48625037",
"0.48479164",
"0.48274207",
"0.47898287",
"0.47856474",
"0.4779... | 0.47504735 | 23 |
Change the 'Box' Value of the Collider | def setBox(self, box: Vector):
if not isinstance(box, Vector):
raise TypeError("Box Property should be a vector")
if self._fixture is not None:
while kge.Physics.world.locked:
continue
self._box = box
self._fixture.shape.box = *s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_box(self, box=0.0):\n self.box = box",
"def ct_slider_value_changed(self):\n for (x, slider) in enumerate(self.sliders):\n # for x in range(0, len(self.sliders)):\n # slider = self.sliders[x]\n slider_value = float(slider.value()) / float(slider.maximum())\n ... | [
"0.6868854",
"0.60540414",
"0.60088193",
"0.59526867",
"0.5921775",
"0.5914926",
"0.59024644",
"0.5891898",
"0.5886626",
"0.5830497",
"0.58262247",
"0.5757698",
"0.57031584",
"0.5687565",
"0.5679468",
"0.56794053",
"0.566042",
"0.5655814",
"0.56456107",
"0.5638671",
"0.560979... | 0.6361842 | 1 |
set the level of leverage for a market | async def set_leverage(self, leverage, symbol: Optional[str] = None, params={}):
if symbol is None:
raise ArgumentsRequired(self.id + ' setLeverage() requires a symbol argument')
if (leverage < 0.01) or (leverage > 100):
raise BadRequest(self.id + ' leverage should be between 0.0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_food_level(self, amount):\n self.plant = amount",
"def update_fuel_level(self, new_level):\n if new_level <= self.fuel_capacity:\n self.fuel_level = new_level\n else:\n print(\"The tank can't hold that much!\")",
"def add_to_water_level(self, amount):\n ... | [
"0.7152359",
"0.6260298",
"0.62460417",
"0.6240798",
"0.61622006",
"0.615288",
"0.61304337",
"0.6111745",
"0.607145",
"0.6069936",
"0.60427296",
"0.6025233",
"0.59582335",
"0.58774936",
"0.58774936",
"0.58774936",
"0.5854171",
"0.58412504",
"0.58220273",
"0.5815192",
"0.57973... | 0.68952924 | 1 |
set margin mode to 'cross' or 'isolated' | async def set_margin_mode(self, marginMode, symbol: Optional[str] = None, params={}):
if symbol is None:
raise ArgumentsRequired(self.id + ' setMarginMode() requires a symbol argument')
marginMode = marginMode.lower()
if marginMode != 'isolated' and marginMode != 'cross':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_margin(self, margin):\n self.margin = margin * self._MM_IN_MICRONS\n\n self._create_drawing_area()\n self.partition(self.rows, self.cols)",
"def set_margin(self, margin):\n _pal.lib.geometry_set_margin(self._geometry, c.c_float(margin))",
"def margin(self):\r\n ret... | [
"0.64773035",
"0.64491284",
"0.6240265",
"0.6064062",
"0.5833248",
"0.5812005",
"0.56422246",
"0.56321394",
"0.56112075",
"0.5591257",
"0.55682397",
"0.55152476",
"0.542555",
"0.542321",
"0.5351552",
"0.53115773",
"0.5260335",
"0.51749176",
"0.516156",
"0.51586515",
"0.513260... | 0.67064786 | 0 |
Creates a new LinesClassifier for the given and . should be a list of (startpoint, endpoint) tuples. If preimages=True is set, preimages of the endpoints of each classification region will be returned (otherwise, only the ratio between startpoint and endpoint will be). | def __init__(self, network, lines, preimages=True):
self.network = network
self.lines = lines
self.preimages = preimages
self.partially_computed = False
self.transformed_lines = None
self.computed = False
self.classifications = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, lines, img=False):\n self.grid = []\n self.bingrid = []\n self.edges = []\n self.neighbors = []\n self.parse(lines)\n if not img:\n self.find_edges()",
"def from_lines(cls, lines: List[str], mode: str):\n for line in lines:\n ... | [
"0.5744178",
"0.56548697",
"0.55664486",
"0.5536467",
"0.55305874",
"0.5527134",
"0.5391128",
"0.5385135",
"0.52715325",
"0.5270974",
"0.5214079",
"0.5187316",
"0.5181916",
"0.5177925",
"0.51689535",
"0.5146106",
"0.5138465",
"0.5122562",
"0.5118466",
"0.511814",
"0.5116213",... | 0.6668736 | 0 |
Get dataframe from a gzip file. | def get_data_frame_from_gzip_file(self, path):
i = 0
df = {}
for d in self.parse_gzip_file(path):
df[i] = d
i += 1
return pd.DataFrame.from_dict(df, orient="index") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load() -> DataFrame:\n return load_file(__file__, \"default.csv.gz\")",
"def parse(self):\n if self.filename.endswith('.gz'):\n compression = 'gzip'\n elif self.filename.endswith('.bz2'):\n compression = 'bz2'\n else:\n compression = None\n df =... | [
"0.74674976",
"0.6905577",
"0.6809279",
"0.6794949",
"0.6529693",
"0.6425484",
"0.64170736",
"0.64164203",
"0.63821334",
"0.6381365",
"0.6381365",
"0.6307134",
"0.62433326",
"0.6240168",
"0.6204149",
"0.6162462",
"0.6148488",
"0.61268944",
"0.61135066",
"0.6055101",
"0.602836... | 0.8608488 | 0 |
Sets the challenge_id of this ArchivedShard. | def challenge_id(self, challenge_id):
self._challenge_id = challenge_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def challenge(self, challenge):\n\n self._challenge = challenge",
"def challenge_id(self):\n return self._challenge_id",
"def hash_id(self, hash_id):\n\n self._hash_id = hash_id",
"def challenge_response(self, challenge_response):\n\n self._challenge_response = challenge_response"... | [
"0.69183207",
"0.61403036",
"0.590898",
"0.58608437",
"0.57689613",
"0.5710538",
"0.5567522",
"0.54344684",
"0.54204166",
"0.53550076",
"0.5262053",
"0.5230635",
"0.51787686",
"0.51685065",
"0.51565886",
"0.5151081",
"0.5151081",
"0.5151081",
"0.51440936",
"0.51433957",
"0.51... | 0.81057924 | 1 |
Sets the shard of this ArchivedShard. | def shard(self, shard):
self._shard = shard | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_shard(self, shard_id):\n\n q = self._clone()\n q._shard_id = shard_id\n return q",
"def shard(self):\n return self._shard",
"def board(self, board):\n\n self._board = board",
"def district(self, district):\n\n self._district = district",
"def district(self,... | [
"0.7178316",
"0.5542228",
"0.536479",
"0.5286505",
"0.5286505",
"0.5270397",
"0.5270397",
"0.5251564",
"0.5198782",
"0.51604134",
"0.5137391",
"0.5137391",
"0.5137391",
"0.5137391",
"0.513079",
"0.5116068",
"0.5039062",
"0.50343937",
"0.5014031",
"0.4982235",
"0.4975716",
"... | 0.85514003 | 0 |
Sets the archive_name of this ArchivedShard. | def archive_name(self, archive_name):
self._archive_name = archive_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_archive_name(self, archive_name):\n self._basket.set_archive_name(archive_name)",
"def set_batch_archive_name(self, archive_name):\n self._basket.set_batch_archive_name(archive_name)",
"def journal_name(self, journal_name):\n\n self._journal_name = journal_name",
"def set_name(se... | [
"0.8252741",
"0.76309353",
"0.58956355",
"0.5698252",
"0.5519945",
"0.54962695",
"0.5493831",
"0.5492752",
"0.5492752",
"0.5487851",
"0.5485356",
"0.54771686",
"0.5465053",
"0.54631066",
"0.54502374",
"0.54353017",
"0.5431204",
"0.54205084",
"0.53980386",
"0.53980386",
"0.539... | 0.85248536 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, ArchivedShard):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, ArchivedShard):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8455985",
"0.83913255",
"0.81440157",
"0.8140831",
"0.8132328",
"0.80937284",
"0.809181",
"0.809181",
"0.809181",
"0.808509",
"0.808509",
"0.8076134",
"0.8076134",
"0.8065528",
"0.80422795",
"0.80422795",
"0.80422795",
"0.80422795",
"0.80422795",
"0.80422795",
"0.80422795"... | 0.0 | -1 |
Read training Spark DataFrame. | def read_train_data(spark_session, sample_size, channels, sample_prob=1, normalize_class_distribution=False, seed=42):
filename = "train_{}{}{}_updated.parquet"
train_df = read_data(spark_session, filename, sample_size, channels, sample_prob, normalize_class_distribution, seed)
return train_df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_val_data(spark_session, sample_size, channels, sample_prob=1, normalize_class_distribution=False, seed=42):\n filename = \"val_{}{}{}_updated.parquet\"\n train_df = read_data(spark_session, filename, sample_size, channels, sample_prob, normalize_class_distribution, seed)\n return train_df",
"def impo... | [
"0.6726411",
"0.65617955",
"0.64648056",
"0.63894486",
"0.63849306",
"0.6362035",
"0.63543874",
"0.62947494",
"0.628969",
"0.6255469",
"0.62545455",
"0.6230773",
"0.62285984",
"0.6226374",
"0.6194892",
"0.61948484",
"0.61708164",
"0.61390954",
"0.6095433",
"0.6084922",
"0.606... | 0.7298192 | 0 |
Returns dictionary of stellar parameters. | def properties(self):
dict = {"Host Name":self.host, "Stellar Mass":self.st_mass,
"Stellar Radius":self.st_rad}
return dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_params(self):\n return {\n \"nspecies\": self.nspecies,\n \"lmax\": self.lmax,\n \"nmax\": self.nmax,\n \"rcut\": self.rcut,\n \"sigma\": self.sigma,\n \"trans_width\": self.trans_width\n }",
"def get_params(self):\n ... | [
"0.7028821",
"0.70265335",
"0.70054066",
"0.678736",
"0.6773889",
"0.66515714",
"0.6641961",
"0.66390634",
"0.6615769",
"0.6601878",
"0.6556185",
"0.65206796",
"0.6490223",
"0.64347315",
"0.63699204",
"0.6369799",
"0.6357316",
"0.63493824",
"0.6322621",
"0.6321861",
"0.628251... | 0.67821205 | 4 |
Returns a dictionary of errors on stellar parameters. | def errors(self):
dict = {"Stellar Mass Error":[self.st_masserr1,self.st_masserr2],
"Stellar Radius Error":[self.st_raderr1,self.st_raderr2]}
return dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fXY_std_errs(self) -> Dict[Tuple[int, ...], Optional[float]]:\n return {tuple(es.targets): es.fXY_std_err for es in self.edges_specs}",
"def fISWAP_std_errs(self) -> Dict[Tuple[int, ...], Optional[float]]:\n return {tuple(es.targets): es.fISWAP_std_err for es in self.edges_specs}",
"def fCZ_s... | [
"0.6398472",
"0.63695234",
"0.63679135",
"0.63636845",
"0.6244795",
"0.61491895",
"0.6142459",
"0.605958",
"0.59881234",
"0.5952139",
"0.5883996",
"0.5877521",
"0.585873",
"0.56553906",
"0.5589065",
"0.55512625",
"0.55043626",
"0.54821485",
"0.5478282",
"0.54688376",
"0.54650... | 0.7822954 | 0 |
Testing the construction of a RateSchedule. | def test_class_construction(self):
rs = self.rate.get_rate_schedule(self.eir.api)
assert rs is not None
assert rs.label == self.rate.label
assert rs.energy_weekend_schedule.shape == (12,24)
logger.info(str(rs)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_recurring_schedule(self):\n pass",
"def test_schedule(self):\n\n year = 2019\n month = 3\n day = 25 \n hour = 0\n\n mydate = datetime.datetime(year, month, day,hour)\n\n lower_boundary = mydate - timedelta(hours=3)\n upper_boundary = mydate + t... | [
"0.7359447",
"0.6835425",
"0.6807714",
"0.679861",
"0.67816955",
"0.67816955",
"0.6777877",
"0.6733011",
"0.6720145",
"0.67147034",
"0.6639859",
"0.66343504",
"0.65940815",
"0.65384954",
"0.64477235",
"0.6420392",
"0.63764626",
"0.62463915",
"0.6235234",
"0.6215878",
"0.61982... | 0.78441036 | 0 |
Split a list into 'n' number of chunks of approximately equal length. | def divide_list(input_list, n):
avg = len(input_list) / float(n)
last = 0.0
divided = []
while last < len(input_list):
divided.append(input_list[int(last):int(last + avg)])
last += avg
return divided | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def divide_chunks(a_list, n):\n return [a_list[i:i + n] for i in range(0, len(a_list), n)]",
"def chunks(l, n):\n if len(l) % n != 0:\n raise Exception('List length is not a multiple on %s', n)\n return [l[i:i+n] for i in range(0, len(l), n)]",
"def make_chunks(l, n):\n return [l[i:i+n] for ... | [
"0.86484945",
"0.8577142",
"0.8501326",
"0.84032923",
"0.8359114",
"0.8288681",
"0.8288681",
"0.8288351",
"0.828544",
"0.82834965",
"0.8283166",
"0.8261474",
"0.8261474",
"0.8260895",
"0.82528013",
"0.8249011",
"0.8248825",
"0.824524",
"0.824336",
"0.8234418",
"0.8234418",
... | 0.0 | -1 |
Return a list of all nodes. | def nodes(self, connected_only=True):
if connected_only:
return set(
node for node in
set(self._children_of.keys()) | set(self._parents_of.keys())
if node is not None
)
else:
return set(
node for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_nodes(self):\n return self._get_all_nodes()",
"def getNodes(self):\n return self.__allNodes",
"def get_all_nodes(self):\n # NOTE: return copy, so no one will screw\n # our list?\n return self.nodes",
"def list_nodes(self):\n return self.ironic_client.node... | [
"0.8838263",
"0.8634761",
"0.8539313",
"0.8334865",
"0.82776123",
"0.8223433",
"0.8170786",
"0.814492",
"0.81393313",
"0.81184477",
"0.81184477",
"0.8106373",
"0.7961414",
"0.7899718",
"0.786716",
"0.7864592",
"0.7849626",
"0.7849626",
"0.7849626",
"0.7839722",
"0.7838829",
... | 0.0 | -1 |
Given a word and a graph, find all single and doublecharacter glyphs in the word. Add them to the graph only if they are present within the given set of allowed symbols. | def build_spelling_graph(word, graph, symbols=ELEMENTS):
def pop_root(remaining, position=0, previous_root=None):
"""Pop the single and double-character roots off the front of a
given string, then recurse into what remains.
For the word 'because', the roots and remainders for each call... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def singleglyph(x):\n return [glyph(x)]",
"def glyphs(self, text):\n # fix: hackish\n text = re.sub(r'\"\\Z', r'\" ', text)\n\n result = []\n searchlist = self.glyph_search_initial\n for i, line in enumerate(re.compile(r'(<[\\w\\/!?].*?>)',\n ... | [
"0.5938288",
"0.5825529",
"0.5779465",
"0.5772455",
"0.56974775",
"0.546466",
"0.52742213",
"0.5266395",
"0.52091265",
"0.51095784",
"0.50959516",
"0.5071331",
"0.5047627",
"0.5043861",
"0.50262237",
"0.50067365",
"0.4995606",
"0.4973724",
"0.49617672",
"0.49457988",
"0.49117... | 0.63700116 | 0 |
Attempts to determine the "root" schema for a targetNamespace. | def _get_include_root(self, ns, list_schemas):
graph = self._build_include_graph(list_schemas)
if all(not(x) for x in itervalues(graph)):
return list_schemas[0]
for fp in graph:
has_ancestors = self._is_included(graph, fp)
has_children = len(graph[fp]) > 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_target_namespace(self) -> None:\n if 'targetNamespace' not in self.elem.attrib:\n return\n\n self._target_namespace = self.elem.attrib['targetNamespace'].strip()\n if 'name' not in self.elem.attrib:\n msg = _(\"attribute 'name' must be present when \"\n ... | [
"0.587778",
"0.5868629",
"0.5803524",
"0.57484674",
"0.5325408",
"0.52930546",
"0.5267727",
"0.5238539",
"0.52291197",
"0.5135206",
"0.5120378",
"0.5085362",
"0.508018",
"0.5062619",
"0.5019345",
"0.49800345",
"0.4968961",
"0.49522263",
"0.48964226",
"0.4822765",
"0.47963214"... | 0.60278034 | 0 |
Performs _isInMandelbrotSet on every pixel and returns the result in an array | def getMandelbrotSet(self):
(x_min, x_max, y_min, y_max) = [i for i in self.extent]
(rows, columns) = (self.width*self.dpi, self.width*self.dpi)
r_real = np.linspace(x_min, x_max, columns)
r_imag = np.linspace(y_max, y_min, rows)
result = np.empty((rows, columns))
# used for smoother colors
horizon = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boolean(operation, bitmaps):\n\n maxX, maxY = size = bitmaps[0].size()\n result = bitmap(size)\n for x in range(maxX):\n for y in range(maxY):\n pixel = bitmaps[0].get(x,y)\n for b in bitmaps[1:]:\n pixel = apply(operation, (pixel, b.get(x,y)))\n ... | [
"0.58032686",
"0.54695725",
"0.5332772",
"0.528668",
"0.5277771",
"0.5275832",
"0.5233972",
"0.523004",
"0.52045196",
"0.517759",
"0.5171296",
"0.512559",
"0.51196384",
"0.5113793",
"0.50889504",
"0.5082905",
"0.5051777",
"0.5033201",
"0.50165915",
"0.50165915",
"0.50165915",... | 0.63857424 | 0 |
A Simple test method to ping if the API server is working properly. | def GET_test(self, request):
request.setHeader('Access-Control-Allow-Origin', settings.PDFCD_HEADER_VALUE)
ip = apiutils.getIP(request)
out.info('Test called (%s)\n' % (ip))
request.setResponseCode(*pdapi.getResponse(pdapi.OK))
return "SUCCESS\n" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ping(self):\n response = self.client.get(reverse(\"api_hello:ping\"))\n self.assertTrue(response.json()[\"status\"])",
"def test_ping():\n\n api = Client()\n response = api.ping()\n response.should.equal({})",
"def test_ping(self):\n response = self.app.get('/ping')\n\n ... | [
"0.85994714",
"0.83163434",
"0.82708377",
"0.8111896",
"0.7930208",
"0.7738232",
"0.7643619",
"0.7588205",
"0.7569927",
"0.753736",
"0.753736",
"0.753736",
"0.753736",
"0.7524902",
"0.74968934",
"0.74928564",
"0.74700254",
"0.7458921",
"0.74455863",
"0.7437223",
"0.7395771",
... | 0.0 | -1 |
Returns a boolean detailing if the button is disabled. | def disabled(self):
check1 = "pf-m-disabled" in self.browser.classes(self)
check2 = "pf-m-aria-disabled" in self.browser.classes(self)
return check1 or check2 or self.browser.get_attribute("disabled", self) is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_disabled(self):\n return self._tag == 'disabled'",
"def disabled(self) -> bool:\n return pulumi.get(self, \"disabled\")",
"def disabled(self) -> bool:\n return pulumi.get(self, \"disabled\")",
"def is_disabled(self) -> pulumi.Output[bool]:\n return pulumi.get(self, \"is_dis... | [
"0.8439733",
"0.8294272",
"0.8294272",
"0.8251847",
"0.8208758",
"0.8161202",
"0.80874795",
"0.80754066",
"0.8019048",
"0.7945348",
"0.7945348",
"0.7945348",
"0.7945348",
"0.7945348",
"0.7945348",
"0.7945348",
"0.7945348",
"0.7945348",
"0.7945348",
"0.7945348",
"0.7945348",
... | 0.7791539 | 22 |
Return user in json format | def to_save(self):
return {'name': self.username, 'password': self.password,
'keywords': self.keywords, 'email': self.email} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_ret():\n user_list = []\n all_objs = storage.all(\"User\")\n for obj in all_objs.values():\n user_list.append(obj.to_dict())\n return jsonify(user_list)",
"def json(self):\n result = {}\n for user in self.users:\n result[user.user_id] = user.json\n retu... | [
"0.798019",
"0.79696214",
"0.796416",
"0.7769263",
"0.76991564",
"0.76970994",
"0.7627915",
"0.76126033",
"0.7544891",
"0.7533699",
"0.75230443",
"0.74398506",
"0.73922336",
"0.7374522",
"0.73487836",
"0.7348381",
"0.73408794",
"0.7315407",
"0.7313388",
"0.73012555",
"0.72724... | 0.0 | -1 |
Count how many missing values in each attribute | def sum_missing_values_attributes(df):
missing_values = pd.DataFrame(df.isna().sum(axis=0), columns=['num_row_missing'])
total_rows = df.shape[0]
missing_values['pct_rows_missing'] = missing_values.num_row_missing/total_rows
return missing_values | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def missing_values():\n print('Missings in the train data:', train_data.isnull().sum())",
"def count_missing(a_dataframe):\n missing_count = []\n for category in a_dataframe.dtypes.keys():\n try:\n np.mean(a_dataframe.loc[:, category]) # skipping numeric\n except TypeError:\n ... | [
"0.71005595",
"0.7035222",
"0.6984083",
"0.69672716",
"0.68343145",
"0.67643523",
"0.6672818",
"0.6622923",
"0.6619202",
"0.6599705",
"0.6599061",
"0.6590311",
"0.65063983",
"0.64784515",
"0.64356464",
"0.64229786",
"0.640649",
"0.639875",
"0.6262686",
"0.6239673",
"0.6237579... | 0.67893785 | 5 |
Reset the game This reset the game to the first initial observation of the first player move. Note that this might mean that this include some setup (e.g. dealing initial cards to player). The return of State is intentional, and allow the environment to return the initial observation. | def reset(self) -> S:
self.a.say("Resetting game.")
self.s.reset()
return self.s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n if not self.single_agent_mode:\n return self._init_game()\n\n while True:\n state, player_id = self.game.init_game()\n while not player_id == self.active_player:\n self.timestep += 1\n action, _ = self.model.agents[play... | [
"0.790589",
"0.75225735",
"0.7500646",
"0.7490452",
"0.7296193",
"0.7263521",
"0.7251667",
"0.7194414",
"0.71906096",
"0.7176636",
"0.71522653",
"0.71512854",
"0.71455914",
"0.714082",
"0.71164006",
"0.7112036",
"0.7107069",
"0.7094572",
"0.708277",
"0.70812994",
"0.70812994"... | 0.72906536 | 5 |
rotates a point p around the point origin. | def rotate(v: vect2d, angle: float) -> vect2d:
vector = ((v.x * math.cos(angle) - v.y * math.sin(angle)),
(v.x * math.sin(angle) + v.x * math.cos(angle)))
return vector | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def RotatePointAroundPoint(c, p, a):\n\n\timport math\n\t\n\tp2 = Point()\n\n\tp2.x = math.cos(math.radians(a)) * (p.x-c.x) - math.sin(math.radians(a)) * (p.y-c.y) + c.x\n\tp2.y = math.sin(math.radians(a)) * (p.x-c.x) + math.cos(math.radians(a)) * (p.y-c.y) + c.y\n\n\treturn p2",
"def _rotate_point(origin, point... | [
"0.73166937",
"0.7283845",
"0.7265202",
"0.70888674",
"0.68284667",
"0.67346203",
"0.67220825",
"0.6692271",
"0.66807187",
"0.6664714",
"0.66309786",
"0.6620689",
"0.65777797",
"0.6568896",
"0.6567272",
"0.65636885",
"0.65576327",
"0.6557172",
"0.6557172",
"0.6557172",
"0.654... | 0.0 | -1 |
Setup the frame that will be displaying the tree | def Tree_Frame( self ):
#Create pane
p = self.pane_widget.add( "Tree", min = 0.2, max = 0.9, size = 0.5 )
frame_tree = Frame( p )
#Add the scale
self.canvas_scale = Canvas( frame_tree, height = 10 )
self.canvas_scale.bind( '<Button-1>', self.Scale_Pick )
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,*args, **kwargs):\n tk.Tk.__init__(self, *args, **kwargs)\n self.winfo_toplevel().title(\"ElogQP\")\n self.container = tk.Frame(self)\n self.container.pack(side=\"top\", fill=\"both\", expand=True)\n self.container.grid_rowconfigure(0, weight=1)\n self.co... | [
"0.69566464",
"0.6771968",
"0.67572284",
"0.6670546",
"0.66303444",
"0.6511257",
"0.6509323",
"0.6433503",
"0.64276046",
"0.64172727",
"0.6409022",
"0.63866544",
"0.6352384",
"0.6343966",
"0.6267864",
"0.62609726",
"0.6253783",
"0.624173",
"0.6236783",
"0.6228844",
"0.6212876... | 0.7471781 | 0 |
Find a LineSegment within reasonable distance of x,y on self.canvas_one Return the LineSegment if found or 1 if not | def Find_Line_By_XY( self, x, y ):
for i in self.handle_list:
#examine the bounding box of each line
bbox = self.canvas_one.bbox( i.line_handle )
xb1 = bbox[ 0 ]
yb = ( bbox[ 1 ] + bbox[ 3 ] ) / 2
xb2 = bbox[ 2 ]
if x >= xb1 and x <=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_segment(p, line, start_vertex=0):\n EPS = 1e-9\n for seg in range(start_vertex, len(line)-1):\n if is_near(p, line[seg]):\n return seg, 0\n if line[seg][0] == line[seg+1][0]:\n if not (p[0]-EPS <= line[seg][0] <= p[0]+EPS):\n continue\n p... | [
"0.68440497",
"0.6581792",
"0.64134264",
"0.64000094",
"0.62943715",
"0.6292594",
"0.62879515",
"0.62764657",
"0.61854774",
"0.6182772",
"0.6133035",
"0.61295795",
"0.61111605",
"0.61011773",
"0.60404015",
"0.6032529",
"0.6017699",
"0.6004317",
"0.5988907",
"0.59828335",
"0.5... | 0.682248 | 1 |
Create an individual profile | def Create_Profile(self):
#Run the dialog to get a list of the keywords
d=ExpressionAdjust.ExpressionAdjuster( self.root, [], 'Keywords', "Create the keyword list" )
if d.return_state == 0:
return #Cancel hit
name = self.Generate_Profile_Name(d.profile_list)
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createProfile(self):\n if self.profile:\n return\n from soc.modules.gsoc.models.profile import GSoCProfile\n user = self.createUser()\n properties = {'link_id': user.link_id, 'student_info': None, 'user': user,\n 'parent': user, 'scope': self.program, 'status': 'active'}\n ... | [
"0.84181476",
"0.791038",
"0.7891102",
"0.78300995",
"0.78212404",
"0.7798358",
"0.7781326",
"0.7714911",
"0.76822567",
"0.7646087",
"0.7623909",
"0.75573075",
"0.75573075",
"0.75573075",
"0.755526",
"0.7455271",
"0.74515235",
"0.74474543",
"0.7400742",
"0.739764",
"0.7390609... | 0.6887815 | 62 |
Validates the category name | def validate_category(self, data):
try:
if data['category_name'] == "":
return "Category_name cannot be blank"
if 'category_name' not in data.keys():
return "Enter category_name"
if not re.match(r"^[a-zA-Z0-9 _]*$", data['category_name']):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_name(self, name):\n import re\n\n if not re.findall(\"^[\\w',]+$\", name):\n self.msg(\"That category name contains invalid characters.\")\n return False\n return True",
"def test_create_category_with_existing_name(self):\n sample_category()\n ... | [
"0.8237069",
"0.70292914",
"0.6660523",
"0.6657001",
"0.66189945",
"0.65886277",
"0.6543362",
"0.6514709",
"0.6502891",
"0.6486032",
"0.6481334",
"0.6448868",
"0.6405428",
"0.63642496",
"0.63458186",
"0.6288824",
"0.6286841",
"0.62794524",
"0.6266098",
"0.62193483",
"0.621353... | 0.83001536 | 0 |
Breaks a list into chunks sort of the opposite of flatten. | def chunk(flat, sizes):
iter_flat = iter(flat)
yield from (list(islice(iter_flat, 0, size)) for size in sizes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_chunk(list, chunk_size):\n for i in range(0, len(list), chunk_size):\n yield list[i:i + chunk_size]",
"def split_to_chunks(of_list, chunk_size):\n assert of_list is not None\n\n for i in range(0, len(of_list), chunk_size):\n yield of_list[i:i + chunk_size]",
"def _split... | [
"0.7659898",
"0.7457301",
"0.730664",
"0.7291115",
"0.7208895",
"0.7206398",
"0.71722114",
"0.7133267",
"0.71206933",
"0.7117941",
"0.7115564",
"0.7040369",
"0.7010916",
"0.7007037",
"0.6974908",
"0.69700575",
"0.69617724",
"0.6938479",
"0.6904307",
"0.6900388",
"0.6866949",
... | 0.66038114 | 55 |
Converts list of empty dicts to JSON string | def test_empty_list_of_dict_arg(self):
self.assertEqual(self.obj.to_json_string([{}, {}]), '[{}, {}]') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json_string(list_dictionaries):\n if list_dictionaries and list_dictionaries is not None:\n return json.dumps(list_dictionaries)\n else:\n return \"[]\"",
"def to_json_string(list_dictionaries):\n if list_dictionaries is None or not list_dictionaries:\n ... | [
"0.7448021",
"0.73329407",
"0.730517",
"0.7301687",
"0.7301687",
"0.7288244",
"0.72859913",
"0.72815084",
"0.72697794",
"0.726297",
"0.7247883",
"0.72096795",
"0.71606624",
"0.7098377",
"0.7023258",
"0.69790304",
"0.69612575",
"0.69251096",
"0.6870016",
"0.6870016",
"0.663517... | 0.7952127 | 0 |
File has valid name | def test_valid_file_name(self):
Base.save_to_file([self.r0, self.s1])
self.assertTrue(path.exists('Base.json')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_file_valid(name: str) -> bool:\n return not name.startswith(\".\")",
"def get_valid_name(self, name):\n return get_valid_filename(name)",
"def is_filename(name):\n test = re.search(\"[A-Za-z0-9_-]+\\.xml$\", name)\n if test:\n return True\n else:\n return False",
"def... | [
"0.8094362",
"0.78478175",
"0.7766918",
"0.7677519",
"0.7652042",
"0.7639583",
"0.76061785",
"0.75876033",
"0.74831384",
"0.74757296",
"0.74267167",
"0.7418283",
"0.74074864",
"0.7404363",
"0.74023855",
"0.73899627",
"0.7382644",
"0.7357557",
"0.73551303",
"0.73405474",
"0.73... | 0.7087495 | 34 |
Returns initialized Rectangle instance | def test_create_rectangle(self):
d = self.r1.to_dictionary()
r3 = Rectangle.create(**d)
self.assertEqual(str(r3), str(self.r1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_rectangle_full_init(self):\n r2 = Rectangle(10, 2, 1, 3, 12)\n self.assertEqual(r2.width, 10)\n self.assertEqual(r2.height, 2)\n self.assertEqual(r2.x, 1)\n self.assertEqual(r2.y, 3)\n self.assertEqual(r2.id, 12)",
"def __init__(self, height, width):\n\n\t\t# _w... | [
"0.74631023",
"0.7345589",
"0.7294174",
"0.7294174",
"0.7138551",
"0.7129037",
"0.68726236",
"0.6844282",
"0.6793449",
"0.6679758",
"0.6656582",
"0.6624404",
"0.660203",
"0.6577081",
"0.65555495",
"0.65507287",
"0.649816",
"0.6425338",
"0.64248025",
"0.64241207",
"0.6396469",... | 0.6220195 | 25 |
Returns initialized Square instance | def test_create_square(self):
d = self.s1.to_dictionary()
s3 = Square.create(**d)
self.assertEqual(str(s3), str(self.s1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_square_class(self):\n s1 = Square(10)\n self.assertEqual(10, s1.size)\n\n s2 = Square(10, 2)\n self.assertEqual(10, s2.size)\n self.assertEqual(2, s2.x)\n\n s3 = Square(3, 5, 2)\n self.assertEqual(3, s3.size)\n self.assertEqual(5, s3.x)\n self... | [
"0.66223186",
"0.650889",
"0.64845306",
"0.6456574",
"0.62990683",
"0.6233196",
"0.6144999",
"0.6136479",
"0.6039277",
"0.59683883",
"0.59489065",
"0.5924383",
"0.59108657",
"0.59021395",
"0.5851967",
"0.5851668",
"0.5833944",
"0.5808165",
"0.5802248",
"0.5724005",
"0.5723983... | 0.0 | -1 |
Compute softmax values for each sets of scores in x. | def softmax(x):
e_x = np.exp(x - np.max(x))
return e_x / e_x.sum(axis=0) # only difference | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.7796294",
"0.7760558",
"0.7759004",
"0.77567077",
"0.76577055",
"0.76577055",
"0.76577055",
"0.76577055",
"0.7585655",
"0.743143",
"0.7407772",
"0.73941606",
"0.7358175",
"0.73174125",
"0.72689486",
"0.72623265",
"0.72614294",
"0.7256868",
"0.723019",
"0.7214918",
"0.72017... | 0.70117974 | 77 |
Uses out_schema and __str__ to return a formatted dict | def output_param_formatter(self, out_param):
filtered = {}
for key in self.out_schema:
filtered[key] = str(out_param[key])
return filtered | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatSchema(self):\n schema = json.loads(self.schemaSource)\n stack = [schema]\n # Strip out all the docs\n while len(stack) > 0:\n elm = stack.pop()\n if \"doc\" in elm:\n elm[\"doc\"] = \"\"\n for value in elm.values():\n ... | [
"0.6765734",
"0.6689606",
"0.6639374",
"0.6626707",
"0.6562237",
"0.6540649",
"0.64570624",
"0.6447549",
"0.6441008",
"0.6398234",
"0.6366553",
"0.6318566",
"0.6310918",
"0.6310918",
"0.6306079",
"0.6288559",
"0.6275156",
"0.62634754",
"0.6255599",
"0.62323433",
"0.6228",
"... | 0.7077399 | 0 |
Plots an interactive scatter plot of `x` vs `y` using bokeh, with automatic tooltips showing columns from `df`. | def scatter_with_hover(df, x, y,
fig=None, cols=None, name=None, marker='x',
fig_width=500, fig_height=500, **kwargs):
# If we haven't been given a Figure obj then create it with default
# size etc.
if fig is None:
fig = figure(width=fig_width, height=f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bokeh_multi_scatter(df, x_col, y_cols, y_label, title, to_svg=False):\n\n source = ColumnDataSource(df)\n TOOLS = \"hover,save,pan,box_zoom,reset,wheel_zoom\"\n\n fig = figure(title=title, plot_width=500, plot_height=500, tools=TOOLS, toolbar_location='below')\n\n #adding all elements to the figure... | [
"0.7642126",
"0.7204018",
"0.6831501",
"0.6637681",
"0.65821695",
"0.6463377",
"0.6450143",
"0.64344925",
"0.6381718",
"0.6270449",
"0.62484515",
"0.6208348",
"0.6176612",
"0.61489385",
"0.6139943",
"0.6131605",
"0.61255974",
"0.60601145",
"0.6057943",
"0.60503435",
"0.602379... | 0.75424886 | 1 |
`test_soundcloud_tracks` From the Chartmetric documentation, > This data is updated weekly only (on Fridays). | def test_soundcloud_tracks(dates):
test = pycmc.charts.soundcloud.tracks(dates["end"])
assert isinstance(test, list)
assert len(test)
assert len(test) > 90
assert test[0]["name"] != ""
assert test[0]["id"] != "" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_youtube_tracks(dates):\n\n test = pycmc.charts.youtube.tracks(dates[\"start\"])\n assert isinstance(test, list)\n assert len(test) > 90\n assert test[0][\"name\"] != \"\"\n assert test[0][\"id\"] != \"\"",
"def test_cm_score_tracks(dates):\n test = pycmc.charts.cm_score.tracks(\n ... | [
"0.64468616",
"0.6438865",
"0.6376899",
"0.5953704",
"0.5898046",
"0.5671847",
"0.55856943",
"0.5564427",
"0.55438346",
"0.5474251",
"0.5439371",
"0.5421194",
"0.5378572",
"0.53645134",
"0.5334621",
"0.5300545",
"0.5283813",
"0.5271602",
"0.52532166",
"0.52349025",
"0.5211261... | 0.78758955 | 0 |
Called when the user specifies an intent for this skill | def on_intent(intent_request, session, league):
print("on_intent requestId=" + intent_request['requestId'] +
", sessionId=" + session['sessionId'])
intent = intent_request['intent']
intent_name = intent_request['intent']['name']
# Dispatch to your skill's intent handlers
if intent_name ... | {
"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.6754843",
"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.62412214 | 41 |
Bar charts of Harvest time tracking. | def plot_harvest(
self,
id_type,
group_type,
id_value=None,
start_date=None,
end_date=None,
freq="MS",
plot_type="bar",
units="Hours",
):
start_date, end_date, freq = self.get_time_parameters(
start_date, end_date, freq
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plotBarChart(resultConfirmed, resultDeath, resultVaccinated):\n fig, ax = plt.subplots(3)\n\n ax[0].plot(resultConfirmed['Date'], resultConfirmed['Confirmed Cases'])\n ax[0].title.set_text('Confirmed Cases')\n \n ax[1].plot(resultDeath['Date'], resultDeath['Death Cases'])\n ax[1].title.set_te... | [
"0.60342443",
"0.58681554",
"0.57882434",
"0.5783688",
"0.5782808",
"0.5756208",
"0.5741617",
"0.5730592",
"0.5680645",
"0.5662719",
"0.55701816",
"0.5559359",
"0.55533963",
"0.554791",
"0.55170757",
"0.5502149",
"0.5496524",
"0.54961276",
"0.5490702",
"0.5456321",
"0.5442171... | 0.0 | -1 |
Create a new Shelter with an L0 location | def test_locationL0(self):
sel = self.selenium
# Login
self.login()
self.create_header()
# Fill in the mandatory fields
sel.type("cr_shelter_name", "Shelter with an L0 Location")
# Select the L0
sel.select("gis_location_L0", "label=Haiti")
# Check ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_shelve(self, recreate=False):\n if recreate:\n self.open(mode='n')\n self.close()\n\n else:\n self.open(mode='c')\n self.close()",
"def shelve_name(self, name):\n self._shelve_name = name",
"def shelve_mode(self, mode):\n self._sh... | [
"0.5582414",
"0.527225",
"0.5189159",
"0.5095476",
"0.5003307",
"0.50018585",
"0.4974554",
"0.4970573",
"0.49432233",
"0.4928983",
"0.49139675",
"0.4877519",
"0.48375446",
"0.4828799",
"0.47741118",
"0.47688287",
"0.47336486",
"0.4721738",
"0.47153398",
"0.47123995",
"0.46842... | 0.46140993 | 29 |
Return ventilation rate in Litres/s == 1000 m^3/s | def ventilation_rate_per_second(self):
return self.volume * self.outdoor_air_ventilation * 1000 / 3600 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ventilation_rate(self):\n # TODO: calculate based on MERV ratings/efficiency/power/etc.\n return (\n sum(v.calculate_ach(self.volume) for v in self.air_quality_measures)\n + self.outdoor_air_ventilation\n )",
"def viral_loss_rate(self):\n return (\n ... | [
"0.6870493",
"0.6542597",
"0.6253348",
"0.6227895",
"0.6192192",
"0.60830337",
"0.6028236",
"0.5997747",
"0.59330904",
"0.59271675",
"0.5896819",
"0.5881798",
"0.58790463",
"0.5875714",
"0.58724487",
"0.5872404",
"0.5868462",
"0.58678246",
"0.5862803",
"0.58543336",
"0.585068... | 0.7565988 | 0 |
Creates a JSON file for submitting to the leaderboard. You should first run your model on the test data, save the reconstructions, zip them up, and upload them to a cloud storage service (like Amazon S3). | def create_submission_file(
json_out_file, challenge, submission_url, model_name, model_description, nyu_data_only,
participants=None, paper_url=None, code_url=None
):
if challenge not in {'singlecoil', 'multicoil'}:
raise ValueError(f'Challenge should be singlecoil or multicoil, not {challenge}')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_submission(data, model, path):\n counter = 0\n length= len(data)\n test_predictions = []\n #Data has form of [(id,vec),(id,vec)....]\n for instance in data:\n print(\"Prog: \",(counter/length*100))\n counter+=1\n id = instance[0]\n vec = instance[1]\n res ... | [
"0.6943896",
"0.66115147",
"0.63279706",
"0.6317349",
"0.6260665",
"0.61263806",
"0.60929954",
"0.6086775",
"0.6073734",
"0.5994069",
"0.59712374",
"0.59566385",
"0.5930714",
"0.5911207",
"0.589651",
"0.5895886",
"0.58933866",
"0.5889639",
"0.5860147",
"0.58233356",
"0.582200... | 0.6907215 | 1 |
Returns the max and min x and y values from a list of coordinate tuples in the form of (min_x, max_x, min_y, max_y). | def get_extrema(list):
max_x = max(list,key=lambda item:item[0])[0]
max_y = max(list,key=lambda item:item[1])[1]
min_x = min(list,key=lambda item:item[0])[0]
min_y = min(list,key=lambda item:item[1])[1]
return (min_x, max_x, min_y, max_y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rect(coords : Tuple[int, int]) -> Tuple[int, int, int, int]:\n min_x = min([x for x, _ in coords])\n max_x = max([x for x, _ in coords])\n min_y = min([y for _, y in coords])\n max_y = max([y for _, y in coords])\n\n return (min_x, max_x, min_y, max_y)",
"def bounding_box(coords):\n min_x =... | [
"0.7505127",
"0.7204944",
"0.719161",
"0.718917",
"0.7164687",
"0.7111631",
"0.7062988",
"0.7017895",
"0.7003294",
"0.69949096",
"0.69793206",
"0.6952037",
"0.6882333",
"0.68058336",
"0.68012494",
"0.6764235",
"0.67614836",
"0.6745956",
"0.67442465",
"0.6722096",
"0.67064",
... | 0.7841841 | 0 |
Return true is location is an edge pixel. | def is_edge(location, hi, lo, bgArray):
offsets = [
(0,1),
(1,0),
(0,-1),
(-1,0)
]
# Check that location is within threshold first
try:
b = fetch_val(bgArray, location)
except IndexError:
return False
if b < lo or b > hi:
return False
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_edge(self):\n if self._row == 0 or self._row == 9 or self._column == 0 or self._column == 9:\n # check that the edge is not actually a corner square\n if not self.is_corner():\n # If not a corner and in a border row return True\n return True\n\n ... | [
"0.7322647",
"0.72881037",
"0.7283599",
"0.71006835",
"0.6975181",
"0.6841006",
"0.6833109",
"0.6759785",
"0.67578155",
"0.6742462",
"0.67366546",
"0.67303246",
"0.66587216",
"0.6614205",
"0.65206194",
"0.6454053",
"0.6233858",
"0.61872625",
"0.6158648",
"0.61348236",
"0.6064... | 0.7299396 | 1 |
Return the row in which the element in the specified column has a value closest to the specified one. Column is specified starting from 1. | def getRowWithGivenValue(filename, value, column=1):
buffer = readData(filename);
min_diff = 99999999; # hopefully this is enough for real use
target_row=[]; # the result
for aLine in buffer:
if abs(value-aLine[column-1]) < min_diff:
min_diff = abs(value-aLine[column-1]);
target_row = aLine;
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closest_row(dataframe, column, value):\n sort = dataframe.iloc[(dataframe[column]-value).abs().argsort()[:1]]\n return sort",
"def _find_nearest(array, value):\n idx = (np.abs(array - value)).argmin()\n return array[idx], idx",
"def get_nearest_row(self):\n return (self.rect.top - (self.... | [
"0.8087647",
"0.6539595",
"0.6500797",
"0.64640206",
"0.6440996",
"0.6414488",
"0.6396769",
"0.6391241",
"0.6375669",
"0.6361679",
"0.6361679",
"0.6352896",
"0.63363826",
"0.6265427",
"0.6265427",
"0.62486076",
"0.6247215",
"0.6234674",
"0.6232756",
"0.6228756",
"0.62121737",... | 0.6354234 | 11 |
create a csv file to store the paths of files for each patient | def create_csv_file(data_root, output_file, fields):
filenames = []
patient_names = os.listdir(data_root + '/' + fields[0])
print(len(patient_names))
for patient_name in patient_names:
patient_image_names = []
for field in fields:
image_name = data_root + '/' + field + '/' + ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_csv(self, lista):\r\n\t\ts = ''\r\n\t\tsalida = self.get_rel_path() + \"/\" + \"tree_names.csv\"\r\n\t\tfor i in lista:\r\n\t\t\t#st = i[2].split('/')\r\n\t\t\t#newpath = os.path.join(i[1],st)\r\n\t\t\thash = str(i[0])\r\n\t\t\tname_path = str(i[1] + \"/\" + i[2])\r\n\t\t\t#s = s + str(i[0]) + \";\" +... | [
"0.67744476",
"0.65794116",
"0.6574338",
"0.6428384",
"0.6393453",
"0.6275458",
"0.6258241",
"0.62501264",
"0.62393457",
"0.6199792",
"0.61792433",
"0.6128413",
"0.60839975",
"0.6066582",
"0.6055135",
"0.60335743",
"0.60169286",
"0.6010963",
"0.5998775",
"0.5984609",
"0.59687... | 0.7392785 | 0 |
Convert class labels from scalars to onehot vectors. | def dense_to_one_hot(labels_dense, num_classes=10):
num_labels = labels_dense.shape[0]
index_offset = np.arange(num_labels) * num_classes
labels_one_hot = np.zeros((num_labels, num_classes))
labels_one_hot.flat[index_offset + labels_dense.ravel()] = 1
return labels_one_hot | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(labels, classes=None):\n return K.utils.to_categorical(labels, classes)",
"def one_hot(labels, classes=None):\n\n one_hot_ = K.utils.to_categorical(labels, classes)\n return(one_hot_)",
"def to_onehot(labels: torch.Tensor, num_classes: int) -> torch.Tensor:\n if len(labels.size()) == 1:... | [
"0.8250402",
"0.807683",
"0.80523187",
"0.7977843",
"0.7908335",
"0.7900327",
"0.7892233",
"0.7869711",
"0.7849721",
"0.7849721",
"0.7826951",
"0.7826122",
"0.77677035",
"0.7765413",
"0.77540547",
"0.77540547",
"0.77540547",
"0.77489346",
"0.7742955",
"0.7737176",
"0.77226317... | 0.7622406 | 37 |
Stops the ongoing messaging session if there is one. | def stop_messenger(self):
if self.connected:
self.messenger.stop()
self.connected = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop(self):\n self.logger.info(\"Stopping messenger.\")\n self.running = False",
"def stop_conversation(self):\n self.redis.publish('conversation_stopped_by_operator', json.dumps(self.operator_token))\n self.conversation_started = False",
"def stop(self):\n\n # Set the ru... | [
"0.75910866",
"0.71739763",
"0.7105642",
"0.6908807",
"0.67326057",
"0.671144",
"0.66973084",
"0.6634864",
"0.6610011",
"0.65834767",
"0.6570538",
"0.65152276",
"0.6514026",
"0.6454598",
"0.6448833",
"0.639832",
"0.6380698",
"0.63593525",
"0.63377637",
"0.63275707",
"0.631906... | 0.7991198 | 0 |
y = a relu(1 x) + relu(x) when x is rank 4, and "a" is of shape (1, C, 1, 1) or (C, 1, 1), this is equivalent to prelu with alpha = a.flatten(), | def get_prelu_pattern():
@mb.program(input_specs=[mb.TensorSpec(shape=([get_new_symbol(), get_new_symbol(),
get_new_symbol(), get_new_symbol()])), ])
def prelu_pattern(x):
return _prelu_pattern(x)
return prelu_pattern | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_prelu(g, op, block):\n\n x = g.get_node(op.input(\"X\")[0])\n alpha = g.get_node(op.input(\"Alpha\")[0])\n ndims = len(infer_shape(x))\n axis = 0 if ndims <= 1 else 1\n mode = op.attr(\"mode\")\n if mode == \"all\":\n if ndims == 1:\n shape = _op.strided_slice(shape_... | [
"0.64592427",
"0.6333044",
"0.62537",
"0.62351996",
"0.6228886",
"0.60807997",
"0.6060645",
"0.6058963",
"0.60451907",
"0.603774",
"0.6034033",
"0.60222596",
"0.60125387",
"0.59823126",
"0.59426486",
"0.59348977",
"0.59206986",
"0.5909111",
"0.5887389",
"0.5864927",
"0.586124... | 0.0 | -1 |
x1 = transpose(perm=(0,2,3,1))(x) y = a relu(1 x1) + relu(x1) when x is rank 4, and "a" is of shape (C,) or (1, C) or (1,1,C) or (1,1,1,C), this is equivalent to prelu with alpha = a.flatten(), followed by a transpose with perm (0,2,3,1) | def get_prelu_pattern():
@mb.program(input_specs=[mb.TensorSpec(shape=([get_new_symbol(), get_new_symbol(),
get_new_symbol(), get_new_symbol()])), ])
def prelu_pattern(x):
# perm value can be anything, it will be checked in "is_var_const... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_prelu(g, op, block):\n\n x = g.get_node(op.input(\"X\")[0])\n alpha = g.get_node(op.input(\"Alpha\")[0])\n ndims = len(infer_shape(x))\n axis = 0 if ndims <= 1 else 1\n mode = op.attr(\"mode\")\n if mode == \"all\":\n if ndims == 1:\n shape = _op.strided_slice(shape_... | [
"0.64946383",
"0.6190469",
"0.61804074",
"0.6178494",
"0.61611867",
"0.61347973",
"0.61074644",
"0.6073049",
"0.6051791",
"0.6036952",
"0.6024749",
"0.59933496",
"0.5989348",
"0.59709513",
"0.59688175",
"0.5963258",
"0.596298",
"0.59624594",
"0.59624594",
"0.59624594",
"0.596... | 0.5500345 | 67 |
Get a address balance. Optinally add confirmation count | def address_balance(self, address, confirmations=0):
address = utils.request_type(address)
confs = {'confirmations': confirmations}
if confs['confirmations'] > 0:
res = r.get(self.url + self.balance + str(address), params=confs)
else:
res = r.get(self.url + self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_balance(self, crypto, address, confirmations=1):\n raise NotImplementedError(\n \"This service does not support getting address balances. \"\n \"Or rather it has no defined 'get_balance' method.\"\n )",
"def get_balance(address: str) -> int:\n return base.Balances(b... | [
"0.7887034",
"0.77190495",
"0.764701",
"0.7177094",
"0.71563447",
"0.7115356",
"0.71096575",
"0.7031843",
"0.6874919",
"0.6860886",
"0.67194027",
"0.6675326",
"0.6509546",
"0.65024954",
"0.64793533",
"0.64408654",
"0.642012",
"0.63749194",
"0.63732433",
"0.6352632",
"0.634901... | 0.77215123 | 1 |
distance from area.ideal_base_pos to pos | def compute_area_dist(areas, timestep, pos):
pathing_grid = timestep.game_info.start_raw.pathing_grid
array = bitmap2array(pathing_grid)
dist = {}
# erase base in pathing_grid
for area in areas:
pos_area = area.ideal_base_pos
if array[int(pos_area[0]), int(pos_area[1])] != 0:
for dx in range(-2,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDistance(self):\n taBox = (self.thor * self.tvert)/(720*960) #box area as percentage of whole\n if(taBox==None or taBox<=0): return -1\n const = 4 * math.tan(0.471)*math.tan(0.3576)\n return math.sqrt((self.abox)/(const*taBox))",
"def distinter(self,pos):\n\t\tdist = 0\n\t\taux... | [
"0.69322103",
"0.68829304",
"0.68774647",
"0.68142766",
"0.6699408",
"0.6632939",
"0.6632939",
"0.6632939",
"0.6632939",
"0.6632939",
"0.6632939",
"0.6632939",
"0.66324484",
"0.65711987",
"0.64923304",
"0.64497685",
"0.6428402",
"0.6407767",
"0.6377411",
"0.6363154",
"0.63485... | 0.6303456 | 24 |
Focal length in pixels (fx, fy). | def f(self) -> np.ndarray:
return self._vector[8:10] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def focal_length(self):\n\n return self.f * self.diameter",
"def estimate_focal_length(self):\n fl = (self.fiber_diameter / 2) / np.tan(np.deg2rad(self.fov / 2))\n\n return fl",
"def focal_point(self):\n return self._focal_point",
"def focal( self, fields, fun ):\n raise No... | [
"0.7961674",
"0.7267804",
"0.65883356",
"0.6258949",
"0.6228528",
"0.6070065",
"0.6040861",
"0.5853543",
"0.58220834",
"0.5811443",
"0.5624299",
"0.556154",
"0.5537403",
"0.5528468",
"0.54856443",
"0.54221153",
"0.541728",
"0.5372348",
"0.5370786",
"0.535826",
"0.52895945",
... | 0.0 | -1 |
Tangential distortion coefficients (p1, p2). | def p(self) -> np.ndarray:
return self._vector[18:20] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _tangential_distortion(self, xy: np.ndarray, r2: np.ndarray) -> np.ndarray:\n # dtx = 2xy * p1 + p2 * (r^2 + 2x^2)\n # dty = p1 * (r^2 + 2y^2) + 2xy * p2\n xty = xy[:, 0] * xy[:, 1]\n dtx = 2 * xty * self.p[0] + self.p[1] * (r2 + 2 * xy[:, 0] ** 2)\n dty = self.p[0] * (r2 + 2... | [
"0.74083185",
"0.640612",
"0.6279532",
"0.6168429",
"0.60852766",
"0.6009689",
"0.59985036",
"0.5985918",
"0.59669715",
"0.5953356",
"0.5952264",
"0.5867634",
"0.58675164",
"0.5842748",
"0.58381224",
"0.58307815",
"0.5783602",
"0.5747098",
"0.574253",
"0.57380193",
"0.5714421... | 0.0 | -1 |
Return a copy of this camera. | def copy(self) -> "Camera":
cam = copy.deepcopy(self)
cam._original_vector = cam._vector.copy()
return cam | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return CameraExtrinsic(self.position, self.direction, self.up)",
"def copy(self) -> 'Camera':\n return Camera(self.map, self.pos.copy(), self.target.copy())",
"def camera(self):\n return self.__camera",
"def camera(self):\n return self._camera",
"def camera(sel... | [
"0.864881",
"0.85979545",
"0.7433533",
"0.7363878",
"0.7363878",
"0.7274645",
"0.7274645",
"0.71847034",
"0.7107203",
"0.6958763",
"0.689573",
"0.6854889",
"0.6748223",
"0.66826576",
"0.6572237",
"0.6572237",
"0.6572237",
"0.65625155",
"0.65574867",
"0.6556663",
"0.6554824",
... | 0.86022824 | 1 |
Return this camera as a numpy array. | def to_array(self) -> np.ndarray:
return self._vector.copy() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_numpy(self) -> np.ndarray:\n return self.frame",
"def get_array(self) -> numpy.array:\r\n \r\n return self.pic_array",
"def get_array(self):\n return numpy.array(self._ar)",
"def to_array(self):\n return np.array(self.to_image())",
"def as_numpy_array(self):\n ... | [
"0.76997596",
"0.76471734",
"0.76109093",
"0.75790477",
"0.7571693",
"0.753058",
"0.7331028",
"0.72305936",
"0.71570414",
"0.7130234",
"0.70580256",
"0.70263255",
"0.6982869",
"0.6950407",
"0.69409233",
"0.6889531",
"0.6853056",
"0.68505514",
"0.68447864",
"0.68447864",
"0.68... | 0.68535376 | 16 |
Return this camera as a dictionary. | def to_dict(
self,
attributes: Iterable[str] = ("xyz", "viewdir", "imgsz", "f", "c", "k", "p"),
) -> Dict[str, tuple]:
return {key: helpers.numpy_to_native(getattr(self, key)) for key in attributes} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self):\n return {\n 'r_name': self. r_name,\n 'cam_Model': self. cam_Model,\n 'Dimension': self. Dimension,\n 'Batteries': self. Batteries,\n 'resolution': self. resolution,\n 'screen_size': self. screen_size,\n 'cone... | [
"0.7123423",
"0.68819064",
"0.68336916",
"0.68336916",
"0.6821867",
"0.6821867",
"0.6821787",
"0.67906344",
"0.6768213",
"0.67536694",
"0.6709776",
"0.6709522",
"0.6682322",
"0.66757405",
"0.6664515",
"0.6661427",
"0.66581386",
"0.6650331",
"0.66496783",
"0.6616861",
"0.66046... | 0.0 | -1 |
Convert points to a raster image. | def rasterize(self, uv: np.ndarray, values: np.ndarray) -> np.ndarray:
mask = self.inframe(uv)
a = np.full((self.imgsz[1], self.imgsz[0]), np.nan)
helpers.rasterize_points(
uv[mask, 1].astype(int), uv[mask, 0].astype(int), values[mask], a=a
)
return a | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPolarPointsImage(self, points):\n\n return getPolarPointsImage(points, self)",
"def getCartesianPointsImage(self, points):\n return getCartesianPointsImage(points, self)",
"def values_from_raster(points, points_crs, raster, raster_profile, algorithm='nearest'):\n raster_crs = workflow.c... | [
"0.6064859",
"0.60447943",
"0.6003631",
"0.5949809",
"0.5757716",
"0.5752522",
"0.57521427",
"0.57521427",
"0.5717727",
"0.5705212",
"0.5704262",
"0.565927",
"0.5640459",
"0.56395304",
"0.5577385",
"0.5552612",
"0.55132204",
"0.55117",
"0.5511431",
"0.5467481",
"0.54523283",
... | 0.5582775 | 14 |
Apply distortion to camera coordinates. | def _distort(self, xy: np.ndarray) -> np.ndarray:
# X' = dr * X + dt
if not any(self.k) and not any(self.p):
return xy
dxy = xy.copy()
r2 = np.sum(xy ** 2, axis=1)
if any(self.k):
dxy *= self._radial_distortion(r2)
if any(self.p):
dxy +... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_distortion(self, pinhole_locations: ARRAY_LIKE) -> np.ndarray:\n\n # ensure we are dealing with an array\n pinhole_locations = np.array(pinhole_locations)\n\n # compute the powers of the radial distance from the optical axis\n radius2 = (pinhole_locations * pinhole_locations).... | [
"0.6400629",
"0.637588",
"0.6351993",
"0.6267175",
"0.6096329",
"0.601465",
"0.5884505",
"0.5837075",
"0.5806434",
"0.5789229",
"0.5743986",
"0.57386905",
"0.572605",
"0.56982684",
"0.5647917",
"0.56253654",
"0.56208825",
"0.56148916",
"0.56014866",
"0.55850095",
"0.55830616"... | 0.58367103 | 8 |
Project camera to image coordinates. | def _xy_to_uv(self, xy: np.ndarray) -> np.ndarray:
xy = self._distort(xy)
uv = xy * self.f + (self.imgsz / 2 + self.c)
return uv | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_onto_image(self, points_in_camera_frame: ARRAY_LIKE, image: int = 0,\n temperature: Real = 0) -> np.ndarray:\n\n _, __, picture_locations = self.get_projections(points_in_camera_frame, image, temperature=temperature)\n\n return picture_locations",
"def camera_t... | [
"0.7119768",
"0.6898936",
"0.6893262",
"0.67345595",
"0.6733456",
"0.66716105",
"0.6666769",
"0.6662401",
"0.66588354",
"0.6619998",
"0.6581624",
"0.65779775",
"0.656165",
"0.6548019",
"0.6517923",
"0.6463425",
"0.6436009",
"0.64259857",
"0.6418045",
"0.6417617",
"0.63960975"... | 0.0 | -1 |
Returns True if the process owserver is running, False otherwise. | def owserver_running():
for proc in psutil.process_iter():
if 'owserver' in proc.name():
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ServerIsRunning( self ):\n return utils.ProcessIsRunning( self._gocode_handle )",
"def is_running(self):\n if self._process and self._process.poll() is None:\n return True\n return False",
"def is_running(self):\n if self._process:\n return self._process.poll(... | [
"0.84420484",
"0.8207125",
"0.818799",
"0.7958545",
"0.7927316",
"0.78956294",
"0.785863",
"0.7836561",
"0.7812053",
"0.7784776",
"0.773373",
"0.77272314",
"0.77215505",
"0.7690334",
"0.7687746",
"0.766594",
"0.7643257",
"0.76378787",
"0.7617915",
"0.7605229",
"0.76045656",
... | 0.8870126 | 0 |
List available entitlement policies This sends a request to the policystore to read a list of all available policies. | def list_policies(policystore_url, verbose):
if verbose:
logging.info('Listing policies')
list_url = policystore_url + POLICYSTORE_PREFIX + 'ListEntitlementPolicies'
r = requests.post(list_url, headers=headers(), json={})
if r.status_code != 200:
logging.error(f'ERROR: Unexpected resp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_policies(self):\n client = self.connect(VAULT_TOKEN)\n return client.list_policies()",
"def ListPolicies(self, request, global_params=None):\n config = self.GetMethodConfig('ListPolicies')\n return self._RunMethod(\n config, request, global_params=global_params)",
"def... | [
"0.7174633",
"0.7099211",
"0.7023259",
"0.6882359",
"0.6852942",
"0.6622799",
"0.6473776",
"0.63904595",
"0.6376881",
"0.6295103",
"0.6196013",
"0.6132331",
"0.61285335",
"0.61197406",
"0.6089613",
"0.6078352",
"0.6067587",
"0.59129965",
"0.5900561",
"0.5896062",
"0.58957905"... | 0.7353608 | 0 |
Create and save a user with the given username, email, and password. | def _create_user(self, email, password, **extra_fields):
email = self.normalize_email(email)
#username = self.model.normalize_username(username)
user = self.model( email=email, **extra_fields)
user.set_password(password)
user.save(using=self._db)
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password,username, **extra_fields):\r\n if not email:\r\n raise ValueError('The given email must be set')\r\n if not username:\r\n raise ValueError('The given username must be set')\r\n email = self.normalize_email(email)\r\n user = se... | [
"0.85967624",
"0.8440654",
"0.84264034",
"0.8423257",
"0.84063315",
"0.8393488",
"0.83878005",
"0.8341707",
"0.8334409",
"0.8332718",
"0.83224976",
"0.8288854",
"0.82819235",
"0.827502",
"0.8269521",
"0.8267577",
"0.81637603",
"0.8159258",
"0.8158126",
"0.81423306",
"0.813671... | 0.8117871 | 22 |
Pad sentences with so that each sentence of a batch has the same length | def pad_sentence_batch(sentence_batch):
max_sentence = max([len(sentence) for sentence in sentence_batch])
return [sentence + [vocab_to_int['<PAD>']] * (max_sentence - len(sentence)) for sentence in sentence_batch] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad_sentence_batch(sentence_batch):\n max_sentence = max([len(sentence) for sentence in sentence_batch])\n return [sentence + [CODES['<PAD>']] * (max_sentence - len(sentence))\n for sentence in sentence_batch]",
"def pad_sentences(sentences, padding_word=\"<PAD/>\"):\n # !!! 一定要注意这里会影响数据的... | [
"0.819788",
"0.789377",
"0.7778575",
"0.75658965",
"0.7562924",
"0.7523857",
"0.7501811",
"0.74699676",
"0.74522513",
"0.7399378",
"0.7086272",
"0.6932305",
"0.6924164",
"0.6899889",
"0.68778116",
"0.67413706",
"0.6728184",
"0.6696565",
"0.66762966",
"0.6624139",
"0.660818",
... | 0.764639 | 3 |
Given the current robot pose, provide the observation z. | def provide_observation(self, sensor_model, sensor_params, known_correspondence=False):
def in_field_of_view(th, view_angles):
"""Determines if the beame at angle `th` is in a field of view of size `view_angles`.
For example, the view_angles=180, means the range scanner scans 180 degrees... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def z(self):\r\n return self.position.z",
"def z(self):\n return self.coords[2]",
"def processOdom(self, msg):\n self.x = msg.pose.pose.position.x\n self.y = msg.pose.pose.position.y\n self.z = 180 * (msg.pose.pose.orientation.z % 2)\n print(self.z)",
"def getZ(self):\n\... | [
"0.6958928",
"0.67781425",
"0.67304003",
"0.6713842",
"0.6683391",
"0.66553706",
"0.660018",
"0.6522622",
"0.6437593",
"0.64109653",
"0.64109653",
"0.64109653",
"0.62739784",
"0.6254482",
"0.62137944",
"0.61799335",
"0.6168868",
"0.6121934",
"0.6119418",
"0.6113457",
"0.61038... | 0.53570455 | 100 |
Get the value of the indexth node in the linked list. If the index is invalid, return 1. | def get(self, index):
if index >= self.len:
return -1
p = self.head.next
while index > 0:
index -= 1
p = p.next
return p.val | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, index: int) -> int:\n node = self.get_node(index)\n if node:\n return node.val\n else:\n return -1",
"def get(self, index: int) -> int:\n cnt = 0\n cur = self.head \n while cur != None:\n if(cnt == index):\n r... | [
"0.8309071",
"0.8223403",
"0.81012017",
"0.79819065",
"0.7971722",
"0.79658747",
"0.7951939",
"0.79492354",
"0.7905674",
"0.7799605",
"0.7734565",
"0.77311933",
"0.76516724",
"0.758455",
"0.7507213",
"0.74742204",
"0.7455023",
"0.7386918",
"0.7386918",
"0.7384269",
"0.7336994... | 0.79279983 | 8 |
Add a node of value val before the first element of the linked list. After the insertion, the new node will be the first node of the linked list. | def addAtHead(self, val):
node = ListNode(val)
node.next = self.head.next
self.head.next = node
if self.head is self.tail:
self.tail = node
self.len += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, val):\n new_node = Node(val)\n new_node.next = self.head\n self.head = new_node",
"def addAtHead(self, val):\n node = ListNode(val)\n if self.head == None:\n self.head = node\n else:\n node.next = self.head\n self.head = ... | [
"0.7888741",
"0.78108865",
"0.77142787",
"0.76656127",
"0.7633473",
"0.7595019",
"0.75851524",
"0.7570664",
"0.75009716",
"0.7491954",
"0.74768883",
"0.7461901",
"0.74279183",
"0.7406604",
"0.73477757",
"0.73477757",
"0.72839826",
"0.72462374",
"0.72356486",
"0.7171154",
"0.7... | 0.7380675 | 14 |
Append a node of value val to the last element of the linked list. | def addAtTail(self, val):
node = ListNode(val)
self.tail.next = node
self.tail = node
self.len += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(self, val):\n inserted_node = DblNode(val, previous_node=self.tail)\n self.tail.next_node = inserted_node\n self.tail = inserted_node",
"def addAtTail(self, val):\n if self.head is None:\n self.addAtHead(val)\n else:\n new_node = Node(val)\n ... | [
"0.80121386",
"0.79795235",
"0.7893152",
"0.7879479",
"0.7879479",
"0.78559566",
"0.7783268",
"0.77445775",
"0.7737258",
"0.7721552",
"0.769086",
"0.7632184",
"0.7549883",
"0.7530906",
"0.7523129",
"0.7448593",
"0.7416308",
"0.73188025",
"0.7240051",
"0.72215813",
"0.7216466"... | 0.76267946 | 12 |
Add a node of value val before the indexth node in the linked list. If index equals to the length of linked list, the node will be appended to the end of linked list. If index is greater than the length, the node will not be inserted. | def addAtIndex(self, index, val):
if index > self.len:
return
p = self.head
while index > 0:
index -= 1
p = p.next
node = ListNode(val)
node.next = p.next
p.next = node
if p is self.tail:
self.tail = node
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addAtIndex(self, index, val):\n if index < 0:\n new_node = ListNode(val)\n new_node.next = self.head\n self.head = new_node\n\n if index <= self.length:\n prev = None\n curr = self.head\n for i in range(1, index + 1):\n ... | [
"0.8008256",
"0.79068935",
"0.78446716",
"0.7804182",
"0.7744993",
"0.7744362",
"0.77328694",
"0.7711853",
"0.7620783",
"0.7616197",
"0.7616197",
"0.7599122",
"0.75055134",
"0.7281114",
"0.72117203",
"0.71564907",
"0.7090044",
"0.7024591",
"0.7024465",
"0.7019368",
"0.6931624... | 0.7759662 | 4 |
Returns starting state of the board. | def initial_state():
return [[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_state(self):\r\n return np.zeros(self.board_size, dtype=np.int8)",
"def start_state():\n return chess.Board()",
"def startingState(self):\n # Returns starting position and 4 false because no corners are visited yet\n return (self.startingPosition, (False, False, False, False))... | [
"0.8080877",
"0.78905165",
"0.7534062",
"0.72784334",
"0.72784334",
"0.72256136",
"0.72256136",
"0.72256136",
"0.72256136",
"0.72256136",
"0.72256136",
"0.72256136",
"0.72256136",
"0.72256136",
"0.72256136",
"0.72256136",
"0.72256136",
"0.72256136",
"0.72256136",
"0.72256136",
... | 0.0 | -1 |
Returns player who has the next turn on a board. | def player(board):
# Game is over
if terminal(board):
return None
# Count number of occurences of X and O
x_count = 0
o_count = 0
for row in board:
for box in row:
if box == X:
x_count = x_count + 1
elif box == O:
o_count ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_player(board, prev_player):\n opp = Othello.opponent(prev_player)\n if Othello.any_legal_move(opp, board):\n return opp\n elif Othello.any_legal_move(prev_player, board):\n return prev_player\n return None",
"def next_player(self,board, prev_player):\r\n... | [
"0.7911148",
"0.7521969",
"0.74204457",
"0.73687756",
"0.71954805",
"0.69775087",
"0.69253695",
"0.69208723",
"0.69010353",
"0.6845991",
"0.6841043",
"0.6838282",
"0.68265843",
"0.67751175",
"0.67751175",
"0.6769739",
"0.6713109",
"0.67060393",
"0.66561204",
"0.6616771",
"0.6... | 0.69621766 | 6 |
Returns the optimal action for the current player on the board. | def minimax(board):
# If terminal board, return None
if terminal(board):
return None
# Determine whose turn it is and the possible actions they can make
current_player = player(board)
moves = actions(board)
if current_player == "X":
utility_from_action = list()
# Creat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_best_action(self):\n if self.bestAction is None:\n self.calculate_best_action()\n return self.bestAction",
"def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = min... | [
"0.77666855",
"0.76333606",
"0.75845265",
"0.7528377",
"0.75182885",
"0.74658805",
"0.7460243",
"0.74243635",
"0.7417258",
"0.7394431",
"0.737319",
"0.7332661",
"0.73146296",
"0.7306597",
"0.7284585",
"0.7266512",
"0.7266512",
"0.7250632",
"0.7233482",
"0.72034407",
"0.717373... | 0.6884857 | 59 |
return attribute list suitable for styling. | def getstyle(self, tag):
try:
styledict = tag.style.__dict__
except AttributeError:
return []
else:
stylelist = [x + ": " + y for x, y in styledict.items()]
return [u(' style="%s"') % u("; ").join(stylelist)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attribute_list(self):\n attributes = [attr for attr in vars(self.entries[0]) if not attr.startswith('__')]\n return attributes",
"def get_attributes(cls):\r\n return [\r\n Attribute('size', '20'),\r\n Attribute('inline', False),\r\n Attribute('label',... | [
"0.74955755",
"0.74515396",
"0.73164135",
"0.7243856",
"0.7238241",
"0.71220064",
"0.70907086",
"0.70480025",
"0.70137507",
"0.6786456",
"0.67586654",
"0.66399753",
"0.6630809",
"0.65929824",
"0.6592324",
"0.6590023",
"0.65886426",
"0.6567952",
"0.6564652",
"0.65298045",
"0.6... | 0.6102737 | 49 |
xmlescape the given unicode string. | def __call__(self, ustring):
ustring = unicode(ustring)
return self.charef_rex.sub(self._replacer, ustring) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def URIEscape(str):\n ret = libxml2mod.xmlURIEscape(str)\n return ret",
"def escapeEncode(s: unicode) -> unicode:\n ...",
"def escapeDecode(s: unicode) -> unicode:\n ...",
"def to_unicode(x):\n try: # This may never fail, but let's be safe\n encoding = locale.getpreferredencodin... | [
"0.62192196",
"0.5877321",
"0.57694584",
"0.5757761",
"0.56107545",
"0.55490744",
"0.5539986",
"0.5527803",
"0.54940397",
"0.54529375",
"0.5429352",
"0.54285204",
"0.539675",
"0.53872883",
"0.536145",
"0.5339886",
"0.5267582",
"0.52469164",
"0.5243678",
"0.5227492",
"0.519413... | 0.5033979 | 28 |
Return the filename associated to the channel of interest for a known czi file and according to the nomenclature. | def get_nomenclature_channel_fname(czi_fname, nomenclature_file, channel_name, ext='.inr.gz'):
# - Read NOMENCLATURE file defining naming conventions:
n_names = get_nomenclature_name(nomenclature_file)
return n_names[czi_fname]+"/", n_names[czi_fname] + "_" + channel_name + ext | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nomenclature_segmentation_name(czi_fname, nomenclature_file, channel_name='PI', ext='.inr.gz'):\n # - Read NOMENCLATURE file defining naming conventions:\n return get_nomenclature_channel_fname(czi_fname, nomenclature_file, channel_name+'_segmented', ext)",
"def get_file_name_from_cd(cd):\n if n... | [
"0.65446234",
"0.6215177",
"0.61947143",
"0.61764735",
"0.60319567",
"0.5958957",
"0.59385675",
"0.58881056",
"0.5876279",
"0.5853474",
"0.5852406",
"0.58491725",
"0.58173716",
"0.5758521",
"0.57582325",
"0.57415986",
"0.5725931",
"0.5715452",
"0.56902283",
"0.56877875",
"0.5... | 0.79580593 | 0 |
Return the filename associated to the channel of interest for a known czi file and according to the nomenclature. | def get_nomenclature_segmentation_name(czi_fname, nomenclature_file, channel_name='PI', ext='.inr.gz'):
# - Read NOMENCLATURE file defining naming conventions:
return get_nomenclature_channel_fname(czi_fname, nomenclature_file, channel_name+'_segmented', ext) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nomenclature_channel_fname(czi_fname, nomenclature_file, channel_name, ext='.inr.gz'):\n # - Read NOMENCLATURE file defining naming conventions:\n n_names = get_nomenclature_name(nomenclature_file)\n return n_names[czi_fname]+\"/\", n_names[czi_fname] + \"_\" + channel_name + ext",
"def get_fil... | [
"0.79579973",
"0.621566",
"0.61959344",
"0.617729",
"0.60319775",
"0.5960434",
"0.59389937",
"0.58884627",
"0.5876879",
"0.5854477",
"0.5852449",
"0.58497036",
"0.58188355",
"0.5759497",
"0.5757808",
"0.5741942",
"0.57261145",
"0.5715687",
"0.569078",
"0.56882733",
"0.5674149... | 0.65446305 | 1 |
Return a formatted result image filename. | def get_res_img_fname(base_fname, t_ref, t_float, trsf_types):
if isinstance(trsf_types, str):
trsf_types = [trsf_types]
base_fname, ext = splitext_zip(base_fname)
if ext == "":
ext = '.inr'
else:
if ext==".lsm" or ext not in POSS_EXT:
ext = '.inr'
compo_trsf = '_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image_filename(self, filename):\n path = 'images/{folder}/{filename}'.format(\n folder=self.folder,\n filename=filename\n )\n return path",
"def generate_image_filename():\n now = datetime.now().strftime('%a-%w-%b-%H:%M:%S')\n return 'CCTV_{0}.jpg'.format(now)",
"def _image... | [
"0.7677582",
"0.72322965",
"0.7221064",
"0.72042483",
"0.71305364",
"0.708942",
"0.7066444",
"0.7044366",
"0.7035267",
"0.69515884",
"0.6918822",
"0.69153714",
"0.6897978",
"0.689336",
"0.6877347",
"0.6821783",
"0.67717993",
"0.67231745",
"0.66843426",
"0.66393924",
"0.663430... | 0.0 | -1 |
Example of a function that must be implemented by the user of these layer. The purpose of this function is to define the default parameter for each layer. Each Keras layers accepts a series of parameters. The implementor of a network only sets the parameter that the network required, for instance the kernel_size of a C... | def example_param_fn(layer_type, in_shape=None, **other_params):
layer_type = layer_type.lower()
d={}
if layer_type == 'batchnormalization':
d['momentum'] = 0.99
d['epsilon'] = 1e-3
elif layer_type == 'dense':
# Le 'gain=2.0' ici (et pour la conv2D ci-dessous) suppose l'utilisati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _default_parameters():\n\n return {\n 'opt': 'adadelta',\n 'activation_function': 'softmax',\n 'lr': 0.0001,\n 'decay': 1e-6,\n 'loss': 'categorical_crossentropy',\n 'batch_size': 32,\n 'nb_epoch': 20,\n 'shuffle': True,\n 'momentum': 0.9,\n ... | [
"0.72345215",
"0.6617995",
"0.6556533",
"0.64466333",
"0.6420908",
"0.63802177",
"0.63063383",
"0.61737794",
"0.6161843",
"0.61563253",
"0.6146703",
"0.6124434",
"0.6119225",
"0.60917217",
"0.6050024",
"0.6038974",
"0.600142",
"0.5995696",
"0.59918356",
"0.59627295",
"0.59540... | 0.6991539 | 1 |
2D Grouped Convolution layer. Implemented as the block (b) from Figure 3 of paper 'Aggregated Residual Transformations for Deep Neural Networks' | def grouped_conv(inputs, filters, cardinality, param_fn=None, **override_params):
channel_axis = get_channel_axis()
grouped_channels = filters // cardinality
name = override_params.setdefault('name', None)
name2 = None
x = inputs
if cardinality == 1:
x = conv(x, filters, param_fn, **ove... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv(self,\n x,\n k_h,\n k_w,\n c_o,\n s_h,\n s_w,\n name,\n relu,\n group=1,\n bias_term=False,\n padding=\"SAME\",\n trainable=True):\n with tf.name_scope(nam... | [
"0.67851555",
"0.65769154",
"0.6534564",
"0.6532578",
"0.64982045",
"0.645435",
"0.63784343",
"0.6370328",
"0.6342608",
"0.63273096",
"0.6308996",
"0.6305091",
"0.6299593",
"0.62968767",
"0.62758356",
"0.6267711",
"0.6264805",
"0.6263667",
"0.6259922",
"0.6254503",
"0.6254308... | 0.6100466 | 50 |
Create the authorization header value to send in an HTTP request. | def generate_veracode_hmac_header(host, path, method, api_key_id, api_key_secret, auth_scheme=DEFAULT_AUTH_SCHEME):
signing_data = format_signing_data(api_key_id, host, path, method)
logging.debug('[generate_veracode_hmac_header] signing_data = "%s"' % signing_data)
timestamp = get_current_timestamp()
n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_header(self):\n authstring = \"Bearer \" + self.auth_token\n header = {\n \"Authorization\": authstring,\n \"Content-Type\": \"application/json\",\n \"User-Agent\": self.user_agent,\n \"Accept-Encoding\": \"gzip\"\n }\n return header... | [
"0.7631153",
"0.741947",
"0.7391649",
"0.73547655",
"0.73475915",
"0.72305113",
"0.7188865",
"0.71520543",
"0.71520543",
"0.70884585",
"0.7084465",
"0.689661",
"0.6861888",
"0.6845993",
"0.67952293",
"0.67759323",
"0.67710805",
"0.66867566",
"0.66517603",
"0.6639793",
"0.6630... | 0.0 | -1 |
ObjectSelector decides whether to run the webhook based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the webhook, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newOb... | def object_selector(self) -> Optional['_meta.v1.outputs.LabelSelector']:
return pulumi.get(self, "object_selector") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_selector(self) -> Optional['_meta.v1.outputs.LabelSelectorPatch']:\n return pulumi.get(self, \"object_selector\")",
"def object_selector(self) -> Optional['_meta.v1.outputs.LabelSelectorPatch']:\n return pulumi.get(self, \"object_selector\")",
"def object_selector(self) -> Optional['_m... | [
"0.6504774",
"0.6504774",
"0.6504774",
"0.46324268",
"0.46075478",
"0.45837897",
"0.45533273",
"0.45282823",
"0.44923168",
"0.4475264",
"0.44605938",
"0.4435445",
"0.44078732",
"0.43742326",
"0.4373357",
"0.43520212",
"0.4286432",
"0.42862844",
"0.42757705",
"0.42624018",
"0.... | 0.64562577 | 3 |
MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object. | def __init__(__self__, *,
api_version: Optional[str] = None,
kind: Optional[str] = None,
metadata: Optional['_meta.v1.outputs.ObjectMeta'] = None,
webhooks: Optional[Sequence['outputs.MutatingWebhook']] = None):
if api_version is not None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def webhooks(self) -> Optional[Sequence['outputs.MutatingWebhook']]:\n return pulumi.get(self, \"webhooks\")",
"def update_config(self):\n if self.integration is None:\n return\n self.enabled = self.integration.has_option(self.get_config_name())\n self.pedantic = self.integ... | [
"0.49276146",
"0.48721498",
"0.48003584",
"0.4777379",
"0.47271284",
"0.46888295",
"0.46602076",
"0.46187678",
"0.46011916",
"0.4599269",
"0.45408332",
"0.45215765",
"0.45130247",
"0.45121095",
"0.45112178",
"0.4492822",
"0.44718304",
"0.44675875",
"0.4463156",
"0.4463156",
"... | 0.4674735 | 6 |
NamespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the webhook. | def namespace_selector(self) -> Optional['_meta.v1.outputs.LabelSelectorPatch']:
return pulumi.get(self, "namespace_selector") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def namespace_selector(self) -> Optional['_meta.v1.outputs.LabelSelector']:\n return pulumi.get(self, \"namespace_selector\")",
"def namespace_selector(self) -> Optional['_meta.v1.outputs.LabelSelector']:\n return pulumi.get(self, \"namespace_selector\")",
"def namespace_selector(self) -> Optiona... | [
"0.61505044",
"0.61505044",
"0.61505044",
"0.55928576",
"0.55928576",
"0.55928576",
"0.5499146",
"0.5499146",
"0.5499146",
"0.5199044",
"0.5176694",
"0.5031577",
"0.49377888",
"0.49080932",
"0.4837504",
"0.480669",
"0.48050517",
"0.47186306",
"0.46861464",
"0.46817052",
"0.46... | 0.6185619 | 0 |
ObjectSelector decides whether to run the webhook based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the webhook, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newOb... | def object_selector(self) -> Optional['_meta.v1.outputs.LabelSelectorPatch']:
return pulumi.get(self, "object_selector") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_selector(self) -> Optional['_meta.v1.outputs.LabelSelector']:\n return pulumi.get(self, \"object_selector\")",
"def object_selector(self) -> Optional['_meta.v1.outputs.LabelSelector']:\n return pulumi.get(self, \"object_selector\")",
"def object_selector(self) -> Optional['_meta.v1.out... | [
"0.6456374",
"0.6456374",
"0.6456374",
"0.46324477",
"0.46065933",
"0.458654",
"0.45532456",
"0.45275164",
"0.44931594",
"0.44742954",
"0.44624636",
"0.4437838",
"0.4408795",
"0.43733457",
"0.43727475",
"0.4351329",
"0.42883047",
"0.42864",
"0.42743626",
"0.42642584",
"0.4183... | 0.65048015 | 0 |
RuleWithOperations is a tuple of Operations and Resources. It is recommended to make sure that all the tuple expansions are valid. | def __init__(__self__, *,
api_groups: Optional[Sequence[str]] = None,
api_versions: Optional[Sequence[str]] = None,
operations: Optional[Sequence[str]] = None,
resources: Optional[Sequence[str]] = None,
scope: Optional[str] = None):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_rules(self) -> Optional[Sequence['outputs.NamedRuleWithOperationsPatch']]:\n return pulumi.get(self, \"resource_rules\")",
"def resource_rules(self) -> Optional[Sequence['outputs.NamedRuleWithOperations']]:\n return pulumi.get(self, \"resource_rules\")",
"def _compile_operation_rule(... | [
"0.5899811",
"0.5876412",
"0.56895965",
"0.55191463",
"0.55191463",
"0.54427385",
"0.54427385",
"0.5265505",
"0.52577776",
"0.5196519",
"0.50445557",
"0.5036513",
"0.5015014",
"0.49897045",
"0.49742377",
"0.49478677",
"0.49440655",
"0.49418068",
"0.4930814",
"0.4929354",
"0.4... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.