query_id
stringlengths
32
32
query
stringlengths
9
4.01k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
95eb8785976f83f94f082197f7eb07b6
Base scoring of a misere contract round.
[ { "docid": "3c27f353c5304059c0ee539b1c8b74c9", "score": "0.0", "text": "def score_misere(self, player, tricks):\n # Successful misere, player receives value of contract into the pool\n if tricks == 0:\n self.inc_pool(player, self.CONTRACT_VALUE[MISERE])\n # Failed misere, player receives v...
[ { "docid": "b64b6377b3fb44c0722b7c52a8961ab4", "score": "0.64262015", "text": "def score(self, round_number: int = 0) -> int:\n # We are assuming 1-indexed round numbers\n if round_number:\n if round_number > len(self.hand):\n return 0\n return self.han...
58f4d7bbff54905795fc687c6a761f53
Bulk set variables from arguments. Intended for internal use by the Set and From methods.
[ { "docid": "f05fda4f6a55f882a4c7fa9334414708", "score": "0.0", "text": "def Apply(self, args, kwargs):\n if len(args) == 1:\n arg = args[0]\n if isinstance(arg, dict):\n self.ApplyMap(arg)\n else:\n self.ApplyMap(dict(arg))\n elif len(args) > 1:\n self.ApplyMap(di...
[ { "docid": "98838b7ea7102453dc9d6be12a0d2909", "score": "0.6670922", "text": "def set(self, **kwargs):\r\n setAllArgs(self, kwargs)", "title": "" }, { "docid": "98ec79dba3f8112d1c67e2200a55b1fc", "score": "0.656707", "text": "def __setFourParameters(self, args):\n self.setM...
89f7327ed06d85dd9d8429a9a2ef528d
Shell sort. O(n^(3/2)) algorithm.
[ { "docid": "f42e521c6f005785f2a76c2ca39d9999", "score": "0.75712293", "text": "def shell_sort(array):\n # Gap between adjacent elements\n gap = int(len(array) / 2)\n while gap > 0:\n for position in range(gap, len(array)):\n # Insert element at position in its sub-array\n ...
[ { "docid": "7b265fc09557b6bbe24693d4f7fb382f", "score": "0.75653803", "text": "def shell_sort(a_list):\n start = time.time()\n list_count = len(a_list) // 2\n while list_count > 0:\n for start_position in range(list_count):\n gap_insertion_sort(a_list, start_position, list_cou...
6fb552c67c4bda0ffa2529c12ddc20a1
Run shell command with args and keywords
[ { "docid": "7076452a671592094e1121a1ae0d679d", "score": "0.6708656", "text": "def cmd(self, shellcmd, *args, **kwargs):\n _cmd = shellcmd.format(*args, **kwargs)\n self.log.info(_cmd)\n os.system(_cmd)", "title": "" } ]
[ { "docid": "dfba1f779d4fa088eb710c699712bfde", "score": "0.7237709", "text": "def do_shell(args):\n os.system(args)", "title": "" }, { "docid": "7e5155bf0d386e91f282e3d483ecd603", "score": "0.7085518", "text": "def do_shell(self, arg):\n run(arg.split())", "title": ...
ea0e1657d25fa363957a6c8004a0f67e
Allow header advertises REPORT
[ { "docid": "13b96c906996f5e22de31346f0ef2ac6", "score": "0.60892195", "text": "def test_allow_header_deltav(self):\n def do_test(response):\n response = IResponse(response)\n\n allow = response.headers.getHeader(\"allow\")\n if not allow:\n self.fai...
[ { "docid": "8d2003e1f6a54240820966697c8de90e", "score": "0.62994033", "text": "def report_only(self) -> None:\n self.header = \"Content-Security-Policy-Report-Only\"", "title": "" }, { "docid": "997e22d61331e7d9a7eff0758254bbbb", "score": "0.6258528", "text": "def report_heade...
605c3d2d364735d62b5ed1a9a8991a37
Get map of var_name > set(input var names) for the model
[ { "docid": "9e6522c73a1371b171b810c30a983e33", "score": "0.6106772", "text": "def make_compute_graph(self):\n input_map = {}\n for var_name in self.var_names:\n input_map[var_name] = self.get_parents(self.model[var_name])\n # add in constants\n input_map[va...
[ { "docid": "432c08e5e8607e48a63c1e3f3d993946", "score": "0.7184372", "text": "def variables(model: Model) -> AbstractSet[str]:\n assert is_model(model)\n return model.keys()", "title": "" }, { "docid": "9790cb9ad8fbc2913d8a9a64c0c38c45", "score": "0.69497913", "text": "def inpu...
596e3ab4ff641e249fde2c3008184dfb
Align post title to the Jekyll post name requirements.
[ { "docid": "5a92ae4ebde3914fad22ce99722836f8", "score": "0.0", "text": "def sanitize(str):\n res = str.lower()\n return res.replace(' ', '-')", "title": "" } ]
[ { "docid": "33b47465d97f487c74fc8226c22da8d1", "score": "0.62691516", "text": "def get_title(self, entry):\n title = _('%(title)s (%(word_count)i words)') % \\\n {'title': entry.title, 'word_count': entry.word_count}\n return title", "title": "" }, { "docid": "9a...
55aaa4dd8d5d0246f24c4c30303c69ca
Return True if entity is available.
[ { "docid": "9834f7b54461beea8e74ee1e5e1e64fe", "score": "0.0", "text": "def available(self) -> bool:\n return (\n super().available\n and self.serial_number in self.coordinator.data[\"climate\"]\n and \"temperature\" in self.coordinator.data[\"climate\"][self.seri...
[ { "docid": "1c89ccd3cdc881324348895730d33496", "score": "0.7533917", "text": "def available(self):\n return self.fetch.data is not None", "title": "" }, { "docid": "68b280265c7e1a24bcec0f5e12030eca", "score": "0.7303804", "text": "def available(self) -> bool:\n return s...
b1a1f78c1400329b156016f857d80ba4
MarkovNetwork.test_update_input_states() with invalid input
[ { "docid": "6f2c1d384b9725b8379bfd720da2b0eb", "score": "0.8879466", "text": "def test_update_input_states_invalid_input():\n np.random.seed(98342)\n test_mn = MarkovNetwork(2, 4, 2)\n try:\n test_mn.update_input_states([1, 1, 0])\n except Exception as e:\n assert type(e) is Va...
[ { "docid": "417db7ac04437880cc0294f26acee2ef", "score": "0.89389145", "text": "def test_update_input_states_bad_input():\n np.random.seed(98342)\n test_mn = MarkovNetwork(2, 4, 2)\n test_mn.update_input_states([-7, 2])\n assert np.all(test_mn.states[:2] == np.array([1, 1]))", "title": ""...
2889e4d95e1a2afe4725a0fa1246c57e
Ingest nodes capture data
[ { "docid": "91cea2ea0f95cb8ff3af87f82893d91c", "score": "0.0", "text": "async def capture_done(self):\n return {\"status\": \"capture_done\"}", "title": "" } ]
[ { "docid": "39747bb26a7f7002dc443639e32f9fb3", "score": "0.66707087", "text": "def execute_ingest(self):", "title": "" }, { "docid": "77c68669678699f652f264717b388401", "score": "0.6277186", "text": "def ingest(self, **kwargs) -> None:\n pass", "title": "" }, { "do...
9d5cf97fdf742bcc546ec4fe25d1aa88
M3VTEF creates the M3VTEF database and associated tables
[ { "docid": "e2ff9e012ab00969a943fb20e1aa7044", "score": "0.71232563", "text": "def run_M3VTEF_DB(db_connection, vegtype_ef_out, ClassID, Jrating):\n # Queries need to be executed in specific order\n # due to dependency of tables generated from previous queries\n print(\"\\n BEGINNING M3VTEF DB ...
[ { "docid": "f719ae0ee9f79c9006012525b8888d3e", "score": "0.7367714", "text": "def make_M3VTEF_tables(conn, csv_input_dir, Description_Vegetation, DB_SLA, DB_emissions):\n\n print(\"Creating M3VTEF DB tables from: %s\\n\" % csv_input_dir)\n csv_Canopy_Position_adjust = pd.read_csv(csv_input_dir + '...
195e6e8f38cc9fb6d6dc260e659ea85e
This function sends a register service command to the manager. THe manager then logs the event and add the local endpoint as the specified service (service_name).
[ { "docid": "84212171bf1d9a2ecd0ec53ab0d2bf8a", "score": "0.7933257", "text": "async def request_register_service(self):\n register_service = RegisterService(\n service=self._service_name,\n local_endpoint=self._local_endpoint,\n pid=self.pid,\n depth=se...
[ { "docid": "248ba0e97e0bdabed00c3d08d6622eaf", "score": "0.73495746", "text": "def _register_with_service_manager(self):\n process_id = os.getpid()\n routed_message = \\\n service_manager_messages.SvcMgrRegisterLocalServiceRoutedMessage(\n send_to='ServiceManager_...
b005e7c1fdfde1419f05fee06fbc5412
__init__ Function Initializes Constant Attributes for BitTimeConv Class
[ { "docid": "71881f03bec44c26ffe3d8dc64338714", "score": "0.58839476", "text": "def __init__(self):\r\n\r\n # Initialize Class Attributes\r\n self.START = timedelta(hours=3)\r\n self.END = timedelta(hours=23)\r\n self.T_UNIT = 15*60\r\n self.SPM = 60\r\n s...
[ { "docid": "a2ad54557cf04feb72ac398d2f684fa5", "score": "0.742722", "text": "def __init__(self):\n ## Convolution time per layer\n self.t_convolution = []\n ## Downsampling time per layer\n self.t_downsample_activation = []\n self.t_non_conv_layers = 0\n self.t_...
4b8718f5c1e2aa91801e74fabf31a1e9
Recursively convert Bunches in `d` to a regular dicts.
[ { "docid": "577f53696729e516eac0e979c595e16b", "score": "0.7504093", "text": "def unbunchify(d):\n return _convert(d, dict)", "title": "" } ]
[ { "docid": "250961978e717ef452175ddb37a456f1", "score": "0.67221117", "text": "def recursive_asdict(d):\n out = {}\n for k, v in asdict(d).iteritems():\n if hasattr(v, \"__keylist__\"):\n out[k] = recursive_asdict(v)\n elif isinstance(v, list):\n out[k] = []\n ...
9eb6839d03e64232b9bb7c334225d01a
Get the bcurve size with more options
[ { "docid": "0032ab02905825b65d578747246c6ddb", "score": "0.5603801", "text": "def IGetBCurveParamsSize3(self, WantCubicIn=defaultNamedNotOptArg, WantNRational=defaultNamedNotOptArg, ForceNonPeriodic=defaultNamedNotOptArg):\n\t\treturn self._oleobj_.InvokeTypes(61, LCID, 1, (3, 0), ((11, 1), (11, 1), (11...
[ { "docid": "11706e10d76bacfd435dc896fd9ade88", "score": "0.7180612", "text": "def IGetBCurveParamsSize(self, WantCubicIn=defaultNamedNotOptArg):\n\t\treturn self._oleobj_.InvokeTypes(16, LCID, 1, (3, 0), ((11, 1),),WantCubicIn\n\t\t\t)", "title": "" }, { "docid": "07a2610952d94e5bee604d2c9c9...
e369648db1ac23f96685962920b8f75e
Load metadata from multiple datasets into a single table with unique utterance ids for every row.
[ { "docid": "15f414d2309c786d99f101a1bbb42e9f", "score": "0.0", "text": "def load_all(corpus_dir, langs, usecols=USE_COLUMNS, num_processes=os.cpu_count()):\n if num_processes > 0:\n with multiprocessing.Pool(processes=num_processes) as pool:\n lang_dfs = pool.starmap(load, ((corpus_...
[ { "docid": "3a708ea54b609df8d7d514f6a89b6e5b", "score": "0.63951355", "text": "def load_metadata_adaptive_all(**kwargs):\n kwargs['cohort'] = 'both'\n metadata_emerson = load_metadata_emerson(**kwargs)\n metadata_lindau = load_metadata_lindau(**kwargs)\n metadata = pd.concat([metadata_emerso...
c28aee430da2c76ae2914d6aeca5a13d
Gets the SharesCollectionPage in async
[ { "docid": "0e1bf656fcc455cff94a91681137bf7c", "score": "0.63819665", "text": "def get_async(self):\n future = self._client._loop.run_in_executor(None,\n self.get)\n collection_page = yield from future\n return collection_page", ...
[ { "docid": "47a58e4fad06da48e8ef633f63ef95ff", "score": "0.73378843", "text": "def collection_page(self):\n if self._collection_page:\n self._collection_page._prop_list = self._prop_dict[\"value\"]\n else:\n self._collection_page = SharesCollectionPage(self._prop_dict...
93362519e55e546b3e963fd8b86ee02a
read excel file for target
[ { "docid": "68c86ecf7a8fdfb2368874eb0d6b6e87", "score": "0.7322174", "text": "def read_excel(target):\n \n bpath = '/home/sam/Dropbox/HIGP/Crater_Lakes/Dmitri_Sam/data/{0}/{0}'.format(target)\n fpath = '{0}_satellite.xlsx'.format(bpath)\n df = pd.read_excel(fpath)\n\n # set datetime as index\n df ...
[ { "docid": "de8846ccf04c7035ebfb08f8da3a26b5", "score": "0.71546036", "text": "def _read_excel(self):\n self.workbook = xlrd.open_workbook(self.handler.output_file_path)\n self.worksheet = self.workbook.sheet_by_index(0)", "title": "" }, { "docid": "c3aff5b016160299da8a4b585640...
398be6fb10a69c0a785eb240f174c075
Does a POST request to /public/clusters/cloudEdition. Sends a request to create a new Cloud Edition Cohesity Cluster and returns the IDs, name, and software version of the new cluster. Also returns the status of each node.
[ { "docid": "be7e214a76a89f11be93995025f6cc40", "score": "0.7171899", "text": "def create_cloud_cluster(self, body):\n try:\n self.logger.info('create_cloud_cluster called.')\n\n # Validate required parameters\n self.logger.info(\n 'Validating requir...
[ { "docid": "985f340a66c978a5cae7d74f141e616b", "score": "0.72254884", "text": "def create_expand_cloud_cluster(self, body):\n try:\n self.logger.info('create_expand_cloud_cluster called.')\n\n # Validate required parameters\n self.logger.info(\n 'Va...
649087d6ced5dca822efab808bee8372
Custom premake hook for building libjpeg.
[ { "docid": "3f4fd333dbfc50897df7f0c581deac67", "score": "0.47270572", "text": "def pre_configure(options, buildout):\n os.system(\"sh autogen.sh\")", "title": "" } ]
[ { "docid": "3df4074d540a4efc12734b5d27c2b239", "score": "0.55957216", "text": "def _jpgProcess(sourceFile):\n if utils.isToolPresent('jpegtran'):\n args = ['-optimize',\n '-progressive',\n '-copy', 'none',\n ]\n return utils.pipeRun('jpegtran...
3262375d1f6c329c5b91d05fbc3cd507
Build a random vector with random indexes Thiago F Pappacena integer size The vector size float min The minimum random number float max The maximum random number
[ { "docid": "3159f2a650547ec677599fac03d5b500", "score": "0.7505865", "text": "def makeRandomVector(size, min = 0.0, max = 1.0):\n import random\n return tuple([min + (random.random() * (max-min)) for i in range(size)])", "title": "" } ]
[ { "docid": "0399617dbc736d7223479c5119f263e2", "score": "0.720517", "text": "def gen_vector(size):\n ret = []\n for _ in range(size):\n ret.append(random.randint(0, 20))\n \n return(ret)", "title": "" }, { "docid": "c58773bfd20fbb308bce725a48a9e39e", "score": "0.719733...
a06723196544353c4f3557cc9541c3d1
`without_role_check` returns `False` if `Context.author` has unwanted role.
[ { "docid": "c75b617f8fa485e3043cce60070c8a5d", "score": "0.7814249", "text": "def test_without_role_check_returns_false_with_unwanted_role(self):\n role_id = 42\n self.ctx.author.roles.append(MockRole(id=role_id))\n self.assertFalse(checks.without_role_check(self.ctx, role_id))", ...
[ { "docid": "00cd2fe15e15fb6a12b5a5d2315858b8", "score": "0.7967805", "text": "def test_with_role_check_without_required_roles(self):\n self.ctx.author.roles = []\n self.assertFalse(checks.with_role_check(self.ctx))", "title": "" }, { "docid": "13990780036da3b2db8f1e73dc9e80d5",...
c732de38d48d22cb8ff99906815730e3
Returns argument at given index, else none.
[ { "docid": "5723224e2b2c339c3814707f91f0d21e", "score": "0.0", "text": "def get(self, x):\r\n try:\r\n return self.all[x]\r\n except IndexError:\r\n return None", "title": "" } ]
[ { "docid": "1b435c63ddb1ed3e184f9ee53599ada4", "score": "0.72445065", "text": "def arg(self, index):\n\n if self.current_node.is_a(lpl.CallExpr):\n return self._with_current_node(\n self.current_node.f_suffix[index].f_expr\n )\n elif self.current_node.i...
b5d32bc7d4481a83810dc500fab61f8f
Render the output into the proper format.
[ { "docid": "75e6d2cf5d65171f1b0fe0b14321f787", "score": "0.0", "text": "def process_result(results, output_format, **kwargs):\n module_name = 'monitorstack.common.formatters'\n method_name = 'write_{}'.format(output_format.replace('-', '_'))\n output_formatter = getattr(\n importlib.impo...
[ { "docid": "c25af8348f8522a3cff527bba3ff3fa4", "score": "0.72547436", "text": "def render():", "title": "" }, { "docid": "5ef62b7811a31f1f104641cb0374764d", "score": "0.68567944", "text": "def render(self):\n pass", "title": "" }, { "docid": "5ef62b7811a31f1f104641...
2d51276f3ae132f7a728c654f3f18324
Allows you to retry opening the file if theres an IOError so that 2 hour processing run isn't wasted.
[ { "docid": "55ab7254fefe31bfd1a63a5dbfd1a2be", "score": "0.630632", "text": "def retry_open(fl, *args, **kwargs):\n while True:\n try:\n return codecs.open(fl, *args, **kwargs)\n except IOError as ex:\n sys.stdout.write(\"{0} when opening {1}\\n\".format(ex, fl))\n...
[ { "docid": "ea3e0d12da9b85a41269447fc1a7a0fd", "score": "0.6223054", "text": "def test_lock_file_error(self):\n with tempfile.TemporaryFile() as fp:\n fp.close()\n with pytest.raises(ValueError):\n with lock_file(fp):\n pass", "title": "...
d80eaebe061dba2fec374effb1258b7b
Gets the query interface for a parameter.
[ { "docid": "40b48b8c6bd432aa87c4cb285b04c1ec", "score": "0.7126727", "text": "def get_parameter_query(self):\n return # osid.configuration.ParameterQuery", "title": "" } ]
[ { "docid": "4b7819f700261f5e24fb35c743438eb6", "score": "0.6674734", "text": "def query_parameter(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"query_parameter\")", "title": "" }, { "docid": "27054f178c9db5c9c41275d118edd515", "score": "0.62531286", "text":...
3f54b1b2a4c1f7c4ea0c9dee34adadc7
kk is a vector of k values, zval is a scalar. Returns P(kk,zval)
[ { "docid": "3a3e93bff869cb81a5562e778ece9ada", "score": "0.7042401", "text": "def interpolate(self,kk,zval):\n pofz = np.dot(self.pktable,self.lagrange_spam(zval))\n pk = np.interp(kk,self.kk,pofz)\n return(pk)\n #", "title": "" } ]
[ { "docid": "f767fef19dc479ea256fa605aad67d44", "score": "0.6809561", "text": "def __call__(self,z=1.0):\n pofz = np.dot(self.pktable,self.lagrange_spam(z))\n return((self.kk,pofz))\n #", "title": "" }, { "docid": "f767fef19dc479ea256fa605aad67d44", "score": "0.680956...
3d6427bc986034793e2e2844a5d522cb
Get sensor temperature value from dictionary list.
[ { "docid": "186790b4769487ff6bb59a48265a5e30", "score": "0.0", "text": "def read():\n\n # Check if temperature list is empty\n if not global_dict['temperature']:\n temp = {}\n # Get first element from temperature list, and then pop it from list\n else:\n temp = [t for t in glob...
[ { "docid": "e08185ab808b9ad7dbaecaeb1dc17c9e", "score": "0.6676416", "text": "def get_temperature(self):\n return self.result['current_conditions']['temp_c']", "title": "" }, { "docid": "c17f85daa53c33a28dcecaf9d7f69ea7", "score": "0.6675716", "text": "def get_sensor_temperature(s...
9a47bf42baf67f0fb9006cccbb52312e
Method to find the comfort zone for the robot to begin measure ambience
[ { "docid": "6a104ff13eeccbb52661329a21970444", "score": "0.57630306", "text": "def comfortZone():\n # If the robot is too close with a wall in front, or if it is touching the wall\n if robot.readDistance() < DISTANCE_TO_WALL or robot.readTouch()[0] == 1:\n robot.backward(SPEED_MOVEMENT, 0.5...
[ { "docid": "30982d4ec599f57101bd074c18227ad4", "score": "0.57420546", "text": "def antenna():", "title": "" }, { "docid": "7e0c4028b64b6011945b4d82211ea695", "score": "0.5630881", "text": "def atgoal(self):\n\n return np.sqrt(np.sum((self.position[:, self.t] - self.platform_lo...
d92a22a0968fefe94ea8f346ec69e7e8
Returns artifacts with spans in [start_span, end_span] inclusive. This resolver function is based on the spanversion semantics, which only considers the latest version of each span. If you want to keep all versions, then set keep_all_versions=True. Input artifacts must have both "span" int property and "version" int pr...
[ { "docid": "375e6a0514b8a2cbb01e2ba741ae8d7f", "score": "0.79851294", "text": "def static_range(artifacts,\n *,\n start_span_number: int = -1,\n end_span_number: int = -1,\n keep_all_versions: bool = False,\n exclude_span_nu...
[ { "docid": "db98839d51840100dbe276ad0430e33e", "score": "0.6690784", "text": "def rolling_range(artifacts,\n *,\n start_span_number: int = 0,\n num_spans: int = 1,\n skip_num_recent_spans: int = 0,\n keep_all_versions: ...
99f78cd801828c47c468dde22fed4952
plots the final result of the trained model on the input data
[ { "docid": "39189d822a479cbe3249845e807a280d", "score": "0.0", "text": "def plot_3d_mlp(epoch=100, nand=False):\n if not nand:\n inputs, labels = dataset(2, 200)\n else:\n inputs, labels = dataset_nand(2, 200)\n\n mlp = MLP(2, 2, epoch)\n mlp.train(inputs, labels)\n x_1 = in...
[ { "docid": "6dd78742d784ef5ffeae68abe49fe372", "score": "0.7612694", "text": "def visualize_model():\n sns.set_style(\"darkgrid\")\n plt.scatter(x=y_test, y=y_predict, alpha=0.4)\n\n plt.xlabel(\"Actual prices\")\n plt.ylabel(\"Predicted prices\")\n plt.title(\"Actual vs Predicted prices\...
13aa2d7782d9b5810a055a80e3e9e114
Find application and its corresponding versions
[ { "docid": "d47acf5dcd33af52c89b45a996862281", "score": "0.0", "text": "def write_to_csv_check_application_versions():\n process_list = backdoor.check_application_version()\n\n if process_list:\n # Write to CSV file\n final_file_path = read_configure_file('file_location', value='appl...
[ { "docid": "9aecd4f08ea2caedf7097609f00b2eb9", "score": "0.7185892", "text": "def versions_for_app(app_path):\n assert(os.path.isdir(app_path))\n\n versions = set()\n\n for potential_version in os.listdir(app_path):\n # Skip invalid entries\n if potential_version.startswith(\".\")...
88b60b38933845833091e1930c7fc728
Testing if the ``DocumentManager`` retrieves the correct objects.
[ { "docid": "667e1b8a43b0683139b26a934093703d", "score": "0.6640915", "text": "def test_manager(self):\n request = Mock(LANGUAGE_CODE='de')\n self.assertEqual(\n models.Document.objects.published(request).count(), 1, msg=(\n 'In German, there should be one publishe...
[ { "docid": "f9c9d1bd862ae9183edf36403f90dc66", "score": "0.71074057", "text": "def test_client_document_retrieve(self):\n pass", "title": "" }, { "docid": "ceeba713fa4c7f6491558110e856064b", "score": "0.69682175", "text": "def test_documents_for(self):\n # Test the defa...
34ddb702a86b35078394c58921e0456b
Get get general document preferences from sublime preferences.
[ { "docid": "7b669abd88a28de68f020e93affca0b6", "score": "0.0", "text": "def setup(self, **kwargs):\n\n eh_settings = sublime.load_settings(PACKAGE_SETTINGS)\n settings = self.view.settings()\n alternate_font_size = eh_settings.get(\"alternate_font_size\", False)\n alternate_f...
[ { "docid": "a89d575bf649c9bcb65bc1478dafa92c", "score": "0.680794", "text": "def Settings(name, default):\n view = sublime.active_window().active_view()\n project_config = view.settings().get('sublimeautopep8', {}) if view else {}\n global_config = sublime.load_settings(common.USER_CONFIG_NAME)...
17d845a7945a76ac53fb4f92dd7a46a9
Set ajax class attribute on self.form.
[ { "docid": "f61ae54a88b35a3fc5718e4c77ffd992", "score": "0.77012664", "text": "def prepare_ajax(self):\n if not self.ajax:\n return\n if self.form.attrs.get('class_add') \\\n and self.form.attrs['class_add'].find('ajax') == -1:\n self.form.attrs['class_...
[ { "docid": "eb4dc8607e9397d0bc9155df9e3371eb", "score": "0.80698156", "text": "def prepare_ajax(self):\n if not self.ajax:\n return\n if self.form.attrs.get('class') \\\n and self.form.attrs['class'].find('ajax') == -1:\n self.form.attrs['class'] += ' ajax'\n...
721a58bb79187b76f3a34dcc2612caf2
Return true if start date is earlier and end date is later than the test_date
[ { "docid": "c107b508ffe07da8f4f2d9b9f6b5ee32", "score": "0.69243836", "text": "def is_active_at_date(self, test_date):\n return ((self.start_date <= test_date) and \n (self.end_date >= test_date))", "title": "" } ]
[ { "docid": "444b5e2562051fb7f34e87db70361b05", "score": "0.7660612", "text": "def is_end_date_before_start_date(start_date: dt, end_date: dt) -> bool:\n return start_date > end_date", "title": "" }, { "docid": "edf3eea0c955dda09f6c509efcd79be7", "score": "0.7135487", "text": "def ...
e07c802ed5a452456a5cd07f2507b689
Get the OLS registry.
[ { "docid": "16a4e70d850b4acf0171f0266bd14e8b", "score": "0.0", "text": "def get_ols(force_download: bool = False):\n if PROCESSED_PATH.exists() and not force_download:\n with PROCESSED_PATH.open() as file:\n return json.load(file)\n\n data = requests.get(URL).json()\n data[\"_...
[ { "docid": "8ab3e6a6e433509d323ce714abcf5c90", "score": "0.7038571", "text": "def registry(self):\n\n return self._registry", "title": "" }, { "docid": "4bf38d3a7b168f4437572774e204ad74", "score": "0.6848575", "text": "def get_registry(self):\n return copy.deepcopy(self...
677a083435b83c78c455b1699bbae99c
Calculate the square values.
[ { "docid": "1a0de8957cc2d81a01a9a3c917a67237", "score": "0.6400062", "text": "def square(value: float) -> float:\n value = value ** 2\n return value", "title": "" } ]
[ { "docid": "a91879b1138e927693b42d7acb85182a", "score": "0.70643616", "text": "def sum_sqr_vals(self):\n\treturn numpy.sum(numpy.square(self.data))", "title": "" }, { "docid": "5c289eea3dd34a8eb2241d184e8ef879", "score": "0.7055393", "text": "def get_square(self):\n return num...
d886c01c4e667f8b25ead077c50aa4ac
Transform a bytes sequence to a token compliant to the pattern.
[ { "docid": "07b377e2b88a307927be13499f4c07bf", "score": "0.0", "text": "def token(self, key):\n if len(key) < 1:\n raise PatternException(_('Password length must be at least 2'))\n\n n = int(key.hex(), base=16)\n d = len(self.gliphs)\n p = []\n\n p.append(se...
[ { "docid": "7f762237daede125fb9a62581f3b76ab", "score": "0.5276037", "text": "def bytes_transform(byte_str, start_idx, stop_idx, fction):\n return bytes_replace(byte_str, start_idx, stop_idx, fction(byte_str[start_idx:stop_idx]))", "title": "" }, { "docid": "e40b07b6af3046d5e25e441af64f92...
28aaba9269dc7fcd05970ee089833be2
A fake refresh method for oauth2client service account credentails.
[ { "docid": "2b427e6162671612f5b4ab4d5b58f1d0", "score": "0.7772881", "text": "def _FakeRefreshOauth2clientServiceAccountCredentials(self, http):\n self.access_token = 'REFRESHED-ACCESS-TOKEN'\n self.token_expiry = _MakeFakeCredentialsRefreshExpiry()", "title": "" } ]
[ { "docid": "7e22844d1cbc6d74f370b67bf76f203a", "score": "0.768099", "text": "def testRefreshServiceAccountId(self):\n response = httplib2.Response({'status': httplib.OK})\n content = '{\"id_token\": \"old-id-token\"}'.encode()\n self.request_mock.return_value = response, content\n properties...
5800a54734ba51004c4c8adbe35d22cf
Returns the current version and patchnotes
[ { "docid": "34adb4005a421509bf0a2a8267d35ec0", "score": "0.6681273", "text": "async def info(self):\n \n message = \"Current cog version: **\" + self.version + \"**\\n\"\n message += \"Patchnotes:\"\n message += self.patchnote\n\n await self.bot.say(message)", "tit...
[ { "docid": "98ea3a806b99445d84baf0bb8c298e0a", "score": "0.67388994", "text": "def get_version_info() -> Tuple[Text, Text]: # type: ignore[empty-body]", "title": "" }, { "docid": "ce3ec83e553abfdc4d44f0757e49b8be", "score": "0.6537433", "text": "def get_version():", "title": "" ...
807735cb0993beeba81fc77d92f40936
Status of the parent submission is updated based on modifications made to related objects
[ { "docid": "b189d60b3cc419d09c33fe0a1e146477", "score": "0.55623835", "text": "def test_changing_moderation_changes_status(self):\n target = \"https://google.com/1234\"\n submission: Submission = Submission.objects.create(\n target_url=target,\n description=\"this is ...
[ { "docid": "a1d86117ba2222d5eefdb15a0ed6e6bb", "score": "0.60847354", "text": "def parent_changed(self, old, new):\n pass", "title": "" }, { "docid": "8212d204dbd53fef809491f07b850dd1", "score": "0.6048187", "text": "def update_submission(self, submission: DbSubmission) -> boo...
ad8880ee8f17bd629d02f1eaf372a9e2
Returns only the __texts of the __results.
[ { "docid": "279b0b24a1a59b79b6b13b762926587f", "score": "0.6544478", "text": "def gettext(self):\n return self.__texts", "title": "" } ]
[ { "docid": "6adc5f023979fa1cf5effeeff7709520", "score": "0.7373752", "text": "def get_texts(self):\n return self._texts", "title": "" }, { "docid": "8bd59f4ce3036abe9c663188ba6b656d", "score": "0.70294625", "text": "def all_text(self):\n return tweet_text.get_all_text(s...
41aaff270011b323101da95b59ee3a60
Calculate the great circle distance between two points on the earth (specified in decimal degrees)
[ { "docid": "6aae576098c963fcb21eed1748290320", "score": "0.697009", "text": "def calcDistance(lon1, lat1, lon2, lat2):\n # convert decimal degrees to radians\n lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])\n\n # haversine formula\n dlon = lon2 - lon1\n dlat = lat2 - lat1...
[ { "docid": "2d03a8f9ad790b3cb18e7f3be6b64e59", "score": "0.78439695", "text": "def great_circle_distance(latlong_a, latlong_b):\n lat1, lon1 = latlong_a\n lat2, lon2 = latlong_b\n\n dLat = math.radians(lat2 - lat1)\n dLon = math.radians(lon2 - lon1)\n a = (math.sin(dLat / 2) * math.sin(dL...
2b5045417a633adf0914209eda41fb5e
Get the syntax form of the input word
[ { "docid": "31665e9ae2a14b12285329bd0c45f988", "score": "0.6982608", "text": "def getSyntax(self,):\n\t\treturn self.syntax;", "title": "" } ]
[ { "docid": "016773b9384a7fcb9df1f714ccdf9034", "score": "0.67101586", "text": "def get_syntax(self,nameoroid):\n at_oid = self.getoid(AttributeType,nameoroid)\n try:\n at_obj = self.get_inheritedobj(AttributeType,at_oid)\n except KeyError:\n return None\n else:\n return at_obj...
6288e1caf3d3aa219d6224c3baa4a33b
With no arguments, return a dictionary of all configuration variables relevant for the current platform. Generally this includes everything needed to build extensions and install both pure modules and extensions. On Unix, this means every variable defined in Python's installed Makefile; on Windows and Mac OS it's a muc...
[ { "docid": "fe9e9fe913211e621b097a69685c6b68", "score": "0.7583598", "text": "def get_config_vars(*args):\n global _config_vars\n if _config_vars is None:\n _config_vars = {}\n\n # Normalized versions of prefix and exec_prefix are handy to have;\n # in fact, these are the stan...
[ { "docid": "7db8c915ff717bc2263e113c79603dee", "score": "0.63694656", "text": "def get_host_package_vars():\n # linux, mac or windows.\n platform_variant = {\n 'darwin': 'mac',\n 'linux2': 'linux',\n 'win32': 'windows',\n }.get(sys.platform)\n if not platform_variant:\n raise ValueError(...
69100a1fba92af3c16f4219ba47b26c6
Converts a HTTP response to an object (from headers)
[ { "docid": "b9f0299e6dd8fba27481c3cf95ae8ed5", "score": "0.64695716", "text": "def _response_to_object(self, object_name, container, response):\n\n headers = response.headers\n size = int(headers[\"content-length\"])\n etag = headers[\"etag\"]\n scheme = \"https\" if self.sec...
[ { "docid": "4b5a69218c07cd43d00ca956e4e1a294", "score": "0.68540525", "text": "def parse_response(self, response):\n return ParseHTTPResponse(response)", "title": "" }, { "docid": "5a6a3c44eb55189438ac0995ee619fb9", "score": "0.68098414", "text": "def parse_response(response):\n ...
6663362abf37edf3b58f7dace091d973
Pick from 20 subgraphs randomly some subgraphs. If n_subgraphs_requested = 1 use labeling_rate only else use n_subgraphs_requested directly return train_idx_random_selected
[ { "docid": "2f5250ef9f606bd59319b56e1b2f4a83", "score": "0.83010703", "text": "def sample_subgraphs_from_ppi(n_subgraphs_requested, seed=None):\n all_train_idx = np.arange(1, 21)\n set_seed(seed)\n random_train_idx = np.random.permutation(all_train_idx)\n train_idx_random_selected = random_train_idx...
[ { "docid": "cf1e7da4ab1b4dacc0000d6abfa8ddd5", "score": "0.75647837", "text": "def get_subsampled_train_idx(graph_id, n_subgraphs_used, seed=None):\n train_indices_all = np.arange(1, 21)\n set_seed(seed)\n random_train_subgraph_idx = np.random.permutation(train_indices_all)\n selected_subgraphs = ra...
855c0dc61c20b3eea86003e65a55f2b9
This function returns a list of document ids that are in the indicated project(s) (and of all children projects if cascade specified)
[ { "docid": "177f5f28c9e2b91a10429b2f13e6d247", "score": "0.7152817", "text": "def get_projs_docs(self, proj_ids, cascade = False):\n # Some initial checks/tweaks\n if not isinstance(proj_ids, list):\n proj_ids = [proj_ids]\n\n # Add any children projects if specified\n ...
[ { "docid": "a1ffa0e9bd95603c45f2bfd83bfa0f87", "score": "0.68752444", "text": "def get_projects_ids():\n\n projects = load_data('projects.json')\n\n project_ids = []\n for project in projects:\n project_ids.append(project['id'])\n\n return project_ids", "title": "" }, { "d...
540d53c03187eb8362cbe679ac1e875b
Fill Ns in maf file mafdict[ind][chrom].append([block_key, coord, "N"])
[ { "docid": "d33a0c3a1c9dd0b1727b67b67654e050", "score": "0.6722032", "text": "def fillMaf(mafdict, mafFile):\n f = open(\"{}.fill\".format(mafFile), 'w')\n with open(mafFile, 'r') as maf:\n for line in maf:\n if line.startswith(\"a\"):\n f.write(\"a\\n\")\n ...
[ { "docid": "a5d44e0fcb3494ad959182eeab084c42", "score": "0.5201526", "text": "def add_block(n_block,maze,inplace=False):\n if inplace:\n for position in available_path(maze)[:n_block]:\n maze[position[0]][position[1]] = 4\n return maze\n else:\n maze_copy = maze.cop...
c515892961cd913beb16a6649562f427
Resnet 101 Based Network
[ { "docid": "360979935b5340307c01fc3d0a6ed7bd", "score": "0.0", "text": "def DeepR101V3PlusD_HANet(args, num_classes, criterion, criterion_aux):\n print(\"Model : DeepLabv3+, Backbone : ResNet-101\")\n return DeepV3PlusHANet(num_classes, trunk='resnet-101', criterion=criterion, criterion_aux=criter...
[ { "docid": "b6179eed08cd0abdb9df6a4ee2d08bba", "score": "0.72976834", "text": "def resnet101(**kwargs):\n model = ResNet(Bottleneck, [3, 4, 23, 3], **kwargs)\n return model", "title": "" }, { "docid": "b6179eed08cd0abdb9df6a4ee2d08bba", "score": "0.72976834", "text": "def resne...
68bc2820b2451fe9fecd4b7b9ba6ffd3
Tests if the input configuration can be used to successfully connect to the integration
[ { "docid": "be09aa3e96c01fdd9c2eb90dd94e1ad2", "score": "0.57417065", "text": "def check(self, logger: logging.Logger, config: ConfigContainer) -> AirbyteConnectionStatus:\n return self.check_config(logger, config.config_path, config)", "title": "" } ]
[ { "docid": "9f6d45e4a3e6db7ba445ddc1392439a1", "score": "0.7090428", "text": "def check_configuration(self):", "title": "" }, { "docid": "1683f2254f9c347148cf6a0d8ddbbe6e", "score": "0.70189494", "text": "def verify_config(self):\n pass", "title": "" }, { "docid": ...
8bd8e980cf04d35e6b38ac315a1baa71
Return ``True`` if the Pixel Data should to be converted from YCbCr to RGB. This affects JPEG transfer syntaxes.
[ { "docid": "b014c23b4d338cb8ecd2e7884bb03548", "score": "0.6915101", "text": "def needs_to_convert_to_RGB(ds: \"Dataset\") -> bool:\n return False", "title": "" } ]
[ { "docid": "8ec1d586b528ba2539eb81241dc48b12", "score": "0.6485655", "text": "def should_change_PhotometricInterpretation_to_RGB(ds: \"Dataset\") -> bool:\n return False", "title": "" }, { "docid": "e669456d6b3dd517d5162c581e892192", "score": "0.64236915", "text": "def rgb(self) -...
7a227b3036fd3185a0211dd6cc939054
Description of the minimization problem
[ { "docid": "6f296f455eb5d3f4b2aa91d2d01d97cb", "score": "0.0", "text": "def initialize(self, func, nvar, bounds, vdx=None):\n # Test the arguments\n error = validate(func, nvar, bounds, vdx, self.verbose)\n if error:\n if self.verbose:\n print( '--> newop E...
[ { "docid": "243623a1f048649b2fdb67811aa09a8b", "score": "0.6914253", "text": "def minimax():", "title": "" }, { "docid": "8184c2d3bb1b25cb043721112ca6771e", "score": "0.6489799", "text": "def _minimize(self):\n return 0", "title": "" }, { "docid": "09d46dc6dda570c2...
478f5f982f16fc0e76a4eadbb5c01864
The rotation matrix of the image Relates to the exterior orientation
[ { "docid": "86dfb7458a143ce1a28d5e19a7d03974", "score": "0.77758867", "text": "def rotationMatrix(self):\n\n R = Compute3DRotationMatrix(self.exteriorOrientationParameters[3], self.exteriorOrientationParameters[4],\n self.exteriorOrientationParameters[5])\n\n ...
[ { "docid": "c5785e1d4b134c7c43ef3846c184d908", "score": "0.80493206", "text": "def getRotationMatrix( self):", "title": "" }, { "docid": "9ea3c54f501c0ff5106c01d4919e0798", "score": "0.7800133", "text": "def rotationMatrix(self):\n\n # R = Compute3DRotationMatrix(self.exterior...
c475eb5c714dda23a8b0070cdd4abed4
Test getting contract ABI by invalid address
[ { "docid": "c505aa8a0c7dd1373097fb10f11df59a", "score": "0.75141275", "text": "def test_get_wrong_contract_abi(self):\n response = _get_contracts_abi_sync({\"wrong\": \"0x0\"})\n self.assertSequenceEqual(response, {\"wrong\": []})", "title": "" } ]
[ { "docid": "1258b3b3c659b69492be70df72559956", "score": "0.7237029", "text": "def test_get_contract_abi(self):\n response = _get_contracts_abi_sync({1: TEST_CONTRACT_ADDRESS})\n self.assertSequenceEqual(response, {1: TEST_CONTRACT_ABI})", "title": "" }, { "docid": "1f99a05372ff...
4e54b02e96fdf43d7e8535acedfb9e84
r"""Propogate input through the layer.
[ { "docid": "9e56e01818320d237d6344cdff3025f9", "score": "0.0", "text": "def forward(self, input, hidden, ctx):\n def recurrence(input, hidden, ctx):\n \"\"\"Recurrence helper.\"\"\"\n input_gate = self.input_weights(input)\n hidden_gate = self.hidden_weights(hidde...
[ { "docid": "489e2b175bc8d9e68705e661f28b9b03", "score": "0.6702976", "text": "def applyInputParams(self):\n pass", "title": "" }, { "docid": "0ade0f639b80566a9895265ca9c30796", "score": "0.65563494", "text": "def propagate_input(self, features):\n for layer in self.laye...
f79fb3e13ed95b711bb5b8b2fc67ea2b
Calculates the entropy gain from the two splits
[ { "docid": "d1781cea78284312ae6e922254bb6b89", "score": "0.7582539", "text": "def get_gain(self, labels, split_1, split_2):\n orig_ent = self.get_entropy(labels)\n after_ent = (self.get_entropy(labels[split_1]) * (sum(split_1) / len(labels)) +\n self.get_entropy(labels[...
[ { "docid": "22ff3aa3a3476c44f70c41e19489e4fd", "score": "0.6996975", "text": "def information_gain(before_split: np.array,\n splits: list) -> float:\n\n assert len(before_split) == sum([len(split) for split in splits]), f\"splits must add up to length of original{len(original)}/{s...
35637ad93933de3599450fbc0a74977a
Use self learning algo to reply ()
[ { "docid": "98cadbd8dc765fbaa7b650b5e78c562b", "score": "0.0", "text": "def quote_lsd(self, msg, status, args):\n #TODO: Shouldn't crash if structures aren't build, just an empty response\n #not sure needs to be tested\n speech = \" \".join(args[1:])\n response = lsdQuote(spe...
[ { "docid": "223ea358153fa91ca62105b9bbff6062", "score": "0.676823", "text": "def learning(self):\n pass", "title": "" }, { "docid": "482b797911d143e4a165ce58963e975d", "score": "0.6712703", "text": "def learn(self, reward, observation):", "title": "" }, { "docid": ...
91dfb5d67afddc9f13ee0c6955ced692
Tests the calling of get_allsubscription with a valid parameters
[ { "docid": "c3f1137d959c4e90e600973d908f0ca8", "score": "0.82672656", "text": "def test_get_allsubscription(self): \r\n statuslink = self.ms.get_allsubscription()\r\n self.assertTrue(len(statuslink)>=0)", "title": "" } ]
[ { "docid": "0d22f0f217a77cd95853c97cbd6efbcf", "score": "0.8271291", "text": "def test_get_all_subscriptions(self):\n pass", "title": "" }, { "docid": "90565508ed55dcce2008b07c50c6efc8", "score": "0.715819", "text": "def test_get_available_credit_subscription(self):\n p...
f6116501c576aef1766a2b274ce6c2b5
Execute the class method.
[ { "docid": "ed0051e6e4d520d78d368835e5a53e16", "score": "0.0", "text": "async def execute(self, sleep: float):\n assert not self.run.locked()\n async with self.run:\n await asyncio.sleep(sleep)", "title": "" } ]
[ { "docid": "d5c5692e0ae74989a1da18ba58c1b49d", "score": "0.7394682", "text": "def execute(cls):\n pass", "title": "" }, { "docid": "c93d9f0cf6afbe6353f4f3399cc31b0e", "score": "0.71576184", "text": "def execute(self):\n raise NotImplementedError(\"Subclasses should over...
eba952d294cab4cbe3a8d5753a2b9925
Parse command line arguments.
[ { "docid": "0f93e885f731bbea666de4f1e7d81e15", "score": "0.0", "text": "def parse_args():\n parser = argparse.ArgumentParser('train.py')\n add_arg = parser.add_argument\n add_arg('config', nargs='?', default='configs/test.yaml')\n add_arg('-d', '--distributed', action='store_true')\n add_...
[ { "docid": "fbefb0e59061fbe6716504a6e1a8d663", "score": "0.7420028", "text": "def parse_args():\n parser = ArgumentParser()\n return parser.parse_args()", "title": "" }, { "docid": "b62f6792f0eee8860859d47ebb64f450", "score": "0.73423314", "text": "def parse_args():\n\t# Help M...
c4aac080fcd65a538f62b7b02d5a6a96
Initialize your data structure here.
[ { "docid": "15ef55cc94a785758caa65df6411d27f", "score": "0.0", "text": "def __init__(self, nestedList):\n self.flater_list=[]\n for n_e in nestedList:\n if n_e.isInteger():\n self.flater_list.append(n_e.getInteger())\n else:\n n_e=n_e.get...
[ { "docid": "9ef4ed4212f822f4b78823c94a4a9635", "score": "0.78362477", "text": "def init_data(self):", "title": "" }, { "docid": "b4c2dddb27354091df8041bff75f9898", "score": "0.7647474", "text": "def __init__(self):\n self._data = []", "title": "" }, { "docid": "b4c...
25489050411a6b76b1f37963f5bc8817
przerwanie 21H, funkcja 2Ah (42), Get System Date AL Day of the week (0 6; 0 = Sunday) CX Year (1980 2099) DH Month (1 12) DL Day (1 31)
[ { "docid": "46e0399dfa82a16044c375263c9d4297", "score": "0.5788917", "text": "def int_21H_42(self):\r\n date_now = datetime.datetime.now()\r\n\r\n year = date_now.year\r\n month = date_now.month\r\n day = date_now.day\r\n weekday = (datetime.datetime.today().weekday())...
[ { "docid": "07396f146082972a84c69ee1041cfb53", "score": "0.67846864", "text": "def wkday_on_first(yr, mon): # returns day of week of first of month of the given year (1/1/2016)\r\n TotalDays = 0\r\n for x in range(1754, yr):\r\n YearNum = yeardays(x)\r\n TotalDays += YearNum\r\n ...
a8fda660651dd2cbe8fc3835c2402716
Function that finds a root using Newton's iteration for a given function f(x) with known derivative f'(x). The function finds the root of f(x) with a predefined absolute accuracy epsilon. The function excepts a starting point x0 that belongs to an interval [a,b] in which is known that f has a root.If the function f has...
[ { "docid": "5357d96546a3b61900b293c024e68def", "score": "0.7213952", "text": "def newton_raphson(f, fprime, x0, eps=5e-6, max_iterations=50):\n\n if f(x0) == 0: # check if x0 is root of f\n return x0, 0\n\n # initializations\n current_x = x0 - f(x0) / fprime(x0)\n previous_x = x0\n ...
[ { "docid": "88fffe03bfe4cfc189651c7be2b9de99", "score": "0.7853638", "text": "def NewtonRoot(f, x, tol=1e-10, iters=2000, der_shift=1):\n\n\tif isinstance(x, list):\n\t\t# Number of variables\n\t\tm = len(x)\n\n\t\t# Convert to da.Var type\n\t\tif m > 1:\n\t\t\tfor i in range(m):\n\t\t\t\tif not isinsta...
eff73b351cf5214d1ceb7090ea18fe4c
Serve main content (global storage).
[ { "docid": "ff7847cffa5235339a19a9d2bcafc62b", "score": "0.0", "text": "def images(filepath: str):\n return common_static('images', filepath)", "title": "" } ]
[ { "docid": "2da4a5b350705097a8f83ba3c33e9942", "score": "0.7041915", "text": "def _serve_main(self):\n\t\t\tready.wait()\n\n\t\t\tenv = Environment(loader=FileSystemLoader(\"templates\"))\n\t\t\ttemplate = env.get_template(\"sensorapp.html\")\n\n\t\t\tself.send_response(200, 'OK')\n\t\t\tself.send_heade...
064a32ad81b2745b5c1843928ca9c783
Call the same parent constructor, then call setup() if we have a session.
[ { "docid": "088d2b82a919c55c17a2323888421224", "score": "0.6701795", "text": "def __init__(self, session=None):\n self.experiment_repeats = 5\n super().__init__(session)\n if session:\n self.setup()\n\n self.log('initialize')", "title": "" } ]
[ { "docid": "9e2fb0a70c9e84897bc65ae3e343a870", "score": "0.73652965", "text": "def init_session(self):\n pass", "title": "" }, { "docid": "4468a722ea66ce2f0668eb1f8f0f6db7", "score": "0.73297703", "text": "def initialize_session(self):\n pass", "title": "" }, { ...
45f0c8a71b490493867c7e63cdc3ffd2
Compares this card to other, first by suit, then rank.
[ { "docid": "489036d087d5ef07476810a38ca87f7b", "score": "0.6491065", "text": "def __lt__(self, other):\n t1 = self.suit, self.rank\n t2 = other.suit, other.rank\n return t1 < t2", "title": "" } ]
[ { "docid": "8f35e44eef683a4c5596f634f120d6d9", "score": "0.7621892", "text": "def compare_rank(card1, card2):\n if card1.get_rank < card2.get_rank:\n return -1\n elif card1.get_rank > card2.get_rank:\n return 1\n else:\n return 0", "title": "" ...
e7ae463295786e541cce1d9d4fbfad94
Instantiate and return the `Template` object based on the given class and parameters. This function is intended for subclasses to override if they need to implement special template instantiation logic. Code that just uses the `TemplateLoader` should use the `load` method instead.
[ { "docid": "c2616ca00d446526281eb29b98fdb4fd", "score": "0.5182011", "text": "def _instantiate(self, cls, fileobj, filepath, filename, encoding=None):\n if encoding is None:\n encoding = self.default_encoding\n return cls(fileobj, filepath=filepath, filename=filename, loader=sel...
[ { "docid": "f73f3be43cc0013896e468aadf48fa68", "score": "0.67032987", "text": "def instantiate_template(cls, data, raw_data, origin, provider, parameters,\n field_offset_map):\n # This assertion is a low-cost trick to ensure that we override this\n # method in a...
c68d0c17a1f37935b39f27ae28d10bff
Save out a transaction to a .yumtx file to be loaded later.
[ { "docid": "a486151aa6e79a7510a7e34a80b1ea7e", "score": "0.71357524", "text": "def save_ts(self, filename=None, auto=False):\n if self.tsInfo._unresolvedMembers:\n if auto:\n self.logger.critical(_(\"Dependencies not solved. Will not save unresolved transaction.\"))\n ...
[ { "docid": "74208d2e2824fc5e8aa565282ea71402", "score": "0.6902627", "text": "def _save_transaction_data(self, path='/data/info'):\n base_dir = os.getcwd() + path\n # Save transactions data record\n with open(f'{base_dir}/transactions', 'w+') as f:\n for tx in self._trans...
d0a19727f1c069c671bc757f00f28501
Select a random move from those available
[ { "docid": "e5b2a018ca1af217d1d81b9c4eee3e7b", "score": "0.75547254", "text": "def randomMove():\n move = self.pickRandomAvailableSquareToEat() # positive int or -1\n return move", "title": "" } ]
[ { "docid": "cc5e061c85fc578cb98aa857aea6a2ff", "score": "0.8201249", "text": "def _random_move(self, grid):\n return random.choice(list_actions(grid))", "title": "" }, { "docid": "d9ad96550adadc59cb5e2aabb391a920", "score": "0.81967247", "text": "def make_random_move(self):\n ...
8b6981e00c6948c86907bb36a43d4c0e
Find a link on this or a child workflow that has target as a sink.
[ { "docid": "894cb00f1d12c3da0715d4897f28378f", "score": "0.6926945", "text": "def find_link_by_target(self, target: Union[CommandInput, CommandParameter]):\n for link in self.links:\n if target in link.sinks:\n yield link, self\n\n for plan in self.plans:\n ...
[ { "docid": "025d34998e9a38ef9dc2c46dc588dc98", "score": "0.5772282", "text": "def get_target(self, share):", "title": "" }, { "docid": "832a11e7a60e6d1681fdfb8c43111497", "score": "0.57031846", "text": "def target(self):\n target_id = self.target_id\n if target_id:\n ...
d642fa0d04315f8d72b138360099416d
Asigna un int como el identificado del factor sobre el que se obtiene la lectura.
[ { "docid": "c8ab05fe650e115bb39a9924cfeb4937", "score": "0.59797025", "text": "def set_id_factor(self, value):\n self.__idFactor = value", "title": "" } ]
[ { "docid": "6da0bbb2aad6b8aec5ab23be9e14d65b", "score": "0.60904473", "text": "def __int__(self):\n return int(self.zaehler / self.nenner)", "title": "" }, { "docid": "a83745d51bda29d42e1dd44a1cd65756", "score": "0.60733753", "text": "def factor_carga(self):\n return se...
85a30106f5afbb277c96bbd4beff562b
Generate a map of known licenses based on `nixpkgs`.
[ { "docid": "3ae921fecdfa86d5f5c8bdf8b5f02ba7", "score": "0.7784949", "text": "def get_nix_licenses():\n global _nix_licenses\n\n if _nix_licenses is None:\n nix_licenses_json = check_output([\n 'nix-instantiate', '--eval', '--expr',\n 'with import <nixpkgs> { }; builti...
[ { "docid": "73fc30d86229d5f0c76a60b8fdfe497d", "score": "0.6401995", "text": "def get_licenses_from_pkginfo(self):\n licenses = set()\n data = \"\"\n try:\n try:\n data = self.pip_req.get_dist().get_metadata('PKG-INFO')\n except (FileNotFoundErro...
73821787ab984ccb56d5e67dd6fc439e
The configuration settings of the storage of the tokens if a file system is used.
[ { "docid": "d551f4f3b9e27b3856657dd11566cc54", "score": "0.5914945", "text": "def file_system(self) -> Optional[pulumi.Input['FileSystemTokenStoreArgs']]:\n return pulumi.get(self, \"file_system\")", "title": "" } ]
[ { "docid": "37b3738304a27691132542a36ac34039", "score": "0.6504488", "text": "def configuration(self):\n return os.path.expanduser(self.settings.get('configuration'))", "title": "" }, { "docid": "6ff621098f65684905dd57e654a377fb", "score": "0.6473083", "text": "def _getConfig(...
990f4eac6cf19f38c7d60b80c2a4c885
Get Oxalis Minecraft server status
[ { "docid": "510f636dfab6d2497112d3425b4c00af", "score": "0.6496605", "text": "async def status(ctx: commands.Context):\n await ctx.send(str(subprocess.run(\"papermc status | grep Status\", stdout=subprocess.PIPE, shell=True).stdout, \"utf-8\"))", "title": "" } ]
[ { "docid": "4a82e7890222cbf56e7e2e23bcf81c3c", "score": "0.8241819", "text": "def server_status(self):\n\t\treq_id = self._send(b'SHOW_STATUS')\n\t\treturn jsonapi.loads(self._recv(req_id).content[1])", "title": "" }, { "docid": "7857be212d49cd8e7daa0f2971e9f170", "score": "0.78942055", ...
fcd071579d4fd2aeabf01752e31d76e3
Run jobs from a sql table.
[ { "docid": "931353192b9fdd9a479504f52d6fc813", "score": "0.5596132", "text": "def runner_sql(options, dbdescr, exproot):\n if options.modules:\n modules = options.modules.split(',')\n else:\n modules = []\n for module in modules:\n __import__(module, fromlist=[])\n\n db ...
[ { "docid": "f6c1fab4be007de17dfb374158154517", "score": "0.67062944", "text": "def runSQL(self, sql, label):\n startTime = time.time()\n verbose(label + '...')\n if type(sql) == type(''):\n results = db.sql(sql.split(self.SQLSEPARATOR), 'auto')\n else:\n ...
5c29a638617b95da4741672f55fd84e8
Sets the item of this Inventory.
[ { "docid": "cb1e7ade7cef844cadf4e257577eba8e", "score": "0.7469803", "text": "def item(self, item):\n\n self._item = item", "title": "" } ]
[ { "docid": "0e77ca0fb4bafc81575720198fee9e0f", "score": "0.81508094", "text": "def set_item(self, item):\n self._item = item", "title": "" }, { "docid": "23f601c64be51554bb0bc647f09f9282", "score": "0.7558917", "text": "def set_item(self, new_item):\n self.item = new_it...
2b2c2dadef91f92a188bf766ad37a1cd
Constructor @ In, kwargs, dict, arguments @ Out, None
[ { "docid": "1872d722f5cdcfd96c697a5e0dfc3b98", "score": "0.0", "text": "def __init__(self, **kwargs):\n Interaction.__init__(self, **kwargs)\n self._demands = None # the resource demanded by this interaction\n self._penalty = None # how to penalize for not meeting demand NOT IMPLEMENTED", ...
[ { "docid": "6c0e35b9d4d7795af375ec34db478ceb", "score": "0.828617", "text": "def __init__(self, *args, **kwargs):\n self.args = args\n self.kwargs = kwargs", "title": "" }, { "docid": "cce888fc35e8c8577470cab46fb38476", "score": "0.81837237", "text": "def __init__(self,...
af8d11fe0f568e83bd7293056c820f72
Function computes a 2D distance field Distance at member of entity_queue is zero Shortest paths avoid obstacles and use distance_type distances
[ { "docid": "04b882c9bfb1c8ba1a73ead8f86fe83c", "score": "0.6837322", "text": "def compute_distance_field(self, entity_type):\n visited = [[EMPTY for dummy_col in range(self._grid_width)]\n for dummy_row in range(self._grid_height)]\n distance_field = [[self._grid_widt...
[ { "docid": "15e8aa11b62ca2778ac69d66394d1324", "score": "0.72263473", "text": "def compute_distance_field(self, entity_type):\n grid_height = self.get_grid_height()\n grid_width = self.get_grid_width()\n #Create a 2D list distance_field of the same size as the grid and initialize ea...
995892ac6f0346f57b21b0bd45e216a1
When getting the URL of an ImageCacheFile, the storage shouldn't be checked.
[ { "docid": "112b8f8898a4d1badcf03acc13621b82", "score": "0.75797176", "text": "def test_no_io_on_url():\n file = get_image_cache_file()\n file.url\n assert not file.storage.exists.called\n assert not file.storage.open.called", "title": "" } ]
[ { "docid": "cf151055813356df2adfaec8dce1fc64", "score": "0.6698855", "text": "def get_url(url: str) -> Optional[str]:\n try:\n parsed = urlparse(url)\n except ValueError:\n return None\n\n if parsed.scheme in (\"file\", \"\"):\n return unquote(parsed.path)\n elif parsed....
9a8974939db3cf419a2799d18e500be1
The ID of an Azure Active Directory server application of type \\"Web app/API\\". This application represents the managed cluster's apiserver (Server application) (string)
[ { "docid": "53d534dd54140f88c1bbaf2d0e60f8e4", "score": "0.73392534", "text": "def add_server_app_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"add_server_app_id\")", "title": "" } ]
[ { "docid": "134caedbe6b529fe9ce366e221179202", "score": "0.79774123", "text": "def server_app_id(self) -> Optional[str]:\n return pulumi.get(self, \"server_app_id\")", "title": "" }, { "docid": "aac51cc07f1e0d6be0a043f58d9e1552", "score": "0.76388377", "text": "def app_id(self...
bfc90003e943be34c028aa78b08084bc
Evaluate a model on a given CV split
[ { "docid": "59ccda8a4a49b6a84deb090dab951621", "score": "0.6733805", "text": "def compute_evaluation(model, cv_split_filename, params=None,\r\n train_size=1.0, mmap_mode='r',\r\n scoring=None, dump_model=False,\r\n dump_predictions=False,...
[ { "docid": "35ea1019c0b7a7f5741d8cba7b8458c8", "score": "0.68407726", "text": "def evaluate_model(model_name, model, x, y):\n print('%s:' % model_name)\n model.fit(x, y.values.ravel())\n print('CV f1_micro (not reusing data): %s' % np.mean(cross_val_score(model,\n x, y.values.ravel(), ...
1015f0d475a10360dd0e41ccacad1fc6
Create a site configuration from a Volt config file.
[ { "docid": "2cca93d684692315c46caed80f111696", "score": "0.0", "text": "def from_file_name(\n cls,\n invoc_dir: Path,\n project_dir: Path,\n config_file_name: str,\n **kwargs: Any,\n ) -> Self:\n config_path = project_dir / config_file_name\n with conf...
[ { "docid": "8c9a1a385e5301c630e9e1751cbf39e6", "score": "0.713112", "text": "def load_from_file(self, config_file):\n with open(config_file, 'r') as f:\n parser = ConfigParser()\n parser.readfp(f)\n if parser.has_option('site', 'outdir'):\n self.out...
ac797dc1950168e935fd4e6788e034a4
Check that a TableDumpV2 JSON document from mabo is correctly abstracted.
[ { "docid": "30c2a70372eb4dab434bc2014251637c", "score": "0.5781272", "text": "def test_TableDumpV2(self):\n\n # Get the abstract BGP message\n abstracted = MaboTableDumpV2Document(\"collector\", json_TableDumpV2)\n\n # Check each element\n elements = abstracted.elements()\n assert len(ele...
[ { "docid": "c8ac963d2472571f1d37e326483a25e1", "score": "0.62551606", "text": "def test_parse_biom_table(self):\r\n # This is a TSV as a list of lines\r\n t = parse_biom_table(self.classic_otu_table1_no_tax)\r\n\r\n # Test TSV as a list of lines\r\n t_tsv_str = t.to_tsv()\r\n...
890b2bfc4b102965155938e2ca874bb1
Sets the residence of this Criminal.
[ { "docid": "ef8fd305f836631f8748820b1c0b4118", "score": "0.8034765", "text": "def residence(self, residence):\n\n self._residence = residence", "title": "" } ]
[ { "docid": "43fd1c6070ff4412d49071a8e6ed45bb", "score": "0.6250316", "text": "def residence(self):\n return self._residence", "title": "" }, { "docid": "44706b55c15938a2eec0f688e775491e", "score": "0.57946104", "text": "def set_evidence(self, evidence):\n self.evidence ...
4be294a3daaf1f9dd3c0be1dd7890a7c
Test the result preserves input dimension order when the coordinate to integrate is not the first dimension (eg there's a leading realization coordinate)
[ { "docid": "98dbb8c89a9297a91af2488f6b5d6a1d", "score": "0.5471508", "text": "def test_dimension_preservation(self):\n cube = set_up_variable_cube(280 * np.ones((3, 3, 3), dtype=np.float32))\n cube = add_coordinate(\n cube, np.array([5.0, 10.0, 20.0]), \"height\", coord_units=\"...
[ { "docid": "f41ba7a1922d8fd415d35d28ac8c8643", "score": "0.5874654", "text": "def test_integrate_column_coordinates(self):\n x = np.linspace(0, 1, 5)\n t = math.integrate_column(np.arange(5), x)\n\n assert(np.isclose(t, 2))", "title": "" }, { "docid": "2b120bfe091aa6100e...
2fe086c3e5a427da90d6431edd2ef5c7
Browse the file system and update the control instance accordingly. If a valid direcorty has already been entered the dialogue will automatically point to this folder, otherwise the current working directory is used.
[ { "docid": "897bc328a97b5b014ceb9ef88458331d", "score": "0.779447", "text": "def onBrowseClicked(control_instance):\n # Get the current directory\n current_control_value = os.path.join(os.getcwd(), os.pardir)\n if DirectoryControlWidget.is_valid(control_instance):\n curre...
[ { "docid": "5a030732cf12ef84300d8a20743a3891", "score": "0.8512092", "text": "def _browse(self):\n\n initial_dir = self._variable.get()\n initial_dir = os.path.abspath(os.path.expanduser(initial_dir))\n\n self.options['initialdir'] = initial_dir\n dlg = filedialog.Directory(s...
8d872fb7864e42a7495f4b21e3bbb084
Parses a media_file path into its component segments.
[ { "docid": "a8a29dc123502596e6c9c7d23ad6beec", "score": "0.65137494", "text": "def parse_media_file_path(path: str) -> Dict[str, str]:\n m = re.match(\n r\"^customers/(?P<customer_id>.+?)/mediaFiles/(?P<media_file_id>.+?)$\",\n path,\n )\n return m.groupdict() ...
[ { "docid": "9f7445ca524d3ea5bd135aa47a25c27f", "score": "0.5895364", "text": "def split_path(full_path):\n parsed_list = full_path.split('/')[-2:] # directtory, file_name\n \n return parsed_list", "title": "" }, { "docid": "3405777c166d80d631ed05388b7710ab", "score": "0.58513534...
7cdb93f03454b8ff65070a1611850f65
Distance from a proposed point to its nearest neighbour (proposed point)
[ { "docid": "2367061b483d48ffb9ef0488832fb63c", "score": "0.6574492", "text": "def ppn2_distance_to_nearest_neighbour(self):\n # FIXME vectorize loop\n distances = []\n for point in self.im_proposals:\n distances.append(np.partition(np.sum(np.power(point - self.im_proposal...
[ { "docid": "f3a2e04fa10b7f690c79eb3d0e02849a", "score": "0.80314505", "text": "def distance_to_point(self, point):", "title": "" }, { "docid": "2ee7ca52fefe409ffc2a9594fb14a392", "score": "0.7305967", "text": "def distance(self, p):\n return ((self.x - p.x) ** 2 + (self.y - p....
099e314d87cb3a8f39b796e97ab050a8
fixed value comparator test
[ { "docid": "6e63a52c489faa303fcf223b6647ddee", "score": "0.6537535", "text": "def test_fixed_value_comparator(self, num_state_qubits, value, geq):\n # initialize weighted sum operator factory\n comp = Comparator(num_state_qubits, value, geq)\n\n # initialize circuit\n q = Qua...
[ { "docid": "a5bff1832536e4806c5a098b17b040b7", "score": "0.65169156", "text": "def comparator_converter(self, val):\r\n return val", "title": "" }, { "docid": "b5bc04f0cc6c2a68b4b7b8a19a45f85c", "score": "0.6449908", "text": "def __cmp__(self, p):\n val = self[0].__cmp_...
c1ef3fb3fca50659a61d3135daea5bf1
Subscribe to the model update request stream.
[ { "docid": "f64491422975b5dd6dc00f57e0bff34d", "score": "0.7139607", "text": "def __listen_to_model_update_stream(self):\n r = alliance.ClientAvailableMessage()\n\n whoami(r.sender, self)\n\n for request in self.orchestrator.ModelUpdateStream(r):\n # A client sent a model...
[ { "docid": "8c39a358475085d8a1c88a34ea6e2c7c", "score": "0.66264987", "text": "def ModelUpdateRequestStream(self, response, context):\n\n client = response.sender\n metadata = context.invocation_metadata()\n if metadata:\n print(\"\\n\\n\\nGOT METADATA: {}\\n\\n\\n\".form...
e936c006f2b60cb1447f0caf61b07198
r""" Return the orientation of the crossings of the link diagram of ``self``.
[ { "docid": "eb391244b5bc7f6d2cc3e43b0e0fc07c", "score": "0.6693827", "text": "def orientation(self):\n directions = self._directions_of_edges()[0]\n orientation = []\n for C in self.pd_code():\n if C[0] == C[1] or C[2] == C[3]:\n orientation.append(-1)\n ...
[ { "docid": "f1ce0f0417423532c5526f5a36e613ce", "score": "0.6612555", "text": "def get_orientation(self, visited):\n #print(visited)\n if visited:\n rot = mathutils.Quaternion(self.helical_axisParam, self.get_angle(2))\n a = self.positio...
05d347d75016454d195ce03d8236430f
Handles input file browsing and selection.
[ { "docid": "49171b4d5fc7d7816a1b2a758f052185", "score": "0.0", "text": "def get_input_file_name(self):\r\n\r\n\t\tentry = self.input_file_E\r\n\t\tentry.delete(0, \"end\")\r\n\t\t\r\n\t\troot.update()\r\n\t\tself.master_input = filedialog.askopenfilename(multiple = True)\r\n\t\troot.update()\r\n\t\t\r\n...
[ { "docid": "32ea7dad953fd98a57afaf65664098bb", "score": "0.68089163", "text": "def input_pick(self):\n file_name = QtWidgets.QFileDialog.getOpenFileName(self, 'Open file', self.vid_file)\n if file_name[0]:\n self.input_load(file_name[0])", "title": "" }, { "docid": "...
abc3539d6a4d16fc36b94d707e583008
Return triangle area given its vertices' coordinates.
[ { "docid": "0add7d83ad7bf33b1cf10765399b27f0", "score": "0.70234346", "text": "def get_triangle_area(point1: Point, point2: Point, point3: Point):\n\t\tprod1 = (point1[0] - point3[0]) * (point2[1] - point1[1])\n\t\tprod2 = (point1[0] - point2[0]) * (point3[1] - point1[1])\n\n\t\ttriangle_area = 1/2 * ab...
[ { "docid": "ce87c52ea5d3ae5d6cadd5a7d6f1c8a6", "score": "0.8274563", "text": "def area_of_triangle(*args):\n if len(args) != 1:\n print('ERROR: one argument expected, got {}.'.format(len(args)))\n return None\n vertexes = args[0]\n if not isinstance(vertexes, list):\n print...
4128657e337d1d76f50983275de1d03c
Method to convert assessor label into a dictionary
[ { "docid": "08d533d9dece6896af31f5254a0b5073", "score": "0.7269525", "text": "def get_assessor_dict(assessor_label):\n assessor_dict = dict()\n labels = assessor_label.split('-x-')\n if len(labels) == 1:\n print'ERROR: WRONG PROCESS LABEL: the assessor label can not be set (ERROR no \"-x...
[ { "docid": "807e2a0238177386f84ae6d97f5c6d81", "score": "0.61845165", "text": "def get_labels(self):\n\t\tld = {}\n\t\tfor label in self.labels:\n\t\t\ttokens = label.split(\":\")\n\t\t\tld[tokens[0]] = tokens[1]\n\t\treturn ld", "title": "" }, { "docid": "c791b0778493c3bc4f7b391e1407d05c", ...
7ce80f9f8797379e4a6aa6862d2a224d
Update the cell with new input x_t = the new input
[ { "docid": "181e455170603e85e323fcba7a64b0ba", "score": "0.78416604", "text": "def update(self, x_t):\n # the output of the previous update\n h_t_0 = self.h_t\n \n # the previous cell content \n C_t_0 = self.C_t\n\n # step 1: Decide what information to forget\n ...
[ { "docid": "9b44555f42e0d42190d1746033231b46", "score": "0.70777196", "text": "def Updatev(Cell,dt):", "title": "" }, { "docid": "c6a57999dc4ecee8ddd36a67f5fc584f", "score": "0.680216", "text": "def recurrent_cell(self, st, t):\n\n\t\tz = self.z[t-par['latency'],..., cp.newaxis]\n\t\...
08221d73799e78906b30f1464d647dc0
Computes how the interaction hamiltonian acts over a given state
[ { "docid": "a69fab8c6a837f99f24123569f0e0dad", "score": "0.55249983", "text": "def Hint(state_ini):\n states = []\n coefs = []\n for k in range(len(state_ini)):\n for l in range(len(state_ini)):\n for p in range(len(state_ini)):\n for q in range(len(state_ini)):...
[ { "docid": "97f2aec5ed08627489e932504160126d", "score": "0.7395203", "text": "def actHam(state, N, J, U):\n t1, t2 = [], []\n # First term\n for i in range(len(state.vector)-1):\n t1.append(state.create(i+1, N).destroy(i))\n t1.append(state.create(i, N).destroy(i+1))\n # Second...
ab02758ba0c11476d13c5cbb34b4f7ee
Update the mapping (nodal2global and elements2global)
[ { "docid": "63e31e5664150100ebe332549c1fd359", "score": "0.6652489", "text": "def update_mapping(self, fields, nodeids, connectivity, dofs_by_element, callbacks, callbackargs, **kwargs):\n self._set_standard_mapping(fields, nodeids, connectivity, dofs_by_element, callbacks, callbackargs, **kwargs...
[ { "docid": "c51c89163158e8315eca9b877ad3d659", "score": "0.6116114", "text": "def _update_global_vars(self):\n\n pass", "title": "" }, { "docid": "88cec46d1e0d250965becc0faf411415", "score": "0.60464275", "text": "def _update_mappings(self):\n self.existing_cost_entry_m...
4d39bb1519a7f62a7cf3caeafcd634a3
GET request to retrieve a specific product from database.
[ { "docid": "4ad297d0b00a0f6bc43b64684bf5bab8", "score": "0.7202844", "text": "def get_specific_product(product_id):\n try:\n # Query database for all products\n selection = Products.query.order_by(Products.id).filter(\n Products.id == product_id).one_or_none()...
[ { "docid": "0dec387335a7d688dff232ff44946424", "score": "0.77556497", "text": "def retrieve(self, request, pk=None):\n try:\n product = ProductModel.objects.get(pk=pk)\n serializer = ProductSerializer(product, context={'request': request})\n return Response(serial...