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
(WELCOMER) Makes the bot send an 'automatic' message to someone.
async def auto(self, ctx, member: discord.Member = None, language: str = None): await ctx.message.delete() if not language: return await ctx.send('**Inform a language!**', delete_after=3) elif not member: return await ctx.send('**Inform a member!**', delete_after=3) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def inviteme(self):\r\n\r\n #Your code will go here\r\n await self.bot.say(\"Here is a link to Invite Me: http://bit.ly/TacoBot\")", "async def send_welcome(message: types.Message):\n await message.reply(\"Hi!\\nI'm Autoencoder Bot!\\nPowered by aiogram.\\n\\n\"\n \"...
[ "0.63956076", "0.6267433", "0.62231386", "0.6137143", "0.61005366", "0.60548556", "0.60298884", "0.60083765", "0.598648", "0.59720325", "0.59639704", "0.5941054", "0.591133", "0.59047765", "0.5891843", "0.58909124", "0.5877904", "0.5874226", "0.5858276", "0.5822594", "0.58185...
0.5660983
34
(ADM) Announces a message in the announcements channel using the bot.
async def announce(self, ctx): await ctx.message.delete() if len(ctx.message.content.split()) < 2: return await ctx.send('You must inform all parameters!') announce_channel = discord.utils.get(ctx.guild.channels, id=announcement_channel_id) msg = ctx.message.content.split('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def announce(self, ctx, *, msg):\n if self._announce_msg is not None:\n await self.bot.say(\"Already announcing, wait until complete to\"\n \" issue a new announcement.\")\n else:\n self._announce_msg = msg", "async def announcement(ctx, bot...
[ "0.6967236", "0.6468096", "0.576518", "0.5730523", "0.57184154", "0.56924826", "0.56363595", "0.563563", "0.56228656", "0.5613768", "0.5541273", "0.5478032", "0.5477188", "0.54606646", "0.5433697", "0.5374674", "0.53567344", "0.53517914", "0.533829", "0.5317261", "0.5314131",...
0.75351304
0
(ADM) Sends a Direct Message to someone.
async def dm(self, ctx, member: discord.Member = None, *, message=None): await ctx.message.delete() if not message: return await ctx.send("**Inform a message to send!**", delete_after=3) if not member: return await ctx.send("**Inform a member!**", delete_after=3) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def directMessage(self, data, who, header=None):\n sentCount = 0\n logger.debug(\"broadcast - \" + str(data) + \" - \" + str(who))\n\n if data[-1] != \"\\n\": # Add newline if needed\n data += \"\\n\"\n\n # toDo: this should be a name search, instead of a number from 'who'\n...
[ "0.68630266", "0.6698008", "0.6628157", "0.6587868", "0.65431786", "0.64631104", "0.6436485", "0.6355667", "0.62877923", "0.6287189", "0.6271002", "0.62494254", "0.6245958", "0.6154725", "0.6149879", "0.61337346", "0.61082524", "0.6098417", "0.6054641", "0.60543466", "0.59996...
0.61359835
15
Creates the ScheduledEvents table.
async def create_table_scheduled_events(self, ctx: commands.Context) -> None: member = ctx.author await ctx.message.delete() if await self.check_scheduled_events_exists(): return await ctx.send(f"**Table `ScheduledEvents` already exists, {member.mention}!**") mycur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_table(self):\n self.c.execute(\n \"\"\"CREATE TABLE IF NOT EXISTS {table} (\n id integer primary key,\n {event} integer,\n {desc} text,\n {date} text,\n {link} text)\n \"\"\".format(\n table=TABLE,\n ...
[ "0.6760438", "0.66445494", "0.6625416", "0.6529982", "0.64881086", "0.64517707", "0.64487267", "0.6446051", "0.62144834", "0.6160995", "0.61342657", "0.6047282", "0.6020282", "0.59020716", "0.58956474", "0.5894661", "0.5871112", "0.5869499", "0.5816645", "0.5795914", "0.57930...
0.8704623
0
Creates the ScheduledEvents table.
async def drop_table_scheduled_events(self, ctx: commands.Context) -> None: member = ctx.author await ctx.message.delete() if not await self.check_scheduled_events_exists(): return await ctx.send(f"**Table `ScheduledEvents` doesn't exist, {member.mention}!**") mycursor, db...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def create_table_scheduled_events(self, ctx: commands.Context) -> None:\n\n member = ctx.author\n await ctx.message.delete()\n\n if await self.check_scheduled_events_exists():\n return await ctx.send(f\"**Table `ScheduledEvents` already exists, {member.mention}!**\")\n ...
[ "0.8704623", "0.6760438", "0.66445494", "0.6529982", "0.64881086", "0.64517707", "0.64487267", "0.6446051", "0.62144834", "0.6160995", "0.61342657", "0.6047282", "0.6020282", "0.59020716", "0.58956474", "0.5894661", "0.5871112", "0.5869499", "0.5816645", "0.5795914", "0.57930...
0.6625416
3
Creates the ScheduledEvents table.
async def reset_table_scheduled_events(self, ctx: commands.Context) -> None: member = ctx.author await ctx.message.delete() if not await self.check_scheduled_events_exists(): return await ctx.send(f"**Table `ScheduledEvents` doesn't exist yet, {member.mention}!**") mycurso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def create_table_scheduled_events(self, ctx: commands.Context) -> None:\n\n member = ctx.author\n await ctx.message.delete()\n\n if await self.check_scheduled_events_exists():\n return await ctx.send(f\"**Table `ScheduledEvents` already exists, {member.mention}!**\")\n ...
[ "0.8704623", "0.6760438", "0.66445494", "0.6625416", "0.6529982", "0.64517707", "0.64487267", "0.6446051", "0.62144834", "0.6160995", "0.61342657", "0.6047282", "0.6020282", "0.59020716", "0.58956474", "0.5894661", "0.5871112", "0.5869499", "0.5816645", "0.5795914", "0.579309...
0.64881086
5
Checks whether the ScheduledEvents table exists.
async def check_scheduled_events_exists(self) -> bool: mycursor, _ = await the_database() await mycursor.execute("SHOW TABLE STATUS LIKE 'ScheduledEvents'") exists = await mycursor.fetchone() await mycursor.close() if exists: return True else: ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def create_table_scheduled_events(self, ctx: commands.Context) -> None:\n\n member = ctx.author\n await ctx.message.delete()\n\n if await self.check_scheduled_events_exists():\n return await ctx.send(f\"**Table `ScheduledEvents` already exists, {member.mention}!**\")\n ...
[ "0.70320445", "0.6886784", "0.6687293", "0.65553224", "0.6387929", "0.63771653", "0.6334157", "0.6333455", "0.62896025", "0.6260394", "0.6249291", "0.6241071", "0.61995167", "0.61830574", "0.61741245", "0.61682135", "0.61477774", "0.61429816", "0.6095434", "0.607051", "0.6070...
0.87525564
0
Checks whether the advertising time is due.
async def check_advertising_time(self, current_ts: int, event_label: str, ad_time: int) -> bool: mycursor, _ = await the_database() await mycursor.execute(""" SELECT * from ScheduledEvents WHERE event_label = %s AND %s - event_ts >= %s """, (event_label, current_ts, ad_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_attack(self):\n now = time.time() * 1000\n if self.prev_time is None:\n return True\n else:\n next_time = self.prev_time + self.get_recharge\n if now >= next_time:\n return True\n else:\n return False", "def ...
[ "0.72752774", "0.6964547", "0.6849957", "0.6738011", "0.66971064", "0.6653395", "0.6607808", "0.657862", "0.6547221", "0.65231436", "0.6503476", "0.64633894", "0.64558476", "0.64554447", "0.645044", "0.6448048", "0.6444591", "0.6404285", "0.6402235", "0.6397026", "0.63682806"...
0.73352146
0
Gets an advertising event.
async def get_advertising_event(self, event_label: str) -> List[Union[str, int]]: mycursor, _ = await the_database() await mycursor.execute("SELECT * FROM ScheduledEvents WHERE event_label = %s", (event_label,)) event = await mycursor.fetchone() await mycursor.close() return eve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_event(self):\r\n return self.events[0]", "def get_event(self):\n return self.keys.events.get()", "def event(self):\n return self.events[0]", "def get_event(self, eventid):\n return self.s.query(Event).get(eventid)", "def get(self, request):\n return self.serviceHa...
[ "0.6796218", "0.6571147", "0.6518009", "0.6428353", "0.6365014", "0.6356171", "0.6340592", "0.6254626", "0.6249749", "0.61499524", "0.611407", "0.6099456", "0.60907185", "0.5956177", "0.59288603", "0.5909034", "0.5888112", "0.5860088", "0.5835143", "0.58041567", "0.5797278", ...
0.69491845
0
Inserts an advertising event.
async def insert_advertising_event(self, event_label: str, current_ts: int) -> None: mycursor, db = await the_database() await mycursor.execute("INSERT INTO ScheduledEvents (event_label, event_ts) VALUES (%s, %s)", (event_label, current_ts)) await db.commit() await mycursor.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_event(self, content: Content):\n self.strg_ctrl.insert_event(self.feed_id, content)", "def insertEvent(self, event):\r\n key=event.time\r\n newitem = [key, event]\r\n for i,item in enumerate(self.__agenda):\r\n if key < item[0]: \r\n self.__agenda....
[ "0.66896", "0.6435405", "0.6179106", "0.6176938", "0.5847098", "0.5748609", "0.5719639", "0.5614003", "0.55954117", "0.55807173", "0.55591655", "0.5534922", "0.54850656", "0.5472918", "0.5435257", "0.5365861", "0.5321969", "0.5307204", "0.52931255", "0.52748203", "0.52549535"...
0.6802399
0
Updates the timestamp of the advertising event.
async def update_advertising_time(self, event_label: str, current_ts: int) -> None: mycursor, db = await the_database() await mycursor.execute("UPDATE ScheduledEvents SET event_ts = %s WHERE event_label = %s", (current_ts, event_label)) await db.commit() await mycursor.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_timestamp(self):\n self._timestamp = datetime.datetime.now()", "def updateTimeStamp(self, ts):\n self.ga_timestamp = ts", "def event_timestamp(self, event_timestamp):\n\n self._event_timestamp = event_timestamp", "def append_event(self, timestamp: datetime, event_type: EventTy...
[ "0.7111035", "0.7030082", "0.62072915", "0.59333533", "0.59035164", "0.5846996", "0.5828776", "0.5828776", "0.5828776", "0.5828776", "0.5828776", "0.5828776", "0.5828776", "0.5763976", "0.57422715", "0.5729423", "0.5669223", "0.56426877", "0.5626922", "0.5625073", "0.5587573"...
0.6941597
2
Called when the other end calls write_eof() or equivalent. This callback may be exercised by the nc(1) client argument ``z``.
def eof_received(self): logger.debug("EOF from client, closing.") self.connection_lost(None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_eof(self):\n self._check_status()\n if not self._writable:\n raise TransportError('transport is not writable')\n if self._closing:\n raise TransportError('transport is closing')\n try:\n self._handle.shutdown(self._on_write_complete)\n e...
[ "0.6295354", "0.61444765", "0.59688306", "0.59359473", "0.58836323", "0.57762265", "0.5693101", "0.5638879", "0.56224006", "0.56115675", "0.55706316", "0.55706316", "0.55706316", "0.55685127", "0.55544186", "0.55434436", "0.5490538", "0.5476318", "0.54692584", "0.54628587", "...
0.6340887
0
Called when the connection is lost or closed.
def connection_lost(self, exc): if self._closing: return self._closing = True # inform yielding readers about closed connection if exc is None: logger.info("Connection closed for %s", self) self.reader.feed_eof() else: logger.info(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connectionLost(self,reason):\n pass", "async def connection_lost(self):\n logging.info('connection dropped')", "def connectionLost(reason):", "def connection_closed(self, exc):\n _logger.info(\"Connection lost: %s\", str(exc))\n super().close()", "def connection_lost(self, e...
[ "0.8473634", "0.83901465", "0.8384363", "0.83001703", "0.82910687", "0.82352555", "0.81307006", "0.8114227", "0.80003196", "0.7977182", "0.7918605", "0.7866092", "0.7850122", "0.7846039", "0.78105974", "0.779474", "0.77219236", "0.76828223", "0.7656635", "0.7630071", "0.76252...
0.7089517
48
Called when a connection is made. Sets attributes ``_transport``, ``_when_connected``, ``_last_received``, ``reader`` and ``writer``. Ensure ``super().connection_made(transport)`` is called when derived.
def connection_made(self, transport): self._transport = transport self._when_connected = datetime.datetime.now() self._last_received = datetime.datetime.now() reader_factory = self._reader_factory writer_factory = self._writer_factory reader_kwds = {} writer_kwds...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connection_made(self, transport: BaseTransport) -> None:\n self.transport = transport", "def connection_made(self, transport):\n print('Connection Made')\n self.transport = transport", "def connection_made(self, transport):\n self.transport = transport\n self.on_connected...
[ "0.7746852", "0.77213734", "0.76538384", "0.7543223", "0.7519254", "0.71371055", "0.7102876", "0.71006286", "0.69904965", "0.6950871", "0.69351697", "0.690995", "0.66259885", "0.66192645", "0.65338343", "0.6512166", "0.6494174", "0.644675", "0.6437705", "0.60995424", "0.60450...
0.8196434
0
Process bytes received by transport.
def data_received(self, data): # This may seem strange; feeding all bytes received to the **writer**, # and, only if they test positive, duplicating to the **reader**. # # The writer receives a copy of all raw bytes because, as an IAC # interpreter, it may likely **write** a resp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_received(self, data):\n self._log.debug(\"recv %s\", data)\n self.incomingMessageBuffer += data\n\n if not self.started:\n # Need to check the startByte to see if we can receive\n if not self.startByte in self.incomingMessageBuffer:\n # We cut the ...
[ "0.7038003", "0.69510216", "0.69052064", "0.68713504", "0.67806935", "0.6757512", "0.6692311", "0.65962946", "0.6584246", "0.65800625", "0.656838", "0.656641", "0.65520895", "0.6493834", "0.6470318", "0.6468363", "0.64630246", "0.64630246", "0.64630246", "0.64630246", "0.6463...
0.6277733
27
Time elapsed since client connected, in seconds as float.
def duration(self): return (datetime.datetime.now() - self._when_connected).total_seconds()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elapsed_time_in_seconds(self):\n return self._elapsed_time_in_seconds", "def duration(self):\n if self._connected:\n return (datetime.datetime.now() - self._connected).total_seconds()\n return float('inf')", "def duration(self) -> float:\n return time.time() - self.co...
[ "0.7489594", "0.74188197", "0.7321411", "0.7258974", "0.7157413", "0.7114975", "0.7096659", "0.7065171", "0.70002097", "0.69881487", "0.6917328", "0.6911001", "0.69096434", "0.6845181", "0.6840852", "0.68355215", "0.6788002", "0.67572224", "0.67431957", "0.6735307", "0.673407...
0.75461715
0
Time elapsed since data last received, in seconds as float.
def idle(self): return (datetime.datetime.now() - self._last_received).total_seconds()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ms(self):\n # my clock uses seconds internally\n return 1000 * self.read()", "def recv_time(self) -> float:\n return ntp_to_system_time(self.recv_timestamp)", "def elapsed_time_in_seconds(self):\n return self._elapsed_time_in_seconds", "def get_elapsed(self):\n delta = ...
[ "0.75423217", "0.73701847", "0.732486", "0.7265605", "0.7202403", "0.717337", "0.71578866", "0.7030599", "0.70195496", "0.69572425", "0.6928816", "0.69168377", "0.69168377", "0.69168377", "0.69168377", "0.69168377", "0.69168377", "0.69095606", "0.69031376", "0.6891059", "0.68...
0.64703196
65
Get optional server protocol or transport information.
def get_extra_info(self, name, default=None): if self._transport: default = self._transport._extra.get(name, default) return self._extra.get(name, default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def protocol_details(self) -> Optional[pulumi.Input['ServerProtocolDetailsArgs']]:\n return pulumi.get(self, \"protocol_details\")", "def protocol_details(self) -> Optional[pulumi.Input['ServerProtocolDetailsArgs']]:\n return pulumi.get(self, \"protocol_details\")", "def protocol(self) -> Optiona...
[ "0.75405777", "0.75405777", "0.68713045", "0.6847968", "0.6670006", "0.6615573", "0.65788776", "0.65390176", "0.6468236", "0.64538616", "0.63897437", "0.632815", "0.62840533", "0.62331843", "0.61603165", "0.61277384", "0.61277384", "0.61277384", "0.61277384", "0.61277384", "0...
0.5525014
54
Begin onconnect negotiation. A Telnet server is expected to demand preferred session options immediately after connection. Deriving implementations should always call ``super().begin_negotiation()``.
def begin_negotiation(self): self._check_later = asyncio.get_event_loop().call_soon( self._check_negotiation_timer ) self._tasks.append(self._check_later)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def begin_negotiation(self):\n if self._closing:\n self.waiter_connected.cancel()\n return\n\n self._loop.call_soon(self.check_negotiation)", "def begin_advanced_negotiation(self):\n pass", "def check_negotiation(self):\n if self._closing:\n self.wai...
[ "0.7393536", "0.65938675", "0.6549495", "0.6211363", "0.58781517", "0.58409035", "0.5833859", "0.57080007", "0.56524163", "0.55732745", "0.5566451", "0.55559033", "0.55526525", "0.55511695", "0.55292064", "0.5454543", "0.54395497", "0.5424254", "0.542225", "0.54040325", "0.53...
0.6509854
3
Begin advanced negotiation. Callback method further requests advanced telnet options. Called once on receipt of any ``DO`` or ``WILL`` acknowledgments received, indicating that the remote end is capable of negotiating further.
def begin_advanced_negotiation(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def begin_negotiation(self):\n if self._closing:\n self.waiter_connected.cancel()\n return\n\n self._loop.call_soon(self.check_negotiation)", "def negotiation_should_advance(self):\n # Generally, this separates a bare TCP connect() from a True\n # RFC-compliant t...
[ "0.59198445", "0.57896835", "0.5568085", "0.55480313", "0.5160394", "0.503215", "0.4938892", "0.48619843", "0.47623533", "0.4716586", "0.47029376", "0.46880955", "0.46534738", "0.46363252", "0.4619564", "0.46188635", "0.46145657", "0.45824525", "0.45603034", "0.455962", "0.45...
0.67340714
0
Encoding that should be used for the direction indicated. The base implementation always returns the encoding given to class initializer, or, when unset (None), ``USASCII``.
def encoding(self, outgoing=False, incoming=False): # pylint: disable=unused-argument return self.default_encoding or "US-ASCII"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encoding(self, outgoing=False, incoming=False):\n assert outgoing or incoming\n return (self.env.get('CHARSET', self._default_encoding)\n if (outgoing and not incoming and self.outbinary) or (\n not outgoing and incoming and self.inbinary) or (\n ...
[ "0.6991464", "0.69778", "0.6884511", "0.6861322", "0.6802753", "0.6802753", "0.6802753", "0.6802753", "0.6790363", "0.6737713", "0.6689147", "0.6489467", "0.6467056", "0.6440495", "0.6418696", "0.6411266", "0.63548106", "0.6142244", "0.61268723", "0.6124121", "0.60555106", ...
0.7481137
0
Whether advanced negotiation should commence.
def negotiation_should_advance(self): # Generally, this separates a bare TCP connect() from a True # RFC-compliant telnet client with responding IAC interpreter. server_do = sum(enabled for _, enabled in self.writer.remote_option.items()) client_will = sum(enabled for _, enabled in self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_negotiation(self, final=False):\n if not self._advanced and self.negotiation_should_advance():\n self._advanced = True\n logger.debug(\"begin advanced negotiation\")\n asyncio.get_event_loop().call_soon(self.begin_advanced_negotiation)\n\n # negotiation is c...
[ "0.69260913", "0.67120564", "0.58638775", "0.5733265", "0.5602215", "0.5586874", "0.55329067", "0.55127007", "0.54190314", "0.5394952", "0.53668785", "0.5343635", "0.52741605", "0.52627194", "0.5261908", "0.5255557", "0.5226124", "0.52245325", "0.5219944", "0.51779395", "0.51...
0.72975564
0
Callback, return whether negotiation is complete.
def check_negotiation(self, final=False): if not self._advanced and self.negotiation_should_advance(): self._advanced = True logger.debug("begin advanced negotiation") asyncio.get_event_loop().call_soon(self.begin_advanced_negotiation) # negotiation is complete (retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_negotiation(self):\n if self._closing:\n self.waiter_connected.cancel()\n return\n pots = self.stream.pending_option\n if not any(pots.values()):\n if self.duration > self.CONNECT_MINWAIT:\n # the number of seconds since connection has ...
[ "0.6801442", "0.6568575", "0.61798817", "0.60798776", "0.60071146", "0.59360796", "0.56638616", "0.5614649", "0.5547745", "0.5415259", "0.54142064", "0.54036856", "0.53632724", "0.535246", "0.5343512", "0.53294545", "0.5275654", "0.52629775", "0.52530646", "0.522893", "0.5228...
0.69614357
0
Validate an Science Metadata XML file.
def assert_valid(format_id, xml): if isinstance(xml, lxml.etree._Element) or isinstance(xml, lxml.etree._ElementTree): validate_tree(format_id, xml) elif isinstance(xml, bytes): validate_bytes(format_id, xml) elif isinstance(xml, str): validate_path(format_id, xml) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate(self):\n if not self._contents.has_key('type'):\n raise ValidationFailed(\"Metadata file %s contains no type field\" % (self._filename))\n \n if not self._contents.has_key('version'):\n raise ValidationFailed(\"Metadata file %s contains no version field\" %\...
[ "0.6776729", "0.6583238", "0.63801646", "0.6338831", "0.63174623", "0.627513", "0.6256632", "0.62440014", "0.61236185", "0.599172", "0.5920939", "0.5914909", "0.59133846", "0.590178", "0.58057374", "0.57970554", "0.5787906", "0.57686836", "0.5767259", "0.57442605", "0.5739704...
0.5263726
59
Renvoyer les groupes actifs
def active(self): return self.filter(active=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refreshGroups(self):\n self.groups = []\n\n self.addGroupsWithIds(self._getGroupIdsJoined())\n self.addGroupsWithIds(self._getGroupIdsInvited(), False)", "def braid_group_action(self):\n G = []\n for c in self:\n c = c.relabel()\n if any(c in g for g i...
[ "0.56621975", "0.5422322", "0.540218", "0.53906757", "0.51505005", "0.5147161", "0.51288426", "0.50973576", "0.508368", "0.5066648", "0.5061436", "0.5027864", "0.5020251", "0.5011031", "0.4997329", "0.49531445", "0.4943913", "0.4941152", "0.487784", "0.4866744", "0.48649377",...
0.0
-1
Renvoyer une page portant un UUID
def get_by_uuid(self, uuid): return self.get(uuid=uuid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_uuid(self):\n uuid = self.request.GET.get('id')\n\n self.publisher = get_object_or_404(Publisher, verbose_id=uuid)\n\n if not self.publisher.is_active:\n raise Http404(\"Link already used or expired.\")\n\n self.publisher.session_start = timezone.now()\n self.p...
[ "0.56170017", "0.546069", "0.546069", "0.546069", "0.52848023", "0.5265702", "0.52582395", "0.52582395", "0.52582395", "0.52582395", "0.51892453", "0.51799047", "0.5146314", "0.51038396", "0.5088354", "0.5075795", "0.5073793", "0.50231856", "0.49986526", "0.49932867", "0.4990...
0.0
-1
Renvoyer une page portant un slug
def get_by_slug(self, slug): return self.get(slug=slug)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_url_slug(self, slug):\n slug = slug[-7:]\n if len(slug) == 7 and \\\n slug[0] == \"p\" and \\\n all(x in ascii_letters + digits for x in slug):\n self.slug = slug\n self.url = \"https://rpaste.com/\" + slug\n self.api_url = \"http...
[ "0.666046", "0.63155615", "0.63155615", "0.62892014", "0.6241365", "0.6082875", "0.5989362", "0.59052235", "0.5868721", "0.58352196", "0.57900846", "0.57820123", "0.5769059", "0.57525", "0.5738554", "0.57298195", "0.57167655", "0.5701861", "0.5663073", "0.56534237", "0.562808...
0.0
-1
Renvoyer la description de l'option
def get_text(self): try: return self.get_translation().text except MissingTranslation: return _("(No text)")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_description(self, option, desc):\n _, command = self.__options[option]\n self.__options[option] = (desc, command)", "def help_description():\n pass", "def help_opt(self):\n print(OPTIONS)", "def description():", "def description(self):", "def get_desc(option_name):\...
[ "0.77296084", "0.7125089", "0.71248794", "0.70966256", "0.70509964", "0.69682354", "0.69006914", "0.6865404", "0.6865404", "0.6803275", "0.6795285", "0.6795285", "0.67554784", "0.6708599", "0.66754556", "0.6666923", "0.66633236", "0.66567886", "0.6650505", "0.66347545", "0.66...
0.0
-1
Renvoyer le titre de la page
def get_title(self): try: return self.get_translation().title except MissingTranslation: return _("(No title)")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_title():", "def title(self, title):\n\t\tself.head += '<title>' + title + '</title>\\n'", "def _visit_title(self, elem):\n title_text = self._text_of(elem).strip()\n print \"document title=\"+ repr(title_text)\n\n # TODO update document title for document id self._curr_doc_id\n ...
[ "0.72360647", "0.7129643", "0.71291935", "0.7091174", "0.69167405", "0.6885677", "0.6884727", "0.6802496", "0.67752737", "0.67278254", "0.66880256", "0.66102135", "0.6556041", "0.6539143", "0.65386605", "0.6527176", "0.6525919", "0.6496958", "0.649229", "0.64881176", "0.64713...
0.0
-1
Creates a new database from scratch loading the info from datalog.csv and extracts info from the each session's .tdms file If a preexisting database is passed it will add the sessions not already present
def create_database(excelpath, database=None): def generate_database_from_metadatas(metadata_dict, stimulus_dict): """ Given a dictionary of session objects with their metadata creates a new database with all the sessions in the database and the associated metadata """ # Cre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_db_setup() -> None:\n db_filename = \"twdft.db\"\n db_path = os.path.join(TWDFT_DATA_DIR, db_filename)\n csv_filename = \"sites.csv\"\n csv_path = os.path.join(TWDFT_DATA_DIR, csv_filename)\n db_is_new = not os.path.exists(db_path)\n sites_csv = os.path.join(TWDFT_DATA_DIR, csv_filena...
[ "0.623949", "0.6126668", "0.6094227", "0.6067609", "0.6060192", "0.6055851", "0.6054817", "0.6004642", "0.5970945", "0.5953632", "0.5857623", "0.58563125", "0.58413136", "0.5826197", "0.57636046", "0.5752786", "0.5735318", "0.5718436", "0.5713309", "0.57069284", "0.5704334", ...
0.6542749
0
Given a dictionary of session objects with their metadata creates a new database with all the sessions in the database and the associated metadata
def generate_database_from_metadatas(metadata_dict, stimulus_dict): # Create empty database from template class indexes = sorted(metadata_dict.keys()) database = pd.DataFrame(index=indexes, columns=['Number', 'Metadata', 'Tracking', 'Registration', 'Stimuli']) # Fill in metadata from th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def database_session_wide(app) -> SQLAlchemy:\n if os.path.exists(get_test_database_path()):\n os.unlink(get_test_database_path())\n\n from pipwatch_api.datastore.models import DATABASE\n DATABASE.init_app(app=app)\n DATABASE.create_all()\n yield DATABASE\n\n DATABASE.drop_all()\n DATAB...
[ "0.6652588", "0.6618158", "0.6533384", "0.6390175", "0.6344271", "0.63380307", "0.6321619", "0.6237914", "0.6227624", "0.62212944", "0.62153596", "0.6207867", "0.61359006", "0.6103177", "0.61003464", "0.60975677", "0.6092535", "0.60867435", "0.6059832", "0.5968431", "0.596832...
0.6749462
0
Get relevant variables for video files
def get_session_videodata(videos): # Get first frame of first video for future processing and number of frames in each video videos_data = {'Frame rate': [], 'Number frames': []} for idx, videofile in enumerate(videos): cap = cv2.VideoCapture(videofile) videos_data['Frame...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_video_params(video_filename):\n \n width, height = get_video_aspect(video_filename)\n frame_rate = get_video_frame_rate(video_filename)\n return width, height, frame_rate", "def get_video_parts(video_path):\n parts = video_path.split(os.path.sep)\n print(\"parts: \", parts)\n filenam...
[ "0.68774587", "0.65146446", "0.65075433", "0.64062", "0.6379639", "0.6262825", "0.6166479", "0.61463535", "0.61107457", "0.60714453", "0.60651374", "0.6056583", "0.6001268", "0.5994215", "0.5975424", "0.5951455", "0.5923903", "0.5923903", "0.590762", "0.58535546", "0.58266294...
0.5403263
54
loops over a list of dictionary with the info for each session and gets all the stimulus onset times
def get_stim_onset_times(sessions, metadata_dict): if not isinstance(sessions, list): sessions = list(sessions) for line in sessions: session_id = line['Sess.ID'] if session_id: # we loaded a line with session info session_name = '{}_{}'.format(line[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTimes():", "def getTimes():", "def getTimes():", "def get_times_from_sessions(sorting_man, sessions,\n sign='pos', skip_artifacts=True):\n return get_data_from_sessions(sorting_man, sessions,\n sign, ['times'], skip_artifacts)", "def sta...
[ "0.65231055", "0.65231055", "0.65231055", "0.6393931", "0.6184825", "0.6122553", "0.59389263", "0.59258145", "0.5923464", "0.5921139", "0.5858588", "0.58490074", "0.5847726", "0.58407706", "0.578101", "0.57597786", "0.57564735", "0.57446367", "0.57149935", "0.5639643", "0.561...
0.7422578
0
loops over a list of dictionary with the info for each session and gets all the metadata
def get_metadata(sessions): if not isinstance(sessions, list): sessions = list(sessions) for line in sessions: session_id = line['Sess.ID'] if session_id: # we loaded a line with session info session_name = '{}_{}'.format(line['Experiment'], line['Se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_metadata(session, url, filelist):\n metadata = {}\n # Loop over the Clowder dataset image ID list\n for clowder_img in filelist.json():\n # Get metadata for the image from Clowder\n response = clowder_file_metadata(session, url, clowder_img['id'])\n # Metadata from multiple ex...
[ "0.6214154", "0.5921212", "0.5755976", "0.57426655", "0.5742081", "0.57078063", "0.56998515", "0.5668264", "0.5618146", "0.55938953", "0.5592542", "0.55439705", "0.5542058", "0.55399126", "0.5531447", "0.55264294", "0.5500047", "0.5478684", "0.54766417", "0.5467299", "0.54621...
0.743502
0
Looks up the actual Object in the database from the reference Object type and id.
def get_real_object(self): query_string = dedent(f"""\ import app.config.models_importer as models_importer class_ = models_importer.all_models['{self.ref_class}'] class_.query.get({self.ref_id})""") return exec(query_string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_object(id):", "def fetch_obj(type, id, error=404, new_id=False):\n if id is None:\n abort(error)\n obj_q = Session.query(type)\n obj = obj_q.get(int(id))\n #else:\n # obj = obj_q.filter(type.ID==int(id)).first()\n\n if obj is None:\n abort(error)\n return obj", "de...
[ "0.7572834", "0.7381233", "0.7321605", "0.73170555", "0.7314897", "0.7191542", "0.7136345", "0.6927527", "0.68669856", "0.6810396", "0.6809115", "0.6793943", "0.6739646", "0.6723026", "0.67192173", "0.6651672", "0.6617682", "0.66116595", "0.65260905", "0.6520378", "0.6511444"...
0.6220674
40
Looks up if an object exists at a location in the mapping.
def get_object_at_location(cls, x, y): object_map_at_target_location = cls.query\ .filter_by(x=x, y=y).one_or_none() if not object_map_at_target_location: return None return object_map_at_target_location.get_real_object()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists(self, obj):\n return False", "def exists(self):\n try:\n self.world.find(self.ehandle)\n except KeyError:\n return False\n else:\n return True", "def does_exist(self, index):\n if index in self.map:\n return True\n return False", "def objExis...
[ "0.73800594", "0.72758543", "0.7176184", "0.69012296", "0.6774274", "0.67585844", "0.66684556", "0.65811926", "0.6520412", "0.6473279", "0.6463379", "0.6448591", "0.64393646", "0.6435208", "0.64135206", "0.6353437", "0.633155", "0.633121", "0.6327503", "0.62858474", "0.627192...
0.6310279
19
Creates a new mapping for an object.
def add_object(world_id, object_to_be_added): try: new_mapping = Map(world_id, object_to_be_added.x, object_to_be_added.y, object_to_be_added.__class__.__name__) new_mapping.save() retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_mapping(self):\n\n indice = client.IndicesClient(self.es)\n\n indice.put_mapping(index=self.es_main_index,\n doc_type=self.es_main_type,\n body=self.mapping)", "def createObjectPropertyMap(self, propertyName: unicode, objectClass: java....
[ "0.6933795", "0.6713559", "0.64649796", "0.6422688", "0.6359902", "0.63087314", "0.61878854", "0.6184359", "0.61745393", "0.61547184", "0.6150395", "0.6137379", "0.61200297", "0.61163414", "0.60887134", "0.6078142", "0.60079116", "0.588799", "0.588419", "0.58624023", "0.58471...
0.6281971
6
Removes a mapping for an object.
def remove_object(cls, object_to_be_removed): cls.query.filter_by(x=object_to_be_removed.x, y=object_to_be_removed.y).delete()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeObjectMap(self,fromMod,toMod):\n if self.objectMaps == None: self.loadObjectMaps()\n del self.objectMaps[(fromMod,toMod)]", "def remove(self) -> None:\n self.map.remove_ent(self)", "def remove_object(self, object_to_be_removed):\n Map.remove_object(object_to_be_removed)\n ...
[ "0.76087886", "0.69040036", "0.6808092", "0.6663382", "0.6503783", "0.648401", "0.6435927", "0.64278466", "0.63999915", "0.63896525", "0.6350306", "0.6347722", "0.6304896", "0.6236945", "0.6230317", "0.6214767", "0.6190034", "0.6178722", "0.61747366", "0.6108503", "0.60911536...
0.62559956
13
Change from date to month
def date_to_month(date): return re.sub(r'(\d{4}-\d{2})-\d{2}', r'\1', date)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_month(date):\n return date.month", "def MONTH(date):\n return _make_datetime(date).month", "def setMonth(self, *args):\n return _libsbml.Date_setMonth(self, *args)", "def get_month(self, indate):\n return indate.strftime(\"%B\") + \"-\" + indate.strftime(\"%Y\")", "def decrement_...
[ "0.77243966", "0.735111", "0.71769124", "0.71729517", "0.6849947", "0.6843161", "0.6707294", "0.66655874", "0.6617973", "0.661158", "0.6599854", "0.6599854", "0.65967923", "0.6558509", "0.65565616", "0.65458804", "0.6489243", "0.64884037", "0.63371634", "0.63212645", "0.63069...
0.7433812
1
Disassemble the json into dictionary
def disassemble_json(arr, k1, k2): result = {} for cat in arr: name = cat[k1] regional_data = cat['regional_data'] result[name] = {} for d in regional_data: try: state = d['state'] result[name][state] = {} for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unpack(self, json_value):\r\n json_d = json.loads(json_value)\r\n if type(json_d) != dict:\r\n json_d = {}\r\n\r\n comment_value = json_d.get('comment', '')\r\n if not isinstance(json_d, basestring):\r\n comment_value = ''\r\n\r\n options_value = json_d...
[ "0.6933589", "0.67503077", "0.6243915", "0.61909956", "0.6159958", "0.6102296", "0.6101179", "0.60537624", "0.60341233", "0.60074747", "0.6004937", "0.59470916", "0.59469193", "0.58795965", "0.587641", "0.58634216", "0.58214486", "0.58062303", "0.5794942", "0.57931095", "0.57...
0.5959185
11
Generate a month step of dates
def date_range(starting_date, ending_date): l = list() curr_month = get_date_end_num(starting_date) e_y, e_m, _ = map(int, ending_date.split('-')) c_y, c_m, _ = map(int, curr_month.split('-')) while e_y > c_y or (e_y == c_y and e_m >= c_m): l.append(curr_month) c_m += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def per_month(start: datetime, end: datetime, n: int = 1):\n curr = start.replace(day=1, hour=0, minute=0, second=0, microsecond=0)\n while curr < end:\n curr_end = add_month(curr, n)\n yield curr, curr_end\n curr = curr_end", "def daysPassedMonth():\n daysPerMonth = np.array([31,28...
[ "0.6915523", "0.65227723", "0.65222013", "0.6505257", "0.6489711", "0.64721024", "0.6427783", "0.63848954", "0.638474", "0.63519174", "0.6351915", "0.6335714", "0.6320129", "0.63189155", "0.6214998", "0.62080663", "0.6198794", "0.61806583", "0.6155854", "0.61311424", "0.61062...
0.5385918
98
Write a test that ensures some other property holds for your functions.
def test_relu_back(x, y): if x > 0: assert op.relu_back(x, y) == y else: assert op.relu_back(x, y) == 0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testFunctionName(self):\n with self.assertRaises(AttributeError):\n Manager.Properties.Version.Set(get_object(TOP_OBJECT), {})", "def test_properties_get(self):\n pass", "def test_change_provisioned_throughput_usual_case():", "def test_properties(self):\n with pytest.raise...
[ "0.6913338", "0.6777949", "0.6662517", "0.6655613", "0.65742916", "0.656769", "0.6565392", "0.6535939", "0.6523745", "0.6501006", "0.64964473", "0.6491478", "0.6476775", "0.63888496", "0.63771737", "0.6367507", "0.63540363", "0.63540363", "0.63540363", "0.63540363", "0.635403...
0.0
-1
Get the interpolation function for the sediment thickness data using radial basis function
def _get_Rbf_func(self,sed_file='/work3/wang/code_bkup/ToolKit/Models/SedThick/sedthick_world_v2.xyz'): thk_xyz = np.loadtxt(sed_file) minlat = self.attrs['minlat'] maxlat = self.attrs['maxlat'] minlon = self.attrs['minlon'] maxlon = self.attrs['maxlon'] lat_pss = np.logical_and(thk_xyz[:,1]>=minlat, thk_xy...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _c_numeric(self, rij):\n radial_fun = np.zeros((self.lmax+1, self.nmax))\n radial_fun[0,1] = 1.0\n\n #Get local references to these variables so that we don't need `self`\n #all over in the overbasis calculation below.\n alpha = self.alpha\n rb = self.rb \n ...
[ "0.59994715", "0.58455396", "0.5843439", "0.57867277", "0.5599836", "0.5571178", "0.55528456", "0.5523423", "0.54624623", "0.54572916", "0.54457825", "0.5435517", "0.54330575", "0.5379174", "0.5377635", "0.53520775", "0.5348289", "0.5328189", "0.53206325", "0.53190476", "0.53...
0.0
-1
Get the function from Nearest interpolation for the oceanic age field
def _get_age_func(self) : age_nc_Arr = self['age_nc_Arr'].value age_lon_Vec = self['age_lon_Vec'].value age_lat_Vec = self['age_lat_Vec'].value xx, yy = np.meshgrid(age_lon_Vec, age_lat_Vec) # xx for longitude, yy for latitude xx = xx.reshape(xx.size) #nearest yy = yy.reshape(yy.size) x = np.column_stack(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interpolate_model(self, age):\n\n # easy exit:\n if (age < self.models[0].glb[iage]): return None\n if (age > self.models[-1].glb[iage]): return None\n\n istart = 0\n istop = len(self.models)-1\n while (istop > istart+1):\n itemp = (istop+istart)//2\n ...
[ "0.574289", "0.56960344", "0.5642655", "0.54970354", "0.5492774", "0.54384196", "0.5385632", "0.5368975", "0.53457355", "0.53434247", "0.53386706", "0.5294346", "0.5285072", "0.52787054", "0.52730745", "0.5235761", "0.5208889", "0.52074367", "0.5201311", "0.51824677", "0.5178...
0.7788994
0
Get tomography dataset from h5 file
def get_tomo_data(self,threshold=20.): dset = raytomo.RayTomoDataSet(self.attrs['tomo_f']) for prd in self.attrs['prd_arr']: group = self['%g_sec'%( prd )] dset.get_data4plot(dataid=self.attrs['dataid'].decode('utf-8'), period=prd) pdens = dset.pdens mask_pdens = dset.pdens < threshold tomo_data = np...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_h5_dataset(self):\n dev = self.getParentObj()\n top = dev.getFileDescriptor()\n for attr in self._attr_list:\n data = top.get(attr)\n if data is None:\n msg = \"Unable to open object (Object %s doesn't exist)\" % attr\n raise Taurus...
[ "0.71766937", "0.68980134", "0.6668635", "0.66649264", "0.6643761", "0.6630398", "0.65814763", "0.65469646", "0.6514351", "0.6514351", "0.64982295", "0.649504", "0.64600307", "0.6434991", "0.6372724", "0.6336845", "0.6264038", "0.620533", "0.6172712", "0.61714697", "0.6161946...
0.0
-1
Get age array for the grids of the tomography result
def get_age_arr(self,renew=False): dset = dispDBase.dispASDF(self.attrs['age_h5']) minlat = self.attrs['minlat'] maxlat = self.attrs['maxlat'] minlon = self.attrs['minlon'] maxlon = self.attrs['maxlon'] dset.set_poly(self.poly_lst,minlon,minlat,maxlon,maxlat) dset.read_age_mdl() self.create_dataset(name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def animal_ages(self):\n herb_ages = []\n carn_ages = []\n for cell in self.land_cells.values():\n for herb in cell.herbivores:\n herb_ages.append(herb.age)\n for carn in cell.carnivores:\n carn_ages.append(carn.age)\n if not herb_ages...
[ "0.69219136", "0.6683577", "0.6079675", "0.60636836", "0.59731746", "0.58518094", "0.58244365", "0.5635037", "0.5590913", "0.5542696", "0.5537797", "0.5531115", "0.5482425", "0.5406711", "0.5401851", "0.53745675", "0.5370552", "0.53588414", "0.53550804", "0.5346951", "0.53351...
0.66394824
2
Calculate the age gradient vector on original age grid points
def _cal_age_grad(self): age_nc_Arr = self['age_nc_Arr'].value age_nc_Arr_msk = age_nc_Arr > 180. age_lon_Vec = self['age_lon_Vec'].value age_lat_Vec = self['age_lat_Vec'].value deriv_lat, deriv_lon = np.gradient(age_nc_Arr, age_lat_Vec, age_lon_Vec) msk_left = np.zeros(age_nc_Arr_msk.shape) msk_right = n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_age_grad(self,renew=False):\n\t\ttry:\n\t\t\tdriv_lat = self['deriv_lat'].value\n\t\t\tdriv_lon = self['deriv_lon'].value\n\t\t\tdriv_msk = self['deriv_msk'].value\n\t\texcept:\n\t\t\tself._cal_age_grad()\n\t\tderiv_lat = self['deriv_lat'].value\n\t\tderiv_lon = self['deriv_lon'].value\n\t\tderiv_msk = sel...
[ "0.691785", "0.6275828", "0.6222302", "0.6183185", "0.61593217", "0.6157958", "0.60830003", "0.6068481", "0.6031056", "0.6023609", "0.60083145", "0.59959316", "0.5975593", "0.59573", "0.5943804", "0.5932758", "0.5924193", "0.58491886", "0.58460766", "0.5843713", "0.58372456",...
0.78362966
0
get the age gradient at each grid point
def get_age_grad(self,renew=False): try: driv_lat = self['deriv_lat'].value driv_lon = self['deriv_lon'].value driv_msk = self['deriv_msk'].value except: self._cal_age_grad() deriv_lat = self['deriv_lat'].value deriv_lon = self['deriv_lon'].value deriv_msk = self['deriv_msk'].value age_lon_Vec =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cal_age_grad(self):\n\t\tage_nc_Arr = self['age_nc_Arr'].value\n\t\tage_nc_Arr_msk = age_nc_Arr > 180.\n\t\tage_lon_Vec = self['age_lon_Vec'].value\n\t\tage_lat_Vec = self['age_lat_Vec'].value\n\t\tderiv_lat, deriv_lon = np.gradient(age_nc_Arr, age_lat_Vec, age_lon_Vec)\n\t\tmsk_left = np.zeros(age_nc_Arr_msk...
[ "0.7373884", "0.6562875", "0.6507039", "0.6486442", "0.64006454", "0.6399949", "0.6344714", "0.6339418", "0.6229573", "0.62217957", "0.6203564", "0.62013716", "0.6187462", "0.6156918", "0.61553365", "0.6141594", "0.6131156", "0.60966295", "0.60867345", "0.6073759", "0.6059024...
0.6642174
1
Based on the given longitude & latitude, construct a trajectory for connnecting age gradient vectors on the map. Doesn't work very well.
def _cons_traj(self,lon,lat,period): group = self['%g_sec'%( period )] lonArr = group['lonArr'].value latArr = group['latArr'].value ageArr = group['age_Arr'].value age_drv_lon = group['age_deriv_lon_Arr'] age_drv_lat = group['age_deriv_lat_Arr'] age_drv_msk = group['age_deriv_msk_Arr'] tomo_data_msk = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cal_age_grad(self):\n\t\tage_nc_Arr = self['age_nc_Arr'].value\n\t\tage_nc_Arr_msk = age_nc_Arr > 180.\n\t\tage_lon_Vec = self['age_lon_Vec'].value\n\t\tage_lat_Vec = self['age_lat_Vec'].value\n\t\tderiv_lat, deriv_lon = np.gradient(age_nc_Arr, age_lat_Vec, age_lon_Vec)\n\t\tmsk_left = np.zeros(age_nc_Arr_msk...
[ "0.620478", "0.6185333", "0.60789245", "0.5874364", "0.5784445", "0.56719106", "0.5623785", "0.5595251", "0.55682504", "0.55042136", "0.54414684", "0.5440517", "0.54328775", "0.5417082", "0.54028606", "0.53831655", "0.5365884", "0.53533524", "0.53461176", "0.53118074", "0.530...
0.6021814
3
Construct trajectory from the stream plot. The output are coordinates for the points interpolated along the desired stream line
def _cons_traj_stream(self,period=6.,lon=232.,lat=48.,N=20,projection='lambert'): strm = self.plot_age_deriv(period=period, lon=lon, lat=lat, streamline=True, projection=projection, showfig=False) m = self._get_basemap(projection=projection) plt.close('all') path_pnts_arr = np.vstack(strm.lines.get_segments()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def streamlines(ax, mesh, umean):\n Nx,Ny = 1001, 401\n xcart = np.linspace(0,10,Nx)\n ycart = np.linspace(0,4,Ny)\n meshcart = np.vstack( map(lambda x: x.flatten(), np.meshgrid(xcart, ycart)) ).T\n interp_u = tri.LinearTriInterpolator(mesh, umean[:,0])\n interp_v = tri.LinearTriInterpolator(mesh...
[ "0.6669836", "0.6290371", "0.6082005", "0.6062288", "0.59400827", "0.5900702", "0.5859876", "0.58147705", "0.5784731", "0.57459486", "0.5736712", "0.5724595", "0.5691527", "0.5668636", "0.5639421", "0.5559905", "0.5559696", "0.5558937", "0.5558591", "0.55503106", "0.550899", ...
0.6127296
2
Find the grid point on the result lat&lon grid that's closest to the given coordinates
def _find_nearest_grid(self,lon,lat,period): group = self['%g_sec'%( period )] lonArr = group['lonArr'].value latArr = group['latArr'].value diff_Arr = np.dstack((lonArr, latArr)) - np.array([lon, lat]) # 3-d array ( , ,2) diff_Arr[:,:,0] = diff_Arr[:,:,0] * np.cos(lat/180.*np.pi) dist_sq = np.sum(diff_Arr*...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_closest_pt(ref_lon, ref_lat, tlon, tlat):\n\n # compute great circle distance from location to model grid points\n dist = gc_dist(ref_lon, ref_lat, tlon, tlat)\n\n # find j index of closest grid point\n work = N.take(dist,N.argmin(dist,0),0).diagonal()\n jj = N.argsort(work)[0]\n\n # f...
[ "0.7869433", "0.7670987", "0.7409804", "0.73985344", "0.7375369", "0.73174095", "0.72477806", "0.69265217", "0.67355555", "0.6684142", "0.6669667", "0.6652987", "0.66368204", "0.6624449", "0.6617213", "0.6610935", "0.6608017", "0.65666974", "0.65532094", "0.6545663", "0.65198...
0.76830816
1
Get the sediment thickness for the grids of the tomography result
def get_sed_thk(self): for period in self.attrs['prd_arr']: group = self['%g_sec'%( period )] sed_Arr = self.Rbf_func(group['latArr'].value, group['lonArr'].value) group.create_dataset(name='sed_Arr', data=sed_Arr) group.create_dataset(name='sed_Arr_msk', data=group['tomo_data_msk'].value) pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def thickness(self):\n return self._thickness", "def calc_thickness(self):\n s = \"::: calculating z-varying thickness :::\"\n print_text(s, cls=self)\n #H = project(self.S - self.x[2], self.Q, annotate=False)\n H = self.vert_integrate(Constant(1.0), d='down')\n Hv = H.vect...
[ "0.6616825", "0.64705014", "0.6346361", "0.62568235", "0.6188957", "0.6188957", "0.61844087", "0.61844087", "0.61843896", "0.61843896", "0.61820525", "0.61806613", "0.61799127", "0.61799127", "0.61598146", "0.61411077", "0.61263955", "0.61028105", "0.60763776", "0.6021636", "...
0.0
-1
Get water depth for the grids of the tomography result
def get_wtr_dep(self,dep_f='./etopo.xyz'): dep_xyz = np.loadtxt(dep_f) dep_lon = dep_xyz[:,0].reshape(self['6_sec']['lonArr'].value.shape[::-1]) dep_lat = dep_xyz[:,1].reshape(self['6_sec']['lonArr'].value.shape[::-1]) dep_data = dep_xyz[:,2].reshape(self['6_sec']['lonArr'].value.shape[::-1]) if not ((self['6...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_depth(self, data): \r\n\r\n data = data.astype(np.float32)\r\n\r\n normalized = np.dot(data, [65536.0, 256.0, 1.0]) \r\n normalized /= (256 * 256 * 256 - 1)\r\n in_meters = 1000 * normalized\r\n\r\n return in_meters", "def calculate_soil_depth_probabilities(sel...
[ "0.6151124", "0.6118698", "0.6104368", "0.60859895", "0.607557", "0.60310143", "0.60183597", "0.5914425", "0.5884729", "0.5856262", "0.5806334", "0.5806334", "0.5769991", "0.5688344", "0.5655041", "0.56502837", "0.5627254", "0.5626253", "0.56167215", "0.5575306", "0.55559176"...
0.0
-1
Ger c0, c1, c2 for the given period
def get_c(self,wave='phase'): dset = dispDBase.dispASDF(self.attrs['age_h5']) # dset = dispDBase.dispASDF('age_model_new.h5') for period in self.attrs['prd_arr']: str_per = str(int(period)).zfill(2) group = self['%g_sec'%( period )] c_dic = dset.auxiliary_data.FitResult[str_per][wave].parameters c0 = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contComp(periods, pr=10, pv=100):\n r = pr / 100 \n return fmtFV(pv * exp(r * periods))", "def compound(ir, period):\n\treturn ir.compound(period)", "def compound(self, period):\n\t\tif self.calendar:\n\t\t\tperiod = CalendarRangePeriod(period, self.calendar)\n\t\t\n\t\tt = self.daycount.timefreq(...
[ "0.61860037", "0.56525433", "0.5574318", "0.5556051", "0.5353795", "0.53194124", "0.52725714", "0.5237334", "0.5217164", "0.5190414", "0.5185958", "0.51773953", "0.51130664", "0.5109806", "0.5103083", "0.5077899", "0.5064242", "0.5042674", "0.5040158", "0.50209373", "0.498983...
0.4801086
43
Read Ye's agedependent phase velocity curve from his 2013 paper, Fig 3
def read_curve_Ye(self, fname='./Curve_Ye.lst'): try: self.create_group(name='Curve_Ye') except: pass group = self['Curve_Ye'] f = open(fname, 'r') lines = f.readlines() for line in lines: try: age, vel = line.strip().split() arr = np.append(arr, np.array([[float(age.replace(',','')), float...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xycurves_read_y(self) -> float:\n return float(self.dss_obj.XYCurvesF(ctypes.c_int32(2), ctypes.c_double(0)))", "def getETA():", "def getETA():", "def iv_curve(voc):\n \n set_mode(mode_cv) # set operation mode to CC\n time.sleep(.1)\n volt_step = voc\n while volt_step > 0.5:\n ...
[ "0.5792761", "0.5689362", "0.5689362", "0.5598587", "0.55810696", "0.54435396", "0.54211086", "0.5395927", "0.5359138", "0.53488517", "0.53426903", "0.53074145", "0.5297593", "0.52945036", "0.52914715", "0.52900124", "0.5276078", "0.52596027", "0.5259379", "0.5245957", "0.524...
0.656235
0
Get data along trajecoty, not done
def get_traj_data(self,lon1=232,lat1=48.,lon2=232.,lat2=46.5,lon3=232.,lat3=45.,N=20): group = self.create_group(name='3_trajs') try: self.age_func except: self._get_age_func() for period in self.attrs['prd_arr']: lons_out1, lats_out1 = self._cons_traj_stream(period=period,lon=lon1,lat=lat1,N=N) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data():\n pass", "def get_data(self):", "def get_data():\n return", "def get_data():\n pass", "def get_data():\n pass", "def get_data():\n pass", "def fetch_data(self):", "def get_data(self):\n pass", "def get_data(self):\n pass", "def get_data(self):\r\n ...
[ "0.6981475", "0.6978822", "0.6795651", "0.6747744", "0.6747744", "0.6747744", "0.6691469", "0.6563791", "0.6563791", "0.6562086", "0.6356172", "0.63410366", "0.63305014", "0.63179636", "0.62120944", "0.6160886", "0.6129554", "0.61056346", "0.60237914", "0.59959394", "0.598794...
0.0
-1
Get basemap for plotting results
def _get_basemap(self, projection='lambert', geopolygons=None, resolution='i', bound=True, hillshade=False): # fig=plt.figure(num=None, figsize=(12, 12), dpi=80, facecolor='w', edgecolor='k') minlat = self.attrs['minlat'] maxlat = self.attrs['maxlat'] minlon = self.attrs['minlon'] maxlon = self.attrs['maxlon'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_basemap(self, projection='lambert', geopolygons=None, resolution='i'):\n # fig=plt.figure(num=None, figsize=(12, 12), dpi=80, facecolor='w', edgecolor='k')\n lat_centre = (self.maxlat+self.minlat)/2.0\n lon_centre = (self.maxlon+self.minlon)/2.0\n if projection=='merc':\n ...
[ "0.768583", "0.67051417", "0.66305643", "0.66269356", "0.6420326", "0.63739675", "0.6318919", "0.6219537", "0.6179917", "0.6173425", "0.61360645", "0.6124757", "0.6112975", "0.6102493", "0.60988593", "0.60919696", "0.6082849", "0.6076129", "0.6058652", "0.6038709", "0.6025106...
0.75758696
1
Plot sedimentary thickness map
def plot_sed(self,period=6.,projection='lambert',geopolygons=None, showfig=True, vmin=0, vmax=None, hillshade=False): if hillshade: alpha = 0.5 else: alpha =1. m = self._get_basemap(projection=projection, geopolygons=geopolygons,hillshade=hillshade) group = self['%g_sec'%( period )] x, y = m(group['lonA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(sigma, strikes, dips):\n values, vectors = principal(sigma)\n sigma1, sigma2, sigma3 = vectors\n\n fig = plt.figure()\n ax = fig.add_subplot(111, projection='stereonet')\n plt.hold(True)\n ax.density_contourf(strikes, dips)\n #ax.pole(strikes, dips, 'b.')\n ax.line(sigma1[0],sigma1...
[ "0.63369995", "0.61236846", "0.6114349", "0.6095849", "0.60944027", "0.6065564", "0.60634726", "0.5903474", "0.5871973", "0.58385426", "0.5830472", "0.58245665", "0.581662", "0.5804532", "0.5801797", "0.5794579", "0.57639295", "0.5746792", "0.5691547", "0.56898904", "0.568783...
0.6411703
0
Plot water depth map
def plot_dep(self,period=6.,projection='lambert',geopolygons=None, showfig=True, vmin=None, vmax=None, hillshade=False): if hillshade: alpha = 0.5 else: alpha =1. m = self._get_basemap(projection=projection, geopolygons=geopolygons,hillshade=hillshade) group = self['%g_sec'%( period )] x, y = m(group['l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_well_depth(self):\n fig, ax = plt.subplots()\n imMap = ax.imshow(self.get_well_depth_image())\n ax.set_title('Well Fraction Map Map')\n ax.set_xlabel('x')\n ax.set_ylabel('y')\n \n ## Adjust colorbar height to match image\n divider = make_axes_locata...
[ "0.67604697", "0.64056957", "0.6388785", "0.6239473", "0.6080056", "0.59995365", "0.59910446", "0.5954135", "0.59384274", "0.58985955", "0.5875919", "0.585443", "0.58198017", "0.58123666", "0.5780815", "0.5731564", "0.5707765", "0.5701782", "0.5686471", "0.56745595", "0.56741...
0.52660173
77
Plot velocity map from tomography result
def plot_tomo_vel(self, period=6., projection='lambert',geopolygons=None, showfig=True, vmin=None, vmax=None, sta=True, hillshade=False): if hillshade: alpha = 0.5 else: alpha =1. m = self._get_basemap(projection=projection, geopolygons=geopolygons,hillshade=hillshade) group = self['%g_sec'%( period )] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def velocity_map(self, output='test'):\n self.figure = figure(figsize=(10,3))\n self.axes = self.figure.gca() \n xWindowLim = (self.analyst.windowSize[0], self.analyst.windowSize[1])\n yWindowLim = (self.analyst.windowSize[2], self.analyst.windowSize[3])\n \n # Generate ...
[ "0.74692625", "0.70355034", "0.67813766", "0.66765213", "0.6462635", "0.6353385", "0.618049", "0.60477555", "0.60405", "0.6039037", "0.60071677", "0.599116", "0.59365726", "0.5931027", "0.5913432", "0.5902688", "0.58840066", "0.5877028", "0.58398914", "0.5831023", "0.5816074"...
0.6879549
2
Plot agedependent velocity map
def plot_age_vel(self, period=6., projection='lambert',geopolygons=None, showfig=True, vmin=None, vmax=None, sta=True, hillshade=False): if hillshade: alpha = 0.5 else: alpha =1. m = self._get_basemap(projection=projection, geopolygons=geopolygons,hillshade=hillshade) group = self['%g_sec'%( period )] x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_velocity(self):\n \n plt.figure(figsize=[2,6])\n plt.plot(self.velocity_model['vp'],self.velocity_model['depth'],'r',label='vp')\n plt.plot(self.velocity_model['vs'],self.velocity_model['depth'],'b',label='vs')\n\n plt.ylim(np.max(self.velocity_model['depth']),np.min(sel...
[ "0.70021725", "0.65644425", "0.654601", "0.6497373", "0.6178289", "0.61547524", "0.61532503", "0.6071668", "0.6066135", "0.5938079", "0.5922543", "0.5911259", "0.5875194", "0.5851111", "0.58128566", "0.5808326", "0.5806869", "0.5797526", "0.57773346", "0.57172334", "0.5687899...
0.72254646
0
Plot the difference between tomography result and agedependent velocity map
def plot_diff(self, period=6., projection='lambert',geopolygons=None, showfig=True, vmin=None, vmax=None, sta=True, hillshade=False, pct=True): group = self['%g_sec'%( period )] age_vel = group['age_vel'].value age_vel_msk = group['age_vel_msk'].value tomo_data = group['tomo_data'].value tomo_data_msk = group...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def velocity_map(self, output='test'):\n self.figure = figure(figsize=(10,3))\n self.axes = self.figure.gca() \n xWindowLim = (self.analyst.windowSize[0], self.analyst.windowSize[1])\n yWindowLim = (self.analyst.windowSize[2], self.analyst.windowSize[3])\n \n # Generate ...
[ "0.65208423", "0.647963", "0.6475825", "0.6369093", "0.63263804", "0.6205774", "0.6198295", "0.61233115", "0.6067947", "0.6054253", "0.6020657", "0.60199803", "0.60023", "0.5966201", "0.5963947", "0.5959262", "0.5952182", "0.5901261", "0.5888683", "0.588114", "0.58783644", ...
0.6540563
0
Plot vel vs. age for the tomography result
def plot_age_curve(self, period=6., showfig=True): group = self['%g_sec'%( period )] tomo_data = group['tomo_data'].value tomo_data_msk = group['tomo_data_msk'].value age_Arr = group['age_Arr'].value age_Arr_msk = group['age_Arr_msk'].value mask = np.logical_or(tomo_data_msk, age_Arr_msk) vel_vec = tomo_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_age_vel(self, period=6., projection='lambert',geopolygons=None, showfig=True, vmin=None, vmax=None, sta=True, hillshade=False):\n\t\tif hillshade:\n\t\t\talpha = 0.5\n\t\telse:\n\t\t\talpha =1.\n\t\tm = self._get_basemap(projection=projection, geopolygons=geopolygons,hillshade=hillshade)\n\t\tgroup = self...
[ "0.66538084", "0.65320843", "0.6044419", "0.60360545", "0.60148966", "0.5998758", "0.5863812", "0.5839247", "0.5835085", "0.57278395", "0.5703921", "0.5658029", "0.5644383", "0.563285", "0.5627888", "0.56032264", "0.55975133", "0.5575337", "0.5540872", "0.55400664", "0.553488...
0.6346426
2
Plot vel vs. age for the tomography result
def plot_age_curve_traj(self, period=6., lon=323, lat=48, showfig=True): group = self['%g_sec'%( period )] mask = self._cons_traj(lon=lon,lat=lat,period=period) tomo_data = group['tomo_data'].value age_Arr = group['age_Arr'].value vel_vec = tomo_data[~mask] age_vec = age_Arr[~mask] plt.plot(age_vec, vel_v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_age_vel(self, period=6., projection='lambert',geopolygons=None, showfig=True, vmin=None, vmax=None, sta=True, hillshade=False):\n\t\tif hillshade:\n\t\t\talpha = 0.5\n\t\telse:\n\t\t\talpha =1.\n\t\tm = self._get_basemap(projection=projection, geopolygons=geopolygons,hillshade=hillshade)\n\t\tgroup = self...
[ "0.6652724", "0.6531718", "0.63463604", "0.6046026", "0.60350746", "0.599974", "0.5863992", "0.5839804", "0.5835225", "0.5729632", "0.5703747", "0.56579", "0.5644317", "0.56326854", "0.56272405", "0.56030625", "0.559727", "0.5576204", "0.55406004", "0.55401415", "0.55346644",...
0.6014958
5
Plot vel vs. age for the tomography result
def plot_age_curve_traj_2(self, period=6., lon=323, lat=48, N=20, showfig=True): lons_out, lats_out = self._cons_traj_stream(period=period,lon=lon,lat=lat,N=N) try: self.age_func except: self._get_age_func() ages = self.age_func(np.column_stack((lons_out,lats_out))) group = self['%g_sec'%( period )] t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_age_vel(self, period=6., projection='lambert',geopolygons=None, showfig=True, vmin=None, vmax=None, sta=True, hillshade=False):\n\t\tif hillshade:\n\t\t\talpha = 0.5\n\t\telse:\n\t\t\talpha =1.\n\t\tm = self._get_basemap(projection=projection, geopolygons=geopolygons,hillshade=hillshade)\n\t\tgroup = self...
[ "0.66538084", "0.65320843", "0.6346426", "0.6044419", "0.60360545", "0.60148966", "0.5998758", "0.5863812", "0.5839247", "0.5835085", "0.57278395", "0.5703921", "0.5658029", "0.563285", "0.5627888", "0.56032264", "0.55975133", "0.5575337", "0.5540872", "0.55400664", "0.553488...
0.5644383
13
Plot the 3 North, Middle and South trajatory on top of tomography result &/or age map
def plot_3_traj(self, period=6.): subgrp = self['3_trajs']['%g_sec'%( period )] lons_out1 = subgrp['traj_N'].value[:,0] lats_out1 = subgrp['traj_N'].value[:,1] lons_out2 = subgrp['traj_M'].value[:,0] lats_out2 = subgrp['traj_M'].value[:,1] lons_out3 = subgrp['traj_S'].value[:,0] lats_out3 = subgrp['traj_S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def world_map_template():\n fig, ax = plt.subplots(figsize=(20, 10))\n ax.plot(\n laea_x(np.pi, np.linspace(-np.pi / 2, np.pi / 2)),\n laea_y(np.pi, np.linspace(-np.pi / 2, np.pi / 2)),\n color=\"k\",\n zorder=10,\n )\n ax.plot(\n laea_x(-np.pi, np.linspace(-np.pi / 2...
[ "0.64240843", "0.61683667", "0.6109635", "0.6089576", "0.60894334", "0.6060874", "0.6006026", "0.59993064", "0.59811276", "0.5974127", "0.59722173", "0.5936386", "0.59219027", "0.58797014", "0.5845029", "0.5837236", "0.5830519", "0.5828187", "0.58226466", "0.5803472", "0.5785...
0.6025872
6
Plot age derivative as vectors on the map vec_s the size of the vectors drawn on the map (length of plot width) sparse how sparse for drawing the vectors lon longitude of starting point on stream line, only works when streamline == True lat latitude of starting point on stream line, only works when streamline == True
def plot_age_deriv(self, period=6., vec_s=0.05, sparse=10, lon=232., lat=46., streamline=False, projection='lambert',geopolygons=None, showfig=True, vmin=None, vmax=None, sta=True, hillshade=False): if hillshade: alpha = 0.5 else: alpha = 1. group = self['%g_sec'%( period )] deriv_lat_Arr = group['age_der...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_age_traj(self, period=6., lon=232., lat=46., N=30, streamline=False, vec=False, projection='lambert',geopolygons=None, showfig=True, vmin=None, vmax=None, sta=True, hillshade=False):\n\t\tif hillshade:\n\t\t\talpha = 0.5\n\t\telse:\n\t\t\talpha = 1.\n\t\tgroup = self['%g_sec'%( period )]\n\t\tage_Arr = gr...
[ "0.5908049", "0.5506614", "0.5383747", "0.5346564", "0.5323745", "0.52370286", "0.51830995", "0.5181756", "0.5127858", "0.5122104", "0.5091455", "0.5085826", "0.5079753", "0.5042886", "0.50355995", "0.50293756", "0.5007741", "0.49756533", "0.49617273", "0.49609876", "0.495422...
0.7200851
0
Plot a trajectory of varying age based on a starting point lon, lat longitude & latitude of the starting point
def plot_age_traj(self, period=6., lon=232., lat=46., N=30, streamline=False, vec=False, projection='lambert',geopolygons=None, showfig=True, vmin=None, vmax=None, sta=True, hillshade=False): if hillshade: alpha = 0.5 else: alpha = 1. group = self['%g_sec'%( period )] age_Arr = group['age_Arr'].value ag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_single_trajectory(self):\n\n plt.plot(self.trip_centroids['lon'], self.trip_centroids['lat'], '-o')", "def plot_trajectories_XYZ(t_start,t_stop):\n \n time, ankle_l_trajectory, ankle_r_trajectory,foot_l_contact,foot_r_contact,muscle_lh_activations, muscle_rh_activations,muscle_lh_forces,mus...
[ "0.67130643", "0.65517485", "0.6224497", "0.6078203", "0.6022338", "0.59993726", "0.5980043", "0.5936171", "0.5933869", "0.5921403", "0.5905096", "0.58895224", "0.5805531", "0.57912093", "0.5780577", "0.57152444", "0.56844264", "0.56327474", "0.5602548", "0.55992043", "0.5591...
0.65716076
1
Plot vel vs. sediment thickness for the tomography result
def plot_sed_curve(self, period=6., showfig=True): group = self['%g_sec'%( period )] tomo_data = group['tomo_data'].value mask = group['tomo_data_msk'].value sed_Arr = group['sed_Arr'].value vel_vec = tomo_data[~mask] sed_vec = sed_Arr[~mask] plt.plot(sed_vec, vel_vec, 'r.') plt.xlim(xmin=0) plt.xlabe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_velocity(self):\n \n plt.figure(figsize=[2,6])\n plt.plot(self.velocity_model['vp'],self.velocity_model['depth'],'r',label='vp')\n plt.plot(self.velocity_model['vs'],self.velocity_model['depth'],'b',label='vs')\n\n plt.ylim(np.max(self.velocity_model['depth']),np.min(sel...
[ "0.6720147", "0.6461012", "0.6309913", "0.6275628", "0.6255573", "0.611402", "0.6001886", "0.5974028", "0.5960949", "0.5951606", "0.59478086", "0.5877472", "0.5856899", "0.5800003", "0.579285", "0.57880896", "0.57839435", "0.57572436", "0.5752048", "0.5704306", "0.57040626", ...
0.5929189
11
Plot tomography vel results vs. oceanic water depth
def plot_dep_curve(self, period=6., showfig=True): group = self['%g_sec'%( period )] tomo_data = group['tomo_data'].value dep_Arr = group['dep_Arr'].value mask = np.logical_or(group['tomo_data_msk'].value, group['dep_Arr_msk'].value) vel_vec = tomo_data[~mask] dep_vec = dep_Arr[~mask] plt.plot(dep_vec, ve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_velocity(self):\n \n plt.figure(figsize=[2,6])\n plt.plot(self.velocity_model['vp'],self.velocity_model['depth'],'r',label='vp')\n plt.plot(self.velocity_model['vs'],self.velocity_model['depth'],'b',label='vs')\n\n plt.ylim(np.max(self.velocity_model['depth']),np.min(sel...
[ "0.72920567", "0.6946014", "0.6632271", "0.6532593", "0.6476658", "0.6348762", "0.6324578", "0.6281116", "0.6236044", "0.6201404", "0.61904883", "0.61287767", "0.61206204", "0.60723925", "0.60469985", "0.6043607", "0.60253555", "0.5967137", "0.5960025", "0.59492826", "0.59457...
0.0
-1
Add stations on plot
def sta_on_plot(self, ax, basemap, period, ms=6): group = self['%g_sec'%( period )] if group['res_data'].value.size == 0: self.get_res_data() cords1 = group['res_data'].value[:,1:3] cords2 = group['res_data'].value[:,3:5] sta_cords,cnts = np.unique(np.concatenate((cords1,cords2),axis=0), return_counts=True...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_station(self, station):\n self.__stations.append(station)", "def _draw_stations(self, color=\"#aaa\"):\n stations = self._stations\n tmp_str_list = []\n for y in stations:\n tmp_str_list.append('<polyline class=\"Station\" stroke=\"%s\" points=\"%s,%s, %s,%s\" /...
[ "0.6541889", "0.64480966", "0.62101495", "0.6146718", "0.6139376", "0.60156673", "0.6008827", "0.5983567", "0.58948153", "0.5861847", "0.580149", "0.5750258", "0.56929463", "0.5690468", "0.5670628", "0.5663634", "0.56554914", "0.562816", "0.562816", "0.5623493", "0.5618505", ...
0.61092496
5
Calculate the greatcircle distance between points on geographic map
def cal_dist(origs,dests): radius = 6371.009 # km if origs.ndim: lat1, lon1 = origs lat2, lon2 = dests else: lat1 = origs[0,:] lon1 = origs[1,:] lat2 = dests[0,:] lon2 = dests[1,:] dlat = (lat2-lat1) / 180. * np.pi dlon = (lon2-lon1) / 180. * np.pi a = np.sin(dlat/2) * np.sin(dlat/2) + np.cos(lat1 / 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long...
[ "0.75469315", "0.73928666", "0.7349093", "0.7241625", "0.7183871", "0.7074445", "0.7036624", "0.7005318", "0.69982374", "0.6977896", "0.6807617", "0.6775541", "0.67164063", "0.66556954", "0.65970504", "0.65907645", "0.65835667", "0.65809673", "0.6543193", "0.6539172", "0.6532...
0.0
-1
Walk along the gradient direction of (i,j)
def _walk(drv_lon,drv_lat,i,j,inc): if drv_lon[i,j] == 0: if drv_lat[i,j] > 0: i += inc else: i += -inc elif drv_lon[i,j] > 0: angle = np.arctan(drv_lat[i,j]/drv_lon[i,j]) if np.abs(angle) <= np.pi/8.: j += inc elif np.pi/8. < angle < 3.*np.pi/8.: j += inc i += inc elif -3.*np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getGradient(self,j):\n i = int(self.indicator['term'][j])\n r = int(self.indicator['row'][j])\n c = int(self.indicator['col'][j])\n rv = -np.kron(self.Fstar()[i][:,[r]],self.Astar()[i][[c],:])\n return rv", "def imageGradient( iImage ):\n iImage = np.array( iImage, dtype...
[ "0.66742575", "0.66101354", "0.6594794", "0.6587557", "0.6485199", "0.6485199", "0.64426845", "0.6429436", "0.6425769", "0.6424722", "0.64223945", "0.64190614", "0.64077705", "0.6406364", "0.64062387", "0.63820815", "0.6381172", "0.63541925", "0.63387144", "0.62836206", "0.62...
0.0
-1
Sends status report to Slack for given operation. `done` is the count of successfully scraped/aggregated symbols `failed` is a list of symbol names that could not be scraped/aggregated
def send_report(done, failed, scraper, op="scrape"): if done > 0: msg_success = "👍 Successfully {}d {}".format(op, _symbol_str(done)) else: msg_success = "No symbols where successfully scraped 😭" if len(failed) > 0: msg_fail = "⚠️️ Failed to {} {}: {}".format(op, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status():\n _request('worklog/status/')", "def status(args):\n print('Yields HPC fleet \"{}\" status'.format(args))", "def do_status(self, args):\n status = self._leet.job_status\n\n for job in self.finished_jobs:\n status.append({\"id\" : job.id,\n ...
[ "0.58444166", "0.57056075", "0.56257963", "0.56198466", "0.5551347", "0.5489644", "0.5458203", "0.54325044", "0.54281545", "0.5385839", "0.5376189", "0.5369204", "0.53362334", "0.53180194", "0.5302695", "0.52896714", "0.5284125", "0.52820325", "0.5270204", "0.5268695", "0.525...
0.7662954
0
Count words in all files under INPUTS_PATH
def word_count(): word_counter = Counter() # read files and count words for file_path in Path(INPUTS_PATH).rglob("*"): if file_path.is_file(): print(f"Processing input file: {file_path.as_posix()}") word_counter += Counter(file_path.read_text().split()) # write the resu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_words(filename):", "def count_all_words(file_name):\n\n return len(separate_words(file_name))", "def load_input(path):\n counts = defaultdict(int)\n if not os.path.exists(mode+'indices.p'):\n root = '/'.join(path.split('/')[0:-1])\n all_paths = [root+'/'+x for x in os.listdir(root)...
[ "0.8194428", "0.77317137", "0.741911", "0.74173814", "0.7133204", "0.70941913", "0.7048425", "0.6957227", "0.6880276", "0.6853278", "0.6809252", "0.6798499", "0.67847085", "0.67829734", "0.67795736", "0.6779509", "0.6753361", "0.6688868", "0.66835743", "0.6672029", "0.6659063...
0.8237946
0
This is an implementation of design pattern
def __getattr__(self, name): return getattr(self.conn, name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self):\n raise NotImplementedError", "def __call__(self):\n raise NotImplementedError()", "def _create_impl(self):", "def __call__(self):\r\n raise NotImplementedError('override me')", "def _build_impl(self):", "def __call__(self) -> None:", "def __call__(self):\n ...
[ "0.77718604", "0.7422359", "0.73965347", "0.73947096", "0.7250414", "0.72188383", "0.7172355", "0.7172355", "0.7104205", "0.70653003", "0.70299375", "0.70299375", "0.70299375", "0.70299375", "0.698645", "0.698645", "0.698645", "0.69826466", "0.6864987", "0.6864987", "0.684951...
0.0
-1
A search algorithm to find the shortest path
def shortest_path(M, start, goal): print("shortest path called") came_from = {} g_score = {} came_from[start] = None g_score[start] = 0 open_heap = [] heappush(open_heap, (0, start)) while open_heap: current = heappop(open_heap)[1] if current == goal: brea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_search(start, goal):\n if start == goal:\n return [start]\n explored = {}\n explored[start] = 2\n queue = [ [start, ('', 0)] ]\n bestPath = [start, ('', 1110)]\n bestPathList = []\n total = 0\n costSearchingNow = 0\n while queue:\n total += 1\n # if total>40...
[ "0.7579267", "0.73575956", "0.73360074", "0.73277307", "0.73038524", "0.72561896", "0.7245626", "0.7240102", "0.7232919", "0.7185928", "0.71780574", "0.7177464", "0.7168024", "0.71671706", "0.7166223", "0.71414894", "0.7100842", "0.7083569", "0.7082751", "0.7061461", "0.70556...
0.7069448
19
Make a user for authenticating and testing community actions
def setUp(self): owner = self.user_model.objects.create(password=make_password('user1'), email='user1@test.com', first_name='1', last_name='User', is_active=True) moderator = self.user_model.objects.create(password=make_password('user2'), email='user2@test....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth(self, user):", "def user():", "def create_and_login(self):\n with self.context():\n user = self.factory(meido.factories.UserFactory)\n self.client.post('/management/login', data={\n 'username': 'admin', 'password': 'pretender'\n })", "def new_user():\n ...
[ "0.70811623", "0.70787936", "0.6941468", "0.6899412", "0.6755422", "0.6755422", "0.6755422", "0.6717914", "0.669138", "0.66474354", "0.6644095", "0.66194624", "0.66173273", "0.66062903", "0.65977556", "0.65919787", "0.6570936", "0.6557859", "0.6480627", "0.6478125", "0.646096...
0.0
-1
Ensure an authenticated user cannot join a community that does not exists
def test_join_wrong_community(self): url = '/api/v1/communities/15/join_community/' response = self.client.post(url, HTTP_AUTHORIZATION=self.auth('user4')) self.assertEquals(status.HTTP_400_BAD_REQUEST, response.status_code) self.assertEqual(15, Member.objects.all().count())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cant_ban_user_from_community_if_member(self):\n user = make_user()\n headers = make_authentication_headers_for_user(user)\n\n other_user = make_user()\n community = make_community(creator=other_user, type='P')\n community_name = community.name\n\n user.join_commun...
[ "0.7300854", "0.71112937", "0.70641446", "0.69880414", "0.6895106", "0.68399394", "0.6777246", "0.6458241", "0.6438161", "0.64138967", "0.63462913", "0.62895274", "0.6252131", "0.62423515", "0.61970246", "0.6186647", "0.6176099", "0.615934", "0.61395776", "0.61223435", "0.601...
0.69475484
4
Ensure an authenticated user can join a community
def test_join_community_not_auto_accept(self): url = '/api/v1/communities/1/join_community/' response = self.client.post(url, HTTP_AUTHORIZATION=self.auth('user4')) self.assertEquals(status.HTTP_201_CREATED, response.status_code) self.assertEqual(16, Member.objects.all().count()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def community_request(current_user, user_id):\n community = Community(community_id=user_id, user_id=current_user.id)\n community.save()\n return response('success', 'Successfully joined community', 200)", "def test_join_wrong_community(self):\n url = '/api/v1/communities/15/join_community/'\n\n ...
[ "0.76816416", "0.6900879", "0.68873966", "0.66313064", "0.6542414", "0.6504048", "0.6460188", "0.64230186", "0.6413348", "0.62595475", "0.6232666", "0.620353", "0.61919194", "0.61688983", "0.61499274", "0.61028385", "0.60183716", "0.5953347", "0.59268004", "0.5919319", "0.587...
0.65946364
4
Ensure an authenticated user can join a community
def test_join_community_auto_accept(self): url = '/api/v1/communities/2/join_community/' response = self.client.post(url, HTTP_AUTHORIZATION=self.auth('user4')) self.assertEquals(status.HTTP_201_CREATED, response.status_code) self.assertEqual(16, Member.objects.all().count()) m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def community_request(current_user, user_id):\n community = Community(community_id=user_id, user_id=current_user.id)\n community.save()\n return response('success', 'Successfully joined community', 200)", "def test_join_wrong_community(self):\n url = '/api/v1/communities/15/join_community/'\n\n ...
[ "0.768026", "0.6901648", "0.688714", "0.6594798", "0.65435594", "0.6505267", "0.646017", "0.6423061", "0.64132786", "0.6260563", "0.6233768", "0.6204147", "0.619267", "0.61678356", "0.61504847", "0.61038417", "0.6019357", "0.59538424", "0.5927055", "0.5920757", "0.588011", ...
0.6631149
3
Ensure a member can leave a community
def test_leave_community(self): url = '/api/v1/communities/3/leave_community/' response = self.client.post(url, HTTP_AUTHORIZATION=self.auth('user3')) self.assertEquals(status.HTTP_204_NO_CONTENT, response.status_code) self.assertEqual(14, Member.objects.all().count())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_leave_community_banned(self):\n url = '/api/v1/communities/5/leave_community/'\n\n response = self.client.post(url, HTTP_AUTHORIZATION=self.auth('user3'))\n self.assertEquals(status.HTTP_401_UNAUTHORIZED, response.status_code)\n\n self.assertEqual(15, Member.objects.all().count...
[ "0.755527", "0.6848541", "0.68042284", "0.6512431", "0.6444627", "0.6382766", "0.6282716", "0.62807584", "0.626154", "0.61867917", "0.6175655", "0.6155387", "0.6050245", "0.6015117", "0.6000263", "0.59927756", "0.5978494", "0.597619", "0.5971745", "0.59683484", "0.5955255", ...
0.7604314
0
Ensure a banned member cannot leave a community
def test_leave_community_banned(self): url = '/api/v1/communities/5/leave_community/' response = self.client.post(url, HTTP_AUTHORIZATION=self.auth('user3')) self.assertEquals(status.HTTP_401_UNAUTHORIZED, response.status_code) self.assertEqual(15, Member.objects.all().count())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cant_ban_user_from_community_if_member(self):\n user = make_user()\n headers = make_authentication_headers_for_user(user)\n\n other_user = make_user()\n community = make_community(creator=other_user, type='P')\n community_name = community.name\n\n user.join_commun...
[ "0.7482391", "0.73174125", "0.71301365", "0.70725477", "0.7006769", "0.6890567", "0.6749513", "0.6619335", "0.6447031", "0.6412974", "0.6375203", "0.63603395", "0.6315346", "0.62225026", "0.60823", "0.60503536", "0.59814376", "0.5931603", "0.5899643", "0.58481574", "0.5830799...
0.74711186
1
Ensure an unauthenticated user cannot list memberships
def test_list_my_memberships_without_auth(self): url = '/api/v1/communities/0/list_my_memberships/' response = self.client.get(url) self.assertEqual(status.HTTP_401_UNAUTHORIZED, response.status_code)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_members_with_mod_rights_not_accepted(self):\n url = '/api/v1/communities/3/retrieve_members/'\n\n # Test before acceptation\n response = self.client.get(url, HTTP_AUTHORIZATION=self.auth('user2'))\n self.assertEqual(status.HTTP_401_UNAUTHORIZED, response.status_code)", "...
[ "0.67897993", "0.65733534", "0.6546578", "0.6515001", "0.6474156", "0.6451716", "0.6421053", "0.6411042", "0.6399281", "0.6391644", "0.6373416", "0.6317749", "0.6316283", "0.6315243", "0.6303196", "0.62909466", "0.6274377", "0.62658304", "0.6185835", "0.61791426", "0.6175023"...
0.67098165
1
Ensure a user can list all his memberships
def test_list_my_memberships_member(self): url = '/api/v1/communities/0/list_my_memberships/' response = self.client.get(url, HTTP_AUTHORIZATION=self.auth('user3')) self.assertEqual(status.HTTP_200_OK, response.status_code) data = response.data self.assertEqual(3, data['count']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_view_all(self):\n return self.request.user.has_permission(\"core.view_all_members\")", "def user_has_access(self, user):\n if not user: return False\n query = db.Query(TaskListMember)\n query.filter('task_list =', self)\n query.filter('user =', user)\n return query.get()", "def te...
[ "0.6774586", "0.6566311", "0.65049064", "0.63590103", "0.62990886", "0.62485856", "0.6227663", "0.62179005", "0.6205145", "0.6188063", "0.6171976", "0.6167746", "0.6152229", "0.6151261", "0.611896", "0.60998124", "0.6096858", "0.60557985", "0.60555935", "0.60300905", "0.60181...
0.63404006
4
Ensure a user can list all his memberships
def test_list_my_memberships_moderator(self): url = '/api/v1/communities/0/list_my_memberships/' response = self.client.get(url, HTTP_AUTHORIZATION=self.auth('user2')) self.assertEqual(status.HTTP_200_OK, response.status_code) data = response.data self.assertEqual(2, data['coun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_view_all(self):\n return self.request.user.has_permission(\"core.view_all_members\")", "def user_has_access(self, user):\n if not user: return False\n query = db.Query(TaskListMember)\n query.filter('task_list =', self)\n query.filter('user =', user)\n return query.get()", "def te...
[ "0.6774586", "0.6566311", "0.65049064", "0.63590103", "0.63404006", "0.62990886", "0.62485856", "0.6227663", "0.62179005", "0.6205145", "0.6188063", "0.6171976", "0.6167746", "0.6152229", "0.6151261", "0.611896", "0.60998124", "0.60557985", "0.60555935", "0.60300905", "0.6018...
0.6096858
17
Ensure a user can list all his memberships
def test_list_my_memberships_owner(self): url = '/api/v1/communities/0/list_my_memberships/' response = self.client.get(url, HTTP_AUTHORIZATION=self.auth('user1')) self.assertEqual(status.HTTP_200_OK, response.status_code) data = response.data self.assertEqual(10, data['count']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_view_all(self):\n return self.request.user.has_permission(\"core.view_all_members\")", "def user_has_access(self, user):\n if not user: return False\n query = db.Query(TaskListMember)\n query.filter('task_list =', self)\n query.filter('user =', user)\n return query.get()", "def te...
[ "0.6774586", "0.6566311", "0.65049064", "0.63404006", "0.62990886", "0.62485856", "0.6227663", "0.62179005", "0.6205145", "0.6188063", "0.6171976", "0.6167746", "0.6152229", "0.6151261", "0.611896", "0.60998124", "0.6096858", "0.60557985", "0.60555935", "0.60300905", "0.60181...
0.63590103
3
Ensure non authenticated user cannot list community members
def test_list_members_without_auth(self): url = '/api/v1/communities/3/retrieve_members/' response = self.client.get(url) self.assertEqual(status.HTTP_401_UNAUTHORIZED, response.status_code)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_members_with_mod_rights_not_accepted(self):\n url = '/api/v1/communities/3/retrieve_members/'\n\n # Test before acceptation\n response = self.client.get(url, HTTP_AUTHORIZATION=self.auth('user2'))\n self.assertEqual(status.HTTP_401_UNAUTHORIZED, response.status_code)", "...
[ "0.7399298", "0.7190504", "0.7182893", "0.7121631", "0.7106234", "0.6940128", "0.69334257", "0.67819583", "0.67460865", "0.6644789", "0.63791406", "0.63500303", "0.63494563", "0.63248897", "0.6277158", "0.62570494", "0.62570494", "0.6224564", "0.62238985", "0.6190223", "0.618...
0.696477
5
Ensure a nonmember authenticated user cannot list community members
def test_list_members_without_member_rights(self): url = '/api/v1/communities/3/retrieve_members/' response = self.client.get(url, HTTP_AUTHORIZATION=self.auth('user4')) self.assertEqual(status.HTTP_401_UNAUTHORIZED, response.status_code)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_members_with_mod_rights_not_accepted(self):\n url = '/api/v1/communities/3/retrieve_members/'\n\n # Test before acceptation\n response = self.client.get(url, HTTP_AUTHORIZATION=self.auth('user2'))\n self.assertEqual(status.HTTP_401_UNAUTHORIZED, response.status_code)", "...
[ "0.74336517", "0.71425796", "0.71181476", "0.711704", "0.69755274", "0.6971609", "0.6896055", "0.6858473", "0.6735097", "0.67309946", "0.64784896", "0.6459869", "0.6459869", "0.64299446", "0.6417699", "0.6399707", "0.6287258", "0.6272853", "0.6266458", "0.62664276", "0.625872...
0.7155631
1
Ensure a simple user cannot list community members
def test_list_members_without_mod_rights(self): url = '/api/v1/communities/3/retrieve_members/' response = self.client.get(url, HTTP_AUTHORIZATION=self.auth('user3')) self.assertEqual(status.HTTP_401_UNAUTHORIZED, response.status_code)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cant_ban_user_from_community_if_member(self):\n user = make_user()\n headers = make_authentication_headers_for_user(user)\n\n other_user = make_user()\n community = make_community(creator=other_user, type='P')\n community_name = community.name\n\n user.join_commun...
[ "0.7069592", "0.70106155", "0.69400036", "0.6918891", "0.6776818", "0.667411", "0.6568431", "0.6553313", "0.65358704", "0.65321076", "0.64630955", "0.6450365", "0.64141417", "0.6353186", "0.6347235", "0.63257086", "0.6284112", "0.62234205", "0.61991274", "0.6178254", "0.61459...
0.66867757
5
Ensure a moderator can list community members
def test_list_members_with_mod_rights_not_accepted(self): url = '/api/v1/communities/3/retrieve_members/' # Test before acceptation response = self.client.get(url, HTTP_AUTHORIZATION=self.auth('user2')) self.assertEqual(status.HTTP_401_UNAUTHORIZED, response.status_code)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_my_memberships_moderator(self):\n url = '/api/v1/communities/0/list_my_memberships/'\n\n response = self.client.get(url, HTTP_AUTHORIZATION=self.auth('user2'))\n self.assertEqual(status.HTTP_200_OK, response.status_code)\n\n data = response.data\n self.assertEqual(2...
[ "0.7051194", "0.6711181", "0.64728236", "0.64343464", "0.6335402", "0.6332418", "0.6322088", "0.6300939", "0.62266105", "0.62061685", "0.6186931", "0.6154109", "0.6133125", "0.6089142", "0.6066312", "0.60557896", "0.60480255", "0.60186434", "0.5995337", "0.598136", "0.5977626...
0.6736305
1
Ensure a moderator can list community members
def test_list_members_with_mod_rights(self): url = '/api/v1/communities/4/retrieve_members/' response = self.client.get(url, HTTP_AUTHORIZATION=self.auth('user2')) self.assertEqual(status.HTTP_200_OK, response.status_code) data = response.data self.assertEqual(3, data['count'])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_my_memberships_moderator(self):\n url = '/api/v1/communities/0/list_my_memberships/'\n\n response = self.client.get(url, HTTP_AUTHORIZATION=self.auth('user2'))\n self.assertEqual(status.HTTP_200_OK, response.status_code)\n\n data = response.data\n self.assertEqual(2...
[ "0.70512396", "0.6736367", "0.6472901", "0.64344007", "0.6335448", "0.63324916", "0.6322152", "0.6300987", "0.6226662", "0.6206207", "0.61869806", "0.6154166", "0.61331785", "0.6089228", "0.60663474", "0.60558283", "0.6048072", "0.60186964", "0.59953946", "0.59813803", "0.597...
0.6711235
2
Ensure an owner can list community members
def test_list_members_with_owner_rights(self): url = '/api/v1/communities/4/retrieve_members/' response = self.client.get(url, HTTP_AUTHORIZATION=self.auth('user1')) self.assertEqual(status.HTTP_200_OK, response.status_code) data = response.data self.assertEqual(3, data['count'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_my_memberships_owner(self):\n url = '/api/v1/communities/0/list_my_memberships/'\n\n response = self.client.get(url, HTTP_AUTHORIZATION=self.auth('user1'))\n self.assertEqual(status.HTTP_200_OK, response.status_code)\n\n data = response.data\n self.assertEqual(10, d...
[ "0.6850305", "0.6369545", "0.6356356", "0.63156796", "0.6232381", "0.62307173", "0.6166239", "0.6013789", "0.5975188", "0.59524864", "0.5949585", "0.5914357", "0.5889505", "0.58360505", "0.5826356", "0.58094084", "0.5800246", "0.5785122", "0.5776153", "0.57705945", "0.5761523...
0.73415005
0
Ensure a non authenticated user can not accept members
def test_accept_member_without_auth(self): url = '/api/v1/communities/3/accept_member/' data = { 'id': 5 } response = self.client.post(url, data, format='json') self.assertEqual(status.HTTP_401_UNAUTHORIZED, response.status_code)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_members_with_mod_rights_not_accepted(self):\n url = '/api/v1/communities/3/retrieve_members/'\n\n # Test before acceptation\n response = self.client.get(url, HTTP_AUTHORIZATION=self.auth('user2'))\n self.assertEqual(status.HTTP_401_UNAUTHORIZED, response.status_code)", "...
[ "0.68864214", "0.68594414", "0.68594414", "0.68196666", "0.6741349", "0.66763455", "0.66365176", "0.6605744", "0.65392977", "0.65020585", "0.6482663", "0.6467157", "0.64486504", "0.64451766", "0.64451766", "0.64451766", "0.64451766", "0.64321786", "0.6431112", "0.6427954", "0...
0.65579623
8
Ensure a simple member cannot accept members
def test_accept_member_with_simple_member(self): url = '/api/v1/communities/3/accept_member/' data = { 'id': 5 } response = self.client.post(url, data, HTTP_AUTHORIZATION=self.auth('user4'), format='json') self.assertEqual(status.HTTP_401_UNAUTHORIZED, response.statu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_validate_member_scheme_not_a_scheme(self):\n opt = scheme.ListOption('test-opt', member_scheme='not-none-or-scheme')\n with pytest.raises(errors.SchemeValidationError):\n opt.validate('foo', ['a', 'b', 'c'])", "def test_validate_member_type_failure(self, member_type, value):\n ...
[ "0.6126346", "0.6092689", "0.60851455", "0.60830885", "0.5978135", "0.58772665", "0.5831851", "0.583164", "0.57699126", "0.5750457", "0.57425725", "0.57206964", "0.5703227", "0.56783754", "0.5675422", "0.5658444", "0.56334704", "0.56322676", "0.56309956", "0.5622133", "0.5620...
0.0
-1
Ensure an owner can accept members
def test_accept_member_with_owner(self): url = '/api/v1/communities/3/accept_member/' data = { 'id': 5 } response = self.client.post(url, data, HTTP_AUTHORIZATION=self.auth('user1'), format='json') self.assertEqual(status.HTTP_200_OK, response.status_code) d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_accept_member_with_owner_bad_request(self):\n url = '/api/v1/communities/3/accept_member/'\n data = {\n 'lol': 5\n }\n\n response = self.client.post(url, data, HTTP_AUTHORIZATION=self.auth('user1'), format='json')\n self.assertEqual(status.HTTP_400_BAD_REQUEST...
[ "0.6731412", "0.65779585", "0.63750887", "0.6366519", "0.6354966", "0.62834394", "0.6279583", "0.6198843", "0.6170857", "0.61704665", "0.61604524", "0.6086872", "0.60775965", "0.6073261", "0.60595465", "0.6056707", "0.59992194", "0.5991158", "0.5943764", "0.59232306", "0.5914...
0.6751411
0
Ensure accept_member request data format
def test_accept_member_with_owner_bad_request(self): url = '/api/v1/communities/3/accept_member/' data = { 'lol': 5 } response = self.client.post(url, data, HTTP_AUTHORIZATION=self.auth('user1'), format='json') self.assertEqual(status.HTTP_400_BAD_REQUEST, response.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_accept_member_with_simple_member(self):\n url = '/api/v1/communities/3/accept_member/'\n data = {\n 'id': 5\n }\n\n response = self.client.post(url, data, HTTP_AUTHORIZATION=self.auth('user4'), format='json')\n self.assertEqual(status.HTTP_401_UNAUTHORIZED, re...
[ "0.6623991", "0.6439201", "0.6344205", "0.60939497", "0.6076833", "0.5939714", "0.57749414", "0.57017714", "0.56973577", "0.56565666", "0.55855423", "0.54607755", "0.54509866", "0.5416845", "0.54042083", "0.5377248", "0.5291782", "0.52428794", "0.52106965", "0.52024275", "0.5...
0.6553939
1
Ensure an non accepted moderator cannot accept members
def test_accept_member_with_not_accepted_moderator(self): url = '/api/v1/communities/3/accept_member/' data = { 'id': 5 } response = self.client.post(url, data, HTTP_AUTHORIZATION=self.auth('user2'), format='json') self.assertEqual(status.HTTP_401_UNAUTHORIZED, respo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_regular_member_cannot_target_another_member(self, constants):\n constants.MODERATION_ROLES = [self.moderator_role.id]\n ctx = helpers.MockContext(author=self.author)\n\n await self.cog.user_info(self.cog, ctx, self.target)\n\n ctx.send.assert_called_once_with(\"You may no...
[ "0.6785598", "0.64873403", "0.64873403", "0.64451265", "0.6402304", "0.63861674", "0.638381", "0.63739187", "0.6372048", "0.63524115", "0.631415", "0.63072675", "0.6279124", "0.62184", "0.6168928", "0.616577", "0.6144473", "0.61243993", "0.60957074", "0.6082967", "0.6080854",...
0.72607374
0
Ensure an moderator can accept members
def test_accept_member_with_moderator(self): mod = Member.objects.get(id=4) mod.status = '1' mod.save() url = '/api/v1/communities/3/accept_member/' data = { 'id': 5 } response = self.client.post(url, data, HTTP_AUTHORIZATION=self.auth('user2'), form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_accept_member_with_not_accepted_moderator(self):\n url = '/api/v1/communities/3/accept_member/'\n data = {\n 'id': 5\n }\n\n response = self.client.post(url, data, HTTP_AUTHORIZATION=self.auth('user2'), format='json')\n self.assertEqual(status.HTTP_401_UNAUTHO...
[ "0.6981334", "0.65625805", "0.65563244", "0.6527023", "0.64415276", "0.6407077", "0.6333332", "0.6292483", "0.62635446", "0.621534", "0.6205803", "0.61909056", "0.6183474", "0.6173419", "0.6173419", "0.6162516", "0.6156852", "0.613148", "0.6097213", "0.60312736", "0.6019743",...
0.71248305
0
A decorator that prints how long a function took to run.
def timer(func): # Define the wrapper function to return def wrapper(*args, **kwargs): # When wrapper() is called, get the current time t_start = time.time() # Call the decorated function and store the result. result = func(*args, **kwargs) # Get the total time it took to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_time(func):\n def wrapper(*args, **kwargs):\n start = time.time()\n result = func(*args, **kwargs)\n done = time.time()\n print(f\"start_time: {start}, end_time: {done}, duration: {done - start}\")\n return result\n\n return wrapper", "def execution_time(func):\...
[ "0.8351", "0.8271865", "0.8107805", "0.8084791", "0.8066382", "0.80261034", "0.7977915", "0.7969038", "0.79266965", "0.78972226", "0.7891819", "0.7882803", "0.78611183", "0.7846636", "0.78464437", "0.7829426", "0.7823577", "0.78007674", "0.77806973", "0.7769669", "0.7751992",...
0.7566843
39