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 |
|---|---|---|---|---|---|---|
Loads volume mesh using meshio. Not meant for mixed shape meshes. | def load_volume_mesh(fname):
fname = abs_fname_(fname)
m = meshio.read(fname)
mesh = Mesh()
mesh.vertices = m.points
for i, c in enumerate(m.cells):
if i == 0:
elements = c.data
else:
elements = np.vstack((elements, c.data))
mesh.elements = elements
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read(self, mesh_path: str) -> None:\n\n reader = VtuReader(mesh_path)\n self.set_mesh_data(mesh=reader.mesh, bc=reader.bc, mpc=reader.mpc)",
"def load_volume_mixd(dim, fname=None, mxyz=None, mien=None, hexa=False):\n vertices, elements = mixd_load_(fname, mxyz, mien)\n\n mesh = Mesh()\n ... | [
"0.70592856",
"0.6962647",
"0.69257474",
"0.6415933",
"0.6392293",
"0.6390476",
"0.6343733",
"0.6273749",
"0.6219491",
"0.620209",
"0.609297",
"0.60837203",
"0.6062914",
"0.6002005",
"0.5998866",
"0.5905394",
"0.586846",
"0.585365",
"0.5845951",
"0.580518",
"0.57808256",
"0... | 0.7867217 | 0 |
Loads mixd volume meshes. | def load_volume_mixd(dim, fname=None, mxyz=None, mien=None, hexa=False):
vertices, elements = mixd_load_(fname, mxyz, mien)
mesh = Mesh()
mesh.vertices = vertices.reshape(-1, dim)
if hexa:
mesh.elements = elements.reshape(-1, 8)
else:
mesh.elements = elements.reshape(-1, 4)
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_volume_mesh(fname):\n fname = abs_fname_(fname)\n\n m = meshio.read(fname)\n mesh = Mesh()\n mesh.vertices = m.points\n\n for i, c in enumerate(m.cells):\n if i == 0:\n elements = c.data\n else:\n elements = np.vstack((elements, c.data))\n\n mesh.eleme... | [
"0.6619064",
"0.6575824",
"0.5888349",
"0.5782488",
"0.5687946",
"0.56595165",
"0.55847037",
"0.5549612",
"0.5535285",
"0.54974794",
"0.5464577",
"0.54594773",
"0.54511726",
"0.5433815",
"0.5415109",
"0.53885984",
"0.53758585",
"0.5352629",
"0.5302441",
"0.53019255",
"0.53004... | 0.7286509 | 0 |
Loads spline files of extension `.iges` `.xml` `.itd` | def load_splines(fname):
fname = str(fname)
fname = abs_fname_(fname)
sr = splinelibpy.Reader()
ext = os.path.splitext(fname)[1]
if ext == ".iges":
loaded_splines = sr.read_iges(fname)
elif ext == ".xml":
loaded_splines = sr.read_xml(fname)
elif ext == ".itd":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(self):\n if self.__fname == '':\n print('You must pass in a file name to load!')\n return []\n\n ext = os.path.splitext(self.__fname)[1]\n first_pt = None\n if len(self.__fea.points) > 0:\n first_pt = self.__fea.points[0]\n if ext == '.dx... | [
"0.598407",
"0.5837179",
"0.56815714",
"0.5675505",
"0.5656372",
"0.56464905",
"0.56287754",
"0.55418855",
"0.5446652",
"0.54027593",
"0.5383158",
"0.5353577",
"0.5353577",
"0.53077507",
"0.5288568",
"0.5288151",
"0.5274512",
"0.52620083",
"0.5251903",
"0.52356094",
"0.523395... | 0.71475726 | 0 |
Checks if fname is absolute. If not, turns it into an abspath. Tilde safe. | def abs_fname_(fname):
if os.path.isabs(fname):
pass
elif '~' in fname:
fname = os.path.expanduser(fname)
else:
fname = os.path.abspath(fname)
return fname | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _makeAbsolute(fname):\n if fname[0] != '/':\n return os.path.join(os.getcwd(), fname)\n else:\n return fname",
"def getAbsFileName(fname):\n\tfileAbsPath=os.path.abspath(fname)\n\treturn fileAbsPath",
"def abspath(filename, relative_to = None):\n # Create filename relative to the refer... | [
"0.82105744",
"0.7471553",
"0.69280857",
"0.69023055",
"0.6898607",
"0.6897593",
"0.6879507",
"0.6845178",
"0.68191797",
"0.6804619",
"0.67667115",
"0.67245203",
"0.67103535",
"0.6708995",
"0.66932917",
"0.66385156",
"0.6597944",
"0.6584722",
"0.65428245",
"0.6516904",
"0.650... | 0.83377725 | 0 |
Checks to see if the user is a librarian for certain routes | def librarian(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if current_user.lflag == 0:
flash("You are not a librarian! Please sign in to a librarian account")
return redirect(url_for('main'))
return f(*args, **kwargs)
return decorated_function | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def librarian_list(request):\n librarian = User.objects.filter(is_student=False, is_lecturer=False, is_parent=False, is_superuser=False)\n user_type = \"Librarian\"\n context = {\n \"librarian\": librarian,\n \"user_type\": user_type,\n }\n return render(request, 'library/librarians_li... | [
"0.62187976",
"0.55780613",
"0.5519553",
"0.54693735",
"0.5451162",
"0.5360155",
"0.53441876",
"0.53240615",
"0.53006685",
"0.5292587",
"0.5280629",
"0.5270738",
"0.5257878",
"0.52497697",
"0.5249029",
"0.52322376",
"0.5221979",
"0.521075",
"0.52094173",
"0.5189399",
"0.51697... | 0.60173243 | 1 |
Instantiate a model from local directory or remote model repo. Note that when loading from remote, the model revision can be specified. | def from_pretrained(cls,
model_name_or_path: str,
revision: Optional[str] = DEFAULT_MODEL_REVISION,
cfg_dict: Config = None,
device: str = None,
**kwargs):
prefetched = kwargs.get('model_prefe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_model(self, model_path: str):",
"def load_model(fname: os.PathLike) -> Model:\n return Model.load(fname)",
"def _load_from(cls, model_state: dict) -> AbstractModel:\n return cls(model=model_state.get('model'), **model_state.get('kwargs'))",
"def load_model_from_file(path, as_builder=False)... | [
"0.67073345",
"0.6637043",
"0.65116197",
"0.6482459",
"0.64491147",
"0.64228743",
"0.6422444",
"0.64197296",
"0.63858056",
"0.6369337",
"0.6368034",
"0.6346652",
"0.6345023",
"0.62734",
"0.62559134",
"0.62544537",
"0.6245681",
"0.6237426",
"0.6231261",
"0.6220943",
"0.6198383... | 0.7069769 | 0 |
Generates the trading instance objects from their class types. This method attaches all of the trading objects (DataHandler, Strategy, Portfolio, and ExecutionHandler) to various internal members. This ties together all the other classes to the Backtester object. | def _generate_trading_instances(self):
print("Creating DataHandler, Strategy, Portfolio, and ExecutionHandler for")
# Set internal data members equal to the classes we passed in earlier, along with necessary parameters.
# https://softwareengineering.stackexchange.com/questions/131403/what-is-th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_trading_instances(self, strategy_params_dict):\n print(\"Creating DataHandler, Strategy, Portfolio, and ExecutionHandler for\")\n print(\"strategy parameter list: %s...\" % strategy_params_dict)\n\n # Set internal data members equal to the classes we passed in earlier, along with... | [
"0.71847904",
"0.7100767",
"0.6478167",
"0.6361291",
"0.56882477",
"0.56326246",
"0.5572381",
"0.5539028",
"0.55039656",
"0.54438514",
"0.5403827",
"0.5379698",
"0.53721094",
"0.5297526",
"0.5287005",
"0.52309954",
"0.52309954",
"0.51850206",
"0.51665777",
"0.5139257",
"0.511... | 0.7943233 | 0 |
Executes the backtest. This is where the signal handling of the Backtesting engine is carried out. There are two while loops, the outerloop (heartbeat) and the nested innerloop, which checks if there is an event in the Event Queue object. The inner loop acts on the Event by calling the appropriate method | def _run_backtest(self):
i = 0
while True:
i += 1
print(i)
# Update the market bars
if self.data_handler.continue_backtest == True:
self.data_handler.update_bars()
else:
break
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _run_backtest(self):\n i = 0\n\n while True:\n i += 1\n print(i)\n\n # Update the market bars\n if self.data_handler.continue_backtest == True:\n self.data_handler.update_bars()\n else:\n break\n\n # H... | [
"0.7295389",
"0.7248762",
"0.6957512",
"0.67003644",
"0.66377956",
"0.6541956",
"0.64540994",
"0.64049834",
"0.62294203",
"0.62108946",
"0.61638576",
"0.61331415",
"0.6129716",
"0.60833454",
"0.60628366",
"0.6045858",
"0.6027141",
"0.6023538",
"0.5971657",
"0.59704083",
"0.59... | 0.7251965 | 1 |
Generates the trading instance objects from their class types. This method attaches all of the trading objects (DataHandler, Strategy, Portfolio, and ExecutionHandler) to various internal members. This ties together all the other classes to the Backtester object. | def _generate_trading_instances(self, strategy_params_dict):
print("Creating DataHandler, Strategy, Portfolio, and ExecutionHandler for")
print("strategy parameter list: %s..." % strategy_params_dict)
# Set internal data members equal to the classes we passed in earlier, along with necessary pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_trading_instances(self):\n print(\"Creating DataHandler, Strategy, Portfolio, and ExecutionHandler for\")\n\n # Set internal data members equal to the classes we passed in earlier, along with necessary parameters.\n # https://softwareengineering.stackexchange.com/questions/131403... | [
"0.7944597",
"0.71021026",
"0.6479502",
"0.6362634",
"0.56881684",
"0.56321007",
"0.5572392",
"0.55376",
"0.5502691",
"0.5442817",
"0.5403161",
"0.5379905",
"0.5372698",
"0.5296769",
"0.52877635",
"0.5230109",
"0.5230109",
"0.5185296",
"0.5165134",
"0.5138819",
"0.5119774",
... | 0.71861804 | 1 |
Executes the backtest. This is where the signal handling of the Backtesting engine is carried out. There are two while loops, the outerloop (heartbeat) and the nested innerloop, which checks if there is an event in the Event Queue object. The inner loop acts on the Event by calling the appropriate method | def _run_backtest(self):
i = 0
while True:
i += 1
print(i)
# Update the market bars
if self.data_handler.continue_backtest == True:
self.data_handler.update_bars()
else:
break
# Handle the Events
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _run_backtest(self):\n i = 0\n \n while True:\n i += 1\n print(i)\n \n # Update the market bars\n if self.data_handler.continue_backtest == True:\n self.data_handler.update_bars()\n else:\n brea... | [
"0.7250805",
"0.7247759",
"0.6956706",
"0.6701028",
"0.6637288",
"0.6541509",
"0.64544195",
"0.64051026",
"0.62292856",
"0.621116",
"0.6163216",
"0.6132048",
"0.61309826",
"0.60833305",
"0.60645205",
"0.60457534",
"0.6026709",
"0.6022797",
"0.5971004",
"0.59705234",
"0.593822... | 0.72942674 | 0 |
Outputs the strategy performance and other metrics from the backtest. | def _output_performance(self):
self.portfolio.create_equity_curve_dataframe()
print("Creating summary statistics...")
stats = self.portfolio.output_summary_stats()
print("Creating equity curve...")
print(self.portfolio.equity_curve.tail(10))
pprint.pprint(stats)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report_performance(self):\n performance = self.amygdala.visualize(self.timestep, \n self.name, \n self.log_dir)\n print('Final performance is {0:.3}'.format(performance))\n self.backup()\n retu... | [
"0.6337549",
"0.6247714",
"0.62319505",
"0.62179327",
"0.6136802",
"0.61355233",
"0.5989832",
"0.5975646",
"0.59036446",
"0.5874888",
"0.5862709",
"0.584473",
"0.58438706",
"0.5822467",
"0.57994264",
"0.5798621",
"0.5797651",
"0.5784963",
"0.5765707",
"0.576413",
"0.5757759",... | 0.6336608 | 1 |
Simulates the backtest and outputs portfolio performance. Loops over all variants of strategy parameters of a space generated by a cartesian product of hyperparameter values. Generates new instances of all the data handlers, event queues, and portfolio objects upon each iteration, in order to ensure a "clean slate" for... | def simulate_trading(self):
# Create the file output stream
posix_now = datetime.datetime.timestamp(datetime.datetime.now())
out_path = os.getcwd() + "/OutputResults/backtest_{}".format(posix_now)[:-7:] + ".csv"
out = open(out_path, "w+")
spl = len(self.strat_params_list)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parameter_optimization(self):\n out = open(self.csv_dir + self.strategy_id + '_gridsearch.csv', \"w\")\n spl = len(self.para_list)\n for i, sp in enumerate(self.para_list):\n print(\"Strategy %s out of %s...\" % (i + 1, spl))\n self._generate_trading_instances(sp)\n ... | [
"0.6824583",
"0.65352273",
"0.6505157",
"0.63680285",
"0.6147844",
"0.6038669",
"0.59978664",
"0.59736603",
"0.58891684",
"0.58687943",
"0.58315384",
"0.58308274",
"0.5772297",
"0.5758246",
"0.57433945",
"0.57423234",
"0.5734684",
"0.5721028",
"0.5683199",
"0.5653934",
"0.565... | 0.6787927 | 1 |
Anonymous users can make `whoami` requests. They receive a 401 response confirming they are not logged in. | def test_whoami_by_anonymous_user(self):
response = self.client.get("/api/users/whoami/")
self.assertEqual(response.status_code, 401) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def whoami():\n g.data['authenticated_user'] = g.current_user",
"def whoami():\n try:\n\n token = request.headers['token']\n username, uid, wid = read_auth_token(token)\n return dict(username=username, uid=uid, wid=wid)\n\n except SignatureExpired as e:\n return dict(error=st... | [
"0.71340424",
"0.7014765",
"0.6927591",
"0.6695747",
"0.6655952",
"0.6655952",
"0.6635073",
"0.65991694",
"0.65672773",
"0.6493297",
"0.64832705",
"0.64729846",
"0.6437622",
"0.6405885",
"0.64006865",
"0.6381664",
"0.6346517",
"0.6344521",
"0.6308586",
"0.6299756",
"0.6297887... | 0.8336867 | 0 |
Fetch node data using k8s API | def get_node_data(cluster_id):
try:
# fetching the token from secret of the namespace 'dashboard'
_TOKEN = [base64.b64decode(secret_item.data['token']).decode('UTF-8') for secret_item in client.CoreV1Api(
).list_namespaced_secret('dashboard').items if base64.b64decode(secret_item.data['names... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(node_instance_id, logger, client, tenant_name):\n if tenant_name:\n logger.info('Explicitly using tenant `{0}`'.format(tenant_name))\n logger.info('Retrieving node instance {0}'.format(node_instance_id))\n try:\n node_instance = client.node_instances.get(node_instance_id)\n except... | [
"0.60346806",
"0.59235954",
"0.578973",
"0.57561266",
"0.5736296",
"0.5608303",
"0.5593132",
"0.5583009",
"0.556707",
"0.5539366",
"0.5538481",
"0.55283237",
"0.5513567",
"0.54998785",
"0.5490597",
"0.5488156",
"0.5446512",
"0.5438874",
"0.5410196",
"0.53977907",
"0.5386005",... | 0.6105052 | 0 |
Fetch compute cell data | def get_compute_cell_data(cluster_id=None, namespace_id=None):
cells_info = client.CustomObjectsApi().list_cluster_custom_object('kiyot.elotl.co', 'v1beta1', 'cells')
return cells_info | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fetch_data(self):\n pass",
"def getdata(\n self,\n col: str,\n exp: str,\n chan: str,\n res: int,\n xs: Tuple[int, int],\n ys: Tuple[int, int],\n zs: Tuple[int, int],\n ):\n if self.hasdata(col, exp, chan, res, xs, ys, zs):\n ... | [
"0.6227691",
"0.6165168",
"0.61336154",
"0.6130058",
"0.6112285",
"0.60044104",
"0.5895254",
"0.57669675",
"0.57077354",
"0.5702612",
"0.56423634",
"0.5611894",
"0.56060374",
"0.559",
"0.5576882",
"0.5543976",
"0.552921",
"0.5527102",
"0.5463397",
"0.54594564",
"0.5458928",
... | 0.6701156 | 0 |
Get count of resources for requested cluster and namespace | def get_resource_count(cluster_id, namespace_id=None):
# fetching namespaced resource count
if namespace_id:
# Deployment count
deployment_count = len(client.AppsV1beta2Api().list_namespaced_deployment(namespace_id).items)
# Pod count
pod_items = client.CoreV1Api().list_namespace... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cluster_count(self) -> int:\n return len(self.get_all_cluster_ids())",
"def count(self, resource):\n return len(self.all(resource))",
"def get_count_all(cls, context, cluster_id):\n return cls.dbapi.get_cluster_nodegroup_count(context, cluster_id)",
"def test_get_resource_license... | [
"0.66817355",
"0.65607",
"0.6554999",
"0.6523906",
"0.65174896",
"0.64166987",
"0.6349572",
"0.6297506",
"0.6249817",
"0.6204213",
"0.6179697",
"0.6140397",
"0.6123831",
"0.6111716",
"0.61096334",
"0.6105647",
"0.6091557",
"0.6071596",
"0.6053722",
"0.6047418",
"0.6045339",
... | 0.7759584 | 0 |
Get cluster capacity from node detail | def get_cluster_capacity_info(cluster_id):
cpu_capacity_info = get_node_data(cluster_id)
cpu_capacity_in_cores = round(unit_conversion(sum([int(''.join(filter(
str.isdigit, str(item['status']['allocatable']['cpu'])))) for item in cpu_capacity_info]), 'm'), 2)
memory_capacity_in_gib = round(sum(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_capacity():\n fs.get_capacity()",
"def capacity(self):\n capacity = {}\n resources = self.nodes[0].capacity.keys()\n for r in resources:\n values = [n.capacity[r] for n in self.nodes]\n capacity[r] = mean(values) if len(values) > 0 else 0.0\n return ca... | [
"0.7165189",
"0.67714345",
"0.67460614",
"0.66856956",
"0.6549141",
"0.6534968",
"0.65045047",
"0.64937866",
"0.648811",
"0.64549166",
"0.64503264",
"0.63680506",
"0.6324158",
"0.6307951",
"0.6224518",
"0.6187836",
"0.61583894",
"0.6155459",
"0.6146542",
"0.6124433",
"0.61244... | 0.7078413 | 1 |
get resource usage information from pods usage | def get_cluster_usage_info(cluster_id, kind, namespace_id=None, pods_list=None):
if pods_list is None:
pods_list = []
else:
logger.info('pod list not none')
if pods_list == 'no_pod_resource':
return {'cpu': 0,
'memory': 0}
else:
logger.info('resources no 0')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_info(cluster_id, kind, namespace_id=None, pods_list=None):\n if pods_list is None:\n pods_list = []\n capacity = get_cluster_capacity_info(cluster_id),\n usage = get_cluster_usage_info(cluster_id, kind, namespace_id, pods_list)\n if capacity[0]['cpu'] != 0 and capacity[0]['memor... | [
"0.684437",
"0.6337999",
"0.6151427",
"0.6085964",
"0.6063859",
"0.6056686",
"0.60112286",
"0.5989251",
"0.5980302",
"0.5904598",
"0.5870229",
"0.58482635",
"0.58432084",
"0.5836446",
"0.5833565",
"0.582723",
"0.57628006",
"0.57566756",
"0.5720972",
"0.5699034",
"0.5695292",
... | 0.730197 | 0 |
Providing random mock values for resource capacity and usage. | def randomise(mock_info):
mock_info["resource_info"]["usage"]["cpu"] = round(random.uniform(0, 1), 2)
mock_info["resource_info"]["usage"]["cpu_percentage"] = round(random.uniform(0, 1), 2)
mock_info["resource_info"]["usage"]["memory"] = round(random.uniform(0, 1), 2)
mock_info["resource_info"]["usage"][... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_glass_capacity__has_expected_default_value():\n glass = moet.create_glass(\"A\")\n assert glass.capacity == 250",
"def _get_random_returns(self): \n return self.asset_process.distrib.random()",
"def test_sdram(self):\n sdram = SDRAMResource(128 * (2**20))\n self.assertEqual(... | [
"0.631372",
"0.61010695",
"0.60488284",
"0.6046735",
"0.5982311",
"0.5956989",
"0.59451956",
"0.5942304",
"0.59133613",
"0.589804",
"0.58927816",
"0.5846016",
"0.57881594",
"0.5747037",
"0.57254654",
"0.57179344",
"0.57009256",
"0.5674274",
"0.5642999",
"0.56372076",
"0.56222... | 0.7475767 | 0 |
Returns N samples from the prior. | def sample_from_prior(self, n_samples):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_from_prior(self, n_samples):\n\n p0 = self.min + self.rng.rand(n_samples) * (self.max - self.min)\n return p0[:, np.newaxis]",
"def sample_from_prior(self, n_samples):\n\n p0 = self.rng.normal(loc=self.mean, scale=self.sigma, size=n_samples)\n return p0[:, np.newaxis]",
"... | [
"0.7308122",
"0.7254096",
"0.71898454",
"0.7128596",
"0.6979248",
"0.6961805",
"0.67606914",
"0.6745526",
"0.6690407",
"0.6622515",
"0.6562736",
"0.65446556",
"0.65446556",
"0.6425273",
"0.6419413",
"0.6395372",
"0.63613814",
"0.6323354",
"0.63091654",
"0.6305061",
"0.6287302... | 0.7954478 | 0 |
Computes the gradient of the prior with respect to theta. | def gradient(self, theta):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gradient(self, theta):\n return (1 / (self.sigma * np.sqrt(2 * np.pi))) * (\n -theta / (self.sigma ** 2) * np.exp(-(theta ** 2) / (2 * self.sigma ** 2))\n )",
"def gradient(self, theta):\n a = -(6 * self.scale ** 2)\n b = 3 * self.scale ** 2 + np.exp(2 * theta)\n ... | [
"0.8256445",
"0.8055304",
"0.7947039",
"0.7867961",
"0.78287417",
"0.78280646",
"0.7741965",
"0.77182055",
"0.77098596",
"0.76828635",
"0.76208895",
"0.75614756",
"0.72576725",
"0.72168595",
"0.7216574",
"0.7211889",
"0.70136374",
"0.70051277",
"0.6994997",
"0.69862175",
"0.6... | 0.83195007 | 0 |
Returns N samples from the prior. | def sample_from_prior(self, n_samples):
p0 = self.min + self.rng.rand(n_samples) * (self.max - self.min)
return p0[:, np.newaxis] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_from_prior(self, n_samples):\n pass",
"def sample_from_prior(self, n_samples):\n\n p0 = self.rng.normal(loc=self.mean, scale=self.sigma, size=n_samples)\n return p0[:, np.newaxis]",
"def sample_from_prior(self, n_samples):\n\n p0 = self.rng.lognormal(mean=self.mean, sigma... | [
"0.7953035",
"0.72522676",
"0.718797",
"0.71269745",
"0.6977341",
"0.6960459",
"0.6759681",
"0.6744323",
"0.66894495",
"0.6622551",
"0.6560197",
"0.65461904",
"0.65461904",
"0.64246196",
"0.641773",
"0.63970256",
"0.6361261",
"0.6323558",
"0.6306985",
"0.63066787",
"0.6286872... | 0.73065966 | 1 |
Computes the gradient of the prior with respect to theta. | def gradient(self, theta):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gradient(self, theta):\n return (1 / (self.sigma * np.sqrt(2 * np.pi))) * (\n -theta / (self.sigma ** 2) * np.exp(-(theta ** 2) / (2 * self.sigma ** 2))\n )",
"def gradient(self, theta):\n a = -(6 * self.scale ** 2)\n b = 3 * self.scale ** 2 + np.exp(2 * theta)\n ... | [
"0.8256445",
"0.8055304",
"0.7947039",
"0.7867961",
"0.78287417",
"0.78280646",
"0.7741965",
"0.77182055",
"0.77098596",
"0.76828635",
"0.76208895",
"0.75614756",
"0.72576725",
"0.72168595",
"0.7216574",
"0.7211889",
"0.70136374",
"0.70051277",
"0.6994997",
"0.69862175",
"0.6... | 0.83195007 | 1 |
Find a square that forms a bracket with `square` for `player` in the given `direction`. Returns None if no such square exists. Returns the index of the bracketing square if found | def find_bracket(self, square, player, board, direction):
curr = square+ direction
opp = self.opponent(player)
if(board[curr]!=opp):
return None
while(self.is_valid(curr) and board[curr]==opp):
curr+=direction
if(self.is_valid(curr) and board[curr] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_bracket(square, player, board, direction):\n bracket = square + direction\n if board[bracket] == player:\n return None\n opp = Othello.opponent(player)\n while board[bracket] == opp:\n bracket += direction\n return None if board[bracket] in (OUTER, ... | [
"0.80075675",
"0.657441",
"0.63864964",
"0.6318657",
"0.6174479",
"0.5725372",
"0.57224786",
"0.5603353",
"0.5454616",
"0.54519516",
"0.54519516",
"0.543676",
"0.5399402",
"0.5393349",
"0.5366055",
"0.52998435",
"0.52970845",
"0.5295573",
"0.5294598",
"0.5291805",
"0.5225825"... | 0.80948424 | 0 |
Flip pieces in the given direction as a result of the move by player. | def make_flips(self, move, player, board, direction):
curr = move + direction
opp = self.opponent(player)
while(board[curr]==opp):
board[curr] = player
curr += direction
#return board
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flip(self, x, y):\n self.pieces[x + (y * self.width)].flip()",
"def flip(self, bev_direction: str = 'horizontal') -> None:\n pass",
"def make_flips(move, player, board, direction):\n bracket = Othello.find_bracket(move, player, board, direction)\n if not bracket:\n re... | [
"0.68362707",
"0.6592844",
"0.65014696",
"0.6500981",
"0.6391202",
"0.62869",
"0.61508685",
"0.61346436",
"0.6131365",
"0.6130957",
"0.6108974",
"0.6072877",
"0.6030984",
"0.59973514",
"0.5908052",
"0.5880105",
"0.57856685",
"0.5767312",
"0.5751639",
"0.5737677",
"0.57143956"... | 0.69535416 | 0 |
Can player make any moves? Returns a boolean | def any_legal_move(self, player, board):
moves = self.legal_moves(player, board)
#print(moves)
return len(moves)!=0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_check(self):\r\n \r\n if not self.run:\r\n return False\r\n \r\n if self.get_num_legal_moves() == 0:\r\n SlTrace.lg(\"NO more legal moves!\", \"nolegalmoves\")\r\n ###return False \r\n \r\n if self.new_move:\r\n se... | [
"0.80388695",
"0.7600481",
"0.76002926",
"0.75457877",
"0.73324925",
"0.7276734",
"0.72636664",
"0.71992004",
"0.71682996",
"0.7102028",
"0.7098147",
"0.7088383",
"0.70783705",
"0.70189273",
"0.6986816",
"0.69830495",
"0.69700056",
"0.69603264",
"0.6956357",
"0.6952261",
"0.6... | 0.77968675 | 1 |
Which player should move next? Returns None if no legal moves exist. | def next_player(self,board, prev_player):
opp = self.opponent(prev_player)
isOpp = self.any_legal_move(opp, board)
isPrev = self.any_legal_move(prev_player, board)
if(isOpp==False and isPrev==False):
return None
elif(isOpp == False and isPrev == True):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_player(board, prev_player):\n opp = Othello.opponent(prev_player)\n if Othello.any_legal_move(opp, board):\n return opp\n elif Othello.any_legal_move(prev_player, board):\n return prev_player\n return None",
"def player_move():\n\tmove = None\n\twhile mo... | [
"0.7872411",
"0.74398774",
"0.71945137",
"0.71246403",
"0.70864546",
"0.70783263",
"0.705533",
"0.7050984",
"0.70068854",
"0.6994962",
"0.69577587",
"0.6937091",
"0.68736523",
"0.68567985",
"0.6854401",
"0.6811088",
"0.6777367",
"0.6775967",
"0.67653716",
"0.67629874",
"0.672... | 0.74983096 | 1 |
Compute player's score (number of player's pieces minus opponent's). | def score(self,player, board):
numPlayer = 0
numOpp = 0
for i in self.squares():
if board[i] == player:
numPlayer+= SQUARE_WEIGHTS[i]
else:
numOpp+=SQUARE_WEIGHTS[i]
return numPlayer-numOpp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score2(self,player, board):\r\n numPlayer = 0\r\n numOpp = 0\r\n for i in self.squares():\r\n if board[i] == player:\r\n numPlayer+= 1\r\n else:\r\n numOpp+=1\r\n return numPlayer-numOpp",
"def score(player, board):\n mine... | [
"0.77100617",
"0.76665014",
"0.7596806",
"0.755954",
"0.74644375",
"0.7270104",
"0.72659296",
"0.7192504",
"0.71761346",
"0.70750165",
"0.70623815",
"0.7020574",
"0.6970311",
"0.69272745",
"0.69137883",
"0.68977886",
"0.6897169",
"0.68841004",
"0.68778896",
"0.68595576",
"0.6... | 0.7846785 | 0 |
Compute player's score (number of player's pieces minus opponent's). | def score2(self,player, board):
numPlayer = 0
numOpp = 0
for i in self.squares():
if board[i] == player:
numPlayer+= 1
else:
numOpp+=1
return numPlayer-numOpp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score(self,player, board):\r\n numPlayer = 0\r\n numOpp = 0\r\n for i in self.squares():\r\n if board[i] == player:\r\n numPlayer+= SQUARE_WEIGHTS[i]\r\n else:\r\n numOpp+=SQUARE_WEIGHTS[i]\r\n return numPlayer-numOpp",
"def scor... | [
"0.7845445",
"0.7665763",
"0.7595392",
"0.7558798",
"0.74634653",
"0.72690827",
"0.72640866",
"0.7191977",
"0.7175509",
"0.7073882",
"0.70610803",
"0.7019335",
"0.696953",
"0.69266623",
"0.6912282",
"0.6897905",
"0.68971044",
"0.68832207",
"0.68773335",
"0.68591225",
"0.68503... | 0.7709773 | 1 |
Clip the values of x from eps to 1eps and renormalize them so that they sum to 1. | def clip_and_renorm(x, eps=1e-5):
x = np.clip(x, eps, 1-eps)
return x / x.sum() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def threshold_and_normalize_pixels(x, eps=1e-2):\n x = torch.clamp(x, min=eps)\n x = x / torch.sum(x, dim=1, keepdim=True)\n return x",
"def _normalize(x):\n tol = 1e-10\n dims = x.shape\n\n x = x.flatten()\n inverse = (np.sum(x**2) + tol) ** -.5\n x = x * inverse\n ... | [
"0.716385",
"0.71209276",
"0.7078646",
"0.6867248",
"0.68503493",
"0.68422705",
"0.6825308",
"0.6799856",
"0.6776279",
"0.6757192",
"0.66739017",
"0.66679573",
"0.6650903",
"0.650148",
"0.6492298",
"0.64902186",
"0.64388424",
"0.642077",
"0.6390071",
"0.63312405",
"0.6331007"... | 0.76624894 | 0 |
Run the sumproduct belief propagation for a single ray accumulating the occupancy to ray messages in log space and producing the new ray to occupancy messages. Arguments | def single_ray_belief_propagation(ray_voxel_indices,
ray_to_occupancy_accumulated_pon,
ray_to_occupancy_pon, s):
# Create an index that when passed to a numpy array will return the voxels
# that this ray passes through
# TODO: Remove this c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def belief_propagation(\n S,\n ray_voxel_indices,\n ray_voxel_count,\n ray_to_occupancy_messages_pon,\n grid_shape,\n gamma=0.05,\n bp_iterations=3,\n progress_callback=lambda *args: None\n):\n # Extract the number of rays\n N, M = S.shape\n\n # Initialize the ray to occupancy mess... | [
"0.6919233",
"0.5892002",
"0.5517866",
"0.54245466",
"0.52051145",
"0.51677525",
"0.5152469",
"0.5125298",
"0.5082556",
"0.50799584",
"0.5073586",
"0.505811",
"0.5040545",
"0.5011798",
"0.4996324",
"0.498793",
"0.49791676",
"0.49737632",
"0.4945683",
"0.49369043",
"0.49077606... | 0.7314743 | 0 |
Run the belief propagation for a set of rays | def belief_propagation(
S,
ray_voxel_indices,
ray_voxel_count,
ray_to_occupancy_messages_pon,
grid_shape,
gamma=0.05,
bp_iterations=3,
progress_callback=lambda *args: None
):
# Extract the number of rays
N, M = S.shape
# Initialize the ray to occupancy messages to uniform
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def single_ray_belief_propagation(ray_voxel_indices,\n ray_to_occupancy_accumulated_pon,\n ray_to_occupancy_pon, s):\n # Create an index that when passed to a numpy array will return the voxels\n # that this ray passes through\n # TODO: Rem... | [
"0.6051191",
"0.57601404",
"0.56488925",
"0.5455181",
"0.5427728",
"0.54135686",
"0.5383709",
"0.53433657",
"0.5283373",
"0.52386534",
"0.5231889",
"0.52266884",
"0.5205245",
"0.5200786",
"0.51926756",
"0.5170246",
"0.51418513",
"0.51362956",
"0.5133803",
"0.51281625",
"0.512... | 0.64419127 | 0 |
Plot stats for an optimization run property specified by opt_run_property. It is possible to plot a histogram or a line plot. In a line plot, on the x axis are the numbers of the multistarts, where the multistarts are ordered with respect to a function value. On the y axis of the line plot the value of the correspondin... | def optimization_run_property_per_multistart(
results: Union[Result, Sequence[Result]],
opt_run_property: str,
axes: Optional[matplotlib.axes.Axes] = None,
size: Tuple[float, float] = (18.5, 10.5),
start_indices: Optional[Union[int, Iterable[int]]] = None,
colors: Optional[Union[List[float], Lis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def optimization_run_properties_one_plot(\n results: Result,\n properties_to_plot: Optional[List[str]] = None,\n size: Tuple[float, float] = (18.5, 10.5),\n start_indices: Optional[Union[int, Iterable[int]]] = None,\n colors: Optional[Union[List[float], List[List[float]]]] = None,\n legends: Opti... | [
"0.66925603",
"0.63589454",
"0.6322748",
"0.6245997",
"0.602035",
"0.59249425",
"0.59024245",
"0.5690448",
"0.568816",
"0.5664423",
"0.5628853",
"0.56173986",
"0.56059617",
"0.55577713",
"0.55445033",
"0.5530686",
"0.55180305",
"0.55145836",
"0.54932714",
"0.547722",
"0.54603... | 0.7293934 | 0 |
Checks a row & peg combination to see if it refers to a real place in the triangle. | def is_valid(row, peg):
return (
(row < TRI_SIZE) and
(row >= 0) and
(peg < TRI_SIZE) and
(peg >= 0) and
(peg <= row)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __check_row(self, x: int, y: int) -> bool:\n return not any([self.__maze[x, y + i] for i in (-1, 0, 1)])",
"def _pre_check(self) -> bool:\n if self._fuse_row:\n rows = (\n self._tiling.cells_in_row(self._row_idx),\n self._tiling.cells_in_row(self._row_id... | [
"0.7280164",
"0.68686604",
"0.6789244",
"0.67537653",
"0.6733248",
"0.6684262",
"0.6682173",
"0.65795547",
"0.6564693",
"0.65318656",
"0.6483577",
"0.6470317",
"0.6459898",
"0.6441177",
"0.64353055",
"0.64183944",
"0.63982993",
"0.63813514",
"0.6358549",
"0.6357853",
"0.63511... | 0.79514277 | 0 |
Returns a copy of the triangle (faster than deepcopy). | def copy_triangle(tri):
return [[peg for peg in row] for row in tri] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triangle(self):\n [r,c] = self.D\n m = min(r,c)\n S = self\n T = zeros(r,c)\n while m > 0:\n NoLigne = 0\n while S[NoLigne, 0] == 0 and (NoLigne < m - 1):\n NoLigne += 1\n S = S.swap(NoLigne,0)\n if S[... | [
"0.6823598",
"0.642301",
"0.6033022",
"0.6030731",
"0.5999631",
"0.5969139",
"0.59297556",
"0.58959395",
"0.58513814",
"0.58339965",
"0.57237965",
"0.5711828",
"0.56681204",
"0.560612",
"0.55897707",
"0.5587957",
"0.5586594",
"0.55755776",
"0.5572819",
"0.5558009",
"0.5556987... | 0.720594 | 0 |
Performs a jump between an occupied (row, peg) tuple A and an unoccupied C, passing over B. If anything is bad with the jump, returns False; otherwise returns True. | def jump(tri, A, B, C):
start_row, start_peg = A
mid_row, mid_peg = B
end_row, end_peg = C
# Check to make sure A is occupied and B is clear
if tri[start_row][start_peg] == False: return False
if tri[end_row][end_peg]: return False
# Make sure we're jumping over an occupied space.
if t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jump(self, j_orig, j_over, j_land):\n orig_x, orig_y = j_orig\n over_x, over_y = j_over\n land_x, land_y = j_land\n\n # indexes for each square\n orig_i = orig_y * self.ncols + orig_x\n over_i = over_y * self.ncols + over_x\n land_i = land_y * self.ncols + land_... | [
"0.58794034",
"0.5780335",
"0.56505096",
"0.56226003",
"0.5529821",
"0.548902",
"0.545118",
"0.54377955",
"0.5421571",
"0.54183495",
"0.5403734",
"0.5387588",
"0.53724825",
"0.5344193",
"0.5342577",
"0.5336441",
"0.52679",
"0.52414954",
"0.5229286",
"0.52260715",
"0.52221286"... | 0.7989009 | 0 |
Returns a (mid_row, mid_peg) tuple between (start_row, start_peg) and (end_row, end_peg). | def mid(start_row, start_peg, end_row, end_peg):
if start_row + 2 == end_row:
mid_row = start_row + 1
elif start_row == end_row + 2:
mid_row = start_row - 1
elif start_row == end_row:
mid_row = start_row
if start_peg + 2 == end_peg:
mid_peg = start_peg + 1
elif start... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def startAndEnd(self):\n upperRow = 0\n upperCol = 0\n lowerRow = 0\n lowerCol = 0\n if self.selectionMode == kSelectionNone:\n upperRow = self.penRow\n upperCol = self.penCol\n lowerRow = self.penRow\n lowerCol = self.penCol\n e... | [
"0.6485405",
"0.59999824",
"0.599718",
"0.57569534",
"0.57080907",
"0.5679897",
"0.5622903",
"0.5562309",
"0.5506314",
"0.5498558",
"0.54762554",
"0.54337853",
"0.53962946",
"0.5344107",
"0.53079104",
"0.52601105",
"0.5217689",
"0.5206089",
"0.51990014",
"0.51918226",
"0.5168... | 0.84714884 | 0 |
Searches, using recursive backtracking. | def search(tri, history = []):
count = 0
children = []
for start_row in range(len(tri)):
for start_peg in range(len(tri[start_row])):
if tri[start_row][start_peg] == True:
count += 1
for end_row, end_peg in jump_lookup[(start_row, start_peg)]:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(self):\r\n #get the initial state\r\n initialState = State()\r\n \r\n #create root node\r\n rootNode = Node(initialState)\r\n \r\n #show the search tree explored so far\r\n treeplot = TreePlot()\r\n treeplot.generateDiagram(rootNode, rootNod... | [
"0.6654038",
"0.65033793",
"0.6456524",
"0.6307618",
"0.6231046",
"0.62213635",
"0.6207362",
"0.61557186",
"0.6107835",
"0.6091845",
"0.6074678",
"0.60684437",
"0.60239583",
"0.5979148",
"0.59736043",
"0.5972576",
"0.5958814",
"0.5956313",
"0.5955384",
"0.5945115",
"0.5939703... | 0.6503747 | 1 |
Create a redis connection by uri. | def connect_redis(uri):
puri = urlparse.urlparse(uri)
host = puri.hostname
port = puri.port
password = puri.password if puri.password else ''
db_name = puri.path.split('/')[1]
r = redis.Redis(host=host, port=port, password=password, db=db_name)
assert r.ping()
return r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conn_redis(host, port, db=0):\r\n r = redis.Redis(host=host, port=port, db=db)\r\n return r",
"def create_connection():\n # REDIS_URL is defined in .env and loaded into the environment by Honcho\n redis_url = os.getenv('REDIS_URL')\n # If it's not defined, use the Redis default\n if not red... | [
"0.7483556",
"0.74211794",
"0.7264241",
"0.72543937",
"0.68576866",
"0.67962694",
"0.6592169",
"0.65768725",
"0.6565991",
"0.6559168",
"0.65246797",
"0.6495612",
"0.6445122",
"0.64029026",
"0.63978356",
"0.6371485",
"0.6359366",
"0.6345691",
"0.6345691",
"0.6323229",
"0.62616... | 0.82560194 | 0 |
Update next_waypoint based on base_waypoints and current_pose. True if a valid waypoint has been updated, False otherwise | def _update_next_waypoint(self):
if not self.base_waypoints:
#rospy.logwarn("Waypoints not updated: base_waypoints not available yet.")
return False
if not self.current_pose:
#rospy.logwarn("Waypoints not updated: current_pose not available yet.")
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self):\n\n # If the agent has already reached the\n # last waypoint it doesn't need to update\n if self.finished:\n return True\n\n # Skip if the proxy don't have any [new] data\n if (self.pp.info.datatime == 0) or \\\n (self.pp.info.datatime == s... | [
"0.75298524",
"0.6561931",
"0.6387742",
"0.6317193",
"0.63150394",
"0.622506",
"0.60167783",
"0.59918606",
"0.5980918",
"0.59700096",
"0.5907589",
"0.59038836",
"0.5851159",
"0.5754915",
"0.5693167",
"0.5637678",
"0.56281024",
"0.5589967",
"0.5589809",
"0.5587563",
"0.5584952... | 0.78717625 | 0 |
Update next_waypoint based on current_pose and base_waypoints Generate the list of the next LOOKAHEAD_WPS waypoints Update velocity for them Publish them to "/final_waypoints" | def update_and_publish(self):
# 1. Find next_waypoint based on ego position & orientation
if self._update_next_waypoint():
# 2. Generate the list of next LOOKAHEAD_WPS waypoints
num_base_wp = len(self.base_waypoints)
last_base_wp = num_base_wp-1
waypoint_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_next_waypoint(self):\n if not self.base_waypoints:\n #rospy.logwarn(\"Waypoints not updated: base_waypoints not available yet.\")\n return False\n\n if not self.current_pose:\n #rospy.logwarn(\"Waypoints not updated: current_pose not available yet.\")\n ... | [
"0.7230159",
"0.6776315",
"0.67544454",
"0.6514871",
"0.6341936",
"0.6335558",
"0.633497",
"0.6204625",
"0.61543787",
"0.6134523",
"0.6099235",
"0.6051331",
"0.59626335",
"0.5945264",
"0.5943431",
"0.59124935",
"0.5906773",
"0.5842161",
"0.5803007",
"0.5779287",
"0.57633066",... | 0.8069657 | 0 |
Restore original velocities of points | def restore_velocities(self, indexes):
for idx in indexes:
self.set_waypoint_velocity(self.base_waypoints, idx, self.base_wp_orig_v[idx]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_velocities(self):\r\n self.wx = np.copy(Turbine.wzero)\r\n self.wy = np.copy(Turbine.wzero)",
"def reset(self):\n self.t = 0.0\n self.last_t = None\n self.current_y = np.copy(self.start_y)\n self.current_yd = np.copy(self.start_yd)",
"def reset(self):\n ... | [
"0.7025841",
"0.6620128",
"0.63186425",
"0.62810314",
"0.6206654",
"0.61409414",
"0.6138598",
"0.6134401",
"0.6096291",
"0.60953915",
"0.6012672",
"0.5995094",
"0.59774",
"0.5973119",
"0.59690225",
"0.59552336",
"0.59322405",
"0.5886006",
"0.58640605",
"0.58620423",
"0.585557... | 0.6673411 | 1 |
Decelerate a list of wayponts so that they stop on stop_index | def decelerate(self, waypoints, stop_index, stop_distance):
if stop_index <= 0:
return
dist = self.distance(waypoints, 0, stop_index)
step = dist / stop_index
# Generate waypoint velocity by traversing the waypoint list backwards:
# - Everything beyond stop_index wil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plan_stop(wps, idx, min_decel, max_decel, speed_limit):\n\n if idx < 0:\n return []\n\n wps = wps[0: idx+1]\n\n # Calculate the acceleration needed to stop the car at the last waypoint in wps\n path_length = distance(wps, 0, len(wps)-1)\n a = -wps[0].twist.twist.linear.x**2/(2*path_length... | [
"0.69572246",
"0.5711461",
"0.56443334",
"0.5461794",
"0.5378483",
"0.5345332",
"0.5312884",
"0.52976394",
"0.5167818",
"0.51332635",
"0.51195765",
"0.50715023",
"0.5067811",
"0.50550187",
"0.50407976",
"0.50374746",
"0.50099397",
"0.4976755",
"0.49753836",
"0.49560714",
"0.4... | 0.6354519 | 1 |
Compare two waypoints to see whether they are the same (within 0.5 m and 0.5 m/s) | def is_same_waypoint(self, wp1, wp2, max_d=0.5, max_v=0.5):
dl = lambda a, b: math.sqrt((a.x-b.x)**2 + (a.y-b.y)**2 + (a.z-b.z)**2)
ddif = dl(wp1.pose.pose.position, wp2.pose.pose.position)
if ddif < max_d:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __comparing_points(self, point1, point2) -> bool:\n return (abs(point1.x - point2.x) <= self.dirt_pos_tolerance and abs(\n point1.y - point2.y) <= self.dirt_pos_tolerance)",
"def match(uspec1, uspec2):\n \n if uspec1.is_power_onoff() and uspec2.is_power_onoff():\n return True\n... | [
"0.66216546",
"0.65738994",
"0.6439483",
"0.6387838",
"0.6352702",
"0.63003606",
"0.6274246",
"0.6252439",
"0.6230331",
"0.62167144",
"0.6209074",
"0.62022907",
"0.61987966",
"0.61629647",
"0.6139927",
"0.61213946",
"0.6107632",
"0.6103632",
"0.6090313",
"0.6084919",
"0.60797... | 0.73450947 | 0 |
Ensures that a capital can only belong to one country | def test_capital_unicity(self):
# Get Bangkok
bangkok = Country.objects.get(iso3="THA").capital
# Get United States
united_states = Country.objects.get(iso3="USA")
# Initialize assertRaises block
with self.assertRaises(IntegrityError):
# Set the capital of... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_country_name_not_in_countries(self):\n\t\tcountry_code = get_country_code('Venezuela, RB')\n\t\tself.assertEqual(country_code, 've')",
"def test_valid_country():\n assert valid_country(\"Democratic Republic of Lungary\") is True\n assert valid_country(\"Kraznoviklandstan\") is True\n assert val... | [
"0.57727647",
"0.5747203",
"0.5745896",
"0.5662479",
"0.5656905",
"0.55133384",
"0.54153365",
"0.53913385",
"0.53848505",
"0.53621507",
"0.5360658",
"0.53440136",
"0.5325288",
"0.53173727",
"0.528774",
"0.5264815",
"0.5211678",
"0.5199605",
"0.5149981",
"0.5145287",
"0.514528... | 0.64122915 | 0 |
Ensures that the cleaning of UN member status behaves as expected | def test_un_member_status(self):
# Get Hong Kong
hong_kong = Country.objects.get(iso3="HKG")
# Assert that is_un_member_at is None
self.assertEqual(hong_kong.is_un_member_at, None)
# Initialize assertRaises block
with self.assertRaises(ValidationError):
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean(self, uid, states=None):\n\n # doesn't change status",
"def clean(self):\n # Perform the standard ACE cleaning\n max_status = mm_ace.clean(self)\n\n # Replace bad values with NaN and remove times with no valid data\n self.data = self.data[self.data['status'] <= max_status]\n\n ret... | [
"0.6766085",
"0.60108733",
"0.5959499",
"0.5928209",
"0.59210426",
"0.5901284",
"0.5901226",
"0.586937",
"0.5864156",
"0.5860781",
"0.58541995",
"0.58541995",
"0.58360237",
"0.58315945",
"0.5801635",
"0.5786526",
"0.57726616",
"0.57681125",
"0.57417685",
"0.572516",
"0.567833... | 0.73605675 | 0 |
Remove all erroneous colors, replaced by the most commonly found in the direct neighborhood | def clean(data, out, npcolors):
prev_err = 0
new_err = 0
old = data.copy()
for r in range(data.shape[0]):
for c in range(data.shape[1]):
found = -1
for i, col in enumerate(npcolors):
if data[r, c] == col:
found = i
if fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_colors(images):\n images = images[:, :, :, :, 0]\n return images",
"def color_invalid(self):\n for i in self.invalid:\n self.color_cell(i, INVALID)",
"def lightness_correction(self):\n points = self.color_lookup_table_points\n lightness_max_value = math.sqrt(3 *... | [
"0.6484606",
"0.6377774",
"0.62030065",
"0.60673124",
"0.6038112",
"0.5998475",
"0.5998475",
"0.595649",
"0.594523",
"0.5914712",
"0.5899766",
"0.58824664",
"0.58483124",
"0.5814882",
"0.580523",
"0.5790582",
"0.5781437",
"0.57611006",
"0.575656",
"0.5732335",
"0.5723635",
... | 0.6692518 | 0 |
Implement call sklearn metric on dataset. | def __call__(self, dataset: 'SklearnCompatible', dropna: bool = False) -> float:
assert hasattr(dataset, 'target'), 'Dataset should have target to calculate metric'
if self.one_dim:
assert dataset.shape[1] == 1, 'Dataset should have single column if metric is one_dim'
# TODO: maybe r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate(self, dataset):\n\t\tpass",
"def evaluate(self, data, metric, classes=None):\n func_dict = {\n 'mutual_information': sklearn.metrics.mutual_info_score,\n 'normed_mutual_information': sklearn.metrics.normalized_mutual_info_score,\n 'square_error': sklearn.metrics.mean_squa... | [
"0.69129854",
"0.66921866",
"0.6664506",
"0.6658557",
"0.65358526",
"0.64022624",
"0.63196886",
"0.6217403",
"0.62092805",
"0.61501414",
"0.61377925",
"0.6125066",
"0.6089111",
"0.6083159",
"0.60741395",
"0.6060244",
"0.6057991",
"0.6048644",
"0.6021093",
"0.5998874",
"0.5975... | 0.6836997 | 1 |
Create metric for dataset. Get LAMLMetric that is called on dataset. | def get_dataset_metric(self) -> LAMLMetric:
# for now - case of sklearn metric only
one_dim = self.name in _one_dim_output_tasks
dataset_metric = SkMetric(self.metric_func, name=self.metric_name,
one_dim=one_dim, greater_is_better=self.greater_is_better)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_metric(self) -> EvalMetric:\n pass",
"def create_metric(self) -> 'LossMetric':\n raise NotImplementedError()",
"def __call__(self, dataset: 'LAMLDataset', dropna: bool = False):\n assert hasattr(dataset, 'target'), 'Dataset should have target to calculate metric'\n raise ... | [
"0.666398",
"0.60399914",
"0.5974834",
"0.5590214",
"0.55357915",
"0.55043375",
"0.55043375",
"0.5482854",
"0.54779565",
"0.5451086",
"0.5451086",
"0.54114413",
"0.5354682",
"0.5354682",
"0.51812303",
"0.51812303",
"0.51733845",
"0.5146675",
"0.5142152",
"0.5129933",
"0.51012... | 0.7164863 | 0 |
Collectes entries in rootdir's basedir directory which is always relateive to rootdir. | def _collect_entries(rootdir: str, basedir: str):
files = []
dirs = []
for entry in os.listdir(os.path.join(rootdir, basedir)):
rel_path = os.path.join(basedir, entry)
full_path = os.path.join(rootdir, rel_path)
isdir = os.path.isdir(full_path)
if isdir and (rel_path in ('.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_final_dirs(self, root=\"\"):\n _updated = int(self.stats()[\"db_update\"])\n _hash = uhash(root)\n return self._get_final_dirs(_updated=_updated, _hash=_hash, root=root)",
"def getImmediateSubdirectories(dir):",
"def _load_dirs(self):\n rootdirs = self._docset.get_compounds(... | [
"0.66336405",
"0.6516187",
"0.63490784",
"0.6312109",
"0.6306998",
"0.6250683",
"0.61746",
"0.6130482",
"0.6113366",
"0.6081825",
"0.60749775",
"0.6051456",
"0.6035353",
"0.602858",
"0.60019743",
"0.59748715",
"0.59671766",
"0.59671766",
"0.5945204",
"0.593414",
"0.5931592",
... | 0.76479506 | 0 |
Return MD5 hash's hexdigest bases on nongit nonpycache entries of the root_dir. The purpose is to check if two directory is identical except the modification dates. The two directories can be on different machines when the file transfer would be costly. | def python_repo_hash_md5(root_dir: str, *, verbose: bool = False):
m = hashlib.md5()
for e in _collect_entries(root_dir, '.'):
if verbose:
log_info('Processing e', e)
m.update(
f"path={e['path']}\tisdir={e['isdir']}\tsize={e['size']}\tmode={e['mode']:03o}\tmtime={e['mtime... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_md5_of_dir(self, verbose=0):\n directory = self.cfg['sharing_path']\n if verbose:\n start = time.time()\n md5Hash = hashlib.md5()\n if not os.path.exists(directory):\n self.stop(1, 'Error during calculate md5! Impossible to find \"{}\" in user folder'... | [
"0.6838967",
"0.6250359",
"0.6099796",
"0.5913261",
"0.5903527",
"0.5851177",
"0.5848145",
"0.5792256",
"0.5689556",
"0.56635755",
"0.56403613",
"0.5586936",
"0.5534521",
"0.5526404",
"0.5467155",
"0.5463636",
"0.54520786",
"0.5427325",
"0.5422579",
"0.54110044",
"0.5407061",... | 0.7109552 | 0 |
Deactivate an ApiOAuth2Application Does not delete the database record, but revokes all tokens and sets a flag that hides this instance from API | def deactivate(self, save=False):
client = cas.get_client()
# Will raise a CasHttpError if deletion fails, which will also stop setting of active=False.
resp = client.revoke_application_tokens(self.client_id, self.client_secret) # noqa
self.is_active = False
if save:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def revoke_api_access(application):\n try:\n file = open(PATH + '/../DB/access.json', 'r')\n accessData = json.load(file)\n if (application in accessData):\n accessData.pop(application, None)\n\n with open(PATH + '/../DB/access.json', 'w') as f:\n f.write(json.d... | [
"0.6420284",
"0.64088273",
"0.6401829",
"0.6401829",
"0.6192459",
"0.6173356",
"0.6137181",
"0.6090798",
"0.6071947",
"0.6071947",
"0.60594076",
"0.5915336",
"0.58965695",
"0.5862787",
"0.5858027",
"0.58575356",
"0.58293414",
"0.5747239",
"0.5745004",
"0.57321835",
"0.5720194... | 0.7059044 | 0 |
Reset the secret of an ApiOAuth2Application Revokes all tokens | def reset_secret(self, save=False):
client = cas.get_client()
client.revoke_application_tokens(self.client_id, self.client_secret)
self.client_secret = generate_client_secret()
if save:
self.save()
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resetSecret(self):\n self.secret = str(uuid())\n self.put()",
"def _clear_secret_token_map():\n global _secret_token_map\n _secret_token_map = None",
"def manage_clearSecrets(self, REQUEST):\n manager = getUtility(IKeyManager)\n manager.clear()\n manager.rotate()\n ... | [
"0.699256",
"0.6872917",
"0.6153157",
"0.6107559",
"0.59967816",
"0.59598404",
"0.5934698",
"0.5888643",
"0.58882296",
"0.5865433",
"0.5845431",
"0.5785667",
"0.57682496",
"0.5740121",
"0.5738762",
"0.57173806",
"0.5665614",
"0.5649307",
"0.56228507",
"0.56142944",
"0.5586983... | 0.702098 | 0 |
Deactivate an ApiOAuth2PersonalToken Does not delete the database record, but hides this instance from API | def deactivate(self, save=False):
client = cas.get_client()
# Will raise a CasHttpError if deletion fails for any reason other than the token
# not yet being created. This will also stop setting of active=False.
try:
resp = client.revoke_tokens({'token': self.token_id}) # no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_auth_token():\n data = get_request_data(request)\n address = data.get(\"address\")\n token = data.get(\"token\")\n\n valid, message = is_token_valid(token, address)\n if not valid:\n return jsonify(error=message), 400\n\n force_expire_token(token)\n\n return jsonify(success=\... | [
"0.68359965",
"0.68096167",
"0.65469694",
"0.6422617",
"0.6284022",
"0.6237951",
"0.61001736",
"0.60755134",
"0.60667545",
"0.60667545",
"0.6003061",
"0.59748185",
"0.59192157",
"0.5878691",
"0.5849091",
"0.5848954",
"0.58168155",
"0.5810158",
"0.5800938",
"0.57993716",
"0.57... | 0.7050593 | 0 |
Calls the cvsfileUsage function to start parsing | def __call__(self):
return self.csvfileUsage() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n parse_file(sys.argv[1])",
"def main():\n parser = ArgumentParser(usage='%(prog)s [options] ecommonsMetadata.csv')\n parser.add_argument(\"-d\", \"--date\", dest=\"date\",\n help=\"Date on or after that an ETD was published for \\\n creating DOI... | [
"0.58680946",
"0.584178",
"0.56904954",
"0.55948025",
"0.55103976",
"0.54529536",
"0.5447621",
"0.5420857",
"0.5396767",
"0.5378413",
"0.5375421",
"0.5359897",
"0.53025967",
"0.5297627",
"0.52868927",
"0.52581596",
"0.52294654",
"0.5224852",
"0.5216758",
"0.51756084",
"0.5175... | 0.6263405 | 0 |
Check For valid csv data | def check_valid_csv_data(self, row):
obj = re.match(re.compile('^[0-9]{4}\,[A-Z]{1}[a-z]{2}\,.'),
','.join(row))
if not obj:
raise Exception("Invalid Data String must be like `1990` `Jan` Check Sample file") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_valid_csvformat(self, csv_path):\n with open(self.csv_path, \"rb+\") as file_obj:\n reader = csv.reader(file_obj, delimiter=',') # CSV DictReader object\n self.check_valid_csv_header(reader.next())\n self.check_valid_csv_data(reader.next())",
"def validate_csv_s... | [
"0.80091965",
"0.75875276",
"0.75167954",
"0.741095",
"0.71336776",
"0.70634043",
"0.6948182",
"0.68665993",
"0.6859504",
"0.67613226",
"0.67475",
"0.6734457",
"0.67083627",
"0.6599125",
"0.6583989",
"0.65218884",
"0.6469705",
"0.64656794",
"0.6436142",
"0.6427924",
"0.640778... | 0.7886953 | 1 |
Check if csv is in valid format with data | def check_valid_csvformat(self, csv_path):
with open(self.csv_path, "rb+") as file_obj:
reader = csv.reader(file_obj, delimiter=',') # CSV DictReader object
self.check_valid_csv_header(reader.next())
self.check_valid_csv_data(reader.next()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_valid_csv_data(self, row):\n obj = re.match(re.compile('^[0-9]{4}\\,[A-Z]{1}[a-z]{2}\\,.'),\n ','.join(row))\n if not obj:\n raise Exception(\"Invalid Data String must be like `1990` `Jan` Check Sample file\")",
"def validate_csv(filen... | [
"0.79888827",
"0.77903473",
"0.7676916",
"0.73605514",
"0.72107303",
"0.69361657",
"0.6886044",
"0.68570256",
"0.68204045",
"0.67923874",
"0.67035025",
"0.65973264",
"0.65804535",
"0.6500226",
"0.6483696",
"0.644907",
"0.6433415",
"0.64274734",
"0.63892037",
"0.6351961",
"0.6... | 0.8132414 | 0 |
Prepare the company's data | def prepare_company_data(self, month, year, row, company_data):
for key, value in row.items():
if not company_data[key]:
company_data[key] = {'year':year, 'month':month, 'value':value}
else:
"""main operation updating the company's data per year
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getCompaniesData(self, schema):\n try:\n self.cursor.execute(\"\"\"SELECT id, twitter, proven_score, slug FROM {schema}.vendors_vendor WHERE\n twitter <> ''\"\"\".format(schema=schema))\n data = self.cursor.fetchall()\n\n companies = []\n... | [
"0.6938614",
"0.67131525",
"0.67055386",
"0.6524873",
"0.63706404",
"0.6255161",
"0.6225849",
"0.6220218",
"0.62027955",
"0.6075558",
"0.5998771",
"0.5954136",
"0.59276706",
"0.5911707",
"0.5911581",
"0.5889178",
"0.5853898",
"0.58073986",
"0.5801998",
"0.5798251",
"0.5788507... | 0.71914417 | 0 |
Takes WARC record and returns domain of target URI plus Counter for domains of outlinked pages if these exist. | def parse_links(record):
try:
page_url = record['WARC-Header-Metadata']['WARC-Target-URI']
page_domain = urlparse.urlparse(page_url).netloc
links = record['Payload-Metadata']['HTTP-Response-Metadata']['HTML-Metadata']['Links']
out_links = Counter([urlparse.urlparse(url['url']).netloc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_domains(urls, screen_name, domains):\n\n def add_domain_to_dict(domains, domain_string):\n \"\"\" helper function\"\"\"\n domain = urlparse(unquote(domain_string)).netloc.replace('www.', '')\n domain = domain.split(':')[0]\n try:\n new_domain = get_domain(domain)\n except ValueError:... | [
"0.5832478",
"0.5743405",
"0.5526221",
"0.54275036",
"0.5161741",
"0.51254606",
"0.5115564",
"0.50487834",
"0.5029015",
"0.49536353",
"0.49229515",
"0.49164706",
"0.48799717",
"0.48791456",
"0.4861495",
"0.48533532",
"0.48137897",
"0.4801171",
"0.47810617",
"0.4773569",
"0.47... | 0.68593603 | 0 |
Takes WARC record and outputs all pairs (domain, path) from URIs, if these exist. It searches both target URI and outlinks and does not distinguish between them. | def parse_urls(record):
url_list = []
try:
page_url = record['WARC-Header-Metadata']['WARC-Target-URI']
x = urlparse.urlparse(page_url)
url_list += [(x.netloc, x.path)]
except:
pass
try:
links = record['Payload-Metadata']['HTTP-Response-Metadata']['HTML-Metada... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_links(record):\n try:\n page_url = record['WARC-Header-Metadata']['WARC-Target-URI']\n page_domain = urlparse.urlparse(page_url).netloc\n links = record['Payload-Metadata']['HTTP-Response-Metadata']['HTML-Metadata']['Links']\n out_links = Counter([urlparse.urlparse(url['url... | [
"0.648302",
"0.58565474",
"0.57382894",
"0.56618035",
"0.55831033",
"0.55718136",
"0.5427328",
"0.5408748",
"0.53590286",
"0.53027636",
"0.526104",
"0.52590644",
"0.5210608",
"0.5188143",
"0.5162076",
"0.5156036",
"0.51295507",
"0.51037467",
"0.50811",
"0.5069011",
"0.5066564... | 0.6712598 | 0 |
Takes domain and concatenates with path URIs separated by newlines.. | def domain_string(domain, path_set):
out = domain + '\n' + '\n'.join(list(path_set)) + '\n\n\n'
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_link(url_domain, url_path):\n\n # Ensure domain is not empty\n if url_domain.strip() == \"\":\n return url_path\n\n # Strip / at end of domain\n if url_domain[-1] == \"/\":\n url_domain = url_domain[0:-1]\n\n # Strip / at beginning of path\n if url_path[0] == \"/\":\n ... | [
"0.6588488",
"0.6037963",
"0.59932935",
"0.58680135",
"0.5814077",
"0.58129615",
"0.5769635",
"0.5683123",
"0.566781",
"0.56072015",
"0.55921346",
"0.55277026",
"0.5518288",
"0.5502831",
"0.5482606",
"0.5472744",
"0.545825",
"0.54528075",
"0.5439585",
"0.5436488",
"0.54126805... | 0.71544874 | 0 |
Creates a DataFrame with polygones and IDs for all tax zones. | def createEmptyMapData():
with open('data/taxzone.json', 'r') as f:
taxzones = json.load(f)
polygons_shape = [shape(feature['geometry']) for feature in taxzones['features']]
names = [feature['properties']['id'] for feature in taxzones['features']]
map_data = pd.DataFrame({'poly': polygons_shape... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def taxa_data_frame(self):\n cols = list(self._taxa.keys())\n cols.remove(\"uid\")\n cols.remove(\"object\")\n df = DataFrame(self._taxa, columns=cols, index=self._taxa[\"uid\"])\n df.index.name = \"uid\"\n\n return df",
"def taxi_zones(path, storage_options=None):\n ... | [
"0.6282922",
"0.62614584",
"0.6177866",
"0.58757657",
"0.58594614",
"0.57724375",
"0.5746732",
"0.5704685",
"0.57044125",
"0.5677378",
"0.56272644",
"0.55792403",
"0.5492265",
"0.5476538",
"0.54143095",
"0.53428125",
"0.53372324",
"0.5313981",
"0.52794796",
"0.52559406",
"0.5... | 0.74269277 | 0 |
Appends a new column named 'field_name' to map_data. The data is read from json_file. Flag single_point_per_zone set True, will only read a single count per polygon. | def addJsonFileToMapData(json_file, field_name, map_data, single_point_per_zone=False):
# Read the json file
json_data = pd.io.json.read_json(json_file)
json_data['points'] = json_data.apply(lambda row: Point(row.coords), axis=1)
# Loop over all polygons in the map.
poly_counts = []
for polygon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def geojson2postgis(self, filepath, table_name, geo_type):\n map_data = gpd.GeoDataFrame.from_file(filepath)\n # Maybe you want to change link address\n link = \"postgresql://{0}:{1}@{3}:5432/{2}\".format(self.username, self.password, self.dbname, self.host)\n engine = create_engine(lin... | [
"0.561637",
"0.55059373",
"0.5413647",
"0.52885896",
"0.5211857",
"0.5193927",
"0.51066226",
"0.5084411",
"0.50838536",
"0.50032544",
"0.49953464",
"0.49931327",
"0.49827933",
"0.4979779",
"0.4963164",
"0.49228954",
"0.49089125",
"0.4892675",
"0.48825735",
"0.48774529",
"0.48... | 0.8169456 | 0 |
A message handler method may simply be a method with som kwargs. The kwargs will be given all incoming pipeline data, the bus and the incoming payload. | def MessageHandlerMethod(**kwargs):
data: dict = kwargs['data']
bus: AbstractPikaBus = kwargs['bus']
payload: dict = kwargs['payload']
print(payload)
if payload['reply']:
payload['reply'] = False
bus.Reply(payload=payload) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_message(**payload):\n handler_instance = message.MessageHandler(payload)\n handler_instance.handle()",
"def _incoming_handler(self, context, message, fake_reply):\r\n return self._map[message.method](context, fake_reply, *message.args, **message.kwargs)",
"def _handler(self, message):\n... | [
"0.70364314",
"0.68466866",
"0.67132837",
"0.65455157",
"0.65276337",
"0.6499453",
"0.64698917",
"0.64215446",
"0.64198",
"0.63106513",
"0.6194863",
"0.61529726",
"0.6119505",
"0.6105504",
"0.6038387",
"0.60153407",
"0.59553987",
"0.59527606",
"0.5943922",
"0.5909026",
"0.586... | 0.7705003 | 0 |
derivative of tanh(x) = 1. (tanh(x) ^.2) | def d_tanh(x):
return 1. - np.power(np.tanh(x), 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def d_tanh(x):\n\n return 1 - x.tanh().pow(2)",
"def d_tanh(x:float)->float:\n if not isinstance(x, numbers.Real):\n raise TypeError(\"Input value of invalid type\")\n\n return(1 - math.pow(math.tanh(x), 2))",
"def tanh(x):\n return (1 - e ** (-2*x))/ (1 + e ** (-2*x))",
"def tanh(x):\n ... | [
"0.83941805",
"0.80225915",
"0.7937077",
"0.78862315",
"0.78078306",
"0.7777195",
"0.7777195",
"0.7744556",
"0.75239104",
"0.7510693",
"0.74799824",
"0.746419",
"0.74618053",
"0.7429449",
"0.73665565",
"0.7362666",
"0.7334647",
"0.72786546",
"0.727234",
"0.7268931",
"0.721921... | 0.8256705 | 1 |
Gets the operational_state of this ConnectionEndPoint. | def operational_state(self) -> str:
return self._operational_state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_status(self):\n return self._conn_state",
"def get_connection_state(self):\n return self.connection_state",
"def state(self):\n return pn_connection_state(self._impl)",
"def connection_status(self):\n return self._connection_status",
"def status(self) -> Optional[pulumi.... | [
"0.68319815",
"0.68308073",
"0.6515286",
"0.64101964",
"0.6124702",
"0.6124702",
"0.6124702",
"0.6124702",
"0.6071668",
"0.5983941",
"0.5983941",
"0.5983941",
"0.59587127",
"0.59099543",
"0.5899447",
"0.58726335",
"0.5847335",
"0.5847335",
"0.5847335",
"0.5847335",
"0.5847335... | 0.75950426 | 0 |
Sets the operational_state of this ConnectionEndPoint. | def operational_state(self, operational_state: str):
allowed_values = ["DISABLED", "ENABLED"] # noqa: E501
if operational_state not in allowed_values:
raise ValueError(
"Invalid value for `operational_state` ({0}), must be one of {1}"
.format(operational_stat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def operational_status(self, operational_status):\n\n self._operational_status = operational_status",
"def operational_status(self, operational_status):\n\n self._operational_status = operational_status",
"def operation_state(self, operation_state):\n\n self._operation_state = operation_st... | [
"0.6623259",
"0.6623259",
"0.6101698",
"0.5693205",
"0.56924415",
"0.5691022",
"0.56134856",
"0.5601487",
"0.5581799",
"0.5563682",
"0.5563682",
"0.5563682",
"0.5563682",
"0.5563682",
"0.5563682",
"0.5563682",
"0.5563682",
"0.5563682",
"0.5563682",
"0.5563682",
"0.5563682",
... | 0.70021296 | 0 |
Gets the termination_direction of this ConnectionEndPoint. | def termination_direction(self) -> str:
return self._termination_direction | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def termination_direction(self, termination_direction: str):\n allowed_values = [\"BIDIRECTIONAL\", \"SINK\", \"SOURCE\", \"UNDEFINED_OR_UNKNOWN\"] # noqa: E501\n if termination_direction not in allowed_values:\n raise ValueError(\n \"Invalid value for `termination_directio... | [
"0.6747025",
"0.6339703",
"0.6330633",
"0.6314831",
"0.6202958",
"0.61843795",
"0.61089504",
"0.6067965",
"0.60548645",
"0.5998903",
"0.5955845",
"0.59224766",
"0.58646476",
"0.5852054",
"0.5817432",
"0.5813375",
"0.5800287",
"0.57266474",
"0.5713044",
"0.57085085",
"0.570361... | 0.8100644 | 0 |
Sets the termination_direction of this ConnectionEndPoint. | def termination_direction(self, termination_direction: str):
allowed_values = ["BIDIRECTIONAL", "SINK", "SOURCE", "UNDEFINED_OR_UNKNOWN"] # noqa: E501
if termination_direction not in allowed_values:
raise ValueError(
"Invalid value for `termination_direction` ({0}), must be ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_termination(self, termination):\n # FIXME should be internally accessible only?\n self.__termination = termination",
"def termination_direction(self) -> str:\n return self._termination_direction",
"def direction(self, direction):\n\n self._direction = direction",
"def set_... | [
"0.640824",
"0.63931453",
"0.56420517",
"0.5394109",
"0.53315324",
"0.52557427",
"0.52557427",
"0.52557427",
"0.5211987",
"0.51994586",
"0.5056376",
"0.5056376",
"0.5051297",
"0.5051297",
"0.5045381",
"0.5027594",
"0.4985935",
"0.4943825",
"0.49381512",
"0.49232072",
"0.48966... | 0.7977831 | 0 |
Gets the termination_state of this ConnectionEndPoint. | def termination_state(self) -> str:
return self._termination_state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def termination(self):\n return self.__termination",
"def get_ssl_termination(self):\n return self.manager.get_ssl_termination(self)",
"def terminating_on(self):\n return self._terminating_on",
"def terminated(self):\n return self._terminated",
"def terminated(self):\n re... | [
"0.65559936",
"0.6262929",
"0.62271124",
"0.6188171",
"0.6188171",
"0.6125202",
"0.60600793",
"0.6005115",
"0.5923498",
"0.56676537",
"0.5665788",
"0.56531096",
"0.5590717",
"0.557181",
"0.5468976",
"0.5463126",
"0.5419899",
"0.5410675",
"0.5404743",
"0.5395988",
"0.5296206",... | 0.7544638 | 0 |
Sets the termination_state of this ConnectionEndPoint. | def termination_state(self, termination_state: str):
allowed_values = ["LP_CAN_NEVER_TERMINATE", "LT_NOT_TERMINATED", "TERMINATED_SERVER_TO_CLIENT_FLOW", "TERMINATED_CLIENT_TO_SERVER_FLOW", "TERMINATED_BIDIRECTIONAL", "LT_PERMENANTLY_TERMINATED", "TERMINATION_STATE_UNKNOWN"] # noqa: E501
if termination... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_termination(self, termination):\n # FIXME should be internally accessible only?\n self.__termination = termination",
"def terminated(self, terminated):\n\n self._terminated = terminated",
"def terminated(self, terminated):\n\n self._terminated = terminated",
"def terminate... | [
"0.6452473",
"0.5807092",
"0.5807092",
"0.5807092",
"0.5624698",
"0.55612886",
"0.54337186",
"0.5364221",
"0.5222837",
"0.4969389",
"0.4969389",
"0.49535656",
"0.48852345",
"0.4882801",
"0.48434332",
"0.48371",
"0.48204172",
"0.47924957",
"0.47783226",
"0.47641855",
"0.476255... | 0.6799398 | 0 |
Gets the layer_protocol_name of this ConnectionEndPoint. | def layer_protocol_name(self) -> str:
return self._layer_protocol_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layer_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"layer_name\")",
"def layer_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"layer_name\")",
"def protocol(self) -> str:\n return self.__parameters.protocol",
"def layer_protocol_name(self, layer... | [
"0.6991893",
"0.6737981",
"0.6655885",
"0.66094315",
"0.6580004",
"0.6526617",
"0.64756644",
"0.64686406",
"0.6449779",
"0.6433681",
"0.6416226",
"0.64074725",
"0.63770485",
"0.63522774",
"0.63161236",
"0.62349397",
"0.61921996",
"0.618826",
"0.6171238",
"0.6171238",
"0.61439... | 0.87370723 | 0 |
Sets the layer_protocol_name of this ConnectionEndPoint. | def layer_protocol_name(self, layer_protocol_name: str):
allowed_values = ["OTSiA", "OCH", "OTU", "ODU", "ETH", "ETY", "DSR"] # noqa: E501
if layer_protocol_name not in allowed_values:
raise ValueError(
"Invalid value for `layer_protocol_name` ({0}), must be one of {1}"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layer_protocol_name(self) -> str:\n return self._layer_protocol_name",
"def layer(self, layer):\n self._layer = layer",
"def protocol_id(self, protocol_id):\n self._protocol_id = protocol_id",
"def protocol_id(self, protocol_id):\n\n self._protocol_id = protocol_id",
"def pr... | [
"0.70598274",
"0.5782147",
"0.57290965",
"0.57289034",
"0.5708312",
"0.5688233",
"0.56085056",
"0.56085056",
"0.56085056",
"0.56085056",
"0.5562985",
"0.54273206",
"0.5392024",
"0.53690857",
"0.53411305",
"0.52844375",
"0.5257484",
"0.52147466",
"0.5196867",
"0.50834507",
"0.... | 0.79915446 | 0 |
Gets the connectivity_service_end_point of this ConnectionEndPoint. | def connectivity_service_end_point(self) -> str:
return self._connectivity_service_end_point | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connectivity_service_end_point(self, connectivity_service_end_point: str):\n\n self._connectivity_service_end_point = connectivity_service_end_point",
"def get_endpoint(self):\r\n return self._endpoint",
"def __get_endpoint(self):\n return self._endpoint",
"def connected_endpoint(sel... | [
"0.70261055",
"0.63055533",
"0.62776625",
"0.6240966",
"0.61877346",
"0.6100025",
"0.60089487",
"0.60035914",
"0.59879875",
"0.5943736",
"0.5943736",
"0.56929696",
"0.5629272",
"0.5618605",
"0.56028825",
"0.55782425",
"0.5570696",
"0.5567195",
"0.5560139",
"0.5560139",
"0.556... | 0.825556 | 0 |
Sets the connectivity_service_end_point of this ConnectionEndPoint. | def connectivity_service_end_point(self, connectivity_service_end_point: str):
self._connectivity_service_end_point = connectivity_service_end_point | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connectivity_service_end_point(self) -> str:\n return self._connectivity_service_end_point",
"def graph_endpoint(self, graph_endpoint):\n\n self._graph_endpoint = graph_endpoint",
"def setEndpoint(self, endpoint):\n self.__lockobj.acquire()\n self.__endpoints[endpoint.getEndpoin... | [
"0.635812",
"0.5773693",
"0.56269103",
"0.53948677",
"0.53651756",
"0.53116417",
"0.525991",
"0.5178036",
"0.5159906",
"0.5135377",
"0.50487715",
"0.50400984",
"0.49996492",
"0.4988267",
"0.4931792",
"0.48966828",
"0.48765537",
"0.4869402",
"0.48534063",
"0.48342404",
"0.4833... | 0.85730124 | 0 |
Gets the parent_node_edge_point of this ConnectionEndPoint. | def parent_node_edge_point(self) -> List[str]:
return self._parent_node_edge_point | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getParent(self):\n return self.parent_edge",
"def edges_parent(self):\n return self._edges_parent",
"def get_parent_id(self):\n return self._parent_id",
"def get_parent(self):\n return BinaryNode.or_none(self.parent)",
"def parent_id(self):\n return self._parent_id",
... | [
"0.7909449",
"0.7849635",
"0.72225994",
"0.71083087",
"0.6985489",
"0.6985489",
"0.69378465",
"0.6932805",
"0.6929256",
"0.6897707",
"0.6897707",
"0.6897707",
"0.68958336",
"0.686817",
"0.68395025",
"0.68314517",
"0.6809207",
"0.6806697",
"0.6785802",
"0.6785802",
"0.67726624... | 0.7929555 | 0 |
Sets the parent_node_edge_point of this ConnectionEndPoint. | def parent_node_edge_point(self, parent_node_edge_point: List[str]):
self._parent_node_edge_point = parent_node_edge_point | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setParent(self, edge):\n self.parent_edge = edge",
"def set_parent(self, parent_node):\n self.set_parent = parent_node",
"def set_parent(self, parent: \"BaseSegment\") -> None:\n self._parent = weakref.ref(parent)",
"def set_parent(self, parent):\n self._parent = parent",
"d... | [
"0.77046937",
"0.7487442",
"0.6870154",
"0.65892845",
"0.6562548",
"0.6562548",
"0.6562548",
"0.6562548",
"0.65572673",
"0.6549818",
"0.65178555",
"0.64919025",
"0.6487479",
"0.6479882",
"0.64650625",
"0.64650625",
"0.64604414",
"0.63897806",
"0.63681376",
"0.63280916",
"0.63... | 0.8324284 | 0 |
Gets the client_node_edge_point of this ConnectionEndPoint. | def client_node_edge_point(self) -> List[str]:
return self._client_node_edge_point | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_node_edge_point(self, client_node_edge_point: List[str]):\n\n self._client_node_edge_point = client_node_edge_point",
"def parent_node_edge_point(self) -> List[str]:\n return self._parent_node_edge_point",
"def edges_parent(self):\n return self._edges_parent",
"def get_edge_co... | [
"0.7040182",
"0.6694296",
"0.6014033",
"0.579763",
"0.5779725",
"0.5725222",
"0.5720722",
"0.56671035",
"0.566444",
"0.5613887",
"0.56126505",
"0.5602985",
"0.55665207",
"0.5564498",
"0.5508583",
"0.55030704",
"0.54853576",
"0.54559284",
"0.545324",
"0.545324",
"0.54242283",
... | 0.78359306 | 0 |
Sets the client_node_edge_point of this ConnectionEndPoint. | def client_node_edge_point(self, client_node_edge_point: List[str]):
self._client_node_edge_point = client_node_edge_point | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_node_edge_point(self, parent_node_edge_point: List[str]):\n\n self._parent_node_edge_point = parent_node_edge_point",
"def setParent(self, edge):\n self.parent_edge = edge",
"def client_node_edge_point(self) -> List[str]:\n return self._client_node_edge_point",
"def set_node(s... | [
"0.64545894",
"0.5764588",
"0.5657335",
"0.5621235",
"0.56201965",
"0.5616962",
"0.54884785",
"0.54075307",
"0.53285813",
"0.5285194",
"0.527346",
"0.52295053",
"0.50200117",
"0.49891022",
"0.4982168",
"0.49503762",
"0.49278897",
"0.49262947",
"0.49262947",
"0.49262947",
"0.4... | 0.84220517 | 0 |
Gets the connection_port_direction of this ConnectionEndPoint. | def connection_port_direction(self) -> str:
return self._connection_port_direction | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_port_direction(self, port):\n if port == 1:\n self.__port_b_direction = self.__bus.read_byte_data(\n self.__ioaddress, self.IODIRB)\n return self.__port_b_direction\n else:\n self.__port_a_direction = self.__bus.read_byte_data(\n ... | [
"0.7422299",
"0.7100193",
"0.6954227",
"0.6906184",
"0.6850313",
"0.6784414",
"0.6750329",
"0.6648726",
"0.6547236",
"0.65026873",
"0.64180374",
"0.6364987",
"0.63177645",
"0.6307946",
"0.6284133",
"0.6239046",
"0.62192076",
"0.6218952",
"0.6201423",
"0.6183298",
"0.61322004"... | 0.8515388 | 0 |
Sets the connection_port_direction of this ConnectionEndPoint. | def connection_port_direction(self, connection_port_direction: str):
allowed_values = ["BIDIRECTIONAL", "INPUT", "OUTPUT", "UNIDENTIFIED_OR_UNKNOWN"] # noqa: E501
if connection_port_direction not in allowed_values:
raise ValueError(
"Invalid value for `connection_port_direct... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_port_direction(self, port, direction):\n\n if port == 1:\n self.__bus.write_byte_data(\n self.__ioaddress, self.IODIRB, direction)\n self.__port_b_direction = direction\n else:\n self.__bus.write_byte_data(\n self.__ioaddress, sel... | [
"0.72491103",
"0.6883171",
"0.61560464",
"0.59813505",
"0.5803918",
"0.5802289",
"0.5751801",
"0.56792367",
"0.56702006",
"0.56702006",
"0.5623771",
"0.5623771",
"0.5603514",
"0.55927914",
"0.558962",
"0.5573132",
"0.55627877",
"0.5492916",
"0.5368065",
"0.53601414",
"0.53387... | 0.77216226 | 0 |
Gets the connection_port_role of this ConnectionEndPoint. | def connection_port_role(self) -> str:
return self._connection_port_role | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connection_port_role(self, connection_port_role: str):\n allowed_values = [\"SYMMETRIC\", \"ROOT\", \"LEAF\", \"TRUNK\", \"UNKNOWN\"] # noqa: E501\n if connection_port_role not in allowed_values:\n raise ValueError(\n \"Invalid value for `connection_port_role` ({0}), mu... | [
"0.6675221",
"0.6536682",
"0.64771336",
"0.643482",
"0.63028085",
"0.62838185",
"0.62733996",
"0.62726057",
"0.6268773",
"0.61741924",
"0.61579907",
"0.61579907",
"0.61579907",
"0.6105567",
"0.6075074",
"0.5997939",
"0.59857833",
"0.59406775",
"0.59406775",
"0.59406775",
"0.5... | 0.8586469 | 0 |
Sets the connection_port_role of this ConnectionEndPoint. | def connection_port_role(self, connection_port_role: str):
allowed_values = ["SYMMETRIC", "ROOT", "LEAF", "TRUNK", "UNKNOWN"] # noqa: E501
if connection_port_role not in allowed_values:
raise ValueError(
"Invalid value for `connection_port_role` ({0}), must be one of {1}"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connection_port_role(self) -> str:\n return self._connection_port_role",
"def set_port(self, party_port) -> None:\n\n self._port = party_port",
"def setport(self, port):\n self.__port = port",
"def set_task_role(self, task_role):\n self._task_role = task_role",
"def port(sel... | [
"0.7050339",
"0.5935539",
"0.58579373",
"0.5754634",
"0.56839955",
"0.56839955",
"0.56839955",
"0.55978996",
"0.5477563",
"0.5477563",
"0.540866",
"0.5401389",
"0.5297533",
"0.5271658",
"0.5263875",
"0.5263875",
"0.5228858",
"0.51936316",
"0.51936316",
"0.5122609",
"0.511871"... | 0.7690575 | 0 |
Resolve the free type variables of a constructor given the argument types we instantiate the class with. This means we need to match up argument types with variables from the class layout. In the most general case this means we need to fixpoint infer all methods called from the constructor. | def infer_constructor_application(classtype, argtypes):
# Figure out the list of argtypes
cls = classtype.impl
init = cls.__init__.py_func
argtypes = fill_missing_argtypes(init, tuple(argtypes))
# Determine __init__ argnames
argspec = inspect.getargspec(init)
assert not argspec.varargs
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args):\n self.types = tuple([trait_from(arg) for arg in args])\n self.fast_validate = (9, self.types)",
"def resolve_types(cls, types: dict) -> Callable:\n return functools.partial(resolve_annotations, annotations=cls.annotations(types))",
"def __init__(self):\n\n ... | [
"0.61208606",
"0.59640104",
"0.5496596",
"0.5320413",
"0.5247586",
"0.52279824",
"0.5196888",
"0.5152734",
"0.510851",
"0.50768083",
"0.50480545",
"0.50430393",
"0.5022698",
"0.4972331",
"0.4889604",
"0.48878282",
"0.48712242",
"0.48436376",
"0.48328483",
"0.4810371",
"0.4807... | 0.6475425 | 0 |
Creates a new boto assignment mock class with the given fields supplied with the specified values. | def make_boto_assignment(values):
assignment = mock.MagicMock()
assignment.AssignmentId = str(uuid.uuid4())
assignment.HITId = str(uuid.uuid4())
assignment.WorkerId = str(uuid.uuid4())
assignment.answers = [[]]
for key, value in values.items():
answer_mock = mock.MagicMock()
ans... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, **attributes):\n self.set(**attributes)",
"def __init__(self, **kwargs):\n default_values = {\n 'name': 'Organization Name',\n 'ubi': 'Unified Business Identifier',\n 'address_line_1': '',\n 'address_line_2': '',\n 'city': ''... | [
"0.5649793",
"0.56196696",
"0.561045",
"0.55781025",
"0.54637",
"0.5424052",
"0.53738207",
"0.53738207",
"0.5343687",
"0.53170776",
"0.526791",
"0.52672625",
"0.5237828",
"0.52287626",
"0.52287626",
"0.52287626",
"0.5224568",
"0.52163136",
"0.52153605",
"0.52097565",
"0.52061... | 0.73545164 | 0 |
Adds some html content after the first plugin from a specific placeholder gets rendered | def add_extra_html(instance, placeholder, rendered_content, original_context):
html_before = getattr(placeholder, '_extra_html_before', '')
html_after = getattr(placeholder, '_extra_html_after', '')
if not html_before and not html_after:
return rendered_content
template_data = ['{{rendered_cont... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_render_placeholder_cache(self):\n invalidate_cms_page_cache()\n ex = Example1(\n char_1='one',\n char_2='two',\n char_3='tree',\n char_4='four'\n )\n ex.save()\n ph1 = ex.placeholder\n ###\n # add the test plugin\... | [
"0.6580603",
"0.6060545",
"0.58660084",
"0.5402581",
"0.5378079",
"0.53726566",
"0.53519636",
"0.5350145",
"0.5341262",
"0.5288138",
"0.52814656",
"0.5248689",
"0.52272385",
"0.52205735",
"0.5199112",
"0.51644737",
"0.5150898",
"0.5070091",
"0.5054961",
"0.4986646",
"0.497368... | 0.61032104 | 1 |
Test task with error in command. | def test_cmd_error(self):
task = Task("uid", False, False, "does_not_exist", None, ".")
task._checkpoint_dir = tmp_checkpoint_dir()
with self.assertRaisesRegexp(RuntimeError, ".*executing Task's command:.*"):
task.run()
task.shell = True
with self.assertRaisesRegexp(R... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_verify_error(self):\n task = Task(\"uid\", False, False, \"echo\", \"does_not_exist\", \".\", \"A\")\n task._checkpoint_dir = tmp_checkpoint_dir()\n with self.assertRaisesRegexp(RuntimeError, \".*executing Task's verification:.*\"):\n task.run()\n task.shell = True\n... | [
"0.753934",
"0.7510016",
"0.7355977",
"0.7223339",
"0.68849444",
"0.67912555",
"0.67883474",
"0.6771038",
"0.67178786",
"0.67099845",
"0.6694828",
"0.669401",
"0.6689271",
"0.6554793",
"0.6538062",
"0.6508295",
"0.647738",
"0.64662874",
"0.6459306",
"0.6447651",
"0.64386034",... | 0.8290416 | 0 |
Test task with error in verification. | def test_verify_error(self):
task = Task("uid", False, False, "echo", "does_not_exist", ".", "A")
task._checkpoint_dir = tmp_checkpoint_dir()
with self.assertRaisesRegexp(RuntimeError, ".*executing Task's verification:.*"):
task.run()
task.shell = True
with self.asser... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _test_run_with_short_error_msg(self, task_class):\r\n task_entry = self._create_input_entry()\r\n self.define_option_problem(PROBLEM_URL_NAME)\r\n expected_message = \"x\" * 900\r\n with self.assertRaises(TestTaskFailure):\r\n self._run_task_with_mock_celery(task_class, t... | [
"0.73252994",
"0.73072",
"0.73054326",
"0.7165724",
"0.7095742",
"0.70697004",
"0.70417243",
"0.69686437",
"0.6939323",
"0.67261666",
"0.6702976",
"0.66879827",
"0.661982",
"0.6608488",
"0.6605837",
"0.6578812",
"0.6557815",
"0.65573394",
"0.650568",
"0.6491746",
"0.64669424"... | 0.817874 | 0 |
List the iDRAC configuration settings | def list_idrac_settings(self):
return self._idrac_cfg.list_idrac_settings() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_config():\n console = Console()\n _config = loadConfig()\n json_data = richJSON.from_data({**asdict(_config)})\n console.print(Panel(json_data, title=\"SubmarineCliConfig\"))",
"def list_conf(self, kwargs):\n self.display(\n self.engine.query(\n self.engine.A... | [
"0.6941069",
"0.68482906",
"0.6822821",
"0.6753772",
"0.63854384",
"0.6331615",
"0.6239787",
"0.6238235",
"0.62348956",
"0.62288743",
"0.61923677",
"0.6163021",
"0.6163021",
"0.61327124",
"0.61241364",
"0.60989195",
"0.6065206",
"0.6030643",
"0.599483",
"0.59766704",
"0.59615... | 0.7821567 | 0 |
Creates a configuration job for applying all pending changes to an iDRAC. | def commit_pending_idrac_changes(
self,
idrac_fqdd='iDRAC.Embedded.1',
reboot=False,
start_time='TIME_NOW'):
return self._job_mgmt.create_config_job(
resource_uri=uris.DCIM_iDRACCardService,
cim_creation_class_name='DCIM_iDRACCardService',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commit_pending_raid_changes(self, raid_controller, reboot=False,\n start_time='TIME_NOW'):\n return self._job_mgmt.create_config_job(\n resource_uri=ironic_uris.DCIM_RAIDService,\n cim_creation_class_name='DCIM_RAIDService',\n cim_name=... | [
"0.5808297",
"0.57016754",
"0.5615414",
"0.55733514",
"0.5548497",
"0.53404003",
"0.52409655",
"0.5188993",
"0.51454985",
"0.51232415",
"0.51201946",
"0.51161766",
"0.5100845",
"0.50881994",
"0.5061088",
"0.50133616",
"0.50033385",
"0.49992248",
"0.49333566",
"0.4930864",
"0.... | 0.6341404 | 0 |
Applies all pending changes on the BIOS by creating a config job | def commit_pending_bios_changes(self, reboot=False, start_time='TIME_NOW'):
return self._job_mgmt.create_config_job(
resource_uri=ironic_uris.DCIM_BIOSService,
cim_creation_class_name='DCIM_BIOSService',
cim_name='DCIM:BIOSService',
target=self.BIOS_DEVICE_FQDD,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply(self) -> None:\n _ba.apply_config()",
"def update(cfg, jobs):\n server = jenkins_utils.server_factory(cfg)\n libjobs.updateJobs(server, jobs)",
"def work(self):\n self.config_file = self.args.config\n self.init_config()\n self.init_db()\n\n self.kickoff()",
... | [
"0.6116701",
"0.58427554",
"0.5800472",
"0.57430637",
"0.5740192",
"0.57239777",
"0.5652123",
"0.5632307",
"0.550247",
"0.54999334",
"0.54730254",
"0.54384893",
"0.5424404",
"0.5407469",
"0.53721374",
"0.535191",
"0.53240836",
"0.53215873",
"0.5314885",
"0.52854794",
"0.52800... | 0.61689615 | 0 |
Abandon all pending changes to a NIC. | def abandon_pending_nic_changes(self, nic_id):
self._job_mgmt.delete_pending_config(
resource_uri=uris.DCIM_NICService,
cim_creation_class_name='DCIM_NICService',
cim_name='DCIM:NICService',
target=nic_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forget(self):\n self.ingress_tbl.clear()\n self.rootsw_tbl.clear()",
"def wifi_off(self):\n self._clear_read_buffer()\n self._write_cmd(\"PE00\")\n time.sleep(100e-3)",
"def off_all(self):\n self._set_status(\"off\", \"11111111\")",
"def test_cancel_changes(self)... | [
"0.6279971",
"0.6219855",
"0.5948782",
"0.5866468",
"0.5858203",
"0.58529437",
"0.5757653",
"0.5757473",
"0.57033193",
"0.5649227",
"0.5646219",
"0.5580135",
"0.5578004",
"0.5567007",
"0.5552631",
"0.5535985",
"0.5527143",
"0.5524624",
"0.5520514",
"0.5509373",
"0.5508314",
... | 0.6980403 | 0 |
Apply all pending changes to a NIC by creating a configuration job. | def commit_pending_nic_changes(self, nic_id, reboot=False):
return self._job_mgmt.create_config_job(
resource_uri=uris.DCIM_NICService,
cim_creation_class_name='DCIM_NICService',
cim_name='DCIM:NICService',
target=nic_id,
reboot=reboot) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply(self, cleanup=False, activate=True):\n logger.info('applying network configs...')\n restart_interfaces = []\n restart_bridges = []\n update_files = {}\n all_file_names = []\n\n for interface_name, iface_data in self.interface_data.iteritems():\n route_... | [
"0.61803114",
"0.61700237",
"0.61677605",
"0.59301126",
"0.5694504",
"0.56244195",
"0.5596565",
"0.5453252",
"0.54015476",
"0.52718323",
"0.5243111",
"0.52348137",
"0.523452",
"0.51573193",
"0.5134133",
"0.51217157",
"0.5073438",
"0.50459903",
"0.5040554",
"0.49998853",
"0.49... | 0.7144519 | 0 |
Creates a configuration job. In CIM (Common Information Model), weak association is used to name an instance of one class in the context of an instance of another class. SystemName and SystemCreationClassName are the attributes of the scoping system, while Name and CreationClassName are the attributes of the instance o... | def create_config_job(self,
resource_uri,
cim_creation_class_name,
cim_name,
target,
cim_system_creation_class_name='DCIM_ComputerSystem',
cim_system_name='DCIM:Com... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createJob(self, joboptions, previousId=None):\n root = self.manifest.getRootResource()\n assert self.manifest.tosca\n job = Job(self, root, joboptions, previousId)\n\n if (\n self.manifest.localEnv\n and not joboptions.parentJob\n and not joboptions.... | [
"0.5764026",
"0.5601463",
"0.55534786",
"0.55200636",
"0.5493523",
"0.5493523",
"0.54148227",
"0.5414623",
"0.5357444",
"0.5340673",
"0.52934015",
"0.52929705",
"0.5279595",
"0.5178549",
"0.51695275",
"0.515132",
"0.5135416",
"0.51059264",
"0.50979036",
"0.50941366",
"0.50646... | 0.7400147 | 0 |
Creates a configuration job for applying all pending changes to a NIC. | def create_nic_config_job(
self,
nic_id,
reboot=False,
start_time='TIME_NOW'):
return self._job_mgmt.create_config_job(
resource_uri=uris.DCIM_NICService,
cim_creation_class_name='DCIM_NICService',
cim_name='DCIM:NICService',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commit_pending_nic_changes(self, nic_id, reboot=False):\n return self._job_mgmt.create_config_job(\n resource_uri=uris.DCIM_NICService,\n cim_creation_class_name='DCIM_NICService',\n cim_name='DCIM:NICService',\n target=nic_id,\n reboot=reboot)",
... | [
"0.6852771",
"0.57400745",
"0.5662997",
"0.55841076",
"0.52505565",
"0.5179049",
"0.5168917",
"0.5116165",
"0.50684077",
"0.50249934",
"0.50060546",
"0.49951974",
"0.49877572",
"0.4984114",
"0.49398127",
"0.48890617",
"0.4845154",
"0.48202658",
"0.4804889",
"0.47988567",
"0.4... | 0.63792557 | 1 |
Creates a reboot job. | def create_reboot_job(self,
reboot_type='graceful_reboot_with_forced_shutdown'):
return self._job_mgmt.create_reboot_job(reboot_type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_job_schedule(self):\n job_schedule_create = netapp_utils.zapi\\\n .NaElement.create_node_with_children(\n 'job-schedule-cron-create',\n **{'job-schedule-name': self.name})\n job_schedule_create.add_node_with_children(\n 'job-schedule-cron... | [
"0.57708925",
"0.5769493",
"0.5592167",
"0.55431616",
"0.5505705",
"0.5497413",
"0.53705674",
"0.53681993",
"0.5323312",
"0.5316519",
"0.5298177",
"0.5262912",
"0.52624005",
"0.5249387",
"0.52462703",
"0.5241022",
"0.5220556",
"0.5172969",
"0.51569784",
"0.50932425",
"0.50894... | 0.8060909 | 0 |
Deletes the given jobs. If no jobs are given, all jobs are deleted. | def delete_jobs(self, job_ids=['JID_CLEARALL']):
return self._job_mgmt.delete_jobs(job_ids) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self, jobs):\n assert isinstance(jobs, list), 'Jobs must be a list'\n assert len(jobs) > 0, 'One or more jobs required'\n\n req = list()\n if len(jobs) > 1:\n for r in self._batch_request(jobs):\n req.append(\n ''.join([self._sched... | [
"0.8024807",
"0.7764335",
"0.73224807",
"0.72803247",
"0.7052461",
"0.6834618",
"0.68255013",
"0.67485654",
"0.6677148",
"0.6632033",
"0.6413806",
"0.6378145",
"0.63686645",
"0.63380384",
"0.63329905",
"0.6238826",
"0.6130432",
"0.61263555",
"0.612368",
"0.6074361",
"0.606865... | 0.8079405 | 0 |
Obtain the legacy, nonUEFI, boot protocol of a NIC. | def get_nic_legacy_boot_protocol(self, nic_id):
return self._nic_cfg.get_nic_legacy_boot_protocol(nic_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_nic_legacy_boot_protocol(self, nic_id, value):\n return self._nic_cfg.set_nic_legacy_boot_protocol(nic_id, value)",
"def set_nic_legacy_boot_protocol_none(self, nic_id):\n return self._nic_cfg.set_nic_legacy_boot_protocol(nic_id, 'NONE')",
"def set_nic_legacy_boot_protocol_pxe(self, nic_i... | [
"0.69560814",
"0.66056216",
"0.63252735",
"0.62761366",
"0.610527",
"0.59243083",
"0.58971286",
"0.5884942",
"0.58824575",
"0.58585525",
"0.58509755",
"0.5845862",
"0.580865",
"0.57988596",
"0.5784832",
"0.57732546",
"0.5768472",
"0.57367367",
"0.57293147",
"0.5726689",
"0.57... | 0.81074166 | 0 |
Obtain the link status, up or down, of a NIC. | def get_nic_link_status(self, nic_id):
return self._nic_mgmt.get_nic_link_status(nic_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_interface_status(conn_obj, interface, device=\"dut\"):\n command = \"cat /sys/class/net/{}/operstate\".format(interface)\n if device==\"dut\":\n return utils_obj.remove_last_line_from_string(st.show(conn_obj, command, skip_tmpl=True))",
"def IsLinkup(nic,timeout):\n nic = nic.strip()\n ... | [
"0.6978756",
"0.6962209",
"0.68197346",
"0.63944924",
"0.6278568",
"0.6132206",
"0.6125867",
"0.6125867",
"0.60397744",
"0.6013797",
"0.6013276",
"0.59495616",
"0.5935399",
"0.5887618",
"0.5884482",
"0.5877811",
"0.58749413",
"0.5842111",
"0.5832965",
"0.5764003",
"0.5742055"... | 0.7465701 | 0 |
Obtain a setting of a NIC. | def get_nic_setting(self, nic_id, attribute_name):
return self._nic_cfg.get_nic_setting(nic_id, attribute_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nic_settings(bmc):\n nic_settings = bmc.list_nics()\n return nic_settings",
"def get_setting(self, setting):\n return self.do_rpc(\"get_setting\", key=key)",
"def set_nic_setting(self, nic_id, attribute_name, value):\n return self._nic_cfg.set_nic_setting(nic_id, attribute_name, val... | [
"0.6571858",
"0.61692965",
"0.590563",
"0.58731306",
"0.58425283",
"0.57504684",
"0.5736546",
"0.5717614",
"0.56472576",
"0.56174994",
"0.5604399",
"0.5568864",
"0.55311763",
"0.5528393",
"0.55063206",
"0.54884344",
"0.5479084",
"0.5471765",
"0.5459784",
"0.5432316",
"0.53471... | 0.7415658 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.