query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Transfer data from one column to another in the Measurement Set | def transfer_data(self, column_in, column_out):
self.open_msfile()
data_in = self.read_col(column_in)
self.open_msfile(nomodify=False)
self.tb.putcol(column_out, data_in)
self.close_msfile() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manipulateData(columnNumber, dataset):\r\n\r\n #Make data the first colum and columnNumber column only\r\n uuid = dataset.at[0, columnNumber]\r\n newData = dataset.iloc[1:, 0: columnNumber + 1: columnNumber]\r\n timesColumn = dataset.loc[1:, 1]\r\n newData = newData.astype(float)\r\n newData ... | [
"0.58232236",
"0.5593612",
"0.5589331",
"0.55474955",
"0.55278325",
"0.5509298",
"0.54993767",
"0.5491314",
"0.53649133",
"0.52494544",
"0.52450836",
"0.52394146",
"0.52272606",
"0.5226081",
"0.52146274",
"0.52061564",
"0.51992697",
"0.5190929",
"0.5175776",
"0.51704514",
"0.... | 0.5719916 | 1 |
Convert Measurement set to uvfits file | def convert_to_uvfits(self, uvfits_name, overwrite=False):
# NOTE: The phase center shifts to (0.0, 0.0) during the conversion
ctk.exportuvfits(self.msfile, uvfits_name, overwrite=overwrite) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_uem(uemf, uem, n_digits=3):\n with open(uemf, 'wb') as f:\n for file_id in sorted(iterkeys(uem)):\n for onset, offset in sorted(uem[file_id]):\n line = ' '.join([file_id,\n '1',\n format_float(onset, n_dig... | [
"0.59630764",
"0.5706561",
"0.53236437",
"0.5267373",
"0.5232523",
"0.52308166",
"0.5225233",
"0.5186095",
"0.5159462",
"0.51572955",
"0.5152818",
"0.5151516",
"0.51237893",
"0.51043826",
"0.51003903",
"0.509759",
"0.5050525",
"0.50395685",
"0.50338125",
"0.5017286",
"0.50093... | 0.6504095 | 0 |
Make sure that when we reopen a file because the inode has changed, we open to the right location. | def test_reopen_changed_inode(tmp_path):
path1 = tmp_path / "file"
path2 = tmp_path / "changed_file"
with open(path1, "w") as f:
for i in range(1000):
print(f"{i}", file=f)
with open(path2, "w") as f:
for i in range(2000):
print(f"{i}", file=f)
file_info =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reopen(self):\n self.close()\n self._fileobj = os.fdopen(os.open(str(self.path), os.O_CREAT | os.O_RDWR, 384), \"r+b\", 0)",
"def reopen(self):\n self.close()\n self._fileobj = os.fdopen(\n os.open(str(self.path), os.O_CREAT | os.O_RDWR, 384), \"r+b\", 0\n )",
... | [
"0.6775823",
"0.67754513",
"0.65995735",
"0.6587164",
"0.6586195",
"0.6561913",
"0.6408571",
"0.621443",
"0.6102716",
"0.6087001",
"0.6087001",
"0.5911594",
"0.58738005",
"0.5827413",
"0.57688123",
"0.5745305",
"0.57410425",
"0.573082",
"0.5726611",
"0.5717674",
"0.5699772",
... | 0.7729124 | 0 |
Importing Ray used to cause `logging.makeRecord` to use the default record factory, rather than the factory set by `logging.setRecordFactory`. This tests validates that this bug is fixed. | def test_ray_does_not_break_makeRecord():
# Make a call with the cli logger to be sure that invoking the
# cli logger does not mess up logging.makeRecord.
with redirect_stdout(None):
cli_logger.info("Cli logger invoked.")
mockRecordFactory = Mock()
try:
logging.setLogRecordFactory(m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_make_record_function():\n prev_factory = logging.getLogRecordFactory()\n\n def make_record(*arguments, **kwargs):\n record = prev_factory(*arguments, **kwargs)\n return _synchrolog_record_factory(record)\n\n return make_record",
"def _record(self):\n record_attr = {\n ... | [
"0.6236432",
"0.595841",
"0.5396664",
"0.51976943",
"0.518653",
"0.51287144",
"0.51224285",
"0.510316",
"0.5082014",
"0.5011037",
"0.49948853",
"0.49832702",
"0.4978337",
"0.49604952",
"0.4953547",
"0.49422857",
"0.49270672",
"0.489807",
"0.48801783",
"0.48780963",
"0.4866809... | 0.7394546 | 0 |
Function to perform PII scan | def performPII(filename):
print(f'***PERFORM PII: {filename}')
with open(filename, "r") as f:
fullfile = f.readlines()
result = []
for line in fullfile:
if REPLACE_TEXT in line:
res = re.sub(r"Users?\\+[a-zA-Z.0-9]+", r"Users\\<u>", line)
res1 = re.sub(r':[\s]?"[a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scan(self, mask):",
"def scan(self) -> List[int]:",
"def scan(self) -> List[int]:",
"def scan(self) -> list[int]:",
"def _scan(self): # pragma: no cover\n raise NotImplementedError()",
"def Scan(self, plugin):\n raise 'Method not implemented'",
"def script_scan(self):\n self._... | [
"0.65596026",
"0.62054896",
"0.62054896",
"0.6164332",
"0.5998671",
"0.59204054",
"0.5813969",
"0.5758621",
"0.56847495",
"0.56796247",
"0.56688553",
"0.5576477",
"0.54695153",
"0.5447298",
"0.54414886",
"0.5413166",
"0.5409423",
"0.5366492",
"0.53627986",
"0.52971727",
"0.52... | 0.62964374 | 1 |
Prepend a value to the beginning of the list. | def prepend(self, value):
if self.head is None:
self.head = Node(value)
return
new_node = Node(value)
new_node.next = self.head
self.head = new_node | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepend(self, value):\n pass",
"def prepend(self, item: Any):\n self.insert(0, item)",
"def prepend(self, x):\n self.insert(0, x)",
"def prepend(self, *args):\n return _libsbml.ListWrapperSBase_prepend(self, *args)",
"def prepend(self, in_items):\n\n items = self.list... | [
"0.8317461",
"0.7703864",
"0.76706845",
"0.74701613",
"0.7348015",
"0.7225708",
"0.7132274",
"0.689888",
"0.6890011",
"0.687966",
"0.6816932",
"0.6731809",
"0.67170197",
"0.6663008",
"0.6539581",
"0.6505828",
"0.65012324",
"0.6495",
"0.64920115",
"0.6425391",
"0.6424154",
"... | 0.77495795 | 1 |
Search the linked list for a node with the requested value and return the node. | def search(self, value):
node = self.head
while node:
if node.value == value:
return node
node = node.next
raise ValueError('Value not found') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_node(self, value):\n cur = self.first\n while cur:\n if cur.value == value:\n return cur\n cur = cur.next\n return None",
"def search(self, val):\n current = self.head\n # import pdb; pdb.set_trace()\n while current is not No... | [
"0.86444634",
"0.8273496",
"0.8144617",
"0.8143377",
"0.8091542",
"0.8027057",
"0.77055156",
"0.75110245",
"0.7502115",
"0.74791056",
"0.74587744",
"0.7358435",
"0.72910225",
"0.7215687",
"0.71858066",
"0.71661836",
"0.7138784",
"0.7113469",
"0.7101064",
"0.7096889",
"0.70412... | 0.8764713 | 0 |
Insert value at pos position in the list. If pos is larger than the length of the list, append to the end of the list. | def insert(self, value, pos):
if self.head is None:
self.head = Node(value)
return
if pos == 0:
self.prepend(value)
return
index = 0
node = self.head
while node.next and index <= pos:
if (pos - 1) == inde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, pos, item):\n \n if pos == 0:\n self.add(item)\n \n elif pos >= self.length():\n self.append(item)\n \n else:\n previous = None\n current = self.head\n \n for _ in range(pos):\n ... | [
"0.7365507",
"0.71653986",
"0.7131035",
"0.70607984",
"0.7060087",
"0.6903673",
"0.6818579",
"0.67716753",
"0.6679426",
"0.66339636",
"0.6624288",
"0.6520374",
"0.6493936",
"0.6466639",
"0.64303565",
"0.63194513",
"0.6312773",
"0.62931496",
"0.6289725",
"0.6266714",
"0.626271... | 0.7602359 | 0 |
Deserialize privilege bytes to Privileges object. | def deserialize(cls, priv_bytes: bytes) -> object:
if len(priv_bytes) not in (0, 1, 3):
raise ValueError("Invalid privilege bytes")
priv_bytes += (3 - len(priv_bytes)) * b'\0'
value = bytes_to_int_big_endian(priv_bytes)
lst = cls()
for key, bits in cls._MAP.items():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deserialize(self, byte: bytes):\n pass",
"def from_pem(cls, data, password=None):\n p = cls()\n private_from_encoding(data, p, password)\n return p",
"def from_binary(self, d):\n p = MsgEd25519SignatureDepA._parser.parse(d)\n for n in self.__class__.__slots__:\n setat... | [
"0.5320958",
"0.5281915",
"0.52777076",
"0.52333075",
"0.51927114",
"0.51070666",
"0.5058015",
"0.5019592",
"0.50140345",
"0.5010676",
"0.4996001",
"0.49813634",
"0.4941202",
"0.4928008",
"0.4924398",
"0.49172363",
"0.49156976",
"0.48830962",
"0.4876608",
"0.48694396",
"0.486... | 0.71521014 | 0 |
Serialize Privileges to privilege bytes. | def serialize(self, n_bytes: int = 3) -> bytes:
value = 0
# This masks clears 'security_domain' bit
check_mask = ~(self._MAP['SECURITY_DOMAIN'][0])
for priv in self:
set_bits = self._MAP[priv][0]
if (value & check_mask) & set_bits != 0:
raise Value... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __bytes__(self):\n byteout = bytearray()\n for index in range(1, 15):\n key = \"d\" + str(index)\n if self._user_data.get(key) is not None:\n byteout.append(self._user_data[key])\n else:\n byteout.append(0x00)\n return bytes(by... | [
"0.5824203",
"0.57819706",
"0.5508372",
"0.54918075",
"0.5487138",
"0.5451303",
"0.542187",
"0.542187",
"0.542187",
"0.53858984",
"0.53761977",
"0.53647023",
"0.533796",
"0.533434",
"0.533434",
"0.52456355",
"0.52057683",
"0.516433",
"0.51384103",
"0.5122727",
"0.512248",
"... | 0.62342376 | 0 |
Set The Title And The Icon Of The Main Window | def set_title_and_icon():
pygame.display.set_caption("Sukodu")
icon = pygame.image.load("assets/icon.png")
pygame.display.set_icon(icon) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def showBasic(self):\n self.setWindowIcon(QIcon(self.icon))\n self.setWindowTitle(self.title)\n self.setGeometry(*self.posXY, *self.windowSize)\n self.show()",
"def __init__(self, title):\n super(TXWindowHeader, self).__init__()\n self.setupUi(self)\n self.window_... | [
"0.7387999",
"0.72235245",
"0.70776117",
"0.70550996",
"0.69922644",
"0.69855475",
"0.68707806",
"0.6845815",
"0.6811798",
"0.6764755",
"0.6720163",
"0.6626838",
"0.66072255",
"0.6593078",
"0.6582844",
"0.65729517",
"0.6561191",
"0.65342915",
"0.64890605",
"0.6480931",
"0.645... | 0.77098817 | 0 |
Load All The Buttons | def load_buttons(self):
self.playing_buttons.append(Button(20, 40, 100, 40, "New Game")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_all_buttons(self) -> bool:\n raise NotImplementedError",
"def show_main_buttons(self):\n pass",
"def create_buttons(self):\r\n return []",
"def generate_buttons(self):\n # Put up a progress dialog\n self.get_world_progress = QtWidgets.QProgressDialog(self.mainwindo... | [
"0.7483391",
"0.7030409",
"0.7026208",
"0.689735",
"0.686187",
"0.6792814",
"0.6710763",
"0.670641",
"0.6673981",
"0.6620799",
"0.6557749",
"0.6476816",
"0.6472717",
"0.6458795",
"0.64072716",
"0.64047295",
"0.63530964",
"0.63530964",
"0.63530964",
"0.6310986",
"0.63100123",
... | 0.7794688 | 0 |
It Colors The Selected Cell | def draw_selected(self):
if self.get_selected() is not None and not self.check_if_locked(self.get_selected()):
self.color_cell(pos=self.get_selected(
), color=SELECTED_INVALID if self.get_selected() in self.invalid else SELECTED) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def click_color(self, row_i):\n self.bg_reset()\n select_rgb = (191, 243, 228)\n select_color = QtGui.QColor(*select_rgb)\n for col_i in range(self.people_table.columnCount()):\n # when table changes row_i may no longer exist (None)\n if self.people_table.item(row_... | [
"0.6985751",
"0.6849019",
"0.67640656",
"0.6757863",
"0.6691283",
"0.668399",
"0.66343147",
"0.65790117",
"0.65168613",
"0.639773",
"0.63874525",
"0.6332912",
"0.6331097",
"0.63164014",
"0.62920564",
"0.6288776",
"0.6197164",
"0.61816067",
"0.61125493",
"0.6097194",
"0.608438... | 0.7410787 | 0 |
It Will Draw The Numbers On The Board | def draw_numbers(self):
for i in range(9):
for j in range(9):
pos = self.get_pos_in_grid(i, j)
text = self.grid[i][j]
text = '' if text == 0 else str(text)
self.text_to_screen(text, pos) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_given_numbers(self):\n y = self.step_y/2 \n while y < self.height:\n x = self.step_x/2\n while x < self.width:\n\n # find row and column of the board based on the step sizes\n r, c = round((y-self.step_y/2)/self.step_y), round((x-self.step_x/2)/self.step_x)\n number =... | [
"0.7678089",
"0.7436017",
"0.7178829",
"0.7080666",
"0.70133114",
"0.6922454",
"0.6885909",
"0.6860841",
"0.6852656",
"0.68270683",
"0.68268335",
"0.6806605",
"0.67897975",
"0.6787238",
"0.6716217",
"0.6704868",
"0.6694162",
"0.66936094",
"0.66898865",
"0.6687331",
"0.6680534... | 0.8320049 | 0 |
This Will Draw All The Buttons Onto The Screen | def draw_buttons(self):
for button in self.playing_buttons:
button.draw(self.screen) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_buttons(self):\n for button in self.buttons:\n x = button.starting_x\n y = button.starting_y\n self.screen.fill(button.color, ((x, y), (button.width, button.height)))",
"def drawButtons(self):\n self.__pausedTitle.draw(self.__screen)\n self.__exitGam... | [
"0.85175043",
"0.8169243",
"0.8007272",
"0.7607241",
"0.7395919",
"0.73840696",
"0.7270972",
"0.7066256",
"0.69378734",
"0.6934372",
"0.69018245",
"0.68842477",
"0.6872431",
"0.6840603",
"0.6824653",
"0.67917746",
"0.6725772",
"0.6670006",
"0.6659281",
"0.66530484",
"0.662013... | 0.8405718 | 1 |
It Will Shade All The Locked Cells | def shade_locked_cells(self):
for i in range(9):
for j in range(9):
if self.grid_check[i][j] != 0:
self.color_cell(pos=(i, j), color=LOCKED_CELL) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lock(cell):\n m = cell['metadata']\n m[\"editable\"] = False\n m[\"deletable\"] = False",
"def f_unlock(self):\n self._locked = False",
"def erase(self):\n\tself.state={}\n\tself.display(update_board=0)",
"def unlockMeshes():\n setLockOnMeshes(0)",
"def dec_gains_of_free_cells(self):... | [
"0.6175055",
"0.57997423",
"0.5639808",
"0.5596297",
"0.5584451",
"0.5535728",
"0.5517984",
"0.5450767",
"0.5386599",
"0.53715956",
"0.5323088",
"0.5304359",
"0.5285234",
"0.52705973",
"0.52583265",
"0.5231134",
"0.5224701",
"0.5221622",
"0.5218678",
"0.52166355",
"0.5212057"... | 0.7075585 | 0 |
It Will Color The Invalid Entry | def color_invalid(self):
for i in self.invalid:
self.color_cell(i, INVALID) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_invalid():\n print(colored('Invalid input\\n', 'red', attrs=['bold']))",
"def _update_color(self, txt):\n color = self.valid_color\n if not self.hasAcceptableInput():\n color = self.invalid_color\n self.setStyleSheet(\"background-color: %s\" % color)",
"def _confirm_co... | [
"0.6991874",
"0.67031866",
"0.6483819",
"0.64674556",
"0.6457547",
"0.6432279",
"0.61969495",
"0.6153183",
"0.60659254",
"0.6022004",
"0.5955116",
"0.5907345",
"0.5892128",
"0.5884154",
"0.58290666",
"0.5822534",
"0.57697856",
"0.5750057",
"0.57197183",
"0.57189155",
"0.57165... | 0.7534199 | 0 |
This Will Update The Button Hover Status | def update_button_hover_status(self):
for button in self.playing_buttons:
button.update(self.mousePos) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_hover(self):\n self.color1 = self.color # Color changes\n position = pygame.mouse.get_pos() # Get mouse position\n if self.rect.collidepoint(position): # If the mouse is inside the button rect\n self.color1 = LIGHT_GREEN # Change color to light green",
"def update(se... | [
"0.7449659",
"0.72782147",
"0.7196526",
"0.69607794",
"0.6892113",
"0.6406873",
"0.63839555",
"0.636601",
"0.634425",
"0.63436794",
"0.6326481",
"0.6225555",
"0.6220948",
"0.60805935",
"0.60604835",
"0.5974381",
"0.5956773",
"0.5947975",
"0.5823839",
"0.5748594",
"0.57011336"... | 0.8288496 | 0 |
It should return True or False based on motion. | def detectMotion():
global MotionDetected
MotionDetected = False
return MotionDetected | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_motion(self) -> bool:\n return self._require_motion",
"def __check_motion(self):\n if self.communications.get_motion_sensor():\n self.communications.set_status(\"Detecting Motion\")\n self.communications.send_motion_data(self.motion_sensors.detect_motion(10))",
"... | [
"0.764494",
"0.73808944",
"0.73020977",
"0.7163485",
"0.7163485",
"0.7149546",
"0.71006066",
"0.70653343",
"0.69570637",
"0.6867434",
"0.6822684",
"0.68209064",
"0.6782755",
"0.6743013",
"0.6732485",
"0.6698545",
"0.6684766",
"0.66791064",
"0.6676883",
"0.66607964",
"0.665292... | 0.78054595 | 0 |
Convert coordinates into pygame coordinates (lowerleft => top left). | def to_pygame(coords):
return (coords[0], HEIGHT - coords[1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_pygame(pos):\n return int(pos.x), int(-pos.y+600)",
"def to_pygame_coords(self, coords):\n coords = Vector(coords)\n if Window.FollowPlayer:\n # offset coords by screen center\n coords = coords + (self.size * .5)\n # offset coords by centered_obj\n... | [
"0.7254828",
"0.72006845",
"0.682167",
"0.67977166",
"0.66983885",
"0.6682158",
"0.6584505",
"0.6572574",
"0.65490896",
"0.6544315",
"0.6501023",
"0.6490764",
"0.6435862",
"0.64180505",
"0.63830537",
"0.637115",
"0.6364992",
"0.6360416",
"0.6345675",
"0.6342017",
"0.6336103",... | 0.77644044 | 0 |
Process event log of DynamoDB stream and update ANDS handle content path if needed | def raid_table_dynamodb_stream_event(event, context):
try:
# Log AWS Lambda event
logger.info('Event: {}'.format(json.dumps(event, indent=4)))
for record in event['Records']:
# Convert low-level DynamoDB format to Python dictionary
deserializer = TypeDeserializer()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def processEventLog(log):\n pass",
"def lambda_handler(event, context): # pylint: disable=too-many-locals,too-many-branches,too-many-statements\r\n try: # pylint: disable=too-many-nested-blocks\r\n print(\"Execution started!\")\r\n #print(\"Event: \",event)\r\n # Bucket name and Full... | [
"0.6164194",
"0.5861876",
"0.5760497",
"0.57345635",
"0.57181984",
"0.5717499",
"0.5713318",
"0.5705176",
"0.5685681",
"0.56830186",
"0.56588256",
"0.5655359",
"0.561172",
"0.55994326",
"0.55731946",
"0.5565909",
"0.5533072",
"0.5529683",
"0.546801",
"0.5466014",
"0.5438785",... | 0.69749135 | 0 |
Strip a malformed YAML directive from the top of a file. Returns the slurped (!) file. | def strip_malformed_directive(yaml_file):
lines = list(yaml_file)
first_line = lines[0]
if first_line.startswith('%') and ":" in first_line:
return "\n".join(lines[1:])
else:
return "\n".join(lines) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_yml_file_without_meta(yml_file):\n with open(yml_file, \"r\") as f:\n data = yaml.load(f, Loader=yaml.FullLoader)\n # get the meta index first\n mi = -1\n for i in range(len(data)):\n if \"meta\" not in data[i]:\n mi = i\n break\n ... | [
"0.63308746",
"0.62082046",
"0.5571192",
"0.5300692",
"0.522862",
"0.5136453",
"0.51294416",
"0.5127715",
"0.511309",
"0.5069137",
"0.5064061",
"0.50461096",
"0.503939",
"0.50142545",
"0.49752197",
"0.49716073",
"0.49489355",
"0.4923321",
"0.49160346",
"0.49102274",
"0.490765... | 0.67927957 | 0 |
Convert an erroneous custom tag, !!opencvmatrix, to the correct !opencvmatrix, in a stream of YAML events. | def convert_opencvmatrix_tag(yaml_events):
for event in yaml_events:
if hasattr(event, "tag") and event.tag == u"tag:yaml.org,2002:opencv-matrix":
event.tag = u"!opencv-matrix"
yield event | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_reads_opencv_from_xml() -> None:\n imgsz = (4288, 2848)\n f = {\"fx\": 3.57e03, \"fy\": 3.58e03}\n c = {\"cx\": 2.15e03, \"cy\": 1.43e03}\n coeffs = {\n \"k1\": 1.1e-01,\n \"k2\": -1.2e-01,\n \"p1\": -9.98e-03,\n \"p2\": 9.99e-03,\n \"k3\": 1.0e-02,\n ... | [
"0.5062877",
"0.48402",
"0.4789745",
"0.47699156",
"0.47673038",
"0.47382063",
"0.4707494",
"0.46134594",
"0.46037513",
"0.45340943",
"0.44836348",
"0.447637",
"0.44666317",
"0.44268033",
"0.43910342",
"0.43851766",
"0.4379255",
"0.43756458",
"0.43580797",
"0.43555278",
"0.43... | 0.8253259 | 0 |
Computes a new Camera Info in the case of mirroring | def new_mirror(self,alongx,alongy):
Knew = K.clone()
if alongx:
Knew[0,2] = size[0]-Knew[0,2]
if alongy:
Knew[1,2] = size[1]-Knew[1,2]
return CameraInfo(self.size,Knew,self.dist) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_camera(self):\n _, frame = self.camera.read()\n return self.mirror(frame)",
"def info_callback(self, info):\n if self.need_cam_info:\n print(\"got camera info\")\n self.camera_model.fromCameraInfo(info)\n self.need_cam_info = False",
"def process_c... | [
"0.65635204",
"0.64050907",
"0.6285134",
"0.6201622",
"0.6198665",
"0.61947",
"0.6176285",
"0.6160507",
"0.6101986",
"0.60852295",
"0.6056886",
"0.6027456",
"0.6011429",
"0.5980591",
"0.59622884",
"0.59386176",
"0.5919779",
"0.5908327",
"0.58563316",
"0.5838457",
"0.5831417",... | 0.7299222 | 0 |
Removes Undistortion from CameraInfo | def new_undistorted(self):
return CameraInfo(self.size,self.K,None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def undistort(self, image):\n return cv2.undistort(image, self.camera_matrix, self.distortion_coeffs, None, self.camera_matrix)",
"def undistort_image(frame, mtx, dist, display=True):\r\n frame_undistorted = cv2.undistort(frame, mtx, dist, newCameraMatrix=mtx)\r\n\r\n if display:\r\n fig, ax ... | [
"0.58126134",
"0.55463165",
"0.55052596",
"0.5433217",
"0.5391852",
"0.5368674",
"0.5345672",
"0.53102624",
"0.5289878",
"0.5272877",
"0.52263516",
"0.5208682",
"0.51604915",
"0.51445305",
"0.5133489",
"0.51326793",
"0.5113074",
"0.50990415",
"0.5032956",
"0.5016939",
"0.4976... | 0.61903244 | 0 |
computes the optimal transformation for the undistortion toward another or similar size. Wraps cv2.getOptimalNewCameraMatrix | def new_makeOptimal(self,alpha,otherSize=None,centerPrincipalPoint=False):
OK,validROI = cv2.getOptimalNewCameraMatrix(self.K,self.dist,alpha,otherSize,centerPrincipalPoint)
if otherSize is None:
otherSize = self.size
return CameraInfo(otherSize,OK,None),validPixROI | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_transform(src_, dst_):\n M_ = cv2.getPerspectiveTransform(src_, dst_)\n Minv_ = cv2.getPerspectiveTransform(dst_, src_)\n return M_, Minv_",
"def compute_camera_calib_distortion_params():\r\n nx = 9#number of inside corners in x\r\n ny = 6#number of inside corners in y\r\n # prepare ob... | [
"0.6404395",
"0.60454637",
"0.5960749",
"0.58915275",
"0.5875036",
"0.57737654",
"0.57172453",
"0.56888026",
"0.5688326",
"0.5684905",
"0.5589449",
"0.5587895",
"0.5575258",
"0.55513036",
"0.55342984",
"0.5509691",
"0.5499112",
"0.5479626",
"0.5454087",
"0.541782",
"0.5413724... | 0.6066039 | 1 |
calls OpenCV initUndistortRectifyMap using CameraInfo data. R is optional. otherK is used for stereo | def initUndistortRectifyMap(self,m1type,R=None,otherK=None):
return cv2.initUndistortRectifyMap(self.K,self.dist,R,otherK is None and self.K or otherK,self.size,m1type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_undistortion_maps(self):\n\n new_camera_matrix, valid_roi = cv2.getOptimalNewCameraMatrix(\n self.camera_matrix, self.distortion_coefficients, self.image_size,\n 0)\n\n self.map1, self.map2 = cv2.initUndistortRectifyMap(\n self.camera_matrix, self.disto... | [
"0.69114333",
"0.6471733",
"0.5740211",
"0.5670836",
"0.5657102",
"0.5598646",
"0.5563903",
"0.55359626",
"0.548316",
"0.54115915",
"0.5390015",
"0.534091",
"0.53331286",
"0.53153676",
"0.5306986",
"0.5242267",
"0.5223143",
"0.5221984",
"0.52040917",
"0.5180249",
"0.5106843",... | 0.73232615 | 0 |
returns all timestamps of given netcdf file as datetime list. | def get_time_nc(nc_file, tv='time'):
from netCDF4 import MFDataset,num2date
ds = MFDataset(nc_file)
try:
time = ds.variables[tv]
except:
tv='time_counter'
ds.close()
try:
ds = MFDataset(nc_file)
time = ds.variables[tv]
if (hasattr(time , 'units') and has... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_timestamps( self, raster_pos=None ):\n if raster_pos is None:\n headers = self.time_specific_headers\n else:\n headers = self.get_raster_pos_headers( raster_pos )\n \n return [to_epoch( from_Tformat( h['DATE_OBS'] ) ) for h in headers]",
"def timestam... | [
"0.67807794",
"0.65918297",
"0.65918297",
"0.649629",
"0.6495381",
"0.6472645",
"0.6459693",
"0.6456668",
"0.6402592",
"0.6382574",
"0.6315384",
"0.6305346",
"0.6288575",
"0.6225149",
"0.6186225",
"0.61691904",
"0.6143416",
"0.60917103",
"0.6061064",
"0.6044909",
"0.60109127"... | 0.6615538 | 1 |
Reformats analogs results file for analogues viewer code. | def reformat_analogs(analogs, prefix = 'modified-analogfile.tsv'):
# import numpy as np
import pandas as pd
try:
num_cols = 3 # dateAnlg, Dis, Corr
# Create dataframe and read in output csv file of analogs process
dfS = pd.DataFrame()
dfS = pd.read_csv(analogs, delimiter=r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_result():\n names = get_tests()[0]\n\n for name in names:\n arctern_file = os.path.join(ARCTERN_RESULT, name + '.csv')\n\n update_quote(arctern_file)\n update_bool(arctern_file)",
"def remix(self):\n self.original = audio.LocalAudioFile(self.infile)\n #for i, s... | [
"0.61483634",
"0.5722668",
"0.5629232",
"0.5580286",
"0.5352792",
"0.535211",
"0.53194237",
"0.5256824",
"0.52232164",
"0.5197312",
"0.51745605",
"0.5136301",
"0.51050967",
"0.5043372",
"0.50213665",
"0.50095344",
"0.4953617",
"0.49320453",
"0.49033397",
"0.48801324",
"0.4854... | 0.62174374 | 0 |
Generate an analogs viewer HTML page based on a template. | def render_viewer(configfile, datafile):
try:
page = 'analogviewer.html'
with open(page, 'w') as fp:
fp.write(templating.render_template(
page,
configfile=configfile,
datafile=datafile,
# static_url=config.output_url() + '/s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_html_page():\n\n return render_template(\"moby.html\")",
"def main():\r\n return render_template(\"UI.html\")",
"def camera():\n return render_template('home/cam.html')",
"def preview():\n return render_template(\"controls/preview.html\")",
"def show(template_name):\n ShowCommandExe... | [
"0.66812843",
"0.6424832",
"0.64130586",
"0.641176",
"0.63622534",
"0.6312638",
"0.62966967",
"0.6219156",
"0.61963755",
"0.61826026",
"0.61532706",
"0.6106545",
"0.61008984",
"0.6087467",
"0.6080106",
"0.605967",
"0.6037739",
"0.6037739",
"0.60084754",
"0.5999159",
"0.596024... | 0.70714074 | 0 |
floor the pont to the nxt lower multiple of bucket_size | def bucketize(point, bucket_size):
return bucket_size * math.floor(point / bucket_size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bucketize(point, bucket_size):\r\n return bucket_size * math.floor(point / bucket_size)",
"def bucket_boundaries(self, bucket):\n\n if bucket < 0 or bucket >= self.total_buckets:\n raise IndexError('bucket %d out of range' % bucket)\n if bucket == self.total_buckets - 1:\n return (self._lo... | [
"0.7597311",
"0.6233041",
"0.62305874",
"0.6062927",
"0.5940828",
"0.5933147",
"0.5872735",
"0.57214737",
"0.57195526",
"0.5686446",
"0.5638457",
"0.5626216",
"0.56134063",
"0.5600956",
"0.5583571",
"0.55832744",
"0.55832744",
"0.55479383",
"0.5519782",
"0.55196553",
"0.54353... | 0.75068164 | 1 |
buckets the ponts and counts how many in each bucket | def make_histogram(points, bucket_size):
return Counter(bucketize(point, bucket_size) for point in points) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_histogram(points, bucket_size):\r\n return Counter(bucketize(point, bucket_size) for point in points)",
"def htable(nbuckets):",
"def list_buckets():\n pass",
"def buckets(text, sigma):\n alpha = []\n bucket_sizes = array(\"L\", [0] * sigma)\n for c in text:\n bucket_sizes[c] +... | [
"0.6686371",
"0.6445363",
"0.6214255",
"0.60969096",
"0.605933",
"0.60316575",
"0.5992487",
"0.5950243",
"0.59492326",
"0.593202",
"0.59296554",
"0.5911292",
"0.58533347",
"0.58212197",
"0.5780779",
"0.5774585",
"0.5740624",
"0.570844",
"0.568908",
"0.5678229",
"0.5676203",
... | 0.6620214 | 1 |
returns the num_columns x num_colunmns matrix whos (i, j)th entry is the correlation between columns i and j of data | def correlation_matrix(data):
_, num_columns = shape(data)
def matrix_entry(i, j):
return correlation(get_column(data, i), get_column(data, j))
return make_matrix(num_columns, num_columns, matrix_entry) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correlation_matrix(data):\r\n\r\n _, num_columns = shape(data)\r\n\r\n def matrix_entry(i, j):\r\n return correlation(get_column(data, i), get_column(data, j))\r\n\r\n return make_matrix(num_columns, num_columns, matrix_entry)",
"def correlation(data):\n return corrcoef(np.transpose(np.res... | [
"0.764798",
"0.69120264",
"0.6902327",
"0.6836222",
"0.6754823",
"0.66619134",
"0.6467521",
"0.637715",
"0.6350548",
"0.6327055",
"0.6241184",
"0.623158",
"0.62231666",
"0.608737",
"0.5997184",
"0.59910566",
"0.5946013",
"0.5926691",
"0.5917131",
"0.5892433",
"0.58744544",
... | 0.77116764 | 0 |
given a list of parsers (some of which may be None) apply the appropriate one to each element of the input row | def parse_row(input_row, parsers):
return [parser(value) if parser is not None else value
for value, parser in zip(input_row, parsers)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_row(input_row, parsers):\n\n return [try_or_none(parser)(value) if parser is not None else value\n for value, parser in zip(input_row, parsers)]",
"def parse_row(input_row, parsers):\n return [try_or_none(parser)(value) if parser is not None else value\n for value, parser in... | [
"0.7760424",
"0.7708113",
"0.5941967",
"0.5765646",
"0.5765646",
"0.5420369",
"0.53176457",
"0.513226",
"0.50360847",
"0.49477687",
"0.49304157",
"0.48991036",
"0.4804586",
"0.4744639",
"0.46920457",
"0.46880016",
"0.46772683",
"0.46717724",
"0.46683633",
"0.46663684",
"0.464... | 0.7862312 | 0 |
wrap a reader to apply the parsers to each of its rows | def parse_rows_with(reader, parsers):
for row in reader:
yield parse_row(row, parsers) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_rows_with(reader, parsers):\n for row in reader:\n yield parse_row(row,parsers)",
"def parse_row(input_row, parsers):\n\n return [parser(value) if parser is not None else value\n for value, parser in zip(input_row, parsers)]",
"def fit_reader(self, reader):\n return sel... | [
"0.8287405",
"0.6207315",
"0.6118633",
"0.59529907",
"0.5909166",
"0.5875364",
"0.5849649",
"0.584668",
"0.5829653",
"0.5819698",
"0.57757884",
"0.569907",
"0.5674658",
"0.5655691",
"0.56322485",
"0.562984",
"0.5621524",
"0.56190336",
"0.55955404",
"0.5495519",
"0.54885215",
... | 0.8208408 | 1 |
wraps f to return None if f raises an exception assumes f takes only one input | def try_or_none(f):
def f_or_none(x):
try: return f(x)
except: return None
return f_or_none | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_or_none(f):\n def f_or_none(x):\n try: return f(x)\n except: return None\n return f_or_none",
"def None_if_exception(f, val):\n def decorated_f(*args, **kwargs):\n try:\n x = f(*args, **kwargs)\n except Exception:\n return None\n else:\n ... | [
"0.7946012",
"0.77939826",
"0.73445934",
"0.72532094",
"0.7125534",
"0.66916907",
"0.6634186",
"0.66205657",
"0.6533325",
"0.65153587",
"0.64503604",
"0.64382523",
"0.63942015",
"0.6357486",
"0.63371694",
"0.63331324",
"0.61645675",
"0.6157735",
"0.6157735",
"0.60959184",
"0.... | 0.7956505 | 0 |
given a list of parsers (some of which may be None) apply the appropriate one to each element of the input row | def parse_row(input_row, parsers):
return [try_or_none(parser)(value) if parser is not None else value
for value, parser in zip(input_row, parsers)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_row(input_row, parsers):\n\n return [parser(value) if parser is not None else value\n for value, parser in zip(input_row, parsers)]",
"def parse_row(input_row, parsers):\n return [try_or_none(parser)(value) if parser is not None else value\n for value, parser in zip(input_ro... | [
"0.7860895",
"0.770681",
"0.5940243",
"0.5763972",
"0.5763972",
"0.5419355",
"0.5315998",
"0.51319647",
"0.5035327",
"0.4946088",
"0.49279934",
"0.4897018",
"0.48079637",
"0.47428817",
"0.46922794",
"0.4687607",
"0.4675127",
"0.46703136",
"0.46676153",
"0.46672013",
"0.464184... | 0.77591646 | 1 |
try to parse value using the appropriate functin from parser dict | def try_parse_field(field_name, value, parser_dict):
parser = parser_dict.get(field_name) # None if no such entry
if parser is not None:
return try_or_none(parser)(value)
else:
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_parse_field(field_name, value, parser_dict):\n parser = parser_dict.get(field_name) # None if no such entry\n if parser is not None:\n return try_or_none(parser)(value)\n else:\n return value",
"def _parse(value, function, fmt):\n try:\n return function(value)\n excep... | [
"0.6987377",
"0.68641037",
"0.6722652",
"0.66606456",
"0.6572043",
"0.6551176",
"0.6439942",
"0.6439942",
"0.6251729",
"0.6146448",
"0.60798484",
"0.597589",
"0.59163487",
"0.5910115",
"0.5864216",
"0.5855629",
"0.58271813",
"0.5824096",
"0.58008903",
"0.5800582",
"0.5771732"... | 0.6986815 | 1 |
returns a function that picks a field out of a dict | def picker(field_name):
return lambda row: row[field_name] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_field(key, obj):\n\n val = obj\n\n for subkey in key.split('.'):\n val = val[subkey]\n\n return val",
"def getfield(value, arg):\n #import pdb; pdb.set_trace()\n if hasattr(value, \"fields\"):\n fields = getattr(value, \"fields\")\n if str(arg) in fields:\n ... | [
"0.66878",
"0.66624385",
"0.6654425",
"0.65902525",
"0.6499913",
"0.6372742",
"0.6320475",
"0.6256116",
"0.620161",
"0.6171656",
"0.61647815",
"0.6113857",
"0.6098898",
"0.6067647",
"0.60438067",
"0.6030453",
"0.6029466",
"0.5986976",
"0.5981687",
"0.5969282",
"0.5962245",
... | 0.6674588 | 1 |
Send an email with the given information using sendgrid API. ``sender`` and ``recipient`` must be ``Contact`` instances. | def send_email(sender, recipient, subject, html_content, txt_content, api_key):
post_headers = SENDGRID_POST_HEADERS.copy()
post_headers['Authorization'] = 'Bearer {0}'.format(api_key)
data = {
'content': [
{
'type': 'text/plain',
'value': txt_content,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_email(email_subject, recipient, message, config = None):\n try:\n config = current_app.config\n except:\n config = config\n\n sender = sendgrid.SendGridClient(config['SENDGRID_API_KEY'])\n\n email = sendgrid.Mail()\n\n email.set_subject(email_subject)\n email.add_to(reci... | [
"0.7199089",
"0.6802284",
"0.66871035",
"0.6629718",
"0.6578772",
"0.65338874",
"0.63848585",
"0.62755436",
"0.62045836",
"0.61931556",
"0.61594427",
"0.6107116",
"0.6099107",
"0.60616297",
"0.59760606",
"0.59718096",
"0.595867",
"0.59301484",
"0.59264135",
"0.59",
"0.5880816... | 0.7293909 | 0 |
this is checking 'ie' against certain words that are put in the arguments also it is taking into consideration the fact that after c it is ei, and I do that by evaluating cie in the parameter (word) | def check(word):
if 'ie' in word:
print('{} doesn\'t follow the rule'.format(word))
elif 'cie' in word:
print('{} doesn\'t follow the rule'.format(word))
else:
print('{} does follow the rule'.format(word)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(self, word):",
"def basic_check(word):\n if word[-1] == \"b\" or word[-1] == \"g\":\n return False\n consonant_counter = 0\n for char in word:\n if char in VOWELS:\n consonant_counter = 0\n else:\n consonant_counter += 1\n if consonant_counter... | [
"0.6563026",
"0.61535275",
"0.6104765",
"0.60968226",
"0.5950032",
"0.59073645",
"0.5877695",
"0.5859684",
"0.5853565",
"0.5838554",
"0.5829444",
"0.582781",
"0.5826885",
"0.57807684",
"0.5766645",
"0.5766633",
"0.57525086",
"0.5734965",
"0.57145435",
"0.56988156",
"0.5696558... | 0.80172086 | 0 |
If the price difference is positive, accept the change. Else, use chance to sometimes accept a negative change. | def check_price(self, price_diff):
chance = exp(price_diff / self.T)
if price_diff < 0 and not chance > random():
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_price(self):\n if self.__product_price < self.__alert_price:\n #print(\"price drop...\")\n self.__alert_client = True\n self.__price_difference = self.__product_price - self.__alert_price\n else:\n #print(\"Price not reduced...\")\n s... | [
"0.681601",
"0.66513777",
"0.6579652",
"0.65598977",
"0.64981097",
"0.640799",
"0.6377233",
"0.63660145",
"0.6304649",
"0.6303129",
"0.63005",
"0.625263",
"0.621822",
"0.6180557",
"0.6165783",
"0.6160765",
"0.6143225",
"0.6127727",
"0.60954076",
"0.6059905",
"0.6056775",
"0... | 0.8071096 | 0 |
Test case for liechtensteinsettlements_get | def test_liechtensteinsettlements_get(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_liechtensteinsettlements_id_get(self):\n pass",
"def test_austriansettlements_get(self):\n pass",
"def test_austriansettlements_id_get(self):\n pass",
"def test_generate_single_element_get(self):\n pass",
"def test_get_html(self):\r\n context = self.mod.get_html(... | [
"0.7831955",
"0.7138092",
"0.5891819",
"0.5717251",
"0.56602263",
"0.56293994",
"0.5599581",
"0.5564111",
"0.541159",
"0.5313962",
"0.52749103",
"0.51254624",
"0.5107244",
"0.5106074",
"0.50819343",
"0.50544786",
"0.5054461",
"0.503181",
"0.5025818",
"0.5009385",
"0.49504754"... | 0.93017524 | 0 |
Test case for liechtensteinsettlements_id_get | def test_liechtensteinsettlements_id_get(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_austriansettlements_id_get(self):\n pass",
"def test_liechtensteinsettlements_get(self):\n pass",
"def test_solareclipses_id_get(self):\n pass",
"def test_intercommunalitys_id_get(self):\n pass",
"def test_prefectures_id_get(self):\n pass",
"def test_variablepr... | [
"0.82076895",
"0.7358317",
"0.6770782",
"0.6580353",
"0.6308794",
"0.6245422",
"0.6235614",
"0.6187761",
"0.60393614",
"0.6010711",
"0.60008794",
"0.5999302",
"0.5997519",
"0.5997346",
"0.59716815",
"0.5962987",
"0.59535784",
"0.59419966",
"0.59416705",
"0.5927985",
"0.592339... | 0.94481444 | 0 |
Return an iterator over snapshots for a timevarying component attribute with values for all nontimevarying components filled in with the default values for the attribute. | def get_switchable_as_iter(network, component, attr, snapshots, inds=None):
df = network.df(component)
pnl = network.pnl(component)
index = df.index
varying_i = pnl[attr].columns
fixed_i = df.index.difference(varying_i)
if inds is not None:
inds = pd.Index(inds)
index = inds.in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def with_time(self):\n if self.time_slices is None:\n raise FeatureError(\"Feature has no time reference.\")\n\n for i, datum in enumerate(self.data[self.name]):\n yield (self.time_slices[i], datum)",
"def with_time(self):\n key = list(self.keys())[0]\n length = ... | [
"0.50482535",
"0.4856219",
"0.4846035",
"0.48322827",
"0.47165158",
"0.47063917",
"0.470118",
"0.46948507",
"0.46752623",
"0.466266",
"0.46456906",
"0.4583182",
"0.4576654",
"0.45431003",
"0.4538435",
"0.44855666",
"0.44833434",
"0.4461226",
"0.4460401",
"0.4453483",
"0.44275... | 0.5498514 | 0 |
Pandas 0.21.0 changes sum() behavior so that the result of applying sum over an empty DataFrame is NaN. Meant to be set as pd.Series.zsum = zsum. | def zsum(s, *args, **kwargs):
return 0 if s.empty else s.sum(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(self):\n # skipna == True\n # only_numerical == True\n # skipna == True\n return self._lift(\"sum\")",
"def row_sums(\n x: DataFrame,\n na_rm: bool = False,\n # dims: int = 1,\n # weights = None,\n # freq = None,\n # n = None\n) -> Ite... | [
"0.6400161",
"0.6269071",
"0.622541",
"0.5976757",
"0.5800932",
"0.57864934",
"0.57507914",
"0.57166976",
"0.5702603",
"0.5651831",
"0.5651831",
"0.5651831",
"0.5651831",
"0.56051767",
"0.5582573",
"0.55817443",
"0.55799365",
"0.54326",
"0.54056394",
"0.5402983",
"0.5398725",... | 0.70001817 | 0 |
Helper function to quickly expand a series to a dataframe with according column axis and every single column being the equal to the given series. | def expand_series(ser, columns):
return ser.to_frame(columns[0]).reindex(columns=columns).ffill(axis=1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def series_from_dataframe(df, index_column: str, value_column: str=None):\n\n if len(df.columns) > 2:\n df = df[[index_column, value_column]].copy()\n else:\n df = df.copy()\n df.set_index(index_column, inplace=True)\n sr = df.squeeze()\n sr.name = value_column\n return sr",
"def... | [
"0.64476883",
"0.64365065",
"0.6100705",
"0.6061576",
"0.5981239",
"0.5914129",
"0.58018684",
"0.5774947",
"0.57282746",
"0.5726346",
"0.5709844",
"0.5703783",
"0.5690615",
"0.56714773",
"0.5614371",
"0.55539507",
"0.55334795",
"0.5530608",
"0.5498409",
"0.5498409",
"0.549654... | 0.737047 | 0 |
Getter function. Get the index of extendable elements of a given component. | def get_extendable_i(n, c):
idx = n.df(c)[lambda ds: ds[nominal_attrs[c] + "_extendable"]].index
return idx.rename(f"{c}-ext") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def element_index(self):\n return self._index",
"def InterfaceIndex(self) -> int:",
"def InterfaceIndex(self) -> int:",
"def get_list_index(self):\r\n return self.n",
"def get_index(self):\n return self.disk.partitions.index(self)",
"def get_index(self):\r\n i = 0\r\n ... | [
"0.66678977",
"0.6171629",
"0.6171629",
"0.5992239",
"0.59366125",
"0.5837213",
"0.5818474",
"0.57752585",
"0.5760597",
"0.5744115",
"0.57399565",
"0.5736708",
"0.5734644",
"0.57214147",
"0.57179445",
"0.56879526",
"0.5640134",
"0.5638468",
"0.5628843",
"0.56254864",
"0.56226... | 0.6495712 | 1 |
Getter function. Get the index of nonextendable elements of a given component. | def get_non_extendable_i(n, c):
idx = n.df(c)[lambda ds: ~ds[nominal_attrs[c] + "_extendable"]].index
return idx.rename(f"{c}-fix") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def element_index(self):\n return self._index",
"def get_instance_index(self):\n return np.unique([tp[0] for tp in self._innercontainer])",
"def get_list_index(self):\r\n return self.n",
"def index(self, elem):\n return _coconut.len(self.iter) - self.iter.index(elem) - 1",
"def ... | [
"0.6539576",
"0.61909676",
"0.6013466",
"0.5934518",
"0.58452624",
"0.58125824",
"0.58125824",
"0.5780629",
"0.5724768",
"0.5723052",
"0.57140875",
"0.56976855",
"0.5628068",
"0.56127214",
"0.5611799",
"0.5598618",
"0.55968726",
"0.55942404",
"0.5589706",
"0.55723184",
"0.556... | 0.6343805 | 1 |
Getter function. Get True values for elements of component c which are active at a given investment period. These are calculated from lifetime and the build year. | def get_active_assets(n, c, investment_period):
periods = np.atleast_1d(investment_period)
active = {}
for period in periods:
if period not in n.investment_periods:
raise ValueError("Investment period not in `network.investment_periods`")
active[period] = n.df(c).eval("build_year... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def periodCheck(data):",
"def getExpired(self, idle=365):\n cutOff = datetime.datetime.now() - datetime.timedelta(days=idle)\n return [x for x in self.xeps if x.status == \"Experimental\" and x.date < cutOff]",
"def operable_ages(self, acode, period):\n if acode not in self.oper_expr: # ac... | [
"0.5174939",
"0.4845245",
"0.4821024",
"0.47831455",
"0.4737875",
"0.47003165",
"0.46910465",
"0.469043",
"0.46834463",
"0.46755636",
"0.4660154",
"0.4653018",
"0.462037",
"0.46168467",
"0.4614364",
"0.4614364",
"0.4614364",
"0.45948458",
"0.45939475",
"0.45936975",
"0.457957... | 0.7044306 | 0 |
Getter function. Get a boolean array with True values for elements of component c which are active at a specific snapshot. If the network is in multi_investment_period mode (given by n._multi_invest), these are calculated from lifetime and the build year. Otherwise all values are set to True. | def get_activity_mask(n, c, sns=None, index=None):
if sns is None:
sns = n.snapshots
if getattr(n, "_multi_invest", False):
_ = {period: get_active_assets(n, c, period) for period in n.investment_periods}
res = pd.concat(_, axis=1).T.reindex(n.snapshots, level=0).loc[sns]
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_active_assets(n, c, investment_period):\n periods = np.atleast_1d(investment_period)\n active = {}\n for period in periods:\n if period not in n.investment_periods:\n raise ValueError(\"Investment period not in `network.investment_periods`\")\n active[period] = n.df(c).eva... | [
"0.65424186",
"0.47628143",
"0.4661641",
"0.4639534",
"0.4568647",
"0.4535897",
"0.45355004",
"0.45338643",
"0.45336056",
"0.452387",
"0.45226544",
"0.44983009",
"0.4493752",
"0.4489318",
"0.44724113",
"0.4471887",
"0.4463261",
"0.44590876",
"0.4454553",
"0.4453565",
"0.44474... | 0.48905343 | 1 |
Getter function to retrieve the per unit bounds of a given compoent for given snapshots and possible subset of elements (e.g. nonextendables). Depending on the attr you can further specify the bounds of the variable you are looking at, e.g. p_store for storage units. | def get_bounds_pu(n, c, sns, index=None, attr=None):
min_pu_str = nominal_attrs[c].replace("nom", "min_pu")
max_pu_str = nominal_attrs[c].replace("nom", "max_pu")
max_pu = get_switchable_as_dense(n, c, max_pu_str, sns)
if c in n.passive_branch_components:
min_pu = -max_pu
elif c == "Storage... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bounds():\n return [0.00], [1.00]",
"def get_bounds(self):\n return ([self.t_min] * self.dim,[self.t_max] * self.dim)",
"def bounds(self):\n return self._bboxes[0][0] #TODO: merge all coverages",
"def get_geo_extents(nc, possible_units, std_name, axis_name, short_name):\n\n geo_ext... | [
"0.57321733",
"0.5713874",
"0.5637598",
"0.5618561",
"0.559979",
"0.5563755",
"0.5507351",
"0.55036366",
"0.5473687",
"0.5466363",
"0.5459925",
"0.5447227",
"0.5392807",
"0.53789955",
"0.53789955",
"0.53789955",
"0.53789955",
"0.53789955",
"0.53789955",
"0.53789955",
"0.53789... | 0.6485828 | 0 |
dump model for later prediction | def dump_model(self): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_model(self):\n joblib.dump(self.pipeline, \"model.joblib\")",
"def savemodel(self, fname):\n if not fname.endswith('.gz'):\n fname += '.gz'\n D = {'clf':self.clf, 'vocab':self.vocab,\n 'idxlabelmap':self.labelmap}\n with gzip.open(fname, 'w') as fout:\n... | [
"0.7894731",
"0.7692822",
"0.76911736",
"0.7653883",
"0.7623206",
"0.7538876",
"0.7530988",
"0.75119674",
"0.75119317",
"0.7468773",
"0.7465218",
"0.74468184",
"0.7443801",
"0.7432671",
"0.7335412",
"0.730605",
"0.730019",
"0.723542",
"0.72077006",
"0.7206754",
"0.72036034",
... | 0.82823545 | 0 |
Get rid of the database again after each test | def tearDown(self):
app.db.drop_database('local')
app.db.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self):\n get_connection().drop_database('test_monstor_registration')",
"def teardown():\n teardown_db()",
"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(peg... | [
"0.8635427",
"0.85302615",
"0.8512873",
"0.8491214",
"0.84900934",
"0.8465409",
"0.8465409",
"0.8465091",
"0.8465091",
"0.8465091",
"0.8465091",
"0.8465091",
"0.8465091",
"0.8444213",
"0.8435058",
"0.8433075",
"0.8433075",
"0.8433075",
"0.8433075",
"0.8433075",
"0.8433075",
... | 0.8665355 | 0 |
Test get itinerary for a user | def test_getItinerary(self):
rv = self.app.get('/itinerarylistshells/alex')
for i in range(5):
assert "itin"+str(i+1) in str(rv.data)
rv = self.app.get('/itinerarylistshells/bbbb')
assert "Invalid username" in str(rv.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_user_get(self):\n pass",
"def test_func(self, user, **kwargs):\n return self.get_object().authorized_user(user)",
"def test_read_user(self):\n pass",
"def test_resource_user_resource_get_current_user_get(self):\n pass",
"def test_resource_user_resource_get_user_get(... | [
"0.68575686",
"0.6680141",
"0.66680706",
"0.6619506",
"0.66056466",
"0.6571949",
"0.65636194",
"0.6502335",
"0.64398944",
"0.6393863",
"0.6360309",
"0.6296977",
"0.62935597",
"0.62925845",
"0.62925845",
"0.62671554",
"0.62409383",
"0.6222767",
"0.6201795",
"0.61806047",
"0.61... | 0.7174526 | 0 |
Test retrieval of events for an itinerary | def test_getEventsForItinerary(self):
date = {'date': '2015-08-21T00:00:00.000Z'}
events = []
for i in range(10):
hh = str(i)
events.append(dict(start = '2015-08-21T'+hh+':23:00.000Z',
end = '2015-08-21T'+hh+':25:00.000Z',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_events(self):\n events = gracedb.events()\n for event in events:\n self.assertTrue('graceid' in event)\n break",
"def test_api_predictor_events_get(self):\n pass",
"def test_query_events(self):\n query_list = {\n 'q': 'test',\n ... | [
"0.6637942",
"0.6494425",
"0.6466185",
"0.61733973",
"0.6157892",
"0.6099789",
"0.6084765",
"0.6012242",
"0.59584683",
"0.59145075",
"0.5910777",
"0.5877571",
"0.587388",
"0.5854526",
"0.58476",
"0.5831675",
"0.58038217",
"0.5803201",
"0.5798981",
"0.5787392",
"0.57758427",
... | 0.7012843 | 0 |
Test retrieval of itinerary data from uid | def test_getItineraryFromId(self):
date = {'date': '2015-08-21T00:00:00.000Z'}
# Create sample itinerary for alex for the event day
self.json_post('/createItinerary/alex', dict(
name = 'New Day',
date = date['date']
))
uid = str('alex_' + ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_id_get(self):\n pass",
"def user(self, uid):",
"def test_user_id_identities_get(self):\n pass",
"def testFetchBodyStructureUID(self):\n return self.test_fetchBodyStructure(1)",
"def lookup(self, user_id):\n raise NotImplementedError",
"def get_Iu(uid):\n try:\... | [
"0.64463186",
"0.63672686",
"0.63439983",
"0.59777427",
"0.5923015",
"0.58660334",
"0.584328",
"0.5841248",
"0.5800688",
"0.57749987",
"0.5771717",
"0.57595974",
"0.57239634",
"0.5602",
"0.5544797",
"0.55285424",
"0.5517793",
"0.55099833",
"0.55007076",
"0.54977375",
"0.54818... | 0.6408533 | 1 |
Constructor of bot class. The token is either passed in argument or read in the config file. | def __init__(self, token):
self.token = token # Slack bot token
self.rtm = None # Real Time Messaging connection
self.api = { # Dict of available bot commands
"help": self.help, # For the help command
"rank": self.rank, # For the rank command (will show playing user score... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, token: str):\n\n self.__token = token\n self.__message_sender = None\n self.bus_controller = None\n self.__updater = None\n self.__dp = None\n self.__users = dict() # dictonary {id: user} (str: User)\n self.__gui = None",
"def __init__(self, TO... | [
"0.7350684",
"0.7225262",
"0.71546656",
"0.71175253",
"0.7082925",
"0.7082925",
"0.7082925",
"0.7029878",
"0.6977135",
"0.6977135",
"0.6932527",
"0.6848244",
"0.6823913",
"0.67627245",
"0.6731667",
"0.670638",
"0.670638",
"0.66926235",
"0.6631106",
"0.66154206",
"0.65494776",... | 0.7344112 | 1 |
computes empirical bootstrap for regression problem | def regression_bootstrap(self, X: np.ndarray, y: np.ndarray, n=None, B=1000, model=None):
boot_est = [None] * B
result = {}
if model.run is False:
model.fit(X, y);
thetas = model.theta
index = 0
for _ in range(B):
idx = np.random.randint(low=0, hig... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def residual_bootstrap(self, X: np.ndarray, y: np.ndarray, n=None, B=1000, model=None):\n # fit the model if it hasn't been run\n if model.run is False:\n model.fit(X, y);\n resid = model.residuals\n pred = model.predictions\n boot_est = [None] * B\n result = {}... | [
"0.6828615",
"0.66068625",
"0.6545324",
"0.65088797",
"0.64571667",
"0.64449966",
"0.6441457",
"0.64222157",
"0.6327106",
"0.6316082",
"0.6301678",
"0.6224388",
"0.62125295",
"0.61592007",
"0.60806715",
"0.60796577",
"0.60620844",
"0.6056833",
"0.6034502",
"0.6022748",
"0.601... | 0.7066247 | 0 |
Samples from the model by using a sentence as input. | def sample_sent(self, seed: str, num_words: int, temperature=1.0):
new_seed = word_tokenize(seed)
return self.sample(new_seed, num_words, temperature) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample(args):\n with open(os.path.join(args.save_dir, 'config.pkl'), 'rb') as f:\n saved_args = cPickle.load(f)\n with open(os.path.join(args.save_dir, 'words_vocab.pkl'), 'rb') as f:\n words, vocab = cPickle.load(f)\n tf.reset_default_graph()\n model = Model(saved_args, True)\n wi... | [
"0.6462898",
"0.6332141",
"0.6311455",
"0.6258953",
"0.6209095",
"0.6182178",
"0.61456835",
"0.6083665",
"0.6044231",
"0.601698",
"0.59860104",
"0.5928433",
"0.59251314",
"0.59154105",
"0.5907113",
"0.5901741",
"0.58996326",
"0.58762306",
"0.58762306",
"0.5863097",
"0.5856869... | 0.6458874 | 1 |
Loads a character sampler from the specified paths. | def from_paths(cls, weights_path, vocab_path, sequence_length):
chars = util.load_vocab(vocab_path)
model = build_character_level_model(len(chars), sequence_length)
model.load_weights(weights_path)
return cls(model, chars, sequence_length) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(path):\n pass",
"def load_sample(self):\n\n self.load_images(self.folder + \"/sampleSet.txt\")\n self.load_traces(self.folder + \"/sampleLabel.txt\")",
"def load_assets(self, paths):\n try:\n self.background = load(paths['background'])\n self.bullet = ... | [
"0.601337",
"0.5859353",
"0.583447",
"0.5746866",
"0.569873",
"0.56790996",
"0.56531835",
"0.56531835",
"0.56473684",
"0.55836266",
"0.54546577",
"0.5444637",
"0.5434526",
"0.5354626",
"0.5247609",
"0.52465093",
"0.52368",
"0.5188384",
"0.5157901",
"0.515153",
"0.5129671",
... | 0.5873757 | 1 |
\ Parse a device file using the given file format. If file format is not given, file extension will be used. | def from_devfile(devfile, file_format=None, raiseErr=True, **kwargs):
from mmdev import parsers
if file_format is None:
file_format = os.path.splitext(devfile)[1][1:]
try:
parsercls = parsers.PARSERS[file_format]
except KeyError:
raise KeyError("File extension '%s' not recognized... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_file(self,filename):\n\n if (config.mode_format == \"simple\"): return self.read_file_simple(filename)\n if (config.mode_format == \"agsm\"): return self.read_file_agsm(filename)\n sys.exit(\"ERROR: unrecognised format \\\"\"+config.mode_format+\"\\\".\\n\" \\\n +\" ... | [
"0.6118345",
"0.5993526",
"0.59147155",
"0.5881222",
"0.5867202",
"0.57360864",
"0.5717077",
"0.5633291",
"0.55890423",
"0.5573933",
"0.5534352",
"0.55200124",
"0.5511212",
"0.5482957",
"0.5473776",
"0.54368377",
"0.54324925",
"0.54305726",
"0.5429239",
"0.54276496",
"0.54210... | 0.6906373 | 0 |
Get this account's current receive address | def receive_address(self):
url = self.base_url + 'account/receive_address'
self.session.headers.update(self.sign(url))
resp =self.session.get(url)
return pd.Series(resp.json()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_address(self):\n pass",
"def get_remit_to_address(self): \n return self.remit_to_address",
"def get_address(self):\n if self.address:\n return self.address",
"def get_address(self):\n \n return self._addr",
"def get_address(self):\n \n ... | [
"0.69223",
"0.67890394",
"0.6574072",
"0.6554729",
"0.6554729",
"0.6517154",
"0.6479102",
"0.6416398",
"0.6332001",
"0.6276571",
"0.62622255",
"0.623307",
"0.6200893",
"0.6195295",
"0.6195295",
"0.6195295",
"0.6195295",
"0.6195295",
"0.61622924",
"0.6149964",
"0.61148465",
... | 0.751058 | 0 |
UNTESTED Request BitCoin from an email address to be delivered to this account | def request(self, from_email, amount, notes='', currency='BTC'):
url = self.base_url + 'transactions/request_money'
if currency == 'BTC':
request_data = {
"transaction": {
"from": from_email,
"amount": amount,
"note... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_0110_activationkey_resend_post_1(self):\n response = self.fetch(\n '/activation_resend', method=\"POST\", follow_redirects=False,\n body=urlencode({'email':'abc@example.com'})\n )\n self.assertEqual(response.code, 200)\n self.assertEqual(\n resp... | [
"0.59033644",
"0.5902301",
"0.5873402",
"0.58182836",
"0.5810677",
"0.57829",
"0.576119",
"0.5751676",
"0.57376075",
"0.5684819",
"0.5678226",
"0.56766224",
"0.56520915",
"0.56503695",
"0.5622658",
"0.56179893",
"0.55932885",
"0.5574992",
"0.5557751",
"0.55373156",
"0.5535638... | 0.6018859 | 0 |
Retrieve a transaction's details | def get_transaction(self, transaction_id):
url = self.base_url + 'transactions/' + str(transaction_id)
self.session.headers.update(self.sign(url))
resp = self.session.get(url)
return resp.json() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_transaction_details_request(self):\n self.trans_details.get_transaction_details(\n trans_id = 123456,\n )",
"def get_transaction_detail(payload):\n response = requests.post(url, data=payload)\n return response.json()",
"def get_transition_details(self, account_id, tr... | [
"0.80232537",
"0.7354677",
"0.73334664",
"0.70271695",
"0.69203156",
"0.6875585",
"0.67973626",
"0.6767174",
"0.67307967",
"0.6686202",
"0.6666744",
"0.66518664",
"0.6626436",
"0.65828323",
"0.65755147",
"0.65755147",
"0.65399855",
"0.6448602",
"0.6392721",
"0.63261706",
"0.6... | 0.7456548 | 1 |
Sends a friend request to the user | async def send_friend_request(self):
logging.debug("Sending friend request to " + self.username)
if self.is_friend:
raise ObjectErrors.AlreadyFriends(
"You are already friends with " + self.display_name)
await self.client.request.post(
"/user/%s/friendR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_request(request, id):\n user = get_object_or_404(User, id=id)\n f_request, created = FriendRequest.objects.get_or_create(\n from_user=request.user,\n to_user=user\n )\n if created:\n messages.success(\n request,\n f'Your friend request to {user} has b... | [
"0.7373825",
"0.713863",
"0.7067845",
"0.7044541",
"0.6986165",
"0.68482757",
"0.6795371",
"0.6744355",
"0.66788155",
"0.6590272",
"0.65513295",
"0.6515606",
"0.65038973",
"0.6477057",
"0.6457316",
"0.64259183",
"0.6416182",
"0.64161116",
"0.6396046",
"0.63797796",
"0.6361164... | 0.8217153 | 0 |
Fetches users permissions, returns list of permission objects Keyword Arguments | async def fetch_permissions(self, condensed=False):
logging.debug("Getting permissions (%scondensed)" % (
"" if condensed else "not "))
if condensed:
perms = await self.client.request.get(
"/auth/permissions", params={"condensed": True})
return perms... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_permissions(self, obj=None):",
"def octopus_permissions_get(self, msg, args):\r\n return self.permissions.get_permissions()",
"def get_permissions(self, principal_id):",
"def get_permissions(self):\n permissions = [IsAdminUser]\n return [permission() for permission in permiss... | [
"0.76583916",
"0.714898",
"0.7069271",
"0.70243394",
"0.69735223",
"0.6933946",
"0.688342",
"0.6883105",
"0.6858095",
"0.6835594",
"0.6835594",
"0.6832657",
"0.68115896",
"0.6804625",
"0.6756365",
"0.6735406",
"0.6730444",
"0.6701549",
"0.66967696",
"0.66963583",
"0.66962457"... | 0.74537504 | 1 |
Fetches user favorites, returning ``favorite_type`` or a mix of all the favorite types Keyword Arguments | async def fetch_favorites(self, favorite_type=None, n=100, offset=0):
if n > 100:
n = 100
params = {
"n": n,
"offset": offset
}
if favorite_type is not None:
params["type"] = favorite_type
favorites = await self.client.request.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def fetch_all_favorites(self, favorite_type=None):\n\n favorites = await vrcpy.util.auto_page_coro(\n self.fetch_favorites, favorite_type=favorite_type)\n\n world = []\n friend = []\n avatar = []\n\n for favorite in favorites:\n if favorite.type == Fav... | [
"0.7206394",
"0.6586617",
"0.6417396",
"0.62762886",
"0.62620825",
"0.62332726",
"0.62299156",
"0.60298043",
"0.6029627",
"0.6012111",
"0.6006813",
"0.5984588",
"0.59840655",
"0.5982405",
"0.5941768",
"0.5735374",
"0.5715554",
"0.57118183",
"0.57083035",
"0.5686642",
"0.56670... | 0.6721451 | 1 |
Fetches all favorites by autopaging, returning ``favorite_type`` or a mix of all the favorite types. Using this also updates favorite cache Keyword Arguments | async def fetch_all_favorites(self, favorite_type=None):
favorites = await vrcpy.util.auto_page_coro(
self.fetch_favorites, favorite_type=favorite_type)
world = []
friend = []
avatar = []
for favorite in favorites:
if favorite.type == FavoriteType.WORLD... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def fetch_favorites(self, favorite_type=None, n=100, offset=0):\n\n if n > 100:\n n = 100\n\n params = {\n \"n\": n,\n \"offset\": offset\n }\n\n if favorite_type is not None:\n params[\"type\"] = favorite_type\n\n favorites = awa... | [
"0.6839941",
"0.64985955",
"0.6240866",
"0.62036407",
"0.6013773",
"0.60058326",
"0.59991366",
"0.5770625",
"0.57559884",
"0.57079",
"0.5651222",
"0.557293",
"0.5548027",
"0.55305433",
"0.5496854",
"0.5464642",
"0.54065603",
"0.5399308",
"0.5373338",
"0.53702813",
"0.5295063"... | 0.72638565 | 0 |
Fetches moderations against the user | async def fetch_moderated(self):
logging.debug("Fetching moderated")
data = await self.client.request.get("/auth/user/playermoderated")
return [PlayerModeration.build_moderation(
self.client, mod, self.loop) for mod in data["data"]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_moderating(self, user):\n if not user: return False\n query = db.Query(GameModerator)\n query.filter('game =', self)\n query.filter('user =', user)\n return query.get()",
"def current_user_moderating(self):\n return self.user_moderating(users.GetCurrentUser())",
"def get_... | [
"0.70628023",
"0.6201899",
"0.61619765",
"0.59319955",
"0.5841453",
"0.57664704",
"0.57575977",
"0.5677609",
"0.56595176",
"0.563347",
"0.5538352",
"0.55252314",
"0.5504787",
"0.54894733",
"0.54779696",
"0.54731494",
"0.544925",
"0.54163736",
"0.53645295",
"0.5355124",
"0.532... | 0.77385306 | 0 |
Fetches favorite groups for worlds, avatars and users Keyword Arguments | async def fetch_favorite_groups(self, n: int = 50):
resp = await self.client.request.get("/favorite/groups", params={"n": str(n)})
groups = {}
for group in resp["data"]:
groups.append(FavoriteGroup.build_favorite_group(
self.client, group, self.loop))
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_groups(request):\r\n if(any(elem not in [\"name\",\"password\",\"gid\",\"member\"] for elem in request.GET)):\r\n badRequest(\"Parameters incorrect\")\r\n group = Group()\r\n # Must format params to allow for multiple members under same key. Dict converts all to arrays, rest is converted... | [
"0.5789151",
"0.57112396",
"0.5698942",
"0.5577221",
"0.5553875",
"0.54356575",
"0.5378318",
"0.5366365",
"0.5348086",
"0.53193164",
"0.53164315",
"0.53105015",
"0.5299645",
"0.5295492",
"0.5291341",
"0.52426225",
"0.5204173",
"0.52040464",
"0.5195504",
"0.5156613",
"0.513098... | 0.5782045 | 1 |
Handles incoming text messages from Twilio API. Isolates the text message and uses it to query The Dog API for a dog picture. Supports searching by breed and getting a random dog picture. | def incoming_sms():
txt = request.form['Body']
# remove leading and trailing white space and make lowercase
txt = txt.strip()
txt = txt.lower()
# handle random searches differently than breed searches
if txt == 'random' or txt == 'dog':
url = get_dogs.get_random_dog()
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def dog(self):\r\n dog_api = \"https://dog.ceo/api/breeds/image/random\"\r\n json_data = requests.get(dog_api).json()\r\n dogimage = json_data['message']\r\n await self.bot.say(dogimage)",
"async def dog(self, ctx: Message):\n\t\timage_url = requests.get(\"https://api.thedogapi.... | [
"0.63701046",
"0.6288669",
"0.61613667",
"0.6006372",
"0.59462607",
"0.5779944",
"0.57687557",
"0.57631946",
"0.57228655",
"0.5700433",
"0.5691575",
"0.56864244",
"0.5678104",
"0.5676385",
"0.5672712",
"0.5642777",
"0.561658",
"0.558971",
"0.55819124",
"0.55591977",
"0.549203... | 0.67864186 | 0 |
Create a Frame Buffer Object (fbo) with the given size and color components | def create_fbo(ctx: moderngl.Context, size: Size, components: int = 4) -> moderngl.Framebuffer:
return ctx.framebuffer(
color_attachments=[ctx.renderbuffer(size, components)],
depth_attachment=ctx.depth_renderbuffer(size)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_fbo_head():\n lfb_prefix_path = osp.normpath(\n osp.join(osp.dirname(__file__), '../data/lfb'))\n\n st_feat_shape = (1, 16, 1, 8, 8)\n st_feat = generate_backbone_demo_inputs(st_feat_shape)\n rois = torch.randn(1, 5)\n rois[0][0] = 0\n img_metas = [dict(img_key='video_1, 930')]\n\... | [
"0.5801889",
"0.5702869",
"0.5541218",
"0.5540134",
"0.53373677",
"0.5206853",
"0.52051324",
"0.51887405",
"0.5129463",
"0.5122263",
"0.5088751",
"0.50370806",
"0.5023039",
"0.50155634",
"0.49956527",
"0.49854746",
"0.49744597",
"0.49742502",
"0.4924055",
"0.49196365",
"0.491... | 0.87300503 | 0 |
Returns current fbo as an ndarray | def snapshot2(self) -> np.array:
fbo = self.fbo
data = fbo.read(components=3, dtype='f4')
w, h = self.size
return np.flipud(np.frombuffer(data, dtype='f4').reshape((h, w, 3))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_numpy_array(self):\n return self.frame",
"def buffer(self) -> np.ndarray:\n return np.array(self._image_data, copy=False)",
"def array(self):\n return self.get_array()",
"def __array__(self):\n return np.asarray(self.data)",
"def to_numpy(self) -> np.ndarray:\n return ... | [
"0.6436365",
"0.6390906",
"0.63370705",
"0.63307345",
"0.6315179",
"0.63022697",
"0.6293401",
"0.6287471",
"0.62845415",
"0.6267776",
"0.62338114",
"0.62107676",
"0.6197706",
"0.61791164",
"0.6142685",
"0.60981643",
"0.6054168",
"0.6038342",
"0.6030088",
"0.60291946",
"0.6028... | 0.6831023 | 0 |
Create a monitor by connecting to the kernel daemon through netlink. | def from_netlink(cls, context, source='udev'):
if source not in ('kernel', 'udev'):
raise ValueError('Invalid source: {0!r}. Must be one of "udev" '
'or "kernel"'.format(source))
monitor = context._libudev.udev_monitor_new_from_netlink(
context, ensur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __initializeMonitor( self ):\n if self.__moduleProperties[ 'standalone' ]:\n self.monitor = gMonitor\n else:\n self.monitor = MonitoringClient()\n self.monitor.setComponentType( self.monitor.COMPONENT_AGENT )\n self.monitor.setComponentName( self.__moduleProperties[ 'fullName' ] )\n se... | [
"0.5842441",
"0.5641095",
"0.55806166",
"0.5491063",
"0.54298496",
"0.53146154",
"0.5299109",
"0.5246322",
"0.5216399",
"0.52025867",
"0.5193295",
"0.51505154",
"0.5142829",
"0.5134207",
"0.5082128",
"0.5077155",
"0.50586104",
"0.50409234",
"0.50360125",
"0.49993685",
"0.4961... | 0.629272 | 0 |
Connect to an arbitrary udev daemon using the given ``socket_path``. | def from_socket(cls, context, socket_path):
monitor = context._libudev.udev_monitor_new_from_socket(
context, ensure_byte_string(socket_path))
if not monitor:
raise EnvironmentError('Could not create monitor for socket: '
'{0!r}'.format(socket_p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_socket(root_dir):\n # Get config directory where the daemon socket is located\n config_dir = os.path.join(root_dir, '.config/pueue')\n\n # Create Socket and exit with 1, if socket can't be created\n try:\n client = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)\n socket_pat... | [
"0.6658648",
"0.57487077",
"0.57248783",
"0.56902397",
"0.5646829",
"0.5571467",
"0.5560274",
"0.5491816",
"0.5469069",
"0.5340727",
"0.53019065",
"0.5294809",
"0.5244782",
"0.5243381",
"0.5200097",
"0.5186089",
"0.51457965",
"0.51306194",
"0.51290256",
"0.509967",
"0.5090110... | 0.6565483 | 1 |
Return the file description associated with this monitor as integer. This is really a real file descriptor ;), which can be watched and | def fileno(self):
return self._libudev.udev_monitor_get_fd(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_desc():\n \n with open('/proc/sys/fs/file-nr') as f:\n line = f.readline()\n \n fd = [int(x) for x in line.split()]\n \n return fd",
"def fileno(self):\r\n return self._fd.fileno()",
"def fileno(self) -> int:",
"def fileno(self):\n return self.channel.fileno()"... | [
"0.74031085",
"0.67754346",
"0.67130655",
"0.6663038",
"0.6642915",
"0.66414106",
"0.6630495",
"0.66018164",
"0.6600667",
"0.6547988",
"0.6527958",
"0.6447365",
"0.6383324",
"0.6367332",
"0.63505316",
"0.63328177",
"0.63328177",
"0.63305724",
"0.63293976",
"0.6233179",
"0.623... | 0.7083363 | 1 |
Filter incoming events. ``subsystem`` is a byte or unicode string with the name of a subsystem (e.g. ``'input'``). Only events originating from the given subsystem pass the filter and are handed to the caller. If given, ``device_type`` is a byte or unicode string specifying the device type. Only devices with the given ... | def filter_by(self, subsystem, device_type=None):
subsystem = ensure_byte_string(subsystem)
if device_type:
device_type = ensure_byte_string(device_type)
self._libudev.udev_monitor_filter_add_match_subsystem_devtype(
self, subsystem, device_type)
self._libudev.ude... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_devices(self, subsystem: UdevSubsystem | None = None) -> list[Device]:\n devices = set()\n for device in self.devices:\n if subsystem and device.subsystem != subsystem:\n continue\n devices.add(device)\n return list(devices)",
"def pass_filters... | [
"0.5975349",
"0.45121318",
"0.44813666",
"0.4332891",
"0.41228282",
"0.40819362",
"0.4061883",
"0.40150812",
"0.39757392",
"0.39721748",
"0.39716902",
"0.3967306",
"0.3962228",
"0.39582562",
"0.39029753",
"0.38913316",
"0.38811502",
"0.38712072",
"0.38544807",
"0.38515154",
"... | 0.79289705 | 0 |
Filter incoming events by the given ``tag``. ``tag`` is a byte or unicode string with the name of a tag. Only events for devices which have this tag attached pass the filter and are handed to the caller. | def filter_by_tag(self, tag):
self._libudev.udev_monitor_filter_add_match_tag(
self, ensure_byte_string(tag))
self._libudev.udev_monitor_filter_update(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crossfilter_by_tag(self,df, tag):\n col,spec= list(tag.items())[0]\n return df[df[col]==spec]",
"def search_tag(self, tag):\n self.driver.get(self.tag_url.format(tag))",
"def filter_queryset(self, queryset):\n tags = self.request.GET.getlist(\"tag\")\n if tags:\n ... | [
"0.5666642",
"0.51973397",
"0.51657885",
"0.5159696",
"0.5134646",
"0.51267135",
"0.50107723",
"0.49824739",
"0.49283835",
"0.4923795",
"0.48922583",
"0.48665416",
"0.486598",
"0.48503694",
"0.48403606",
"0.48226506",
"0.47957942",
"0.47786885",
"0.47646055",
"0.4741162",
"0.... | 0.79313517 | 0 |
Set the receive buffer ``size``. ``size`` is the requested buffer size in bytes, as integer. | def set_receive_buffer_size(self, size):
try:
self._libudev.udev_monitor_set_receive_buffer_size(self, size)
except EnvironmentError:
self._reraise_with_socket_path() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strace_set_buffer_size(self, size):\n size = ctypes.c_uint32(size)\n res = self._dll.JLINK_STRACE_Control(enums.JLinkStraceCommand.SET_BUFFER_SIZE, size)\n if res < 0:\n raise errors.JLinkException('Failed to set the STRACE buffer size.')\n\n return None",
"def __set_si... | [
"0.6981181",
"0.6979146",
"0.68849653",
"0.68056643",
"0.6791033",
"0.650424",
"0.6397327",
"0.63909835",
"0.63701284",
"0.63119274",
"0.63112855",
"0.63112855",
"0.63112855",
"0.63112855",
"0.6291892",
"0.6289078",
"0.6160049",
"0.6160049",
"0.61325973",
"0.6129285",
"0.6051... | 0.7975507 | 0 |
Receive a single device from the monitor. The caller must make sure, that there are events available in the event queue. The call blocks, until a device is available. If a device was available, return ``(action, device)``. ``device`` | def receive_device(self):
try:
device_p = self._libudev.udev_monitor_receive_device(self)
except EnvironmentError:
self._reraise_with_socket_path()
if not device_p:
raise EnvironmentError('Could not receive device')
action = ensure_unicode_string(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_device(self, device):\n\t\tself.ise.headers.update({'Accept': 'application/vnd.com.cisco.ise.network.networkdevice.1.0+xml'})\n\n\t\tresult = {\n\t\t\t'success': False,\n\t\t\t'response': '',\n\t\t\t'error': '',\n\t\t}\n\n\t\tresp = self.ise.get('{0}/config/networkdevice?filter=name.EQ.{1}'.format(self.url... | [
"0.59522355",
"0.58867776",
"0.58853173",
"0.5813893",
"0.57472056",
"0.56929654",
"0.56529856",
"0.56129146",
"0.5546824",
"0.5546824",
"0.5546824",
"0.5546824",
"0.55230916",
"0.55181956",
"0.5491791",
"0.54799294",
"0.54527694",
"0.5444138",
"0.53849095",
"0.5365675",
"0.5... | 0.75275433 | 0 |
Takes the module name and tries to identify a list of functions to return. | def _getModFunctions(modName, modSearch):
# First find all callable functions they want
try:
mod = sys.modules[modName]
modNames = dir(mod)
callables = []
for m in modNames:
a = getattr(mod, m)
if(hasattr(a, '__call__') and hasattr(a, '__class__')):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_function_list_from_modlist(self):\n function_list = []\n function_name_list = []\n for module in self.module_list:\n for name, obj in inspect.getmembers(module, inspect.isfunction):\n if inspect.getmodule(obj) == module:\n function_list.appe... | [
"0.70581394",
"0.661115",
"0.6598877",
"0.65795875",
"0.6404035",
"0.63618064",
"0.6332475",
"0.6321175",
"0.6285262",
"0.6178784",
"0.6146512",
"0.6116439",
"0.6094806",
"0.60747135",
"0.59446853",
"0.59231937",
"0.59136623",
"0.5896091",
"0.58631843",
"0.58433676",
"0.58364... | 0.7192133 | 0 |
Creates an optimal policy for solving the contextual bandit environment. | def get_contextual_bandit_policy(contextual_bandit_env,
epsilon_explore=0.0,
py=True,
return_distribution=True):
if epsilon_explore < 0 or epsilon_explore > 1:
raise ValueError('Invalid exploration value %f' % epsil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_optimal_policy(self):\n self.Policy = np.argmax(self.Q, axis=1)\n if self.mode == 'debug':\n print(\"Optimal Policy:\",self.Policy)",
"def getPolicy(self, state):\n \"\"\"Description:\n Find all of q-values of current state, and choose the action \n with the hight q-... | [
"0.64927095",
"0.60700333",
"0.6013502",
"0.5950279",
"0.5819569",
"0.58070433",
"0.5794501",
"0.5701989",
"0.5638407",
"0.55973166",
"0.5588712",
"0.55322045",
"0.5500936",
"0.5482766",
"0.5460455",
"0.54048747",
"0.53948706",
"0.53906006",
"0.5379852",
"0.5373095",
"0.53423... | 0.6236816 | 1 |
Wrapper for tf.matmul (sparse vs dense). | def dot(x,y,sparse=False):
if sparse:
res = tf.sparse_tensor_dense_matmul(x, y)
else:
res = tf.matmul(x, y)
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dot(x, y, sparse=False):\n if sparse:\n res = tf.sparse_tensor_dense_matmul(x, y)\n else:\n res = tf.matmul(x, y)\n return res",
"def sparse_matmul(A: SparseTensor, B: SparseTensor, out: torch.Tensor) -> torch.Tensor:\n if A.nnz() == 0 or B.nnz() == 0:\n return out\n\n if ... | [
"0.7717564",
"0.739388",
"0.7382497",
"0.71858466",
"0.71548396",
"0.7092191",
"0.7060006",
"0.69942117",
"0.69575405",
"0.6784286",
"0.6765532",
"0.67141557",
"0.66577524",
"0.6653065",
"0.6623352",
"0.6549582",
"0.65280193",
"0.6438002",
"0.6416873",
"0.64110273",
"0.640699... | 0.77353585 | 0 |
Inserts rows into specified table. | def insert(self, table_name, rows, bulk=True):
table = self._create_table(table_name)
return self._perform_query(table.insert(), rows, bulk) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bq_insert_rows(bq_client, table, rows):\n _batch_insert(bq_client, table, rows)",
"def insert_row(self, tablename, fields):\n insert_params = \"(\" + \",\".join(['?' for x in fields]) + \")\"\n self.cursor.execute(\"insert into \" + tablename + \" values \" +\n ins... | [
"0.76099175",
"0.7304086",
"0.72266775",
"0.70127386",
"0.70006967",
"0.69257027",
"0.6918206",
"0.6911293",
"0.6864757",
"0.68546313",
"0.6818461",
"0.6810073",
"0.678777",
"0.6763292",
"0.6754389",
"0.6733423",
"0.6727673",
"0.66795295",
"0.6675443",
"0.66739845",
"0.665978... | 0.7594534 | 1 |
Update a row of the specified database table based on the ID. | def update(self, table_name, data, id_column_name='id'):
table = self._create_table(table_name)
for row in data:
try:
statement = table.update() \
.where(table.c[id_column_name] == row[id_column_name]) \
.values(**row)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(table, id_):\n\n # your code\n\n return table",
"def sqlite3_update_record(data_base, table, param_column, param_value, id_column, record_id):\n con = sqlite3.connect(data_base)\n cur = con.cursor()\n try:\n query = 'UPDATE ' + table + ' SET ' + param_column + ' =... | [
"0.7131184",
"0.6938645",
"0.6827818",
"0.68115515",
"0.67745304",
"0.66986614",
"0.6474268",
"0.6451171",
"0.63700366",
"0.6360486",
"0.63131547",
"0.62055993",
"0.61969274",
"0.61965156",
"0.6179578",
"0.6170901",
"0.6168173",
"0.6132337",
"0.6125871",
"0.61153567",
"0.6096... | 0.70219463 | 1 |
Complete name = "parent_name / name" | def get_complete_name(self):
if self.parent_id:
name = '%s / %s'%(self.parent_id.get_complete_name(), self.name)
else:
name = self.name
return name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _complete_name(self):\n for record in self:\n if record.parent_id:\n record.complete_name = record.parent_id.complete_name + ' / ' + record.name\n else:\n record.complete_name = record.name",
"def longname(self):\n if not self.parent:\n ... | [
"0.73629916",
"0.73120004",
"0.7069055",
"0.6927215",
"0.6807252",
"0.66381985",
"0.6618085",
"0.644751",
"0.6444999",
"0.6424132",
"0.6367957",
"0.63577133",
"0.6339139",
"0.6298488",
"0.62682086",
"0.62632906",
"0.62410146",
"0.62161547",
"0.6157869",
"0.6157869",
"0.615786... | 0.76520973 | 0 |
Fonction name_search de la gamme | def name_search(self, name, args=None, operator='ilike', limit=1000):
args = self.compute_domain_args(args)
recs = self.search([('name', operator, name)] + args, limit=limit)
return recs.name_get() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_search(self,cr,uid,name='',args=[],operator='ilike',context=None,limit=80):\n if context is None: \n context={}\n ids= []\n if len(name) >= 2:\n ids = self.search(cr, uid, [('vat',operator,name)] + args, limit=limit, context=context)\n if not ids:\n ... | [
"0.7332873",
"0.7273161",
"0.71859074",
"0.70795864",
"0.7058341",
"0.6973131",
"0.69059366",
"0.686474",
"0.6849113",
"0.684415",
"0.683499",
"0.6810947",
"0.6781055",
"0.6720904",
"0.669474",
"0.664896",
"0.66237813",
"0.6620524",
"0.658569",
"0.657765",
"0.6539284",
"0.6... | 0.7374638 | 0 |
Sets the tab selection | def select_tab(self, selected_tab):
for tab in self.tabs:
if tab == selected_tab:
tab.selected = True
else:
tab.selected = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetCurrentTab(self, index):\n if index == self.GetCurSel(): return\n self.OnSelChanging(None) #simulate\n self.SetCurSel(index) #does not cause sel changing and sel change events\n self.OnSelChange(None) #simulate",
"def tabSelected(self):",
"def tabSelected(self):",
"def tabS... | [
"0.7228304",
"0.7061206",
"0.7061206",
"0.7045288",
"0.6945325",
"0.6928036",
"0.68255275",
"0.67694014",
"0.6713398",
"0.6493335",
"0.6293864",
"0.62175435",
"0.6192053",
"0.6135601",
"0.6122223",
"0.6078583",
"0.6056166",
"0.5967249",
"0.5932563",
"0.5923162",
"0.58946025",... | 0.7906762 | 0 |
Ask all GUI elements to check event | def check_event(self, event):
for tab in self.tabs:
tab.check_event(event) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_events(self):\r\n for event in pg.event.get():\r\n if event.type == pg.QUIT:\r\n self.ai_game.quit()\r\n elif event.type == pg.KEYDOWN:\r\n self._check_keydown_events(event)\r\n elif event.type == pg.KEYUP:\r\n self._che... | [
"0.716912",
"0.6734102",
"0.6625884",
"0.655134",
"0.6521154",
"0.64759755",
"0.64363146",
"0.64115113",
"0.63923794",
"0.63923794",
"0.6372732",
"0.6327478",
"0.63157505",
"0.62871295",
"0.61911",
"0.6177678",
"0.60905755",
"0.6080838",
"0.6063604",
"0.60579574",
"0.6054394"... | 0.6774125 | 1 |
Get the IMAP host. | def get_imap_host():
return get_account().Get(GOA_ACCOUNT_MAIL, 'ImapHost',
dbus_interface=PROPERTIES) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mail_host():\n portal = getSite()\n if portal is None:\n return None\n request = portal.REQUEST\n ctrlOverview = getMultiAdapter((portal, request), name='overview-controlpanel')\n mail_settings_correct = not ctrlOverview.mailhost_warning()\n if mail_settings_correct:\n mail_... | [
"0.7323792",
"0.7314019",
"0.728461",
"0.719561",
"0.71634734",
"0.7103244",
"0.7092401",
"0.70497376",
"0.7040019",
"0.70081824",
"0.69928026",
"0.69074327",
"0.6778371",
"0.6778371",
"0.6778371",
"0.6778371",
"0.6778371",
"0.6778371",
"0.6778371",
"0.67529756",
"0.67471695"... | 0.85919154 | 0 |
Get the IMAP user name. | def get_imap_user_name():
return str(get_account().Get(GOA_ACCOUNT_MAIL, 'ImapUserName',
dbus_interface=PROPERTIES)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_name(self):\n return self._stub.List(self._message).user_name",
"def user_name(self) -> str:\n return pulumi.get(self, \"user_name\")",
"def user_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"user_name\")",
"def getUserName(self):\n userType = self.env['re... | [
"0.7674771",
"0.7609183",
"0.7536241",
"0.739787",
"0.7250912",
"0.71732175",
"0.7153436",
"0.7127807",
"0.7097307",
"0.708607",
"0.705256",
"0.70507437",
"0.70507437",
"0.70507437",
"0.7041432",
"0.70206535",
"0.7014133",
"0.7014133",
"0.7014133",
"0.6957826",
"0.69508284",
... | 0.8884453 | 0 |
Get the client secret from the online account. | def get_client_secret():
return str(get_account().Get(GOA_ACCOUNT_OAUTH2, 'ClientSecret',
dbus_interface=PROPERTIES)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_secret(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"client_secret\")",
"def client_secret(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"client_secret\")",
"def client_secret(self) -> str:",
"def client_secret(self) -> pulumi.Input[str]:\n ... | [
"0.7722696",
"0.7722696",
"0.7474888",
"0.7474458",
"0.7474458",
"0.7474458",
"0.7474458",
"0.7474458",
"0.7392615",
"0.7392615",
"0.7344622",
"0.7344622",
"0.7344622",
"0.7344622",
"0.7344622",
"0.7344622",
"0.7344622",
"0.7344622",
"0.732468",
"0.71429634",
"0.70245343",
... | 0.78848386 | 0 |
Get the access token from the online account. | def get_access_token():
account = get_account()
account.EnsureCredentials(dbus_interface=GOA_ACCOUNT)
access_token, _ = account.GetAccessToken(dbus_interface=GOA_ACCOUNT_OAUTH2)
return str(access_token) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_access_token(self):\n access_token = self._auth_provider._get_auth_value()\n return access_token",
"def get_access_token(self):\n\n token_work = time.time() < self.expires\n\n if token_work:\n # No need update token\n return self.access_token\n\n d... | [
"0.7698096",
"0.7672184",
"0.7662937",
"0.76265717",
"0.75849855",
"0.7543128",
"0.7496568",
"0.7485268",
"0.7455015",
"0.7395089",
"0.7383475",
"0.7366155",
"0.73583156",
"0.73583156",
"0.73305404",
"0.7288126",
"0.72761136",
"0.7240915",
"0.72369367",
"0.7220162",
"0.720622... | 0.7807534 | 0 |
Add a Vlan object to the net config object. | def add_vlan(self, vlan):
logger.info('adding vlan: %s' % vlan.name)
data = self._add_common(vlan)
logger.debug('vlan data: %s' % data)
self.interface_data[vlan.name] = data
if vlan.routes:
self._add_routes(vlan.name, vlan.routes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(\n self,\n Enabled=None,\n InternalRootPathCost=None,\n Mac=None,\n PortPriority=None,\n Priority=None,\n UpdateRequired=None,\n VlanId=None,\n ):\n # type: (bool, int, str, int, str, bool, int) -> Vlan\n return self._create(self._map... | [
"0.6077769",
"0.59645206",
"0.5894081",
"0.57518435",
"0.57477623",
"0.5655887",
"0.56225246",
"0.55709255",
"0.5518417",
"0.54682285",
"0.5455874",
"0.5418201",
"0.539219",
"0.5344074",
"0.5312479",
"0.5307091",
"0.5276449",
"0.52353144",
"0.52163297",
"0.52099174",
"0.52071... | 0.603703 | 1 |
Add an OvsBridge object to the net config object. | def add_bridge(self, bridge):
logger.info('adding bridge: %s' % bridge.name)
data = self._add_common(bridge)
logger.debug('bridge data: %s' % data)
self.bridge_data[bridge.name] = data
if bridge.routes:
self._add_routes(bridge.name, bridge.routes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addBridge(self, bridge):\n self.bridges.append(bridge)",
"def remote_createBridge(self, name):\r\n if name in self._bridges:\r\n raise InternalError('Bridge already exists.')\r\n\r\n self._bridges.add(name)\r\n return execute(('/usr/bin/ovs-vsctl', '--', '--may-exist', ... | [
"0.7036302",
"0.636155",
"0.62205625",
"0.58536595",
"0.5717984",
"0.5396469",
"0.5350926",
"0.533486",
"0.5209206",
"0.5184907",
"0.5178858",
"0.51081914",
"0.5087172",
"0.5024791",
"0.5011627",
"0.49891123",
"0.49801546",
"0.49567738",
"0.492117",
"0.49055576",
"0.4870483",... | 0.70225567 | 1 |
Add an OvsBond object to the net config object. | def add_bond(self, bond):
logger.info('adding bond: %s' % bond.name)
data = self._add_common(bond)
logger.debug('bond data: %s' % data)
self.interface_data[bond.name] = data
if bond.routes:
self._add_routes(bond.name, bond.routes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_bond(self,bond):\n if bond.label==None:\n bond.label = bond_label_dir[str(self.Nbonds)]\n if bond.color==None:\n bond.color = 'black'\n self.bonds.append(bond)\n self.Nbonds +=1",
"def addBond(self, **kwds):\n print kwds\n self.MagCell.addBo... | [
"0.7042654",
"0.6725331",
"0.66269624",
"0.6428748",
"0.58589774",
"0.5577654",
"0.54904604",
"0.5479174",
"0.5383009",
"0.5240194",
"0.5154615",
"0.5078846",
"0.5077104",
"0.5046048",
"0.5018264",
"0.49932727",
"0.49637228",
"0.49340352",
"0.48739976",
"0.48453963",
"0.48439... | 0.6750536 | 1 |
Apply the network configuration. | def apply(self, cleanup=False, activate=True):
logger.info('applying network configs...')
restart_interfaces = []
restart_bridges = []
update_files = {}
all_file_names = []
for interface_name, iface_data in self.interface_data.iteritems():
route_data = self.r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_network_section(self):\n rconfig = configparser.RawConfigParser()\n rconfig.read(self.conf_file)\n if self.ext_net:\n if not rconfig.has_section('network'):\n rconfig.add_section('network')\n rconfig.set('network', 'public_network_id', self.ext_n... | [
"0.66229737",
"0.64015234",
"0.6399242",
"0.63743067",
"0.62465507",
"0.6235132",
"0.6220781",
"0.60972697",
"0.6086234",
"0.60562795",
"0.6052708",
"0.60332054",
"0.59511423",
"0.5916945",
"0.5869258",
"0.5860552",
"0.5835882",
"0.58355385",
"0.58274704",
"0.5805548",
"0.580... | 0.65709144 | 1 |
Load configuration text from a file | def load_from_file(self, file_path):
with open(file_path) as f:
config_text = f.read()
self.load_from_string(config_text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(file):\n _config.load(file)",
"def load( self ):\n ini = codecs.open(self.filename,\"r\",\"utf-8\",errors=\"replace\",buffering=0)\n for l in ini:\n l = l.strip()\n if l:\n (name,value) = l.split(\"=\",1)\n self.conf[name.strip()] = va... | [
"0.75854945",
"0.75312644",
"0.7097647",
"0.70612305",
"0.6969976",
"0.6944861",
"0.6935008",
"0.6870552",
"0.68562406",
"0.68411684",
"0.68382555",
"0.683738",
"0.6824307",
"0.67287827",
"0.6713675",
"0.67064744",
"0.6700246",
"0.66864276",
"0.66733307",
"0.66413516",
"0.661... | 0.8322267 | 0 |
Add ACL sequence numbers for use on configurations with a style of 'ios' | def _add_acl_sequence_numbers(self):
ipv4_acl_sw = 'ip access-list'
# ipv6_acl_sw = ('ipv6 access-list')
if self.host.os in ['ios']:
acl_line_sw = ('permit', 'deny')
else:
acl_line_sw = ('permit', 'deny', 'remark')
for child in self.children:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _GenerateACLLine(self, app_id, term, unit, precedence=None):\n target = []\n target.append('application')\n target.append(str(app_id))\n target.append(term.term.name)\n target.append('protocol')\n if term.term.protocol:\n target.append('/'.join(sorted(term.term.protocol)))\n else:\n ... | [
"0.568859",
"0.5519338",
"0.5210421",
"0.5170846",
"0.51472306",
"0.51472306",
"0.51472306",
"0.504872",
"0.49429473",
"0.49280027",
"0.49235392",
"0.48615628",
"0.48489556",
"0.47969285",
"0.47635686",
"0.47626066",
"0.4755888",
"0.4732398",
"0.47136363",
"0.47089124",
"0.47... | 0.75554097 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.