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 |
|---|---|---|---|---|---|---|
Create the Product instance and its connectedProductAttribute | def create(self, validated_data):
# Create the Attribute instance
product = Product(
name=validated_data['name'],
product_template=validated_data['product_template']['id'],
description=validated_data.get('description'),
active=validated_data.get('active',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_product(self):\n product = self.product_obj.create({\n \"default_code\": 'A2330',\n \"product_tmpl_id\":\n self.ref(\"product.product_product_4_product_template\"),\n \"attribute_value_ids\": [(6, 0, [\n self.ref('product.product_attribut... | [
"0.7809591",
"0.74017674",
"0.70743674",
"0.6890056",
"0.6756093",
"0.67468816",
"0.6729608",
"0.6729589",
"0.6467058",
"0.6433752",
"0.6425072",
"0.64164263",
"0.6376284",
"0.63619643",
"0.6321698",
"0.6321698",
"0.63119274",
"0.62768716",
"0.6142879",
"0.60312605",
"0.60166... | 0.77725405 | 1 |
Gets the enabled of this ShiftTradeSettings. Whether shift trading is enabled for this management unit | def enabled(self):
return self._enabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_isenabled(self):\n return self.isenabled",
"def enabled(self):\n return self._get('enabled')",
"def enabled(self) -> bool:\n return pulumi.get(self, \"enabled\")",
"def enabled(self) -> bool:\n return pulumi.get(self, \"enabled\")",
"def enabled(self) -> bool:\n r... | [
"0.70148814",
"0.69808656",
"0.69736594",
"0.69736594",
"0.69736594",
"0.69736594",
"0.69736594",
"0.69736594",
"0.694321",
"0.6886858",
"0.6877134",
"0.6877134",
"0.6877134",
"0.6877134",
"0.6877134",
"0.6877134",
"0.6877134",
"0.6877134",
"0.6866529",
"0.68635756",
"0.68575... | 0.68832886 | 15 |
Gets the auto_review of this ShiftTradeSettings. Whether automatic shift trade review is enabled according to the rules defined in for this management unit | def auto_review(self):
return self._auto_review | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auto_review(self, auto_review):\n \n self._auto_review = auto_review",
"def review(self):\n return self._review",
"def auto(self):\n return self._auto",
"def auto_mode(self):\n return self._auto_mode",
"def review(self) -> object:\n return self._review",
"def... | [
"0.62337404",
"0.5877003",
"0.58669287",
"0.5605534",
"0.55631214",
"0.5485725",
"0.5485725",
"0.54195344",
"0.53595024",
"0.53475046",
"0.5258285",
"0.52451265",
"0.520811",
"0.5148728",
"0.5148728",
"0.5133972",
"0.51075655",
"0.5106319",
"0.5101208",
"0.5100062",
"0.509978... | 0.7241317 | 0 |
Gets the allow_direct_trades of this ShiftTradeSettings. Whether direct shift trades between agents are allowed | def allow_direct_trades(self):
return self._allow_direct_trades | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_direct_trades(self, allow_direct_trades):\n \n self._allow_direct_trades = allow_direct_trades",
"def allow_gateway_transit(self) -> pulumi.Output[Optional[bool]]:\n return pulumi.get(self, \"allow_gateway_transit\")",
"def allow_gateway_transit(self) -> Optional[pulumi.Input[boo... | [
"0.747426",
"0.53346044",
"0.5100105",
"0.5100105",
"0.5003391",
"0.49880004",
"0.49498343",
"0.49094033",
"0.48874655",
"0.48220852",
"0.47878334",
"0.47765717",
"0.47406754",
"0.47323847",
"0.47250593",
"0.4720025",
"0.4684115",
"0.46295232",
"0.46295232",
"0.46295232",
"0.... | 0.79995286 | 0 |
Sets the min_hours_in_future of this ShiftTradeSettings. The minimum number of hours in the future shift trades are allowed | def min_hours_in_future(self, min_hours_in_future):
self._min_hours_in_future = min_hours_in_future | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_hours_in_future(self):\n return self._min_hours_in_future",
"def min_time(self, min_time: str):\n\n self._min_time = min_time",
"def min_voms_proxy_hours(self):\n return int(self.__get_option('min_voms_proxy_valid_hours'))",
"def min_myproxy_hours(self):\n return int(self.... | [
"0.7488132",
"0.5778957",
"0.55238605",
"0.5499553",
"0.5439674",
"0.53993577",
"0.5261042",
"0.5257334",
"0.5257334",
"0.52563965",
"0.5238442",
"0.5238442",
"0.5238442",
"0.5131546",
"0.512785",
"0.512785",
"0.5121968",
"0.509475",
"0.5084545",
"0.5068271",
"0.50552446",
... | 0.8711309 | 0 |
Gets the unequal_paid of this ShiftTradeSettings. How to handle shift trades which involve unequal paid times | def unequal_paid(self):
return self._unequal_paid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unequal_paid(self, unequal_paid):\n allowed_values = [\"Allow\", \"Disallow\", \"AdminReview\"]\n if unequal_paid.lower() not in map(str.lower, allowed_values):\n # print(\"Invalid value for unequal_paid -> \" + unequal_paid)\n self._unequal_paid = \"outdated_sdk_version\"\n... | [
"0.6139955",
"0.53387636",
"0.49372396",
"0.49044767",
"0.48526916",
"0.47926265",
"0.47427806",
"0.4700392",
"0.46879274",
"0.46879274",
"0.46811366",
"0.46606246",
"0.4617068",
"0.46066138",
"0.45941156",
"0.45581588",
"0.45421192",
"0.45329323",
"0.45126745",
"0.4495702",
... | 0.73930126 | 0 |
Sets the unequal_paid of this ShiftTradeSettings. How to handle shift trades which involve unequal paid times | def unequal_paid(self, unequal_paid):
allowed_values = ["Allow", "Disallow", "AdminReview"]
if unequal_paid.lower() not in map(str.lower, allowed_values):
# print("Invalid value for unequal_paid -> " + unequal_paid)
self._unequal_paid = "outdated_sdk_version"
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unequal_paid(self):\n return self._unequal_paid",
"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 unapproved(self, unapproved):\n\n self._... | [
"0.66380477",
"0.5880214",
"0.5880214",
"0.51383543",
"0.500558",
"0.49487096",
"0.48211223",
"0.47970998",
"0.47960222",
"0.47937986",
"0.47918844",
"0.47356665",
"0.47185376",
"0.4710121",
"0.46704188",
"0.4662278",
"0.46506834",
"0.46480542",
"0.46471024",
"0.46138376",
"0... | 0.7029199 | 0 |
Gets the one_sided of this ShiftTradeSettings. How to handle onesided shift trades | def one_sided(self):
return self._one_sided | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def side(self):\n return self._side.copy()",
"def dwarsdoorsnede(self):\n return self._dwarsdoorsnede.get_waarde()",
"def get_wl(self, strict=True):\n ax, wl, ds, ss = self.get_response()\n if (ax is True) and (strict is True):\n wl = None\n return wl",
"def __re... | [
"0.5588246",
"0.4999655",
"0.49308547",
"0.49244335",
"0.49237114",
"0.49048492",
"0.4892378",
"0.4798444",
"0.4798198",
"0.47741646",
"0.4773227",
"0.47707933",
"0.4730155",
"0.46796873",
"0.4664128",
"0.46336004",
"0.46076268",
"0.45964298",
"0.4591801",
"0.45813593",
"0.45... | 0.6997625 | 0 |
Sets the requires_matching_languages of this ShiftTradeSettings. Whether to constrain shift trades to agents with matching languages | def requires_matching_languages(self, requires_matching_languages):
self._requires_matching_languages = requires_matching_languages | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def requires_matching_languages(self):\n return self._requires_matching_languages",
"def allows_language_choice(self, allows_language_choice):\n\n self._allows_language_choice = allows_language_choice",
"def requires_matching_skills(self, requires_matching_skills):\n \n self._requir... | [
"0.660035",
"0.5910095",
"0.5873693",
"0.5462056",
"0.4720534",
"0.46974784",
"0.46014965",
"0.4505857",
"0.44450456",
"0.4354574",
"0.4335083",
"0.43275222",
"0.4273099",
"0.42656523",
"0.42637634",
"0.42247966",
"0.41790164",
"0.41742778",
"0.41720313",
"0.41189757",
"0.411... | 0.81081593 | 0 |
Gets the requires_matching_planning_groups of this ShiftTradeSettings. Whether to constrain shift trades to agents with matching planning groups | def requires_matching_planning_groups(self):
return self._requires_matching_planning_groups | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def requires_matching_planning_groups(self, requires_matching_planning_groups):\n \n self._requires_matching_planning_groups = requires_matching_planning_groups",
"def enable_groups(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"enable_groups\")",
"def match_constraints... | [
"0.78293633",
"0.5144219",
"0.4976061",
"0.49256355",
"0.48759344",
"0.48727217",
"0.47323728",
"0.47321418",
"0.46929336",
"0.46308273",
"0.46221137",
"0.45919544",
"0.45839018",
"0.4579318",
"0.45729378",
"0.45659393",
"0.45462197",
"0.4495398",
"0.44463462",
"0.44000325",
... | 0.8434141 | 0 |
Sets the requires_matching_planning_groups of this ShiftTradeSettings. Whether to constrain shift trades to agents with matching planning groups | def requires_matching_planning_groups(self, requires_matching_planning_groups):
self._requires_matching_planning_groups = requires_matching_planning_groups | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def requires_matching_planning_groups(self):\n return self._requires_matching_planning_groups",
"def requires_matching_queues(self, requires_matching_queues):\n \n self._requires_matching_queues = requires_matching_queues",
"def requires_matching_skills(self, requires_matching_skills):\n ... | [
"0.7490272",
"0.4813987",
"0.47733462",
"0.4771342",
"0.46703315",
"0.45196325",
"0.44602185",
"0.44554698",
"0.44414607",
"0.44335997",
"0.44194436",
"0.43835708",
"0.43758637",
"0.43642312",
"0.43547672",
"0.43463677",
"0.4340733",
"0.4329243",
"0.43282712",
"0.42960754",
"... | 0.8618694 | 0 |
Gets the activity_category_rules of this ShiftTradeSettings. Rules that specify what to do with activity categories that are part of a shift defined in a trade | def activity_category_rules(self):
return self._activity_category_rules | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activity_category_rules(self, activity_category_rules):\n \n self._activity_category_rules = activity_category_rules",
"def get_rules_for_category(category):\n\n rules = get_db().execute('SELECT * FROM ruleset WHERE category_id = ?', (category,)).fetchall()\n\n return rules",
"def get_r... | [
"0.65764445",
"0.56854343",
"0.5613786",
"0.5561689",
"0.55392265",
"0.55276525",
"0.55239964",
"0.5513118",
"0.54814136",
"0.5451201",
"0.53944457",
"0.53867567",
"0.53611493",
"0.53129584",
"0.52809757",
"0.5203807",
"0.51137215",
"0.5097135",
"0.50868076",
"0.50547934",
"0... | 0.81497526 | 0 |
Sets the activity_category_rules of this ShiftTradeSettings. Rules that specify what to do with activity categories that are part of a shift defined in a trade | def activity_category_rules(self, activity_category_rules):
self._activity_category_rules = activity_category_rules | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activity_category_rules(self):\n return self._activity_category_rules",
"def set_device_rules(self, rules, rule_objs):\n self.logger.debug(\"set_device_rules: rules: {}\".format(rules))\n self._load_device_rules(rules, rule_objs=rule_objs)\n self._determine_cli_command_list()\n ... | [
"0.5965316",
"0.49182183",
"0.47771955",
"0.4753459",
"0.47052824",
"0.46763086",
"0.45752648",
"0.4574007",
"0.4574007",
"0.4574007",
"0.4574007",
"0.4553582",
"0.4497546",
"0.44832736",
"0.4482188",
"0.4435759",
"0.43805346",
"0.43805346",
"0.43805346",
"0.43805346",
"0.438... | 0.8358281 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
return self.__dict__ == other.__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.7961088",
"0.7961088",
"0.79433626",
"0.79303336",
"0.7926563",
"0.7897525",
"0.78826123",
"0.78826123",
"0.78806067",
"0.7872423",
"0.7868354",
"0.78668815",
"0.7825702",
"0.7819993",
"0.78162885",
"0.78078854",
"0.78068... | 0.79670393 | 21 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"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.0 | -1 |
shows form by which user can add new post | def show_form_to_add_new_post(user_id):
user = User.query.get_or_404(user_id)
tags = Tag.query.all()
return render_template('posts/new.html', user=user, tags=tags) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_new_post_form(user_id):\n\n user = User.query.get_or_404(user_id)\n\n return render_template('new_post_form.html', user=user)",
"def new_post_form(user_id):\n user = User.query.get_or_404(user_id)\n tags = Tag.query.all()\n return render_template('posts/new.html', user=user, tags=tags)",
... | [
"0.7803368",
"0.77031416",
"0.76967293",
"0.7611464",
"0.7593046",
"0.75702906",
"0.7559357",
"0.75396353",
"0.7437009",
"0.74052477",
"0.7396248",
"0.73693126",
"0.7366067",
"0.7362356",
"0.7318585",
"0.7317058",
"0.7299925",
"0.7257682",
"0.72130656",
"0.72055334",
"0.71996... | 0.7992803 | 0 |
adds new post to db and redirects to user detail page | def add_new_post(user_id):
user = User.query.get_or_404(user_id)
tag_ids = [int(num) for num in request.form.getlist("tags")]
tags = Tag.query.filter(Tag.id.in_(tag_ids)).all()
new_post = Post(title=request.form['title'],
content=request.form['content'],
us... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_post(request):\n if request.session.get('id_user') is None:\n request.session['res'] = 'Warn'\n messages.add_message(request, messages.WARNING,\n \"The session has expired\")\n return HttpResponseRedirect(reverse('home'))\n form = PostForm(request.POST... | [
"0.77512014",
"0.76852494",
"0.75416464",
"0.7478064",
"0.7418435",
"0.73780847",
"0.7377658",
"0.72728056",
"0.7265733",
"0.72467005",
"0.72125876",
"0.71652454",
"0.71383387",
"0.709577",
"0.7071186",
"0.6992147",
"0.6979702",
"0.6978954",
"0.69764656",
"0.6975354",
"0.6965... | 0.7367204 | 7 |
Call this function to retrieve the singleton ConfigurationManager object, reading and initializing it if necessary. Since so much happens when the ConfigurationManager is initialized, this has to go in a function so that autodoc doesn't blow up when it tries to import the module. | def cm(cache=[]):
if not cache:
cache.append(ConfigurationManager())
return cache[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(cls) -> \"__Config\":\n if cls.__instance is None:\n cls.__instance = cls.__Config()\n return cls.__instance",
"def get(cls):\n\t\tif cls.__ConfigParser is None:\n\t\t\traise RuntimeError('Enter the Config context first.')\n\t\treturn cls.__ConfigParser",
"def _get_confi... | [
"0.67559856",
"0.672997",
"0.65746063",
"0.6330233",
"0.6276495",
"0.6236162",
"0.61998963",
"0.61858684",
"0.61582774",
"0.6133882",
"0.61122125",
"0.61122125",
"0.61122125",
"0.61122125",
"0.61122125",
"0.61122125",
"0.61122125",
"0.61122125",
"0.61122125",
"0.61122125",
"0... | 0.0 | -1 |
Convert a datetime.timedelta object into Days, Hours, Minutes, Seconds. | def smooth_timedelta(timedeltaobj):
secs = timedeltaobj.total_seconds()
timetot = ""
if secs > 86400: # 60sec * 60min * 24hrs
days = secs // 86400
timetot += "{} days".format(int(days))
secs = secs - days*86400
if secs > 3600:
hrs = secs // 3600
timetot += " {} h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_timedelta(item):\r\n if isinstance(item, timedelta):\r\n seconds = int(item.total_seconds())\r\n hours, remainder = divmod(seconds, 3600)\r\n minutes, seconds = divmod(remainder, 60)\r\n formated = '{}h {}m {}s'.format(hours, minutes, seconds)\r\n else:\r\n rais... | [
"0.7238108",
"0.71331143",
"0.68996936",
"0.6734208",
"0.66785395",
"0.66232896",
"0.6568203",
"0.6527074",
"0.6513767",
"0.6480116",
"0.644792",
"0.6446878",
"0.64321375",
"0.6420291",
"0.63748384",
"0.6364614",
"0.63624907",
"0.6344878",
"0.6337026",
"0.63270295",
"0.632687... | 0.67753106 | 3 |
Sets the voting_token of this VotingUser. | def voting_token(self, voting_token: str):
if voting_token is None:
raise ValueError("Invalid value for `voting_token`, must not be `None`") # noqa: E501
self._voting_token = voting_token | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def voting_token(self) -> str:\n return self._voting_token",
"def __init__(self, voting_token: str=None, user_org_id: str=None): # noqa: E501\n self.swagger_types = {\n 'voting_token': str,\n 'user_org_id': str\n }\n\n self.attribute_map = {\n 'voting... | [
"0.6830911",
"0.6465393",
"0.595013",
"0.595013",
"0.5531626",
"0.5400101",
"0.53767824",
"0.53420585",
"0.53248674",
"0.53226763",
"0.5282861",
"0.5255783",
"0.5218371",
"0.5135403",
"0.5127925",
"0.51046884",
"0.5068379",
"0.5013884",
"0.5013884",
"0.50131935",
"0.49514234"... | 0.84230316 | 0 |
Gets the user_org_id of this VotingUser. | def user_org_id(self) -> str:
return self._user_org_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def org_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"org_id\")",
"def get_user_id(self):\n return self.id_user",
"def org_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"org_id\")",
"def org_id(self) -> pulumi.Input[str]:\n return pulumi.get(sel... | [
"0.6899005",
"0.6897272",
"0.68779665",
"0.67156845",
"0.6661198",
"0.6661198",
"0.6661198",
"0.6661198",
"0.6661198",
"0.6648258",
"0.66482234",
"0.66482234",
"0.6560425",
"0.6552495",
"0.6548865",
"0.6532151",
"0.64681876",
"0.64505225",
"0.6379392",
"0.6378247",
"0.6376733... | 0.83588845 | 0 |
Sets the user_org_id of this VotingUser. | def user_org_id(self, user_org_id: str):
if user_org_id is None:
raise ValueError("Invalid value for `user_org_id`, must not be `None`") # noqa: E501
self._user_org_id = user_org_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def org_id(self, org_id):\n\n self._org_id = org_id",
"def user_id(self, user_id):\n\n self._user_id = user_id",
"def user_id(self, user_id):\n\n self._user_id = user_id",
"def user_id(self, user_id):\n\n self._user_id = user_id",
"def user_id(self, user_id):\n\n self._us... | [
"0.6810901",
"0.62934107",
"0.62934107",
"0.62934107",
"0.62934107",
"0.62934107",
"0.62934107",
"0.62934107",
"0.62934107",
"0.62934107",
"0.62934107",
"0.62934107",
"0.62934107",
"0.62934107",
"0.62934107",
"0.62673724",
"0.6159892",
"0.5727693",
"0.5723272",
"0.5714084",
"... | 0.74308753 | 0 |
Get the front element. | def peek(self):
if not self.empty():
return self.queue[-1]
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass",
"def getFront(self):\n if not self.isEmpty():\n return self._data[0]\n else:\n return -1",
"def front(self):\n return self.queue[0] if not self.empty() else None",
"def peek_front(... | [
"0.82009244",
"0.79261875",
"0.7852642",
"0.7791182",
"0.77886623",
"0.75723046",
"0.752337",
"0.7510604",
"0.7478953",
"0.7379256",
"0.7379256",
"0.734284",
"0.7323573",
"0.7320296",
"0.7291721",
"0.72772557",
"0.7269801",
"0.72657627",
"0.7253295",
"0.72355044",
"0.72213495... | 0.0 | -1 |
Returns whether the queue is empty. | def empty(self):
return len(self.queue) == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_queue) == 0",
"def is_empty(self):\n return len(self.__queue) > 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return self.queue == []",
"def ... | [
"0.9270249",
"0.92506766",
"0.923635",
"0.923635",
"0.9155843",
"0.9098441",
"0.9095006",
"0.90922606",
"0.90731245",
"0.89205354",
"0.89137155",
"0.8877591",
"0.88436323",
"0.88436323",
"0.8835949",
"0.88038146",
"0.8758203",
"0.87577534",
"0.87310195",
"0.86462456",
"0.8628... | 0.9053733 | 9 |
Find the qubit operator for the number operator in bravyi_kitaev_fast representation | def number_operator(iop, mode_number=None):
n_qubit = iop.n_qubits
num_operator = QubitOperator()
edge_matrix = bravyi_kitaev_fast_edge_matrix(iop)
edge_matrix_indices = numpy.array(
numpy.nonzero(
numpy.triu(edge_matrix) - numpy.diag(numpy.diag(edge_matrix))))
if mode_number is ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_exact_classical_binary_solution(qubit_operator, offset):\n result = get_classical_solver_result(qubit_operator, offset)\n return result.x",
"def Q_i(params):\n Q = params['Q'].value\n Qe = Q_e(params)\n return (Q ** -1 - np.real(Qe ** -1)) ** -1",
"def get_quant(q):\n\n try:\n ... | [
"0.59903646",
"0.5763858",
"0.5735831",
"0.5710417",
"0.56848425",
"0.566386",
"0.5656029",
"0.56033295",
"0.56028676",
"0.55861324",
"0.55652666",
"0.5559749",
"0.5528611",
"0.5506494",
"0.5478781",
"0.5472446",
"0.5444578",
"0.54406655",
"0.5435226",
"0.54314655",
"0.542751... | 0.6643483 | 0 |
Uses the shoelace method to calculate area of a polygon Goes as fast as I can, handling rounding errors as best I can. | def polygon_area(ppath): # pragma: no cover
v_ = ppath.vertices
if len(v_) < 3:
return 0.0
x_ = v_[:, 1] - v_[:, 1].mean()
y_ = v_[:, 0] - v_[:, 0].mean()
correction = x_[-1] * y_[0] - y_[-1] * x_[0]
main_area = np.dot(x_[:-1], y_[1:]) - np.dot(y_[:-1], x_[1:])
return 0.5 * np.abs(m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_polygon_area(self):\n\n # Create closed simple polygon (counter clock wise)\n P = numpy.array([[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]])\n A = calculate_polygon_area(P)\n msg = 'Calculated area was %f, expected 1.0 deg^2' % A\n assert numpy.allclose(A, 1), msg\n\n ... | [
"0.71910584",
"0.705447",
"0.6981431",
"0.69338065",
"0.69288665",
"0.68755835",
"0.6709687",
"0.6658822",
"0.665294",
"0.6632191",
"0.65549934",
"0.6463432",
"0.64608073",
"0.6454783",
"0.64356244",
"0.64018565",
"0.63925415",
"0.63903403",
"0.634907",
"0.63372636",
"0.63231... | 0.69571567 | 3 |
Set the document SPDX Identifier. Raise SPDXValueError if malformed value, CardinalityError if already defined. | def set_doc_spdx_id(self, doc, doc_spdx_id_line):
if not self.doc_spdx_id_set:
if doc_spdx_id_line == 'SPDXRef-DOCUMENT' or validations.validate_doc_spdx_id(doc_spdx_id_line):
doc.spdx_id = doc_spdx_id_line
self.doc_spdx_id_set = True
return True
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identifier(self, value: str):\n if Business.validate_identifier(value):\n self._identifier = value\n else:\n raise BusinessException('invalid-identifier-format', 406)",
"def set_doc_spdx_id(self, doc, doc_spdx_id_line):\n if not self.doc_spdx_id_set:\n if... | [
"0.6477791",
"0.63131696",
"0.60792327",
"0.59714293",
"0.586449",
"0.5863854",
"0.5863854",
"0.5820501",
"0.5795002",
"0.5762477",
"0.5762477",
"0.5762477",
"0.5762477",
"0.5761745",
"0.57515347",
"0.56856257",
"0.56726503",
"0.56453",
"0.5602145",
"0.5458397",
"0.54528254",... | 0.6232787 | 2 |
Set license name. Raise SPDXValueError if name is not str or utils.NoAssert Raise CardinalityError if it is already set Raise OrderError if no license id defined. | def set_lic_name(self, doc, name):
if self.has_extr_lic(doc):
if not self.extr_lic_name_set:
self.extr_lic_name_set = True
if validations.validate_extr_lic_name(name, True):
self.extr_lic(doc).full_name = name
return True
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_lic_name(self, doc, name):\n if self.has_extr_lic(doc):\n if not self.extr_lic_name_set:\n self.extr_lic_name_set = True\n if validations.validate_extr_lic_name(name):\n self.extr_lic(doc).full_name = name\n return True\n... | [
"0.74007356",
"0.6421445",
"0.6295538",
"0.62915987",
"0.62772936",
"0.62594885",
"0.62594885",
"0.62465584",
"0.6132982",
"0.6127764",
"0.6125195",
"0.6125195",
"0.6125195",
"0.6125195",
"0.6112782",
"0.6059133",
"0.605745",
"0.605508",
"0.605508",
"0.60507804",
"0.602856",
... | 0.7390864 | 1 |
Set license name. Raise CardinalityError if it is already set. Raise OrderError if no license id defined. | def set_lic_text(self, doc, text):
if self.has_extr_lic(doc):
if not self.extr_text_set:
self.extr_text_set = True
self.extr_lic(doc).text = text
return True
else:
raise CardinalityError('ExtractedLicense::text')
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_lic_name(self, doc, name):\n if self.has_extr_lic(doc):\n if not self.extr_lic_name_set:\n self.extr_lic_name_set = True\n if validations.validate_extr_lic_name(name):\n self.extr_lic(doc).full_name = name\n return True\n... | [
"0.7197196",
"0.71845764",
"0.646389",
"0.6222807",
"0.61809736",
"0.608007",
"0.6017681",
"0.6010477",
"0.5962896",
"0.58759445",
"0.58620965",
"0.5854337",
"0.5805188",
"0.5805188",
"0.58008826",
"0.5729864",
"0.5709019",
"0.57035506",
"0.56775826",
"0.56775826",
"0.5677582... | 0.5769071 | 15 |
When select file button is pressed a dialog of filenames is presented to the user. The entire text of the selected files is then added to the selected case. | def add_files_to_case(self):
index_list = self.ui.tableWidget.selectionModel().selectedIndexes()
rows = []
for i in index_list:
rows.append(i.row())
rows = list(set(rows)) # duplicate rows due to multiple columns
if len(rows) == 0:
return
selecte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selectFiles(self):\n\n filenames = []\n self.fileIDs = \"\"\n self.caseIDs = \"\" # clears any case selections\n cur = self.settings['conn'].cursor()\n cur.execute(\"select id, name, status from source\")\n result = cur.fetchall()\n for row in result:\n ... | [
"0.7599809",
"0.7312092",
"0.71427107",
"0.7118748",
"0.70763516",
"0.7027887",
"0.70081896",
"0.6910631",
"0.6909173",
"0.6898093",
"0.6897799",
"0.6894666",
"0.6867969",
"0.6848958",
"0.684623",
"0.68427694",
"0.67669785",
"0.67478716",
"0.674199",
"0.6724243",
"0.6709323",... | 0.74605596 | 1 |
Decorator to pass in instance_uuid as instance_id | def uuidize(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
if 'instance_id' in kwargs and 'instance_uuid' in kwargs:
kwargs['instance_id'] = kwargs['instance_uuid']
del kwargs['instance_uuid']
return f(*args, **kwargs)
return wrapper | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_instance_id(self):\n return self.__instance_id",
"def uuid(self):\n raise NotImplementedError",
"def uuid(self):\n raise NotImplementedError",
"def uuid(self):\n raise NotImplementedError",
"def get_uuid(self, obj):\n return IUUID(obj, None)",
"def get_uuid(self, o... | [
"0.67995924",
"0.6435182",
"0.6435182",
"0.6435182",
"0.6259262",
"0.6259262",
"0.62581223",
"0.61940676",
"0.6163332",
"0.5998131",
"0.5985018",
"0.5976193",
"0.5933036",
"0.5872257",
"0.5870427",
"0.5870427",
"0.5848155",
"0.58157057",
"0.5784641",
"0.5778465",
"0.5777457",... | 0.8623325 | 0 |
Returns the date and time as a datetime object. | def datetime(self):
time = self.time()
if time is None or time < 0 or time >= 24:
time = 0
try:
d = datetime(self.year(), self.month(), self.day()) + \
timedelta(hours=time)
return d
except:
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datetime(self):\n return datetime.datetime(self.year, self.month, self.day,\n self.hour, self.min, self.sec)",
"def datetime(self):\n\n time = self.time()\n if time is None or time < 0 or time >= 24:\n time = 0\n\n try:\n d = ... | [
"0.79485387",
"0.76939386",
"0.7358117",
"0.72879016",
"0.7270013",
"0.72353446",
"0.712729",
"0.7085262",
"0.70215476",
"0.70149654",
"0.69995666",
"0.6942897",
"0.6829285",
"0.673249",
"0.6712073",
"0.67041194",
"0.67038614",
"0.67020714",
"0.6668572",
"0.66638786",
"0.6620... | 0.7605094 | 2 |
Returns a numpy masked array of depths. | def z(self):
data = np.ma.array(np.zeros(self.n_levels()), mask=True)
for i in range(self.n_levels()):
if self.profile_data[i]['Missing']: continue
data[i] = self.profile_data[i]['Depth']
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subgraph_mask(self, size):\n init_matrix = np.random.randn(size,size)\n Tcs = csgraph.minimum_spanning_tree(init_matrix)\n mask_matrix = Tcs.toarray()\n return mask_matrix",
"def mask_depth_image(depth_image, min_depth, max_depth):\n # print ('mask min max', min_depth, max_dept... | [
"0.6285784",
"0.5943351",
"0.59043217",
"0.5888919",
"0.5861979",
"0.57344025",
"0.55919063",
"0.5591023",
"0.55867904",
"0.5559047",
"0.5550822",
"0.54389495",
"0.5414423",
"0.5403325",
"0.5394839",
"0.5389406",
"0.5382665",
"0.53772783",
"0.53699744",
"0.53505087",
"0.52924... | 0.53578013 | 19 |
Returns the quality control flag for entire cast. | def var_profile_qc(self, index, originator=False):
if index is None: return None
if originator:
return None # There is no originator flag for the entire profile.
else:
return self.primary_header['variables'][index]['Quality control flag for variable'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quality(self):\n return self.plays * self.number",
"def quality(self) -> int:\n return self._quality",
"def type(self):\n return self.INEQUALITY",
"def type(self):\n return self.INEQUALITY",
"def audio_quality_key(option):\n return (\n AUDIO_RATING_DICT[option.... | [
"0.65142",
"0.61104584",
"0.5916678",
"0.5916678",
"0.5877908",
"0.5847327",
"0.5737969",
"0.554602",
"0.55412567",
"0.55284953",
"0.5505148",
"0.5462881",
"0.5424974",
"0.5377842",
"0.5365478",
"0.5355195",
"0.5355195",
"0.53138036",
"0.5313186",
"0.530949",
"0.53059655",
... | 0.5014392 | 48 |
Returns a boolean array showing which levels are rejected by the quality control (values are True). A true is only put in the array if there is a rejection (not if there is a missing value). | def var_qc_mask(self, index):
data = np.ma.array(np.zeros(self.n_levels()), mask=False, dtype=bool)
prof = self.var_profile_qc(index)
if prof is not None and prof > 0:
data[:] = True
else:
zqc = self.z_level_qc()
data[(zqc.mask == False) & (zqc > 0)] =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_violations_mask(self) -> np.ndarray:\n bad = np.abs(self.tlm_vals - self.state_vals) > self.max_delta_val\n return bad",
"def get_violations_mask(self):\n bad = np.zeros(len(self.times), dtype=bool)\n\n for pcad_mode, max_delta_val in self.max_delta_vals.items():\n ... | [
"0.5780199",
"0.56570405",
"0.5638089",
"0.553421",
"0.55126435",
"0.528094",
"0.52581483",
"0.5233896",
"0.52186644",
"0.52174014",
"0.5185233",
"0.51067424",
"0.5105301",
"0.51030743",
"0.50844073",
"0.5046268",
"0.503596",
"0.5031853",
"0.50262076",
"0.5019203",
"0.4998505... | 0.49277017 | 29 |
This view returns a list of all courses. | def list_all_courses(request):
courses = Course.objects.all()
courses = [dict(course_name = c.course_name, course_code = c.course_code, course_year = c.year,
course_url = '/course/%s/' % c.course_code.lower()) for c in courses]
response = {'courses': courses}
return render_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def course_listing(request):\r\n if GlobalStaff().has_user(request.user):\r\n # user has global access so no need to get courses from django groups\r\n courses = _accessible_courses_list(request)\r\n else:\r\n try:\r\n courses = _accessible_courses_list_from_groups(request)\r\... | [
"0.81252503",
"0.7970566",
"0.7938835",
"0.7740521",
"0.75059247",
"0.74730605",
"0.747094",
"0.7467073",
"0.7453179",
"0.7405879",
"0.7360561",
"0.72404325",
"0.70759976",
"0.7071681",
"0.70332766",
"0.70184034",
"0.6910547",
"0.6848491",
"0.682735",
"0.6808897",
"0.6771157"... | 0.83171123 | 0 |
Find the innermost Env where var appears. | def find(self, var):
if var in self: return self
elif self.outer: return self.outer.find(var)
else:
raise Exception("Unresolved symbol: %s", var) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup_variable_value(var, env):\n def env_loop(environment):\n \"\"\"\n calls scan on each frame in the env list\n \"\"\"\n def scan(vars, vals):\n \"\"\"\n scans variables in a frame\n \"\"\"\n if isNull(vars):\n return... | [
"0.6516638",
"0.62047035",
"0.6181113",
"0.6127629",
"0.603166",
"0.60289836",
"0.6019515",
"0.5930335",
"0.5710975",
"0.5709732",
"0.5686623",
"0.56501734",
"0.56241107",
"0.5612279",
"0.5610644",
"0.55986196",
"0.55229604",
"0.55172545",
"0.54881775",
"0.54673326",
"0.54574... | 0.6067136 | 4 |
Verifica se a categoria existe em todas as letras. | def category_exists(self, category: str) -> bool:
return all(category in self.data[letter] for letter in self.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _verify_basic_categories(self):\n for cat in CATEGORIES:\n if not Category.objects.filter(name=cat).exists():\n self.add_category(cat)",
"def test_categories_add(self):\n categories = [category.category for category in self.note.categories.all()]\n self.assertIn... | [
"0.68643826",
"0.65396655",
"0.6447354",
"0.6423177",
"0.6365938",
"0.6034636",
"0.5962784",
"0.59085315",
"0.584652",
"0.5841601",
"0.58201087",
"0.5816927",
"0.5771564",
"0.5758775",
"0.559042",
"0.5577145",
"0.5576167",
"0.55607396",
"0.55607396",
"0.5521435",
"0.54990447"... | 0.6557177 | 1 |
Convert python to JSON by replacing single quotes with double quotes and stripping trailing commas Note that this checker might be oversensitive if additional JSON errors with the nested dictionary Used before SafeDictHook to check for redundant keys. We use a placeholder in block text because JSON cannot process it an... | def jsonify(text):
# remove comments because they might corrupt the JSON
re_block_comments = re.compile(r'([\"]{3}.*?[\"]{3})',flags=re.M+re.DOTALL)
text = re_block_comments.sub('"REMOVED_BLOCK_COMMENT"',text)
# note that this fails if you use hashes inside of dictionary values
re_comments = re.compile(r'(#.*?)\n'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_json_quotes(json_data):\n lines = []\n for line in json_data.splitlines():\n if ':' in line:\n key, value = line.split(':', maxsplit=1)\n value = value.strip()\n lines.append(key + ': ' + value.strip('\",') + (',' if value.endswith(',') else ''))\n els... | [
"0.6101548",
"0.60665554",
"0.6039736",
"0.5973466",
"0.5965454",
"0.59043264",
"0.56827843",
"0.56486374",
"0.5458422",
"0.5438886",
"0.5437395",
"0.539824",
"0.5383692",
"0.5371119",
"0.5345633",
"0.53277117",
"0.5322137",
"0.53118145",
"0.5297029",
"0.5265412",
"0.52639145... | 0.68492764 | 0 |
Return unique items maintaining the order. | def unique_ordered(seq):
vals = set()
return [x for x in seq if not (x in vals or vals.add(x))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deduped(items):\n \n return list(set(items))",
"def _unique(li):\n return list(set(li))",
"def Deduplicate(items):\n seen = set()\n for it in items:\n if it not in seen:\n seen.add(it)\n yield it",
"def unique(items, attribute=None):\n\n if attribute is not None:\n r... | [
"0.75954455",
"0.7282616",
"0.7104418",
"0.7073925",
"0.7034081",
"0.70192593",
"0.70053464",
"0.6951663",
"0.6933097",
"0.68960434",
"0.68862057",
"0.68222094",
"0.6807638",
"0.6799778",
"0.67874324",
"0.6773549",
"0.67681473",
"0.67522",
"0.6700722",
"0.6685626",
"0.6677326... | 0.66935945 | 19 |
Expand all op nodes to the given basis. | def run(self, dag):
# Walk through the DAG and expand each non-basis node
for node in dag.gate_nodes():
if node.name in self.basis: # If already a base, ignore.
continue
# TODO: allow choosing other possible decompositions
decomposition_rules = node.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_expand(g, op, block):\n\n x = g.get_node(op.input(\"X\")[0])\n if op.input(\"Shape\"):\n sizes = g.get_node(op.input(\"Shape\")[0])\n else:\n sizes = op.attr(\"shape\")\n\n if isinstance(sizes, _expr.Expr):\n sizes = try_infer_value(sizes, parameters=g.get_params())[0]\... | [
"0.56806636",
"0.56788045",
"0.5609273",
"0.55485564",
"0.5548129",
"0.54040587",
"0.52648944",
"0.518253",
"0.51816136",
"0.5165354",
"0.51469094",
"0.5050234",
"0.5043392",
"0.5037604",
"0.49747393",
"0.49306676",
"0.49135447",
"0.4849872",
"0.4849872",
"0.48495495",
"0.484... | 0.60018677 | 0 |
Save the sessions list to the database and then clear this list. | def persist(self, username):
if username:
database = get_database(username)
add_sessions(database, [self[-1]]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_session(self):\n self.mongo_database.cache.delete_many({\"session_id\": self.session_id})",
"def reload_sessions(self):\n import glob \n sessions = glob.glob('*.session')\n for x in sessions:\n self._db['accounts'][x.split('.')[0]] = { 'session': x.split('.')[0] }... | [
"0.6888573",
"0.6327292",
"0.6278466",
"0.6127889",
"0.5996171",
"0.59702975",
"0.59702975",
"0.59475917",
"0.59403265",
"0.5936944",
"0.59045005",
"0.5846126",
"0.58096296",
"0.57787824",
"0.57718617",
"0.5755877",
"0.57385254",
"0.570005",
"0.5696959",
"0.5695594",
"0.56594... | 0.0 | -1 |
Returns the data point at the given index in the linked list | def get(self, index):
if index >= self.length():
print("ERROR")
return None
current_index = 0
current_node = self.head
while True:
current_node = current_node.next
if current_index == index: return current_node.data
cur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value_at(self, index):\n if self.empty():\n return \"Linked List Empty\"\n\n idx = 1\n l = self.head\n while l.next is not None:\n if idx is index:\n break\n\n l = l.next\n idx += 1\n return l.data",
"def get(self, ... | [
"0.7797997",
"0.7666959",
"0.7656844",
"0.7646723",
"0.7589874",
"0.75175244",
"0.7513057",
"0.74896353",
"0.7478273",
"0.7468482",
"0.7463467",
"0.7372911",
"0.73503286",
"0.7231281",
"0.719802",
"0.7094952",
"0.70239764",
"0.7021252",
"0.7020151",
"0.7017563",
"0.6994454",
... | 0.7570134 | 5 |
Sets the sat_company_account_id of this EditAccountingJournalItem. | def sat_company_account_id(self, sat_company_account_id):
if sat_company_account_id is None:
raise ValueError("Invalid value for `sat_company_account_id`, must not be `None`") # noqa: E501
self._sat_company_account_id = sat_company_account_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_id(self, account_id):\n self._account_id = account_id",
"def account_id(self, account_id):\n\n self._account_id = account_id",
"def account_id(self, account_id):\n\n self._account_id = account_id",
"def account_id(self, account_id):\n\n self._account_id = account_id",
... | [
"0.6178081",
"0.6147414",
"0.6147414",
"0.6147414",
"0.6147414",
"0.6147414",
"0.6147414",
"0.6134564",
"0.5944026",
"0.5931777",
"0.5931777",
"0.57107115",
"0.5660232",
"0.5629784",
"0.5591194",
"0.5558076",
"0.54987",
"0.54695153",
"0.5431011",
"0.5368474",
"0.5368474",
"... | 0.7790871 | 0 |
Sets the cargo of this EditAccountingJournalItem. | def cargo(self, cargo):
if cargo is None:
raise ValueError("Invalid value for `cargo`, must not be `None`") # noqa: E501
if cargo is not None and cargo < 0: # noqa: E501
raise ValueError("Invalid value for `cargo`, must be a value greater than or equal to `0`") # noqa: E501
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_cargo(self, total_cargo):\n\n self._total_cargo = total_cargo",
"def cargo_fuel(self, cargo_fuel):\n\n self._cargo_fuel = cargo_fuel",
"def cargo_gas(self, cargo_gas):\n\n self._cargo_gas = cargo_gas",
"def dry_cargo(self, dry_cargo):\n\n self._dry_cargo = dry_cargo",
... | [
"0.5894072",
"0.51697636",
"0.515634",
"0.5031346",
"0.50103515",
"0.4902964",
"0.47004157",
"0.4674612",
"0.46719876",
"0.4623271",
"0.4567104",
"0.45393223",
"0.45121405",
"0.44361523",
"0.44219348",
"0.4409397",
"0.43817514",
"0.4378921",
"0.43769842",
"0.4371719",
"0.4345... | 0.67557865 | 0 |
Sets the comments of this EditAccountingJournalItem. | def comments(self, comments):
self._comments = comments | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comments(self, comments):\n\n self.container['comments'] = comments",
"def comments(self, comments):\n if comments is not None and len(comments) > 1000:\n raise ValueError(\"Invalid value for `comments`, length must be less than or equal to `1000`\") # noqa: E501\n\n self._co... | [
"0.7108144",
"0.65711296",
"0.6474661",
"0.6419131",
"0.64177847",
"0.6257858",
"0.6126435",
"0.6126435",
"0.6126435",
"0.6126435",
"0.6126435",
"0.6126435",
"0.6126435",
"0.6126435",
"0.6126435",
"0.6126435",
"0.5982231",
"0.5982231",
"0.59577405",
"0.5947953",
"0.58393097",... | 0.7272099 | 1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, EditAccountingJournalItem):
return False
return self.__dict__ == other.__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):
return not self == other | {
"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.8456082",
"0.83912885",
"0.81436425",
"0.81406975",
"0.8131807",
"0.8093013",
"0.80912536",
"0.80912536",
"0.80912536",
"0.8084505",
"0.8084505",
"0.8075543",
"0.8075543",
"0.8065009"
] | 0.0 | -1 |
Compute the bin numbers from a given grid | def grid_to_bins(grid, start_bin_val, end_bin_val):
bin_centers = (grid[1:] + grid[:-1])/2.0
bins = np.concatenate([[start_bin_val], bin_centers, [end_bin_val]])
return bins | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bincalc(nbin=0.1,bmin=5,bmax=2000):\n\n logbmin=np.log10(bmin)\n logbmax=np.log10(bmax)\n\n logbins=np.arange(logbmin,logbmax,nbin)\n\n bins=10**logbins\n\n #bins=np.linspace(bmin,bmax,60)\n return (bins)",
"def _bin_numbers(col1, col2, bin_n):\n col1 = col1[~col1.map(lambda x: is_null_f... | [
"0.6988975",
"0.6984424",
"0.67759913",
"0.6577237",
"0.65490645",
"0.6458017",
"0.6443781",
"0.6413207",
"0.63787806",
"0.63331187",
"0.6303565",
"0.62823945",
"0.6276484",
"0.6272296",
"0.6242215",
"0.62306744",
"0.62077826",
"0.6177793",
"0.61308944",
"0.61144274",
"0.6078... | 0.756557 | 0 |
show a super simple example of a bootstrapped page | def bootstrap_hello():
poolsize = [1, 2, 3, 4, 5, 6, 7, 8]
kafka_throughput = [ dbwrapper.query_latest_throughput( "kafka_%dprod" % i) for i in poolsize ]
kinesis_throughput = [ dbwrapper.query_latest_throughput("kinesis_%dprod" % i) for i in poolsize ]
return render_template('Bootstrap_hello.html',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intro_page():\n logger.info('At introductory app page.')\n return render_template('first.html')",
"def main_page():\n return render_template(\"main_page.html\")",
"def app():\n # Add balloons animation when page opens\n st.balloons()\n\n # Add title\n st.title(\"Welcome to the about me... | [
"0.7028451",
"0.6747192",
"0.6735735",
"0.67335194",
"0.67067796",
"0.6647583",
"0.6639521",
"0.6559266",
"0.65066856",
"0.64416444",
"0.64416444",
"0.63820773",
"0.6328478",
"0.6328478",
"0.63255847",
"0.62823004",
"0.6262756",
"0.62538695",
"0.6253553",
"0.6231967",
"0.6225... | 0.0 | -1 |
Init device info class. | def __init__(
self,
avm_wrapper: AvmWrapper,
device_name: str,
description: SwitchEntityDescription,
) -> None:
super().__init__(avm_wrapper)
self.entity_description = description
self._device_name = device_name
self._attr_unique_id = f"{avm_wrapper.un... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self._device_info = None",
"def __init__(self, host_info):\n # A group name to group map. It represents the device tree.\n self._groups = self._BuildGroupTrees(host_info.device_infos)\n\n # Build device indexes for faster lookup.\n self._device_serial_index = {}\n self... | [
"0.80433166",
"0.69608974",
"0.6939508",
"0.6841803",
"0.6813904",
"0.6797074",
"0.6746871",
"0.6713792",
"0.6712473",
"0.6706968",
"0.66841716",
"0.66724086",
"0.666621",
"0.6650666",
"0.66330117",
"0.6602313",
"0.65648913",
"0.6563",
"0.65593237",
"0.6552972",
"0.65281254",... | 0.0 | -1 |
Set some basic defaults. Note that these might get overriden by a parent Sequence, or by calling configure() with a dict of values | def set_default_parameters(self):
super().set_default_parameters()
if not "replace_existing_files" in vars(self):
self.replace_existing_files = False
if not "num_files_per_point" in vars(self):
self.num_files_per_point = -1
if not "input_location_type" in vars(sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_defaults(self):\n\n for k, v in self.DEFAULTS.items():\n if not getattr(self, k, None):\n setattr(self, k, v)",
"def load_defaults(self):\n self.set_motor_limits(self.MOTOR_LEFT, self.LEFT_DEFAULT)\n self.set_motor_limits(self.MOTOR_RIGHT, self.RIGHT_DEFAULT... | [
"0.7057989",
"0.7027152",
"0.7027152",
"0.7027152",
"0.67891604",
"0.6766258",
"0.67320925",
"0.6718038",
"0.6680536",
"0.6605883",
"0.6566642",
"0.64754784",
"0.6445571",
"0.64052516",
"0.63962984",
"0.638312",
"0.6382473",
"0.6354681",
"0.6354681",
"0.63403976",
"0.63198566... | 0.559007 | 89 |
Set some basic defaults. Note that these might get overriden by a parent Sequence, or by calling configure() with a dict of values | def set_default_parameters(self):
super().set_default_parameters()
if not "region_size" in vars(self):
self.region_size = 0.08
if not "RGB_bands" in vars(self):
self.RGB_bands = ["B4","B3","B2"]
if not "split_RGB_images" in vars(self):
self.split_RGB_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_defaults(self):\n\n for k, v in self.DEFAULTS.items():\n if not getattr(self, k, None):\n setattr(self, k, v)",
"def load_defaults(self):\n self.set_motor_limits(self.MOTOR_LEFT, self.LEFT_DEFAULT)\n self.set_motor_limits(self.MOTOR_RIGHT, self.RIGHT_DEFAULT... | [
"0.70587385",
"0.70276564",
"0.70276564",
"0.70276564",
"0.67893606",
"0.676722",
"0.67328024",
"0.6717961",
"0.6681048",
"0.6606936",
"0.6567108",
"0.6477132",
"0.64453864",
"0.64051515",
"0.63980156",
"0.63843596",
"0.63833004",
"0.63554263",
"0.63554263",
"0.63416094",
"0.... | 0.0 | -1 |
Set some basic defaults. Note that these might get overriden by a parent Sequence, or by calling configure() with a dict of values | def set_default_parameters(self):
super().set_default_parameters() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_defaults(self):\n\n for k, v in self.DEFAULTS.items():\n if not getattr(self, k, None):\n setattr(self, k, v)",
"def load_defaults(self):\n self.set_motor_limits(self.MOTOR_LEFT, self.LEFT_DEFAULT)\n self.set_motor_limits(self.MOTOR_RIGHT, self.RIGHT_DEFAULT... | [
"0.7059435",
"0.702843",
"0.702843",
"0.702843",
"0.67675865",
"0.6733396",
"0.67172796",
"0.66808504",
"0.6606263",
"0.6568121",
"0.6476384",
"0.64463484",
"0.64058495",
"0.6398728",
"0.6384109",
"0.6383018",
"0.6355535",
"0.6355535",
"0.634216",
"0.63198215",
"0.6253839",
... | 0.6789325 | 4 |
Get the distance between two positions | def distance(currX, currY, targetX, targetY):
return abs(currX - targetX) + abs(currY - targetY) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDistance(pos1, pos2):\r\n return ((pos1[0] - pos2[0]) ** 2 + (pos1[1] - pos2[1]) ** 2) ** 0.5",
"def distance(pos1, pos2):\n return math.sqrt((pos1[0] - pos2[0])**2. + (pos1[1] - pos2[1])**2.)",
"def _pos_distance(pos1, pos2):\n delta = np.array(pos1).astype(float).flatten(\n ) - np.array(po... | [
"0.8511572",
"0.8471865",
"0.8261178",
"0.8259059",
"0.80267745",
"0.7931143",
"0.7891745",
"0.7870262",
"0.7847093",
"0.7828129",
"0.7791938",
"0.77693313",
"0.77277005",
"0.7724491",
"0.77211344",
"0.77053475",
"0.7673862",
"0.76604116",
"0.765924",
"0.7654856",
"0.76370704... | 0.0 | -1 |
Util function that returns true iff the pieces are the same color | def _is_same_color(p1: str, p2: str):
return p1.islower() == p2.islower() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def same_color(self, other: 'Piece') -> bool:\n\n return self.color == other.color",
"def is_win(self, color):\n win = self.n\n # check y-strips\n for y in range(self.n):\n count = 0\n for x in range(self.n):\n if self[x][y] == color:\n ... | [
"0.78296685",
"0.7121043",
"0.69307554",
"0.6913036",
"0.686258",
"0.68609273",
"0.6859676",
"0.68483245",
"0.68285185",
"0.6701736",
"0.66740555",
"0.6609951",
"0.6589256",
"0.6526294",
"0.65075636",
"0.65069586",
"0.6472786",
"0.6435926",
"0.64279747",
"0.6402838",
"0.63328... | 0.62614256 | 30 |
Return the value of the state (computed in __init__). | def getValue(self, state):
return self.values[state] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value(self, state):\n raise NotImplementedError",
"def value(self, state):\n raise NotImplementedError",
"def value(self, state):\n\t\traise NotImplementedError",
"def getValue(self, state):\n util.raiseNotDefined()",
"def getValue(self, state):\n util.raiseNotDefined()",
... | [
"0.83014333",
"0.83014333",
"0.826012",
"0.8086146",
"0.8086146",
"0.79581815",
"0.79296756",
"0.78013283",
"0.77367806",
"0.77336967",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
... | 0.77333474 | 14 |
The policy is the best action in the given state according to the values currently stored in self.values. You may break ties any way you see fit. Note that if there are no legal actions, which is the case at the terminal state, you should return None. | def computeActionFromValues(self, state):
State_actions = self.mdp.getPossibleActions(state)
max_Action=util.Counter()
for k in State_actions:
max_Action[k] = self.getQValue(state,k)
return max_Action.argMax()
util.raiseNotDefined() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPolicy(self, state):\n \"*** YOUR CODE HERE ***\"\n # OUR CODE HERE\n possibleActions = self.mdp.getPossibleActions(state)\n #checking for terminal state (no possible actions)\n if len(possibleActions) is 0: \n return None\n \n #attempt at using the Counter\n eValsActions = ut... | [
"0.77924776",
"0.771162",
"0.7612669",
"0.76075274",
"0.7490432",
"0.74670315",
"0.73735553",
"0.734055",
"0.733961",
"0.73371553",
"0.7335494",
"0.7314689",
"0.7308831",
"0.73080486",
"0.72947824",
"0.72724277",
"0.72438973",
"0.72438973",
"0.71556383",
"0.70876473",
"0.7081... | 0.6652552 | 56 |
Returns the value of a cgroup parameter for a container path path to the container parent directory | def get_parameter(name, parameter, path=None):
_ensure_exists(name, path=path)
cmd = "lxc-cgroup"
if path:
cmd += f" -P {shlex.quote(path)}"
cmd += f" -n {name} {parameter}"
ret = __salt__["cmd.run_all"](cmd, python_shell=False)
if ret["retcode"] != 0:
raise CommandExecutionError... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_cgroup(self):\n if os.environ.get(\"NO_CGROUP\"):\n return None\n pid = os.getpid()\n cfile = \"/proc/{}/cgroup\".format(pid)\n # TODO REMOVE THIS OR FIGURE OUT FOR TESTING WHAT TO DO ABOUT THIS\n if not os.path.exists(cfile):\n raise Exception(f\"C... | [
"0.65769273",
"0.62457204",
"0.5867603",
"0.5534241",
"0.5521419",
"0.5441542",
"0.5439973",
"0.5414378",
"0.53632414",
"0.5348421",
"0.52795565",
"0.5239584",
"0.5190792",
"0.51211596",
"0.5106422",
"0.5100882",
"0.5077889",
"0.50685614",
"0.5065297",
"0.50638187",
"0.503881... | 0.6499566 | 1 |
Returns information about a container path path to the container parent directory | def info(name, path=None):
cachekey = f"lxc.info.{name}{path}"
try:
return __context__[cachekey]
except KeyError:
_ensure_exists(name, path=path)
cpath = get_root_path(path)
try:
conf_file = os.path.join(cpath, name, "config")
except AttributeError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_parentURI(self):\n # A container in CDMI has a '/' at the end but we don't (except for the\n # root)\n parent_path = self.resource.container\n if parent_path != \"/\":\n parent_path = \"{}\".format(parent_path)\n return \"{}\".format(parent_path)",
"def get_p... | [
"0.7459594",
"0.7322418",
"0.7017532",
"0.6869559",
"0.6696945",
"0.6621653",
"0.66183496",
"0.64958006",
"0.64879954",
"0.6440171",
"0.64052624",
"0.6300083",
"0.6264086",
"0.6236769",
"0.62329406",
"0.615795",
"0.6089979",
"0.60693574",
"0.6067441",
"0.60654557",
"0.6045239... | 0.0 | -1 |
Negation of whether other is equal to this path | def __ne__(self, other):
return not self.__eq__(other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ne (self, other):\n return not (self == other) # opposite of eq",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other):\n return not self == other",
"def __ne__(self, other):\n return self.point != other.point",
"def __ne__(... | [
"0.7707839",
"0.76140374",
"0.75773257",
"0.7567763",
"0.7564402",
"0.7564402",
"0.75478035",
"0.7543831",
"0.75389874",
"0.75321317",
"0.75321317",
"0.75321317",
"0.75321317",
"0.75321317",
"0.75321317",
"0.75321317",
"0.75321317",
"0.75321317",
"0.75321317",
"0.75321317",
"... | 0.754833 | 15 |
Checks if the contact has any active subscription. If count is passed through this, it will instead return how many of these they have. | def has_active_subscription(self, count=False):
subs = self.subscriptions.filter(active=True)
return subs.exists() if count is False else subs.count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_subscribers(self):\n return self.request(\"count:Contact\", [ None ])",
"def contacts_in_route_count(self):\n subprods = SubscriptionProduct.objects.filter(route=self).distinct('subscription__contact')\n return subprods.count",
"def get_subscribed_users(self, obj):\n retur... | [
"0.75198597",
"0.6862191",
"0.66709375",
"0.628151",
"0.6169264",
"0.60658246",
"0.6064264",
"0.60293543",
"0.589479",
"0.58911204",
"0.5842869",
"0.57893777",
"0.57746965",
"0.57657087",
"0.5731054",
"0.57261413",
"0.5724176",
"0.5717416",
"0.5708131",
"0.5706865",
"0.570610... | 0.7511574 | 1 |
Returns a queryset with the subscriptions of this contact. | def get_subscriptions(self):
return self.subscriptions.all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscriptions(self):\r\n return subs.AccountSubscriptions(self)",
"def subscriptions(self):\r\n return v3.Subscriptions(self)",
"def get_subscriptions(self):\n url = '{}/v2/subscriptions'.format(self.url)\n r = requests.get(url, headers=self.headers_v2)\n return r.json()"... | [
"0.75429577",
"0.7530589",
"0.7323063",
"0.7279339",
"0.7275472",
"0.72422016",
"0.7151664",
"0.7102055",
"0.7097441",
"0.6876215",
"0.68351597",
"0.66983294",
"0.66664577",
"0.66407704",
"0.66184616",
"0.654786",
"0.64856887",
"0.64463097",
"0.64458936",
"0.6443956",
"0.6442... | 0.8102227 | 0 |
Returns the latest activity of this contact. | def last_activity(self):
if self.activity_set.exists():
return self.activity_set.latest("id")
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_activity(self):\n return Activity.objects.filter(campaign=self.campaign, status=\"P\", contact=self.contact).latest(\"id\")",
"def get_last_activity(self):\n last_activities = self.get_last_activities(n=1)\n return last_activities[0]",
"def get_activity():\n try:\n a... | [
"0.8648703",
"0.78931224",
"0.75479627",
"0.7339513",
"0.7190762",
"0.70039374",
"0.6519089",
"0.6409866",
"0.62134755",
"0.6154373",
"0.61299175",
"0.61265826",
"0.6100983",
"0.60382956",
"0.60372984",
"0.5983238",
"0.59454715",
"0.59314495",
"0.5913023",
"0.58917516",
"0.58... | 0.7688959 | 2 |
Returns a queryset with all the newsletters that this contact has subscriptions in. | def get_newsletters(self):
return SubscriptionNewsletter.objects.filter(contact=self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subscriptions(self):\n return self.subscriptions.all()",
"def get_all_subscriptions(cls, **kwargs):\n return Subscription.query.filter(**kwargs).all()",
"def subscriptions(self):\r\n return subs.AccountSubscriptions(self)",
"def getAllSubscriptions(self):\n return self.req... | [
"0.76563036",
"0.72232264",
"0.6919182",
"0.66618294",
"0.66575885",
"0.66574",
"0.6607653",
"0.65924275",
"0.6519385",
"0.6455571",
"0.6406239",
"0.6384957",
"0.6365558",
"0.6332527",
"0.62650865",
"0.6246953",
"0.6179742",
"0.617221",
"0.61497104",
"0.6115057",
"0.61131865"... | 0.83896947 | 0 |
Returns the last paid invoice for this contact if it exists. Returns None if they have none. | def get_last_paid_invoice(self):
try:
return self.invoice_set.filter(Q(paid=True) | Q(debited=True)).latest("id")
except Exception:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pending_invoice(self,org_id=None):\n if org_id is None:\n org_id = self.org_id\n return self.get('{}/orgs/{}/invoices/pending'.format(ApiVersion.A1.value,org_id))",
"def get_latest_invoice(self) -> CreditorInvoice:\n\n LOGGER.info(\"Getting latest invoice from EON Romania\")\n\n sess... | [
"0.58459026",
"0.56620586",
"0.5511519",
"0.5396463",
"0.5305116",
"0.52948034",
"0.5150207",
"0.51453376",
"0.5130346",
"0.51226276",
"0.51226276",
"0.51226276",
"0.51226276",
"0.51226276",
"0.51183546",
"0.5111227",
"0.5106159",
"0.5092524",
"0.50849295",
"0.50741434",
"0.5... | 0.82362366 | 0 |
Gets the billing phone for the contact. If it doesn't have one, then the contact's phone is returned. Used primarily in invoicing. | def get_billing_phone(self):
if self.billing_phone:
return self.billing_phone
else:
return self.contact.phone | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def billing_contact(self):\n return self._billing_contact",
"def getPhone(self):\n return self.phone",
"def phone(self):\n return self._phone",
"def phone(self):\n return self._phone",
"def phone(self):\n return self._phone",
"def phone(self):\n\n return self._ph... | [
"0.72117543",
"0.69185233",
"0.6816935",
"0.6816935",
"0.6816935",
"0.68060094",
"0.67518926",
"0.6579222",
"0.65608084",
"0.6559647",
"0.63917357",
"0.6354833",
"0.6352409",
"0.63150704",
"0.62963",
"0.62963",
"0.62078226",
"0.62078226",
"0.61214375",
"0.6061901",
"0.6044865... | 0.8716133 | 0 |
Gets the billing address for the contact. If there is none set, then it will return the first address. It will return None given the case there's no available address in any products of the subscription. Used primaily in invoicing. | def get_billing_address(self):
if self.billing_address:
return self.billing_address.address_1
else:
subscription_products = SubscriptionProduct.objects.filter(
subscription=self
)
addresses = [sp.address for sp in subscription_products if s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def billing_contact(self):\n return self._billing_contact",
"def get_address(self):\n if self.get_entity: # needs an entity to work\n if self.building:\n address = self.get_entity.get_institutional_address()\n address.extend(self.building.get_postal_address(... | [
"0.6749646",
"0.6549209",
"0.64370364",
"0.63437635",
"0.63437635",
"0.62060183",
"0.60846496",
"0.6025994",
"0.5972726",
"0.59543216",
"0.5943322",
"0.5896184",
"0.5877524",
"0.5877524",
"0.5877524",
"0.5830147",
"0.5830147",
"0.5825068",
"0.5797176",
"0.5797176",
"0.5722416... | 0.8461856 | 0 |
Gets the billing state for the contact. If it doesn't have one, it will chose the contact's first address' state. Used primarily in invoicing. | def get_billing_state(self):
if self.billing_address and self.billing_address.state:
return self.billing_address.state
else:
sub_prods = SubscriptionProduct.objects.filter(subscription=self)
addresses = [sp.address for sp in sub_prods]
if addresses:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def billing_contact(self):\n return self._billing_contact",
"def get_billing_name(self):\n if self.billing_name:\n return self.billing_name\n else:\n return self.contact.name",
"def get_billing_phone(self):\n if self.billing_phone:\n return self.bill... | [
"0.6733393",
"0.626571",
"0.6247604",
"0.6238033",
"0.62253356",
"0.60487026",
"0.59813064",
"0.59758586",
"0.5958007",
"0.59036",
"0.5803874",
"0.5803874",
"0.5647028",
"0.54867643",
"0.54809517",
"0.54809517",
"0.5471374",
"0.5471374",
"0.5471374",
"0.5344955",
"0.52707523"... | 0.79510605 | 0 |
Takes each product for this subscription and returns a list with the copies for each. | def product_summary(self):
# products = self.products.filter(type='S') # TODO: explain the usage of this commented line or remove it
from .utils import process_products
subscription_products = SubscriptionProduct.objects.filter(subscription=self)
dict_all_products = {}
for sp i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ListProducts(self):\n return copy.deepcopy(self._products)",
"def sum_copies_per_product(self, product=None, new=False):\n if product is None:\n subprods = SubscriptionProduct.objects.filter(route=self, subscription__active=True)\n else:\n subprods = SubscriptionPro... | [
"0.66389644",
"0.6372359",
"0.6192775",
"0.6183691",
"0.6012321",
"0.6008919",
"0.5960865",
"0.59557086",
"0.591539",
"0.58433527",
"0.5830497",
"0.5779049",
"0.5690014",
"0.5670402",
"0.56616014",
"0.5647406",
"0.5637686",
"0.56343627",
"0.56197554",
"0.55755746",
"0.5539333... | 0.67118526 | 0 |
Returns true if the subscription has a Friday product. | def has_friday(self):
return self.products.filter(type="S", weekday=5).exists() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_weekend(self):\n return self.products.filter(type=\"S\", weekday=10).exists()",
"def has_wednesday(self):\n return self.products.filter(type=\"S\", weekday=3).exists()",
"def has_thursday(self):\n return self.products.filter(type=\"S\", weekday=4).exists()",
"def has_tuesday(self... | [
"0.7637973",
"0.7567508",
"0.75327075",
"0.7065873",
"0.65174216",
"0.6368904",
"0.6181212",
"0.61077476",
"0.5917382",
"0.58119035",
"0.57857114",
"0.57834",
"0.57660586",
"0.5702861",
"0.56998616",
"0.5680689",
"0.5678202",
"0.5603491",
"0.55724514",
"0.5518139",
"0.5485771... | 0.8796624 | 0 |
Returns true if the subscription has a Weekend product. | def has_weekend(self):
return self.products.filter(type="S", weekday=10).exists() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_wednesday(self):\n return self.products.filter(type=\"S\", weekday=3).exists()",
"def has_thursday(self):\n return self.products.filter(type=\"S\", weekday=4).exists()",
"def has_tuesday(self):\n return self.products.filter(type=\"S\", weekday=2).exists()",
"def is_weekend() -> b... | [
"0.748854",
"0.69645387",
"0.68662715",
"0.6862472",
"0.6481014",
"0.64291966",
"0.6000979",
"0.5917448",
"0.57905054",
"0.57651114",
"0.57306504",
"0.5691392",
"0.5668606",
"0.5651247",
"0.56261396",
"0.5589581",
"0.55890775",
"0.5559175",
"0.5558002",
"0.5557032",
"0.555141... | 0.82367826 | 0 |
Returns the payment type. | def get_payment_type(self):
payment_types = dict(settings.SUBSCRIPTION_PAYMENT_METHODS)
return payment_types.get(self.payment_type, "N/A") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def payment_type(self) -> str:\n return pulumi.get(self, \"payment_type\")",
"def pay_type(self) -> str:\n return pulumi.get(self, \"pay_type\")",
"def pay_type(self) -> str:\n return pulumi.get(self, \"pay_type\")",
"def pay_type(self) -> pulumi.Output[str]:\n return pulumi.get(s... | [
"0.92547166",
"0.843507",
"0.843507",
"0.82871956",
"0.80102414",
"0.8000726",
"0.7407751",
"0.7407751",
"0.7096854",
"0.6870054",
"0.6848388",
"0.6848388",
"0.6848388",
"0.6848388",
"0.6848388",
"0.6848388",
"0.6848388",
"0.6848388",
"0.6848388",
"0.6848388",
"0.6848388",
... | 0.8578038 | 1 |
Returns the count of ContactCampaignStatus objects for all Contacts that have not been called yet (status=1) | def get_not_contacted_count(self, seller_id):
return self.get_not_contacted(seller_id).count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_subscribers(self):\n return self.request(\"count:Contact\", [ None ])",
"def status_counts(self):\n return self._status_counts",
"def get_already_contacted_count(self, seller_id):\n return self.get_already_contacted(seller_id).count()",
"def campaign_status(self):\n retu... | [
"0.58729506",
"0.5697539",
"0.56552345",
"0.5644677",
"0.5614512",
"0.55899376",
"0.5523953",
"0.5406303",
"0.5382926",
"0.53309304",
"0.532123",
"0.5316718",
"0.53129387",
"0.5263166",
"0.5259178",
"0.52466035",
"0.5164468",
"0.51618105",
"0.5160587",
"0.5086446",
"0.5086372... | 0.5831577 | 1 |
Returns the count of ContactCampaignStatus objects for all Contacts that have already been called yet (status=2, 3) | def get_already_contacted_count(self, seller_id):
return self.get_already_contacted(seller_id).count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact_count(self, *args, **kwargs) -> Any:\n pass",
"def count_subscribers(self):\n return self.request(\"count:Contact\", [ None ])",
"def count_status(list_of_results, domain_status):\n count = 0\n for dict in list_of_results:\n if dict[\"DomainStatus\"] == domain_status:\n ... | [
"0.6202253",
"0.6093372",
"0.58754146",
"0.5722498",
"0.5658049",
"0.5446101",
"0.5395493",
"0.5377425",
"0.53690165",
"0.53161544",
"0.5297942",
"0.524916",
"0.52398884",
"0.5224794",
"0.5223452",
"0.52136314",
"0.52130175",
"0.51598656",
"0.51577294",
"0.51293063",
"0.51259... | 0.6045504 | 2 |
Returns the seller from the contact this activity is assigned for. | def get_contact_seller(self):
return self.contact.seller | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seller(self):\n if \"seller\" in self._prop_dict:\n return self._prop_dict[\"seller\"]\n else:\n return None",
"def seller_from_user(context: Dict[str, Any]) -> Optional[Seller]:\n user: User = context[\"user\"]\n if user.is_authenticated:\n try:\n ... | [
"0.7485591",
"0.5901869",
"0.58646476",
"0.57309294",
"0.5610337",
"0.55715734",
"0.55709654",
"0.55709654",
"0.5546228",
"0.5507627",
"0.5496031",
"0.5492068",
"0.5451132",
"0.5379029",
"0.5316402",
"0.52811015",
"0.52564305",
"0.5247079",
"0.5247",
"0.5247",
"0.52305055",
... | 0.7961372 | 0 |
Returns a description of the type for this activity. | def get_type(self):
types = dict(ACTIVITY_TYPES)
return types.get(self.activity_type, "N/A") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type(self):\n\n return self.manifest[\"type\"]",
"def type(self) -> str:\n return self.type_",
"def type(self) -> str:\n return self._type",
"def type(self) -> str:\n return self._type",
"def type(self) -> str:\n return self._type",
"def type(self) -> str:\n ... | [
"0.7715168",
"0.77077985",
"0.7626987",
"0.7626987",
"0.7626987",
"0.7582602",
"0.7582602",
"0.7582602",
"0.7582602",
"0.7582602",
"0.7582602",
"0.7582602",
"0.7582602",
"0.7582602",
"0.7582602",
"0.7582602",
"0.7582602",
"0.7582602",
"0.7582602",
"0.7582602",
"0.7582602",
... | 0.7386901 | 51 |
Returns a description of the status for this activity. | def get_status(self):
statuses = dict(ACTIVITY_STATUS_CHOICES)
return statuses.get(self.status, "N/A") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self) -> str:\n return pulumi.get(self, \"status\")",
"def status(self) -> str:\n return pulumi.get(self, \"status\")",
"def status(self) -> str:\n return pulumi.get(self, \"status\")",
"def status(self) -> str:\n return pulumi.get(self, \"status\")",
"def status(self... | [
"0.8096618",
"0.8096618",
"0.8096618",
"0.8096618",
"0.8096618",
"0.8096618",
"0.8096618",
"0.8096618",
"0.8096618",
"0.8096618",
"0.8096618",
"0.8096618",
"0.8096618",
"0.8096618",
"0.8096618",
"0.8096618",
"0.8096618",
"0.8096618",
"0.8096618",
"0.8096618",
"0.8096618",
"... | 0.0 | -1 |
Returns the last activity for the contact, on this exact campaign. | def get_last_activity(self):
return Activity.objects.filter(campaign=self.campaign, status="P", contact=self.contact).latest("id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_activity(self):\n last_activities = self.get_last_activities(n=1)\n return last_activities[0]",
"def last_activity(self):\n if self.activity_set.exists():\n return self.activity_set.latest(\"id\")\n else:\n return None",
"def last_time(self) -> dat... | [
"0.8021665",
"0.7515905",
"0.68185985",
"0.67223203",
"0.6343814",
"0.6304953",
"0.63015753",
"0.61637557",
"0.6048075",
"0.5997703",
"0.59606355",
"0.58743024",
"0.57338977",
"0.5712074",
"0.5694064",
"0.56693697",
"0.5622185",
"0.5594319",
"0.55657274",
"0.55362064",
"0.551... | 0.87714857 | 0 |
Returns a description of the status for this campaign on this contact. | def get_status(self):
return dict(CAMPAIGN_STATUS_CHOICES).get(self.status, "N/A") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def campaign_status(self):\n return self._campaign_status",
"def detailed_status(self) -> str:\n return pulumi.get(self, \"detailed_status\")",
"def status(self):\n return STATUS[self.fields['status']]",
"def status(self):\n return status_dict[self._get_property_(self.STATUS).uppe... | [
"0.78112537",
"0.75666934",
"0.7361897",
"0.73248297",
"0.7271082",
"0.72507674",
"0.72201604",
"0.72176176",
"0.7217202",
"0.7217202",
"0.7217202",
"0.7217202",
"0.7217202",
"0.7217202",
"0.7217202",
"0.7217202",
"0.7217202",
"0.7217202",
"0.7217202",
"0.7217202",
"0.7217202... | 0.70803624 | 49 |
Returns a description of the resolution for this campaign on this contact. | def get_campaign_resolution(self):
campaign_resolutions = dict(CAMPAIGN_RESOLUTION_CHOICES)
return campaign_resolutions.get(self.campaign_resolution, "N/A") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Resolution(self):\n\t\treturn self._get_attribute('resolution')",
"def resolution(self):\n return self._resolution",
"def res_description(self):\n return self.get(\"res_description\", decode=True)",
"def get_resolution(self):\n return self.__resolution",
"def get_description(self):... | [
"0.66166127",
"0.6521925",
"0.6436431",
"0.63877213",
"0.62083656",
"0.61682487",
"0.596611",
"0.5934394",
"0.59258974",
"0.5867041",
"0.5824322",
"0.578653",
"0.57848024",
"0.5735983",
"0.5665601",
"0.55896026",
"0.558924",
"0.556708",
"0.55272025",
"0.5522097",
"0.5521857",... | 0.73374283 | 0 |
Run the program in its own thread. | def schedule(self, sleep_time, delay):
self.sleep_time = sleep_time
self.delay = delay
self.thread = Thread(target=self.run)
self.thread.start() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n self.thread = threading.Thread(target=self._main)\n self.thread.start()\n self.running = True",
"def run(self):\n self.log.info(\"Starting thread: \" + self.name)\n self.object__ = self.run_process(self.object__, self.args)",
"def run(self):\n self.sub... | [
"0.8403954",
"0.73345995",
"0.73030037",
"0.7096608",
"0.7092464",
"0.70406306",
"0.70351154",
"0.700119",
"0.6956562",
"0.6896904",
"0.68522936",
"0.6844799",
"0.6836655",
"0.68328965",
"0.6795837",
"0.6782529",
"0.67435163",
"0.67148036",
"0.67073345",
"0.6686638",
"0.66725... | 0.0 | -1 |
Set the site to the current site when the record is first created, or the ``update_site`` argument is explicitly set to ``True``. | def save(self, update_site=False, *args, **kwargs):
if update_site or not self.id:
self.site_id = current_site_id()
super(SiteRelated, self).save(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_site(self, site):\n assert self.default_model is not None\n self.default_model.add_site(site)",
"def add_site_to_context(self):\n g.current_site = self",
"def save_site(self, site):\n raise NotImplementedError('save_site')",
"def _update_site_configuration(self):\n ... | [
"0.7196496",
"0.6944524",
"0.6681965",
"0.64669836",
"0.6459213",
"0.641109",
"0.641109",
"0.61772376",
"0.61531913",
"0.6105513",
"0.6099537",
"0.6084168",
"0.6019811",
"0.5998988",
"0.59902525",
"0.59790754",
"0.594837",
"0.59265506",
"0.586496",
"0.5850791",
"0.5836316",
... | 0.74763525 | 0 |
Returns a string representation of the leaf (with n whitespaces on the left). | def get_string(self, n):
pad = self.get_pad(n)
string = pad + self.c
return string | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n\t\tself._synchronize_attributes()\n\t\ts = \"\"\n\t\tqueue = c3.Queue()\n\t\tlevel = 0\n\t\tqueue.enqueue((1, self._root))\n\t\twhile queue.peek():\n\t\t\tnodelev, node = queue.dequeue()._data\n\t\t\tif (not node):\n\n\t\t\t\t#NODE IS NOT THERE - just a placeholder\n\t\t\t\t#print spacing and ... | [
"0.70769984",
"0.68211764",
"0.6797134",
"0.6785509",
"0.6755062",
"0.6743716",
"0.672917",
"0.67118156",
"0.6642162",
"0.6629195",
"0.6591694",
"0.6590827",
"0.656558",
"0.6524702",
"0.64034504",
"0.6390659",
"0.63566357",
"0.6315551",
"0.6307762",
"0.6285226",
"0.62744355",... | 0.0 | -1 |
Compute the average calculation time over N evaluations. An additional call is generated without polydispersity in order to initialize the calculation engine, and make the average more stable. | def time_calculation(calculator, pars, Nevals=1):
# initialize the code so time is more accurate
value = calculator(**suppress_pd(pars))
toc = tic()
for _ in range(max(Nevals, 1)): # make sure there is at least one eval
value = calculator(**pars)
average_time = toc()*1000./Nevals
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def runtime(self, n):\n rate = 0\n for fun in self.functions:\n rate = rate + fun.runtime\n\n return float(rate * n)",
"def algorithm_avg_time(n, score, algorithm, *args, **kwargs):\r\n algorithms = []\r\n for num in range(n):\r\n algorithms.append(algorithm(*args, **... | [
"0.6657755",
"0.6579823",
"0.6567078",
"0.6543196",
"0.63556015",
"0.6339145",
"0.6317344",
"0.6079842",
"0.6030012",
"0.6024761",
"0.5990073",
"0.5989419",
"0.59579384",
"0.59347075",
"0.59027743",
"0.5867304",
"0.5838388",
"0.58107877",
"0.58085364",
"0.5807844",
"0.5800882... | 0.6130196 | 7 |
Receives an interval from the frequency of root_pitch root_pitch['freq']), expressed in mils. A positive value means the interval extends above root_pitch while a negative value means the interval extends below. Returns the frequency of the pitch that interval away from root_pitch. | def mils_to_freq(m):
f = root_pitch['freq']*(2**(float(m)/12000))
return f; | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def freq_to_mils(f):\n if f == 0:\n raise Exception('0 not a valid frequency, what you playing at!?')\n else:\n m = int(round(12000* log(f/root_pitch['freq'],2)))\n return m;",
"def getFundFreq(self, data, sampleRate):\n sp = SignalProc.SignalProc(256, 128)\n sp.d... | [
"0.6005354",
"0.5816876",
"0.5760161",
"0.56855977",
"0.5584908",
"0.55389327",
"0.5513072",
"0.5502047",
"0.5458081",
"0.5408832",
"0.5342084",
"0.53296864",
"0.5326595",
"0.5306963",
"0.52949834",
"0.5241739",
"0.5227384",
"0.521453",
"0.5211651",
"0.5193988",
"0.51438063",... | 0.6486499 | 0 |
Receives a frequency, returns interval in mils between that frequency and the frequency of root_pitch (root_pitch['freq']). Returns positive value if given frequency is higher than root_pitch, negative if lower | def freq_to_mils(f):
if f == 0:
raise Exception('0 not a valid frequency, what you playing at!?')
else:
m = int(round(12000* log(f/root_pitch['freq'],2)))
return m; | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def miditofreq(midinote):\n return 440 * (2 ** ((midinote - 69.0)/12.0))",
"def perceptual_amplitude_dbb(frequency: float) -> float:\n # See http://www.sengpielaudio.com/BerechnungDerBewertungsfilter.pdf\n\n num = 12200.0 ** 2. * frequency ** 3\n den = (frequency ** 2. + 20.6) * (frequency ** 2. + 12... | [
"0.6333899",
"0.61145616",
"0.6066061",
"0.6028613",
"0.60101444",
"0.5847054",
"0.5843562",
"0.5816642",
"0.58075583",
"0.57927597",
"0.5756494",
"0.5755922",
"0.5688351",
"0.56856346",
"0.5646544",
"0.56452155",
"0.5620738",
"0.5614233",
"0.5599333",
"0.5584674",
"0.5558646... | 0.6282281 | 1 |
inputs =Input( shape=(784,)) x = Dense(self.dense1, activation='sigmoid')(inputs) x = Dropout(self.drop1)(x) x = Dense(self.dense2, activation='sigmoid')(x) x = Dropout(self.drop2)(x) outputs = Dense(10, activation='softmax')(x) model = Model(inputs=inputs, outputs=outputs) | def mlp_model(self):
model = Sequential()
model.add(Dense(self.dense1, input_shape=(784,)))
model.add(Activation(self.activation))
model.add(Dropout(self.drop1))
model.add(Dense(self.dense2))
model.add(Activation(self.activation))
model.add(Dropout(self.drop2))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dropout_keras_model():\n\n inputs = tf.keras.Input(shape=(10, 10, 3,))\n x = tf.keras.layers.Conv2D(16, (3, 3))(inputs)\n x = tf.keras.layers.Dropout(rate=.4)(x)\n x = tf.identity(x)\n x = tf.keras.layers.Conv2D(8, (2, 2))(x)\n x = tf.keras.layers.Flatten()(x)\n outputs = tf.keras.layers.D... | [
"0.7823621",
"0.74830896",
"0.7386618",
"0.7193419",
"0.7029184",
"0.69533604",
"0.69344425",
"0.69100124",
"0.68434304",
"0.6829454",
"0.682372",
"0.6756743",
"0.67520654",
"0.6721723",
"0.67098445",
"0.66883034",
"0.6681063",
"0.6680644",
"0.6646242",
"0.66427433",
"0.66120... | 0.6374448 | 41 |
Takes a filesystem path and returns a sorted list of filenames under that path. | def get_filenames(path):
xs = []
for (dirpath, dirnames, filenames) in os.walk(path):
xs.extend(filenames)
break
xs.sort()
return xs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_files(path: str) -> List:\n files = []\n for file in os.listdir(path):\n if os.path.isfile(os.path.join(path, file)):\n files.append(file)\n # Reversed to prevent collision upon renaming\n return sorted(files, reverse=True)",
"def get_dirnames(path):\n storage = DefaultSt... | [
"0.7952454",
"0.73314255",
"0.7306707",
"0.72185194",
"0.7201891",
"0.71731275",
"0.7164499",
"0.7163715",
"0.7132579",
"0.7100023",
"0.70964265",
"0.7095107",
"0.70786023",
"0.7019149",
"0.69829243",
"0.6979037",
"0.6974068",
"0.69649667",
"0.69457054",
"0.69418824",
"0.6890... | 0.7987954 | 0 |
Takes two nested two dimensional arrays, a_ary and b_ary, representing a bounding box in ll, ur format [[lon, lat], [lon, lat]]. Returns a boolean result as to whether the bounding boxes overlap. | def bbox_intersect(a_ary, b_ary):
# Do any of the 4 corners of one bbox lie inside the other bbox?
# bbox format of [ll, ur]
# bbx[0] is lower left
# bbx[1] is upper right
# bbx[0][0] is lower left longitude
# bbx[0][1] is lower left latitude
# bbx[1][0] is upper right longitude
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bbox_overlap(bbox_1: Sequence, bbox_2: Sequence) -> bool:\n if (bbox_1[0] > bbox_2[0]) or (bbox_1[1] > bbox_2[1]):\n return False\n if (bbox_1[2] < bbox_2[2]) or (bbox_1[3] < bbox_2[3]):\n return False\n\n return True",
"def is_overlap(bb1, bb2):\n l1, t1, r1, b1 = bb1['x'], bb1['y'... | [
"0.7563125",
"0.72570115",
"0.710988",
"0.701064",
"0.6934993",
"0.677594",
"0.6731343",
"0.66541207",
"0.66268736",
"0.66024",
"0.659357",
"0.65671766",
"0.65535945",
"0.65387017",
"0.6467221",
"0.64572394",
"0.64162743",
"0.6390569",
"0.63497204",
"0.631824",
"0.63000226",
... | 0.85588765 | 0 |
Return true if the current state of this item (in memory) does not match the state of the HDF5 group on disk. | def isDirty(self):
return self._dirty | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equals(self, state):\r\n return self.blockList == state.blockList",
"def changed(self) -> bool:\n for chunk_location, chunk in self._chunk_cache.items():\n if chunk is None:\n # if the chunk is None and the saved record is not None, the chunk has changed.\n ... | [
"0.63124794",
"0.6099656",
"0.60570216",
"0.6045821",
"0.5981474",
"0.5891855",
"0.5865911",
"0.58481914",
"0.5832187",
"0.5811008",
"0.5802596",
"0.57616246",
"0.5759454",
"0.5756959",
"0.5742821",
"0.56859136",
"0.5676896",
"0.56756544",
"0.5663482",
"0.56469285",
"0.563479... | 0.0 | -1 |
Reads a file into a content list line by line and returns that list | def __read_file(self, filename):
with open(filename) as f:
content = f.readlines()
return content | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readListFromFile( filename ):\n try:\n with open( filename ) as f:\n lines = f.readlines()\n return lines\n except:\n #e = sys.exc_info()[0]\n print( 'Error reading file ' + filename )",
"def get_file_contents_as_list(file_name):\n with open(file_name) ... | [
"0.75253785",
"0.7503706",
"0.7470235",
"0.74682444",
"0.7418134",
"0.73924285",
"0.736998",
"0.73024243",
"0.72904253",
"0.72894645",
"0.7281902",
"0.726414",
"0.72486943",
"0.72417253",
"0.720726",
"0.7144634",
"0.7117955",
"0.70599425",
"0.70313835",
"0.70241666",
"0.69936... | 0.6772585 | 40 |
Get the name to use for the object. | def get_context_object_name(self, obj):
if self.context_object_name:
return self.context_object_name
elif isinstance(obj, Price):
return obj._meta.model_name
else:
return None
print(self.context_object_name)
print(obj._meta.model_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_object_name(self):\n return self.obj_name",
"def get_name(self):\n return self.__name",
"def get_name(self):\n return self.__name",
"def get_name(self):\n return self.__name",
"def get_name(self):\n\t\treturn self.__name",
"def get_name(self):\n\n\t\treturn self.__name... | [
"0.8735555",
"0.86023766",
"0.86023766",
"0.86023766",
"0.85686743",
"0.85671425",
"0.8550343",
"0.8550343",
"0.8546606",
"0.8546606",
"0.8546606",
"0.8546606",
"0.8520344",
"0.8453703",
"0.8453703",
"0.8453703",
"0.844385",
"0.844153",
"0.84352714",
"0.84352714",
"0.84352714... | 0.0 | -1 |
Retrieve current OpenVidu configuration | def get(self):
response = openvidu().config()
if response.status_code != 200:
abort(response)
config = response.json()
return dict(
version=config["VERSION"],
domain_or_public_ip=config["DOMAIN_OR_PUBLIC_IP"],
https_port=config["HTTPS_PORT... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self, view = None):\n return self._get_config(\"config\", view)",
"def config(self):\n return self[CONFIG_KEY]",
"def get_config():\n return CONFIG",
"def config(self):\r\n return self._config",
"def config(self):\n return self._config",
"def _get_config(self):\n retu... | [
"0.6989512",
"0.692285",
"0.69071615",
"0.68891853",
"0.6857477",
"0.6812272",
"0.6812272",
"0.6812272",
"0.6812272",
"0.6812272",
"0.6812272",
"0.6812272",
"0.6812272",
"0.6812272",
"0.6812272",
"0.6812272",
"0.6812272",
"0.6812272",
"0.6812272",
"0.6812272",
"0.6812272",
... | 0.6679012 | 80 |
Return the configuration of the actual device. | def device_config(self):
try:
return self._dev
except:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config(self) -> 'outputs.DeviceConfigResponse':\n return pulumi.get(self, \"config\")",
"def get_configuration(self):\n\t\tdevice = DeviceBase(self.name)\n\n\t\tif len(self.master_url) > 0:\n\t\t\tdevice.master_url = self.master_url\n\t\t\tr = requests.get(self.master_url + '/configuration/' + self.na... | [
"0.85367155",
"0.76415837",
"0.76286024",
"0.74827415",
"0.74146307",
"0.7380526",
"0.72712225",
"0.72463226",
"0.72262603",
"0.71948266",
"0.7149988",
"0.70847535",
"0.70729476",
"0.7020076",
"0.70090455",
"0.7004731",
"0.70004076",
"0.69863135",
"0.6963824",
"0.6931717",
"0... | 0.81186765 | 1 |
Return the configuration of the Python object instance representing the device. | def object_config(self):
try:
return self._obj
except:
return 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config(self) -> 'outputs.DeviceConfigResponse':\n return pulumi.get(self, \"config\")",
"def get_config(self):\n return {\"name\": self.name, \"tunable\": self.tunable}",
"def get_configuration(self):\n\t\tdevice = DeviceBase(self.name)\n\n\t\tif len(self.master_url) > 0:\n\t\t\tdevice.master... | [
"0.77338785",
"0.73076427",
"0.72470176",
"0.71414936",
"0.71384084",
"0.7051976",
"0.7000746",
"0.6998327",
"0.69924194",
"0.697031",
"0.6967773",
"0.6925108",
"0.6925108",
"0.6925108",
"0.6925108",
"0.6925108",
"0.6925108",
"0.6925108",
"0.6925108",
"0.6925108",
"0.6925108"... | 0.0 | -1 |
Initializes the controller with the view & model. | def __init__(self, view, model):
self.view = view
self.view.set_controller(self)
self.model = model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.model = self.load_model()\n self.form_html = self.create_form_html()",
"def __init__(self, controller):\n self._controller = controller",
"def on_init(self):\n self.controller = gameController.Controller()",
"def initializeUI(self):\n self.setGeom... | [
"0.7051387",
"0.68626446",
"0.676445",
"0.67608416",
"0.6730788",
"0.66994655",
"0.66494745",
"0.662967",
"0.66260207",
"0.65950286",
"0.6576748",
"0.654844",
"0.6439896",
"0.64361614",
"0.6435332",
"0.6284416",
"0.62685275",
"0.62328696",
"0.6160774",
"0.6102789",
"0.6099398... | 0.80433726 | 0 |
Leaky relu activation function. | def leaky_relu(self, x, name, leak=0.2):
return tf.maximum(x, leak * x, name=name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_leaky_relu_activation(self):\n self.assertEqual(\n [-0.0050, 0.5000], list(af.LeakyRelu(0.01).output(np.array([-0.5, 0.5]))))\n self.assertEqual([0.01, 1], list(af.LeakyRelu(\n 0.01).derivative(np.array([-0.5, 0.5]))))",
"def leaky_relu(x, slope=0.2):\n return Leak... | [
"0.7686328",
"0.7230175",
"0.7181241",
"0.7143373",
"0.71075493",
"0.7102333",
"0.7057857",
"0.7035016",
"0.68852365",
"0.68745446",
"0.6856663",
"0.6809263",
"0.6791482",
"0.67016006",
"0.6603871",
"0.65718055",
"0.6509904",
"0.64695686",
"0.63709915",
"0.6325982",
"0.632339... | 0.69515204 | 8 |
Make user use group's timezones. | def disable_user_tzs(self, user_id):
self.set_user_tzs(user_id, []) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_timezone(dt, user):\n\ttz = get_config('TIME_ZONE', 'UTC')\n\tif user.is_authenticated():\n\t\tif user.profile.timezone:\n\t\t\ttz = user.profile.timezone\n\ttry:\n\t\tresult = dt.astimezone(pytz.timezone(tz))\n\texcept ValueError:\n\t\t# The datetime was stored without timezone info, so use the\n\t\t# ti... | [
"0.63500154",
"0.6300656",
"0.6300656",
"0.6260512",
"0.6236655",
"0.6027528",
"0.6027528",
"0.6027528",
"0.6027528",
"0.6027528",
"0.6027528",
"0.6027528",
"0.6027528",
"0.6027528",
"0.6027528",
"0.6027528",
"0.6027528",
"0.6027528",
"0.6027528",
"0.6027528",
"0.6027528",
... | 0.60925454 | 5 |
Sets the availability of this AdditionalInfoResponseTimestamps. | def availability(self, availability):
self._availability = availability | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_available(self):\n self._available = True\n self._timeout_stamp = datetime.now()",
"def set_availability(self, available: bool) -> None:\n self._attr_available = available\n self.schedule_update_ha_state()",
"def set_availability(self, available: bool) -> None:\n self... | [
"0.63755864",
"0.6079537",
"0.6079537",
"0.59843475",
"0.5740844",
"0.5688291",
"0.56257373",
"0.5434451",
"0.5280206",
"0.52409625",
"0.5186938",
"0.51610863",
"0.5156062",
"0.51475394",
"0.5111984",
"0.50719017",
"0.50218046",
"0.4982686",
"0.49308842",
"0.49190474",
"0.491... | 0.67319524 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.