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 |
|---|---|---|---|---|---|---|
calcule un ACM du graphe G en utilisant l'algorithme de Kruskal | def ACM_Kruskal(G):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Kruskal(G): # la fonction prend la liste de edges et de union find\n edges = G.edges\n unionfind_list = G.nodes\n G_k = Graph() # le graph contient le graph de kruskal\n dim = len(unionfind_list) # dimension du nombre de sommet du graph\n kruskal_cost = 0 # initilisation du cout du graphe\n\... | [
"0.7165909",
"0.67326295",
"0.64641",
"0.64422137",
"0.6430121",
"0.6193321",
"0.60410535",
"0.5938368",
"0.5934219",
"0.5923638",
"0.5894519",
"0.5869061",
"0.58546543",
"0.57801723",
"0.5769721",
"0.5765839",
"0.5758802",
"0.57420546",
"0.57336897",
"0.5726783",
"0.571303",... | 0.86322194 | 0 |
get train_loader and test_loader | def getloader(self):
return self.train_loader, self.test_loader | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_loader(mode):\n\tglobal train_loader, valid_loader\n\tconfig = Config\n\ttransform_list_train = []\n\ttransform_list_test = []\n\tis_train = mode == \"train\"\n\tif config.train.use_augmentation:\n\t\ttransform_list_train.extend([transforms.Resize((config.data.image_size, config.data.image_size)), ImageNet... | [
"0.77100426",
"0.76738524",
"0.76040876",
"0.7384658",
"0.7363785",
"0.72057515",
"0.71765244",
"0.71735513",
"0.7090515",
"0.6992934",
"0.6848907",
"0.6813013",
"0.67717856",
"0.6755532",
"0.6742161",
"0.6734493",
"0.67340785",
"0.67340785",
"0.67340785",
"0.67340785",
"0.67... | 0.90590286 | 0 |
Given a set of images with all the same shape, makes a mosaic with nrows and ncols | def make_mosaic(imgs, nrows, ncols, border=1):
nimgs = imgs.shape[0]
imshape = imgs.shape[1:]
mosaic = ma.masked_all((nrows * imshape[0] + (nrows - 1) * border,
ncols * imshape[1] + (ncols - 1) * border),
dtype=np.float32)
paddedh = imsha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_mosaic(imgs, nrows, ncols, border=1):\n nimgs = imgs.shape[0]\n imshape = imgs.shape[1:]\n\n mosaic = ma.masked_all((nrows * imshape[0] + (nrows - 1) * border,\n ncols * imshape[1] + (ncols - 1) * border),\n dtype=np.float32)\n\n paddedh = ... | [
"0.8022985",
"0.7750741",
"0.7483416",
"0.7252812",
"0.7172096",
"0.68353236",
"0.6759894",
"0.664381",
"0.6552254",
"0.6430067",
"0.6313499",
"0.6269626",
"0.62662363",
"0.6173159",
"0.61729586",
"0.61434",
"0.6112478",
"0.61113024",
"0.60981095",
"0.60899454",
"0.6086112",
... | 0.8077606 | 0 |
Retrieves the position a piece will end up in when it jumps/captures another piece | def get_piece_jumping_position(self, captured_piece):
row_diff = captured_piece.row - self.row # Compares the row/column numbers of the two pieces
col_diff = captured_piece.col - self.col
opp_row = row_diff + captured_piece.row
opp_col = col_diff + captured_piece.col
return {'op... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_position(self):",
"def get_position(self, position):",
"def getKickingPosition():\n pass",
"def GetPosition(self):\n ...",
"def _find_position(self, e):\n walk = self._data.first()\n while walk is not None and walk.element()._value != e:\n walk = self._data.a... | [
"0.6879707",
"0.6765341",
"0.6561232",
"0.64922756",
"0.64267874",
"0.6377644",
"0.63749224",
"0.6371028",
"0.63477916",
"0.6345881",
"0.6296877",
"0.6216796",
"0.62100327",
"0.62100327",
"0.62100327",
"0.62100327",
"0.62100327",
"0.62100327",
"0.62100327",
"0.62100327",
"0.6... | 0.7369341 | 0 |
Turns a normal piece into a King piece | def make_piece_king(self):
made_king = False
if self.player == 1 and self.row == 7 and not self.king:
self.king = True
self.symbol = '@'
made_king = True
if self.player == 2 and self.row == 0 and not self.king:
self.king = True
self.sym... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crowned(self): # called when this piece has become a 'King'\r\n \r\n self.isKing = True",
"def __init__(self, player):\n self._piece_type = 'king'\n self._value = 200 if player == \"white\" else -200\n self._summary = 'W-Kg' if player == \"white\" else 'B-Kg'\n\n sel... | [
"0.6926413",
"0.6292884",
"0.6171554",
"0.6160158",
"0.60965276",
"0.5949254",
"0.5843888",
"0.5793144",
"0.57742566",
"0.5739838",
"0.57030153",
"0.56553817",
"0.5634157",
"0.5566023",
"0.5545282",
"0.5544854",
"0.5489704",
"0.5484199",
"0.54804754",
"0.5445173",
"0.54320693... | 0.63675565 | 1 |
Add given successor to given node. Successor must be a list | def addSuccTo(self, thisNode, addedSuccessor):
# add addedSuccessor to node addedSuccessors
if self.nodes.get(thisNode) != None:
self.nodes[thisNode] += addedSuccessor
else:
self.nodes[thisNode] = addedSuccessor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_last(cls, node, value):\n # Check if element is the last element\n if node.next_ is None:\n node.next_ = Node(value)\n return\n\n # Recursively go to next node\n cls._add_last(node.next_, value)",
"def append(self, node):\n if not isinstance(node,... | [
"0.59201324",
"0.5847294",
"0.58244926",
"0.56499416",
"0.56388146",
"0.5604914",
"0.55893385",
"0.5552044",
"0.5538396",
"0.5529828",
"0.55075616",
"0.5507199",
"0.55013466",
"0.5490016",
"0.5460252",
"0.5459665",
"0.5453652",
"0.54473245",
"0.5441345",
"0.543303",
"0.542749... | 0.6483051 | 0 |
Delete successor of given node. retiredSuccessor must be a list | def retSuccOf(self, thisNode, retiredSuccessor):
if self.nodes.get(thisNode) != None:
# reconstruct the list without content
# of retiredSuccessor
self.nodes[thisNode] = [x for x in self.nodes[thisNode] if x not in retiredSuccessor]
else:
pass # nothing t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _delete_node(self, node):\n predecessor = node._prev\n successor = node._next\n predecessor._next = successor\n successor._prev = predecessor\n self._size -= 1\n element = node._element # record deleted element\n node._prev = node._next = node._element = None ... | [
"0.6731497",
"0.66242737",
"0.6571568",
"0.63829976",
"0.6107068",
"0.5910325",
"0.57547265",
"0.5712412",
"0.5700635",
"0.56927544",
"0.5683774",
"0.5659619",
"0.56565934",
"0.5649435",
"0.56414557",
"0.5528133",
"0.5516164",
"0.54907864",
"0.54866654",
"0.5474099",
"0.54736... | 0.73988205 | 0 |
Create a DNNLinearCombinedClassifier based on the HYPER_PARAMS in the parameters module | def create_classifier(config):
feature_columns = list(featurizer.create_feature_columns().values())
deep_columns, wide_columns = featurizer.get_deep_and_wide_columns(
feature_columns
)
linear_optimizer = tf.train.FtrlOptimizer(learning_rate=parameters.HYPER_PARAMS.learning_rate)
dnn_optim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_hparams(hparam_string=None):\n hparams = tf.contrib.training.HParams(\n # The name of the architecture to use.\n arch='resnet',\n lrelu_leakiness=0.2,\n batch_norm_decay=0.9,\n weight_decay=1e-5,\n normal_init_std=0.02,\n generator_kernel_size=3,\n discriminator_... | [
"0.61655724",
"0.6055172",
"0.5826157",
"0.57699984",
"0.5739669",
"0.57394177",
"0.57380944",
"0.5731565",
"0.57296675",
"0.5708917",
"0.56826067",
"0.5669957",
"0.5664464",
"0.56582004",
"0.561601",
"0.5595524",
"0.5571619",
"0.55614996",
"0.55269104",
"0.5517112",
"0.55164... | 0.6402716 | 0 |
Create a DNNLinearCombinedRegressor based on the HYPER_PARAMS in the parameters module | def create_regressor(config):
feature_columns = list(featurizer.create_feature_columns().values())
deep_columns, wide_columns = featurizer.get_deep_and_wide_columns(
feature_columns
)
linear_optimizer = tf.train.FtrlOptimizer(learning_rate=parameters.HYPER_PARAMS.learning_rate)
dnn_optimi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dnn_regressor(input_columns, dnn_hidden_units, learning_rate):\n # Following values are hard coded for simplicity in this example,\n # However prefarably they should be passsed in as hparams.\n\n input_layers = {\n colname: tf.keras.layers.Input(name=transformed_name(colname), shape=(), dtype=tf.... | [
"0.6357165",
"0.6267551",
"0.5845995",
"0.57434636",
"0.56861526",
"0.5682881",
"0.5592301",
"0.5583284",
"0.55018824",
"0.54800844",
"0.54477584",
"0.54402536",
"0.54336065",
"0.5403131",
"0.533953",
"0.5338399",
"0.53342026",
"0.53158724",
"0.52965474",
"0.52957726",
"0.529... | 0.69446474 | 0 |
Create the number of hidden units in each layer if the HYPER_PARAMS.layer_sizes_scale_factor > 0 then it will use a "decay" mechanism to define the number of units in each layer. Otherwise, parameters.HYPER_PARAMS.hidden_units will be used asis. | def construct_hidden_units():
hidden_units = list(map(int, parameters.HYPER_PARAMS.hidden_units.split(',')))
if parameters.HYPER_PARAMS.layer_sizes_scale_factor > 0:
first_layer_size = hidden_units[0]
scale_factor = parameters.HYPER_PARAMS.layer_sizes_scale_factor
num_layers = parameter... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layers_sizes(self):\n return iter([self.delta_h*l for l in range(int(self.h/self.delta_h)-1)])",
"def get_hidden_layer_size(self):\r\n return self.hidden_layer_size",
"def init(InputUnits, OutputUnits, numHiddenLayer, HiddenUnits=None):\n global HiddenUnit\n all_weights = []\n ... | [
"0.6702567",
"0.64026886",
"0.6389147",
"0.6316787",
"0.6186162",
"0.61597973",
"0.6137765",
"0.6114793",
"0.61083937",
"0.6039899",
"0.6028688",
"0.6006836",
"0.59841716",
"0.5980518",
"0.5980518",
"0.5961161",
"0.5955761",
"0.5954433",
"0.5954433",
"0.5954433",
"0.5954433",... | 0.7744325 | 0 |
We expect the 2019 population for Boulder, CO to be 326196. | def test_census_county_population():
dataframe = get_county_population_dataframe()
boulder_county_row = dataframe.loc[dataframe['county_fips'] == 8013]
boulder_county_population = boulder_county_row.get('county_population')
assert float(boulder_county_population) == 326196 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_population_for_health_board(health_board_to_council: pd.DataFrame,\r\n council_areas: pd.DataFrame) -> pd.Series:\r\n population_health_boards = {}\r\n for health_board, councils in health_board_to_council.iterrows():\r\n population_total = 0\r\n for c... | [
"0.5970188",
"0.5863773",
"0.5613959",
"0.55375576",
"0.55260384",
"0.5476783",
"0.54646116",
"0.5452425",
"0.5383164",
"0.5369351",
"0.53572977",
"0.53572977",
"0.5309722",
"0.5297909",
"0.5263271",
"0.525975",
"0.5241239",
"0.520593",
"0.5202293",
"0.5201915",
"0.51903474",... | 0.668509 | 0 |
GIVEN A FLASK app running WHEN the '/predict' page is requested (POST) with wrong data type THEN error message is returned | def test_service_api_predict_wrong_data_type(service_app):
response = service_app.post('/predict',
data="test",
content_type='application/json')
assert response.headers['Content-Type'] == 'application/json'
assert response.status_code == 400
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_service_api_post_without_data(service_app):\n response = service_app.post('/predict')\n assert response.headers['Content-Type'] == 'application/json'\n assert response.status_code == 400\n assert json.loads(response.data) == {'error': 'Failed to decode JSON object'}",
"def test_service_api_p... | [
"0.66735005",
"0.6633048",
"0.6560816",
"0.6507953",
"0.63487774",
"0.6273836",
"0.626291",
"0.6202898",
"0.61672586",
"0.6142531",
"0.60959303",
"0.6080977",
"0.6053256",
"0.60155135",
"0.6006262",
"0.59955657",
"0.5945496",
"0.59417224",
"0.5937137",
"0.5935213",
"0.5906254... | 0.7668008 | 0 |
GIVEN A FLASK app running WHEN the '/predict' page is requested (POST) with one not classified data sample THEN Records does not meet classification requirements is returned | def test_service_api_predict_single_raw_no_classification(service_app):
response = service_app.post('/predict',
data=json.dumps(data[:1]),
content_type='application/json')
assert response.headers['Content-Type'] == 'application/json'
assert res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_service_api_predict_single_raw_classified(service_app):\n response = service_app.post('/predict',\n data=json.dumps(data[1:2]),\n content_type='application/json')\n\n response_data = json.loads(response.data)\n assert response.headers[... | [
"0.7039637",
"0.6956225",
"0.6946195",
"0.6836482",
"0.66805923",
"0.6593482",
"0.6588958",
"0.6545336",
"0.64770377",
"0.6471251",
"0.6464594",
"0.6451226",
"0.6428195",
"0.6403254",
"0.64030516",
"0.638386",
"0.63687927",
"0.63607633",
"0.6325054",
"0.6274598",
"0.62648636"... | 0.76360226 | 0 |
GIVEN A FLASK app running WHEN the '/predict' page is requested (POST) with one not classified data sample THEN multiple classifications are returned | def test_service_api_predict_multiple_raw_classified(service_app):
response = service_app.post('/predict',
data=json.dumps(data),
content_type='application/json')
response_data = json.loads(response.data)
assert response.headers['Content-Type']... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_predict(self):\n answer = []\n response = []\n\n for it_predictions in json.loads(request.data.decode('UTF-8')):\n prediction = it_predictions['score']\n for ite_clf in g_list_of_classifier:\n answer.append(ite_clf.predict(prediction))\n ... | [
"0.76061213",
"0.74443936",
"0.7346938",
"0.72539616",
"0.7151024",
"0.70943403",
"0.7005228",
"0.7001114",
"0.69478196",
"0.6899592",
"0.68731046",
"0.68594086",
"0.68349653",
"0.67683935",
"0.6751782",
"0.6748465",
"0.6708636",
"0.66829735",
"0.66460854",
"0.6640956",
"0.66... | 0.7640239 | 0 |
Initializes ROSnode, instantiates the controller and initializes dynamic quantities (eta, ni, ...). | def __init__(self, name, rate):
super(ControlNode, self).__init__(name, rate)
self.mutex = RLock()
self.controller = InverseDynamicController()
self.ready = False
# Physical quantities from sensors
self.eta2 = np.zeros((3, 1))
self.ni = np.zeros((6, 1))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_ros_node(self): #pylint: disable=no-self-use\n print(\"rospy init node\")\n rospy.init_node('ispy_ROS_receiver', anonymous = True)",
"def __init__(self):\n rospy.init_node('TruckSimNode')\n\n self.steer_angle_topic = rospy.get_param('~steer_angle_topic', \"steer_angle\")\n ... | [
"0.6636221",
"0.65183675",
"0.6513829",
"0.6351623",
"0.63456255",
"0.63114524",
"0.62774974",
"0.62013453",
"0.6159472",
"0.61007905",
"0.60075647",
"0.59990346",
"0.5983112",
"0.59483445",
"0.5938138",
"0.5929864",
"0.5914592",
"0.5877536",
"0.5867562",
"0.58567476",
"0.584... | 0.68503463 | 0 |
Callback function to extract values from topic '/drivers/imu'. | def imu_callback(self, msg):
self.mutex.acquire()
self.ni[3] = msg.angular_rate.x
self.ni[4] = msg.angular_rate.y
self.ni[5] = msg.angular_rate.z
self.eta2[0] = msg.orientation.roll
self.eta2[1] = msg.orientation.pitch
self.eta2[2] = msg.orientation.yaw
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sensor_data(self):\n # Initialize ROS msgs\n imu_raw_msg = Imu()\n imu_msg = Imu()\n mag_msg = MagneticField()\n temp_msg = Temperature()\n\n # read from sensor\n buf = self.con.receive(registers.BNO055_ACCEL_DATA_X_LSB_ADDR, 45)\n # Publish raw data\... | [
"0.6155501",
"0.5870027",
"0.5677831",
"0.5530361",
"0.5407481",
"0.5399191",
"0.53831446",
"0.5286985",
"0.5270629",
"0.5181471",
"0.5162484",
"0.51556665",
"0.51381165",
"0.50479764",
"0.50355625",
"0.5021234",
"0.500381",
"0.49855492",
"0.49629354",
"0.49543217",
"0.492997... | 0.6154561 | 1 |
Callback function to extract values from topic '/drivers/dvl'. | def dvl_callback(self, msg):
self.mutex.acquire()
self.ni[0] = msg.velocity_instrument.x
self.ni[1] = msg.velocity_instrument.y
self.ni[2] = msg.velocity_instrument.z
self.mutex.release()
rospy.loginfo("%s receive dvl", self.node_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pull(self):\n \n data = self.s.recv(1024)\n if data:\n info = ET.fromstring(data)\n info = { info[0].tag : info[0].text, info[1].tag : info[1].text}\n #print(info)\n \n return info.get(\"topic\"), info.get(\"value\")\n pass",
... | [
"0.5263453",
"0.5185213",
"0.5034765",
"0.5004337",
"0.48835906",
"0.48829684",
"0.48176336",
"0.4803725",
"0.48003805",
"0.4771483",
"0.47152287",
"0.47055992",
"0.4702171",
"0.46666574",
"0.46612",
"0.4641564",
"0.46413577",
"0.4634017",
"0.46190333",
"0.46136248",
"0.46108... | 0.5269785 | 0 |
Callback function to extract values from topic '/reference/depth'. This method compute derivative of eta1_ref in body_fixed frame. | def refDepth_callback(self, msg):
self.mutex.acquire()
depth_ref = np.array([0, 0, msg.depth]).reshape((3, 1))
if not (self.reference_flags['depth']):
# first assignment
self.eta1_ref_body.last_value = self.controller.vehicle.ned2body_linear(deepcopy(depth_ref), self.eta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delta_ad_ref(self, T: float):\n return self.kappa_ref * (np.exp(self.eps_ref / T) - 1.0)",
"def extract_depth(obj, varname=None):\n if varname is not None:\n try:\n depth = obj[varname]\n except KeyError:\n raise LookupError\n if np.size(depth) > 1:\n ... | [
"0.52576995",
"0.5111601",
"0.5059385",
"0.49424797",
"0.48675165",
"0.48636612",
"0.48578805",
"0.48349983",
"0.4817226",
"0.48155236",
"0.47970894",
"0.4778559",
"0.47529778",
"0.47526708",
"0.47429052",
"0.4730778",
"0.47178364",
"0.47172207",
"0.46995127",
"0.46942344",
"... | 0.7089794 | 0 |
Callback function to extract values from topic '/reference/speed'. | def refSpeed_callback(self, msg):
self.mutex.acquire()
self.speed_ref[0] = msg.vx
self.speed_ref[1] = msg.vy
self.speed_ref[2] = msg.vz
self.mutex.release()
rospy.loginfo("%s receive speed reference", self.node_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_scan_speed(self, mess):\n scan_speed = mess[self.scan_speed_idx]\n return scan_speed",
"def get_speed(self):\n return self.get_par(\"slew_speed\")",
"def get_of_features_speed(self):\n speed = self._get_v0x01_v0x04_speed()\n # Don't use switch.is_connected() because w... | [
"0.57048595",
"0.5602207",
"0.5388428",
"0.53410476",
"0.533619",
"0.52595574",
"0.5231034",
"0.52257985",
"0.5213829",
"0.5150222",
"0.51455814",
"0.509102",
"0.5084496",
"0.5084496",
"0.50796765",
"0.5075798",
"0.49859887",
"0.4978502",
"0.49759266",
"0.49322572",
"0.492607... | 0.61902446 | 0 |
Callback function to extract values from topic '/reference/rpy'. This method compute derivative of eta2_ref. | def refRpy_callback(self, msg):
self.mutex.acquire()
rpy_ref = np.array([msg.roll, msg.pitch, msg.yaw]).reshape((3, 1))
if not (self.reference_flags['rpy']):
# first assignment
self.eta2_ref.last_value = deepcopy(rpy_ref)
self.eta2_ref.last_sampling = rospy.T... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refDepth_callback(self, msg):\n self.mutex.acquire()\n depth_ref = np.array([0, 0, msg.depth]).reshape((3, 1))\n\n if not (self.reference_flags['depth']):\n # first assignment\n self.eta1_ref_body.last_value = self.controller.vehicle.ned2body_linear(deepcopy(depth_ref... | [
"0.56509167",
"0.53251004",
"0.52550304",
"0.525233",
"0.51270187",
"0.50797045",
"0.50053024",
"0.49920037",
"0.49759054",
"0.49710527",
"0.49663278",
"0.49258175",
"0.49160272",
"0.49135745",
"0.490166",
"0.48991102",
"0.4883105",
"0.4860947",
"0.48555177",
"0.48424578",
"0... | 0.66459703 | 0 |
Callback function to extract values from topic '/reference/ll'. | def refLL_callback(self, msg):
self.mutex.acquire()
ll_ref = np.array([msg.latitude, msg.longitude, 0]).reshape((3, 1))
self.reference_flags['ll'] = True
self.mutex.release()
rospy.loginfo("%s receive ll reference", self.node_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_topic(bot, trigger, from_topic, topic_reset):",
"def ll_ext_values(tt):\n\n res = []\n for t in tt:\n xref = xref_fnc(t)\n nu = tv_feedback_gain.nu\n uuref = [refinput(t, i) for i in range(nu)]\n\n args = list(xref) + list(uuref)\n\n ll_num_ext = tv_feedback_gai... | [
"0.56976753",
"0.5451466",
"0.53502387",
"0.52519614",
"0.5142377",
"0.5081978",
"0.5074142",
"0.49585354",
"0.49151048",
"0.48834464",
"0.48804724",
"0.47684902",
"0.47528148",
"0.47485197",
"0.47457796",
"0.4745345",
"0.4723722",
"0.4719889",
"0.47153133",
"0.47101045",
"0.... | 0.64063287 | 0 |
Publish control law in '/control/tau' topic. | def publish(self, tau):
# tau message
sender = String('')
tau1 = Forces(tau[0], tau[1], tau[2])
tau2 = Euler(tau[3], tau[4], tau[5])
tau = Tau(sender, tau1, tau2)
self.pub_tau.publish(tau)
rospy.loginfo(tau) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sendControls(self):\n\n if self.controller.status:\n mode = '\"cool3\"'\n temp = self.controller.setpoint\n else:\n mode = '\"off\"'\n temp = self.controller.setpoint\n\n payload = '{\"mode\": ' + mode + ', \"temp\": ' + str(temp) + '}'\n ... | [
"0.5807704",
"0.5758317",
"0.55228525",
"0.5270476",
"0.52608407",
"0.5252377",
"0.5207384",
"0.517864",
"0.5148226",
"0.5117156",
"0.5114873",
"0.5094817",
"0.5083416",
"0.5068257",
"0.50589406",
"0.49929762",
"0.4973006",
"0.4966835",
"0.49520248",
"0.49468485",
"0.4941492"... | 0.7162413 | 0 |
Visualize graph on a circle. Return visualization or save to file. | def visualise_graph_on_circle(self, save_to_file, file_name) -> None:
nodes_number = len(self.adjacency_matrix)
phi = 2 * math.pi / nodes_number
# estimate graph radius
graph_radius = nodes_number * 1.5
nodes = []
for node in range(nodes_number):
nodes.inser... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_graph(self, filename='', save=False):\n nx.draw_circular(self.graph, node_color='pink', node_size=1000, with_labels=True)\n if save:\n plt.savefig(filename)\n print(f'Saved graph as {filename!r}')\n else:\n plt.show()",
"def show(self, circular=Fals... | [
"0.6911878",
"0.67860097",
"0.6635305",
"0.643991",
"0.6420579",
"0.6402754",
"0.63290936",
"0.6279044",
"0.6165545",
"0.61419237",
"0.61375046",
"0.606099",
"0.60442394",
"0.6030049",
"0.59707093",
"0.59639984",
"0.5942462",
"0.59208083",
"0.59208083",
"0.59208083",
"0.59185... | 0.7294445 | 0 |
configure the DAQ card sample clock | def Config_Sample_Clock(self,samples_per_sec=1000.0,num_samps_per_ch=1000):
self.samples_per_sec = samples_per_sec
self.num_samples_per_ch = num_samps_per_ch | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_clock_config(self, *args, **kwargs):\n return _uhd_swig.usrp_sink_sptr_set_clock_config(self, *args, **kwargs)",
"def set_clock_config(self, *args, **kwargs):\n return _uhd_swig.usrp_source_sptr_set_clock_config(self, *args, **kwargs)",
"def set_clock_config(self, *args, **kwargs):\n ... | [
"0.6446509",
"0.64428025",
"0.6261773",
"0.62558603",
"0.6078298",
"0.60676754",
"0.6008888",
"0.5913299",
"0.5799603",
"0.57889813",
"0.57223356",
"0.5658652",
"0.5648047",
"0.56223387",
"0.56196237",
"0.561595",
"0.56083894",
"0.56038594",
"0.5572591",
"0.5551271",
"0.55359... | 0.69151354 | 0 |
this function will start the voltage measurement and, when completed put the result onto a result queue for retrieval by the calling function | def run(self):
result = self.Take_Voltage_Measurement()
self.result_queue.put(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Take_Voltage_Measurement(self):\n self._CHK(nidaq.DAQmxStartTask(self.task_handle))\n samples_read = int32()\n data = numpy.zeros((self.num_samples,),dtype=numpy.float64)\n self._CHK(nidaq.DAQmxReadAnalogF64(self.task_handle,uInt32(self.num_samples),float64(self.timeout),\n ... | [
"0.69389534",
"0.69389534",
"0.6495457",
"0.6467312",
"0.6262244",
"0.6239943",
"0.6169618",
"0.6110444",
"0.6105568",
"0.6086529",
"0.6075996",
"0.6055169",
"0.6050425",
"0.60212076",
"0.5989642",
"0.59422153",
"0.5929142",
"0.5898589",
"0.58818233",
"0.58625567",
"0.5854719... | 0.85619634 | 0 |
take the list of samples (gathered by scan) and put into numpy arrays to place on the queue for return. If there was only one channel measured put the numpy array on the queue If there were more than one channel measured put a list of the numpy arrays on the queue | def _group_samples_by_channel(self):
samples_acquired_per_channel = len(self.all_samples_list) / self.num_channels
#make a list with each element being a numpy array for the results from each channel
channel_data = []
for i in range(self.num_channels):
channel_data.append(nu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill_buffer(self):\n num_of_smp = 0\n while num_of_smp < self.buf_size:\n c, t = self.inlet.pull_chunk(timeout=0.0)\n new_c = []\n new_t = []\n while c:\n new_c += c\n new_t += t\n c, t = self.inlet.pull_chun... | [
"0.5985075",
"0.5966764",
"0.58003885",
"0.5708871",
"0.5656563",
"0.5628519",
"0.56126255",
"0.55900705",
"0.5584042",
"0.5574181",
"0.5572602",
"0.55428034",
"0.5534926",
"0.5500349",
"0.5494749",
"0.5487945",
"0.548696",
"0.5468989",
"0.5410651",
"0.5404914",
"0.53854257",... | 0.72428924 | 0 |
this function will start the voltage measurement and, when completed put the result onto a result queue for retrieval by the calling function | def run(self):
result = self.Take_Voltage_Measurement()
self.result_queue.put(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Take_Voltage_Measurement(self):\n self._CHK(nidaq.DAQmxStartTask(self.task_handle))\n samples_read = int32()\n data = numpy.zeros((self.num_samples,),dtype=numpy.float64)\n self._CHK(nidaq.DAQmxReadAnalogF64(self.task_handle,uInt32(self.num_samples),float64(self.timeout),\n ... | [
"0.69374573",
"0.69374573",
"0.6493556",
"0.6465622",
"0.62603533",
"0.6238026",
"0.6168592",
"0.61111826",
"0.6104776",
"0.6087953",
"0.60747576",
"0.60541385",
"0.6051305",
"0.6022862",
"0.5989234",
"0.59406954",
"0.59291",
"0.58989024",
"0.5880741",
"0.5860903",
"0.5854285... | 0.8560719 | 1 |
this function will start the pulse width measurement thread and, when completed put the result onto a result queue for retrieval by the calling function | def run(self):
result = self.measure_pulse_width()
self.result_queue.put(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n result = self.Take_Voltage_Measurement()\n self.result_queue.put(result)",
"def run(self):\n result = self.Take_Voltage_Measurement()\n self.result_queue.put(result)",
"async def run(self):\n\n\t\tawait asyncio.sleep(self.delay)\n\t\tR_load = self.lock.mag/(self.sen... | [
"0.590271",
"0.590271",
"0.585027",
"0.5721861",
"0.5684144",
"0.5626837",
"0.5606898",
"0.5588782",
"0.5566415",
"0.55425",
"0.55309975",
"0.5524727",
"0.5490144",
"0.54408985",
"0.5437546",
"0.54260224",
"0.5421195",
"0.5393401",
"0.53891146",
"0.5383975",
"0.536363",
"0.... | 0.84387416 | 0 |
Affiche la table de multiplication de `nombre` >>> affiche_table(3) 3x1=3 3x2=6 3x3=9 3x4=12 3x5=15 3x6=18 3x7=21 3x8=24 3x9=27 | def affiche_table(nombre: int) -> None:
for k in range(1, 10):
## Version classique
#print(nombre, "x", k, "=", k * nombre, sep="")
## Version f-string ; recommandée
print(f"{nombre}x{k}={k * nombre}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def obtenerTabla(numero, limite):\n\tcontador = 1\n\tcadena = \"\"\n\t# tambien se puede utilizar un for \n\twhile contador <= limite:\n\t\tmultiplicacion = numero + contador\n\t\tcadena = \"%s%d * %d = %d\\n\" % (cadena, numero, contador, multiplicacion) \n\t\tcontador = contador + 1 \n\t\t\n\treturn cadena",
"... | [
"0.6910347",
"0.6519845",
"0.62801874",
"0.6244707",
"0.61948454",
"0.6127561",
"0.60558057",
"0.58783156",
"0.58383137",
"0.54473317",
"0.5439304",
"0.5434162",
"0.5394117",
"0.5381114",
"0.5374683",
"0.5309784",
"0.52044314",
"0.5187076",
"0.5173614",
"0.5159223",
"0.510004... | 0.7620428 | 0 |
Contains commands to register/deregister channels as specialized | async def managechannels(self, ctx:commands.Context): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_switch_channels(self):\n\t\t# not available yet, experimental\n\t\tpass",
"async def deregister(self, ctx:commands.Context):\r\n\r\n if await self.IsSpecialized(ctx.guild, ctx.channel.id):\r\n channels = await self.config.guild(ctx.guild).channels()\r\n t = channels.pop(str(... | [
"0.61868197",
"0.59882474",
"0.59592223",
"0.57463384",
"0.56101733",
"0.5564106",
"0.5533975",
"0.5527059",
"0.5507555",
"0.5495455",
"0.5495455",
"0.5489563",
"0.5468004",
"0.53812283",
"0.537934",
"0.5369928",
"0.5332631",
"0.5319344",
"0.53091747",
"0.52858245",
"0.526146... | 0.62506276 | 0 |
Designates a channel to be either a pool or a shop, and allow users to fish or sell within them | async def register(self, ctx:commands.Context, channel_type):
if not channel_type in [POOL_CHANNEL, SHOP_CHANNEL]:
await ctx.send(f'{channel_type} is not a valid channel type\n_Channel types:_\npool\nshop')
channel_type = await self.GetChannelType(ctx.guild, ctx.channel.id)
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def buybait(self, ctx:commands.Context, quantity:int, *bait_type:str):\r\n\r\n if not await self.IsSpecialized(ctx.guild, ctx.channel.id, SHOP_CHANNEL):\r\n await ctx.send('Cannot buy bait here\\nUse `add shop` to turn this channel into a shop')\r\n return\r\n\r\n bait_typ... | [
"0.5647163",
"0.5521696",
"0.55059946",
"0.5493717",
"0.5469494",
"0.54440546",
"0.54370826",
"0.53783447",
"0.5305762",
"0.5266002",
"0.52345294",
"0.5204717",
"0.51995337",
"0.51888597",
"0.5185262",
"0.51404196",
"0.5135386",
"0.50460726",
"0.5040098",
"0.5039286",
"0.5029... | 0.57456744 | 0 |
Removes a specialization from a channel | async def deregister(self, ctx:commands.Context):
if await self.IsSpecialized(ctx.guild, ctx.channel.id):
channels = await self.config.guild(ctx.guild).channels()
t = channels.pop(str(ctx.channel.id))
await self.config.guild(ctx.guild).channels.set(channels)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_channel(self, channel):\n self._channels.pop(channel.fileno, None)\n\n try:\n self._poller.remove(channel.fileno, channel._events)\n except (IOError, OSError):\n log.exception(\"Error while removing %r.\" % channel)",
"async def remove(self, ctx, channel: dis... | [
"0.6403853",
"0.6333425",
"0.62266964",
"0.61756617",
"0.6173588",
"0.6055281",
"0.6000497",
"0.5994604",
"0.5960761",
"0.5886335",
"0.5879209",
"0.5879169",
"0.58512884",
"0.5774928",
"0.57064",
"0.5690842",
"0.5644079",
"0.5636995",
"0.5624369",
"0.5623662",
"0.5566769",
... | 0.66375667 | 0 |
Displays if a channel has been registered as a type or is a normal channel | async def checktype(self, ctx:commands.Context):
t = await self.GetChannelType(ctx.guild, ctx.channel.id)
if t == 'none':
await ctx.send(
f'<#{ctx.channel.id}> is a normal channel (use `register <channel type>` to make this a specialized channel)')
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_channel(self):\n return True",
"def single_channel():\n return True",
"async def register(self, ctx:commands.Context, channel_type):\r\n\r\n if not channel_type in [POOL_CHANNEL, SHOP_CHANNEL]:\r\n await ctx.send(f'{channel_type} is not a valid channel type\\n_Channel typ... | [
"0.7110801",
"0.6721393",
"0.65132374",
"0.62517273",
"0.59904927",
"0.59034956",
"0.5791688",
"0.5790419",
"0.5699715",
"0.5697061",
"0.56941587",
"0.56895554",
"0.5688134",
"0.56565374",
"0.56562656",
"0.5655637",
"0.5649726",
"0.5635336",
"0.56016374",
"0.55869657",
"0.557... | 0.779624 | 0 |
Allows an admin to skip the merchant cooldown and refresh the current merchants Must be used in a channel registered as a shop | async def forceshopreset(self, ctx:commands.Context):
if not await self.IsSpecialized(ctx.guild, ctx.channel.id, SHOP_CHANNEL):
await ctx.send('Cannot refresh the shops here\nUse `add shop` to turn this channel into a shop')
return
await self.RefreshMerchants(ctx.guild, c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_fedcm_cooldown(self):\n pass",
"def somenonturbotadmin():\n cond = lambda member: member != ADMIN and ADMIN_ROLE not in member.roles\n return random.choice(list(filter(cond, CHANNEL_MEMBERS)))",
"async def plaguebearer(self, ctx):\n currency = await bank.get_currency_name(ctx.guil... | [
"0.56874806",
"0.54557216",
"0.5449109",
"0.5441443",
"0.5407161",
"0.5375872",
"0.536857",
"0.53412104",
"0.532588",
"0.53013366",
"0.5246306",
"0.5204909",
"0.52011704",
"0.51955307",
"0.51895314",
"0.5162264",
"0.5128543",
"0.5118908",
"0.5112617",
"0.50994235",
"0.5087400... | 0.5940937 | 0 |
Sell one fish in your inventory chosen by a specified name and size Prices affected by rarity modifiers | async def sell(self, ctx:commands.Context, name, size):
await self.sellall(ctx, 'specific', f'{name} {size}') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def sellall(self, ctx:commands.Context, fish_type:str='', fish_quality:str=''):\r\n\r\n if not fish_type in ['specific', 'name', 'school', 'rarity', '']:\r\n await ctx.send(f'{fish_type} must be one of the following:\\n```name\\nschool\\nrarity```')\r\n return\r\n\r\n all_... | [
"0.658816",
"0.63521826",
"0.62320566",
"0.6212246",
"0.6195439",
"0.6163087",
"0.5955984",
"0.5949366",
"0.5944461",
"0.5921581",
"0.5864623",
"0.5834307",
"0.5759784",
"0.57362646",
"0.5733804",
"0.5728298",
"0.57077825",
"0.566822",
"0.5668064",
"0.56453043",
"0.5621441",
... | 0.7736391 | 0 |
Sell all of the fish in your bucket Fish will automatically be sold to valid merchants Can filter by categories (name, school, or rarity) Sale prices are increased for fish from a school you've completed Prices affected by rarity modifiers and school_complete_mod | async def sellall(self, ctx:commands.Context, fish_type:str='', fish_quality:str=''):
if not fish_type in ['specific', 'name', 'school', 'rarity', '']:
await ctx.send(f'{fish_type} must be one of the following:\n```name\nschool\nrarity```')
return
all_fish = await self.co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sell_all(self):\n\n from_symbol = self.symbol\n to_symbol = self.currency\n price = self.data[0].close\n amount = self.portfolio['buy_sell_amount'][self.currency]\n date = self.date\n\n if self.slippage:\n slip_factor = (self.data[-1].high - self.data[-1].cl... | [
"0.6112792",
"0.5922017",
"0.59102553",
"0.58273405",
"0.57666373",
"0.57215554",
"0.5645061",
"0.5625076",
"0.5543856",
"0.55328435",
"0.5518493",
"0.5486257",
"0.54659057",
"0.5428261",
"0.54258066",
"0.54080296",
"0.53866935",
"0.5328948",
"0.5327947",
"0.52997863",
"0.526... | 0.8000234 | 0 |
Purchase bait to use with cast prices affected by bait_price_mod and bulk_purchase_mod | async def buybait(self, ctx:commands.Context, quantity:int, *bait_type:str):
if not await self.IsSpecialized(ctx.guild, ctx.channel.id, SHOP_CHANNEL):
await ctx.send('Cannot buy bait here\nUse `add shop` to turn this channel into a shop')
return
bait_type = ' '.join(bait_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purchase(self, item_type):",
"def buy(self, price, volume):\r\n self.order(\"bid\", price, volume)",
"def trade(self, action=None):\n #print(\"Trading {}\".format(action))\n # Buy\n if action > 0.2 : self.posture = 1\n # Hold\n if action < 0.2 and action > -0.2: se... | [
"0.6886232",
"0.6607025",
"0.64934975",
"0.60241896",
"0.60035247",
"0.5941296",
"0.59302354",
"0.59000635",
"0.58302313",
"0.58104116",
"0.5774722",
"0.5711439",
"0.5693818",
"0.56447804",
"0.562465",
"0.5609996",
"0.5592459",
"0.55905706",
"0.5580305",
"0.55768406",
"0.5566... | 0.6931416 | 0 |
Display your completion percentage of every school (use the school command to get more detailed information about a specific school) | async def schools(self, ctx:commands.Context, member:Member = None):
if member is None:
member = ctx.message.author
embeds = []
member_schools = await self.config.member(member).schools()
print(member_schools)
display_length = await self.GetSetting(ctx.guild... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __statistics_best_situation(self):\n students_list = self.__grade_controller.get_list_of_students_with_best_situation()\n if len(students_list) == 0:\n print(\"There is no student with a grade!\")\n return\n\n for student in students_list:\n print(str(stude... | [
"0.58460474",
"0.5808042",
"0.57187593",
"0.5698568",
"0.5609004",
"0.55549574",
"0.5528185",
"0.5505077",
"0.549608",
"0.5484342",
"0.5468743",
"0.54617643",
"0.5460946",
"0.5454344",
"0.54534066",
"0.5427118",
"0.54151547",
"0.5391401",
"0.5356463",
"0.5352042",
"0.5342426"... | 0.5910057 | 0 |
Display all of your obtained fish in a specific school | async def school(self, ctx:commands.Context, *school_name):
school_name = ' '.join(school_name)
if not school_name in list(self.fish_schools.keys()):
await ctx.send(f'{school_name} is not a valid school')
return
curr_school = self.fish_schools[school_name]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_school():\n if current_user.is_administrator():\n schools = School.query.order_by(School.long_name)\n else:\n schools = current_user.schools_coached\n\n # if initial get request, render add_school.html\n return render_template('choose_school.html', schools=schools)",
"async d... | [
"0.6135468",
"0.5999562",
"0.59924406",
"0.5975256",
"0.59099156",
"0.5878306",
"0.5703355",
"0.56727314",
"0.565807",
"0.55854195",
"0.5557434",
"0.55572337",
"0.5554035",
"0.55434054",
"0.5498167",
"0.54382086",
"0.54246515",
"0.5367391",
"0.5365888",
"0.5359602",
"0.533951... | 0.67277 | 0 |
Modify various settings used by fishing | async def fishingsettings(self, ctx:commands.Context): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iniitialize_dynamic_settings(self):\n\t\tself.speed_factor = 1.5\n\t\tself.bullet_speed_factor = 3\n\t\tself.alien_speed_factor = 1\n\n\t\t# fleet_direction of 1 represents right; -1 represents left. \n\t\tself.fleet_direction = 1",
"def update_settings(self):\n settings = {\n \"reference\"... | [
"0.6475052",
"0.6378027",
"0.6329654",
"0.630778",
"0.6306532",
"0.63065314",
"0.6230689",
"0.6115725",
"0.60704213",
"0.6046115",
"0.60442805",
"0.59416527",
"0.58606344",
"0.5817816",
"0.57655704",
"0.5748576",
"0.5730808",
"0.57159686",
"0.57140666",
"0.5683879",
"0.568081... | 0.7662924 | 0 |
Get the `sqlglot.exp.DataType` type of a column in the schema. | def get_column_type(
self,
table: exp.Table | str,
column: exp.Column,
dialect: DialectType = None,
normalize: t.Optional[bool] = None,
) -> exp.DataType: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_postgres_column_type(\n self, tablename: str, column_name: str\n ) -> str:\n return self.get_postgres_column_definition(\n tablename=tablename, column_name=column_name\n ).data_type.upper()",
"def get_data_type(col_val):\n dtype = \"\"\n\n original_col_val = col_v... | [
"0.7730265",
"0.7696099",
"0.73876876",
"0.72716093",
"0.71338415",
"0.70155656",
"0.6958082",
"0.6940547",
"0.6886838",
"0.68727636",
"0.67603856",
"0.67428154",
"0.67064464",
"0.67043954",
"0.6693943",
"0.6691234",
"0.6677616",
"0.6676066",
"0.6651016",
"0.6613417",
"0.6550... | 0.7796341 | 0 |
Table arguments this schema support, e.g. `("this", "db", "catalog")` | def supported_table_args(self) -> t.Tuple[str, ...]: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_table(self):",
"def __init__(self, table_id='', columns=(),\n file_name='', table_data=(), verbose=True):\n self.table_id = table_id\n self.columns = list(columns)\n self.file_name = file_name\n self.table_data = list(table_data)\n self.verbose = verbose",
"def __get_datatab... | [
"0.610192",
"0.6069731",
"0.5908132",
"0.58353543",
"0.5732963",
"0.5682121",
"0.56772226",
"0.56651264",
"0.5651429",
"0.5648963",
"0.56454366",
"0.5626827",
"0.5563479",
"0.5518577",
"0.55164057",
"0.5494886",
"0.5479745",
"0.54671645",
"0.54371583",
"0.5426792",
"0.5411122... | 0.8341999 | 0 |
Register or update a table. Updates are only performed if a new column mapping is provided. The added table must have the necessary number of qualifiers in its path to match the schema's nesting level. | def add_table(
self,
table: exp.Table | str,
column_mapping: t.Optional[ColumnMapping] = None,
dialect: DialectType = None,
normalize: t.Optional[bool] = None,
match_depth: bool = True,
) -> None:
normalized_table = self._normalize_table(table, dialect=dialect... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_table(\n self,\n table: exp.Table | str,\n column_mapping: t.Optional[ColumnMapping] = None,\n dialect: DialectType = None,\n normalize: t.Optional[bool] = None,\n match_depth: bool = True,\n ) -> None:",
"def append_table(self, table):\n\n self._db_man... | [
"0.6906549",
"0.65174025",
"0.58558434",
"0.58537805",
"0.55823225",
"0.5572148",
"0.55663824",
"0.55141455",
"0.54686254",
"0.54144526",
"0.5408034",
"0.54023874",
"0.5366671",
"0.53248453",
"0.5310447",
"0.5292642",
"0.5265485",
"0.52491516",
"0.5245744",
"0.52282953",
"0.5... | 0.6541329 | 1 |
calculates the perimeter of the rectangle | def calculateperimeter(self):
return (self.width * 2) + (self.height * 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perimeter(self):\n\t\treturn 2 * (self.width + self.height)",
"def perimeter(self):\n return self.sidelength1 + self.sidelength2 + self.baselength1 + self.baselength2",
"def perimeter(self):\n return 2 * (self.height + self.width)",
"def perimeter(self):\r\n return (2*self.width) + (2*se... | [
"0.84097177",
"0.82991195",
"0.8230295",
"0.82295436",
"0.8175543",
"0.8090151",
"0.7748024",
"0.7746333",
"0.7600331",
"0.7560432",
"0.7461582",
"0.7413485",
"0.73691916",
"0.733947",
"0.733947",
"0.7245376",
"0.71416146",
"0.7044641",
"0.7007834",
"0.7006381",
"0.6965209",
... | 0.84027857 | 1 |
Initializes an FAT file system. | def __init__(self, resolver_context, path_spec):
super(FATFileSystem, self).__init__(resolver_context, path_spec)
self._file_object = None
self._fsfat_volume = None
self._root_directory_identifier = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, raiz):\n super(Fiunamfs, self).__init__()\n self.raiz = raiz\n self.void_entrada_dir = \"Xx.xXx.xXx.xXx.\"\n if os.path.isfile(self.raiz):\n with open(self.raiz,\"r+\") as filesystem:\n self.map = mmap.mmap(filesystem.fileno(), 0)\n ... | [
"0.63188535",
"0.5889343",
"0.5821936",
"0.57740694",
"0.5654106",
"0.5625574",
"0.5606235",
"0.56006455",
"0.5562057",
"0.5519923",
"0.551059",
"0.5489221",
"0.54600346",
"0.54571086",
"0.5440901",
"0.5398454",
"0.53769785",
"0.5342027",
"0.5341216",
"0.5325688",
"0.53254545... | 0.70108753 | 0 |
Determines if a file entry for a path specification exists. | def FileEntryExistsByPathSpec(self, path_spec):
# Opening a file by identifier is faster than opening a file by location.
fsfat_file_entry = None
location = getattr(path_spec, 'location', None)
identifier = getattr(path_spec, 'identifier', None)
try:
if identifier is not None:
fsfat_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def FileEntryExistsByPath(self, path):\n if not self._file_entries:\n return False\n\n return path in self._file_entries",
"def PathHasFile(path_spec, fname):\n for dir in path_spec.split(':'):\n if os.path.exists(os.path.join(dir, fname)):\n return True\n return False",
"def... | [
"0.7863224",
"0.75036407",
"0.74586415",
"0.73196864",
"0.7236807",
"0.7229731",
"0.7118913",
"0.70956737",
"0.7033691",
"0.70013297",
"0.696599",
"0.6944815",
"0.6918158",
"0.6915945",
"0.69062704",
"0.6898333",
"0.6893156",
"0.68854475",
"0.68753237",
"0.6865665",
"0.685695... | 0.8408388 | 0 |
Retrieves a file entry for a path specification. | def GetFileEntryByPathSpec(self, path_spec):
# Opening a file by identifier is faster than opening a file by location.
fsfat_file_entry = None
location = getattr(path_spec, 'location', None)
identifier = getattr(path_spec, 'identifier', None)
if (location == self.LOCATION_ROOT or
identifier... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetFATFileEntryByPathSpec(self, path_spec):\n # Opening a file by identifier is faster than opening a file by location.\n location = getattr(path_spec, 'location', None)\n identifier = getattr(path_spec, 'identifier', None)\n\n if identifier is not None:\n fsfat_file_entry = self._fsfat_volume... | [
"0.73651946",
"0.68824446",
"0.6858954",
"0.6523468",
"0.6486279",
"0.6416723",
"0.63695353",
"0.6296745",
"0.62840843",
"0.62158257",
"0.6162694",
"0.6115889",
"0.6102433",
"0.59521365",
"0.5931107",
"0.5867576",
"0.58413875",
"0.57731813",
"0.5739516",
"0.57122064",
"0.5708... | 0.7410478 | 0 |
Retrieves the FAT file entry for a path specification. | def GetFATFileEntryByPathSpec(self, path_spec):
# Opening a file by identifier is faster than opening a file by location.
location = getattr(path_spec, 'location', None)
identifier = getattr(path_spec, 'identifier', None)
if identifier is not None:
fsfat_file_entry = self._fsfat_volume.get_file_e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetFileEntryByPathSpec(self, path_spec):\n # Opening a file by identifier is faster than opening a file by location.\n fsfat_file_entry = None\n location = getattr(path_spec, 'location', None)\n identifier = getattr(path_spec, 'identifier', None)\n\n if (location == self.LOCATION_ROOT or\n ... | [
"0.779033",
"0.6408017",
"0.6292353",
"0.61965084",
"0.6132355",
"0.60661227",
"0.5960667",
"0.59466404",
"0.59354794",
"0.59317774",
"0.5781503",
"0.5739296",
"0.573339",
"0.5607855",
"0.5578621",
"0.53752375",
"0.5236052",
"0.5231925",
"0.5211708",
"0.5204015",
"0.52011734"... | 0.82839155 | 0 |
Retrieves the FAT volume. | def GetFATVolume(self):
return self._fsfat_volume | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volume():\n vol = sonos.volume\n return vol",
"def get_volume(self):\n return int(self.get(COMMAND_UIC, 'GetVolume')['volume'])",
"def getVolume(self):\n return self.__volume",
"def get_volume(cls) -> float:\n raise NotImplementedError",
"def get_volume(self):\n return... | [
"0.6741914",
"0.64630485",
"0.6441217",
"0.64277786",
"0.6402811",
"0.63844526",
"0.6358187",
"0.6316619",
"0.6304788",
"0.6304788",
"0.61879545",
"0.61807597",
"0.6056522",
"0.6056522",
"0.6051996",
"0.6024354",
"0.6017007",
"0.5998696",
"0.5896236",
"0.5891706",
"0.5859794"... | 0.8854301 | 0 |
Retrieves the root file entry. | def GetRootFileEntry(self):
path_spec = fat_path_spec.FATPathSpec(
location=self.LOCATION_ROOT,
identifier=self._root_directory_identifier,
parent=self._path_spec.parent)
return self.GetFileEntryByPathSpec(path_spec) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetRootFileEntry(self):\n path_spec = compressed_stream_path_spec.CompressedStreamPathSpec(\n compression_method=self._compression_method,\n parent=self._path_spec.parent)\n return self.GetFileEntryByPathSpec(path_spec)",
"def get_file_entry(self):\n pass",
"def get_root_filename... | [
"0.76521605",
"0.71184343",
"0.6924379",
"0.6699768",
"0.6628157",
"0.64125776",
"0.64025784",
"0.64025784",
"0.6372416",
"0.6306385",
"0.62967706",
"0.61980176",
"0.6194078",
"0.61891824",
"0.6178764",
"0.6148309",
"0.614439",
"0.6111012",
"0.6111012",
"0.61053246",
"0.60989... | 0.8115555 | 0 |
Convert type ty to string. | def type_str(ty: type) -> str:
type_str = str(ty).replace("typing.", "")
return type_str[8:-2] if type_str.startswith("<class '") else type_str | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def typestr(self) -> str:\n return self.type if not self.subtype else f\"{self.type}:{self.subtype}\"",
"def __str__(self):\n if self.default_kind:\n return self.typestr\n elif check_fortran_intrinsic(self.typestr):\n return \"{}(kind={})\".format(self.typestr, self._ki... | [
"0.6965034",
"0.69143295",
"0.68898505",
"0.6834358",
"0.6822356",
"0.67486227",
"0.6729471",
"0.67144763",
"0.6709419",
"0.67053926",
"0.66915524",
"0.6657758",
"0.66090363",
"0.6587318",
"0.6541538",
"0.6539442",
"0.6529326",
"0.6527245",
"0.65105623",
"0.6467017",
"0.64665... | 0.7121505 | 0 |
create code to assert type of var_name is ty | def gen_type_assertion(var_name: str, ty: type) -> str:
tys = type_str(ty)
vars = [c for c in 'abcdefghijklmnop' if c != var_name][::-1]
def helper(var_name, tys):
tys = tys.strip()
pre_bracket = tys.split("[")[0].lower() # part before [ (or the entire string if no bracket
ans = f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_typevar(self, name: str, node: nodes.AssignName) -> None:\n if isinstance(node.parent, nodes.Assign):\n keywords = node.assign_type().value.keywords\n args = node.assign_type().value.args\n elif isinstance(node.parent, nodes.Tuple):\n keywords = (\n ... | [
"0.7006384",
"0.6486391",
"0.647841",
"0.6444737",
"0.6433076",
"0.63064885",
"0.62820286",
"0.616275",
"0.61551017",
"0.61477345",
"0.6119317",
"0.6078907",
"0.60352945",
"0.6022062",
"0.6018125",
"0.6001449",
"0.5978701",
"0.597096",
"0.5967621",
"0.5964612",
"0.5926319",
... | 0.7428603 | 0 |
Returns True if the input is a duplicate of a previous puzzle, and also makes sure that the types match | def check_seen_input(self, inp):
s = str(inp)
if s in self._seen_problems:
return True # duplicate problem
self._seen_problems.add(s)
assert set(inp) == set(self.arg_names[1:]), \
f"Instance #{len(self.instances)} keys mismatch in {self.name}"
for v in ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testDuplicate(self,permutations=True):\n # This algorithm is faster than encode,\n # but for nplex=2 enmagic2 would probably still be faster.\n if permutations:\n C = self.copy()\n C.sort(axis=1)\n else:\n C = self\n ind = sortByColumns(C)\n ... | [
"0.64221823",
"0.62725854",
"0.6169439",
"0.6140278",
"0.60666955",
"0.6028952",
"0.59893286",
"0.5950086",
"0.5846187",
"0.58433527",
"0.5839482",
"0.58392394",
"0.58291453",
"0.58108467",
"0.58045936",
"0.5784773",
"0.5781221",
"0.5771139",
"0.57415956",
"0.5735265",
"0.567... | 0.6422894 | 0 |
Sets a list of webhook topics for the same target address. | def set_webhooks(
self,
topics: List[str],
address: str,
format: str = "json",
metafield_namespaces: str = None,
private_metafield_namespaces: str = None
):
for each in topics:
params = dict(
topic=each,
address=addr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_webhook(\n self,\n topic: str,\n address: str,\n format: str = \"json\",\n version: str = \"2021-04\",\n metafield_namespaces: str = None,\n private_metafield_namespaces: str = None\n ):\n if topic not in ALL_TOPICS:\n raise TypeError(\"... | [
"0.57152766",
"0.56827545",
"0.5655309",
"0.54852873",
"0.536025",
"0.5280246",
"0.5264144",
"0.5238817",
"0.5237985",
"0.5237473",
"0.5196603",
"0.5186489",
"0.5143624",
"0.512701",
"0.50614136",
"0.5052115",
"0.50493985",
"0.4921148",
"0.4892306",
"0.48920962",
"0.4890296",... | 0.77544063 | 0 |
Resets current selected actions, reward and optimum variables of the Player. Typically used at the start of any run. | def reset(self):
self.player_selected_actions = np.zeros((self.num_actions,), int)
self.player_reward = np.zeros((self.num_timesteps,))
self.player_optimum = np.zeros_like(self.player_reward, dtype=int) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\r\n\t\t# Performs Player superclass reset.\r\n\t\tsuper().reset()\r\n\r\n\t\t# Resets the Q value estimate to the default initial_Q for all actions.\r\n\t\tself.player_Q = np.ones_like(self.player_selected_actions, dtype=float) * self.initial_Q",
"def reset(self):\r\n\t\t# Performs Player superc... | [
"0.7927685",
"0.7927685",
"0.74411565",
"0.7344265",
"0.7262832",
"0.71475285",
"0.710667",
"0.7080993",
"0.7068728",
"0.70190877",
"0.6923594",
"0.690727",
"0.68847734",
"0.6866576",
"0.6863593",
"0.6861664",
"0.68284225",
"0.68099797",
"0.68089426",
"0.6778495",
"0.67172694... | 0.8316216 | 0 |
Update parameters of the Player and performs a full reset of the Player (reset and stored_reset). Parameters that can be updated include num_runs, num_actions, num_timesteps, first_considered_reward_step and any parameter associated with a Player subclass object. | def update_params(self, **kwargs):
# Only resets Player if kwargs contains keyword arguments.
if kwargs:
# Assume that a full reset is not necessary prior to analysing
# kwargs.
to_full_reset = False
for key, value in kwargs.items():
# Ensure that the key corresponds to a valid updating par... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self, **kwargs):\n self.player = None\n self.player_list = list()\n\n self.events.post('mc_reset_phase_1')\n self.events.post('mc_reset_phase_2')\n self.events.post('mc_reset_phase_3')",
"def player_reset(self):\n\n logging.info(\n f\"Player.player_r... | [
"0.67885375",
"0.6768914",
"0.63853073",
"0.63853073",
"0.62770176",
"0.6273355",
"0.6225072",
"0.61682576",
"0.60797715",
"0.6035246",
"0.6019779",
"0.6000464",
"0.59267855",
"0.5831954",
"0.5822047",
"0.57927036",
"0.5770765",
"0.56878793",
"0.5668958",
"0.56678265",
"0.565... | 0.7322754 | 0 |
Resets the Player based on the Player superclass method, but also includes resetting the Q value estimate. Similar to the Player superclass method, typically used at the start of any run. | def reset(self):
# Performs Player superclass reset.
super().reset()
# Resets the Q value estimate to the default initial_Q for all actions.
self.player_Q = np.ones_like(self.player_selected_actions, dtype=float) * self.initial_Q | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self, **kwargs):\n self.player = None\n self.player_list = list()\n\n self.events.post('mc_reset_phase_1')\n self.events.post('mc_reset_phase_2')\n self.events.post('mc_reset_phase_3')",
"def reset(self):\n self.last_round = False\n self.last_player = No... | [
"0.67301285",
"0.66991335",
"0.66798097",
"0.6666841",
"0.6382751",
"0.6360523",
"0.63426226",
"0.632091",
"0.6284623",
"0.62717915",
"0.62696385",
"0.6261351",
"0.62484235",
"0.6238393",
"0.6223089",
"0.6174614",
"0.6157824",
"0.61563545",
"0.6145117",
"0.61428857",
"0.61418... | 0.83313805 | 0 |
Updates the Player based on the Player superclass method, but also includes updating the Q value estimate. Similar to the Player superclass method, typically used at the end of every timestep. Uses the same parameters as the Player superclass. | def update(self, timestep, action, reward, best_action):
# Performs updates based on the Player superclass update method.
super().update(timestep, action, reward, best_action)
# Updates the Q value estimate based on the nature of the step size
# parameter.
if self.step_size_parameter is None:
# Upd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_params(self, **kwargs):\r\n\t\t# Only resets Player if kwargs contains keyword arguments.\r\n\t\tif kwargs:\r\n\t\t\t# Assume that a full reset is not necessary prior to analysing\r\n\t\t\t# kwargs.\r\n\t\t\tto_full_reset = False\r\n\r\n\t\t\tfor key, value in kwargs.items():\r\n\t\t\t\t# Ensure that th... | [
"0.65239024",
"0.63022316",
"0.6153938",
"0.6147981",
"0.6094651",
"0.6094651",
"0.6051621",
"0.59814626",
"0.59468865",
"0.5909017",
"0.588301",
"0.58721393",
"0.5857797",
"0.5856023",
"0.58154404",
"0.5811147",
"0.57896477",
"0.5783527",
"0.5781377",
"0.57559735",
"0.574274... | 0.72308457 | 0 |
Resets the Player based on the Player superclass method, but also includes resetting the Q value estimate. Similar to the Player superclass method, typically used at the start of any run. | def reset(self):
# Performs Player superclass reset.
super().reset()
# Resets the Q value estimate to the default initial_Q for all actions.
self.player_Q = np.ones_like(self.player_selected_actions, dtype=float) * self.initial_Q | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self, **kwargs):\n self.player = None\n self.player_list = list()\n\n self.events.post('mc_reset_phase_1')\n self.events.post('mc_reset_phase_2')\n self.events.post('mc_reset_phase_3')",
"def reset(self):\n self.last_round = False\n self.last_player = No... | [
"0.6727657",
"0.66974413",
"0.66793954",
"0.66646314",
"0.63810194",
"0.6359409",
"0.6340726",
"0.63195854",
"0.62819606",
"0.62700206",
"0.62668645",
"0.62604225",
"0.62486696",
"0.62376493",
"0.62214196",
"0.617289",
"0.6155191",
"0.6155135",
"0.6142722",
"0.6140925",
"0.61... | 0.83304054 | 1 |
Updates the Player based on the Player superclass method, but also includes updating the Q value estimate. Similar to the Player superclass method, typically used at the end of every timestep. Uses the same parameters as the Player superclass. | def update(self, timestep, action, reward, best_action):
# Performs updates based on the Player superclass update method.
super().update(timestep, action, reward, best_action)
# Updates the Q value estimate based on the nature of the step size
# parameter.
if self.step_size_parameter is None:
# Upd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_params(self, **kwargs):\r\n\t\t# Only resets Player if kwargs contains keyword arguments.\r\n\t\tif kwargs:\r\n\t\t\t# Assume that a full reset is not necessary prior to analysing\r\n\t\t\t# kwargs.\r\n\t\t\tto_full_reset = False\r\n\r\n\t\t\tfor key, value in kwargs.items():\r\n\t\t\t\t# Ensure that th... | [
"0.65239066",
"0.63032603",
"0.6155153",
"0.6147414",
"0.6095376",
"0.6095376",
"0.6052002",
"0.5982112",
"0.5946964",
"0.5909957",
"0.58827126",
"0.58719295",
"0.5858522",
"0.5856996",
"0.58168924",
"0.5812062",
"0.5789582",
"0.57842654",
"0.5780534",
"0.57566565",
"0.574347... | 0.7231035 | 1 |
Set loglevel for all treadmill modules | def set_log_level(log_level):
# pylint: disable=consider-iterating-dictionary
# yes, we need to iterate keys
logger_keys = [
lk for lk in logging.Logger.manager.loggerDict.keys()
if '.' not in lk and lk[:9] == 'treadmill'
]
logging.getLogger().setLevel(log_level)
for logger_key ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_log_level(level):\n __log__.setLevel(level)",
"def set_loggers(log_level: int = 0) -> None:\n\n logging.getLogger('requests').setLevel(logging.INFO if log_level <= 1 else logging.DEBUG)\n logging.getLogger('urllib3').setLevel(logging.INFO if log_level <= 1 else logging.DEBUG)\n logging.getLog... | [
"0.7417297",
"0.7379488",
"0.7164858",
"0.71622586",
"0.716013",
"0.7155325",
"0.71458966",
"0.7082803",
"0.7060833",
"0.7045006",
"0.7036214",
"0.70269495",
"0.6999209",
"0.69648945",
"0.69274646",
"0.69192773",
"0.6912224",
"0.6887123",
"0.6799752",
"0.6774565",
"0.6737566"... | 0.80625314 | 0 |
load plugin log conf from various modules | def load_logging_conf(name):
# Shortcut - check if logging already exists.
logconf_path = os.path.join(
os.environ.get('TREADMILL_APPROOT', ''),
'logging',
name
)
if os.path.exists(logconf_path):
with io.open(logconf_path) as f:
return json.loads(f.read())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_logger():\n logging.config.dictConfig(LOGGING)",
"def load():\n return SyslogOutOutputPlugin",
"def _load_logging_file(plugin_name, name):\n import pkg_resources\n\n utf8_reader = codecs.getreader('utf8')\n log_conf_file = utf8_reader(\n pkg_resources.resource_stream(plugin_name,... | [
"0.67765653",
"0.6554534",
"0.64338154",
"0.62319195",
"0.6214265",
"0.61860853",
"0.61772305",
"0.6160944",
"0.6143693",
"0.6137388",
"0.6094451",
"0.6026661",
"0.60258913",
"0.60114056",
"0.60027283",
"0.5989091",
"0.59733725",
"0.5972805",
"0.59547335",
"0.5929312",
"0.591... | 0.6830847 | 0 |
List all defined logging configurations. | def list_logging_conf():
import pkg_resources
configs = set()
for plugin in plugin_manager.load_all(__name__):
configs.update({
cfg for cfg in pkg_resources.resource_listdir(__name__, '.')
if cfg.endswith('.json')
})
return configs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_configurations(ctx):\n config_set = __ensure_configuration_exists(ctx)\n formatter = ConfigSetListFormatter.build(config_set, format='plain')\n out = formatter.format()\n\n click.echo(out)",
"def available_loggers():\n return list(logging.Logger.manager.loggerDict.keys())",
"def list_co... | [
"0.7080317",
"0.65279603",
"0.6527329",
"0.6493259",
"0.643572",
"0.636159",
"0.6316272",
"0.62676394",
"0.62604356",
"0.625639",
"0.62366325",
"0.6218721",
"0.6163993",
"0.61506796",
"0.6122123",
"0.61011463",
"0.6088227",
"0.6087312",
"0.6075647",
"0.60719967",
"0.60462475"... | 0.7941358 | 0 |
Use the rest api to check if an order is open | def rest_open_order(self, orderID):
o = self.client.Order.Order_getOrders(filter=json.dumps({"open": True, "orderID": orderID})).result()
if o[0].__len__():
return o[0][0]
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rest_open_order(self, orderID=None):\n if orderID:\n o = self.client.Order.Order_getOrders(filter=json.dumps({\"open\": True, \"orderID\": orderID})).result()\n else:\n o = self.client.Order.Order_getOrders(filter=json.dumps({\"open\": True}))\n if o:\n ret... | [
"0.70774716",
"0.6966681",
"0.6897799",
"0.68051106",
"0.66603386",
"0.66218126",
"0.66125774",
"0.6561244",
"0.6510378",
"0.6500806",
"0.642141",
"0.63950855",
"0.6287398",
"0.6284869",
"0.62530905",
"0.6234361",
"0.6221804",
"0.617574",
"0.6062104",
"0.60420233",
"0.5986443... | 0.7141044 | 0 |
monitor the websocket for lag and restart if lag is detected, if signals come in while websocket is restarting, then bot will resort to rest api via self.ws_restarting parameter | def monitor_ws(self):
started = False
restart_count = 0
while True:
if not started or self.ws is None:
self.ws = BitMEXWebsocket(endpoint="https://www.bitmex.com/api/v1", symbol=self.strategy.symbol,
api_key=self.api_key, api_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monitor_ws(self, endpoint='https://www.bitmex.com/api/v1'): #TODO: implement\n started = False\n restart_count = 0\n while True:\n if not started or self.ws.exited or self.ws is None:\n self.ws = BitMEXWebsocket(endpoint=endpoint, symbol=self.symbol,\n ... | [
"0.73614126",
"0.6309412",
"0.595059",
"0.5944019",
"0.59311074",
"0.5885894",
"0.586567",
"0.5765681",
"0.57259333",
"0.56546336",
"0.56426543",
"0.56327415",
"0.5630869",
"0.56279796",
"0.5622897",
"0.56213593",
"0.55941254",
"0.5586691",
"0.55748737",
"0.55509716",
"0.5523... | 0.79196155 | 0 |
Construct the EM object corresponding to the specified vendor. | def __init__(self, vendor, generic_config, adapter_config):
self.set_generic_config(**generic_config)
self.em_adapter = construct_adapter(vendor, module_type='em', **adapter_config) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vendor(self, vendor):\n\n self._vendor = vendor",
"def setup_vendor(\n vendor_str,\n bucket=None,\n use_encryption=True,\n ignore_prefix=False,\n profile=None,\n **other\n):\n vendor = vendor_str.lower()\n try:\n vendor = ALIASES[vendor]\n except KeyError:\n ra... | [
"0.6443602",
"0.6166787",
"0.5779186",
"0.5756621",
"0.5719546",
"0.5569656",
"0.5553841",
"0.5517644",
"0.5306806",
"0.5202103",
"0.5197069",
"0.5068234",
"0.506652",
"0.504566",
"0.5044996",
"0.4976304",
"0.49384418",
"0.49314418",
"0.48769754",
"0.48534948",
"0.48517972",
... | 0.6419027 | 1 |
This function is exposed by the EM at the Emtst interface and is used by the Test System to trigger ModifyConfiguration on the VNF from the EM (and through the VNFM). This function is a reexposure of the VNF Configuration Management interface offered by the VNF/VNFM over the VeVnfm reference points. See ETSI GS NFVIFA ... | def modify_vnf_configuration(self, vnf_instance_id, vnf_configuration_data=None, ext_virtual_link=None,
vnfc_configuration_data=None):
return self.em_adapter.modify_vnf_configuration(vnf_instance_id, vnf_configuration_data, ext_virtual_link,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_func(config_old, config_new):\n\n # This is an example of a firmware upgrade requiring a configuration migration\n \n # Firmware 00.05.XX to 00.06.XX configuration migration.\n # NOTE: This example assumes that the advanced bit-rate (bit-timing) setting is not used\n\n config_new = conf... | [
"0.6424253",
"0.5883528",
"0.5832548",
"0.5803905",
"0.5792312",
"0.57719773",
"0.57702446",
"0.5756364",
"0.56825936",
"0.5677728",
"0.5652082",
"0.56172705",
"0.5587201",
"0.55492836",
"0.5547896",
"0.5518183",
"0.54852474",
"0.54742813",
"0.54489917",
"0.5403628",
"0.53854... | 0.70188683 | 0 |
This function is exposed by the EM at the Emtst interface and is used by the Test System to trigger VNF scale operation and check results at the EM. This function scales a VNF horizontally (out/in). This function is a reexposure of the VNF Lifecycle Management interface at the VeVnfmem reference point. See ETSI GS NFVI... | def vnf_scale(self, vnf_instance_id, scale_type, aspect_id, number_of_steps=1, additional_param=None):
return self.em_adapter.vnf_scale(vnf_instance_id, scale_type, aspect_id, number_of_steps, additional_param) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _call_scale(vecObj, sc):\n res = vecObj.scale(sc)\n return res",
"def scale(self):",
"def verticalScaleIncrease(self):\n scaleFac = float(self.qline4.text())\n self.qline4.setText(str(scaleFac * 2))\n self.model.refreshScreen()",
"def scale(self, up):\n s = 1.1 if up els... | [
"0.62913805",
"0.61345226",
"0.59601223",
"0.5883413",
"0.5786027",
"0.5762792",
"0.5724653",
"0.5712696",
"0.5712486",
"0.56960535",
"0.5693303",
"0.56557405",
"0.55952173",
"0.5524789",
"0.5497013",
"0.549634",
"0.5480721",
"0.5480076",
"0.5453029",
"0.54494715",
"0.5434116... | 0.6241293 | 1 |
Save the histogram and its properties in a npz file | def save(self, filename):
if not os.path.isdir( os.path.dirname(filename) ):
self.logger.critical('%s does not exist'%os.path.dirname(filename))
raise FileNotFoundError
try:
fit_func = 'NoneType' if not self.fit_function else self.fit_function.__name__
np.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_hist(self, file_name):\n file_ext = file_name.split(\".\")[-1]\n assert file_ext == \"npy\", \"The file extension has to be npy (numpy file)\"\n np.save(file_name, self.hist)",
"def save_histogram_data(self, histogram_data, obj_name):\n dirname = os.path.dirname(os.path.abspa... | [
"0.71867526",
"0.70626557",
"0.7017196",
"0.70088106",
"0.6667355",
"0.66330504",
"0.6574414",
"0.6519371",
"0.64562464",
"0.6433873",
"0.62954587",
"0.62861025",
"0.6282882",
"0.6270514",
"0.62624353",
"0.62120754",
"0.6199626",
"0.6182045",
"0.6174208",
"0.6165592",
"0.6158... | 0.70737016 | 1 |
Function to retreive the bin number | def find_bin(self, x):
return (x - self.bin_edges[0]) // self.bin_width | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBinIndex(self, x):\n\t\tb = -1\n\t\tif x == self._max_val: # final bin is [low, high], where others are [low,high)\n\t\t\tb = len(self._bins)-1\n\t\telse:\n\t\t\tb = math.floor((x-self._min_val)/self._bin_width)\n\t\treturn int(b)",
"def get_bin(x, n=0):\n return format(x, 'b').zfill(n)",
"def get_bi... | [
"0.756075",
"0.71849936",
"0.7154794",
"0.70585626",
"0.70246756",
"0.69715875",
"0.6932861",
"0.6929739",
"0.6837561",
"0.67998797",
"0.67592144",
"0.669569",
"0.6684878",
"0.66757673",
"0.661859",
"0.65625226",
"0.65551496",
"0.65463084",
"0.65427136",
"0.65268064",
"0.6524... | 0.7280951 | 1 |
Accessor for topology. This function retrieves topology from the server as a list of road segments as pairs of waypoint objects, and processes the topology into a list of dictionary objects. | def get_topology(self):
topology = []
# Retrieving waypoints to construct a detailed topology
for segment in self._wmap.get_topology():
x1 = segment[0].transform.location.x
y1 = segment[0].transform.location.y
x2 = segment[1].transform.location.x
y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topology(self) -> List[Topology]:\n return self._topology",
"def topology(self):\n return self._topology",
"def topology(self):\n return self._h5[TOPOLOGY][()]",
"def get_topology(odl_url, odl_usr, odl_pass):\n if odl_url.endswith('/'):\n odl_url = odl_url[:-1]\n topolog... | [
"0.636812",
"0.61905444",
"0.6013915",
"0.5730167",
"0.55567867",
"0.551303",
"0.54704964",
"0.5465589",
"0.53611004",
"0.53493327",
"0.5213731",
"0.51869893",
"0.5132174",
"0.50400406",
"0.50259393",
"0.5021925",
"0.49883884",
"0.49612585",
"0.49448407",
"0.49364305",
"0.493... | 0.7202825 | 0 |
Recover an list of item according to a pattern id retrieved by listpatterns method | def getitemsbypattern(self, pattern):
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_knitting_patterns_by_ids(self, ids_list):\n ids_string = ''\n\n for i in ids_list:\n ids_string = '{}, {}'.format(ids_string, i)\n\n ids_string = ids_string[1:] \n\n params = {\n \"ids\" : ids_string,\n \"craft\" : \"knitting\"\n }\n\n ... | [
"0.5939668",
"0.5890393",
"0.586018",
"0.58466846",
"0.55761737",
"0.55570734",
"0.54914767",
"0.54500127",
"0.54500127",
"0.54500127",
"0.5429458",
"0.54239345",
"0.534361",
"0.5338712",
"0.5329596",
"0.5321798",
"0.526911",
"0.5244883",
"0.5229335",
"0.52082",
"0.51975065",... | 0.67687434 | 0 |
Parse the provided commit message and return an array of problem identifiers that have been fixed. | def locate_fixed_problems(commit_message):
identifiers = set()
commit_message = commit_message.strip()
lines = commit_message.splitlines()
match_urls = True
for line in lines:
ids = identifiers_from_line(line, match_urls)
if len(ids) == 0:
match_urls = Fals... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_commit_message(message):\n # ['closes', 'close', 'fix', ...]\n keywords = []\n [keywords.extend(val) for val in KEYWORDS.values()]\n # we need to sort to match longuest command possible\n keywords.sort(lambda x, y: cmp(len(y), len(x)))\n # 'closes|close|fix...'\n keywords_re = '|'.jo... | [
"0.68951225",
"0.58136165",
"0.5794153",
"0.57117003",
"0.5585164",
"0.5564257",
"0.5515667",
"0.5413323",
"0.53617334",
"0.5349822",
"0.5347324",
"0.5335515",
"0.53326064",
"0.53308296",
"0.526027",
"0.52450615",
"0.5195016",
"0.5193949",
"0.51831806",
"0.5180323",
"0.517877... | 0.7625704 | 0 |
Shells out to git(1), and locates the commits between start and end within repo_path. Returns a list of Commit objects for each commit in the range given. | def commits_between(repo_path, start, end):
git = subprocess.Popen(["git", "log", "%s..%s" % (start, end)], stdout=subprocess.PIPE, cwd=repo_path)
log = git.stdout.read().decode("utf-8")
cur = None
commits = []
for line in log.splitlines():
cm = re.match(r'commit ([a-f0-9]{40}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commits_in_range(self, revision_start, revision_end):\n revision_range = revision_start + '..' + revision_end\n output = self.run(\n ['git', 'rev-list', '--pretty=oneline', revision_range])\n commits = []\n for line in output.splitlines():\n # Split at the firs... | [
"0.7568852",
"0.71092194",
"0.7074235",
"0.66874045",
"0.6632878",
"0.6599274",
"0.6252481",
"0.62169653",
"0.621228",
"0.6012338",
"0.5848484",
"0.5825941",
"0.5750245",
"0.57368284",
"0.57110775",
"0.5701161",
"0.5697965",
"0.554039",
"0.5535404",
"0.5516413",
"0.5487601",
... | 0.77835447 | 0 |
Batch entropy of logits of shape [... x num_logits]. | def categ_batch_entropy(logits):
logits = tf.reshape(logits, [-1, logits.shape[-1].value])
mean_probs = tf.reduce_mean(tfd.Categorical(logits).probs, axis=0)
return - tf.reduce_sum(mean_probs * tf.log(mean_probs + 1e-30), axis=-1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logit_entropy(logits):\n # We support either:\n # - 1D list of logits\n # - A 2D list, batch size x logits\n assert len(logits.shape) <= 2\n # keepdims=True is necessary so that we get a result which is\n # batch size x 1 instead of just batch size\n logp = logits - tf.reduce_logsumexp(log... | [
"0.7909235",
"0.71882784",
"0.6994014",
"0.669817",
"0.6688508",
"0.6650155",
"0.6617079",
"0.6557628",
"0.6547111",
"0.6547111",
"0.6494878",
"0.64854825",
"0.6482859",
"0.6433548",
"0.64330524",
"0.64080656",
"0.6405705",
"0.6405494",
"0.6401852",
"0.64008105",
"0.6372565",... | 0.76391613 | 1 |
Return a Yices String representing the given pySMT logic. | def yices_logic(pysmt_logic):
ylogic = str(pysmt_logic)
if ylogic == "QF_BOOL":
ylogic = "NONE"
return ylogic | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logic_program_form(self):\r\n return '% -------------------------------------\\n' +\\\r\n '% Theory ' + self.name + '\\n' +\\\r\n '% -------------------------------------\\n\\n' +\\\r\n GENERAL_AXIOMS",
"def logic_program_form(self):\r\n s = ''\r\n ... | [
"0.62014735",
"0.606736",
"0.59748554",
"0.5924965",
"0.58945024",
"0.5881407",
"0.58732706",
"0.5744191",
"0.5730173",
"0.5689957",
"0.5673435",
"0.56425935",
"0.5622357",
"0.5577381",
"0.5539573",
"0.54892117",
"0.54863834",
"0.54485565",
"0.5437061",
"0.54344344",
"0.54099... | 0.677988 | 0 |
After a call to solve() yielding UNSAT, returns the unsat core as a dict of names to formulae | def get_named_unsat_core(self):
if self.options.unsat_cores_mode is None:
raise SolverNotConfiguredForUnsatCoresError
if self.last_result is not False:
raise SolverStatusError("The last call to solve() was not" \
" unsatisfiable")
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_named_unsat_core(self):\n if self.options.unsat_cores_mode is None:\n raise SolverNotConfiguredForUnsatCoresError\n\n if self.last_result is not False:\n raise SolverStatusError(\"The last call to solve() was not\" \\\n \" unsatisfiable... | [
"0.7151089",
"0.6253496",
"0.6253496",
"0.57105905",
"0.54076594",
"0.5346823",
"0.53426343",
"0.53031605",
"0.5271458",
"0.5252732",
"0.5247248",
"0.5245722",
"0.5221663",
"0.5160494",
"0.5159359",
"0.51163274",
"0.5076806",
"0.5043931",
"0.50153726",
"0.50065917",
"0.496032... | 0.71991855 | 0 |
Convert a Yices expression back into a pySMT expression. | def back(self, expr, model=None):
if expr in self._yices2pysmt:
return self._yices2pysmt[expr]
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interm_to_smt2_expr(expr, env=None):\n assert isinstance(expr, Expression)\n CODE_SMT = ExprTranslator.apply(expr)\n return ProgramSmt2([CODE_SMT])",
"def reconstructY(self, inputs):\n if self.act_dec is None:\n act_dec = lambda x: x\n else:\n act_dec = self.act_d... | [
"0.61883765",
"0.60296005",
"0.5956401",
"0.5223984",
"0.5221168",
"0.52152973",
"0.5208775",
"0.51623577",
"0.5157018",
"0.5115472",
"0.510989",
"0.50814354",
"0.5077802",
"0.50336796",
"0.50196713",
"0.49950975",
"0.49521714",
"0.49446702",
"0.49392343",
"0.4907591",
"0.487... | 0.6567182 | 0 |
Bounds the variables in formula. Returns a tuple (new_formula, new_var_list) in which the old variables have been replaced by the new variables in the list. | def _rename_bound_variables(self, formula, variables):
new_vars = [self._bound_symbol(x) for x in variables]
old_vars = [self.walk_symbol(x) for x in variables]
new_formula = yicespy.yices_subst_term(len(variables), yicespy.make_term_array(new_vars),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_occuring_variables(formula,variables_to_consider,allowed_variables) :\n variable_set=set(allowed_variables)\n for clause in formula :\n variables_in_clause = {abs(l) for l in clause if abs(l) in variables_to_consider}\n if not variables_in_clause <= variable_set:\n return False, [v for v in ... | [
"0.5877155",
"0.5828667",
"0.5643589",
"0.56074995",
"0.5544756",
"0.5446839",
"0.54266375",
"0.540049",
"0.52934396",
"0.52764535",
"0.5275413",
"0.5272243",
"0.52428776",
"0.51679504",
"0.5162843",
"0.5141705",
"0.5139646",
"0.5126008",
"0.51069546",
"0.51050544",
"0.509448... | 0.69548506 | 0 |
Return the yices Sort for the given name. | def yicesSort(self, name):
name = str(name)
try:
return self._yicesSort[name]
except KeyError:
sort = yicespy.yices_new_uninterpreted_type()
self._yicesSort[name] = sort
return sort | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_sort_by_name_ascendant(self):\n msg = \"The new order of the items is by ascendant name\"\n with self.allure.step(msg):\n self.__product_sort.select_by_text('Name (A to Z)')\n self.allure.attach_image(self.driver, msg)",
"def sort_by_name(self):\n # sort_by_n... | [
"0.6208319",
"0.61897",
"0.6068596",
"0.60552937",
"0.6051539",
"0.5996636",
"0.5967185",
"0.5892825",
"0.5877872",
"0.5851732",
"0.57803917",
"0.5762835",
"0.57413083",
"0.57134265",
"0.56733364",
"0.5667565",
"0.5640422",
"0.56211984",
"0.56094944",
"0.5606411",
"0.5592871"... | 0.8395888 | 0 |
Return the yices EnumSort for the given name. | def yicesEnumSort(self, name, value):
key = str(name)
try:
return self._yicesEnumSort[key][0]
except KeyError:
sort = yicespy.yices_new_scalar_type(len(value))
sortvalues = []
for i in range(len(value)):
lhs = str(value[i])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yicesSort(self, name):\n name = str(name)\n try:\n return self._yicesSort[name]\n except KeyError:\n sort = yicespy.yices_new_uninterpreted_type()\n self._yicesSort[name] = sort\n return sort",
"def tenum(name, vals):\n\n if isinstance(vals, bas... | [
"0.7609963",
"0.589033",
"0.5835212",
"0.57860774",
"0.5753377",
"0.56176436",
"0.56006116",
"0.5560994",
"0.55155605",
"0.5423769",
"0.53936815",
"0.53725404",
"0.53691125",
"0.5356705",
"0.53469497",
"0.5331938",
"0.52929187",
"0.52641493",
"0.52285933",
"0.52111757",
"0.51... | 0.8267941 | 0 |
tests if sentence contains a word in the wordlist | def match(self, sentence) -> bool:
for word in self.word_list:
if word.lower() in sentence.lower():
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_word(words, word):\r\n if word in words:\r\n return True\r\n else:\r\n return False",
"def check_words(title, wordlist, verbose=False):\n\tfor word in wordlist:\n\t\tif title.find(word) >= 0:\n\t\t\tif verbose:\n\t\t\t\tprint(\"\\t\\tFOUND '\"+word+\"' IN:\", title)\n\t\t\treturn Tr... | [
"0.7722893",
"0.76752436",
"0.75732464",
"0.7551399",
"0.7463943",
"0.7463943",
"0.7463943",
"0.7405517",
"0.73894894",
"0.7206948",
"0.7145627",
"0.71257436",
"0.7120852",
"0.7107858",
"0.6995455",
"0.6987601",
"0.69658506",
"0.6918556",
"0.6901736",
"0.6859819",
"0.6829926"... | 0.8025514 | 0 |
test if sentence matches a full or partial word, but not a not word | def match(self, sentence) -> bool:
if (any(word[0] in sentence.lower() for word in self.word_list if word[1] == "partial") or any(
word[0].lower() == sentence.lower() for word in self.word_list if word[1] == "full")) and not any(
word[0] in sentence.lower() for word in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_word_not(text):\n return text.strip() == 'not'",
"def substring_match(recipe, word):\n if names_only:\n line = recipe.name\n else:\n line = str(recipe)\n\n if not case:\n word = word.lower()\n line = line.lower()\n\n return line... | [
"0.7004962",
"0.6858748",
"0.68342656",
"0.67009854",
"0.6636463",
"0.66354656",
"0.66077316",
"0.65880203",
"0.6583608",
"0.656416",
"0.65482354",
"0.6531005",
"0.6517633",
"0.65096074",
"0.6455604",
"0.6451215",
"0.6446208",
"0.6426749",
"0.6421576",
"0.6373186",
"0.6365616... | 0.7749148 | 0 |
returns true if building is placeable at pos, else false | def building_isplaceable(self, building, pos):
x_pos, y_pos = pos
m = building.mask_full()
y_size, x_size = m.shape
if x_pos + x_size > AIV_SIZE or y_pos + y_size > AIV_SIZE:
return False
for x in range(0,x_size):
for y in range(0,y_size):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isPositionInRoom(self, pos):\n if pos in self.tiles:\n return True\n else:\n return False",
"def _can_place(self, loc):\n non_blocks = [_AIR, _WATER, _LAVA]\n player = [self._pos, self._pos + _Vec3(0, 1, 0)]\n for dir_ in _adj_dirs + [_Vec3(0, 1, 0), _... | [
"0.69598156",
"0.69421697",
"0.6878886",
"0.685575",
"0.67933196",
"0.67796236",
"0.6751459",
"0.6727748",
"0.6723218",
"0.66230464",
"0.66161877",
"0.66148025",
"0.66137296",
"0.6579545",
"0.65682584",
"0.65298176",
"0.6518893",
"0.651155",
"0.65102607",
"0.64806265",
"0.647... | 0.716373 | 0 |
places building at pos with pause, does nothing if building is not placable | def building_place(self, building, pos, pause=False):
if not self.building_isplaceable(building, pos):
return
x_pos, y_pos = pos
# all future steps +1
for x in range(0, AIV_SIZE):
for y in range(0, AIV_SIZE):
if (self.bmap_step[y, x] >= s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_buildings(self):",
"def place_building(self, building):\n if self.environment.grid.is_cell_empty(building.pos):\n self.environment.grid.place_agent(building, building.pos)\n self.environment.agents['residences'].append(building)\n else:\n try:\n ... | [
"0.63600856",
"0.6258558",
"0.60359925",
"0.5988893",
"0.5929227",
"0.5911008",
"0.5888564",
"0.5828456",
"0.5728379",
"0.5718982",
"0.57092506",
"0.57061243",
"0.56950647",
"0.5675169",
"0.56746465",
"0.5644606",
"0.56289035",
"0.56059235",
"0.56031656",
"0.555743",
"0.55550... | 0.7207601 | 0 |
removes building placed at pos | def building_remove(self, pos):
x, y = pos
step = self.bmap_step[y,x]
if step == 0:
return
for x in range(0,AIV_SIZE):
for y in range(0,AIV_SIZE):
if (self.bmap_step[y,x] == step):
self.bmap_step[y,x] = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeIfDead(self):\n if self.y < 0:\n del projectiles[findPlace(self, projectiles)]",
"def remove_pos(self):\r\n selected_items = self.treeview.selection()\r\n for items in selected_items:\r\n values = self.treeview.item(items, 'values')\r\n if values[0]... | [
"0.6693598",
"0.65811896",
"0.6406837",
"0.6351213",
"0.6280977",
"0.6223392",
"0.622173",
"0.6203216",
"0.61993384",
"0.6186201",
"0.6151671",
"0.6138891",
"0.6054233",
"0.60505754",
"0.60432374",
"0.60303444",
"0.5995092",
"0.5985748",
"0.5971482",
"0.59708905",
"0.5967626"... | 0.74935937 | 0 |
places troop at pos | def troop_place(self, troop, pos):
x, y = pos
self.tmap[y, x] = troop
tile_id = AIV_SIZE * y + x
print(10*troop)
for slot in range(10 * troop, 10 * (troop+1)):
if self.tarr[slot]== 0:
self.tarr[slot] = tile_id
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_to_position2(self):",
"def move_to_position1(self):",
"def place(placement: str):\n Robot.place(placement)",
"def place_goal(self, point = \"random\"):\n if point != \"random\":\n self.maze[point[0]][point[1]] = self.goal_value\n self.goal_position = tuple([point[0],p... | [
"0.64251316",
"0.636119",
"0.61575276",
"0.6102893",
"0.60633576",
"0.6005838",
"0.5976706",
"0.5975634",
"0.59755576",
"0.59528005",
"0.59332687",
"0.58925927",
"0.57779956",
"0.5756049",
"0.57527",
"0.5743293",
"0.5738759",
"0.573769",
"0.57347894",
"0.5723453",
"0.57222986... | 0.7567367 | 0 |
removes troop at pos | def troop_remove(self, pos):
x, y = pos
# tile_id = AIV_SIZE * y + x
troop = self.tmap[y, x]
if (troop == 0):
return
# update tmap
self.tmap[y, x] = 0
# first remove thing from tarr, then find something new in tmap
# for sl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self,pos):\n pos.next = pos.next.next",
"def remove():",
"def building_remove(self, pos):\n x, y = pos\n step = self.bmap_step[y,x]\n\n if step == 0:\n return\n\n for x in range(0,AIV_SIZE):\n for y in range(0,AIV_SIZE):\n if (s... | [
"0.6689739",
"0.6675071",
"0.65882707",
"0.65590334",
"0.6428142",
"0.64276046",
"0.6408341",
"0.63639593",
"0.63227624",
"0.631509",
"0.630923",
"0.62942326",
"0.6270247",
"0.6265951",
"0.6254995",
"0.62523973",
"0.62419504",
"0.622547",
"0.62165946",
"0.62106955",
"0.619811... | 0.78317654 | 0 |
builds a wall of type from pos1 to pos2 with thickness | def build_wall(self, type, pos1, pos2, thickness=1):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_boundary_wall(self, height, width) -> None:\n for x in range(0, width):\n Wall(self, x, 0)\n Wall(self, x, height - 1)\n for y in range(1, height - 1):\n Wall(self, 0, y)\n Wall(self, width - 1, y)",
"def add_walls(self):\n for x in range(... | [
"0.6652816",
"0.6530705",
"0.6497158",
"0.6430438",
"0.6359166",
"0.62932396",
"0.6252796",
"0.6150248",
"0.61410415",
"0.6075788",
"0.6074455",
"0.60314775",
"0.60010916",
"0.59678346",
"0.59656036",
"0.5935086",
"0.59339607",
"0.5909519",
"0.58775026",
"0.5872708",
"0.58670... | 0.877552 | 0 |
builds stairs from pos1 with height to pos2; extended also builds the 6th stair | def build_stairs(self, pos1, pos2, height, extendend = False):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stairs(x, y, length, blueness):\n color = (0, 0.5*blueness, blueness)\n if length>3:\n penup()\n goto(x, y)\n pendown()\n fillcolor(color)\n begin_fill()\n square(length)\n end_fill()\n stairs(x, y+length, length/2, blueness/1.25)\n stairs(x+... | [
"0.59213537",
"0.5730924",
"0.5600649",
"0.5567194",
"0.55222636",
"0.54645634",
"0.5406177",
"0.53234625",
"0.51944",
"0.5179853",
"0.51700884",
"0.5168403",
"0.51683027",
"0.5167756",
"0.5164616",
"0.51390946",
"0.5133047",
"0.5126641",
"0.5106857",
"0.5099314",
"0.5093502"... | 0.8246664 | 0 |
merges steps into the steps with the lowest number | def merge_steps(self, steps):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stage1(self):\n n = self.min\n while True:\n n, bin_ = self.sort_to_bin(n)\n if n is None:\n n = self.get_new_n(bin_)\n if n is None:\n break\n if self.viz:\n yield",
"def get_next_steps(self, steps... | [
"0.57471377",
"0.5562235",
"0.5537756",
"0.5376745",
"0.53701097",
"0.5365862",
"0.52793205",
"0.5239232",
"0.52255756",
"0.5206005",
"0.5202807",
"0.51601505",
"0.5144697",
"0.5136471",
"0.51265377",
"0.5107818",
"0.50958174",
"0.5094482",
"0.5065117",
"0.5062962",
"0.504582... | 0.6262804 | 0 |
returns mask for bmap_tile | def mask_tile(self):
if self.size == 1:
m = np.array([[0]])
elif self.size ==2:
m = np.array([[1,2],[4,3]])
else:
m = 9 * np.ones((self.size, self.size))
m[0,0] = 1
m[0,-1] = 2
m[-1,-1] = 3
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_binary_mask(self,index):\n mask = self.load_mask_png(index)\n (rows,cols) = np.where(mask>0)[0:2] #pixels in mask disregarding the color\n new_mask = np.zeros(shape=mask.shape[0:2], dtype=np.uint8)\n new_mask[(rows,cols)] = 255\n return new_mask",
"def _mask(self, map_)... | [
"0.68030757",
"0.6597235",
"0.64020073",
"0.63684136",
"0.636295",
"0.6307365",
"0.62979585",
"0.62321377",
"0.62078494",
"0.6204927",
"0.62012064",
"0.61955607",
"0.61827964",
"0.6167925",
"0.61083657",
"0.6076602",
"0.60515094",
"0.603599",
"0.603599",
"0.603599",
"0.603599... | 0.6715494 | 1 |
returns mask for bmap_size | def mask_size(self):
m = self.size * self.mask()
return m.astype(np.int8) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _modify_map_size(self, merged_map):\n pos_x_white, pos_y_white = np.where(merged_map == 255)\n pos_x_black, pos_y_black = np.where(merged_map == 0)\n\n pos_x_M = np.amax(np.hstack((pos_x_black, pos_x_white)))\n pos_x_m = np.amin(np.hstack((pos_x_black, pos_x_white)))\n pos_y_... | [
"0.6193336",
"0.6103328",
"0.60384744",
"0.5995964",
"0.5965488",
"0.59573275",
"0.5923458",
"0.5921077",
"0.58160436",
"0.58096987",
"0.57979405",
"0.5764964",
"0.5760093",
"0.57463944",
"0.5730128",
"0.5718431",
"0.56881696",
"0.5681048",
"0.56538427",
"0.56254137",
"0.5623... | 0.70576715 | 0 |
Run Jacobi algorithm to diagonalize symmetric matrix. | def jacobi_diagonalization(M, max_iter=1000, verbose=False):
A = np.copy(M)
n = A.shape[0]
trajectory = []
for it in range(max_iter):
diag_A = np.diag(A)
A[np.arange(n), np.arange(n)] = 0
p, q = max_abs_idx(A)
A[np.arange(n), np.arange(n)] = diag_A
c, s = compute... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jacobi(inv_diag: sparse.dia_matrix, lower_upper: sparse.dia.dia_matrix,\n b: np.ndarray, min_iter: int = 10, max_iter: int = 20, TOL = 0.001):\n x = b.copy()\n for i in range(min_iter):\n x = inv_diag @ (b - lower_upper @ x)\n \n for i in range(max_iter - min_iter):\n x... | [
"0.65458184",
"0.65215915",
"0.62391186",
"0.6096284",
"0.60770935",
"0.5979991",
"0.5963886",
"0.5961214",
"0.5884774",
"0.58699703",
"0.57684314",
"0.5725163",
"0.5719469",
"0.5671948",
"0.56443053",
"0.56403714",
"0.56045103",
"0.5555194",
"0.5532265",
"0.5508106",
"0.5507... | 0.7252654 | 0 |
Finds angle that minimizes Givens rotation in subspace (i,j). | def minimize_frobenius_subspace(U, i, j):
u_ii = U[i, i]
u_ij = U[i, j]
u_ji = U[j, i]
u_jj = U[j, j]
g = lambda alpha : -2 * ((u_ii + u_jj) * np.cos(alpha) + (u_ij - u_ji) * np.sin(alpha))
alpha = np.arctan2(u_ij - u_ji, u_ii + u_jj)
alpha_shifted = alpha - np.sign(alpha) * np.pi
if g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle_peaks(self, i, j):\n g1 = norm_vec(self.Gvec(self.xp[i], self.yp[i], self.zp[i]))\n g2 = norm_vec(self.Gvec(self.xp[j], self.yp[j], self.zp[j]))\n return np.around(np.arccos(float(g1.T*g2)) * degrees, 3)",
"def index_to_angle(i):\n return -135.0 + (i / 1081.0) * 0.25",
"def Ho... | [
"0.61956495",
"0.5928302",
"0.59179556",
"0.5873517",
"0.57913995",
"0.57579696",
"0.5714722",
"0.56798893",
"0.5673125",
"0.56543744",
"0.5654022",
"0.56531966",
"0.5631712",
"0.5619218",
"0.561369",
"0.55928063",
"0.5586454",
"0.5548546",
"0.5513429",
"0.54990697",
"0.54963... | 0.63661486 | 0 |
Generates a random sequence of n Givens factors in d dimensions, where the Givens angles are drawn uniformly from [pi,pi]. If replace is True the subspaces are sampled with replacement otherwise not. | def random_planted_matrix(d, n, replace='True'):
all_idx = np.asarray(list(zip(*np.tril_indices(d,-1))))
chosen_idx_positions = np.random.choice(len(all_idx), size=n, replace=replace)
subspaces = all_idx[chosen_idx_positions]
angles = 2*np.pi * (np.random.rand(len(subspaces)) - 0.5)
U = np.eye(d)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Generate_Ginibre(n):\n G_real = np.random.normal(scale= np.sqrt(1/(2*n)), size=[n,n])\n G_im = np.random.normal(scale= np.sqrt(1/(2*n)), size=[n,n]) * complex(0,1)\n G = G_real + G_im\n return G",
"def rg(self, d=3, n=20):\n\n RG = nx.random_graphs.random_regular_graph(d, n)\n retur... | [
"0.62676924",
"0.59859097",
"0.59496826",
"0.5851699",
"0.5818886",
"0.5799751",
"0.5763621",
"0.5757867",
"0.5737094",
"0.5703747",
"0.5696938",
"0.56821245",
"0.5679375",
"0.5670225",
"0.56460977",
"0.5583334",
"0.5574868",
"0.5567993",
"0.555292",
"0.55380654",
"0.5535247"... | 0.7204504 | 0 |
End Conversation by InlineKeyboard. | def end(update, context) -> int:
update.callback_query.edit_message_text(
'Bye! I hope we can talk again some day.')
logger.info("User [%s] exited the conversation, [Exit], from [Main Menu / Results State].",
update.callback_query.message.chat.first_name)
return ConversationHandler.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endMessage(self):",
"def end(update: Update, context: CallbackContext) -> int:\n update.callback_query.answer()\n\n text = \"See you around!\"\n update.callback_query.edit_message_text(text=text)\n\n return END",
"def end(update, context):\n query = update.callback_query\n bot = context.b... | [
"0.69865876",
"0.6973438",
"0.68213534",
"0.66304886",
"0.61615235",
"0.60839623",
"0.6069418",
"0.6066864",
"0.6059899",
"0.6048676",
"0.5969928",
"0.595569",
"0.594251",
"0.5929114",
"0.5924612",
"0.5903801",
"0.58803385",
"0.5869796",
"0.5862226",
"0.583221",
"0.5808793",
... | 0.71500057 | 0 |
End Conversation by command, /stop. | def stop(update, context) -> None:
update.message.reply_text('Okay, bye.')
logger.info("User [%s] canceled conversation using command [/stop].",
update.message.from_user.first_name)
return END | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop(update, context):\n\n update.message.reply_text(\n config.messages['stop'],\n reply_markup=ReplyKeyboardRemove())\n\n logger.info(f'{update.message.from_user.full_name}: stop')\n\n # clear cache\n context.user_data.clear()\n\n return ConversationHandler.END",
"def stop(self)... | [
"0.6944882",
"0.68855196",
"0.665506",
"0.6576726",
"0.6544538",
"0.65385246",
"0.65183944",
"0.6486657",
"0.6477054",
"0.64704984",
"0.64567894",
"0.64277023",
"0.64273757",
"0.64197487",
"0.6331442",
"0.63195616",
"0.6311176",
"0.6311176",
"0.62933475",
"0.62311274",
"0.620... | 0.73626995 | 0 |
Completely end conversation from within nested conversation by command, /stop. | def stop_nested(update, context):
update.message.reply_text('Okay, bye.')
logger.info("User [%s] canceled conversation within nested using command [/stop].",
update.message.from_user.first_name)
return STOPPING | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop(update, context) -> None:\n update.message.reply_text('Okay, bye.')\n\n logger.info(\"User [%s] canceled conversation using command [/stop].\",\n update.message.from_user.first_name)\n return END",
"def stop(update, context):\n\n update.message.reply_text(\n config.mess... | [
"0.74252063",
"0.67726016",
"0.6479838",
"0.63667774",
"0.6243147",
"0.61980194",
"0.61872613",
"0.61744773",
"0.6128704",
"0.61268866",
"0.61176383",
"0.60804325",
"0.6076494",
"0.6063793",
"0.6007844",
"0.59601426",
"0.59601426",
"0.5948303",
"0.5938749",
"0.59248614",
"0.5... | 0.77043283 | 0 |
End Second level conversation, add_filter, and Return to First level conversation. | def end_filter_selection(update, context):
context.user_data['START_OVER'] = True
start(update, context)
logger.info("User [%s] selected to return to previous menu, [Main Menu], "
"from [Add Filter / Show Filters]",
update.callback_query.message.chat.first_name)
return S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end(update, context) -> int:\n update.callback_query.edit_message_text(\n 'Bye! I hope we can talk again some day.')\n\n logger.info(\"User [%s] exited the conversation, [Exit], from [Main Menu / Results State].\",\n update.callback_query.message.chat.first_name)\n return Convers... | [
"0.61874306",
"0.58758193",
"0.5396063",
"0.5229586",
"0.5209735",
"0.520134",
"0.51906264",
"0.518927",
"0.5108428",
"0.5048686",
"0.5047585",
"0.5041993",
"0.50342107",
"0.49853578",
"0.49816087",
"0.49747455",
"0.49464867",
"0.4933484",
"0.4929137",
"0.49254668",
"0.491540... | 0.62463814 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.