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
Create a new queue.
def create_queue(self, queue_name='', exclusive=True, queue_size=10, message_ttl=60000, overflow_behaviour='drop-head', expires=600000): args = { 'x-max-length': queue_size, 'x-overflow': overflow_behaviour, 'x-message-ttl': message_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _queue_create(self, **kwargs):\n name = self.generate_random_name()\n return self.clients(\"zaqar\").queue(name, **kwargs)", "def new_queue() -> Queue:\n return multiprocessing.Queue()", "def create_queue(self):\n queue_name = self.generate_name()\n try:\n queue = ...
[ "0.84256244", "0.80481786", "0.7837237", "0.7533506", "0.7467886", "0.717403", "0.7129509", "0.7068409", "0.70213354", "0.6993228", "0.68516374", "0.6833725", "0.6795976", "0.676159", "0.67119175", "0.6704848", "0.6704265", "0.66924536", "0.6631918", "0.6602393", "0.65828705"...
0.7167157
6
Check if a queue exists, given its name.
def queue_exists(self, queue_name): # resp = self._channel.queue_declare(queue_name, passive=True, # callback=self._queue_exists_clb) try: resp = self._channel.queue_declare(queue_name, passive=True) except pika.exceptions.ChannelClosedByBro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queue_exists(name: str) -> bool:\n try:\n batch = aws.client_with_default_region(\"batch\")\n\n return bool(\n batch.describe_job_queues(jobQueues = [name]) \\\n .get(\"jobQueues\"))\n except:\n return False", "def check_queue_exists(self, queue_name):\n ...
[ "0.8382494", "0.80331993", "0.7178421", "0.6821361", "0.6522141", "0.6282557", "0.62823933", "0.6259214", "0.6247339", "0.6228033", "0.6066524", "0.6053394", "0.5989296", "0.59568065", "0.59551704", "0.5893848", "0.5880719", "0.58080995", "0.5800476", "0.57873005", "0.5771296...
0.8045337
1
Bind a queue to and exchange using a bindkey.
def bind_queue(self, exchange_name, queue_name, bind_key): self.logger.info('Subscribed to topic: {}'.format(bind_key)) try: self._channel.queue_bind( exchange=exchange_name, queue=queue_name, routing_key=bind_key) except Exception as exc: raise exc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def bind(\n self,\n exchange: ExchangeParamType,\n routing_key: Optional[str] = None,\n *,\n arguments: Arguments = None,\n timeout: TimeoutType = None,\n ) -> aiormq.spec.Queue.BindOk:\n\n if routing_key is None:\n routing_key = self.name\n\n ...
[ "0.81183326", "0.8103516", "0.7299756", "0.72343296", "0.6798707", "0.66810113", "0.6661785", "0.6393759", "0.6380712", "0.61351526", "0.6023554", "0.60181004", "0.5864606", "0.5818092", "0.5730135", "0.56261426", "0.5511071", "0.5502747", "0.54900175", "0.54781646", "0.53866...
0.83013225
0
This method connects to RabbitMQ, returning the connection handle. When the connection is established, the on_connection_open method will be invoked by pika.
def connect(self): self.logger.info("Connecting to AMQP broker @ [{}:{}] ...".format( self._host, self._port)) connection = pika.SelectConnection( pika.URLParameters(host=self.host, port=self.port), on_open_callback=self.on_connection_open, on_open_error_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self):\n logger.info(\"[{}] Connecting to exchange {}\".format(self.bot_id, self.exchange))\n creds = pika.PlainCredentials(self.rabbit_user, self.rabbit_pw)\n return pika.SelectConnection(pika.ConnectionParameters(host=self.rabbit_host,\n ...
[ "0.79583675", "0.76922405", "0.7413911", "0.7396698", "0.7392125", "0.7361149", "0.716752", "0.7063484", "0.6990006", "0.6917834", "0.69153863", "0.69112873", "0.6738685", "0.6720706", "0.66703725", "0.65770364", "0.6209485", "0.6167131", "0.6166281", "0.61037654", "0.6077000...
0.8152155
0
This method is called by pika once the connection to RabbitMQ has been established. It passes the handle to the connection object in case we need it, but in this case, we'll just mark it unused.
def on_connection_open(self, unused_connection): self.logger.info('Connection established!') self.open_channel()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_connection_open(self, unused_conncetion):\n self.logger.info('connection opened, adding connection close callback')\n self._connection.add_on_close_callback(self.on_connection_closed)\n self.open_channel()", "def __init__(self):\n self.connection = pika.BlockingConnection(\n ...
[ "0.6701812", "0.66555756", "0.66298574", "0.656991", "0.6541563", "0.64921635", "0.6467267", "0.6367725", "0.63595337", "0.63595337", "0.63595337", "0.6307992", "0.6292066", "0.62611574", "0.62238425", "0.61832494", "0.6112028", "0.61088294", "0.6090186", "0.6062533", "0.6047...
0.6621059
3
This method adds an on close callback that will be invoked by pika when RabbitMQ closes the connection to the publisher unexpectedly.
def add_on_connection_close_callback(self): self.logger.info('Adding connection close callback') self._connection.add_on_close_callback(self.on_connection_closed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_on_connection_close_callback(self):\n logger.info('Adding connection close callback')\n self._connection.add_on_close_callback(self.on_connection_closed)", "def add_on_channel_close_callback(self):\n self.logger.info('Adding channel close callback')\n self._channel.add_on_clos...
[ "0.68998057", "0.65204984", "0.6488441", "0.6387048", "0.63626075", "0.6320616", "0.63115996", "0.6273689", "0.6253002", "0.61269623", "0.602197", "0.59879506", "0.5974477", "0.59583783", "0.5915136", "0.5909586", "0.59004337", "0.5899694", "0.58445156", "0.58380735", "0.5822...
0.6884927
1
This method is invoked by pika when the connection to RabbitMQ is closed unexpectedly. Since it is unexpected, we will reconnect to RabbitMQ if it disconnects.
def on_connection_closed(self, connection, reply_code, reply_text): if self._closing: self._connection.ioloop.stop() else: self.logger.warning( 'Connection closed, reopening in 5 seconds: (%s) %s', reply_code, reply_text) self._connecti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _on_connection_close(self):\n print(\"connection was closed, reconnecting...\")\n self.connect()", "def on_channel_closed(self, *args, **kwargs):\n if not self._normal_close:\n self.log.warning(\n 'Channel closed. Reconnect after 5s. args: %s, kwargs: %s',\n ...
[ "0.7251963", "0.7179434", "0.7149098", "0.7059979", "0.69511366", "0.6929557", "0.69081956", "0.67586553", "0.6745817", "0.66988873", "0.6589153", "0.654896", "0.6546863", "0.6529638", "0.65250856", "0.65176976", "0.6515138", "0.6503515", "0.6501766", "0.6497037", "0.6458325"...
0.68513435
7
This method is called by pika if the connection to RabbitMQ can't be established.
def on_connection_open_error(self, _unused_connection, err): self.logger.info('Connection open failed: %s', err) self.reconnect()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self):\n\n if settings.DEBUG:\n parameters = pika.ConnectionParameters(self._host)\n else:\n credentials = pika.PlainCredentials(\n username=settings.RABBITMQ_USERNAME,\n password=settings.RABBITMQ_PASSWORD\n )\n pa...
[ "0.76524365", "0.73355776", "0.7146914", "0.7039626", "0.6954922", "0.6872367", "0.66885805", "0.6670188", "0.66616225", "0.66507435", "0.66390634", "0.66341794", "0.6580812", "0.6533151", "0.6533151", "0.6533151", "0.64967763", "0.64835", "0.64647335", "0.6295705", "0.624545...
0.0
-1
Will be invoked by the IOLoop timer if the connection is closed. See the on_connection_closed method.
def reconnect(self): # This is the old connection IOLoop instance, stop its ioloop self._connection.ioloop.stop() if not self._closing: # Create a new connection self._connection = self.connect() # There is now a new connection, needs a new ioloop to run ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_connection_closed(self):", "def _on_connection_close(self):\n print(\"connection was closed, reconnecting...\")\n self.connect()", "def connection_closed(self) -> bool:", "def on_connection_closed(self, connection, *args):\n self.logger.debug(\"Connection %s closed: %s\", connecti...
[ "0.7900951", "0.7527537", "0.733466", "0.71512675", "0.7019361", "0.69824934", "0.6971358", "0.69225365", "0.6832293", "0.6736063", "0.6719352", "0.6688421", "0.66839", "0.662017", "0.66129375", "0.66046816", "0.6596524", "0.6573944", "0.6537812", "0.653255", "0.65226555", ...
0.61807764
47
Open a new channel with RabbitMQ by issuing the Channel.Open RPC command. When RabbitMQ responds that the channel is open, the on_channel_open callback will be invoked by pika.
def open_channel(self): self.logger.info('Creating a new channel') self._connection.channel(on_open_callback=self.on_channel_open)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_channel(self):\n logger.info('Creating a new channel')\n self._connection.channel(on_open_callback=self.on_channel_open)", "def open_channel(self):\n self.logger.info('creating channel')\n self._connection.channel(on_open_callback=self.on_channel_opened)", "def open_channel...
[ "0.83642685", "0.8301442", "0.79944754", "0.75968945", "0.7201714", "0.7161115", "0.71372306", "0.69947195", "0.6949203", "0.6906915", "0.68744904", "0.6814651", "0.6694035", "0.66927004", "0.66060114", "0.6562752", "0.6420667", "0.64157397", "0.6349529", "0.6260485", "0.6246...
0.8340857
1
This method is invoked by pika when the channel has been opened. The channel object is passed in so we can make use of it. Since the channel is now open, we'll declare the exchange to use. IMPLEMENT IN INHERITED CLASSES!!!!!!!!
def on_channel_open(self, channel): self.logger.info('Channel opened') self._channel = channel self.add_on_channel_close_callback()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, channel, exchange_name='SIAEF', type_exchange='direct',\n durable=True, auto_delete=False):\n self._channel = channel\n self._exchange = exchange_name\n self._type = type_exchange\n self._durable = durable\n self._auto_delete = auto_delete", "...
[ "0.71607494", "0.6960244", "0.6836535", "0.67349494", "0.6725853", "0.6699549", "0.6674025", "0.6576601", "0.65715283", "0.6568829", "0.650567", "0.6453448", "0.64338934", "0.63642514", "0.63528585", "0.63528585", "0.63066196", "0.6247157", "0.6232668", "0.62311137", "0.61946...
0.6367061
13
This method tells pika to call the on_channel_closed method if RabbitMQ unexpectedly closes the channel.
def add_on_channel_close_callback(self): self.logger.info('Adding channel close callback') self._channel.add_on_close_callback(self.on_channel_closed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_channel_closed(self, channel, reason):\n LOGGER.warning('Channel %i was closed: %s', channel, reason)\n self.close_connection()", "def on_channel_closed(self, channel, *args):\n self.logger.debug(\"Channel %i closed: %s\", channel, args)\n\n if self._connection.is_open:\n ...
[ "0.8011449", "0.793568", "0.7836473", "0.77349186", "0.7723029", "0.7692266", "0.7498293", "0.71402335", "0.7060219", "0.69551265", "0.6825842", "0.67961293", "0.67742664", "0.67607003", "0.6727862", "0.6648942", "0.6603812", "0.6585666", "0.65702814", "0.64794236", "0.647406...
0.7093154
8
Invoked by pika when RabbitMQ unexpectedly closes the channel. Channels are usually closed if you attempt to do something that violates the protocol, such as redeclare an exchange or queue with different parameters. In this case, we'll close the connection to shutdown the object.
def on_channel_closed(self, channel, reply_code, reply_text): self.logger.warning('Channel %i was closed: (%s) %s', channel, reply_code, reply_text) self._connection.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n if self.closed:\n return\n try:\n self.channel.close(self)\n self.dispose()\n except StopIteration:\n # If the underlying connection for the channel is closed explicitly\n # open will not able to find an appropriate chan...
[ "0.76048094", "0.75260854", "0.7489542", "0.7464305", "0.7393039", "0.7334392", "0.7277552", "0.7258353", "0.72012675", "0.71841216", "0.71738076", "0.71419466", "0.7117607", "0.71016544", "0.70979506", "0.70826536", "0.7029215", "0.702514", "0.6946058", "0.68941104", "0.6890...
0.70083207
18
This method sets up the consumer prefetch to only be delivered one message at a time. The consumer must acknowledge this message before RabbitMQ will deliver another one. You should experiment with different prefetch values to achieve desired performance.
def set_qos(self, on_ok): self._channel.basic_qos( prefetch_count=self._prefetch_count, callback=on_ok)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consumer(self, no_ack=False, prefetch=100, priority=None):\n if prefetch is not None:\n self.channel.prefetch_count(prefetch)\n self.channel._consume(self, no_ack, priority)\n self.consuming = True\n yield Consumer(self)", "def _begin_consuming(self):\n self._con...
[ "0.6386738", "0.6202129", "0.60504824", "0.59214187", "0.5843941", "0.57672805", "0.5666277", "0.5638212", "0.55534893", "0.5539789", "0.5535149", "0.54916906", "0.5320489", "0.5203373", "0.51975536", "0.5137638", "0.51316375", "0.5095189", "0.507659", "0.5065045", "0.5050707...
0.49272645
22
Creates an instance of this client using the provided credentials info.
def from_service_account_info(cls, info: dict, *args, **kwargs): return TraceServiceClient.from_service_account_info.__func__(TraceServiceAsyncClient, info, *args, **kwargs) # type: ignore
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_credentials(credentials):\n return API(\n username=credentials.username,\n password=credentials.password,\n database=credentials.database,\n session_id=credentials.session_id,\n server=credentials.server,\n )", "def client():\n retu...
[ "0.7084263", "0.68953437", "0.6611958", "0.64023256", "0.64023256", "0.6395", "0.6389857", "0.63601583", "0.63514674", "0.6341069", "0.6340937", "0.6337875", "0.6331294", "0.6324723", "0.6295603", "0.6272051", "0.62671936", "0.62648886", "0.6210242", "0.62000835", "0.61797225...
0.5909938
46
Creates an instance of this client using the provided credentials file.
def from_service_account_file(cls, filename: str, *args, **kwargs): return TraceServiceClient.from_service_account_file.__func__(TraceServiceAsyncClient, filename, *args, **kwargs) # type: ignore
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_file(cls, filename, **kwargs):\n return super(Credentials, cls).from_file(filename, **kwargs)", "def from_service_account_file(cls, filename: str, *args, **kwargs):\n return Controller2Client.from_service_account_file.__func__(Controller2AsyncClient, filename, *args, **kwargs) # type: ign...
[ "0.7091153", "0.67576563", "0.67252976", "0.6711361", "0.6703819", "0.6665847", "0.6665847", "0.6665847", "0.6661515", "0.6661515", "0.6504191", "0.6491302", "0.64719963", "0.64663166", "0.63905597", "0.63775736", "0.63732255", "0.63529396", "0.62860876", "0.62815064", "0.625...
0.6268551
20
Return the API endpoint and client cert source for mutual TLS.
def get_mtls_endpoint_and_cert_source( cls, client_options: Optional[ClientOptions] = None ): return TraceServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mtls_endpoint_and_cert_source(\n cls, client_options: Optional[client_options_lib.ClientOptions] = None\n ):\n if client_options is None:\n client_options = client_options_lib.ClientOptions()\n use_client_cert = os.getenv(\"GOOGLE_API_USE_CLIENT_CERTIFICATE\", \"false\")\...
[ "0.68628275", "0.6686332", "0.6681253", "0.6476345", "0.6468472", "0.6432804", "0.6295466", "0.5955754", "0.5941172", "0.584801", "0.58269423", "0.5758851", "0.57413423", "0.57297987", "0.56861925", "0.56242657", "0.55747026", "0.55548036", "0.5545874", "0.5531823", "0.552890...
0.620875
7
Returns the transport used by the client instance.
def transport(self) -> TraceServiceTransport: return self._client.transport
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transport(self):\n return self._transport", "def transport(self) -> ServiceControllerTransport:\n return self._client.transport", "def transport(self) -> MetadataServiceTransport:\n return self._client.transport", "def transport(self) -> Controller2Transport:\n return self._cl...
[ "0.82946277", "0.773594", "0.773068", "0.76806635", "0.7674273", "0.76357967", "0.7558095", "0.7551682", "0.75303864", "0.74958986", "0.7488142", "0.7436853", "0.7423566", "0.7368433", "0.73340607", "0.721926", "0.7109823", "0.7102308", "0.68808985", "0.68144", "0.6671675", ...
0.7887542
1
Instantiates the trace service client.
def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, TraceServiceTransport] = "grpc_asyncio", client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_service_account_info(cls, info: dict, *args, **kwargs):\n return TraceServiceClient.from_service_account_info.__func__(TraceServiceAsyncClient, info, *args, **kwargs) # type: ignore", "def init_tracing(tracer=None, start_span_cb=None):\n if start_span_cb is not None and not callable(start_spa...
[ "0.6224425", "0.614903", "0.6148861", "0.6143238", "0.60640776", "0.60572755", "0.6037", "0.6000073", "0.59515965", "0.5935823", "0.59356844", "0.58780044", "0.5807344", "0.5730025", "0.5720148", "0.57108897", "0.56886417", "0.5663852", "0.565965", "0.56489265", "0.56397253",...
0.72883797
0
r"""Batch writes new spans to new or existing traces. You cannot update existing spans.
async def batch_write_spans( self, request: Optional[Union[tracing.BatchWriteSpansRequest, dict]] = None, *, name: Optional[str] = None, spans: Optional[MutableSequence[trace.Span]] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, obje...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def emit(self, span_datas):\n spans = []\n for span_data in span_datas:\n start_timestamp_mus = timestamp_to_microseconds(span_data.start_time)\n end_timestamp_mus = timestamp_to_microseconds(span_data.end_time)\n duration_mus = end_timestamp_mus - start_timestamp_mus...
[ "0.6811375", "0.60281205", "0.5970347", "0.57480675", "0.5696596", "0.56760955", "0.5543506", "0.55071294", "0.5426647", "0.5372521", "0.5276325", "0.52397996", "0.52351356", "0.5235073", "0.52316785", "0.5226964", "0.519142", "0.5142626", "0.51129663", "0.51124173", "0.51083...
0.6472164
1
r"""Creates a new span.
async def create_span( self, request: Optional[Union[trace.Span, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> trace.Span: # Create or c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_span(\n span_id,\n parent_span_id,\n trace_id,\n span_name,\n annotations,\n binary_annotations,\n):\n span_dict = {\n \"trace_id\": unsigned_hex_to_signed_int(trace_id),\n \"name\": span_name,\n \"id\": unsigned_hex_to_signed_int(span_id),\n \"annotation...
[ "0.7390717", "0.6574922", "0.65667725", "0.6332873", "0.6157061", "0.61126727", "0.606435", "0.5934049", "0.58486116", "0.5803575", "0.5777852", "0.5760561", "0.57184625", "0.57174397", "0.57099116", "0.56587386", "0.5475287", "0.54695296", "0.5420705", "0.5386749", "0.537131...
0.5682287
15
Test the profile API endpoint GET response
def test_profile_api_get(self): response = self.client.get(self.url) self.assertEqual(response.status_code, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_profiles(self):\n\n result = self.client.get(\"/profile/1\")\n self.assertIn(b'In house:',result.data)", "def test_retrieve_profile_success(self):\r\n res = self.client.get(ME_URL)\r\n\r\n self.assertEqual(res.status_code, status.HTTP_200_OK)\r\n self.assertEqual(...
[ "0.78998727", "0.78946996", "0.78889894", "0.78718877", "0.7852061", "0.78516936", "0.7841847", "0.7619126", "0.75576365", "0.7531133", "0.7519396", "0.75156456", "0.75071", "0.748667", "0.7394794", "0.7361457", "0.73495585", "0.73462677", "0.73241436", "0.72645575", "0.72075...
0.8666205
0
Test the profile API endpoint GET response
def test_profile_api_post(self): response = self.client.get(self.url) j = response.json() obj = j['objects'][0] #self.assertFalse(obj['telephone']) #tel = '9111 1111' #response = self.client.post(self.url, {'telephone': tel}) #self.assertEqual(response.status_code...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_profile_api_get(self):\n response = self.client.get(self.url)\n self.assertEqual(response.status_code, 200)", "def test_user_profiles(self):\n\n result = self.client.get(\"/profile/1\")\n self.assertIn(b'In house:',result.data)", "def test_retrieve_profile_success(self):\r\...
[ "0.86665565", "0.79003435", "0.78957915", "0.78895974", "0.7873033", "0.78528136", "0.7851981", "0.7843075", "0.76203614", "0.75586027", "0.75321424", "0.7518781", "0.7516638", "0.7506998", "0.7487404", "0.7394842", "0.7362004", "0.7350435", "0.7346322", "0.7324662", "0.72647...
0.64742774
76
Test that anonymous users can't use the profile endpoint
def test_profile_api_anon(self): self.client.logout() response = self.client.get(self.url) self.assertEqual(response.status_code, 403)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_anonymous_cannot_get_userprofileview(dclient):\n resp = dclient.get(\"/api/record/profile/\", follow=True)\n assert resp.status_code == 403", "def test_user_get_profile_not_authorized(self):\n self.client.logout()\n response = self.client.get(CONSTS.USER_PROFILE_URL)\n self.as...
[ "0.82741946", "0.79313326", "0.7904038", "0.735246", "0.7276615", "0.7208659", "0.7133845", "0.71277064", "0.71277064", "0.7126814", "0.7056105", "0.7036489", "0.6996773", "0.69937104", "0.6974785", "0.69686174", "0.69459134", "0.69378793", "0.69362813", "0.6936106", "0.69107...
0.83698225
0
Test the data_org_structure API endpoint
def test_data_org_structure(self): url = '/api/options/?list=org_structure' response = self.client.get(url) self.assertEqual(response.status_code, 200) # Division 1 will be present in the response. self.assertContains(response, self.div1.name) # Response can be deserialis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_org_structure(self):\n url = '/api/users/?org_structure=true'\n response = self.client.get(url)\n self.assertEqual(response.status_code, 200)\n # User 1 will be present in the response.\n self.assertContains(response, self.user1.email)\n # Division 1 will be prese...
[ "0.7280201", "0.7019675", "0.69859654", "0.698312", "0.6874224", "0.68411446", "0.6755719", "0.6737832", "0.6731981", "0.6727342", "0.66614383", "0.65936196", "0.65404403", "0.6487398", "0.6469158", "0.6427537", "0.6424736", "0.64159113", "0.6405096", "0.6384944", "0.6375816"...
0.79321814
0
Test the data_cost_centre API endpoint
def test_data_cost_centre(self): url = '/api/options/?list=cost_centre' response = self.client.get(url) self.assertEqual(response.status_code, 200) # 001 will be present in the response. self.assertContains(response, self.cc1.code) # Add 'inactive' to Division 1 name to i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_costcenter_create(self):\n response = self.client.post(self.url, self.data, format='json')\n self.assertEqual(response.status_code, status.HTTP_201_CREATED)\n self.assertEqual(CostCenter.objects.latest('pk').name, 'testCostCenter')", "def test_costcenter_permissions(self):\n ...
[ "0.64706284", "0.6464512", "0.643265", "0.63336295", "0.62168723", "0.61924493", "0.6173499", "0.6118328", "0.6030371", "0.59304565", "0.588217", "0.58735037", "0.58357346", "0.5835226", "0.5833968", "0.58259165", "0.58216953", "0.5815268", "0.5794791", "0.5775297", "0.575300...
0.75237375
0
Test the data_org_unit API endpoint
def test_data_org_unit(self): url = '/api/options/?list=org_unit' response = self.client.get(url) self.assertEqual(response.status_code, 200) # Org unit names will be present in the response. self.assertContains(response, self.dept.name) self.assertContains(response, self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_org_unit_types_retrieve_ok(self):\n\n self.client.force_authenticate(self.jane)\n response = self.client.get(f\"/api/orgunittypes/{self.org_unit_type_1.id}/\")\n self.assertJSONResponse(response, 200)\n self.assertValidOrgUnitTypeData(response.json())", "def test_api_response...
[ "0.7054267", "0.69409764", "0.68107057", "0.677534", "0.6769197", "0.6747698", "0.66711855", "0.66707194", "0.6649014", "0.6616306", "0.65697694", "0.6565859", "0.65644926", "0.6545995", "0.6535199", "0.65209496", "0.6512976", "0.64967656", "0.6492492", "0.64836305", "0.64805...
0.78380704
0
Test the data_dept_user API endpoint
def test_data_dept_user(self): url = '/api/options/?list=dept_user' response = self.client.get(url) self.assertEqual(response.status_code, 200) # User 1 will be present in the response. self.assertContains(response, self.user1.email) # Make a user inactive to test excludi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_user_get(self):\n pass", "def test_api_can_get_department_by_id(self):\n res = self.client().get(service_url+'/1')\n self.assertEqual(res.status_code, 200)\n self.assertIn('dep 1', str(res.data))", "def test_department_list_view_does_not_require_login(self):\n\n ...
[ "0.6911616", "0.6585779", "0.65574944", "0.6486932", "0.6429227", "0.6393024", "0.6330526", "0.6287828", "0.62805206", "0.62287253", "0.62287253", "0.6190859", "0.61889917", "0.6157453", "0.61065644", "0.61012024", "0.60839427", "0.6061331", "0.60579497", "0.6019481", "0.5989...
0.78939223
0
Test the DepartmentUserResource list responses
def test_list(self): url = '/api/users/' response = self.client.get(url) self.assertEqual(response.status_code, 200) r = response.json() self.assertTrue(isinstance(r['objects'], list)) # Response should not contain inactive, contractors or shared accounts. self.as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_data_dept_user(self):\n url = '/api/options/?list=dept_user'\n response = self.client.get(url)\n self.assertEqual(response.status_code, 200)\n # User 1 will be present in the response.\n self.assertContains(response, self.user1.email)\n # Make a user inactive to t...
[ "0.70617765", "0.6896499", "0.6760332", "0.67289186", "0.6697319", "0.66882765", "0.6570206", "0.647242", "0.6395878", "0.6352461", "0.6339239", "0.62306577", "0.6206826", "0.6193651", "0.61818725", "0.6169891", "0.61679596", "0.61593413", "0.6158925", "0.6155703", "0.6143452...
0.7140781
0
Test the DepartmentUserResource filtered list responses
def test_list_filtering(self): # Test the "all" response. url = '/api/users/?all=true' response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertContains(response, self.contract_user.email) self.assertContains(response, self.del_user.email) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list(self):\n url = '/api/users/'\n response = self.client.get(url)\n self.assertEqual(response.status_code, 200)\n r = response.json()\n self.assertTrue(isinstance(r['objects'], list))\n # Response should not contain inactive, contractors or shared accounts.\n ...
[ "0.6846262", "0.67765677", "0.6305678", "0.6193764", "0.6162232", "0.61519986", "0.61414033", "0.6136389", "0.6124053", "0.61087686", "0.60943234", "0.60008335", "0.59636486", "0.5943496", "0.59418", "0.59281904", "0.5924701", "0.5920633", "0.59044653", "0.5896293", "0.587839...
0.6689523
2
Test the DepartmentUserResource detail response
def test_detail(self): # Test detail URL using ad_guid. url = '/api/users/{}/'.format(self.user1.ad_guid) response = self.client.get(url) self.assertEqual(response.status_code, 200) # Test URL using email also. url = '/api/users/{}/'.format(self.user1.email.lower()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_data_dept_user(self):\n url = '/api/options/?list=dept_user'\n response = self.client.get(url)\n self.assertEqual(response.status_code, 200)\n # User 1 will be present in the response.\n self.assertContains(response, self.user1.email)\n # Make a user inactive to t...
[ "0.722836", "0.6757754", "0.66205096", "0.6576246", "0.6565223", "0.64823437", "0.6452468", "0.640094", "0.63558656", "0.6343852", "0.62996393", "0.6298576", "0.629484", "0.62794876", "0.6237302", "0.62220615", "0.6208703", "0.6194712", "0.6190152", "0.6186738", "0.61780584",...
0.66737914
2
Test the DepartmentUserResource org_structure response
def test_org_structure(self): url = '/api/users/?org_structure=true' response = self.client.get(url) self.assertEqual(response.status_code, 200) # User 1 will be present in the response. self.assertContains(response, self.user1.email) # Division 1 will be present in the r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_data_org_structure(self):\n url = '/api/options/?list=org_structure'\n response = self.client.get(url)\n self.assertEqual(response.status_code, 200)\n # Division 1 will be present in the response.\n self.assertContains(response, self.div1.name)\n # Response can be...
[ "0.7079402", "0.6818299", "0.66625524", "0.64964676", "0.63513947", "0.6324385", "0.6287517", "0.624722", "0.6163514", "0.607215", "0.6066868", "0.6002692", "0.60003984", "0.5983165", "0.59071344", "0.5842544", "0.58366925", "0.58230346", "0.5792428", "0.57868", "0.57077533",...
0.7828602
0
Test the sync_o365=true request parameter
def test_org_structure_sync_0365(self): self.div1.sync_o365 = False self.div1.save() url = '/api/users/?org_structure=true&sync_o365=true' response = self.client.get(url) self.assertEqual(response.status_code, 200) # Division 1 won't be present in the response. se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update(self):\n tz = pytz.timezone(settings.TIME_ZONE)\n self.assertFalse(self.user1.o365_licence)\n url = '/api/users/{}/'.format(self.user1.ad_guid)\n data = {\n 'Surname': 'Lebowski',\n 'title': 'Bean Counter',\n 'o365_licence': True,\n\n ...
[ "0.5523401", "0.5490021", "0.5473076", "0.5389904", "0.5329667", "0.5279898", "0.5278388", "0.52731276", "0.5264166", "0.5212756", "0.520137", "0.5167739", "0.5163394", "0.5136898", "0.5109988", "0.509473", "0.5079237", "0.5046441", "0.50332296", "0.5016915", "0.50153786", ...
0.63471866
0
Test populate_groups=true request parameter
def test_org_structure_populate_groups_members(self): self.user3.populate_primary_group = False self.user3.save() url = '/api/users/?org_structure=true&populate_groups=true' response = self.client.get(url) self.assertEqual(response.status_code, 200) # User 2 will be prese...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_groups_get(self):\n pass", "def test_groups_get(self):\n pass", "def test_get_groups(self):\n pass", "def test_get_groups(self):\n pass", "def test_get_group(self):\n pass", "def test_groups_post(self):\n pass", "def test_api_v1_groups_post(self):\n ...
[ "0.753054", "0.753054", "0.7523477", "0.7523477", "0.7240147", "0.7155175", "0.7128205", "0.7106086", "0.7093751", "0.6990435", "0.69688916", "0.69688916", "0.68914807", "0.6871205", "0.6870413", "0.6816445", "0.67022467", "0.66704774", "0.6640968", "0.66321903", "0.6613571",...
0.68094444
16
Test the DepartmentUserResource create response with missing data
def test_create_invalid(self): url = '/api/users/' data = {} username = str(uuid1())[:8] # Response should be status 400 where essential parameters are missing. response = self.client.post(url, json.dumps(data), content_type='application/json') self.assertEqual(response.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_valid(self):\n url = '/api/users/'\n username = str(uuid1())[:8]\n data = {\n 'EmailAddress': '{}@dbca.wa.gov.au'.format(username),\n 'DisplayName': 'Doe, John',\n 'SamAccountName': username,\n 'DistinguishedName': 'CN={},OU=Users,DC=...
[ "0.7841297", "0.7816776", "0.7070017", "0.701998", "0.69643325", "0.6918825", "0.68151873", "0.6812281", "0.68062836", "0.665978", "0.6655587", "0.6646549", "0.6630824", "0.65947104", "0.65903497", "0.65839535", "0.658191", "0.6577394", "0.65673107", "0.6548825", "0.65404", ...
0.72707784
2
Test the DepartmentUserResource create response with valid data
def test_create_valid(self): url = '/api/users/' username = str(uuid1())[:8] data = { 'EmailAddress': '{}@dbca.wa.gov.au'.format(username), 'DisplayName': 'Doe, John', 'SamAccountName': username, 'DistinguishedName': 'CN={},OU=Users,DC=domain'.form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_valid_alt(self):\n url = '/api/users/'\n username = str(uuid1())[:8]\n data = {\n 'email': '{}@dbca.wa.gov.au'.format(username),\n 'name': 'Doe, John',\n 'username': username,\n 'ad_dn': 'CN={},OU=Users,DC=domain'.format(username),\n ...
[ "0.818291", "0.7483183", "0.74106675", "0.7328781", "0.7323043", "0.7190883", "0.7050981", "0.7025523", "0.70017236", "0.6995397", "0.6940708", "0.69277716", "0.6915937", "0.6911802", "0.68888426", "0.688786", "0.68668306", "0.6850452", "0.684756", "0.68334687", "0.6804259", ...
0.83909786
0
Test the DepartmentUserResource create response with alternate parameter names
def test_create_valid_alt(self): url = '/api/users/' username = str(uuid1())[:8] data = { 'email': '{}@dbca.wa.gov.au'.format(username), 'name': 'Doe, John', 'username': username, 'ad_dn': 'CN={},OU=Users,DC=domain'.format(username), 'e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_valid(self):\n url = '/api/users/'\n username = str(uuid1())[:8]\n data = {\n 'EmailAddress': '{}@dbca.wa.gov.au'.format(username),\n 'DisplayName': 'Doe, John',\n 'SamAccountName': username,\n 'DistinguishedName': 'CN={},OU=Users,DC=...
[ "0.72510594", "0.67844975", "0.6702618", "0.66944396", "0.6694119", "0.65534997", "0.6493329", "0.6493242", "0.64452225", "0.64258426", "0.63768077", "0.63703567", "0.6356024", "0.6324553", "0.6317689", "0.6305012", "0.6266619", "0.62521505", "0.6219614", "0.6197601", "0.6192...
0.7325158
0
Test the DepartmentUserResource update response
def test_update(self): tz = pytz.timezone(settings.TIME_ZONE) self.assertFalse(self.user1.o365_licence) url = '/api/users/{}/'.format(self.user1.ad_guid) data = { 'Surname': 'Lebowski', 'title': 'Bean Counter', 'o365_licence': True, 'email...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_update_request(self):\n pass", "def test_update_user(self):\n pass", "def test_user_update(self):\n userPK = self.testUser.pk\n url = reverse('User-detail', kwargs={'pk': userPK})\n data = {'username': 'company1NewTest'}\n response = self.client.put(url, ...
[ "0.74304736", "0.7100337", "0.7083804", "0.7059448", "0.70498127", "0.7006222", "0.6972898", "0.69647837", "0.6948436", "0.6912053", "0.6911955", "0.6867315", "0.6849965", "0.68217105", "0.68207514", "0.6787449", "0.6785152", "0.67461604", "0.67318773", "0.6691769", "0.665955...
0.7544808
0
Test the DepartmentUserResource update response (set user as inactive)
def test_disable(self): self.assertTrue(self.user1.active) self.assertFalse(self.user1.ad_deleted) url = '/api/users/{}/'.format(self.user1.ad_guid) data = { 'Enabled': False, } response = self.client.put(url, json.dumps(data), content_type='application/json')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_data_dept_user(self):\n url = '/api/options/?list=dept_user'\n response = self.client.get(url)\n self.assertEqual(response.status_code, 200)\n # User 1 will be present in the response.\n self.assertContains(response, self.user1.email)\n # Make a user inactive to t...
[ "0.6705734", "0.665646", "0.6515721", "0.6420796", "0.6402472", "0.63838017", "0.6368533", "0.6187678", "0.61713004", "0.6147244", "0.6120597", "0.6083781", "0.60777783", "0.6072792", "0.6065049", "0.6060552", "0.6054846", "0.6045528", "0.60311913", "0.6006138", "0.5993923", ...
0.7478637
0
Test the DepartmentUserResource update response (set user as 'AD deleted')
def test_delete(self): self.assertFalse(self.user1.ad_deleted) self.assertTrue(self.user1.active) url = '/api/users/{}/'.format(self.user1.ad_guid) data = {'Deleted': True} response = self.client.put(url, json.dumps(data), content_type='application/json') self.assertEqual...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_disable(self):\n self.assertTrue(self.user1.active)\n self.assertFalse(self.user1.ad_deleted)\n url = '/api/users/{}/'.format(self.user1.ad_guid)\n data = {\n 'Enabled': False,\n }\n response = self.client.put(url, json.dumps(data), content_type='applic...
[ "0.6858798", "0.673273", "0.6596995", "0.6502775", "0.6428381", "0.6339772", "0.63135546", "0.6285482", "0.62707835", "0.6264158", "0.6246897", "0.6209684", "0.62034184", "0.6203136", "0.61618066", "0.61393726", "0.6103969", "0.60593694", "0.6054395", "0.6054395", "0.60507435...
0.7495284
0
Test the LocationResource list response
def test_list(self): loc_inactive = mixer.blend(Location, manager=None, active=False) url = '/api/locations/' response = self.client.get(url) self.assertEqual(response.status_code, 200) # Response should not contain the inactive Location. self.assertNotContains(response, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_locations(self):\n url = reverse(\"locations\", args=[00000])\n response = self.client.get(url)\n\n self.assertEqual(response.status_code, status.HTTP_200_OK)\n self.assertTrue(isinstance(response.data, list))\n self.assertTrue(response.data) # list not empty\n\n ...
[ "0.75615865", "0.73977536", "0.7293898", "0.7004044", "0.68876386", "0.67524344", "0.6536098", "0.653123", "0.6502782", "0.6500661", "0.64945704", "0.6477591", "0.6466978", "0.6464637", "0.6457173", "0.6457173", "0.643977", "0.6437493", "0.6426901", "0.6372002", "0.636272", ...
0.74700975
1
Test the LocationResource filtered response
def test_filter(self): url = '/api/locations/?location_id={}'.format(self.loc1.pk) response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertContains(response, self.loc1.name) # We can still return inactive locations by ID loc_inactive = mixer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_viewset_list_filter(self):\n # valid coordinate within a zone\n data = {\"coords\": \"55.710663495702725/9.52840811021021\"}\n response = self.client.get(reverse(\"servicearea-list\"), data, format='json')\n\n # we should get a http 200 and the zone\n self.assertEqual(re...
[ "0.6681495", "0.66567737", "0.6653688", "0.66046005", "0.6528886", "0.64084023", "0.6384683", "0.6360479", "0.6327835", "0.6174376", "0.6027128", "0.59949857", "0.5966776", "0.5947426", "0.5935014", "0.5918347", "0.5887104", "0.58725655", "0.5836169", "0.583044", "0.5819339",...
0.7458695
0
Do not return anything, modify nums inplace instead.
def moveZeroes(self, nums: List[int]) -> None: lenght = len(nums) currzero = 0 numszero = 0 for x in range(lenght): if nums[x] == 0: currzero = x numszero += 1 elif nums[x] != 0 and numszero > 0: pos = currzero - num...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fn(i):\n if i == len(nums): ans.append(nums.copy())\n for j in range(i, len(nums)): \n nums[i], nums[j] = nums[j], nums[i]\n fn(i+1)\n nums[i], nums[j] = nums[j], nums[i]", "def double_nums(num_list):", "def remove_dups(nums):\r\n nums[:...
[ "0.70462054", "0.6715351", "0.66929126", "0.65873164", "0.65023595", "0.64822435", "0.6440834", "0.6406664", "0.63777506", "0.63735336", "0.6368216", "0.63669443", "0.6350561", "0.63289344", "0.62994266", "0.6287385", "0.6268109", "0.6247793", "0.6223016", "0.61956227", "0.61...
0.0
-1
changes the value of this die to a random number between 1 and the number of sides of a die
def roll(self): #dieValue = [] self._value = random.randrange(Die.SIDES) + 1 self._update() #dieValue.append(self._value) #print(dieValue) #print(self._value) self._valueA = random.randrange(Die.SIDES) + 1 #self._update2() #print(self._valueA)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roll_die(self):\n number = randint(1, self.sides) \n print(number)", "def rollDie(self):\n return random.randint(1, self.sides)", "def roll(self):\n return randint(1, self.sides)", "def roll(self):\n return randint(1, self.sides)", "def roll(self):\n\t\treturn randint...
[ "0.8395775", "0.7952748", "0.78309155", "0.78309155", "0.78290623", "0.7803528", "0.7783923", "0.77485865", "0.77485865", "0.77485865", "0.77485865", "0.7704405", "0.7525191", "0.7505842", "0.7484638", "0.7454847", "0.7225844", "0.7225528", "0.72099024", "0.71160156", "0.7103...
0.75409114
12
return the current value of this die
def getValue(self): return self._value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_value(self):\n assert(self.is_started())\n return self.currValue", "def current_value(self):\n return self.current_counter.value", "def getlife(self):\n return self.vida", "def __call__(self):\n return self.value", "def value(self):\n\n\t\treturn self.__va...
[ "0.69122237", "0.6856261", "0.6638565", "0.660128", "0.65722835", "0.6564898", "0.6537252", "0.653598", "0.6522754", "0.6500427", "0.64593863", "0.64554805", "0.64534694", "0.64534694", "0.6447006", "0.6442245", "0.6437702", "0.6437702", "0.64089245", "0.6396853", "0.6390667"...
0.0
-1
Helper function to call become plugin simiarly on how Ansible itself handles this.
def call_become_plugin(task, var_options, cmd, executable=None): plugin = become_loader.get(task['become_method']) plugin.set_options(task_keys=task, var_options=var_options) shell = get_shell_plugin(executable=executable) return plugin.build_become_command(cmd, shell)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def playbook_on_start(this):\n\n # Monkey-patch ansible.playbook.task.Task\n import ansible.playbook.task\n\n class T(ansible.playbook.task.Task):\n VALID_KEYS = ansible.playbook.task.Task.VALID_KEYS.union({'run_once_per'})\n\n def __init__(self, play, ds, **kwargs):\n ...
[ "0.5598071", "0.5544143", "0.55433804", "0.55309314", "0.54727757", "0.54650944", "0.5433382", "0.5429682", "0.53782296", "0.5356523", "0.53534186", "0.51360434", "0.50613815", "0.48578998", "0.48062238", "0.47975665", "0.4780355", "0.47606272", "0.47257707", "0.46939725", "0...
0.71577346
0
Returns a future date string that is the closest to the current day
def get_closest_due_date(self, due_dates: List[DueDate], current_day=None) -> DueDate: if current_day is None: current_day = Today() diff_list = [] # calculate the difference between current day and date string for due_date in due_dates: if len(due_date.date_stri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getfuturedate(runningdate, futuredays):\n d = (runningdate + datetime.timedelta(days=(futuredays-1))).strftime('%d-%m')\n return str(d)", "def least_current_date():\n # This is not the right way to do it, timezones can change\n # at the time of writing, Baker Island observes UTC-12\n return da...
[ "0.7042028", "0.6739802", "0.6684847", "0.6435696", "0.64088297", "0.6390447", "0.62545943", "0.624605", "0.62121683", "0.60754883", "0.6039635", "0.599666", "0.59774864", "0.5965249", "0.5883925", "0.5881052", "0.5848764", "0.58483094", "0.58483094", "0.5839244", "0.57240605...
0.63654786
6
Gets all the days from today until the end of the month.
def get_days(start_day, month_count: int = 1) -> List[Day]: assert type(start_day) is Day assert type(month_count) is int start = start_day.to_date_time() days = list(rrule(MONTHLY, count=month_count * 2, bymonthday=(-1, 1,), dtstart=start)) return Calendar.fill(Day(days[0]), Da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAllDays(self):\n start = str(self.current[0:10])\n end = str(self.dueDate[0:10])\n daysRange = pd.date_range(start = start, end = end).tolist()\n daysRange = daysRange[1:len(daysRange)-1]\n days = []\n for i in daysRange:\n day = str(i)\n day =...
[ "0.69140226", "0.6511607", "0.638647", "0.6041111", "0.59826064", "0.59621537", "0.5925641", "0.5920649", "0.58771974", "0.5869278", "0.58284515", "0.5811526", "0.581057", "0.5739362", "0.5698352", "0.5691271", "0.5685953", "0.56856126", "0.56745434", "0.56403077", "0.5640276...
0.6592042
1
Returns all the days for the provided week day in a month.
def get_week_days(start_day: Day, weekday_number: int, month_count: int) -> List[Day]: assert type(start_day) is Day assert type(weekday_number) is int assert type(month_count) is int start = start_day.to_date_time() end = start + relativedelta(months=month_count) days =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_work_week_days(start_day: Day, month_count: int) -> List[Day]:\n assert type(start_day) is Day\n assert type(month_count) is int\n\n start = start_day.to_date_time()\n end = start + relativedelta(months=month_count)\n days = list(rrule(DAILY, wkst=MO, byweekday=(MO, TU, W...
[ "0.6844833", "0.6423875", "0.638872", "0.63580483", "0.6291826", "0.6276168", "0.61245525", "0.61162984", "0.6059549", "0.605568", "0.60542864", "0.6043643", "0.5857643", "0.5835116", "0.5813211", "0.570522", "0.56851107", "0.5675388", "0.5672337", "0.5669654", "0.56690675", ...
0.6708884
1
Gets all days within a work week from today until the end of the month
def get_work_week_days(start_day: Day, month_count: int) -> List[Day]: assert type(start_day) is Day assert type(month_count) is int start = start_day.to_date_time() end = start + relativedelta(months=month_count) days = list(rrule(DAILY, wkst=MO, byweekday=(MO, TU, WE, TH, FR),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dates_of_the_week():\n date_list = list()\n now = datetime.datetime.now()\n monday = now - datetime.timedelta(days=now.weekday(), hours=now.hour, minutes=now.minute, seconds=now.second,\n microseconds=now.microsecond)\n date_list.append(monday)\n for each in ...
[ "0.7065504", "0.6642577", "0.6616175", "0.6610579", "0.64627105", "0.64162827", "0.6385287", "0.6337657", "0.6333118", "0.6311995", "0.6309436", "0.630006", "0.6294607", "0.6228853", "0.621049", "0.62000245", "0.617651", "0.6172212", "0.61515874", "0.60586876", "0.6044418", ...
0.7435883
0
Gets the next calendar day in current week, next week, or next month that matches the provided weekday_number.
def get_day(today: Day, weekday_number: int) -> Day: assert type(today) is Day assert type(weekday_number) is int today = today.to_date_time() date_list = list(rrule(DAILY, count=1, wkst=MO, byweekday=weekday_number, dtstart=today)) if date_list: return Day(date_list...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_weekday(date, weekday):\n return date + dt.timedelta(days=(weekday - date.weekday() + 7) % 7)", "def get_next_closest_day(weekday):\n names = {\n 'monday': 0,\n 'tuesday': 1,\n 'wednesday': 2,\n 'thursday': 3,\n 'friday': 4,\n 'saturday': 5,\n '...
[ "0.725804", "0.7174793", "0.71469533", "0.7095039", "0.6511598", "0.6461116", "0.6283346", "0.60687757", "0.6066865", "0.606382", "0.5941634", "0.5862346", "0.5844903", "0.5792223", "0.568226", "0.56529", "0.55957466", "0.5561878", "0.54421115", "0.54184437", "0.54017496", ...
0.6462945
5
Gets the relevant shas given the start date, end date and interval on the given branch.
def get_dates_and_shas(branch, start, end, interval): shas = [] dates = [] if interval == 0: # If interval is 0, simply get all the non-merge commits and find # their dates revlist = subprocess.Popen(['git', 'rev-list', '--since', str(start), '--before', str(end), '--no-merges', branch], stdout=su...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spline_branch(self,branch,interval=1.0):\n\t\t\n\t\tnumber_of_points = int(round(self.branchLength(branch)/interval,0))+1\n\t\tline = LineString([tuple(point[:3]) for point in branch])\n\t\tsplitter = MultiPoint([line.interpolate((i/number_of_points),normalized=True) for i in range(number_of_points+1)])\n\t\ti...
[ "0.5246796", "0.48593053", "0.4788723", "0.45969608", "0.45834252", "0.45441726", "0.45159206", "0.44913507", "0.44680756", "0.44357204", "0.43516868", "0.43506223", "0.4348679", "0.4344899", "0.43400103", "0.43250442", "0.43206328", "0.43109226", "0.4303643", "0.42983198", "...
0.75405824
0
Calculates the total churn of commits described in dateshas after filtering out the excluded paths.
def get_churn_with_interval(dateshas, excludestr): print "sha1;date1;sha2;date2;churn" # CSV header line total = 0 date, sha = dateshas[0] for prevdate, prevsha in dateshas[1:]: diff = None if excludestr: # See function get_churn_per_commit for an explanation per # process call files = subprocess.Pope...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_churn_per_commit(dateshas, excludestr):\n\tprint \"sha;date;churn\" # CSV header line\n\ttotal = 0\n\tfor date, sha in dateshas:\n\t\tcommit = None\n\t\tif excludestr:\n\t\t\t# Example command with filtering:\n\t\t\t# git show abcde -w -C --name-status --format=format: \n\t\t\t#\t\tOutputs all the changed ...
[ "0.72989583", "0.5401435", "0.51254535", "0.50825906", "0.49629587", "0.49015906", "0.48703545", "0.48519665", "0.48055995", "0.47520775", "0.46931726", "0.46821773", "0.46621984", "0.4652477", "0.464813", "0.46309492", "0.45973372", "0.45786098", "0.45642877", "0.45621127", ...
0.7305681
0
Calculates the total churn of commits described in dateshas after filtering out the excluded paths.
def get_churn_per_commit(dateshas, excludestr): print "sha;date;churn" # CSV header line total = 0 for date, sha in dateshas: commit = None if excludestr: # Example command with filtering: # git show abcde -w -C --name-status --format=format: # Outputs all the changed files with just their filenames, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_churn_with_interval(dateshas, excludestr):\n\tprint \"sha1;date1;sha2;date2;churn\" # CSV header line\n\ttotal = 0\n\tdate, sha = dateshas[0]\n\tfor prevdate, prevsha in dateshas[1:]:\n\t\tdiff = None\n\t\tif excludestr:\n\t\t\t# See function get_churn_per_commit for an explanation per \n\t\t\t# process ca...
[ "0.7305681", "0.5401435", "0.51254535", "0.50825906", "0.49629587", "0.49015906", "0.48703545", "0.48519665", "0.48055995", "0.47520775", "0.46931726", "0.46821773", "0.46621984", "0.4652477", "0.464813", "0.46309492", "0.45973372", "0.45786098", "0.45642877", "0.45621127", "...
0.72989583
1
Function vararg_callback An extention on OptParser to parse a varying amount of argument, in this case used for the x flag.
def vararg_callback(option, opt_str, value, parser): assert value is None value = [] def floatable(str): try: float(str) return True except ValueError: return False for arg in parser.rargs: # Stop on options like --foo if arg[:2] == "--" and len(arg) > 2: break # Stop on -a, but not on nega...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def argparse_callback(parser: argparse.ArgumentParser):\n parser.add_argument(\n '--my-custom-flag', default=\"Default value\", type=str, help='My custom flag'\n )", "def _argument_adapter(callback):\n def wrapper(*args, **kwargs):\n if kwargs or len(args) > 1:\n callback(Argume...
[ "0.56956077", "0.5579839", "0.5338161", "0.5259655", "0.5250685", "0.52107143", "0.5143298", "0.5102959", "0.5097259", "0.50921047", "0.50836056", "0.5052569", "0.5029265", "0.5027403", "0.49902073", "0.49874467", "0.496362", "0.49565348", "0.49565348", "0.4903791", "0.489057...
0.70214987
0
Add a store location
def add_location(self, **kwargs): self.options.update(kwargs) self.options['action'] = 'locator.location.add' return self.call(self.options)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def StoreLocation(self) -> str:", "def add_location(db_path: str, location: Location) -> None:\n query = f'INSERT INTO locations (name, area, climate) VALUES (\"{location.name}\", {location.area}, {location.climate.climate_type})'\n\n conn: Connection = sqlite3.connect(path.join(db_path, 'company_data.db')...
[ "0.68922573", "0.66731364", "0.6477832", "0.637889", "0.6161532", "0.6137485", "0.6105172", "0.6104328", "0.6104328", "0.6104328", "0.6104328", "0.6104328", "0.6104328", "0.6104328", "0.6088784", "0.60743314", "0.6058797", "0.6046716", "0.6001751", "0.6000176", "0.59155136", ...
0.7235024
0
Get details of a location in a store locator
def location_details(self, **kwargs): self.options.update(kwargs) self.options['action'] = 'locator.location.details' return self.call(self.options)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_location(self):\n return self.request({\n \"path\": \"/\" + UUID + \"/location\"\n })", "def get_location(self):\n return self.location", "def _get_location_details(self, location):\n resp = requests.get(\n self.base_url,\n params = {\n ...
[ "0.7287444", "0.72388345", "0.7233243", "0.703261", "0.6991874", "0.69567317", "0.6938865", "0.6914896", "0.68907416", "0.68650895", "0.6812407", "0.67199504", "0.6700374", "0.66257614", "0.6614068", "0.65762717", "0.656604", "0.6555892", "0.65359735", "0.65218616", "0.651035...
0.7368558
0
List all locations in a store locator
def list_locations(self, _id): self.options['usr_locator_id'] = _id self.options['action'] = 'locator.location.list' return self.call(self.options)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_locations(self):", "def get_all_locations():\n rs = run_query('''select * from zlrz_office_location''')\n return [] if rs is None else list(map(lambda t: Location(t[1], t[2], t[3], t[4], t[5], t[0]), rs))", "def get_locations(self) -> list:\n return self.client.locations.get_all()", ...
[ "0.8253324", "0.72439396", "0.719489", "0.71375585", "0.6980356", "0.6961326", "0.6918223", "0.6916912", "0.6751447", "0.6736801", "0.666683", "0.6632365", "0.6618579", "0.6591178", "0.65871257", "0.6587024", "0.6511874", "0.6503713", "0.6503713", "0.6503713", "0.6503713", ...
0.72020453
2
Remove a location from a store locator
def remove_location(self, **kwargs): self.options.update(kwargs) self.options['action'] = 'locator.location.remove' return self.call(self.options)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_location(self, location_id):", "def delete_loc(lat, lon):\n\tredis_server = SETTINGS['REDIS_IP']\n\tredis_session = redis.StrictRedis(host=redis_server,\\\n\t\t\t\t\t\t\tport=6379, db=0)\n\tredis_session.zrem(\"all_loc\", str(str(lon), str(lat)))", "def removelocation(self, location):\n found...
[ "0.74674547", "0.6915386", "0.6857918", "0.6857918", "0.6857918", "0.6857918", "0.6857918", "0.6857918", "0.6857918", "0.6838363", "0.659987", "0.65884995", "0.6565125", "0.65502083", "0.6539492", "0.6524253", "0.65041393", "0.64223635", "0.62793577", "0.61533785", "0.6065900...
0.8073628
0
Update configuration of a location
def update_location(self, **kwargs): self.options.update(kwargs) self.options['action'] = 'locator.location.update' return self.call(self.options)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_location(self):\n\n # show current location\n self.app.stdout.write(\"Current location\\n\")\n self.app.stdout.write(f\"{self.Location}\\n\")\n self.app.stdout.write('\\n')\n\n # choose new location\n location_set = self.browse_location()\n self.set_locat...
[ "0.7021159", "0.6805759", "0.6768406", "0.6389433", "0.6281382", "0.623813", "0.6155685", "0.6113912", "0.61124575", "0.61106986", "0.6061526", "0.6059167", "0.60387474", "0.60103077", "0.6009843", "0.59543437", "0.59473723", "0.59142107", "0.5896123", "0.58798623", "0.584419...
0.69828993
1
Test that a ``GET /account/settings`` returns the settings for the session user.
async def test_get_settings(spawn_client): client = await spawn_client(authorize=True) resp = await client.get("/account/settings") assert resp.status == 200 assert await resp.json() == { "skip_quick_analyze_dialog": True, "show_ids": True, "show_versions": True, "quic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_account_settings(self):\n settings = AccountSettings(self.client, False, {})\n\n self.assertEqual(settings.longview_subscription.id, \"longview-100\")\n self.assertEqual(settings.managed, False)\n self.assertEqual(settings.network_helper, False)\n self.assertEqual(se...
[ "0.7293422", "0.6904159", "0.68857753", "0.67829", "0.6742984", "0.6587807", "0.65675956", "0.65069836", "0.6502907", "0.6484014", "0.6447866", "0.6412865", "0.6388406", "0.6352493", "0.6341707", "0.6281831", "0.62814415", "0.62814415", "0.6279597", "0.6249542", "0.6220485", ...
0.71580607
1
Test that account settings can be updated at ``POST /account/settings`` and that requests to ``POST /account/settings`` return 422 for invalid JSON fields.
async def test_update_settings(data, status, spawn_client, resp_is, snapshot): client = await spawn_client(authorize=True) resp = await client.patch("/account/settings", data) assert resp.status == status assert await resp.json() == snapshot(name="response")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_save_rule_settings_fail(self):\n # Not including any required filters\n rule_settings_params = {}\n response = self.app.post('/v1/save_rule_settings/', rule_settings_params, expect_errors=True,\n headers={'x-session-id': self.session_id})\n self....
[ "0.64927924", "0.6425838", "0.6378065", "0.6341072", "0.62973046", "0.6262483", "0.61875397", "0.6182209", "0.617659", "0.6137747", "0.6127384", "0.59938157", "0.59098905", "0.58919597", "0.58788544", "0.58646953", "0.58451706", "0.5840452", "0.5826956", "0.58254063", "0.5811...
0.641091
2
Test that creation of an API key functions properly. Check that different permission inputs work.
async def test( self, has_perm, req_perm, mocker, snapshot, spawn_client, static_time, no_permissions, fake2, ): mocker.patch( "virtool.utils.generate_key", return_value=("raw_key", "hashed_key") ) group = a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_api_key(self):\n pass", "def test_generate_api_key():\n\n key = auth.generate_api_key() # returns a NamedTuple with api_key and hashed_key\n hashed_api_key = sha256(key.api_key.encode('utf-8')).hexdigest()\n assert hashed_api_key == key.hashed_key", "def test_create_digital_acc...
[ "0.8457492", "0.7665717", "0.7518472", "0.7366651", "0.7356679", "0.7149596", "0.7147376", "0.7068961", "0.70369226", "0.6855225", "0.6811727", "0.67681736", "0.6747361", "0.6738854", "0.6724939", "0.6718124", "0.66407055", "0.66340154", "0.6581428", "0.65608966", "0.6509043"...
0.61763203
41
Test that uniqueness is ensured on the ``id`` field.
async def test_naming(self, mocker, snapshot, spawn_client, static_time): mocker.patch( "virtool.utils.generate_key", return_value=("raw_key", "hashed_key") ) client = await spawn_client(authorize=True) await client.db.keys.insert_one( {"_id": "foobar", "id": "f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unique_id_1():\n id1 = tasks.unique_id()\n id2 = tasks.unique_id()\n assert id1 != id2", "def test_id_uniqueness(self):\n user_2 = User()\n self.assertNotEqual(self.user_1.id, user_2.id)", "def test_unique_id_2():\n ids = []\n ids.append(tasks.add(Task('one')))\n ids.ap...
[ "0.75097454", "0.7343673", "0.72977453", "0.7128972", "0.6996544", "0.68331695", "0.6704463", "0.6675847", "0.6533515", "0.6521291", "0.6513088", "0.650479", "0.6445268", "0.64450353", "0.6401554", "0.6398316", "0.63763666", "0.63701594", "0.63643473", "0.63432914", "0.632410...
0.0
-1
Test that calling the logout endpoint results in the current session being removed and the user being logged out.
async def test_logout(spawn_client): client = await spawn_client(authorize=True) # Make sure the session is authorized resp = await client.get("/account") assert resp.status == 200 # Logout resp = await client.get("/account/logout") assert resp.status == 200 # Make sure that the sessi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_logout(self):\n with self.client:\n self.client.post(\n '/users/login',\n data=dict(username=\"eschoppik\", password=\"secret\"),\n follow_redirects=True\n )\n response = self.client.get('/users/logout', follow_redirects=...
[ "0.86817217", "0.8620689", "0.8503574", "0.84649366", "0.8398431", "0.83475596", "0.82962453", "0.8256798", "0.82545614", "0.8250788", "0.8196764", "0.8192935", "0.8151099", "0.811001", "0.8099418", "0.80973464", "0.8074678", "0.79863524", "0.797551", "0.7947014", "0.7936032"...
0.78094244
27
Test that a '401 Requires authorization' response is sent when the session is not authenticated.
async def test_requires_authorization(method: str, path: str, spawn_client): client = await spawn_client() if method == "GET": resp = await client.get(path) elif method == "POST": resp = await client.post(path, {}) elif method == "PATCH": resp = await client.patch(path, {}) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unauthenticated_request(self):\n url = self.get_url(self.active_user.id)\n response = self.client.get(url)\n\n expected_status_code = 401\n self.assertEqual(response.status_code, expected_status_code)", "def test_unhappy_path_unauthorized(self):\n\n response = self.cli...
[ "0.8175428", "0.79936105", "0.795609", "0.79258925", "0.7866128", "0.7854916", "0.78037983", "0.7783581", "0.77625", "0.77625", "0.77625", "0.77370256", "0.7729856", "0.771603", "0.7693628", "0.76369053", "0.7625064", "0.7607438", "0.75973517", "0.7575885", "0.75604343", "0...
0.0
-1
Tests that when an invalid permission is used, validators.is_permission_dict raises a 422 error.
async def test_is_permission_dict(value, spawn_client, resp_is): client = await spawn_client(authorize=True) permissions = { Permission.cancel_job.value: True, Permission.create_ref.value: True, Permission.create_sample.value: True, Permission.modify_hmm.value: True, } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_permissions(permission, payload):\n if 'permissions' not in payload:\n abort(401)\n\n if permission not in payload['permissions']:\n abort(401)\n\n return True", "def test_wrong_permission(self):\n with self.assertRaises(InvalidPermissionStringError):\n client_h...
[ "0.66814137", "0.6591706", "0.6436258", "0.6376614", "0.6225889", "0.614307", "0.5958166", "0.592137", "0.592137", "0.592137", "0.592137", "0.5903146", "0.5903146", "0.58885974", "0.58770496", "0.5861494", "0.58467174", "0.5839908", "0.5837318", "0.57968867", "0.5785536", "...
0.6642042
1
Tests that when an invalid email is used, validators.is_valid_email raises a 422 error.
async def test_is_valid_email(value, spawn_client, resp_is): client = await spawn_client(authorize=True) data = { "email": "valid@email.ca" if value == "valid_email" else "-foo-bar-@baz!.ca", "old_password": "old_password", "password": "password", } resp = await client.patch("/...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_email(self):\n with self.client:\n response = register_user(\n self, 'Dalin', 'Oluoch', 'anothergmail.com', 'aaaAAA111')\n data = json.loads(response.data.decode())\n self.assertTrue(data['status'] == 'fail')\n self.assertTrue(data[...
[ "0.7987133", "0.78519726", "0.7842617", "0.7782488", "0.7780942", "0.7752983", "0.7626841", "0.7611363", "0.75869507", "0.7532575", "0.7456714", "0.7392861", "0.7391124", "0.73835063", "0.73661447", "0.7342488", "0.73311436", "0.7228408", "0.7206134", "0.7202689", "0.7202689"...
0.66390425
61
Compute the Euclidean distance between two vectors.
def compute_distance (uVector, uOther): ## since each element can be either 0 or 1, ## no need for square roots and pow d = 0 for i in range (len(uVector)): d = d + math.pow((int(uVector [i]) - int(uOther [i])), 2) return d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euclidean_distance(vec1, vec2):\n return numpy.linalg.norm(vec1 - vec2)", "def euclidean_distance(vector_1: Vector, vector_2: Vector) -> VectorOut:\n return np.sqrt(np.sum((np.asarray(vector_1) - np.asarray(vector_2)) ** 2))", "def euclidean_distance(vector1, vector2):\n e_dist = [(v1 - v2) ** 2 f...
[ "0.8314072", "0.8293595", "0.8282914", "0.8227416", "0.8217555", "0.8119624", "0.80949605", "0.8017848", "0.7994268", "0.79869294", "0.7986311", "0.78874433", "0.78707206", "0.78615564", "0.7839835", "0.78135645", "0.779958", "0.77728957", "0.7743268", "0.76533705", "0.764628...
0.7110773
63
Exists for the purpose of deploying to 485 class servers.
def empty_app(env, resp): resp('200 OK', [('Content-Type', 'text/plain')]) return [b"Enforcing Prefix"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supportsHotDeployment():\n return False", "def isSciServerComputeEnvironment():\n if os.path.isfile(\"/home/idies/keystone.token\"):\n return True\n else:\n return False", "def exist(self):", "def instanceha_deployed():\n if overcloud.has_overcloud():\n return get_ove...
[ "0.5984334", "0.5726757", "0.563354", "0.56056887", "0.5603879", "0.54911774", "0.5475289", "0.54510885", "0.54414535", "0.5416737", "0.5396014", "0.53902584", "0.5377006", "0.53663504", "0.5363164", "0.53535247", "0.5346147", "0.5330945", "0.5330945", "0.5309412", "0.5271866...
0.0
-1
Configure subscriber channel, queues and exchange.
async def configure(self, channel: Optional[Channel] = None) -> None: await self.qos(prefetch_count=self.concurrent) with suppress(SynchronizationError): await self._configure_queue() await self._dlx.configure() await self._configure_exchange() await self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setup_tubes(self):\n chan = self.channel\n inp = self.config[self.MODULE_NAME]['amqp']['in']\n out = self.config[self.MODULE_NAME]['amqp']['out']\n if inp['exchange']:\n log.info('generating Input Queue'+ str(inp))\n chan.exchange_declare(**inp)\n self.qname = chan.queue_declare(exc...
[ "0.6417954", "0.5965889", "0.59259367", "0.5896797", "0.5751727", "0.57395524", "0.56895745", "0.5584957", "0.556008", "0.55356395", "0.54921764", "0.5466252", "0.5462644", "0.54402477", "0.5409119", "0.54074705", "0.540599", "0.5405738", "0.537762", "0.53596455", "0.53596455...
0.5772559
4
Sends ack message to broker.
async def ack_event(self, envelope: Envelope, multiple: bool = False) -> None: await self.channel.basic_client_ack( delivery_tag=envelope.delivery_tag, multiple=multiple )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ack(self):\n self.consumer.ack(self)", "def _send_ack(self):\n ack_packet = packet.Packet.from_data(\n 0,\n self.dest_addr,\n self.own_addr,\n ack=self._next_expected_seqnum\n )\n self._schedule_send_out_of_order(ack_packet)", "def ack...
[ "0.7573186", "0.7252091", "0.72382003", "0.70203686", "0.700533", "0.70004696", "0.6902512", "0.68186754", "0.67715496", "0.6686612", "0.6534734", "0.6498039", "0.6484207", "0.6477674", "0.64756954", "0.63871384", "0.63021624", "0.62603724", "0.6260108", "0.62588596", "0.6240...
0.6594374
10
Sends nack message to broker.
async def nack_event( self, envelope: Envelope, multiple: bool = False, requeue: bool = True ) -> None: await self.channel.basic_client_nack( delivery_tag=envelope.delivery_tag, multiple=multiple, requeue=requeue )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send_ack(self):\n ack_packet = packet.Packet.from_data(\n 0,\n self.dest_addr,\n self.own_addr,\n ack=self._next_expected_seqnum\n )\n self._schedule_send_out_of_order(ack_packet)", "def on_nack(self, message: PubsubMessage, ack: Callable[[], ...
[ "0.70904136", "0.695393", "0.6328557", "0.630192", "0.62442684", "0.6098512", "0.60923684", "0.6015874", "0.59566116", "0.5950902", "0.5916203", "0.5902035", "0.582037", "0.581886", "0.5795247", "0.56935865", "0.5655064", "0.56261975", "0.5622341", "0.5593803", "0.55453736", ...
0.63043153
3
Informs for the message broker that event message was rejected.
async def reject_event(self, envelope: Envelope, requeue: bool = False) -> None: await self.channel.basic_reject( delivery_tag=envelope.delivery_tag, requeue=requeue )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_reject(self):\n self.state = REJECTED\n self._reject()", "def m_ts_OrderRejected(self, sender, e):\r\n print(\"Order was rejected. {0}\".format(e.Message))", "def on_buttonBox_rejected(self):\n self.reject()", "async def onRejected( # type: ignore[override]\n self, ...
[ "0.7376357", "0.66578037", "0.6633302", "0.650125", "0.63836914", "0.6290341", "0.62653553", "0.6171732", "0.6170672", "0.61640024", "0.61493176", "0.6098134", "0.6087443", "0.6061216", "0.5989285", "0.5976502", "0.5968853", "0.595685", "0.5894163", "0.5869914", "0.58388615",...
0.7038541
1
Configure qos feature in the subscriber channel.
async def qos( self, prefetch_size: int = 0, prefetch_count: int = 0, connection_global: bool = False, ): await self.channel.basic_qos( prefetch_size=prefetch_size, prefetch_count=prefetch_count, connection_global=connection_global, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_qos(self, on_ok):\n self._channel.basic_qos(\n prefetch_count=self._prefetch_count, callback=on_ok)", "def qos_type(self, qos_type):\n\n self._qos_type = qos_type", "def set_qos(self, qos, set_specs_args):\n self._impl.set_qos(qos.id, set_specs_args)\n return self...
[ "0.6994104", "0.6917727", "0.66590065", "0.64854676", "0.6458646", "0.64513636", "0.6413767", "0.62722945", "0.6259844", "0.6248928", "0.6144506", "0.60625154", "0.6042893", "0.5847944", "0.58474493", "0.58474493", "0.58474493", "0.5847176", "0.57718706", "0.57582027", "0.568...
0.695466
1
Slice data & precompute max height & width.
def __init__(self, area: str) -> None: self.area = area.split("\n")[:-1] # Trailing newline leaves an annoying empty string self.max_h = len(self.area) self.max_w = len(self.area[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def long_slice(image_data):\n\n\t# Process binary data and open.\n\tim = image_data.split('base64,')[1]\n\tim = base64.b64decode(im)\n\tim = io.BytesIO(im)\n\t\n\timg = Image.open(im)\n\twidth, height = img.size\n\tupper = 0\n\tleft = 0\n\t\n\t# Max height to fit pdf.\n\tmax_height_mm = 198\n\tmax_height = (max_he...
[ "0.64375347", "0.63574696", "0.61667806", "0.6032037", "0.60157377", "0.5926639", "0.59262925", "0.5880874", "0.58728945", "0.57927257", "0.57488066", "0.57138455", "0.5645841", "0.5644485", "0.5626869", "0.5612803", "0.56114805", "0.56063926", "0.5589896", "0.55604446", "0.5...
0.0
-1
Access item by height & width index tuple.
def __getitem__(self, coordinates: Coordinates) -> str: h, w = coordinates return self.area[h][w % self.max_w]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, index):\n im, gt, h, w = self.pull_item(index)\n if self.return_image_info:\n return im, gt, h, w\n return im, gt", "def __getitem__(self, index):\n x, y = index\n if 0 <= x < self.width and 0 <= y < self.height:\n return self.cells[x...
[ "0.7372948", "0.716817", "0.6627757", "0.65858984", "0.64791167", "0.6462247", "0.6343543", "0.6336812", "0.6306152", "0.6285962", "0.6285106", "0.6271381", "0.62638116", "0.62425", "0.62350637", "0.62344295", "0.62018174", "0.61390424", "0.61340684", "0.6126287", "0.61242765...
0.58396596
78
Count tree occurrences when traversing `m` on `slope`.
def solve_for(m: Map, slope: Coordinates) -> int: n_trees = h = w = 0 h_step, w_step = slope while h < m.max_h: n_trees += m[h, w] == "#" h += h_step w += w_step return n_trees
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leaf_count(T):\n if T.is_leaf:\n return 1\n else:\n# s = 0\n# for child in T:\n# s += leaf_count(child)\n# return s\n return reduce(add, map(leaf_count, T))", "def count_trees(matrix, dx, dy):\n\n # We begin in the upper left corner\n x = 0\n y = 0...
[ "0.6242175", "0.618104", "0.6117079", "0.6071778", "0.59382737", "0.57623035", "0.570038", "0.56910276", "0.5621603", "0.55228496", "0.54363155", "0.5398564", "0.53712696", "0.53538644", "0.53342783", "0.5333687", "0.53148955", "0.5304808", "0.52953374", "0.5286473", "0.52812...
0.73680854
0
Load a feather of amino acid counts for a protein.
def load_feather(protein_feather, length_filter_pid=None, copynum_scale=False, copynum_df=None): protein_df = pd.read_feather(protein_feather).set_index('index') # Combine counts for residue groups from ssbio.protein.sequence.properties.residues import _aa_property_dict_one, EXTENDED_AA_PROPERTY_DICT_ONE ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def codon_frequency(seq, aminoacid):\n tmpList = []\n for i in range(0, len(seq) - 2, 3):\n if CodonTable[seq[i:i + 3]] == aminoacid:\n tmpList.append(seq[i:i + 3])\n\n freqDict = dict(Counter(tmpList))\n totalScore = sum(freqDict.values())\n for seq in freqDict:\n freqDict[...
[ "0.5596277", "0.5492704", "0.53756523", "0.519119", "0.5187027", "0.51630163", "0.50907207", "0.5074862", "0.50250167", "0.5022161", "0.49966186", "0.49030453", "0.4886083", "0.48618254", "0.48587584", "0.47983077", "0.47870308", "0.47677997", "0.47620273", "0.47374693", "0.4...
0.6117666
0
Get counts, uses the mean feature vector to fill in missing proteins for a strain
def get_proteome_counts_impute_missing(prots_filtered_feathers, outpath, length_filter_pid=None, copynum_scale=False, copynum_df=None, force_rerun=False): if ssbio.utils.force_rerun(flag=force_rerun, outfile=outpath): big_strain_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __calc_empirical_counts__(self):\n self.empirical_counts = np.zeros(self._features_vector_length, dtype=float)\n for feature, freq in self.features_dict.items():\n for index in feature:\n self.empirical_counts[index] += freq\n assert len(self.empirical_counts) == ...
[ "0.61193806", "0.5992313", "0.5972102", "0.5867572", "0.58505726", "0.573586", "0.57060236", "0.57018924", "0.564849", "0.5533449", "0.55128986", "0.55066305", "0.54961157", "0.54363257", "0.54289085", "0.54247606", "0.54075843", "0.54021853", "0.5393844", "0.5393201", "0.536...
0.5867277
4
Get counts and normalize by number of proteins, providing percentages
def get_proteome_correct_percentages(prots_filtered_feathers, outpath, length_filter_pid=None, copynum_scale=False, copynum_df=None, force_rerun=False): if ssbio.utils.force_rerun(flag=force_rerun, outfile=outpath): prot_tracker = def...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percentage(count, total):\n return count / total * 100", "def percent_frequencies(self):\n word_count = 0\n local = self.frequencies()\n for key in local.keys():\n i = local[key]\n word_count += int(i)\n for key in local.keys():\n i = local[key]...
[ "0.69889706", "0.68392456", "0.6490643", "0.6469943", "0.6456043", "0.6447988", "0.6428525", "0.6389722", "0.63814026", "0.6363162", "0.6359575", "0.632115", "0.6306917", "0.62921137", "0.6225133", "0.61689633", "0.613601", "0.61147857", "0.6080384", "0.60781604", "0.607476",...
0.65423685
2
Make a plot showing contributions of properties to a PC
def make_contribplot(self, pc_to_look_at=1, sigadder=0.01, outpath=None, dpi=150, return_top_contribs=False): cont = pd.DataFrame(self.pca.components_, columns=self.features_df.index, index=self.pc_names_list) tmp_df = pd.DataFrame(cont.iloc[pc_to_look_at - 1]).reset_index().rename(columns={'index': 'Pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_pcs(adata, pcs=[1, 2], groups=['n_counts', 'n_genes']):\n\n if not isinstance(pcs, type(np.array)):\n pcs = np.array(pcs)\n\n ys = [adata.obs[g] if g in adata.obs_keys() else adata[:, g].X if g in adata.var_names else None\n for g in groups]\n\n ok = tuple(map(lambda y: y is not N...
[ "0.64118433", "0.63123", "0.62668484", "0.61422974", "0.6089986", "0.6033068", "0.60002935", "0.5999633", "0.5990332", "0.59675866", "0.596716", "0.5967138", "0.59388196", "0.59272015", "0.59108025", "0.59038943", "0.5884593", "0.5874629", "0.5857097", "0.58497685", "0.584790...
0.5778411
27
Make bars in horizontal bar chart thinner
def _change_height(self, ax, new_value): for patch in ax.patches: current_height = patch.get_height() diff = current_height - new_value # we change the bar height patch.set_height(new_value) # we recenter the bar patch.set_y(patch.get_y()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setBarWidth(w):\n dislin.barwth(w)", "def setBarWidth(w=0.75):\n dislin.barwth(w)", "def bar(*args, **kwargs):\n ax, args, kwargs = maybe_get_ax(*args, **kwargs)\n color_cycle = brewer2mpl.get_map('Set2', 'qualitative', 8).mpl_colors\n almost_black = '#262626'\n kwargs.setdefault('color',...
[ "0.62765217", "0.6275063", "0.615337", "0.60450804", "0.5972968", "0.5908288", "0.5865915", "0.5836691", "0.5821282", "0.5787317", "0.5757265", "0.57453865", "0.5732923", "0.5655093", "0.56392026", "0.5630556", "0.56223506", "0.55828375", "0.5574982", "0.55665416", "0.5557649...
0.6018318
4
Returns two dictionaries reporting (skew, skew_pval) for all groups
def compute_skew_stats(intra, inter): # Intra (within a group) stats intra_skew = {} for k, v in intra.items(): skew = st.skew(v) try: skew_zstat, skew_pval = st.skewtest(v) except ValueError: # if sample size too small skew_zstat, skew_pval = (0, 1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_skewness_and_kurtosis(self):\n self._set_statistics()\n return self.statistics_object.get_skewness(), self.statistics_object.get_kurtosis()", "def clock_skews(self):\r\n clock_skews = {}\r\n for address, probe in self.__probes.items():\r\n clock_skews[address] = pro...
[ "0.59570825", "0.5915371", "0.5632146", "0.54369366", "0.5265766", "0.51468486", "0.51444227", "0.5088198", "0.50643164", "0.5039543", "0.5033357", "0.49957722", "0.49237293", "0.48994094", "0.48572588", "0.48366004", "0.47897634", "0.47575718", "0.47551352", "0.4721034", "0....
0.5819345
2
run_all but ignoring observations before pca
def run_all2(protgroup, memornot, subsequences, base_outdir, protgroup_dict, protein_feathers_dir, date, errfile, impute_counts=True, cutoff_num_proteins=0, core_only_genes=None, length_filter_pid=.8, remove_correlated_feats=True, force_rerun_counts=False, force_rerun_per...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_pca(data_file, rs, n_components, outfile1, outfile2):\n print('running PCA with n_components={}'.format(n_components))\n day_batcher = DayBatcher(data_file, skiprow=1, delimiter=' ')\n mat = day_batcher.next_batch()\n rst = []\n while mat is not None:\n if mat.shape[1] == 13:\n ...
[ "0.6059944", "0.5925717", "0.59000474", "0.5795408", "0.57630026", "0.56776613", "0.566015", "0.563358", "0.5627678", "0.55640286", "0.5562012", "0.5530116", "0.5508027", "0.5503407", "0.5499793", "0.5486599", "0.5458203", "0.54523826", "0.54140157", "0.53893006", "0.5386249"...
0.0
-1
Resolve a list of effects, replacing random distributions with samples from them. It converts every number to string to match the expectations of torchaudio.
def sample_effects(self) -> List[List[str]]: return [ [ str(item.sample() if isinstance(item, RandomValue) else item) for item in effect ] for effect in self.effects ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_all_effects(all_effects):\n # format all effects\n fmt_all_effects = []\n for eff in all_effects:\n gene_name = eff['Hugo_Symbol'] if eff['Hugo_Symbol'] else ''\n effect_type = eff['One_Consequence']\n protein_change = eff['HGVSp_Short'] if eff.get('HGVSp_Short') el...
[ "0.5677834", "0.5586095", "0.5448812", "0.5331068", "0.51997465", "0.50951654", "0.50077164", "0.4994568", "0.49366093", "0.49105924", "0.4897263", "0.48967674", "0.48934194", "0.4862928", "0.48131192", "0.4800036", "0.4800036", "0.47897625", "0.4766505", "0.47561795", "0.474...
0.68593466
0
Class to fit Naive Bayes.
def __init__( self, column_distribution_map: dict, alpha: float = 1, binomial: bool = False, verbose: bool = True, ): self.binomial = binomial self.column_distribution_map = column_distribution_map self.fitted_distributions = {} self.is_fitted ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def naiveBayes(x_train, x_test, y_train):\n gnb = GaussianNB()\n y_pred = gnb.fit(x_train, y_train).predict(x_test)\n return y_pred", "def naive_bayes_classify(df: pd.DataFrame, vect, names):\n features = vect\n target = df.success_lvl\n\n X_train, X_test, y_train, y_test = \\\n train_te...
[ "0.75167596", "0.7410412", "0.74067736", "0.739734", "0.7372487", "0.7332388", "0.7220718", "0.7137054", "0.7131353", "0.71049625", "0.71010524", "0.6986771", "0.6960169", "0.69516456", "0.6820173", "0.6808535", "0.6802807", "0.6799987", "0.67803574", "0.6715854", "0.66659456...
0.0
-1
Fits the classifier across all classes.
def fit(self, X: np.ndarray, y: np.ndarray): # For each feature column index in X for col_idx in range(X.shape[1]): if col_idx not in self.column_distribution_map: raise ValueError(f"No distribution given for column {col_idx}") # If the column has a multinomial ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_classifier(self):\n for detected_object in self.detected_objects:\n detected_object.predict_class(self.original_image)", "def fit(self, features, classes):\n\n # TODO: finish this.\n classes = np.array(classes)\n features = np.array(features)\n idx_1 = np.w...
[ "0.7368542", "0.66387194", "0.65592366", "0.6522632", "0.64972943", "0.64783496", "0.64602786", "0.6438066", "0.6212635", "0.6194388", "0.6173832", "0.6171643", "0.6150513", "0.6149979", "0.60982805", "0.60944873", "0.6090038", "0.6064533", "0.60455483", "0.6024487", "0.59952...
0.0
-1
Generate prediction value for one class.
def _predict_one_class(self, X: np.ndarray, class_idx: int): return ( np.array( [ self.fitted_distributions[col_idx][class_idx].pdf( X[:, col_idx] ) # get PDF if Gaussian if self.column_distribution_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_prediction(self):\n raise NotImplementedError", "def predict(self, testData=[]):\n result = []\n for classValue in self._classAttrs:\n #print(f'Computing Label: {classValue}, {self._classLabelMap[classValue]}')\n result.append(self._computeCondProb(testData, cl...
[ "0.7180626", "0.70270187", "0.688201", "0.67794514", "0.67482245", "0.67216885", "0.6717402", "0.668145", "0.66791725", "0.66554374", "0.66512483", "0.6651043", "0.66376346", "0.66208947", "0.6614632", "0.6585858", "0.65707326", "0.6561249", "0.6551322", "0.6547303", "0.65396...
0.6834894
3
Get the prediction probability for each row in X, for each class in y.
def predict_prob(self, X): if not self.is_fitted: raise ValueError("Must fit model before predictions can be made") return pipe( [ self._predict_one_class( X=X, class_idx=class_idx ) # Get one class prediction ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, X, y):\n # Implement the forward pass and return the output class (argmax of the softmax outputs)\n a1, probs = self._feed_forward(X)\n \n hits = 0\n for i in xrange(len(y)):\n if np.where(probs[i]==max(probs[i]))[0][0] == y[i]: hits+=1\n\n pri...
[ "0.7292774", "0.7017846", "0.70151633", "0.6993751", "0.6986414", "0.69515455", "0.68011767", "0.67936254", "0.6777828", "0.6759871", "0.67576486", "0.6749975", "0.67347264", "0.6729457", "0.6726271", "0.67145663", "0.67058694", "0.67037964", "0.6684672", "0.66840285", "0.667...
0.690123
6
Retrieving a tracing configuration file
def get(isamAppliance, instance_id, check_mode=False, force=False): return isamAppliance.invoke_get("Retrieving a tracing configuration file", "{0}/{1}/tracing_configuration".format(uri, instance_id), requires_modules=requires_modules, requires...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_config(self, config_filename):", "def config_file(self):\n return self[CONFIG_FILE_KEY]", "def config_locator():\n print(pkgrs.resource_filename('latools', 'latools.cfg'))\n return", "def get_config_file(config_file):\n if os.path.isfile(config_file):\n return config_file\n ...
[ "0.65861887", "0.6201471", "0.59921926", "0.59153795", "0.5883415", "0.5848848", "0.5817266", "0.58134186", "0.581149", "0.58110315", "0.58077043", "0.5786387", "0.5786206", "0.57854015", "0.5768189", "0.5768189", "0.5762999", "0.5759536", "0.57474333", "0.57328016", "0.57271...
0.6589118
0
Exporting a tracing configuration file
def export_file(isamAppliance, instance_id, filepath, check_mode=False, force=False): if os.path.exists(filepath) is True: logger.info("File '{0}' already exists. Skipping export.".format(filepath)) warnings = ["File '{0}' already exists. Skipping export.".format(filepath)] return isamApp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_configurations():\n pass", "def write_config(self, config_file):\n \n # write root paths\n \n # write reference data\n \n # write tool paths\n \n pass", "def dump_default_config():\n output = \"PythiaPlotter_config.py\"\n log.info(\"Du...
[ "0.67341244", "0.56953835", "0.559031", "0.5490457", "0.5467667", "0.54212755", "0.54184455", "0.53651875", "0.53548735", "0.53518707", "0.5349986", "0.5322976", "0.5302918", "0.5302767", "0.52994025", "0.5294441", "0.5291963", "0.52893883", "0.5279176", "0.52742004", "0.5267...
0.0
-1
Updating tracing configuration file data using contents string
def update(isamAppliance, instance_id, contents, check_mode=False, force=False): update_required = False ret_obj = get(isamAppliance, instance_id) ret_contents = ret_obj['data']['contents'] if ret_contents.strip() != contents.strip(): update_required = True if force is True or update_requ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configureTrace(self,traceString):\n configureTrace(traceString)", "def config_replace(context,target,filename):\n\n result = context.get_operation('config_replace')\n return result", "def add_to_local_conf(prepared_test_build, string):\n\n with open(prepared_test_build['local_conf'], \"a\") as ...
[ "0.5832456", "0.5765424", "0.5668442", "0.56163013", "0.56066316", "0.55877095", "0.5560684", "0.5472369", "0.54155135", "0.5403871", "0.5373601", "0.53309315", "0.5326576", "0.53178144", "0.53058666", "0.52930135", "0.5251103", "0.52441126", "0.5235663", "0.52275234", "0.521...
0.57540876
2
Updating tracing configuration file data using a file
def import_file(isamAppliance, instance_id, filepath, check_mode=False, force=False): if force is True or _check_import(isamAppliance=isamAppliance, id=instance_id, filepath=filepath) is True: if check_mode is True: return isamAppliance.create_return_object(changed=True) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_from_file(self):\n config_path = os.environ.get('MINDINSIGHT_CONFIG', '')\n if not config_path:\n return\n\n config_module = None\n\n # python:full.path.for.config.module\n if config_path.startswith('python:'):\n config_module = import_module(conf...
[ "0.63233757", "0.6213268", "0.61495537", "0.6062462", "0.5931395", "0.5910168", "0.5885912", "0.58781916", "0.5852153", "0.58122075", "0.5808638", "0.57931113", "0.57922876", "0.5791657", "0.57788295", "0.5746347", "0.5694466", "0.5679826", "0.56783456", "0.566996", "0.566653...
0.0
-1
Checks if the file to be imported is the same as the file that's already on the instance
def _check_import(isamAppliance, id, filepath): tmpdir = get_random_temp_dir() tmp_original_file = os.path.join(tmpdir, os.path.basename("tempfile.txt")) export_file(isamAppliance, instance_id=id, filepath=tmp_original_file, check_mode=False, force=True) if files_same(tmp_original_file, filepath): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dupe_imports(self):\r\n good_file = self._get_del_file()\r\n imp = Importer(good_file, username=u\"admin\")\r\n imp.process()\r\n\r\n good_file = self._get_del_file()\r\n imp = Importer(good_file, username=u\"admin\")\r\n imp.process()\r\n\r\n # now let's d...
[ "0.6489134", "0.6460151", "0.63492894", "0.6330165", "0.6237938", "0.6193168", "0.61540926", "0.61357623", "0.61025244", "0.60976493", "0.60797423", "0.60688674", "0.60449314", "0.60211533", "0.6008159", "0.5987599", "0.59309274", "0.5908474", "0.5878707", "0.58716476", "0.58...
0.68644285
0
Create a simple form generator the populates the choices from a list of Poll objects
def get_choice(cls, polls): cl = cls() items = [] for poll in polls: items.append((poll.id, poll.question)) setattr(cl.poll, 'items', items) return cl
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, choices, *args, **kwargs):\n super(RangePollChoiceForm, self).__init__(*args, **kwargs)\n nominees = [(i, '%d' % i) for i in range(0, choices.count()+1)]\n for choice in choices:\n self.fields['range_poll__%s' % str(choice.id)] = (\n forms.ChoiceFie...
[ "0.7152413", "0.6911527", "0.6545342", "0.61729306", "0.5988688", "0.5907622", "0.5904008", "0.5762562", "0.57005036", "0.56966144", "0.56839067", "0.55775195", "0.55669415", "0.5556159", "0.55277395", "0.551386", "0.55103374", "0.55000895", "0.5446568", "0.5429533", "0.54105...
0.694909
1
Gets an environnement variable. Raises an exception if it doesn't exist.
def get_env_or_exception(key): value = os.getenv(key) if value is None: raise ImproperlyConfigured(f'{key} env variable is not set') return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_env_variable(self, var_name, optional=False):\n try:\n return environ[var_name]\n except KeyError:\n if optional:\n return False\n else:\n error_msg = f'Error: You must set the {var_name} environment variable.'\n raise Exception(error_msg)", "de...
[ "0.7947116", "0.793334", "0.7908944", "0.7871617", "0.7830233", "0.7790688", "0.7754946", "0.771797", "0.77005094", "0.76996714", "0.7667179", "0.7621666", "0.75790864", "0.75512064", "0.75072914", "0.74945444", "0.7478032", "0.74726355", "0.74603695", "0.7441183", "0.7383394...
0.7757982
6
Create a new ``forge`` marker class with a ``native`` attribute.
def __new__( mcs, name: str, bases: typing.Tuple[type, ...], namespace: typing.Dict[str, typing.Any], ): namespace['__repr__'] = lambda self: repr(type(self)) return super().__new__(mcs, name, bases, namespace)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args):\n _gdi_.NativePixelData_swiginit(self,_gdi_.new_NativePixelData(*args))", "def get_reflect_marker(self):\r\n return Marker((255, 255, 255), self._screen)", "def __init__(self, *args):\n _gdi_.NativePixelData_Accessor_swiginit(self,_gdi_.new_NativePixelData_Access...
[ "0.54972416", "0.5409649", "0.5404728", "0.5395699", "0.5164821", "0.5149928", "0.5126409", "0.50671685", "0.50481206", "0.5013763", "0.5008197", "0.500164", "0.49649024", "0.495157", "0.48945302", "0.48802048", "0.48734143", "0.48688027", "0.48635876", "0.48486874", "0.48462...
0.0
-1
Conditionally coerce the value to a
def ccoerce_synthetic(cls, value): return value if value is not cls.native else cls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coerce(self, value, **kwds):\n # just leave it alone\n return value", "def coerce_value(value):\n if not isinstance(value, string_types):\n return value\n\n if re.match(r'^[0-9]+$', value):\n return int(value)\n\n if re.match(r'^[.0-9]+$', value):\n try:\n ...
[ "0.7240736", "0.70956117", "0.69254243", "0.69145334", "0.69145125", "0.6890752", "0.6890752", "0.6855949", "0.68498045", "0.68226534", "0.67946637", "0.67854136", "0.67821395", "0.6712882", "0.6696194", "0.66583407", "0.661882", "0.6569828", "0.65626615", "0.653433", "0.6534...
0.57399714
84
Helper function to list protocol buffer fields
def fields(proto): return [x[0].name for x in proto.ListFields()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_proto_fields():\n raise NotImplementedError()", "def list_fields(fc):\n return [f.name for f in arcpy.ListFields(fc)]", "def _list_fields(self):\n return list(self._state.keys())", "def getFields(iface):\n return getFieldsInOrder(iface)", "def fields(self):", "def get_fields_l...
[ "0.74497396", "0.7188583", "0.6732649", "0.6660771", "0.66101354", "0.6575934", "0.6503095", "0.64481694", "0.6414286", "0.63747007", "0.6358524", "0.6334771", "0.62941283", "0.6234232", "0.6233044", "0.6232955", "0.62042385", "0.61363804", "0.6134944", "0.61275667", "0.61232...
0.798349
0