query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Returns last task in the individual robot buffer. Task is deleted. | def get_last_task(self, robot_id):
individual_buffer = self.all_buffers[robot_id]
data = individual_buffer[0]
individual_buffer = np.delete(individual_buffer, 0, 0)
self.all_buffers[robot_id] = individual_buffer
return data | [
"def get_last_task(self):\n return self.get_task_by_index(-1)",
"def check_last_task(self, robot_id): \n individual_buffer = self.all_buffers[robot_id]\n return individual_buffer[0]",
"def get_task(self): \n task = self.buffer[0]\n self.buffer = np.delete(self.buffer, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check last task info without deletion. | def check_last_task(self, robot_id):
individual_buffer = self.all_buffers[robot_id]
return individual_buffer[0] | [
"def check_repeated_task(self, task):\n task_status = task in self.tasks_asked\n\n # append if never asked\n if task_status == False:\n self.tasks_asked.append(task)\n\n return task_status",
"def check_done(self):\n return not bool(len(self.tasks))",
"def _query_updated... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes task from robot's buffer by task id. | def delete_task_by_id(self, robot_id, task_id):
individual_buffer = self.all_buffers[robot_id]
task_ids = individual_buffer[:, 0]
task_idx = np.where(task_ids == task_id)
if task_idx[0].size == 0:
print("ERROR: Task was already deleted of was never in the buffer.")
... | [
"async def remove_task(self, task_id: str) -> None:",
"def onboard_task_delete(context, task_id):\n return IMPL.onboard_task_delete(context, task_id)",
"async def cancel_and_delete_task(task_id: TaskId):",
"def deleteTask(self, id):\n text = self.generateRequest('/v2.1/Tasks/' + str(id), 'DELETE', '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prints the contents of all buffers. | def print_all_buffers(self):
for robot in range(self.no_robots):
print("Buffer for robot: " + str(robot) + ":")
print("Task ids: X, Y goal: Z orientation: Deadline:")
individual_buffer = self.all_buffers[robot]
if isinstance(individual_... | [
"def dump(self):\n# self.partial_in=\"\"\n# for line in sys.stdin: \n# self.partial_in+=sys.stdin.read(1)\n sys.stdout = sys.__stdout__\n os.system('cls')\n for cb in self.buffers.values():\n cb.dump(sys.stdout)\n sys.stdout = self",
"def printROB(self):... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If all buffers are empty True is returned. | def are_buffers_empty(self):
i = 0
for i in range(self.no_robots):
if self.is_buffer_empty_for_robot(i) is True:
i += 1
else:
return False
if i >= self.no_robots:
return True
else:
pass | [
"def is_empty(self):\n # type: () -> bool\n return not self.unbuffered_elements and not self.buffers",
"def isBufferEmpty(self):\n return self.ecg_buffer.empty()",
"def is_empty(self):\r\n return self.buff==[]",
"def is_full(self):\n return len(self) == self.buffer_size",
"def buf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns task from robot's individual buffer. Returned task has a deadline that ends before the argumented deadline. If there is no such task, current active task is returned. Task is not deleted from the buffer. | def check_task_by_deadline(self, robot_id, deadline):
individual_buffer = self.all_buffers[robot_id]
if individual_buffer.shape[0] == 1:
task = self.check_last_task(robot_id)
return task
elif individual_buffer.shape[0] == 0:
print("ERROR: buffer for ro... | [
"def get_task(self):\n try :\n return self.queue.get_nowait()\n except Empty:\n return None",
"def get_task(self): \n task = self.buffer[0]\n self.buffer = np.delete(self.buffer, 0, 0)\n return task",
"def get_task(self):\n task = self.sched... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add task to buffer. | def add_task(self, task):
self.buffer = np.vstack((self.buffer, task))
return self.buffer | [
"def add_task(self, task):\n heapq.heappush(self.to_run, task)",
"def register(self, task: Task) -> None:\n self._buffer.add(task.future)\n task.add_ready_callback(self._add)",
"def add_task(self, task):\n self.tasks.append(task)",
"def add_task(self, task):\n self.added_ite... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns first task from buffer. Task is deleted. | def get_task(self):
task = self.buffer[0]
self.buffer = np.delete(self.buffer, 0, 0)
return task | [
"def get_first_task(self, robot_id): \n individual_buffer = self.all_buffers[robot_id]\n task = individual_buffer[-1]\n individual_buffer = np.delete(individual_buffer, -1, 0)\n self.all_buffers[robot_id] = individual_buffer\n return task",
"def first(self) -> Task:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a dictionary with ROS publisher objects used for publishing goals. | def create_set_goal_pubs(self):
pubs = {}
for i in range(self.no_robots):
pub_topic = '/robot_' + str(i) + '/move_base/goal'
# pub_name = 'send_goal_robot_' + str(i) # key
pub_name = str(i) # key
pubs[pub_name] = rospy.Publisher(pub_topic, MoveBase... | [
"def create_hand_publishers(self):\n hand_pub = {}\n\n for joint in [\"FFJ0\", \"FFJ3\", \"FFJ4\",\n \"MFJ0\", \"MFJ3\", \"MFJ4\",\n \"RFJ0\", \"RFJ3\", \"RFJ4\",\n \"LFJ0\", \"LFJ3\", \"LFJ4\", \"LFJ5\",\n \"THJ1\", \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns current robot occupancy. If robot isn't moving > 0, if robot is moving > 1. | def get_robot_occupancy(self):
occupancy = np.zeros(self.no_robots)
for i in range(self.no_robots):
status_topic = '/robot_' + str(i) + '/move_base/status'
msg = rospy.wait_for_message(status_topic, GoalStatusArray)
msg_list = msg.status_list
if ms... | [
"def get_occupancy(self):\n return self.occupancy",
"def get_occupancy(self):\n # Compute logo for current alignment\n logo = self.get_logo()\n # Compute occupancy denominator by summing number of occurriencies\n den = np.sum(logo, axis=0)\n # Compute occupancy numerator ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets goal for a robot according to it's id. | def set_goal(self, robot_id, task, pub_msg):
pub_names = self.goal_pubs.keys()
pub_objs = self.goal_pubs.values()
for i in range(len(pub_names)):
if robot_id == int(pub_names[i]):
Goal = MoveBaseActionGoal()
Goal.header.stamp = rospy.Time.now()... | [
"def set_goal(self, goal):\n self._pid_lock.acquire() # Acquire Lock\n self._goal = goal\n self._pid_lock.release() # Release Lock",
"def set_goal(self, **kwargs):\n return self.env.set_goal(**kwargs)",
"def set_goal(self, goal):\n self._reset(self)\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Try to get available user to download. | def get_user(self):
user = None
while user is None:
user = self.use()
if user is None:
logging.info('Waiting for available user to download...')
time.sleep(5)
return user | [
"def required_users(sender, request_user, **kwargs):\n uploaders = set()\n if has_perm(request_user, 'mediafiles.can_see'):\n for mediafile_collection_element in Collection(Mediafile.get_collection_string()).element_generator():\n full_data = mediafile_collection_element.get_full_data()\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set current session Appium. |oAppiumInfo=${AppInfo}| | def aisappium_set_driver_instance(self, oAppiumInfo):
self._cache.current = oAppiumInfo.driver | [
"def appium_init(self):\n desired_cups = {}\n desired_cups['platformName'] = 'Android'\n desired_cups['platformVersion'] = android_version\n desired_cups['deviceName'] = device_name\n desired_cups['appPackage'] = pkg_name\n desired_cups['appActivity'] = activity\n de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Click element on mobile. |locator=xpath=//[="id123"]|oAppiumInfo=${AppInfo} | def aisappium_click_element(self, locator, oAppiumInfo=None):
self._info("Clicking mobile element '%s'." % locator)
if oAppiumInfo is not None:
self._element_find_atlas(locator, True, True, oAppiumInfo.driver).click()
else:
self._element_find(locator, True, True).click() | [
"def on_the_dashboard_click_on_apps(driver):\n assert wait_on_element(driver, 10, '//span[contains(.,\"Dashboard\")]')\n assert wait_on_element(driver, 10, '//mat-list-item[@ix-auto=\"option__Apps\"]', 'clickable')\n driver.find_element_by_xpath('//mat-list-item[@ix-auto=\"option__Apps\"]').click()",
"de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clears the text field identified by `locator`. |locator=xpath=//[="id123"]|oAppiumInfo=${AppInfo} | def aisappium_clear_text(self, locator, oAppiumInfo=None):
self._info("Clear text field '%s'" % locator)
if oAppiumInfo is not None:
self._element_clear_text_by_locator_atlas(locator, oAppiumInfo.driver)
else:
self._element_clear_text_by_locator(locator) | [
"def clear_input_text(self,locator):\n self.element = self._element_finder(locator)\n if self.element:\n self.element.clear()\n log.mjLog.LogReporter(\"WebUIOperation\",\"debug\",\"clear_input_text operation \\\n successful- %s\" %(locator))",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Types the given `text` into text field identified by `locator`. |locator=xpath=//[="id123"]|oAppiumInfo=${AppInfo} See `introduction` for details about locating elements. | def aisappium_input_text(self, locator, text, oAppiumInfo=None):
self._info("Typing text '%s' into text field '%s'" % (text, locator))
if oAppiumInfo is not None:
self._element_input_text_by_locator_atlas(locator, text, oAppiumInfo.driver)
else:
self._element_input_text_b... | [
"def input_text_basic(self, locator, text):\n self.element = self._element_finder(locator)\n if self.element:\n self.element.send_keys(text)\n log.mjLog.LogReporter(\"WebUIOperation\",\"debug\",\"input_text_basic operation successful- %s\" %(locator))",
"def type_into_element(s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Types the given password into text field identified by `locator`. |locator=xpath=//[="id123"]|oAppiumInfo=${AppInfo} Difference between this keyword and `Input Text` is that this keyword does not log the given password. See `introduction` for details about locating elements. | def aisappium_input_password(self, locator, text, oAppiumInfo=None):
self._info("Typing password into text field '%s'" % locator)
if oAppiumInfo is not None:
self._element_input_text_by_locator_atlas(locator, text, oAppiumInfo.driver)
else:
self._element_input_text_by_loc... | [
"def aisappium_input_text(self, locator, text, oAppiumInfo=None):\n self._info(\"Typing text '%s' into text field '%s'\" % (text, locator))\n if oAppiumInfo is not None:\n self._element_input_text_by_locator_atlas(locator, text, oAppiumInfo.driver)\n else:\n self._element_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hides the software keyboard on the device. (optional) In iOS, use `key_name` to press a particular key, ex. `Done`. In Android, no parameters are used. | def aisappium_hide_keyboard(self, oAppiumInfo=None, key_name=None):
if oAppiumInfo is not None:
driver = oAppiumInfo.driver
else:
driver = self._current_application()
driver.hide_keyboard(key_name) | [
"def hide_keyboard(\n self, key_name: Optional[str] = None, key: Optional[str] = None, strategy: Optional[str] = None\n ) -> 'WebDriver':\n ext_name = 'mobile: hideKeyboard'\n try:\n self.assert_extension_exists(ext_name).execute_script(\n ext_name, {**({'keys': [ke... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies that element identified with locator is disabled. Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements. | def aisappium_element_should_be_disabled(self, locator, loglevel='INFO', oAppiumInfo=None):
if oAppiumInfo is not None:
element = self._element_find_atlas(locator, True, True, oAppiumInfo.driver)
else:
element = self._element_find(locator, True, True)
if element.is_enable... | [
"def field_is_not_read_only_xpath(driver, locator):\n elem = driver.find_element_by_xpath(locator)\n is_disabled = elem.get_attribute(\"disabled\")\n if is_disabled == 'true':\n log_to_file('Expected Read Only field to be enabled, but was still disabled', 'WARNING')\n return False\n else:\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies that element identified with locator is enabled. Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements. | def aisappium_element_should_be_enabled(self, locator, loglevel='INFO', oAppiumInfo=None):
if oAppiumInfo is not None:
element = self._element_find_atlas(locator, True, True, oAppiumInfo.driver)
else:
element = self._element_find(locator, True, True)
if not element.is_ena... | [
"def element_enabled(self, locator_method, locator, wait_time=10):\n WebDriverWait(self.driver.instance, wait_time).until(EC.element_to_be_clickable((\n locator_method, locator)))\n print(f\"✅ Element '{locator}' was enabled.\")",
"def aisappium_element_should_be_disabled(self, locator, l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies that element's name identified with locator is equal 'expected'. Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements. | def aisappium_element_name_should_be(self, locator, expected, oAppiumInfo=None):
if oAppiumInfo is not None:
element = self._element_find_atlas(locator, True, True, oAppiumInfo.driver)
else:
element = self._element_find(locator, True, True)
if expected != element.get_attr... | [
"def test_element_name(argument, expected):\n assert element_name(argument) == expected, \\\n (f\"element_name({repr(argument)}) is returning a value of \"\n f\"{element_name(argument)}, which differs from the expected \"\n f\"value of {repr(expected)}.\")",
"def assert_true_element_by_n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies that element's value identified with locator is equal 'expected'. Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements. | def aisappium_element_value_should_be(self, locator, expected, oAppiumInfo=None):
if oAppiumInfo is not None:
element = self._element_find_atlas(locator, True, True, oAppiumInfo.driver)
else:
element = self._element_find(locator, True, True)
if expected != element.get_att... | [
"def element_value_should_contain(self, locator, expected):\n\n\t\tself._info(\"Verifying element '%s' value contains '%s'\" % (locator, expected))\n\t\t\n\t\telement = self._element_find(locator, True, True)\n\t\tvalue = str(element.get_attribute('value'))\n\t\t\n\t\tif expected in value:\n\t\t\treturn\n\t\t\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify that an attribute of an element matches the expected criteria. The element is identified by _locator_. See `introduction` for details about locating elements. If more than one element matches, the first element is selected. The _attr_name_ is the name of the attribute within the selected element. The _match_patt... | def aisappium_element_attribute_should_match(self, locator, attr_name, match_pattern, regexp=False,
oAppiumInfo=None):
if oAppiumInfo is not None:
elements = self._element_find_atlas(locator, False, True, oAppiumInfo.driver)
else:
ele... | [
"def _attribute_matcher(kwargs):\n # This comment stops black style adding a blank line here, which causes flake8 D202.\n def match(node):\n if \"terminal\" in kwargs:\n # Special case: restrict to internal/external/any nodes\n kwa_copy = kwargs.copy()\n pattern = kwa_c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the network connection Status. Android only. | def aisappium_set_network_connection_status(self, connectionStatus, oAppiumInfo=None):
if oAppiumInfo is not None:
driver = oAppiumInfo.driver
else:
driver = self._current_application()
return driver.set_network_connection(int(connectionStatus)) | [
"def change_status():\n if self.on:\n connect.SOCKET.sendall(bytes(\"OFF\\n\", \"utf-8\"))\n self.on = False\n else:\n connect.SOCKET.sendall(bytes(\"ON\\n\", \"utf-8\"))\n self.on = True",
"def SetConnectionStatus(self, state, info):\n self.connect... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return elements that match the search criteria The element is identified by _locator_. See `introduction` for details about locating elements. If the _first_element_ is set to 'True' then only the first matching element is returned. If the _fail_on_error_ is set to 'True' this keyword fails if the search return nothing... | def aisappium_get_elements(self, locator, first_element_only=False, fail_on_error=True, oAppiumInfo=None):
if oAppiumInfo is not None:
element = self._element_find_atlas(locator, first_element_only, fail_on_error, oAppiumInfo.driver)
else:
element = self._element_find(locator, fi... | [
"def find_any(self, *args, **kwargs):\n hits = self.find_elements(*args, **kwargs)\n try:\n return next(hits)\n except StopIteration:\n return None",
"def find_element(**kwargs):\r\n elements = find_elements(**kwargs)\r\n\r\n if not elements:\r\n raise Eleme... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Aa文字大小切换按钮 状态判断 及 切换操作 | def font_operate(self):
x = []
y = []
middle = self.font_middle() # first
large = self.font_large() # second
great = self.font_great() # third
i = 0
j = 0
while i < 3:
bounds = self.content_desc() # 获取输入框坐标
print(middle.get_att... | [
"def font_operation(self):\n y = []\n middle = self.font_middle() # first\n large = self.font_large() # second\n great = self.font_great() # third\n\n i = j = 0\n while i < 3:\n bounds = self.content_desc() # 获取输入框坐标\n print(self.get.checked(middle... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Integration test for crowdsource scenario. Alice is evaluator, others are trainers. | def test_crowdsource():
alice = CrowdsourceClient(
"Alice", alice_data, alice_targets, XORModel, F.mse_loss, 0, deploy=True)
bob = CrowdsourceClient(
"Bob", bob_data, bob_targets, XORModel, F.mse_loss, 1,
contract_address=alice.contract_address)
charlie = CrowdsourceClient(
"... | [
"def test_get_scenarios(self):\n pass",
"def test_get_scenario(self):\n pass",
"def test_create_scenario1(self):\n pass",
"def test_scenario_analysis(self):\n pass",
"def before_scenario(context, scenario):\n pass",
"def before_tester_run(self) -> None:",
"def test_create_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Permite al usuario seleccionar las palabras clave que se usarán en la búsqueda. | def palabras_clave():
keywords = input("Select keywords: ")
keywords = keywords.split()
words = ""
for word in keywords:
words += (word + "+")
keywords = words[:-1]
return keywords | [
"def getClaveColaborador(self, colaborador):\n return self.conexion.ejecutarSQL(\"select contraseña from colaboradores where usuario = '%s'\"%(colaborador))[0][0]",
"def _select_from_key(self, *args):\n # TODO: make it continue through them?\n char = args[0].char.upper()\n for opt in s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
r""" Perform an iterative procedure to find the optimal weights for K direct spectral estimators of DPSS tapered signals. | def _adaptive_weights(yk, eigvals, sides='onesided', max_iter=150):
from multitaper_spectral import mtm_cross_spectrum
K = len(eigvals)
if sides not in [ 'one_sided', 'two_sided' ]:
warnings.warn('Warning: strange input: sides', UserWarning)
if max_iter <= 0:
warnings.warn('Warning: strange input: iterations', ... | [
"def weighted_ps(self, mfactor=1.1):\n self.weightedpower=[]\n #ksum=np.sum(self.psdata[self.klist)\n Nk=int(len(self.klist)/mfactor)\n for i in range(self.Nsubs):\n nsum=np.sum(self.psdata[i][1][0:Nk])\n total=np.sum(np.array([self.psdata[i][1][j]*self.powerspectra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Perform an inverse iteration to find the eigenvector corresponding to the given eigenvalue in a symmetric tridiagonal system. | def _tridi_inverse_iteration(d, e, w, x0=None, rtol=1e-6):
eig_diag = d - w
if x0 is None:
x0 = np.random.randn(len(d))
x_prev = np.zeros_like(x0)
norm_x = np.linalg.norm(x0)
# the eigenvector is unique up to sign change, so iterate
# until || |x^(n)| - |x^(n-1)| ||^2 < rtol
x0 /= norm_x
while np.linalg.norm(... | [
"def eigen_vector_i(self, i):\n return self._eig_vec[:,i]",
"def test_eigen_(self):\n self._X_Y_comparison(\"eig_\", \"ca_eig.txt\", n_components = None)\n for i in np.arange(-10, 10, 0.5):\n self._X_Y_comparison(\"eig_\", \"ca_eig.txt\", n_components = i)",
"def calc_eigendecomp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
place the initial supply of the resource at the start of the game into the capacity_list | def initialize_supply(self):
unit_count = 0
for i in range(self.start_allocation[0 ] -1, self.start_allocation[1]):
for j in range(len(self.capacity_list[i][1])):
self.capacity_list[i][1][j] = 1
unit_count += 1
self.total_supply -= unit_count | [
"def __init__(self, capacity, initial):\n\t\tself.capacity = capacity\n\t\tself.amount = initial",
"def __init__(self, capacity, fillValue = None):\n \n self._items = list() \n self._fillValue = fillValue\n self._DEFAULT_CAPACITY = capacity\n self._logicalSize = 0 #as required b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
print list of resource currently on the board | def show_board(self):
print(self.capacity_list) | [
"def print_resource_details(self):\n print(\"Resources remaining:\")\n #FIXME this is BROKEN. If resource definitions are needed, they must be externally linked.\n #I.e. read a resource file or read from redis or use resource manager\n for resource in resources:\n e_key = self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns PIL.Image objects for all the images in directory. If directory is not specified, uses current directory. Returns a 2tuple containing a list with a PIL.Image object for each image file in root_directory, and a list with a string filename for each image file in root_directory | def get_images(directory=None):
if directory == None:
directory = os.getcwd() # Use working directory if unspecified
image_list = [] # Initialize aggregaotrs
file_list = []
directory_list = os.listdir(directory) # Get list of files
for entry in directory_list:
abso... | [
"def get_images(directory=None):\n \n if directory == None:\n directory = os.getcwd() # Use working directory if unspecified\n\n image_list = [] # Initialize aggregaotrs\n file_list = []\n \n directory_list = os.listdir(directory) # Get list of files\n for entry in directory_list:\n absolute_filename =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assumes model was saved on GPU. Will load based off of cur_dev. | def load(self, path, cur_dev):
if cur_dev == 'cpu':
self.load_state_dict(torch.load(path, map_location=torch.device('cpu')))
else:
self.load_state_dict(torch.load(path))
self.to(torch.device("cuda")) | [
"def load(self):\n # self.model.load_state_dict(torch.load(os.path.join(self.ckpt_dir, 'best_model_state_dict.pt')))\n print(\"In model loading, the self.ckpt_dir is \", self.ckpt_dir)\n path = os.path.join(self.ckpt_dir, 'best_model_forward.pt')\n #path = self.ckpt_dir + 'best_model_for... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes a Status, but is actually unused. Instead you should | def __init__(self: "Status") -> None:
raise NotImplementedError(
"Please instantiate one of the `Status` "
"subclasses:\n"
"\n\t- `Failed`"
"\n\t- `NotStarted`"
"\n\t- `InProgress(progress)`"
"\n\t- `Succeeded`"
) | [
"def __init__(self, status):\n Exception.__init__(self, status)\n self.status = status",
"def status(self, status):\n self.__status = status",
"def status(self, status: dict):\n pass",
"def __init__(self):\n self._status = GoalPursuitReadiness.Status.NOT_READY",
"def statu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines if two status are equal. Two statues are considered equal if they are of the same Status type; if both `Status`es are `InProgress`, then their progress values must compare equal also. | def __eq__(self: "Status", other: "Status") -> bool: # type: ignore
self_type = type(self)
other_type = type(other)
if self_type is InProgress and other_type is InProgress:
return self.progress == other.progress # type: ignore
else:
return self_type == other_ty... | [
"def test_status_comparison(self):\n\n a = Status('OK',0)\n b = Status('OK',0)\n assert a == b\n assert not a is b\n assert Status('Test',0) < Status('Test',1)\n assert Status('Test',1) > Status('Test',0)",
"def __eq__(self, other: Union[int, Status]):\n if isinsta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines if one `Status` is less than another one. | def __lt__(self: "Status", other: "Status") -> bool:
self_type = type(self)
other_type = type(other)
both_not_in_progress = not self.in_progress and not other.in_progress
if both_not_in_progress and self_type is other_type:
return False
elif self_type is Failed:
... | [
"def __lt__(self, other):\n status = self.get_status()\n Ostatus = other.get_status()\n \n if status == Ostatus:\n return self.get_nickname() < other.get_nickname()\n \n if status == \"online\":\n return True\n elif status == \"away\" and Ostatu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines if this `Status` is in progress or not. This is different from a comparison to an `InProgress` because said comparison would require both `Status` to have the same `progress` values (if they are both indeed `InProgress`), while this method returns true for any `InProgress` progress value. | def in_progress(self: "Status") -> bool:
return isinstance(self, InProgress) | [
"def is_in_progress(self) -> bool:\n return bool(not self.is_finished)",
"def __eq__(self: \"Status\", other: \"Status\") -> bool: # type: ignore\n self_type = type(self)\n other_type = type(other)\n\n if self_type is InProgress and other_type is InProgress:\n return self.p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the string representation of this `NotStarted` `Status`. | def __repr__(self: "NotStarted") -> str:
return "NotStarted()" | [
"def status(self):\n if self.started_at:\n return \"Running since %s\" % self.started_at\n return \"Stopped\"",
"def __str__(self):\n sb = ''\n sb += '\\nInterfaceStatus [ ' + self.interface_name + ' ]\\n'\n sb += '\\tLinkState : ' + str(self.InterfaceState.enu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new `InProgress` status. If the given `progress` is not `0 100 progress. | def __init__(self: "InProgress", progress: int = 0) -> None:
self.progress = max(0, min(progress, 100)) | [
"def get_or_create_label_status_in_progress(self):\n\n return self.get_or_create_label(\n name='Status: In Progress',\n color='ffc107'\n )",
"def update_progress(self, progress, message):\n assert 0 <= progress < 100\n self._progress = int(progress)\n self.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the string representation of this `InProgress` `Status`. | def __repr__(self: "InProgress") -> str:
return f"InProgress({self.progress})" | [
"def __str__(self):\n sb = ''\n sb += '\\nInterfaceStatus [ ' + self.interface_name + ' ]\\n'\n sb += '\\tLinkState : ' + str(self.InterfaceState.enumval(self.link)) + '\\n'\n sb += '\\tLineProtoState : ' + str(self.InterfaceState.enumval(self.lineproto)) + '\\n'\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the string representation of this `Succeeded` `Status`. | def __repr__(self: "Succeeded") -> str:
return "Succeeded()" | [
"def success_message(cls):\n return f'Successfully performed \"{cls.display_name.lower()}\"'",
"def get_success_message(cls, args, results):\n return cls.success_message",
"def get_completed(self):\n\n return \"Completed Tasks: \\n\" + self.success",
"def __str__(self):\n struct_re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Disconnect the Google account of the current loggedin user. | def gdisconnect():
# Only disconnect the connected user.
access_token = login_session.get('access_token')
if access_token is None:
response = make_response(
json.dumps('Current user not connected.'), 401)
response.headers['Content-Type'] = 'application/json'
return respo... | [
"def gdisconnect():\r\n # Only disconnect a connected user.\r\n logger.info(\"Inside gdisconnect(), Disconnect google connect session\")\r\n access_token = login_session.get('access_token')\r\n if access_token is None:\r\n response = make_response(\r\n json.dumps('Current user not conn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shortcut to get the flash scope from the view context. | def _flash(self):
return self.response.context[CONTEXT_VAR] | [
"def active(self):\n ctx = current_context()\n return ctx.scope",
"def scope_from_view(view):\n try:\n scope = view.scope_name(view.sel()[0].begin())\n except IndexError:\n scope = view.scope_name(0)\n\n return scope.split(' ')[0]",
"def scope(self):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Flash scope shouldn't be stored in the session if there's no flash. | def test_session_state_for_unused_flash(self):
self.response = self.client.get(reverse(views.render_template))
self.assertFalse(_SESSION_KEY in self.client.session) | [
"def test_session_state_for_used_flash(self):\n self.response = self.client.get(reverse(views.set_flash_var))\n self.response = self.client.get(reverse(views.render_template))\n self.assertTrue(_SESSION_KEY in self.client.session)\n\n # Flash scope should be removed from the session\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Flash scope should be removed from the session if there's no flash. | def test_session_state_for_used_flash(self):
self.response = self.client.get(reverse(views.set_flash_var))
self.response = self.client.get(reverse(views.render_template))
self.assertTrue(_SESSION_KEY in self.client.session)
# Flash scope should be removed from the session
self.r... | [
"def flash_messages(event: NewRequest) -> list:\n flash = []\n\n if hasattr(event.request, 'session'):\n flash = event.request.session.pop('flash', [])\n\n event.request.flash = flash",
"def test_session_state_for_unused_flash(self):\n self.response = self.client.get(reverse(views.render_te... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert a single token into a soundclass. | def _token2soundclass(token, model, stress=STRESS, diacritics=DIACRITICS, cldf=True):
if cldf:
a, sep, b = token.partition('/')
if sep:
token = b or '?'
if not isinstance(model, Model):
model = MODELS[model]
try:
return model[token]
except KeyError:
... | [
"def soundclass(tokens, model='dolgo', stress=STRESS, diacritics=DIACRITICS, cldf=True):\n # raise value error if input is not an iterable (tuple or list)\n if not isinstance(tokens, (tuple, list)):\n raise ValueError(\"Need tuple or list as input.\")\n\n out = []\n for token in tokens:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert tokenized IPA strings into their respective class strings. | def soundclass(tokens, model='dolgo', stress=STRESS, diacritics=DIACRITICS, cldf=True):
# raise value error if input is not an iterable (tuple or list)
if not isinstance(tokens, (tuple, list)):
raise ValueError("Need tuple or list as input.")
out = []
for token in tokens:
out.append(_to... | [
"def process_classification(cls, class_string):\n ipc = r'[A-H][0-9][0-9][A-Z][0-9]{1,4}\\/?[0-9]{1,6}'\n # Last bit can occur 1-3 times then we have \\d+\\\\?\\d+ -\n p = re.compile(ipc)\n classifications = [\n cls(\n match.group(0)[0],\n match.g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lowlevel processing of prosodic strings. | def _process_prosody(sonority):
assert 9 not in sonority[1:-1]
assert sonority[0] == sonority[-1] == 9
# create the output values
psequence = []
first = True # stores whether first syllable is currently being processed
for i in range(1, len(sonority) - 1):
# get a segment with context... | [
"def test_process_string():\n\n sp = StringProcessor()\n assert sp.process_string(\"ab\") == \"\"\n assert sp.process_string(\"ab*\") == \"b\"\n assert sp.process_string(\"ab^\") == \"ba\"\n assert sp.process_string(\"^\") == \"\"",
"def test_process_string():\n decode = StringProcessor()\n a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a prosodic string of the sonority profile of a sequence. | def prosody(sequence, format=True, stress=STRESS, diacritics=DIACRITICS,
cldf=True):
if not sequence:
return []
# get the sonority profile
sonority = [9] + \
ints(soundclass(
sequence, model='art', stress=stress, diacritics=diacritics, cldf=cldf)) + \
[9]
pse... | [
"def _process_prosody(sonority):\n assert 9 not in sonority[1:-1]\n assert sonority[0] == sonority[-1] == 9\n\n # create the output values\n psequence = []\n first = True # stores whether first syllable is currently being processed\n\n for i in range(1, len(sonority) - 1):\n # get a segmen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert a sequence in supposed IPA to the B(road)IPA of CLTS. Notes The mapping is not guaranteed to work as well as the more elaborate mapping with `pyclts`. | def bipa(sequence):
return [_token2clts(segment)[0] for segment in sequence] | [
"def ipa2sca(ipa):\n sca_list = [t for x in tokenize_word_reversibly(ipa)\n for t, char in itertools.zip_longest(\n tokens2class(x, 'sca'),\n \"0\")]\n assert len(''.join(sca_list)) == len(ipa)\n return ''.join(sca_list)",
"def translate(nse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes standings object based on your league ID number and year Required arguments leagueId ID of ESPN league, get from standings page url seasonId Year | def __init__(self, leagueId, seasonId):
self.league_id = leagueId
self.season_id = seasonId
self.league_data = {'leagueId': self.league_id,
'seasonId': self.season_id,
'view': 'official'}
self.soup = self.make_soup(LeagueStandings.b... | [
"def __init__(self, league):\n # Set basic attributes\n self.league = league\n league.season = self\n league.history.seasons.append(self)\n self.year = league.cosmos.year\n # Record name, league offices, and commissioner, since this could change later (i.e.,\n # we c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets HTML standings table | def get_standings(self):
self.standings = self.soup.find('table', id='standingsTable') | [
"def get_html_for_tablestart() -> str:\n html = '<table class=\"sortable w3-table\">'\n return html",
"def getTableFormat(self):\n soup = BeautifulSoup(self.page.content, 'html.parser')\n statsTable = soup.find(id='per_game')\n statTableHead = statsTable.find(\"thead\")\n statTab... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets HTML cumulative stats table | def get_stats(self):
self.stats = self.soup.find('table', id='statsTable') | [
"def _repr_html_(self):\n\n html = [css(\"table\")]\n with self.connection as db:\n for n in db.execute(\"SELECT * FROM cache\"):\n html.append(\"<table class='climetlab'>\")\n html.append(\"<td><td colspan='2'>%s</td></tr>\" % (n[\"path\"],))\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the end_action of this SubscriptionSuspensionCreate. When the suspension reaches the planned end date the end action will be carried out. This action is only executed when the suspension is ended automatically based on the end date. | def end_action(self):
return self._end_action | [
"def end_action(self, end_action):\n if end_action is None:\n raise ValueError(\"Invalid value for `end_action`, must not be `None`\")\n\n self._end_action = end_action",
"def planned_end_date(self):\n return self._planned_end_date",
"def final_action(self):\n return self.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the end_action of this SubscriptionSuspensionCreate. When the suspension reaches the planned end date the end action will be carried out. This action is only executed when the suspension is ended automatically based on the end date. | def end_action(self, end_action):
if end_action is None:
raise ValueError("Invalid value for `end_action`, must not be `None`")
self._end_action = end_action | [
"def end_fact(self, end_fact):\n self._end_fact = end_fact",
"def end_date(self, end_date):\n\n self._end_date = end_date",
"def end_date(self, end_date):\n self._end_date = end_date",
"def end_date_time(self, end_date_time):\n\n self._end_date_time = end_date_time",
"def set_sta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the note of this SubscriptionSuspensionCreate. The note may contain some internal information for the suspension. The note will not be disclosed to the subscriber. | def note(self):
return self._note | [
"def note(self):\n if self._simplecell:\n self.fetch()\n return self._note",
"def note(self) -> str:\n return str(self.get(\"note\") or \"\")",
"def credit_note(self):\n if self.is_null():\n from Acquire.Accounting import CreditNote as _CreditNote\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the note of this SubscriptionSuspensionCreate. The note may contain some internal information for the suspension. The note will not be disclosed to the subscriber. | def note(self, note):
if note is not None and len(note) > 300:
raise ValueError("Invalid value for `note`, length must be less than or equal to `300`")
self._note = note | [
"def note(self, note):\n \n self._note = note",
"def note(self, note):\n\n self._note = note",
"def personal_note(self, personal_note):\n\n self._personal_note = personal_note",
"def notes(self, notes):\n\n self._notes = notes",
"def notes(self, notes: str):\n self.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the planned_end_date of this SubscriptionSuspensionCreate. The planned end date of the suspension identifies the date on which the suspension will be ended automatically. | def planned_end_date(self):
return self._planned_end_date | [
"def planned_end_date(self, planned_end_date):\n if planned_end_date is None:\n raise ValueError(\"Invalid value for `planned_end_date`, must not be `None`\")\n\n self._planned_end_date = planned_end_date",
"def planned_end_date(self, planned_end_date):\n\n self._planned_end_date =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the planned_end_date of this SubscriptionSuspensionCreate. The planned end date of the suspension identifies the date on which the suspension will be ended automatically. | def planned_end_date(self, planned_end_date):
if planned_end_date is None:
raise ValueError("Invalid value for `planned_end_date`, must not be `None`")
self._planned_end_date = planned_end_date | [
"def planned_end_date(self, planned_end_date):\n\n self._planned_end_date = planned_end_date",
"def set_statement_end_date(self, end_date):\n end_date_to_set = None\n if end_date != \"\":\n end_date_to_set = end_date\n else:\n end_date_to_set = self.get_date(last_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the subscription of this SubscriptionSuspensionCreate. | def subscription(self, subscription):
if subscription is None:
raise ValueError("Invalid value for `subscription`, must not be `None`")
self._subscription = subscription | [
"def subscription(self, subscription):\n\n self._subscription = subscription",
"def subscription_state(self, subscription_state):\n\n self._subscription_state = subscription_state",
"def subscription_id(self, subscription_id):\n\n self._subscription_id = subscription_id",
"def flex_subscr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
String representation of the workspace | def __repr__(self):
return "<Workspace({0})>".format(self.name) | [
"def workspace(self) -> ConfigNodePropertyString:\n return self._workspace",
"def __str__(self):\n string = \"\"\"\n Project Factory:\\n\n Directory: {}\\n\n Size: {}\\n\n \"\"\".format(self._directory, len(self.projects))\n return s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes preprocessing combinations that should not occur in a single pipeline. | def remove_incompatible_operations(pipelines):
def find_duplicates(pipelines):
for idx in range(len(pipelines)):
for idx_ in range(idx + 1, len(pipelines)):
if pipelines[idx] == pipelines[idx_]:
return idx
return -1
def _remove_illegal_combinati... | [
"def _build_preprocessing(self):\n\n # For now, do nothing\n pass",
"def cleanup_unused_processors(msm):\n # TODO",
"def decompose(self):\n for feature in self.features:\n for pref_relation in self.get_CPT(feature)[\"pref_relations\"]:\n if len(pref_relation[\"c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reads input_filename and output_filename from command line. creates L4 object and returns the output if it always fired and the output based on the distribution given by the sigmoid function. returns the frequency of different neurons fired over a number of runs. create L23 object and returns what fired in a given run ... | def main():
# -------- input ------------------------
# get command line arguments into args array
args = sys.argv[1:]
if not args or len(args) > 2:
print "usage: input_filename output_filename"
sys.exit(1)
input_file = open(args[0], 'r')
output_filename = args[1]
# get parameters separate... | [
"def main(input, granularity):\n if input == '':\n print('Input should contain a filename.')\n else:\n input = input + '.csv'\n spectra, components = csv_to_spectra(input, granularity)\n metrics = compute_metrics(spectra, components)\n pp(metrics)",
"def main():\n args ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute the probability of a connection at EVERY LOCATION in the matrix Does not depend on the actual observed values of data | def compute_prob_matrix(tgt_latent, tgt_data, model_name='LogisticDistance'):
ss = tgt_latent['relations']['R1']['ss']
ass = tgt_latent['domains']['d1']['assignment']
hps = tgt_latent['relations']['R1']['hps']
data_conn = tgt_data['relations']['R1']['data']
N = data_conn.shape[0]
pred = np.... | [
"def _probabilistic_connect(self, tgt, p):\n if numpy.isscalar(p) and p == 1:\n create = numpy.arange(self.local.sum())\n else:\n rarr = self.probas_generator.get(self.N)\n if not core.is_listlike(rarr) and numpy.isscalar(rarr): # if N=1, rarr will be a single number... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
assumes m is one of the movements 'Up', 'Down', 'Left', 'Right', returns a Board resulting from the movement m | def childAfterMove(self, m):
indexOfZero = self.tiles.index(0)
initial = self.tiles[:]
child = Board(initial)
if m == 'Up':
assert(indexOfZero > 2)
temp = self.tiles[indexOfZero - 3]
child.tiles[indexOfZero] = temp
child.tiles[indexOfZero -... | [
"def make_move(self, board):",
"def get_move(moves):\n pass",
"def legalMoves( self ):\n moves = []\n row, col = self.blankLocation\n if(row != 0):\n moves.append('up')\n if(row != 2):\n moves.append('down')\n if(col != 0):\n moves.append('left')\n if(col != 2):\n moves.append... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if (r,c) is on board, false otherwise. | def is_on_board(self, r, c):
return 0 <= r <= 7 and 0 <= c <= 7 | [
"def is_on_board(x: int, y: int) -> bool:\n return x >= 0 and x < BOARDWIDTH and y < BOARDHEIGHT",
"def is_on_board(x, y):\n # Return true if the coords are on the board, otherwise false\n return x >= 0 and x <= 59 and y >= 0 and y <= 14",
"def check_on_board(cell):\n if cell[0] > 4 or cell[0] < -4 ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the color value of self_color's opponent. | def get_opponent_color(self, self_color):
return abs(self_color - 1) | [
"def _get_opponent_color(self):\n\n if self.number_of_moves_made % 2 == 1:\n return BOARD_SLOT.black\n else:\n return BOARD_SLOT.white",
"def opponent(color):\n if color == WHITE:\n return BLACK\n elif color == BLACK:\n return WHITE\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the amount of self_color's discs on board. | def get_disk_count(self, self_color, board):
count = 0
for r in range(8):
for c in range(8):
if board[r][c] == self_color:
count += 1
return count | [
"def get_num_black_pieces(self):\n return self.num_black_pieces",
"def count_discs(self, player: Player) -> int:\n count = 0\n player_disc = disc.get_disc(player)\n for i in range(self.size):\n for j in range(self.size):\n if self._grid[i][j] == player_disc:\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check whether self_color has any valid moves in direction (delta) of (coords). | def check_moves(self, board, self_color, coords, delta):
found_opponent = False
for i in range(1, 8):
dr = coords[0] + i * delta[0]
dc = coords[1] + i * delta[1]
if self.is_on_board(dr, dc):
if board[dr][dc] == self_color:
... | [
"def _is_move_valid(\n self, start: tuple[int, int, int], goal: tuple[int, int, int]\n ) -> bool:\n moves = 0\n for x, y in zip(start, goal):\n if y != x and x == 0:\n moves += 1\n elif y != x:\n return False\n return moves == 1",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns all moves self_color could make on the given board. | def find_possible_moves(self, board, self_color):
possible_moves = []
delta = [(0,-1), (-1,-1), (-1,0), (-1,1), (0,1), (1,1), (1,0), (1,-1)]
for r in range(len(board)):
for c in range(len(board[r])):
if board[r][c] == self_color:
for i in r... | [
"def get_all_possible_moves(self):\r\n moves = []\r\n for i in range(8):\r\n for j in range(8):\r\n color = self.board[i][j][0]\r\n if (color == 'b' and not self.turn_white) or (color == 'w' and self.turn_white):\r\n p_type = self.board[i][j]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find discs that need to be flipped to update the board. | def find_flippable_disks(self, board, self_color, coords, delta):
found_opponent = False
flip_positions = []
for i in range(1, 8):
dr = coords[0] + i * delta[0]
dc = coords[0] + i * delta[1]
if self.is_on_board(dr, dc):
if board[dr][dc... | [
"def get_pieces_to_flip(board, move):\r\n total_pieces_to_flip = []\r\n\r\n turn = board.turn\r\n if turn == 'white':\r\n opposite_turn = 'black'\r\n else:\r\n opposite_turn = 'white'\r\n\r\n for i in range(1, 9):\r\n adjacent = (move[0] + directions[i][0], move[1] + directions[i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a rough approximation of the amount of stable disks self_color has in a particular corner. | def get_stable_disks(self, board, self_color, corner_coords):
step_row = 1 if corner_coords[0] == 0 else -1
step_col = 1 if corner_coords[1] == 0 else -1
bound_row = abs(corner_coords[0] - 7)
bound_col = abs(corner_coords[1] - 7)
cur_row = corner_coords[0]
cur_c... | [
"def get_disk_count(self, self_color, board):\r\n count = 0\r\n for r in range(8):\r\n for c in range(8):\r\n if board[r][c] == self_color:\r\n count += 1\r\n return count",
"def get_relative_number_of_inter_stroke_intersections(self):\n ret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prints the information about control keys to the command line. | def print_controls(self):
print("TAKEOFF: {}".format(self._control_keys(COMMAND_TAKEOFF)))
print("LAND: {}".format(self._control_keys(COMMAND_LAND)))
print("EMERGENCY: {}".format(self._control_keys(COMMAND_EMERGENCY)))
print("HOVER: {}".format(self.... | [
"def _print_instructions(self):\n print('Enter the index of a signal to set the control change for, or `q` '\n 'when done.')\n fmt = '{:>6}\\t{:<20}\\t{:>6}'\n print(fmt.format('Index', 'Control', 'Current'))\n for i, signal in enumerate(self._signals):\n print(fmt.format(i + 1, signal, se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a list of control keys for the given command. | def _control_keys(self, command):
return [key for key, comm in self.KEY_TO_COMMAND.items() if comm == command] | [
"def get_control_ids(self) -> List[str]:\n return self._control_dict.keys()",
"def cli(ctx):\n return ctx.gi.cannedkeys.get_keys()",
"def read_keys(self) -> list[KeyPress]:",
"def get_command_names(self):\n return list(self.commands.keys())",
"def get_keyboard_command(self):\n key_pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reads raw corpus from `RAW_CORPUS_PATH`. | def get_raw_corpus():
with open(RAW_CORPUS_PATH, 'r') as f:
return f.read().splitlines() | [
"def read_corpus_from_file(input_file): \n \n print ('reading corpus')\n file = open(input_file, 'r')\n corpus = file.read()\n return corpus",
"def load_corpus_txt(path):\n try: \n with open(path, encoding=\"utf-8\", mode=\"r+\") as f:\n text = \"\"\n for line ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reads raw datetimes from `RAW_DATETIMES_PATH`. | def get_raw_datetimes():
raw_datetimes = []
with open(RAW_DATETIMES_PATH, 'r') as f:
for x in f.read().splitlines():
try:
raw_datetimes.append(datetime.datetime(year=int(x[1:5]), month=int(x[6:8]), day=int(x[9:11])))
except ValueError:
raw_datetime... | [
"def get_raw_data():\n raw_corpus = get_raw_corpus()\n raw_datetimes = get_raw_datetimes()\n raw_data = []\n for i, raw_datetime in enumerate(raw_datetimes):\n raw_data.append([raw_datetime, raw_corpus[i]])\n return raw_data",
"def parse_data_from_file(path):\n print(path.stem)\n \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transforms `raw_corpus` and `raw_dates` into a list of lists where each inner list is a timestamped article. | def get_raw_data():
raw_corpus = get_raw_corpus()
raw_datetimes = get_raw_datetimes()
raw_data = []
for i, raw_datetime in enumerate(raw_datetimes):
raw_data.append([raw_datetime, raw_corpus[i]])
return raw_data | [
"def solr_transformed_dates(solr_client: Solr, parsed_dates: typing.List):\n return [solr_client._from_python(date) for date in parsed_dates] # pylint: disable=protected-access",
"def to_twodim_list(self):\n if self._timestampFormat is None:\n return self._timeseriesData\n\n datalist =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts `article_sents` into a single string. | def get_article_str(article_sents):
article_str = ""
for nlp_sent in article_sents:
article_str += (' ' + nlp_sent.text + ' ')
return article_str | [
"def get_article_as_string(article,\n preprocess_type=PreprocessWordType.LEMMATIZE):\n article_string = ''\n for word in article.words:\n preprocessed_word = query_utils.preprocess_word(word, preprocess_type)\n if article_string == '':\n article_string = prepr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show detail of topology, device and more. Show [topology, device] | def do_show(self, args):
args = args.split(" ")
if args[0] == '':
print("Incorrect command.")
return
elif args[0] == 'device':
if len(args) < 2:
if len(self.topology.devices) == 0:
print("No device in this topology.")
... | [
"def show_device_information_long(self):\n\n for device in self._devices:\n print(\"\")\n if device['Device Type'].startswith(\"enclosu\"):\n if device.get('Device Type'):\n print(\"{0:>32}: {1}\".format(\"Device Type\", device['Device Type']))\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enter to device mode | def do_device(self, args):
self.device_command.cmdloop("Enter to device mode") | [
"def _turn_on_dev_mode(self):\n if self._device is not None:\n self._char_write(self._BLE_SERVICE_ANTI_DOS,\n [ord(c) for c in self._ANTI_DOS_MESSAGE])\n self._char_write(self._BLE_SERVICE_TX_POWER,\n [self._TX_POWER_VALUE])\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enter to config mode | def do_config(self, args):
self.config_command.cmdloop("Enter to config mode") | [
"def on_config(self, e):\n self.config_window = configwindow.ConfigWindow(self)\n self.config_window.Show()",
"def state_choose_enter(cfg, app, win):",
"def state_chosen_enter(cfg, app, win):",
"def enter_config_mode(device_info, telnet_conn, read_delay=1):\n\n if(check_config_mode(device_inf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds the enemy board. Arguments boardDimensions dimensions of the (square) enemy board. shipsAfloat the size and counts of the initial enemy fleet. | def __init__(self, boardDimensions, shipsAfloat):
self.enemyBoard = [[BoardState.OPEN for j in range(boardDimensions)] for i in range(boardDimensions)]
self.boardDimensions = boardDimensions
self.shipsAfloat = shipsAfloat | [
"def _create_fleet(self):\n # Create an enemy and find the number of enemies in a row.\n # Spacing between each enemy is equal to one enemy width.\n\n if self.settings.current_player == '1':\n self.enemy_model = pygame.image.load(\n ENEMY_MODELS_DANIELA[rand(\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For debugging purposes, prints the remaining ships afloat. | def printShipsAfloat(self):
logging.debug("ships afloat")
sb = []
for size in self.shipsAfloat:
number = self.shipsAfloat[size]
sb.append(str(size))
sb.append(":")
sb.append(str(number))
sb.append(" ")
logging.debug("".... | [
"def printShipsToSink(self):\r\n sb = []\r\n for sinkingShip in self.shipsToSink:\r\n shot = self.mapToShot(sinkingShip.bullseye)\r\n sb.append(str(shot))\r\n sb.append(\":\")\r\n sb.append(str(sinkingShip.size))\r\n sb.append(\" \")\r\n lo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates internal state given the results of a shot. Arguments shot Shot of the form LetterNumber. hit True, if the shot was a hit. sunk Size of the sunk ship, if the shot sunk it. | def shotResult(self, shot, hit, sunk):
logging.debug("shot result: %s, hit: %d, sunk: %d" % (shot, hit, sunk))
coordinates = self.mapToCoordinates(shot)
# If a ship was sunk, remove it from the fleet.
if sunk:
sunk = str(sunk)
assert(self.shipsAfloat[sunk] >... | [
"def shotResult(self, shot, hit, sunk):\r\n ShotSelector.shotResult(self, shot, hit, sunk)\r\n coordinates = self.mapToCoordinates(shot)\r\n if sunk:\r\n self.shipsToSink.append(SinkingShip(coordinates, sunk))\r\n self.sinkShips()\r\n self.printShipsAfloat()\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Maps a shot to x and y coordinates. | def mapToCoordinates(self, shot):
toks = shot.split("-")
return Coordinates(ord(toks[0]) - ord("A"), int(toks[1]) - 1) | [
"def _get_shot_coordinates(self, shot):\n origin_x = shot['x1']\n origin_y = shot['y1']\n end_x = shot['x2']\n end_y = shot['y2']\n return origin_x, origin_y, end_x, end_y",
"def mapToShot(self, coordinates):\r\n return chr(coordinates.x + ord(\"A\")) + \"-\" + str(coordi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Maps x and y coordinates to a shot. | def mapToShot(self, coordinates):
return chr(coordinates.x + ord("A")) + "-" + str(coordinates.y + 1) | [
"def _get_shot_coordinates(self, shot):\n origin_x = shot['x1']\n origin_y = shot['y1']\n end_x = shot['x2']\n end_y = shot['y2']\n return origin_x, origin_y, end_x, end_y",
"def mapToCoordinates(self, shot):\r\n toks = shot.split(\"-\")\r\n return Coordinates(ord(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For debugging purposes, prints the ships that are sinking. | def printShipsToSink(self):
sb = []
for sinkingShip in self.shipsToSink:
shot = self.mapToShot(sinkingShip.bullseye)
sb.append(str(shot))
sb.append(":")
sb.append(str(sinkingShip.size))
sb.append(" ")
logging.debug("".join(sb)) | [
"def sinkShips(self):\r\n while True:\r\n stillSinkingShips = False\r\n for i in range(len(self.shipsToSink) - 1, -1, -1):\r\n sunkShip, shipCoordinates = self.positionAndSinkShip(self.shipsToSink[i])\r\n if sunkShip:\r\n stillSinkingShip... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Weights the board by placing all remaining ships in all possible positions. The more ways a ship can be placed over a particular set of coordinates, the higher the weight. Positions that overlay previous hits are given extra weight. | def weightBoard(self):
directions = (Direction.East, Direction.South)
for size, count in self.shipsAfloat.items():
size = int(size)
for i in range(self.boardDimensions):
for j in range(self.boardDimensions):
for direction in directions:
... | [
"def postion_fleet(self, ships_positions, board):\n for cell in ships_positions:\n row = ord(cell[:1]) - ord('A')\n col = int(cell[1:]) - 1\n for i in range(row, row + self.total_rows_req):\n for j in range(col, col + self.total_column_req):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Recursive function that positions a ship in a particular direction and applies the weights. Arguments coordinates The coordinate to check. size The size of the ship. weight The weight to apply if this coordinate can hold a ship. direction The direction to move as the ship is being placed. hitWeight The extra amount of ... | def weightShipSearch(self, coordinates, size, weight, direction, hitWeight):
if size == 0:
# Successfully searched the required size.
return True, hitWeight
if coordinates.x < 0 or coordinates.y < 0 or coordinates.x == self.boardDimensions or coordinates.y == self.boa... | [
"def sinkShipSearch(self, coordinates, size, direction):\r\n if size == 0:\r\n # Successfully searched the required size.\r\n return True, []\r\n if coordinates.x < 0 or coordinates.y < 0 or coordinates.x == self.boardDimensions or coordinates.y == self.boardDimensions:\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Puts all of the weighted coordinates in a priority queue and selects the coordinate with the most weight. Return bestCoordinates The highest weighted coordinates. | def selectBestCoordinates(self):
coordinatesQueue = []
# It's highly likely that there are going to be a lot of coordinates with the same "most" weight. Rather
# than always choosing the leftmost coordinates, make a random choice by adding a random tie breaker to the
# priority.
... | [
"def _find_best_p_q(self, tuples):\n best_diff = None # optimal difference between p and q\n best_tuple = None\n\n for tuple in tuples:\n diff = abs(tuple[0] - tuple[1]) # difference between p and q\n if best_diff == None:\n best_diff = diff\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attempts to sink as many sinking ships as possible given the shot result. Arguments shot Shot of the form LetterNumber. hit True, if the shot was a hit. sunk Size of the sunk ship, if the shot sunk it. | def shotResult(self, shot, hit, sunk):
ShotSelector.shotResult(self, shot, hit, sunk)
coordinates = self.mapToCoordinates(shot)
if sunk:
self.shipsToSink.append(SinkingShip(coordinates, sunk))
self.sinkShips()
self.printShipsAfloat()
self.printShips... | [
"def shotResult(self, shot, hit, sunk):\r\n logging.debug(\"shot result: %s, hit: %d, sunk: %d\" % (shot, hit, sunk))\r\n coordinates = self.mapToCoordinates(shot)\r\n # If a ship was sunk, remove it from the fleet.\r\n if sunk:\r\n sunk = str(sunk)\r\n assert(self.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attempts to sink all sinking ships by positioning them in all possible positions . If there's not enough information to sink them, the board remains asis. For every ship that's sunk marks all of its coordinates as SUNK to prevent them from being used in subsequent shot selections. | def sinkShips(self):
while True:
stillSinkingShips = False
for i in range(len(self.shipsToSink) - 1, -1, -1):
sunkShip, shipCoordinates = self.positionAndSinkShip(self.shipsToSink[i])
if sunkShip:
stillSinkingShips = True
... | [
"def positionAndSinkShip(self, sinkingShip):\r\n directions = [Direction.North, Direction.South, Direction.East, Direction.West]\r\n sunkShip = False\r\n shipCoordinates = None\r\n for direction in directions:\r\n tSunkShip, tShipCoordinates = self.sinkShip(sinkingShip.bullsEy... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Positions a sinking ship in all possible positions and tries to sink it. Arguments sinkingShip The ship to position. Returns sunkShip True if the ship was sunk, False if not. shipCoorindates Only valid if the ship was sunk, the coordinates of the sunk ship. | def positionAndSinkShip(self, sinkingShip):
directions = [Direction.North, Direction.South, Direction.East, Direction.West]
sunkShip = False
shipCoordinates = None
for direction in directions:
tSunkShip, tShipCoordinates = self.sinkShip(sinkingShip.bullsEye, sinkingShip.... | [
"def sinkShips(self):\r\n while True:\r\n stillSinkingShips = False\r\n for i in range(len(self.shipsToSink) - 1, -1, -1):\r\n sunkShip, shipCoordinates = self.positionAndSinkShip(self.shipsToSink[i])\r\n if sunkShip:\r\n stillSinkingShip... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Skips over the BULLSEYE before placing the sinking ship as the BULLSEYE will cause early search termination. Arguments bullsEye The coordinates of the shot that caused the ship to start sinking. size The size of the ship. direction The direction to move as the ship is being placed. Returns sunkShip True if the ship was... | def sinkShip(self, bullsEye, size, direction):
sunkShip, shipCoordinates = self.sinkShipSearch(Coordinates(bullsEye.x + direction.x, bullsEye.y + direction.y), size - 1, direction)
if sunkShip:
shipCoordinates.append(bullsEye)
return sunkShip, shipCoordinates | [
"def sinkShipSearch(self, coordinates, size, direction):\r\n if size == 0:\r\n # Successfully searched the required size.\r\n return True, []\r\n if coordinates.x < 0 or coordinates.y < 0 or coordinates.x == self.boardDimensions or coordinates.y == self.boardDimensions:\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Recursive function that positions a sinking ship in a particular direction to see if can be sunk. Arguments bullsEye The coordinates of the shot that caused the ship to start sinking. size The size of the ship. direction The direction to move as the ship is being placed. Returns sunkShip True if the ship was sunk, Fals... | def sinkShipSearch(self, coordinates, size, direction):
if size == 0:
# Successfully searched the required size.
return True, []
if coordinates.x < 0 or coordinates.y < 0 or coordinates.x == self.boardDimensions or coordinates.y == self.boardDimensions:
# Can't g... | [
"def sinkShip(self, bullsEye, size, direction):\r\n sunkShip, shipCoordinates = self.sinkShipSearch(Coordinates(bullsEye.x + direction.x, bullsEye.y + direction.y), size - 1, direction)\r\n if sunkShip:\r\n shipCoordinates.append(bullsEye)\r\n return sunkShip, shipCoordinates",
"de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Purpose NOTE THAT THIS FUNCTION IS INTENDED TO BE USED FOR THE `apply()` METHOD OF A PANDAS DATAFRAME WITH THE AXIS PARAMETER SET TO `"columns"` or `1`. The purpose of this function is to take the information about an event and return as a int the starting point of the event. Something that is important to note is that... | def event_starting_point_extractor(row) -> int:
to_return = None
# First, define the variables that we will need for the rest of this
# function.
positions_list = literal_eval(row["positions"])
assert isinstance(positions_list, list)
assert 1 <= len(positions_list) <= 2
# Next, extract the ... | [
"def event_ending_point_extractor(row) -> int:\n to_return = None\n # First, define the variables that we will need for the rest of this\n # function.\n positions_list = literal_eval(row[\"positions\"])\n assert isinstance(positions_list, list)\n assert 1 <= len(positions_list) <= 2\n\n # Next,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Purpose NOTE THAT THIS FUNCTION IS INTENDED TO BE USED FOR THE `apply()` METHOD OF A PANDAS DATAFRAME WITH THE AXIS PARAMETER SET TO `"columns"` or `1`. The purpose of this function is to take the information about an event and return as a int the ending point of the event. Something that is important to note is that t... | def event_ending_point_extractor(row) -> int:
to_return = None
# First, define the variables that we will need for the rest of this
# function.
positions_list = literal_eval(row["positions"])
assert isinstance(positions_list, list)
assert 1 <= len(positions_list) <= 2
# Next, extract the st... | [
"def event_starting_point_extractor(row) -> int:\n to_return = None\n # First, define the variables that we will need for the rest of this\n # function.\n positions_list = literal_eval(row[\"positions\"])\n assert isinstance(positions_list, list)\n assert 1 <= len(positions_list) <= 2\n\n # Nex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Purpose The purpose of this function is to take a DataFrame that contains all of the events of set piece sequences that belong to a particular cluster of interest and create a new DataFrame that for each event explicitly lists its starting point and ending point on the soccer pitch. | def cluster_positions_extractor(
cluster_events_df: pd.DataFrame) -> pd.DataFrame:
to_return = None
# First, validate the input data
ipv.parameter_type_validator(expected_type=pd.DataFrame,
parameter_var=cluster_events_df)
normed = cluster_events_df.reset_index(d... | [
"def sequence_onset(dataframe, onset_x_col='onset_correct', onset_y_col='onset_incorrect', name_chan_dict={'x':'C','y':'I','resp':'R'},\\\r\n resp_time_col='resp_time', min_lat_difference=0):\r\n import pandas as pd\r\n \r\n seq_list = []\r\n\r\n for index, trial in dataframe.iterrows(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Purpose The purpose of this function is to take the positions (whether its the starting or ending as specified by the user) of the events that comprise the sequences that belong to the cluster of interest and conduct a 2dimensional binning so as to determine the spatial distribution of events in said cluster. | def cluster_positions_binning(
cluster_positions_df: pd.DataFrame, beginning_points=True) -> tuple:
to_return = None
# First, validate the input data
ipv.parameter_type_validator(expected_type=pd.DataFrame,
parameter_var=cluster_positions_df)
# Next, define the ... | [
"def _assignbins_2d(coordinates, bin_size):\n x_min, x_max = np.min(coordinates[:,0]), np.max(coordinates[:,0])\n y_min, y_max = np.min(coordinates[:,1]), np.max(coordinates[:,1])\n\n x_length = (x_max - x_min)\n y_length = (y_max - y_min)\n\n x_center = x_min + (x_length/2)\n y_center = y_min + (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |