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
Return whether a command has negatively controlled qubits.
def has_negative_control(cmd): return get_control_count(cmd) > 0 and '0' in cmd.control_state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_available(self, cmd):\n num_qubits = 0\n for qureg in cmd.all_qubits:\n num_qubits += len(qureg)\n return num_qubits <= 2", "def is_use_qps(self) -> bool:\n if self.qps > 0 and self.second > 0:\n return True\n else:\n return False", "de...
[ "0.6443017", "0.62384444", "0.6159438", "0.59778637", "0.59440106", "0.59436524", "0.5875699", "0.5865012", "0.5853049", "0.5851665", "0.58293706", "0.582807", "0.5757742", "0.5732011", "0.5711578", "0.56456465", "0.56133777", "0.5585858", "0.55658156", "0.55565083", "0.55423...
0.69478786
0
Creates a starboard. A starboard is a channel which has messages with some stars. To configure this starboard (such as max age and threshold, which are 7 days and 5 stars by default), use starconfig's subcommands. See the help for details.
async def starboard(self, ctx): if self.bot.db.execute("SELECT * FROM starboards WHERE guild_id = ?",(ctx.guild.id,)).fetchone(): return await ctx.say("star.already") async with ctx.typing(): await ctx.channel.edit( topic=TOPIC.format(mention=self.bot.user.mention...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def add_starboard(self, ctx):\n channel = await ctx.get_text_channel(embed=CustomEmbeds.add(author=\"Channel\",\n description=\"Send a channel to add it to the starboard!\"))\n emotes = await ctx.get_emotes(embed=CustomEmbeds.ad...
[ "0.74559045", "0.6628303", "0.64687115", "0.6309718", "0.6219598", "0.59351027", "0.59275556", "0.586937", "0.5743689", "0.5702885", "0.56899554", "0.56740135", "0.558157", "0.5522696", "0.53798324", "0.53583425", "0.52350324", "0.5224017", "0.52115166", "0.52085984", "0.5154...
0.7119598
1
Enables a disabled starboard.
async def enable(self, ctx): self.bot.db.execute("UPDATE starboards SET enabled = 1 WHERE channel_id = ?", (ctx.channel.id,)) await ctx.say("star.enabled")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable(self):\r\n self.update(enabled=True)", "def enable(self):\n self.enabled = True", "def enable(self):\n self.enabled = True", "async def starboard_toggle(self, ctx, value: bool):\n await queries.update_setting(ctx, \"starboard_settings\", \"is_enabled\", value)\n ...
[ "0.69257647", "0.673253", "0.673253", "0.6605978", "0.65678227", "0.6538243", "0.64849865", "0.6334245", "0.6330517", "0.6330517", "0.63191867", "0.62614286", "0.6255469", "0.6149117", "0.6149117", "0.6149117", "0.6149117", "0.6149117", "0.6149117", "0.6149117", "0.6149117", ...
0.7405919
0
Sets "max age" for the starboard messages. If a message is older than the specified days, the message is ignored. Note that existing messages are not affected. Defaults to 7 (one week).
async def maxage(self, ctx, age: int): if age > 0: self.bot.db.execute("UPDATE starboards SET age = ? WHERE channel_id = ?", (age,ctx.channel.id)) await ctx.say("star.age", age) await self.set_topic(ctx.channel.id) else: await ctx.say("star.unsigned", age)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_age(self, max_age):\n self._max_age = max_age", "def max_age(self, max_age):\n\n self._max_age = max_age", "def max_age(self, max_age):\n if (max_age is not None and max_age < -1): # noqa: E501\n raise ValueError(\"Invalid value for `max_age`, must be a value greater th...
[ "0.6970839", "0.6911315", "0.61830574", "0.6088173", "0.60299325", "0.58305186", "0.58305186", "0.57887924", "0.56967527", "0.5692167", "0.5583454", "0.5548023", "0.5548023", "0.55217004", "0.54962564", "0.54864573", "0.5448077", "0.5405468", "0.5401819", "0.53459024", "0.530...
0.6915784
1
Sets "threshold" for the starboard messages. The specified number of stars are required to put the message on the starboard. Note that existing messages are not affected. Defaults to 5.
async def threshold(self, ctx, threshold: int): if threshold > 0: self.bot.db.execute("UPDATE starboards SET threshold = ? WHERE channel_id = ?", (threshold, ctx.channel.id)) await ctx.say("star.threshold", threshold) await self.set_topic(ctx.channel.id) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def set_star_thresh(self, ctx: commands.Context, thresh: int):\n self.check_if_exist(ctx.guild)\n\n self.starboard_guilds = self.starboard_info.find(\"guilds\")\n\n self.starboard_guilds[str(ctx.guild.id)][\"thresh\"] = thresh\n\n self.starboard_info.update(\"guilds\", self.starbo...
[ "0.71225744", "0.59684855", "0.5927058", "0.58108085", "0.576199", "0.57090366", "0.5671583", "0.5666817", "0.5666817", "0.5666817", "0.5666817", "0.5666817", "0.5508571", "0.5468851", "0.5445576", "0.5442838", "0.538356", "0.53599596", "0.5337971", "0.5335528", "0.5254369", ...
0.7315309
0
Shows a starboard item. The argument can be either original message ID or starboard item ID.
async def star_show(self, ctx, item: Star): board = self.bot.db.execute("SELECT * FROM starboards WHERE guild_id = ?", (ctx.guild.id,)).fetchone() try: board_msg = await self.bot.get_channel(board["channel_id"]).fetch_message(item["item_id"]) except discord.NotFound: retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(self, item_id):\n pass", "async def star_random(self, ctx):\n board = self.bot.db.execute(\"SELECT * FROM starboards WHERE guild_id = ?\", (ctx.guild.id,)).fetchone()\n item = self.bot.db.execute(\n \"SELECT item_id FROM starboard_items WHERE visible = 1 \" \\\n ...
[ "0.6767876", "0.62626845", "0.6151777", "0.6020385", "0.5975807", "0.58423346", "0.57976115", "0.5691685", "0.5685633", "0.5602847", "0.5571166", "0.5512835", "0.5495824", "0.54660666", "0.54644984", "0.54629415", "0.545546", "0.54352176", "0.541161", "0.541123", "0.54102796"...
0.8043702
0
Enables/disables DM when your message was stared. If the parameter is not given, this returns current status. Can be used anywhere including DM.
async def star_dm(self, ctx, enable: bool = None): if enable is None: result = self.bot.db.execute("SELECT starboard_dm FROM users WHERE user_id = ?", (ctx.author.id,)).fetchone() enabled = result["starboard_dm"] if result else 0 status_str = ctx._(f"star.dm{['Disabled', 'Ena...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def moderation(self, ctx):\n\n new_value = await self.toggle_dm_setting(ctx.author.id, \"ban_kick_mute\")\n\n if new_value:\n message = \":white_check_mark: You will now receive DMs when you get muted, kicked or banned by me.\"\n else:\n message = \":white_check_mar...
[ "0.64651364", "0.59721977", "0.5788894", "0.5637827", "0.559156", "0.55866206", "0.5582838", "0.5560499", "0.5545492", "0.5535075", "0.55287397", "0.5520025", "0.5509821", "0.5500232", "0.5459743", "0.54503405", "0.544722", "0.54312956", "0.5386221", "0.5380486", "0.53682333"...
0.6530001
0
Finds the postion that a value of weight "weight" would fall in the weight_list, where weight_list is sorted by smallest to largest. Newer inputs win in ties.
def find_pos(weight, weight_list): bool_list = [weight >= x for x in weight_list] pos = bool_list.count(True) - 1 return pos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getByWeight(list, w):\n itemId = 0\n partialWeight = list[0][1]\n while partialWeight < w:\n itemId += 1\n partialWeight += list[itemId][1]\n return list[itemId]", "def solve_brute_force(n: int, W: int, weight: List[int], value: List[int]) -> int:\n mapped_items = [{\"w\": w, \"v...
[ "0.7426046", "0.6773496", "0.6738176", "0.6716903", "0.67166317", "0.6681879", "0.6489452", "0.647155", "0.6244381", "0.6119967", "0.6119967", "0.6119967", "0.6103172", "0.5987175", "0.59611946", "0.5952065", "0.5946552", "0.594247", "0.59135944", "0.5880885", "0.5846692", ...
0.7051767
1
Adjusts top10 list in ascending order, by inserting a new item in appropriate place and adjusting others appropriately
def adjust_top10(value, pos, weight, top10, top10weights): # Create new top10 to be adjusted newtop10 = top10 newtop10weights = top10weights # Keep higher ones, shift lower ones left one newtop10[0:pos] = top10[1:pos + 1] newtop10weights[0:pos] = top10weights[1:pos + 1] # add new ones ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top10(self, top10: List[Word]):\n\n self._top10 = top10", "def move_top ( self ):\n list, index = self.get_info()\n self.value = [ list[index] ] + list[:index] + list[index+1:]", "def test_sorting(sort=selection_sort, num_items=20, max_value=50):\n # TODO: Repeat until all items ar...
[ "0.69200873", "0.61177766", "0.6019761", "0.5785143", "0.574743", "0.56948155", "0.5632971", "0.5610252", "0.5595934", "0.557611", "0.5559975", "0.5536772", "0.5520824", "0.5512247", "0.5477111", "0.54510283", "0.54510283", "0.54265624", "0.5416262", "0.5411289", "0.54062337"...
0.72702825
0
Calculates the correction factor for ambient air temperature and relative humidity Based on the linearization of the temperature dependency curve under and above 20 degrees Celsius, asuming a linear dependency on humidity,
def get_correction_factor(self, temperature, humidity): if temperature < 20: return self.CORA * temperature * temperature - self.CORB * temperature + self.CORC - (humidity - 33.) * self.CORD return self.CORE * temperature + self.CORF * humidity + self.CORG
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_corrected_resistance(self, temperature, humidity):\n return self.get_resistance()/ self.get_correction_factor(temperature, humidity)", "def get_corrected_resistance(self, temperature, humidity):\n return self.get_resistance()/ self.get_correction_factor(temperature, humidity)", "def corre...
[ "0.67288923", "0.67288923", "0.63658255", "0.6330217", "0.6249179", "0.61254853", "0.60804427", "0.591038", "0.5909975", "0.58495927", "0.58438057", "0.58438057", "0.57863986", "0.57804346", "0.5774944", "0.5772292", "0.5767601", "0.5738072", "0.5698512", "0.56778646", "0.564...
0.7517804
1
Returns the resistance of the sensor in kOhms // 1 if not value got in pin
def get_resistance(self): adc = ADC(self.pin) value = adc.read() if value == 0: return -1 return (4095./value - 1.) * self.RLOAD
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resistance(self):\n adc = ADC(self.pin)\n value = adc.read()\n if value == 0:\n return -1\n\n return (4095./value - 1.) * self.RLOAD # ESP32 maksimi, ESP8266:lle arvo on 1023", "def get_distance():\n \n GPIO.output(pinTrigger, False) # pulse off\n time.sle...
[ "0.7418249", "0.64756715", "0.63563746", "0.62588537", "0.6185685", "0.6180163", "0.61774236", "0.5992633", "0.59730357", "0.59586394", "0.5931926", "0.5876045", "0.58549595", "0.58542717", "0.5832019", "0.5829989", "0.58182263", "0.5806874", "0.5794576", "0.5794576", "0.5763...
0.71054703
1
Gets the resistance of the sensor corrected for temperature/humidity
def get_corrected_resistance(self, temperature, humidity): return self.get_resistance()/ self.get_correction_factor(temperature, humidity)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resistance(self):\n adc = ADC(self.pin)\n value = adc.read()\n if value == 0:\n return -1\n\n return (4095./value - 1.) * self.RLOAD # ESP32 maksimi, ESP8266:lle arvo on 1023", "def get_resistance(self):\n adc = ADC(self.pin)\n value = adc.read()\n ...
[ "0.7635503", "0.74764", "0.69839656", "0.68464166", "0.6839649", "0.67363864", "0.6672957", "0.663751", "0.65953994", "0.65851945", "0.6578019", "0.65570176", "0.65442514", "0.6527985", "0.64984643", "0.64984643", "0.6488228", "0.6481326", "0.6471587", "0.646373", "0.639092",...
0.7932213
1
Returns the resistance RZero of the sensor (in kOhms) for calibratioin purposes
def get_rzero(self): return self.get_resistance() * math.pow((self.ATMOCO2/self.PARA), (1./self.PARB))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_corrected_rzero(self, temperature, humidity):\n return self.get_corrected_resistance(temperature, humidity) * math.pow((self.ATMOCO2/self.PARA), (1./self.PARB))", "def get_corrected_rzero(self, temperature, humidity):\n return self.get_corrected_resistance(temperature, humidity) * math.pow(...
[ "0.75763285", "0.75763285", "0.72106373", "0.70308226", "0.6785906", "0.6573991", "0.6407301", "0.62468076", "0.61387134", "0.60672534", "0.6046186", "0.6046186", "0.59931934", "0.5981607", "0.5975342", "0.5957084", "0.59491", "0.59407234", "0.5909753", "0.58624816", "0.58089...
0.7964137
1
Returns the resistance RZero of the sensor (in kOhms) for calibration purposes corrected for temperature/humidity
def get_corrected_rzero(self, temperature, humidity): return self.get_corrected_resistance(temperature, humidity) * math.pow((self.ATMOCO2/self.PARA), (1./self.PARB))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rzero(self):\n return self.get_resistance() * math.pow((self.ATMOCO2/self.PARA), (1./self.PARB))", "def get_rzero(self):\n return self.get_resistance() * math.pow((self.ATMOCO2/self.PARA), (1./self.PARB))", "def get_resistance(self):\n adc = ADC(self.pin)\n value = adc.read(...
[ "0.7580876", "0.7580876", "0.6772141", "0.6595775", "0.627289", "0.627289", "0.6242239", "0.62241274", "0.5995406", "0.5957256", "0.59282094", "0.5875282", "0.58737624", "0.57592624", "0.5742674", "0.5665439", "0.56521314", "0.5646416", "0.5641885", "0.56370544", "0.56231505"...
0.78341985
1
Find and create a configuration for Boost. prefix Where to find sofiasip, should sofiasip/sip.h.
def __init__(self, prefix = None): # Compute the search path. if prefix is None: test = [Path('/usr'), Path('/usr/local')] else: test = [Path(prefix)] self.__prefix = self._search_all('include/sofia-sip-1.12/sofia-sip/sip.h', test)[0] self.__config = drake...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup():\n\tglobal config_parser, config_file\n\tglobal prefix\n\n\tif os.path.islink(sys.argv[0]):\n\t\tlink = os.readlink(sys.argv[0])\n\n\t\tif not os.path.isabs(link):\n\t\t\tlink = os.path.join(os.path.dirname(sys.argv[0]), link)\n\n\t\tprefix = os.path.dirname(os.path.abspath(link))\n\telse:\n\t\tprefix ...
[ "0.5301707", "0.52438116", "0.51499075", "0.5118139", "0.50677866", "0.5059345", "0.5040578", "0.50159454", "0.49063885", "0.48804155", "0.48284978", "0.4827175", "0.4806287", "0.4769773", "0.47503495", "0.47349274", "0.47349274", "0.47349274", "0.47349274", "0.4719681", "0.4...
0.67315805
0
Transliterate and clean username by removing any unsupported character
def clean_username(value): if NO_ASCII_REGEX.search(value): value = unidecode(value) value = NO_ASCII_REGEX.sub('', value) value = NO_SPECIAL_REGEX.sub('', value) return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_username(username):\n\n regex = compile(UnicodeUsernameValidator.regex)\n normalized_username = \"\"\n for char in username:\n if not regex.match(char):\n continue\n normalized_username += char\n return normalized_username", "def clean_username(self, username):\...
[ "0.8276948", "0.7640557", "0.748814", "0.7462814", "0.6971219", "0.6806881", "0.6668218", "0.6659604", "0.6582828", "0.6548192", "0.6532645", "0.65318185", "0.65207565", "0.6505552", "0.6473751", "0.64688873", "0.6456", "0.64483285", "0.64419836", "0.64402777", "0.6427039", ...
0.8559825
0
Replacement of ore.alchemist.container.stringKey The difference is that here the primary_key is not determined by sqlalchemy.orm.mapper.primary_key_from_instance(obj) but by doing the logically equivalent (but a little more laborious) [ getattr(instance, c.name) for c in mapper.primary_key ]. This is because, in some h...
def stringKey(obj): unproxied = proxy.removeSecurityProxy(obj) mapper = orm.object_mapper(unproxied) #primary_key = mapper.primary_key_from_instance(unproxied) identity_values = [ getattr(unproxied, c.name) for c in mapper.primary_key ] identity_key = "-".join(map(str, identity_values)) return "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key(self):\n def validate(name):\n '''Compute the key if necessary and validate'''\n found = getattr(self, name)\n value = found() if callable(found) else found\n if value is None:\n raise BadKeyError(\"The key for %s cannot be None\" % self)\n ...
[ "0.69380665", "0.67975974", "0.6636642", "0.6627335", "0.64218795", "0.6354907", "0.6309344", "0.62846273", "0.622991", "0.62281317", "0.61777174", "0.61190313", "0.6101327", "0.6091566", "0.6083226", "0.6061366", "0.6051213", "0.6004258", "0.5950747", "0.5949102", "0.5949088...
0.7004091
0
Updates the puzzle state based on the provided move string
def update_puzzle(self, move_string): zero_row, zero_col = self.current_position(0, 0) for direction in move_string: if direction == "l": assert zero_col > 0, "move off grid: " + direction self._grid[zero_row][zero_col] = self._grid[zero_row][zero_col - 1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_puzzle(self, move_string):\r\n zero_row, zero_col = self.current_position(0, 0)\r\n for direction in move_string:\r\n if direction == \"l\":\r\n assert zero_col > 0, \"move off grid: \" + direction\r\n self._grid[zero_row][zero_col] = self._grid[zer...
[ "0.8120185", "0.8120185", "0.8120185", "0.8101825", "0.8077781", "0.7200039", "0.70454454", "0.6661715", "0.6583404", "0.6582128", "0.65785265", "0.65703756", "0.6560121", "0.6289467", "0.6268087", "0.61335135", "0.61134064", "0.60638404", "0.605805", "0.6051816", "0.60436565...
0.81526875
1
Check whether the puzzle satisfies the row zero invariant at the given column (col > 1) Returns a boolean
def row0_invariant(self, target_col): result = True if self._grid[0][target_col] != 0: result = False if self._grid[1][target_col] != (target_col + self._width * 1): result = False for row in range(2, self._height): for col in range(self._width): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def row1_invariant(self, target_col):\r\n # replace with your code\r\n conditions = 0\r\n current = self._grid[1][target_col] == 0\r\n if current:\r\n conditions +=1\r\n else:\r\n # print 'Tile ZERO is not at (0, %s) position' %(target_col)\r\n re...
[ "0.7548881", "0.752049", "0.75068325", "0.74679226", "0.742282", "0.7359223", "0.7341293", "0.73344994", "0.7321091", "0.73030216", "0.7264205", "0.7223349", "0.7205626", "0.7195732", "0.7169341", "0.7164632", "0.71609145", "0.71587044", "0.71222657", "0.7111231", "0.7105816"...
0.76055276
0
Check whether the puzzle satisfies the row one invariant at the given column (col > 1) Returns a boolean
def row1_invariant(self, target_col): result = True if self._grid[1][target_col] != 0: result = False for row in range(2, self._height): for col in range(self._width): solved_value = (col + self._width * row) if solved_value != self._grid[r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def row1_invariant(self, target_col):\r\n # assert that row 1 is solved\r\n if not self.lower_row_invariant(1, target_col):\r\n return False\r\n # asserts that tile proceeded to (1,j), the grid below (1,j) and to the right is solved\r\n for dummy_j in range(0, self.get_width(...
[ "0.7744749", "0.7643967", "0.7540741", "0.7405464", "0.7363063", "0.7331644", "0.73298305", "0.72720087", "0.7253807", "0.71994525", "0.7157826", "0.71566737", "0.71124315", "0.7103953", "0.7086645", "0.70836926", "0.7064152", "0.7060724", "0.7032539", "0.7031373", "0.7020518...
0.77575016
0
Generate a solution string for a puzzle Updates the puzzle and returns a move string
def solve_puzzle(self): cur0_row, cur0_col = self.current_position(0, 0) move_str = 'd' * (self._height - cur0_row - 1) + 'r' * (self._width - cur0_col - 1) self.update_puzzle(move_str) for row in range(self._height-1, 1, -1): for col in range(self._width-1, -1, -1): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve_puzzle(self):\n\n move_str = \"\"\n \n # Move zero tile to bottom right corner tile of puzzle.\n zero_pos = self.current_position(0,0) \n vert_dist = (self.get_height() - 1) - zero_pos[0]\n horiz_dist = (self.get_width() - 1) - zero_pos[1]\n...
[ "0.7559481", "0.73133874", "0.69816166", "0.66144603", "0.6516676", "0.63399726", "0.6325148", "0.6325148", "0.6299051", "0.6299051", "0.6299051", "0.6297025", "0.62952787", "0.6252764", "0.6244446", "0.6211515", "0.61357105", "0.6083045", "0.6063561", "0.6049944", "0.602346"...
0.7348655
1
Run a reaction and combine the products in a single string. Makes errors readable ish
def _reactAndSummarize(rxn_smarts, *smiles): rxn = rdChemReactions.ReactionFromSmarts(rxn_smarts) mols = [Chem.MolFromSmiles(s) for s in smiles] products = [] for prods in rxn.RunReactants(mols): products.append(' + '.join(map(_getProductCXSMILES, prods))) products = ' OR '.join(products) return product...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reaction_str(self):\n\n def format(number):\n return str(number).rstrip(\".0\") + \" \"\n\n reactant_bits = []\n product_bits = []\n for met in sorted(self._metabolites, key=attrgetter(\"id\")):\n coefficient = self._metabolites[met]\n if coefficient...
[ "0.6317691", "0.59467554", "0.57581663", "0.5728929", "0.5590028", "0.5556531", "0.5528526", "0.55182624", "0.5469046", "0.54264945", "0.5413973", "0.5307061", "0.5297744", "0.5281674", "0.5246843", "0.52160555", "0.51447445", "0.51412046", "0.5139743", "0.511896", "0.5064106...
0.5951013
1
StereoGroup atoms are in the reaction, and the reaction destroys the specified chirality at the stereo centers > invalidate stereo center, preserve the rest of the stereo group.
def test_reaction_destroys_stereo(self): reaction = '[C@:1]>>[C:1]' products = _reactAndSummarize(reaction, 'F[C@H](Cl)Br |o1:1|') self.assertEqual(products, 'FC(Cl)Br') products = _reactAndSummarize(reaction, 'F[C@@H](Cl)Br |&1:1|') self.assertEqual(products, 'FC(Cl)Br') products = _reactAndSum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reaction_defines_stereo(self):\n products = _reactAndSummarize('[C:1]>>[C@@:1]', 'F[C@H](Cl)Br |o1:1|')\n self.assertEqual(products, 'F[C@@H](Cl)Br')\n products = _reactAndSummarize('[C:1]>>[C@@:1]', 'F[C@@H](Cl)Br |&1:1|')\n self.assertEqual(products, 'F[C@@H](Cl)Br')\n products = _reactAn...
[ "0.6586952", "0.58681905", "0.5560465", "0.5431528", "0.5087718", "0.49389872", "0.49223432", "0.4907192", "0.48812112", "0.4859121", "0.48425356", "0.48171473", "0.48001352", "0.47328418", "0.46946502", "0.46811792", "0.46665424", "0.46157676", "0.4614911", "0.4604623", "0.4...
0.6826048
0
StereoGroup atoms are in the reaction, and the reaction creates the specified chirality at the stereo centers > remove the stereo center from > invalidate stereo group
def test_reaction_defines_stereo(self): products = _reactAndSummarize('[C:1]>>[C@@:1]', 'F[C@H](Cl)Br |o1:1|') self.assertEqual(products, 'F[C@@H](Cl)Br') products = _reactAndSummarize('[C:1]>>[C@@:1]', 'F[C@@H](Cl)Br |&1:1|') self.assertEqual(products, 'F[C@@H](Cl)Br') products = _reactAndSummarize...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reaction_destroys_stereo(self):\n reaction = '[C@:1]>>[C:1]'\n products = _reactAndSummarize(reaction, 'F[C@H](Cl)Br |o1:1|')\n self.assertEqual(products, 'FC(Cl)Br')\n products = _reactAndSummarize(reaction, 'F[C@@H](Cl)Br |&1:1|')\n self.assertEqual(products, 'FC(Cl)Br')\n products = _...
[ "0.6699158", "0.599879", "0.5703354", "0.54769295", "0.5319069", "0.51858544", "0.49389228", "0.49315634", "0.4910987", "0.48884475", "0.4821768", "0.4819886", "0.4803131", "0.48022223", "0.48019797", "0.47844344", "0.47762632", "0.47756767", "0.47696617", "0.47598013", "0.46...
0.6745221
0
If multiple copies of an atom in StereoGroup show up in the product, they should all be part of the same product StereoGroup.
def test_reaction_copies_stereogroup(self): # Stereogroup atoms are in the reaction with multiple copies in the product products = _reactAndSummarize('[O:1].[C:2]=O>>[O:1][C:2][O:1]', 'Cl[C@@H](Br)C[C@H](Br)CCO |&1:1,4|', 'CC(=O)C') # stere...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_grouping(self):\n n = self.create(NodeItem, UML.Node)\n a = self.create(ArtifactItem, UML.Artifact)\n\n self.group(n, a)\n\n assert 1 == len(n.subject.deployment)\n assert n.subject.deployment[0].deployedArtifact[0] is a.subject", "def test_reaction_splits_stereogroup(...
[ "0.57665616", "0.5714965", "0.56087047", "0.5555653", "0.53248274", "0.5304287", "0.5222042", "0.520931", "0.5198424", "0.5198424", "0.5195729", "0.5162648", "0.5140849", "0.51147324", "0.5112582", "0.5106029", "0.50989425", "0.50513166", "0.5048671", "0.50138116", "0.5004784...
0.693719
0
Get the versions from GitHub tags
def get_versions(self): # They randomly use and don't use 'r' prefix so we have to sort # versions manually versions = list(self._get_github_tags()) versions.sort( key=operator.attrgetter('base_version'), reverse=True, ) return versions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_github_chandra_models_version_info():\n with urlopen('https://api.github.com/repos/sot/chandra_models/tags') as url:\n response = url.read()\n tags = json.loads(response.decode('utf-8'))\n\n with urlopen('https://api.github.com/repos/sot/chandra_models/branches') as url:\n respon...
[ "0.6975342", "0.67174757", "0.66325366", "0.6590542", "0.6541449", "0.64341235", "0.64160585", "0.6401173", "0.6249824", "0.61892974", "0.61882895", "0.618634", "0.61683893", "0.61543375", "0.6109142", "0.60987633", "0.608993", "0.6088227", "0.6088083", "0.6067755", "0.604825...
0.7527406
0
Fill the packets data properties.
def fill_data(self, data): self._data = data self._data_length = data[1:3] self._frame_id = data[4] self._address = XbeeAddress(data[5:9], data[9:13], data[13:15]) self._at_command = data[15:17] self._command_status = data[17] try: self._command_data ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initAttributes(self):\n CCSDS.DU.DataUnit.initAttributes(self)\n self.dataFieldHeaderFlag = 0\n self.setPacketLength()", "def _init_data(self) -> None:\n self.dtype = dict()\n self.shape = dict()\n self.size = dict()\n self.attrs = dict()\n self.data_p...
[ "0.6564761", "0.6411371", "0.62188", "0.6214954", "0.61160105", "0.60499305", "0.592144", "0.5917901", "0.58758026", "0.5839473", "0.58239967", "0.58188593", "0.5807109", "0.57820135", "0.57779455", "0.5756668", "0.57558346", "0.57392687", "0.57246864", "0.57196575", "0.57140...
0.6753045
0
test if the stations are sorted correctly by distance
def test_stations_by_distance(): station_list = build_station_list() #test for stations closest to cambridge city coordinates station_list_sort = stations_by_distance(station_list, (52.2053, 0.1218)) output = [(station.name, distance) for (station, distance) in station_list_sort] for n in range(1, l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_nearest_filter(self):\n for airport, reports, count in (\n (True, True, 6),\n (True, False, 16),\n (False, True, 6),\n (False, False, 30),\n ):\n stations = station.nearest(30, -80, 30, airport, reports, 1.5)\n self.assertEqua...
[ "0.66526514", "0.64656", "0.6275362", "0.60979766", "0.6097272", "0.6059003", "0.6043562", "0.59792054", "0.5845956", "0.5807009", "0.5800586", "0.57856506", "0.5729412", "0.5716074", "0.5695116", "0.5680469", "0.5653806", "0.5639628", "0.5623877", "0.5608037", "0.55967736", ...
0.8008606
0
Function to reset instrument commands.
def reset_instrument(self): return self.inst.write('*RST')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _doReset(self):\n self._cmdReset()", "def reset():\n pass", "def reset():\n pass", "def reset():", "def reset():", "def reset():", "def reset(*args):", "def reset(*args):", "def reset(*args):", "def reset(self):\r\n _debug('simq03b_api.reset')\r\n self.write('*RST')...
[ "0.6838344", "0.6738413", "0.6738413", "0.671417", "0.671417", "0.671417", "0.66459775", "0.66459775", "0.66459775", "0.6641422", "0.6612196", "0.6542922", "0.6525732", "0.65187824", "0.6515516", "0.6514655", "0.649084", "0.646241", "0.646241", "0.646241", "0.646241", "0.64...
0.728747
0
queries the database for a specific character takes a name returns a json with the lines
def lines_from_char(character): query = f""" SELECT script_l FROM script JOIN characters ON characters.char_id = script.characters_char_id WHERE name = '{character}' """ data = pd.read_sql_query(query,engine) return data.to_json(orient="records")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lines_from_char_ep(character,ep):\n query = f\"\"\"\nSELECT script_l FROM script\nJOIN characters \nON characters.char_id = script.characters_char_id\nINNER JOIN episodes\nON episodes.ep_id = script.episodes_ep_id\nWHERE name = '{character}' and episode = '{ep}'\n\"\"\"\n data = pd.read_sql_query(query,e...
[ "0.6725487", "0.60146636", "0.5816583", "0.5747994", "0.5689336", "0.5673698", "0.56607604", "0.5536652", "0.5442061", "0.5321022", "0.5247645", "0.52152646", "0.5201513", "0.5195355", "0.5165863", "0.51640224", "0.5157612", "0.5139213", "0.5121536", "0.5115688", "0.5093197",...
0.7432127
0
queries the database for a specific character and episode takes a name and episode returns a json with the filtered lines
def lines_from_char_ep(character,ep): query = f""" SELECT script_l FROM script JOIN characters ON characters.char_id = script.characters_char_id INNER JOIN episodes ON episodes.ep_id = script.episodes_ep_id WHERE name = '{character}' and episode = '{ep}' """ data = pd.read_sql_query(query,engine) return da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lines_():\n query = f\"\"\"\nSELECT script_l, `name`, episode\nFROM script\nINNER JOIN characters\nON characters.char_id = script.characters_char_id\nINNER JOIN episodes\nON episodes.ep_id = script.episodes_ep_id\n\"\"\"\n data = pd.read_sql_query(query, engine)\n return data.to_json(orient=\"records\...
[ "0.6161546", "0.61566335", "0.58697116", "0.531941", "0.51938283", "0.5191531", "0.51225615", "0.50665915", "0.49034274", "0.48820502", "0.48670354", "0.48493454", "0.48400128", "0.48004526", "0.47973293", "0.47908667", "0.47580832", "0.47565988", "0.47521466", "0.47492182", ...
0.7129047
0
queries the database for all lines takes no arguments returns a json with all the lines
def lines_(): query = f""" SELECT script_l, `name`, episode FROM script INNER JOIN characters ON characters.char_id = script.characters_char_id INNER JOIN episodes ON episodes.ep_id = script.episodes_ep_id """ data = pd.read_sql_query(query, engine) return data.to_json(orient="records")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_all_record():\n # X_new = item.to_df()\n # item_str = item.to_string()\n # project_code = int(item_str[item_str.find('=')+1:])\n pg = PostgreSQL()\n return_json = pg.fetch_all_records()\n return return_json", "def select_all_lines(conn):\n\n cur = conn.cursor()\n cur.execute...
[ "0.70531267", "0.6787454", "0.6718839", "0.66217417", "0.62935805", "0.62533355", "0.6238542", "0.6206922", "0.611652", "0.608391", "0.6056544", "0.59862447", "0.5970311", "0.59272057", "0.5872251", "0.58481425", "0.58452594", "0.5820792", "0.58157414", "0.5807491", "0.578491...
0.6937443
1
queries the database to insert a line from a character takes a name , character and episode returns a confirmation message
def new_line(script_l, character, episode): if up.check("characters", character): char_id = up.giveId("characters", character) else: up.insertCharacter(character) char_id = up.giveId("characters", character) if up.check("episodes", episode): ep_id = up.giveId("episodes", epis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertCharacter(string):\n if check(\"character\", string):\n return \"character exists\"\n else:\n engine.execute(f\"INSERT INTO characters (name) VALUES ('{string}');\")", "def insertLine(row):\n if check(\"script\", row[\"dialogue\"]) and check(\"characters\", row[\"character\"]) an...
[ "0.68971574", "0.6643312", "0.6609034", "0.63286656", "0.62008613", "0.596312", "0.5952589", "0.5870909", "0.58442897", "0.5829052", "0.58106846", "0.58059555", "0.57868826", "0.57820517", "0.5769277", "0.56395286", "0.5630925", "0.56198794", "0.5592354", "0.55757797", "0.551...
0.6655293
1
Prints a string representation of SnakemakeRule instance
def __repr__(self): template = """ SnakemakeRule ({}) - parent_id : {} - input : {} - output : {} - local : {} - template : {} - params : {} """ return template.format( self.rule_id, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return \"[ %s ]\" % str(self.__rule)", "def __str__(self):\n return \"{ %s }\" % str(self.__rule)", "def __str__(self):\n return \"{ %s }1\" % str(self.__rule)", "def print_rules(self):\n for idx, r in enumerate(self.rules):\n print(idx, \"=>\", r._...
[ "0.7497269", "0.74336165", "0.73365", "0.7002294", "0.6986714", "0.6474687", "0.6371976", "0.63269794", "0.62451273", "0.620827", "0.6196005", "0.6190379", "0.6182506", "0.6179493", "0.6122271", "0.60830194", "0.60090804", "0.5991629", "0.59799564", "0.5888777", "0.5873028", ...
0.7577809
0
Prints a string representation of DataIntegrationRule instance
def __repr__(self): template = """ DataIntegrationRule ({}) - inputs : {} - output : {} - local : {} - template : {} - params : {} """ return template.format( self.rule_id, self.inputs, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return \"[ %s ]\" % str(self.__rule)", "def __str__(self):\n return \"{ %s }\" % str(self.__rule)", "def __str__(self):\n return \"{ %s }1\" % str(self.__rule)", "def __str__ (self) :\n\t\ttext_rule = \"\"\n\t\t\n\t\tfor key, rules in self.production_rules.items() :\...
[ "0.68674856", "0.68624336", "0.6645672", "0.6532725", "0.6322785", "0.628434", "0.62689245", "0.6190423", "0.604574", "0.6039333", "0.59951794", "0.5989062", "0.5976397", "0.59762686", "0.5963851", "0.5931985", "0.59197044", "0.59166557", "0.590007", "0.5897591", "0.5883885",...
0.7635887
0
Compute the jacobian of a finger at configuration q0.
def compute_jacobian(self, finger_id, q0): frame_id = self.tip_link_ids[finger_id] return pinocchio.computeFrameJacobian( self.robot_model, self.data, q0, frame_id, pinocchio.ReferenceFrame.LOCAL_WORLD_ALIGNED, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jacobian(self, dt):\n raise NotImplementedError", "def jacobian(self, x):\n pass", "def jacobian_ur5(q, delta=0.0001):\n # Alocacion de memoria\n J = np.zeros((3,6))\n # Transformacion homogenea inicial (usando q)\n T = fkine_ur5(q)\n # Iteracion para la derivada de cada column...
[ "0.7174676", "0.7125965", "0.71125233", "0.702315", "0.6786565", "0.6759826", "0.6759339", "0.66214025", "0.6568994", "0.653416", "0.6530263", "0.6495432", "0.64650875", "0.64634913", "0.64042807", "0.6402122", "0.6401185", "0.6370891", "0.6329893", "0.63101774", "0.63079286"...
0.7850823
0
Creates the initial search space using latin hypercube sampling.
def lhs_start(hyperbounds, n_samples, rng=None): low_bounds = [] high_bounds = [] for bound in hyperbounds: low_bounds.append(bound[0]) high_bounds.append(bound[1]) low_bounds = np.array(low_bounds, dtype=object) high_bounds = np.array(high_bounds, dtype=object) samples = sampl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_latin_hypercube(samples, param_dict, class_root, seed=10):\n # Set random seed\n random.seed(seed)\n\n # Create dictionary to hold sampled parameter values\n sample_points = {}\n for key in param_dict.keys():\n sample_points[key] = np.zeros(samples)\n Ndim = len(param_dict.key...
[ "0.6223337", "0.59628797", "0.58912903", "0.5874907", "0.5854502", "0.5754657", "0.5733271", "0.56222767", "0.5502466", "0.54998386", "0.54974604", "0.5460404", "0.5426823", "0.5370437", "0.53134114", "0.5280649", "0.52736545", "0.5264173", "0.52439547", "0.52239805", "0.5213...
0.6189054
1
converts time to gmt, appends to list
def gmt(time): gmt = [0]*time.size for i in range(time.size): gmt[i]=datetime.utcfromtimestamp(time[i]).strftime('%Y-%m-%d %H:%M:%S') return gmt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_time(self):\r\n\r\n curr_time = datetime.datetime.now()\r\n time = []\r\n time.append([int(x) for x in '{0:06b}'.format(curr_time.second)])\r\n time.append([int(x) for x in '{0:06b}'.format(curr_time.minute)])\r\n time.append([int(x) for x in '{0:06b}'.format(curr_tim...
[ "0.6536344", "0.61749583", "0.5915965", "0.57811874", "0.5765255", "0.5675775", "0.5667193", "0.5663627", "0.5660941", "0.5621869", "0.5613156", "0.55986845", "0.5576497", "0.5538767", "0.55233485", "0.55079854", "0.5443805", "0.5407144", "0.53734505", "0.53541595", "0.534225...
0.72068673
0
finds stations that don't have predictand data and appends them to a list
def miss_station(all_stations,stations): diff = len(all_stations)-len(stations) k=0 i=0 miss_stations = ['']*diff a = all_stations[:] a.sort() s = stations[:] s.sort() while i < len(stations): while a[i] != s[i]: mi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stations():\n\n return station_list", "def prep_stations(url):\n stations = []\n _stations = requests.get(url).json()\n\n for _station in _stations['stationBeanList']:\n if _station['statusKey'] == 1:\n stations.append([_station['stationName'], _station['id'],\n ...
[ "0.6918483", "0.63394576", "0.6295055", "0.6175655", "0.6134076", "0.6036043", "0.59990704", "0.5990439", "0.5939404", "0.59325945", "0.5899833", "0.5873434", "0.58216053", "0.5731162", "0.5703947", "0.5658584", "0.5635071", "0.563275", "0.56268054", "0.5625375", "0.56150836"...
0.66159266
1
Hexlify raw text, return hexlified text.
def hexlify(text): if six.PY3: text = text.encode('utf-8') hexlified = binascii.hexlify(text) if six.PY3: hexlified = hexlified.decode('utf-8') return hexlified
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unhexlify(text):\n unhexlified = binascii.unhexlify(text)\n\n if six.PY3:\n unhexlified = unhexlified.decode('utf-8')\n\n return unhexlified", "def hexify(text):\r\n return ' '.join([hexify_word(word) for word in text.split()])", "def normalize(self, text):\n\n return binascii.hexli...
[ "0.7632533", "0.7439492", "0.70764095", "0.65433866", "0.6380229", "0.61830765", "0.61594963", "0.61447966", "0.6132453", "0.6124988", "0.61229116", "0.6114684", "0.59884095", "0.5947459", "0.59325373", "0.5788667", "0.5782058", "0.57663274", "0.5741124", "0.57352805", "0.571...
0.78595716
0
Unhexlify raw text, return unhexlified text.
def unhexlify(text): unhexlified = binascii.unhexlify(text) if six.PY3: unhexlified = unhexlified.decode('utf-8') return unhexlified
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hexlify(text):\n if six.PY3:\n text = text.encode('utf-8')\n\n hexlified = binascii.hexlify(text)\n\n if six.PY3:\n hexlified = hexlified.decode('utf-8')\n\n return hexlified", "def test_unhexlify_not_python():\n assert '' == uflash.unhexlify(\n ':020000040003F7\\n:10E0...
[ "0.76805043", "0.724818", "0.71128637", "0.6909091", "0.6862392", "0.6219935", "0.6197366", "0.59515", "0.5922873", "0.5843483", "0.57907474", "0.5650561", "0.56349534", "0.56267136", "0.55028135", "0.550243", "0.5497304", "0.54252976", "0.5407516", "0.53313655", "0.52876633"...
0.8604057
0
Obtains the record in the set with the time closest to the given $unix_time. If this record with not $within the correct number of seconds, an exception is raised.
def get_record(self, unix_time, within): if len(self.records) <= 0: raise Exception("No records in this set") r = self.records[0] closest_record = r closest_delta = abs(r.unix_time - unix_time) for r in self.records[1:]: delta = abs(r.unix_time - unix_time) if delta < closest_delta: closest_reco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_closest_record(self, time):\n dist = 10000000\n record = -1\n # TODO: optimise a bit\n for i, itime in enumerate(self.times):\n if (abs(time-itime)) < dist:\n dist = abs(time-itime)\n record = i\n\n return record", "def find_near...
[ "0.6383025", "0.57725835", "0.5726713", "0.5603155", "0.550198", "0.5465888", "0.51996434", "0.51091826", "0.49394408", "0.49366295", "0.49245772", "0.48886275", "0.48809275", "0.48312008", "0.48274845", "0.4817998", "0.4760067", "0.47593623", "0.47202304", "0.47175002", "0.4...
0.84365386
0
Pulls in the records from other into self with the other, but since the timestamps won't match up perfectly, the output will only have a record per $period number of seconds.
def merge_with(self, other, period=60): new_list = [] last_timestamp = 0 for r in self.records: if abs(r.unix_time - last_timestamp) > period: # Accept this record last_timestamp = r.unix_time other_r = other.get_record(r.unix_time, period/2) r.merge_with(other_r) new_list.append(r) self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add__ ( self, other, resample_opts=None ):\n result = ObservationStorage (datadir=self.datadir, \\\n resample_opts=resample_opts )\n if self.date[0] > other.date[0]:\n start_date = other.date[0]\n else:\n start_date = self.date[0]\n if self.date[-1...
[ "0.60452324", "0.5793913", "0.5528706", "0.5526547", "0.5517215", "0.5493142", "0.54775965", "0.54737484", "0.5462078", "0.54354554", "0.5395026", "0.5321515", "0.529761", "0.5283373", "0.5275335", "0.5271934", "0.52359205", "0.51437724", "0.51378435", "0.513382", "0.51214904...
0.7975035
0
Given a UC480 camera object (instrumental module) and a number indicating the number of trap objects, applies an iterative image analysis to individual trap adjustment in order to achieve a nearly homogeneous intensity profile across traps.
def stabilize_intensity(which_cam, cam, verbose=False): L = 0.5 # Correction Rate mags = np.ones(12) ### ! ntraps = len(mags) iteration = 0 while iteration < 5: iteration += 1 print("Iteration ", iteration) im = cam.latest_frame() try: trap_po...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def analyze_image(which_cam, image, ntraps, iteration=0, verbose=False):\n threshes = [0.5, 0.6]\n margin = 10\n threshold = np.max(image) * threshes[which_cam]\n im = image.transpose()\n\n x_len = len(im)\n peak_locs = np.zeros(x_len)\n peak_vals = np.zeros(x_len)\n\n ## Trap Peak Detectio...
[ "0.5652331", "0.5335536", "0.52658623", "0.5259198", "0.5201728", "0.51909906", "0.515129", "0.5142113", "0.5076965", "0.5063984", "0.5055916", "0.49459288", "0.4884683", "0.48668435", "0.4824002", "0.482143", "0.47895026", "0.47749937", "0.47587273", "0.4741739", "0.4710989"...
0.5542998
1
Scans the given image for the 'ntraps' number of trap intensity peaks. Then extracts the 1dimensional gaussian profiles across the traps and returns a list of the amplitudes.
def analyze_image(which_cam, image, ntraps, iteration=0, verbose=False): threshes = [0.5, 0.6] margin = 10 threshold = np.max(image) * threshes[which_cam] im = image.transpose() x_len = len(im) peak_locs = np.zeros(x_len) peak_vals = np.zeros(x_len) ## Trap Peak Detection ## for i ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trapfilt_taps(N, phil, alfa):\n\n\n\n tt = arange(-N/2,N/2 + 1) # Time axis for h(t) \n # ***** Generate impulse response ht here *****\n ht = zeros(len(tt))\n ix = where(tt != 0)[0]\n if alfa != 0:\n ht[ix] = ((sin(2*pi*phil*tt[ix]))/(pi*tt[ix]))*((s...
[ "0.587632", "0.52485836", "0.5228704", "0.5138485", "0.5076651", "0.50504184", "0.5020896", "0.49921283", "0.49873865", "0.4987357", "0.49527085", "0.48427442", "0.48109403", "0.4805407", "0.47939897", "0.47633266", "0.47571003", "0.47376722", "0.47331765", "0.47273827", "0.4...
0.5898754
0
Given the opened camera object and the Slider object connected to the camera's exposure, adjusts the exposure to just below clipping. Binary Search
def fix_exposure(cam, slider, verbose=False): margin = 10 exp_t = MAX_EXP / 2 cam._set_exposure(exp_t * u.milliseconds) time.sleep(0.5) print("Fetching Frame") im = cam.latest_frame() x_len = len(im) right, left = MAX_EXP, 0 inc = right / 10 for _ in range(10): ## Determ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_exposure(self, expo):\n if expo == 0:\n self.exposure = 0\n elif expo == 1:\n self.exposure = min(9, self.exposure+1)\n elif expo == -1:\n self.exposure = max(-9, self.exposure-1)\n self.drone.set_exposure(self.exposure)\n log.info(f\"EXPO...
[ "0.59731835", "0.5947797", "0.5704381", "0.5572308", "0.5527399", "0.54456806", "0.54195607", "0.5414224", "0.5396532", "0.53867406", "0.5374971", "0.5353075", "0.52843153", "0.52828944", "0.52818215", "0.52474177", "0.5239085", "0.5233961", "0.52310765", "0.52299416", "0.522...
0.71824807
0
Fetches prediction field from prediction byte array. After TensorRT inference, prediction data is saved in byte array and returned by object detection network. This byte array contains several pieces of data about prediction we call one such piece a prediction field. The prediction fields layout is described in TRT_PRE...
def fetch_prediction_field(field_name, detection_out, pred_start_idx): return detection_out[pred_start_idx + TRT_PREDICTION_LAYOUT[field_name]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_predict(path=MODEL_PATH, version=VERSION, namePredictor=DEFAULT_PREDICTOR):\n logging.info(\"trying to load {}\".format(path + namePredictor + version + '.npz'))\n return np.load(path + namePredictor + version + '.npz')['pred']", "async def predict(params: predict_text):\n tweet = params.text\n...
[ "0.55769396", "0.5293517", "0.52770144", "0.5273354", "0.5251776", "0.52444863", "0.522911", "0.51298296", "0.507966", "0.5062503", "0.50453293", "0.5021716", "0.5021298", "0.5006652", "0.5005181", "0.50023496", "0.49902007", "0.49683675", "0.4965189", "0.4964087", "0.4936551...
0.7810624
0
Get a dictionary with the important tags for DAGMC geometries inputs
def get_dagmc_tags(my_core): dagmc_tags = {} dagmc_tags['geom_dim'] = my_core.tag_get_handle('GEOM_DIMENSION', size=1, tag_type=types.MB_TYPE_INTEGER, storage_type=types.MB_TAG_SPARSE, create_if_missing=True) # geometric dimension dagmc_tags['category'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTag(self, inputs, tag):\n result = {}\n for into in inputs:\n for i in into:\n if i in self.sim.agents:\n agentTags = self.sim.agents[i].access[\"tags\"]\n if tag in agentTags:\n result[i] = agentTags[tag]\n...
[ "0.6049964", "0.5798417", "0.5783547", "0.56233895", "0.56191564", "0.5531968", "0.54956996", "0.5407354", "0.54043907", "0.5376861", "0.5376861", "0.53438914", "0.53383356", "0.5330779", "0.5323087", "0.5323087", "0.5323087", "0.5323087", "0.5323087", "0.5323087", "0.5323087...
0.6765775
0
Get a dictionary with MOAB ranges for each of the requested entity types inputs
def get_native_ranges(my_core, meshset, entity_types): native_ranges = {} for entity_type in entity_types: native_ranges[entity_type] = my_core.get_entities_by_type( meshset, entity_type) return native_ranges
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_entityset_ranges(my_core, meshset, geom_dim):\n\n entityset_ranges = {}\n entityset_types = ['Nodes', 'Curves', 'Surfaces', 'Volumes']\n for dimension, set_type in enumerate(entityset_types):\n entityset_ranges[set_type] = my_core.get_entities_by_type_and_tag(meshset, types.MBENTITYSET, geo...
[ "0.65154475", "0.600458", "0.5998008", "0.5853334", "0.5807972", "0.5797119", "0.562755", "0.562755", "0.55852807", "0.55669194", "0.5557111", "0.5455386", "0.54513985", "0.5441645", "0.53997433", "0.53997433", "0.5393903", "0.5376995", "0.5375735", "0.53752905", "0.5361025",...
0.6155824
1
Get a dictionary with MOAB Ranges that are specific to the types.MBENTITYSET type inputs
def get_entityset_ranges(my_core, meshset, geom_dim): entityset_ranges = {} entityset_types = ['Nodes', 'Curves', 'Surfaces', 'Volumes'] for dimension, set_type in enumerate(entityset_types): entityset_ranges[set_type] = my_core.get_entities_by_type_and_tag(meshset, types.MBENTITYSET, geom_dim, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRangeMM(self) -> float:\n ...", "def range_dic_(df_):\n range_dic = {}\n for man in df_['maneuver']:\n trial_indx = df_.index[df_['maneuver'] == man].tolist()\n range_ = (min(trial_indx), max(trial_indx))\n range_dic.update({man: range_})\n return range_dic", "def ra...
[ "0.59818125", "0.5639009", "0.5639009", "0.5624772", "0.5565236", "0.5513016", "0.5494546", "0.5442198", "0.54400784", "0.5380527", "0.5366019", "0.5358748", "0.5318177", "0.5313223", "0.52917475", "0.5266361", "0.5262664", "0.5223182", "0.5186198", "0.517666", "0.5118012", ...
0.6958238
0
Get side lengths of triangle inputs
def get_tri_side_length(my_core, tri): side_lengths = [] s = 0 coord_list = [] verts = list(my_core.get_adjacencies(tri, 0)) for vert in verts: coords = my_core.get_coords(vert) coord_list.append(coords) for side in range(3): side_lengths.append(np.linalg.norm(coord_l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_side_lengths(triangles):\n first_vec = [2, 0, 1]\n second_vec = [1, 2, 0]\n sides = triangles[:, first_vec] - triangles[:, second_vec]\n lengths = np.sqrt(np.sum(sides**2, axis=2))\n return lengths", "def get_edge_lengths(points: np.ndarray, triangles: np.ndarray) -> np.ndarray:\n edge...
[ "0.80329156", "0.73527324", "0.6605369", "0.6578953", "0.653027", "0.6457566", "0.6410448", "0.6380816", "0.6373851", "0.634458", "0.63425255", "0.62799424", "0.62611526", "0.62526083", "0.6235124", "0.6221507", "0.62141633", "0.61444443", "0.6128147", "0.61095893", "0.610488...
0.7491572
1
Cleans the line from geometrical shape characters and replaces these with space.
def clean_text_from_geometrical_shape_unicode(line): line = re.sub(r"([\u25A0-\u25FF])", " ", line) return line
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean(line):\n line = line.strip('\\n').strip()\n line = line.replace('\\xe2\\x80\\x93', '-')\n line = line.replace('\\xe2\\x80\\x99', '\\'')\n\n return line", "def clean(line):\n line = line.lower().replace(\"\\n\",\" \").replace(\"\\r\",\"\").replace(',',\"\").replace(\">\",\"> \").replace(\...
[ "0.6750238", "0.6354936", "0.60908276", "0.60867965", "0.6052043", "0.5917007", "0.58838075", "0.58618855", "0.5852398", "0.58450764", "0.5843433", "0.584121", "0.5809004", "0.5809004", "0.5773769", "0.5744268", "0.573116", "0.57237", "0.56972486", "0.5695229", "0.5684892", ...
0.8284751
1
Cleans the line from private unicode characters and replaces these with space.
def clean_text_from_private_unicode(line): line = re.sub(r"([\uE000-\uF8FF]|\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDDFF])", " ", line) return line
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_text_from_geometrical_shape_unicode(line):\n line = re.sub(r\"([\\u25A0-\\u25FF])\", \" \", line)\n return line", "def clean_text_from_geometrical_shape_unicode(line):\n line = re.sub(r\"([\\u25A0-\\u25FF])\", \" \", line)\n return line", "def RemoveNonUtf8BadChars(line):\n return \"\"...
[ "0.6923628", "0.6923628", "0.6871189", "0.68013835", "0.6612186", "0.6590212", "0.643773", "0.6276485", "0.6224105", "0.6136164", "0.60882586", "0.6054826", "0.6043292", "0.60300654", "0.6018717", "0.6001594", "0.5968716", "0.59620196", "0.59620196", "0.5959176", "0.593358", ...
0.8404962
1
return a model as defines in model_search.yaml
def get_model_from_yaml(name): filename = pkg_resources.resource_filename('empirical_lsm', 'data/model_search.yaml') with open(filename) as f: model_dict = yaml.load(f)[name] return get_model_from_dict(model_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model(model=gin.REQUIRED):\n return model", "def get_model(*args):\n return Model()", "def get_model(model):\n all_models = cmd.get_object_list()\n\n if len(all_models) == 0:\n logging.parser_error('No models are opened.')\n return\n\n model = model.lower()\n\n if mode...
[ "0.72097623", "0.6948634", "0.67616165", "0.67475533", "0.66909075", "0.66902417", "0.66678", "0.6573517", "0.65641904", "0.65121186", "0.651177", "0.6477959", "0.6459214", "0.6455929", "0.64499646", "0.6413741", "0.6407674", "0.64009804", "0.6380913", "0.6357358", "0.6337721...
0.6980467
1
Return a sklearn model pipeline from a model_dict
def get_model_from_dict(model_dict): pipe_list = [] if 'transforms' in model_dict: # For basic scikit-learn transforms transforms = model_dict['transforms'].copy() if 'scaler' in transforms: scaler = transforms.pop('scaler') pipe_list.append(get_scaler(scaler)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_pipeline(model):\n\n steps = [\n (\"imp\", SimpleImputer(strategy=\"most_frequent\")),\n (\"norm\", MinMaxScaler()),\n (\"reg\", model)\n ]\n pipeline = Pipeline(steps=steps)\n\n return pipeline", "def build_model():\n # Build ML pipeline using random forest classifie...
[ "0.6688918", "0.64640874", "0.64640874", "0.6416069", "0.6381701", "0.636211", "0.6302781", "0.62598276", "0.62242967", "0.6168712", "0.6149896", "0.6133813", "0.6130566", "0.61174124", "0.6096542", "0.6070486", "0.6065497", "0.60585046", "0.6046623", "0.6042597", "0.603112",...
0.771603
0
Return a Lag wrapper for a pipeline.
def get_lagger(pipe, kwargs): from .transforms import LagWrapper return LagWrapper(pipe, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pipeline(self) -> Pipeline:\n if self._to_pipeline is None:\n raise AttributeError(\n \"pipeline not available because `to_pipeline` was not set on __init__.\"\n )\n return self._to_pipeline(self)", "def get_pipeline(tag=None):\n\n\n data_science_pipeline...
[ "0.614468", "0.5957362", "0.59200114", "0.58368886", "0.5657546", "0.54006594", "0.53980225", "0.53207415", "0.53056926", "0.53035724", "0.5302075", "0.52976626", "0.5268746", "0.52655923", "0.5263156", "0.52361935", "0.52361935", "0.52285284", "0.52276915", "0.5182775", "0.5...
0.8226096
0
Return a markov wrapper for a pipeline.
def get_markov_wrapper(pipe, kwargs): from .transforms import MarkovWrapper return MarkovWrapper(pipe, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_own_pipeline() -> Pipeline:\n clf = svm.LinearSVC(C=2, loss='hinge')\n vect = TfidfVectorizer(ngram_range=(1, 2))\n\n pipeline = None\n ##### Write code here #######\n pipeline = Pipeline([\n ('vect', vect),\n ('tfidf', TfidfTransformer()),\n ('clf', clf)\n ])\n ...
[ "0.6571192", "0.6444065", "0.6408322", "0.60807306", "0.6047931", "0.5914984", "0.59031147", "0.58204484", "0.5804149", "0.5747107", "0.5725643", "0.5704614", "0.5703797", "0.56960964", "0.56624687", "0.56623226", "0.5654284", "0.562496", "0.5591383", "0.55484897", "0.5527152...
0.83327645
0
Return a scikitlearn clusterer from name and args.
def get_clusterer(name, kwargs): if name == 'KMeans': from sklearn.cluster import KMeans return KMeans(**kwargs) if name == 'MiniBatchKMeans': from sklearn.cluster import MiniBatchKMeans return MiniBatchKMeans(**kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_cluster(name: str) -> Cluster:\n environment = EnvironmentProvider().environment\n return environment.clusters[name]", "def create_marker_cluster(name: str):\n return MarkerCluster(name=name)", "def launch_example_cluster_cmd(*args, **kwargs):\n return launch_example_cluster(*args, **k...
[ "0.5950856", "0.58060235", "0.5799281", "0.5795873", "0.5752199", "0.56631964", "0.55473256", "0.5533583", "0.5423363", "0.54131496", "0.53921217", "0.53843373", "0.53843373", "0.53843373", "0.5361153", "0.5359831", "0.53507227", "0.53416944", "0.5282299", "0.5266684", "0.526...
0.7380628
0
get a sklearn scaler from a scaler name
def get_scaler(scaler): if scaler == 'standard': from sklearn.preprocessing import StandardScaler return StandardScaler() if scaler == 'minmax': from sklearn.preprocessing import MinMaxScaler return MinMaxScaler()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __create_scaler_type(self):\n\n if self.scalertype == \"standard\":\n return StandardScaler()\n if self.scalertype == \"minmax\":\n return MinMaxScaler(feature_range=self.featureRange)\n assert True, \"An error occured when creating a scaler of type '{}'\".format(self...
[ "0.68367714", "0.63356686", "0.620714", "0.61540365", "0.58169883", "0.57977337", "0.57299215", "0.57015646", "0.56682044", "0.5622776", "0.5611353", "0.55854297", "0.5540283", "0.5517815", "0.5501262", "0.54594105", "0.5455747", "0.5352761", "0.5330781", "0.5323924", "0.5315...
0.81780565
0
get a PCA decomposition
def get_pca(): from sklearn.decomposition import PCA return PCA()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPCA(data):\n #covM = np.cov(data.T) #note that np.cov define row as variables, col as observations\n #corM = np.corrcoef(data.T) # we will use correlation matrix instead of cov.\n covM = np.cov(data.T)\n eigvalue,eigvector = np.linalg.eig(covM) # each col of the eigvector matrix corresponds to o...
[ "0.76003706", "0.74183345", "0.73857856", "0.73070925", "0.7215321", "0.7163089", "0.7066037", "0.7064292", "0.7050474", "0.7049609", "0.70191026", "0.7006228", "0.6999517", "0.6968802", "0.6924137", "0.68874854", "0.6884852", "0.68622917", "0.67792535", "0.6774958", "0.67328...
0.84510195
0
get a PolynomialFeatures transform
def get_poly(kwargs): from sklearn.preprocessing import PolynomialFeatures return PolynomialFeatures(**kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_polynomial_features(self, X) :\n\n n,d = X.shape\n\n ### ========== TODO : START ========== ###\n # part b: modify to create matrix for simple linear model\n # part g: modify to create matrix for polynomial model\n Phi = X\n m = self.m_\n\n if m == 1:\n...
[ "0.7088703", "0.69679934", "0.66370046", "0.6578305", "0.6512583", "0.6453376", "0.63881963", "0.6234599", "0.6210643", "0.6198964", "0.61715096", "0.61595196", "0.6012623", "0.60067403", "0.595723", "0.5934394", "0.58879584", "0.5873344", "0.582992", "0.5797094", "0.57733417...
0.77433574
0
Check GMail E.g. messages,unseen = imap.check_gmail('username.com','password')
def check_gmail(username, password): i = imaplib.IMAP4_SSL('imap.gmail.com') try: i.login(username, password) x, y = i.status('INBOX', '(MESSAGES UNSEEN)') messages = int(re.search('MESSAGES\s+(\d+)', y[0]).group(1)) unseen = int(re.search('UNSEEN\s+(\d+)', y[0]).group(1)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkEmail():\n\tpop_conn = poplib.POP3_SSL('pop.gmail.com')\n\tpop_conn.user('')\n\tpop_conn.pass_('')\n\t#Get messages from server:\n\tmessages = [pop_conn.retr(i) for i in range(1, len(pop_conn.list()[1]) + 1)]\n\t# Concat message pieces:\n\tmessages = [\"\\n\".join(mssg[1]) for mssg in messages]\n\t#Parse ...
[ "0.70329154", "0.6592309", "0.64842856", "0.636004", "0.6350439", "0.62164766", "0.6210396", "0.6174336", "0.60854125", "0.6038846", "0.6019747", "0.5920456", "0.58898234", "0.5836752", "0.5829357", "0.57975626", "0.57911247", "0.57865626", "0.5757906", "0.57237977", "0.56982...
0.8364727
0
Converts a raw packet to a dpkt packet regarding of link type.
def iplayer_from_raw(raw, linktype=1): if linktype == 1: # ethernet pkt = dpkt.ethernet.Ethernet(raw) ip = pkt.data elif linktype == 101: # raw ip = dpkt.ip.IP(raw) else: raise Exception("unknown PCAP linktype") return ip
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_packet(linktype, packet):\n link_layer = parse_Ethernet(packet) if linktype == pcapy.DLT_EN10MB else parse_Cooked(packet)\n if link_layer['payload_type'] in ['IPv4', 'IPv6']:\n network_layer = parse_IPv4(link_layer['payload']) if link_layer['payload_type'] == 'IPv4' else parse_IPv6(link_laye...
[ "0.68164754", "0.62622094", "0.5889911", "0.5856772", "0.5697665", "0.52689415", "0.5258935", "0.52217716", "0.5157317", "0.51023954", "0.5042225", "0.5041668", "0.49423012", "0.49230462", "0.4902196", "0.4897916", "0.4865398", "0.48552364", "0.4845798", "0.48386303", "0.4838...
0.63520455
1
Extract all packets belonging to the same flow from a pcap packet iterator
def next_connection_packets(piter, linktype=1): first_ft = None for ts, raw in piter: ft = flowtuple_from_raw(raw, linktype) if not first_ft: first_ft = ft sip, dip, sport, dport, proto = ft if not (first_ft == ft or first_ft == (dip, sip, dport, sport, proto)): bre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter(self):\n # outfile = open(self.newpcap, 'wb')\n # writer = dpkt.pcap.Writer(outfile)\n f = open(self.pcapfile, 'rb')\n packets = dpkt.pcap.Reader(f)\n\n for timestamp, buf in packets:\n eth = dpkt.ethernet.Ethernet(buf)\n if not isinstance(eth.dat...
[ "0.6305733", "0.6296941", "0.6157458", "0.5966342", "0.58530146", "0.58158106", "0.5761478", "0.5597372", "0.5591383", "0.5550107", "0.5509687", "0.5483427", "0.5468516", "0.54531425", "0.53616995", "0.52512836", "0.5180603", "0.51701915", "0.5169873", "0.5168804", "0.5165378...
0.67187
0
Open a PCAP, seek to a packet offset, then get all packets belonging to the same connection
def packets_for_stream(fobj, offset): pcap = dpkt.pcap.Reader(fobj) pcapiter = iter(pcap) ts, raw = pcapiter.next() fobj.seek(offset) for p in next_connection_packets(pcapiter, linktype=pcap.datalink()): yield p
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_packets(pcap):\n\n # For each packet in the pcap process the contents\n for timestamp, buf, hdr_len in pcap:\n \n # Unpack the Ethernet frame (mac src/dst, ethertype)\n eth = dpkt.ethernet.Ethernet(buf)\n # print('Ethernet Frame: ', mac_addr(eth.src), mac_addr(eth.dst), ...
[ "0.5710354", "0.5529603", "0.5436237", "0.5389503", "0.5370659", "0.5341635", "0.5319951", "0.5312948", "0.5296589", "0.52821374", "0.5232271", "0.5231817", "0.5208476", "0.52023923", "0.51755023", "0.5116855", "0.5112408", "0.5110333", "0.5092085", "0.5089987", "0.5086152", ...
0.69073343
0
Use SortCap class together with batch_sort to sort a pcap
def sort_pcap(inpath, outpath): inc = SortCap(inpath) batch_sort(inc, outpath, output_class=lambda path: WriteCap(path, linktype=inc.linktype)) return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def external_sort(input_file_name, block_size, output_file_name=None):\n if output_file_name is None:\n output_file_name = input_file_name\n sorter = ExternalSort(input_file_name, block_size, output_file_name)\n sorter.run()", "def step020():\n logger.logMessage('Begin: Sorting records')\n ...
[ "0.55296206", "0.5489133", "0.5482073", "0.5391432", "0.53850245", "0.53489995", "0.5328854", "0.52847326", "0.5241572", "0.5189761", "0.5177634", "0.51613575", "0.51465315", "0.5137804", "0.5135673", "0.51097757", "0.51089555", "0.51009786", "0.5096934", "0.5095022", "0.5090...
0.7660257
0
test that the StrainData.fetch_open_frame works as expected
def test_fetch_open_frame(self): import requests pesummary_data = StrainData.fetch_open_frame( "GW190412", IFO="L1", duration=32, sampling_rate=4096., channel="L1:GWOSC-4KHZ_R1_STRAIN", format="hdf5" ) N = len(pesummary_data) np.testing.assert_almost_equal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fetch_open_data(self):\n args = [\"L1\", 1126259446, 1126259478]\n pesummary_data = StrainData.fetch_open_data(*args)\n gwpy_data = TimeSeries.fetch_open_data(*args)\n np.testing.assert_almost_equal(pesummary_data.value, gwpy_data.value)\n np.testing.assert_almost_equal(...
[ "0.73446274", "0.65186745", "0.6414948", "0.6280164", "0.61943877", "0.6105646", "0.5987783", "0.596136", "0.5908009", "0.5907794", "0.59036356", "0.5877466", "0.5877377", "0.5873337", "0.5770271", "0.57309335", "0.57286495", "0.5710138", "0.569773", "0.56320137", "0.5627794"...
0.81294215
0
Add v to a ordered set s and return s. >>> s = Link(1, Link(3, Link(5))) >>> add(s, 0) Link(0, Link(1, Link(3, Link(5)))) >>> add(s, 4) Link(0, Link(1, Link(3, Link(4, Link(5))))) >>> add(s, 6) Link(0, Link(1, Link(3, Link(4, Link(5, Link(6)))))) >>> t = Link(1) >>> add(t, 0) Link(0, Link(1))
def add(s, v): if empty(s): return Link(v) head = s if head.first > v: # s = Link(v, s) #error: assigment, then s will rebind to a new object # s.first, s.rest = v, s # error s.rest = s s.first, s.rest = v, Link(s.first, s.rest) return s # head.first <= v ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(s, v):\n if empty(s):\n return Link(v)\n if s.first > v:\n s.first, s.rest = v, Link(s.first, s.rest)\n elif s.first < v and empty(s.rest):\n s.rest = Link(v, s.rest)\n elif s.first < v:\n add(s.rest, v)\n return s", "def add(self, s):\n current = self.fi...
[ "0.7793301", "0.6587982", "0.6429319", "0.6309428", "0.61591506", "0.60639244", "0.5989767", "0.5989767", "0.58004624", "0.5777832", "0.5752884", "0.56904775", "0.56822777", "0.56809616", "0.56809616", "0.56750697", "0.5661514", "0.56589", "0.561813", "0.5617699", "0.55932224...
0.7641497
1
Returns the Saved news object data in serializable format
def serialize(self): return { "id": self.id, "headline": self.headline, "url": self.url, "image": self.image, "shortDescription": self.shortDescription, "saved": True, "date": self.date, "savedDate": self.savedDate ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialized_data(self):\n return {\n 'id': self.id,\n 'start_time': str(self.start_time),\n 'venue_id': self.venue_id,\n 'venue_name': self.venue.name,\n 'venue_image_link': self.venue.image_link,\n 'artist_id': self.artist_id,\n ...
[ "0.67177093", "0.67075676", "0.66094065", "0.6601732", "0.6585369", "0.6565495", "0.6531196", "0.649494", "0.64723766", "0.64716303", "0.64442974", "0.64352673", "0.6431501", "0.64202684", "0.64165074", "0.64140564", "0.64076835", "0.64070576", "0.6395844", "0.6394233", "0.63...
0.6998519
0
This method is responsible for getting the messages to respond with Also covers analytics events for those messages for e.g. click, view
def respond_to_message(self): MessageEventHandler(self.state, self.meta_data, self.message_data).handle_events(events=self.events) data = Converter(self.state).get_messages(meta_data=self.meta_data, message_data=self.message_data) outgoing_messages = data.get("messages", []) events_to_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_messages(self):\n pass", "def handle_message(self, message):", "def handle_messages():\n print(\"Handling Messages\")\n payload = request.get_data()\n for sender, incoming_message, payload in messaging_events(payload):\n # The following statements check which options the user...
[ "0.64154905", "0.63751894", "0.635842", "0.62978166", "0.6275776", "0.62662673", "0.6228096", "0.6210156", "0.6176662", "0.6156185", "0.6149644", "0.61168385", "0.60755175", "0.6055626", "0.6054083", "0.6031606", "0.6029565", "0.6019241", "0.5985364", "0.5980711", "0.59471154...
0.69531924
0
Given the vm data from the API, create a dictionary that contains all of the necessary keys for the template The keys will be checked in the update method and not here, this method is only concerned with fetching the data that it can.
def _get_template_data(vm_data: Dict[str, Any], span: Span) -> Optional[Dict[str, Any]]: vm_id = vm_data['id'] Windows.logger.debug(f'Compiling template data for VM #{vm_id}') data: Dict[str, Any] = {key: None for key in Windows.template_keys} data['vm_identifier'] = f'{vm_data["project...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_template_data(vm_data: Dict[str, Any], span: Span) -> Optional[Dict[str, Any]]:\n vm_id = vm_data['id']\n Windows.logger.debug(f'Compiling template data for VM #{vm_id}')\n data: Dict[str, Any] = {key: None for key in Windows.template_keys}\n\n data['vm_identifier'] = f'{vm_dat...
[ "0.69213694", "0.6188512", "0.6179154", "0.6003007", "0.5900166", "0.58198947", "0.58040434", "0.5778774", "0.5772093", "0.5710987", "0.5700737", "0.56920326", "0.56712186", "0.566643", "0.564755", "0.56175077", "0.56043386", "0.5603194", "0.55743086", "0.5572557", "0.5553227...
0.7405127
0
This runs instead of most of nextEvent when Shared_Board is True and there are ambiguous wild cards. It is looking for key strokes to designate ambiguous wild cards in runs. The mouse is ignored until you designate all the wilds (turn phase goes back to play).
def nextEventWildsOnBoard(self): if self.controller._state.rules.Shared_Board and self.num_wilds > 0: for self.event in pygame.event.get(): if self.event.type == pygame.QUIT: # The window crashed, we should handle this print("pygame crash, AAA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nextEvent(self):\n\n if self.controller._state.rules.Shared_Board:\n self.num_wilds = len(self.controller.unassigned_wilds_dict.keys())\n if self.num_wilds > 0:\n self.nextEventWildsOnBoard()\n\n for self.event in pygame.event.get():\n if self.event...
[ "0.7081879", "0.6245746", "0.61995095", "0.61223036", "0.5956481", "0.58805364", "0.5852858", "0.5740237", "0.57229996", "0.57229334", "0.57194364", "0.571404", "0.5688867", "0.56664747", "0.5663727", "0.56603277", "0.56460625", "0.5638092", "0.5631298", "0.5616782", "0.56125...
0.7606982
0
This submits the next user input to the controller, In games with Shared_Board = False (e.g. HandAndFoot) key strokes don't do anything unless designating values for prepared wild cards, at which time the mouse is ignored unless you want to clear the prepared cards. In games with Shared_Board = True wilds on board migh...
def nextEvent(self): if self.controller._state.rules.Shared_Board: self.num_wilds = len(self.controller.unassigned_wilds_dict.keys()) if self.num_wilds > 0: self.nextEventWildsOnBoard() for self.event in pygame.event.get(): if self.event.type == pyga...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nextEventWildsOnBoard(self):\n\n if self.controller._state.rules.Shared_Board and self.num_wilds > 0:\n for self.event in pygame.event.get():\n if self.event.type == pygame.QUIT:\n # The window crashed, we should handle this\n print(\"pygam...
[ "0.72409004", "0.64886266", "0.6171364", "0.59191036", "0.59139985", "0.5860547", "0.57915825", "0.5791442", "0.5777218", "0.57734597", "0.5769721", "0.5763385", "0.5751395", "0.5743939", "0.5728276", "0.5692042", "0.56845224", "0.5682954", "0.56781256", "0.56780386", "0.5671...
0.6859589
1
Confirm a user is sure about a discard and then perform it once confirmed.
def discardConfirmation(self, confirmed, wrapped_discards): discards = [] for element in wrapped_discards: discards.append(element.card) if self.discards != discards: confirmed = False self.discards = discards if not confirmed: self.control...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm_with_abort() -> None:\n\n click.confirm(\n \"Are you sure you want to drop the users table?\",\n abort=True\n )\n\n click.echo(\"We have gotten to this point, so the user has confirmed.\")", "def action_confirm(self):\n self.check_txt_ids()\n self.write({'state': ...
[ "0.6619172", "0.65421534", "0.63608795", "0.6252194", "0.62353194", "0.6222551", "0.61789745", "0.6149395", "0.61379594", "0.6117161", "0.6086858", "0.6077924", "0.6073165", "0.60582376", "0.60207057", "0.60002977", "0.59929824", "0.5937757", "0.593176", "0.59203535", "0.5888...
0.72036105
0
Test Category model data insertion/types/field attributes
def test_category_model_entry(self): # PRUEBA DE CARGAR LA INFORMACION EN LOS MODELOS A TESTEAR data = self.data1 self.assertTrue(isinstance(data, Category)) # REALIZA EL TESTEO
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_category_model_entry(self):\n data = self.data1\n self.assertTrue(isinstance(data, Category))\n self.assertEqual(str(data), 'django')", "def test_create_category(self):\n pass", "def test_category_has_access_to_model_data():\n category = Category()\n category_data = c...
[ "0.7511274", "0.74611753", "0.7387198", "0.7346792", "0.7272893", "0.721909", "0.6904485", "0.69011027", "0.6842334", "0.67509025", "0.67248386", "0.6717649", "0.6624068", "0.656367", "0.6542668", "0.6540674", "0.65404874", "0.6470544", "0.646362", "0.64630693", "0.64449406",...
0.80247825
0
Test product model data insertion/types/field attributes
def test_products_model_entry(self): data = self.data1 self.assertTrue(isinstance(data, Product)) self.assertEqual(str(data), 'django beginners')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_product_fields(self):\n\n prd = Product.objects.get(id=1)\n\n # test the type of name field\n prd_type = prd._meta.get_field('name').get_internal_type()\n self.assertEqual(prd_type, 'CharField')\n # label name\n max_length = prd._meta.get_field('name').max_length\...
[ "0.76896816", "0.7435254", "0.74246174", "0.73524946", "0.71989226", "0.7134408", "0.6947085", "0.69248456", "0.68103576", "0.67975587", "0.67713046", "0.67241883", "0.6704033", "0.66982996", "0.6688978", "0.66654783", "0.66048956", "0.659939", "0.6586787", "0.6566571", "0.65...
0.7449101
1
Returns the total, nonblank and net loc for all the python files in a directory
def get_folder_total(path): files = os.listdir(path) pythonfiles = ['%s/%s' % (path, filename) for filename in files if filename[-3:] == '.py'] total = { 'net': 0, 'total': 0, 'nonblank': 0, 'num_inputs':0 } for filename in pythonfiles: with open(filename, 'r') as thisfile: blob = th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loc():\n file_types = (\n ['Python', 'py', '#']\n )\n\n click.echo('Lines of code\\n-------------')\n\n click.echo(\"{0}: {1}\".format(file_types[0], count_locs(file_types[1],\n file_types[2])))\n\n return None", "def analyze_file...
[ "0.63941246", "0.6148792", "0.5896523", "0.5792946", "0.56846035", "0.5674842", "0.56738776", "0.56557024", "0.5595728", "0.55465335", "0.55265635", "0.5509024", "0.5490125", "0.54562646", "0.53724253", "0.53600603", "0.53305817", "0.5296591", "0.52905095", "0.52354455", "0.5...
0.6992177
0
Get vertices dividing a 1d grid.
def get_1d_vertices(grid, cut_edges=False): if len(grid.shape) > 1: raise ValueError("grid must be 1d array.") diff = np.diff(grid) vert = np.zeros(grid.size+1) # Interior vertices: halfway between points vert[1:-1] = grid[0:-1] + diff/2 # Edge vertices: tight or reflect if cut_edge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vertices(self):\n try:\n return self._vertices\n except:\n self._vertices = [list(x) for x in self.vertex_generator()]\n return self._vertices", "def vertices(self):\n\n if self._faces is None:\n if self._vertices is None:\n retu...
[ "0.6591957", "0.65517676", "0.6523746", "0.6520511", "0.64833", "0.64833", "0.64218307", "0.6383808", "0.6376488", "0.63350326", "0.6328131", "0.63177186", "0.6316762", "0.6278034", "0.6251261", "0.6179584", "0.61629945", "0.6152223", "0.61260945", "0.6122966", "0.6108887", ...
0.76482964
0
Compute padded image limits for x and y grids.
def pad_limits(xgrid, ygrid, xpad=0., ypad=0., square=None): xmin, xmax = xgrid.min(), xgrid.max() ymin, ymax = ygrid.min(), ygrid.max() dx = xmax - xmin dy = ymax - ymin x0 = xmin - xpad*dx x1 = xmax + xpad*dx y0 = ymin - ypad*dy y1 = ymax + ypad*dy if square: axis = squar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_image_bounds(pixel_meter_size, frame, beam_width_data, additional_pixel_padding_x=0, additional_pixel_padding_y=0):\n\n # Compute the projected locations of all samples so that we can get the extent\n all_bl = []\n all_br = []\n all_fr = []\n all_fl = []\n\n for beam_num in [0, frame....
[ "0.6500194", "0.6199433", "0.6105291", "0.60281", "0.59161913", "0.5894251", "0.585068", "0.58396924", "0.5810349", "0.5791982", "0.57880354", "0.5763434", "0.57571024", "0.57165116", "0.57111406", "0.5668063", "0.56606424", "0.565698", "0.56563175", "0.5641682", "0.5641682",...
0.7511422
0
Generate a object formatter for links..
def link(text, link_func): def object_formatter(v, c, m, p): """Format object view link.""" return Markup('<a href="{0}">{1}</a>'.format( link_func(m), text)) return object_formatter
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object_formatter(v, c, m, p):\n return Markup('<a href=\"{0}\">{1}</a>'.format(\n link_func(m), text))", "def __repr__(self):\n if self.rest:\n rest_repr = ', ' + repr(self.rest)\n else:\n rest_repr = ''\n return 'Link({0}{1})'.format(self.first, r...
[ "0.784745", "0.6504912", "0.64552146", "0.6426217", "0.62232155", "0.6217698", "0.60861593", "0.60861593", "0.60610193", "0.60496616", "0.5940354", "0.59321237", "0.5914688", "0.58717525", "0.5870953", "0.5845969", "0.5824419", "0.58027077", "0.57641745", "0.57560444", "0.573...
0.72780514
1
Format object view link.
def object_formatter(v, c, m, p): return Markup('<a href="{0}">{1}</a>'.format( link_func(m), text))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link(text, link_func):\n def object_formatter(v, c, m, p):\n \"\"\"Format object view link.\"\"\"\n return Markup('<a href=\"{0}\">{1}</a>'.format(\n link_func(m), text))\n return object_formatter", "def link(self, obj):\n return format_html(\n '<a href=\"{url...
[ "0.73224676", "0.7216829", "0.7124374", "0.68019325", "0.65847546", "0.64726907", "0.64016116", "0.63936055", "0.6361755", "0.635381", "0.63412184", "0.63111347", "0.6248648", "0.6244252", "0.61723745", "0.61185104", "0.6079688", "0.6079688", "0.60349536", "0.6026926", "0.601...
0.75110674
0
Returns a list of the currently connected playes (on the MC server). First tries to hit the cache to see if this has been checked recently. If there is no cache entry, queries the Minecraft server's zombiepygman API to get the list of currently connected players.
def _get_connected_player_list(self): if not zpgapi.is_zgp_api_enabled(): # API is not configured, skip this. return [] cache_key = 'api_connected_players' cache_val = cache.get(cache_key) if cache_val != None: return cache_val ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_players(self):\n return self.server.status().players.online", "def get_players():\n nfl_players = redis_cache('nfl_players_key', NFL_Player_2015.query.all)\n return nfl_players", "def players(self):\n return self.currents.player", "def get_players(self):\n\n # Append the cu...
[ "0.7143071", "0.68768233", "0.6365127", "0.635414", "0.62231076", "0.60774004", "0.6067745", "0.60203606", "0.6001943", "0.5917321", "0.5900113", "0.58974326", "0.5869177", "0.5867893", "0.5851105", "0.58382463", "0.5821852", "0.57409716", "0.5719336", "0.57017183", "0.565462...
0.82015663
0
Ensure the value of 'done' is set to False when creating an item
def test_done_default_value_is_False(self): item = Item(name = "A test item") self.assertEqual(item.name, "A test item") self.assertFalse(item.done)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_done_value_can_be_set_to_True(self):\n item = Item(name = \"A test item\", done = True)\n self.assertEqual(item.name, \"A test item\")\n self.assertTrue(item.done)", "def test_create(self):\n Todo = self.env[\"todo.task\"]\n task = Todo.create({'name': 'Test Task'})\n ...
[ "0.73595536", "0.69080955", "0.6256873", "0.6184523", "0.61320096", "0.60282576", "0.6025874", "0.59891725", "0.58720154", "0.5870808", "0.58685875", "0.5864126", "0.5850043", "0.5843042", "0.580223", "0.5788047", "0.5772935", "0.5769292", "0.5767891", "0.5756782", "0.5730310...
0.7237571
1
Ensure the value of 'done' is True when set to True when creating an item
def test_done_value_can_be_set_to_True(self): item = Item(name = "A test item", done = True) self.assertEqual(item.name, "A test item") self.assertTrue(item.done)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_done_default_value_is_False(self):\n item = Item(name = \"A test item\")\n self.assertEqual(item.name, \"A test item\")\n self.assertFalse(item.done)", "def test_create(self):\n Todo = self.env[\"todo.task\"]\n task = Todo.create({'name': 'Test Task'})\n self.as...
[ "0.7198816", "0.6800873", "0.65567577", "0.6417597", "0.6363705", "0.6359525", "0.6172014", "0.6137984", "0.61083496", "0.6047177", "0.60278106", "0.6007678", "0.59839237", "0.59442586", "0.590649", "0.5906427", "0.5846286", "0.5799823", "0.5794618", "0.5780171", "0.57660437"...
0.76738805
0
Ensure the string value of the object is equal to the item name
def test_object_name_is_equal_to_item_name(self): item = Item(name = "A test item") self.assertEqual(str(item), "A test item")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_str(self):\n item = self.item\n\n self.assertEqual(str(item), self.item_raw['name'])", "def _valid_object_with_name(ui_object):\n return ui_object.obj_name", "def test_name(self):\n self.assertTrue(type(x.name) == str)", "def test_values_single(self):\n input_item = self...
[ "0.72171146", "0.6880246", "0.6773977", "0.6383563", "0.6352", "0.6319917", "0.62903845", "0.6150476", "0.60850054", "0.60359854", "0.60222614", "0.5974848", "0.5964395", "0.59447414", "0.5942534", "0.59195846", "0.59191364", "0.5898834", "0.58966243", "0.5865687", "0.5844299...
0.7843017
0
Create a postvalidator function that makes sure the value of this item is a key in the sibling dictionary 'sib_name'. Raises a ValueError if not. This generally assumes siblings[sib_name] is a required CategoryElement.
def is_sib_key(sib_name): def is_sib_key_val(siblings, value): if value not in siblings[sib_name].keys(): raise ValueError( "Must be a key of {}, but got {}" .format(sib_name, value)) return value return is_sib_key_val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self):\n for search_tag_name in self.get_search_tag_names():\n search_tag_obj = Tag(search_tag_name)\n for search_tag_value in self.get_search_tag_values(search_tag_name):\n for new_tag_name in self.get_new_tag_names(search_tag_name, search_tag_value):\n ...
[ "0.45828247", "0.4572428", "0.45380762", "0.44724888", "0.42696497", "0.42584473", "0.42416134", "0.41420826", "0.41245428", "0.41224957", "0.4097658", "0.4080648", "0.40750405", "0.40694186", "0.40613383", "0.4061312", "0.40393326", "0.40243196", "0.3988627", "0.3969611", "0...
0.62593156
0
get requirements file line.
def get_line(self): # type: () -> str line = "{}=={}".format(self.name, self.version) if self.type != RequirementType.LATEST_VERSION: line += ' # ' + TEMPLATES[self.type] if self.type == RequirementType.NOT_LATEST_VERSION: line = line.replace(r'(\S*)', sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_line(self, path, line):\n\t\tlines = self.find_source(path)\n\t\tif lines == None:\n\t\t\treturn None\n\t\telse:\n\t\t\ttry:\n\t\t\t\treturn lines[line - 1]\n\t\t\texcept IndexError:\n\t\t\t\treturn None", "def find_requirements():\n with open(\"requirements.txt\", 'r') as f:\n return f.read()....
[ "0.6740572", "0.6701391", "0.65815175", "0.64647526", "0.6415879", "0.6412485", "0.6349819", "0.63256943", "0.63117", "0.6291996", "0.62328476", "0.6201596", "0.6177119", "0.6160064", "0.6157574", "0.615133", "0.6138522", "0.6128042", "0.6090447", "0.6074949", "0.6072613", ...
0.6781809
0
Split line on text and comment
def split_line(self, line): # type: (str) -> tuple parts = [s.strip() for s in line.split('#', 1)] package = parts[0] comment = parts[1] if len(parts) >= 2 else '' return package, comment
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_comment(cls, code):\r\n if '#' not in code: return code\r\n #: Remove comments only (leave quoted strings as they are)\r\n subf = lambda m: '' if m.group(0)[0]=='#' else m.group(0)\r\n return re.sub(cls.re_pytokens, subf, code)", "def to_multi_line_comment(text: str) -> str:...
[ "0.6692685", "0.66081315", "0.65925145", "0.6545137", "0.6362264", "0.6226867", "0.62236226", "0.6117526", "0.6067819", "0.60001516", "0.59967846", "0.5966611", "0.59597796", "0.5954498", "0.59440887", "0.59440887", "0.5927107", "0.5925445", "0.59013635", "0.5877957", "0.5875...
0.6687648
1
Calculate cosine distance between two vector
def findCosineDistance(vector1, vector2): vec1 = vector1.flatten() vec2 = vector2.flatten() a = np.dot(vec1.T, vec2) b = np.dot(vec1.T, vec1) c = np.dot(vec2.T, vec2) return 1 - (a / (np.sqrt(b) * np.sqrt(c)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cosine_distance(u, v):\n #print u,v\n return numpy.dot(u, v) / (math.sqrt(numpy.dot(u, u)) * math.sqrt(numpy.dot(v, v)))", "def cosine_distance(u, v):\n return numpy.dot(u, v) / (math.sqrt(numpy.dot(u, u)) * math.sqrt(numpy.dot(v, v)))", "def cosine_similarity(v1: Vector, v2: Vector) -> float:\n ...
[ "0.8144758", "0.806103", "0.7972851", "0.79563916", "0.7951864", "0.77495205", "0.7739488", "0.7737394", "0.7714112", "0.7667365", "0.76573527", "0.7630341", "0.7616587", "0.76105106", "0.76048666", "0.7574436", "0.7551911", "0.7540636", "0.7515504", "0.7509719", "0.7507556",...
0.8303037
0
Add index operation with name to the operations given.
def add_index_operation(self, name, operations): if name not in self._index_operations: self._add_io(name, operations) else: raise AttributeError("An index operation with the name {} was already taken".format(name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_index(self, name, func):\n assert name not in self.indices\n info_name = 'index:%s:%s' % (self.info['name'], name)\n info = self.store._get_info(info_name, index_for=self.info['name'])\n index = Index(self, info, func)\n self.indices[name] = index\n if IndexKeyBuil...
[ "0.68858343", "0.6698154", "0.64274466", "0.6417586", "0.63482445", "0.6007961", "0.5947242", "0.5861968", "0.5853543", "0.57812166", "0.57532567", "0.57404816", "0.57012236", "0.5667653", "0.5642528", "0.5634883", "0.56331265", "0.5619371", "0.55785316", "0.5549118", "0.5546...
0.85664165
0
Return the offset of the param inside this parameterized object. This does not need to account for shaped parameters, as it basically just sums up the parameter sizes which come before param.
def _offset_for(self, param): if param.has_parent(): p = param._parent_._get_original(param) if p in self.parameters: return reduce(lambda a,b: a + b.size, self.parameters[:p._parent_index_], 0) return self._offset_for(param._parent_) + param._parent_._offset_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def offset(self):\n return self.__offset", "def offset(self):\n return self.__offset", "def get_offset(self):\n return self.offset", "def wm_offset(self):\n return self.get_par(\"offset\")", "def offset(self):\n return self._offset", "def offset(self):\n return self....
[ "0.65088356", "0.65088356", "0.6396925", "0.63015145", "0.6291252", "0.6291252", "0.6291252", "0.6291252", "0.6291252", "0.6291252", "0.6291252", "0.62532693", "0.62532693", "0.62532693", "0.62496376", "0.62265295", "0.61739165", "0.61539537", "0.61539537", "0.61539537", "0.6...
0.79988617
1
get the raveled index for a param that is an int array, containing the indexes for the flattened param inside this parameterized logic. !Warning! be sure to call this method on the highest parent of a hierarchy, as it uses the fixes to do its work
def _raveled_index_for(self, param): from ..param import ParamConcatenation if isinstance(param, ParamConcatenation): return np.hstack((self._raveled_index_for(p) for p in param.params)) return param._raveled_index() + self._offset_for(param)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _raveled_index_for(self, param):\n from .param import ParamConcatenation\n if isinstance(param, ParamConcatenation):\n return np.hstack((self._raveled_index_for(p) for p in param.params))\n return param._raveled_index() + self._offset_for(param)", "def _raveled_index_for_trans...
[ "0.71273017", "0.6010891", "0.59065056", "0.5804188", "0.58011395", "0.57862777", "0.57440937", "0.57440937", "0.57353306", "0.56626016", "0.56598043", "0.5625494", "0.5600237", "0.5588847", "0.5567432", "0.55587304", "0.55522966", "0.554781", "0.55181646", "0.5507306", "0.55...
0.71871
0
Helper preventing copy code. This adds the given what (transformation, prior etc) to parameter index operations which. reconstrained are reconstrained indices. warn when reconstraining parameters if warning is True.
def _add_to_index_operations(self, which, reconstrained, what, warning): if warning and reconstrained.size > 0: # TODO: figure out which parameters have changed and only print those print("WARNING: reconstraining parameters {}".format(self.hierarchy_name() or self.name)) index = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warn_inplace(exc, nav, repl_pairs, local_opt):\r\n if isinstance(exc, InconsistencyError):\r\n return\r\n return NavigatorOptimizer.warn(exc, nav, repl_pairs, local_opt)", "def ensure_default_constraints(self,warn=False):\n positive_strings = ['variance','lengthscale', 'precis...
[ "0.6421251", "0.57638377", "0.53960013", "0.5364344", "0.52853006", "0.52772886", "0.52772886", "0.52772886", "0.52637357", "0.52537453", "0.52390754", "0.5176815", "0.51558375", "0.514963", "0.51430506", "0.5140084", "0.5106313", "0.5041951", "0.49778527", "0.4977233", "0.49...
0.71344423
1
Helper preventing copy code. Remove given what (transform prior etc) from which param index ops.
def _remove_from_index_operations(self, which, transforms): if len(transforms) == 0: transforms = which.properties() removed = np.empty((0,), dtype=int) for t in list(transforms): unconstrained = which.remove(t, self._raveled_index()) removed = np.union1d(remo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _remove_operator(self, operator):", "def remove_extra_index_from_context_actions(context_action_dict):\n keys_to_keep = {'initial_value', 'replacement_value'}\n for question in context_action_dict:\n for obj_dct in context_action_dict[question]:\n total_keys = set(obj_dct.keys())\n ...
[ "0.5864179", "0.57993364", "0.5767263", "0.5759645", "0.57012475", "0.5697558", "0.5676129", "0.56178457", "0.559176", "0.55809194", "0.5571276", "0.5533166", "0.5462391", "0.5455604", "0.54388994", "0.54100037", "0.539974", "0.5399218", "0.53672886", "0.53319484", "0.5327874...
0.65478945
1
Emit a JSON representation of a given row
def format(self, row): return json.dumps(row.print_fields)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, row: Optional[Any] = None):\n self.fout.write('{}\\n'.format(json.dumps(row, cls=self.encoder)))", "def row_to_json(row: sqlite3.Row) -> str:\n d = {}\n for key in row.keys():\n d[key] = row[key]\n\n return json.dumps(d)", "def __data_row_to_json(self, row):\n raw_...
[ "0.745525", "0.7241681", "0.72320414", "0.6897235", "0.68846", "0.6736316", "0.65954936", "0.65526325", "0.6160118", "0.61541754", "0.6141491", "0.61156374", "0.6115557", "0.6070374", "0.60693794", "0.6057097", "0.5938166", "0.5934188", "0.58886075", "0.58313084", "0.5826782"...
0.7718322
0
Creates a dictonary of nodes listed by currie id from answers 1 and 2
def make_node_dict(self): if self.input1 is None or self.input2 is None: raise Exception("Missing input: please run the populate() method first") self.node_dict1 = {} for node in self.input1['knowledge_graph']['nodes']: self.node_dict1[node['id']] = node self.node...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_nodes_by_id(ntwrk, nodeid):\r\n return {k: v for el in ntwrk\r\n for k, v in el.items() if k == nodeid}", "def node_diff(self):\n if self.input1 is None or self.input2 is None:\n raise Exception(\"Missing input: please run the populate() method first\")\n if s...
[ "0.5874153", "0.5803899", "0.5788026", "0.5769955", "0.56848216", "0.56081706", "0.5563815", "0.55347794", "0.5533629", "0.55147934", "0.5420318", "0.53809404", "0.53226113", "0.53205335", "0.52443105", "0.52339405", "0.5148043", "0.5130552", "0.5121005", "0.5114256", "0.5098...
0.60742897
0
Runs through all of the nodes in the json responses storing the intersection and set differences into a dictonary organized by tuples of node ids or the tuple (1, 1) for all nodes.
def node_diff(self): if self.input1 is None or self.input2 is None: raise Exception("Missing input: please run the populate() method first") if self.node_dict1 is None or self.node_dict2 is None: self.make_node_dict() # Initialize dictonaries to keep track of the nodes in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_sets_intersection_test(self, data):\n\n data_info = self.get_data_info(data)\n finished = []\n\n for part in data:\n for union_part in data:\n if part != union_part and union_part not in finished:\n data[part].intersection(data[union_part])...
[ "0.57611847", "0.57074016", "0.5648599", "0.5608913", "0.55996966", "0.54121363", "0.539312", "0.5247284", "0.5185026", "0.51842594", "0.51647484", "0.51572686", "0.51484066", "0.5144395", "0.5093303", "0.5067902", "0.5056289", "0.5055382", "0.5027136", "0.5016611", "0.500497...
0.6736763
0
Reproducing kernel Calculate the inverse FunkRadon transform of reproducing kernel for the space of spherical harmonics of maximum degree N.
def inv_funk_radon_kernel(mu, N): # Check that -1 <= mu <= 1 mu = np.clip(mu, -1, 1) # Need Legendre polynomials legPolys = legp(mu, N) p_at_zero = legp(0, N) coefs = 2*np.arange(0, N+1, 2) + 1 ker = coefs*legPolys[::2]/p_at_zero[::2] return ker.sum() / (8*np.pi)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inv_funk_radon_even_kernel(mu, N):\n\n # Check that -1 <= mu <= 1\n mu = np.clip(mu, -1, 1)\n\n # Need Legendre polynomials\n legPolys = legp(mu, N)\n p_at_zero = legp(0, N)\n\n coefs_num = 2*np.arange(0, N+1) + 1\n coefs_den = np.arange(2,N+1,2) * (np.arange(2,N+1,2) + 1)\n\n ker = coe...
[ "0.7213641", "0.63983333", "0.61867654", "0.61385816", "0.61052585", "0.60678124", "0.6047397", "0.59877527", "0.598379", "0.59239495", "0.584012", "0.5723425", "0.57071584", "0.5696312", "0.55959344", "0.556116", "0.5512384", "0.5488459", "0.5458828", "0.5453336", "0.543654"...
0.7255298
0
Reproducing kernel Calculate inverse FunkRadon transform and inverse spherical Laplacian of reproducing kernel for even degree subspace of spherical harmonics of maximum degree N, i.e., calculates H(\mu) = \Delta^1 G^1 K_e(\mu), where \Delta is the spherical Laplacian and G is the FunkRadon transporm. The calculation i...
def inv_funk_radon_even_kernel(mu, N): # Check that -1 <= mu <= 1 mu = np.clip(mu, -1, 1) # Need Legendre polynomials legPolys = legp(mu, N) p_at_zero = legp(0, N) coefs_num = 2*np.arange(0, N+1) + 1 coefs_den = np.arange(2,N+1,2) * (np.arange(2,N+1,2) + 1) ker = coefs_num[2::2]*legP...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inv_funk_radon_kernel(mu, N):\n\n # Check that -1 <= mu <= 1\n mu = np.clip(mu, -1, 1)\n\n # Need Legendre polynomials\n legPolys = legp(mu, N)\n p_at_zero = legp(0, N)\n coefs = 2*np.arange(0, N+1, 2) + 1\n ker = coefs*legPolys[::2]/p_at_zero[::2]\n return ker.sum() / (8*np.pi)", "de...
[ "0.739296", "0.6562701", "0.65557134", "0.65486634", "0.63957083", "0.6381057", "0.6323597", "0.62995636", "0.6100595", "0.59519017", "0.59446114", "0.59294933", "0.59197277", "0.5910358", "0.5873097", "0.58403426", "0.5745301", "0.5744658", "0.5742014", "0.57419306", "0.5586...
0.7455563
0
Reproducing kernel Calculate of reproducing kernel for even subspace of spherical harmonics of maximum degree N.
def even_kernel(mu, N): # Check that -1 <= mu <= 1 mu = np.clip(mu, -1, 1) # Need Legendre polynomials legPolys = legp(mu, N) coefs = 2*np.arange(0, N+1) + 1 ker = coefs[0::2]*legPolys[0::2] return ker.sum() / (4.0*np.pi)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def even_kernel_der(mu, N):\n\n # Check that -1 <= mu <= 1\n mu = np.clip(mu, -1, 1)\n\n #Derivatives of Legendre polynomials\n DlegPolys = legp_der(mu, N)\n \n coefs = 2*np.arange(0, N+1) + 1\n \n ker = coefs[0::2]*DlegPolys[0::2] \n\n return ker.sum() / (4.0*np.pi)", "def inv_funk_radon...
[ "0.6827804", "0.67321193", "0.67197824", "0.65318835", "0.6531037", "0.6433048", "0.62198204", "0.6084965", "0.60187733", "0.60123444", "0.59886587", "0.59792995", "0.5959411", "0.59217125", "0.5896507", "0.58899844", "0.5817358", "0.5794526", "0.5773375", "0.5705847", "0.568...
0.7083843
0