query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Sell one fish in your inventory chosen by a specified name and size Prices affected by rarity modifiers
async def sell(self, ctx:commands.Context, name, size): await self.sellall(ctx, 'specific', f'{name} {size}')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def sellall(self, ctx:commands.Context, fish_type:str='', fish_quality:str=''):\r\n\r\n if not fish_type in ['specific', 'name', 'school', 'rarity', '']:\r\n await ctx.send(f'{fish_type} must be one of the following:\\n```name\\nschool\\nrarity```')\r\n return\r\n\r\n all_...
[ "0.658816", "0.63521826", "0.62320566", "0.6212246", "0.6195439", "0.6163087", "0.5955984", "0.5949366", "0.5944461", "0.5921581", "0.5864623", "0.5834307", "0.5759784", "0.57362646", "0.5733804", "0.5728298", "0.57077825", "0.566822", "0.5668064", "0.56453043", "0.5621441", ...
0.7736391
0
Sell all of the fish in your bucket Fish will automatically be sold to valid merchants Can filter by categories (name, school, or rarity) Sale prices are increased for fish from a school you've completed Prices affected by rarity modifiers and school_complete_mod
async def sellall(self, ctx:commands.Context, fish_type:str='', fish_quality:str=''): if not fish_type in ['specific', 'name', 'school', 'rarity', '']: await ctx.send(f'{fish_type} must be one of the following:\n```name\nschool\nrarity```') return all_fish = await self.co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sell_all(self):\n\n from_symbol = self.symbol\n to_symbol = self.currency\n price = self.data[0].close\n amount = self.portfolio['buy_sell_amount'][self.currency]\n date = self.date\n\n if self.slippage:\n slip_factor = (self.data[-1].high - self.data[-1].cl...
[ "0.6112792", "0.5922017", "0.59102553", "0.58273405", "0.57666373", "0.57215554", "0.5645061", "0.5625076", "0.5543856", "0.55328435", "0.5518493", "0.5486257", "0.54659057", "0.5428261", "0.54258066", "0.54080296", "0.53866935", "0.5328948", "0.5327947", "0.52997863", "0.526...
0.8000234
0
Purchase bait to use with cast prices affected by bait_price_mod and bulk_purchase_mod
async def buybait(self, ctx:commands.Context, quantity:int, *bait_type:str): if not await self.IsSpecialized(ctx.guild, ctx.channel.id, SHOP_CHANNEL): await ctx.send('Cannot buy bait here\nUse `add shop` to turn this channel into a shop') return bait_type = ' '.join(bait_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purchase(self, item_type):", "def buy(self, price, volume):\r\n self.order(\"bid\", price, volume)", "def trade(self, action=None):\n #print(\"Trading {}\".format(action))\n # Buy\n if action > 0.2 : self.posture = 1\n # Hold\n if action < 0.2 and action > -0.2: se...
[ "0.6886232", "0.6607025", "0.64934975", "0.60241896", "0.60035247", "0.5941296", "0.59302354", "0.59000635", "0.58302313", "0.58104116", "0.5774722", "0.5711439", "0.5693818", "0.56447804", "0.562465", "0.5609996", "0.5592459", "0.55905706", "0.5580305", "0.55768406", "0.5566...
0.6931416
0
Display your completion percentage of every school (use the school command to get more detailed information about a specific school)
async def schools(self, ctx:commands.Context, member:Member = None): if member is None: member = ctx.message.author embeds = [] member_schools = await self.config.member(member).schools() print(member_schools) display_length = await self.GetSetting(ctx.guild...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __statistics_best_situation(self):\n students_list = self.__grade_controller.get_list_of_students_with_best_situation()\n if len(students_list) == 0:\n print(\"There is no student with a grade!\")\n return\n\n for student in students_list:\n print(str(stude...
[ "0.58460474", "0.5808042", "0.57187593", "0.5698568", "0.5609004", "0.55549574", "0.5528185", "0.5505077", "0.549608", "0.5484342", "0.5468743", "0.54617643", "0.5460946", "0.5454344", "0.54534066", "0.5427118", "0.54151547", "0.5391401", "0.5356463", "0.5352042", "0.5342426"...
0.5910057
0
Display all of your obtained fish in a specific school
async def school(self, ctx:commands.Context, *school_name): school_name = ' '.join(school_name) if not school_name in list(self.fish_schools.keys()): await ctx.send(f'{school_name} is not a valid school') return curr_school = self.fish_schools[school_name] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_school():\n if current_user.is_administrator():\n schools = School.query.order_by(School.long_name)\n else:\n schools = current_user.schools_coached\n\n # if initial get request, render add_school.html\n return render_template('choose_school.html', schools=schools)", "async d...
[ "0.6135468", "0.5999562", "0.59924406", "0.5975256", "0.59099156", "0.5878306", "0.5703355", "0.56727314", "0.565807", "0.55854195", "0.5557434", "0.55572337", "0.5554035", "0.55434054", "0.5498167", "0.54382086", "0.54246515", "0.5367391", "0.5365888", "0.5359602", "0.533951...
0.67277
0
Modify various settings used by fishing
async def fishingsettings(self, ctx:commands.Context):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iniitialize_dynamic_settings(self):\n\t\tself.speed_factor = 1.5\n\t\tself.bullet_speed_factor = 3\n\t\tself.alien_speed_factor = 1\n\n\t\t# fleet_direction of 1 represents right; -1 represents left. \n\t\tself.fleet_direction = 1", "def update_settings(self):\n settings = {\n \"reference\"...
[ "0.6475052", "0.6378027", "0.6329654", "0.630778", "0.6306532", "0.63065314", "0.6230689", "0.6115725", "0.60704213", "0.6046115", "0.60442805", "0.59416527", "0.58606344", "0.5817816", "0.57655704", "0.5748576", "0.5730808", "0.57159686", "0.57140666", "0.5683879", "0.568081...
0.7662924
0
Change values for timers and similar settings used by the cog
async def changesetting(self, ctx:commands.Context, setting, new_value: int): settings = await self.config.guild(ctx.guild).settings() if not settings.get(setting): await ctx.send(f'{setting} is not a valid setting\n```Valid settings:\nfishing_delay: Length (seconds) between casts fro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timer_setup(self):\n pass", "def set_throttle_timer(self, view, value):\n for cls in view.throttle_classes:\n cls.timer = lambda self: value", "def setup_timers():\n cfg_section = 'Timers'\n # Timer1\n name = 'Timer_mqtt'\n c_period = float(config.option('period_mqtt', ...
[ "0.6512214", "0.61067474", "0.6089995", "0.60644996", "0.6058134", "0.6032505", "0.59452313", "0.58926195", "0.5889013", "0.5859946", "0.58295083", "0.57871264", "0.5746872", "0.5733588", "0.5718087", "0.5695202", "0.5691744", "0.5661278", "0.5640012", "0.5618772", "0.5618067...
0.0
-1
Set modifiers for prices within the cog
async def changemodifier(self, ctx:commands.Context, mod:str, new_value:int): mods = await self.config.guild(ctx.guild).value_modifiers() if not mods.get(mod): await ctx.send(f'{mod} is not a valid modifier\n```Available modifiers:\nFish values:\ncommon\nrare\nabyssal```') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __create_update_price_modifiers(key, value, modifier_map):\n (_, identifier, field_name) = validate.regex_match_modifiers(key)\n\n modifier = modifier_map.get(identifier, dict())\n\n if value is not None and not value.isalpha():\n value = value.replace('$', '')\n value = validate.is_vali...
[ "0.64837945", "0.5973431", "0.5895524", "0.564905", "0.559698", "0.5576284", "0.5448824", "0.5448824", "0.5410199", "0.53854036", "0.5285329", "0.52712774", "0.5267689", "0.5249317", "0.52335227", "0.52335227", "0.52335227", "0.52335227", "0.522147", "0.51983523", "0.5154663"...
0.48607576
38
Make a profile catch exclusively Sea Bass
async def bryanmode(self, ctx:commands.Context, member: Member, enabled: bool): await self.config.member(member).bryan_mode.set(enabled) await ctx.send(f'{member.mention} has bryan mode set to {enabled}')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _should_profile(self) -> bool:\n if \"profile\" in self._allowed_plugins:\n if not self._one_shot:\n raise ValueError(\n \"Profile plugin currently only supported for one shot.\"\n )\n logger.info(\"Profile plugin is enalbed.\")\n ...
[ "0.6005656", "0.5688947", "0.5668254", "0.5527675", "0.5507394", "0.5488788", "0.5415933", "0.5379828", "0.5379472", "0.53589666", "0.52888966", "0.5264464", "0.525113", "0.523389", "0.518869", "0.5166509", "0.51656634", "0.5156091", "0.51377076", "0.51319677", "0.510483", ...
0.0
-1
If the cog gets shut down in the middle of a cast a user can get locked out of fishing, this fixes it
async def resettimer(self, ctx:commands.Context, member: Member = None): await self.config.member(member if not member == None else ctx.message.author).currently_fishing.set(False) await ctx.send('Fishing cooldown reset')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cog_unload(self):\n\n self._check_to_send_cookie.cancel()", "def update(self):\n if self.bunker_health == 0:\n self.kill()", "def just_died(self):\r\n self.dead = True", "async def shutdown(self, ctx):\n if ctx.author.id == int(cfload.configSectionMap('Owner Credent...
[ "0.5801518", "0.57327765", "0.56845856", "0.5664485", "0.5639712", "0.5635289", "0.55996174", "0.5575853", "0.5572584", "0.5566643", "0.5450909", "0.5439034", "0.54304796", "0.541446", "0.5406383", "0.5403297", "0.53733003", "0.53730935", "0.53623754", "0.53147614", "0.531292...
0.0
-1
Register or update a table. Some implementing classes may require column information to also be provided. The added table must have the necessary number of qualifiers in its path to match the schema's nesting level.
def add_table( self, table: exp.Table | str, column_mapping: t.Optional[ColumnMapping] = None, dialect: DialectType = None, normalize: t.Optional[bool] = None, match_depth: bool = True, ) -> None:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_table(self, table):\n\n self._db_manager.register_table(table)", "def add_table(self, name):\n raise NotImplementedError(\n \"Please implement the 'add_table' method in a derived class.\")", "def install(cls):\n return cls.interface.set_table(cls.schema)", "def regi...
[ "0.69186026", "0.64221174", "0.6126137", "0.60864323", "0.604655", "0.59777266", "0.5955453", "0.5943477", "0.5871837", "0.5858177", "0.585505", "0.5813016", "0.5722131", "0.5648839", "0.5621529", "0.55864596", "0.55618095", "0.5555854", "0.55466276", "0.55347514", "0.5507931...
0.63572854
2
Get the column names for a table.
def column_names( self, table: exp.Table | str, only_visible: bool = False, dialect: DialectType = None, normalize: t.Optional[bool] = None, ) -> t.List[str]:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_column_names(self, table):\n try:\n logging.info(f'Getting column names of table `{table}`')\n return list(self.execute(f'SELECT * FROM `{table}`'))\n except:\n logging.exception('Something went wrong getting column names. Check trace.')\n return", ...
[ "0.8756207", "0.83754176", "0.82285607", "0.7912641", "0.78543603", "0.7848229", "0.7780093", "0.7767077", "0.7762207", "0.7748659", "0.77375937", "0.7732724", "0.77221346", "0.768008", "0.75873166", "0.75750923", "0.75518394", "0.754936", "0.75139666", "0.75123733", "0.74906...
0.7909959
4
Get the `sqlglot.exp.DataType` type of a column in the schema.
def get_column_type( self, table: exp.Table | str, column: exp.Column, dialect: DialectType = None, normalize: t.Optional[bool] = None, ) -> exp.DataType:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_postgres_column_type(\n self, tablename: str, column_name: str\n ) -> str:\n return self.get_postgres_column_definition(\n tablename=tablename, column_name=column_name\n ).data_type.upper()", "def get_data_type(col_val):\n dtype = \"\"\n\n original_col_val = col_v...
[ "0.7730265", "0.7696099", "0.73876876", "0.72716093", "0.71338415", "0.70155656", "0.6958082", "0.6940547", "0.6886838", "0.68727636", "0.67603856", "0.67428154", "0.67064464", "0.67043954", "0.6693943", "0.6691234", "0.6677616", "0.6676066", "0.6651016", "0.6613417", "0.6550...
0.7796341
0
Table arguments this schema support, e.g. `("this", "db", "catalog")`
def supported_table_args(self) -> t.Tuple[str, ...]:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_table(self):", "def __init__(self, table_id='', columns=(),\n file_name='', table_data=(), verbose=True):\n self.table_id = table_id\n self.columns = list(columns)\n self.file_name = file_name\n self.table_data = list(table_data)\n self.verbose = verbose", "def __get_datatab...
[ "0.610192", "0.6069731", "0.5908132", "0.58353543", "0.5732963", "0.5682121", "0.56772226", "0.56651264", "0.5651429", "0.5648963", "0.56454366", "0.5626827", "0.5563479", "0.5518577", "0.55164057", "0.5494886", "0.5479745", "0.54671645", "0.54371583", "0.5426792", "0.5411122...
0.8341999
0
Returns whether or not the schema is empty.
def empty(self) -> bool: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return not bool(self.schema)", "def is_empty(self):\n return not bool(self.schema)", "def has_empty(self):\n return self.mdb.get().has_empty()", "def _is_empty(conn):\n with Tx(conn) as c:\n c.execute('''\n SELECT COUNT(*) AS count FROM informat...
[ "0.9007715", "0.9007715", "0.7852084", "0.7792788", "0.76313865", "0.7627544", "0.7621029", "0.7583046", "0.7583046", "0.7581427", "0.7573049", "0.7567903", "0.7560972", "0.75508446", "0.75269824", "0.74985206", "0.74985206", "0.7496334", "0.7486152", "0.7486152", "0.7486152"...
0.0
-1
Register or update a table. Updates are only performed if a new column mapping is provided. The added table must have the necessary number of qualifiers in its path to match the schema's nesting level.
def add_table( self, table: exp.Table | str, column_mapping: t.Optional[ColumnMapping] = None, dialect: DialectType = None, normalize: t.Optional[bool] = None, match_depth: bool = True, ) -> None: normalized_table = self._normalize_table(table, dialect=dialect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_table(\n self,\n table: exp.Table | str,\n column_mapping: t.Optional[ColumnMapping] = None,\n dialect: DialectType = None,\n normalize: t.Optional[bool] = None,\n match_depth: bool = True,\n ) -> None:", "def append_table(self, table):\n\n self._db_man...
[ "0.6906549", "0.65174025", "0.58558434", "0.58537805", "0.55823225", "0.5572148", "0.55663824", "0.55141455", "0.54686254", "0.54144526", "0.5408034", "0.54023874", "0.5366671", "0.53248453", "0.5310447", "0.5292642", "0.5265485", "0.52491516", "0.5245744", "0.52282953", "0.5...
0.6541329
1
Normalizes all identifiers in the schema.
def _normalize(self, schema: t.Dict) -> t.Dict: normalized_mapping: t.Dict = {} flattened_schema = flatten_schema(schema, depth=dict_depth(schema) - 1) for keys in flattened_schema: columns = nested_get(schema, *zip(keys, keys)) if not isinstance(columns, dict): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(self):\n\n pass", "def normalize(data):\n data = lowercase(data)\n data = remove_punct(data)\n data = remove_apostrophes(data)\n data = remove_stopwords(data)\n data = num_to_words(data)\n data = lemmatize(data)\n data = stemming(data)\n data = remove_punct(data)\n ...
[ "0.59266895", "0.5873956", "0.54764223", "0.5359589", "0.53381366", "0.533242", "0.5312207", "0.52822524", "0.5257845", "0.5236573", "0.5232166", "0.5186246", "0.51529974", "0.5135209", "0.5133256", "0.51218295", "0.5093864", "0.50758624", "0.504007", "0.5028942", "0.50234723...
0.5703642
2
Convert a type represented as a string to the corresponding `sqlglot.exp.DataType` object.
def _to_data_type(self, schema_type: str, dialect: DialectType = None) -> exp.DataType: if schema_type not in self._type_mapping_cache: dialect = dialect or self.dialect try: expression = exp.DataType.build(schema_type, dialect=dialect) self._type_mapping...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_to_type(name_type):\n if name_type == 'float' or name_type == 'Float':\n return float\n if name_type == 'bool':\n return bool\n if name_type == 'int':\n return lambda x: int(float(x))\n if name_type == 'list':\n return ast.literal_eval\n if name_type == 'date':\n ...
[ "0.72812384", "0.6753143", "0.6728669", "0.66921026", "0.6690243", "0.666623", "0.6633469", "0.66003263", "0.651732", "0.64889014", "0.64723027", "0.64593905", "0.64558285", "0.6397051", "0.63894325", "0.63656294", "0.63352287", "0.6271332", "0.6264416", "0.62493855", "0.6223...
0.66903555
4
Get a value for a nested dictionary.
def nested_get( d: t.Dict, *path: t.Tuple[str, str], raise_on_missing: bool = True ) -> t.Optional[t.Any]: for name, key in path: d = d.get(key) # type: ignore if d is None: if raise_on_missing: name = "table" if name == "this" else name raise ValueEr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_nested_value(dct, key_path):\n key = key_path[0]\n if not isinstance(dct, dict):\n raise errors.AnsibleFilterError(\n f\"stringfilter: looking for key '{key}' \"\n f\"but list item is not dict: {pformat(dct)}\"\n )\n if key not in dct:\n raise errors.Ans...
[ "0.7135181", "0.7069162", "0.7069162", "0.69069624", "0.6868929", "0.6814029", "0.67106485", "0.6700245", "0.6690352", "0.6679888", "0.6679399", "0.6644695", "0.6634186", "0.66251916", "0.6576415", "0.6574386", "0.65613616", "0.6560294", "0.6546466", "0.6541264", "0.65052503"...
0.6221771
34
Inplace set a value for a nested dictionary
def nested_set(d: t.Dict, keys: t.Sequence[str], value: t.Any) -> t.Dict: if not keys: return d if len(keys) == 1: d[keys[0]] = value return d subd = d for key in keys[:-1]: if key not in subd: subd = subd.setdefault(key, {}) else: subd =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_nested_item(data_dict: dict, key_list: tuple or list, value):\r\n reduce(getitem, key_list[:-1], data_dict)[key_list[-1]] = value\r\n return data_dict", "def set_upward(self, key, value):\n context = self.dicts[-1]\n for d in reversed(self.dicts):\n if key in d:\n ...
[ "0.76483804", "0.68748134", "0.6776923", "0.673773", "0.673209", "0.66844517", "0.66722816", "0.6589765", "0.65844417", "0.65179634", "0.65048563", "0.6496487", "0.64852047", "0.6467597", "0.6466819", "0.6431448", "0.64198995", "0.63964117", "0.6390859", "0.6359635", "0.63530...
0.62517637
27
calculates the area of the rectangle
def calculatearea(self): return self.width * self.height
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rect_area(rect):\n return rect[2] * rect[3]", "def area_rect(w, h):\n return w * h", "def findArea(self):\n\n a, b = self.sides\n area = a * b\n print(f\"Are of rectangle is: {area}\")", "def rectangle_area(base, height):\n return (base * height)", "def rectangle_area(widt...
[ "0.83337206", "0.82646203", "0.8154543", "0.8110759", "0.81097955", "0.79950184", "0.79927397", "0.7932302", "0.7919297", "0.78404224", "0.78065634", "0.7769078", "0.77205867", "0.7713733", "0.7695757", "0.7682392", "0.762865", "0.76224244", "0.7613377", "0.7581859", "0.75748...
0.7714777
13
calculates the perimeter of the rectangle
def calculateperimeter(self): return (self.width * 2) + (self.height * 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perimeter(self):\n\t\treturn 2 * (self.width + self.height)", "def perimeter(self):\n return self.sidelength1 + self.sidelength2 + self.baselength1 + self.baselength2", "def perimeter(self):\n return 2 * (self.height + self.width)", "def perimeter(self):\r\n return (2*self.width) + (2*se...
[ "0.84097177", "0.82991195", "0.8230295", "0.82295436", "0.8175543", "0.8090151", "0.7748024", "0.7746333", "0.7600331", "0.7560432", "0.7461582", "0.7413485", "0.73691916", "0.733947", "0.733947", "0.7245376", "0.71416146", "0.7044641", "0.7007834", "0.7006381", "0.6965209", ...
0.84027857
1
returns True is rectangle is a square
def issquare(self): if self.width == self.height: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_square (self):\n return self.width == self.height", "def isSquare(self):\n return self._width == self._height", "def inside_rectangle(self, x, y):\n if (self.pos.x - self.width < x < self.pos.x + self.width and\n self.pos.y - self.height < y < self.pos.y + self.height...
[ "0.8301252", "0.80768895", "0.761006", "0.7551291", "0.75170374", "0.75170374", "0.73089445", "0.7280404", "0.70729554", "0.7034106", "0.7018055", "0.7017966", "0.7011305", "0.696699", "0.69637334", "0.6921471", "0.6892658", "0.6863922", "0.6852449", "0.68163353", "0.67850566...
0.7880159
2
reads the input csv file and returns a df of the dataset
def read_input(path): data = pd.read_csv(path) for each_column in data.columns: if each_column != "class": mean = data[each_column].mean(); std = data[each_column].std() data[each_column] = (data[each_column]-mean)/std data['intercept'] = np.ones((len(data))) return dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_df_from_csv(input_file_name):\n df = pd.read_csv(input_file_name)\n df = df.drop(['Unnamed: 0'], axis=1)\n return df", "def read_data_from_csv(filename):\n df = pd.read_csv(filename)\n return df", "def create_dataframe():\r\n\r\n df = pd.read_csv('data/data.csv', header=0)\r\n retu...
[ "0.77667457", "0.7690494", "0.7660739", "0.76215523", "0.7569005", "0.7555159", "0.75490314", "0.75490314", "0.75490314", "0.75108314", "0.75095314", "0.74875903", "0.7486111", "0.7477994", "0.74681795", "0.74587166", "0.74511033", "0.74408513", "0.73669136", "0.73642737", "0...
0.0
-1
Calculate Max Profit with Short Selling
def calculate_max_profit_with_short_sell(prices: List[int]) -> int: min_price = prices[0] max_price = prices[0] for curr_price in prices[1:]: min_price = min(min_price, curr_price) max_price = max(max_price, curr_price) return max_price - min_price
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maxProfit(self, prices):\r\n\t\tprofit = 0", "def max_profit(prices: List[int]) -> int:", "def maxProfit(self, prices):\n np = 0\n p = float('-inf')\n cd = float('-inf')\n for price in prices:\n p, np, cd = max(np - price, p), max(np, cd), p + price\n return ma...
[ "0.7982723", "0.74972606", "0.7321962", "0.7311258", "0.72100675", "0.7158053", "0.7059075", "0.699616", "0.69582564", "0.6954031", "0.69240034", "0.68837875", "0.6757931", "0.6703956", "0.66622394", "0.6616795", "0.6577813", "0.650568", "0.6467139", "0.64429665", "0.64338046...
0.7233974
4
Parse all parser arguments that are provided when the script is running in a terminal. Returns
def __parse_args(): parser = argparse.ArgumentParser() parser.add_argument('-f', '--force', action="store_true", default=False, help='overwrite existing database files during import') parser.add_argument('-e', '--extension', action="store", default='txt', help...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_args():\n parser = argparse.ArgumentParser()\n parser.add_argument(\n \"-d\",\n \"--debug\",\n help=\"Print lots of debugging statements\",\n action=\"store_const\",\n dest=\"loglevel\",\n const=logging.DEBUG,\n de...
[ "0.7371315", "0.7308467", "0.72853595", "0.72379285", "0.72374195", "0.7210013", "0.7209308", "0.7166969", "0.7132854", "0.71251345", "0.71116334", "0.711051", "0.70840627", "0.7079573", "0.70689017", "0.70564026", "0.70511127", "0.70470864", "0.7045937", "0.7029301", "0.7014...
0.7049054
17
Downloads MNIST dataset for training, and also loads test data from disk.
def __init__(self): TEST_RATIO = 0.05 mnist_trainset = datasets.MNIST(root='./data', train=True, download=True, transform=None) idxs = np.arange(mnist_trainset.train_data.size(0)) np.random.shuffle(idxs) #print(torch.min(mnist_trainset.train_labels), torch.max(mnist_trainset.tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_mnist(train_data=True, test_data=False):\n os.chdir(ROOT_DIR)\n RESOURCES = [\n 'train-images-idx3-ubyte.gz', 'train-labels-idx1-ubyte.gz',\n 't10k-images-idx3-ubyte.gz', 't10k-labels-idx1-ubyte.gz'\n ]\n\n if (os.path.isdir('data') == 0):\n os.mkdir('data')\n if (os.pa...
[ "0.79208606", "0.79082674", "0.7655954", "0.76327527", "0.75560623", "0.75118375", "0.74953026", "0.7387118", "0.7368737", "0.732294", "0.72736555", "0.72332406", "0.71906793", "0.714779", "0.71164674", "0.7112829", "0.7091428", "0.7082898", "0.7055393", "0.70147556", "0.6992...
0.0
-1
Instantiates the SqueezeNet architecture.
def SqueezeNet(include_top=False, weights='imagenet', input_tensor=None, input_shape=(224,224,3), pooling='avg', classes=1000): if weights not in {'imagenet', None}: raise ValueError('The `weights` argument should be either ' '`N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_net(self):\n pass", "def SqueezeNet(input_shape=(224, 224, 3)):\n image_input = Input(shape=input_shape)\n\n network = Conv2D(64, (3, 3), strides=(2, 2), padding=\"valid\")(image_input)\n network = Activation(\"relu\")(network)\n network = MaxPool2D(pool_size=(3, 3), strides=(2, 2))(...
[ "0.6381434", "0.63172764", "0.62752783", "0.62749684", "0.6267166", "0.6253274", "0.6241765", "0.6218476", "0.6167657", "0.6106487", "0.60971177", "0.60891086", "0.6064243", "0.6059463", "0.60303885", "0.60127574", "0.60098624", "0.59857666", "0.59608865", "0.59554607", "0.59...
0.0
-1
The system of differential equations.
def f_van_der_pol(x, y, rpar): eps = rpar[0] return [y[1], ((1-y[0]**2)*y[1]-y[0])/eps]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derivatives(self):\n self.rdot = self.v\n self.vdot[:,:] = 0.0\n \n for nl in self.nlists: \n nl.separations()\n \n for force in self.forces:\n force.apply()\n\n # Controllers is the new implementation of forces\n for controller in self....
[ "0.72941625", "0.71099967", "0.70839316", "0.70839316", "0.70388865", "0.70388865", "0.6882565", "0.6751534", "0.6741056", "0.6691202", "0.6644309", "0.6583451", "0.6528382", "0.6505572", "0.6428237", "0.6398824", "0.6395037", "0.6380307", "0.6364613", "0.6339316", "0.6338677...
0.0
-1
Initializes an FAT file system.
def __init__(self, resolver_context, path_spec): super(FATFileSystem, self).__init__(resolver_context, path_spec) self._file_object = None self._fsfat_volume = None self._root_directory_identifier = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, raiz):\n super(Fiunamfs, self).__init__()\n self.raiz = raiz\n self.void_entrada_dir = \"Xx.xXx.xXx.xXx.\"\n if os.path.isfile(self.raiz):\n with open(self.raiz,\"r+\") as filesystem:\n self.map = mmap.mmap(filesystem.fileno(), 0)\n ...
[ "0.63188535", "0.5889343", "0.5821936", "0.57740694", "0.5654106", "0.5625574", "0.5606235", "0.56006455", "0.5562057", "0.5519923", "0.551059", "0.5489221", "0.54600346", "0.54571086", "0.5440901", "0.5398454", "0.53769785", "0.5342027", "0.5341216", "0.5325688", "0.53254545...
0.70108753
0
Closes the file system.
def _Close(self): self._fsfat_volume = None self._file_object = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n os.close(self.fd)", "def _close(self):\n self.fh.close()", "def Close(self): \n posix.close(self.File)", "def close(self):\n self.f.close()", "def close(self):\n self.f.close()", "def close(self):\r\n self._fd.close()", "def close(self):\n ...
[ "0.74770784", "0.7465795", "0.743813", "0.74379766", "0.74379766", "0.74256295", "0.74251753", "0.7406343", "0.7382513", "0.737657", "0.7370766", "0.73330665", "0.73330665", "0.7296642", "0.7283068", "0.7283068", "0.72551316", "0.725284", "0.725284", "0.7233543", "0.7233543",...
0.6829866
46
Opens the file system defined by path specification.
def _Open(self, mode='rb'): if not self._path_spec.HasParent(): raise errors.PathSpecError( 'Unsupported path specification without parent.') file_object = resolver.Resolver.OpenFileObject( self._path_spec.parent, resolver_context=self._resolver_context) fsfat_volume = pyfsfat.volu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open (self, path, mode):\r\n pass", "def open(self, path: str, **kwargs): # don't know how to type hint this\n pass", "def open_file(path, config):\n\n return fopen(normalize_path(path, config))", "def open(self):\n if System.is_linux():\n subprocess.run([\"xdg-open\",...
[ "0.7166314", "0.69829744", "0.69514716", "0.68696135", "0.68495303", "0.681287", "0.66424996", "0.66242665", "0.6547193", "0.6518385", "0.6455179", "0.64270276", "0.64153993", "0.64133656", "0.64128685", "0.64118516", "0.6394808", "0.6377929", "0.6243743", "0.62168086", "0.61...
0.6950342
3
Determines if a file entry for a path specification exists.
def FileEntryExistsByPathSpec(self, path_spec): # Opening a file by identifier is faster than opening a file by location. fsfat_file_entry = None location = getattr(path_spec, 'location', None) identifier = getattr(path_spec, 'identifier', None) try: if identifier is not None: fsfat_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FileEntryExistsByPath(self, path):\n if not self._file_entries:\n return False\n\n return path in self._file_entries", "def PathHasFile(path_spec, fname):\n for dir in path_spec.split(':'):\n if os.path.exists(os.path.join(dir, fname)):\n return True\n return False", "def...
[ "0.7863224", "0.75036407", "0.74586415", "0.73196864", "0.7236807", "0.7229731", "0.7118913", "0.70956737", "0.7033691", "0.70013297", "0.696599", "0.6944815", "0.6918158", "0.6915945", "0.69062704", "0.6898333", "0.6893156", "0.68854475", "0.68753237", "0.6865665", "0.685695...
0.8408388
0
Retrieves a file entry for a path specification.
def GetFileEntryByPathSpec(self, path_spec): # Opening a file by identifier is faster than opening a file by location. fsfat_file_entry = None location = getattr(path_spec, 'location', None) identifier = getattr(path_spec, 'identifier', None) if (location == self.LOCATION_ROOT or identifier...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetFATFileEntryByPathSpec(self, path_spec):\n # Opening a file by identifier is faster than opening a file by location.\n location = getattr(path_spec, 'location', None)\n identifier = getattr(path_spec, 'identifier', None)\n\n if identifier is not None:\n fsfat_file_entry = self._fsfat_volume...
[ "0.73651946", "0.68824446", "0.6858954", "0.6523468", "0.6486279", "0.6416723", "0.63695353", "0.6296745", "0.62840843", "0.62158257", "0.6162694", "0.6115889", "0.6102433", "0.59521365", "0.5931107", "0.5867576", "0.58413875", "0.57731813", "0.5739516", "0.57122064", "0.5708...
0.7410478
0
Retrieves the FAT file entry for a path specification.
def GetFATFileEntryByPathSpec(self, path_spec): # Opening a file by identifier is faster than opening a file by location. location = getattr(path_spec, 'location', None) identifier = getattr(path_spec, 'identifier', None) if identifier is not None: fsfat_file_entry = self._fsfat_volume.get_file_e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetFileEntryByPathSpec(self, path_spec):\n # Opening a file by identifier is faster than opening a file by location.\n fsfat_file_entry = None\n location = getattr(path_spec, 'location', None)\n identifier = getattr(path_spec, 'identifier', None)\n\n if (location == self.LOCATION_ROOT or\n ...
[ "0.779033", "0.6408017", "0.6292353", "0.61965084", "0.6132355", "0.60661227", "0.5960667", "0.59466404", "0.59354794", "0.59317774", "0.5781503", "0.5739296", "0.573339", "0.5607855", "0.5578621", "0.53752375", "0.5236052", "0.5231925", "0.5211708", "0.5204015", "0.52011734"...
0.82839155
0
Retrieves the FAT volume.
def GetFATVolume(self): return self._fsfat_volume
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volume():\n vol = sonos.volume\n return vol", "def get_volume(self):\n return int(self.get(COMMAND_UIC, 'GetVolume')['volume'])", "def getVolume(self):\n return self.__volume", "def get_volume(cls) -> float:\n raise NotImplementedError", "def get_volume(self):\n return...
[ "0.6741914", "0.64630485", "0.6441217", "0.64277786", "0.6402811", "0.63844526", "0.6358187", "0.6316619", "0.6304788", "0.6304788", "0.61879545", "0.61807597", "0.6056522", "0.6056522", "0.6051996", "0.6024354", "0.6017007", "0.5998696", "0.5896236", "0.5891706", "0.5859794"...
0.8854301
0
Retrieves the root file entry.
def GetRootFileEntry(self): path_spec = fat_path_spec.FATPathSpec( location=self.LOCATION_ROOT, identifier=self._root_directory_identifier, parent=self._path_spec.parent) return self.GetFileEntryByPathSpec(path_spec)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetRootFileEntry(self):\n path_spec = compressed_stream_path_spec.CompressedStreamPathSpec(\n compression_method=self._compression_method,\n parent=self._path_spec.parent)\n return self.GetFileEntryByPathSpec(path_spec)", "def get_file_entry(self):\n pass", "def get_root_filename...
[ "0.76521605", "0.71184343", "0.6924379", "0.6699768", "0.6628157", "0.64125776", "0.64025784", "0.64025784", "0.6372416", "0.6306385", "0.62967706", "0.61980176", "0.6194078", "0.61891824", "0.6178764", "0.6148309", "0.614439", "0.6111012", "0.6111012", "0.61053246", "0.60989...
0.8115555
0
Get open, high, low, close, volumefrom and volumeto from the daily historical data.
def get_daily(self, from_currency, to_currency, limit = DEFAULT_LIMIT, aggregate = DEFAULT_AGGREGATE): return self.__get(HISTORY_DAY, from_currency, to_currency, limit, aggregate)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_daily_historic_data(self, ticker, start_date, end_date):\n av_url = self._construct_alpha_vantage_symbol_call(ticker)\n\n try:\n av_data_js = requests.get(av_url)\n data = json.loads(av_data_js.text)['Time Series (Daily)']\n except Exception as e:\n pri...
[ "0.6949066", "0.68844277", "0.6695228", "0.65981036", "0.65414983", "0.6505848", "0.64435995", "0.63736016", "0.6328588", "0.62936145", "0.6285569", "0.62706625", "0.6266869", "0.62420505", "0.62268656", "0.6225306", "0.6217513", "0.6176802", "0.6161418", "0.6146305", "0.6098...
0.57274574
51
Get open, high, low, close, volumefrom and volumeto from the hourly historical data.
def get_hourly(self, from_currency, to_currency, limit = DEFAULT_LIMIT, aggregate = DEFAULT_AGGREGATE): return self.__get(HISTORY_HOUR, from_currency, to_currency, limit, aggregate)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_data(t0, t1, stock_symbol):\n \n # Alpha vantage timeseries object to fetch data (value every 5 min) in pandas-format\n ts = TimeSeries(API_KEY, output_format=\"pandas\")\n data, _ = ts.get_intraday(symbol=stock_symbol, interval=\"5min\", outputsize=\"full\")\n\n # Cut current time window ...
[ "0.6284052", "0.6271263", "0.62495035", "0.6109087", "0.6097593", "0.6064519", "0.6063949", "0.5964306", "0.59627736", "0.5949517", "0.5888321", "0.58527225", "0.5840097", "0.58298445", "0.57632643", "0.5750246", "0.5742488", "0.57306737", "0.57294065", "0.57279015", "0.57222...
0.5940774
10
Get open, high, low, close, volumefrom and volumeto from the minutely historical data.
def get_minutely(self, from_currency, to_currency, limit = DEFAULT_LIMIT, aggregate = DEFAULT_AGGREGATE): return self.__get(HISTORY_MINUTE, from_currency, to_currency, limit, aggregate)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFullPriceHistory(self, stockSymbol, stockExchange):\n response = requests.get(\"https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol={}:{}&outputsize=full&apikey={}\".format(\n stockExchange, stockSymbol, self.ALPHA_VANTAGE_SECRET_KEY))\n data = response.json...
[ "0.6157639", "0.6128776", "0.6118778", "0.6109766", "0.6056755", "0.60040444", "0.5919595", "0.5885627", "0.58849335", "0.58422494", "0.58033365", "0.57959276", "0.57388055", "0.57364684", "0.5723639", "0.5721137", "0.57113665", "0.5687648", "0.5679598", "0.5669504", "0.56674...
0.0
-1
Checks the object is the correct type. Supports only bool, int, float, str, and (possibly nested) lists of these
def type_check(typ, obj): type_s = type_str(typ) # convert to string if necessary nest_depth = type_s.count("List") assert type_s.count("[") == nest_depth, "type_check only supports List for now, no Sets, Dicts, Tuples, ..." assert type_s.startswith("List[" * nest_depth) and type_s.endswith("]" * nes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isdatatype(object):\n return isinstance(object, (str, int, bool, float, type(None)))", "def verify_type(self, obj):\n return isinstance(obj, self.type_)", "def CheckType(self, *args, **kwargs):\n pass", "def checkType(self, value):\n pass", "def check_type(self):\n return Tru...
[ "0.77150726", "0.7513595", "0.70783436", "0.6977785", "0.6849266", "0.6711847", "0.6670505", "0.66524214", "0.66426677", "0.66206664", "0.6613556", "0.660913", "0.660035", "0.65739655", "0.6565112", "0.6557893", "0.6554193", "0.6534318", "0.65338105", "0.6509926", "0.65022236...
0.7434298
2
Convert type ty to string.
def type_str(ty: type) -> str: type_str = str(ty).replace("typing.", "") return type_str[8:-2] if type_str.startswith("<class '") else type_str
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def typestr(self) -> str:\n return self.type if not self.subtype else f\"{self.type}:{self.subtype}\"", "def __str__(self):\n if self.default_kind:\n return self.typestr\n elif check_fortran_intrinsic(self.typestr):\n return \"{}(kind={})\".format(self.typestr, self._ki...
[ "0.6965034", "0.69143295", "0.68898505", "0.6834358", "0.6822356", "0.67486227", "0.6729471", "0.67144763", "0.6709419", "0.67053926", "0.66915524", "0.6657758", "0.66090363", "0.6587318", "0.6541538", "0.6539442", "0.6529326", "0.6527245", "0.65105623", "0.6467017", "0.64665...
0.7121505
0
create code to output an object of type ty as a string
def gen_dump_code(var_name: str, ty: type) -> str: tys = type_str(ty) if tys.startswith("Set["): return "print(json.dumps({k : 1 for k in " + var_name + "})) # write sets as dictionaries\n" return f"print(json.dumps({var_name}))\n"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_(object_):\n return str(object_)", "def __str__(self):\r\n\t\treturn \"({}, {})\".format(self.type, self.value)", "def __str__(self) -> str:\n return f'{self.type}'", "def __str__(self):\n # DOC {{{\n # }}}\n\n # CODE {{{\n return \"%s (%s) [%s, %u, %u]\" % (self...
[ "0.70533574", "0.6811207", "0.67233855", "0.67124987", "0.65906006", "0.658907", "0.65646935", "0.6562564", "0.6561285", "0.65528595", "0.65345925", "0.65235066", "0.64904886", "0.64879006", "0.6486485", "0.6471154", "0.6471154", "0.6471154", "0.6463843", "0.6460837", "0.6455...
0.64863896
15
create code to assert type of var_name is ty
def gen_type_assertion(var_name: str, ty: type) -> str: tys = type_str(ty) vars = [c for c in 'abcdefghijklmnop' if c != var_name][::-1] def helper(var_name, tys): tys = tys.strip() pre_bracket = tys.split("[")[0].lower() # part before [ (or the entire string if no bracket ans = f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_typevar(self, name: str, node: nodes.AssignName) -> None:\n if isinstance(node.parent, nodes.Assign):\n keywords = node.assign_type().value.keywords\n args = node.assign_type().value.args\n elif isinstance(node.parent, nodes.Tuple):\n keywords = (\n ...
[ "0.7006384", "0.6486391", "0.647841", "0.6444737", "0.6433076", "0.63064885", "0.62820286", "0.616275", "0.61551017", "0.61477345", "0.6119317", "0.6078907", "0.60352945", "0.6022062", "0.6018125", "0.6001449", "0.5978701", "0.597096", "0.5967621", "0.5964612", "0.5926319", ...
0.7428603
0
create code to load an object of type ty as a string
def gen_load_code(var_name: str, ty: type) -> str: tys = type_str(ty) if tys.startswith("Set["): assert tys.endswith("]") inside = tys[4:-1] ans = f"{var_name} = set(json.load(sys.stdin))) # convert set (stored as json dictionary)" assertions = [f"all(isinstance(x, {inside}) fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_hickle_4_x_string(h_node,base_type,py_obj_type):\n if not 'object' in h_node.dtype.name or h_node.attrs.get('str_type',None) is not None:\n return load_list_dataset(h_node,base_type,py_obj_type)\n content = h_node[()]\n if py_obj_type is str:\n return content if isinstance(content,s...
[ "0.68164665", "0.64886904", "0.59964514", "0.5907233", "0.58396524", "0.5816692", "0.5782749", "0.5741819", "0.5668538", "0.5662188", "0.565627", "0.56160295", "0.56144637", "0.5593506", "0.55878687", "0.5563929", "0.5560551", "0.552529", "0.55208963", "0.5498176", "0.5475631...
0.5686016
8
Assert that the solution satisfies the given instance and add the solution to the instance. Do a roundtrip json encoding/decoding to mimic the actual test and deter strange attacks. Ideally this could be done by running a protected process (like in evaluating programming contest submissions) but that is much slower. Si...
def add_test(self, sol_src, run_test_type=False): if sol_src in self.sol_srcs: # already added this solution return if run_test_type: env = dict(List=List, Dict=Dict, Set=Set) time0 = time.perf_counter() my_exec(sol_src + "\n" + "answer = sol()", env, de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_manuscript_instance(self):\n\n route = self.results[self.MANUSCRIPT_ROUTE_NAME]['route']\n known_obj = self.results[self.MANUSCRIPT_ROUTE_NAME]['obj']\n\n frvcp_solver = solver.Solver(\n self.REFERENCE_INSTANCE, route, self.q_init)\n obj, _ = frvcp_solver.solve()\n\n...
[ "0.6106482", "0.6091957", "0.5978399", "0.5801316", "0.5638009", "0.54817665", "0.54205143", "0.5376911", "0.53249276", "0.5295629", "0.5257906", "0.5240362", "0.521852", "0.51684266", "0.51647216", "0.51589215", "0.5136146", "0.513267", "0.5132262", "0.5131596", "0.50833285"...
0.56046605
5
Returns True if the input is a duplicate of a previous puzzle, and also makes sure that the types match
def check_seen_input(self, inp): s = str(inp) if s in self._seen_problems: return True # duplicate problem self._seen_problems.add(s) assert set(inp) == set(self.arg_names[1:]), \ f"Instance #{len(self.instances)} keys mismatch in {self.name}" for v in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testDuplicate(self,permutations=True):\n # This algorithm is faster than encode,\n # but for nplex=2 enmagic2 would probably still be faster.\n if permutations:\n C = self.copy()\n C.sort(axis=1)\n else:\n C = self\n ind = sortByColumns(C)\n ...
[ "0.64221823", "0.62725854", "0.6169439", "0.6140278", "0.60666955", "0.6028952", "0.59893286", "0.5950086", "0.5846187", "0.58433527", "0.5839482", "0.58392394", "0.58291453", "0.58108467", "0.58045936", "0.5784773", "0.5781221", "0.5771139", "0.57415956", "0.5735265", "0.567...
0.6422894
0
Sets a single webhook.
def set_webhook( self, topic: str, address: str, format: str = "json", version: str = "2021-04", metafield_namespaces: str = None, private_metafield_namespaces: str = None ): if topic not in ALL_TOPICS: raise TypeError("Invalid topic.") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_webhook(self, webhook):\n self.webhook = webhook\n return", "def set_webhook(event, context):\n print(context)\n logger.info('Event: {}'.format(event))\n bot = configure_telegram()\n url = 'https://{}/{}/'.format(\n event.get('headers').get('Host'),\n event.get('re...
[ "0.83400434", "0.69085205", "0.62319696", "0.6211912", "0.6091016", "0.6091016", "0.6061197", "0.6061197", "0.5896589", "0.58095413", "0.58002734", "0.5745416", "0.57188", "0.56779355", "0.562242", "0.5593093", "0.55695176", "0.5402233", "0.53929234", "0.53513575", "0.5227182...
0.5778035
11
Sets a list of webhook topics for the same target address.
def set_webhooks( self, topics: List[str], address: str, format: str = "json", metafield_namespaces: str = None, private_metafield_namespaces: str = None ): for each in topics: params = dict( topic=each, address=addr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_webhook(\n self,\n topic: str,\n address: str,\n format: str = \"json\",\n version: str = \"2021-04\",\n metafield_namespaces: str = None,\n private_metafield_namespaces: str = None\n ):\n if topic not in ALL_TOPICS:\n raise TypeError(\"...
[ "0.57152766", "0.56827545", "0.5655309", "0.54852873", "0.536025", "0.5280246", "0.5264144", "0.5238817", "0.5237985", "0.5237473", "0.5196603", "0.5186489", "0.5143624", "0.512701", "0.50614136", "0.5052115", "0.50493985", "0.4921148", "0.4892306", "0.48920962", "0.4890296",...
0.77544063
0
Resets stored reward and optimum variables of the Player. Typically used after introducing a new Bandit or after one round of a parameter study.
def stored_reset(self): self.stored_reward = np.zeros((self.num_timesteps - self.first_considered_reward_step,)) self.stored_optimum = np.zeros_like(self.stored_reward)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\r\n\t\tself.player_selected_actions = np.zeros((self.num_actions,), int)\r\n\t\tself.player_reward = np.zeros((self.num_timesteps,))\r\n\t\tself.player_optimum = np.zeros_like(self.player_reward, dtype=int)", "def reset(self):\r\n\t\t# Performs Player superclass reset.\r\n\t\tsuper().reset()\r\n...
[ "0.7974778", "0.7360607", "0.7360607", "0.7238184", "0.7000341", "0.6996056", "0.68766654", "0.683964", "0.6714509", "0.67075217", "0.66256106", "0.6606849", "0.6603082", "0.6600936", "0.6590724", "0.65883505", "0.6588079", "0.65535086", "0.65450776", "0.64778346", "0.6475262...
0.7296158
3
Resets current selected actions, reward and optimum variables of the Player. Typically used at the start of any run.
def reset(self): self.player_selected_actions = np.zeros((self.num_actions,), int) self.player_reward = np.zeros((self.num_timesteps,)) self.player_optimum = np.zeros_like(self.player_reward, dtype=int)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\r\n\t\t# Performs Player superclass reset.\r\n\t\tsuper().reset()\r\n\r\n\t\t# Resets the Q value estimate to the default initial_Q for all actions.\r\n\t\tself.player_Q = np.ones_like(self.player_selected_actions, dtype=float) * self.initial_Q", "def reset(self):\r\n\t\t# Performs Player superc...
[ "0.7927685", "0.7927685", "0.74411565", "0.7344265", "0.7262832", "0.71475285", "0.710667", "0.7080993", "0.7068728", "0.70190877", "0.6923594", "0.690727", "0.68847734", "0.6866576", "0.6863593", "0.6861664", "0.68284225", "0.68099797", "0.68089426", "0.6778495", "0.67172694...
0.8316216
0
Displays relevant parameters of the Player.
def display(self): for key, value in self.__dict__.items(): print(key.upper(), value, sep=': ') print("")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_player_info(self):\n\t\tclear_screen()\n\n\t\tprint(\"# PLAYER INFO #\\n\")\n\t\tprint(\"Name{:.>17} \".format(self.info['Name']))\n\t\tprint(\"Race{:.>17} \".format(self.info['Race']))\n\t\tprint(\"Level{:.>16} \".format(self.stats['Level']))\n\t\tprint(\"Hit Points{:.>11} \".format(self.stats['HP...
[ "0.7364672", "0.6847529", "0.68328834", "0.6832846", "0.6794547", "0.6789354", "0.66954327", "0.6652314", "0.650892", "0.6372237", "0.63718796", "0.6345343", "0.6332063", "0.628822", "0.62689906", "0.62525076", "0.6239251", "0.6220462", "0.61981994", "0.617046", "0.61578614",...
0.0
-1
Provides feedback to Player and, if required, performs updates for the Player. The Player class only implements Player feedback, with Player updates individually handled by Player subclass objects. Typically used at the end of every timestep.
def update(self, timestep, action, reward, is_optimal): # Increments the Player's selected action index by 1. self.player_selected_actions[action] += 1 # Sets the Player reward for the particular timestep to the reward # obtained. self.player_reward[timestep] = reward # Sets the Player optimum for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def handle_player_update(self, update: andesite.PlayerUpdate) -> None:\n ...", "def _update_player(self, player: Player, update_grid = None):\n grid = update_grid if update_grid is not None else \\\n self.game_state.get_character_surroundings(player.entity, self.view_distance)\n ...
[ "0.6812928", "0.678072", "0.6477095", "0.64066684", "0.63528526", "0.6292604", "0.6248551", "0.6235971", "0.6234131", "0.61867", "0.616763", "0.61113304", "0.6080566", "0.6071212", "0.6062153", "0.6005146", "0.5986397", "0.5959052", "0.5939245", "0.59341234", "0.58981174", ...
0.58648247
21
Update parameters of the Player and performs a full reset of the Player (reset and stored_reset). Parameters that can be updated include num_runs, num_actions, num_timesteps, first_considered_reward_step and any parameter associated with a Player subclass object.
def update_params(self, **kwargs): # Only resets Player if kwargs contains keyword arguments. if kwargs: # Assume that a full reset is not necessary prior to analysing # kwargs. to_full_reset = False for key, value in kwargs.items(): # Ensure that the key corresponds to a valid updating par...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self, **kwargs):\n self.player = None\n self.player_list = list()\n\n self.events.post('mc_reset_phase_1')\n self.events.post('mc_reset_phase_2')\n self.events.post('mc_reset_phase_3')", "def player_reset(self):\n\n logging.info(\n f\"Player.player_r...
[ "0.67885375", "0.6768914", "0.63853073", "0.63853073", "0.62770176", "0.6273355", "0.6225072", "0.61682576", "0.60797715", "0.6035246", "0.6019779", "0.6000464", "0.59267855", "0.5831954", "0.5822047", "0.57927036", "0.5770765", "0.56878793", "0.5668958", "0.56678265", "0.565...
0.7322754
0
Obtains a valid action from Player. All Player subclass objects must implement this method and return the same kind of value.
def obtain_action(self): return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_action(self):\n\n # Determine the computer player's desired action\n action = \"r\" if self._current_score < min(25, (100 - (self._total_score + self._current_score))) else \"h\"\n # Return the action\n return action", "def get_action(player):\n print_action(player)\n ...
[ "0.6926013", "0.69082093", "0.68985134", "0.68784523", "0.6807941", "0.67007565", "0.66934615", "0.6680355", "0.6679184", "0.6655069", "0.66246766", "0.66152793", "0.65953773", "0.65869653", "0.65766686", "0.6573468", "0.65038055", "0.6471631", "0.6463644", "0.6458159", "0.64...
0.6463349
19
Obtains a valid action from Player randomly.
def obtain_action(self, timestep): return random.randint(0, self.num_actions-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_play(state, player):\n import random\n actions = YoteRules.get_player_actions(state, player, reward_move=state.rewarding_move)\n choice = random.choice(actions)\n return choice", "def randomAction():\n return np.random.randint(0, POSSIBLE_ACTIONS)", "def chooseAction(s...
[ "0.782963", "0.7675171", "0.75941974", "0.7580613", "0.75644445", "0.74983543", "0.74983543", "0.7491248", "0.7483152", "0.74063724", "0.73933065", "0.73125345", "0.7220319", "0.72160316", "0.7152613", "0.7134621", "0.70930433", "0.70774955", "0.7056175", "0.7049523", "0.7012...
0.72675484
12
Obtains a valid action from Player manually.
def obtain_action(self, timestep): # Loops constantly until a valid input is obtained. while True: try: # Tries to obtain a valid input manually and convert it to an # integer. action = int(input('Please provide an input action index between 0 and (number of actions - 1): %i: ' % (self.num_acti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_action(player):\n print_action(player)\n chosen_action_index = int(input('Please indicate your selection from the following list by inputting the number: '))\n return player.available_actions[chosen_action_index]", "def get_player_action(self) -> None:\n print(f\"\\nYou have: {self.user.h...
[ "0.744291", "0.70224696", "0.7002059", "0.6985362", "0.69842356", "0.69637775", "0.6922473", "0.68893236", "0.68688256", "0.68492746", "0.6814807", "0.6791687", "0.677312", "0.6749948", "0.6726016", "0.6721176", "0.6705981", "0.66953146", "0.6691397", "0.6687377", "0.666444",...
0.65572494
26
Resets the Player based on the Player superclass method, but also includes resetting the Q value estimate. Similar to the Player superclass method, typically used at the start of any run.
def reset(self): # Performs Player superclass reset. super().reset() # Resets the Q value estimate to the default initial_Q for all actions. self.player_Q = np.ones_like(self.player_selected_actions, dtype=float) * self.initial_Q
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self, **kwargs):\n self.player = None\n self.player_list = list()\n\n self.events.post('mc_reset_phase_1')\n self.events.post('mc_reset_phase_2')\n self.events.post('mc_reset_phase_3')", "def reset(self):\n self.last_round = False\n self.last_player = No...
[ "0.67301285", "0.66991335", "0.66798097", "0.6666841", "0.6382751", "0.6360523", "0.63426226", "0.632091", "0.6284623", "0.62717915", "0.62696385", "0.6261351", "0.62484235", "0.6238393", "0.6223089", "0.6174614", "0.6157824", "0.61563545", "0.6145117", "0.61428857", "0.61418...
0.83313805
0
Obtains a valid action from Player randomly with probability epsilon and deterministically by randomly selecting between actions with the maximum Q value estimate with probability 1epsilon.
def obtain_action(self, timestep): # Generates a random number for deciding between performing a random or # deterministic action. random_num = random.random() if random_num < self.epsilon: # Random action taken. return random.randint(0, self.num_actions-1) else: # Deterministic action ta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_action(Q_table, state, epsilon):\n if random.uniform(0, 1) < epsilon:\n return random.choice(ACTIONS)\n else:\n actions = Q_table.get(state.__str__())\n if actions is None:\n return random.choice(ACTIONS)\n else:\n return PlayerAction(np.argmax(act...
[ "0.8109837", "0.7914522", "0.789213", "0.78175986", "0.7799837", "0.7799837", "0.7645618", "0.7638084", "0.7489072", "0.74776727", "0.7462509", "0.74186605", "0.7417692", "0.7380337", "0.7378144", "0.73679775", "0.7366256", "0.7348006", "0.7341899", "0.73062605", "0.7303164",...
0.76467246
6
Updates the Player based on the Player superclass method, but also includes updating the Q value estimate. Similar to the Player superclass method, typically used at the end of every timestep. Uses the same parameters as the Player superclass.
def update(self, timestep, action, reward, best_action): # Performs updates based on the Player superclass update method. super().update(timestep, action, reward, best_action) # Updates the Q value estimate based on the nature of the step size # parameter. if self.step_size_parameter is None: # Upd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_params(self, **kwargs):\r\n\t\t# Only resets Player if kwargs contains keyword arguments.\r\n\t\tif kwargs:\r\n\t\t\t# Assume that a full reset is not necessary prior to analysing\r\n\t\t\t# kwargs.\r\n\t\t\tto_full_reset = False\r\n\r\n\t\t\tfor key, value in kwargs.items():\r\n\t\t\t\t# Ensure that th...
[ "0.65239024", "0.63022316", "0.6153938", "0.6147981", "0.6094651", "0.6094651", "0.6051621", "0.59814626", "0.59468865", "0.5909017", "0.588301", "0.58721393", "0.5857797", "0.5856023", "0.58154404", "0.5811147", "0.57896477", "0.5783527", "0.5781377", "0.57559735", "0.574274...
0.72308457
0
Resets the Player based on the Player superclass method, but also includes resetting the Q value estimate. Similar to the Player superclass method, typically used at the start of any run.
def reset(self): # Performs Player superclass reset. super().reset() # Resets the Q value estimate to the default initial_Q for all actions. self.player_Q = np.ones_like(self.player_selected_actions, dtype=float) * self.initial_Q
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self, **kwargs):\n self.player = None\n self.player_list = list()\n\n self.events.post('mc_reset_phase_1')\n self.events.post('mc_reset_phase_2')\n self.events.post('mc_reset_phase_3')", "def reset(self):\n self.last_round = False\n self.last_player = No...
[ "0.6727657", "0.66974413", "0.66793954", "0.66646314", "0.63810194", "0.6359409", "0.6340726", "0.63195854", "0.62819606", "0.62700206", "0.62668645", "0.62604225", "0.62486696", "0.62376493", "0.62214196", "0.617289", "0.6155191", "0.6155135", "0.6142722", "0.6140925", "0.61...
0.83304054
1
Obtains a valid action from Player deterministically by randomly selecting between actions with the maximum Q value estimate plus upper confidence bound term. If certain actions have not been selected at all, those actions will be given priority for selection.
def obtain_action(self, timestep): # Finds all actions which have not been selected before. zero_action = np.argwhere(self.player_selected_actions == 0).flatten() # Checks if there are any actions which have not been selected before. if zero_action.size: # Returns a random action index that has not be...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_action(self):\n estimated_q_a = self._action_value_estimator.get_estimated_q_a()\n\n if np.random.rand() < self._epsilon:\n chosen_action = random.choice(list(estimated_q_a.keys()))\n else:\n chosen_action = max(estimated_q_a, key=estimated_q_a.get)\n\n ...
[ "0.8176621", "0.77825046", "0.77489686", "0.77165926", "0.77005327", "0.7656863", "0.7642504", "0.7577348", "0.7577348", "0.7554682", "0.74225026", "0.73960197", "0.73934495", "0.7387889", "0.73576856", "0.73490137", "0.73334473", "0.73161817", "0.72964036", "0.72933036", "0....
0.759997
7
Updates the Player based on the Player superclass method, but also includes updating the Q value estimate. Similar to the Player superclass method, typically used at the end of every timestep. Uses the same parameters as the Player superclass.
def update(self, timestep, action, reward, best_action): # Performs updates based on the Player superclass update method. super().update(timestep, action, reward, best_action) # Updates the Q value estimate based on the nature of the step size # parameter. if self.step_size_parameter is None: # Upd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_params(self, **kwargs):\r\n\t\t# Only resets Player if kwargs contains keyword arguments.\r\n\t\tif kwargs:\r\n\t\t\t# Assume that a full reset is not necessary prior to analysing\r\n\t\t\t# kwargs.\r\n\t\t\tto_full_reset = False\r\n\r\n\t\t\tfor key, value in kwargs.items():\r\n\t\t\t\t# Ensure that th...
[ "0.65239066", "0.63032603", "0.6155153", "0.6147414", "0.6095376", "0.6095376", "0.6052002", "0.5982112", "0.5946964", "0.5909957", "0.58827126", "0.58719295", "0.5858522", "0.5856996", "0.58168924", "0.5812062", "0.5789582", "0.57842654", "0.5780534", "0.57566565", "0.574347...
0.7231035
1
Resets the Player based on the Player superclass method, but also includes resetting the action preferences. Similar to the Player superclass method, typically used at the start of any run.
def reset(self): # Performs Player superclass reset. super().reset() # Resets the action preferences to the default value of 0 for all # timesteps and actions. self.H_gradient = np.zeros((self.num_timesteps, self.num_actions), dtype=float)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self, *args):\n self.state = GameStates.playing\n self.human = evilrps.Player('Human', self.get_player_choice)\n self.ai = evilrps.Player('AI', evilrps.create_ai())\n self.game = evilrps.Game(self.human, self.ai)", "def reset(self):\r\n\t\t# Performs Player superclass reset....
[ "0.71573555", "0.7156274", "0.7156274", "0.7144471", "0.642723", "0.64042836", "0.6395783", "0.6291392", "0.6281546", "0.6279522", "0.6205311", "0.6099861", "0.60649633", "0.6052392", "0.60189664", "0.60075533", "0.5983", "0.5982071", "0.5967863", "0.59311885", "0.5919399", ...
0.7008234
4
Obtains a valid action from Player deterministically by using action preferences to weigh the probability of selecting each action.
def obtain_action(self, timestep): # Obtain the action probabiltiy weights self.curr_prob_gradient = softmax(self.H_gradient[timestep]) # Randomly selects an action, weighted by the action probability weights return np.random.choice(self.num_actions, p=self.curr_prob_gradient)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAction(self, state):\n # Pick Action\n legalActions = self.getLegalActions(state)\n action = None\n\n \"\"\"Description:\n Use util.flipCoin, if return true then randomly choice from legalAction\n if flase, then sue getPolicy to get best policy action\n \"\"\"\n \"\"\" YOUR CODE HERE...
[ "0.7540198", "0.71881586", "0.7088222", "0.706894", "0.7015818", "0.699615", "0.6978244", "0.6974235", "0.6944287", "0.693501", "0.68988067", "0.6894592", "0.68934655", "0.6887132", "0.6878449", "0.68703896", "0.6868771", "0.6861499", "0.6861499", "0.68518865", "0.6831762", ...
0.0
-1
Updates the Player based on the Player superclass method, but also includes updating the action prefereneces. Similar to the Player superclass method, typically used at the end of every timestep. Uses the same parameters as the Player superclass.
def update(self, timestep, action, reward, best_action): # Performs updates based on the Player superclass update method. super().update(timestep, action, reward, best_action) # Perform updates only if the timestep is not the last timestep. An # increased action preference indicates that either an action ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self) -> None:\n\n #Update the action of the AI\n self.player2.action(self.get_entities())\n\n #Call the superclass update\n return super().update()", "def update(self, timestep, action, reward, is_optimal):\r\n\t\t# Increments the Player's selected action index by 1.\r\n\t...
[ "0.72991633", "0.69506955", "0.6803945", "0.6803945", "0.6464186", "0.6447012", "0.6256083", "0.61741924", "0.61453855", "0.6119295", "0.6107761", "0.6096652", "0.6083245", "0.5976829", "0.59614503", "0.5954932", "0.5950722", "0.59300816", "0.5868044", "0.5855404", "0.5847396...
0.66098315
4
Set loglevel for all treadmill modules
def set_log_level(log_level): # pylint: disable=consider-iterating-dictionary # yes, we need to iterate keys logger_keys = [ lk for lk in logging.Logger.manager.loggerDict.keys() if '.' not in lk and lk[:9] == 'treadmill' ] logging.getLogger().setLevel(log_level) for logger_key ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_log_level(level):\n __log__.setLevel(level)", "def set_loggers(log_level: int = 0) -> None:\n\n logging.getLogger('requests').setLevel(logging.INFO if log_level <= 1 else logging.DEBUG)\n logging.getLogger('urllib3').setLevel(logging.INFO if log_level <= 1 else logging.DEBUG)\n logging.getLog...
[ "0.7417297", "0.7379488", "0.7164858", "0.71622586", "0.716013", "0.7155325", "0.71458966", "0.7082803", "0.7060833", "0.7045006", "0.7036214", "0.70269495", "0.6999209", "0.69648945", "0.69274646", "0.69192773", "0.6912224", "0.6887123", "0.6799752", "0.6774565", "0.6737566"...
0.80625314
0
Load logging config json file from treadmill_xx/logging/xxx.json
def _load_logging_file(plugin_name, name): import pkg_resources utf8_reader = codecs.getreader('utf8') log_conf_file = utf8_reader( pkg_resources.resource_stream(plugin_name, name) ) return json.load(log_conf_file)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_logging():\n name_json = 'logging_config.json'\n path_json = os.path.join(os.path.dirname(__file__), name_json)\n with open(path_json, 'r') as f_json:\n dict_config = json.load(f_json)\n logging.config.dictConfig(dict_config)", "def _setup_logger_from_json_file(self, config_file):\n ...
[ "0.78517497", "0.7631437", "0.75648385", "0.70562047", "0.70301414", "0.69533324", "0.68847895", "0.6835545", "0.67063653", "0.66583395", "0.65927243", "0.65224314", "0.6503446", "0.65020454", "0.64886147", "0.64005363", "0.6383869", "0.63532263", "0.63532263", "0.63025844", ...
0.68767816
7
Convert treadmill.logging.xxx => treadmill
def _package_root(name): return name.split('.', 1)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_read_namespaced_build_log_log(self):\n pass", "def getLogs():", "def getLogs():", "def logIt(msg):\n utils = CONFIG['utils'].logIt(msg) #@UnusedVariable", "def _original_vlog_fn(level):\n return _LOG_MAPPING[level]", "def _get_logger(self):", "def system_log_separation(log_type, l...
[ "0.5773135", "0.55894816", "0.55894816", "0.55245227", "0.54702246", "0.5435723", "0.53971684", "0.5394747", "0.53867847", "0.534911", "0.53174275", "0.52837646", "0.52157414", "0.51748174", "0.5065848", "0.50583386", "0.5048819", "0.504638", "0.5041356", "0.50296754", "0.502...
0.0
-1
load plugin log conf from various modules
def load_logging_conf(name): # Shortcut - check if logging already exists. logconf_path = os.path.join( os.environ.get('TREADMILL_APPROOT', ''), 'logging', name ) if os.path.exists(logconf_path): with io.open(logconf_path) as f: return json.loads(f.read()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_logger():\n logging.config.dictConfig(LOGGING)", "def load():\n return SyslogOutOutputPlugin", "def _load_logging_file(plugin_name, name):\n import pkg_resources\n\n utf8_reader = codecs.getreader('utf8')\n log_conf_file = utf8_reader(\n pkg_resources.resource_stream(plugin_name,...
[ "0.67765653", "0.6554534", "0.64338154", "0.62319195", "0.6214265", "0.61860853", "0.61772305", "0.6160944", "0.6143693", "0.6137388", "0.6094451", "0.6026661", "0.60258913", "0.60114056", "0.60027283", "0.5989091", "0.59733725", "0.5972805", "0.59547335", "0.5929312", "0.591...
0.6830847
0
List all defined logging configurations.
def list_logging_conf(): import pkg_resources configs = set() for plugin in plugin_manager.load_all(__name__): configs.update({ cfg for cfg in pkg_resources.resource_listdir(__name__, '.') if cfg.endswith('.json') }) return configs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_configurations(ctx):\n config_set = __ensure_configuration_exists(ctx)\n formatter = ConfigSetListFormatter.build(config_set, format='plain')\n out = formatter.format()\n\n click.echo(out)", "def available_loggers():\n return list(logging.Logger.manager.loggerDict.keys())", "def list_co...
[ "0.7080317", "0.65279603", "0.6527329", "0.6493259", "0.643572", "0.636159", "0.6316272", "0.62676394", "0.62604356", "0.625639", "0.62366325", "0.6218721", "0.6163993", "0.61506796", "0.6122123", "0.61011463", "0.6088227", "0.6087312", "0.6075647", "0.60719967", "0.60462475"...
0.7941358
0
Load and write logging configs.
def write_configs(logconf_dir): for name in list_logging_conf(): conf = load_logging_conf(name) with io.open(os.path.join(logconf_dir, name), 'w') as f: f.write(json.dumps(conf))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _configure_logger():\n try:\n log_dir = os.environ['AUTOMINE_LOG_DIR']\n log_name = _log_name()\n cfg_path = os.path.join(log_dir, 'logging_config.json')\n with open(cfg_path) as src:\n cfg = json.load(src)\n handlers = cfg.get('handlers')\n for h...
[ "0.74688447", "0.74431235", "0.729815", "0.72017014", "0.7184714", "0.70311505", "0.70297337", "0.6922407", "0.68696606", "0.686453", "0.6838581", "0.6802465", "0.6801292", "0.6783347", "0.6745252", "0.6741858", "0.6711271", "0.66899043", "0.6688466", "0.66791886", "0.6663701...
0.7218264
3
Preload model objects as defined in the model module from the anonymised sittings file in the anodirectory.
def preload(self): # load the objects for otype, fname in self.TYPE2NAME.items(): if fname: path = os.path.join(self.anodir, fname + ".gz") if os.path.isfile(path): with gzip.open(path, "rt") as handler: for line in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadParts(self):\n for i in range(15):\n self.model_parts[i] = loadModel(\"ato_{}.pkl\".format(str(i)))", "def import_data(self):\n self.models = []\n for o in self.loader.load():\n klass = self.type_for(o)\n if hasattr(klass, \"from_api\"):\n ...
[ "0.689034", "0.6732793", "0.65872616", "0.65585244", "0.6545921", "0.65286523", "0.65189946", "0.64807075", "0.64433175", "0.6369734", "0.6349787", "0.6338296", "0.6329398", "0.6324702", "0.6305951", "0.6279137", "0.62210464", "0.616392", "0.6111596", "0.6111596", "0.61044794...
0.6706889
2
Generate a random password of length n
def gen_random_id(self, n: int = 12) -> object: random_source = string.ascii_letters + string.digits id_ = random.choice(string.ascii_lowercase) id_ += random.choice(string.ascii_uppercase) id_ += random.choice(string.digits) for i in range(n): id_ += random.choice(r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_password(n):\n import os\n import math\n from base64 import b64encode\n return b64encode(os.urandom(int(math.ceil(0.75*n))),'-_')[:n]", "def random_password(\n n=50, chars=\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890/>#\"\n):\n\n return \"\".join(random.choice(c...
[ "0.89124167", "0.8725423", "0.83011085", "0.82468885", "0.82263476", "0.81920224", "0.81738615", "0.8110295", "0.81008816", "0.8095953", "0.80591285", "0.8048119", "0.802162", "0.79844606", "0.797559", "0.79369843", "0.78687334", "0.78639066", "0.78463686", "0.7840548", "0.78...
0.0
-1
Limit Order Chasing Ensure that our limit order is the first on the orderbook
def chase_order(self, order_id, side, avg, qty=None): sleep(1) # takes a second for order_id to register in bitmex trade engine last_price = avg max_chase_buy = float(avg) + float(self.strategy.chase) max_chase_sell = float(avg) - float(self.strategy.chase) self.logger.info(f'Ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action_confirm(self):\n for order in self:\n order.check_limit()\n return super(SaleOrder, self).action_confirm()", "def order(self, order):\n\n #print(\"Evaluating order: \", order)\n if self.security != order.secid:\n raise (\"Cannot place order for securit...
[ "0.6539003", "0.63525957", "0.6246731", "0.61992913", "0.6187268", "0.61325973", "0.61221045", "0.6112907", "0.59891355", "0.59784013", "0.59504294", "0.59232557", "0.591283", "0.5785371", "0.5773255", "0.5772763", "0.57540095", "0.5748743", "0.5677814", "0.56711113", "0.5653...
0.0
-1
Trailing stop functionality via local bot logic
def trailing_stop(self): # price = self.binance.get_price(self.market) pos = self.get_position() entry_price = pos['avgEntryPrice'] qty = pos['currentQty'] print('Trailing stop triggered') order_type = 'market' if qty > 0: # long position p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _stop_bot(_event):\n pass", "def _stop(self):", "def stopwasp():\n\n\trespond = send_command('stopwasp')", "def on_stop(self):\n self.write_log(\"策略停止\")", "def on_stop(self):\n self.write_log(\"策略停止\")", "def on_stop(self):\n self.write_log(\"策略停止\")", "def on_stop(self...
[ "0.77440274", "0.70286995", "0.6818242", "0.67481714", "0.67481714", "0.67481714", "0.67481714", "0.67217135", "0.6665244", "0.66315264", "0.6616451", "0.6616451", "0.6616451", "0.6616451", "0.6609682", "0.65904486", "0.65835595", "0.6579909", "0.65657586", "0.65546185", "0.6...
0.0
-1
Use the rest api to check if an order is open
def rest_open_order(self, orderID): o = self.client.Order.Order_getOrders(filter=json.dumps({"open": True, "orderID": orderID})).result() if o[0].__len__(): return o[0][0] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rest_open_order(self, orderID=None):\n if orderID:\n o = self.client.Order.Order_getOrders(filter=json.dumps({\"open\": True, \"orderID\": orderID})).result()\n else:\n o = self.client.Order.Order_getOrders(filter=json.dumps({\"open\": True}))\n if o:\n ret...
[ "0.70774716", "0.6966681", "0.6897799", "0.68051106", "0.66603386", "0.66218126", "0.66125774", "0.6561244", "0.6510378", "0.6500806", "0.642141", "0.63950855", "0.6287398", "0.6284869", "0.62530905", "0.6234361", "0.6221804", "0.617574", "0.6062104", "0.60420233", "0.5986443...
0.7141044
0
Use the WebSocket API to check if an order is open
def ws_open_order(self, oid): open_orders = self.ws.open_orders('') if open_orders.__len__(): for o in open_orders: if o['orderID'] == oid: return o return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _open_orders_websocket(self):\n orders_path = '/v1/order/events'\n headers = self._create_headers(orders_path, encoding=\"utf-8\")\n # Filter order events so that only events from this key are sent.\n creds = self._api_credentials\n order_events_url = self._wss_url_base...
[ "0.66771257", "0.64747626", "0.6348902", "0.63147837", "0.6162243", "0.6095055", "0.60626507", "0.6047776", "0.6043715", "0.6038452", "0.6028027", "0.5993607", "0.5941025", "0.5932963", "0.59289896", "0.5838935", "0.58134806", "0.5778505", "0.57713723", "0.5770612", "0.576800...
0.59725416
12
NEW ORDER FROM SCRAPER
def new_order(self, signal, type): # self.client = bitmex.bitmex(test=True, api_key=self.strategy.api_key.key, api_secret=self.strategy.api_key.secret) if not self.strategy.live_trade: self.logger.info('Notice: Trading on testnet.') if self.scrape_only: return sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_order():", "def update_order():", "def update_order():", "def save(self, *args, **kwargs):\n if not self.order_number:\n self.order_number = self._generate_order_number()\n super().save(*args, **kwargs)", "def save(self, *args, **kwargs):\n if not self.order_numbe...
[ "0.7379586", "0.71550333", "0.71550333", "0.63035375", "0.63035375", "0.614624", "0.6069818", "0.602426", "0.5959267", "0.5937161", "0.5893447", "0.58831096", "0.5881218", "0.5865147", "0.5865147", "0.5865147", "0.58274335", "0.5822178", "0.5818749", "0.5810393", "0.5808482",...
0.56688064
43
monitor the websocket for lag and restart if lag is detected, if signals come in while websocket is restarting, then bot will resort to rest api via self.ws_restarting parameter
def monitor_ws(self): started = False restart_count = 0 while True: if not started or self.ws is None: self.ws = BitMEXWebsocket(endpoint="https://www.bitmex.com/api/v1", symbol=self.strategy.symbol, api_key=self.api_key, api_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monitor_ws(self, endpoint='https://www.bitmex.com/api/v1'): #TODO: implement\n started = False\n restart_count = 0\n while True:\n if not started or self.ws.exited or self.ws is None:\n self.ws = BitMEXWebsocket(endpoint=endpoint, symbol=self.symbol,\n ...
[ "0.73614126", "0.6309412", "0.595059", "0.5944019", "0.59311074", "0.5885894", "0.586567", "0.5765681", "0.57259333", "0.56546336", "0.56426543", "0.56327415", "0.5630869", "0.56279796", "0.5622897", "0.56213593", "0.55941254", "0.5586691", "0.55748737", "0.55509716", "0.5523...
0.79196155
0
Token ids from Tokenizer vocab
def get_ids(self,tokens, tokenizer, max_seq_length): token_ids = tokenizer.convert_tokens_to_ids(tokens,) input_ids = token_ids + [0] * (max_seq_length-len(token_ids)) return input_ids
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sentence_to_token_ids(sentence, vocabulary):\n return [vocabulary.get(w, UNK_ID) for w in sentence.strip().split()]", "def vectorize(tokens, vocab):\n ids = []\n for token in tokens:\n if token in vocab.tok2id:\n ids.append(vocab.tok2id[token])\n else:\n ids.appen...
[ "0.74453104", "0.7427918", "0.72003746", "0.7193835", "0.71358985", "0.7134197", "0.7128639", "0.70729506", "0.70416474", "0.7035099", "0.69734365", "0.69675064", "0.69156736", "0.68288344", "0.6781958", "0.6779992", "0.67489445", "0.6704759", "0.6686456", "0.6618584", "0.661...
0.7092017
7
Construct the EM object corresponding to the specified vendor.
def __init__(self, vendor, generic_config, adapter_config): self.set_generic_config(**generic_config) self.em_adapter = construct_adapter(vendor, module_type='em', **adapter_config)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vendor(self, vendor):\n\n self._vendor = vendor", "def setup_vendor(\n vendor_str,\n bucket=None,\n use_encryption=True,\n ignore_prefix=False,\n profile=None,\n **other\n):\n vendor = vendor_str.lower()\n try:\n vendor = ALIASES[vendor]\n except KeyError:\n ra...
[ "0.6443602", "0.6166787", "0.5779186", "0.5756621", "0.5719546", "0.5569656", "0.5553841", "0.5517644", "0.5306806", "0.5202103", "0.5197069", "0.5068234", "0.506652", "0.504566", "0.5044996", "0.4976304", "0.49384418", "0.49314418", "0.48769754", "0.48534948", "0.48517972", ...
0.6419027
1
This function provides the status of a VNF lifecycle management operation. This function was written in accordance with section 7.2.13 of ETSI GS NFVIFA 007 v2.1.1 (201610).
def get_operation_status(self, lifecycle_operation_occurrence_id): return self.em_adapter.get_operation_status(lifecycle_operation_occurrence_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getStatus():", "def status(self):\n self.scion_sh('status')", "def comando_status(self):\r\n\tif args.tipo == 'web':\r\n return self.status_web()\r\n\r\n\tif args.tipo == 'nfce':\r\n return self.consulta_status_nfce()\r\n\r\n\tif args.tipo == 'dual':\r\n return self....
[ "0.68123484", "0.6708237", "0.6699134", "0.66092175", "0.6581816", "0.65742725", "0.65195423", "0.6388407", "0.6376594", "0.6345557", "0.6341616", "0.6336772", "0.6326629", "0.6324543", "0.6319756", "0.6301125", "0.628058", "0.62744135", "0.6257398", "0.6257359", "0.6257359",...
0.6422141
7
This function polls the status of an operation until it reaches a final state or time is up.
def poll_for_operation_completion(self, lifecycle_operation_occurrence_id, final_states, max_wait_time, poll_interval): operation_pending = True elapsed_time = 0 while operation_pending and elapsed_time < max_wait_time: operation_status = self.g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _server_poll_expcompleted_(self):\n #print \"class Princeton_CCD function _server_poll_expcompleted_\" \n try:\n last_state = self.polled_running\n except (AttributeError,UnboundLocalError):\n self.polled_running = False\n last_state = False\n self...
[ "0.7180969", "0.6980559", "0.6892969", "0.6872489", "0.6701094", "0.6588462", "0.65346026", "0.6531489", "0.6487031", "0.6457893", "0.64545697", "0.64471096", "0.6377327", "0.6377327", "0.6345501", "0.6308268", "0.62924045", "0.62827855", "0.6280865", "0.6268159", "0.6243457"...
0.66374624
5
This function is exposed by the EM at the Emtst interface and is used by the Test System to trigger ModifyConfiguration on the VNF from the EM (and through the VNFM). This function is a reexposure of the VNF Configuration Management interface offered by the VNF/VNFM over the VeVnfm reference points. See ETSI GS NFVIFA ...
def modify_vnf_configuration(self, vnf_instance_id, vnf_configuration_data=None, ext_virtual_link=None, vnfc_configuration_data=None): return self.em_adapter.modify_vnf_configuration(vnf_instance_id, vnf_configuration_data, ext_virtual_link, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_func(config_old, config_new):\n\n # This is an example of a firmware upgrade requiring a configuration migration\n \n # Firmware 00.05.XX to 00.06.XX configuration migration.\n # NOTE: This example assumes that the advanced bit-rate (bit-timing) setting is not used\n\n config_new = conf...
[ "0.6424253", "0.5883528", "0.5832548", "0.5803905", "0.5792312", "0.57719773", "0.57702446", "0.5756364", "0.56825936", "0.5677728", "0.5652082", "0.56172705", "0.5587201", "0.55492836", "0.5547896", "0.5518183", "0.54852474", "0.54742813", "0.54489917", "0.5403628", "0.53854...
0.70188683
0
This function is exposed by the EM at the Emtst interface and is used by the Test System to trigger VNF scale operation and check results at the EM. This function scales a VNF horizontally (out/in). This function is a reexposure of the VNF Lifecycle Management interface at the VeVnfmem reference point. See ETSI GS NFVI...
def vnf_scale(self, vnf_instance_id, scale_type, aspect_id, number_of_steps=1, additional_param=None): return self.em_adapter.vnf_scale(vnf_instance_id, scale_type, aspect_id, number_of_steps, additional_param)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _call_scale(vecObj, sc):\n res = vecObj.scale(sc)\n return res", "def scale(self):", "def verticalScaleIncrease(self):\n scaleFac = float(self.qline4.text())\n self.qline4.setText(str(scaleFac * 2))\n self.model.refreshScreen()", "def scale(self, up):\n s = 1.1 if up els...
[ "0.62913805", "0.61345226", "0.59601223", "0.5883413", "0.5786027", "0.5762792", "0.5724653", "0.5712696", "0.5712486", "0.56960535", "0.5693303", "0.56557405", "0.55952173", "0.5524789", "0.5497013", "0.549634", "0.5480721", "0.5480076", "0.5453029", "0.54494715", "0.5434116...
0.6241293
1
This function synchronously scales a VNF horizontally (out/in).
def vnf_scale_sync(self, vnf_instance_id, scale_type, aspect_id, number_of_steps=1, additional_param=None): lifecycle_operation_occurrence_id = self.vnf_scale(vnf_instance_id, scale_type, aspect_id, number_of_steps, additional_param) operation_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale_uv(self):\n self.u = [i * self.scale * self.scaleratio for i in self.u]\n self.v = [i * self.scale for i in self.v]", "def scale(self, sc):\n daskD.wait(self.client.map(_call_scale, self.vecDask, sc=sc, pure=False))\n return self", "def scale(self):", "def _call_scale(ve...
[ "0.5791274", "0.5481162", "0.5469276", "0.5311644", "0.5301182", "0.52593035", "0.51907325", "0.5180283", "0.5180015", "0.5174601", "0.5152834", "0.5144616", "0.5132757", "0.5123352", "0.51101947", "0.51085633", "0.5098054", "0.50869817", "0.5085398", "0.5063626", "0.5062109"...
0.0
-1
Create, delete an object.
def test_simple(h3): # All empty. assert h3.list_buckets() == [] with pytest.raises(pyh3lib.H3NotExistsError): h3.info_object('b1', 'o1') with pytest.raises(pyh3lib.H3NotExistsError): h3.delete_object('b1', 'o1') with pytest.raises(pyh3lib.H3NotExistsError): h3.read_objec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, *args, **kwargs):\n obj, created = self.get_or_create(stub=self.model.STUB_DEFAULT)\n if not created:\n with transaction.atomic():\n obj.delete()\n obj = self.create(stub=self.model.STUB_DEFAULT)\n return obj", "def delete(self, obj):...
[ "0.6477542", "0.64668757", "0.645949", "0.645949", "0.641772", "0.63872", "0.63786584", "0.62908465", "0.6251157", "0.62172925", "0.62172925", "0.62172925", "0.6214557", "0.61662096", "0.6157794", "0.6102822", "0.605769", "0.6039701", "0.6009355", "0.5982904", "0.5981674", ...
0.0
-1
Create, copy an object.
def test_copy(h3): count = 100 # More than 10 assert h3.list_buckets() == [] assert h3.create_bucket('b1') == True assert h3.list_objects('b1') == [] with open('/dev/urandom', 'rb') as f: data = f.read(3 * MEGABYTE) h3.create_object('b1', 'object', data) for i in range(count):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n return Object(_default_item=self._default_item, **self._items)", "def Clone(cls, obj):\n return cls(decompress_files=obj.decompress_files) if obj else None", "def copy(self):\n return object.__new__(type(self))", "def copy(self):\n cls = self.__class__\n resul...
[ "0.7162037", "0.7149872", "0.7120862", "0.7060812", "0.6971831", "0.69080067", "0.68970615", "0.6835823", "0.6831521", "0.6806895", "0.67993116", "0.67769486", "0.6766617", "0.6766617", "0.6734053", "0.67246723", "0.6721302", "0.6712582", "0.66975313", "0.66968155", "0.667769...
0.0
-1
Create many objects. Purge.
def test_purge(h3): assert h3.list_buckets() == [] assert h3.create_bucket('b1') == True assert h3.list_objects('b1') == [] with open('/dev/urandom', 'rb') as f: data = f.read(3 * MEGABYTE) h3.create_object('b1', 'o1', data) h3.create_object('b1', 'o2', data) h3.create_object('b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_all(self):\n if not self.created:\n return\n self.shotgun.batch([dict(\n request_type='delete',\n entity_type=type_,\n entity_id=id_,\n ) for type_, id_ in reversed(self.created)])\n self.created = []", "def _degraded_bulk_create(...
[ "0.62239665", "0.6166164", "0.6149394", "0.61363995", "0.61252594", "0.610809", "0.61057276", "0.60735315", "0.5989256", "0.5980897", "0.5964914", "0.5932444", "0.592054", "0.59132224", "0.5890958", "0.586617", "0.5861265", "0.5836292", "0.5822895", "0.575887", "0.5757986", ...
0.0
-1
Read and write using files.
def test_file(h3): assert h3.list_buckets() == [] assert h3.create_bucket('b1') == True with open('/dev/urandom', 'rb') as f: data = f.read(3 * MEGABYTE) with open('testfile', 'wb') as f: f.write(data) h3.create_object_from_file('b1', 'o1', 'testfile') h3.create_object_from_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n open_read_write()", "def read(path):", "def read(self, filename):\n pass", "def read(self, filename):\n pass", "def Run():\n file_name = AskForFileName()\n file_content = ReadFileContents(file_name)\n head_list = BuildHeadList(file_content)\n atom_list = BuildAt...
[ "0.6532179", "0.61322236", "0.6122945", "0.6122945", "0.6021061", "0.5962787", "0.5890631", "0.5863313", "0.58378553", "0.58014005", "0.57983905", "0.5654645", "0.55896586", "0.55629146", "0.55445087", "0.55445087", "0.5533598", "0.5485481", "0.54689837", "0.5454426", "0.5445...
0.0
-1
Create and read an empty object.
def test_empty(h3): assert h3.list_buckets() == [] assert h3.create_bucket('b1') == True h3.create_object('b1', 'o1', b'') object_info = h3.info_object('b1', 'o1') assert not object_info.is_bad assert object_info.size == 0 object_data = h3.read_object('b1', 'o1') assert object_data =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ReadObject(self, *args, **kwargs):\n pass", "def createBasicObject(self):\n\n\t\treturn self._createBasicObjFunct(self)", "def _mkObject(self):\n return ImmutableObject(\n store=self.store,\n hash=u'somehash',\n contentDigest=u'quux',\n content=self...
[ "0.6376657", "0.61970514", "0.61782616", "0.59999585", "0.59957343", "0.5983896", "0.59829193", "0.5924859", "0.58904916", "0.58284163", "0.5725011", "0.5723589", "0.5714014", "0.5671411", "0.5661745", "0.56002873", "0.5578054", "0.5574107", "0.555871", "0.55338645", "0.55239...
0.5888526
9
Save the histogram and its properties in a npz file
def save(self, filename): if not os.path.isdir( os.path.dirname(filename) ): self.logger.critical('%s does not exist'%os.path.dirname(filename)) raise FileNotFoundError try: fit_func = 'NoneType' if not self.fit_function else self.fit_function.__name__ np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_hist(self, file_name):\n file_ext = file_name.split(\".\")[-1]\n assert file_ext == \"npy\", \"The file extension has to be npy (numpy file)\"\n np.save(file_name, self.hist)", "def save_histogram_data(self, histogram_data, obj_name):\n dirname = os.path.dirname(os.path.abspa...
[ "0.71867526", "0.70626557", "0.7017196", "0.70088106", "0.6667355", "0.66330504", "0.6574414", "0.6519371", "0.64562464", "0.6433873", "0.62954587", "0.62861025", "0.6282882", "0.6270514", "0.62624353", "0.62120754", "0.6199626", "0.6182045", "0.6174208", "0.6165592", "0.6158...
0.70737016
1
Save the histogram and its properties in a npz file
def load(self, filename): if not os.path.isfile( filename ): self.logger.critical('%s does not exist'%filename) raise FileNotFoundError try : file = np.load(filename) self.data = np.copy(file['data']) self.bin_centers = np.copy(file['bin_cen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_hist(self, file_name):\n file_ext = file_name.split(\".\")[-1]\n assert file_ext == \"npy\", \"The file extension has to be npy (numpy file)\"\n np.save(file_name, self.hist)", "def save(self, filename):\n if not os.path.isdir( os.path.dirname(filename) ):\n self.l...
[ "0.7189999", "0.7074685", "0.7061987", "0.7020175", "0.70122737", "0.6671988", "0.6635239", "0.6576272", "0.65154845", "0.6458322", "0.6430016", "0.62998265", "0.6289298", "0.62806946", "0.62723434", "0.62592417", "0.62146103", "0.6199251", "0.61780614", "0.61723524", "0.6168...
0.0
-1
Update the Histogram array with an array of values
def fill(self, value, indices=None): # TODO deal with underflow and overflow and do the doc + optimize the function # change the value array to an array of Histogram index to be modified hist_indices = ((value - self.bin_edges[0]) // self.bin_width).astype(int) # treat overflow and und...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_histogram(self, tag, values, global_step=None, bins='tensorflow'):\n values = make_np(values)\n self.vis.histogram(make_np(values), opts={'title': tag})", "def push_histogram(self, data):\n # Loop through bands of this tile\n for i, dat in enumerate(data):\n # Creat...
[ "0.6830705", "0.67523885", "0.6648374", "0.6395213", "0.6283525", "0.6273418", "0.6271707", "0.62139225", "0.6200964", "0.61929804", "0.6156026", "0.6128089", "0.6018463", "0.6015496", "0.60005915", "0.5975846", "0.5915452", "0.5915452", "0.59093845", "0.59093845", "0.5902604...
0.64837337
3
A function to transform a batch of data in Histogram and add it to the existing one
def fill_with_batch(self, batch, indices=None): # noinspection PyUnusedLocal data, underflow, overflow = None,None,None if not indices: data = self.data underflow = self.underflow overflow = self.overflow else: data = self.data[indices] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_histogram(self, data):\n # Loop through bands of this tile\n for i, dat in enumerate(data):\n # Create histogram for new data with the same bins\n new_hist = numpy.histogram(dat['data'], bins=self.hist_bins[i])\n # Add counts of this tile to band metadata his...
[ "0.69523394", "0.6767134", "0.6438797", "0.6043549", "0.593412", "0.5933531", "0.59027445", "0.58531564", "0.5793045", "0.5790227", "0.57800436", "0.57797366", "0.5761364", "0.57537884", "0.5747389", "0.5728315", "0.5715099", "0.57096684", "0.5699468", "0.5691519", "0.5678225...
0.62129676
3
Return the residuals of the data with respect to a function
def _residual(function, p, x, y, y_err): return (y - function(p, x)) / y_err
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def residuals(self, p, data, X):\n err = data - self.fitfunc(X,p)\n return err", "def residual(params, model_func, x, data, min_x_param=None, max_x_param=None,\n eps=None):\n # Crop the X data according to a fit parameter\n if min_x_param is not None or max_x_param is not None:\n ...
[ "0.75699353", "0.7316754", "0.6957108", "0.69393134", "0.6910241", "0.6838792", "0.67472905", "0.67468846", "0.66880476", "0.668041", "0.66118664", "0.66115135", "0.6595756", "0.6589628", "0.658915", "0.6566147", "0.6532827", "0.65295565", "0.65191776", "0.6509996", "0.647240...
0.7135918
2
Compute poisson error of the sample
def _compute_errors(self): self.errors = np.sqrt(self.data) self.errors[self.errors == 0.] = 1.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def poisson_sd(data: DataSeries) -> DataSeries:\n return data.pow(0.5)", "def get_poisson_uncertainty(x:float) -> float:\n err = np.sqrt(x) if x>=1 else 1.0\n return err", "def poisson(y_true, y_pred):\n y_pred = tensor_conversion.convert_to_tensor_v2_with_dispatch(y_pred)\n y_true = math_ops.cast(y...
[ "0.6744262", "0.6711675", "0.6451199", "0.6346631", "0.6217465", "0.61602235", "0.6137103", "0.61210454", "0.60341156", "0.5975253", "0.59619516", "0.5961279", "0.5951947", "0.59371024", "0.59371024", "0.59371024", "0.59091955", "0.58724505", "0.58334446", "0.58288467", "0.58...
0.0
-1
Perform a fit on this specific Histogram
def _axis_fit(self, idx, func, p0, slice_list=None, bounds=None, fixed_param=None, verbose=False): # TODO inline comment of the function # Reduce the functions parameters according to the fixed_param reduced_p0 = p0 reduced_bounds = bounds reduced_func = func # TODO optim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self, X):", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...
[ "0.73474675", "0.725244", "0.725244", "0.725244", "0.725244", "0.725244", "0.725244", "0.725244", "0.725244", "0.725244", "0.725244", "0.7168676", "0.7168676", "0.7168676", "0.70350116", "0.7007278", "0.6957967", "0.690869", "0.6880627", "0.6856432", "0.68440187", "0.684228...
0.0
-1
An helper to fit Histogram
def fit(self, func, p0_func, slice_func, bound_func, labels_func = None , config=None, limited_indices=None, fixed_param=[], force_quiet=False): # todo COMMENTS and treat the labels data_shape = list(self.data.shape) print(self.fit_result.shape) data_shape.pop() data_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeHistogram(values, numBins, xLabel, yLabel, title=None):", "def histo ( self ,\n xbins = 20 , xmin = None , xmax = None ,\n ybins = 20 , ymin = None , ymax = None ,\n hpars = () , \n histo = None ,\n ...
[ "0.72147185", "0.70465183", "0.68976337", "0.6755789", "0.67428446", "0.6732709", "0.66729593", "0.6659278", "0.66192293", "0.6618425", "0.6576588", "0.65255135", "0.65107584", "0.650957", "0.64876926", "0.6442412", "0.6430534", "0.6425839", "0.64162403", "0.64150983", "0.640...
0.0
-1