query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Function for uploading presentations to Plotly. | def upload(cls, presentation, filename, sharing="public", auto_open=True):
if sharing == "public":
world_readable = True
elif sharing in ["private", "secret"]:
world_readable = False
else:
raise _plotly_utils.exceptions.PlotlyError(SHARING_ERROR_MSG)
d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_save(self):\r\n # collect save_path and desired file extension\r\n extensions = \"PowerPoint Presentation(*.pptx);;PDF(*.pdf)\"\r\n save_path, extension = QtWidgets.QFileDialog.getSaveFileName(\r\n self, 'Save File', \"Figures\", extensions)\r\n # save path in desire... | [
"0.56772554",
"0.5399572",
"0.5398044",
"0.5314774",
"0.5229122",
"0.51323825",
"0.5124113",
"0.5074955",
"0.49781245",
"0.49762642",
"0.49641114",
"0.4905709",
"0.4898548",
"0.48640507",
"0.48637408",
"0.48447624",
"0.4821062",
"0.4804937",
"0.4803702",
"0.4802437",
"0.47761... | 0.63278127 | 0 |
Extract inline data arrays from a graph_obj instance and place them in a grid | def _extract_grid_graph_obj(obj_dict, reference_obj, grid, path):
from chart_studio.grid_objs import Column
for prop in list(obj_dict.keys()):
propsrc = "{}src".format(prop)
if propsrc in reference_obj:
val = obj_dict[prop]
if is_array(val):
column = Col... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_graph(self):",
"def data_shapes(self):",
"def regrid(self, obj, **kwargs):\n if isinstance(obj, xr.Dataset):\n return obj.map(self._regrid_dataarray, keep_attrs=True, **kwargs)\n elif isinstance(obj, xr.DataArray):\n return self._regrid_dataarray(obj, **kwargs)\... | [
"0.58976513",
"0.57809937",
"0.56220186",
"0.55353063",
"0.5491279",
"0.54407907",
"0.5427664",
"0.5394095",
"0.53782594",
"0.5346735",
"0.53352916",
"0.52837694",
"0.5283666",
"0.5258334",
"0.5243876",
"0.52306527",
"0.5229383",
"0.5210069",
"0.5205945",
"0.5193088",
"0.5187... | 0.6230959 | 0 |
Populate src columns in a figure from uploaded grid | def _set_grid_column_references(figure, grid):
from plotly.basedatatypes import BaseFigure
for col in grid:
prop_path = BaseFigure._str_to_dict_path(col.name)
prop_parent = figure
for prop in prop_path[:-1]:
prop_parent = prop_parent[prop]
prop_parent[prop_path[-1] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prepare_grid(self):\n raise NotImplementedError",
"def import_grid(file_name):\n\n return FileReader(file_name=file_name).grid",
"def populate_contents(self):\n\n guitile = self.guitile\n tile = guitile.tile\n scene = guitile.parent\n world = scene.world\n data... | [
"0.58529615",
"0.5722479",
"0.55783635",
"0.5519258",
"0.5485704",
"0.5460925",
"0.54276276",
"0.53621876",
"0.5329061",
"0.53277713",
"0.52422005",
"0.52240705",
"0.51649535",
"0.51596576",
"0.5140765",
"0.5121448",
"0.5101367",
"0.5097897",
"0.50913846",
"0.507666",
"0.5063... | 0.67005676 | 0 |
BETA function that creates plots with animations via `frames`. Creates an animated plot using 'frames' alongside 'data' and 'layout'. This BETA endpoint is subject to deprecation in the future. In relation to `plotly.plotly.plot`, foldercreation and overwriting are not supported but creating a plot with or without anim... | def create_animations(figure, filename=None, sharing="public", auto_open=True):
# This function is no longer needed since plot now supports figures with
# frames. Delegate to this implementation for compatibility
return plot(figure, filename=filename, sharing=sharing, auto_open=auto_open) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def icreate_animations(figure, filename=None, sharing=\"public\", auto_open=False):\n from plotly.basedatatypes import BaseFigure, BaseLayoutType\n\n url = create_animations(figure, filename, sharing, auto_open)\n\n if isinstance(figure, dict):\n layout = figure.get(\"layout\", {})\n if isin... | [
"0.6433402",
"0.6419043",
"0.61983055",
"0.61686194",
"0.61157924",
"0.6006025",
"0.5984746",
"0.58544487",
"0.5740268",
"0.5688314",
"0.5680433",
"0.56523126",
"0.56414497",
"0.55911505",
"0.55769205",
"0.55617744",
"0.5528451",
"0.5492272",
"0.5473786",
"0.5433037",
"0.5418... | 0.6678529 | 0 |
Create a unique url for this animated plot in Plotly and open in IPython. This function is based off `plotly.plotly.iplot`. See `plotly.plotly. create_animations` Doc String for param descriptions. | def icreate_animations(figure, filename=None, sharing="public", auto_open=False):
from plotly.basedatatypes import BaseFigure, BaseLayoutType
url = create_animations(figure, filename, sharing, auto_open)
if isinstance(figure, dict):
layout = figure.get("layout", {})
if isinstance(layout, B... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_animations(figure, filename=None, sharing=\"public\", auto_open=True):\n # This function is no longer needed since plot now supports figures with\n # frames. Delegate to this implementation for compatibility\n return plot(figure, filename=filename, sharing=sharing, auto_open=auto_open)",
"de... | [
"0.6538474",
"0.57929957",
"0.56766987",
"0.5381108",
"0.53011656",
"0.51854855",
"0.5129218",
"0.5093216",
"0.5035693",
"0.5000139",
"0.49549904",
"0.49181676",
"0.4911445",
"0.49071693",
"0.48865756",
"0.4881856",
"0.48634565",
"0.48596302",
"0.48410246",
"0.48392338",
"0.4... | 0.6949142 | 0 |
Override default field save action and create resized campaign images. `instance` is a campaign instance. | def save_form_data(self, instance, data):
if data and isinstance(data, UploadedFile):
# A new file is being uploaded. So delete the old one.
remove_model_image(instance, 'image')
super(CampaignImageField, self).save_form_data(instance, data)
instance._create_resized_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_resized_images(self, raw_field, save):\r\n # Derive base filename (strip out the relative directory).\r\n filename = os.path.split(self.image.name)[-1]\r\n ctype = guess_type(filename)[0]\r\n\r\n # Generate resized copy of image.\r\n remove_model_image(self, 'image_re... | [
"0.626244",
"0.6168812",
"0.57716715",
"0.5742439",
"0.5704328",
"0.5671202",
"0.5671202",
"0.5671202",
"0.5671202",
"0.5613979",
"0.56132865",
"0.55828434",
"0.5474811",
"0.541257",
"0.5371931",
"0.5325314",
"0.52652144",
"0.5259431",
"0.5245635",
"0.5236411",
"0.52255183",
... | 0.72719294 | 0 |
Return tuple (True/False, reason_list) based on whether user abides by all campaign rules or not. Return True if user qualifies. False, otherwise. When False, return a list of reasons for nonqualification. | def is_user_qualified(self, user):
reason_list = []
qual = True
p = user.get_profile()
if not (user.first_name and user.last_name):
qual = False
reason_list.append('NO_NAME')
if self.address_required:
try:
adr = p.addre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_viability(self, applied_rules,user_requirements):\n \n for req in user_requirements:\n label1=True\n if \"not\" in req:\n label1=False\n for a,c in applied_rules.items():\n if not (c!=c):\n for item in c:\n ... | [
"0.5745078",
"0.5604385",
"0.5587739",
"0.55618876",
"0.5380991",
"0.5368372",
"0.53602606",
"0.5305023",
"0.5258019",
"0.5210823",
"0.52031296",
"0.5195069",
"0.51850647",
"0.5180097",
"0.5171265",
"0.51503825",
"0.50853825",
"0.50533473",
"0.504923",
"0.50428295",
"0.499314... | 0.6823228 | 0 |
Return true if this campaign has not been approved or has not yet started AND no contributions are associated with it. In all other cases, an admin needs to review the campaign before it may be deleted. | def is_deletable(self):
# Deletion functionality is currently under discussion.
# For now, delete requests are emailed to the admin.
return False
#return (not self.is_approved or self.start_date > now) and (not self.amount_raised) and (not self.is_deleted)
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n from .delivery import Delivery\n return Delivery.objects.filter(deadline__assignment_group=self).count() == 0",
"def available(self):\n existing_url = self.context.get_personal_fundraising_campaign_url()\n same = existing_url == self.context.absolute_url()\n ... | [
"0.65984696",
"0.6162966",
"0.6141656",
"0.6131104",
"0.6130167",
"0.6102289",
"0.60798293",
"0.6004878",
"0.59252405",
"0.58954984",
"0.58919406",
"0.588413",
"0.5877901",
"0.58376265",
"0.58272123",
"0.58170944",
"0.58153945",
"0.5807906",
"0.579944",
"0.5790465",
"0.577757... | 0.630697 | 1 |
Return true if tickets may be requested for this campaign. True only if the campaign is active and at least some online contributions are left to be fulfilled. Tickets are allocated from the online contributions left unfulfilled. | def are_tickets_available(self):
return self.is_active and self.num_online_left > 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_make_action(self) -> bool:\n return not(self.has_pending_action or self.is_dead())",
"def _is_ticket_blocked(self, registration, **kwargs):\n if not self._is_ticketing_handled(registration.registration_form):\n return False\n req = registration.cern_access_request\n ... | [
"0.63105994",
"0.6292283",
"0.62916857",
"0.62805647",
"0.62008506",
"0.61067694",
"0.6098208",
"0.6084625",
"0.6049259",
"0.6017531",
"0.5990475",
"0.59258395",
"0.59092116",
"0.590441",
"0.5888742",
"0.5873884",
"0.5873884",
"0.58295614",
"0.58243793",
"0.5793655",
"0.57704... | 0.7212234 | 0 |
Return true only if the campaign has ended, payout has not yet been requested and a nonzero amount was raised by this campaign online (i.e. excluding ticket sales.) | def is_payout_available(self):
return False # Disabled because artist receives payout directly from fan
# return self.has_ended and not self.is_payout_requested and self.amount_raised_online and not self.is_deleted
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_enacted(self, billing_cycle):\n return RecurredCost.objects.filter(\n recurring_cost=self,\n billing_cycle=billing_cycle,\n ).exists()",
"def membership_valid(self):\n\n today = date.today()\n\n if self.dues_paid is None:\n return False\n\n months = 12 if... | [
"0.65153354",
"0.63850176",
"0.6346148",
"0.6225997",
"0.604898",
"0.59899217",
"0.59664005",
"0.595621",
"0.594457",
"0.59373146",
"0.5927735",
"0.5919399",
"0.5915515",
"0.58982766",
"0.588037",
"0.58716947",
"0.58713675",
"0.58652365",
"0.5850064",
"0.58477294",
"0.5843681... | 0.7094323 | 0 |
Return HTML fragment to display campaign avatar. | def avatar_preview(self):
h = '<img src="%s" alt="%s"/>' % (self.image_avatar_url, self.title)
return mark_safe(h) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def avatar(self) -> str:\n\t\tif self.hasAvatar:\n\t\t\treturn f'https://avatars.atelier801.com/{self.id % 10000}/{self.id}.jpg'\n\n\t\t# default avatar\n\t\treturn 'https://avatars.atelier801.com/0/0.jpg'",
"def player_avatar(player_obj):\n avatar = \"http://www.gravatar.com/avatar/%s.jpg?d=monsterid\" % md5... | [
"0.7806285",
"0.7282646",
"0.72011507",
"0.7108825",
"0.70606655",
"0.70385337",
"0.697288",
"0.69312835",
"0.68360925",
"0.6825771",
"0.682436",
"0.6802031",
"0.67996067",
"0.67163044",
"0.6692477",
"0.6676478",
"0.6615921",
"0.65725875",
"0.6559654",
"0.65546507",
"0.647917... | 0.7811329 | 0 |
Return a short title for the campaign. | def short_title(self):
return truncate_words(self.title, settings.CAMPAIGN_SHORT_TITLE_WORDS) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def short_title(self):\n if hasattr(self, \"title\"):\n return self.title\n else:\n return \"\"",
"def _get_full_title(self):\n return \"%s - %s %d\" % (self.title, _('Season'), self.season)",
"def dc_title(self):\n return u\"{0} ({1}): {2} {3}\".format(\n ... | [
"0.79867166",
"0.72651714",
"0.72408205",
"0.72131294",
"0.7174297",
"0.7174297",
"0.7174297",
"0.70960057",
"0.7030137",
"0.70218027",
"0.69329596",
"0.69229525",
"0.69193155",
"0.68910915",
"0.68901145",
"0.688875",
"0.688875",
"0.688875",
"0.688875",
"0.688875",
"0.688875"... | 0.80238175 | 0 |
Return the amount raised online to date by this campaign (excluding tickets). | def amount_raised_online(self):
return self.stats.amount_raised_online | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def amount_raised_by_tickets(self):\r\n return self.stats.amount_raised_by_tickets",
"def online_quota(self):\r\n return self.max_contributions - self.num_tickets_total",
"def total_earnings(self):\n return self.total_balance - self.net_invested",
"def unused_daily_balance(self):\n ... | [
"0.6648538",
"0.65222704",
"0.6517339",
"0.62456536",
"0.6216171",
"0.6207917",
"0.6100024",
"0.6017811",
"0.58511364",
"0.58508337",
"0.5834497",
"0.5765602",
"0.5745018",
"0.57433647",
"0.5703548",
"0.5685412",
"0.56764346",
"0.56647485",
"0.56386673",
"0.5617618",
"0.56143... | 0.7680387 | 0 |
Return the amount raised online to date by this campaign (excluding tickets). | def amount_raised_by_tickets(self):
return self.stats.amount_raised_by_tickets | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def amount_raised_online(self):\r\n return self.stats.amount_raised_online",
"def online_quota(self):\r\n return self.max_contributions - self.num_tickets_total",
"def total_earnings(self):\n return self.total_balance - self.net_invested",
"def unused_daily_balance(self):\n curren... | [
"0.76792353",
"0.6520958",
"0.65152824",
"0.62454665",
"0.621647",
"0.62060404",
"0.61002696",
"0.6016582",
"0.5852542",
"0.5847458",
"0.5835288",
"0.5765441",
"0.5743976",
"0.57388186",
"0.57017225",
"0.56852645",
"0.5676207",
"0.56661224",
"0.5640928",
"0.56180817",
"0.5614... | 0.66476005 | 1 |
Return a tuple with campaign_completion_status and completion reason. | def completion_status(self):
if self.end_date < date.today():
return True, self.END_DATE_ARRIVED
try:
if self.stats.num_contributions == self.max_contributions:
return True, self.NUM_CONTRIBUTIONS_RECEIVED
if self.target_amount > D('0'): # Not a ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_completionStatus(self):\n val = self.resource.get_cdmi_sys_meta().get(\"cdmi_completionStatus\",\n \"Complete\")\n return val",
"def get_completionStatus(self):\n val = self.collection.get_cdmi_sys_meta().get(\"cdmi_completionStatu... | [
"0.5947804",
"0.59327567",
"0.5616291",
"0.52731144",
"0.5265674",
"0.49436983",
"0.4830952",
"0.47959238",
"0.47385868",
"0.47261295",
"0.46917155",
"0.4671187",
"0.46472266",
"0.46409318",
"0.46299332",
"0.4625591",
"0.46055818",
"0.46053553",
"0.45845097",
"0.45746335",
"0... | 0.6246219 | 0 |
Return number of online contribution slots left. | def num_online_left(self):
return self._contributions_left[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _contributions_left(self):\r\n if self.is_complete:\r\n return 0, 0\r\n online_left = self.online_quota - self.stats.num_online_contributions\r\n if online_left < 0:\r\n online_left = 0\r\n tickets_left = self.num_tickets_total - self.stats.num_tickets_redeemed... | [
"0.7571377",
"0.7465683",
"0.73241013",
"0.7127471",
"0.68168294",
"0.67226344",
"0.6411935",
"0.6411935",
"0.63958174",
"0.6355988",
"0.63558394",
"0.6352642",
"0.63446766",
"0.6318067",
"0.6280293",
"0.6265559",
"0.6192847",
"0.61567706",
"0.61299294",
"0.6124264",
"0.61216... | 0.819704 | 0 |
Return number of tickets left unredeemed. | def num_tickets_left(self):
return self._contributions_left[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_assigned(self):\n return FlicketTicket.query.filter_by(assigned=self.user).count()",
"def get_number_of_non_exhausted_votes(self):\n return (\n len(self._ballots) * self._number_of_votes_pr_voter\n - self._number_of_blank_votes\n )",
"def count_dead_node(self)... | [
"0.6493252",
"0.6428032",
"0.6175619",
"0.61656725",
"0.61582017",
"0.6120342",
"0.60774404",
"0.6042892",
"0.6042448",
"0.5973437",
"0.5968522",
"0.59675795",
"0.5950691",
"0.5931682",
"0.5920631",
"0.5914511",
"0.5914287",
"0.5904884",
"0.5904233",
"0.5885647",
"0.5863499",... | 0.701578 | 0 |
Return number of online contribution slots left for ``user``. | def num_online_left_for_user(self, user):
q = self.contribution_set.filter(contributor=user)
num_user_contribs = sum([c.qty for c in q])
remaining = self.max_contributions_per_person - num_user_contribs
if remaining < 0:
remaining = 0
left = min(remaining, self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_online_left(self):\r\n return self._contributions_left[0]",
"def num_tickets_left(self):\r\n return self._contributions_left[1]",
"def online_quota(self):\r\n return self.max_contributions - self.num_tickets_total",
"def _contributions_left(self):\r\n if self.is_complete:\... | [
"0.68160844",
"0.62330186",
"0.6140564",
"0.6102145",
"0.6067481",
"0.5960645",
"0.5903416",
"0.5866932",
"0.5677821",
"0.5669443",
"0.56257105",
"0.55714935",
"0.553589",
"0.5470045",
"0.5459135",
"0.54082644",
"0.54061705",
"0.5398779",
"0.5391419",
"0.53723705",
"0.5372370... | 0.84675765 | 0 |
Return tuple with number of online contributions left, unredeemed tickets left. | def _contributions_left(self):
if self.is_complete:
return 0, 0
online_left = self.online_quota - self.stats.num_online_contributions
if online_left < 0:
online_left = 0
tickets_left = self.num_tickets_total - self.stats.num_tickets_redeemed
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_tickets_left(self):\r\n return self._contributions_left[1]",
"def num_online_left(self):\r\n return self._contributions_left[0]",
"def num_contributions(self):\r\n return self.stats.num_online_contributions + self.stats.num_tickets_redeemed",
"def num_online_left_for_user(self, u... | [
"0.7854473",
"0.77017546",
"0.76214844",
"0.696369",
"0.66078",
"0.6212701",
"0.61763775",
"0.6029871",
"0.6027404",
"0.5975739",
"0.588967",
"0.5837207",
"0.58153087",
"0.579741",
"0.57788235",
"0.5733538",
"0.5713386",
"0.5599514",
"0.559566",
"0.5583314",
"0.5579644",
"0... | 0.87415415 | 0 |
Return number of online and ticket contributions made to this campaign. | def num_contributions(self):
return self.stats.num_online_contributions + self.stats.num_tickets_redeemed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_attendees(self):\r\n n = sum([c.qty for c in self.contribution_set.all()])\r\n return n",
"def get_num_contributions(self, project):\n return project.observations.exclude(\n status='draft').exclude(status='pending').count()",
"def _contributions_left(self):\r\n if... | [
"0.6976142",
"0.6615978",
"0.6504466",
"0.6337855",
"0.62272394",
"0.6158342",
"0.6111951",
"0.60996264",
"0.6082669",
"0.6033576",
"0.6031653",
"0.6028697",
"0.5957099",
"0.59200794",
"0.5905668",
"0.588132",
"0.58618236",
"0.58588386",
"0.58588386",
"0.58567053",
"0.5841208... | 0.8378922 | 0 |
Return number of attendee i.e. tickets purchased when this campaign behaves like an event. | def num_attendees(self):
n = sum([c.qty for c in self.contribution_set.all()])
return n | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attendee_type(self):\n return self.__attendee_type",
"def number_of_employees(self) -> object:\n return self._number_of_employees",
"def get_num_events(self):\n return len(self.events)",
"def event_count(self):\n\n with self.lock:\n return self.num_events",
"def n... | [
"0.5956268",
"0.5897246",
"0.58398396",
"0.58112955",
"0.5803674",
"0.5795053",
"0.57909834",
"0.57790005",
"0.5719",
"0.5714171",
"0.5689035",
"0.56651944",
"0.5661494",
"0.560605",
"0.5589365",
"0.5561161",
"0.5552847",
"0.5528604",
"0.55058783",
"0.5503661",
"0.5494597",
... | 0.7240361 | 0 |
Return the number of online contributions accepted excluding tickets. | def online_quota(self):
return self.max_contributions - self.num_tickets_total | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_contributions(self):\r\n return self.stats.num_online_contributions + self.stats.num_tickets_redeemed",
"def _contributions_left(self):\r\n if self.is_complete:\r\n return 0, 0\r\n online_left = self.online_quota - self.stats.num_online_contributions\r\n if online_l... | [
"0.7680878",
"0.68704367",
"0.67946506",
"0.67775667",
"0.66226083",
"0.65727556",
"0.62992626",
"0.6272155",
"0.5835012",
"0.57726115",
"0.57014626",
"0.56466216",
"0.5588915",
"0.55851907",
"0.55542594",
"0.5546944",
"0.5543755",
"0.5502432",
"0.5480795",
"0.5479391",
"0.54... | 0.68959504 | 1 |
Return the campaign's title upto ``settings.CAMPAIGN_SHORT_TITLE_LENGTH`` characters long. | def short_title_chars(self):
if len(self.title) > settings.CAMPAIGN_SHORT_TITLE_LENGTH:
return mark_safe(u'%s…' % self.title[:settings.CAMPAIGN_SHORT_TITLE_LENGTH])
else:
return self.title | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def short_title(self):\r\n return truncate_words(self.title, settings.CAMPAIGN_SHORT_TITLE_WORDS)",
"def short_title(self):\n if hasattr(self, \"title\"):\n return self.title\n else:\n return \"\"",
"def short_title_wrapped_for_badge(self):\r\n chars_per_line =... | [
"0.8213916",
"0.70617396",
"0.6692291",
"0.65539163",
"0.65110725",
"0.65110725",
"0.65110725",
"0.64610857",
"0.6314523",
"0.6277278",
"0.62569463",
"0.6240971",
"0.6175591",
"0.6133644",
"0.6116493",
"0.6102081",
"0.6100081",
"0.609643",
"0.60527235",
"0.60176116",
"0.59802... | 0.7798636 | 1 |
Return characters per line computed to fit within a badge's available area. | def _badge_chars_per_line(self, text, font, font_size):
xmin, y = settings.CAMPAIGN_BADGE_TITLE_POSITION
xmax, y = settings.CAMPAIGN_BADGE_CALLOUT_POSITION
width_available = xmax - xmin - settings.CAMPAIGN_BADGE_TITLE_CLEARANCE # clearance
font = ImageFont.truetype(font, font_size, e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def embedcount(line):\r\n\r\n x_temp = line.count(BOX_CHAR['lu'])\r\n return self.defaults.get('size')-(4*x_temp)",
"def max_cell_print_len(self):\n m = 0\n for r in range(1, self.height + 1):\n for c in range(1, self.width + 1):\n l = 0\n ... | [
"0.61816067",
"0.611288",
"0.60307944",
"0.59668225",
"0.59407157",
"0.59143853",
"0.5897015",
"0.5884214",
"0.5830635",
"0.580511",
"0.5767582",
"0.57243836",
"0.5687531",
"0.5649153",
"0.56305814",
"0.55950236",
"0.5588034",
"0.55606884",
"0.55350626",
"0.5440564",
"0.54376... | 0.7767387 | 0 |
Return the campaign's title with wrapped lines to fit a badge. Each line is returned as a list element. | def short_title_wrapped_for_badge(self):
chars_per_line = self._badge_chars_per_line(self.title, settings.CAMPAIGN_BADGE_TITLE_FONT, settings.CAMPAIGN_BADGE_TITLE_FONT_SIZE)
max_lines = settings.CAMPAIGN_BADGE_TITLE_MAX_LINES
if len(self.title) > chars_per_line:
wrapped = textwra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _badge_chars_per_line(self, text, font, font_size):\r\n xmin, y = settings.CAMPAIGN_BADGE_TITLE_POSITION\r\n xmax, y = settings.CAMPAIGN_BADGE_CALLOUT_POSITION\r\n width_available = xmax - xmin - settings.CAMPAIGN_BADGE_TITLE_CLEARANCE # clearance\r\n font = ImageFont.truetype(font,... | [
"0.5950481",
"0.55526423",
"0.5538213",
"0.5385978",
"0.5345763",
"0.53086627",
"0.5280988",
"0.5221275",
"0.5208013",
"0.52050734",
"0.51493007",
"0.51407295",
"0.51266825",
"0.51221615",
"0.5109308",
"0.5073842",
"0.50568175",
"0.50422937",
"0.5035569",
"0.5021889",
"0.5021... | 0.77992505 | 0 |
Return the latest unapproved changes for this campaign | def changed_version(self):
try:
return CampaignChange.objects.get(campaign__pk=self.pk)
except CampaignChange.DoesNotExist:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unapproved(self):\n return self._unapproved",
"def getChanges():",
"def force_pr_branch_stale_review_dismissal(org: Organization, repo: Repository,\n branches: Dict[str, Branch]) -> List[Change[str]]:\n prb = get_pr_branch(repo, branches)\n if prb:\n ... | [
"0.60499513",
"0.57585406",
"0.5640645",
"0.55023813",
"0.54660064",
"0.53767884",
"0.5359074",
"0.5332692",
"0.5301732",
"0.5226611",
"0.5223253",
"0.5220014",
"0.51943934",
"0.51526076",
"0.5127967",
"0.51240945",
"0.51203287",
"0.5109074",
"0.51008165",
"0.5045237",
"0.502... | 0.6028784 | 1 |
Return embed_service from this instance or from the campaign instance. | def embed_service_latest(self):
return self.embed_service and self.embed_service or self.campaign.embed_service | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service(self) -> Optional[IBMExperimentService]:\n return self._service",
"def service_instance(self):\n return self.service_class(self)",
"def get_embedding(self, embed_id):\n\t\tif not embed_id in self.embedding_meta:\n\t\t\treturn None\n\t\tif embed_id in self.embedding_cache:\n\t\t\tlog.i... | [
"0.5945992",
"0.5741038",
"0.5721124",
"0.548496",
"0.5369398",
"0.5369398",
"0.5360651",
"0.5312046",
"0.5309917",
"0.52676064",
"0.52676064",
"0.52670103",
"0.5165733",
"0.5135973",
"0.5107867",
"0.5107787",
"0.50714964",
"0.5068069",
"0.5064477",
"0.5059853",
"0.5007797",
... | 0.7217123 | 0 |
Return HTML fragment to display badge image. | def image_preview(self):
h = '<img src="%s" alt="Campaign badge"/>' % self.image.url
return mark_safe(h) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_preview(self):\r\n h = '<img src=\"%s\" alt=\"%s\"/>' % (self.image_resized_url, self.title)\r\n return mark_safe(h)",
"def avatar_preview(self):\r\n h = '<img src=\"%s\" alt=\"%s\"/>' % (self.image_avatar_url, self.title)\r\n return mark_safe(h)",
"def img(self, obj):\n ... | [
"0.65032226",
"0.63238186",
"0.6238921",
"0.6182968",
"0.6120444",
"0.6027751",
"0.5957812",
"0.59428513",
"0.5906134",
"0.58768463",
"0.5873083",
"0.58691084",
"0.58234966",
"0.5822494",
"0.5817191",
"0.58008146",
"0.57927096",
"0.5779642",
"0.57480925",
"0.56906426",
"0.565... | 0.8229253 | 0 |
Return path to the badge's background image. | def bg_image_path(self):
from event.models import Badge as EventBadge
if self.campaign.is_event:
return EventBadge.BADGE_BG_IMAGES[self.badge_type]
return self.BADGE_BG_IMAGES[self.badge_type] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_background_pictures_path(self):\n file_path = os.path.dirname(__file__)\n file_path = os.path.join(file_path, \"Background\")\n return file_path",
"def GetBackgroundImage(self):\r\n\r\n return self._backgroundImage",
"def background_image_url(self):\n uf = self.app.ur... | [
"0.7314103",
"0.6826502",
"0.635492",
"0.6251166",
"0.62500614",
"0.623601",
"0.6187002",
"0.6161996",
"0.61078787",
"0.59646225",
"0.59202504",
"0.5913104",
"0.58714074",
"0.5858313",
"0.5850347",
"0.58337384",
"0.5736036",
"0.5709618",
"0.56743366",
"0.5602943",
"0.5598979"... | 0.8470755 | 0 |
Generate tickets for a campaign. Take into account tickets that may have already been generated. | def generate_tickets_for_campaign(self, campaign):
tickets = campaign.ticket_set.all()
# Create a dictionary of this campaign's existing ticket codes.
# These codes are the likeliest ones to clash with the ones we
# are about to generate because their 6 character prefix will be
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _serverSendTickets(self, settings):\n if not settings.ticketKeys:\n return\n\n for _ in range(settings.ticket_count):\n # prepare the ticket\n ticket = SessionTicketPayload()\n ticket.create(self.session.resumptionMasterSecret,\n ... | [
"0.569118",
"0.56331664",
"0.5563668",
"0.55021864",
"0.5442881",
"0.53257453",
"0.52706563",
"0.5247917",
"0.5236451",
"0.5209986",
"0.5176439",
"0.51397324",
"0.5118627",
"0.51181203",
"0.509486",
"0.50916964",
"0.50529736",
"0.5049281",
"0.5030783",
"0.50271887",
"0.501288... | 0.8084835 | 0 |
Create a ticket code that is not in the provided code dictionary. | def make_ticket_code(prefix, code_dict):
while (True): # continue until we find a unique code
letters = random.sample(_CHAR_LIST, 4) # generate 4 random letters
code = prefix + ''.join(letters) # turn letters to string
if not code_dict.has_key(code): # code is unique
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_ticket_code(self, ticket_code):\n if check_data_exist(ticket_code) is True:\n self.ticket_code = ticket_code.text",
"def from_code(cls, code):\n id, contact_uuid = hashids.decode(code)\n consent = Consent.objects.get(id=id)\n contact_uuid = UUID(int=contact_uuid)\n ... | [
"0.62801766",
"0.5443674",
"0.5440538",
"0.5234728",
"0.520275",
"0.519511",
"0.5161558",
"0.5116961",
"0.502177",
"0.48840544",
"0.4875084",
"0.48725167",
"0.48650402",
"0.48570913",
"0.48569077",
"0.48387298",
"0.48369125",
"0.4833771",
"0.48060164",
"0.47906187",
"0.477658... | 0.6983198 | 0 |
Return a userfriendly version of the ticket code in the format AAABBBCCCC. | def code_display(self):
return u'%s-%s-%s' % (self.code[:3], self.code[3:6], self.code[6:]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_ticket_code(prefix, code_dict):\r\n while (True): # continue until we find a unique code\r\n letters = random.sample(_CHAR_LIST, 4) # generate 4 random letters\r\n code = prefix + ''.join(letters) # turn letters to string\r\n if not code_dict.has_key(code): # code is unique\r\n ... | [
"0.6595918",
"0.6372422",
"0.6350186",
"0.6275939",
"0.62750477",
"0.6203088",
"0.619837",
"0.5990963",
"0.5935194",
"0.59275705",
"0.59174114",
"0.5891635",
"0.5859422",
"0.58105373",
"0.5809429",
"0.5787439",
"0.57846373",
"0.5770695",
"0.5770517",
"0.57554734",
"0.5737908"... | 0.7020354 | 0 |
Return all contributions made by IR members excluding anonymous contributions. | def members(self):
return self.exclude(contributor__username=u'anonymous') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_contributors(self):\n from mysite.profile.models import Person\n return Person.objects.filter(\n portfolioentry__project=self, \n portfolioentry__is_deleted=False,\n portfolioentry__is_published=True\n ).distinct()",
"def contribut... | [
"0.6046986",
"0.6043562",
"0.584833",
"0.5670841",
"0.56313753",
"0.5630841",
"0.5573765",
"0.55295014",
"0.53894323",
"0.53311527",
"0.5322318",
"0.53058314",
"0.53029674",
"0.5283125",
"0.52802974",
"0.52257013",
"0.520252",
"0.50943434",
"0.5088471",
"0.5066758",
"0.502704... | 0.66629636 | 0 |
When a ``Contribution`` or ``Ticket`` object is saved, schedule a recomputation of the campaign's statistics. | def recompute_campaign_stats(sender, instance, **kwargs):
if isinstance(instance, (Contribution, Ticket)):
ActionItem.objects.q_campaign_action(instance.campaign, 'recompute-campaign') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_contribution(self):\n contributions = [v for v in self.action_register if v['action'] == 'contribution']\n for contribution in contributions:\n self.model.schedule.agents_by_type['Customer'][contribution['unique_id']].hour_wallet -= contribution['value']\n self.model... | [
"0.6043927",
"0.56969786",
"0.5672916",
"0.56659484",
"0.56136096",
"0.545843",
"0.5456702",
"0.53531253",
"0.53505385",
"0.5321189",
"0.52938175",
"0.52388984",
"0.51704293",
"0.51602507",
"0.51519763",
"0.5143518",
"0.51280487",
"0.51014",
"0.51009095",
"0.5099541",
"0.5083... | 0.7159458 | 0 |
Copies all specified directories from the development folder to the release folder. | def push(dirs = ['table', 'trigger', 'w3x2lni'], release='release/', development='development/'):
for directory in dirs:
if os.path.exists(release+directory):
shutil.rmtree(release+directory)
shutil.copytree(development+directory, release+directory) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pull(dirs = ['map','table', 'trigger', 'w3x2lni'], release='release/', development='development/'):\n\n if not os.path.exists(development):\n os.mkdir(development)\n\n if not os.path.exists(os.path.join(development, '.w3x')):\n shutil.copy(os.path.join(release, '.w3x'), os.path.join(develop... | [
"0.7620498",
"0.6622516",
"0.6251239",
"0.6242599",
"0.6153279",
"0.6149938",
"0.61095166",
"0.6053073",
"0.6040428",
"0.6013699",
"0.5982683",
"0.59419584",
"0.58662176",
"0.5812235",
"0.5807465",
"0.5791868",
"0.5771328",
"0.5765179",
"0.5745225",
"0.5715352",
"0.57089186",... | 0.77305776 | 0 |
As push, but includes the map directory, which contains many binary files. | def push_all():
push(['map', 'table', 'trigger', 'w3x2lni']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(target):\n if target is None:\n target = getcwd()\n\n target = path.abspath(target)\n\n dot_chunk = load_chunk(target)\n src = dot_chunk[\"src\"]\n source = load_source(src)\n\n copy(target, source)",
"def push(images, tag, registry):\n manager = Manager('push', tag, images=i... | [
"0.60577404",
"0.5499866",
"0.54935145",
"0.54254794",
"0.5405315",
"0.5395411",
"0.5373221",
"0.5372996",
"0.535942",
"0.53404325",
"0.5328375",
"0.53146565",
"0.5246568",
"0.52294695",
"0.5227571",
"0.5217949",
"0.5182642",
"0.5182503",
"0.51716846",
"0.51180077",
"0.510260... | 0.58723074 | 1 |
Copies all specified directories from the release folder to the developlment folder. | def pull(dirs = ['map','table', 'trigger', 'w3x2lni'], release='release/', development='development/'):
if not os.path.exists(development):
os.mkdir(development)
if not os.path.exists(os.path.join(development, '.w3x')):
shutil.copy(os.path.join(release, '.w3x'), os.path.join(development, '.w3x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(dirs = ['table', 'trigger', 'w3x2lni'], release='release/', development='development/'):\n for directory in dirs:\n if os.path.exists(release+directory):\n shutil.rmtree(release+directory)\n shutil.copytree(development+directory, release+directory)",
"def copy_files():\n o... | [
"0.74492764",
"0.6441505",
"0.63066787",
"0.63064885",
"0.6289598",
"0.60637814",
"0.60516167",
"0.59382504",
"0.5931252",
"0.5914326",
"0.5906424",
"0.58967733",
"0.5877343",
"0.58352673",
"0.58161974",
"0.58150053",
"0.5772798",
"0.57671076",
"0.5730384",
"0.5682985",
"0.56... | 0.74292 | 1 |
Opens a file in the Windows explorer (or equivalent). | def open_in_explorer(file):
webbrowser.open(os.path.dirname(p['paths'][file])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_file_browser(path):\n if sys.platform == 'win32':\n #subprocess.Popen(['start', path], shell=True)\n os.startfile(path)\n\n elif sys.platform == 'darwin':\n subprocess.Popen(['open', path])\n\n else:\n try:\n subprocess.Popen(['xdg-open', path])\n exc... | [
"0.78888535",
"0.7886586",
"0.75610894",
"0.72731686",
"0.72630876",
"0.71721107",
"0.7157188",
"0.7046568",
"0.69904256",
"0.69589436",
"0.6947861",
"0.6946041",
"0.69299746",
"0.6867009",
"0.6840836",
"0.6695129",
"0.66920954",
"0.6644093",
"0.6509257",
"0.6484421",
"0.6483... | 0.7954632 | 0 |
Prints all available userdefined functions and their doc strings | def helpme():
for f in get_user_functions(globals()):
help(f)
print("==============================") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def help() : \n\n import types\n\n globs = globals()\n for key, val in globs.iteritems() :\n if isinstance(val, types.FunctionType ) :\n print key\n #for obj in globals() :\n # print obj\n # print obj.callable()\n print globals()['main'].__doc__",
"def print_model_fun... | [
"0.73581004",
"0.7202948",
"0.70071095",
"0.69985086",
"0.67861766",
"0.6772293",
"0.6726573",
"0.67210656",
"0.67196006",
"0.67185324",
"0.66892517",
"0.66633725",
"0.6647594",
"0.6633161",
"0.65764993",
"0.6563759",
"0.6553461",
"0.65467256",
"0.6537472",
"0.6524563",
"0.65... | 0.7403969 | 0 |
Prints all avaiable userdefined functions. | def ls():
for f in get_user_functions(globals()):
print (str(f).split()[1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_model_functions(self):\n # TODO replace print statements with stdout.write\n # TODO get derivatives recursively\n self.functions = self.definitions.get(\"functions\", [])\n for func in self.functions:\n print \"type: \", func[\"type\"]\n print \"args: \",... | [
"0.7516232",
"0.72549874",
"0.7107509",
"0.6689188",
"0.63580495",
"0.6331645",
"0.63284194",
"0.6306593",
"0.62493235",
"0.6227353",
"0.61906517",
"0.61475015",
"0.6114945",
"0.61103076",
"0.60923547",
"0.59975606",
"0.599221",
"0.5966558",
"0.595546",
"0.5936408",
"0.591021... | 0.7512969 | 1 |
A smoke test for GCLDA with symmetric regions. | def test_gclda_symmetric(testdata_laird):
counts_df = annotate.text.generate_counts(
testdata_laird.texts,
text_column="abstract",
tfidf=False,
min_df=1,
max_df=1.0,
)
with pytest.raises(ValueError):
annotate.gclda.GCLDAModel(
counts_df,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_gclda_asymmetric(testdata_laird):\n counts_df = annotate.text.generate_counts(\n testdata_laird.texts,\n text_column=\"abstract\",\n tfidf=False,\n min_df=1,\n max_df=1.0,\n )\n model = annotate.gclda.GCLDAModel(\n counts_df,\n testdata_laird.coord... | [
"0.6335738",
"0.61107993",
"0.604725",
"0.5956813",
"0.5869714",
"0.58591646",
"0.5840649",
"0.58067614",
"0.57013077",
"0.5633415",
"0.56103796",
"0.5609736",
"0.55924153",
"0.55846447",
"0.5578769",
"0.55709195",
"0.5551859",
"0.55398643",
"0.5536729",
"0.55270886",
"0.5488... | 0.6316714 | 1 |
Extract the two parameters from the key the key is given in base 64 | def extractParamsFromKey(key: str) -> []:
l = base64.b64decode(key).decode('ascii')
param1 = l.split('\n')[0]
param2 = l.split('\n')[1]
#convert back to int
param1 = int(param1, 16)
param2 = int(param2, 16)
if args.verbose : print(param1,param2)
return [param1,param2] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_raw_key(self, key_id):",
"def decode_key(key: str) -> Tuple[int, int]:\n try:\n mod, exp = key.split(\".\")\n except ValueError:\n raise ValueError(f\"`{key}` is not a valid key\")\n\n return (\n int.from_bytes(base64.urlsafe_b64decode(mod), config.BYTEORDER),\n int.... | [
"0.64382935",
"0.64359355",
"0.6143085",
"0.6123797",
"0.60922164",
"0.60667336",
"0.60663986",
"0.5990049",
"0.5919372",
"0.5919372",
"0.59139675",
"0.5893412",
"0.5890933",
"0.5886463",
"0.5869078",
"0.5860584",
"0.58529973",
"0.5842338",
"0.5840205",
"0.5792779",
"0.578281... | 0.77334327 | 0 |
Calculate the crypt int | def calculateCrypt(asci: int, e: int, n: int) -> int:
return pow(int(asci),e,n) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculateDeCrypt(asci: int, d: int, n: int) -> int:\n return pow(int(asci),d,n)",
"def encrypt(self,num):\n assert len(bin(num)) <= len(bin(self.kl.n))-self.s\n return itob64(pow(random.randint(0,(1<<self.s)-1)+(num<<self.s),self.kl.e,self.kl.n))",
"def compute_phash_int(im):\n return pha... | [
"0.66796535",
"0.6038953",
"0.59549034",
"0.5820464",
"0.5741138",
"0.5692359",
"0.56516397",
"0.5601851",
"0.55902827",
"0.5567751",
"0.55213207",
"0.5476895",
"0.5407991",
"0.53815913",
"0.5364652",
"0.53618526",
"0.5355564",
"0.53398025",
"0.5336875",
"0.53351057",
"0.5313... | 0.7401181 | 0 |
generate the E and D numbers | def genED(nn: int) -> []:
found = False
i = 0
while not found:
# i don't understand this code but it generates a temp number
i += 1
temp = 1 + (i * nn)
f=prime_factors(temp) #calculate the prime numbers for that number
if(f != []):
e = int(f[0]) # tak... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initECDLP(E):\n \n import random\n \n P=E.gen(0)\n orderP=P.order()\n #k in [1, orderP-1] => Q != E(0)\n k=int(1+(orderP-1)*random.random())\n Q=k*P\n return P, Q",
"def genKeys(p, q):\r\n n = p * q\r\n phi = (p-1)*(q-1)\r\n #e = findE(phi, p, q)\r\n e = findE(phi)\r\n ... | [
"0.65447533",
"0.6277884",
"0.60738915",
"0.6043669",
"0.5972493",
"0.59606236",
"0.5871564",
"0.5846093",
"0.5829476",
"0.58234674",
"0.5806136",
"0.5803679",
"0.57689476",
"0.57675594",
"0.57675594",
"0.57265586",
"0.56781113",
"0.5663191",
"0.56571263",
"0.5647869",
"0.561... | 0.6455815 | 1 |
check if a key file is or is not valid. the 2nd parameter is eiver "private" or "public" defining what key to check | def checkKeyFile(file : str, typ : str) -> bool:
return True
with open(file, "r") as file:
first_line = file.readline()
for last_line in file:
pass
if typ == "private" :
if(first_line == "---begin monRSA private key---\n"):
if(last_line == "--... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isValidKey(key):\n return True",
"def _search_for_key_file(path_to_key_file):\n\n return True if os.path.exists(path_to_key_file) else False",
"def test_getKey_keyexists(self):\n filename = self.mktemp()\n with open(filename, 'wb') as fh:\n fh.write(SEKRIT_KEY)\n fh.... | [
"0.7435507",
"0.6957731",
"0.68942934",
"0.6802299",
"0.6796916",
"0.6708349",
"0.667198",
"0.6648683",
"0.6623832",
"0.6584893",
"0.65597236",
"0.6557",
"0.6553017",
"0.6550139",
"0.65456825",
"0.65126485",
"0.6495024",
"0.64843595",
"0.64770085",
"0.6472086",
"0.6443343",
... | 0.7602366 | 0 |
Inspects a class object | def inspect_class(obj):
print_with_indent("+Class: %s" % obj.__name__)
indent()
for name in obj.__dict__:
node = getattr(obj, name, None)
if node is not None and inspect.ismethod(node):
inspect_method(node)
dedent() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect_oldclass_instance():\n obj = OldClass(11)\n print(dir(obj)) # ['__doc__', '__init__', '__module__', 'number']\n # Why isn't __class__ seen by dir()? I don't know but it exists\n print(obj.__class__) # __main__.OldClass\n print(obj.__dict__) # {'number': 11}\n #print(obj.__getattribute... | [
"0.6613328",
"0.62653726",
"0.6211737",
"0.61960196",
"0.6110185",
"0.5986598",
"0.59814566",
"0.5934204",
"0.5796442",
"0.5774094",
"0.57559836",
"0.5753788",
"0.573132",
"0.5720345",
"0.57163346",
"0.5676686",
"0.5660802",
"0.565003",
"0.563667",
"0.563667",
"0.563667",
"... | 0.7341859 | 0 |
Inspects a builtin function | def inspect_builtin(obj):
print_with_indent("+Builtin Function: %s" % obj.__name__)
indent()
print_docstr(obj)
dedent()
print() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isbuiltin(object):\r\n return isinstance(object, types.BuiltinFunctionType)",
"def is_builtin(fn) -> bool:\n return getattr(fn, TRITON_BUILTIN, False)",
"def builtin_utility(func):\n func.is_utility = True\n return func",
"def isbuiltin(object):\n if inspect.isbuiltin(object):\n ret... | [
"0.7390962",
"0.6973263",
"0.69511855",
"0.66379327",
"0.65531063",
"0.6482589",
"0.6479676",
"0.64753157",
"0.6392714",
"0.61884785",
"0.6184197",
"0.6146314",
"0.60761666",
"0.6052978",
"0.60003906",
"0.59859073",
"0.59435755",
"0.5937477",
"0.5912072",
"0.58720666",
"0.586... | 0.7880373 | 0 |
Inspects the module object including its classes and functions | def inspect_module(module, depth=2):
if depth < 1: return
print_with_indent("Module: %s\n" % module.__name__)
indent()
count = 0
for name in dir(module):
obj = getattr(module, name)
if inspect.isclass(obj):
count += 1
inspect_class(obj)
elif inspect.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def module_info():\n pass",
"def _inspect_module(module):\n module_list = getmembers(module, predicate=ismodule)\n classes = getmembers(module, predicate=isclass)\n for (name, cls) in classes:\n if issubclass(cls, db.Model) and not issubclass(cls, Taxonomy):\n if cls is not db.M... | [
"0.7188315",
"0.69164604",
"0.6614014",
"0.6614014",
"0.6614014",
"0.6414687",
"0.63764894",
"0.6332649",
"0.6281843",
"0.621142",
"0.6125064",
"0.61122406",
"0.6087565",
"0.6070274",
"0.6031727",
"0.60100985",
"0.59951043",
"0.5992282",
"0.5980591",
"0.592615",
"0.5923805",
... | 0.7390741 | 0 |
Load GE 3T b0 image form the scil b0 dataset. Returns | def read_scil_b0():
dipy_home = os.path.join(os.path.expanduser('~'), '.dipy')
file = pjoin(dipy_home,
'datasets_multi-site_all_companies',
'3T',
'GE',
'b0.nii.gz')
return nib.load(file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_sherbrooke_3shell():\n dipy_home = pjoin(os.path.expanduser('~'), '.dipy')\n folder = pjoin(dipy_home, 'sherbrooke_3shell')\n fraw = pjoin(folder, 'HARDI193.nii.gz')\n fbval = pjoin(folder, 'HARDI193.bval')\n fbvec = pjoin(folder, 'HARDI193.bvec')\n md5_dict = {'data': '0b735e8f16695a37b... | [
"0.607615",
"0.57492703",
"0.5654193",
"0.55892587",
"0.5580285",
"0.555715",
"0.5531645",
"0.54786587",
"0.54739684",
"0.54730284",
"0.5470991",
"0.5441779",
"0.54277116",
"0.53883517",
"0.53697693",
"0.53539664",
"0.5348485",
"0.5344175",
"0.53311616",
"0.5302135",
"0.52955... | 0.62558323 | 0 |
Load Siemens 1.5T b0 image form the scil b0 dataset. Returns | def read_siemens_scil_b0():
dipy_home = os.path.join(os.path.expanduser('~'), '.dipy')
file = pjoin(dipy_home,
'datasets_multi-site_all_companies',
'1.5T',
'Siemens',
'b0.nii.gz')
return nib.load(file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_scil_b0():\n dipy_home = os.path.join(os.path.expanduser('~'), '.dipy')\n file = pjoin(dipy_home,\n 'datasets_multi-site_all_companies',\n '3T',\n 'GE',\n 'b0.nii.gz')\n\n return nib.load(file)",
"def extract_b0(in_file, b0_ixs, ou... | [
"0.67495304",
"0.60644424",
"0.59589976",
"0.59048885",
"0.57966423",
"0.57379186",
"0.5633264",
"0.54841524",
"0.5282094",
"0.52427334",
"0.52060914",
"0.52036047",
"0.5200739",
"0.5196795",
"0.5192517",
"0.51827204",
"0.51650256",
"0.5147097",
"0.51174784",
"0.51135117",
"0... | 0.72508013 | 0 |
Download a 2shell software phantom dataset | def fetch_isbi2013_2shell():
dipy_home = pjoin(os.path.expanduser('~'), '.dipy')
url = 'https://dl.dropboxusercontent.com/u/2481924/isbi2013_merlet/'
uraw = url + '2shells-1500-2500-N64-SNR-30.nii.gz'
ubval = url + '2shells-1500-2500-N64.bval'
ubvec = url + '2shells-1500-2500-N64.bvec'
folder = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_data():\n # Download Unihan meta data for radical-stroke analysis\n os.system(' mkdir Unihan')\n os.system(' curl -O http://unicode.org/Public/UCD/latest/ucd/Unihan.zip')\n os.system(' apt-get -y install unzip')\n os.system(' unzip Unihan.zip -d Unihan/')\n os.system(' rm Unihan.zip'... | [
"0.68775976",
"0.66987246",
"0.6619036",
"0.661324",
"0.6612394",
"0.6594848",
"0.6582969",
"0.6507894",
"0.64481825",
"0.64454395",
"0.6372677",
"0.6333559",
"0.6326726",
"0.631835",
"0.63142276",
"0.63080144",
"0.6275045",
"0.62746406",
"0.6262041",
"0.62585896",
"0.6227156... | 0.6701189 | 1 |
Load Sherbrooke 3shell HARDI dataset Returns | def read_sherbrooke_3shell():
dipy_home = pjoin(os.path.expanduser('~'), '.dipy')
folder = pjoin(dipy_home, 'sherbrooke_3shell')
fraw = pjoin(folder, 'HARDI193.nii.gz')
fbval = pjoin(folder, 'HARDI193.bval')
fbvec = pjoin(folder, 'HARDI193.bvec')
md5_dict = {'data': '0b735e8f16695a37bfbd66aab136... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_sherbrooke_3shell():\n dipy_home = pjoin(os.path.expanduser('~'), '.dipy')\n url = 'https://dl.dropboxusercontent.com/u/2481924/sherbrooke_data/'\n uraw = url + '3shells-1000-2000-3500-N193.nii.gz'\n ubval = url + '3shells-1000-2000-3500-N193.bval'\n ubvec = url + '3shells-1000-2000-3500-N... | [
"0.6948553",
"0.6487614",
"0.6254063",
"0.6184875",
"0.61839867",
"0.6147611",
"0.60905784",
"0.606405",
"0.6053621",
"0.60466534",
"0.6008154",
"0.5960204",
"0.5947041",
"0.5943305",
"0.5890382",
"0.58828884",
"0.5882014",
"0.5861466",
"0.5851769",
"0.5846251",
"0.5839514",
... | 0.71048427 | 0 |
Read stanford hardi data and label map | def read_stanford_labels():
# First get the hardi data
fetch_stanford_hardi()
hard_img, gtab = read_stanford_hardi()
# Fetch and load
files, folder = fetch_stanford_labels()
labels_file = pjoin(folder, "aparc-reduced.nii.gz")
labels_img = nib.load(labels_file)
return hard_img, gtab, lab... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_data(feature_file, label_file):",
"def fetch_stanford_labels():\n dipy_home = pjoin(os.path.expanduser('~'), '.dipy')\n folder = pjoin(dipy_home, 'stanford_hardi')\n baseurl = 'https://stacks.stanford.edu/file/druid:yx282xq2090/'\n\n files = {}\n files[\"aparc-reduced.nii.gz\"] = (baseurl... | [
"0.68909866",
"0.68566054",
"0.6280608",
"0.6082985",
"0.5977923",
"0.5870405",
"0.5853151",
"0.58476645",
"0.57703805",
"0.57467085",
"0.574277",
"0.5737102",
"0.57115316",
"0.57073283",
"0.56779665",
"0.56748366",
"0.5668402",
"0.5667598",
"0.5644525",
"0.5634228",
"0.56186... | 0.73376054 | 0 |
Load Stanford HARDI dataset Returns | def read_stanford_hardi():
dipy_home = pjoin(os.path.expanduser('~'), '.dipy')
folder = pjoin(dipy_home, 'stanford_hardi')
fraw = pjoin(folder, 'HARDI150.nii.gz')
fbval = pjoin(folder, 'HARDI150.bval')
fbvec = pjoin(folder, 'HARDI150.bvec')
md5_dict = {'data': '0b18513b46132b4d1051ed3364f2acbc',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_stanford_hardi():\n dipy_home = pjoin(os.path.expanduser('~'), '.dipy')\n url = 'https://stacks.stanford.edu/file/druid:yx282xq2090/'\n uraw = url + 'dwi.nii.gz'\n ubval = url + 'dwi.bvals'\n ubvec = url + 'dwi.bvecs'\n folder = pjoin(dipy_home, 'stanford_hardi')\n\n md5_list = ['0b1... | [
"0.63684505",
"0.622341",
"0.61821675",
"0.6158769",
"0.6082676",
"0.60746723",
"0.59733224",
"0.58599687",
"0.5831271",
"0.5809915",
"0.580198",
"0.5788284",
"0.57681197",
"0.5744487",
"0.57415545",
"0.5724408",
"0.5714508",
"0.5690167",
"0.5684347",
"0.5681874",
"0.5667758"... | 0.62924814 | 1 |
Load Taiwan NTU dataset Returns | def read_taiwan_ntu_dsi():
dipy_home = pjoin(os.path.expanduser('~'), '.dipy')
folder = pjoin(dipy_home, 'taiwan_ntu_dsi')
fraw = pjoin(folder, 'DSI203.nii.gz')
fbval = pjoin(folder, 'DSI203.bval')
fbvec = pjoin(folder, 'DSI203.bvec')
md5_dict = {'data': '950408c0980a7154cb188666a885a91f',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_taiwan_ntu_dsi():\n dipy_home = pjoin(os.path.expanduser('~'), '.dipy')\n uraw = 'http://dl.dropbox.com/u/2481924/taiwan_ntu_dsi.nii.gz'\n ubval = 'http://dl.dropbox.com/u/2481924/tawian_ntu_dsi.bval'\n ubvec = 'http://dl.dropbox.com/u/2481924/taiwan_ntu_dsi.bvec'\n ureadme = 'http://dl.dr... | [
"0.61756366",
"0.5716733",
"0.5668432",
"0.564826",
"0.5604333",
"0.55147326",
"0.5506182",
"0.54763895",
"0.5406975",
"0.54067343",
"0.5400896",
"0.5399608",
"0.53895825",
"0.53670913",
"0.5356851",
"0.5312431",
"0.5301151",
"0.52841884",
"0.5277188",
"0.52759355",
"0.527288... | 0.5970224 | 1 |
Download t1 and b0 volumes from the same session | def fetch_syn_data():
dipy_home = pjoin(os.path.expanduser('~'), '.dipy')
url = 'https://dl.dropboxusercontent.com/u/5918983/'
t1 = url + 't1.nii.gz'
b0 = url + 'b0.nii.gz'
folder = pjoin(dipy_home, 'syn_test')
md5_list = ['701bda02bb769655c7d4a9b1df2b73a6', # t1
'e4b741f0c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_files(self):",
"def download1():\n #t=request.vars.arg(0)\n response.flash=request\n #print request.wsgi.environ['HTTP_REFERER']\n #print 'yghklo=',request.args[0]\n a=db(db.Project.Project_File==request.args[0]).select(db.Project.ALL)\n #a=db(db.Project.id==38).select(db.Project.A... | [
"0.6127656",
"0.5788105",
"0.5635588",
"0.560416",
"0.55838215",
"0.5575191",
"0.55328935",
"0.54932624",
"0.5481344",
"0.5445018",
"0.54110694",
"0.5409064",
"0.54085475",
"0.5388539",
"0.5365564",
"0.53495365",
"0.5339003",
"0.533743",
"0.53304434",
"0.53248733",
"0.5322752... | 0.5941047 | 1 |
The query to execute for notifs related to a user. This query clubs all notifications with the post's id and only which were sent to the user | def query_notifs(user, **kwargs):
notif_type = kwargs.get("notif_type", None)
notif_unread = None
if notif_type == "unread":
notif_unread = 1
elif notif_type == "read":
notif_unread = 0
page = kwargs.get("page", 0)
max_items = kwargs.get("max_items", 5)
if page and max_items:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def for_user(self, user):\n return self.get_query_set().filter(owner=user, sender=user)",
"def for_user(self, user):\n return self.get_query_set().filter(owner=user, recipient=user)",
"def notify_users_of_reminders():\n\n #Get current date into dd/mm/YYYY format.\n now = datetime.da... | [
"0.5889689",
"0.58595943",
"0.576337",
"0.5741798",
"0.57218426",
"0.57030535",
"0.5698023",
"0.5683861",
"0.5680164",
"0.5645842",
"0.558274",
"0.55718887",
"0.5557081",
"0.55380493",
"0.55174744",
"0.54981583",
"0.5497325",
"0.5494232",
"0.5396251",
"0.53864706",
"0.5381462... | 0.67015195 | 0 |
The query to get all walls related to a user | def get_my_walls(user):
erp_profile = None
if isinstance(user, User):
user = user
erp_profile = user.erp_profile
elif isinstance(user, ERPProfile):
erp_profile = user
user = erp_profile.user
erp_coords = erp_profile.coord_relations.all()
erp_supercoords = erp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def walls(self):\n return self.container['walls']",
"def walls(self):\n return self._walls",
"def walls(self):\n return self._walls",
"def OLD_get_my_posts(access_obj, wall=None):\n from apps.users.models import Dept, Subdept, Page\n\n if isinstance(access_obj, User):\n erp_... | [
"0.61828864",
"0.61241937",
"0.61241937",
"0.5877998",
"0.5711099",
"0.5704843",
"0.56985855",
"0.56568384",
"0.5612942",
"0.5448833",
"0.5419498",
"0.5355048",
"0.5276249",
"0.52732354",
"0.5241815",
"0.52263796",
"0.52210313",
"0.52190775",
"0.52153635",
"0.5150145",
"0.514... | 0.7427626 | 0 |
Convert an hexadecimal search pattern into a POSIX regular expression. | def pattern(token):
token = ''.join([ c for c in token if c == '?' or c.isalnum() ])
if len(token) % 2 != 0:
raise ValueError("Missing characters in hex data")
regexp = ''
for i in range(0, len(token), 2):
x = token[i:i+2]
if x == '??':
regexp += '.'
elif x[0]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_regex(pattern:str) -> str:\n raise NotImplementedError()",
"def pattern(arg: str) -> Pattern[bytes]:\n try:\n return re.compile(str.encode(arg))\n except (TypeError, re.error) as err:\n raise argparse.ArgumentTypeError(err) from err",
"def _MakeRE(regex_str):\n ... | [
"0.6082075",
"0.60554343",
"0.59393954",
"0.58206123",
"0.5796114",
"0.5733823",
"0.5656317",
"0.5623442",
"0.5587492",
"0.5577933",
"0.55637306",
"0.5552807",
"0.55328435",
"0.5436339",
"0.5430866",
"0.54217577",
"0.54079485",
"0.54032713",
"0.5327642",
"0.53107345",
"0.5306... | 0.68075114 | 0 |
Searches an Album on BandCamp. (beta) | async def search_album(album_name):
async with aiohttp.ClientSession() as session:
async with session.get('https://bandcamp.com/api/fuzzysearch/1/autocomplete?q=' + album_name) as resp:
response = await resp.json()
results = response.get('auto', {}).get('results', [])
results = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_for_album(album_name):\n\n print(f'Searching for album: {album_name}')\n\n search_result = spotifyObject.search(q=f'\"{album_name}\"', limit=20, type='album')\n\n items = search_result['albums']['items']\n\n results = []\n\n for item in items:\n if len(item['artists']) > 1:\n ... | [
"0.7766403",
"0.76074123",
"0.7496857",
"0.7451845",
"0.7424531",
"0.7287499",
"0.68833065",
"0.68389136",
"0.6599589",
"0.65992373",
"0.6511754",
"0.6448354",
"0.6384227",
"0.6380701",
"0.6377998",
"0.637098",
"0.63539565",
"0.6277398",
"0.6262615",
"0.624885",
"0.62354416",... | 0.77526784 | 1 |
Searches a song on BandCamp. (beta) | async def search_song(album_name):
async with aiohttp.ClientSession() as session:
async with session.get('https://bandcamp.com/api/fuzzysearch/1/autocomplete?q=' + album_name) as resp:
response = await resp.json()
results = response.get('auto', {}).get('results', [])
results = [... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def searchSong(query, lim=40):\n headers = {\n \"User-Agent\": \"ytmdl\"\n }\n payload = {\n \"api_key\": API_KEY,\n \"method\": \"track.search\",\n \"track\": query,\n \"format\": \"json\"\n }\n\n data = []\n\n response = get(API_BASE, headers=headers, params=p... | [
"0.7316468",
"0.72379035",
"0.7220568",
"0.72196877",
"0.70340496",
"0.68845904",
"0.68495643",
"0.6729129",
"0.67290336",
"0.67248535",
"0.6716794",
"0.67030185",
"0.665925",
"0.66006905",
"0.6565912",
"0.6564356",
"0.65098923",
"0.648606",
"0.6478352",
"0.64568156",
"0.6455... | 0.73291177 | 0 |
Display Help for Managed Service | def help():
managed_services = help_managed_service()
click.echo(format_text(
"List of Fandogh managed services:", TextStyle.OKBLUE
))
for managed_service in managed_services:
click.echo("\t* Service name: {}".format(managed_service['name']))
for parameter_name, description in ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def help():\n print(UI.HELP)",
"def help(self):",
"def help(self):",
"def help(self):\n pass",
"def help(self):\n pass",
"def help(self) -> str:\n\t\treturn None",
"def help(self):\n\t\treturn",
"def help():\n \n pass",
"def help():",
"def help(self):\n res =... | [
"0.773901",
"0.7644714",
"0.7644714",
"0.7644708",
"0.7644708",
"0.7623705",
"0.7621721",
"0.7603582",
"0.7599238",
"0.75487274",
"0.7531515",
"0.7480801",
"0.74756837",
"0.7465213",
"0.7455863",
"0.74367136",
"0.7421766",
"0.7334787",
"0.722242",
"0.7116715",
"0.7098295",
... | 0.85765314 | 0 |
get a strain given its id | def getByID(id_strain:int):
strain = StrainAPI().get_by_id(id_strain)
schema = StrainSchema()
results = schema.load(strain, many=False)
return results[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get(isamAppliance, id):\n return isamAppliance.invoke_get(\"Retrieve a specific STS chain\", \"{0}/{1}\".format(uri, id),\n requires_modules=requires_modules,\n requires_version=requires_version)",
"def find_rent(self, id):\n al... | [
"0.6486314",
"0.6282963",
"0.61901087",
"0.5939586",
"0.58417946",
"0.57824117",
"0.5693693",
"0.5670682",
"0.5648144",
"0.5645753",
"0.5645112",
"0.5642275",
"0.563421",
"0.56186205",
"0.55942535",
"0.55904734",
"0.5574538",
"0.55737454",
"0.55563635",
"0.5549891",
"0.554271... | 0.7957233 | 0 |
Verify if a strain already exists given its designation and fk_specie | def verifyStrainExistanceDesignationFkSpecie(designation:str, fk_specie:int):
designation = urllib.parse.quote(designation)
strain_obj = StrainAPI().getByDesignationFkSpecie(designation, fk_specie)
print(strain_obj['strain_exists'])
if strain_obj['strain_exists'] == True:
sc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_study_rule_program__uniqueness(create_study_rule_db, db_session):\n db_session.add(studyrule.StudyRule(id=1618, name=\"asdf\"))\n db_session.commit()\n\n db_session.add(studyrule.StudyRuleProgram(study_rule_id=1618, program_name=\"dupe\"))\n db_session.commit()\n\n with pytest.raises(exc.In... | [
"0.58901703",
"0.57306916",
"0.5671358",
"0.5660681",
"0.55906117",
"0.5581848",
"0.5503833",
"0.5465218",
"0.54610837",
"0.5409015",
"0.53681105",
"0.5350694",
"0.5347269",
"0.530641",
"0.52536494",
"0.5231749",
"0.5229953",
"0.52043843",
"0.51879007",
"0.51870143",
"0.51810... | 0.7813482 | 0 |
Aggregates predictions for each timestep. When predicting n steps ahead where n > 1, will end up with multiple predictions for a timestep. | def aggregate_predictions(self, y_hat_batch, method='first'):
agg_y_hat_batch = np.array([])
for t in range(len(y_hat_batch)):
start_idx = t - self.config.n_predictions
'''
try:
print ('Aggregate: ', start_idx, type(y_hat_batch),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _predictions_reduction(\n self, predictions: Union[Sequence[TimeSeries], TimeSeries]\n ) -> Union[TimeSeries, Sequence[TimeSeries]]:\n is_single_series = isinstance(predictions, TimeSeries)\n predictions = series2seq(predictions)\n if self.train_samples_reduction == \"median\":\n... | [
"0.61915815",
"0.6125354",
"0.60371107",
"0.60230154",
"0.5984794",
"0.5970209",
"0.5913707",
"0.5829734",
"0.5826352",
"0.58180803",
"0.5814369",
"0.5810058",
"0.58100486",
"0.5807297",
"0.57960373",
"0.57780325",
"0.57759136",
"0.5773188",
"0.57708246",
"0.57541",
"0.574638... | 0.61820257 | 1 |
Rebuild toolbar For all custom scripts defined in the script manager a tool button (either image button or text button) if added to the toolbar if that script has been marked to be shown in the toolbar by the user. | def refresh(self):
# Remove old custom tools
for key in self.custom_tools.keys():
button = self.custom_tools[key]['button']
if button is None:
self.Unbind(wx.EVT_MENU, id=key)
else:
self.Unbind(wx.EVT_BUTTON, button)
but... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _setup_toolbar(self):\n\n low_resolution_action = QToolButton(self)\n low_resolution_action.setText('All Low')\n low_resolution_action.setToolTip('Enable High Resolution Mesh in all assets in current scene')\n low_resolution_action.setStatusTip('Enable High Resolution Mesh in all as... | [
"0.7449407",
"0.7179298",
"0.6937985",
"0.67124236",
"0.6550895",
"0.64809287",
"0.63323003",
"0.6259587",
"0.6192688",
"0.61410236",
"0.6084918",
"0.59979314",
"0.599547",
"0.5991203",
"0.5990629",
"0.59698886",
"0.58941394",
"0.58864087",
"0.5880492",
"0.58508915",
"0.58505... | 0.77194506 | 0 |
To check whether the AICORE operator can support the shape of indices or not | def check_supported(x, indices, v, y, kernel_name="inplace_update"):
shape_indices = indices.get("shape")
shape_v = v.get("shape")
dtype_v = v.get("dtype").lower()
reg_v_len = 1
for i in range(1, len(shape_v)):
reg_v_len = reg_v_len * shape_v[i]
if dtype_v in ("float32", "int32"):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def any(self):\n boolean = True\n if type(self.idxs) == np.ndarray:\n boolean = all(self.idxs.shape)\n elif type(self.idxs) == list:\n sh = np.array(self.idxs).shape\n if len(sh) >= 2:\n boolean = np.all(sh)\n return boolean",
"def is_sc... | [
"0.6186108",
"0.61199296",
"0.60875684",
"0.60499",
"0.6010543",
"0.59965426",
"0.5930538",
"0.5927907",
"0.5927495",
"0.5903537",
"0.5892703",
"0.58787227",
"0.5877431",
"0.584448",
"0.58435637",
"0.5843049",
"0.583327",
"0.5813067",
"0.5807061",
"0.5803886",
"0.5790846",
... | 0.6575466 | 0 |
Loads dataset using tfds and returns a dataset | def load_dataset(name):
dataset, info = tfds.load(name=name,
with_info=True,
data_dir='data/external')
train_dataset = dataset['train']
train_dataset = train_dataset.shuffle(SHUFFLE_BUFFER_SIZE,
reshuffle_e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(data_config):\n return tfds.load(data_config.path, with_info=data_config.load_with_info)",
"def load_data(data_config):\n return tfds.load(data_config.path, with_info=data_config.load_with_info)",
"def load_dataset(dataset):\n print('Start loading dataset - ' + dataset + '...\\n'... | [
"0.7774422",
"0.7774422",
"0.74698395",
"0.72216266",
"0.7168205",
"0.7042313",
"0.7010148",
"0.6988322",
"0.6856829",
"0.68535143",
"0.6804984",
"0.67565787",
"0.6723519",
"0.6723479",
"0.6678223",
"0.6666716",
"0.6661955",
"0.6623973",
"0.66187096",
"0.66152847",
"0.6614179... | 0.7995171 | 0 |
>>> consecutive_distinct(2) 14 >>> consecutive_distinct(3) 644 | def consecutive_distinct(count):
result = None
acc = set()
consecutive = 1
i = 1
while result is None:
i += 1
new = set(factors(i))
# does i have the correct number of factors
if len(new) != count:
consecutive = 1
acc = set()
conti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distinct(n):\n if n <= 10:\n return [_distincts[2*i] for i in range(0, n)]\n elif n <= 20:\n return _distincts[:n]\n else:\n return _distincts[:]",
"def distinct(x):\n return list(set(x))",
"def _consecutive(self, n):\n grouped = zip(*[iter(self._history())]*n)\n ... | [
"0.6174642",
"0.591835",
"0.5780073",
"0.57269806",
"0.56822354",
"0.56802255",
"0.5669227",
"0.5664036",
"0.5610772",
"0.5606805",
"0.55484045",
"0.5547042",
"0.55102015",
"0.55083257",
"0.548067",
"0.5458478",
"0.5413407",
"0.5390004",
"0.538433",
"0.53842354",
"0.5356658",... | 0.681215 | 0 |
Overwrites the nil_slot (first row) of the input Tensor with zeros. The nil_slot is a dummy slot and should not be trained and influence the training algorithm. | def zero_nil_slot(t, name=None):
with tf.name_scope(name, "zero_nil_slot", [t]) as name:
t = tf.convert_to_tensor(t, name="t")
s = tf.shape(t)[1]
z = tf.zeros(tf.stack([1, s]))
return tf.concat(axis=0, values=[z, tf.slice(t, [1, 0], [-1, -1])], name=name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_nil_slot(t, name=None):\n\twith tf.name_scope(name, \"zero_nil_slot\", [t]) as name:\n\t\tt = tf.convert_to_tensor(t, name=\"t\")\n\t\ts = tf.shape(t)[1]\n\t\tz = tf.zeros(tf.pack([1, s]))\n\t\treturn tf.concat(0, [z, tf.slice(t, [1, 0], [-1, -1])], name=name)",
"def zero_nil_slot(t, name=None):\n wi... | [
"0.78309005",
"0.7585748",
"0.74005955",
"0.65641546",
"0.6203455",
"0.6191431",
"0.6104243",
"0.60961765",
"0.60934246",
"0.6091892",
"0.602161",
"0.5920386",
"0.5919561",
"0.5905201",
"0.5901274",
"0.58469564",
"0.58254486",
"0.58201325",
"0.5778825",
"0.57560945",
"0.57375... | 0.77145684 | 1 |
Reads in data for countries and populations | def load_population_data():
return pd.read_csv(os.path.join('data', 'processed', 'worldometer_data.csv'),
usecols = ['Country/Region','Population']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_country_code_data():\n name_conversion = {\n 'East Timor': 'Timor-Leste',\n 'Republic of the Congo': 'Congo (Kinshasa)',\n 'Ivory Coast': 'Cote d\\'Ivoire',\n 'Macedonia': 'North Macedonia',\n 'Myanmar': 'Burma',\n 'Republic of Serbia': 'Serbia',\n 'Taiw... | [
"0.6832422",
"0.67265177",
"0.6566655",
"0.6523227",
"0.64967054",
"0.62986267",
"0.6285257",
"0.61791676",
"0.6161535",
"0.60601306",
"0.6046531",
"0.60452425",
"0.6015783",
"0.5969099",
"0.5963318",
"0.5901846",
"0.58160615",
"0.5812385",
"0.5792473",
"0.5778258",
"0.575209... | 0.68690926 | 0 |
Reads in data for countries and populations | def load_country_code_data():
name_conversion = {
'East Timor': 'Timor-Leste',
'Republic of the Congo': 'Congo (Kinshasa)',
'Ivory Coast': 'Cote d\'Ivoire',
'Macedonia': 'North Macedonia',
'Myanmar': 'Burma',
'Republic of Serbia': 'Serbia',
'Taiwan': 'Taiwan*'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_population_data():\n return pd.read_csv(os.path.join('data', 'processed', 'worldometer_data.csv'),\n usecols = ['Country/Region','Population'])",
"def extract_data(file):\n countries = [\n \"Brunei Darussalam\",\n \"Cambodia\",\n \"Indonesia\",\n \"Lao People's ... | [
"0.68690926",
"0.67265177",
"0.6566655",
"0.6523227",
"0.64967054",
"0.62986267",
"0.6285257",
"0.61791676",
"0.6161535",
"0.60601306",
"0.6046531",
"0.60452425",
"0.6015783",
"0.5969099",
"0.5963318",
"0.5901846",
"0.58160615",
"0.5812385",
"0.5792473",
"0.5778258",
"0.57520... | 0.6832422 | 1 |
Merges daily_data and population_data dataframes | def join_population_data(daily_data, population_data):
return daily_data.merge(population_data, how = 'left', on = 'Country/Region') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def combine(new_data, raw_data):\n return pd.merge(new_data, raw_data, on=[\"location\", \"date\"], how=\"outer\")",
"def combine_data(self):\n for country in config.COUNTRIES:\n frames = []\n for year in config.years:\n incidence_path = (config.raw_data_path / coun... | [
"0.6539487",
"0.6402935",
"0.63505423",
"0.6306777",
"0.61291736",
"0.6089709",
"0.6065073",
"0.60488784",
"0.60017717",
"0.59830976",
"0.5967912",
"0.5922061",
"0.59063876",
"0.5755208",
"0.5740678",
"0.57263327",
"0.56330174",
"0.5614142",
"0.5611158",
"0.5522358",
"0.55142... | 0.76023966 | 0 |
Merges daily_data and country_code_data dataframes | def join_country_code_data(daily_data, country_code_data):
#new columns: country, country_code, geometry
return country_code_data.merge(daily_data, left_on = 'country', right_on = 'Country/Region').drop(['country'], axis=1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def combine_data(self):\n for country in config.COUNTRIES:\n frames = []\n for year in config.years:\n incidence_path = (config.raw_data_path / country / 'complete'\n / (str(year) + '_' + str(year + 1) + '.csv'))\n\n if inc... | [
"0.72284955",
"0.66128045",
"0.6469387",
"0.6388423",
"0.6137204",
"0.6008344",
"0.60076165",
"0.5960355",
"0.590629",
"0.58845705",
"0.5863901",
"0.5858391",
"0.58411586",
"0.5830907",
"0.5800769",
"0.57668734",
"0.5764536",
"0.57458264",
"0.5702459",
"0.5644967",
"0.5609093... | 0.7809908 | 0 |
Plots interactive line charts and world map based on filtering features | def filter_plot(mode, country, continent, start_date, end_date, options):
# Default is World mode
chart_data = world_daywise_df
map_data = countries_daywise_df
print(country, continent)
if mode == SelectionMode.Continents.value:
#Continents mode
if not isinstance(continent, list):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write():\n with st.spinner(\"Loading Map ...\"):\n\n # read CSV\n\n # CSV for Choropleth Map\n df = pd.read_csv(\"https://raw.githubusercontent.com/hannahkruck/visuasyl/master/src/datasets/Map.csv\", encoding =\"utf8\", sep=\";\")\n # CSV for Line Map\n df2 = pd.read_csv(\... | [
"0.6414269",
"0.6118733",
"0.6061339",
"0.60379195",
"0.59876",
"0.59507",
"0.580802",
"0.5804279",
"0.58020955",
"0.5773301",
"0.5756024",
"0.5749856",
"0.5739029",
"0.5711507",
"0.56961215",
"0.569031",
"0.567555",
"0.56663054",
"0.5658308",
"0.56441504",
"0.56386507",
"0... | 0.6570168 | 0 |
Plots an interactive line chart with the time period on the x axis and selected metric on the y axis | def plot(chart_data, metric, metric_name):
chart = (alt.Chart(chart_data).mark_line().encode(
x=alt.X('month(Date):T', title="Month"),
y=alt.Y(f'mean({metric}):Q', title=f'Average {metric_name}', axis=alt.Axis(tickCount=5)),
color=alt.Color('Country/Region', title='Region'))
.propert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_interactive_line(data, col, title=None):\n\n\torgn = go.Scatter(name='Original Data',\n\t\t\t\t\tx = data.index,\n\t\t\t\t\ty = data[col],\n\t\t\t\t\tmode='lines',\n\t\t\t\t\tline=dict(width=3, color='royalblue'))\n\n\tlayout = dict(autosize=False, width=1000, title=title, \n\t\txaxis = dict(\n\t\t\tshowg... | [
"0.6988643",
"0.64005005",
"0.63966286",
"0.63894534",
"0.6287888",
"0.6264561",
"0.62150186",
"0.62079173",
"0.6180638",
"0.6177438",
"0.6118947",
"0.610583",
"0.61025035",
"0.6002728",
"0.5984472",
"0.59713393",
"0.5941918",
"0.59208655",
"0.5907251",
"0.5904696",
"0.589656... | 0.6849102 | 1 |
Test ipv4 configuration object. | async def test_ipv4_configuration(
ip4config_service: IP4ConfigService, dbus_session_bus: MessageBus
):
ip4 = IpConfiguration("/org/freedesktop/NetworkManager/IP4Config/1")
assert ip4.gateway is None
assert ip4.nameservers is None
await ip4.connect(dbus_session_bus)
assert ip4.gateway == IPv4... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SupportsIPv4(self) -> bool:",
"def test_ipv4_validation_success():\n assert is_ipv4('8.8.8.8')",
"def OSSupportsIPv4(self) -> bool:",
"def test_ipv4_in_net(self):\n test_ip = ip_address.IPAddress(\"192.168.178.4\", force_v4=True)\n assert test_ip.in_network(\"192.168.178.0/24\")\n ... | [
"0.7382061",
"0.73755616",
"0.7294412",
"0.6909549",
"0.66554224",
"0.6596564",
"0.65278935",
"0.6516912",
"0.6498978",
"0.64626014",
"0.64310247",
"0.640672",
"0.64041173",
"0.6383307",
"0.6383307",
"0.6383307",
"0.628541",
"0.62701786",
"0.62666386",
"0.6256903",
"0.6244954... | 0.80854356 | 0 |
r""" Calculates the Laplace coeffecient given by | def calculate_laplace_coeff(alpha, j, s):
return integrate.quad(lambda psi, alpha, j, s: np.cos(j*psi)/(1-2*alpha*np.cos(psi)+alpha**2)**s,
0, 2*np.pi, args=(alpha, j, s,))[0]/np.pi | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solve_laplace_equation(\n grid: GridBase, bc: \"BoundariesData\", label: str = \"Solution to Laplace's equation\"\n) -> ScalarField:\n rhs = ScalarField(grid, data=0)\n return solve_poisson_equation(rhs, bc=bc, label=label)",
"def Laplace_covariance(self):\n #TODO add in the prior contributio... | [
"0.6932956",
"0.68487763",
"0.68143916",
"0.6609716",
"0.65814567",
"0.6552639",
"0.64997023",
"0.63508654",
"0.6182345",
"0.61654204",
"0.6130257",
"0.6069662",
"0.60692745",
"0.603655",
"0.6034478",
"0.602011",
"0.5966904",
"0.59553957",
"0.58933884",
"0.5871512",
"0.586865... | 0.69991326 | 0 |
Returns an array containing a specific property of all planets. The possible property names can be | def get_property_all_planets(self, property_name):
return np.array([p.__dict__[property_name] for p in self.planets]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sentientPlanets():\n planet_list = []\n url = 'https://swapi-api.hbtn.io/api/species'\n while url is not None:\n data = requests.get(url).json()\n for species in data['results']:\n if ((species['designation'] == 'sentient'\n or species['designation'] == 'reptil... | [
"0.6067556",
"0.57106155",
"0.5654744",
"0.56438106",
"0.56438106",
"0.560891",
"0.5554839",
"0.5500772",
"0.5491841",
"0.544657",
"0.54276913",
"0.52968067",
"0.52860713",
"0.5190911",
"0.5188186",
"0.51838416",
"0.5164972",
"0.5159275",
"0.5151172",
"0.5141814",
"0.51188713... | 0.87880796 | 0 |
Calculates the initial values for the 4 equations of motion (h, k, p, and q) for each planet. | def initial_conditions(self):
e = self.get_property_all_planets('e')
pi = self.get_property_all_planets('pi')*np.pi/180
i = self.get_property_all_planets('i')*np.pi/180
omega = self.get_property_all_planets('Omega')*np.pi/180
h = np.array(e*np.sin(pi), dtype='complex128')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialise(self):\n for i in range(self.nx):\n self.T[:, i] = (\n self.t_sun\n + self.mu\n * self.m_u\n * self.nabla\n * self.g\n * (self.y - self.y_max)\n / self.kb\n )\n ... | [
"0.61825645",
"0.6121948",
"0.6086376",
"0.6023547",
"0.59796304",
"0.5894778",
"0.5858605",
"0.5805327",
"0.5802638",
"0.57790107",
"0.5690194",
"0.5668174",
"0.56570876",
"0.56516266",
"0.56371945",
"0.56321806",
"0.56212556",
"0.5580118",
"0.5568198",
"0.55517566",
"0.5531... | 0.7309716 | 0 |
Calculates the eccentricity of all planets. | def get_eccentricity(self, h_arr, k_arr):
n = len(self.planets)
h, k = h_arr, k_arr
eccentricities = []
for j in range(n):
# eccentricities.append(np.sqrt(h[j]**2+k[j]**2))
eccentricities.append(np.real(np.sqrt(h[j]*np.conjugate(h[j])+k[j]*np.conjugate(k[j]))))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eccentricity(self):\n return self.b / self.a",
"def eccentricity(self):\n new_data = self._data[['pl_pnum', 'pl_orbper', 'pl_orbsmax',\n 'pl_masse', 'pl_orbeccen',\n 'pl_radj', 'pl_dens', 'st_teff',\n 'st_... | [
"0.6641933",
"0.6585359",
"0.6583154",
"0.65796834",
"0.6260899",
"0.6133317",
"0.60250473",
"0.59133375",
"0.5844478",
"0.5737476",
"0.5667675",
"0.5645154",
"0.5639566",
"0.56270146",
"0.5596546",
"0.55745906",
"0.5555845",
"0.55459523",
"0.5515555",
"0.5499975",
"0.5480366... | 0.67587054 | 0 |
Calculates the rate of precession of each planet. | def get_perihelion_precession_rates(self, A, eccentricities, h_arr, k_arr):
n = len(self.planets)
d_pidot_dt_list = []
for j in range(n):
h_dot_j, k_dot_j = 0, 0
for i in range(n):
h_dot_j += A[j, i]*k_arr[i]
k_dot_j -= A[j, i]*h_arr[i]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculateUSky(self):\n skyline = []\n for p in self.pruned:\n pastart = [self.drange[0] for i in range(self.dim)]\n pamax = p.getLocationMax()\n pdom = list(self.index.intersection(tuple(pastart+pamax),objects=True))\n if len(pdom) == 1 and pdom[0].obje... | [
"0.6023712",
"0.5999428",
"0.584742",
"0.5802319",
"0.5748347",
"0.57448065",
"0.57405853",
"0.5664763",
"0.56076354",
"0.5582161",
"0.5553502",
"0.55217224",
"0.5520002",
"0.55156034",
"0.5491234",
"0.5485111",
"0.54775244",
"0.5477034",
"0.5473606",
"0.5461726",
"0.5442388"... | 0.63820016 | 0 |
Returns the state of the most recent termination command, or None if one has not been sent | def get_termination_command_state(instance: Dict[str, str]) -> Optional[str]:
invocations = ssm.list_command_invocations(
InstanceId=instance["InstanceId"], Filters=[{"key": "DocumentName", "value": SSM_TERMINATION_DOCUMENT_NAME}]
)["CommandInvocations"]
if len(invocations) == 0:
return Non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self):\n if not self._last_command:\n return None\n return self._last_command.status()",
"def termination_state(self) -> str:\n return self._termination_state",
"def get_last_cmd(self):\n self._data_available = False\n return self._cmd",
"def last_comm... | [
"0.6568246",
"0.63824147",
"0.6295372",
"0.62449306",
"0.60604876",
"0.6011663",
"0.5985889",
"0.5955732",
"0.57259166",
"0.5685755",
"0.5677972",
"0.55844754",
"0.5576714",
"0.55413306",
"0.5508534",
"0.5473941",
"0.54474074",
"0.54474074",
"0.54210883",
"0.54150015",
"0.537... | 0.7101299 | 0 |
Sends a termination command to an instance | def send_termination_command(
instance: Dict[str, str], groups: Dict[str, Dict[str, str]], topic_arn: str, service_role_arn: str
) -> None:
try:
ssm.send_command(
InstanceIds=[
instance["InstanceId"],
],
DocumentName=SSM_TERMINATION_DOCUMENT_NAME,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(self, cmd_args):\n reservations = self._ec2_client.describe_instances(Filters=[\n {'Name': \"instance-id\", 'Values': [cmd_args.id]},\n {'Name': \"tag:Name\", 'Values': [cmd_args.name]}\n ])['Reservations']\n if not reservations:\n halt.err(\"No instan... | [
"0.6916483",
"0.6723862",
"0.6613553",
"0.6446231",
"0.6295171",
"0.6282951",
"0.62679225",
"0.62422293",
"0.62396604",
"0.6239423",
"0.62374634",
"0.6223791",
"0.620144",
"0.61916363",
"0.6178856",
"0.6176469",
"0.61625284",
"0.6159763",
"0.6159763",
"0.61463964",
"0.6136787... | 0.71694994 | 0 |
An infinite stream of random points. | def stream():
while True:
yield random_point() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_values():\n while True:\n yield random()",
"def random_points(N, condition=None):\n\n def stream():\n \"\"\" An infinite stream of random points. \"\"\"\n while True:\n yield random_point()\n\n if condition is None:\n # approve unconditionally\n i... | [
"0.6327212",
"0.63079315",
"0.6190208",
"0.59318656",
"0.5903586",
"0.59018904",
"0.5753265",
"0.57038164",
"0.5696104",
"0.5679901",
"0.5627401",
"0.5614692",
"0.5546329",
"0.551726",
"0.55001336",
"0.547799",
"0.5469722",
"0.546817",
"0.54530305",
"0.5396228",
"0.5381844",
... | 0.87704355 | 0 |
Whether the origin is inside the hull formed by the points. If not, they must all be on one hemisphere. We do not try to construct a reference frame based on the locations of such a problematic distribution of points. | def is_origin_inside(points):
# SciPy requires the array of points to have indices [point, axis]
# so we have to transpose our arrays
hull = scipy.spatial.Delaunay(points.T)
return numpy.all(hull.find_simplex(origin().T) >= 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_inside(self, points):\n points = np.atleast_2d(points) - self.centroid\n return np.logical_and(\n np.linalg.norm(points, axis=-1) <= self.radius,\n # At present circles are not orientable, so the z position must\n # match exactly.\n np.isclose(points... | [
"0.6979389",
"0.6672889",
"0.65810275",
"0.6550029",
"0.6505384",
"0.64974886",
"0.6457747",
"0.6413353",
"0.63747317",
"0.6372016",
"0.631495",
"0.63140607",
"0.62676966",
"0.62370855",
"0.6229541",
"0.6211103",
"0.6172395",
"0.6153061",
"0.6151926",
"0.613876",
"0.61223644"... | 0.7826114 | 0 |
Circumcenters of the triangles from the Delaunay triangulation. | def Delaunay_circumcenters(triangles):
na = numpy.newaxis
sign = numpy.sign(linalg.det(triangles))
A = triangles[:, 1, :] - triangles[:, 0, :]
B = triangles[:, 2, :] - triangles[:, 0, :]
C = numpy.cross(A, B)
return sign[:, na] * (C / linalg.norm(C, axis=1)[:, na]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_barycenters(self):\n barycenters = []\n for i,tri in enumerate(self.tri_pnts):\n #import pdb; pdb.set_trace()\n barycenters.append(1./3.*self.points[tri].sum(axis=0))\n tri0, tri1, tri2 = tri\n a = np.linalg.norm(self.points[tri1]-self.points[tr... | [
"0.70603967",
"0.65778387",
"0.64206976",
"0.6387122",
"0.62674934",
"0.62299466",
"0.62147385",
"0.6159396",
"0.60821253",
"0.6066455",
"0.60587",
"0.6039496",
"0.5958141",
"0.5954246",
"0.5953353",
"0.5935889",
"0.5925192",
"0.5914339",
"0.59061617",
"0.58897835",
"0.588482... | 0.8082175 | 0 |
Collect the simplices around the vertices. These are the combinatorial representation of the points and the triangles of the Delaunay triangulation. | def simplices_around_vertices(hull):
# one list for each vertex
# starting empty
result = {i: [] for i in range(len(hull.vertices))}
# collect simplices into the lists corresponding
# to their member vertices
for simplex in range(len(hull.simplices)):
for vertex in hull.simplices[simple... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triangulated_facial_incidences(self):\n from sage.misc.misc import deprecation\n deprecation('This method is deprecated. Use triangulate() instead.', 'Sage Version 4.7.1')\n try:\n return self._triangulated_facial_incidences\n except AttributeError:\n t_fac_inc... | [
"0.6296649",
"0.62730896",
"0.60796994",
"0.60012954",
"0.5873787",
"0.5869935",
"0.58270377",
"0.57136935",
"0.57014155",
"0.56687814",
"0.5603605",
"0.55603707",
"0.5556364",
"0.55536395",
"0.55252105",
"0.5497604",
"0.5480074",
"0.54695964",
"0.54609716",
"0.5459235",
"0.5... | 0.6612077 | 0 |
Decomposes a polygon into triangles. | def decompose_polygon(points):
N, _ = points.shape
for i in range(1, N - 1):
yield numpy.array([points[0], points[i], points[i + 1]]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _finish_polygon(self):\n global undo_stack, choose_polygon\n if len(self.polygon_points) < 6:\n messagebox.showinfo(title='Info', message='Too few points for a polygon')\n return 'too_few_points'\n relative_poly_points = []\n for p in range(0, len(self.polygon_... | [
"0.6328098",
"0.6206093",
"0.6199687",
"0.6190266",
"0.6177033",
"0.61456007",
"0.60635793",
"0.6060911",
"0.60404634",
"0.6039962",
"0.60075074",
"0.59891325",
"0.5983098",
"0.59734195",
"0.59604895",
"0.5918178",
"0.5907658",
"0.58527386",
"0.58260196",
"0.5786267",
"0.5759... | 0.69888943 | 0 |
The areas of the Voronoi cells. These should sum up to | def areas(cells):
return numpy.array([polygon_area(cells[i])
for i in range(len(cells.keys()))]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def area(self):\n num_rows = self.row_end - self.row_start\n num_cols = self.col_end - self.col_start\n area = num_rows*num_cols\n return area",
"def area(self):\n area = 0\n\n for room in self.rooms:\n area += room.polygon.area()\n\n for wall in self.w... | [
"0.7053104",
"0.6949703",
"0.6937096",
"0.68968654",
"0.68406224",
"0.6828189",
"0.6806362",
"0.6779826",
"0.6707864",
"0.6702784",
"0.6623552",
"0.6616147",
"0.6616147",
"0.65818137",
"0.6552741",
"0.65369576",
"0.65365654",
"0.6533091",
"0.6524128",
"0.6514253",
"0.6486411"... | 0.718567 | 0 |
Creates the unnique hash for the block, It uses sha256. | def hash_block(self):
sha = hasher.sha256()
sha.update((str(self.index) + str(self.timestamp) + str(self.data) + str(self.previous_hash)).endswith('utf-8'))
return sha.hexdigest() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_hash(self) -> str:\r\n #block_dict = self.__dict__.pop('hash', None) # Remove hash field value before calculating hash\r\n block_dict = self.__dict__.copy()\r\n block_dict.pop('hash', None) # Remove hash field value before calculating hash\r\n block_string = json.dumps(bloc... | [
"0.7649336",
"0.75152916",
"0.7505065",
"0.7395027",
"0.7395027",
"0.73254246",
"0.72794044",
"0.7272706",
"0.72677046",
"0.72617227",
"0.7258047",
"0.71818274",
"0.71584433",
"0.71584433",
"0.71544576",
"0.7106827",
"0.70858914",
"0.70794773",
"0.70781595",
"0.7007207",
"0.6... | 0.7700506 | 0 |
Launch a container using a Tale object. | def launch_container(self, service_info):
user, instance = _get_user_and_instance(
self.girder_client, service_info['instanceId'])
tale = self.girder_client.get(f"/tale/{service_info['taleId']}")
self.job_manager.updateProgress(
message='Starting container', total=LAUNCH_CONTAINER_STEP_TOTA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self, container_config: ContainerConfig) -> Container:",
"def start(self, container: Container):",
"def _start_instance(self, resource_handler):\n log.debug('Starting container')\n cli = resource_handler.cli\n #host_config=cli.create_host_config(network_mode=self.network_mode)\n ... | [
"0.6903617",
"0.6689237",
"0.6458532",
"0.61829054",
"0.6100124",
"0.6091408",
"0.6029948",
"0.6014928",
"0.6000101",
"0.59634477",
"0.59353226",
"0.59195656",
"0.5817203",
"0.57239187",
"0.5722327",
"0.57136554",
"0.56895715",
"0.56748176",
"0.56577605",
"0.56559885",
"0.559... | 0.6910923 | 0 |
Create a Tale provided a url for an external data and an image Id. Currently, this task only handles importing raw data. In the future, it should also allow importing serialized Tales. | def import_tale(self, lookup_kwargs, tale, spawn=True):
if spawn:
total = 4
else:
total = 3
if spawn:
try:
instance = self.girder_client.post(
'/instance', parameters={'taleId': tale['_id']})
except girder_client.HttpError as resp:
try... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_article(self, html):\n kav_api = getattr(self.api, settings.SALESFORCE_ARTICLE_TYPE)\n data = html.create_article_data()\n result = kav_api.create(data=data)\n kav_id = result['id']\n return kav_id",
"def create_dataset(request):\n body = json.loads(request.body)\... | [
"0.5222644",
"0.5135196",
"0.5084164",
"0.50787556",
"0.49574423",
"0.49435887",
"0.48804367",
"0.48550144",
"0.4798177",
"0.47727865",
"0.47499785",
"0.4711364",
"0.47111937",
"0.47051713",
"0.46928445",
"0.4680703",
"0.46756452",
"0.46702892",
"0.46500966",
"0.45984757",
"0... | 0.6369024 | 0 |
Start a recorded run for a tale version | def recorded_run(self, run_id, tale_id, entrypoint):
run = self.girder_client.get(f"/run/{run_id}")
state = RecordedRunCleaner(run, self.girder_client)
tale = self.girder_client.get(
f"/tale/{tale_id}/restore", parameters={"versionId": run["runVersionId"]}
)
user = self.girder_client.get('/u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __firstRun(self, t1, t2):\n # this is the first run - initialize the timestep manager of metafor\n tsm = self.metafor.getTimeStepManager()\n dt = t2-t1 # time-step size\n dt0 = dt # initial time step\n dtmax = dt # maximum size of the time step\n tsm.setI... | [
"0.6213816",
"0.60477567",
"0.60004336",
"0.5929506",
"0.59222806",
"0.58859074",
"0.58753705",
"0.5834681",
"0.5824568",
"0.57992744",
"0.57978606",
"0.57501125",
"0.5740585",
"0.5736623",
"0.57203275",
"0.5712352",
"0.56932455",
"0.5685907",
"0.56575197",
"0.565015",
"0.563... | 0.6255668 | 0 |
Include more molecules to an existing dynamic | def include_molecules(request,dynamic_id):
dynamic = Dynamic.objects.get(pk=dynamic_id)
if request.method == 'POST':
include_molecules_form = IncludeMoreMoleculesForm(request.POST)
if include_molecules_form.is_valid():
number_of_molecules = include_molecules_form.cleaned_data['numb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dynamically_embedded(self) -> '_ImagineMany':\n return _ImagineMany(*[component.dynamically_embedded() for component in self.__traverse_forward()])",
"def addMetaMolecule (self,metaMolecule):\r\n self.metaMolecule = metaMolecule",
"def __init__(self, nr_molecules, surface_size):\n self... | [
"0.5940312",
"0.58800155",
"0.58118194",
"0.5710613",
"0.5622153",
"0.550986",
"0.542106",
"0.5300614",
"0.5284355",
"0.5207803",
"0.52051073",
"0.5176879",
"0.51691127",
"0.51690906",
"0.51549256",
"0.5131621",
"0.51103634",
"0.5100931",
"0.50958353",
"0.5088113",
"0.5063917... | 0.6247824 | 0 |
Suggest an employee to promote. This function will check if a list has only one element, if not, it will pop an element out and call itself to again check if the length is now one. It will continue until the length is one, and it will print that element as the suggested employee. | def suggested_promotion(cls, n):
try:
copy = n.copy()
if len(copy) == 0:
print("Error: No employee names given")
elif len(copy) == 1:
print(f'Suggested Employee: {copy[0]}')
else:
x = random.randint(0, le... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduce_list(employee_list, check_favorite=False):\n # Sort the list of employees by teamCount\n employee_list = sorted(employee_list,\n key=lambda empl : len(empl.co_worker_list),\n reverse=True)\n\n counts_list = []\n\n # Initate a list with all po... | [
"0.5725042",
"0.5252546",
"0.50994617",
"0.5059567",
"0.5053287",
"0.4896579",
"0.48945847",
"0.4857462",
"0.48512113",
"0.48504257",
"0.48129869",
"0.48034996",
"0.47938102",
"0.478565",
"0.47508729",
"0.47481212",
"0.47475734",
"0.474493",
"0.47405213",
"0.47335303",
"0.470... | 0.6871171 | 0 |
Create a table of all current employees. Make a copy of each of the four lists being used. After checking that all elements in each are strings, this function will find the length of the largest list, and append empty strings to every other list until they are the same length as the largest. Each list is then iterated ... | def table_maker():
try:
off_copy = off.copy()
man_copy = man.copy()
exe_copy = exe.copy()
ceo_copy = ceo.copy()
list_of_lists = [off_copy, man_copy, exe_copy, ceo_copy]
for i in list_of_lists:
for j in i:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_table(table, title_list):\n\n # your goes code\n cols = len(title_list)\n\n \n\n table.insert(0,title_list)\n\n for sublist in range(len(table)):\n if cols != len(table[sublist]):\n print('dataset does not match number of cols')\n quit()\n\n max_lenghts = []... | [
"0.58415484",
"0.5610653",
"0.55406296",
"0.5464943",
"0.54581714",
"0.5392137",
"0.5377166",
"0.53111964",
"0.5303556",
"0.5274188",
"0.52197236",
"0.5180787",
"0.5153787",
"0.51003027",
"0.50797075",
"0.5078394",
"0.5070702",
"0.50685734",
"0.50022894",
"0.49969354",
"0.498... | 0.72879314 | 0 |
Iterate through office workers list, prints each element as a string. | def get_personnel():
if len(off) == 0:
print("There are no office workers")
else:
for i in off:
print(str(i)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_personnel():\r\n if len(exe) == 0:\r\n print(\"There are no executives\")\r\n else:\r\n for i in exe:\r\n print(str(i))",
"def warehouse_print(warehouse_list):\n for warehouse_item in warehouse_list:\n warehouse_item_print(warehouse_item)",
"def __... | [
"0.6073432",
"0.6038501",
"0.5863117",
"0.5757517",
"0.5697495",
"0.5623462",
"0.56123453",
"0.55482763",
"0.5501774",
"0.5473595",
"0.5470617",
"0.54509634",
"0.53954977",
"0.53934115",
"0.53895783",
"0.5384264",
"0.5351677",
"0.5344317",
"0.5343152",
"0.52992666",
"0.528356... | 0.6981273 | 0 |
Given the hours, calculates the amount this employee type will earn. | def pay(hours):
try:
hourly = 15.37
if hours == 0:
print("With 0 hours they will earn nothing")
elif hours == 1:
print(f"The hourly rate for an office worker is ${hourly}")
else:
print(f"With {hours} hours, a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pay(hours):\r\n try:\r\n hourly = 17.47\r\n if hours == 0:\r\n print(\"With 0 hours, they will earn nothing\")\r\n elif hours == 1:\r\n print(f\"The hourly rate for a manager is ${hourly}\")\r\n else:\r\n print(f\"W... | [
"0.6740932",
"0.6442476",
"0.6434463",
"0.6339684",
"0.62844306",
"0.616537",
"0.6114141",
"0.6027342",
"0.6024514",
"0.5988583",
"0.5948045",
"0.5946869",
"0.59212047",
"0.590968",
"0.58617175",
"0.586124",
"0.58087116",
"0.57809657",
"0.565309",
"0.56509376",
"0.56447303",
... | 0.6829552 | 0 |
Move name from office workers list to managers list, provided name is in the office workers list. | def promote(name):
try:
if name in off:
off.remove(name)
man.append(name)
man.sort()
else:
print(f"{name} cannot be promoted from an office worker, as they are not in the personnel list")
except TypeError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def promote(name):\r\n try:\r\n if name in man:\r\n man.remove(name)\r\n exe.append(name)\r\n exe.sort()\r\n else:\r\n print(f\"{name} cannot be promoted from a manager, as they are not in the personnel list\")\r\n\r\n ... | [
"0.6940359",
"0.6072968",
"0.57918125",
"0.5253137",
"0.51126254",
"0.50498134",
"0.5026471",
"0.4992736",
"0.4905242",
"0.49006265",
"0.48963538",
"0.4837236",
"0.4832816",
"0.4828419",
"0.47942898",
"0.476899",
"0.4750832",
"0.46724123",
"0.46502608",
"0.4635915",
"0.458895... | 0.7341518 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.