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 |
|---|---|---|---|---|---|---|
Returns your deposits history for all currencies if currency == None, else returns your deposit history history for a given currency | def get_deposit_history(self, currency=None):
if not currency:
currency = ""
return self.__call__('balance', "getdeposithistory",
{"currencyname": currency}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_withdrawal_history(self, currency=None):\n if not currency:\n currency = \"\"\n return self.__call__('balance', \"getwithdrawalhistory\", \n {\"currencyname\": currency})",
"def deposits(self, asset=None, timestamp=None):\n\t\tif self._session:\n\t\t\t... | [
"0.7181737",
"0.6265953",
"0.6256395",
"0.5999103",
"0.5971611",
"0.5971611",
"0.5891272",
"0.57960427",
"0.5796026",
"0.5788832",
"0.5654856",
"0.5641938",
"0.55472964",
"0.55197686",
"0.5512888",
"0.5473172",
"0.5465289",
"0.5432421",
"0.5431507",
"0.5428109",
"0.53995806",... | 0.8211167 | 0 |
Returns your pending deposits for all currencies if currency == None, else returns your pending deposits for a given currency | def get_pending_deposits(self, currency=None):
if not currency:
currency = ""
return self.__call__('balance', "getpendingdeposits",
{"currencyname": currency}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_net_deposits():\n try:\n currency = CONF.base if CONF.base != 'BTC' else 'XBt'\n if CONF.exchange == 'bitmex':\n result = EXCHANGE.private_get_user_wallet({'currency': currency})\n return (result['deposited'] - result['withdrawn']) * CONF.satoshi_factor\n if CO... | [
"0.61301494",
"0.5777903",
"0.5770035",
"0.5666787",
"0.56485957",
"0.56381893",
"0.56362486",
"0.5562137",
"0.54185045",
"0.5388741",
"0.525439",
"0.52407694",
"0.5226148",
"0.5206764",
"0.5167088",
"0.5162601",
"0.5137205",
"0.50447756",
"0.5023116",
"0.5020608",
"0.4967862... | 0.81448656 | 0 |
Returns your deposit address for a specified currency | def get_deposit_address(self, currency):
return self.__call__('balance', "getdepositaddress",
{"currencyname": currency}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_deposit_address(self, currency):\n return self.__call__('balance', \"generatedepositaddress\", \n {\"currencyname\": currency})",
"def account_deposit_address(self, currency_symbol):\n return self.get(f'addresses/{currency_symbol}', auth=True)",
"def depos... | [
"0.8206939",
"0.8058791",
"0.7541995",
"0.72679263",
"0.6907658",
"0.6904803",
"0.6846511",
"0.66308177",
"0.6531001",
"0.647837",
"0.6215014",
"0.6175209",
"0.6087592",
"0.6085711",
"0.6083454",
"0.59652126",
"0.5964581",
"0.58932877",
"0.5868178",
"0.585196",
"0.5732439",
... | 0.8653332 | 0 |
Generate a deposit address for a specified currency | def generate_deposit_address(self, currency):
return self.__call__('balance', "generatedepositaddress",
{"currencyname": currency}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_deposit_address(self, currency):\n return self.__call__('balance', \"getdepositaddress\", \n {\"currencyname\": currency})",
"def generateNewAddress(self, currency):\n pass",
"def account_deposit_address(self, currency_symbol):\n return self.get(f'addres... | [
"0.7937538",
"0.78079385",
"0.75209194",
"0.702808",
"0.6947784",
"0.67889476",
"0.67295337",
"0.67104584",
"0.6589194",
"0.650122",
"0.6497345",
"0.64887273",
"0.647375",
"0.63904107",
"0.6224214",
"0.5979534",
"0.5926984",
"0.5741646",
"0.5739581",
"0.5705033",
"0.56793594"... | 0.87661046 | 0 |
Initialize the gym environment, normalize if continuous and return | def init_environment(env_name):
env = gym.make(env_name)
discrete = False
if type(env.action_space) is gym.spaces.Discrete:
discrete = True
else:
env = NormalizedActions(env)
return env, discrete | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _setup():\n\n # Set random seeds\n tf.set_random_seed(CONFIG.seed)\n np.random.seed(CONFIG.seed)\n\n gs_env = tf.Variable(0, trainable=False, name='global_step_env')\n inc_gs = tf.assign_add(gs_env, 1)\n\n # Make the gym environment\n if CONFIG.env == 'mnist':\n env = MNIST()\n e... | [
"0.68251",
"0.6739193",
"0.6660122",
"0.6658179",
"0.6658179",
"0.6524979",
"0.64715725",
"0.6378405",
"0.6352905",
"0.6352905",
"0.63428676",
"0.63428676",
"0.63373494",
"0.6318366",
"0.6303331",
"0.6293471",
"0.6266703",
"0.62337184",
"0.62220687",
"0.62220687",
"0.6217486"... | 0.68122315 | 1 |
Computes Huddinge distance between two kmers x and y and minimum with their reverse compelemnt if reverse_complements==True. Gaps are denoted with lower case 'n' | def huddinge_distance(x,y,reverse_complements=False):
import six
x = x.upper().strip("N")
y = y.upper().strip("N")
if not set(x+y).issubset(ALPHABET):
raise ValueError("Unrecognized character {} in input.".format(set(x+y)-ALPHABET))
if len(x)==0 or len(y)==0: # Special case which wou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_pairs_huddinge_distance(kmers,reverse_complements=False):\n\n kmers = [x.upper().strip(\"N\") for x in kmers]\n\n all_chars = set()\n all_chars.update(*[set(x) for x in kmers])\n if not all_chars.issubset(ALPHABET):\n raise ValueError(\"Unrecognized character {} in input.\".format(all_ch... | [
"0.60899293",
"0.58851165",
"0.5833583",
"0.56599003",
"0.56141937",
"0.5577935",
"0.54773736",
"0.5452747",
"0.54051864",
"0.53413916",
"0.53242105",
"0.53145605",
"0.53009653",
"0.53005236",
"0.5288499",
"0.5278975",
"0.5265207",
"0.5264674",
"0.5258944",
"0.5247087",
"0.52... | 0.70030487 | 0 |
Compute Huddinge distance between all pairs of kmers. Return value is compressed distance matrix which can be expanded with scipy.spatial.squareform | def all_pairs_huddinge_distance(kmers,reverse_complements=False):
kmers = [x.upper().strip("N") for x in kmers]
all_chars = set()
all_chars.update(*[set(x) for x in kmers])
if not all_chars.issubset(ALPHABET):
raise ValueError("Unrecognized character {} in input.".format(all_chars-ALPHABET))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wasserstein_distance_1d(pers_diag_1, pers_diag_2) -> float:\n wasserstein_distance = d.wasserstein_distance(pers_diag_1[1], pers_diag_2[1],\n q=1, delta=0.2)\n return wasserstein_distance",
"def squared_distance_matrix(X, augmented=False):\n XX = np.d... | [
"0.5586073",
"0.5553668",
"0.55147296",
"0.5492364",
"0.5491042",
"0.547736",
"0.5469315",
"0.54214764",
"0.53913164",
"0.5382942",
"0.5367299",
"0.53591996",
"0.5332127",
"0.52939844",
"0.5293823",
"0.5292805",
"0.52920127",
"0.52787626",
"0.52740616",
"0.5269486",
"0.526588... | 0.69209677 | 0 |
Testing that are allowed to raise an exception from other exception. | def test_raise_from_other_exception(
assert_errors,
parse_ast_tree,
default_options,
code,
):
tree = parse_ast_tree(code)
visitor = WrongRaiseVisitor(default_options, tree)
visitor.run()
assert_errors(visitor, []) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_raise_():\n with pytest.raises(Exception):\n raise_(ValueError)",
"def unexpectedException(self):",
"def testRaisesException(self):\n\t\tx = BaseAction('x')\n\t\tx.throws = Exception()\n\t\tself.failUnlessRaises(Exception, x.playback)",
"def test_exception_handling(self) -> None:\n ... | [
"0.7283441",
"0.7222686",
"0.71286875",
"0.70461375",
"0.702566",
"0.6919083",
"0.69043064",
"0.6901056",
"0.6897048",
"0.6896397",
"0.68562293",
"0.6852995",
"0.684049",
"0.6824385",
"0.68236893",
"0.68157256",
"0.6806579",
"0.6799443",
"0.6794498",
"0.677336",
"0.6734699",
... | 0.74903035 | 0 |
The origin point for the `sugar` command. Shows relevant cookie count scores based on the options provided. | async def sugar(self, ctx: commands.Context, options: str = None):
if options is not None:
if options.lower() == CookieHuntSugarOptions.HIGH.value:
# Get the high scores
top_collectors = DataAccess.get_top_cookie_collectors(3)
# convert IDs to nickna... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dispNextQuestion(q):\r\n print '\\n'*100\r\n print q.name+'\\n'+'-'*60+'\\n'+q.prompt+'\\n '+q.q\r\n\r\n for i, a in enumerate(q.options):\r\n print str(i+1)+')',a\r\n \r\n guess = raw_input('\\nEnter the number for the answer: ')\r\n return str(int(guess)-1)",
"def start_game(a... | [
"0.4841101",
"0.48288307",
"0.47088268",
"0.46371207",
"0.46211737",
"0.46126956",
"0.46061584",
"0.45846096",
"0.45694092",
"0.45565212",
"0.4538243",
"0.45364892",
"0.45308313",
"0.45300734",
"0.45147198",
"0.45143977",
"0.44994774",
"0.44951534",
"0.44943297",
"0.44859034",
... | 0.6825909 | 0 |
Forces a cookie to drop ahead of schedule. | async def force_drop(self, ctx: commands.Context):
await self._check_to_send_cookie(True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prep_cookie_drop(self):\n\n min_hour = ConfiguredCog.config['content']['cookie_hunt_hour_variance'][0]\n max_hour = ConfiguredCog.config['content']['cookie_hunt_hour_variance'][1]\n hour_delay = randint(min_hour, max_hour)\n minute_delay = randint(0, 59) # Picks a random minute wi... | [
"0.6956465",
"0.64249563",
"0.6181846",
"0.6105178",
"0.6024926",
"0.59671783",
"0.5816674",
"0.5726944",
"0.56996155",
"0.5585827",
"0.55452776",
"0.5514695",
"0.54557884",
"0.5440784",
"0.5428901",
"0.5428901",
"0.53907055",
"0.5385221",
"0.53444123",
"0.5341342",
"0.532851... | 0.7046057 | 0 |
A looping task to check if a cookie needs to be sent. Checks a few parameters such as a randomized time delay and whether there's already an available cookie to claim. If all the parameters have been met, picks a random channel from a configured list and drops a cookie into that channel for claiming. | async def _check_to_send_cookie(self, force_drop: bool = False):
# If random number isn't set, plan out a new cookie drop
if self.cookie_drop_delay_hours is None:
self._prep_cookie_drop()
# If current timestamp is after the logged timestamp + random number's hours, then drop a cook... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def report_cookie(self, ctx):\n author, guild = ctx.author, ctx.guild\n last_cookie = await self.config.member(author).last_cookie()\n config = await self.config.guild(guild).all()\n confirm, cancel = self.bot.get_emoji(\n 812451214037221439), self.bot.get_emoji(8124512... | [
"0.5574006",
"0.5546708",
"0.5362515",
"0.534167",
"0.5166654",
"0.51666087",
"0.5122933",
"0.51168656",
"0.5051517",
"0.50297546",
"0.50089407",
"0.4967746",
"0.49649328",
"0.49468896",
"0.48325738",
"0.48162162",
"0.48001364",
"0.47884035",
"0.47752225",
"0.47751737",
"0.47... | 0.6909147 | 0 |
Parses the cookie file out into its corresponding data | def _parse_cookie_data() -> dict:
with open('Data/cookies.json') as cookie_data_file:
cookie_data_dict = json.load(cookie_data_file)
# Cast the necessary data
for cookie_type in cookie_data_dict:
cookie_type['weight'] = float(cookie_type['weight'])
cookie_ty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_cookies( headers ):",
"def cookie_cutter():\n sweets = open('cookies.txt', 'r').read().splitlines()\n cookie = {}\n for i in sweets:\n x = i.split()\n l = list(x[4])\n if l[0] in '1234567890':\n x[4], x[5] = x[5], x[4]\n # domain = x[0]\n # secure ... | [
"0.70252764",
"0.6949617",
"0.6799373",
"0.67058736",
"0.6616347",
"0.6616034",
"0.6607985",
"0.6571951",
"0.6514927",
"0.64970124",
"0.64934254",
"0.64665645",
"0.6439661",
"0.6244839",
"0.6065831",
"0.6001244",
"0.59881127",
"0.5973992",
"0.595498",
"0.5902724",
"0.5864861"... | 0.7205349 | 0 |
Gets an arbitrarily ordered list of weights mapped to the cookie data dictionary. | def _get_cookie_weights(self) -> list:
cookie_weights = []
for cookie_type in self.cookie_data:
cookie_weights.append(cookie_type['weight'])
return cookie_weights | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_weights(self):\n return []",
"def get_weight_list(self) -> List[float]:\n return self._weight_list",
"def get_weights(self, index):\n weight = self._weights[index]\n if isinstance(weight, dict):\n return list(weight.items())\n else:\n return [(Te... | [
"0.7143785",
"0.7113703",
"0.6898142",
"0.68969184",
"0.6720294",
"0.6644023",
"0.66178274",
"0.66178274",
"0.66178274",
"0.65902275",
"0.6558685",
"0.6558685",
"0.65377706",
"0.65377706",
"0.6528398",
"0.6528398",
"0.6528398",
"0.6528398",
"0.6523422",
"0.6523422",
"0.649902... | 0.86205095 | 0 |
Takes the preconfigured list of available channels that we can drop a cookie into, and returns a possible one. | def _pick_random_channel_to_send(self) -> Optional[TextChannel]:
# Shuffle the whole list of all the channels we can access, so that in case we can't find the first channel
# that we randomly picked, we move on to the next one safely.
random_channel_pick_list = sample(ConfiguredCog.config['cont... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _drop_channels_func(cfg, raw, subject, session) -> None:\n if cfg.drop_channels:\n msg = f'Dropping channels: {\", \".join(cfg.drop_channels)}'\n logger.info(**gen_log_kwargs(message=msg, subject=subject,\n session=session))\n raw.drop_channels(cfg.dr... | [
"0.58252966",
"0.5737545",
"0.5679604",
"0.5487908",
"0.5474256",
"0.5467786",
"0.5449958",
"0.54170334",
"0.5416666",
"0.5412446",
"0.5368089",
"0.53582144",
"0.5328972",
"0.5287675",
"0.52859217",
"0.5261427",
"0.52401495",
"0.52378476",
"0.519669",
"0.5195097",
"0.51682675... | 0.6000068 | 0 |
Gets today's drawing prompt from reddit.com/r/SketchDaily, if it exists. | def _get_daily_drawing_prompt(self) -> str:
site = urllib.request.urlopen(
urllib.request.Request("https://reddit.com/r/SketchDaily/new", headers={'User-Agent': 'Mozilla/5.0'}))
site_str = site.read().decode('utf-8')
# search for today's theme on the skd site
now = datetime... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _get_sketch_prompt(self):\n\n drawing_prompt = self._get_daily_drawing_prompt()\n\n if drawing_prompt == '':\n # No drawing prompt found for today; don't do anything\n return\n elif not drawing_prompt == self.current_prompt:\n # The prompt we pulled d... | [
"0.83026",
"0.61140496",
"0.57782805",
"0.55153304",
"0.53746676",
"0.519586",
"0.5176729",
"0.50717723",
"0.5057849",
"0.505051",
"0.5020132",
"0.50175774",
"0.5009017",
"0.49882758",
"0.49771962",
"0.49585855",
"0.49365133",
"0.4935201",
"0.49266633",
"0.49121836",
"0.49100... | 0.82358694 | 1 |
A looping task to query the web for today's sketch prompt and announce it in a given discord channel if it was found. If today's prompt was already announced, or if the prompt for today wasn't found, nothing is announced in the channel. | async def _get_sketch_prompt(self):
drawing_prompt = self._get_daily_drawing_prompt()
if drawing_prompt == '':
# No drawing prompt found for today; don't do anything
return
elif not drawing_prompt == self.current_prompt:
# The prompt we pulled does not match... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def day_countdown(bot: commands.Bot) -> None:\n while (\n int(datetime.now(tz=pytz.timezone(\"EST\")).day) in range(1, 25)\n and int(datetime.now(tz=pytz.timezone(\"EST\")).month) == 12\n ):\n tomorrow, time_left = time_left_to_aoc_midnight()\n\n # Prevent bot from being sli... | [
"0.66209805",
"0.6492989",
"0.5970007",
"0.5769224",
"0.57180107",
"0.5647457",
"0.56431574",
"0.56421155",
"0.55787164",
"0.5490393",
"0.54651934",
"0.5431895",
"0.5377005",
"0.5319981",
"0.5312935",
"0.5301288",
"0.527435",
"0.5266636",
"0.5257734",
"0.5248884",
"0.52326787... | 0.67039174 | 0 |
The send_command_bytes_usb method is a general command that takes data and packages it into a form that the YOST Labs IMU can understand. The data is in the format _______, and is repackaged as ___________. It also handles whether or not to include a response_header, which is set to False by default. | def send_command_bytes_usb(self, data, response_header = False):
checksum = 0
for d in data:
checksum += ord(d)
# Construct the packet.
# NOTE: If you want the response header use 0xf9;
# for no response header (see below) use 0xf7
packet = chr(0xf7)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raw_paste_write(self, command_bytes: bytes) -> None:\n # Read initial header, with window size.\n\n debug(f\"pyboard raw_paste_write({command_bytes})\")\n\n data = self.con.read(2)\n window_size = data[0] | data[1] << 8\n window_remain = window_size\n\n # Write out the... | [
"0.6374932",
"0.6293821",
"0.62895876",
"0.6280506",
"0.6280413",
"0.6239928",
"0.61916727",
"0.6174661",
"0.61186856",
"0.611612",
"0.60123956",
"0.59946126",
"0.5937041",
"0.59336567",
"0.593072",
"0.59133464",
"0.5911092",
"0.5905834",
"0.5869474",
"0.5856577",
"0.58054006... | 0.8783261 | 0 |
The stop_streaming method simply sends the stop stream command to the IMU, and can also close the port if specified. | def stop_streaming(self, close_port=False):
self.send_command_bytes_usb(chr(0x56))
if close_port:
self.port.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop(self) -> None:\n self._stream.stop()",
"def stop_stream(self):\n pass",
"def stop(self):\n\t\tself.stream.stop_stream()",
"def stop(self):\n self.stream.stop()\n self.running = False",
"async def async_stop_stream(self) -> None:\n await self._api.request(\n ... | [
"0.7264861",
"0.718144",
"0.7176403",
"0.70262796",
"0.6982241",
"0.6863957",
"0.6729255",
"0.6694405",
"0.6455401",
"0.6420625",
"0.6333957",
"0.6220613",
"0.6176769",
"0.6159119",
"0.6095989",
"0.6060559",
"0.6035854",
"0.6018048",
"0.6011591",
"0.59839016",
"0.5957527",
... | 0.7401476 | 0 |
Initialize a share. If value is None (default), the SecureObject starts out as an empty placeholder (implemented as a Future). | def __init__(self, value=None):
if value is None:
value = Future(loop=runtime._loop)
self.share = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__, *,\n password: str,\n share_name: str,\n share_type: str,\n supported_access_protocols: Sequence[str],\n user_name: str):\n pulumi.set(__self__, \"password\", password)\n pulumi.set(__self__, \"shar... | [
"0.626363",
"0.6119347",
"0.5971166",
"0.5934742",
"0.5703738",
"0.54947865",
"0.54902184",
"0.543624",
"0.5373682",
"0.5335877",
"0.5318093",
"0.52795523",
"0.5264376",
"0.5231973",
"0.5148437",
"0.51152617",
"0.50861144",
"0.5076849",
"0.50735134",
"0.5071154",
"0.5040574",... | 0.72121334 | 0 |
Use of secretshared objects in Boolean expressions makes no sense. | def __bool__(self):
raise TypeError('cannot use secure type in Boolean expressions') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __bool__(self):\n raise RuntimeError(\"Cannot evaluate BinarySharedTensors to boolean values\")",
"def __nonzero__(self):\n raise RuntimeError(\"Cannot evaluate BinarySharedTensors to boolean values\")",
"def on_true(self) -> global___Expression:",
"def __bool__(self):\n raise Runtim... | [
"0.69063854",
"0.64766705",
"0.6415193",
"0.62044346",
"0.598954",
"0.59646463",
"0.5953213",
"0.5934133",
"0.5916273",
"0.58861864",
"0.5845669",
"0.5841427",
"0.5830323",
"0.58289284",
"0.579894",
"0.57973653",
"0.5778859",
"0.57580787",
"0.57386625",
"0.57372",
"0.57246774... | 0.726486 | 0 |
Left shift with public integral offset. | def __lshift__(self, other):
# TODO: extend to secret offset
if not isinstance(other, int):
return NotImplemented
return runtime.mul(self, 1<<other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shift_left(self):\n self.pointer = (self.pointer - 1) % len(self.data)",
"def lrshift(val, n) -> np.int64:\n return (val % (1 << 64)) >> n",
"def leftshift(x, c):\n return x << c",
"def lshift_(self, value):\n assert isinstance(value, int), \"lshift must take an integer argument.\"\n ... | [
"0.70157146",
"0.6971136",
"0.6966064",
"0.687211",
"0.6779076",
"0.6691059",
"0.6663449",
"0.6568696",
"0.65645045",
"0.65489537",
"0.6513061",
"0.64453125",
"0.6443939",
"0.6401666",
"0.6386486",
"0.63442093",
"0.63239676",
"0.6321679",
"0.6321679",
"0.62379247",
"0.6200954... | 0.7011936 | 1 |
Initialize a secure finite field element. Value must be None, int, or correct field type. | def __init__(self, value=None):
if value is not None:
if isinstance(value, int):
value = self.field(value)
elif isinstance(value, self.field):
pass
# elif isinstance(value, Future):
# pass # NB: for internal use in runtime... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, value=None):\r\n if value is not None:\r\n if isinstance(value, int):\r\n value = self.field(value)\r\n elif isinstance(value, self.field):\r\n pass\r\n elif isinstance(value, Future):\r\n pass # NB: for intern... | [
"0.7180803",
"0.6357175",
"0.6074774",
"0.6043568",
"0.6036887",
"0.5706349",
"0.5674456",
"0.5649658",
"0.5628464",
"0.5615713",
"0.5613315",
"0.5609899",
"0.5603874",
"0.5603874",
"0.5603874",
"0.5603874",
"0.5603874",
"0.5603874",
"0.55963373",
"0.5579277",
"0.5578103",
... | 0.73585224 | 0 |
Initialize a secure fixedpoint number. Value must be None, int, float, or correct field type. Boolean flag integral sets the attribute integral of the secure fixedpoint number. If integral=True or integral=False, the attribute integral is set accordingly. Otherwise, if integral=None (not set), the attribute integral is... | def __init__(self, value=None, integral=None):
if value is not None:
if isinstance(value, int):
if integral is None:
integral = True
value = self.field(value << self.frac_length)
elif isinstance(value, float):
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, value=0, int_bits=INT_BITS, frac_bits=FRAC_BITS):\n\n if MODE_STRICT_WITHOUT_ERROR_CHECKING == 0:\n assert int_bits >= 1, \"int_bits must be greater or equal than 1\" \n assert frac_bits >= 0, \"frac_bits must be greater or eqaul than 0\"\n assert isinstance(value, ... | [
"0.5385981",
"0.53461695",
"0.5147439",
"0.5144935",
"0.50891316",
"0.48378143",
"0.483563",
"0.48116675",
"0.4750356",
"0.47082746",
"0.46940985",
"0.46737733",
"0.46501005",
"0.46455583",
"0.4642167",
"0.46177754",
"0.4615524",
"0.46141466",
"0.46034044",
"0.45899317",
"0.4... | 0.68220216 | 0 |
Secure finite field of order q = pd. Order q >= min_order. Field is prime (d = 1) by default and if modulus is prime. Extension degree d > 1 if order is a prime power pd with d > 1, if modulus is a polynomial or a string or an integer > char, or if ext_deg is an integer > 1, or if min_order > char. | def SecFld(order=None, modulus=None, char=None, ext_deg=None, min_order=None, signed=False):
# TODO: raise errors instead of assert statements
if order is not None:
p, d = gmpy2.factor_prime_power(order)
char = char or p
assert char == p
ext_deg = ext_deg or d
asse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def padic_factorization(f):\n num_factors = f.degree()\n stock = None\n for p in prime.generator():\n fmodp = uniutil.polynomial(\n f.terms(),\n finitefield.FinitePrimeField.getInstance(p))\n if f.degree() > fmodp.degree():\n continue\n g = fmodp.getRi... | [
"0.5711715",
"0.54392415",
"0.53506035",
"0.5339976",
"0.53016204",
"0.5242012",
"0.51738083",
"0.51737356",
"0.5147842",
"0.5120234",
"0.50616676",
"0.5046668",
"0.48879713",
"0.48864082",
"0.48315802",
"0.48312983",
"0.480685",
"0.4782244",
"0.47740605",
"0.47628087",
"0.47... | 0.73394835 | 0 |
Secure lbit fixedpoint numbers with fbit fractional part. | def SecFxp(l=None, f=None, p=None, n=2):
if l is None:
l = runtime.options.bit_length
if f is None:
f = l//2 # l =~ 2f enables division such that x =~ 1/(1/x)
return _SecFxp(l, f, p, n) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fixed_point(x, int_bits, frac_bits):\n if int_bits == None and frac_bits == None: return x\n _frac = x - np.floor(x) #if x >= 0 else x - np.ceil(x)\n _int = np.floor(x) #if x>= 0 else np.ceil(x)\n _frac = np.round(_frac*2**frac_bits)/2**frac_bits\n _x = _int + _frac\n # if _x > 2**(int_bits-1... | [
"0.629891",
"0.60171586",
"0.5973151",
"0.57463026",
"0.56794393",
"0.56075317",
"0.5535887",
"0.55093217",
"0.54868424",
"0.5471796",
"0.54630536",
"0.5392732",
"0.5379805",
"0.53429425",
"0.53334975",
"0.5317457",
"0.53009814",
"0.5275058",
"0.5266734",
"0.5254934",
"0.5251... | 0.61971754 | 1 |
Secure reciprocal (multiplicative inverse). | def reciprocal(self):
s, e = self.share
s = 0.5*(1/s) # TODO: no normalization for 1/s as 1/2<=abs(s)<=1 (s<0 test still needed)
return type(self)((s, 1-e)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reciprocal(self):\n return Rational(self.denominator, self.numerator)",
"def __rtruediv__(self, other):\r\n return other * self.reciprocal()",
"def reciprocal(self):\n recip = RationalFrac(0, empty=True)\n if 0 in self.numer:\n raise ZeroDivisionError('the reciprocal of z... | [
"0.65587157",
"0.63058263",
"0.6252335",
"0.60305053",
"0.5973367",
"0.5941175",
"0.5938069",
"0.593007",
"0.59042937",
"0.58057606",
"0.5718905",
"0.5677508",
"0.5594446",
"0.55937606",
"0.55853975",
"0.55845696",
"0.55700475",
"0.55287266",
"0.5506249",
"0.53989714",
"0.538... | 0.6664809 | 0 |
Secure lbit floatingpoint number with sbit significand and ebit exponent, where l=s+e. The significand is an (s+1)bit secure (signed) fixedpoint number. The absolute value of a nonzero significand is normalized between 0.5 and 1.0. Here, both 0.5 and 1.0 are included and therefore one extra bit is used. The exponent is... | def SecFlt(l=None, s=None, e=None):
if l is None:
if s is None or e is None:
l = runtime.options.bit_length
else:
l = s + e
if s is None:
if e is None:
s = round(6.2 + 0.99*l - 4.1*math.log(l)) # yields IEEE 754 precisions
# 1-bit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_sign_exponent_mantissa(value, exponent_bits=exponent_bits, mantissa_bits=mantissa_bits):\n float_mantissa, float_exponent = math.frexp(value)\n if (float_mantissa >= 0):\n sign = 0\n else:\n sign = 1\n exponent = int(float_exponent + 2**(exponent_bits - 1))\n mantissa = int(abs(... | [
"0.6315675",
"0.58471805",
"0.5813373",
"0.57885563",
"0.57599986",
"0.5402319",
"0.5355119",
"0.53074723",
"0.5191419",
"0.51889896",
"0.5182611",
"0.51206464",
"0.5116516",
"0.5083811",
"0.50577974",
"0.5049948",
"0.50257796",
"0.5018366",
"0.5010144",
"0.50060797",
"0.4954... | 0.7129989 | 0 |
Handle GET requests for single director | def retrieve(self, request, pk=None):
try:
director = Director.objects.get(pk=pk)
serializer = DirectorSerializer(director, context={'request': request})
return Response(serializer.data)
except Exception as ex:
return HttpResponseServerError(ex) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_GET(self):\n parsed_path = urlparse.urlparse(self.path)\n if parsed_path.path == '/books':\n return self.books()\n elif parsed_path.path == '/my_loans':\n return self.my_loans()\n return self.send_response(404)",
"def do_GET(self):\n\n files = { \"/... | [
"0.64945436",
"0.6366653",
"0.6194099",
"0.61047953",
"0.6070203",
"0.6068011",
"0.59507227",
"0.5916238",
"0.5893639",
"0.5875762",
"0.58593446",
"0.58449155",
"0.58247393",
"0.58247393",
"0.58247393",
"0.58247393",
"0.58247393",
"0.5821012",
"0.5773198",
"0.5770254",
"0.576... | 0.6844999 | 0 |
Handle GET requests to get all directors | def list(self, request):
directors = Director.objects.all()
# Note the additional `many=True` argument to the
# serializer. It's needed when you are serializing
# a list of objects instead of a single object.
serializer = DirectorSerializer(
directors, many=True, con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_directors():\n return Director.query.all()",
"def do_GET(self):\r\n if not self._client_allowed():\r\n return\r\n\r\n try:\r\n (_, _, path, query, _) = urlparse.urlsplit(self.path)\r\n params = urlparse.parse_qs(query)\r\n # Give each handler a chance to respond.\r\n ... | [
"0.6055036",
"0.5751576",
"0.5671285",
"0.56701726",
"0.5646972",
"0.5645688",
"0.563264",
"0.5629597",
"0.561972",
"0.5616489",
"0.5600296",
"0.5578244",
"0.5574298",
"0.5556852",
"0.5527755",
"0.5527755",
"0.5527755",
"0.5527755",
"0.5527755",
"0.55089176",
"0.549342",
"0... | 0.65263104 | 0 |
Sets up PyMOL for making animations. | def setup_pymol():
pymol.finish_launching() # Prevent threading errors
# Configure global settings
cmd.set('scene_buttons', 1)
cmd.set('matrix_mode', 1)
cmd.set('movie_panel', 1)
# Configure quality settings
cmd.mset("1 x500")
cmd.set('ray_trace_frames', 1)
cmd.viewport(800, 800) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_anim(self):\n pass",
"def __init__(\n self, OUTPUT_DIREC, name=\"forgot_name_TC_Animator\", move_with=True, **kwargs\n ):\n self.co, self.sy = ip.read_in(OUTPUT_DIREC, name)\n # set up figure and animation\n self.move_with = move_with\n self.name = name\n ... | [
"0.7058298",
"0.6481218",
"0.64715505",
"0.64715505",
"0.64715505",
"0.64715505",
"0.64715505",
"0.64715505",
"0.64715505",
"0.64715505",
"0.64715505",
"0.64715505",
"0.64715505",
"0.62363625",
"0.61171365",
"0.60874075",
"0.58897936",
"0.5842589",
"0.5781435",
"0.57651997",
... | 0.7555513 | 0 |
Configure the initial representations for the protein and the ligand | def initial_representations():
cmd.hide('everything', 'all')
cmd.show('cartoon', 'all')
cmd.select('ligand', 'resn NFT')
cmd.deselect()
cmd.show("sticks", "ligand") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n super(sppasSeparatorSettings, self).__init__()\n self.__dict__ = dict(\n phonemes=\"-\", # X-SAMPA standard\n syllables=\".\", # X-SAMPA standard\n variants=\"|\" # used for all alternative tags\n )",
"def __init__(\n sel... | [
"0.5557697",
"0.55270153",
"0.5517505",
"0.54689217",
"0.54266536",
"0.5382944",
"0.5378958",
"0.52977574",
"0.52924097",
"0.5276829",
"0.52426785",
"0.52357006",
"0.521549",
"0.52119714",
"0.52119714",
"0.520381",
"0.5188778",
"0.5159423",
"0.5150978",
"0.51465404",
"0.51394... | 0.6362775 | 0 |
Set up the scenes for a global view and a closeup on the binding site | def set_up_scenes():
cmd.zoom('Cathepsin', 10) # Zoom out to get a view on the whole complex
cmd.scene('001', 'store', message='This is the first scene with a view on the complex!')
cmd.set_view(closeup) # Get a close-up of the ligand by using the manually chosen viewpoint
cmd.scene('002', 'store', me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_simple_scenes(self):\n clown = Clown()\n clown.set_location( 0, 0, 0 )\n clown.set_size( 1, 1, 1 )\n self.objects.append( clown )\n\n clown1Scene = Scene3D()\n clown1Scene.add_object( clown )\n self.scenes.append( clown1Scene )\n\n head = Head()\n ... | [
"0.62434477",
"0.6230232",
"0.61665434",
"0.6159436",
"0.60763496",
"0.6068542",
"0.59872186",
"0.5984309",
"0.5977762",
"0.5972188",
"0.597133",
"0.59602195",
"0.5914986",
"0.59016806",
"0.5899475",
"0.5885025",
"0.5880209",
"0.58532643",
"0.5839844",
"0.5828175",
"0.5812543... | 0.70386547 | 0 |
Assign scenes to frames | def scenes_to_frames():
# Scene 001 from frames 1-150
cmd.scene('001', animate=0)
cmd.mview('store', 1)
cmd.mview('store', 150)
# Scene 002 from frames 250-400
cmd.scene('002', animate=0)
cmd.mview('store', 250)
cmd.mview('store', 400) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_scenes():\n cmd.zoom('Cathepsin', 10) # Zoom out to get a view on the whole complex\n cmd.scene('001', 'store', message='This is the first scene with a view on the complex!')\n cmd.set_view(closeup) # Get a close-up of the ligand by using the manually chosen viewpoint\n cmd.scene('002', 's... | [
"0.6616894",
"0.655957",
"0.6380134",
"0.6218213",
"0.61854327",
"0.6162548",
"0.6120408",
"0.6058437",
"0.59921515",
"0.59880334",
"0.59158957",
"0.5908106",
"0.58934283",
"0.58868957",
"0.5860588",
"0.58202595",
"0.5736717",
"0.5720266",
"0.57186955",
"0.57179105",
"0.57086... | 0.6971273 | 0 |
given a list of keys and a list of values where len(values) >= len(keys) zips them into a dictionary, merging the last elements of "values" into one string if there are too many of them. | def zip_args(keys, values):
if len(values) < len(keys):
raise ValueError('not enough values to zip')
if len(values) > len(keys):
offset = len(keys) - 1
values[offset:] = [' '.join(values[offset:])]
return dict(zip(keys, values)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join_string_lists(**kwargs) -> dict:\n return {k: \",\".join(v) for k, v in kwargs.items() if v}",
"def reduce_length(key, values):\n yield str((key, len(values)))",
"def gen_dict(keys, vals):\n retVal = {}\n for i in range(len(keys)):\n if i > len(vals):\n retVal[keys[i]] = \"\... | [
"0.6087465",
"0.60600287",
"0.6010543",
"0.5700864",
"0.56741667",
"0.56285065",
"0.5496323",
"0.5471675",
"0.546605",
"0.5436579",
"0.53102285",
"0.529213",
"0.5269648",
"0.52457285",
"0.5206242",
"0.52028763",
"0.5192346",
"0.5175492",
"0.5168006",
"0.515274",
"0.5151428",
... | 0.67119396 | 0 |
Default returns an exmpty dictionary Override in subclass to return a dictionary of actual report data. | def report_data(self):
return {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _report():\n return {\n 'type' : 'class',\n 'name' : 'report',\n 'base' : None,\n 'is_abstract' : False,\n 'doc' : None,\n 'properties' : [\n ('date', 'datetime', '0.1', None),\n ('evaluation', 'quality.evaluation', '1.1', None),\n (... | [
"0.7502043",
"0.7178087",
"0.6950027",
"0.67789155",
"0.6740138",
"0.6650753",
"0.6541191",
"0.6514413",
"0.65049016",
"0.64137584",
"0.63945055",
"0.63503003",
"0.6334826",
"0.6326371",
"0.6305484",
"0.63021976",
"0.62488234",
"0.6211244",
"0.62085056",
"0.62085056",
"0.6204... | 0.8397921 | 0 |
Read XML fragment from the Serial device. | def read(self) -> str:
return self._readXMLfragment() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _readXMLfragment(self) -> str:\n\t\tself._check()\n\t\tself._raven.reset_output_buffer()\n\t\tself._raven.reset_input_buffer()\n\t\tfirst_char = self._raven.read()\n\t\twhile (first_char == 0 or first_char == b' '):\n\t\t\tfirst_char = self._raven.read()\n\t\tif (first_char != b'<'):\n\t\t\tself._clear()\n\t\t... | [
"0.6738327",
"0.66172403",
"0.6028417",
"0.572713",
"0.570984",
"0.56527716",
"0.5625893",
"0.56190526",
"0.5601156",
"0.5577678",
"0.5563732",
"0.5547772",
"0.554366",
"0.5537192",
"0.5486714",
"0.54664564",
"0.54640734",
"0.5418437",
"0.53619486",
"0.53369015",
"0.533309",
... | 0.71517503 | 0 |
Reads XML fragment, byte by byte. Continues until it encounters the end tag. | def _readXMLfragment(self) -> str:
self._check()
self._raven.reset_output_buffer()
self._raven.reset_input_buffer()
first_char = self._raven.read()
while (first_char == 0 or first_char == b' '):
first_char = self._raven.read()
if (first_char != b'<'):
self._clear()
raise InvalidFormat('INVALID CHAR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read(self, len):\n ret = libxml2mod.xmlParserInputBufferRead(self._o, len)\n return ret",
"def read(self) -> str:\n\t\treturn self._readXMLfragment()",
"def _readuntil(f, end=_TYPE_END):\n\tbuf = bytearray()\n\twhile True:\n\t\tbyte = f.read(1)\n\t\tif byte != end:\n\t\t\tbuf += byte\n\t\tels... | [
"0.631318",
"0.6233979",
"0.5647298",
"0.5511581",
"0.5358623",
"0.5339674",
"0.5334437",
"0.5314324",
"0.5259029",
"0.524801",
"0.52402294",
"0.5204905",
"0.5200498",
"0.5184129",
"0.5168518",
"0.5159357",
"0.5159198",
"0.5158312",
"0.5117924",
"0.51070935",
"0.50285447",
... | 0.73196983 | 0 |
Raises NoDeviceFoundException if no RAVEn is found. | def _check(self):
if not self._raven:
raise NoDeviceFoundException | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unavailable_pcm_value(self):\n connection = _ConstantResponseConnection(\"?\")\n interface = OBDInterface(connection)\n\n with assert_raises(ValueNotAvailableError):\n interface.read_pcm_value(_STUB_PCM_VALUE_DEFINITION)\n\n with assert_raises(ValueNotAvailableError)... | [
"0.53241944",
"0.52015805",
"0.5128626",
"0.5109298",
"0.5102709",
"0.50846285",
"0.5037354",
"0.49841046",
"0.49652138",
"0.4959888",
"0.48987514",
"0.48051974",
"0.47894606",
"0.4788844",
"0.47884858",
"0.4783935",
"0.476777",
"0.47373584",
"0.47236955",
"0.4716197",
"0.470... | 0.69653606 | 0 |
Either create a layer shared between builds, or return one from the cache. | def shared_layer(self, build_function, args, kwargs, skip_cache=False, save=False, initfn=None, initfnkwargs=None):
assert 'name' in kwargs # We need a name to be able to save/load layers
fullname = self.generate_name(kwargs['name'])
key = self._layer_counter
if skip_cache or key not ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_flyweight(self, shared_state: Dict) -> Flyweight:\n\n key = self.get_key(shared_state)\n\n if not self._flyweights.get(key):\n print(\"FlyweightFactory: Can't find a flyweight, creating new one.\")\n self._flyweights[key] = Flyweight(shared_state)\n else:\n ... | [
"0.56422144",
"0.5565521",
"0.5382827",
"0.5356183",
"0.535318",
"0.52758646",
"0.5268788",
"0.52604026",
"0.5226205",
"0.5209528",
"0.5200411",
"0.5193046",
"0.51882285",
"0.51818866",
"0.51814073",
"0.51719624",
"0.5166996",
"0.5164656",
"0.5158343",
"0.5148412",
"0.5145308... | 0.7204974 | 0 |
Increment the layer counter by count. If a shared layer is used in an optional branch of the recipe, use skip_layer in the other branch to ensure that the layer index (counter) is consisent regardless of the branch taken. | def skip_layer(self, count=1):
self._layer_counter += count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_layer_count(layer_type=''):\n _LAYER_TYPES[layer_type] += 1\n return _LAYER_TYPES[layer_type]",
"def num_layers(self, value):\n if self._is_build:\n raise CustomException('The num_layers attribute can only be '\n + 'changed if the network has not b... | [
"0.62739974",
"0.59908986",
"0.5784928",
"0.57338244",
"0.5592933",
"0.5591847",
"0.55628777",
"0.55294997",
"0.55196124",
"0.5519254",
"0.5519254",
"0.5519254",
"0.5516848",
"0.5438291",
"0.54324627",
"0.5424787",
"0.5423188",
"0.5379306",
"0.5374964",
"0.53313196",
"0.52989... | 0.700846 | 0 |
Internal method. Save the weights of savable layers into the given h5py file object. | def _save_local_weights(self, h5file):
for name, layer in self._layers_to_save.items():
self._save_layer_weights(layer, name, h5file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _save_layer_weights(self, layer, name, h5file):\n # How to save binary data in h5py: http://docs.h5py.org/en/latest/strings.html\n # How to serialize objects: https://docs.python.org/3.3/library/pickle.html\n weights = layer.get_weights()\n h5file.create_dataset(\"{}/length\".format... | [
"0.8043652",
"0.7284594",
"0.7061492",
"0.7000754",
"0.6942523",
"0.6871728",
"0.6865363",
"0.6853377",
"0.682836",
"0.68251354",
"0.68034434",
"0.6778258",
"0.6753908",
"0.67513347",
"0.67415386",
"0.6701683",
"0.66921026",
"0.6691346",
"0.6630848",
"0.66061604",
"0.66061604... | 0.7933558 | 1 |
Internal method. Load and overwite the weights of savable layers. | def _load_local_weights(self, h5file):
for name, layer in self._layers_to_save.items():
self._load_layer_weights(layer, name, h5file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _save_local_weights(self, h5file):\n for name, layer in self._layers_to_save.items():\n self._save_layer_weights(layer, name, h5file)",
"def load_weigths_into_target_network(self):\n logging.debug(\"Transfer Weight!\")\n self.network.save_weights(self._save_path)\n self... | [
"0.7112637",
"0.6886456",
"0.68030757",
"0.67139125",
"0.66837305",
"0.65610504",
"0.65234435",
"0.65043664",
"0.64603144",
"0.6424455",
"0.6416083",
"0.63992655",
"0.63778496",
"0.6374594",
"0.6349747",
"0.62888044",
"0.6262619",
"0.6246883",
"0.62425447",
"0.62310976",
"0.6... | 0.745677 | 0 |
Internal method. Save the weights of one layer into a h5py file object. | def _save_layer_weights(self, layer, name, h5file):
# How to save binary data in h5py: http://docs.h5py.org/en/latest/strings.html
# How to serialize objects: https://docs.python.org/3.3/library/pickle.html
weights = layer.get_weights()
h5file.create_dataset("{}/length".format(name), dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _save_local_weights(self, h5file):\n for name, layer in self._layers_to_save.items():\n self._save_layer_weights(layer, name, h5file)",
"def save(self, filename):\n hebbian_weights = open(filename, \"w\")\n for i in xrange(self.hidden):\n hebbian_weights.write(\"\\t... | [
"0.75632304",
"0.722571",
"0.7194497",
"0.70877653",
"0.6951095",
"0.6914637",
"0.6897107",
"0.6889849",
"0.67413175",
"0.67290705",
"0.66955364",
"0.6688484",
"0.66395587",
"0.66256803",
"0.66020083",
"0.65897715",
"0.65897715",
"0.65264314",
"0.6514339",
"0.65094656",
"0.64... | 0.8237694 | 0 |
Internal method. Load the weights of one layer from a h5py file object. | def _load_layer_weights(self, layer, name, h5file):
group = h5file[name]
length = group['length'][0]
weights = [group["{}".format(idx)] for idx in range(length)]
layer.set_weights(weights) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_weights(self, filepath, by_name=False):\n if h5py is None:\n raise ImportError('`load_weights` requires h5py.')\n with h5py.File(filepath, 'r') as f:\n if 'layer_names' not in f.attrs and 'model_weights' in f:\n f = f['model_weights']\n if by_name:\n load_weights_from_hd... | [
"0.7762422",
"0.7741495",
"0.7162051",
"0.70875186",
"0.7042549",
"0.69837266",
"0.6980732",
"0.68744195",
"0.68642384",
"0.68527466",
"0.6803724",
"0.6780911",
"0.67803186",
"0.67626196",
"0.67356473",
"0.6702431",
"0.6684989",
"0.66833407",
"0.6679716",
"0.66557705",
"0.661... | 0.8173073 | 0 |
Initialise the dense layer providing the input. Implement any necessary initialization in the subclass. | def init_dense(self, layer):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, input_dim: int, output_dim: int):\n\n super().__init__()\n\n self.input_dim = input_dim\n self.output_dim = output_dim\n\n self.batchNorm1 = layers.BatchNormalization()\n self.dense1 = layers.Dense(\n 64, input_shape=(input_dim+output_dim,),\n ... | [
"0.7554496",
"0.7480992",
"0.71194774",
"0.6937145",
"0.6901332",
"0.68904847",
"0.68022543",
"0.67635393",
"0.6720167",
"0.67137855",
"0.6669927",
"0.6656371",
"0.6638359",
"0.66269267",
"0.6613141",
"0.6611152",
"0.6595971",
"0.65903264",
"0.658748",
"0.65860504",
"0.655012... | 0.84982526 | 0 |
Create a layer that crops out a range from a 1D (+ batch dimension) input tensor. | def CropLayer(start, end, step=1, name=None):
# See https://github.com/keras-team/keras/issues/890
return keras.layers.Lambda(lambda x: x[:, start:end:step], output_shape=(int((end-start)/step),), name=name)
# Could use K.slice but unsure how to manage batch dimension | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clip(tensor, a_min=None, a_max=None):\n raise NotImplementedError",
"def _create_clip(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n if op.min is not None:\n node.input.append(op.name + \":min\")\n else:\n node.input.append(\"\")\n... | [
"0.6546244",
"0.6141691",
"0.61134",
"0.6070888",
"0.5853883",
"0.5851135",
"0.58372146",
"0.57809424",
"0.5738954",
"0.5708426",
"0.56785744",
"0.56711173",
"0.5663829",
"0.56391865",
"0.56372476",
"0.5624146",
"0.5603696",
"0.5546158",
"0.5543226",
"0.5527415",
"0.5527415",... | 0.650073 | 1 |
Create a layer that adds size_added 0's to a 1D (+ batch dimension) tensor in all batches. | def ExtendWithZeros(size_added, name=None):
# This automatically infers the batch size from the shape of the input
# See https://stackoverflow.com/questions/46465813/creating-constant-value-in-keras
def func(x):
batch_size = K.shape(x)[0]
zeros = K.zeros((1, size_added))
tiledzeros =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_dummy_batch_dim(x):\n return x.view(1, x.size()[0], x.size()[1], x.size()[2])",
"def add_layer(inputs, in_size, out_size, activation_function=None):\n Weights = tf.Variable(tf.random_normal([in_size, out_size]))\n baises = tf.Variable(tf.zeros([1, out_size]) + 0.1)\n Wx_plus_b = tf.matmul(inp... | [
"0.6467608",
"0.63522273",
"0.6214069",
"0.600142",
"0.5907973",
"0.58308244",
"0.57064754",
"0.55592173",
"0.5558718",
"0.5553583",
"0.5531294",
"0.55280936",
"0.54874694",
"0.5435519",
"0.54327196",
"0.5429146",
"0.5413363",
"0.540437",
"0.54015374",
"0.53974116",
"0.539462... | 0.7770197 | 0 |
Batch gets the update history of assets that overlap a time window. For RESOURCE content, this API outputs history with asset in both nondelete or deleted status. For IAM_POLICY content, this API outputs history when the asset and its attached IAM POLICY both exist. This can create gaps in the output history. | def BatchGetAssetsHistory(self, request, context):
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def history(self, q=None):\r\n q = q or []\r\n # allow history to be returned for deleted alarms, but scope changes\r\n # returned to those carried out on behalf of the auth'd tenant, to\r\n # avoid inappropriate cross-tenant visibility of alarm history\r\n auth_project = acl.get... | [
"0.5380494",
"0.5238478",
"0.51865685",
"0.4977591",
"0.49411282",
"0.48572037",
"0.4824996",
"0.48175287",
"0.47901803",
"0.47824702",
"0.47599956",
"0.47578102",
"0.4734974",
"0.47099155",
"0.46861556",
"0.46759883",
"0.4675461",
"0.4665507",
"0.46557721",
"0.4652701",
"0.4... | 0.61627144 | 0 |
Generate a random name of the form "export_XXXXXX" where XXXXXX are 6 random characters. | def generate_rand_name() -> str:
suf = "".join(random.choices(string.ascii_uppercase + string.digits, k=6))
return f"exporters_{suf}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_name(prefix='test'):\n rndbytes = os.urandom(8)\n md5 = hashlib.md5()\n md5.update(rndbytes)\n return '{}_{}'.format(prefix, md5.hexdigest()[:7])",
"def generate_unique_name(base):\n random_length = 10\n random_string = ''.join(random.choices(string.ascii_lowercase,\n ... | [
"0.768563",
"0.76545644",
"0.75999147",
"0.7569935",
"0.7542139",
"0.7486131",
"0.7448492",
"0.7422053",
"0.73991156",
"0.7305884",
"0.72978884",
"0.7269345",
"0.72691554",
"0.7266666",
"0.72513133",
"0.72499096",
"0.72090775",
"0.7191241",
"0.7174157",
"0.71657175",
"0.71649... | 0.872831 | 0 |
Validates data based on a table's schema. `table` is a dictionary where keys are column names and values are of the type `resilient_exporters.utils.ColumnDescription`. | def _validate_data_for_sql_table(data: dict, table: dict):
for key, val in data.items():
if val is None:
if not table[key].is_nullable:
raise DataTypeError(message=f"Column '{key}' is not nullable, but \
value provided is None.")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_table(self, table_name, table_meta, table_data=None, errors=None):\n errors = [] if errors is None else errors\n dtypes = self.get_dtypes(table_name, ids=True, errors=errors)\n\n # Primary key field exists and its type is 'id'\n primary_key = table_meta.get('primary_key')\... | [
"0.72025895",
"0.67606306",
"0.64266175",
"0.6219533",
"0.621396",
"0.6048845",
"0.60193807",
"0.5879363",
"0.5862361",
"0.582637",
"0.5825835",
"0.5788179",
"0.5783682",
"0.575792",
"0.57199675",
"0.57069767",
"0.5690828",
"0.5687178",
"0.5678511",
"0.56484246",
"0.56320566"... | 0.6854717 | 1 |
Sample application of supbot which takes in commands to run actions, and prints incoming events on screen made just to tests the library starts the bot then waits for input | def main():
args = docopt(__doc__)
if args["--version"]:
from supbot import __version__
print("supbot v{}".format(__version__))
return
print("Loading...")
kwargs = {}
for k, v in args.items():
kwargs[k.strip("-").replace("-", "_")] = v
with Supbot(message_rece... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n user_interaction()",
"def main():\n\ttoken = os.getenv(\"BOT_TOKEN\")\n\tapplication = Application.builder().token(token).read_timeout(30).write_timeout(30).build()\n\tload_interactions(application)\n\tprint(\"Simple Media Converter instance started!\")\n\tapplication.run_polling()",
"def main... | [
"0.66402084",
"0.6416996",
"0.63584006",
"0.63525045",
"0.63263494",
"0.6285461",
"0.62299246",
"0.62007874",
"0.6193642",
"0.6058847",
"0.60473156",
"0.59969383",
"0.5994912",
"0.59931445",
"0.5974902",
"0.5973593",
"0.5972498",
"0.5970085",
"0.5967575",
"0.5942954",
"0.5934... | 0.71783435 | 0 |
Given a username provide the password hash for verification. | def get_password_hash(self, username):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_password(username, password):\n if username in user_auth and check_password_hash(user_auth.get(username), password):\n return username",
"def hash_password(username, password):\n m = hashlib.sha512()\n m.update(username.encode('utf-8'))\n m.update(password.encode('utf-8'))\n retu... | [
"0.76989436",
"0.74546",
"0.74088085",
"0.6934754",
"0.6850222",
"0.6827627",
"0.681311",
"0.67802805",
"0.6749425",
"0.67201895",
"0.67056984",
"0.6703862",
"0.6681003",
"0.66740316",
"0.6672733",
"0.66718876",
"0.6665299",
"0.66435826",
"0.66078746",
"0.6593887",
"0.6589873... | 0.8096595 | 0 |
Given an API key provide the username for verification. | def get_username_for_api_key(self, api_key):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_key(request):\r\n user_acct = request.user\r\n return _api_response(request, {\r\n 'api_key': user_acct.api_key,\r\n 'username': user_acct.username\r\n })",
"def authenticate_key(api_key):\n global db\n if db is None:\n init_db()\n try:\n if not api_key:\n ... | [
"0.6946986",
"0.6891404",
"0.6888661",
"0.6683553",
"0.6593266",
"0.64410377",
"0.63841265",
"0.63680893",
"0.6326453",
"0.62688935",
"0.617031",
"0.6064826",
"0.6000425",
"0.6000425",
"0.59984523",
"0.59604925",
"0.5912697",
"0.5912697",
"0.5912697",
"0.5871952",
"0.5871952"... | 0.82580423 | 0 |
This method parses the raw results and returns the (matched) rule names. Not all scanners have rules that necessarily match. | def extract_rule_names(self):
if self.scanner == YARA:
return sorted({result['rule'] for result in self.results})
if self.scanner == CUSTOMS and 'matchedRules' in self.results:
return self.results['matchedRules']
# We do not have support for the remaining scanners (yet).
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rules(self):\n rules = []\n for item in self.name:\n rules.append(item)\n return rules",
"def match(self, input_reader):\n retval = []\n # skip the whitespace here to prevent errors at the end of the string\n if input_reader.getIgnoreState():\n ... | [
"0.58293056",
"0.574617",
"0.57306695",
"0.56760645",
"0.55722415",
"0.55476874",
"0.54868764",
"0.54668844",
"0.54554164",
"0.5445627",
"0.54269177",
"0.5400866",
"0.5398674",
"0.5394911",
"0.53394765",
"0.5269379",
"0.5252902",
"0.5246714",
"0.5233869",
"0.52135444",
"0.518... | 0.8033873 | 0 |
Construct a new waypoint updater ROS node. Subscribe to relevant topics and start periodic publishing loop. | def __init__(self):
# Set a node name - something relevant
rospy.init_node('waypoint_updater')
# Most recent pose
self.pose = None
# Map waypoint list
self.waypoints = None
# Map waypoint list xy only
self.waypoints_2d = None
# Map waypoint ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_and_publish(self):\n # 1. Find next_waypoint based on ego position & orientation\n if self._update_next_waypoint():\n\n # 2. Generate the list of next LOOKAHEAD_WPS waypoints\n num_base_wp = len(self.base_waypoints)\n last_base_wp = num_base_wp-1\n ... | [
"0.6129685",
"0.6112764",
"0.6028667",
"0.5951765",
"0.5935534",
"0.5821579",
"0.580386",
"0.56859714",
"0.5633623",
"0.5629907",
"0.56185484",
"0.55631036",
"0.5547242",
"0.5492855",
"0.5485667",
"0.54784465",
"0.5472739",
"0.5470031",
"0.5346683",
"0.53146404",
"0.53136533"... | 0.66279036 | 0 |
Save the base waypoint list, and derive a KDTree object that can be used to rapidly find the closest waypoint. | def base_waypoints_cb(self, waypoints):
# Save the waypoint list
self.waypoints = waypoints
# If waypoints_2d hasn't been initialized...
if not self.waypoints_2d:
# Extract xy coordinates from the waypoint list
self.waypoints_2d = [[waypoint.pose.pose.position.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_path(self, grid, start_wp, end_wp):\n # The open and closed sets\n openset = set()\n closedset = set()\n\n # Add the starting point to the open set\n openset.add(start_wp)\n\n # While the open set is not empty\n while openset:\n # Find the waypoin... | [
"0.581276",
"0.5641672",
"0.5496497",
"0.5485003",
"0.5446566",
"0.5437193",
"0.54245466",
"0.5296717",
"0.5245098",
"0.52290475",
"0.5214895",
"0.51733696",
"0.5162174",
"0.5152632",
"0.5138083",
"0.51125187",
"0.5094541",
"0.5083135",
"0.507725",
"0.5061636",
"0.5053027",
... | 0.63528305 | 1 |
Publish a list containing a fixed number (LOOKAHEAD_WPS) of upcoming waypoints. | def publish_waypoints(self):
# Make a lane message
lane = Lane()
# Get closest waypoint index
closest_idx = self.get_closest_waypoint_idx()
# Get farthest waypoint index
farthest_idx = closest_idx + LOOKAHEAD_WPS
# Slice to get the upcoming waypoints
u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_and_publish(self):\n # 1. Find next_waypoint based on ego position & orientation\n if self._update_next_waypoint():\n\n # 2. Generate the list of next LOOKAHEAD_WPS waypoints\n num_base_wp = len(self.base_waypoints)\n last_base_wp = num_base_wp-1\n ... | [
"0.62480044",
"0.60641503",
"0.56459844",
"0.5507908",
"0.5430524",
"0.5343059",
"0.51219857",
"0.5051992",
"0.5036601",
"0.5036601",
"0.49800295",
"0.4899217",
"0.4861399",
"0.48376894",
"0.48301238",
"0.48267654",
"0.47846898",
"0.47637987",
"0.47414124",
"0.47414124",
"0.4... | 0.62992644 | 0 |
Find the index of the waypoint closest to the current vehicle position. | def get_closest_waypoint_idx(self):
# TODO:
# The churchlot waypoints are roughly circular but have self-
# intersecting endpoints, so I'm not sure how this code will
# yield good results. Might need some additional filtering
# logic to force a choice consistent with the vehicl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_closest_waypoint_idx(self):\n\n # Position\n x = self.car_pose.pose.position.x\n y = self.car_pose.pose.position.y\n closest_idx = self.waypoint_tree.query([x, y], 1)[1]\n\n # Coordinates\n closest_coord = self.waypoints_2d[closest_idx]\n prev_coord = self.w... | [
"0.8830682",
"0.85288805",
"0.84218025",
"0.8262445",
"0.800733",
"0.79122454",
"0.7903936",
"0.7894664",
"0.78327197",
"0.78181565",
"0.77997684",
"0.7766977",
"0.7581055",
"0.75732034",
"0.7417619",
"0.70965505",
"0.70769525",
"0.70434797",
"0.6945622",
"0.68906826",
"0.686... | 0.87519574 | 1 |
Given a list of waypoints and the index of a waypoint at which to stop the vehicle, compute the maximum velocities at each waypoint from the stoplight at which the deceleration limit can be honored while stopping at the light. | def deceleration_velocities(self, waypoints, stop_idx):
# TODO:
# It would be cool to calculate the jerk minimizing trajectory as the velocity profile
# here instead of using uniform accelaration. I think this might be straightforward
# and it would give the test passengers a nice smoot... | {
"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.6782716",
"0.670986",
"0.5823709",
"0.5699146",
"0.564044",
"0.5634501",
"0.5554556",
"0.550232",
"0.5494014",
"0.5378662",
"0.531732",
"0.5241058",
"0.52316356",
"0.5197867",
"0.5169545",
"0.516476",
"0.51561236",
"0.5120471",
"0.508423",
"0.5076499",
"0.5075114",
"0.50... | 0.6912576 | 0 |
Given a package ID, fetch the binary data for the corresponding DALF. | def get_package(self, __package_id):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_by_id(data_id):\n return Data.get_by_id(data_id)",
"def get_package(self, package_id):\n return self._package_cache.get(package_id)",
"def fetchPDB(pdb_id):\n url = 'http://www.rcsb.org/pdb/files/%s.pdb' % pdb_id.split('.')[0]\n return urllib.urlopen(url).read()",
"def download_p... | [
"0.5741528",
"0.57333213",
"0.5639069",
"0.56298864",
"0.5627175",
"0.56064665",
"0.5505054",
"0.5451957",
"0.54145837",
"0.53899807",
"0.53776354",
"0.53315514",
"0.53221554",
"0.5293827",
"0.5262425",
"0.52597123",
"0.5251216",
"0.5238555",
"0.5213157",
"0.5190088",
"0.5183... | 0.6083735 | 0 |
Fetch a list of all known package IDs. | def list_package_ids(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_package_ids(self):\n return self._package_cache.keys()",
"def get_all_packages(cls):\n packages = Package.query.all()\n return packages",
"def get_ids(self) -> List[str]:",
"def _get_remote_import_ids(self, pkg_dir):\n sources = glob(os.path.join(pkg_dir, '*.go'))\n out... | [
"0.7446137",
"0.6486978",
"0.64863884",
"0.64059454",
"0.6339285",
"0.6302878",
"0.6286886",
"0.60721457",
"0.6067935",
"0.60119027",
"0.5990228",
"0.5939338",
"0.58955723",
"0.58918065",
"0.58891857",
"0.5881745",
"0.58761805",
"0.58683753",
"0.5831789",
"0.58257884",
"0.580... | 0.75314474 | 0 |
Submit one or more commands to the Ledger API. | def submit(
self,
__commands,
*,
workflow_id=None,
command_id=None,
read_as=None,
act_as=None,
):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_commands(self, commands=None):\n commands = commands or []\n command_list = {}\n for command in commands:\n command_list[command.id] = {\n 'speed': command.speed, 'direction': command.direction\n }\n data = {'commands': command_list}\n ... | [
"0.6990217",
"0.6171283",
"0.585225",
"0.575658",
"0.57206416",
"0.57013875",
"0.56184304",
"0.5604083",
"0.5603666",
"0.5567094",
"0.5516933",
"0.5489178",
"0.548268",
"0.548268",
"0.548268",
"0.548268",
"0.5482236",
"0.5480144",
"0.547103",
"0.54695624",
"0.5462931",
"0.5... | 0.626948 | 1 |
Exercise a choice on a contract identified by its contract ID. | def exercise(
self,
__contract_id,
__choice_name,
__argument,
*,
workflow_id=None,
command_id=None,
read_as=None,
act_as=None,
):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose(self, choice):\n if self.available(choice):\n self.select(choice)",
"def _Answer(questionId, choice):\n\n self.assertEqual(questionId, self.vmQuestion.runtime.question.id,\n '_Answer got questionId == \"%s\"' % questionId +\n ... | [
"0.5909464",
"0.58261186",
"0.5734502",
"0.5574911",
"0.55023646",
"0.5500195",
"0.5481747",
"0.5479912",
"0.5430886",
"0.54132265",
"0.5404205",
"0.5392914",
"0.53866935",
"0.5341044",
"0.53362083",
"0.5322413",
"0.531496",
"0.5302565",
"0.52872443",
"0.52562076",
"0.5251627... | 0.6547571 | 0 |
Archive a choice on a contract identified by its contract ID. | def archive(
self,
__contract_id,
*,
workflow_id=None,
command_id=None,
read_as=None,
act_as=None,
):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self, cr, uid, id, default=None, context=None):\n if default is None:\n default = {}\n if context is None:\n context = {}\n default.update({\n 'name': self.pool.get('ir.sequence').get(cr, uid, 'services.contracts.archive'),\n \n })\n ... | [
"0.5373664",
"0.5326765",
"0.5324196",
"0.5267254",
"0.5185591",
"0.49727675",
"0.4942948",
"0.49278527",
"0.46802637",
"0.46598157",
"0.4659047",
"0.46433893",
"0.46025074",
"0.45979676",
"0.4586326",
"0.4575588",
"0.45753622",
"0.45585194",
"0.45350742",
"0.4533718",
"0.451... | 0.6624 | 0 |
List all existing users. | def list_users(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_users():\n\n users = crud.get_users()\n\n return render_template('all_users.html', users=users)",
"def list_users():\n check_admin()\n results = User.query.order_by(-User.id)\n return render_template('user_list.html', users=results)",
"def list_users(self):\n return self.get_admin... | [
"0.80981964",
"0.80645543",
"0.8025107",
"0.8014082",
"0.80049413",
"0.7992539",
"0.7988481",
"0.7875423",
"0.7872784",
"0.7866806",
"0.78332657",
"0.78332657",
"0.78332657",
"0.78332657",
"0.78332657",
"0.78332657",
"0.7822958",
"0.77924705",
"0.7791774",
"0.7776591",
"0.771... | 0.81106097 | 0 |
Allocate a new party. This method requires that the connection be created with ``admin=true``, or a token that contains an ``admin=true`` claim. | def allocate_party(self, *, identifier_hint=None, display_name=None):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def connect(self):\n request = stun.Message(message_method=stun.Method.ALLOCATE,\n message_class=stun.Class.REQUEST)\n request.attributes['LIFETIME'] = self.lifetime\n request.attributes['REQUESTED-TRANSPORT'] = 0x11000000\n\n try:\n respon... | [
"0.60664934",
"0.585542",
"0.57943094",
"0.5717729",
"0.54857254",
"0.5376112",
"0.5320097",
"0.53065187",
"0.5291629",
"0.52910084",
"0.5277893",
"0.5257278",
"0.52095205",
"0.51774466",
"0.5044071",
"0.503644",
"0.4979813",
"0.4967158",
"0.4954761",
"0.49205396",
"0.4909792... | 0.62972397 | 0 |
Retrieve a metering report. | def get_metering_report(self, from_, to=None, application_id=None):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request(self, **kwargs):\n if not hasattr(self, kwargs['report']):\n raise AttributeError(f'Report {kwargs[\"report\"]} not exist')\n report_name = kwargs.pop('report')\n return getattr(self, report_name)(**kwargs)",
"def fetch(self, limit=0, offset=0, report_type=\"\"):\n ... | [
"0.6597813",
"0.630198",
"0.623186",
"0.62237763",
"0.61662734",
"0.6165879",
"0.61537915",
"0.61305636",
"0.6127537",
"0.6058018",
"0.60577226",
"0.6053767",
"0.6031755",
"0.6022046",
"0.60194963",
"0.6005892",
"0.59870195",
"0.59498644",
"0.59314066",
"0.5918785",
"0.589190... | 0.70391953 | 0 |
Return the method resolution order of a class. This is a helper function that returns the method resolution order of a class. It is used by Microdot to find the best error handler to invoke for the raised exception. In CPython, this function returns the ``__mro__`` attribute of the class. In MicroPython, this function ... | def mro(cls): # pragma: no cover
if hasattr(cls, 'mro'):
return cls.__mro__
def _mro(cls):
m = [cls]
for base in cls.__bases__:
m += _mro(base)
return m
mro_list = _mro(cls)
# If a class appears multiple times (due to multiple inheritance) remove
# all... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ascend_mro(cls):\n if not inspect.isclass(cls):\n cls = cls.__class__\n mro = type.mro(cls)\n return mro",
"def getmethodclass(m):\n\n # Callable objects: return their own class.\n if (not hasattr(m, '__name__') and hasattr(m, '__class__') and\n hasattr(m, '__call__')):\n if isinsta... | [
"0.55598754",
"0.5345881",
"0.52941066",
"0.52751136",
"0.5244676",
"0.5164598",
"0.5153065",
"0.5127351",
"0.5125589",
"0.50652593",
"0.50588655",
"0.50420904",
"0.49888206",
"0.4984516",
"0.4921321",
"0.48939714",
"0.48844427",
"0.47613055",
"0.4746692",
"0.47332576",
"0.47... | 0.54487604 | 1 |
The parsed form submission body, as a | def form(self):
if self._form is None:
if self.content_type is None:
return None
mime_type = self.content_type.split(';')[0]
if mime_type != 'application/x-www-form-urlencoded':
return None
self._form = self._parse_urlencoded(self.b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def body(self):\n\n if 'request.body' in self:\n return self['request.body']\n\n else:\n self['request.body'] = self.read_request_body()\n return self['request.body']",
"async def read_parse_form_data(self):\n # TODO: Probably there is better solution how to ... | [
"0.67119783",
"0.65598774",
"0.6539312",
"0.6468889",
"0.6414824",
"0.63136953",
"0.6303863",
"0.62881345",
"0.6282559",
"0.6269712",
"0.6225637",
"0.62143856",
"0.6160001",
"0.6152666",
"0.6152666",
"0.6124522",
"0.6107054",
"0.6090933",
"0.6088297",
"0.6088297",
"0.6052718"... | 0.6974464 | 0 |
Register a requestspecific function to run after the request is handled. Requestspecific after request handlers run at the very end, after the application's own after request handlers. The function must take two arguments, the request and response objects. The return value of the function must be the updated response o... | def after_request(self, f):
self.after_request_handlers.append(f)
return f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_request_handle(self, func):\n self.after_request.append(func)\n return func",
"def after_request(self, f):\n self.after_request_funcs.append(f)\n return f",
"def after_request(self, func: typing.Callable):\n return self.add_hook(type_=\"post\", hook=func)",
"def b... | [
"0.80925375",
"0.75040066",
"0.71636343",
"0.6808765",
"0.6315511",
"0.6213739",
"0.62055516",
"0.6154878",
"0.5974813",
"0.5971836",
"0.5949403",
"0.5915641",
"0.57664365",
"0.57474244",
"0.572584",
"0.57017833",
"0.5678802",
"0.5664648",
"0.56407416",
"0.55845493",
"0.55745... | 0.76208955 | 1 |
Decorator that is used to register a function as a ``PUT`` request handler for a given URL. | def put(self, url_pattern):
return self.route(url_pattern, methods=['PUT']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PUT(url, mime_type='text/html'):\n def_app = DefaultHttpRequestHandler()\n return def_app.RequestMap(url, methods=['PUT'], produces=mime_type)",
"def _put(self, url, **kwargs):\n return self._call('PUT', url, kwargs)",
"def put(path, *params, **kwparams):\n def method(f):\n return co... | [
"0.70415163",
"0.7040791",
"0.6934701",
"0.68630487",
"0.6663218",
"0.6656668",
"0.6616704",
"0.6491086",
"0.63796943",
"0.63272226",
"0.63009584",
"0.6251108",
"0.62466264",
"0.6237601",
"0.6173316",
"0.6155613",
"0.6083235",
"0.604405",
"0.6032566",
"0.6032491",
"0.60016954... | 0.7210403 | 0 |
Decorator that is used to register a function as a ``PATCH`` request handler for a given URL. | def patch(self, url_pattern):
return self.route(url_pattern, methods=['PATCH']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch(self, pattern, handler):\n return self.route(PATCH, pattern, handler)",
"def patch(url, data=None, **kwargs):\n\n return request('patch', url, data=data, **kwargs)",
"def patched_request(urlpath):\n def inner(f):\n def wrapped(self, *args, **kwargs):\n cookies = self.cl... | [
"0.64774215",
"0.64569557",
"0.6379666",
"0.6267415",
"0.6244529",
"0.61835325",
"0.61429286",
"0.60852486",
"0.6083073",
"0.5966932",
"0.59632117",
"0.58392936",
"0.582967",
"0.5825828",
"0.57768136",
"0.57505405",
"0.5736299",
"0.57226765",
"0.5700141",
"0.5658015",
"0.5648... | 0.68318826 | 0 |
Decorator to register a function to run after an error response is generated. The decorated function must take two arguments, the request and response objects. The return value of the function must be an updated response object. The handler is invoked for error responses generated by Microdot, as well as those returned... | def after_error_request(self, f):
self.after_error_request_handlers.append(f)
return f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_handler(func):\n def handle_caller():\n try:\n response, headers = func()\n if not isinstance(response, dict):\n raise ValueError(\n \"Call function %s (method %s) returned non-dict\"\n % (func.methods_to_viewfunc.get(re... | [
"0.69318444",
"0.68357384",
"0.6749913",
"0.6637534",
"0.6632007",
"0.66023004",
"0.6562973",
"0.65165573",
"0.6503986",
"0.6422893",
"0.64151907",
"0.63882715",
"0.6312583",
"0.62664",
"0.6223201",
"0.6197041",
"0.6194712",
"0.618327",
"0.61256194",
"0.6114041",
"0.6110268",... | 0.7190238 | 0 |
Decorator to register a function as an error handler. Error handler functions for numeric HTTP status codes must accept a single argument, the request object. Error handler functions for Python exceptions must accept two arguments, the request object and the exception object. | def errorhandler(self, status_code_or_exception_class):
def decorated(f):
self.error_handlers[status_code_or_exception_class] = f
return f
return decorated | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_error_handler(app):\n def errorhandler(error):\n response = error.to_json()\n response.status_code = error.status_code\n print(response.status_code)\n return response\n\n app.errorhandler(ExceptionHandler)(errorhandler)",
"def error_handler(func):\n def handle_ca... | [
"0.7104267",
"0.705982",
"0.70450544",
"0.70396096",
"0.69537294",
"0.694501",
"0.6908718",
"0.6867559",
"0.6843429",
"0.6796218",
"0.6774907",
"0.676121",
"0.67425674",
"0.66827863",
"0.6532456",
"0.65028566",
"0.6443002",
"0.6436772",
"0.6373276",
"0.6354201",
"0.6348197",
... | 0.7910496 | 0 |
Mount a subapplication, optionally under the given URL prefix. | def mount(self, subapp, url_prefix=''):
for methods, pattern, handler in subapp.url_map:
self.url_map.append(
(methods, URLPattern(url_prefix + pattern.url_pattern),
handler))
for handler in subapp.before_request_handlers:
self.before_request_hand... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, environ, start_response):\n if environ['PATH_INFO'].startswith(self.prefix):\n environ['PATH_INFO'] = environ['PATH_INFO'][len(self.prefix):]\n environ['SCRIPT_NAME'] = self.prefix\n return self.app(environ, start_response)\n else:\n star... | [
"0.6577382",
"0.65587366",
"0.56430376",
"0.5397363",
"0.53771305",
"0.5332551",
"0.51074326",
"0.50820076",
"0.5062987",
"0.50439113",
"0.5037803",
"0.50116587",
"0.5011364",
"0.49150854",
"0.49003822",
"0.48995587",
"0.4888713",
"0.4849157",
"0.48152724",
"0.48125216",
"0.4... | 0.7295566 | 0 |
Abort the current request and return an error response with the given status code. | def abort(status_code, reason=None):
raise HTTPException(status_code, reason) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def abort(code=500, text='Unknown Error: Application stopped.'):\r\n raise HTTPError(code, text)",
"def abort(self, status, message):\n self.abort_status = status\n self.abort_message = message\n raise Exception() # Just like original context",
"def abortify(app, code=500, text=\"Unkno... | [
"0.74483114",
"0.69010496",
"0.67767173",
"0.64303935",
"0.6402307",
"0.63961095",
"0.62271506",
"0.6211101",
"0.60999316",
"0.6042293",
"0.602101",
"0.5962243",
"0.59486115",
"0.5919316",
"0.58756685",
"0.5831655",
"0.5819187",
"0.5783905",
"0.57552415",
"0.5733917",
"0.5722... | 0.80517876 | 0 |
Estimate the maximum correlation of any ROI in _scene_ to the unscaled _feature_. | def calculate_frame_confidence(self, scene, feature, rois):
scaled_feature = cv2.resize(
feature, (0, 0), fx=self.view.scale, fy=self.view.scale
)
scaled_feature = cv2.Laplacian(scaled_feature, cv2.CV_8U)
percent_corrs = []
for roi in rois:
if roi is not... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def corrf(self, refimg_fea, targetimg_fea, maxdisp, fac=1):\n b, c, height, width = refimg_fea.shape\n if refimg_fea.is_cuda:\n cost = Variable(\n torch.cuda.FloatTensor(b, c, 2 * maxdisp + 1, 2 * int(maxdisp // fac) + 1, height, width)).fill_(\n 0.) # b,c,u,... | [
"0.5468452",
"0.53973424",
"0.50929636",
"0.5064636",
"0.49564397",
"0.49539375",
"0.49536982",
"0.49180138",
"0.4839602",
"0.482461",
"0.48203814",
"0.48177767",
"0.479656",
"0.47921994",
"0.47857365",
"0.47499976",
"0.4739262",
"0.47115904",
"0.4704665",
"0.46990857",
"0.46... | 0.60823494 | 0 |
Find the time index of a match segment boundary (start or end) near _time_, accurate to within _tolerance_ seconds. Uses the bisection method to find an approximate solution for f(t) = conf_at(t) self.threshold = 0. | def find_segment_boundary(self, time, tolerance):
threshold = self.get_threshold()
def conf_at(time):
scene = self.stream.get_frame(time)
if scene is not None:
conf = self.calculate_frame_confidence(
scene, PERCENT, self.view.ports
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bisect(self, dtime, b=0): # pylint: disable=invalid-name\n return self._collection.bisect(dtime, b)",
"def find_start_index():\n def recursive_find_index(lower_bound, upper_bound):\n if upper_bound - lower_bound <= 1:\n if intervals[upper_bound... | [
"0.5377704",
"0.53541327",
"0.53184265",
"0.5317281",
"0.5311943",
"0.5195018",
"0.5074439",
"0.5073081",
"0.50678974",
"0.504804",
"0.50347793",
"0.50212705",
"0.500662",
"0.49575242",
"0.49484062",
"0.49464294",
"0.4933454",
"0.49152228",
"0.49141937",
"0.49114174",
"0.4907... | 0.7794025 | 0 |
Returns a copy of source_dict, updated with the new keyvalue pairs in diffs. | def copy_dict(source_dict, diffs):
result = dict(source_dict)
result.update(diffs)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extend_dict(source_dict, diff=None, deep=False):\n if deep:\n new_dict = deepcopy(source_dict)\n else:\n new_dict = copy(source_dict)\n\n if diff:\n new_dict.update(diff)\n return new_dict",
"def _merge_sources(dest: Dict[str, Any], source: ConfigSource) -> Dict[str, Any]:\n ... | [
"0.71756923",
"0.64150095",
"0.6306634",
"0.61946076",
"0.61865973",
"0.6070891",
"0.600583",
"0.5980258",
"0.5975859",
"0.59716463",
"0.59605694",
"0.58847195",
"0.5873863",
"0.5784325",
"0.5763397",
"0.5756359",
"0.5710987",
"0.56717694",
"0.5655682",
"0.5609655",
"0.560115... | 0.816688 | 0 |
Takes a formula and a set of atoms (that do not necessarily appear in the formula), and returns a set of models of the formula, where each model is represented by a dictionary that maps each atom to a Boolean value, where atoms are drawn from the set of atoms that appear in ``formula`` and the set of atoms represented ... | def models_with_all_atoms(formula, atoms):
if formula == True:
return [model for model in tablize(atoms)]
original_models = [model for model in satisfiable(formula, all_models=True)]
extra_atoms = atoms - formula.atoms()
if not extra_atoms:
return original_models
else:
mode... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def truth_values(formula: Formula, models: Iterable[Model]) -> Iterable[bool]:\r\n # Task 2.3\r\n # all_models_local = all_models(list(formula.variables()))\r\n to_return = list()\r\n for l_model in models:\r\n to_return.append(evaluate(formula, l_model))\r\n return to_return",
"def truth_v... | [
"0.6231055",
"0.61913365",
"0.6105409",
"0.60890245",
"0.5991903",
"0.59173256",
"0.54118824",
"0.5358695",
"0.5334758",
"0.5264302",
"0.52000153",
"0.5052022",
"0.50512755",
"0.5039385",
"0.5019679",
"0.50089824",
"0.48878434",
"0.48770222",
"0.48583898",
"0.48507598",
"0.48... | 0.76160675 | 0 |
Converts a model from a dictionary representation to a set representation. Given a ``model`` represented by a dictionary mapping atoms to Boolean values, this function returns the set of atoms that are mapped to ``True`` in the dictionary. Paramters | def model_set(model):
return set([atom for atom in model if model[atom] == True]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mset(self, kvs: Mapping[K, V]) -> List[bool]:\n raise NotImplementedError('mset must be reimplemented in concrete implementation')",
"def truth_values(formula: Formula, models: Iterable[Model]) -> Iterable[bool]:\r\n # Task 2.3\r\n # all_models_local = all_models(list(formula.variables()))\r\n ... | [
"0.5403658",
"0.5058126",
"0.4966774",
"0.49404937",
"0.4921063",
"0.48980522",
"0.47910836",
"0.476906",
"0.47453827",
"0.47427893",
"0.47330308",
"0.47066554",
"0.46962583",
"0.4680119",
"0.4657873",
"0.46518394",
"0.4619476",
"0.46179077",
"0.45870307",
"0.45768023",
"0.45... | 0.8118031 | 0 |
Computes the symmetric difference of sets ``a`` and ``b``. | def symmetric_diff(a,b):
return a ^ b | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symmetricDifference(stack):\n assertArity(stack, 2)\n rhs, lhs = stack.pop(), stack.pop()\n assertType(lhs, Set)\n assertType(rhs, Set)\n return Set(lhs ^ rhs)",
"def set_difference(set_a, set_b):\n \n diff = set_b - set_a\n \n return diff",
"def difference(a, b):\r\n return list... | [
"0.7312908",
"0.72336715",
"0.70659167",
"0.70105547",
"0.6810427",
"0.6511473",
"0.65003294",
"0.6439229",
"0.6338102",
"0.6300634",
"0.6293343",
"0.62888217",
"0.6282021",
"0.6249131",
"0.619077",
"0.6190273",
"0.60954916",
"0.6062466",
"0.6060257",
"0.6045366",
"0.6016287"... | 0.7276503 | 1 |
Returns a list of nodes that have different formulas in graphs S and T. | def find_diff_nodes(S,T):
diff_nodes = []
for node in S:
s_formula = S.formula_conj(node)
t_formula = T.formula_conj(node)
if s_formula != t_formula:
diff_nodes.append(node)
return diff_nodes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nodes_repeated_formulas(proof_graph):\n level = 0\n repeated_formulas = {}\n nodes_level = proof_graph.get_nodes_level()\n for level, nodes in nodes_level.items():\n repeated_formulas[level] = []\n nodes_formula = {}\n for node in nodes:\n formula = proof_graph.g... | [
"0.6130903",
"0.5951822",
"0.5615369",
"0.55068696",
"0.5347638",
"0.5273744",
"0.5220002",
"0.5210907",
"0.5168683",
"0.5162859",
"0.5133877",
"0.5115681",
"0.50824875",
"0.50458014",
"0.5025736",
"0.50229836",
"0.50124246",
"0.50097686",
"0.50008786",
"0.49804062",
"0.49749... | 0.73081934 | 0 |
Creeate all the layers of the discriminator and pass the data through to return the logits | def build_discriminator(self):
with tf.variable_scope("discriminator") as scope:
# --- build the convolutional layers
self.d_convlayers = list()
mi = self.num_colors
dim = self.img_dim
count = 0
for mo, filter_size, stride, apply_batch_nor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_discriminator():\n\n #Slope and weight initializer are chosen to match parmeters in the paper\n weight_initializer = tf.keras.initializers.RandomNormal(stddev=0.02)\n slope = 0.2\n inputs = keras.Input(shape=(64,64,3))\n x = preprocessing.Rescaling(scale=1./127.5, offset=-1.)(inputs)\n\n ... | [
"0.7137716",
"0.68968344",
"0.6878221",
"0.6835045",
"0.6785011",
"0.6780507",
"0.6760468",
"0.6740854",
"0.6736071",
"0.67317444",
"0.66882855",
"0.6571358",
"0.6562134",
"0.65493655",
"0.6426375",
"0.6424817",
"0.6422969",
"0.6399334",
"0.63874745",
"0.6377929",
"0.637574",... | 0.73796755 | 0 |
Testing the evaluation warning. | def test_evaluation_warning():
folding = Folding(DATASET,
reset=True)
smote_variants.config.suppress_internal_warnings(False)
for fold in folding.fold():
sjob = SamplingJob(fold,
OVERSAMPLER,
OVERSAMPLER_PARAMS)
result = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_runtime_warnings(self):\n\t\tprint(\"test runtime warning: sqrt(-1)=\", np.sqrt(-1.0))\n\t\tassert(True)",
"def test_warning(self):\n self.p.compute_termination_criteria = True\n self.set_parameter_and_step(\"max_iter\", True, 5, \"ignore\")",
"def eval_warnings(self):\n\n # Ensur... | [
"0.70464563",
"0.6789823",
"0.66387427",
"0.6633873",
"0.6546751",
"0.64080334",
"0.6353826",
"0.6338319",
"0.6326757",
"0.6200878",
"0.61668783",
"0.61667156",
"0.61558366",
"0.6118739",
"0.60978484",
"0.60978484",
"0.60978484",
"0.60978484",
"0.60978484",
"0.60978484",
"0.6... | 0.73529434 | 0 |
Testing the sampling of a cached folding. | def test_sampling_cached_folding():
shutil.rmtree(CACHE_PATH, ignore_errors=True)
folding = Folding(DATASET,
cache_path=CACHE_PATH,
reset=True)
oversampler = 'SMOTE'
oversampler_params = {}
for fold in folding.folding_files():
sjob = SamplingJob(fold... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sampling_no_caching():\n folding = Folding(DATASET,\n reset=True)\n oversampler = 'SMOTE'\n oversampler_params = {}\n\n for fold in folding.fold():\n sjob = SamplingJob(fold,\n oversampler,\n oversampler_params)\n\n ... | [
"0.6796683",
"0.59314656",
"0.5675805",
"0.56290734",
"0.56118405",
"0.55508626",
"0.5549305",
"0.5492429",
"0.5483185",
"0.5451302",
"0.54304993",
"0.53862286",
"0.53766567",
"0.534435",
"0.53215796",
"0.531871",
"0.5314264",
"0.5303718",
"0.5303154",
"0.52706116",
"0.525229... | 0.77682436 | 0 |
Testing sampling with no caching. | def test_sampling_no_caching():
folding = Folding(DATASET,
reset=True)
oversampler = 'SMOTE'
oversampler_params = {}
for fold in folding.fold():
sjob = SamplingJob(fold,
oversampler,
oversampler_params)
result = sjob.d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sampling1 ():\n cpus = list(range(C.N_PARALLEL))\n affinity = dict(cuda_idx=C.CUDA_IDX, workers_cpus=cpus)\n agent_ = findOptimalAgent(reward=None)\n agent = CategoricalPgAgent(AcrobotNet, \n initial_model_state_dict=agent_.state_dict())\n s0 = np.array([1, 0, 1/np.sqrt(2), 1/... | [
"0.69445354",
"0.6910612",
"0.68195087",
"0.66835654",
"0.6659194",
"0.66209507",
"0.66209507",
"0.65721816",
"0.64831334",
"0.6454222",
"0.6447753",
"0.64418006",
"0.64253753",
"0.63707554",
"0.63564646",
"0.63562113",
"0.63562113",
"0.63562113",
"0.63562113",
"0.63537365",
... | 0.7139382 | 0 |
Test the get_params function. | def test_get_params():
ejob = EvaluationJob({},
CLASSIFIERS,
cache_path=CACHE_PATH)
assert len(ejob.get_params()) > 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_params(self):",
"def test_get_parameter_processing(self):\n self._register_uri(httpretty.GET)\n photo = trovebox.objects.photo.Photo(None, {\"id\": \"photo_id\"})\n album = trovebox.objects.album.Album(None, {\"id\": \"album_id\"})\n tag = trovebox.objects.tag.Tag(None, {\"id\... | [
"0.74293447",
"0.73741364",
"0.7364429",
"0.7355852",
"0.73138356",
"0.7187823",
"0.7068114",
"0.70407087",
"0.6983017",
"0.6865281",
"0.6819726",
"0.6814677",
"0.67116445",
"0.67070705",
"0.6682827",
"0.66793627",
"0.6675571",
"0.6658886",
"0.6656839",
"0.6638013",
"0.662299... | 0.75295115 | 0 |
Set parameter to be updated on next refresh. | def update_parameter(self, param, val, force=False):
self._update_dict[param] = val
if force:
self._cur_val[param] = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setParam(self,param,value):\n if param in self.params.keys():\n self.params[param] = value",
"def update_param(self, update_param):\n\n self._update_param = update_param",
"def setParameter(self, name, value):",
"def set_parameter_value(self, parameter, value):\n pass",
... | [
"0.7196291",
"0.71410686",
"0.7029949",
"0.7018598",
"0.70086557",
"0.6989109",
"0.6725654",
"0.66086185",
"0.66047776",
"0.6575276",
"0.6568009",
"0.6562167",
"0.65552574",
"0.65532875",
"0.65109634",
"0.6478439",
"0.6473853",
"0.6439176",
"0.6431167",
"0.64106256",
"0.64097... | 0.7156386 | 1 |
Set username for this ConnectionParams.Builder | def username(self, username):
self._username = username
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_username(self, value):\n self.username = value",
"def username(self, username: str):\n\n self._username = username",
"def username(self, username) :\n\t\ttry :\n\t\t\tself._username = username\n\t\texcept Exception as e:\n\t\t\traise e",
"def username(self, username):\n\n self._u... | [
"0.69477564",
"0.6898007",
"0.6870225",
"0.67377764",
"0.67377764",
"0.67377764",
"0.67377764",
"0.67377764",
"0.67377764",
"0.67377764",
"0.67377764",
"0.67377764",
"0.67174953",
"0.6716314",
"0.6668254",
"0.6557477",
"0.6491731",
"0.64303696",
"0.6254873",
"0.59398717",
"0.... | 0.69286305 | 1 |
Set ip for this ConnectionParams.Builder | def ip(self, ip):
self._ip = ip
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_ip(self, ip: str, host_addr: str) -> None:\n self.config[\"linkIp\"] = ip\n self.config[\"ngapIp\"] = ip\n self.config[\"gtpIp\"] = ip",
"def ip(self, ip: str):\n\n self._ip = ip",
"def ip(self, ip):\n\n self._ip = ip",
"def ip(self, ip):\n\n self._ip = ip",
... | [
"0.7653571",
"0.7268464",
"0.71183467",
"0.71183467",
"0.7078478",
"0.684115",
"0.68255967",
"0.65730906",
"0.65730906",
"0.6492071",
"0.64018714",
"0.63779247",
"0.63779247",
"0.63779247",
"0.63104355",
"0.6216685",
"0.6155088",
"0.61399996",
"0.6114473",
"0.60862315",
"0.60... | 0.74469644 | 1 |
Set hostname for this ConnectionParams.Builder | def hostname(self, hostname):
self._hostname = hostname
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_hostname(self, hostname):\n raise NotImplementedError()",
"def hostname(self, hostname):\n\n self._hostname = hostname",
"def hostname(self, hostname):\n\n self._hostname = hostname",
"def host(self, host: str):\n\n self._host = host",
"def host_name(self, host_name):\n\... | [
"0.7587153",
"0.7470589",
"0.7470589",
"0.6685926",
"0.6577746",
"0.6577746",
"0.6577266",
"0.65609527",
"0.655843",
"0.65481156",
"0.65371454",
"0.6527284",
"0.65215445",
"0.65215445",
"0.65215445",
"0.65215445",
"0.63492376",
"0.63074416",
"0.62974584",
"0.6277756",
"0.6277... | 0.7783883 | 0 |
Set public key (used in SSH connections) for this ConnectionParams.Builder | def public_key(self, public_key):
self._public_key = public_key
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_key(self, public_key):\n\n self._public_key = public_key",
"def __init__(self, public_key=None):\n self.public_key = self.convert_public_key_to_ecdsa(public_key) if public_key else public_key",
"def __init__(__self__, *,\n public_keys: pulumi.Input[Sequence[pulumi.Input... | [
"0.72115606",
"0.6647799",
"0.66361755",
"0.65658844",
"0.64768475",
"0.6417709",
"0.63966715",
"0.6229489",
"0.6219649",
"0.6205448",
"0.6172644",
"0.61412466",
"0.61112964",
"0.60900635",
"0.608558",
"0.60663295",
"0.60455406",
"0.6042779",
"0.6021624",
"0.60194415",
"0.600... | 0.7345211 | 0 |
Set baudrate (used in serial connections) for this ConnectionParams.Builder | def baudrate(self, baudrate):
self._baudrate = baudrate
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_baud_rate(self, baud_rate=115200):\n self._log_msg_start(f\"Setting baudrate to {baud_rate} bps\")\n self._ubx.send(\"CFG-PRT\", baudRate=baud_rate)\n self._close_device()",
"def __init__(self, port, baudrate):\n return",
"def baudrate_cmd(self, baudrate):\r\n if baud... | [
"0.7545729",
"0.65128815",
"0.64628726",
"0.6461636",
"0.64534026",
"0.62416404",
"0.61964583",
"0.6099569",
"0.6020234",
"0.5976602",
"0.58991754",
"0.58631307",
"0.583419",
"0.5821075",
"0.5762481",
"0.5748556",
"0.5657696",
"0.55712175",
"0.5566267",
"0.5528345",
"0.552820... | 0.78621507 | 0 |
Set serial device (used in serial connections) for this ConnectionParams.Builder | def serial_dev(self, serial_dev):
self._serial_dev = serial_dev
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _SetDeviceSerial(self, device_serial):\n self._device_address = (\"127.0.0.1:%s\" % self._adb_port if\n self._adb_port else \"\")\n self._device_serial = (device_serial if device_serial else\n self._device_address)",
"def set_serial(s... | [
"0.78610384",
"0.7396258",
"0.69601756",
"0.6592349",
"0.6473133",
"0.6462555",
"0.62612796",
"0.6253815",
"0.6251454",
"0.62428033",
"0.6175611",
"0.61707854",
"0.610889",
"0.61053956",
"0.6042725",
"0.6004655",
"0.59726554",
"0.59647393",
"0.5957133",
"0.5947981",
"0.589948... | 0.75075537 | 1 |
Set log_file_path for this ConnectionParams.Builder. | def log_file_path(self, log_file_path):
self._log_file_path = log_file_path
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setLogFile(self, logfile):\n self.log(\"Log set to: \" + logfile)\n self.logfile = logfile",
"def setPath(logPath):\n GlobalLogger.logger.close()\n GlobalLogger.logger = FileLogger(logPath)",
"def set_log_file(filename):\n pass",
"def set_log_file(filepath):\n paramiko.u... | [
"0.6670603",
"0.66163194",
"0.6557119",
"0.6466353",
"0.6432745",
"0.6407817",
"0.63724566",
"0.63659227",
"0.6168891",
"0.5966789",
"0.5963065",
"0.59349877",
"0.5881307",
"0.58745915",
"0.58319294",
"0.5826963",
"0.57529885",
"0.5746189",
"0.5716357",
"0.5659038",
"0.564467... | 0.7678871 | 0 |
Set pssh for this ConnectionParams.Builder. | def pssh(self, pssh):
self._pssh = pssh
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hpkp(self, hpkp):\n\n self._hpkp = hpkp",
"def _init_ssh_options(self) -> asyncssh.SSHClientConnectionOptions:\n options = asyncssh.SSHClientConnectionOptions(\n login_timeout=self.connect_timeout,\n username=self.username,\n agent_identities=self.pvtkey if self... | [
"0.55352694",
"0.5502825",
"0.5493793",
"0.5392353",
"0.5289325",
"0.527694",
"0.52678764",
"0.5209869",
"0.5178735",
"0.50798965",
"0.50484097",
"0.50364953",
"0.5035972",
"0.50217456",
"0.5011508",
"0.4994038",
"0.49867058",
"0.49206",
"0.49058962",
"0.49035868",
"0.4887604... | 0.8202454 | 0 |
Set aws_region for this ConnectionParams.Builder. | def aws_region(self, aws_region):
self._aws_region = aws_region
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def region(self, region):\n \n self._region = region",
"def region(self, region):\n\n self._region = region",
"def region(self, region):\n\n self._region = region",
"def region(self, region):\n\n self._region = region",
"def vpc_region(self) -> Optional[pulumi.Input[str]]... | [
"0.606084",
"0.59297305",
"0.59297305",
"0.59297305",
"0.5909032",
"0.5909032",
"0.5797179",
"0.57693416",
"0.5750321",
"0.5710382",
"0.57043797",
"0.56806797",
"0.5667119",
"0.5640637",
"0.56229335",
"0.56000876",
"0.5552613",
"0.54591423",
"0.5452551",
"0.5452274",
"0.54233... | 0.8107011 | 0 |
Set store_domain for this ConnectionParams.Builder. | def store_domain(self, store_domain):
self._store_domain = store_domain
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def domain(self, domain):\n self._domain = domain",
"def domain(self, domain):\n self._domain = domain",
"def domain(self, domain):\n\n self._domain = domain",
"def domain(self, domain):\n\n self._domain = domain",
"def set_store(self, store):\n self.store = store",
"de... | [
"0.5982223",
"0.5982223",
"0.5935323",
"0.5935323",
"0.5746205",
"0.5554445",
"0.5512305",
"0.5469114",
"0.538639",
"0.53064066",
"0.52760637",
"0.5180398",
"0.5166013",
"0.51162654",
"0.5096893",
"0.5095592",
"0.509208",
"0.5034343",
"0.5033187",
"0.49751824",
"0.4953182",
... | 0.7748373 | 0 |
Set store_type for this ConnectionParams.Builder. | def store_type(self, store_type):
self._store_type = store_type
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_store(self, store):\n self.store = store",
"def __init__(__self__, *,\n data_store_type: pulumi.Input[Union[str, 'DataStoreTypes']],\n object_type: pulumi.Input[str],\n resource_group_id: Optional[pulumi.Input[str]] = None):\n pulumi.set(__sel... | [
"0.6590411",
"0.60840034",
"0.60840034",
"0.6031117",
"0.5917283",
"0.5909269",
"0.57748413",
"0.5671474",
"0.5431813",
"0.5431813",
"0.5380842",
"0.5371841",
"0.53262705",
"0.5314249",
"0.5291545",
"0.5266711",
"0.52419436",
"0.52419436",
"0.52419436",
"0.5205786",
"0.515286... | 0.77237594 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.