query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Attach a lot of summaries to a Tensor (for TensorBoard visualization). | def variable_summaries(var):
with tf.name_scope('summaries'):
mean = tf.reduce_mean(var)
tf.summary.scalar('mean', mean)
with tf.name_scope('stddev'):
stddev = tf.sqrt(tf.reduce_mean(tf.square(var - mean)))
tf.summary.scalar('stddev', stddev)
tf.summary.scalar('m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_summary(self):\n for k, v in self.metrics.items():\n tf.summary.scalar(k, v)\n \n self.summary_op = tf.summary.merge_all()",
"def build_summaries(self):\n\n # Loss summary.\n tf.summary.scalar('loss', self.loss)\n\n merged = tf.summary.merge_all()\n self.summary_op = merged\n ... | [
"0.7071791",
"0.6970259",
"0.6970259",
"0.6800256",
"0.67872906",
"0.67407334",
"0.66669947",
"0.66576326",
"0.66193783",
"0.66085786",
"0.6595776",
"0.65836215",
"0.6581151",
"0.655297",
"0.6500364",
"0.6459978",
"0.64145213",
"0.6294558",
"0.62718755",
"0.62713677",
"0.6265... | 0.0 | -1 |
Gets a random time segment of duration segment_ms in a 10,000 ms audio clip. | def get_random_time_segment(segment_ms):
segment_start = np.random.randint(low=0, high=10000-segment_ms) # Make sure segment doesn't run past the 10sec background
segment_end = segment_start + segment_ms - 1
return (segment_start, segment_end) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rand_stim(self):\n which = np.random.randint(low=0, high=self.ndata)\n signal = self.data[which]\n excess = signal.shape[0] - self.seg_length\n if excess < 0:\n segment = signal\n else:\n where = np.random.randint(low=0, high=excess)\n segment... | [
"0.6346133",
"0.5968093",
"0.57872385",
"0.543045",
"0.5348455",
"0.5320724",
"0.53102636",
"0.52795",
"0.527616",
"0.52141804",
"0.5163699",
"0.5153029",
"0.51250505",
"0.5076233",
"0.50741565",
"0.50674105",
"0.5055897",
"0.49999702",
"0.49932885",
"0.49894676",
"0.4988453"... | 0.81394756 | 0 |
Assert that two complex structures have almost equal contents. Compares lists, dicts and tuples recursively. Checks numeric values | def assertDeepAlmostEqual(self, expected, actual, *args, **kwargs):
kwargs.pop("__trace", "ROOT")
if (
hasattr(expected, "__geo_interface__")
and hasattr(actual, "__geo_interface__")
and expected.__geo_interface__["type"] == actual.__geo_interface__["type"]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _equivalent_data_structures(struct_1, struct_2):\n if isinstance(struct_1, np.ndarray):\n return np.allclose(struct_1, struct_2)\n if isinstance(struct_1, Mapping):\n if set(struct_1.keys()) != set(struct_2.keys()):\n return False\n return all(\n _equivalent_dat... | [
"0.6856",
"0.66641694",
"0.6636554",
"0.6619295",
"0.6600221",
"0.6590562",
"0.65527815",
"0.6550562",
"0.6423729",
"0.63992083",
"0.63608086",
"0.6349685",
"0.63460094",
"0.6332496",
"0.63299686",
"0.632918",
"0.6323604",
"0.63124764",
"0.63048434",
"0.63048434",
"0.62941104... | 0.6847316 | 1 |
Sets the id of this LoanRecord. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id_):\n\n self.id_ = id_",
"def set_id(self, id):\n self.__id = id",
"def SetId(self, id):\n self.id = int(id)",
"def loan_id(self, loan_id):\n\n self._loan_id = loan_id",
"def set_id(self, id):\n self.data['id'] = id",
"def set_id(self, id):\n\n\t\tif ... | [
"0.759683",
"0.7548506",
"0.75382507",
"0.75325704",
"0.7444702",
"0.72462225",
"0.71202624",
"0.71202624",
"0.71202624",
"0.71202624",
"0.71202624",
"0.711454",
"0.711454",
"0.711454",
"0.711454",
"0.711454",
"0.711454",
"0.711454",
"0.711454",
"0.711454",
"0.711454",
"0.7... | 0.0 | -1 |
Sets the loan_id of this LoanRecord. | def loan_id(self, loan_id):
self._loan_id = loan_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loan_application_id(self, loan_application_id: str):\n if loan_application_id is None:\n raise ValueError(\"Invalid value for `loan_application_id`, must not be `None`\") # noqa: E501\n\n self._loan_application_id = loan_application_id",
"def pay_loan(self, loan_id):\n r = re... | [
"0.6962601",
"0.620105",
"0.59342825",
"0.59055126",
"0.586726",
"0.5798028",
"0.5787697",
"0.5730725",
"0.5720255",
"0.5618062",
"0.5604811",
"0.5603773",
"0.5600246",
"0.5597707",
"0.55507684",
"0.55507684",
"0.54346",
"0.54217577",
"0.5409986",
"0.5400782",
"0.5370823",
... | 0.8840699 | 0 |
Sets the expire_time of this LoanRecord. | def expire_time(self, expire_time):
self._expire_time = expire_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expire(self, expire):\n\n self._expire = expire",
"def expire_date(self, expire_date):\n\n self._expire_date = expire_date",
"def expiry(self, expiry):\n\n self._expiry = expiry",
"def expires(self, expires):\n\n self._expires = expires",
"def set_expired(self, bExpired):\n ... | [
"0.772447",
"0.71713036",
"0.66144574",
"0.6304232",
"0.6256894",
"0.6230747",
"0.62274754",
"0.6214677",
"0.6175106",
"0.61741",
"0.6112252",
"0.6087046",
"0.596938",
"0.5916242",
"0.5916242",
"0.5916242",
"0.5847494",
"0.5830621",
"0.57409316",
"0.5691829",
"0.565899",
"0... | 0.82511336 | 0 |
Sets the status of this LoanRecord. | def status(self, status):
allowed_values = ["loaned", "finished"] # noqa: E501
if self.local_vars_configuration.client_side_validation and status not in allowed_values: # noqa: E501
raise ValueError(
"Invalid value for `status` ({0}), must be one of {1}".format(status, allo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_status(self, status):\n self.status = status",
"def set_status(self, status):\n self.status = status",
"def set_status(self, status):\n self.status = status",
"def status(self, status):\n\n self._status = status",
"def status(self, status):\n\n self._status = stat... | [
"0.742818",
"0.742818",
"0.742818",
"0.729607",
"0.729607",
"0.729607",
"0.729607",
"0.729607",
"0.729607",
"0.729607",
"0.729607",
"0.729607",
"0.729607",
"0.729607",
"0.729607",
"0.729607",
"0.729607",
"0.729607",
"0.729607",
"0.729607",
"0.729607",
"0.729607",
"0.72960... | 0.6636454 | 44 |
Sets the currency of this LoanRecord. | def currency(self, currency):
self._currency = currency | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def currency(self, currency: str):\n\n self._currency = currency",
"def currency(self, currency):\n if currency is None:\n raise ValueError(\"Invalid value for `currency`, must not be `None`\")\n\n self._currency = currency",
"def currency(self, currency):\n if self.local... | [
"0.7614526",
"0.73841035",
"0.7099388",
"0.7009042",
"0.6942794",
"0.6905837",
"0.68229604",
"0.68229604",
"0.68229604",
"0.68229604",
"0.68229604",
"0.6784052",
"0.67260253",
"0.66681486",
"0.648117",
"0.6459493",
"0.6418965",
"0.6418965",
"0.6418965",
"0.6348937",
"0.634515... | 0.77603483 | 3 |
Sets the rate of this LoanRecord. | def rate(self, rate):
self._rate = rate | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_current_rate(self, rate_to_set):\n pass",
"def a_rate(self, a_rate):\n\n self._a_rate = a_rate",
"def _set_rate(self):\r\n interval = self.data.iloc[2, 0] - self.data.iloc[1, 0]\r\n self.rate = int(1 / interval)",
"def rate(self, rate):\n # Get the sign of the rates... | [
"0.7485775",
"0.74187046",
"0.72313124",
"0.71784174",
"0.71728796",
"0.703834",
"0.7017632",
"0.7009341",
"0.67899215",
"0.6787706",
"0.6784016",
"0.6716015",
"0.66581655",
"0.6630198",
"0.66155386",
"0.66155386",
"0.6520406",
"0.64290434",
"0.63918084",
"0.63397455",
"0.625... | 0.7928234 | 1 |
Sets the days of this LoanRecord. | def days(self, days):
self._days = days | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setDay(self, *args):\n return _libsbml.Date_setDay(self, *args)",
"def valid_days(self, valid_days):\n\n self._valid_days = valid_days",
"def dates(self, dates):\n\n self._dates = dates",
"def day(self, day):\n\n self._day = day",
"def day(self, day):\n\n self._day = ... | [
"0.6816621",
"0.642756",
"0.6311254",
"0.61405617",
"0.61405617",
"0.6133144",
"0.59248406",
"0.56419295",
"0.56288844",
"0.5606653",
"0.55495334",
"0.5488741",
"0.54864126",
"0.54237914",
"0.53746676",
"0.5214575",
"0.51699585",
"0.514902",
"0.514902",
"0.5147522",
"0.512607... | 0.76819426 | 0 |
Sets the repaid of this LoanRecord. | def repaid(self, repaid):
self._repaid = repaid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repaid_interest(self, repaid_interest):\n\n self._repaid_interest = repaid_interest",
"def repaid(self):\n return self._repaid",
"def set_repin(self, repin):\n self.repin = repin",
"def rpn(self, rpn):\n\n self._rpn = rpn",
"def rpn(self, rpn):\n\n self._rpn = rpn",
... | [
"0.62934273",
"0.61154217",
"0.60819227",
"0.565408",
"0.565408",
"0.5434639",
"0.54299945",
"0.53666764",
"0.53007287",
"0.5187828",
"0.5181274",
"0.517406",
"0.51329285",
"0.51020914",
"0.50844795",
"0.5062485",
"0.4932726",
"0.49300233",
"0.4923862",
"0.48997575",
"0.48851... | 0.8184397 | 1 |
Sets the paid_interest of this LoanRecord. | def paid_interest(self, paid_interest):
self._paid_interest = paid_interest | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unpaid_interest(self, unpaid_interest):\n\n self._unpaid_interest = unpaid_interest",
"def unpaid_interest(self, unpaid_interest):\n\n self._unpaid_interest = unpaid_interest",
"def repaid_interest(self, repaid_interest):\n\n self._repaid_interest = repaid_interest",
"def paid(self, ... | [
"0.7236033",
"0.7236033",
"0.71311146",
"0.66910017",
"0.64686334",
"0.6349484",
"0.5744775",
"0.5435513",
"0.53329575",
"0.52915186",
"0.52469635",
"0.52424407",
"0.51769537",
"0.5017863",
"0.501439",
"0.499235",
"0.49731472",
"0.48712048",
"0.48048043",
"0.48048043",
"0.480... | 0.88164794 | 0 |
Sets the unpaid_interest of this LoanRecord. | def unpaid_interest(self, unpaid_interest):
self._unpaid_interest = unpaid_interest | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paid_interest(self, paid_interest):\n\n self._paid_interest = paid_interest",
"def unapproved(self, unapproved):\n\n self._unapproved = unapproved",
"def repaid_interest(self, repaid_interest):\n\n self._repaid_interest = repaid_interest",
"def unequal_paid(self, unequal_paid):\n ... | [
"0.7019945",
"0.6402536",
"0.6021122",
"0.5758044",
"0.5642467",
"0.5596227",
"0.5357277",
"0.53555346",
"0.53414106",
"0.53238195",
"0.5245023",
"0.52279675",
"0.51817405",
"0.5176743",
"0.517406",
"0.5098232",
"0.50832754",
"0.5067834",
"0.50374216",
"0.50374216",
"0.503742... | 0.90181386 | 1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, LoanRecord):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, LoanRecord):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Set the user password. Generate a password salt based on current timestamp to make a strong password, than encrypt password with generated salt | def set_password(self, value):
# Salt need to be generated before set password
m = hashlib.sha256()
m.update('-'.join([
str(datetime.now()),
config.get('security.password_salt')
]))
self.salt = m.hexdigest()
self.password_pending = False
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_password(self, password):\n self.password_hash = generate_password_hash(f\"{password}{self.user_salt}\")",
"def set_password(self, password):\n self.password = md5crypt(password, gen_salt())",
"def set_password(self, password):\n\n self.password = bcrypt.generate_password_hash(pass... | [
"0.8176986",
"0.79079384",
"0.78515375",
"0.78112805",
"0.7796077",
"0.7787635",
"0.7759864",
"0.7732668",
"0.7732668",
"0.7723714",
"0.7670568",
"0.7647617",
"0.7632073",
"0.761807",
"0.7602045",
"0.75774527",
"0.75717",
"0.75231826",
"0.7488054",
"0.7452838",
"0.7452838",
... | 0.8358073 | 0 |
Check if given password is valid | def check_password(self, password):
if self.password is None:
return password is None
return self.__encrypt(password) == self.password | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_password_valid(password):\n #TODO : This should also be handled by the front_end\n pass",
"def _check_password(self, password):\n if self.password_regex.search(password) is not None:\n print(\"Correct password\")\n return True\n else:\n print(\"... | [
"0.85381305",
"0.8415312",
"0.8411327",
"0.8369029",
"0.8341775",
"0.8338921",
"0.8325012",
"0.8299718",
"0.82976085",
"0.8273978",
"0.82609844",
"0.8258765",
"0.8204182",
"0.8182063",
"0.81680256",
"0.8166231",
"0.81649506",
"0.8150684",
"0.8130021",
"0.81136376",
"0.8098576... | 0.0 | -1 |
Get the calculated margin value | def margin(self):
sp = self.sale_price or zero
if u.isempty(sp):
return zero
cp = self.cost_price or zero
return u.decimal((um-(cp/sp))*cem, True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_margin(self):\n _pal.lib.geometry_get_margin.restype = c.c_float\n return _pal.lib.geometry_get_margin(self._geometry)",
"def margin(self):\r\n return self._generate_spacing_info(self.config['margin'])",
"def getMargin(self):\n assert False",
"def get_offset_value():\n ... | [
"0.8096916",
"0.7665626",
"0.7661267",
"0.75854164",
"0.7425228",
"0.73526794",
"0.72962034",
"0.7249989",
"0.71489507",
"0.71366096",
"0.7049974",
"0.7034223",
"0.6887032",
"0.6742051",
"0.66695106",
"0.65863913",
"0.6580583",
"0.64934206",
"0.6456584",
"0.63965106",
"0.6378... | 0.76836574 | 1 |
Create an Stock Adjustment with given initial quantity | def set_initial(self, value):
# TODO: Make an Initial Stock Adjust here
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_stock_item(self):\n pass",
"def add_stock(self, symbol, quantity, unit_price):\n # TODO write SQL statement to grab unit_price\n stock_price_total = quantity * unit_price # TODO write SQL statement\n # TODO deduct stock quantity from market ??\n self.portfolios.ap... | [
"0.6080927",
"0.6029048",
"0.5925458",
"0.5915727",
"0.5871318",
"0.57795393",
"0.5704251",
"0.5703172",
"0.57001394",
"0.56679547",
"0.5659063",
"0.5655113",
"0.5620402",
"0.5597564",
"0.55950505",
"0.5591549",
"0.5579981",
"0.5575802",
"0.55751693",
"0.55661815",
"0.5548048... | 0.63861334 | 0 |
Get the current queue of historical data collections. Returns dict standard and priority queues | def get_history_queue():
response = houston.get("/history/queue")
houston.raise_for_status_with_json(response)
return response.json() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_queues(self):\n return self.__queues",
"def _get_queues(self):\n return self.__queues",
"def _get_queues(self):\n return self.__queues",
"def _get_queues(self):\n return self.__queues",
"def _get_queues(self):\n return self.__queues",
"def _get_queues(self):\n return self.__que... | [
"0.6904607",
"0.6904607",
"0.6904607",
"0.6904607",
"0.6904607",
"0.6904607",
"0.6904607",
"0.6904607",
"0.6904607",
"0.6895607",
"0.6776065",
"0.65952545",
"0.65623784",
"0.6477117",
"0.6474315",
"0.6470711",
"0.6470711",
"0.6470711",
"0.6470711",
"0.6470711",
"0.6470711",
... | 0.6942455 | 0 |
Check if the user has a permission on a specific object. Returns boolean. | def has_perm(context, perm, obj):
return access.has_perm(context['request'].user, perm, obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_object_permission(self, request, view, obj):\n return request.user == obj",
"def has_object_permission(self, request, view, obj):\n\n return request.user == obj",
"def has_object_permission(self, request, view, obj):\n\n if request.method in permissions.SAFE_METHODS:\n r... | [
"0.84076005",
"0.83953106",
"0.836508",
"0.8360155",
"0.82976496",
"0.8297573",
"0.829155",
"0.82663745",
"0.8210482",
"0.8193988",
"0.81622005",
"0.8154853",
"0.81465",
"0.81384635",
"0.8135296",
"0.8115141",
"0.81032956",
"0.8072388",
"0.80661887",
"0.8064932",
"0.8063964",... | 0.8247362 | 9 |
Check if the user has a permission or owns the object. Ownership is determined by comparing perm_obj.field_name to the user in context. | def has_perm_or_owns(context, perm, obj, perm_obj, field_name='creator'):
user = context['request'].user
if user.is_anonymous():
return False
return access.has_perm_or_owns(user, perm, obj, perm_obj, field_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_object_permission(self, request, view, obj):\n if request.user.is_superuser:\n return True\n if request.user.profile.role == UserRole.CLIENT and obj.owner != request.user:\n return False\n if request.user.profile.role == UserRole.EXECUTOR and obj.executor != reque... | [
"0.80219024",
"0.7785759",
"0.7783671",
"0.7718651",
"0.7711835",
"0.7683579",
"0.7657346",
"0.76486826",
"0.76464075",
"0.7631261",
"0.76284045",
"0.7627279",
"0.76208466",
"0.76107574",
"0.7604181",
"0.75970876",
"0.75931394",
"0.75782865",
"0.7575515",
"0.75751346",
"0.756... | 0.84912825 | 1 |
Returns the path of a temporary directory in which to create an environment | def create_temp_env_directory():
return tempfile.mkdtemp(prefix="spack-") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tempdir():\n\n # Create a directory and return the path\n return tempfile.mkdtemp()",
"def get_temp_dir():\n return tempfile.mkdtemp()",
"def get_temp_path():\n return os.getcwd() + \"/temp/\"",
"def getSystemTmpDir():\n return os.path.join(Configurations.getProjectRootDir(), TEMP_... | [
"0.8361968",
"0.8094515",
"0.7965658",
"0.7875448",
"0.78722507",
"0.78453726",
"0.7782834",
"0.7735586",
"0.77059007",
"0.7637353",
"0.7586785",
"0.7582181",
"0.75643015",
"0.75305915",
"0.7522155",
"0.75219756",
"0.7516346",
"0.7513781",
"0.7477625",
"0.74714607",
"0.746551... | 0.8108573 | 1 |
Normalize predictors with MEANSTD or MINMAX | def norm(predictors, normalize=None):
if normalize == "std":
predictors_norm = (predictors - predictors.mean()) / predictors.std()
elif normalize == "minmax":
predictors_norm = (predictors - predictors.min()) / (predictors.max() - predictors.min())
return predictors_norm | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def standardize(X):\n mu = X.mean(axis=0, keepdims=True)\n s = X.std(axis=0, keepdims=True)\n return (X-mu)/s",
"def normalize(values):\n return (values - np.mean(values)) / np.std(values)",
"def normalize(dataset):\n return normalize_standard_deviation(normalize_mean(dataset))",
"def normalize_... | [
"0.72300565",
"0.7215287",
"0.71540743",
"0.7050196",
"0.7050196",
"0.7021896",
"0.7006436",
"0.69846344",
"0.6955152",
"0.69413626",
"0.692841",
"0.69198185",
"0.69004965",
"0.68824595",
"0.6849414",
"0.6838761",
"0.68124807",
"0.67880714",
"0.6771253",
"0.6742",
"0.6734627"... | 0.62444717 | 69 |
Split data into train and test | def split_data(predictors_norm, target):
x_train, x_test, y_train, y_test = train_test_split(predictors_norm, target, test_size=0.05)
return x_train, x_test, y_train, y_test | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_data_into_train_and_test(raw_training_data):\n train_set, test_set = train_test_split(raw_training_data, test_size=0.2, random_state=42)\n return train_set, test_set",
"def split_data(data, test_size):\r\n ntest = int(round(len(data) * (1 - test_size)))+1\r\n \r\n train, test = data[:ntes... | [
"0.873683",
"0.8483841",
"0.83644855",
"0.834212",
"0.8317109",
"0.83067477",
"0.8096327",
"0.8048392",
"0.80409783",
"0.8020229",
"0.79795235",
"0.797699",
"0.7964837",
"0.7943567",
"0.7933621",
"0.79305464",
"0.7871084",
"0.786965",
"0.78459436",
"0.7813407",
"0.77857035",
... | 0.0 | -1 |
Initializes the special characteristics of the ball projectile | def __init__ (self, centerPoint, images, direction, counter = 5, damage = 1):
Projectile.__init__(self, centerPoint, images, direction, counter, damage)
self.image = self.images[0]
self.projectile = 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\r\n config = ConfigProvider().getProcessingConfig()\r\n self.xGround = config.get(\"xGround\")\r\n self.yGround = config.get(\"yGround\")",
"def __init__(self):\n GameObject.__init__(self)\n\n # private attributes to hold the properties so they appear read o... | [
"0.6647712",
"0.66328055",
"0.65436834",
"0.65067834",
"0.64770657",
"0.6444444",
"0.64166594",
"0.63280714",
"0.6289788",
"0.62440264",
"0.62392956",
"0.61616236",
"0.6150982",
"0.6143104",
"0.6139053",
"0.61206657",
"0.61007804",
"0.60949653",
"0.60934603",
"0.6053228",
"0.... | 0.6649772 | 0 |
Add a decision to the builder with the specified properties. Ensures data types and paths are as they should be, before creating a MergeDecision and adding it to its internal store. | def add_decision(self, path, action, local_diff, remote_diff,
conflict=False, **kwargs):
# Ensure path is immutable
if isinstance(path, list):
path = tuple(path)
else:
assert isinstance(path, tuple)
# Ensure diffs are lists
if local_di... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_rule(self, selectors, properties):\n self.cliques.append((selectors, properties))",
"def _apply_decision(self, decision, responder):\n self.responder = responder\n self.status = decision\n self.decision_datetime = timezone.now()\n self.save()",
"def decision(self, dec... | [
"0.46802995",
"0.46581772",
"0.46199575",
"0.44571906",
"0.439587",
"0.42753375",
"0.42626432",
"0.42232627",
"0.41409373",
"0.40909263",
"0.40903434",
"0.40371084",
"0.40203336",
"0.40123707",
"0.40097067",
"0.39897484",
"0.39800665",
"0.39618322",
"0.3955701",
"0.39554638",
... | 0.591461 | 0 |
Prevent paths from pointing to specific string lines. Since strings are diffed as a sequence of lines without actually splitting the string in base, any path to a specific line will fail to resolve. This checks if path points to a specific line in a string, and splits off the final key of the path (the line number). Re... | def split_string_path(base, path):
for i in range(len(path)):
if isinstance(base, string_types):
return path[:i], path[i:]
base = base[path[i]]
return path, () | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _split_path(self, path):\n if path.strip() in (None, \"\", \"/\"):\n return (None, None)\n tableName, primKey = util.save_split(path.strip(\"/\"), \"/\", 1)\n # _logger.debug(\"'%s' -> ('%s', '%s')\" % (path, tableName, primKey))\n return (tableName, primKey)",
"... | [
"0.58438736",
"0.55865395",
"0.55445385",
"0.54815745",
"0.5374716",
"0.53637385",
"0.5360315",
"0.532145",
"0.5319302",
"0.5306603",
"0.52543753",
"0.5219936",
"0.5219936",
"0.5194231",
"0.5190084",
"0.51812303",
"0.51786155",
"0.5143997",
"0.5139139",
"0.51283526",
"0.51274... | 0.6491819 | 0 |
returns a tokenized, lemmatized and normalized version of text | def tokenize(text):
tokens = word_tokenize(text)
lemmatizer = WordNetLemmatizer()
clean_tokens = []
for tok in tokens:
clean_tok = lemmatizer.lemmatize(tok).lower().strip()
clean_tokens.append(clean_tok)
return clean_tokens | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(text):\n tokens = word_tokenize(text)\n words = [token for token in tokens if re.match(\"[a-zA-Z0-9]\", token)]\n no_stopwords = [word for word in words if word not in stopwords.words(\"english\")]\n lowercase_words = [word.lower() for word in no_stopwords]\n pos_tagged_words = pos_tag(... | [
"0.8100713",
"0.80528414",
"0.7996317",
"0.7988491",
"0.78783566",
"0.78497446",
"0.7836231",
"0.78281635",
"0.78146666",
"0.77794397",
"0.7768499",
"0.7762011",
"0.77241933",
"0.7710668",
"0.76043123",
"0.7599103",
"0.75054395",
"0.74959946",
"0.7484094",
"0.7477629",
"0.747... | 0.78101337 | 9 |
Retrieve the model for tuning. | def model(self):
return self.model_ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_best_model(self):\n return self.best_model",
"def get_model(name, disable_logging=False):\n return PluginLoader._import(\"train.model\", name, disable_logging)",
"def get_model(self):\n if (\n self.params.model_str == 'optfixedsig'\n or self.params.model_str =... | [
"0.71232873",
"0.70950174",
"0.70315486",
"0.68864965",
"0.68570817",
"0.6819725",
"0.67824244",
"0.6770826",
"0.6729921",
"0.6729898",
"0.6715729",
"0.6715729",
"0.6715729",
"0.6715729",
"0.6715729",
"0.6715729",
"0.6715729",
"0.6715729",
"0.6715729",
"0.6715729",
"0.6694007... | 0.6300765 | 47 |
Pulls the image from the given tag. | def pull_image(self, tag):
image_name = self.build_image_name(tag)
image = self.client.images.pull(image_name)
return image | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch(self, tag):\n return fetch_image(self.collection.client, tag)",
"def pull_image_if_not_exists(self, tag):\n image_name = self.build_image_name(tag)\n try:\n # Check if exists\n image = self.client.images.get(image_name)\n except Exception as ex:\n ... | [
"0.8267111",
"0.7836386",
"0.76608956",
"0.72345316",
"0.7146073",
"0.6594149",
"0.6545526",
"0.6537543",
"0.64523375",
"0.63604754",
"0.6346792",
"0.6342315",
"0.6299139",
"0.6168",
"0.6167582",
"0.60108876",
"0.5995023",
"0.59875506",
"0.59868664",
"0.5986473",
"0.5969709",... | 0.87834466 | 0 |
Check if image has been pulled and pull if not. Returns an Image object. | def pull_image_if_not_exists(self, tag):
image_name = self.build_image_name(tag)
try:
# Check if exists
image = self.client.images.get(image_name)
except Exception as ex:
print('Image does not exist: {}'.format(str(ex)))
# Pull if doesn't exist
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pull_image(self, tag):\n image_name = self.build_image_name(tag)\n image = self.client.images.pull(image_name)\n return image",
"def pull(self, data):\n required = {'token', 'source'}\n api.validate(data, required)\n token = data['token']\n repo = data['source... | [
"0.7119271",
"0.67481136",
"0.6722738",
"0.6720265",
"0.6712497",
"0.6692992",
"0.66367066",
"0.65651745",
"0.6555469",
"0.65308905",
"0.6523817",
"0.65055454",
"0.62881595",
"0.6285456",
"0.62187743",
"0.62077725",
"0.6187183",
"0.61717373",
"0.6158442",
"0.6023814",
"0.6003... | 0.7565341 | 0 |
r""" This routine determines whether the baselines can safely be assumed to be constant with channel, when the are represented in units of kilolambda. | def safe_baseline_constant_kilolambda(
uu: NDArray[floating[Any]],
vv: NDArray[floating[Any]],
coords: GridCoords,
uv_cell_frac: float = 0.05,
) -> bool:
# convert uv_cell_frac to a kilolambda threshold
delta_uv = uv_cell_frac * coords.du # [klambda]
# find maximum change in baseline acros... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def safe_baseline_constant_meters(\n uu: NDArray[floating[Any]],\n vv: NDArray[floating[Any]],\n freqs: NDArray[floating[Any]],\n coords: GridCoords,\n uv_cell_frac: float = 0.05,\n) -> bool:\n\n # broadcast and convert baselines to kilolambda across channel\n uu, vv = utils.broadcast_and_conv... | [
"0.61919177",
"0.5781319",
"0.5683866",
"0.5642855",
"0.5625211",
"0.5610771",
"0.5595743",
"0.54909843",
"0.535999",
"0.53503597",
"0.53503597",
"0.53503597",
"0.53503597",
"0.53503597",
"0.53503597",
"0.53503597",
"0.53503597",
"0.53503597",
"0.53503597",
"0.53503597",
"0.5... | 0.64720726 | 0 |
Convert a spatial frequency in units of klambda to 'radians/sky pixel,' using the pixel cell_size provided by ``self.coords.dl``. These concepts can be a little confusing because there are two angular measures at play. 1. The first is the normal angular sky coordinate, normally measured in arcseconds for typical source... | def _klambda_to_radpix(
self, klambda: float | NDArray[floating[Any]]
) -> float | NDArray[floating[Any]]:
# convert from kilolambda to cycles per sky radian
u_lam = klambda * 1e3 # [lambda, or cycles/radian]
# convert from 'cycles per sky radian' to 'radians per sky radian'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mK_to_Jy(z, cellsize, distances):\r\n\r\n nu = redshifts2frequencies(z)\r\n\r\n wvlngth = const.c / (nu / un.s)\r\n\r\n intensity = 2 * const.k_B * 1e-3 * un.K / wvlngth ** 2\r\n\r\n flux_density = 1e26 * intensity.to(un.W / (un.Hz * un.m ** 2))\r\n \r\n return flux_density.value * (( cellsiz... | [
"0.5187176",
"0.5049861",
"0.49715167",
"0.4864913",
"0.48607707",
"0.48538828",
"0.4840828",
"0.48305038",
"0.48291564",
"0.47935903",
"0.4754563",
"0.47489184",
"0.4737665",
"0.47172284",
"0.4696523",
"0.46803114",
"0.46462554",
"0.46429673",
"0.46360967",
"0.4632502",
"0.4... | 0.655299 | 0 |
Checks if the address is present in the database. If the address is there, it checks if the mobile number is present. | def check_address(data):
firebase_uid = data['session'].split('/')[-1]
db = firebase.database()
pincode = db.child("user_data").child(firebase_uid).child("Address").child("Pincode").get().val()
if pincode == "0" or pincode is None:
print("Address not found.")
response = {
"f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_address(self, address):\n\n if self.filter(to_address=address).count() > 0: # @@@ is there a better way?\n return True\n else:\n return False",
"def validate_address(address:str) -> bool:\r\n return True",
"def check_address_empty(address):\n return re.search(... | [
"0.64447075",
"0.6392096",
"0.63707554",
"0.6100853",
"0.6052511",
"0.59455246",
"0.5923358",
"0.5893706",
"0.57902026",
"0.5783983",
"0.57700825",
"0.56942475",
"0.56583595",
"0.56550705",
"0.5594629",
"0.558664",
"0.5555087",
"0.551946",
"0.54921275",
"0.54778254",
"0.54611... | 0.69549084 | 0 |
This saves the address entered by the user and then checks if the mobile number is there. | def save_address(data):
print("Saving address.")
firebase_uid = data['session'].split('/')[-1]
db = firebase.database()
contexts = data['queryResult']['outputContexts']
for i in contexts:
if 'address_data' in i['name']:
context = i
break
pincode = str(int(context... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_address():\n #get address info from form\n user_details = request.form\n #validate address with google geocoding\n update_details = apiapijoyjoy.validate_address(user_details)\n #update ino in db\n dbwrangler.newaddress(update_details)\n \n return redirect(\"/\")",
"def save(s... | [
"0.6683163",
"0.6333266",
"0.6239255",
"0.6186604",
"0.59452665",
"0.59258366",
"0.585413",
"0.58388376",
"0.58325744",
"0.57758844",
"0.5721588",
"0.5691895",
"0.56913704",
"0.5691305",
"0.5679186",
"0.56714463",
"0.56701845",
"0.56425613",
"0.56190586",
"0.55902934",
"0.556... | 0.7019911 | 0 |
Return neighbor's client that has the lowest cost. | def get_cheapest_neighbor(client, facilities):
adj_facilities = client.get_facility_list(facilities)
return min(adj_facilities, key=lambda fac: fac['cost']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_lowest_cost_node(self) -> str:\n lowest_cost = float(\"inf\")\n lowest_cost_node = None\n for node in self.costs:\n cost = self.costs[node]\n if cost < lowest_cost and node not in self.closed_nodes:\n lowest_cost = cost\n lowest_cos... | [
"0.6979329",
"0.67977226",
"0.67064893",
"0.6582499",
"0.6467232",
"0.6439107",
"0.64178556",
"0.6347458",
"0.630641",
"0.6279515",
"0.6246214",
"0.62035185",
"0.61466414",
"0.61309564",
"0.61108446",
"0.6105327",
"0.6105327",
"0.60867393",
"0.6084405",
"0.6059113",
"0.605734... | 0.7379686 | 0 |
Testing the Add function of the calculator | def test_calculator_add():
# Arrange by instantiating the calc class
calc = Calculator()
# Act by calling the method to be tested
calc.add(4)
# Assert that the results are correct
assert calc.result == 4 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_addition():\n assert calculator.add(7, 3) == 10\n assert calculator.add(7.0, 3.0) == 10.0\n assert calculator.add(7, -3) == 4\n assert calculator.add(7.0, -3.0) == 4.0",
"def test_add_returns_correct_result(self):\n result = self.calc.add(2, 2)\n self.assertEqual(4, result)",
... | [
"0.8440173",
"0.8434948",
"0.8202158",
"0.8202158",
"0.8202158",
"0.81960595",
"0.8010745",
"0.80049014",
"0.7991473",
"0.7982925",
"0.7965928",
"0.79100037",
"0.7906378",
"0.78788674",
"0.7748355",
"0.7728935",
"0.760771",
"0.7594136",
"0.7570065",
"0.7547949",
"0.7540929",
... | 0.701352 | 82 |
Testing the subtract method of the calculator | def test_calculator_subtract():
calc = Calculator()
calc.subtract(1)
assert calc.get_result() == -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_subtraction():\n assert calculator.subtract(7, 3) == 4\n assert calculator.subtract(7.0, 3.0) == 4.0\n assert calculator.subtract(7, -3) == 10\n assert calculator.subtract(7.0, -3.0) == 10.0",
"def test_answer_subtract():\n calc = Calculator()\n calc.subtract_number(5)\n assert calc... | [
"0.8693571",
"0.85075855",
"0.8305262",
"0.82759595",
"0.8261573",
"0.82330716",
"0.82330716",
"0.821264",
"0.8192774",
"0.8152954",
"0.8083025",
"0.80597436",
"0.7985497",
"0.7983098",
"0.77423507",
"0.7734247",
"0.7657529",
"0.75747967",
"0.7517118",
"0.7416459",
"0.7376896... | 0.8651895 | 1 |
This function determines if the provided string is a valid url | def isURL(gridurl):
is_url = False
try:
urllib.request.urlopen(gridurl)
is_url = True
except BaseException:
pass
return is_url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_url(string):\n try:\n urlparse(string)\n return True\n except:\n return False",
"def _is_url(string):\n return \"http\" in string",
"def IsValidURL(s):\n return RE_COMPLEX_URL.match(s)",
"def _is_url(s: str) -> bool:\n\n return urlparse(s).netloc != \"\"",
"def is_u... | [
"0.8673294",
"0.85257894",
"0.84064704",
"0.8335012",
"0.8059771",
"0.8057145",
"0.8036634",
"0.79782146",
"0.7972021",
"0.7954024",
"0.79393",
"0.79187065",
"0.79172534",
"0.7908587",
"0.7905948",
"0.7904055",
"0.7896498",
"0.788577",
"0.7870402",
"0.78580713",
"0.7840891",
... | 0.71572477 | 68 |
Creates a file called .gfail_defaults that contains default path information to simplify running gfail. Can be overwritten by any manually entered paths. This updates any existing .gfail_defaults file. If args.data_path is 'reset' then any existing defaults will be removed. | def set_default_paths(args):
filename = os.path.join(os.path.expanduser('~'), '.gfail_defaults')
if os.path.exists(filename):
D = ConfigObj(filename)
else:
D = {}
if args.data_path is not None:
if args.data_path == 'reset':
D.pop('data_path')
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_paths(args):\n filename = os.path.join(os.path.expanduser('~'), '.gfail_defaults')\n if os.path.exists(filename):\n D = ConfigObj(filename)\n else:\n D = {}\n if args.data_path is not None:\n if args.data_path == 'reset':\n D.pop('data_path')\n els... | [
"0.7620641",
"0.7246542",
"0.7246542",
"0.6094279",
"0.6036922",
"0.57540333",
"0.5414049",
"0.53694755",
"0.53436",
"0.5326386",
"0.5305993",
"0.5305259",
"0.5305259",
"0.52869475",
"0.52749646",
"0.5264033",
"0.5250722",
"0.5233199",
"0.52252257",
"0.5204767",
"0.5184978",
... | 0.7754869 | 0 |
Convert sparse matrix to tuple representation. | def sparse_to_tuple(sparse_mx):
def to_tuple(mx):
if not sp.isspmatrix_coo(mx):
mx = mx.tocoo()
coords = np.vstack((mx.row, mx.col)).transpose()
values = mx.data
shape = mx.shape
# All of these will need to be sorted:
sort_indices = np.lexsort(np.rot90(coo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sparse_to_tuple(sparse_mx):\n def to_tuple(mx):\n if not sp.isspmatrix_coo(mx):\n mx = mx.tocoo()\n coords = np.vstack((mx.row, mx.col)).transpose()\n values = mx.data\n shape = mx.shape\n return coords, values, shape",
"def sparse_to_tuple(sparse_mx):\n de... | [
"0.85870504",
"0.82655305",
"0.82655305",
"0.82655305",
"0.82655305",
"0.82655305",
"0.82655305",
"0.82655305",
"0.82527",
"0.82527",
"0.7986327",
"0.602773",
"0.59843755",
"0.5971062",
"0.59706587",
"0.59447116",
"0.59443593",
"0.5910293",
"0.5910293",
"0.5910293",
"0.591029... | 0.8091624 | 10 |
Symmetrically normalize adjacency matrix. | def normalize_adj(adj):
adj = sp.coo_matrix(adj)
rowsum = np.array(adj.sum(1))
d_inv_sqrt = np.power(rowsum, -0.5).flatten()
d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0.
d_mat_inv_sqrt = sp.diags(d_inv_sqrt)
return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt).tocoo() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_adj(adj):\n\n rowsum = np.array(adj.sum(1))\n d_inv_sqrt = np.power(rowsum, -0.5).flatten()\n d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0.\n d_mat_inv_sqrt = np.diag(d_inv_sqrt)\n return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt)",
"def normalize_adj(adj):\r\n adj = sp.coo_m... | [
"0.788518",
"0.7691616",
"0.759434",
"0.7566608",
"0.7335597",
"0.730491",
"0.72684425",
"0.688461",
"0.68616927",
"0.686005",
"0.6832041",
"0.682895",
"0.6750887",
"0.6750057",
"0.67278",
"0.66282207",
"0.6616473",
"0.64879745",
"0.6486613",
"0.63610464",
"0.63610464",
"0.... | 0.7698141 | 7 |
Creates a list of boxes [(ymin,xmin, ...), ...] from features. | def _recover_boundingboxes(features):
ymin = features['image/object/bbox/ymin'].values
xmin = features['image/object/bbox/xmin'].values
ymax = features['image/object/bbox/ymax'].values
xmax = features['image/object/bbox/xmax'].values
return tf.transpose([ymin, xmin, ymax, xmax]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_prior_boxes(self):\n # value of k for each feature map to create k^2 boxes for each feature map\n feature_map_dims = {'conv4_3': 38, 'conv7': 19, 'conv8_2': 10, 'conv9_2': 5}\n\n # scale for boxes across different feature maps. boxes for inner feature maps\n # are scaled much... | [
"0.69378746",
"0.66383505",
"0.66365016",
"0.64500713",
"0.6441254",
"0.63685644",
"0.63382584",
"0.6323342",
"0.6318142",
"0.6280029",
"0.62593615",
"0.6216456",
"0.6216169",
"0.61580694",
"0.61571467",
"0.6096902",
"0.6092807",
"0.60843086",
"0.6069239",
"0.6064159",
"0.606... | 0.68837494 | 1 |
Tokenize text into words | def tokenize(text):
tokens = word_tokenize(text)
lemmatizer = WordNetLemmatizer()
clean_tokens = []
for tok in tokens:
clean_tok = lemmatizer.lemmatize(tok).lower().strip()
clean_tokens.append(clean_tok)
return clean_tokens | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(text):\n return text.split(' ')",
"def tokenize_text(text):\n return nltk.tokenize.word_tokenize(text)",
"def tokenize(txt):\n Depunc = depunctuate(txt).lower()\n Tokens = word_tokenize(Depunc)\n \n return Tokens",
"def word_tokenize(text):\n for (regexp, replacement) in RULES... | [
"0.82015747",
"0.8139867",
"0.8126357",
"0.8006827",
"0.8002833",
"0.79444563",
"0.7927374",
"0.7903637",
"0.785835",
"0.7803104",
"0.7785723",
"0.7779478",
"0.77535665",
"0.77502143",
"0.77495676",
"0.7741321",
"0.77362084",
"0.77175754",
"0.771605",
"0.77137065",
"0.7692061... | 0.7690597 | 21 |
Determines if the pandigital number with decimal string representation num_string satisfies the problem conditions. | def concats_divisible_by_divisors(num_string: str) -> bool:
# check if all concatenated numbers are divisible by divisors in DIVISORS
for i in range(divisor_count):
# form number by concatenating digits of num_string
indices = DIGIT_INDICES[i]
concat_num = int(num_string[indices[0]-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __has_numbers(self, input_string):\n return bool(re.search(r'\\d', input_string))",
"def checkifnumber(self, test_string):\r\n try:\r\n float(test_string)\r\n return(True)\r\n except ValueError:\r\n return(False)",
"def _isDecimalNumber(strWord):\n ... | [
"0.6834889",
"0.67161345",
"0.66909087",
"0.6650816",
"0.65644526",
"0.6547312",
"0.6547252",
"0.6488748",
"0.64555776",
"0.64497566",
"0.6447451",
"0.63969874",
"0.63644266",
"0.6315065",
"0.6280636",
"0.6275843",
"0.6262726",
"0.6261015",
"0.6253959",
"0.6235004",
"0.623390... | 0.0 | -1 |
Returns if the word is in the trie. | def search(self, word: str) -> bool:
curr = self.root
for ch in word:
curr = curr.children.get(ch)
if curr is None:
return False
return curr.is_word | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_trie(self, trie, word):\n current_dict = trie\n for letter in word:\n if letter in current_dict:\n current_dict = current_dict[letter]\n else:\n return False\n else:\n if '_end_' in current_dict:\n return curr... | [
"0.838632",
"0.8150416",
"0.8123471",
"0.7856802",
"0.7830664",
"0.77935004",
"0.7792806",
"0.77642965",
"0.7747724",
"0.7711298",
"0.76816714",
"0.7677101",
"0.7664614",
"0.76506114",
"0.76338875",
"0.7628353",
"0.76114196",
"0.7577657",
"0.75695884",
"0.756079",
"0.75591743... | 0.7753436 | 8 |
Excludes any questions that aren't published yet. | def get_queryset(self):
return Question.objects.filter(publication_date__lte=timezone.now()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n # the filter says that it only returns those w/ the pub_date\n # less or equal to timezone.now() (earlier or now)\n questions = Question.objects.filter(\n pub_date__lte=timezone.now()\n ).order_by('-pub_date')\n\n excludes = []\n for qu... | [
"0.66057587",
"0.6447535",
"0.62109476",
"0.62109476",
"0.62109476",
"0.62109476",
"0.62109476",
"0.62109476",
"0.62109476",
"0.62109476",
"0.62109476",
"0.62109476",
"0.62109476",
"0.62109476",
"0.62109476",
"0.62109476",
"0.62109476",
"0.6170101",
"0.6170101",
"0.6101224",
... | 0.6222388 | 2 |
Get attribute value of wrapper if available and of env if not. | def __getattribute__(self, name):
if name in ["sampling_function", "env", "fit_dist", "reset"]:
return object.__getattribute__(self, name)
else:
return getattr(self.env, name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getattr__(self, attr):\n\n if attr in self._vars.keys():\n return self._vars[attr]\n else:\n raise EnvError(\"Unknown environment variable: \" + attr)",
"def get_value(self, section_name: str, attr_name: str, env_override: bool = False) -> typing.Optional[str]:\n ... | [
"0.6463677",
"0.63506675",
"0.63123435",
"0.6290044",
"0.62491477",
"0.6243202",
"0.61736166",
"0.59429103",
"0.5914098",
"0.5851614",
"0.5848964",
"0.5848964",
"0.5848554",
"0.5834117",
"0.5806653",
"0.5801188",
"0.57902724",
"0.5765679",
"0.576386",
"0.5742184",
"0.57307005... | 0.60938406 | 7 |
If in output mode, set the pin high (1) or low (0) | def set(self, state):
if self.mode == gpio.OUT:
# Write an event to the buffer.
self._buffer_write(state, time.time()*1000)
gpio.output(self.bcm_id, state)
self.state = state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_pin(self):\n GPIO.setwarnings(False)\n GPIO.setmode(GPIO.BOARD)\n GPIO.setup(self.pin, GPIO.OUT)\n GPIO.output(self.pin, GPIO.LOW)\n time.sleep(3)\n GPIO.output(self.pin, GPIO.HIGH)",
"def set_PIenable(self,highlow): \n GPIO.output(self.chanlist[4], highlo... | [
"0.7649815",
"0.7548743",
"0.7441307",
"0.73354435",
"0.71780396",
"0.7121803",
"0.706834",
"0.70608014",
"0.7041925",
"0.6992716",
"0.6992716",
"0.6955646",
"0.6929402",
"0.6890403",
"0.6865052",
"0.68295604",
"0.67966545",
"0.6784026",
"0.6710824",
"0.6669501",
"0.66153157"... | 0.6472234 | 28 |
Sends a 401 response that enables basic auth | def deny_access():
flash('You must login first.')
return redirect(url_for('home')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})",
"def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )",
"def authenticate():\n return Response(\n 'You have to login with pro... | [
"0.8093736",
"0.80926424",
"0.7958403",
"0.7852648",
"0.7843114",
"0.7824419",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
... | 0.0 | -1 |
Constructor de la clase HeapNode. | def __init__(self, char, freq):
self.char = char
self.freq = freq
self.left = None
self.right = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n # Initialize a new binary min heap to store the items\n self.heap = MinHeap()",
"def __init__(self):\n self.max_heap = MaxHeap()\n self.min_heap = MinHeap()",
"def __init__(self):\n self.heap = [None]",
"def __init__(self):\n self.heap = []",
... | [
"0.7540211",
"0.7495445",
"0.7449612",
"0.7400123",
"0.7400123",
"0.7400123",
"0.72300327",
"0.7224344",
"0.7209375",
"0.7182773",
"0.7136554",
"0.70745546",
"0.7047429",
"0.7010996",
"0.69846475",
"0.695481",
"0.6952642",
"0.69490576",
"0.6925778",
"0.69244117",
"0.69045913"... | 0.0 | -1 |
Se construye una priority queue, minHeap Como parametro recibe el diccionario de frecuencias | def make_heap(self, frequency):
for key in frequency:
node = self.HeapNode(key, frequency[key])#instaciamos un nodo con el valor y frecuencia
heapq.heappush(self.heap, node)#agregamos el nodo al priority queue | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_priority_que_success_min_no_priority(priority_queue):\n priority_queue.insert(10)\n priority_queue.insert(5)\n priority_queue.insert(100)\n assert priority_queue._heap[0].value == 10",
"def priority_queue_full():\n from src.priorityq import PriorityQueue\n priority_queue = PriorityQueu... | [
"0.73245394",
"0.724735",
"0.7230464",
"0.70911926",
"0.6946129",
"0.6916181",
"0.68937707",
"0.68039113",
"0.6757227",
"0.6716285",
"0.6688516",
"0.6687496",
"0.6661745",
"0.6660722",
"0.66606385",
"0.66061854",
"0.66046613",
"0.6570331",
"0.6565803",
"0.65304613",
"0.650738... | 0.6614608 | 15 |
Esta funcion se utiliza para hacer que el codigo binario sea multiplo de 8, para asi guardarlo luego como bytes. En caso de no ser multiplo de 8 le agregamos '0' al final para forzarlo a ser multiplo de 8. | def pad_encoded_text(self, encoded_text):
extra_padding = 8 - len(encoded_text) % 8#calculmaos cuanto falta por agregar
for i in range(extra_padding):
encoded_text += "0"
padded_info = "{0:08b}".format(extra_padding)#le agregamos una informacion adicionar la cual utilizaremos despues al comprimir para saber ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def utf8(num):\n # code de la prof louche\n if num < 8:\n return 1\n else:\n return num//6+1\n\n return binary",
"def utf8_to_binary() :\n dico_binary, comp_seq, file_comp = read_compressed_file()\n \n #for each items of the sequence convert it in binary string on 8 bits\n b... | [
"0.66471833",
"0.6639713",
"0.653793",
"0.6367039",
"0.632429",
"0.6318381",
"0.63074166",
"0.62991506",
"0.6284303",
"0.62339085",
"0.62193197",
"0.6145768",
"0.6106193",
"0.6101097",
"0.6099698",
"0.6058014",
"0.6036505",
"0.5985778",
"0.5973782",
"0.5963074",
"0.59404814",... | 0.0 | -1 |
Create and configure an instance of the Flask application. | def create_app(test_config=None):
app = Flask(__name__, instance_relative_config=True)
if app.config["ENV"] == "production":
app.config.from_object("config.ProductionConfig")
else:
app.config.from_object("config.DevelopmentConfig")
if app.config['SECRET_KEY'] is None:
raise Exc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_app():\n\n # 1 Create Flask application\n app = Flask(\n import_name=__name__,\n template_folder=\"templates\",\n static_folder=\"static\"\n )\n\n # 2 Update the apps configuration\n app = config_selector(app)\n register_error_handlers(app)\n\n cache.init_app(app... | [
"0.8524236",
"0.8516853",
"0.8504485",
"0.83319825",
"0.82396483",
"0.82314265",
"0.8200104",
"0.81300336",
"0.80288595",
"0.8026753",
"0.8019436",
"0.79989535",
"0.7984679",
"0.7978355",
"0.7973289",
"0.7970172",
"0.7959833",
"0.79556865",
"0.7952428",
"0.7946338",
"0.793713... | 0.7665361 | 62 |
Getter method for tunnel_metric, mapped from YANG variable /mpls_state/ldp/tunnels/ldp_tunnels/tunnel_metric (uint32) | def _get_tunnel_metric(self):
return self.__tunnel_metric | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_tunnel_metric(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"tunnel-metric\", rest_name=\"tunnel-metric\", paren... | [
"0.787248",
"0.5775085",
"0.52268475",
"0.5217927",
"0.5169334",
"0.48704112",
"0.47564745",
"0.46870294",
"0.46567965",
"0.46452942",
"0.45842758",
"0.45474067",
"0.45454866",
"0.45203787",
"0.4490149",
"0.44528368",
"0.44103217",
"0.43810743",
"0.43802214",
"0.43174794",
"0... | 0.6746544 | 1 |
Setter method for tunnel_metric, mapped from YANG variable /mpls_state/ldp/tunnels/ldp_tunnels/tunnel_metric (uint32) | def _set_tunnel_metric(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="tunnel-metric", rest_name="tunnel-metric", parent=self, path_he... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_next_hop_metric(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"next-hop-metric\", rest_name=\"next-hop-metric\",... | [
"0.6468852",
"0.60566455",
"0.5836589",
"0.49196678",
"0.46951672",
"0.4554392",
"0.4550597",
"0.4487862",
"0.44511905",
"0.43346286",
"0.43113655",
"0.42628804",
"0.42611477",
"0.4200006",
"0.41528833",
"0.41470173",
"0.4097872",
"0.40919003",
"0.4077287",
"0.40689656",
"0.4... | 0.8605958 | 0 |
Getter method for name, mapped from YANG variable /mpls_state/ldp/tunnels/ldp_tunnels/name (string) | def _get_name(self):
return self.__name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_name(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name=\"name\", rest_name=\"name\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com... | [
"0.5090813",
"0.5058265",
"0.4923551",
"0.4921544",
"0.4901212",
"0.484595",
"0.48404792",
"0.483194",
"0.48164737",
"0.48053187",
"0.47947714",
"0.47947714",
"0.4785435",
"0.47577295",
"0.47577295",
"0.47577295",
"0.47577295",
"0.47577295",
"0.47577295",
"0.4754745",
"0.4748... | 0.0 | -1 |
Setter method for name, mapped from YANG variable /mpls_state/ldp/tunnels/ldp_tunnels/name (string) | def _set_name(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="name", rest_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name: str):\n self._name = name",
"def set_name(self, _name):\n self.name = _name\n return self.name",
"def name(self, name: str):\n if name is None:\n raise ValueError(\"Invalid value for `name`, must not be `None`\") # noqa: E501\n\n self._nam... | [
"0.5768138",
"0.57261276",
"0.5717015",
"0.5717015",
"0.5717015",
"0.5717015",
"0.5717015",
"0.5717015",
"0.5717015",
"0.5717015",
"0.5717015",
"0.57159704",
"0.57159704",
"0.5680133",
"0.5680133",
"0.5680133",
"0.5680133",
"0.56487364",
"0.5615849",
"0.5615849",
"0.5615849",... | 0.6363787 | 0 |
Getter method for out_segments, mapped from YANG variable /mpls_state/ldp/tunnels/ldp_tunnels/out_segments (list) | def _get_out_segments(self):
return self.__out_segments | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_out_segments(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=YANGListType(\"outgoing_interface\",out_segments.out_segments, yang_name=\"out-segments\", rest_name=\"out-segments\", parent=self, is_container='list', user_ordered=False, pa... | [
"0.7782451",
"0.58628637",
"0.54530233",
"0.50903213",
"0.48552582",
"0.47954535",
"0.47702944",
"0.47534996",
"0.46822906",
"0.46325573",
"0.4562999",
"0.45285845",
"0.45221573",
"0.45125315",
"0.45005968",
"0.4498356",
"0.44559428",
"0.44239897",
"0.4373917",
"0.43685722",
... | 0.71787906 | 1 |
Get the genesis block | def get_genesis(cls):
header = {
"prev_hash": algo.HASH_LEN * '0',
"root": algo.HASH_LEN * 'f',
"timestamp": 1337.0,
"nonce": algo.NONCE_LEN * '0'
}
return cls(header) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def genesisBlock():\n return Block(0, \"0\", 1465154705, \"my genesis block!!\",\n \"816534932c2b7154836da6afc367695e6337db8a921823784c14378abed4f7d7\");",
"def genesis():\n #return Block(\n #GENESIS_DATA['timestamp'],\n #GENESIS_DATA['last_hash'],\n #GE... | [
"0.8612813",
"0.8519608",
"0.7926867",
"0.78212637",
"0.7589681",
"0.7543601",
"0.7536982",
"0.74724776",
"0.7427732",
"0.7427732",
"0.7301296",
"0.71517515",
"0.7071303",
"0.7043413",
"0.7041905",
"0.69644314",
"0.68472135",
"0.6812987",
"0.6805526",
"0.67819744",
"0.6730378... | 0.6711841 | 21 |
Create random string from a character set. | def create_random_string(length):
return ''.join(random.choice("ACDEFGHJKMNPQRTWXYZ")
for _ in range(length)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_chars(char_set, length):\n s = \"\"\n sz = len(char_set)-1\n r = random.SystemRandom()\n for i in range(0, length+1):\n n = r.randint(0, sz)\n s = s + char_set[n]\n return s",
"def RandomString():\n return \"\".join(random.choice(CHARACTER_SET) for _ in range(STRING_LEN... | [
"0.7881733",
"0.7214051",
"0.6963568",
"0.69582874",
"0.6918719",
"0.6907419",
"0.68807536",
"0.6832773",
"0.68215317",
"0.68125284",
"0.68057466",
"0.6805543",
"0.6800336",
"0.672561",
"0.67117333",
"0.67064047",
"0.662535",
"0.6614045",
"0.6587097",
"0.65863824",
"0.6568078... | 0.0 | -1 |
Read summary of job. | def search_summary(self, target, name="*summary.txt"):
summary_found = glob.glob(os.path.join(self.path, name))
if summary_found:
summary_name = summary_found[0]
if os.path.exists(summary_name):
with open(summary_name, "r") as summary_file:
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_summary_job(job):\n if job is None:\n return None\n url = conf.WIKIPEDIA_URL.format(\n urllib.parse.quote(job))\n\n r = requests.get(url).content\n data_loaded = json.loads(r)\n if type(data_loaded) == dict and data_loaded['title'] != 'Not found.':\n summary = data_loade... | [
"0.68054897",
"0.6259136",
"0.622249",
"0.6129661",
"0.61105084",
"0.60962766",
"0.59839576",
"0.59413147",
"0.58795303",
"0.5796104",
"0.5789329",
"0.5772065",
"0.5756708",
"0.5600015",
"0.5553826",
"0.5537408",
"0.54992276",
"0.5447802",
"0.5391038",
"0.5378679",
"0.5373208... | 0.0 | -1 |
Get a configuration from the current app, or fall back to os.env. | def get_application_config(app: Optional[Flask] = None) ->Mapping:
# pylint: disable=protected-access
if app is not None:
if isinstance(app, Flask):
return app.config
if flask_app: # Proxy object; falsey if there is no application context.
return flask_app.config
return os... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_env():\n app_env = os.getenv(\"APP_ENV\", \"TEST\")\n return ConfigurationFactory.get_config(app_env)",
"def current_config():\n if os.environ[\"ENVIRONMENT\"] == \"production\":\n return Production()\n elif os.environ[\"ENVIRONMENT\"] == \"staging\":\n return Staging()... | [
"0.75097376",
"0.7439782",
"0.72174436",
"0.71761423",
"0.71068466",
"0.70351344",
"0.70303476",
"0.7015616",
"0.70153475",
"0.6958263",
"0.6922452",
"0.68456364",
"0.68438685",
"0.68353",
"0.6807706",
"0.6803812",
"0.67981213",
"0.6783477",
"0.6770236",
"0.6758533",
"0.67140... | 0.76392716 | 0 |
Get the current application global proxy object. Returns proxy or None | def get_application_global() -> Optional[werkzeug.local.LocalProxy]:
if g:
return g # type: ignore
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_proxy(self):\n return self.proxy()",
"def proxy(self):\n\t\tif self.__proxy is None:\n\t\t\treturn PROXY_DEFAULT\n\t\telif isinstance(self.__proxy, basestring):\n\t\t\treturn self.__proxy\n\t\telse:\n\t\t\traise ValueError(\"Proxy!!\")",
"def proxy(self):\n return self.get('proxy', None)"... | [
"0.71598953",
"0.69232327",
"0.6776725",
"0.6643692",
"0.6639855",
"0.6481546",
"0.6112692",
"0.60281223",
"0.60005057",
"0.59307635",
"0.5909591",
"0.5892466",
"0.5797842",
"0.57395446",
"0.57395446",
"0.5712025",
"0.5619453",
"0.5609545",
"0.55908555",
"0.55908555",
"0.5562... | 0.7704217 | 0 |
Object contructor. Set key for API requests | def __init__(self, api_key):
self._api_key = api_key
self._get_params = urllib.urlencode({'subscription-key': api_key})
self._headers = {
# Basic Authorization Sample
# 'Authorization': 'Basic %s' % base64.encodestring('{username}:{password}'),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, api_key: str):\n self.api_key = api_key",
"def __init__(self, api_key):\r\n self.api_key = api_key",
"def __init__(self, key=None):\n self._key = key or os.environ['HERE_API_KEY']",
"def __init__(self, api_key=None):\n self.api_key = api_key",
"def __init__(se... | [
"0.81402403",
"0.81222415",
"0.8114551",
"0.8073673",
"0.80504924",
"0.79244316",
"0.7870784",
"0.78264487",
"0.78235483",
"0.77268183",
"0.7714379",
"0.76652837",
"0.7613839",
"0.76039046",
"0.75493795",
"0.7487023",
"0.7484333",
"0.7457474",
"0.74551564",
"0.74551564",
"0.7... | 0.7292994 | 30 |
Testing bad tailed option. | def test_fail_tailed_option(self):
with self.assertRaises(ValueError):
_p_value_and_confidence_intervals(2.3, 100, 'greater') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_options(self):\n\n wf._items = []\n\n sys.argv = ['drive.py', '> not here']\n main(None)\n self.assertEqual(len(wf._items), 1)\n self.assertEqual(wf._items[0].title, ERRORS['InvalidOption']['title'])\n self.assertFalse(wf._items[0].valid)\n self.ass... | [
"0.75627965",
"0.72289014",
"0.7110534",
"0.705724",
"0.696193",
"0.6945205",
"0.69374156",
"0.693025",
"0.6921404",
"0.68064135",
"0.67977136",
"0.67970276",
"0.67543125",
"0.6746969",
"0.67439955",
"0.6680917",
"0.6669686",
"0.6645032",
"0.6637725",
"0.66218424",
"0.6605776... | 0.6197457 | 52 |
Returns a set of extensions disabled on this channel | def get_disabled(self, channel):
return self.disabled_extensions.get(channel, set()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_disabled_plugins(self):\n return self._disabled_plugins",
"def get_enabled(self, channel):\n return self.extension_names - self.get_disabled(channel)",
"def get_optional_extensions(self):\n return []",
"def get_required_extensions(self):\n return []",
"def extensions(sel... | [
"0.7352268",
"0.7041985",
"0.69945544",
"0.6629966",
"0.6586109",
"0.65787256",
"0.65787256",
"0.64285773",
"0.639227",
"0.63875234",
"0.6385988",
"0.627853",
"0.6271314",
"0.62429434",
"0.6230865",
"0.61979973",
"0.6194124",
"0.61913097",
"0.6157169",
"0.61224616",
"0.612246... | 0.8177675 | 0 |
The name of the column. | def column_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "column_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name(self):\n return self.col_name",
"def columnName(self):\n return self.__column",
"def column_name(self) -> Optional[str]:\n return pulumi.get(self, \"column_name\")",
"def get_column_name(self) -> str:\n if self.is_shared():\n assert self._shared_id is not N... | [
"0.88936096",
"0.8834523",
"0.8703659",
"0.7820816",
"0.7793215",
"0.770282",
"0.75885355",
"0.75579673",
"0.75579673",
"0.75195926",
"0.74106073",
"0.74106073",
"0.7254733",
"0.7254733",
"0.7237926",
"0.71962434",
"0.7195401",
"0.7176704",
"0.71206796",
"0.7115431",
"0.71025... | 0.8617958 | 4 |
The name of the resource group. The name is case insensitive. | def resource_group_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "resource_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_group_name\")",
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def resource_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"resource_group_name\")",
"def resource_gr... | [
"0.8591517",
"0.83646333",
"0.82033736",
"0.82033736",
"0.82033736",
"0.82033736",
"0.82033736",
"0.82033736",
"0.82033736",
"0.82033736",
"0.82033736",
"0.82033736",
"0.82033736",
"0.82033736",
"0.8175502",
"0.8084937",
"0.8084937",
"0.8084937",
"0.8084937",
"0.8084937",
"0.... | 0.8087981 | 51 |
The name of the schema. | def schema_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "schema_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_qualified_name(self):\r\n return self.__schema + \".\" + self.__name",
"def get_schema_url(self):\n return self.NAME_TYPE_SCHEMAS.get(self.name_type, None)",
"def get_schema_name(schema_path):\n print(schema_path)\n path = os.path.normpath(schema_path)\n return os.pat... | [
"0.80118686",
"0.7685699",
"0.76807356",
"0.76068985",
"0.7238417",
"0.71435183",
"0.7129686",
"0.6990798",
"0.6873381",
"0.6833481",
"0.6824794",
"0.68080795",
"0.6789163",
"0.67179954",
"0.6712032",
"0.66892123",
"0.6685197",
"0.6620679",
"0.6548385",
"0.654416",
"0.6539484... | 0.8805085 | 0 |
The information type ID. | def information_type_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "information_type_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def information_type_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"information_type_id\")",
"def getTypeID(self) -> int:\n ...",
"def typeID(self) -> int:\n\t\t# pylint: disable=invalid-name\n\t\treturn self._ot",
"def get_type_id(self):\n\n raise Exception(\"Not ... | [
"0.8816013",
"0.8445265",
"0.7995544",
"0.79396313",
"0.79106444",
"0.7834661",
"0.7779588",
"0.77263844",
"0.7621873",
"0.750992",
"0.7487657",
"0.72888786",
"0.7223047",
"0.7057642",
"0.6951764",
"0.6938796",
"0.6934405",
"0.68459255",
"0.684111",
"0.68215436",
"0.68215436"... | 0.8550614 | 1 |
Get an existing SqlPoolSensitivityLabel resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None) -> 'SqlPoolSensitivityLabel':
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = SqlPoolSensitivityLabelArgs.__new__(SqlPoolSensitivityLabelArgs)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_label(id):\n return if_found(dao.get_label(id))",
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n backup_pool: Optional[pulumi.Input[str]] = None,\n description: Optional[pulumi.Input[str]] = None,\n ... | [
"0.5292389",
"0.5146897",
"0.5050671",
"0.4960148",
"0.49591848",
"0.48732096",
"0.48411962",
"0.48371366",
"0.4825001",
"0.48135552",
"0.4808048",
"0.48046932",
"0.47910935",
"0.47805795",
"0.47394773",
"0.47091335",
"0.46723664",
"0.46375751",
"0.46363795",
"0.46112335",
"0... | 0.7888315 | 0 |
The information type ID. | def information_type_id(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "information_type_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def information_type_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"information_type_id\")",
"def getTypeID(self) -> int:\n ...",
"def typeID(self) -> int:\n\t\t# pylint: disable=invalid-name\n\t\treturn self._ot",
"def get_type_id(self):\n\n raise Exception(\"Not i... | [
"0.8550614",
"0.8445265",
"0.7995544",
"0.79396313",
"0.79106444",
"0.7834661",
"0.7779588",
"0.77263844",
"0.7621873",
"0.750992",
"0.7487657",
"0.72888786",
"0.7223047",
"0.7057642",
"0.6951764",
"0.6938796",
"0.6934405",
"0.68459255",
"0.684111",
"0.68215436",
"0.68215436"... | 0.8816013 | 0 |
Is sensitivity recommendation disabled. Applicable for recommended sensitivity label only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not. | def is_disabled(self) -> pulumi.Output[bool]:
return pulumi.get(self, "is_disabled") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_be_disabled(self) -> bool:\n return True",
"def disabled(self) -> bool:\n return pulumi.get(self, \"disabled\")",
"def disabled(self) -> bool:\n return pulumi.get(self, \"disabled\")",
"def is_disabled(self):\n\n return self.__contains__('disabled')",
"def disabled(self)... | [
"0.64761704",
"0.64364034",
"0.64364034",
"0.64180195",
"0.6351265",
"0.62909853",
"0.62909853",
"0.62909853",
"0.62909853",
"0.62909853",
"0.62909853",
"0.62909853",
"0.62909853",
"0.62909853",
"0.62909853",
"0.62909853",
"0.62909853",
"0.6276564",
"0.6276564",
"0.6237687",
... | 0.6219868 | 21 |
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" | def type(self) -> pulumi.Output[str]:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_type\")",
"def ... | [
"0.7918516",
"0.7918516",
"0.7866337",
"0.7866337",
"0.7866337",
"0.7866337",
"0.7866337",
"0.7708053",
"0.75534964",
"0.7282099",
"0.70591027",
"0.6979169",
"0.69202054",
"0.6868452",
"0.67303157",
"0.67049116",
"0.6654272",
"0.6646357",
"0.66396123",
"0.66396123",
"0.663961... | 0.0 | -1 |
Turns an ObjectLabel into an box_3d | def object_label_to_box_3d(obj_label):
fc.check_object_label_format(obj_label)
box_3d = np.zeros(7)
box_3d[0:3] = obj_label.t
box_3d[3] = obj_label.l
box_3d[4] = obj_label.w
box_3d[5] = obj_label.h
box_3d[6] = obj_label.ry
return box_3d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def box_3d_to_object_label(box_3d, obj_type='Car'):\n\n fc.check_box_3d_format(box_3d)\n\n obj_label = obj_utils.ObjectLabel()\n\n obj_label.type = obj_type\n\n obj_label.t = box_3d.take((0, 1, 2))\n obj_label.l = box_3d[3]\n obj_label.w = box_3d[4]\n obj_label.h = box_3d[5]\n obj_label.ry ... | [
"0.77555287",
"0.64040226",
"0.63454074",
"0.6308304",
"0.6102986",
"0.6064366",
"0.6003773",
"0.59435654",
"0.58984995",
"0.58250475",
"0.57929236",
"0.5776907",
"0.5766211",
"0.5724403",
"0.55941707",
"0.55842286",
"0.55777836",
"0.55655193",
"0.55435383",
"0.5541456",
"0.5... | 0.8783067 | 0 |
Returns the derivative of the polynomial. | def deriv(self):
poly_deriv = []
for i, val in enumerate(self.coeff):
poly_deriv.append(i*val)
# Removes the differentiated constant (which is always 0).
del poly_deriv[0]
return Poly(poly_deriv) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derivative(self) -> Polynomial:\n coefficients: list[float] = [0] * self.degree\n for i in range(self.degree):\n coefficients[i] = self.coefficients[i + 1] * (i + 1)\n return Polynomial(self.degree - 1, coefficients)",
"def derivative ( self ):\n return self.__derivativ... | [
"0.80640745",
"0.72366905",
"0.7205113",
"0.7043707",
"0.69380283",
"0.6904667",
"0.68858963",
"0.6874331",
"0.685892",
"0.6845841",
"0.68192995",
"0.67496014",
"0.6719688",
"0.66250384",
"0.6597144",
"0.6544061",
"0.6536769",
"0.6518428",
"0.6518428",
"0.65071756",
"0.647962... | 0.7513244 | 1 |
Returns reputation of the user. | def get_user_reputation(db, user_id):
muddas = db.execute('''select count(*) from message where
author_id = %s''' % (user_id))
return muddas.fetchone()[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reputation(self) -> int:\n return self._reputation",
"def get_reputation_score(self):\n self._extract()\n if self.user_type == 0:\n for key in BitBucketEnum.USER_NEW_REPUTATION_MAPPING:\n if key.high >= self.no_of_followers >= key.low:\n retur... | [
"0.8184056",
"0.76162",
"0.69041735",
"0.6345966",
"0.62551254",
"0.6173726",
"0.6038486",
"0.59987664",
"0.5835841",
"0.56642777",
"0.55898046",
"0.5483086",
"0.5474121",
"0.54692876",
"0.5463739",
"0.5463739",
"0.5461857",
"0.5408507",
"0.5321992",
"0.5291672",
"0.5236963",... | 0.77521765 | 1 |
maximum value of dtype | def max_value(dtype):
return _api_internal._max_value(dtype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def MaximumValue(self):\n datatype = self.NumPyDataType\n if issubclass(datatype, numpy.integer):\n return numpy.iinfo(datatype).max\n elif issubclass(datatype, numpy.floating):\n return numpy.inf\n else:\n raise TypeError(\"Cannot handle DataType: {0}\"... | [
"0.77579236",
"0.7565953",
"0.7509675",
"0.7484681",
"0.73976016",
"0.7336556",
"0.7278407",
"0.70756334",
"0.70754564",
"0.7052625",
"0.7042913",
"0.7042913",
"0.70154893",
"0.68845314",
"0.68314886",
"0.6814904",
"0.6795724",
"0.6789237",
"0.6776031",
"0.6769447",
"0.676771... | 0.8582118 | 0 |
Convert value to TVM node or function. | def convert(value):
if isinstance(value, (Function, NodeBase)):
return value
if callable(value):
return _convert_tvm_func(value)
return _convert_to_node(value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert(self, value):\r\n return value",
"def convert(self, value):\n return value",
"def convert(self, value, context):\n return value",
"def convert(self, value):\r\n return Converter.convert(self, value)",
"def __call__(self, value):\n with tf.name_scope('parser'):\n ... | [
"0.6279382",
"0.6256688",
"0.60399127",
"0.6025817",
"0.60166246",
"0.5995694",
"0.5848212",
"0.5749729",
"0.57351524",
"0.5657269",
"0.5657269",
"0.5632645",
"0.55735344",
"0.5570252",
"0.5570252",
"0.5559893",
"0.55296767",
"0.55156195",
"0.54953367",
"0.54953367",
"0.54931... | 0.847413 | 0 |
Add edge from vertex1 to vertex2 Outgoing path is added for vertex1 and Incoming path is added to vertex2 | def add_edge(self, vertex1, vertex2):
vertex1.add_outgoing_node(vertex2)
vertex2.add_incoming_node(vertex1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, v1, v2):\n # TODO\n\n # add directed edges\n self.vertices[v1].add(v2)\n # self.vertices[v2].add(v1)",
"def add_edge(self, v1, v2):\n pass # TODO",
"def add_edge(self, v1, v2):\n # add the 2nd node to the list of edges for the first node\n if... | [
"0.80195355",
"0.8014558",
"0.79909235",
"0.78902555",
"0.78623915",
"0.78332496",
"0.77914",
"0.7787613",
"0.77378166",
"0.77030283",
"0.7691134",
"0.76855844",
"0.76425695",
"0.7630411",
"0.760392",
"0.7576403",
"0.7557445",
"0.7533331",
"0.7397467",
"0.73893046",
"0.737633... | 0.84819597 | 0 |
Opens file as a file object and returns list of contents. | def open_and_read_file(filename):
our_New_File = open(filename)
our_New_File = our_New_File.read()
our_New_File = our_New_File.split()
return our_New_File | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_contents_as_list(file_name):\n with open(file_name) as file:\n data = file.read().splitlines()\n return data",
"def read_file(file):\n\tfile_contents = []\n\twith open(file) as csvfile:\n\t\treader = csv.reader(csvfile)\n\t\tfile_contents = list(reader)\n\treturn file_conten... | [
"0.76863444",
"0.75270146",
"0.7516787",
"0.7369235",
"0.73338413",
"0.71808106",
"0.71676",
"0.7146824",
"0.7086747",
"0.7080839",
"0.7004382",
"0.69245505",
"0.690404",
"0.68940645",
"0.6878723",
"0.6855489",
"0.6831297",
"0.6764957",
"0.6756562",
"0.6756251",
"0.6742705",
... | 0.0 | -1 |
Initialize the weights of the nnet | def _initialize_weights(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights_(self):\n raise NotImplementedError",
"def initialize_weights(self):\n for layer in self._cnn_layers:\n weights_initializer.WeightsInitializer.initialize_layer_or_model(layer)",
"def init_weight(self):\n init_layer(self.conv1)\n init_layer(self.conv2)\n init... | [
"0.8081424",
"0.8063455",
"0.8005433",
"0.79929304",
"0.7989815",
"0.7973171",
"0.7935623",
"0.79169947",
"0.7898647",
"0.7873155",
"0.786975",
"0.7854538",
"0.7819653",
"0.7791364",
"0.778897",
"0.7758977",
"0.77389",
"0.77116245",
"0.76937133",
"0.7688013",
"0.76717275",
... | 0.8290864 | 0 |
Convert string to list if not already | def _providers_string_to_list(val):
# Use a set to remove duplicates
if type(val) == str:
return list(set(val.replace(' ', '').split(',')))
return list(set(val)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str2list(input):\n if isinstance(input, str):\n return [input]\n\n else:\n return input",
"def _convert_str_to_list(cls, v: Union[List[str], str]) -> List[str]:\n if isinstance(v, str):\n return v.split(\",\")\n return v # cov: ignore",
"def _strings_to_list(on... | [
"0.80174595",
"0.7779365",
"0.76761246",
"0.74755675",
"0.740217",
"0.733614",
"0.727507",
"0.7184322",
"0.7121702",
"0.71059835",
"0.7094156",
"0.70723337",
"0.7016092",
"0.70036477",
"0.6989471",
"0.6876689",
"0.68761295",
"0.6848565",
"0.684002",
"0.67927045",
"0.6792517",... | 0.70332205 | 12 |
Stack k last frames. Returns lazy array, which is much more memory efficient. See Also baselines.common.atari_wrappers.LazyFrames | def __init__(self, env, k):
gym.Wrapper.__init__(self, env)
self.k = k
self.frames = deque([], maxlen=k)
shp = env.observation_space.shape
self.observation_space = spaces.Box(low=0, high=255, shape=(shp[:-1] + (shp[-1] * k,)), dtype=env.observation_space.dtype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stack_context(features, k=10, labels=None):\n n_feats, n_frames = features.shape[0], features.shape[1]\n stacked_features = np.array([features[:,frame-k:frame+k+1] for frame in range(k,n_frames-k-1)])\n stacked_features = np.reshape(stacked_features, [-1, (2*k+1)*n_feats]).T\n\n if labels is not No... | [
"0.57865286",
"0.5741627",
"0.5726587",
"0.567123",
"0.56566584",
"0.5654241",
"0.56238633",
"0.5528545",
"0.5497",
"0.5494203",
"0.53637475",
"0.53107125",
"0.53068376",
"0.52863336",
"0.52829486",
"0.52807283",
"0.52513605",
"0.52412486",
"0.52375424",
"0.52159554",
"0.5197... | 0.0 | -1 |
Convert a datetime.datatime object to a datetime.date object | def convert_datetime_to_date(datetime_obj: datetime) -> date:
assert isinstance(datetime_obj, datetime), "Not a datetime object."
return datetime_obj.date() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _date_to_datetime(value):\r\n assert isinstance(value, datetime.date)\r\n return datetime.datetime(value.year, value.month, value.day)",
"def _to_date(self, x):\n if isinstance(x, datetime.datetime):\n return x.date()\n return x",
"def convert_date_to_datetime(date_obj: date)... | [
"0.7541873",
"0.7527641",
"0.743314",
"0.71043843",
"0.7079859",
"0.6963271",
"0.68946266",
"0.6842356",
"0.6833108",
"0.6800361",
"0.6779418",
"0.67234695",
"0.6576024",
"0.65474147",
"0.6536968",
"0.64717054",
"0.6425142",
"0.63471526",
"0.6323886",
"0.6271963",
"0.6265224"... | 0.7451771 | 2 |
Add a name to the names list. | def _add_name(self, msg, name):
try:
names = self.get_local(msg, "names")
except KeyError:
names = set()
names.add(name)
self.set_local(msg, "names", names) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_name(self, name: str) -> None:\n self._names.append(name)",
"def AddName(self, name):\n self.__names.append(name)\n self.Modified()",
"def add_names(self, *sNames):\n self.names += list(sNames)",
"def add_name(self, name):\n self.name = name",
"def addAlias(self, ... | [
"0.86947227",
"0.83983153",
"0.79373425",
"0.7711156",
"0.70747286",
"0.7012143",
"0.69368744",
"0.69045013",
"0.68825597",
"0.68747795",
"0.6838872",
"0.6763741",
"0.66478956",
"0.6561512",
"0.65537184",
"0.64515525",
"0.64220285",
"0.6418434",
"0.6418434",
"0.6418434",
"0.6... | 0.8068757 | 2 |
Match if the name matches a regular expression. | def image_name_regex(self, msg, regex, target=None):
name_re = oa.regex.perl2re(regex)
names = self._get_image_names(msg)
for name in names:
if name_re.match(name):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_name_matching(string, matches: bool):\n assert (re.fullmatch(pattern, string) is not None) == matches",
"def _regex_comp(self, name, flist):\n if name in flist:\n return True\n for item in flist:\n p = re.compile(item)\n match = p.match(name)\n ... | [
"0.7096113",
"0.68586236",
"0.6832065",
"0.68237925",
"0.66911465",
"0.66336304",
"0.6611614",
"0.6572248",
"0.65638494",
"0.6549043",
"0.644251",
"0.6401486",
"0.6392493",
"0.63684195",
"0.63526124",
"0.63193214",
"0.63174033",
"0.62669635",
"0.6262099",
"0.6259306",
"0.6240... | 0.6171424 | 24 |
Ensures the user has an active account. Optimized for the ``django.contrib.auth.models.User`` case. | def check_active(self, user):
if not self.require_active:
# Ignore & move on.
return True
return user.is_active | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activate_user(self, user):\n if not user.active:\n user.active = True\n return True\n return False",
"def activate_user(self, user):\n if not user.active:\n user.active = True\n # noinspection PyUnresolvedReferences\n self.save(user)... | [
"0.7736804",
"0.7614778",
"0.75469196",
"0.7225659",
"0.72024155",
"0.7185472",
"0.7175116",
"0.71358246",
"0.71358246",
"0.71358246",
"0.71358246",
"0.71358246",
"0.70492345",
"0.70281875",
"0.69713575",
"0.6925092",
"0.6901343",
"0.6868536",
"0.6851052",
"0.68341273",
"0.68... | 0.7624484 | 1 |
Checks a user's basic auth credentials against the current Django auth backend. Should return either ``True`` if allowed, ``False`` if not or an ``HttpResponse`` if you need something custom. | def is_authenticated(self, request, **kwargs):
if not request.META.get('HTTP_AUTHORIZATION'):
return self._unauthorized()
try:
(auth_type, data) = request.META['HTTP_AUTHORIZATION'].split()
if auth_type.lower() != 'basic':
return self._unauthor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basic_auth_required(view_func):\n # http://djangosnippets.org/snippets/448/\n def _auth(request, *args, **kwargs):\n if 'HTTP_AUTHORIZATION' in request.META:\n auth = request.META['HTTP_AUTHORIZATION'].split()\n if len(auth) == 2:\n if auth[0].lower() == \"basi... | [
"0.7249858",
"0.7208708",
"0.6995782",
"0.6948909",
"0.68970144",
"0.68316627",
"0.6735266",
"0.6711592",
"0.6709405",
"0.6701788",
"0.66545",
"0.66545",
"0.66335964",
"0.6626289",
"0.6625748",
"0.6585397",
"0.6570015",
"0.656018",
"0.6550344",
"0.6549522",
"0.65337485",
"0... | 0.7130147 | 2 |
Checks to ensure that all the OAuth parameter names are in the provided ``params``. | def is_in(self, params):
from oauth_provider.consts import OAUTH_PARAMETERS_NAMES
for param_name in OAUTH_PARAMETERS_NAMES:
if param_name not in params:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_params(params):\n\n required = ['initlandmarks']\n for r in required:\n assert r in params.keys(), 'Params must include {}'.format(r)",
"def _check_parameters(self, ep, params):\n\n any_group_satisfied = False\n for group in ep.REQUIRED:\n if all(required_param in ... | [
"0.7285534",
"0.7211709",
"0.7126631",
"0.7121936",
"0.7068163",
"0.70661825",
"0.70594436",
"0.70415455",
"0.7026599",
"0.6943581",
"0.68871313",
"0.6876744",
"0.6833549",
"0.67174983",
"0.6704745",
"0.6703145",
"0.663663",
"0.66279244",
"0.66213",
"0.6620816",
"0.6591034",
... | 0.76074886 | 0 |
Makes ``Authorization`` a descriptor of ``ResourceOptions`` and creates a reference to the ``ResourceOptions`` object that may be used by methods of ``Authorization``. | def __get__(self, instance, owner):
self.resource_meta = instance
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__, resource_name, opts=None, certificate_authority_configuration=None, enabled=None, permanent_deletion_time_in_days=None, revocation_configuration=None, tags=None, type=None, __props__=None, __name__=None, __opts__=None):\n if __name__ is not None:\n warnings.warn(\"explicit ... | [
"0.6020222",
"0.60166335",
"0.59568375",
"0.5942353",
"0.59015995",
"0.5891294",
"0.58533263",
"0.57830095",
"0.5644851",
"0.5605517",
"0.5605418",
"0.56010914",
"0.5560622",
"0.55552214",
"0.5544433",
"0.55300456",
"0.55118215",
"0.5510557",
"0.54916304",
"0.5485132",
"0.547... | 0.0 | -1 |
Checks if the user is authorized to perform the request. If ``object`` is provided, it can do additional rowlevel checks. Should return either ``True`` if allowed, ``False`` if not or an ``HttpResponse`` if you need something custom. | def is_authorized(self, request, obj=None):
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_authorized(self, request, object=None):\n if request.user.is_superuser:\n return True\n\n if not object:\n # if the object is unavailable, then leave the authorization to the apply_limits method\n # or to the over-rides of this method\n return True\n... | [
"0.7441831",
"0.74014306",
"0.73093945",
"0.727171",
"0.72491837",
"0.72440606",
"0.7232059",
"0.7210261",
"0.7202326",
"0.71925175",
"0.71911705",
"0.7183503",
"0.7165748",
"0.715481",
"0.7147539",
"0.71329576",
"0.71307623",
"0.71254474",
"0.7113402",
"0.7103005",
"0.710300... | 0.72825813 | 3 |
Optionally accepts an ``attr``, which should be a string of either an instance attribute or callable off the object during ``process``. Defaults to ``None``, meaning data will be manually accessed. Optionally accepts a ``default``, which provides default data when the object being ``processed`` has no data on the field... | def __init__(self, attr=None, default=None, help_text=None):
self._attribute = attr
self._field_name = None
self._default = default
if help_text:
self.help_text = help_text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_attr_helper(self, object, field, default=None):\n # TODO: Make PR to fix this ^ bug\n if hasattr(object, field):\n return getattr(object, field)\n\n return default",
"def __init__(self, *args, **kwargs):\n if not args:\n raise TypeError('Field definitio... | [
"0.5863607",
"0.5784444",
"0.5646748",
"0.5646748",
"0.5628012",
"0.5613186",
"0.54752284",
"0.543945",
"0.53355473",
"0.53071487",
"0.5295331",
"0.5237086",
"0.523609",
"0.5220396",
"0.52149266",
"0.52103233",
"0.52062714",
"0.5188362",
"0.5154186",
"0.5141225",
"0.5101233",... | 0.67173475 | 0 |
Returns a boolean of whether this field has a default value. | def has_default(self):
return self._default is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_default_value(self):\n return self.default is not None",
"def has_default_value(self, name):\n return self.get_attribute_schema(name).has_default_value",
"def has_default(self):\r\n return self.default is not None",
"def has_default(model_field: DataclassCreationFields) -> bool:\... | [
"0.86846113",
"0.8106691",
"0.8099059",
"0.8059237",
"0.7869552",
"0.758738",
"0.7584747",
"0.75369126",
"0.74947244",
"0.7468538",
"0.74284494",
"0.74118936",
"0.74118936",
"0.73985183",
"0.73017776",
"0.7270397",
"0.72586685",
"0.7219383",
"0.7219383",
"0.7219383",
"0.72193... | 0.7979636 | 4 |
Determines the proper maximum number of results to return. | def get_limit(self):
limit = self.request_data.get('limit', self.limit)
if limit is None:
limit = getattr(settings, 'API_LIMIT_PER_PAGE', 20)
try:
limit = int(limit)
except ValueError:
raise BadRequest(
"Invalid limit '%s' p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_results(self) -> float:\n return self._max_results",
"def max_results(self) -> str:\n return pulumi.get(self, \"max_results\")",
"def _determine_limit(self, limit):\n\n # Note: +1 is allowed here because it allows\n # the user to fetch one beyond to see if they\n # ar... | [
"0.7424188",
"0.73012775",
"0.70610124",
"0.70139414",
"0.68197155",
"0.67455894",
"0.6710359",
"0.66792804",
"0.66114205",
"0.65120083",
"0.6482303",
"0.6477769",
"0.64406085",
"0.6427381",
"0.6413323",
"0.64021224",
"0.63875824",
"0.63838345",
"0.63553286",
"0.63399744",
"0... | 0.0 | -1 |
A hook to control how datetimes are formatted. Can be overridden at the ``Serializer`` level (``datetime_formatting``) or globally (via ``settings.DELICIOUS_CAKE_DATETIME_FORMATTING``). | def format_datetime(self, data):
data = make_naive(data)
if self.datetime_formatting == 'rfc-2822':
return format_datetime(data)
return data.isoformat() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datetime_format(context):\n return {'DATETIME_FORMAT': settings.DATETIME_FORMAT.replace('%', '')}",
"def format_date(self, data):\r\n if self.datetime_formatting == 'rfc-2822':\r\n return format_date(data)\r\n\r\n return data.isoformat()",
"def format_datetime(self, datetime):\n... | [
"0.66110486",
"0.6392224",
"0.634406",
"0.63079673",
"0.6306439",
"0.6266501",
"0.6234092",
"0.62103003",
"0.61847234",
"0.61650395",
"0.61491525",
"0.60894626",
"0.60634506",
"0.6026088",
"0.599988",
"0.59623426",
"0.5935637",
"0.59240323",
"0.5884567",
"0.5855736",
"0.58044... | 0.68528706 | 0 |
A hook to control how times are formatted. Can be overridden at the ``Serializer`` level (``datetime_formatting``) or globally (via ``settings.DELICIOUS_CAKE_DATETIME_FORMATTING``). | def format_time(self, data):
if self.datetime_formatting == 'rfc-2822':
return format_time(data)
return data.isoformat() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_action_set_time_format(self, content):\n self.set_time_format(content['time_format'])",
"def time_formats(self) -> localedata.LocaleDataDict:\n return self._data['time_formats']",
"def set_timeformat(self, tsformat=None):\n self._timestampFormat = tsformat",
"def datetime_format(c... | [
"0.6929254",
"0.6314527",
"0.6191749",
"0.6104157",
"0.607456",
"0.6068035",
"0.5932887",
"0.5917905",
"0.587497",
"0.58634365",
"0.58494854",
"0.5788309",
"0.5784242",
"0.5769785",
"0.57655984",
"0.57637125",
"0.5727732",
"0.571506",
"0.5658016",
"0.565317",
"0.56443554",
... | 0.67758644 | 1 |
Given some Python data, produces YAML output. | def to_yaml(self, data, options=None):
options = options or {}
if yaml is None:
raise UnsupportedSerializationFormat("Usage of the YAML aspects requires yaml.")
return yaml.dump(self.to_simple(data, options)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DumpYaml(data):\n #NOTE(g): Import is done here, instead of the top of the file, to not require this module if it is not used\n import yaml\n \n text = yaml.safe_dump(data)\n \n return text",
"def _yaml_dump(data):\n return yaml.dump(data, Dumper=_OrderedDumper, allow_unicode=True)",
"def pdump(da... | [
"0.7447313",
"0.7166232",
"0.7100774",
"0.7092351",
"0.70849323",
"0.7061118",
"0.7038931",
"0.6903972",
"0.67381144",
"0.6633934",
"0.6593408",
"0.65112597",
"0.6509104",
"0.64395535",
"0.637974",
"0.6299583",
"0.6290893",
"0.62828183",
"0.6245169",
"0.61800086",
"0.61800086... | 0.6578388 | 11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.