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 |
|---|---|---|---|---|---|---|
Returns the smallest item of this stream. | def min(self, key=lambda _: _):
return min(self, key=key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take_min(self):\n return self.get_first()",
"def min(self):\n return self.get_first()",
"def _find_min(self):\n if self.is_empty(): # is_empty inherited from base class\n raise Empty('Priority queue is empty')\n small = self._data.first()\n walk = self._data.after(small)\n wh... | [
"0.8079357",
"0.7964827",
"0.786516",
"0.78332955",
"0.76497614",
"0.75355464",
"0.75355464",
"0.7523685",
"0.74445915",
"0.73460555",
"0.7334136",
"0.7317787",
"0.7317787",
"0.7303266",
"0.7297569",
"0.72822535",
"0.7268715",
"0.7267241",
"0.72492516",
"0.72000057",
"0.71911... | 0.7408102 | 9 |
Returns the largest item of this stream. | def max(self, key=lambda _: _):
return max(self, key=key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max(self):\n return self.get_first()",
"def find_max(self):\r\n maxVal = self.items[1]\r\n if maxVal is None:\r\n return None\r\n \r\n for i in range(1,len(self.items)):\r\n if self.items[i] is not None:\r\n if self.items[i] > maxVal:\r\... | [
"0.7670412",
"0.7572868",
"0.7463609",
"0.7441727",
"0.7412763",
"0.7282507",
"0.7238279",
"0.7205189",
"0.7166872",
"0.7162609",
"0.7157219",
"0.7157219",
"0.71475804",
"0.7141774",
"0.71350074",
"0.7082565",
"0.708053",
"0.70803034",
"0.702977",
"0.6994883",
"0.6988381",
... | 0.711443 | 15 |
Returns the number of items of this stream. | def count(self):
return sum(1 for _ in self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def items_count(self):\n return len(self.items)",
"def get_num_items(self):\r\n return self.num_items",
"def items_num(self):\n return len(self.items)",
"def count(self):\n return len(self.read_ints())",
"def items_num(self):\n\t\treturn len(self.items)",
"def items_num(self):... | [
"0.8301211",
"0.81344986",
"0.80515355",
"0.79899615",
"0.79588777",
"0.79588777",
"0.79573154",
"0.7908144",
"0.78880036",
"0.78873676",
"0.7877877",
"0.78292423",
"0.7749551",
"0.77141726",
"0.7712948",
"0.7682725",
"0.7682725",
"0.7682725",
"0.7651507",
"0.7649355",
"0.764... | 0.70951164 | 92 |
Apply a function of two arguments cumulatively to the items of this stream from left to right, so as to reduce this stream to a single value. | def reduce(self, binary_operator):
return functools.reduce(binary_operator, self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduce_right(self, func, init=None):\n return self.reverse().reduce(func, init)",
"def _pipe_and_accumulate(val, fns):\n for fn in fns:\n val = fn(val)\n yield val",
"def accumulate(binop, seq):\n result = next(iter(seq))\n yield result\n for elem in itertools.islice(seq, 1... | [
"0.6198",
"0.6075733",
"0.5867045",
"0.5766462",
"0.567074",
"0.5650203",
"0.56231153",
"0.5569381",
"0.55498356",
"0.55137277",
"0.55052614",
"0.53980947",
"0.5390954",
"0.5376807",
"0.5336012",
"0.5332723",
"0.53193396",
"0.52803785",
"0.5242527",
"0.52422947",
"0.5239353",... | 0.55236965 | 9 |
Performs an action for each items of this stream. | def foreach(self, action):
for item in self:
action(item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def act(self, timestep):\n for listwriter in self._listwriters:\n listwriter.act(timestep)",
"def bulk_process(self):\n\n def actions():\n try:\n task = self.queue.get(block=False, timeout=None)\n\n if task['action'] == 'index':\n ... | [
"0.62833196",
"0.6251297",
"0.6223325",
"0.61298406",
"0.6001018",
"0.59882206",
"0.59653026",
"0.59495246",
"0.58906627",
"0.58894193",
"0.58095604",
"0.5779752",
"0.57670933",
"0.57375664",
"0.5698702",
"0.5692092",
"0.56511533",
"0.5648216",
"0.5644593",
"0.562101",
"0.558... | 0.8300826 | 0 |
Returns a collection of items collected by given collector. | def collect(self, collector):
return collector(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect(self, item, collector_set):\n\t\tpass",
"def generator_sends_collector():\n def w(collect_list):\n def collector(*a, **kw):\n item = yield\n while item is not None:\n collect_list.append(item)\n item = yield\n collect_list.appen... | [
"0.7062182",
"0.6238775",
"0.62127477",
"0.6085421",
"0.5568038",
"0.54260415",
"0.5394952",
"0.5348385",
"0.52863944",
"0.5280602",
"0.5253309",
"0.5215131",
"0.5201584",
"0.51625365",
"0.513643",
"0.5104146",
"0.50596243",
"0.5026734",
"0.50245863",
"0.50178623",
"0.4997005... | 0.7430312 | 0 |
Returns concatenated stream of given streams. | def chain(*streams):
return Stream(itertools.chain(*streams)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concatenate_from_streams(cls, streams, schema, **kwargs):\n if 'taxon_set' not in kwargs:\n taxon_set = TaxonSet()\n kwargs[\"taxon_set\"] = taxon_set\n else:\n taxon_set = kwargs[\"taxon_set\"]\n char_matrices = []\n for stream in streams:\n ... | [
"0.7202589",
"0.66483635",
"0.63785625",
"0.6352309",
"0.6278003",
"0.6186486",
"0.61308485",
"0.61265486",
"0.6086431",
"0.580553",
"0.5698017",
"0.5645479",
"0.56218",
"0.54383713",
"0.5383753",
"0.5369233",
"0.53659254",
"0.5361231",
"0.5355483",
"0.53350115",
"0.5286327",... | 0.78553116 | 0 |
Get info of all users endpoint To access, access token and admin permissions are required | def get(self):
users = User.query.all()
usersJSON = []
for u in users:
usersJSON.append({'id':u.id, 'admin':u.admin})
return { 'users' : usersJSON } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_users_info(): \n \n data = user_obj.get_users_info()\n return data",
"def get_all_users():\n token = request.headers.get('token')\n\n # Token Validation\n token_valid, response = is_token_valid(token)\n if not token_valid:\n return response\n token_username = response\n\n ... | [
"0.7055338",
"0.70068",
"0.69804466",
"0.6967265",
"0.6938567",
"0.693126",
"0.69212884",
"0.69199544",
"0.6903586",
"0.6865703",
"0.6795045",
"0.67894423",
"0.67894423",
"0.67894423",
"0.67894423",
"0.67866087",
"0.6781199",
"0.67622477",
"0.6760568",
"0.6749771",
"0.6745474... | 0.61079377 | 83 |
Create a new user account endpoint To create, access token and admin permissions are required | def post(self):
args = usr_parser.parse_args()
# convert admin parameter into a boolean
admin = bool(args['admin'])
# check if the id of user is provided
if args['uid'] is not None:
user = User.new_user(admin, args['uid'])
else:
user = User.new_use... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create():\n api_request = apireq.APIRequest(request, 'client_schema')\n if api_request.is_invalid():\n return api_request.error_text, 400\n return user_management.create_user(api_json['username'])",
"def create_user(self, data):\n return self.client.post(\n path='/api/v2/auth/signup... | [
"0.7385268",
"0.7270193",
"0.7257422",
"0.7244507",
"0.7169587",
"0.7113832",
"0.69993824",
"0.69920707",
"0.69871134",
"0.69725406",
"0.6966641",
"0.6958602",
"0.6949076",
"0.6946899",
"0.68811727",
"0.6865503",
"0.68632054",
"0.6859041",
"0.68502843",
"0.6844834",
"0.684362... | 0.6783019 | 28 |
Reset password endpoint To reset, access token and admin permissions are required Takes in an id of a user that needs to have its password reset Returns the new changed password | def post(self, user_id):
user = User.query.get(user_id)
if user is None:
return abort(422, message="User does not exist")
password = user.generate_new_pass()
return { 'password' : password } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_password():\n password = request.get_json().get('password')\n access_token = authentication_request()\n\n if access_token:\n # Attempt to decode the token and get the User ID\n user_id = Users.decode_token(access_token)\n if not isinstance(user_id, str):\n user = ... | [
"0.8160001",
"0.78259015",
"0.73780406",
"0.73630553",
"0.7288486",
"0.7231366",
"0.7226374",
"0.7201207",
"0.7156852",
"0.70836085",
"0.70733124",
"0.7066418",
"0.7063696",
"0.6987889",
"0.6974885",
"0.6954941",
"0.69168526",
"0.6910582",
"0.69019395",
"0.6876891",
"0.682572... | 0.0 | -1 |
Delete user endpoint To delete, access token and admin permissions are required | def delete(self, user_id):
user = User.query.get(user_id)
if user is None:
return abort(422, message="User does not exist")
# check if the user is an admin and is the only one
admins = User.query.filter_by(admin=True).all()
if user.id == get_jwt_iden... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_user():",
"def delete_user():\n #TODO user delete\n pass",
"def delete_user():\n token = request.args.get('token')\n data = jwt.decode(token, app.config['SECRET_KEY'])\n\n permit = functions.delete_user(data)\n if permit:\n return make_response(jsonify({'Delete': 'User Delet... | [
"0.8195418",
"0.81057185",
"0.8041586",
"0.7993288",
"0.77391946",
"0.7623318",
"0.7620193",
"0.75872415",
"0.75852036",
"0.7533905",
"0.7503918",
"0.7478631",
"0.74715984",
"0.746987",
"0.7424775",
"0.742072",
"0.741527",
"0.7410538",
"0.73725116",
"0.7310007",
"0.73016226",... | 0.68693036 | 54 |
Toggle user admin status endpoint To toggle, access token and admin permissions are required | def post(self, user_id):
user = User.query.get(user_id)
if user is None:
return abort(422, message="User does not exist")
""" check if user's the only admin if it's an admin """
admins = User.query.filter_by(admin=True).all()
if user.admin and len(ad... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_required(handler):\n def admin_login(self, *args, **kwargs):\n auth = self.auth\n if not auth.get_user_by_session():\n self.redirect('/auth/login', abort=True)\n \n user = auth.get_user_by_session()\n queried_entity = User.get_by_id(user['user_id'])\n ... | [
"0.6454747",
"0.63205993",
"0.62615484",
"0.62442005",
"0.62236315",
"0.6223049",
"0.6207268",
"0.6181463",
"0.6181463",
"0.61800843",
"0.61779815",
"0.6082381",
"0.6079935",
"0.60787714",
"0.60214365",
"0.602113",
"0.60124683",
"0.6005901",
"0.5990312",
"0.5989222",
"0.59612... | 0.0 | -1 |
Create context with specified parameters. | async def create(app=None, config=None, update=None, backend=None):
ctx = Context(
app=app,
config=config,
update=update,
backend=backend,
)
if update.type == UpdateType.MSG:
if update.receiver_type == ReceiverType.MULTI:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_context(cls):\n pass",
"def make_context(self, engine, args):\n args = self.normalize_args(args)\n _, ctx = self._make_argkey_and_context(engine, args)\n return ctx",
"def make_context(self, args, **kwargs):\n #The following headers will be available from Auth filter:\... | [
"0.77609843",
"0.72384435",
"0.6999001",
"0.6952777",
"0.6904564",
"0.6891574",
"0.6884766",
"0.6866193",
"0.68576616",
"0.6841668",
"0.6783492",
"0.6779137",
"0.6697613",
"0.664317",
"0.6552902",
"0.64865357",
"0.6455056",
"0.6431982",
"0.6339957",
"0.6279981",
"0.6273673",
... | 0.6041788 | 27 |
Replaces this instance's method with specified name with passed method. | def replace_method(self, method_name, method):
if not callable(getattr(self, method_name, None)):
raise ValueError(f"No method with name '{method_name}'")
setattr(self, method_name, types.MethodType(method, self)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replaces_method(func: Callable[..., Tuple[str]], classname: str, method_name: str):\n Replacements._method_rep[(classname, method_name)] = func\n return func",
"def _override_command_method(self, name):\n method=getattr(self,name,None)\n if method is not None:\n @func_utils.get... | [
"0.7471502",
"0.6672633",
"0.6672284",
"0.6640323",
"0.66057575",
"0.65453744",
"0.6527196",
"0.6520483",
"0.64873147",
"0.6427852",
"0.639384",
"0.63288766",
"0.6258245",
"0.6235818",
"0.6152616",
"0.61291534",
"0.60626507",
"0.60151434",
"0.6005935",
"0.5988945",
"0.5977686... | 0.82818156 | 0 |
Split text into chunks with specified length. | def split_large_text(text, length=4096):
text = str(text)
yield text[0: length]
for i in range(length, len(text), length):
yield text[i: i + length] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunk_split(cls, text):\n parts = []\n current = []\n for line in text.splitlines():\n size = sum(len(part) + 1 for part in current)\n extra = len(line)\n if size + extra >= 2000:\n if current:\n # The message is full, spli... | [
"0.7383811",
"0.69554186",
"0.6950578",
"0.6878057",
"0.65951",
"0.65605026",
"0.6474294",
"0.6446131",
"0.6441423",
"0.6360656",
"0.6346665",
"0.63384575",
"0.63274455",
"0.63134134",
"0.6289246",
"0.6232736",
"0.6232736",
"0.61928964",
"0.6154149",
"0.6089452",
"0.60799557"... | 0.82328856 | 0 |
Perform request to backend's API and return response. | async def request(self, method, **kwargs):
return await self.backend.execute_request(
method,
kwargs,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(self):\n\n self.url = self._prepare_url()\n status_code, response = self._do_request(self.url)\n return self._process_response(status_code, response)",
"def api_call():\n\tresponse = requests.get(URL_API)\n\treturn response",
"def _api_request(*args, **kwargs):\n ... | [
"0.7054616",
"0.69675416",
"0.662412",
"0.65425575",
"0.6516123",
"0.64511174",
"0.6406854",
"0.6401858",
"0.6400295",
"0.6398491",
"0.6398415",
"0.63875556",
"0.63718516",
"0.6337847",
"0.633471",
"0.63279456",
"0.631839",
"0.6312061",
"0.62975377",
"0.6290924",
"0.6290571",... | 0.65656155 | 3 |
Reply with specified message and attachments. Other kwargs are passed to the backend. Often as additional arguments to sending the message. If message is too long it will be splitted. | async def reply(self, message, attachments=(), **kwargs):
return await self.send_message(
self.default_target_id,
message,
attachments,
**kwargs
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reply(self, *content, **kwargs):\n return self.message.reply(*content, **kwargs)",
"def Reply_With_Attchment(service, userId, receiver, subject, message, attachments, threadId, message_id):\n # Create email message\n emailMsg = message\n mimeMessage = MIMEMultipart()\n mimeMessage['to'] = receiver... | [
"0.65980136",
"0.64945555",
"0.61485016",
"0.5996543",
"0.590376",
"0.58438814",
"0.5796048",
"0.57734615",
"0.5757795",
"0.5730796",
"0.5721487",
"0.5720016",
"0.57094204",
"0.5687314",
"0.5680167",
"0.5676434",
"0.5666405",
"0.5598512",
"0.55501354",
"0.55411804",
"0.553382... | 0.7515483 | 0 |
Send message to specified target_id with specifiend message and attachments. Other kwargs are passed to the backend. Often as additional arguments to sending the message. If message is too long it will be splitted. | async def send_message(self, target_id, message, attachments=(), **kwargs):
responses = []
parts = tuple(self.split_large_text(message))
for part in parts[:-1]:
responses.append(await self.backend.execute_send(
target_id,
part,
(),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_message_to_target(\n message: str,\n sessionId: Optional[SessionID] = None,\n targetId: Optional[TargetID] = None,\n) -> dict:\n return {\n \"method\": \"Target.sendMessageToTarget\",\n \"params\": filter_none(\n {\n \"message\": message,\n ... | [
"0.6636919",
"0.65982866",
"0.63353294",
"0.61850524",
"0.61734605",
"0.60913",
"0.58138454",
"0.5768072",
"0.5706319",
"0.5661404",
"0.5604912",
"0.55760515",
"0.5503068",
"0.55023414",
"0.54777795",
"0.5473992",
"0.5461167",
"0.5453858",
"0.5446829",
"0.54394525",
"0.535112... | 0.7016827 | 0 |
Create a new external query interface. | def __init__(self, db):
assert db.schema.id == self.schema, \
_('invalid schema: %r instead of %r' % (
db.schema.id, self.schema)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_query(self):\r\n raise NotImplementedError()",
"def make_query(self):",
"def create_query(self, keywords=None, servicetype=None, \n waveband=None, sqlpred=None):\n srch = RegistryQuery(self._baseurl)\n if sqlpred:\n srch.addpredicate(sqlpred)\n ... | [
"0.7400449",
"0.6667208",
"0.6418966",
"0.6345435",
"0.61312544",
"0.600857",
"0.59114534",
"0.5836827",
"0.5821988",
"0.5761216",
"0.57217693",
"0.5714301",
"0.56627864",
"0.5628812",
"0.5609877",
"0.5583228",
"0.55595607",
"0.5543764",
"0.5539105",
"0.5531038",
"0.5531038",... | 0.0 | -1 |
Return the number of matches for the specified query. | def count(self, query): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(self, query=None):\n return self.create_search(query).count()",
"def count(self, query):\n if len(query._where) == 0:\n url = '%s/%s' % (self.uri, query.table())\n else:\n url = '%s/%s/filter?%s' % (self.uri, query.table(), query.encode())\n data, resp ... | [
"0.7925641",
"0.75999933",
"0.7589242",
"0.74711955",
"0.7319044",
"0.71779466",
"0.69396776",
"0.69268286",
"0.69268286",
"0.69212264",
"0.67377263",
"0.67277676",
"0.6695024",
"0.6598876",
"0.64854753",
"0.64568627",
"0.6439811",
"0.6438354",
"0.64087915",
"0.6369378",
"0.6... | 0.73863304 | 4 |
Return the number of matches for the specified query and a ResultSet() with the records that have been retrieved (at most maxhits). | def search(self, query, maxhits=100): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(self, query=None):\n return self.create_search(query).count()",
"def count(self, query):\n if len(query._where) == 0:\n url = '%s/%s' % (self.uri, query.table())\n else:\n url = '%s/%s/filter?%s' % (self.uri, query.table(), query.encode())\n data, resp ... | [
"0.69246066",
"0.68974704",
"0.6793249",
"0.6793249",
"0.6489237",
"0.64849895",
"0.6410751",
"0.64053744",
"0.63750935",
"0.63527423",
"0.6315266",
"0.63146746",
"0.6290408",
"0.6224941",
"0.614808",
"0.60947335",
"0.606999",
"0.5997522",
"0.5994227",
"0.59854776",
"0.596957... | 0.63218844 | 10 |
Cancel a pending query. | def cancel(self): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel(self):\n # type: () -> None\n if self.query_id is None or self.is_finished():\n return\n\n self._cancelled = True\n url = self._request.get_url(\"/v1/query/{}\".format(self.query_id))\n logger.debug(\"cancelling query: %s\", self.query_id)\n response ... | [
"0.79472077",
"0.74434185",
"0.7349859",
"0.6652361",
"0.6523437",
"0.64968413",
"0.6489558",
"0.64771354",
"0.6469782",
"0.6464311",
"0.6459153",
"0.64537746",
"0.64488226",
"0.6440854",
"0.6423534",
"0.6384417",
"0.6384417",
"0.6384417",
"0.6384417",
"0.63764673",
"0.637224... | 0.6360666 | 23 |
Last updated by Sasha on May 31st | def relevant_complaints(complaints, complaints_accused, t1, t2):
complaints["incident_date"] = pd.to_datetime(complaints["incident_date"])
complaints_t1 = complaints[(complaints["incident_date"].dt.year >= t1[0]) &
(complaints["incident_date"].dt.year <= t1[1])]
complaints_t2 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use(self):",
"def _update(self):\n pass",
"def support(self):",
"def __upgrade(self):",
"def VER(self):",
"def version(self):",
"def _get_version(self):",
"def update( ):\r\n pass",
"def update(self):",
"def update(self):",
"def update(self):",
"def dummy_update( self ):\r\n... | [
"0.5965305",
"0.5931108",
"0.5926973",
"0.590799",
"0.58984023",
"0.58660567",
"0.5796488",
"0.57686836",
"0.5710671",
"0.5710671",
"0.5710671",
"0.57063276",
"0.5662753",
"0.56604344",
"0.5643487",
"0.56243074",
"0.558985",
"0.55641353",
"0.5551176",
"0.55164707",
"0.5516470... | 0.0 | -1 |
Written by Sasha on May 26th | def add_suspension_length(complaints):
final_outcome = complaints["final_outcome"].fillna("")
complaints["suspension_length"] = final_outcome.map(lambda x: int(x.split()[0])
if x is not None and
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exo2():",
"def degibber(self):",
"def regular(self):",
"def cx():",
"def mezclar_bolsa(self):",
"def CL(self):",
"def exercise_b2_53():\r\n pass",
"def support(self):",
"def sth():",
"def __call__(self) -> None:",
"def c(self):\n pass",
"def c(self):\n pass",
"def subst... | [
"0.6317537",
"0.6086023",
"0.606445",
"0.60347",
"0.59799373",
"0.5889416",
"0.58407587",
"0.5813075",
"0.5781369",
"0.57409066",
"0.57407206",
"0.57407206",
"0.5739394",
"0.5733369",
"0.5728564",
"0.5717941",
"0.5682548",
"0.56436235",
"0.5623817",
"0.5611533",
"0.560476",
... | 0.0 | -1 |
Written on June 7th by Sasha | def add_victim_race(by_officer_df, complaints_t1, complaints_victims):
complaints_w_victim_data = complaints_t1.merge(complaints_victims, how="left", on="cr_id")
by_officer_groupby = pd.DataFrame(complaints_w_victim_data.groupby(["UID", "race"]).size())
by_officer_racial_breakdown = pd.pivot_table(by_office... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weekly():",
"def day_07_b() -> int:\n return 0",
"def date(self):",
"def day_06_b() -> int:\n return 0",
"def day_07_a() -> int:\n return 0",
"def day_06_a() -> int:\n return 0",
"def int_21H_42(self):\r\n date_now = datetime.datetime.now()\r\n\r\n year = date_now.year\r\n... | [
"0.59752893",
"0.5590746",
"0.5566567",
"0.5543655",
"0.55310494",
"0.5417895",
"0.53572714",
"0.53434193",
"0.53412515",
"0.5324521",
"0.53034854",
"0.526831",
"0.52480185",
"0.52423704",
"0.52418077",
"0.5223946",
"0.5180193",
"0.51182556",
"0.5102488",
"0.5072671",
"0.5064... | 0.0 | -1 |
Register the NSXV3 QoS driver. | def register():
global DRIVER
if not DRIVER:
DRIVER = NSXv3QosDriver.create(agent_rpc=None)
LOG.debug('NSXv3QosDriver QoS driver registered') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register(self):\n\n @asyncio.coroutine\n def on_prepare(xact_info, action, ks_path, msg):\n \"\"\" prepare callback from dts \"\"\"\n self._log.debug(\n \"Got vnfr on_prepare callback (xact_info: %s, action: %s): %s\",\n xact_info, action, msg\n... | [
"0.5284315",
"0.51736283",
"0.5088734",
"0.49640363",
"0.4955186",
"0.49492526",
"0.48222563",
"0.47500452",
"0.47391933",
"0.4716713",
"0.46789974",
"0.46687174",
"0.46618465",
"0.46448204",
"0.46002236",
"0.44792214",
"0.44595623",
"0.44356644",
"0.4349463",
"0.4303832",
"0... | 0.86845803 | 0 |
Find hilight for item. If item does not have an explicit hilight, check subitems, in order, for one that has an explicit or implicit hilight. | def _find_hilight(self):
traverse = deque([self.item])
while traverse:
item = traverse.popleft()
if item.hilight:
return item.hilight
traverse.extendleft(reversed(item.subitems)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find(self, item):\n stack = [self.root]\n while stack:\n node = stack.pop()\n if node.items and item in node.items:\n return True, node.active[node.items.index(item)], node\n elif not node.items:\n axis = node.cutdim\n ... | [
"0.58067036",
"0.5193684",
"0.5138478",
"0.51258224",
"0.5124072",
"0.5008926",
"0.49733815",
"0.49026772",
"0.48955747",
"0.4875211",
"0.4851098",
"0.48247287",
"0.48153755",
"0.48101473",
"0.4797423",
"0.47863838",
"0.47824356",
"0.4755184",
"0.47521403",
"0.4747824",
"0.47... | 0.8131971 | 0 |
This function should be called periodically to do work. | def bootstrap_spin(self):
if self.spins > 300:
# too many spins with no result -> give up
self.stop()
self.start()
return
(ridx, match, res) = self.tn.expect([b"Performing automatic"], 1)
if match: # got a match!
if ridx == 0: # logi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_work(self):",
"def do_work(self):\n raise NotImplementedError",
"def work(self):\n time.sleep(random.randint(0, 200) / 100)\n pass",
"def __work__(self):\n while not self.is_done:\n self.refreshSignal.emit()\n time.sleep(0.05)",
"def run(self):\n ... | [
"0.79755855",
"0.75077736",
"0.74177593",
"0.7290416",
"0.7257468",
"0.7127241",
"0.71202874",
"0.69918203",
"0.6965564",
"0.69398797",
"0.68110764",
"0.68043095",
"0.6802662",
"0.67973304",
"0.6785489",
"0.67724556",
"0.6759046",
"0.6735404",
"0.6691155",
"0.6658877",
"0.664... | 0.0 | -1 |
Do the actual bootstrap config | def bootstrap_config(self):
self.logger.info("applying bootstrap configuration")
self.wait_write("\r", None)
# Wait for the prompt
time.sleep(1)
self.wait_write("system-view", "<HPE>")
self.wait_write("ssh server enable", "[HPE]")
self.wait_write("user-interface c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _do_bootstrap(self, configs=None):\n pass",
"def bootstrap():\n Bootstrap()",
"def bootstrap(self):\n None",
"def init_config(self):\n pass",
"def bootstrap_post():\n\timport os\n\tprint('status','running bootstrap_post from bootstrap.py')\n\tos.system('make config')\n\t... | [
"0.7954499",
"0.73024774",
"0.7067478",
"0.69428086",
"0.6893034",
"0.68891966",
"0.6865797",
"0.683293",
"0.683293",
"0.67178863",
"0.66723686",
"0.65899235",
"0.65830034",
"0.6562887",
"0.6562887",
"0.6562887",
"0.6562887",
"0.65597296",
"0.65597296",
"0.6520876",
"0.651885... | 0.6654136 | 11 |
Object constructor. (couch.Client) client (str) name (Exception) | def __init__(self, client, name):
if not isinstance(client, couch.Client):
raise Exception("'client' arg must be instance of couch.Client")
self.client = client
self.name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, name, client):\n self.name = name\n self.client = client",
"def __init__(self, client, name):\n self._client = client\n self._attr_name = name",
"def __init__(self, client, db_name):\n self.client = client\n self.db_name = db_name",
"def __init__(s... | [
"0.79376125",
"0.7793737",
"0.7756333",
"0.765076",
"0.76003",
"0.75791806",
"0.7549555",
"0.71095353",
"0.699044",
"0.68987614",
"0.68522894",
"0.685037",
"0.68476003",
"0.68101704",
"0.6764563",
"0.67382616",
"0.6712658",
"0.6706904",
"0.6615811",
"0.6611911",
"0.6610059",
... | 0.901303 | 0 |
Ping database, expect 200 response code. (bool) | def ping(self):
return (200 == self.client.head(self.name).getStatusCode()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ping(self):\n response = self._request(\"GET\", [ROUTE_PING])\n\n if response.status_code == 200:\n logging.info(\"OK\")\n return True\n logging.error(\"FAILED\")\n return False",
"def ping():\n\treturn HTTPResponse(status=200)",
"def ping(self) -> bool:\n ... | [
"0.7543295",
"0.75236094",
"0.73076844",
"0.70573723",
"0.70573723",
"0.70573723",
"0.70573723",
"0.7006478",
"0.7005644",
"0.6999016",
"0.69803816",
"0.6916096",
"0.6909071",
"0.6856432",
"0.6856432",
"0.6840503",
"0.6798197",
"0.67841005",
"0.67634654",
"0.67485744",
"0.674... | 0.7236813 | 3 |
Get database info. (str|None) key (mixed) | def info(self, key = None):
return self.client.get(self.name).getBodyData(key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, key):\n if self.db is None:\n self._init()\n return self.db[key]",
"def dbinfo(self):\n data = self._http_get(\"dbInfo\")\n return data.json()",
"def get(self, key):\n value = self.driftwood.cache.download(\"DB:\"+key) # Check if the value is cached.... | [
"0.70179176",
"0.69876987",
"0.6937808",
"0.6894777",
"0.6870712",
"0.6760878",
"0.67522407",
"0.6612673",
"0.65385586",
"0.6511942",
"0.64921844",
"0.6481387",
"0.6422423",
"0.63685524",
"0.636529",
"0.63513875",
"0.63299954",
"0.63299394",
"0.6289464",
"0.6240409",
"0.62158... | 0.0 | -1 |
Create a new database. (bool) | def create(self):
return (True == self.client.put(self.name).getBodyData("ok")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create():\n\tcreate_db()",
"def create_db():\n db.create_all()\n print('Database structure created successfully')",
"def createdb():\n if database.exists():\n raise click.UsageError(\n click.style('Database already exists at {}.'\n .format(database.url), fg... | [
"0.83337766",
"0.82598007",
"0.82372695",
"0.81654936",
"0.81133765",
"0.8096522",
"0.8012044",
"0.7969226",
"0.79100245",
"0.79100245",
"0.79100245",
"0.79100245",
"0.79100245",
"0.79100245",
"0.79100245",
"0.79100245",
"0.79100245",
"0.79100245",
"0.79100245",
"0.7848301",
... | 0.0 | -1 |
Replicate database. (str) target (bool) targetCreate (mixed) | def replicate(self, target, targetCreate = True):
return self.client.post("/_replicate", None, {
"source" : self.name,
"target" : target,
"create_target": targetCreate,
}).getBodyData() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replicate(self, source, target, **params):\n replicator = cloudant.replicator.Replication(self.cloudant_client)\n source_db = Database(self.cloudant_client, source)\n target_db = Database(self.cloudant_client, target)\n return replicator.create_replication(source_db, target_db, **pa... | [
"0.7249406",
"0.68904024",
"0.64122343",
"0.60974616",
"0.5874705",
"0.5838073",
"0.5760138",
"0.56065917",
"0.5582746",
"0.5554158",
"0.5514307",
"0.5511637",
"0.5496934",
"0.5466124",
"0.54082936",
"0.54078144",
"0.5349957",
"0.5330608",
"0.5330608",
"0.5318922",
"0.5315699... | 0.75178003 | 0 |
Get a document by given key (docid). (str) key (mixed) | def getDocument(self, key):
data = self.client.get(self.name +"/_all_docs", {
"include_docs": True,
"key" : "\"%s\"" % util.quote(key),
}).getBodyData()
try:
return data["rows"][0]
except: pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_by_id(key):\n key = KeyModel(key)\n key.validate()\n return {\"text\": repository.get_doc(COLLECTION_NAME, key.to_dict())}",
"def _get_doc_key(self, doc_id, key):\n cursor = self.connection.cursor()\n cursor.execute(\n \"SELECT {} FROM documents WHERE id = ?\".format(key... | [
"0.8314795",
"0.8264005",
"0.7100072",
"0.70551383",
"0.69726807",
"0.685477",
"0.6811178",
"0.6808184",
"0.6733314",
"0.6727457",
"0.6324252",
"0.62639403",
"0.6240559",
"0.62122256",
"0.61395997",
"0.6134667",
"0.61335945",
"0.6122954",
"0.61188513",
"0.60682803",
"0.603660... | 0.789013 | 2 |
Get all documents by given query options. If keys params provided, request for documents by given keys. (dict) query (list) keys (mixed) | def getDocumentAll(self, query = {}, keys = []):
query = query or {}
if "include_docs" not in query:
query["include_docs"] = True
if not keys:
return self.client.get(self.name +"/_all_docs", query)
else:
return self.client.post(self.name +"/_all_docs", query,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getQuery(self, keys, any):\n operator = 'or' if any else 'and'\n def _and(lhs, rhs): return (lhs & rhs)\n def _or(lhs, rhs): return (lhs | rhs)\n join = {'and': _and, 'or': _or}[operator]\n iter = keys.iteritems()\n key, val = iter.next()\n query = (where(key) == val)\n for key, value ... | [
"0.63462067",
"0.6236286",
"0.61819315",
"0.6042806",
"0.5950434",
"0.5912153",
"0.5910383",
"0.58933896",
"0.58612514",
"0.5856646",
"0.58252406",
"0.57792425",
"0.5764174",
"0.5743013",
"0.5715739",
"0.5676636",
"0.5655873",
"0.5646454",
"0.5639526",
"0.5632748",
"0.5625158... | 0.74887514 | 0 |
Create a document. (mixed) document (mixed|dict|None) | def createDocument(self, document):
data = self.createDocumentAll([document])
try:
return data[0]
except: pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_document(self):\n # set single values\n if len(self.field_values) > 0:\n self._set_field_values()\n\n # set multi values\n if len(self.block_field_values) > 0:\n self._set_multi_field_values()\n\n self.field_values = {}\n self.block_field_v... | [
"0.77244157",
"0.7691563",
"0.76078093",
"0.75448394",
"0.7497625",
"0.74059784",
"0.7292055",
"0.6920336",
"0.6887969",
"0.6811379",
"0.67622185",
"0.6626416",
"0.65347296",
"0.6533986",
"0.6524472",
"0.64461523",
"0.64386547",
"0.6436524",
"0.6423536",
"0.63911057",
"0.6388... | 0.7777444 | 0 |
Create multiple documents. (list) documents (mixed) | def createDocumentAll(self, documents):
docs = []
for document in documents:
if isinstance(document, couch.Document):
document = document.getData()
# this is create method, no update allowed
if "_rev" in document: del document["_rev"]
if "_deleted" in doc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createMultipleDocuments(cred, payload):\n url = cred.base_url + \"documents:commit\"\n data = { 'writes': [] }\n\n for path, fieldData in payload.iteritems():\n pathData = createFirestoreDataObject(cred, path, fieldData)\n del pathData['updateMask']\n data['writes'].append(pathDat... | [
"0.78010774",
"0.7073005",
"0.68392444",
"0.66553426",
"0.6612657",
"0.6597123",
"0.65874046",
"0.651352",
"0.64082724",
"0.64022493",
"0.6401017",
"0.635387",
"0.6344267",
"0.6334641",
"0.63181096",
"0.62612283",
"0.6239612",
"0.622958",
"0.62243754",
"0.6214315",
"0.6211875... | 0.75502867 | 1 |
Update a document. (mixed) document (mixed|dict|None) (Exception) | def updateDocument(self, document):
data = self.updateDocumentAll([document])
try:
return data[0]
except: pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_document(self):\n pass",
"def update_document(self, database, collection, _id, document):\n r = self.__get_response(settings.UPD_DOC,\n {\"db\": database, \"col\": collection, \"id\": str(_id)},\n data=document)\n if r[\"status\"] == 200:\n return ... | [
"0.8244296",
"0.81278163",
"0.80653954",
"0.80026454",
"0.77117115",
"0.7609541",
"0.7524039",
"0.7359426",
"0.73501",
"0.72596943",
"0.70607513",
"0.6978547",
"0.6936055",
"0.68760943",
"0.6840614",
"0.6819702",
"0.6771791",
"0.670879",
"0.67000234",
"0.66932553",
"0.6665531... | 0.7978994 | 4 |
Update multiple documents. (list) documents (mixed) (Exception) | def updateDocumentAll(self, documents):
docs = []
for document in documents:
if isinstance(document, couch.Document):
document = document.getData()
# these are required params
if "_id" not in document or "_rev" not in document:
raise Exception("Both _id & ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateMultipleDocuments(cred, payload):\n\n url = cred.base_url + \"documents:commit\"\n data = { 'writes': [] }\n\n for path, fieldData in payload.iteritems():\n pathData = createFirestoreDataObject(cred, path, fieldData)\n data['writes'].append(pathData)\n \n makeRequest(cred, ur... | [
"0.78099144",
"0.7534766",
"0.75062966",
"0.7235758",
"0.7190231",
"0.7041025",
"0.6973437",
"0.68992174",
"0.68857944",
"0.6773296",
"0.6708585",
"0.6685556",
"0.6675647",
"0.65449",
"0.65124184",
"0.6472734",
"0.6444656",
"0.64238936",
"0.64129144",
"0.63841826",
"0.6369809... | 0.7975772 | 0 |
Delete a document. (mixed) document (mixed|dict|None) (Exception) | def deleteDocument(self, document):
data = self.deleteDocumentAll([document])
try:
return data[0]
except: pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_document(self):\n pass",
"def delete_document(self, document):\n assert isinstance(document, pylastica.document.Document), \"document must be a Document object: %r\" % document\n options = document.get_options([\n 'version',\n 'version_type',\n 'ro... | [
"0.854854",
"0.7985816",
"0.79602367",
"0.77905333",
"0.7671771",
"0.76135665",
"0.7500454",
"0.7358197",
"0.720484",
"0.7169715",
"0.71652853",
"0.7159339",
"0.7127536",
"0.71197265",
"0.7083857",
"0.70511234",
"0.70165825",
"0.7002135",
"0.69746053",
"0.6959095",
"0.6949389... | 0.83614945 | 1 |
Delete multiple documents. (list) documents (mixed) (Exception) | def deleteDocumentAll(self, documents):
docs = []
for document in documents:
if isinstance(document, couch.Document):
document = document.getData()
# just add "_deleted" param into document
document["_deleted"] = True
docs.append(document)
return self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deleteDocument(cred, documentPaths):\n for documentPath in documentPaths:\n url = cred.base_url + \"documents/\" + documentPath\n\n makeRequest(cred, url, 'DELETE')",
"def delete(self, docs: DocumentArray, *args, **kwargs):\n cursor = self.connection.cursor()\n psycopg2.extras.... | [
"0.75507",
"0.7483352",
"0.7301912",
"0.7285418",
"0.72843164",
"0.72680336",
"0.7206066",
"0.70919824",
"0.7041331",
"0.703872",
"0.6864328",
"0.6850383",
"0.68409914",
"0.6829072",
"0.6810127",
"0.67259806",
"0.67087394",
"0.6707566",
"0.66987157",
"0.6647907",
"0.6610914",... | 0.76793355 | 0 |
Get database changes. (dict|None) query (list) docIds (mixed) | def getChanges(self, query = {}, docIds = []):
if not docIds:
return self.client.get(self.name +"/_changes", query).getBodyData()
query = query or {}
# ensure query filter
if "filter" not in query:
query["filter"] = "_doc_ids"
return self.client.post(self.name +"/_chang... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_changes(db):\n changes = db['changes']\n\n for c in changes.find():\n yield Change(c)",
"def get_documents() -> list[Document]:\n g.ledger.changed()\n return [e for e in g.filtered.entries if isinstance(e, Document)]",
"def changelog(database: Database, nr_changes: int, **uuids):\n ... | [
"0.6487273",
"0.64745814",
"0.62022734",
"0.6122241",
"0.6058865",
"0.6057436",
"0.5836886",
"0.580801",
"0.57459617",
"0.56311685",
"0.56311685",
"0.561473",
"0.5611481",
"0.5547698",
"0.55470645",
"0.5528323",
"0.5522995",
"0.5508942",
"0.5460746",
"0.5379281",
"0.5360777",... | 0.75472516 | 0 |
Compact database. (str) ddoc mixed | def compact(self, ddoc = ""):
return self.client.post(self.name +"/_compact/"+ ddoc).getBodyData() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_DB(self, doc_files):\n\t\tcompteur=0\n\t\tdoc_name=doc_files+'doc_'+str(compteur)+'.txt'\n\t\twhile os.path.exists(doc_name):\n\t\t doc=Doc(doc_name)\n\t\t self.DB.add_doc(doc)\n\t\t compteur+=1\n\t\t doc_name=doc_files+'doc_'+str(compteur)+'.txt'\n\t\tprint \"Number of documents in the Data Base: \"... | [
"0.55888885",
"0.55718595",
"0.5545751",
"0.5450331",
"0.5441021",
"0.53697366",
"0.52911764",
"0.52885437",
"0.52682585",
"0.5236551",
"0.5206599",
"0.52048665",
"0.518499",
"0.5125269",
"0.5121712",
"0.5114919",
"0.51134604",
"0.5107076",
"0.5075558",
"0.50194037",
"0.50088... | 0.675761 | 0 |
View cleanup, so remove unneded view index files. (mixed) | def viewCleanup(self):
return self.client.post(self.name +"/_view_cleanup").getBodyData() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clearViews(request):\n return redirect(\"home\")",
"def cleanup(self):\n index_id = self.params[\"index_id\"]\n\n # Remove the index document from the database.\n self.db.indexes.delete_one({\"_id\": index_id})\n\n self.dispatch(\"indexes\", \"delete\", [index_id])\n\n q... | [
"0.6842255",
"0.6781138",
"0.6723472",
"0.6611905",
"0.6464315",
"0.63532996",
"0.6257693",
"0.6242239",
"0.61868984",
"0.6119992",
"0.6114376",
"0.60640466",
"0.6026558",
"0.6004134",
"0.6001217",
"0.5975733",
"0.59358555",
"0.58973235",
"0.58761585",
"0.5762732",
"0.5712189... | 0.7383045 | 0 |
Create (and execute) a temporary view. (string) map (string|None) reduce (mixed) | def viewTemp(self, map, reduce = None):
return self.client.post(self.name +"/_temp_view", None,
{"map":map, "reduce":reduce}).getBodyData() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_map_reduce(self):\n outfile = cStringIO.StringIO()\n var_order = [2,1,0]\n\n \n # Write out in the order 2, 1, 0. In a normal program those constants\n # would come from an enum indicating the order in which the fields\n # appear in schema\n aggregator = lr... | [
"0.50765437",
"0.50461334",
"0.48576868",
"0.48564032",
"0.48163113",
"0.47419778",
"0.47339833",
"0.47279567",
"0.4608937",
"0.4591241",
"0.45833737",
"0.4578122",
"0.4565904",
"0.44983184",
"0.44623956",
"0.44551846",
"0.44538876",
"0.44160914",
"0.44105223",
"0.44015622",
... | 0.6233113 | 0 |
Get the current security object of the database. (mixed) | def getSecurity(self):
return self.client.get(self.name +"/_security").getBodyData() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_security(self):\n return self.cloudant_database.get_security_document()",
"def security(self):\n return self._security",
"def security_class(self):\n return self._security_class",
"def get_security(self, security_id: str) -> Security:\n return self.session.get_security(sel... | [
"0.7439619",
"0.71845263",
"0.70937705",
"0.6900253",
"0.61629117",
"0.60930294",
"0.6086127",
"0.6086127",
"0.6058834",
"0.6051057",
"0.6030994",
"0.59401894",
"0.59401894",
"0.59401894",
"0.5932471",
"0.5864239",
"0.5863935",
"0.5863935",
"0.5863935",
"0.5863935",
"0.586393... | 0.63126576 | 4 |
Set the security object for the database. (dict) admins (dict) members (mixed) (Exception) | def setSecurity(self, admins = {}, members = {}):
admins, members = admins or {}, members or {}
if ("names" not in admins or "roles" not in admins
or "names" not in members or "roles" not in members):
raise Exception("Specify admins and/or members with names=>roles fields!")
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_security(self, secobj):\n with SecurityDocument(self.cloudant_database) as sec_doc:\n # context manager saves\n for key in sec_doc:\n del sec_doc[key]\n for k, v in secobj.items():\n sec_doc[k] = v\n return self.get_security()",
... | [
"0.71343416",
"0.6238021",
"0.5764386",
"0.5729426",
"0.5572113",
"0.555214",
"0.5530345",
"0.55035365",
"0.54517037",
"0.5408705",
"0.5408705",
"0.53911316",
"0.5369847",
"0.53649384",
"0.5352794",
"0.53076476",
"0.5307175",
"0.53050363",
"0.5276571",
"0.52599055",
"0.524271... | 0.71073496 | 1 |
Permanently remove the references to deleted documents from the database. (str) docId (list) docRevs (mixed) | def purge(self, docId, docRevs):
return self.client.post(self.name +"/_purge", None,
{docId: docRevs}).getBodyData() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self, doc_id, doc_rev):\n headers = {'If-Match': doc_rev}\n url = '/'.join([self.url, self.db, doc_id])\n r = requests.delete(url, headers=headers)\n if r.status_code != 200:\n raise Exception(\"HTTP \" + str(r.status_code))",
"def delete_docs(self, docs, empty_o... | [
"0.68039834",
"0.65360206",
"0.6525212",
"0.6505973",
"0.6444762",
"0.6378858",
"0.6366382",
"0.6346002",
"0.6328677",
"0.6302514",
"0.6301834",
"0.6259889",
"0.62486005",
"0.61599386",
"0.6085523",
"0.60242635",
"0.6024021",
"0.6020497",
"0.5949303",
"0.585777",
"0.5822132",... | 0.70110476 | 0 |
Get the document revisions that do not exist in the database. (str) docId (list) docRevs (mixed) | def getMissingRevisions(self, docId, docRevs):
return self.client.post(self.name +"/_missing_revs", None,
{docId: docRevs}).getBodyData() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMissingRevisionsDiff(self, docId, docRevs):\n return self.client.post(self.name +\"/_revs_diff\", None,\n {docId: docRevs}).getBodyData()",
"def getREVIssues(db):\n return map(trimmedREVDoc,\n db.reviews.find({\"done\": False, \"lgtms\": {\"$exists\": False}}))",
"def get_d... | [
"0.77465665",
"0.64262056",
"0.5819118",
"0.57928604",
"0.5722721",
"0.55840975",
"0.54831105",
"0.5478584",
"0.5419591",
"0.5378559",
"0.5261083",
"0.5253438",
"0.52523065",
"0.5240468",
"0.519454",
"0.5144665",
"0.5143659",
"0.514143",
"0.5111656",
"0.50992197",
"0.508413",... | 0.82235867 | 0 |
Get the subset of those that do not correspond to revisions stored in the database. (str) docId (list) docRevs (mixed) | def getMissingRevisionsDiff(self, docId, docRevs):
return self.client.post(self.name +"/_revs_diff", None,
{docId: docRevs}).getBodyData() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMissingRevisions(self, docId, docRevs):\n return self.client.post(self.name +\"/_missing_revs\", None,\n {docId: docRevs}).getBodyData()",
"def get_unlabelled_documents_queryset(self):\n queryset = self.get_queryset()\n\n # Retrieve labelled IDs\n labelled_ids = self.get_... | [
"0.6968676",
"0.62757945",
"0.6029085",
"0.60112655",
"0.5796243",
"0.5786746",
"0.5634135",
"0.56114686",
"0.54787636",
"0.5477941",
"0.5468216",
"0.54656684",
"0.5433515",
"0.53004605",
"0.52851826",
"0.52675676",
"0.52418417",
"0.50862885",
"0.5062252",
"0.49948937",
"0.49... | 0.65350854 | 1 |
Get the current "revs_limit" (revision limit) setting. (int) | def getRevisionLimit(self):
return self.client.get(self.name +"/_revs_limit").getBodyData() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setRevisionLimit(self, limit):\n return self.client.put(self.name +\"/_revs_limit\", None, limit).getBodyData()",
"def get_limit(self):\n return self.limit",
"def get_limit(self):\n return self._limit",
"def get_limit(self):\n return self._limit",
"def limit(self):\n re... | [
"0.77255625",
"0.7021097",
"0.6959421",
"0.6959421",
"0.6694741",
"0.6694741",
"0.6430344",
"0.6255963",
"0.6254812",
"0.61720395",
"0.6131563",
"0.6104614",
"0.60650253",
"0.59897816",
"0.59867847",
"0.5967378",
"0.5967092",
"0.59318274",
"0.5925763",
"0.59253764",
"0.592110... | 0.826944 | 0 |
Set the current "revs_limit" (revision limit) setting. (int) limit (mixed) | def setRevisionLimit(self, limit):
return self.client.put(self.name +"/_revs_limit", None, limit).getBodyData() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_limit(self, limit):\n self.limit = limit\n self._prune()",
"def getRevisionLimit(self):\n return self.client.get(self.name +\"/_revs_limit\").getBodyData()",
"def SetLimit(self, *args):\n return _BRepAlgo.BRepAlgo_NormalProjection_SetLimit(self, *args)",
"def limit(self, lim... | [
"0.6917625",
"0.6857605",
"0.66053945",
"0.6602822",
"0.6602822",
"0.6602822",
"0.6594543",
"0.6535649",
"0.65266085",
"0.64890593",
"0.6478399",
"0.63712174",
"0.6257707",
"0.60748005",
"0.6017279",
"0.6012214",
"0.5952001",
"0.5936896",
"0.59314567",
"0.59136355",
"0.590478... | 0.87726605 | 0 |
Given a list of timestamps, return the estimated beatperminute | def estimate_bpm(D):
if len(D) < 2*ignore:
return 0
else:
return 1/np.mean(np.diff(D))*60 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rate(timestamps):\n return (timestamps[1, 1] - timestamps[0, 1]) / (timestamps[1, 0])",
"def part1() -> int:\n longest_sleeper = max(sleep_times, key=lambda g: len(sleep_times[g]))\n sleepiest_minute = max(\n sleep_times[longest_sleeper], key=sleep_times[longest_sleeper].count)\n\n ret... | [
"0.6555634",
"0.6002977",
"0.5905045",
"0.5784351",
"0.57114905",
"0.57070845",
"0.56152827",
"0.56140614",
"0.5578334",
"0.5552795",
"0.5544566",
"0.5522906",
"0.54752254",
"0.5463913",
"0.545873",
"0.5453876",
"0.5378447",
"0.5355978",
"0.53555685",
"0.5316064",
"0.52399397... | 0.5490882 | 12 |
Scans a physical disk at disk_url, creates a scan file and saves it at scan_file_dir Scan file can be converted into a SemanticDiskEngine object, but only NTFS volumes will have any data at all, and only metadata. | def scan_disk(disk_url, scan_file_dir):
# make the dir if it doesn't exist
if not os.path.exists(scan_file_dir):
os.makedirs(scan_file_dir)
# open up the image
img = pytsk3.Img_Info(url=disk_url)
# get the volume info
VOL_INFO = pytsk3.Volume_Info(img)
# print out some i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scan_disks():\n disks = get_disks()\n\n # Get disk details\n for disk in disks:\n # Get partition style\n disk['Table'] = get_table_type(disk)\n\n # Get disk name/model and physical details\n disk.update(get_disk_details(disk))\n\n # Get partition info for disk\n disk['Partitions'] = get_p... | [
"0.5176828",
"0.5053886",
"0.4732638",
"0.47221076",
"0.4695053",
"0.4614912",
"0.45604998",
"0.45434868",
"0.4539425",
"0.4539425",
"0.45263734",
"0.45119947",
"0.45113498",
"0.45068026",
"0.446161",
"0.4457252",
"0.44203302",
"0.44179124",
"0.4412884",
"0.43939742",
"0.4379... | 0.7032303 | 0 |
Sparse files for unallocated space or unsupported filesystems | def save_sparse(sparse_number, scan_file_dir, len_bytes):
logger.info("Saving sparse data.")
fname = os.path.join(scan_file_dir, "sparse"+str(sparse_number))
f = open(fname, 'ab')
f.truncate(len_bytes)
f.close()
return fname | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_sparse(f, vol=DMG_VOLUME_NAME, fs=DMG_DEFAULT_FS, mountpoint=DMG_MOUNT, dry_run=ARGS.dry_run):\n result = None\n sparseimage = Path('{f}.sparseimage'.format(f=f)) if not str(f).endswith('.sparseimage') else Path(f)\n\n if not isinstance(mountpoint, Path):\n mountpoint = Path(mountpoint)\... | [
"0.60973555",
"0.58297205",
"0.5687104",
"0.5451819",
"0.54395884",
"0.5424618",
"0.5384249",
"0.5364704",
"0.5326901",
"0.53123873",
"0.51812476",
"0.5156405",
"0.51373065",
"0.5120344",
"0.51124233",
"0.50768536",
"0.506891",
"0.50668067",
"0.50525",
"0.50525",
"0.5042461",... | 0.60911804 | 1 |
Function to insert values into a table. | def info_insert(tbl_mgr, table_str, row_arr):
val_str = "("
for col in range(len(row_arr)):
if col > 0:
val_str += ", "
if row_arr[col] is None:
val_str += "NULL"
else:
val_str += "'" + row_arr[col] + "'"
val_str += ")"
return tbl_mgr.insert_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self,table,values):\n self.connect.execute(self.insert_disc[table],values)\n self.connect.commit()",
"def insert_values():\n pass",
"def insert(self, tablename, columns, values):\n\n length = len(columns)\n if length != 0:\n placeholder = ['?'] * length\... | [
"0.81872624",
"0.7828157",
"0.7670675",
"0.76484233",
"0.7530199",
"0.74803674",
"0.7438946",
"0.7412622",
"0.7350234",
"0.72913873",
"0.72789294",
"0.7234165",
"0.7224627",
"0.720949",
"0.71930563",
"0.7153607",
"0.71359974",
"0.70893145",
"0.70855266",
"0.70855266",
"0.7059... | 0.6329544 | 72 |
Generates a link allowing the data in a given panda dataframe to be downloaded | def get_table_download_link(xlsx_file):
data = open(xlsx_file, 'rb').read()
base64_encoded = base64.b64encode(data).decode('UTF-8')
# b64 = base64.b64encode(csv.encode()).decode() # some strings <-> bytes conversions necessary here
href = f'<a href="data:file/xlsx;base64,{base64_encoded}" download... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_table_download_link(df, file_name):\n if 'embedding_average' in df.columns:\n df = df.drop(columns='embedding_average')\n # df = results_output.drop(columns='embedding_average')\n # csv = df.to_csv(index=False)\n # b64 = base64.b64encode(csv.encode()).decode() # some strings <-> bytes c... | [
"0.787067",
"0.7815045",
"0.77096945",
"0.7707009",
"0.7706094",
"0.76888394",
"0.7660536",
"0.7650524",
"0.76439977",
"0.7624979",
"0.7611864",
"0.7605457",
"0.75974107",
"0.7584136",
"0.7568541",
"0.74671227",
"0.7449035",
"0.73943675",
"0.7307776",
"0.7290543",
"0.68125397... | 0.6422487 | 29 |
Computes the element with the maximum count | def mode(y):
if len(y)==0:
return -1
else:
return stats.mode(y.flatten())[0][0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_max(alon):\n return count_max_acc(alon, alon[0], 0, 0)",
"def question_24(list_num: int) -> int:\n return max(list_num, key=list_num.count)",
"def max(self):\n max = 0\n a = self.array_form\n for i in xrange(len(a)):\n if a[i] != i and a[i] > max:\n ... | [
"0.7012061",
"0.6818691",
"0.67945176",
"0.67868096",
"0.6693529",
"0.66694856",
"0.6477938",
"0.6439545",
"0.64226174",
"0.6417511",
"0.64135456",
"0.6355612",
"0.635108",
"0.635108",
"0.6347511",
"0.63298154",
"0.63119894",
"0.6311235",
"0.63071495",
"0.6299886",
"0.6288605... | 0.0 | -1 |
Computes the Euclidean distance between rows of 'X' and rows of 'Xtest' | def euclidean_dist_squared(X, Xtest):
return np.sum(X**2, axis=1)[:,None] + np.sum(Xtest**2, axis=1)[None] - 2 * np.dot(X,Xtest.T)
# without broadcasting:
# n,d = X.shape
# t,d = Xtest.shape
# D = X**2@np.ones((d,t)) + np.ones((n,d))@(Xtest.T)**2 - 2*X@Xtest.T | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_distances(self, X):\n num_test = X.shape[0]\n num_train = self.X_train.shape[0]\n dists = np.zeros((num_test, num_train))\n \n sum_test_square = np.sum(np.square(X), axis=1).reshape(-1, 1)\n sum_train_square = np.sum(np.square(self.X_train), axis=1).reshape(-1, 1... | [
"0.7366164",
"0.73052317",
"0.7162334",
"0.7152637",
"0.7010976",
"0.6955845",
"0.6955845",
"0.69257826",
"0.6906152",
"0.6888624",
"0.6838205",
"0.67319787",
"0.67113405",
"0.6625997",
"0.6581194",
"0.65710795",
"0.65633863",
"0.6519284",
"0.6498425",
"0.6447752",
"0.6427021... | 0.7961684 | 0 |
Update Stack's currency with a given value. | def updateCurrency(self, currency: str, value: str) -> None:
if currency == "USDT":
self._USDT = float(value)
elif currency == "ETH":
self._ETH = float(value)
elif currency == "BTC":
self._BTC = float(value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_price(self, value): \n value = self.price",
"def format_currency(value, currency=\"USD\"):\n symbol = CURRENCIES[currency][\"symbol\"]\n\n return \"%s%s\" % (symbol, round(value) / 100)",
"async def set_currency(self, currency: str):\n json = {**self.get_data(), \"currencyId\": c... | [
"0.60010123",
"0.5893632",
"0.57380164",
"0.57254374",
"0.57075036",
"0.56984043",
"0.56984043",
"0.56984043",
"0.56984043",
"0.56679785",
"0.56300604",
"0.54938513",
"0.5454203",
"0.5446152",
"0.543147",
"0.5414669",
"0.5411957",
"0.5407819",
"0.5390974",
"0.53639185",
"0.53... | 0.7322223 | 0 |
Update Stack's currencies from the given command. | def update_s(self, updateCommand: str) -> None:
currenciesUpdate = updateCommand.split(sep=",")
if len(currenciesUpdate) is not 3:
Logger("Might update the three currencies.")
return
for currencyUpdate in currenciesUpdate:
update = currencyUpdate.split(sep="... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_settings(command):\n namespace = app.main(command)\n assert namespace.command == 'u' or namespace.command == \"updatesettings\"",
"def update_stock(option, stock):\n lowered_opt = option.lower()\n if lowered_opt == 'f':\n stock[\"five\"]+=1\n elif lowered_opt == 'o':\n sto... | [
"0.5118964",
"0.50880444",
"0.5078902",
"0.50084573",
"0.50015914",
"0.49701083",
"0.49340314",
"0.49003208",
"0.48828048",
"0.48751676",
"0.48618007",
"0.48497853",
"0.48473632",
"0.4832575",
"0.48187694",
"0.48165464",
"0.48111126",
"0.4809619",
"0.4794288",
"0.4759543",
"0... | 0.64856386 | 0 |
Compute center from selection. | def compute_center(self, mole_object):
if mole_object.plugin_type == "PyMOL":
sel = PymolPlugin.PymolPlugin().get_model('all')
cnt = len(sel.atom)
else:
sel = ChimeraPlugin.ChimeraPlugin().select()
cnt = len(ChimeraPlugin.ChimeraPlugin().current_at... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_center_of_coordinates(selection='(all)', state=-1):\n # find middle x, y, z coordinate of the selection\n state = utils.int_to_state(state)\n minc, maxc = cmd.get_extent(selection, state=state)\n coc = [float(l + (u - l) / 2.0) for l, u in zip(minc, maxc)]\n return coc",
"def calculate_ce... | [
"0.75782245",
"0.6908749",
"0.6876772",
"0.68412405",
"0.6772314",
"0.67576814",
"0.67576385",
"0.67170984",
"0.6691908",
"0.6674895",
"0.6657364",
"0.6654274",
"0.66452104",
"0.66253275",
"0.65939564",
"0.6561643",
"0.6546516",
"0.65395445",
"0.6538209",
"0.653681",
"0.65068... | 0.6692934 | 8 |
Show center of comutation. | def show_crisscross(self, mole_object):
if mole_object.plugin_type == "PyMOL":
obj = [
LINEWIDTH, 3,
BEGIN, LINE_STRIP,
VERTEX, float(float(self.point_x.get()) - 0.5), float(self.point_y.get()), float(self.point_z.get()),
VERTEX... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center(self):\n return self['center']",
"def showCenter(self, window, color=None, mode=None):\n if not color: color = self.center_color\n if not mode: mode = self.center_mode\n self.center.show(window, mode=mode, color=color)",
"def GetCenter(self):\n ...",
"def GetCent... | [
"0.7249889",
"0.6969353",
"0.6967628",
"0.6967628",
"0.6967628",
"0.6967628",
"0.6949013",
"0.67202693",
"0.67143965",
"0.6710556",
"0.66110283",
"0.6607382",
"0.65840524",
"0.65836847",
"0.65259933",
"0.650603",
"0.64327586",
"0.63326114",
"0.6317418",
"0.6310811",
"0.627805... | 0.0 | -1 |
Reset all changes (used on restart) | def reset(self):
self.settings = None
self.sublime_settings = None
self.settings_base = "Javatar.sublime-settings"
self.sublime_base = "Preferences.sublime-settings" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n \n pass",
"def reset(self):\n ...",
"def reset(self):\n ...",
"def _reset(self, *args):\n self.dirty = True",
"def reset():",
"def reset():",
"def reset():",
"def reset(self):\n\t\tpass",
"def reset():\r\n pass",
"def reset(self):\n ... | [
"0.8022717",
"0.80051595",
"0.80051595",
"0.7975329",
"0.7972136",
"0.7972136",
"0.7972136",
"0.7899253",
"0.7890797",
"0.78901154",
"0.78901154",
"0.78901154",
"0.78901154",
"0.78901154",
"0.78901154",
"0.78901154",
"0.78901154",
"0.78901154",
"0.78901154",
"0.78901154",
"0.... | 0.0 | -1 |
Read all settings from files | def startup(self):
self.settings = sublime.load_settings(self.settings_base)
self.sublime_settings = sublime.load_settings(self.sublime_base) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_settings(self):\n self.settings = read_settings(self.settings_path)",
"def read_settings():\n \n settings = OrdDic()\n settings.update(json.load(open(\"resources/files/settings.txt\", \"r\")))\n\n ## OLD WAY BELOW\n\n #r = open(\"resources/files/settings.txt\", ... | [
"0.75103927",
"0.7295505",
"0.7091795",
"0.6900407",
"0.680928",
"0.6775323",
"0.6665875",
"0.66451675",
"0.66379684",
"0.6604915",
"0.65468645",
"0.6512434",
"0.650206",
"0.6477879",
"0.6474246",
"0.6459",
"0.64446545",
"0.6431422",
"0.6418008",
"0.64051664",
"0.6396256",
... | 0.0 | -1 |
Upgrade the outdated settings | def upgrade_settings(self, keys):
upgradable_keys = {
"project_dir": "%root_dir%",
"source_folder": "%source_folder%",
"packages_path": "%packages_path%",
"sep": "%sep%",
"$": "$"
}
for key in keys:
value, from_global = self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_settings(self):\n\n param = \"settings.py\"\n self._check_path_availability([\"get_settings_dir\", \"get_settings_dir_to\"])\n self.updater.update_files(\n self.analizer.get_settings_dir(),\n self.analizer.get_settings_dir_to(),\n param,\n )\n... | [
"0.7298722",
"0.7031012",
"0.7031012",
"0.65588164",
"0.6543409",
"0.6543409",
"0.6377971",
"0.6347385",
"0.6260175",
"0.6242316",
"0.6119386",
"0.60469204",
"0.60413337",
"0.6027217",
"0.5955511",
"0.5950166",
"0.59306175",
"0.5926366",
"0.5903038",
"0.58640105",
"0.5844353"... | 0.6841634 | 3 |
Returns a value in default settings file | def get_global(self, key, default=None, as_tuple=False):
if as_tuple:
return (self.get_global(key, default, as_tuple=False), True)
else:
return self.settings.get(key, default) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_setting_value(self, key, default = None):\n \n if not \"settings\" in self.configuration or not key in self.configuration['settings']:\n return default\n \n return self.configuration['settings'][key]",
"def get(self, key, default=None):\n return self.settings.get... | [
"0.7748326",
"0.76666",
"0.7468772",
"0.7411909",
"0.73779166",
"0.7375401",
"0.7211646",
"0.7130592",
"0.7078822",
"0.7017662",
"0.6990456",
"0.69369453",
"0.6903834",
"0.6804834",
"0.6784414",
"0.6783358",
"0.6765874",
"0.6754751",
"0.6748902",
"0.67236185",
"0.67148525",
... | 0.6089976 | 88 |
Returns a value in project settings file | def get_local(self, key, default=None, as_tuple=False):
if as_tuple:
return (self.get_local(key, default, as_tuple=False), False)
else:
project_data = sublime.active_window().project_data()
if (project_data and "javatar" in project_data and
key in ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def settings():\n return _get_settings()[1]",
"def get_project_value(key, default_value=None):\r\n # Load project coniguration settings\r\n try:\r\n load_project_values()\r\n except RuntimeError:\r\n sublime.set_timeout(lambda: load_project_values(), 0)\r\n\r\n # Find value in project ... | [
"0.7651562",
"0.73200214",
"0.7067771",
"0.69836646",
"0.68459237",
"0.67755395",
"0.66721684",
"0.6671477",
"0.65649176",
"0.6564709",
"0.6528995",
"0.6528318",
"0.6519946",
"0.6495842",
"0.6494672",
"0.6466321",
"0.6431724",
"0.6427801",
"0.63764167",
"0.63681996",
"0.63494... | 0.0 | -1 |
Returns a value in Sublime Text's settings file | def get_sublime(self, key, default=None):
return self.sublime_settings.get(key, default) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def settings():\n return _get_settings()[1]",
"def get_setting_value(self, title, setting):\r\n return self.parser.get(title, setting)",
"def file_name(self):\n return self.name + '.sublime-settings'",
"def get_setting(which, default=None):\n settings = QSettings('USGS', 'guanoeditor')\n ... | [
"0.71429825",
"0.68833137",
"0.6775958",
"0.65221494",
"0.6432501",
"0.6207987",
"0.6183132",
"0.6104724",
"0.6102577",
"0.59805095",
"0.5975891",
"0.589315",
"0.5880934",
"0.58360827",
"0.5832989",
"0.5815088",
"0.5803238",
"0.5793106",
"0.57881093",
"0.5786521",
"0.57713073... | 0.7707067 | 0 |
Returns whether the settings contain a specified key | def has(self, key, from_global=None):
return self.get(key, from_global=from_global) is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains(self, key):\n return self.__config.contains(key)",
"def has_key(self, key):\n return key in self",
"def containsKey(self, key):\n return get(key) != None",
"def __contains__(self, key):\n return key in self._group._opts",
"def __contains__(self, key):\n r... | [
"0.8355248",
"0.7996474",
"0.7888765",
"0.7825089",
"0.7800999",
"0.7757456",
"0.7748888",
"0.77122355",
"0.7691761",
"0.7654982",
"0.76216596",
"0.75954455",
"0.75895786",
"0.75737417",
"0.75465983",
"0.75337666",
"0.7492835",
"0.74503034",
"0.74148536",
"0.7407489",
"0.7407... | 0.720088 | 40 |
Returns a value in settings | def get(self, key, default=None, from_global=None, as_tuple=False):
if from_global is None:
value = self.get(
key,
default=None,
from_global=False,
as_tuple=as_tuple
)
if (isinstance(value, tuple) and value[0] is... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def settings():\n return _get_settings()[1]",
"def get_setting_value(self, title, setting):\r\n return self.parser.get(title, setting)",
"def getValue(self, valueName):\n\t\treturn self.settings[valueName][0]",
"def get_setting(self, id):\n return __settings__.getSetting(id)",
"def setting(s... | [
"0.80842143",
"0.80742574",
"0.77294874",
"0.7547966",
"0.752184",
"0.7299969",
"0.7192908",
"0.7191574",
"0.71221507",
"0.7119327",
"0.7079211",
"0.69702846",
"0.69382447",
"0.68558466",
"0.6834664",
"0.68313074",
"0.6776904",
"0.6697164",
"0.66897684",
"0.6689722",
"0.66896... | 0.0 | -1 |
Set a value to specified key in settings | def set(self, key, val, to_global=False, fallback=True):
if to_global:
if val is None:
if self.settings.has(key):
self.settings.erase(key)
else:
# Return here so it won't wasting time saving old settings
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __setitem__(self, key, value):\n self.settings.set(key, value)",
"def set(self, key, value):",
"def set(self, key, value):",
"def set_setting(key, value):\n with sublime_haskell_settings as settings:\n settings[key] = value\n get_settings().set(key, value)\n save_settings()",
"de... | [
"0.81129986",
"0.76770437",
"0.76770437",
"0.75266355",
"0.71827185",
"0.71827054",
"0.7163596",
"0.71215695",
"0.70986235",
"0.7073633",
"0.70629996",
"0.70259386",
"0.7007894",
"0.7003608",
"0.69931805",
"0.6917034",
"0.6905877",
"0.68857306",
"0.68717545",
"0.6828506",
"0.... | 0.63296664 | 81 |
Returns the processed view's group and index | def get_view_index(self, key):
group_settings = self.get(key)
view_group = -1
view_index = -1
window = sublime.active_window()
view = window.active_view()
current_group, current_index = window.get_view_index(view)
for group_setting in group_settings:
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getGroupIndex(self):\n return copy.deepcopy(self._group_index)",
"def _getGroupIndex(self):\n return copy.deepcopy(self._group_index)",
"def get_debug_index(name=None):\r\n # Set group and index for each debug view\r\n breakpoint_group = get_value(S.KEY_BREAKPOINT_GROUP, -1)\r\n bre... | [
"0.6900552",
"0.6900552",
"0.65036124",
"0.638696",
"0.6258358",
"0.6208498",
"0.6133117",
"0.60072374",
"0.58788896",
"0.5853668",
"0.5841622",
"0.5803315",
"0.576409",
"0.5723506",
"0.5682181",
"0.56816834",
"0.56425756",
"0.5614514",
"0.5609213",
"0.55979174",
"0.55827665"... | 0.74922854 | 0 |
Returns whether settings are ready to be used | def ready(self):
return self.settings is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_settings(self):\n pass",
"def check_settings(self):\r\n pass",
"def is_setup(self):\n return self._market_data_sock_info.ready.is_set() and \\\n self._orders_sock_info.ready.is_set()",
"def configured(self):\n return self._optional or self.ready()",
"def ... | [
"0.76344365",
"0.76162714",
"0.7299227",
"0.7269583",
"0.7183383",
"0.7121698",
"0.70650893",
"0.7056003",
"0.703516",
"0.69944656",
"0.69864106",
"0.6983592",
"0.69819415",
"0.6971682",
"0.6948749",
"0.6941797",
"0.69299155",
"0.6927403",
"0.69120926",
"0.68935144",
"0.67944... | 0.86375195 | 0 |
Reads a 1line plain text file and populates a list with Process(). | def read_input(self, infile):
self.infile = open(infile, 'r')
input_list = None
for l in [line.strip('\n') for line in self.infile]:
input_list = l.split(' ')
pid = 0
for i in range(0, len(input_list), 2):
self.processes.append(Process(pid, in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_file(file_name):\n f_in = open(file_name)\n return list(map(lambda s: s.strip(), f_in.readlines()))",
"def process_data(file_object: TextIO) -> list:\n text_list = [line.replace('\\n', '').split(' ') for line in file_object]\n return text_list",
"def parse_file(self, file_path) -> list:... | [
"0.71494466",
"0.6954961",
"0.6860393",
"0.66333246",
"0.6562685",
"0.6529095",
"0.65073156",
"0.64306605",
"0.63948846",
"0.6388165",
"0.63848495",
"0.63636005",
"0.6334855",
"0.6304879",
"0.6304524",
"0.628761",
"0.6285325",
"0.62770015",
"0.6249658",
"0.62492687",
"0.62282... | 0.68063706 | 3 |
Exception.with_traceback(tb) set self.__traceback__ to tb and return self. | def with_traceback(self, tb): # real signature unknown; restored from __doc__
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def WrappedException(self) -> object:",
"def reraise(exception_class, e, traceback=None):\n try:\n e = exception_class(\"\" if e is None else e)\n if e.__traceback__ is not traceback:\n raise e.with_traceback(traceback)\n raise e\n finally:\n ... | [
"0.5987309",
"0.5953781",
"0.59018964",
"0.5863477",
"0.5807588",
"0.58008033",
"0.572044",
"0.57091415",
"0.569477",
"0.56432295",
"0.556439",
"0.537897",
"0.5359169",
"0.53149515",
"0.5295616",
"0.5262731",
"0.5262731",
"0.5257782",
"0.52253854",
"0.5209788",
"0.5207411",
... | 0.7416604 | 0 |
Create and return a new object. See help(type) for accurate signature. | def __new__(*args, **kwargs): # real signature unknown
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_object():\n return object()",
"def create(cls, _):\n return cls",
"def __newobj__(cls, *args):\n return cls.__new__(cls, *args)",
"def create(cls):\n pass\n return cls()",
"def __new__(cls):\n return object.__new__(cls)",
"def __new__(cls):\n return objec... | [
"0.7521635",
"0.74247146",
"0.7226771",
"0.72235626",
"0.7097113",
"0.7097113",
"0.70590734",
"0.70068395",
"0.6914946",
"0.6869231",
"0.6814115",
"0.6813175",
"0.6803347",
"0.6693966",
"0.6628847",
"0.65862906",
"0.65708584",
"0.6558201",
"0.65469146",
"0.654557",
"0.6541631... | 0.0 | -1 |
Implement setattr(self, name, value). | def __setattr__(self, *args, **kwargs): # real signature unknown
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __setattr__(self, name, value):\n self.set(**{name: value})",
"def set_attr(self, name, value):\n setattr(self, name, value)",
"def __setattr__(self, name, value):\n if not hasattr(self, name):\n raise AttributeError(\"'%s' object has no attribute '%s'\" % (type(self).__name... | [
"0.86881596",
"0.8361366",
"0.82908237",
"0.8286996",
"0.8224362",
"0.82046074",
"0.8100595",
"0.8100595",
"0.806975",
"0.8039054",
"0.8024018",
"0.7998455",
"0.79908824",
"0.7986897",
"0.79501677",
"0.7939762",
"0.7935037",
"0.7892338",
"0.7890024",
"0.779899",
"0.7754794",
... | 0.0 | -1 |
Removes all nonascii chars from a string Parameter | def asciify(text: str) -> str:
return "".join(
filter(
lambda x: x in list(string.ascii_letters) or x.isspace(),
unidecode.unidecode(text).lower()
)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize(instring):\r\n return instring.encode('ascii','replace')",
"def remove_non_ascii(word):\r\n if not isinstance(word, str):\r\n raise ValueError('The value passed is not a string')\r\n\r\n return unicodedata.normalize('NFKD', word).encode('ascii', 'ignore').decode('utf-8', 'ignore')",
... | [
"0.81141496",
"0.8072271",
"0.8054922",
"0.78692186",
"0.76751894",
"0.7537971",
"0.7509463",
"0.73111624",
"0.7304859",
"0.72943443",
"0.72550195",
"0.72165686",
"0.7211366",
"0.72005796",
"0.7196183",
"0.7172691",
"0.7162736",
"0.71434265",
"0.7138844",
"0.7135383",
"0.7135... | 0.0 | -1 |
Whether the identifier has a scope prefix. | def is_valid(self, identifier, lint_context):
scope_plugin = lint_context['plugins']['scope']
explicity = scope_plugin.get_explicity_of_scope_visibility(identifier)
is_valid = (scope_plugin.is_function_identifier(identifier) or
explicity is not ExplicityOfScopeVisibility.IM... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stillLookingForPrefix(self, prefix):\n return prefix in self._prefixToIdentifiers",
"def hasScope(self, name):",
"def hasNamespacePrefix(self, *args):\n return _libsbml.XMLToken_hasNamespacePrefix(self, *args)",
"def hasPrefix(self, *args):\n return _libsbml.XMLNamespaces_hasPrefix(self,... | [
"0.71096164",
"0.6891588",
"0.6729567",
"0.67228335",
"0.6604345",
"0.6509575",
"0.6445968",
"0.6350322",
"0.62630177",
"0.62455106",
"0.6244376",
"0.6153805",
"0.6144609",
"0.6130003",
"0.6113165",
"0.60817474",
"0.6057561",
"0.6045548",
"0.60363",
"0.60306555",
"0.60261106"... | 0.568618 | 65 |
Function to heuristic evaluation of state. | def evaluate(state):
if wins(state, COMP):
score = +1
elif wins(state, HUMAN):
score = -1
else:
score = 0
return score | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate(self, state):\n abstract",
"def evaluate(self) :\n for inp in self.inStates :\n if inp.getState() == 1 : return 1\n return 0",
"def evaluate(self) :\n for inp in self.inStates :\n if inp.getState() == 0 : return 0\n return 1",
"def evaluat... | [
"0.7699154",
"0.7341043",
"0.71370894",
"0.70947444",
"0.70398873",
"0.6997567",
"0.68989694",
"0.68934023",
"0.6736354",
"0.67123234",
"0.67123234",
"0.67123234",
"0.67123234",
"0.67123234",
"0.67123234",
"0.6671703",
"0.6591738",
"0.65109974",
"0.6458898",
"0.6458418",
"0.6... | 0.69093186 | 6 |
This function test if the human or computer wins | def game_over(state):
return wins(state, HUMAN) or wins(state, COMP) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkForWin(self):\n w = self.getWinner()\n if w == PLAYER or w == AI:\n # self.printBoard()\n # print('%d'%w + ' won!')\n return\n if w == Tie:\n # print('Tie')\n return",
"def check_if_game_over():\n # Calling check for winners.... | [
"0.74535036",
"0.73181516",
"0.72689044",
"0.72578865",
"0.7256983",
"0.71447664",
"0.70782626",
"0.7048773",
"0.7024273",
"0.7018341",
"0.7000439",
"0.69792455",
"0.69792455",
"0.69792455",
"0.6975942",
"0.6949253",
"0.6948959",
"0.6942385",
"0.69366336",
"0.693293",
"0.6907... | 0.7036436 | 8 |
Each empty cell will be added into cells' list | def empty_cells(state):
cells = []
for x, row in enumerate(state):
for y, cell in enumerate(row):
if cell == 0:
cells.append([x, y])
return cells | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty_cells(self) -> List[Cell]:\n return list(ob.pos[0] for ob in self.new_obs())",
"def get_empty_cells(grid):\n\tempty = []\n\tfor j,row in enumerate(grid):\n\t\tfor i,val in enumerate(row):\n\t\t\tif not val:\n\t\t\t\tempty.append((j,i))\n\treturn empty",
"def get_empty_cells(grid):\n empty =... | [
"0.794357",
"0.7524207",
"0.7348577",
"0.73234653",
"0.7297448",
"0.7279685",
"0.7155935",
"0.69855237",
"0.6946108",
"0.6896722",
"0.6891784",
"0.6829081",
"0.68175733",
"0.67509216",
"0.6622468",
"0.659703",
"0.6574073",
"0.65726584",
"0.6565587",
"0.65097904",
"0.6427765",... | 0.7264266 | 6 |
A move is valid if the chosen cell is empty | def valid_move(x, y):
if [x, y] in empty_cells(board):
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isLegalMove(self, column, state):\n \n for i in range(6):\n if state[i][column] == ' ':\n # once we find the first empty, we know it's a legal move\n return True\n \n # if we get here, the column is full\n return False",
"def move_va... | [
"0.74975675",
"0.72044504",
"0.7123773",
"0.70122266",
"0.6999459",
"0.698641",
"0.6952747",
"0.69518375",
"0.6944301",
"0.69423324",
"0.69382113",
"0.69361067",
"0.6933988",
"0.69228756",
"0.69140935",
"0.68995947",
"0.6898277",
"0.68812275",
"0.68639076",
"0.68425095",
"0.6... | 0.7653947 | 0 |
Set the move on board, if the coordinates are valid | def set_move(x, y, player, xi, yi):
if valid_move(x, y):
board[x][y] = player
board[xi][yi] = 0
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_move(self, board):\n user_input = self.get_user_input(\n 'coordinates of next move (x,y): '\n )\n move = self.transform_user_input(user_input)\n\n valid = board.move_is_valid(move)\n while not valid:\n user_input = self.get_user_input(\n ... | [
"0.7428019",
"0.71092373",
"0.7015963",
"0.70088",
"0.6936503",
"0.692291",
"0.68933105",
"0.688197",
"0.6787634",
"0.6764633",
"0.67580676",
"0.6747932",
"0.66932666",
"0.66889393",
"0.66844594",
"0.6678542",
"0.66688395",
"0.66686535",
"0.66652036",
"0.66585314",
"0.6657071... | 0.75921804 | 0 |
AI function that choice the best move | def minimax(state, depth, player):
if player == COMP:
best = [-1, -1, -infinity]
else:
best = [-1, -1, +infinity]
if depth == 0 or game_over(state):
score = evaluate(state)
return [-1, -1, score]
for cell in empty_cells(state):
x, y = cell[0], cell[1]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_best_move(state: GameState) -> None:",
"def minimax(board):\n #This function will return the best move. \n #If Ai is playing as X, I can reduce the processing time by creating a random first move. \n if (board == initial_state()):\n coord1 = randint(0,2)\n coord2 = randint(0,2)\n ... | [
"0.83686894",
"0.75552547",
"0.75352454",
"0.7524291",
"0.74875534",
"0.73716456",
"0.73589486",
"0.7354193",
"0.72988343",
"0.7243456",
"0.71988624",
"0.71960807",
"0.7193915",
"0.7154133",
"0.7140579",
"0.709039",
"0.7088791",
"0.70801204",
"0.70508504",
"0.7029258",
"0.702... | 0.0 | -1 |
Print the board on console | def render(state, c_choice, h_choice):
chars = {
2: h_choice,
1: c_choice,
0: ' '
}
str_line = '--------------------------------------------------'
print('\n' + str_line)
for row in state:
for cell in row:
#print(cell)
symbol = c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printBoard(self):",
"def print_board(self):\n self.board.print()",
"def print_board(self):\n print(*self._board, sep=\"\\n\")",
"def _print_board(board):\r\n pass",
"def print_board(self):\n print(self.board)",
"def print_board(self):\n print_sp = functools.partial(... | [
"0.8656841",
"0.8654637",
"0.86475843",
"0.85846126",
"0.846856",
"0.8427143",
"0.84263456",
"0.83604497",
"0.83430725",
"0.8339541",
"0.82963955",
"0.8280853",
"0.8217008",
"0.82045764",
"0.8198454",
"0.81959254",
"0.81959116",
"0.8175621",
"0.8153995",
"0.81443745",
"0.8144... | 0.0 | -1 |
It calls the minimax function if the depth < 70, else it choices a random coordinate. | def ai_turn(c_choice, h_choice, xi, yi):
depth = len(empty_cells(board))
if depth == 0 or game_over(board):
return
clean()
print(f'Computer turn [{c_choice}]')
render(board, c_choice, h_choice)
if depth == 70:
x = choice([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
y = ch... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minimax(self, game, depth):\n _, move = self.minimax_search(game, depth)\n return move",
"def generateMoveWithMiniMax(board: np.ndarray, player: BoardPiece, saved_state: Optional[SavedState]\n) -> Tuple[PlayerAction, Optional[SavedState]]:\n\n # creating a minimax tree with depth 4\n root... | [
"0.62668",
"0.6200618",
"0.61517376",
"0.609066",
"0.60597336",
"0.6019495",
"0.60122555",
"0.6008154",
"0.59847593",
"0.5979335",
"0.59750915",
"0.59555006",
"0.59096134",
"0.59017205",
"0.5895744",
"0.5843875",
"0.5819815",
"0.5813577",
"0.58135337",
"0.5771601",
"0.5745750... | 0.0 | -1 |
The Human plays choosing a valid move. | def human_turn(c_choice, h_choice,xi,yi):
depth = len(empty_cells(board))
if depth == 0 or game_over(board):
return
# Dictionary of valid moves
move = -1
moves = {
0: [0, 0], 1: [0, 1], 2: [0, 2], 3: [0, 3], 4: [0, 4], 5: [0, 5], 6: [0, 6], 7: [0, 7], 8: [0, 8], 9: [0, 9],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_move(self, board):\n if self.opp == Player.HUMAN:\n time.sleep(4)\n if self.type == Player.HUMAN:\n move = input(\"Please enter your move:\")\n while not board.legalMove(self, move):\n print(move, \"is not valid\")\n move = inp... | [
"0.75520533",
"0.7428555",
"0.7175023",
"0.71660423",
"0.71155757",
"0.7112883",
"0.71108216",
"0.709908",
"0.70906836",
"0.6949657",
"0.6913495",
"0.687316",
"0.6872029",
"0.68426174",
"0.68424296",
"0.68190217",
"0.6816854",
"0.6809753",
"0.6777399",
"0.6769718",
"0.6761530... | 0.0 | -1 |
Main function that calls all functions | def main():
clean()
h_choice = '2' #
c_choice = '1' #
first = '' # if human is the first
# Human may starts first
clean()
while first != 'Y' and first != 'N':
try:
print(" $$\ $$\ $$$$$$\ $$$$$$$\ $$$$$$$\ $$$$$$$$\ $$$$$$$\ $$$$$$\ ")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n pass",
"def main():\n return",
"def main():",
"def main():",
"def main():",
"def main():",
"def main():",
"def main():",
"def main():",
"def main():",
"def main():",
"def main():",
"def main():",
"def main():",
"def main():",
"def main():",
"def main():",
"... | [
"0.80330014",
"0.79245186",
"0.78528756",
"0.78528756",
"0.78528756",
"0.78528756",
"0.78528756",
"0.78528756",
"0.78528756",
"0.78528756",
"0.78528756",
"0.78528756",
"0.78528756",
"0.78528756",
"0.78528756",
"0.78528756",
"0.78528756",
"0.78528756",
"0.78528756",
"0.78528756"... | 0.0 | -1 |
Creates and saves a User with the given email, date of birth and password. | def create_user(self, login_name, email, password=None):
if not login_name:
raise ValueError(_('Users must have an login'))
user = self.model(
login_name=login_name,
email=self.normalize_email(email),
)
user.set_password(password)
user.save(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password, first_name, last_name, **extra_fields):\n now = timezone.now()\n email = self.normalize_email(email)\n user = self.model(email=email,\n first_name=first_name,\n last_name=last_name,\n ... | [
"0.8198321",
"0.81976444",
"0.8184564",
"0.8164066",
"0.81594366",
"0.8146032",
"0.81377095",
"0.8096175",
"0.80850804",
"0.8062514",
"0.8053982",
"0.804203",
"0.8021915",
"0.8015896",
"0.8014823",
"0.80099773",
"0.80099773",
"0.8006592",
"0.8004393",
"0.7993231",
"0.7990132"... | 0.0 | -1 |
Creates and saves a superuser with the given email, date of birth and password. | def create_superuser(self, login_name, email, password):
user = self.create_user(
login_name,
email,
password=password,
)
user.is_admin = True
user.save(using=self._db)
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createsuperuser():\n\n email = prompt('User E-Mail')\n email_confirm = prompt('Confirm E-Mail')\n\n if not email == email_confirm:\n sys.exit('\\nCould not create user: E-Mail did not match')\n\n if not EMAIL_REGEX.match(email):\n sys.exit('\\nCould not create user: Invalid E-Mail add... | [
"0.8130828",
"0.81258726",
"0.8055208",
"0.8015058",
"0.8010546",
"0.8000795",
"0.7982015",
"0.7974123",
"0.7970312",
"0.7967593",
"0.7967593",
"0.7967593",
"0.7933699",
"0.793049",
"0.7923913",
"0.7923643",
"0.79217",
"0.7915823",
"0.7909032",
"0.7904034",
"0.7902635",
"0.... | 0.0 | -1 |
get_csas ciscoToken auth token from Cisco API Oauth csaParam search by what csaParamValue search parameter value | def get_csas(ciscoToken,csaParam,csaParamValue):
date = str(datetime.date.today())
ciscoTokenHeader = "Bearer " + ciscoToken
csaBaseUrl = 'https://api.cisco.com/security'
csaUrlY = '/advisories/cvrf/year/' # <YYYY - year>
csaUrlAll = '/advisories/cvrf/all'
csaUrlCve = '/advisories/cvrf/cve/'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def psirt_get_token():\n creds = json.load(open('creds.json'))\n psirt_headers = {'Content-Type': 'application/x-www-form-urlencoded'}\n psirt_payload = {\n 'client_id': creds['CLIENT_ID'],\n 'client_secret': creds['CLIENT_SECRET'],\n 'grant_type': 'client_credentials'\n }\n url... | [
"0.6010371",
"0.5442733",
"0.5332393",
"0.52155715",
"0.5119013",
"0.50927144",
"0.5004644",
"0.498877",
"0.4980103",
"0.49789926",
"0.48310238",
"0.48263535",
"0.48007572",
"0.47805667",
"0.47256306",
"0.4725277",
"0.46955785",
"0.46931717",
"0.4689277",
"0.46836177",
"0.465... | 0.6577107 | 0 |
Sets the input tensor. | def set_input_tensor(image):
tensor_index = interpreter.get_input_details()[0]['index']
input_tensor = interpreter.tensor(tensor_index)()[0]
input_tensor[:, :] = image | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_input_tensor(self, image):\n tensor_index = self.model.get_input_details()[0]['index']\n input_tensor = self.model.tensor(tensor_index)()[0]\n input_tensor[:, :] = image",
"def _set_input_tensor(self, image):\n tensor_index = self._interpreter.get_input_details()[0]['index']\n... | [
"0.78921735",
"0.7880164",
"0.78591853",
"0.7483206",
"0.7421616",
"0.7421616",
"0.7421616",
"0.7390989",
"0.69884974",
"0.67202246",
"0.6647317",
"0.6647317",
"0.65358335",
"0.6404296",
"0.6386191",
"0.63792336",
"0.62816674",
"0.626906",
"0.62600327",
"0.6236887",
"0.620573... | 0.75897944 | 3 |
Returns the output tensor at the given index. | def get_output_tensor(index):
output_details = interpreter.get_output_details()[index]
tensor = np.squeeze(interpreter.get_tensor(output_details['index']))
return tensor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_output_tensor(self, index):\n output_details = self.model.get_output_details()[index]\n tensor = np.squeeze(self.model.get_tensor(output_details['index']))\n return tensor",
"def get_output_tensor(self, index):\n output_details = self.interpreter.get_output_details()[index]\n ... | [
"0.8773681",
"0.87153566",
"0.86581725",
"0.8473132",
"0.8446493",
"0.8446493",
"0.8446493",
"0.75534517",
"0.7171569",
"0.68134344",
"0.6715133",
"0.6542007",
"0.65397805",
"0.65058136",
"0.6436549",
"0.6430624",
"0.63161963",
"0.6215072",
"0.6104049",
"0.6095873",
"0.608248... | 0.88110566 | 0 |
Returns a list of detection results, each a dictionary of object info. If classes is None, return all | def detect_objects(image, threshold, classes_incl=None):
set_input_tensor(image)
interpreter.invoke()
# Get all output details
boxes = get_output_tensor(0)
classes = get_output_tensor(1)
scores = get_output_tensor(2)
count = int(get_output_tensor(3))
results = []
for i in range(cou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect_objects(interpreter, image):\n set_input_tensor(interpreter, image)\n interpreter.invoke()\n\n # Get all output details\n boxes = get_output_tensor(interpreter, 0)\n classes = get_output_tensor(interpreter, 1)\n scores = get_output_tensor(interpreter, 2)\n count = int(get_output_ten... | [
"0.678076",
"0.6609013",
"0.6485807",
"0.6481792",
"0.64596814",
"0.6415124",
"0.63866055",
"0.6221281",
"0.6165529",
"0.6160837",
"0.6160301",
"0.6133809",
"0.60750854",
"0.59835714",
"0.5975361",
"0.5961792",
"0.59229106",
"0.5864082",
"0.5837682",
"0.5833264",
"0.58326215"... | 0.69507647 | 0 |
Adds a bounding box to an image. | def draw_bounding_box_on_image(image, ymin, xmin, ymax, xmax, color, font, thickness=2, display_str_list=()):
draw = ImageDraw.Draw(image)
im_width, im_height = image.size
(left, right, top, bottom) = (xmin * im_width, xmax * im_width,
ymin * im_height, ymax * im_height)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_bbox(self, image_path, image_size, obj):\n\n if image_path not in self.img_path_2_img_id:\n self.img_path_2_img_id[image_path] = len(self.img_path_2_img_id)\n\n self.annotation['images'].append({\n \"file_name\": image_path,\n \"height\": image_siz... | [
"0.73145103",
"0.69078493",
"0.68972373",
"0.6852669",
"0.6684505",
"0.66179127",
"0.66104835",
"0.6551878",
"0.6413111",
"0.637614",
"0.6347887",
"0.6316216",
"0.62306195",
"0.61955655",
"0.6126171",
"0.6122072",
"0.6082913",
"0.60756123",
"0.6063343",
"0.60619533",
"0.60182... | 0.5644437 | 65 |
Simplified from obj detection full TF example | def draw_box(image, boxes, class_name, score, max_boxes=10, min_score=0.1):
colors = list(ImageColor.colormap.values())
font = ImageFont.load_default()
ymin, xmin, ymax, xmax = tuple(boxes)
display_str = "{}: {}%".format(class_name, int(100 * score))
color = colors[hash(class_name) % len(colors)]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yolo_detection(raw_image):\n class_ids = []\n confidences = []\n boxes = []\n height , width ,c= raw_image.shape\n blob = cv2.dnn.blobFromImage(raw_image, 0.00392, (416,416), (0,0,0), True, crop=False)\n net.setInput(blob)\n outs = net.forward(output_layers)\n\n for out in outs:\n ... | [
"0.6576785",
"0.646078",
"0.63862246",
"0.6365827",
"0.6306967",
"0.6298362",
"0.6263435",
"0.62618035",
"0.62503177",
"0.6235407",
"0.62271196",
"0.62065756",
"0.6158221",
"0.61491674",
"0.6137149",
"0.6119531",
"0.6093698",
"0.6077226",
"0.6063234",
"0.60471946",
"0.6041822... | 0.0 | -1 |
Draw boxes from results structure onto image | def draw_boxes(image, results, min_score=0.2, max_boxes=10):
results = sorted(results, key=lambda x: x['score'])
results = results[0:max_boxes]
for r in results:
if r['score'] < min_score:
continue
draw_box(image, r['bounding_box'], labels[r['class_id']], r['score']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_boxes(self, im, boxes):\n for bbox in boxes:\n l = [int(x) for x in bbox[\"coords\"]]\n l = self.scalebox(l)\n icon = self.classes_to_icons[bbox[\"label\"]]\n overlay_im_to_background(im, icon, l[0], l[1] - icon.shape[0] - 5)\n cv2.rectangle(im... | [
"0.72445345",
"0.7153246",
"0.7029988",
"0.7007932",
"0.69935673",
"0.69907695",
"0.6941484",
"0.6920315",
"0.6867858",
"0.6833942",
"0.6833801",
"0.6787415",
"0.6783118",
"0.67714643",
"0.67637265",
"0.66858953",
"0.6676106",
"0.6671345",
"0.6658536",
"0.66494524",
"0.664904... | 0.7102486 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.