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 |
|---|---|---|---|---|---|---|
Changing sizes of the fields CharField and TextField | def fieldSize(size, rows, cols):
formfield_overrides = {
models.CharField: {'widget': TextInput(attrs={'size': str(size)})},
models.TextField: {'widget': Textarea(attrs={'rows': rows, 'cols': cols})},
}
return formfield_overrides | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __updateSize(self, *args):\n bottom, top = self.getRange()\n nbchar = max(len(str(bottom)), len(str(top)))\n font = self.font()\n font.setStyle(qt.QFont.StyleItalic)\n fontMetrics = qt.QFontMetrics(font)\n self.setMaximumWidth(\n fontMetrics.boundingRect('0'... | [
"0.59937036",
"0.59723264",
"0.59423476",
"0.59423476",
"0.5840828",
"0.5839777",
"0.583722",
"0.583722",
"0.5796603",
"0.5787035",
"0.5785973",
"0.577334",
"0.57362247",
"0.5730432",
"0.5689748",
"0.5689748",
"0.5689748",
"0.5689748",
"0.5689748",
"0.5689748",
"0.5689748",
... | 0.7416564 | 0 |
Just compute the logits and outputs given activations. | def compute_asa_output(self, activations):
asa_logits = tf.contrib.layers.linear(
activations, 1,
weights_initializer=tf.random_uniform_initializer(-0.01, 0.01),
scope='ASALogits')
self.asa_output = tf.nn.relu(asa_logits, name='ASA_output_relu')
return asa_logits | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_outputs(self, *args, **kwargs):\n pass\n # self.outputs = self.model(input_ids=self.input_ids, masked_lm_labels=self.input_ids)\n # self.logits = self.outputs[0][0]\n # self.probs = torch.softmax(self.logits, 1)",
"def logistic(self, data, weights, biases):\n\n sta... | [
"0.67076755",
"0.6531197",
"0.6527088",
"0.64616674",
"0.6449939",
"0.63124216",
"0.628669",
"0.6226123",
"0.6211575",
"0.62114877",
"0.62107086",
"0.61876786",
"0.61538976",
"0.61358494",
"0.61024755",
"0.6069556",
"0.60633683",
"0.6017902",
"0.5952135",
"0.59489363",
"0.594... | 0.69602144 | 0 |
Find the positions for a city with a top and a bottom | def test_find_city(self):
# Given
game_state: CarcassonneGameState = CarcassonneGameState()
city_top = base_tiles["city_top"]
city_bottom = city_top.turn(2)
game_state.board = [[None for column in range(1)] for row in range(2)]
game_state.board[0][0] = city_bottom
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_city_points(city):\n for item in coordinate_list:\n if item[0] == city:\n return (item[1], item[2])",
"def test_find_donut_city(self):\n\n # Given\n game_state: CarcassonneGameState = self.create_donut_city_board()\n\n # When\n city: City = CityUtil.find_c... | [
"0.6479767",
"0.6087169",
"0.6083894",
"0.6046743",
"0.60243106",
"0.6016493",
"0.5994365",
"0.5983197",
"0.5905748",
"0.58899623",
"0.5857768",
"0.5781798",
"0.5723718",
"0.5706854",
"0.56964326",
"0.56894207",
"0.5657274",
"0.5609153",
"0.5604276",
"0.559685",
"0.5595108",
... | 0.66049397 | 0 |
Find the positions for a donut shaped city | def test_find_donut_city(self):
# Given
game_state: CarcassonneGameState = self.create_donut_city_board()
# When
city: City = CityUtil.find_city(
game_state=game_state,
city_position=CoordinateWithSide(Coordinate(0, 0), Side.BOTTOM)
)
# Then
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_city_points(city):\n for item in coordinate_list:\n if item[0] == city:\n return (item[1], item[2])",
"def test_find_city(self):\n\n # Given\n game_state: CarcassonneGameState = CarcassonneGameState()\n\n city_top = base_tiles[\"city_top\"]\n city_bottom =... | [
"0.6695276",
"0.6203773",
"0.6144273",
"0.6093429",
"0.60021555",
"0.58367753",
"0.5835113",
"0.5829337",
"0.5829337",
"0.58179224",
"0.5796318",
"0.57576895",
"0.5756332",
"0.57547903",
"0.57539165",
"0.5744328",
"0.5703674",
"0.5703478",
"0.56935674",
"0.5677695",
"0.567653... | 0.6870112 | 0 |
Find meeple positions for a donut shaped city | def test_find_meeples_in_donut_city(self):
# Given
game_state: CarcassonneGameState = self.create_donut_city_board()
game_state.placed_meeples = [[], [], []]
game_state.placed_meeples[0].append(MeeplePosition(meeple_type=MeepleType.NORMAL, coordinate_with_side=CoordinateWithSide(Coordin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_find_donut_city(self):\n\n # Given\n game_state: CarcassonneGameState = self.create_donut_city_board()\n\n # When\n city: City = CityUtil.find_city(\n game_state=game_state,\n city_position=CoordinateWithSide(Coordinate(0, 0), Side.BOTTOM)\n )\n\n ... | [
"0.63763857",
"0.6294268",
"0.5994749",
"0.58479625",
"0.5692342",
"0.56698024",
"0.5659775",
"0.56519175",
"0.56519175",
"0.56280005",
"0.562039",
"0.5616189",
"0.56113046",
"0.5585523",
"0.55844796",
"0.5576134",
"0.5575527",
"0.5563845",
"0.5553286",
"0.5546779",
"0.553914... | 0.6835468 | 0 |
Find cities left and right | def test_find_cities(self):
# Given
game_state: CarcassonneGameState = CarcassonneGameState()
city_one_side_straight_road = base_tiles["city_top_straight_road"].turn(3)
city_with_road = inns_and_cathedrals_tiles["ic_15"].turn(3)
game_state.board = [[None for column in range(2)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_right(nodeL, nodeR, city):\n A = get_node_points(nodeL)\n B = get_node_points(nodeR)\n C = get_city_points(city)\n slope = _slope(A, B)\n (F, G) = calibrator(A, B, slope)\n sign = math.copysign(1, ((G[0] - F[0]) * (C[1] - F[1]) - (G[1] - F[1]) * (C[0] - F[0])))\n\n if slope == \"hori... | [
"0.58423823",
"0.5793729",
"0.5751381",
"0.5717831",
"0.5653619",
"0.55346805",
"0.54687995",
"0.5438168",
"0.5415307",
"0.54040617",
"0.53798175",
"0.5343393",
"0.53421456",
"0.5333387",
"0.5331795",
"0.53222567",
"0.5321915",
"0.5293763",
"0.52919155",
"0.52559435",
"0.5250... | 0.60894334 | 0 |
Create an Edge between two vertices using an anchor. This is useful to have a better representation of the direction of the edge. | def from_anchor(
cls,
anchor: Vertex,
other: Vertex,
label: str = "",
direction: str = "out",
) -> "Edge":
has_direction = direction != "none"
if has_direction is True:
if direction == "out":
start = anchor
end = ot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_edge(self, a, b):\n try: e = self.G.new_edge(a, b)\n except: return self.G.new_edge(a,b)\n\n try: self.G.set_edge_attribute(e, \"arrow\", \"true\")\n except: return self.G.new_edge(a,b)\n\n try: self.G.set_edge_attribute(e, \"spline\", \"false\")\n except: return ... | [
"0.6983778",
"0.66082233",
"0.65253586",
"0.6465049",
"0.6457213",
"0.63240004",
"0.6193088",
"0.614468",
"0.6093483",
"0.60523874",
"0.60418546",
"0.6033494",
"0.6029768",
"0.6016275",
"0.5921528",
"0.57524085",
"0.57500446",
"0.5746553",
"0.57396865",
"0.5726155",
"0.569536... | 0.7591544 | 0 |
Create an Edge between two vertices using a pack (4tuple). | def from_pack(cls, pack: Tuple[int, int, str, bool], db) -> "Edge":
start_place, end_place, label, has_direction = pack
start = db[start_place]
end = db[end_place]
return cls(start, end, label, has_direction) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_edge(vertex_1, vertex_2, edge_type, strand, edges):\n # Check if the edge exists, and return the ID if it does\n query = \",\".join([str(vertex_1), str(vertex_2), edge_type,strand])\n if query in edges.keys():\n existing_edge_id = edges[query][0]\n return existing_edge_id, edges\n... | [
"0.6660539",
"0.65261745",
"0.65147144",
"0.64800143",
"0.64572924",
"0.6405685",
"0.634937",
"0.63491523",
"0.63377154",
"0.63239527",
"0.63221407",
"0.6290063",
"0.6218834",
"0.6176455",
"0.61461127",
"0.6144521",
"0.6127656",
"0.61104333",
"0.6051926",
"0.60435635",
"0.597... | 0.6592813 | 1 |
Change the anchor vertex, thus the perspective of the edge. The ``anchor``, ``other`` and ``direction`` attributes are recalculated. | def change_anchor(self, anchor: Vertex) -> None:
if not self.has_vertex(anchor):
raise ValueError("The given anchor doesn't belong to the edge")
self._anchor = anchor
if self._has_direction is False:
self._other = (
self._end if self._anchor is self._star... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setAnchor(self,a):\n self.anchor = a",
"def set_transformation_anchor(self, mode: ViewportAnchorStr | mod.ViewportAnchor):\n self.setTransformationAnchor(VIEWPORT_ANCHOR.get_enum_value(mode))",
"def setAnchor(self, anchor):\r\n self.pack(anchor=anchor)",
"def setAnchor(self, anchor):... | [
"0.613399",
"0.60137486",
"0.5749917",
"0.5749917",
"0.5749917",
"0.5731453",
"0.55341566",
"0.5467825",
"0.52504694",
"0.5230639",
"0.52012956",
"0.51814395",
"0.5119678",
"0.5112798",
"0.5108198",
"0.51019514",
"0.5035828",
"0.50141704",
"0.49247175",
"0.49093834",
"0.48961... | 0.7595603 | 0 |
Do additional process when the Edge is inserted in a database. This callback method can be overriden when subclassing the Edge class. It is called by the DocNetDB object when inserting this Edge. | def on_insert(self) -> None: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_database_node_create(self, resource_dict):\n pass",
"def on_insert(self, callback):\n self._insert_callback = callback if callable(callback) else _void",
"def on_publish_edge(self):\n logging.debug(\"Edge data published\")",
"def process_IN_CREATE(self, event):",
"def save_edg... | [
"0.5794349",
"0.57343805",
"0.5708902",
"0.5656077",
"0.5542931",
"0.5499471",
"0.54518545",
"0.54497755",
"0.5391843",
"0.53787625",
"0.5335628",
"0.5284934",
"0.5263634",
"0.52613235",
"0.5238483",
"0.5238483",
"0.52286077",
"0.52163917",
"0.5213748",
"0.5213024",
"0.520319... | 0.6171724 | 0 |
Readonly property for the has_direction attribute. | def has_direction(self) -> bool:
return self._has_direction | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_direction(self):\r\n return self.__direction",
"def direction(self):\n return self._direction.copy()",
"def get_direction(self):\n return self.direction",
"def direction(self):\n _direction = self._custom.get(\"direction\")\n if _direction is not None:\n ... | [
"0.68509877",
"0.67023075",
"0.66625434",
"0.65358186",
"0.6429286",
"0.631484",
"0.62817025",
"0.619135",
"0.6172699",
"0.6124396",
"0.6123484",
"0.612275",
"0.60402006",
"0.60147136",
"0.5984809",
"0.5958099",
"0.5958099",
"0.5938603",
"0.5921282",
"0.58906907",
"0.5875808"... | 0.748902 | 0 |
Test that SLURM environment variables are properly checked for rank_zero_only. | def test_rank_zero_known_cluster_envs(env_vars: Mapping[str, str]):
from pytorch_lightning.utilities.distributed import _get_rank, rank_zero_only
rank_zero_only.rank = _get_rank()
with mock.patch.dict(os.environ, env_vars):
from pytorch_lightning.utilities.distributed import _get_rank, rank_zero_o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _assert_local_rank_set(self):\n assert self.local_rank >= 0, 'The environment variable LOCAL_RANK is not set, thus the coordinator is not aware of the local rank of the current process.'",
"def test_rank_zero_none_set(rank_key, rank):\n\n with mock.patch.dict(os.environ, {rank_key: rank}):\n ... | [
"0.6818698",
"0.6449645",
"0.61541635",
"0.57703334",
"0.5661064",
"0.5612566",
"0.5535392",
"0.5509749",
"0.5493569",
"0.54028124",
"0.5381893",
"0.5332986",
"0.5329292",
"0.5304521",
"0.52791685",
"0.52758074",
"0.52317387",
"0.52317387",
"0.52295375",
"0.52202594",
"0.5189... | 0.7357966 | 0 |
Test that function is not called when rank environment variables are not global zero. | def test_rank_zero_none_set(rank_key, rank):
with mock.patch.dict(os.environ, {rank_key: rank}):
from pytorch_lightning.utilities.distributed import _get_rank, rank_zero_only
rank_zero_only.rank = _get_rank()
@rank_zero_only
def foo():
return 1
x = foo()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_rank_zero_known_cluster_envs(env_vars: Mapping[str, str]):\n from pytorch_lightning.utilities.distributed import _get_rank, rank_zero_only\n\n rank_zero_only.rank = _get_rank()\n\n with mock.patch.dict(os.environ, env_vars):\n from pytorch_lightning.utilities.distributed import _get_rank, ... | [
"0.7123143",
"0.63766265",
"0.62233394",
"0.5965803",
"0.5875504",
"0.5828639",
"0.58116204",
"0.56961274",
"0.56833506",
"0.5677485",
"0.56677",
"0.5659446",
"0.56122255",
"0.56006694",
"0.55998755",
"0.559386",
"0.55727184",
"0.55625874",
"0.5549769",
"0.55450904",
"0.55266... | 0.6874552 | 1 |
Read SQuAD data, and filter by passage and question length. | def read_data(squad_train_path, squad_dev_path, max_passage_length,
max_question_length, min_token_count):
squad_reader = SquadReader()
# Read SQuAD train set
train_dataset = squad_reader.read(squad_train_path)
logger.info("Read {} training examples".format(len(train_dataset)))
# Filt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read(self, input_file, remove_evidence=False, remove_question=False, remove_passage=False, remove_dict=None):\n logger.info('Reading data set from {}...'.format(input_file))\n logger.info('Remove evidence during test: {}'.format(remove_evidence))\n with open(input_file, \"r\", encoding='ut... | [
"0.5752212",
"0.5749095",
"0.56410015",
"0.5553645",
"0.55321485",
"0.53939885",
"0.5328976",
"0.5213072",
"0.5181305",
"0.5114432",
"0.5081804",
"0.5073686",
"0.50505215",
"0.50505215",
"0.50505215",
"0.50038326",
"0.4980892",
"0.49647292",
"0.49619284",
"0.49582574",
"0.494... | 0.64043224 | 0 |
trap += min(left_high, right_high) own bar | def trap(self, height: List[int]) -> int:
# Make a left highest list
left_highest = [0]*(len(height)+1)
# left_highest[0] = 0
for i,x in enumerate(height):
left_highest[i+1] = max(x,left_highest[i])
print (left_highest)
# right_highest = [0] * (len(he... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trapArea(base1, base2, height):\n return base1 + base2 * 1/2 * height",
"def trap(height: List[int]) -> int:\n # No heights passed!\n if not height:\n return 0\n # Max from left\n max_L = 0\n L = len(height)\n left = [0] * L\n for i in range(L):\n if height[i] > max_L:\n... | [
"0.6273298",
"0.58288777",
"0.56634337",
"0.5574212",
"0.5464066",
"0.5402058",
"0.5370418",
"0.5370418",
"0.5370418",
"0.5317396",
"0.52973926",
"0.5267531",
"0.5262715",
"0.52284837",
"0.52092624",
"0.51587045",
"0.5144264",
"0.51428884",
"0.5125576",
"0.5123592",
"0.510483... | 0.610084 | 1 |
private function for preparing command string with extras | def __joinCmdStringWithExtras (self,cmdString,extras):
if (extras != ""):
self._log("joining-extras").debug4("joining cmd '%s' with extra params '%s'",cmdString,extras)
cmdString += " " + extras
return cmdString | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_direct_command(self, cmd, arg):\n return \"%s%s\" % (arg, self._newline)",
"def _build_command(self, cmd, unit):\n return '#' + unit + cmd + NEWLINE",
"def StringifyCommand(cmd):\n ret = ''\n grouping = 0\n for a in cmd:\n if grouping == 0 and len(ret) > 0:\n ret += \" \\\\\... | [
"0.69066787",
"0.67727035",
"0.6672051",
"0.6502448",
"0.6478234",
"0.6404473",
"0.63872284",
"0.6364261",
"0.63335603",
"0.6307962",
"0.6271431",
"0.62701386",
"0.6237365",
"0.6220038",
"0.6126546",
"0.609141",
"0.6057912",
"0.6043142",
"0.6036063",
"0.6033363",
"0.59979045"... | 0.7013613 | 0 |
set the reserved block percentage parameter | def _setReservedBlockPercentage (self,blockDevice,percentage,timer):
if not (0 <= percentage <= 100):
self._log("bad-param-for-set-reserved").error("%s is no a valid parameter for setting reserved block percentage!",percentage)
return ReturnCodes.kGeneralError
setReservedBlockPe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setPercent(*args):",
"def setPercent(*args):",
"def SetValue(self, percent):\n pass",
"def set_percent(self, percent):\n self.percent = percent\n self.set_bars()",
"def SetPercentage( self, percent, total ):\n self.percentageView = percent\n self.total = total \n ... | [
"0.7321322",
"0.7321322",
"0.68597203",
"0.6715722",
"0.6561971",
"0.6426917",
"0.6426917",
"0.6426917",
"0.6426917",
"0.63940376",
"0.6321565",
"0.62884337",
"0.6281122",
"0.62152314",
"0.62088424",
"0.6119454",
"0.6082144",
"0.6046596",
"0.6023594",
"0.59494066",
"0.5919022... | 0.82864237 | 0 |
entire mounting sequence with pre and post commands | def _mount (self,blockDevice,mountingPoint,blockDeviceReadahead,timer):
# pre-mount command
preMountCmd = self._activeCommandsConfig.preMount
preMountCmdExtras = self._activeCommandsConfig.preMountExtras
preMountCmdString = self.__joinCmdStringWithExtras(preMountCmd,preMountCmdExtras)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preloop(self):\n super(CoreCommand, self).preloop() # sets up command completion",
"def on_pre_enter(self):\n self.setup()\n self.start()",
"def at_pre_cmd(self):\n pass",
"def main():\n parser = specify_parser()\n args = parser.parse_args()\n\n mapping = init_data(... | [
"0.59750396",
"0.5799191",
"0.5756659",
"0.56043506",
"0.55664533",
"0.5534101",
"0.55339694",
"0.5528653",
"0.5525409",
"0.5490769",
"0.5465857",
"0.546551",
"0.5461396",
"0.54246646",
"0.5414721",
"0.5411846",
"0.53944814",
"0.53874266",
"0.53799397",
"0.536231",
"0.5334266... | 0.6451285 | 0 |
create the file system on the block device. | def _mkfs (self,blockDevice,timer):
# build command string
fsTypeString = None
if (self._activeFileSystemConfig.fileSystemType == blinky_generated_enums.FileSystemTypeType.kExt3):
fsTypeString = "ext3"
if (self._activeFileSystemConfig.fileSystemType == blinky_generated_enums.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self):\n self.create_file()",
"def create(self, filesystem=None):\n raise NotImplementedError()",
"def create(self, directory):\n\n if not self.preallocated:\n if directory:\n self.filename = '%s/%s' % (directory, self.filename)\n logging.inf... | [
"0.6528467",
"0.651849",
"0.6473016",
"0.6375333",
"0.62772226",
"0.61223996",
"0.6070813",
"0.6032275",
"0.59915876",
"0.59814245",
"0.59137577",
"0.5885163",
"0.58850354",
"0.5881064",
"0.58809644",
"0.58729494",
"0.584595",
"0.5844075",
"0.58207464",
"0.5786709",
"0.576043... | 0.7982237 | 0 |
Parses the first line of a log record. | def _ParseRecordStart(self, structure):
self._event_data = APTHistoryLogEventData()
time_elements_structure = self._GetValueFromStructure(
structure, 'date_time')
self._event_data.start_time = self._ParseTimeElements(
time_elements_structure) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, line):\n # Throw an exception if we don't see the parenthesis that mark a history entry\n if not line[108] == '(':\n raise ParsingException\n if not line[138:139] == ')':\n raise ParsingException\n\n self.status = line[109:122].strip()\n s... | [
"0.6299794",
"0.62642795",
"0.623273",
"0.6208043",
"0.61811304",
"0.6137225",
"0.6113412",
"0.60875434",
"0.6070435",
"0.6058054",
"0.60519",
"0.6039214",
"0.59604293",
"0.59400874",
"0.59321016",
"0.5927462",
"0.59130496",
"0.58992994",
"0.5885058",
"0.58600867",
"0.5859611... | 0.70170045 | 0 |
Helper that tests that two sets of cards are identical up to ordering. As an added bonus, this can handle any combination of card lists and card dicts. | def cards_are_same(hand1, hand2):
hand1_dict = {}
hand2_dict = {}
# List -> Dict conversion
if isinstance(hand1, dict):
hand1_dict = hand1
else:
for card in hand1:
hand1_dict[card] = hand1_dict.get(card, 0) + 1
if isinstance(hand2, dict):
hand2_dict = hand2
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_element(self, card1, card2, card3, element):\n e1 = card1[element]\n e2 = card2[element]\n e3 = card3[element]\n if (e1 == e2 and e2 == e3) or (e1 != e2 and e1 != e3 and e2 != e3):\n # All the same or all different.\n return 1\n return 0",
"def... | [
"0.65992314",
"0.657484",
"0.64334226",
"0.64320785",
"0.6430725",
"0.6417162",
"0.6396451",
"0.63866633",
"0.6370803",
"0.6362378",
"0.6356536",
"0.632622",
"0.6239135",
"0.6231354",
"0.6228795",
"0.6206319",
"0.6168011",
"0.61559004",
"0.6144484",
"0.6099852",
"0.6090382",
... | 0.71126974 | 0 |
Helper that tests if a deck is the same as a set of cards. Assumes that cards is a dict. | def deck_has_cards(deck, cards):
deck_dict = collections.defaultdict(int)
for card in itertools.chain(deck.draw_pile, deck.discard_pile, deck.hand):
deck_dict[card] += 1
return deck_dict == cards | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_deck_screen_my_deck_check_duplicate(card, local_store_list):\n for cd in local_store_list:\n if card.set_number == cd.set_number and card.card_number == cd.card_number:\n return True\n break\n return False",
"def validate_cards(self, cards_list):\n return set(s... | [
"0.7119846",
"0.7076654",
"0.69705415",
"0.68710893",
"0.68217534",
"0.66353387",
"0.6516489",
"0.6278403",
"0.617272",
"0.6160348",
"0.615524",
"0.60827607",
"0.60686934",
"0.60345966",
"0.60345966",
"0.59672284",
"0.59543985",
"0.5945144",
"0.58992213",
"0.5891211",
"0.5850... | 0.75060856 | 0 |
Returns an authorized API client by discovering the IoT API and creating a service object using the service account credentials JSON. | def get_client(service_account_json):
api_scopes = ['https://www.googleapis.com/auth/cloud-platform']
api_version = 'v1'
discovery_api = 'https://cloudiot.googleapis.com/$discovery/rest'
service_name = 'cloudiotcore'
credentials = service_account.Credentials.from_service_account_file(
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_service(api_name, api_version, scope, client_secrets_path):\n # Parse command-line arguments.\n parser = argparse.ArgumentParser(\n formatter_class=argparse.RawDescriptionHelpFormatter,\n parents=[tools.argparser])\n flags = parser.parse_args([])\n\n # Set up a Flow object to be used if we ne... | [
"0.70476496",
"0.6967219",
"0.68839943",
"0.6839995",
"0.6822203",
"0.6819169",
"0.6687449",
"0.6609617",
"0.6607141",
"0.65145785",
"0.6481238",
"0.6416878",
"0.6413384",
"0.6408897",
"0.64063555",
"0.6363026",
"0.63294923",
"0.63294923",
"0.63169473",
"0.6308933",
"0.629779... | 0.7558698 | 0 |
Generic media edit view. Handles some existence and permission checks that apply to all media types, then delegates to a more type specific implementation. | def media_edit(request, mediatype, username, slug):
# verify the object exists and fetch it, if so
user = get_object_or_404(authmodels.User, username=username)
mediatype = mediatype_deplural.get(mediatype)
klass = models.mediatype_map.get(mediatype, {}).get('klass')
if not klass:
return Http... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateMedia(request, form, update, m, mt, expires, members, vendors, employees, contractors, filesize):\n\tis360 = False\n\tif 'is_360' in request.POST:\n\t\tis360 = request.POST['is_360']\n\tif update:\n\t\tif m.user == request.user.username or request.user.is_superuser: #need to make sure id is not spoofed\... | [
"0.62852633",
"0.54435855",
"0.5440475",
"0.5382883",
"0.5344347",
"0.5296331",
"0.5240183",
"0.52306396",
"0.5207163",
"0.5171759",
"0.5161495",
"0.5148306",
"0.5147011",
"0.5133456",
"0.51291484",
"0.5108886",
"0.5098199",
"0.506505",
"0.5042118",
"0.5030467",
"0.5025438",
... | 0.7646887 | 0 |
If POST, either add to or remove from press gallery. If GET, redirect to the browse page w/ a properly formed press gallery query. | def press_gallery(request):
press_gallery_path = settings.PRESS_GALLERY_PATH
if request.method == 'POST':
if not request.user.has_perm('gallery.can_review'):
raise PermissionDenied
photo = models.Photo.objects.get(id=request.POST.get('id'))
if photo is None:
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def browse(request):\n klass = media_klass_from_request(request)\n filter_args, filter_kwargs = filter_args_from_request(request)\n press_gallery = request.GET.get('press_gallery', '')\n press_gallery = press_gallery.lower() == 'true'\n if press_gallery:\n if not request.user.has_perm('galler... | [
"0.6142033",
"0.59063977",
"0.5835408",
"0.568863",
"0.5672334",
"0.56279814",
"0.55793434",
"0.55041337",
"0.5490576",
"0.5481275",
"0.5449348",
"0.54288334",
"0.53872204",
"0.53834766",
"0.5364756",
"0.52974206",
"0.5286496",
"0.5253664",
"0.52518123",
"0.5241001",
"0.52392... | 0.72716916 | 0 |
View that accepts ajax upload requests, returning a JSON response | def upload_ajax(request):
log.debug('upload ajax view')
if not request.user.has_perm('gallery.can_upload'):
return None
#videoPerm = request.user.has_perm('gallery.can_review')
if request.method != "POST":
return JSONResponse(False, {}, response_mimetype(request))
log.debug("Batc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_check_upload_files(request):\n\n files = []\n for filename, file in request.FILES.items():\n files.append(file)\n\n json_message = check_uploaded_files(files)\n return JsonResponse(json_message)",
"def handle_upload_files(request):\n\n files = []\n for filename, file in reques... | [
"0.68334264",
"0.66960365",
"0.65871376",
"0.6556745",
"0.6499524",
"0.6499524",
"0.6397053",
"0.63761085",
"0.6338587",
"0.63231015",
"0.6295487",
"0.6197913",
"0.6195067",
"0.6190436",
"0.6165591",
"0.615164",
"0.6142574",
"0.60224116",
"0.5988723",
"0.5988673",
"0.59264004... | 0.7459421 | 0 |
Generate random expression and return correct answer and question. | def calc():
randnum1 = randint(1, 100)
randnum2 = randint(1, 100)
operator = choice('+-*')
question = '{0} {1} {2}'.format(randnum1, operator, randnum2)
if operator == '+':
answer = randnum1 + randnum2
elif operator == '-':
answer = randnum1 - randnum2
elif operator == '*':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_question_and_answer(): # noqa: WPS210\n start_number = random.randint(1, 100)\n progression_step = random.randint(1, 10)\n progression_length = random.randint(5, 10)\n progression = generate_progression(\n start_number, progression_step, progression_length,\n )\n return hide_... | [
"0.69674486",
"0.6796805",
"0.6784748",
"0.6760564",
"0.6284866",
"0.62717825",
"0.6146464",
"0.6050245",
"0.6044953",
"0.6043534",
"0.599811",
"0.59578353",
"0.5931196",
"0.5915013",
"0.58821046",
"0.5855784",
"0.5849916",
"0.58499056",
"0.58317935",
"0.5807753",
"0.5769087"... | 0.70223653 | 0 |
Returns the full path to the test data directory | def test_data_dir(self):
return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_test_data_path():\n return os.path.abspath(os.path.join(os.path.dirname(__file__), \"data\") + os.path.sep)",
"def data_dir():\n return os.path.join(os.path.dirname(_here), 'test', 'data')",
"def data_dir():\n return os.path.join(os.path.dirname(__file__), 'test', 'data')",
"def test_data_di... | [
"0.91113776",
"0.90987366",
"0.887621",
"0.86290467",
"0.8481252",
"0.8396891",
"0.831865",
"0.826754",
"0.8233042",
"0.8229824",
"0.8090345",
"0.80200744",
"0.80070865",
"0.7992242",
"0.7949754",
"0.7906792",
"0.7864156",
"0.7812648",
"0.7732339",
"0.77273315",
"0.7723905",
... | 0.92368877 | 0 |
Returns the full paath to the test task directory | def test_task_dir(self):
return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tasks') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dir():\n return os.path.abspath(os.path.dirname(__file__))",
"def get_test_path():\n path, name = os.path.split(__file__)\n return os.path.join(path,\"..\", 'test-data')",
"def test():\n return os.path.dirname(__file__)",
"def testnodes_path() -> str:\n return os.path.abspath(\n ... | [
"0.7674695",
"0.7589369",
"0.71511745",
"0.7132654",
"0.7118378",
"0.70436317",
"0.7012108",
"0.69527984",
"0.6950599",
"0.6936121",
"0.689541",
"0.6856171",
"0.6844601",
"0.68313617",
"0.67896086",
"0.67874813",
"0.6763031",
"0.67000246",
"0.66965204",
"0.66603136",
"0.66419... | 0.85292554 | 0 |
Abstract method for generating python toolboxes from test tasks. | def setup_toolbox(self, engine_name, task_name, toolbox_name):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_tasks(self, task):",
"def main():\n\n parser = argparse.ArgumentParser(description=\"generateTestStubs\")\n\n parser.add_argument(\"taskFile\",\n help=\"Path for assignment file.\")\n\n args = parser.parse_args()\n\n if not os.path.exists(args.taskFile):\n p... | [
"0.66955596",
"0.6265931",
"0.62322456",
"0.618248",
"0.6164758",
"0.61037296",
"0.6079226",
"0.6002927",
"0.59454316",
"0.5785487",
"0.5765015",
"0.57604563",
"0.5711359",
"0.5682157",
"0.56809783",
"0.56793827",
"0.56743544",
"0.5657822",
"0.5649914",
"0.5636607",
"0.561536... | 0.73740774 | 0 |
Removes the toolbox file from disk | def remove_toolbox(self, toolbox_file):
toolbox_file = os.path.splitext(toolbox_file)[0]
for tb_file in glob.glob(toolbox_file + '.*'):
os.remove(tb_file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _remove(self):\n self._system.remove(self.get_install_path())\n self._system.remove(self._source_path)",
"def cleanUp(self, f):\n os.system('rm ' + f)",
"def cleanUp(self):\n import evoware.fileutil as F\n F.tryRemove(self.f_project, verbose=(self.VERBOSITY>1), tree=1)",... | [
"0.7031161",
"0.7022566",
"0.6924097",
"0.689578",
"0.68619317",
"0.6856123",
"0.68492395",
"0.6763925",
"0.6706439",
"0.6685907",
"0.66433996",
"0.6638025",
"0.65897125",
"0.65406245",
"0.65248865",
"0.6520881",
"0.64963454",
"0.64885324",
"0.6474568",
"0.6458304",
"0.645603... | 0.7411929 | 0 |
Compares two text files. Removes whitespace, empty lines, and newline chars Empty string as a return value mean file are the same Open, read lines to string list, remove any newline chars, and filter out empty strings/lines. | def compare_text_files(self, file1, file2):
text1 = list(filter(None, map(str.rstrip, open(file1, 'U').readlines())))
text2 = list(filter(None, map(str.rstrip, open(file2, 'U').readlines())))
return ''.join(difflib.unified_diff(text1, text2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_contents(first, second):\n def strip_lines(lines):\n return [line.strip() + '\\n' for line in lines]\n\n try:\n with open(first, mode='r', encoding='utf_8') as file:\n content1 = strip_lines(file.readlines())\n except IOError:\n return 'failed to load first file... | [
"0.7229945",
"0.7133003",
"0.65655166",
"0.653714",
"0.651467",
"0.64735854",
"0.64228237",
"0.6375053",
"0.6353911",
"0.6302926",
"0.62963974",
"0.6286208",
"0.62219095",
"0.62118894",
"0.62079155",
"0.61327523",
"0.6097942",
"0.60494936",
"0.6049022",
"0.599863",
"0.5989535... | 0.7781031 | 0 |
Override the default arcpy workspace and scratch workspace | def setup_workspace(self, workspace_dir):
if not os.path.isdir(workspace_dir):
os.mkdir(workspace_dir)
arcpy.env.workspace = workspace_dir
scratch_workspace = os.path.join(workspace_dir, 'scratch')
if not os.path.isdir(scratch_workspace):
os.mkdir(scratch_workspa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addWorkspace(self, dryrun):\n pass",
"def PrepareWorkspace():\n \n # define expected file paths for file gdb folder, fgdb, taxi feature class \n fgdb_folder = constants.fgdb_folder\n fgdb_name = constants.taxi_fgdb_name\n file_gdb = os.path.join(fgdb_folder, fgdb_name)\n taxi_feat... | [
"0.60415196",
"0.5961241",
"0.55555195",
"0.55302453",
"0.55170834",
"0.5511445",
"0.5508495",
"0.5484124",
"0.5473416",
"0.53657085",
"0.53048396",
"0.527415",
"0.52119976",
"0.51903075",
"0.51817805",
"0.51736385",
"0.5149729",
"0.51310563",
"0.5106731",
"0.50921094",
"0.50... | 0.6590121 | 0 |
Determine whether Z3's fpRem is correct, and set fpMod accordingly. | def detect_fpMod():
import logging
log = logging.getLogger(__name__)
log.debug('Setting fpMod')
if z3.is_true(z3.simplify(z3.FPVal(3, z3.Float32()) % 2 < 0)):
log.debug('Correct fpRem detected')
fpMod.__code__ = fpMod_using_fpRem.__code__
else:
log.debug('fpRem = fpMod')
fpMod.__code__ = fpRe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_fdr_correction(self):\r\n pvals = array([.1, .7, .5, .3, .9])\r\n exp = array([.5, .7 * 5 / 4., .5 * 5 / 3., .3 * 5 / 2., .9])\r\n obs = fdr_correction(pvals)\r\n self.assertFloatEqual(obs, exp)",
"def fmod(x, y):\n return 0.0",
"def test_mod_float():\n with pytes... | [
"0.55525136",
"0.55021083",
"0.548925",
"0.5151387",
"0.5075938",
"0.50551873",
"0.49866614",
"0.49831784",
"0.49707228",
"0.49685395",
"0.49653804",
"0.49096474",
"0.4895829",
"0.48700342",
"0.48425165",
"0.4841886",
"0.48279795",
"0.48066127",
"0.47917056",
"0.47375423",
"0... | 0.794923 | 0 |
see and clear user_data | def user_data(update, context):
text = html.escape(str(context.user_data))
if context.args and context.args[0] == 'clear' and len(context.args) > 1:
context.user_data.pop(' '.join(context.args[1:]), None)
send(text, update, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_delete_user_data(self):\n util.log(\"Clearing all user data\", util.LogLevel.Info)\n self.db.db_clear_data_user()\n util.log(\"Done\", util.LogLevel.Info)",
"def clean_up_data(self):\n pass",
"def clear_data(self):\n if isinstance(self.data, DataManager):\n ... | [
"0.7238882",
"0.7038704",
"0.70255494",
"0.6968918",
"0.6856509",
"0.67883766",
"0.6694745",
"0.66806406",
"0.66479325",
"0.66210365",
"0.66091675",
"0.657036",
"0.657036",
"0.6560426",
"0.6494945",
"0.6494945",
"0.6494945",
"0.64465475",
"0.64314586",
"0.64099723",
"0.640566... | 0.71037084 | 1 |
Negotiate a server shutdown. | def negotiate_server_shutdown(self, client):
if client.server_shutdown:
client.send_data('Y')
client.sock.close()
if client.shutdown_kill:
sys.exit()
client.reboot_self()
else:
client.send_data('N')
return client | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shutdown():\n\n cmd = dict()\n cmd[\"type_\"] = \"shutdown\"\n cmd[\"name_\"] = \"all\"\n\n ## In case of the shutdown there will be no returned message to\n ## check the success.\n s = comm.send_and_receive_socket(cmd)\n\n s.close()",
"def shutdown():\n shutdown_server()\n return ... | [
"0.7204201",
"0.7163601",
"0.69143903",
"0.6900163",
"0.68729514",
"0.68322897",
"0.6815528",
"0.68109536",
"0.66986215",
"0.669364",
"0.6683313",
"0.66780865",
"0.6673532",
"0.6670553",
"0.6648767",
"0.6644792",
"0.6615747",
"0.6614075",
"0.66128385",
"0.6555828",
"0.6527253... | 0.7417078 | 0 |
Send something back to the control server with the current working directory appended to the end of it. | def send_data_with_cwd(self, client, some_data):
client.sock.send(str.encode(some_data + str(getcwd()) + '> ' + '~!_TERM_$~'))
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cwd_cmd(self, new_dir):\n print_debug(\"Executing CWD\")\n command = \"CWD %s\\r\\n\" % new_dir\n msg_rec = self.send_and_log(self.s, command)\n return msg_rec",
"def submit(self):\n self.directory = fd.askdirectory()\n \n self.dirText.insert(1.0, \"{}\".forma... | [
"0.59056413",
"0.5640681",
"0.5631773",
"0.5594963",
"0.5576927",
"0.5571801",
"0.55344164",
"0.55312216",
"0.5504062",
"0.5450833",
"0.5402424",
"0.5397717",
"0.5367096",
"0.5354462",
"0.5342658",
"0.53353286",
"0.53015214",
"0.52969617",
"0.5285048",
"0.52726805",
"0.525603... | 0.69748133 | 0 |
Creates font from tileset using given letter mapping. Letter mapping is a string of letters that should match unwrapped grid (row by row) starting from the topleft corner. Letter mapping could be shorter than overall size of the font tileset grid unused tiles will be ignored. | def __init__(self, tileset, letter_mapping):
self._tileset = tileset
tile_grid = itertools.chain.from_iterable((Point(x, y) for x in range(tileset.size.width)) for y in range(tileset.size.height))
self._letter_mapping = dict(zip(letter_mapping, tile_grid)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, tileset, letter_mapping, space_width=None, transparent_color=0):\n\t\tsuper().__init__(tileset, letter_mapping)\n\t\tself._bound_rects = {}\n\t\twith pygame.PixelArray(self._tileset.get_texture()) as pixels:\n\t\t\tfor letter in self._letter_mapping.keys():\n\t\t\t\tletter_image = self._tileset.... | [
"0.6685653",
"0.59776837",
"0.59776837",
"0.59776837",
"0.58866596",
"0.5877266",
"0.58717793",
"0.5843012",
"0.5781023",
"0.5589857",
"0.55857843",
"0.5526979",
"0.5516415",
"0.54384875",
"0.54295045",
"0.5378243",
"0.53621095",
"0.53253853",
"0.5320736",
"0.5243554",
"0.524... | 0.7094142 | 0 |
Returns subimage for given letter. | def get_letter_image(self, letter):
assert len(letter) == 1
return self._tileset.get_tile(self._letter_mapping[letter]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_letter_image(self, letter):\n\t\tassert len(letter) == 1\n\t\treturn ImageRegion(self._tileset, self._bound_rects[letter])",
"def get_letter_image(self, letter): # pragma: no cover\n\t\traise NotImplementedError()",
"def select_object_from_letter(self, letter):\n\t\tindex = ALPHABET.index(letter)\n\t\t... | [
"0.78910303",
"0.73898816",
"0.66551983",
"0.63486063",
"0.61542475",
"0.6099315",
"0.59665734",
"0.58227265",
"0.5736932",
"0.56307167",
"0.5630472",
"0.5580798",
"0.5493414",
"0.54799604",
"0.5448674",
"0.5376145",
"0.53500587",
"0.53446937",
"0.53319925",
"0.53206825",
"0.... | 0.76579726 | 1 |
Creates font from tileset using given letter mapping (see TilesetFont for details). Space width is a min width for a completely empty tile (which normally represents space character, ' '). If not specified, full tile width is used. Uses given transparent color value to consider pixels "empty". By default is 0 (fully tr... | def __init__(self, tileset, letter_mapping, space_width=None, transparent_color=0):
super().__init__(tileset, letter_mapping)
self._bound_rects = {}
with pygame.PixelArray(self._tileset.get_texture()) as pixels:
for letter in self._letter_mapping.keys():
letter_image = self._tileset.get_tile(self._letter_m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, tileset, letter_mapping):\n\t\tself._tileset = tileset\n\t\ttile_grid = itertools.chain.from_iterable((Point(x, y) for x in range(tileset.size.width)) for y in range(tileset.size.height))\n\t\tself._letter_mapping = dict(zip(letter_mapping, tile_grid))",
"def createTiles():\n Renderer.Clear... | [
"0.58362615",
"0.5499941",
"0.53657395",
"0.5182974",
"0.5153799",
"0.51268566",
"0.51066536",
"0.50781935",
"0.507169",
"0.501892",
"0.50151426",
"0.49879408",
"0.4963365",
"0.49593616",
"0.49591786",
"0.49389654",
"0.4933736",
"0.4921736",
"0.49056354",
"0.48952273",
"0.489... | 0.66264325 | 0 |
Returns subimage for given letter. | def get_letter_image(self, letter):
assert len(letter) == 1
return ImageRegion(self._tileset, self._bound_rects[letter]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_letter_image(self, letter):\n\t\tassert len(letter) == 1\n\t\treturn self._tileset.get_tile(self._letter_mapping[letter])",
"def get_letter_image(self, letter): # pragma: no cover\n\t\traise NotImplementedError()",
"def select_object_from_letter(self, letter):\n\t\tindex = ALPHABET.index(letter)\n\t\tr... | [
"0.76579726",
"0.73898816",
"0.66551983",
"0.63486063",
"0.61542475",
"0.6099315",
"0.59665734",
"0.58227265",
"0.5736932",
"0.56307167",
"0.5630472",
"0.5580798",
"0.5493414",
"0.54799604",
"0.5448674",
"0.5376145",
"0.53500587",
"0.53446937",
"0.53319925",
"0.53206825",
"0.... | 0.78910303 | 0 |
removes list of outliers keys from dict object | def remove_outlier(keys):
for key in keys:
data_dict.pop(key, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_outlier(dict_object, keys):\n for key in keys:\n dict_object.pop(key, 0)",
"def remove_outlier(dict_object, keys):\r\n for key in keys:\r\n dict_object.pop(key, 0)",
"def prune(candidate_aspect_list, min_sup):\n l_k = deepcopy(candidate_aspect_list)\n for key, value in list... | [
"0.7666286",
"0.764993",
"0.6490826",
"0.62917334",
"0.61497504",
"0.60963714",
"0.60686636",
"0.60594124",
"0.60409945",
"0.6001855",
"0.59809375",
"0.59354466",
"0.5890583",
"0.5846965",
"0.5815032",
"0.58145547",
"0.58056134",
"0.58049035",
"0.57859176",
"0.5770592",
"0.57... | 0.794232 | 0 |
Calculate a bitmap for use as a wx frame background with rounded corners. | def _get_round_edges_bitmap(width: int, height: int, radius: int):
mask_color = opts['gui']['attrs']['mask_color']
background_color = opts['gui']['attrs']['background_color']
bitmap = wx.Bitmap(width, height)
dc = wx.MemoryDC(bitmap)
dc.SetBrush(wx.Brush(mask_color))
dc.DrawRectangle(0, 0, width... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetRoundBitmap(w, h, r):\n maskColor = wx.Colour(0, 0, 0)\n shownColor = wx.Colour(5, 5, 5)\n b = wx.Bitmap(w, h)\n dc = wx.MemoryDC(b)\n dc.SetBrush(wx.Brush(maskColor))\n dc.DrawRectangle(0, 0, w, h)\n dc.SetBrush(wx.Brush(shownColor))\n dc.SetPen(wx.Pen(shownColor))\n dc.DrawRound... | [
"0.6974992",
"0.63787454",
"0.62973994",
"0.6074198",
"0.6049358",
"0.6016021",
"0.5992435",
"0.5903606",
"0.58498806",
"0.5837642",
"0.57610255",
"0.5738808",
"0.573359",
"0.5661286",
"0.56497365",
"0.56497365",
"0.5610528",
"0.5558927",
"0.55396557",
"0.55325127",
"0.552236... | 0.7052649 | 0 |
Updates the list of displayed attribute text inputs. | def _update_attr_list(self) -> None:
old_flex_grid = self.flex_grid
self.flex_grid = wx.FlexGridSizer(cols=3, vgap=5, hgap=10)
wx_elements = []
for attr_id in self.attr_ids:
button = self.attr_buttons[attr_id]
label_input = self.attr_labels[attr_id]
va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_attr_list(self) -> None:\n old_flex_grid = self.flex_grid\n self.flex_grid = wx.FlexGridSizer(cols=3, vgap=5, hgap=10)\n wx_elements = []\n for attr_id in self.attr_req_ids:\n button = self.attr_req_buttons[attr_id]\n attr_req_label_ctrl = self.attr_req... | [
"0.6138667",
"0.58394015",
"0.57136977",
"0.5605623",
"0.5420066",
"0.5399311",
"0.53753835",
"0.5258919",
"0.5243419",
"0.5237437",
"0.5222367",
"0.521364",
"0.5211479",
"0.52040356",
"0.5188745",
"0.51685643",
"0.5158266",
"0.5157293",
"0.5097068",
"0.50787485",
"0.50495744... | 0.6706066 | 0 |
Load the attributes from the connected element. | def _load_attrs(self) -> None:
self.attr_ids.clear()
for attr_label, attr_value in self.element.attr.items():
self.add_attr(None, attr_label, attr_value)
self._update_attr_list() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_attrs(self):\n return loads(self.get_attr().GetObject()) or {}",
"def load(self):\r\n self.domain.get_attributes(self.name, item=self)",
"def get_attributes(self):\n\t\treturn dict(list(self.__element.items()))",
"def prepare_node_attrs(self):",
"def read_attributes(self, dataset):\n... | [
"0.6402216",
"0.63636845",
"0.5951157",
"0.57516307",
"0.56711984",
"0.56089693",
"0.5590862",
"0.5546388",
"0.5435026",
"0.541997",
"0.5352226",
"0.52861327",
"0.52834237",
"0.52810484",
"0.5278922",
"0.5264512",
"0.52519834",
"0.5222196",
"0.52052623",
"0.51943564",
"0.5177... | 0.6939825 | 0 |
Save the changes to the attributes to the connected element. | def _save_attrs(self) -> None:
for attr_id in self.attr_ids:
orig_label = self.attr_ids[attr_id]
attr_label = self.attr_labels[attr_id].GetValue()
attr_value = self.attr_values[attr_id].GetValue()
if attr_label == '':
continue
if orig_l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _save(self):\n for attrib in self.attribs:\n setattr(self, attrib, getattr(self.obj, attrib))",
"def store_attrs(self, attrs):\n self.get_attr().SetObject(dumps(attrs), False)",
"def _save_attrs(self) -> None:\n for attr_req_id in self.attr_req_ids:\n orig_label =... | [
"0.678142",
"0.6351419",
"0.6286748",
"0.6224528",
"0.6134093",
"0.610638",
"0.59863436",
"0.58716166",
"0.5859173",
"0.58556986",
"0.5841143",
"0.5747278",
"0.5647891",
"0.5641672",
"0.5629725",
"0.5609513",
"0.56082225",
"0.5603071",
"0.5603071",
"0.5603071",
"0.5603071",
... | 0.7135137 | 0 |
Remove the specified attribute from the element and the gui. | def remove_attr(self, event: Union[wx.CommandEvent, None],
attr_id: Union[int, None]) -> None:
self.attr_buttons.pop(attr_id).Destroy()
self.attr_values.pop(attr_id).Destroy()
self.attr_labels.pop(attr_id).Destroy()
attr_label = self.attr_ids.pop(attr_id)
if a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_attribute(self, attribute) -> None:\n logging.info(f\"remove element attribute. {self.desc}\")\n js = f\"\"\"var elm = document.querySelectorAll(\"{self.css}\")[{self.index}];\n elm.removeAttribute(\"{attribute}\");\"\"\"\n self._execute_javascript(js)",
"def re... | [
"0.81728333",
"0.7617282",
"0.75242573",
"0.75183755",
"0.7310464",
"0.7302848",
"0.7302848",
"0.7302848",
"0.7192179",
"0.71326095",
"0.7076926",
"0.7030358",
"0.6921169",
"0.6725303",
"0.66307867",
"0.66302186",
"0.6618078",
"0.66085863",
"0.6600818",
"0.645934",
"0.6452364... | 0.78135085 | 1 |
Override to save changes to arguments before closing the frame. | def Close(self, *args, **kwargs):
self._save_attrs()
super().Close(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore(self, arguments):\n puts_err(colored.red(\"Not implemented!\"))",
"def close_extras(self, **kwargs):\n pass",
"def close(*args):",
"def close(*args):",
"def close(*args):",
"def close(*args):",
"def close(*args):",
"def _exit(self, save_vars):\n raise NotImplementedEr... | [
"0.6397291",
"0.6238765",
"0.62264043",
"0.62264043",
"0.62264043",
"0.62264043",
"0.62264043",
"0.6015775",
"0.6008856",
"0.60076225",
"0.5912482",
"0.5897535",
"0.5865324",
"0.5848845",
"0.58236265",
"0.57882524",
"0.577333",
"0.57647246",
"0.5741745",
"0.57246125",
"0.5651... | 0.6632843 | 0 |
Sets this frames shape to a rounded rectangle. | def _set_frame_shape(self) -> None:
width, height = self.GetSize()
self.SetShape(wx.Region(_get_round_edges_bitmap(width, height, 10))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetRoundShape(self):\n w, h = self.GetSize()\n self.SetShape(GetRoundShape(w, h, 10))",
"def draw_rounded_rect(self, context, x, y, width, height, radius, lineWidth):\n from math import pi\n degrees = pi / 180\n\n context.set_line_width(lineWidth)\n context.set_sourc... | [
"0.79114413",
"0.6763416",
"0.6615487",
"0.6506466",
"0.6503821",
"0.6501542",
"0.6364012",
"0.6357104",
"0.6332116",
"0.6317095",
"0.62739325",
"0.62622",
"0.6216487",
"0.61987716",
"0.61970615",
"0.61883825",
"0.60820854",
"0.6080519",
"0.6069578",
"0.6019931",
"0.6009432",... | 0.71043444 | 1 |
Updates the list of displayed attribute text inputs. | def _update_attr_list(self) -> None:
old_flex_grid = self.flex_grid
self.flex_grid = wx.FlexGridSizer(cols=3, vgap=5, hgap=10)
wx_elements = []
for attr_id in self.attr_req_ids:
button = self.attr_req_buttons[attr_id]
attr_req_label_ctrl = self.attr_req_labels[att... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_attr_list(self) -> None:\n old_flex_grid = self.flex_grid\n self.flex_grid = wx.FlexGridSizer(cols=3, vgap=5, hgap=10)\n wx_elements = []\n for attr_id in self.attr_ids:\n button = self.attr_buttons[attr_id]\n label_input = self.attr_labels[attr_id]\n ... | [
"0.6706066",
"0.58394015",
"0.57136977",
"0.5605623",
"0.5420066",
"0.5399311",
"0.53753835",
"0.5258919",
"0.5243419",
"0.5237437",
"0.5222367",
"0.521364",
"0.5211479",
"0.52040356",
"0.5188745",
"0.51685643",
"0.5158266",
"0.5157293",
"0.5097068",
"0.50787485",
"0.50495744... | 0.6138667 | 1 |
Override to save changes to arguments before closing the frame. | def Close(self, *args, **kwargs):
self._save_attrs()
super().Close(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore(self, arguments):\n puts_err(colored.red(\"Not implemented!\"))",
"def close_extras(self, **kwargs):\n pass",
"def close(*args):",
"def close(*args):",
"def close(*args):",
"def close(*args):",
"def close(*args):",
"def _exit(self, save_vars):\n raise NotImplementedEr... | [
"0.6397291",
"0.6238765",
"0.62264043",
"0.62264043",
"0.62264043",
"0.62264043",
"0.62264043",
"0.6015775",
"0.6008856",
"0.60076225",
"0.5912482",
"0.5897535",
"0.5865324",
"0.5848845",
"0.58236265",
"0.57882524",
"0.577333",
"0.57647246",
"0.5741745",
"0.57246125",
"0.5651... | 0.6632843 | 1 |
Setup all the visual setting of the matplotlib canvas, figure and subplot. This function needs to be called every time the mpl figure is redrawn because clearing the figure allso resets all these visual settings. | def setup_mpl_visuals(self, axes=None) -> None:
if axes is None:
axes = self.subplot
axes.patch.set_facecolor('white')
axes.set_aspect('equal', 'box')
axes.set_xlim(-10, 10, auto=True)
axes.set_ylim(-10, 10, auto=True)
# TODO: Make XYLim confort to window size... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _InitAxes( self ):\n self.ax = self.fig.add_subplot( 111 )",
"def _setup_figure(self):\n\n plt.figure(1)\n plt.clf()\n\n # Two main axes\n self._tsne_window = plt.axes([0.05, 0.05, 0.4, 0.4])\n self._main_window = plt.axes([0.05, 0.55, 0.4, 0.4])\n\n # Nine sub ax... | [
"0.70345396",
"0.7023591",
"0.6718693",
"0.6701137",
"0.65575993",
"0.6535653",
"0.65306026",
"0.6503289",
"0.63787425",
"0.6369504",
"0.6320576",
"0.63002175",
"0.6274523",
"0.6248552",
"0.6243613",
"0.62430453",
"0.62426406",
"0.620692",
"0.620692",
"0.6132402",
"0.61245346... | 0.71893555 | 0 |
Add newly available free spaces adjacent to pos to the list if they are not already present. | def add_new_free_spaces(pos: Tuple[int, int],
free_spaces: MutableSequence[
Tuple[int, int]]) -> None:
offset = 2
possible_positions = [
(pos[0] + offset, pos[1] + offset),
(pos[0] + offset, pos[1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autoreveal_empty_spaces(self, position):\n revealed = []\n zero_spaces = []\n check_stack = [position]\n checked = []\n\n while len(check_stack) > 0:\n pos = x, y = check_stack.pop()\n if self.get_num_mines_around_position(x, y) == 0:\n ze... | [
"0.60795987",
"0.5536707",
"0.5347553",
"0.5315331",
"0.52387303",
"0.5216414",
"0.5211053",
"0.51984644",
"0.51950127",
"0.51828325",
"0.5182313",
"0.51762885",
"0.51726806",
"0.51522017",
"0.51186055",
"0.50984484",
"0.5096328",
"0.5086424",
"0.50736445",
"0.50462025",
"0.5... | 0.82575357 | 0 |
Annotate a FigureElement. This is a convenience function so you don't need to pass all three arguments separately, they are all taken from the passed element. | def annotate_element(self, element: 'FigureElement') -> plt.Annotation:
if element.annotation is not None:
element.annotation.set_text(element.get_hover_text())
return element.annotation
else:
return self.annotate(element.get_hover_text(),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def annotate(*args, point: List[float, float, float]=None, text: AnyStr=\"\", **kwargs)->AnyStr:\n pass",
"def annotate(axis, text, x, y):\n text_annotation = Annotation(text, xy=(x, y), xycoords='data')\n axis.add_artist(text_annotation)",
"def annotate(args):\n prism.annotate.run(\n input_... | [
"0.66608083",
"0.63205814",
"0.60229737",
"0.58094853",
"0.5672598",
"0.561528",
"0.5587976",
"0.54985315",
"0.5394095",
"0.5393415",
"0.538822",
"0.5365531",
"0.5352155",
"0.53486985",
"0.53486985",
"0.5328886",
"0.5327457",
"0.52940744",
"0.5276026",
"0.5244312",
"0.5231723... | 0.7454883 | 0 |
Clears the current drawing and dicts/lists referencing the drawn elements. | def _clear_drawing(self) -> None:
self.vertices.clear()
self.edges.clear()
self.subplot.clear()
self.selected_element = None
self.pressed_elements.clear() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _clear_drawing(self) -> None:\n self.vertices.clear()\n self.edges.clear()\n self.subplot.clear()\n self.subplot2.clear()",
"def _clear(self):\n self._fillitem = self._fillpath = None\n for item in self.items:\n self.screen._delete(item)\n self.curr... | [
"0.82706034",
"0.79316634",
"0.7764828",
"0.76532316",
"0.7638401",
"0.75774086",
"0.7515265",
"0.7456398",
"0.74527353",
"0.742205",
"0.7401441",
"0.7380618",
"0.7338083",
"0.7337927",
"0.73297036",
"0.729089",
"0.72666776",
"0.72562766",
"0.7228562",
"0.72144085",
"0.721064... | 0.8798906 | 0 |
Redraw the currently loaded graph. | def _redraw_graph(self) -> None:
self._clear_drawing()
self.draw_graph() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _redraw_graph(self) -> None:\n self._clear_drawing()\n self.draw_graph(graph=self.graph, axes=self.subplot)\n self.draw_graph(graph=self.graph2, axes=self.subplot2)\n self.draw_mappings(self.mapping)",
"def _update_current_graph(self, **kwargs):\n\n self.current_graph.redra... | [
"0.82990897",
"0.80580974",
"0.7624843",
"0.76079607",
"0.76079607",
"0.7428141",
"0.74012005",
"0.73839015",
"0.73257685",
"0.7198118",
"0.71539146",
"0.7142096",
"0.7136589",
"0.7117135",
"0.7117135",
"0.70529664",
"0.7042666",
"0.7020045",
"0.7020045",
"0.700638",
"0.70062... | 0.84994626 | 0 |
Load and display the passed graph. | def load_graph(self, graph: Graph) -> None:
self.graph = graph
self._redraw_graph() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(self, **kwargs):\n self.graph = self.get_graph(**kwargs)\n self.graph.load(**kwargs)",
"def loadgraph(self, path):\n\n raise NotImplementedError",
"def show_graph(self):\n graph_file = self.dump_graph()\n subprocess.check_output(shlex.split(f'gwenview {graph_file}'))... | [
"0.7156698",
"0.68800837",
"0.6848133",
"0.6830049",
"0.6730292",
"0.66468304",
"0.6600777",
"0.654772",
"0.6512795",
"0.6414203",
"0.6403494",
"0.63959014",
"0.6333781",
"0.63320535",
"0.62774754",
"0.6231875",
"0.6223195",
"0.61864907",
"0.6167505",
"0.61524636",
"0.6135590... | 0.72175366 | 0 |
Return the graph that is represented by the specified axes. | def _get_connected_graph(self, axes: plt.Axes) -> Graph:
if axes == self.subplot:
return self.graph
else:
raise KeyError('Specified Axes could not be found.') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_connected_graph(self, axes: plt.Axes) -> Graph:\n if axes == self.subplot:\n return self.graph\n elif axes == self.subplot2:\n return self.graph2\n else:\n raise KeyError('Specified Axes could not be found.')",
"def axes(self) -> np.ndarray: # array... | [
"0.6946097",
"0.5786139",
"0.5764504",
"0.5764504",
"0.57531923",
"0.57531923",
"0.5719589",
"0.5469798",
"0.5383216",
"0.53713644",
"0.5342922",
"0.52830964",
"0.52605724",
"0.5249076",
"0.5199109",
"0.5196632",
"0.51746565",
"0.51670814",
"0.5148048",
"0.5135304",
"0.513386... | 0.7047026 | 0 |
Adds a vertex to the graph at the position defined by the mpl event. | def add_vertex(self, event: matplotlib.backend_bases.LocationEvent) \
-> None:
transform_func = event.inaxes.transData.inverted().transform
new_coords = transform_func((event.x, event.y))
log.info(f'Adding Vertex @ {event.x} - {event.y}, axis: '
f'{new_coords}')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(self, vertex):\n raise NotImplementedError",
"def add_vertex(self, vertex_id):\n pass # TODO",
"def add_vertex(self, vertex):\n self.vertices.append(vertex)\n self.vertex_edge[vertex] = []",
"def add_vertex(self, label):\n\n if label in self._vertices:\n ... | [
"0.7563129",
"0.723222",
"0.7161543",
"0.7156355",
"0.71207875",
"0.71198916",
"0.7035426",
"0.6999496",
"0.6957054",
"0.69250786",
"0.6904555",
"0.6765922",
"0.67454743",
"0.66659695",
"0.66659695",
"0.6649009",
"0.66469586",
"0.66432774",
"0.66098505",
"0.6546472",
"0.65267... | 0.8221702 | 0 |
Add a mapping between the two elements to the production. | def _add_mapping(self, mother_element: GraphElement,
daughter_element: GraphElement) -> None:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_mapping(self, mother_element: GraphElement,\n daughter_element: GraphElement) -> None:\n self.mapping[mother_element] = daughter_element",
"def __add__(self, other: MapValue) -> MapValue:\n return ops.MapMerge(self, other).to_expr()",
"def __radd__(self, other: MapVal... | [
"0.7042673",
"0.6301587",
"0.608117",
"0.6053467",
"0.60229",
"0.5890286",
"0.587229",
"0.58372045",
"0.58208764",
"0.5736256",
"0.5708055",
"0.56233305",
"0.5622347",
"0.5588315",
"0.55871934",
"0.55576986",
"0.55576986",
"0.5500496",
"0.5489049",
"0.5449521",
"0.54427195",
... | 0.7386965 | 0 |
Adds an attribute requirement between the two specified elements. | def _add_attr_requirement(self, mother_element: GraphElement,
daughter_element: GraphElement) -> None: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_attr_requirement(self, mother_element: GraphElement,\n daughter_element: GraphElement) -> None:\n if not daughter_element in self.attr_requirements:\n self.attr_requirements[daughter_element] = {}\n requirement_num = len(self.attr_requirements[daughter... | [
"0.7101804",
"0.6230195",
"0.6216398",
"0.6155128",
"0.59988314",
"0.5600701",
"0.545208",
"0.5447197",
"0.5264721",
"0.5214643",
"0.52116716",
"0.52106464",
"0.5197594",
"0.51585436",
"0.5156553",
"0.50689334",
"0.50541675",
"0.50425434",
"0.5041376",
"0.5033299",
"0.5023482... | 0.739838 | 0 |
Connects any two elements if it makes sense in context. Adds a new Edge between two vertices, if self.selected_element is not None and both vertices are in the same axes. If selected_element is None then it sets self.selected_element to the vertex passed as argument. If two edges are in the same axes nothing happens. I... | def connect_elements(self, event: matplotlib.backend_bases.LocationEvent,
element: 'FigureElement') -> None:
if self.selected_element is None:
self.selected_element = element
element.add_extra_path_effect('selection',
pe.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, v1, v2):\n pass # TODO",
"def add_edge(self, item1: Any, item2: Any, weight: Union[int, float]) -> None:\n if item1 in self._vertices and item2 in self._vertices:\n v1 = self._vertices[item1]\n v2 = self._vertices[item2]\n\n # Add the new edge\n ... | [
"0.5999846",
"0.59856063",
"0.5815487",
"0.57965994",
"0.57955956",
"0.57671285",
"0.57221603",
"0.5625872",
"0.5615395",
"0.5603937",
"0.5591767",
"0.55876136",
"0.5574401",
"0.55651414",
"0.5539157",
"0.55012083",
"0.54722184",
"0.5467264",
"0.5466253",
"0.5464435",
"0.5457... | 0.750268 | 0 |
Removes the hovered Elements from the graph. | def delete_element(self, event: matplotlib.backend_bases.LocationEvent) \
-> None:
log.info(f'Removing Element(s) @ {event.x} - {event.y}')
graph = self._get_connected_graph(event.inaxes)
to_remove = {x for x in self.elements if x.contains(event)[0]}
log.info(f'Elements to re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_unhover(self) -> None:",
"def unisolvent_nodes(self):\r\n pass",
"def disconnect_nodes(self):\n for src_id, trg_id in itertools.product(self.selected_nodes, repeat=2):\n if src_id != trg_id:\n # `discard` ignores non-existing elements (unlike `remove`)\n ... | [
"0.69784325",
"0.6411747",
"0.6281012",
"0.61337537",
"0.6083778",
"0.60492814",
"0.59661543",
"0.5953363",
"0.5932168",
"0.58861417",
"0.586513",
"0.5794916",
"0.57807744",
"0.57794785",
"0.57381606",
"0.57132536",
"0.57085484",
"0.57056797",
"0.57054806",
"0.5690846",
"0.56... | 0.64425635 | 1 |
Display a window that allows for editing of an elements attributes. | def open_attr_editing(self, element) -> None:
if self.attr_editing_window is not None:
self.close_attr_editing()
else:
position = wx.GetMousePosition()
self.attr_editing_window = AttributeEditingFrame(self, wx.ID_ANY,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_attr_req_editing(self, element) -> None:\n if self.attr_req_editing_window is not None:\n self.close_attr_editing()\n else:\n position = wx.GetMousePosition()\n self.attr_req_editing_window = AttributeRequirementEditingFrame(\n self, wx.ID_ANY,... | [
"0.6659311",
"0.6169691",
"0.59491926",
"0.58992946",
"0.58726037",
"0.5852599",
"0.5716457",
"0.5696189",
"0.5662377",
"0.5640791",
"0.56367207",
"0.5632048",
"0.5631164",
"0.5622477",
"0.5620895",
"0.56067353",
"0.5592529",
"0.55700505",
"0.5557119",
"0.5548776",
"0.5534905... | 0.6958823 | 0 |
Closes an opened element attribute editing window. | def close_attr_editing(self) -> None:
self.attr_editing_window.Close()
self.attr_editing_window = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_attr_req_editing(self) -> None:\n self.attr_req_editing_window.Close()\n self.attr_req_editing_window = None",
"def close_attr_req_editing(self) -> None:\n pass",
"def open_attr_editing(self, element) -> None:\n if self.attr_editing_window is not None:\n self.cl... | [
"0.7997215",
"0.7141961",
"0.6551061",
"0.6231262",
"0.59630466",
"0.5795215",
"0.5795215",
"0.5771843",
"0.56921726",
"0.5654888",
"0.5469147",
"0.5466623",
"0.5452029",
"0.5451822",
"0.5445185",
"0.5425771",
"0.541461",
"0.5413825",
"0.5386832",
"0.53592354",
"0.53446835",
... | 0.8355211 | 0 |
Test if an event is inside the axes of this Panel. | def event_in_axes(self, event: matplotlib.backend_bases.LocationEvent) \
-> bool:
return event.inaxes == self.subplot | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def axes_enabled(self):\n if hasattr(self, 'axes_widget'):\n return bool(self.axes_widget.GetEnabled())\n return False",
"def _check_axes(axes):\n _check_type(axes, (Axes, np.ndarray), \"axes\")\n if isinstance(axes, np.ndarray):\n if axes.ndim == 1:\n for ax in a... | [
"0.671091",
"0.6208423",
"0.6156233",
"0.61335844",
"0.60991186",
"0.6088695",
"0.60207427",
"0.57926714",
"0.57722473",
"0.5760292",
"0.57368016",
"0.5726686",
"0.562051",
"0.56115305",
"0.5580775",
"0.5571055",
"0.5563919",
"0.5550448",
"0.5470026",
"0.5459179",
"0.5459179"... | 0.8854843 | 0 |
Clears the current drawing and dicts/lists referencing the drawn elements. | def _clear_drawing(self) -> None:
self.vertices.clear()
self.edges.clear()
self.subplot.clear()
self.subplot2.clear() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _clear_drawing(self) -> None:\n self.vertices.clear()\n self.edges.clear()\n self.subplot.clear()\n self.selected_element = None\n self.pressed_elements.clear()",
"def _clear(self):\n self._fillitem = self._fillpath = None\n for item in self.items:\n ... | [
"0.8798906",
"0.79316634",
"0.7764828",
"0.76532316",
"0.7638401",
"0.75774086",
"0.7515265",
"0.7456398",
"0.74527353",
"0.742205",
"0.7401441",
"0.7380618",
"0.7338083",
"0.7337927",
"0.73297036",
"0.729089",
"0.72666776",
"0.72562766",
"0.7228562",
"0.72144085",
"0.7210648... | 0.82706034 | 1 |
Redraw the currently loaded graphs. | def _redraw_graph(self) -> None:
self._clear_drawing()
self.draw_graph(graph=self.graph, axes=self.subplot)
self.draw_graph(graph=self.graph2, axes=self.subplot2)
self.draw_mappings(self.mapping) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _redraw_graph(self) -> None:\n self._clear_drawing()\n self.draw_graph()",
"def redraw_figures(self):\n pass",
"def redraw_figures(self):\n pass",
"def plot_refresh():\n figure.canvas.draw()",
"def _update_current_graph(self, **kwargs):\n\n self.current_graph.redra... | [
"0.812659",
"0.7936349",
"0.7936349",
"0.77163017",
"0.75561",
"0.73383135",
"0.70364344",
"0.70364344",
"0.703126",
"0.69579417",
"0.69479334",
"0.69155383",
"0.6909802",
"0.69051296",
"0.6891078",
"0.6877941",
"0.68396044",
"0.6830217",
"0.68077636",
"0.6800429",
"0.6766062... | 0.8057434 | 1 |
Display a window that allows for editing the requirements of attributes of a specific element. | def open_attr_req_editing(self, element) -> None:
if self.attr_req_editing_window is not None:
self.close_attr_editing()
else:
position = wx.GetMousePosition()
self.attr_req_editing_window = AttributeRequirementEditingFrame(
self, wx.ID_ANY,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_attr_editing(self, element) -> None:\n if self.attr_editing_window is not None:\n self.close_attr_editing()\n else:\n position = wx.GetMousePosition()\n self.attr_editing_window = AttributeEditingFrame(self, wx.ID_ANY,\n ... | [
"0.68413615",
"0.65508693",
"0.5571642",
"0.5496969",
"0.54830647",
"0.5474354",
"0.53333175",
"0.5329269",
"0.5287009",
"0.52479637",
"0.52346814",
"0.5229036",
"0.5212956",
"0.51698345",
"0.51592696",
"0.51546735",
"0.5137302",
"0.5124626",
"0.5122872",
"0.5102492",
"0.5070... | 0.7490717 | 0 |
Closes an opened element attribute requirement editing window. | def close_attr_req_editing(self) -> None:
self.attr_req_editing_window.Close()
self.attr_req_editing_window = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_attr_editing(self) -> None:\n self.attr_editing_window.Close()\n self.attr_editing_window = None",
"def close_attr_req_editing(self) -> None:\n pass",
"def open_attr_req_editing(self, element) -> None:\n if self.attr_req_editing_window is not None:\n self.close_... | [
"0.79165214",
"0.7444396",
"0.68249637",
"0.6152994",
"0.6150109",
"0.5953293",
"0.5739249",
"0.5689546",
"0.5680209",
"0.5583001",
"0.5583001",
"0.5564221",
"0.5481616",
"0.5457909",
"0.5449019",
"0.54295856",
"0.54149216",
"0.5407903",
"0.5404366",
"0.53568083",
"0.52921045... | 0.8197979 | 0 |
Add a mapping between the two elements to the production. | def _add_mapping(self, mother_element: GraphElement,
daughter_element: GraphElement) -> None:
self.mapping[mother_element] = daughter_element | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_mapping(self, mother_element: GraphElement,\n daughter_element: GraphElement) -> None:\n pass",
"def __add__(self, other: MapValue) -> MapValue:\n return ops.MapMerge(self, other).to_expr()",
"def __radd__(self, other: MapValue) -> MapValue:\n return ops.MapMer... | [
"0.7386965",
"0.6301587",
"0.608117",
"0.6053467",
"0.60229",
"0.5890286",
"0.587229",
"0.58372045",
"0.58208764",
"0.5736256",
"0.5708055",
"0.56233305",
"0.5622347",
"0.5588315",
"0.55871934",
"0.55576986",
"0.55576986",
"0.5500496",
"0.5489049",
"0.5449521",
"0.54427195",
... | 0.7042673 | 1 |
Adds an attribute requirement between the two specified elements. | def _add_attr_requirement(self, mother_element: GraphElement,
daughter_element: GraphElement) -> None:
if not daughter_element in self.attr_requirements:
self.attr_requirements[daughter_element] = {}
requirement_num = len(self.attr_requirements[daughter_element]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_attr_requirement(self, mother_element: GraphElement,\n daughter_element: GraphElement) -> None:",
"def add_attr_requirement(self, event: Union[wx.CommandEvent, None],\n attr_req_label: str = '',\n attr_req_element: Grap... | [
"0.739838",
"0.6230195",
"0.6216398",
"0.6155128",
"0.59988314",
"0.5600701",
"0.545208",
"0.5447197",
"0.5264721",
"0.5214643",
"0.52116716",
"0.52106464",
"0.5197594",
"0.51585436",
"0.5156553",
"0.50689334",
"0.50541675",
"0.50425434",
"0.5041376",
"0.5033299",
"0.5023482"... | 0.7101804 | 1 |
Return the graph that is represented by the specified axes. | def _get_connected_graph(self, axes: plt.Axes) -> Graph:
if axes == self.subplot:
return self.graph
elif axes == self.subplot2:
return self.graph2
else:
raise KeyError('Specified Axes could not be found.') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_connected_graph(self, axes: plt.Axes) -> Graph:\n if axes == self.subplot:\n return self.graph\n else:\n raise KeyError('Specified Axes could not be found.')",
"def axes(self) -> np.ndarray: # array[Axes]\n return self._axes",
"def get_axes(self) -> VGroup:\n ... | [
"0.7047026",
"0.5786139",
"0.5764504",
"0.5764504",
"0.57531923",
"0.57531923",
"0.5719589",
"0.5469798",
"0.5383216",
"0.53713644",
"0.5342922",
"0.52830964",
"0.52605724",
"0.5249076",
"0.5199109",
"0.5196632",
"0.51746565",
"0.51670814",
"0.5148048",
"0.5135304",
"0.513386... | 0.6946097 | 1 |
Get and return the onhover text of the element. | def get_hover_text(self) -> str:
if self.graph_element is None:
return ''
text = ''
for name, value in self.graph_element.attr.items():
if name in ('x', 'y') or name.startswith('.'):
continue
text += f'{name}: {value}\n'
return text[:-1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tooltip_text(self): # real signature unknown; restored from __doc__\n return \"\"",
"def GetToolTip(self):\r\n\r\n return self._label",
"def hover(mouse):\n nonlocal desc_label\n\n smallest_element = get_element(mouse)\n\n with data_lock:\n if smallest_elem... | [
"0.6931978",
"0.6610155",
"0.6458537",
"0.64448744",
"0.64009815",
"0.6232814",
"0.6061276",
"0.60440975",
"0.60406834",
"0.60304356",
"0.6012522",
"0.5991501",
"0.59678483",
"0.59628785",
"0.5956597",
"0.5904038",
"0.5879372",
"0.5839806",
"0.5836077",
"0.57789415",
"0.57775... | 0.81764066 | 0 |
Removes the path effect with the specified name from the element. | def remove_extra_path_effect(self, name: str):
self.extra_path_effects.pop(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_extra_path_effect(self, name: str):\n super().remove_extra_path_effect(name)\n self.update_path_effects()",
"def remove_extra_path_effect(self, name: str):\n super().remove_extra_path_effect(name)\n self.update_path_effects()",
"def remove(name):",
"def remove_asset(sel... | [
"0.75836045",
"0.75836045",
"0.6658393",
"0.66141933",
"0.6609292",
"0.65412486",
"0.64385855",
"0.6330571",
"0.6297923",
"0.6283011",
"0.6278286",
"0.60900366",
"0.60307115",
"0.6020726",
"0.59730655",
"0.5940002",
"0.5930177",
"0.59114444",
"0.58867127",
"0.58836484",
"0.58... | 0.82098126 | 0 |
Called when the element is hovered. | def on_hover(self) -> None: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_over(self):\n pass",
"def hovered(self, *args, **kwargs): # real signature unknown\n pass",
"def hoverEnterEvent( self, event ):\n # process the parent event\n super(XNode, self).hoverEnterEvent(event)\n \n # hover over a hotspot\n hotspot = self.hotsp... | [
"0.7412773",
"0.7237632",
"0.6906489",
"0.68526864",
"0.6812145",
"0.67659557",
"0.66197455",
"0.66132617",
"0.6613236",
"0.6613236",
"0.6557558",
"0.64740694",
"0.6457405",
"0.64437896",
"0.641706",
"0.6406154",
"0.6402043",
"0.6388164",
"0.63690585",
"0.6352717",
"0.6292873... | 0.83767354 | 0 |
Called when an element stops being hovered. | def on_unhover(self) -> None: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_out(self):\n pass",
"def hoverLeaveEvent(self, event):\n if self._hoverSpot:\n if self._hoverSpot.hoverLeaveEvent(event):\n self.update()\n \n self._hoverSpot = None\n \n super(XNode, self).hoverLeaveEvent(event)",
"def on_hover(self... | [
"0.651642",
"0.63788223",
"0.615204",
"0.60260147",
"0.5947012",
"0.58971274",
"0.5630406",
"0.55071926",
"0.5495076",
"0.5430006",
"0.53661186",
"0.53160745",
"0.52913845",
"0.52894986",
"0.5289293",
"0.5289293",
"0.52844995",
"0.527896",
"0.527896",
"0.527896",
"0.527896",
... | 0.70880145 | 0 |
Is called when the Position of an Element is changed. | def on_position_change(self) -> None:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def position_changed(self, position):\n pass",
"def _pos_changed(self, timestamp=None, value=None, **kwargs):\n self._set_position(value)",
"def update_position(position):\n pass",
"def set_position(self, updated):\n self.buff_x = updated[0]\n self.buff_y = updated[1]",
"... | [
"0.8156067",
"0.7252104",
"0.7039363",
"0.69174737",
"0.681203",
"0.67029595",
"0.66832906",
"0.6652416",
"0.6515981",
"0.6392963",
"0.63458174",
"0.63199514",
"0.6239177",
"0.6238975",
"0.6185581",
"0.6180617",
"0.61575466",
"0.6155134",
"0.6139133",
"0.60846967",
"0.6080966... | 0.8031221 | 1 |
Updates the applied path effects. | def update_path_effects(self) -> None:
effects = list(self.extra_path_effects.values())
effects.append(pe.Normal())
self.set_path_effects(effects) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _post_update_paths(self, **kwargs):\n\n files_updated = kwargs.get('files_updated', list())\n if not files_updated:\n return\n\n maya_utils.reload_textures(files_updated)\n\n # Dependencies are already reloaded during update paths process\n # maya_utils.reload_depe... | [
"0.61469114",
"0.61446667",
"0.61446667",
"0.5958415",
"0.574662",
"0.574662",
"0.557207",
"0.5543527",
"0.54779965",
"0.5468949",
"0.5436489",
"0.5336085",
"0.530303",
"0.52836776",
"0.5258503",
"0.52316934",
"0.52080363",
"0.51516473",
"0.5130554",
"0.512807",
"0.51250166",... | 0.87097293 | 0 |
Add an extra path effect to the element. | def add_extra_path_effect(self, name: str,
effect: pe.AbstractPathEffect) -> None:
super().add_extra_path_effect(name, effect)
self.update_path_effects() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_extra_path_effect(self, name: str,\n effect: pe.AbstractPathEffect) -> None:\n self.extra_path_effects[name] = effect",
"def update_path_effects(self) -> None:\n effects = list(self.extra_path_effects.values())\n effects.append(pe.Normal())\n self.... | [
"0.7660745",
"0.6776474",
"0.6776474",
"0.67419755",
"0.67419755",
"0.640628",
"0.612771",
"0.6119774",
"0.6047129",
"0.58292586",
"0.57328755",
"0.5724404",
"0.5654173",
"0.564765",
"0.56371963",
"0.5637085",
"0.5551509",
"0.5488044",
"0.5342429",
"0.5342429",
"0.53235936",
... | 0.774229 | 0 |
Update the position of the Edge based on the connected Edges. | def update_position(self):
p1, p2 = connection_points_between_figure_elements(self.vertex1,
self.vertex2)
self.set_xdata((p1.x, p2.x))
self.set_ydata((p1.y, p2.y))
self.arrow.remove()
self.arrow = create_directional_arrow... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_coords(self, change=None):\n if self.node_id:\n x, y = self.layout[self.node_id]\n self.coords = (x - self.dist, x + self.dist, y - self.dist, y + self.dist)",
"def update_cell_edges(self):\n self.cells['edges'] = -1\n for c in range(self.Ncells()):\n ... | [
"0.64629555",
"0.641795",
"0.63651884",
"0.6266439",
"0.6243622",
"0.6069046",
"0.5965587",
"0.5938171",
"0.5910652",
"0.589336",
"0.5868739",
"0.58291113",
"0.58093846",
"0.57940036",
"0.578529",
"0.57735974",
"0.5755373",
"0.5742247",
"0.57411766",
"0.5723811",
"0.56988275"... | 0.6516109 | 0 |
Updates the applied path effects. | def update_path_effects(self) -> None:
effects = list(self.extra_path_effects.values())
effects.append(pe.Normal())
self.set_path_effects(effects) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _post_update_paths(self, **kwargs):\n\n files_updated = kwargs.get('files_updated', list())\n if not files_updated:\n return\n\n maya_utils.reload_textures(files_updated)\n\n # Dependencies are already reloaded during update paths process\n # maya_utils.reload_depe... | [
"0.61469114",
"0.61446667",
"0.61446667",
"0.5958415",
"0.574662",
"0.574662",
"0.557207",
"0.5543527",
"0.54779965",
"0.5468949",
"0.5436489",
"0.5336085",
"0.530303",
"0.52836776",
"0.5258503",
"0.52316934",
"0.52080363",
"0.51516473",
"0.5130554",
"0.512807",
"0.51250166",... | 0.87097293 | 1 |
Add an extra path effect to the element. | def add_extra_path_effect(self, name: str,
effect: pe.AbstractPathEffect) -> None:
super().add_extra_path_effect(name, effect)
self.update_path_effects() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_extra_path_effect(self, name: str,\n effect: pe.AbstractPathEffect) -> None:\n self.extra_path_effects[name] = effect",
"def update_path_effects(self) -> None:\n effects = list(self.extra_path_effects.values())\n effects.append(pe.Normal())\n self.... | [
"0.7660745",
"0.6776474",
"0.6776474",
"0.67419755",
"0.67419755",
"0.640628",
"0.612771",
"0.6119774",
"0.6047129",
"0.58292586",
"0.57328755",
"0.5724404",
"0.5654173",
"0.564765",
"0.56371963",
"0.5637085",
"0.5551509",
"0.5488044",
"0.5342429",
"0.5342429",
"0.53235936",
... | 0.774229 | 1 |
Removes the path effect with the specified name from the element. | def remove_extra_path_effect(self, name: str):
super().remove_extra_path_effect(name)
self.update_path_effects() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_extra_path_effect(self, name: str):\n self.extra_path_effects.pop(name)",
"def remove(name):",
"def remove_asset(self, name):\n if name in self.assets:\n del self.assets[name]",
"def remove(self, name: str) -> None:\n del self.components[name]",
"def remove_mix(se... | [
"0.82098126",
"0.6658393",
"0.66141933",
"0.6609292",
"0.65412486",
"0.64385855",
"0.6330571",
"0.6297923",
"0.6283011",
"0.6278286",
"0.60900366",
"0.60307115",
"0.6020726",
"0.59730655",
"0.5940002",
"0.5930177",
"0.59114444",
"0.58867127",
"0.58836484",
"0.5874422",
"0.584... | 0.75836045 | 1 |
Return the two points connecting the edges of two circles with the shortest straight line between them. | def connection_points_between_circles(center1: Vec, center2: Vec,
radius1: float, radius2: float
) -> Tuple[Vec, Vec]:
dir_vec = normalize(Vec(vec1=center1, vec2=center2))
p1 = center1 + dir_vec * radius1
p2 = center2 - dir_vec * ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _distance2_line_endpoints(line1, line2):\n (A,B),(C,D) = line1, line2\n R2=lambda u,v: (u[0]-v[0])**2+(u[1]-v[1])**2\n pairs = zip((A,A,B,B),(C,D,C,D))\n r2 = [R2(pair[0],pair[1]) for pair in pairs]\n mini=sorted(zip(r2,pairs),key=lambda a,b: a)[0]\n #R2_min = min((R2(A,C), R2(A,D), R2(B,C), ... | [
"0.6925683",
"0.67373735",
"0.64805984",
"0.64763045",
"0.6326114",
"0.6269599",
"0.62621427",
"0.6218426",
"0.6215204",
"0.6210706",
"0.61912256",
"0.61775285",
"0.6175741",
"0.6126969",
"0.610556",
"0.6078402",
"0.6052879",
"0.60473776",
"0.5969025",
"0.5966519",
"0.5963086... | 0.7133297 | 0 |
Returns the two points connecting the centers of the two elements with a straight line, taking into account the circumference of the figure elements. | def connection_points_between_figure_elements(element1: FigureElement,
element2: FigureElement
) -> Tuple[Vec, Vec]:
if isinstance(element1, FigureVertex):
center1 = Vec(x1=element1.center[0], y1=element1.center[1])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mapping_points_between_figure_elements(element1: FigureElement,\n element2: FigureElement\n ) -> Tuple[Vec, Vec]:\n if isinstance(element1, FigureVertex):\n center1 = Vec(x1=element1.center[0], y1=element1.center[1])\... | [
"0.66054904",
"0.64072263",
"0.6248832",
"0.62166214",
"0.62028444",
"0.61827886",
"0.612428",
"0.6113595",
"0.6099789",
"0.6065092",
"0.60411304",
"0.6020374",
"0.60182923",
"0.5980456",
"0.59705496",
"0.595651",
"0.5934626",
"0.5933855",
"0.5900288",
"0.58866364",
"0.588513... | 0.65649503 | 1 |
This function is similar to the connection_points_between_figure_elements() function, but takes two elements in different subplots and calculates the connection points for mapping arrows between them. Because each subplot has a different coordinate system the calculations are more complicated. | def mapping_points_between_figure_elements(element1: FigureElement,
element2: FigureElement
) -> Tuple[Vec, Vec]:
if isinstance(element1, FigureVertex):
center1 = Vec(x1=element1.center[0], y1=element1.center[1])
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connection_points_between_figure_elements(element1: FigureElement,\n element2: FigureElement\n ) -> Tuple[Vec, Vec]:\n if isinstance(element1, FigureVertex):\n center1 = Vec(x1=element1.center[0], y1=element1.ce... | [
"0.6324668",
"0.6066518",
"0.59506184",
"0.58509564",
"0.5810313",
"0.569868",
"0.5489544",
"0.548774",
"0.54173046",
"0.54137576",
"0.53784466",
"0.5377732",
"0.53768015",
"0.5362857",
"0.5308323",
"0.5304957",
"0.5276873",
"0.5269564",
"0.5238408",
"0.52253467",
"0.52139115... | 0.6332839 | 0 |
Calculates the starting point and the offset for an arrow placed at the end of an edge. | def calc_edge_arrow_data(edge: FigureEdge) -> Tuple[Vec, Vec]:
p1, p2 = connection_points_between_figure_elements(edge.vertex1,
edge.vertex2)
arrow_offset = opts['gui']['arrows']['arrow_start_offset']
start = p2 - normalize(Vec(vec1=p1, vec2=p2)) * arro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_arrowhead(self, direction: str, x: int, y: int, end: int) -> str:\n if direction == \"left\":\n p1, p2, p3 = (x, x - self.arrow_width + 2, x + self.arrow_width - 2)\n else:\n p1, p2, p3 = (end, end + self.arrow_width - 2, end - self.arrow_width + 2)\n return f\"M{... | [
"0.62411326",
"0.6234753",
"0.6191948",
"0.6077081",
"0.607508",
"0.6027296",
"0.60175747",
"0.600105",
"0.59105873",
"0.5842727",
"0.5818897",
"0.5693497",
"0.5648054",
"0.5632693",
"0.56246793",
"0.5540439",
"0.5520203",
"0.5511624",
"0.54976594",
"0.54948705",
"0.54892325"... | 0.77951217 | 0 |
Instantiates a new FancyArrow with the correct configuration for adding a direction to a FigureEdge. | def create_directional_arrow(edge: FigureEdge) -> FancyArrow:
arrow_start, arrow_offset = calc_edge_arrow_data(edge)
arrow_width = opts['gui']['arrows']['arrow_width']
arrow_head_width = opts['gui']['arrows']['head_width']
arrow_head_length = opts['gui']['arrows']['head_length']
arrow_color = opts['... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_edge(self, a, b):\n try: e = self.G.new_edge(a, b)\n except: return self.G.new_edge(a,b)\n\n try: self.G.set_edge_attribute(e, \"arrow\", \"true\")\n except: return self.G.new_edge(a,b)\n\n try: self.G.set_edge_attribute(e, \"spline\", \"false\")\n except: return ... | [
"0.6377767",
"0.57696813",
"0.57174975",
"0.55853325",
"0.55731285",
"0.55496216",
"0.5487053",
"0.5478329",
"0.54537594",
"0.5447913",
"0.5423972",
"0.54171115",
"0.53919244",
"0.5359261",
"0.5346887",
"0.5345027",
"0.5339781",
"0.53128153",
"0.5301507",
"0.528697",
"0.52714... | 0.75913894 | 0 |
adds config file and Connection creating object to ctx This will prepare the context for other commands. It reads the config file and adds the file to the Context. It also instantiates the CreateConnection class which allows for lazy loading of the Youtrack connection so that we only try to connect if we are required t... | def youtrack(ctx, url, username, password):
class CreateConnection(object):
def __init__(self, url, username, password, cfg):
if not url:
url = cfg.get('connection', 'url')
if not username:
username = cfg.get('connection', 'username')
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_create():\r\n\r\n \"\"\"\r\n global CONSUMER_KEY \r\n global CONSUMER_SECRET \r\n global ACCESS_KEY \r\n global ACCESS_SECRET\r\n global TweetBotName \r\n global StreamL \r\n global TweetL \r\n global NSFW \r\n global SFW \r\n ... | [
"0.5525787",
"0.55179673",
"0.5470595",
"0.54597384",
"0.54575396",
"0.5417419",
"0.5349808",
"0.5319401",
"0.5318282",
"0.5314346",
"0.5311134",
"0.5266186",
"0.52488166",
"0.5244951",
"0.52314883",
"0.5213098",
"0.517702",
"0.5170664",
"0.51704514",
"0.5147311",
"0.5133716"... | 0.6027475 | 0 |
view command for config if no subcommand called | def config(ctx):
if not ctx.invoked_subcommand:
cfg = ctx.obj['cfg']
for section in cfg.sections():
print("[", section, "]")
for option in cfg[section]:
print(option, " = ", cfg[section][option]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command():\n return _config.command",
"def subcommand_foo(self):\n print('foo: ')\n baz.print_configuration()",
"def main(ctx):\n\n print(\"Mode:\", ctx.invoked_subcommand)",
"def config_mode(self, config_command=\"config\", pattern=\">config\"):\n return super().config_mode(co... | [
"0.73776984",
"0.68675506",
"0.65850604",
"0.655881",
"0.64289594",
"0.6370118",
"0.62698364",
"0.62263596",
"0.613195",
"0.6106364",
"0.60411704",
"0.6039722",
"0.6039082",
"0.60292476",
"0.60105103",
"0.59776926",
"0.59661555",
"0.59473556",
"0.59448",
"0.594449",
"0.593851... | 0.7026435 | 1 |
Called by get_all_poll_data, gets poll data from rcp site | def get_rcp_poll_data(website_url):
all_races = dict()
page = requests.get(website_url)
page.raise_for_status()
bs_obj = bs4.BeautifulSoup(page.text, 'html.parser')
td_race = bs_obj.find_all("td", "lp-race")
td_poll = bs_obj.find_all("td", "lp-poll")
td_results = bs_obj.find_all("td", "lp-results")
td_spread = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_poll_data():\n\trcp_poll_race_dict = get_rcp_poll_data('http://www.realclearpolitics.com/epolls/latest_polls/') # realclearpolotics poll data\n\treturn rcp_poll_race_dict",
"def polling_call(self) -> global___Snippet.ClientCall:",
"def poll(self):\n self.get_peers()\n self.get_tracker... | [
"0.71145755",
"0.5876649",
"0.58502626",
"0.56043375",
"0.55491203",
"0.5527701",
"0.5467159",
"0.5448426",
"0.5352088",
"0.53126615",
"0.5300438",
"0.528354",
"0.52794904",
"0.5267711",
"0.52276313",
"0.5127261",
"0.5117422",
"0.51122195",
"0.5105585",
"0.5096877",
"0.507037... | 0.61796045 | 1 |
Called by get_all_headline_data, Parse the headline html data for one news site and make each headline into a Headline object. | def get_headline_data(website_url, source):
page = requests.get(website_url)
page.raise_for_status()
all_headlines = []
bs_obj = bs4.BeautifulSoup(page.text, 'html.parser')
item_list = bs_obj.select('item')
printable = set(string.printable)
for curr_item in item_list:
item_title = curr_item.title.string
foll... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_headline_data():\n\twebsites = database.get_website_URLs()\n\tall_headlines_arr = []\n\tfor curr_elt in websites:\n\t\tcurr_website = curr_elt[0]\n\t\tsource = curr_elt[1]\n\t\tcurr_headline_arr = get_headline_data(curr_website, source)\n\t\tall_headlines_arr.append(curr_headline_arr)\n\treturn all_hea... | [
"0.6478179",
"0.6475193",
"0.6362648",
"0.635065",
"0.6339492",
"0.6281099",
"0.6231646",
"0.61889184",
"0.61672",
"0.60695523",
"0.60031974",
"0.6001032",
"0.5983614",
"0.5980124",
"0.5951432",
"0.5941756",
"0.5933869",
"0.5879412",
"0.5856849",
"0.5823046",
"0.5822084",
"... | 0.7263744 | 0 |
Gets all headlines in a 2d array of headline objects | def get_all_headline_data():
websites = database.get_website_URLs()
all_headlines_arr = []
for curr_elt in websites:
curr_website = curr_elt[0]
source = curr_elt[1]
curr_headline_arr = get_headline_data(curr_website, source)
all_headlines_arr.append(curr_headline_arr)
return all_headlines_arr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_headlines(self, kw = None):\r\n\t\tif kw:\r\n\t\t\treturn self.get_headlines_with_keyword(kw)\r\n\t\telse:\r\n\t\t\treturn self.get_all_headlines()",
"def get_all_headlines(self):\r\n\t\tlist_vals = list(self.keyword_headlines().values())\r\n\t\tuniq_headlines = set()\r\n\t\tfor list_val in list_vals:\r\... | [
"0.6805288",
"0.66681826",
"0.64414334",
"0.63071424",
"0.62891537",
"0.627671",
"0.6207181",
"0.61054546",
"0.60500246",
"0.59685016",
"0.59470963",
"0.59354955",
"0.5918765",
"0.59022444",
"0.5855261",
"0.58342147",
"0.5818049",
"0.5792158",
"0.5789079",
"0.5785733",
"0.578... | 0.74649847 | 0 |
Gets all poll data from websites, just rcp right now | def get_all_poll_data():
rcp_poll_race_dict = get_rcp_poll_data('http://www.realclearpolitics.com/epolls/latest_polls/') # realclearpolotics poll data
return rcp_poll_race_dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rcp_poll_data(website_url):\n\tall_races = dict()\n\tpage = requests.get(website_url)\n\tpage.raise_for_status()\n\tbs_obj = bs4.BeautifulSoup(page.text, 'html.parser')\n\ttd_race = bs_obj.find_all(\"td\", \"lp-race\")\n\ttd_poll = bs_obj.find_all(\"td\", \"lp-poll\")\n\ttd_results = bs_obj.find_all(\"td\"... | [
"0.64626014",
"0.6146017",
"0.607786",
"0.60068434",
"0.59178555",
"0.5915178",
"0.5807954",
"0.5772672",
"0.5762507",
"0.5743239",
"0.572163",
"0.5704955",
"0.5704645",
"0.5699589",
"0.5688857",
"0.56837356",
"0.56790507",
"0.567832",
"0.56728864",
"0.5632242",
"0.5624435",
... | 0.7451158 | 0 |
returns string s where all spelled out numbers between 0 and 99 are converted to numbers | def spelledout_numbers_to_numbers(self, s):
numbers_1to9 = 'one two three four five six seven eight nine'.split()
mappings_1to9 = {t[0]: str(t[1])
for t in zip(numbers_1to9, range(1,10))}
mappings_10to19 = {t[0]: str(t[1])
for t in zip("""ten eleven twelve thirteen fourteen fifteen
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spelled_num_to_digits(spelled_num):\n words = re.split(r\",?\\s+|-\", spelled_num.lower())\n major = 0\n units = 0\n for w in words:\n x = SMALL.get(w, None)\n if x is not None:\n units += x\n elif w == \"hundred\":\n units *= 100\n elif w == \"and\... | [
"0.6682553",
"0.6589257",
"0.65729326",
"0.65535784",
"0.639042",
"0.63530743",
"0.63379157",
"0.63367224",
"0.6257592",
"0.6254087",
"0.6237117",
"0.61532366",
"0.6119005",
"0.6051259",
"0.6035944",
"0.6022159",
"0.601946",
"0.59924936",
"0.596444",
"0.5929257",
"0.5909929",... | 0.73115116 | 0 |
unfold abbreviations in string st | def deabbreviate(self, st):
abbrs = {'gws': 'greater western sydney giants',
'gwsg': 'greater western sydney giants',
'afl': 'australian football league',
'nrc': 'national rugby championship',
'nrl': 'national rugby league',
'syd': 'sydney',
'mel': 'melbourne',
'melb': 'melbourne',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_abbrev_in_text(text):\r\n tokens = word_tokenize(text)\r\n tokens = [convert_abbrev(word) for word in tokens]\r\n text = ' '.join(tokens)\r\n return text",
"def convert_abbrev(word):\r\n return abbreviations[word.lower()] if word.lower() in abbreviations.keys() else word",
"def combi... | [
"0.6166929",
"0.61277133",
"0.6118352",
"0.5967223",
"0.5957388",
"0.5905005",
"0.5876301",
"0.5796989",
"0.5763699",
"0.57412267",
"0.57412267",
"0.5737245",
"0.5723872",
"0.5700332",
"0.5695759",
"0.56211364",
"0.5612642",
"0.5579643",
"0.5558237",
"0.5548861",
"0.54835266"... | 0.782033 | 0 |
Get the geolocation data from the request. | def get_geo_data(request):
# Note that geoip2 (from maximind) doesn't work on GAE because there is a
# C lib in there apparently.
# We can use Appengine's added headers to do that work though thankfully.
geo = dict()
geo['region'] = request.headers.get("X-AppEngine-Region", "unknown")
geo['city... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_geolocation(self, location):\n\n response = self.request(dict(\n method=\"GET\",\n query=dict(location=location),\n ))\n\n return response['data']",
"def getLocation(self):\n send_url = 'https://ipinfo.io'\n r = requests.get(send_url)\n resp... | [
"0.7609283",
"0.70273775",
"0.67268974",
"0.6568262",
"0.65253556",
"0.6492344",
"0.6459893",
"0.64520943",
"0.6426659",
"0.6425953",
"0.6342649",
"0.63417333",
"0.63356334",
"0.63080126",
"0.6297456",
"0.62643236",
"0.62602955",
"0.6233702",
"0.6208337",
"0.6201374",
"0.6194... | 0.7446573 | 1 |
Request Polly speech given text and language. | def polly_request_speech(intext: str, intlanguage: str):
session = Session(profile_name="default")
polly = session.client("polly")
try:
response = polly.synthesize_speech(Text=intext,LanguageCode = intlanguage,OutputFormat="mp3",VoiceId="Joanna")
print(response)
except (BotoCoreError, Cl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def speaklang(ctx, language, *, message: commands.clean_content):\n await _speak(ctx, language, \"com\", message)",
"def generate_audio():\n text, lang = introduction()\n ses = boto3.Session(profile_name=\"default\")\n pol = ses.client(\"polly\")\n res = pol.synthesize_speech(Text=text, Lang... | [
"0.70442706",
"0.6185518",
"0.6089862",
"0.6000693",
"0.59898984",
"0.59892875",
"0.5983067",
"0.59538555",
"0.5942186",
"0.5904593",
"0.589987",
"0.5897557",
"0.5882125",
"0.5855573",
"0.5855573",
"0.58457834",
"0.5836635",
"0.5835496",
"0.5825341",
"0.58195424",
"0.5769832"... | 0.81863856 | 0 |
Reset dims values to initial states. | def reset(self):
# Don't reset axis labels
self.range = ((0, 2, 1),) * self.ndim
self.current_step = (0,) * self.ndim
self.order = tuple(range(self.ndim)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_states(self):\n K.batch_set_value([(v, 0) for v in self.variables])",
"def reset_state(self):\n for row in range(len(self.state)):\n for column in range(len(self.state[row])):\n self.state[row][column] = None",
"def reset_all(self):\n self._stepsize = _steps... | [
"0.72302496",
"0.6860482",
"0.6855735",
"0.67577887",
"0.67106414",
"0.66854584",
"0.6611975",
"0.6588729",
"0.6568128",
"0.6565924",
"0.65548766",
"0.65257764",
"0.65088725",
"0.6506533",
"0.6469049",
"0.6465789",
"0.64638746",
"0.6454795",
"0.6448066",
"0.64407986",
"0.6437... | 0.6904098 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.