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 |
|---|---|---|---|---|---|---|
Return True if the given element is in this view. | def is_element_in_view(self, element: Element) -> bool:
return self.find_element_view(element=element) is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains(self, element) -> bool:\n\n return self.__find_node(element) is not None",
"def __contains__(self, item):\n\n if self.is_view:\n return item in self._view\n return item in self._storage",
"def contains(self, element):\n pass",
"def is_element_visible(self):... | [
"0.72909355",
"0.6978362",
"0.6958688",
"0.67255217",
"0.6717766",
"0.6496774",
"0.64491296",
"0.64290804",
"0.6372613",
"0.6279521",
"0.6277805",
"0.62600285",
"0.6246147",
"0.6245345",
"0.6212836",
"0.6174918",
"0.6135724",
"0.61295",
"0.61222446",
"0.61159575",
"0.6111",
... | 0.8923193 | 0 |
Find a child element view matching a given element. | def find_element_view(
self,
*,
element: Optional[Element] = None,
) -> Optional[ElementView]:
return next(
(view for view in self.element_views if view.element.id == element.id), None
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getChildView(self, parentId, childSeq):\n # child_view = None\n # str_getChildView = \"self.vc.findViewById('\" + parentId + \"')\"\n # for index in childSeq:\n # str_getChildView += ('.children[' + str(index) + ']')\n # printLog(self.threadName + \"executing child_view... | [
"0.62151027",
"0.611608",
"0.58677596",
"0.5785795",
"0.573255",
"0.56479764",
"0.5616665",
"0.55585456",
"0.5556",
"0.5547902",
"0.55382514",
"0.54818493",
"0.54810154",
"0.5471856",
"0.5421521",
"0.53672916",
"0.5366021",
"0.52839684",
"0.5273117",
"0.5253067",
"0.52432305"... | 0.7645557 | 0 |
Find a child relationship view matching the supplied nonNone arguments. | def find_relationship_view(
self,
*,
relationship: Optional[Relationship] = None,
description: Optional[str] = None,
response: Optional[bool] = None,
) -> Optional[RelationshipView]:
for view in self._relationship_views:
rel = view.relationship
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getChildView(self, parentId, childSeq):\n # child_view = None\n # str_getChildView = \"self.vc.findViewById('\" + parentId + \"')\"\n # for index in childSeq:\n # str_getChildView += ('.children[' + str(index) + ']')\n # printLog(self.threadName + \"executing child_view... | [
"0.59846926",
"0.5548496",
"0.5530844",
"0.5438237",
"0.52437264",
"0.5235289",
"0.52155375",
"0.51775765",
"0.5124838",
"0.5076548",
"0.49964866",
"0.49897185",
"0.49897185",
"0.49897185",
"0.49834818",
"0.49717134",
"0.49717134",
"0.49509534",
"0.49450922",
"0.49279633",
"0... | 0.655181 | 0 |
Ensure that an element can't be added if parent or children are in view. | def check_parent_and_children_not_in_view(self, element: Element) -> None:
for view in self.element_views:
if view.element in element.child_elements:
raise ValueError(f"A child of {element.name} is already in this view.")
if view.element is getattr(element, "parent", None... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_lacking_parent(self):\n pass",
"def child_invalid(self):\n raise NotImplementedError(\n \"{} does not have implemented `child_invalid`\".format(self)\n )",
"def has_parent(self):\n return False",
"def incorrectly_nested(self):\n return self.parent is not... | [
"0.60467064",
"0.5970557",
"0.5904759",
"0.58408904",
"0.57895845",
"0.5762888",
"0.5762888",
"0.5762888",
"0.5762888",
"0.5762888",
"0.55479467",
"0.5520642",
"0.5500766",
"0.545122",
"0.5440226",
"0.5396799",
"0.5394671",
"0.53918046",
"0.53586113",
"0.53525645",
"0.5312074... | 0.79654515 | 0 |
Implements bilinear functions using replicated secret shares. Shares are input as ArithmeticSharedTensors and are replicated within this function to perform computations. The protocol used here is that of section 3.2 of ABY3 | def __replicated_secret_sharing_protocol(op, x, y, *args, **kwargs):
assert op in {
"mul",
"matmul",
"conv1d",
"conv2d",
"conv_transpose1d",
"conv_transpose2d",
}
x_shares, y_shares = replicate_shares([x.share, y.share])
x1, x2 = x_shares
y1, y2 = y_sh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_shared(self, x=None, y=None):\n with tf.name_scope(\"comput_shared\") as name:\n assert (x is None) != (y is None)\n is_x = x is not None\n\n with tf.name_scope(\"piece0\"):\n range_min = tf.convert_to_tensor(self.range_min, name='range_min')\n kx = _knot_positions(self... | [
"0.5719756",
"0.5430887",
"0.542316",
"0.5418885",
"0.5392883",
"0.5379249",
"0.53384435",
"0.5258141",
"0.5237195",
"0.5228597",
"0.5221881",
"0.52066815",
"0.51239055",
"0.5099972",
"0.5070661",
"0.5048621",
"0.5037715",
"0.5023207",
"0.4981468",
"0.4955277",
"0.49488163",
... | 0.63490194 | 0 |
Adds a new client to the database | def add_client(name):
return create_client(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_01_add_client(self):\n try:\n for k, v in self.test_data.items():\n client = Client()\n test_str = v.split(',')\n client.user_id = test_str[0]\n client.host_name = test_str[1]\n client.user_name = test_str[2]\n ... | [
"0.7131107",
"0.6994528",
"0.6953803",
"0.6861296",
"0.6846199",
"0.6807965",
"0.66636294",
"0.65601414",
"0.6553862",
"0.6495806",
"0.6450804",
"0.64192295",
"0.6418755",
"0.63998187",
"0.6399166",
"0.6305849",
"0.6305849",
"0.6294406",
"0.62839854",
"0.6116749",
"0.606965",... | 0.7155781 | 0 |
Let's public and registered user submit a support ticket | def support_submit_ticket(self, **kw):
person_name = ""
if http.request.env.user.name != "Public user":
person_name = http.request.env.user.name
pic = http.request.env['schedule.person.in.charge'].sudo().search([],order = 'end_date desc',limit=1).pic
return http.request.r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_support_ticket(self, admin_uid, project_name, customer_name,\n tmp_name, supporter_name,\n customer_profile='TMS Customer Profile'):\n support_ticket_obj = self.registry('tms.support.ticket')\n partner_obj = self.registry('res.pa... | [
"0.69233453",
"0.65590894",
"0.65289736",
"0.6415005",
"0.64081705",
"0.638714",
"0.6355518",
"0.62974226",
"0.62485695",
"0.624069",
"0.6219356",
"0.6219195",
"0.62152666",
"0.62112",
"0.6184423",
"0.61602175",
"0.61165065",
"0.6109556",
"0.6039671",
"0.60171163",
"0.6001981... | 0.77420163 | 0 |
Create a new session and persist it according to its username and token values. | def _new_session(self, username_key=None, **attributes):
for key in ['username', 'token', 'tenant_id']:
if attributes.get(key, None) is None:
attributes[key] = key + "_" + text_type(uuid4())
if 'expires' not in attributes:
attributes['expires'] = (
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_new_session_token(self):\n session_token = self.__generate_session_token()\n payload = {\n 'token' : session_token\n }\n self.encoded_token = jwt.encode(payload, 'secret', algorithm='HS256')\n Token.objects.create(session_token=session_token)",
"def creat... | [
"0.7512262",
"0.7276753",
"0.72110564",
"0.7114964",
"0.70534384",
"0.700323",
"0.69665575",
"0.6964039",
"0.6911601",
"0.68732077",
"0.6832288",
"0.6659833",
"0.66411835",
"0.66335",
"0.65931505",
"0.65842974",
"0.6561036",
"0.6559232",
"0.65558994",
"0.6549769",
"0.65234375... | 0.74275583 | 1 |
Given the name of a region and a mimic internal service ID, get a resource for that service. | def service_with_region(self, region_name, service_id, base_uri):
key = (region_name, service_id)
if key in self.uri_prefixes:
return self.uri_prefixes[key].resource_for_region(
self.uri_for_service(region_name, service_id, base_uri)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_region(self, region_id):\n raise exception.NotImplemented() # pragma: no cover",
"def GetResourceFromNamespacedName(namespaced_name, resource_type):\n service = ServiceFns[resource_type]()\n req = GetResourceFns[resource_type](name=namespaced_name)\n response = service.Get(req)\n\n return res... | [
"0.6456018",
"0.63319135",
"0.617736",
"0.6104381",
"0.5876853",
"0.5802578",
"0.5799496",
"0.5796975",
"0.577786",
"0.57154256",
"0.569162",
"0.56586933",
"0.5637189",
"0.56066823",
"0.55764836",
"0.5558472",
"0.5557971",
"0.55479217",
"0.55479217",
"0.55479217",
"0.55396986... | 0.7848388 | 0 |
Generate a URI prefix for a given region and service ID. | def uri_for_service(self, region, service_id, base_uri):
return str(URLPath.fromString(base_uri)
.child("service").child(region).child(service_id).child("")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_with_region(self, region_name, service_id, base_uri):\n key = (region_name, service_id)\n if key in self.uri_prefixes:\n return self.uri_prefixes[key].resource_for_region(\n self.uri_for_service(region_name, service_id, base_uri))",
"def generate_router_uri(pro... | [
"0.66818917",
"0.6075172",
"0.59251356",
"0.5835961",
"0.5789605",
"0.57216346",
"0.5645432",
"0.56307805",
"0.5608411",
"0.54919595",
"0.54798126",
"0.54721117",
"0.5455161",
"0.5435575",
"0.5394286",
"0.536875",
"0.53580153",
"0.53372353",
"0.53315735",
"0.5327415",
"0.5322... | 0.71465874 | 0 |
set_time_period takes in a data frame and calculates the time period (ThanksGiving, WinterBreak, SummerBreak or Not Holiday)for each record returns a modified data frame | def set_time_period(df):
for i in range(0,len(df['Day'])):
if (((df.loc[i,'Month']==11) & (df.loc[i,'Day']<=30) & (df.loc[i,'Day']>=27))\
| ((df.loc[i,'Month']==12) & (df.loc[i,'Day']<=3) & (df.loc[i,'Day']>=1)) ):
df.loc[i,'Holiday'] = 'ThanksGiving'
TGDate = df.loc[i,'w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_datetime_train(df):\n\n df['pickup_hour'] = pd.to_datetime(df['pickup_datetime']).dt.hour\n\n df['dropoff_hour'] = pd.to_datetime(df['dropoff_datetime']).dt.hour\n\n df['pickup_minute'] = pd.to_datetime(df['pickup_datetime']).dt.minute\n\n df['dropoff_minute'] = pd.to_datetime(df['dropoff_da... | [
"0.6012442",
"0.59708464",
"0.54916745",
"0.5437837",
"0.52865595",
"0.5175374",
"0.5171756",
"0.51660645",
"0.51351386",
"0.5048385",
"0.504096",
"0.5034693",
"0.50177866",
"0.50149727",
"0.4976959",
"0.49694532",
"0.4965803",
"0.4921499",
"0.49133396",
"0.48727775",
"0.4872... | 0.7606388 | 0 |
anova_analysis takes in a data frame and performs an anova test for hypothesis testing 1 prints out the test results | def anova_analysis(df):
time_periods = df.groupby(['week_ending','Holiday'],as_index = False)[['seats_sold']].sum()
TG = time_periods.loc[time_periods['Holiday'] == 'ThanksGiving','seats_sold']
WB = time_periods.loc[time_periods['Holiday'] == 'WinterBreak','seats_sold']
SB = time_periods.loc[time_period... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testANOVA():\n\n data = {'Control': [54, 23, 45, 54, 45, 47], 'Treated': [87, 98, 64, 77, 89],\n 'TreatedAntagonist': [45, 39, 51, 49, 50, 55]}\n print(type(data))\n OneWayAnova(dataStruct=data, dataLabel='3 Groups', mode='parametric')\n print ('-'*80)\n print ('Compare to Prism output: ')\n ... | [
"0.6850544",
"0.6621147",
"0.6502546",
"0.6270873",
"0.62652534",
"0.6217322",
"0.60624397",
"0.6005953",
"0.5985062",
"0.59251034",
"0.5853259",
"0.58106",
"0.5775162",
"0.5741587",
"0.57148474",
"0.5647258",
"0.5563191",
"0.556098",
"0.55328804",
"0.55215967",
"0.5488164",
... | 0.7318326 | 0 |
test2 takes in the grosses data set and the rating data set prepares the data performs a logistic regression to test the hypothesis 2 prints out the regression results | def hypoTest2(df, rt):
from sklearn import preprocessing
import statsmodels.api as sm
gs = df
ratings = rt
# limit the time scope to recent 5 years
testData2 = gs[gs['year']>=2015]
testData2 = testData2[['show','year','month','this_week_gross']]
# calculate avg weekly grosses mean (b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_g2(self):\n self.setUp()\n theta = self.data.theta\n beta_0, beta_1 = theta[\"beta_0\"], theta[\"beta_1\"]\n gamma_0, gamma_1 = theta[\"gamma_0\"], theta[\"gamma_1\"]\n g2 = self.E_func.g2(self.S, gamma_0, beta_0, gamma_1, beta_1)\n # values of g2 at first group a... | [
"0.66347843",
"0.6209006",
"0.619178",
"0.6048459",
"0.599496",
"0.59430534",
"0.5936024",
"0.59307",
"0.5913007",
"0.5906161",
"0.587387",
"0.58414817",
"0.58316684",
"0.5810793",
"0.5808976",
"0.58022356",
"0.5780662",
"0.57751703",
"0.5768546",
"0.57460725",
"0.5743792",
... | 0.6988483 | 0 |
Add model parameters in the modelica file and create dictionary of model parameters This function extract model and subckt information along with their parameters with the help of optionInfo | def addModel(self,optionInfo):
modelName = []
modelInfo = {}
subcktName = []
paramInfo = []
transInfo = {}
for eachline in optionInfo:
words = eachline.split()
if words[0] == '.include':
name = words[1].split('.')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doParametersOfInterest(self):\n \n self.modelBuilder.doVar('expr::cosW(\"0.87681811112\",)')\n self.modelBuilder.doVar('expr::sinW(\"0.48082221247\",)')\n self.modelBuilder.doVar('expr::mZ(\"91.2\",)')\n self.modelBuilder.doVar('expr::Lambda1(\"100.0\",)')\n self.modelBui... | [
"0.6502187",
"0.64847857",
"0.6467319",
"0.642566",
"0.63406587",
"0.6313643",
"0.62799996",
"0.61906505",
"0.6187379",
"0.61486065",
"0.6145462",
"0.6080124",
"0.6062548",
"0.60373634",
"0.59718966",
"0.5930781",
"0.59303004",
"0.5926543",
"0.5897012",
"0.58648956",
"0.58574... | 0.7351766 | 0 |
separate print plot and component statements | def separatePlot(self,schematicInfo):
compInfo = []
plotInfo = []
for eachline in schematicInfo:
words = eachline.split()
if words[0] == 'run':
continue
elif words[0] == 'plot' or words[0] == 'print':
plotInfo.append(eachline)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display(self):\n for x, p in zip(self.xs, self.ps):\n print(x, p)",
"def render(self, mode='human', type_of='color'):\n if type_of == 'color':\n plot_color(self.observation, self.servers_mem ,self.services_mem)\n elif type_of=='black':\n plot_black(self.o... | [
"0.61761427",
"0.6136814",
"0.6121266",
"0.61151016",
"0.6107716",
"0.6094556",
"0.60828936",
"0.60395825",
"0.6032903",
"0.6008571",
"0.6008571",
"0.5999056",
"0.5972926",
"0.5953528",
"0.5943987",
"0.59269154",
"0.58774036",
"0.58771664",
"0.58751196",
"0.58711714",
"0.5861... | 0.63181067 | 0 |
Take subcircuit name and give the info related to parameters in the first line and initislise it in | def getSubParamLine(self,subname, numNodesSub, subParamInfo,dir_name):
#nodeSubInterface = []
subOptionInfo_p = []
subSchemInfo_p = []
filename_t = subname + '.sub'
filename_t = os.path.join(dir_name, filename_t)
data_p = self.readNetlist(filename_t)
subOptionInfo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_subcircuit(self, lines: Tuple[int, int], circuit: Circuit, content: str) -> None:",
"def __init__(self,\n name,\n vertices_location,\n connectivity,\n connectivity_ids=None,\n connectivity_label=None,\n connectivity_label_metadata... | [
"0.62633604",
"0.5877768",
"0.57064974",
"0.5682109",
"0.56702554",
"0.5581789",
"0.55173093",
"0.54036635",
"0.53858906",
"0.5371969",
"0.534201",
"0.5316278",
"0.52800095",
"0.5277655",
"0.5275859",
"0.5246889",
"0.5243808",
"0.5242359",
"0.5229417",
"0.5203361",
"0.5200167... | 0.6259067 | 1 |
separate the node numbers and create nodes in modelica file; the nodes in the subckt line should not be inside protected keyword. pinInit is the one that goes under protected keyword. | def nodeSeparate(self,compInfo, ifSub, subname, subcktName,numNodesSub):
node = []
nodeTemp = []
nodeDic = {}
pinInit = 'Modelica.Electrical.Analog.Interfaces.Pin '
pinProtectedInit = 'Modelica.Electrical.Analog.Interfaces.Pin '
protectedNode = []
print "CompInfo ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_nodes(self):",
"def TreeInit(tree):\n \"\"\" Settings/NI_6133 \"\"\"\n tree.addNode('.SETTINGS')\n tree.addNode('.SETTINGS.EXPERIMENT')\n tree.addNode('.SETTINGS.NI')\n tree.addNode('.SETTINGS.NI.NI_6602_TIME')\n tree.addNode('.SETTINGS.NI.NI_6133')\n tree.addNode('.NI_6133')\n ... | [
"0.6431492",
"0.58888775",
"0.5808518",
"0.5718617",
"0.568527",
"0.568527",
"0.568527",
"0.568527",
"0.568527",
"0.568527",
"0.5668452",
"0.5654593",
"0.56267965",
"0.5613493",
"0.55443066",
"0.55038846",
"0.54904735",
"0.546983",
"0.5460912",
"0.5418785",
"0.54137105",
"0... | 0.68805975 | 0 |
It is main function of module Ngspice to Modelica converter | def main(args):
if len(sys.argv) == 2:
filename = sys.argv[1]
else:
print "USAGE:"
print "python NgspicetoModelica.py <filename>"
sys.exit()
dir_name = os.path.dirname(os.path.realpath(filename))
file_basename = os.path.basename(filename)
obj_NgMoConvert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n\n # Load the data and scale\n x_train = np.load(\"../data/audio/ESC-10/esc10_raw_train_audio.npy\")[:,:,0]\n y_train = np.load(\"../data/audio/ESC-10/esc10_raw_train_labels.npy\")\n x_test = np.load(\"../data/audio/ESC-10/esc10_raw_test_audio.npy\")[:,:,0]\n y_test = np.load(\"../da... | [
"0.64135325",
"0.64008504",
"0.6285087",
"0.61439496",
"0.61026406",
"0.6097184",
"0.60559285",
"0.60184",
"0.6000427",
"0.59560597",
"0.59112316",
"0.59103507",
"0.5902412",
"0.58892053",
"0.5882462",
"0.5876786",
"0.5848752",
"0.5848752",
"0.5848752",
"0.5848752",
"0.584875... | 0.7880283 | 0 |
Loads the given filename found at filepath with the preferred options. Accepts CSV, XLS, XLSX, HTML, and XML. | def load(path, directory=None):
if directory is not None:
path = os.path.join(directory, path)
_, ext = os.path.splitext(path)
if ext.lower() == '.csv':
try:
df = pd.read_csv(path, index_col=None, dtype=object)
return df
except:
df = pd.read_csv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_file(filepath: str, sep: str = \";\"):\n _, extension = filepath.rsplit(\".\", 1)\n if not os.path.exists(filepath):\n raise FileNotFoundError(filepath)\n if extension == \"csv\":\n content = pd.read_csv(filepath, sep=sep)\n elif extension == \"yaml\":\n content = open_yam... | [
"0.6457961",
"0.6086716",
"0.6062022",
"0.6057617",
"0.5977015",
"0.5924193",
"0.58977485",
"0.585386",
"0.5848094",
"0.5767723",
"0.57574713",
"0.57529175",
"0.5707004",
"0.5656995",
"0.5639052",
"0.56309414",
"0.5627251",
"0.5604909",
"0.5593014",
"0.55896103",
"0.5577483",... | 0.65248215 | 0 |
Converts all xls files at the given path to CSV files and outputs them into a directory named after the file. If the xls file has sheets, those are also outputted to the new directory. | def csv_from_excel(path=os.getcwd()):
path = path + '/*.xls*'
files = glob.glob(path)
for i in files:
file = os.path.basename(i)
filename = os.path.splitext(file)[0]
xls_file = pd.ExcelFile(i, index_col=None, dtype=object)
if len(xls_file.sheet_names) > 1:
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_excel_files(self):\n for x in self.files:\n if x[-4:] not in [\".xls\", \"xlsx\"]:\n continue\n else:\n files = pd.read_excel(x, sheet_name=None)\n for k, v in files.items():\n #get name with the extension stripp... | [
"0.69403607",
"0.6792918",
"0.6768217",
"0.61681294",
"0.5829117",
"0.57755077",
"0.57054704",
"0.5697257",
"0.56801313",
"0.5591886",
"0.55775934",
"0.5491799",
"0.5417065",
"0.53639287",
"0.53344417",
"0.5266534",
"0.5203592",
"0.51408166",
"0.5134812",
"0.50818545",
"0.506... | 0.74483657 | 0 |
Distributes values in ranks column into columns created based on unique values in programs column. | def fix_ranks(df, ranks='Current Ranks', programs='Programs'):
# Create columns based on unique program values
if programs in df:
unique_programs = set(df[programs].unique())
if np.nan in unique_programs:
unique_programs.remove(np.nan)
for value in unique_programs.copy():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalized_rankings(df, columns=['Lust', 'Envy', 'Greed', 'Sloth', 'Wrath',\n 'Pride', 'Gluttony']):\n df[columns] = (df[columns] - 4) / 2 # hard coding n=7 case for now",
"def ranksByProgram(self):\n\n # Prompts user and gets a set of values\n ranks, p... | [
"0.5437983",
"0.5321464",
"0.48331884",
"0.47549316",
"0.46927905",
"0.46685165",
"0.46200693",
"0.45880383",
"0.4580909",
"0.4577722",
"0.4532358",
"0.45247898",
"0.44939372",
"0.44839427",
"0.44658518",
"0.446214",
"0.44235912",
"0.44155613",
"0.44132406",
"0.44088876",
"0.... | 0.6814282 | 0 |
Distributes the values in the phones column based on the identifier given in parentheses into either Home, Mobile, or Work. | def split_phones(df, column):
df['Work'] = df[column].str.extract(r'(...-...-....)\(W\)', expand=True)
df['Mobile'] = df[column].str.extract(r'(...-...-....)\(M\)', expand=True)
df['Mobile 2'] = df[column].str.extract(r'...-...-....\(M\).*?(...-...-....)\(M\)', expand=True)
df['Mobile 3'] = df[column].... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_phone(phone, phone_mapping):\n results = []\n for iphone in re.split(',|;',phone):\n patterns = phone_pattern_re.search(iphone)\n if patterns:\n numbers = patterns.groups()\n if numbers[0] == \"852\":\n results.append(re.compile(r'\\D?(\\d{0,4}?)\... | [
"0.557691",
"0.48557055",
"0.47899625",
"0.45926788",
"0.45099318",
"0.44751787",
"0.4453989",
"0.44258246",
"0.4379909",
"0.43671274",
"0.43414667",
"0.4331737",
"0.43276244",
"0.42938775",
"0.42938775",
"0.42811003",
"0.42746872",
"0.42629614",
"0.42539835",
"0.42346013",
"... | 0.6594883 | 0 |
Splits the comma separated values in the emails column into a maximum of 3 different columns. | def split_emails(df, column):
df['Email'] = df[column].str.extract(r'(.*?@.*?\....),?', expand=True)
df['Email 2'] = df[column].str.extract(r'.*@.*\....,\s?(.*@.*\....)', expand=True)
df['Email 3'] = df[column].str.extract(r'.*@.*\....,\s?.*@.*\....,\s?(.*@.*\....)', expand=True)
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_into_columns(s):\n\ts = re.sub(',,,', ',0,0,', s)\n\ts = re.sub(',,', ',0,', s)\n\treturn s.split(',')",
"def _parse_emails(self, emails):\n return [e.strip() for e in emails.split(',')]",
"def get_email_ids(self):\n if self.emails is None or self.emails == '':\n return []\n ... | [
"0.67024225",
"0.65343946",
"0.5943639",
"0.59189403",
"0.55012566",
"0.5432298",
"0.5371343",
"0.52167886",
"0.5202834",
"0.5180676",
"0.5168435",
"0.5163331",
"0.5148711",
"0.51152694",
"0.50926095",
"0.50753117",
"0.5074737",
"0.5072455",
"0.506463",
"0.50392157",
"0.50359... | 0.7557674 | 0 |
Removes all leading and trailing whitespace. Replaces all newlines, carriage returns, and invisible tabbreaks with a space. \n If a column isn't specified, it acts on the entire dataframe. | def strip_whitespace(df, column=None):
if column is None:
for x in df.columns:
if df[x].dtypes == object:
df[x] = pd.core.strings.str_strip(df[x])
df[x] = df[x].str.replace('\n', '')
df[x] = df[x].str.replace(r'\r', ' ', regex=True)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_df(self, df, column_name):\r\n \r\n df[column_name] = df[column_name].fillna('').str.replace('\\n', ' ')\r\n return df",
"def shrink_whitespace(data: pd.Series) -> pd.Series:\n data = data.replace(r'\\s+', value=' ', regex=True)\n return data.str.strip()",
"def strip_column... | [
"0.7356934",
"0.6805515",
"0.6794057",
"0.64226145",
"0.64139557",
"0.6157395",
"0.6111862",
"0.6067155",
"0.5934019",
"0.59189373",
"0.5878997",
"0.58672464",
"0.5864388",
"0.5830358",
"0.58267504",
"0.58051336",
"0.5795834",
"0.5767993",
"0.57601017",
"0.573922",
"0.5724872... | 0.7584346 | 0 |
Splits a column of comma separated values into their own rows with values identical to the original. | def tidy_split(df, column='Members', sep=', '):
indexes = []
new_values = []
for i, presplit in enumerate(df[column].astype(str)):
for value in presplit.split(sep):
indexes.append(i)
new_values.append(value)
new_df = df.iloc[indexes, :].copy() # the .copy() Prevents a wa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_column(df,col_name,reg_ex=',',keep=False):\n # https://stackoverflow.com/a/51680292/5847441\n df = df.select(col_name,posexplode(split(col_name,reg_ex)).alias('pos','val'))\\\n .select(col_name,concat(lit(col_name),col('pos').cast('string')).alias('name'),'val')\\\n .groupBy(col_name)... | [
"0.64203936",
"0.63070935",
"0.61441594",
"0.6137313",
"0.5952938",
"0.5780356",
"0.57425",
"0.5677074",
"0.5605468",
"0.544994",
"0.5446234",
"0.5424089",
"0.53638244",
"0.53548014",
"0.53276426",
"0.53026354",
"0.52907306",
"0.525217",
"0.5158915",
"0.51240396",
"0.510114",... | 0.66650534 | 0 |
Iterates over a dataframe and drops all rows that contain quotes as part of the string. | def drop_quote_rows(df):
for i in df.columns.values:
if df[i].dtype != 'datetime64[ns]' and df[i].dtype != 'float64':
df = df[~df[i].str.contains('"', na=False)]
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean(df):",
"def strip_columns(df: DataFrame) -> DataFrame:\r\n return df.apply(lambda x: x.str.strip() if x.dtype == 'object' else x)",
"def __clean_column_names(self, columns):\r\n cols = []\r\n for column in columns:\r\n cols.append(column.replace('\"', ''))\r\n retur... | [
"0.626898",
"0.60871345",
"0.6035571",
"0.5847739",
"0.58360153",
"0.58146024",
"0.5808672",
"0.5807812",
"0.57319236",
"0.57052547",
"0.5661681",
"0.56058556",
"0.55961424",
"0.557724",
"0.5502874",
"0.54684365",
"0.5449995",
"0.5445038",
"0.5423044",
"0.54162115",
"0.539627... | 0.8157656 | 0 |
Chooses the date closest to the given date in a given pandas series in the given direction. | def closest_date(series, date=pd.to_datetime('today'), period='future'):
x = series.copy()
x = x.append(pd.Series(date, index=[len(x.index)]))
x = x.ix[pd.to_datetime(x).sort_values().index]
x = x.reset_index(drop=True)
index_today = x[x == date].head(1)
if period == 'future':
if x.tail... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closest_row(dataframe, column, value):\n sort = dataframe.iloc[(dataframe[column]-value).abs().argsort()[:1]]\n return sort",
"def next_determination_date(ddates,clo_idx):\n dd = ddates.loc[ddates['Fund']==clo_idx,'Determination Date']\n next_ddate = min(dd.loc[dd>pd.Timestamp.today()], key=lambd... | [
"0.5489094",
"0.53745514",
"0.5371786",
"0.5279156",
"0.517958",
"0.5167142",
"0.5166287",
"0.51227057",
"0.5106809",
"0.51014584",
"0.50864875",
"0.5069313",
"0.50628966",
"0.5034019",
"0.495855",
"0.4945508",
"0.49299702",
"0.49279854",
"0.4911208",
"0.48947218",
"0.4872206... | 0.7016062 | 0 |
function call for every view before Django choose witch view would be called. function ask user`s browser for Negotiate token | def process_request(self, request, *args, **kwargs):
if not settings.GSSAPI_ENABLED_OPTION:
return None
unauthorized = False
if 'HTTP_AUTHORIZATION' in request.META:
kind, initial_client_token = request.META['HTTP_AUTHORIZATION'].split(' ', 1)
if kind != 'Nego... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lesson_auth(request):",
"def login_required(view):\n def check_login(request,*args,**kwds):\n if not request.user.is_authenticated():\n api = FlattrAPI(secrets.FLATTR_API_KEY,secrets.FLATTR_API_SECRET)\n callback = reverse(oauth_callback)\n callback += \"?next=\" + ... | [
"0.621399",
"0.6102215",
"0.6026413",
"0.5909619",
"0.58216614",
"0.5788693",
"0.5766099",
"0.5750259",
"0.57497793",
"0.57260203",
"0.57218957",
"0.5685113",
"0.56807905",
"0.5671643",
"0.56470495",
"0.56376934",
"0.56284064",
"0.56181693",
"0.5616399",
"0.55913",
"0.5590202... | 0.61591715 | 1 |
Create a dataset from the given parameters. Note that despite the type hinting, ``domain`` is only semioptional, as a domain is required to create a | async def create_dataset(self, dataset_name: str, category: DataCategory, domain: Optional[DataDomain] = None,
**kwargs) -> bool:
# If a domain wasn't passed, generate one from the kwargs, or raise and exception if we can't
if domain is None:
data_format = kwargs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, domain_keys, require_domain=True, datasets=None):\n assert isinstance(domain_keys, list) or isinstance(domain_keys, str)\n if isinstance(domain_keys, list):\n self.domain_keys = domain_keys\n elif isinstance(domain_keys, str):\n self.domain_keys = [x fo... | [
"0.70908016",
"0.6585426",
"0.6346205",
"0.6299749",
"0.6184952",
"0.6145635",
"0.6139993",
"0.61318284",
"0.6127892",
"0.6063784",
"0.5988405",
"0.59247696",
"0.5912318",
"0.5860009",
"0.5854653",
"0.5846334",
"0.5820806",
"0.58134025",
"0.5787504",
"0.577296",
"0.57687443",... | 0.68479204 | 1 |
Request the status of the provided job, represented in string form. | async def request_job_status(self, job_id: str, *args, **kwargs) -> str:
# TODO: implement
raise NotImplementedError('{} function "request_job_status" not implemented yet'.format(self.__class__.__name__)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job_status(self, job_id):\n url = self.base_url + \"/ml-service/phoenix-ml/job/status?id={0}\".format(job_id)\n # url = \"http://10.1.2.110:8199/phoenix-ml/job/status?id=12\"\n headers = {\"ApiKey\": self.api_key}\n response = requests.get(url=url, headers=headers)\n return r... | [
"0.7616898",
"0.74997103",
"0.7483296",
"0.7299432",
"0.7210846",
"0.7101452",
"0.70003635",
"0.6996187",
"0.69212604",
"0.68891513",
"0.68681103",
"0.6823939",
"0.682249",
"0.6807101",
"0.68042487",
"0.6784051",
"0.67744637",
"0.6770887",
"0.67177606",
"0.6702504",
"0.667996... | 0.7644943 | 0 |
Request the provided job be stopped; i.e., transitioned to the ``STOPPED`` exec step. | async def request_job_stop(self, job_id: str, *args, **kwargs) -> bool:
# TODO: implement
raise NotImplementedError('{} function "request_job_stop" not implemented yet'.format(self.__class__.__name__)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_job(self):\n # DELETE /jobs/{job_id}/results\n pass",
"def stop(self) -> None:\n self._client.terminate_job(jobId = self.id, reason = self.STOP_REASON)",
"def stop_training_job(TrainingJobName=None):\n pass",
"def stop_transform_job(TransformJobName=None):\n pass",
"def ... | [
"0.70777583",
"0.70626056",
"0.7052685",
"0.68527895",
"0.6800575",
"0.6784599",
"0.6706217",
"0.6705649",
"0.66965103",
"0.6625707",
"0.6621099",
"0.6580438",
"0.65283185",
"0.6504719",
"0.64555734",
"0.6401517",
"0.6334278",
"0.6256518",
"0.6234194",
"0.62264514",
"0.621269... | 0.71144575 | 0 |
Read a blockchain file and store blocks into a list | def loadBlockchain(path):
list = []
filename = Blockchain(0, '0', 0, 0, 0).getFilename()
f = open(path)
for line in f:
if line == '\n':
continue
linesplit = line[:-1].split(';')
b = Blockchain(int(linesplit[0]), linesplit[1], int(linesplit[2]), int(linesplit[3... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(self):\n try:\n with open(\"blockchain.txt\", mode=\"r\") as f:\n file_content = f.readlines()\n blockchain = json.loads(file_content[0][:-1])\n # OrderedDict\n updated_blockchain = []\n for block in blockcha... | [
"0.74427164",
"0.68054676",
"0.6126557",
"0.60757756",
"0.59914404",
"0.5931667",
"0.5885084",
"0.5811858",
"0.5760393",
"0.57101476",
"0.56943816",
"0.5690348",
"0.56846213",
"0.5644611",
"0.56390595",
"0.56177294",
"0.55774206",
"0.5571329",
"0.55698186",
"0.55587953",
"0.5... | 0.6991728 | 1 |
Convert a block in string to a block object | def stringToBlock(strBlock):
blocksplit = strBlock.split(';')
block = Blockchain(int(blocksplit[0]), blocksplit[1], int(blocksplit[2]), int(blocksplit[3]) ,blocksplit[4])
return block | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _decode_block_string(block_string):\n assert isinstance(block_string, str)\n\n ops = block_string.split('_')\n options = {}\n for op in ops:\n splits = re.split(r'(\\d.*)', op)\n if len(splits) >= 2:\n key, value = splits[:2]\n opt... | [
"0.70905423",
"0.70905423",
"0.70402545",
"0.68169737",
"0.6797657",
"0.6712426",
"0.6638009",
"0.65721875",
"0.65279007",
"0.64944434",
"0.645922",
"0.6392348",
"0.63896126",
"0.62067014",
"0.61407346",
"0.60342276",
"0.59786546",
"0.59596866",
"0.59488565",
"0.58848554",
"0... | 0.81313765 | 0 |
Creat a block for a trascation | def newBlock(preBlock, remitter, number, payee):
index = preBlock.index + 1
timestamp = int(round(time.time() * 1000))
data = (remitter, number, payee).__str__()
previousHash = preBlock.hash
nounce = 0
return Blockchain(index, data, timestamp, nounce, previousHash) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_block(self):\n return poet_transaction_block.PoetTransactionBlock()",
"def gen_new_block(self):\n block = BasicBlock()\n self.blocks.append(block)\n return block",
"def NewBlock(self):\n for i in self.matrix:\n if 2 in i:\n return()\n ... | [
"0.68695533",
"0.67798185",
"0.6753776",
"0.6749143",
"0.6747121",
"0.6487674",
"0.6477238",
"0.64685786",
"0.6462074",
"0.6456521",
"0.6425149",
"0.6414496",
"0.64110404",
"0.64087576",
"0.6393785",
"0.6349181",
"0.6316754",
"0.63043255",
"0.63032055",
"0.6290305",
"0.628259... | 0.6858441 | 1 |
This function handles the /practices/create endpoint for the blueprint | def practices_create():
practice = Practice()
form = PracticeCreateForm()
if form.validate_on_submit():
form.populate_obj(practice)
db.session.add(practice)
db.session.commit()
return redirect(url_for('practices.home'))
return render_template('practices/create.html', for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create():\n data = request.get_json()\n print(\"DATA: \", data)\n db_helper.insert_new_record(data['first_name'], data['last_name'], data['class_period'], data['current_belt'], data['student_teacher_id'])\n result = {'success': True, 'response': 'Done'}\n return jsonify(result)",
"def create_d... | [
"0.62720287",
"0.6226054",
"0.62232095",
"0.6165267",
"0.61319274",
"0.61049116",
"0.60810924",
"0.6080852",
"0.6080852",
"0.5967741",
"0.59200597",
"0.5918674",
"0.58601415",
"0.5856752",
"0.58543026",
"0.5830439",
"0.58303565",
"0.58087665",
"0.58066255",
"0.5784546",
"0.57... | 0.81431204 | 0 |
Generator for sequence. Will return num equally spaced items from the sequence. | def takespread(sequence, num):
length = float(len(sequence))
for i in range(num):
yield sequence[int(np.ceil(i * length / num))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def takespread(sequence, num):\n length = float(len(sequence))\n for i in range(num):\n yield sequence[int(ceil(i * length / num))]",
"def takeNGenerator(seq, n):\n\tindex = 0\n\twhile index + n <= len(seq):\n\t\tyield seq[index:index + n]\n\t\tindex = index + 1",
"def iter_n(sequence: Sequence[T]... | [
"0.69585615",
"0.6918271",
"0.6467057",
"0.6417184",
"0.6414611",
"0.638621",
"0.6358035",
"0.6358023",
"0.6356029",
"0.62794334",
"0.62706125",
"0.62275124",
"0.62054384",
"0.6202193",
"0.6199912",
"0.6168549",
"0.61490697",
"0.61056083",
"0.61028194",
"0.6096058",
"0.608375... | 0.69746965 | 0 |
Adds an object (or an object of the given class) with the given name to the runtime object. | def add_object(self, name, cls_or_object):
if self._internal.is_node_registered_within_endpoint():
raise CloudioModificationException('A CloudioRuntimeObject\'s structure can only be modified before' +
' it is registered within the endpoint!')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addObject(self, name, object):\n self.map[name] = object",
"def add_object(self, name, obj):\n if not isinstance(obj, SceneObject):\n raise ValueError('obj must be an object of type SceneObject')\n self._objects[name] = obj\n self.close_renderer()",
"def _add_object(s... | [
"0.76477057",
"0.7273519",
"0.7175446",
"0.7083584",
"0.7020766",
"0.70008993",
"0.69030166",
"0.68717223",
"0.6804043",
"0.67406464",
"0.6653478",
"0.6592018",
"0.6576465",
"0.6524411",
"0.65112865",
"0.63575375",
"0.63374376",
"0.6245882",
"0.62386525",
"0.6237244",
"0.6229... | 0.7540122 | 1 |
Filter input api request | def _filter_in_request(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_filters():\n params = {'api_key': API_KEY}\n for k in demisto.args():\n if demisto.getArg(k):\n params[k] = demisto.getArg(k)\n return params",
"async def filter(self, **kwargs):\n\n pass",
"def filterRansac():\n pass",
"def filter_query(self, query, request, r... | [
"0.6453626",
"0.63813454",
"0.6328844",
"0.6165196",
"0.61065346",
"0.609105",
"0.6009696",
"0.5985568",
"0.59085464",
"0.5872922",
"0.5858413",
"0.5852256",
"0.5820519",
"0.5807515",
"0.5779072",
"0.5766825",
"0.5754975",
"0.5714173",
"0.57101095",
"0.56960094",
"0.5687599",... | 0.6802354 | 0 |
Gets a QuerySet of current objects related to ``objs`` via the relation ``related``. | def related_objects(self, related, objs):
from versions.models import Versionable
related_model = related.related_model
if issubclass(related_model, Versionable):
qs = related_model.objects.current
else:
qs = related_model._base_manager.all()
return qs.us... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def related_objects(self, related_model, related_fields, objs):\n predicate = reduce(operator.or_, (\n query_utils.Q(**{'%s__in' % related_field.name: objs})\n for related_field in related_fields\n ))\n return related_model._default_manager.using(self.using).filter(\n ... | [
"0.7643895",
"0.6433926",
"0.62799156",
"0.61716324",
"0.60885555",
"0.5964254",
"0.5934872",
"0.58134305",
"0.5811461",
"0.5781093",
"0.57791954",
"0.57010734",
"0.5631755",
"0.55931336",
"0.55913925",
"0.55770904",
"0.5536853",
"0.55321735",
"0.5504152",
"0.5481324",
"0.544... | 0.8107112 | 0 |
add user to db. User details (name, pass, phone) is in json_details | def add_user_to_db(json_details):
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_user():\n json = request.json\n name = json[\"name\"]\n email = json[\"email\"]\n pwd = json[\"pwd\"]\n if name and email and pwd and request.method == \"POST\":\n sql = \"INSERT INTO users(user_name, user_email, user_password) \" \\\n \"VALUES(%s, %s, %s)\"\n data... | [
"0.7702093",
"0.75006545",
"0.7271409",
"0.7251211",
"0.7179736",
"0.71710926",
"0.7168135",
"0.71519035",
"0.71314853",
"0.7124831",
"0.7101933",
"0.709933",
"0.70991194",
"0.70895416",
"0.7084391",
"0.70836115",
"0.7083596",
"0.7064821",
"0.70374316",
"0.7032721",
"0.702668... | 0.87101287 | 0 |
Repeats a command a specified number of times. | async def do(ctx, times : int, *, command):
msg = copy.copy(ctx.message)
msg.content = command
for i in range(times):
await bot.process_commands(msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def repeat(times : int, content='repeating...'):\n for i in range(times):\n await bot.say(content)",
"async def repeat(ctx, times : int, content='repeating...'):\n for i in range(times):\n await bot.say(content)",
"async def repeat(ctx, times: int, content='repeating...'):\n for i ... | [
"0.738469",
"0.7359903",
"0.73264",
"0.72749573",
"0.67965984",
"0.67318964",
"0.66883427",
"0.64287454",
"0.6378672",
"0.6340102",
"0.62727064",
"0.6257879",
"0.6256501",
"0.6239841",
"0.6161488",
"0.6144609",
"0.60422397",
"0.6017532",
"0.6012069",
"0.6001311",
"0.5942651",... | 0.7408826 | 0 |
Gives a URL to the current bot changelog. | async def changelog():
await bot.say('https://discord.gg/y2PcWMM') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_changelog_url(repository_url, branch):\n changelog_url = f\"{repository_url}/blob/{branch}/CHANGES.txt\"\n requests_var = requests.get(changelog_url, timeout=30)\n if requests_var.status_code != 200:\n raise RuntimeError(f\"Page at URL {changelog_url} not found\")\n\n return changelog_ur... | [
"0.7049577",
"0.6941905",
"0.66407025",
"0.6581072",
"0.6575993",
"0.6410137",
"0.6290972",
"0.61633486",
"0.61253595",
"0.6025912",
"0.5953337",
"0.591455",
"0.5777124",
"0.57560915",
"0.5750858",
"0.57106954",
"0.5691371",
"0.5683107",
"0.55855507",
"0.55481666",
"0.5528186... | 0.7766924 | 0 |
Download raw REPY data from Technion, convert it to almostunicode (numbers are reversed) | def repy_data():
REPY_URI = "http://ug.technion.ac.il/rep/REPFILE.zip"
if prefs.options.usecache:
t = open("REPFILE.zip")
else:
try:
t = tempfile.TemporaryFile()
t.write(urllib.urlopen(REPY_URI).read())
except:
ttime.warning(_("Network download of ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode(data): #@NoSelf",
"def get_and_prepare_data_string():\n\n request = requests.get(\"https://pastebin.com/raw/a83ELw6K\")\n request.encoding = 'ISO-8859-1'\n\n return request.text",
"def decode(self, encoded):",
"def decode(self, s):",
"def decode(self, s):",
"def convert_txt_to_data():... | [
"0.593756",
"0.5877718",
"0.57247186",
"0.56543195",
"0.56543195",
"0.56461793",
"0.56322694",
"0.5608812",
"0.5603942",
"0.5595547",
"0.5556599",
"0.55428666",
"0.5420726",
"0.5420726",
"0.53380746",
"0.5324333",
"0.5293145",
"0.5286872",
"0.52605474",
"0.5250356",
"0.524740... | 0.6201089 | 0 |
convert time in seconds from 1998.1.1 to fractional year | def sectoFracYear(stime):
ltime = convertCtimeToYdate(stime)
atemp = re.split(':', ltime)
year= int(atemp[0])
ydate = int(atemp[1])
hours = int(atemp[2])
minutes = int(atemp[3])
seconds = int(atemp[4])
chk = 4.0 * int(0.25 * year)
if chk == year:
base = 366
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datetime_to_decimal_year(time):\n if not isinstance(time, datetime):\n raise TypeError(\"The input must be a datetime object.\")\n\n year_start = datetime(year=time.year, month=1, day=1)\n next_year_start = datetime(year=time.year+1, month=1, day=1)\n\n year_elapsed = (time - year_start).tot... | [
"0.6982566",
"0.6425419",
"0.63888425",
"0.6374404",
"0.63053405",
"0.63038373",
"0.62888265",
"0.6287638",
"0.625002",
"0.6155581",
"0.60713786",
"0.6063753",
"0.60450315",
"0.5957644",
"0.593662",
"0.5935859",
"0.59352255",
"0.5934942",
"0.59210765",
"0.5891124",
"0.5833839... | 0.7589334 | 0 |
Initialize summary logger (if needed). | def initialize_summary(self):
if self.need_logs:
self.summary_writer = tf.summary.create_file_writer(self.log_dir)
if self.verbose > 0:
full_log_path = os.path.abspath(self.log_dir)
print('Initialize logs, use: \ntensorboard --logdir={}'.format(full_log_pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, log_dir):\n self.writer = SummaryWriter(log_dir)",
"def initialize_log():\n logging.basicConfig(\n format='%(asctime)s %(levelname)-8s %(message)s',\n level=logging.INFO,\n datefmt='%Y-%m-%d %H:%M:%S',\n )",
"def _init_logging(self):\n # Setup logging var... | [
"0.72479147",
"0.719565",
"0.6993717",
"0.684605",
"0.67818",
"0.6757587",
"0.6726005",
"0.67242354",
"0.67202115",
"0.6719694",
"0.66944724",
"0.66559464",
"0.66170186",
"0.6603188",
"0.6601731",
"0.65876406",
"0.6564645",
"0.6533853",
"0.6529449",
"0.65213436",
"0.64860255"... | 0.7754888 | 0 |
Get operation profiling info. | def get_profile_op_info():
profiler_dir = get_profiler_dir(request)
train_id = get_train_id(request)
if not profiler_dir or not train_id:
raise ParamValueError("No profiler_dir or train_id.")
search_condition = request.stream.read()
try:
search_condition = json.loads(search_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_profile_stats():\n return p_stats",
"def print_performance_info(self):\n pass",
"def map_profile_info(profile):\n result = map(\n lambda p: {\n 'callcount': p.callcount,\n 'time': p.totaltime,\n 'name': p.code if isinstance(p.code, str) else p.code.c... | [
"0.66240704",
"0.62480927",
"0.6232298",
"0.6200571",
"0.61967117",
"0.605343",
"0.6047269",
"0.58772755",
"0.57756025",
"0.57734996",
"0.57548666",
"0.57354444",
"0.57291603",
"0.5698983",
"0.5678599",
"0.5661551",
"0.5656184",
"0.5646105",
"0.56389225",
"0.5613454",
"0.5604... | 0.7344386 | 0 |
Get profile device list. | def get_profile_device_list():
profiler_dir = get_profiler_dir(request)
train_id = get_train_id(request)
if not profiler_dir or not train_id:
raise ParamValueError("No profiler_dir or train_id.")
profiler_dir_abs = os.path.join(settings.SUMMARY_BASE_DIR, train_id, profiler_dir)
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_devices(self):\n response = self.oauth.get(url=f'{self.base_url}/json/devices/list')\n\n result = response.json()['device']\n for device in result:\n print(device)",
"def list_devices(self):\n return [x for x in self.devices.keys()]",
"def get_devices(self):\n ... | [
"0.749383",
"0.7381647",
"0.72927547",
"0.7277462",
"0.71753764",
"0.7086246",
"0.70075804",
"0.6882325",
"0.68772906",
"0.68372095",
"0.68343604",
"0.680703",
"0.67837983",
"0.6698722",
"0.66796744",
"0.6654076",
"0.66497344",
"0.6642055",
"0.66392237",
"0.6628788",
"0.66121... | 0.82288843 | 0 |
Returns the image without atomic prefixes used to map to skopeo args. | def image(self):
image = self._image
for remove in ('oci:', 'http:', 'https:'):
if image.startswith(remove):
image = image.replace(remove, '')
return image | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def no_bin(image, *args, **kwargs):\n return image",
"def no_img(texto):\n return sub_no_img.sub(\"\", texto)",
"def unprocess(image):\n return image + MEAN_PIXEL",
"def image(images):\n return images[0]",
"def image_cleaner(self) -> Optional[pulumi.Input['ManagedClusterSecurityProfileImageClea... | [
"0.6517635",
"0.6052293",
"0.60255784",
"0.5684926",
"0.5681953",
"0.5605083",
"0.55945504",
"0.5563343",
"0.5490649",
"0.54342526",
"0.54245436",
"0.54207134",
"0.53968036",
"0.537718",
"0.5360237",
"0.53349835",
"0.5334659",
"0.53315836",
"0.53258747",
"0.53241473",
"0.5304... | 0.6296732 | 1 |
Execute an action on the signin API. | def _action(self, action, data=None, api="signin"):
if not data:
data = {}
data['action'] = action
# data['redirect_uri'] = self._REDIRECT_URL
data['csrf'] = self._csrf_token()
print(data)
r = self.session()._post(
"https://signin.aws.amazon.com... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_in(self) -> pulumi.Output['outputs.ServiceSignIn']:\n return pulumi.get(self, \"sign_in\")",
"def initiateAuthentication(identity_url, return_to=None):",
"def signin():\n scope = request.args.get(\n 'scope',\n 'identify')\n discord = make_session(scope=scope.split(' '))\n ... | [
"0.620925",
"0.60264295",
"0.60104525",
"0.5591886",
"0.5576621",
"0.55588895",
"0.55383855",
"0.5535826",
"0.55275285",
"0.55239755",
"0.5506689",
"0.55012316",
"0.549917",
"0.54822266",
"0.5477129",
"0.5430199",
"0.54202974",
"0.5412541",
"0.5411632",
"0.5404519",
"0.539851... | 0.6361719 | 0 |
checksum for nmea string if there is no checksum present for simplified arduino input The check sum should be appended to the original NMEA sentence and return | def checkSum(nmea_string):
# take string after $
nmea_str = re.sub(r'^\$(.*)$', r'\1', nmea_string)
# clear whitespace
nmea_str = re.sub(r'\s', '', nmea_str)
checksum = 0 # initialize
for b in nmea_str:
checksum ^= ord(b) # xor
# need to remove the front '0x' from the import hex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checksum(s):\n result = re.search('\\$(.*)\\*', s) # everything between '$' and '*' (escaped with '\\')\n\n # https://rietman.wordpress.com/2008/09/25/how-to-calculate-the-nmea-checksum/\n # see also https://forum.u-blox.com/index.php/14618/python-generate-checksums-validate-coming-serial-interface\... | [
"0.6902954",
"0.67252344",
"0.65304875",
"0.6492474",
"0.6474358",
"0.6465052",
"0.6324542",
"0.61919427",
"0.6151632",
"0.61403924",
"0.6118252",
"0.6098456",
"0.5994872",
"0.595297",
"0.59509265",
"0.5938676",
"0.5938676",
"0.59314114",
"0.59124553",
"0.5904448",
"0.5897225... | 0.77633667 | 0 |
sign(x) = 1 when x >=0, sign(x) = 1 when x < 0 | def sign(x):
if x >= 0:
return 1
else:
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign(x):\n if x >= 0:\n return 1\n return -1",
"def sign(a):\n return (a > 0) - (a < 0)",
"def sign(a) :\n return (a>0) - (a<0)",
"def sign(num: float):\n return 1 if num >= 0 else -1",
"def sign(x):\n if x < 0.0:\n sign = -1\n elif x == 0.0:\n sign = 0... | [
"0.8934227",
"0.8589877",
"0.8557983",
"0.84978384",
"0.8455169",
"0.82966465",
"0.8226261",
"0.8218827",
"0.80557597",
"0.7960639",
"0.77862436",
"0.7741318",
"0.76713824",
"0.74776924",
"0.74519736",
"0.74350107",
"0.73274165",
"0.73155457",
"0.72797954",
"0.7140799",
"0.70... | 0.89466614 | 0 |
vector dot product, return a scalar x and y are two vectors with same length | def vector_dot(x, y):
if(len(x) != len(y)):
raise ValueError("vector lengths differ")
else:
# return x1*y1+x2*y2+...xn*yn
return sum([x[i] * y[i] for i in range(len(x))]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vec_dot(x, y):\r\n return sum(a * b for a, b in zip(x, y))",
"def naive_vector_dot(x, y):\n assert len(x.shape) == 1\n assert len(y.shape) == 1\n assert x.shape[0] == y.shape[0]\n\n z = 0\n for i in range(x.shape[0]):\n z += x[i] * y[i]\n return z",
"def vector_dot(v1,v2):\n re... | [
"0.86098886",
"0.83120406",
"0.8255133",
"0.8179656",
"0.80700606",
"0.7998463",
"0.79642713",
"0.79305995",
"0.7897161",
"0.78932184",
"0.78799474",
"0.787511",
"0.78657234",
"0.7834769",
"0.7806407",
"0.7790224",
"0.7761924",
"0.7682441",
"0.767671",
"0.7645681",
"0.7637908... | 0.8495939 | 1 |
vector cross product, return a vector x and y are two vectors with same length returned vector z is the same length as well this time only with dim=3 | def vector_cross(x, y):
if(len(x) != len(y)):
raise ValueError("vector lengths differ")
elif(len(x) > 3):
raise ValueError("vector is more than 3D")
else:
s = [x[1] * y[2] - x[2] * y[1],
x[2] * y[0] - x[0] * y[2],
x[0] * y[1] - x[1] * y[0]]
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross(vec1, vec2):\n result = np.zeros(3)\n return cross_(vec1, vec2, result)",
"def cross(x, y):\n x = x.reshape(3)\n y = y.reshape(3)\n z = np.cross(x, y)\n z = z.reshape((3, 1))\n return z",
"def vec_cross(a,b):\r\n return [a[1] * b[2] - a[2] * b[1],\r\n a[2] * b[0] - a[0]... | [
"0.76212597",
"0.74925447",
"0.73110324",
"0.7152654",
"0.7140053",
"0.71354425",
"0.7123215",
"0.71210593",
"0.70858693",
"0.7048258",
"0.70462084",
"0.7012079",
"0.69709086",
"0.69547546",
"0.6936852",
"0.69079554",
"0.6902274",
"0.68876064",
"0.6840153",
"0.6813516",
"0.67... | 0.76472753 | 0 |
data acquisition of accelerator and magentometer data, LSM303D datasheet | def LSM_acquisition(add):
# control register
CTRL0 = 0x1f # p.34, accelerator
CTRL1 = 0x20
CTRL2 = 0x21
CTRL5 = 0x24 # p.36, magnetic
CTRL6 = 0x25
CTRL7 = 0x26
FIFO_CTRL = 0x2e # p.40
# accelerater
OUT_X_L_A = 0x28
OUT_X_H_A = 0x29
OUT_Y_L_A = 0x2a
OUT_Y_H_A = 0x2b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def obtain_data(self):\n ##MODIFY THIS\n #ipdb.set_trace()\n print('obtain_data')\n print(self.enabler)\n print(self.index)\n helper = '>'+str(1+int(self.chann_span.get()))+'Q'\n print('helper='+helper)\n while(self.enabler):\n #print('size'+str(1+... | [
"0.66846615",
"0.6139364",
"0.61318266",
"0.6100957",
"0.59762603",
"0.59737635",
"0.5934688",
"0.5893882",
"0.5851181",
"0.5845216",
"0.58336294",
"0.5833296",
"0.5828705",
"0.5823165",
"0.57837117",
"0.57669115",
"0.57583517",
"0.5741563",
"0.57170486",
"0.5711301",
"0.5664... | 0.6794902 | 0 |
read the LSM value for certain time and return the value and write to offset register, make sure the chip is leveled and calm lsm arduino library | def LSM_offset(add, timer_out=1000):
# initialize
timer = 0
m_min = [32767, 32767, 32767]
m_max = [-32768, -32768, -32768]
# lsm reading
lsm_result = LSM_acquisition(add)
# loop to update min and max
while timer <= timer_out:
m = lsm_result.next()[3:6]
m_min = [min(m_min... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_sensor(sensor: int, gpio_pin: int) -> (int, float, float, datetime):\r\n logging.debug('reading sensor')\r\n hum_rh, temp_c = Adafruit_DHT.read_retry(sensor, gpio_pin)\r\n if hum_rh is None or temp_c is None:\r\n logging.error(\"failed to read from the sensor\")\r\n return 1, 0, 0, ... | [
"0.59235793",
"0.59106934",
"0.5670082",
"0.5641416",
"0.5617479",
"0.56003934",
"0.5563454",
"0.5529551",
"0.5488265",
"0.5479008",
"0.5411189",
"0.53775793",
"0.5370738",
"0.53605217",
"0.53589904",
"0.5346288",
"0.5344704",
"0.5330145",
"0.53069305",
"0.52879274",
"0.52723... | 0.6330764 | 0 |
Delete URI and return the number of bytes deleted. | def delete_uri(
self, uri: str, logger: Optional[logging.Logger] = default_logger
) -> int:
local_dir = get_local_dir_from_uri(uri, self._resources_dir)
local_dir_size = get_directory_size_bytes(local_dir)
deleted = delete_package(uri, self._resources_dir)
if not deleted:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self, _uri):\n print(\"Deleting '%s'\"%(_uri))\n response = self.__httpsRequest('DELETE', _uri, '')",
"def count_deleted_bytes(self): # FileObj.count_deleted_bytes\n if self.deleted:\n return self.bytes \n else:\n return 0",
"d... | [
"0.67140555",
"0.65919757",
"0.65536815",
"0.6445002",
"0.60951376",
"0.6051026",
"0.60461366",
"0.5974676",
"0.59423614",
"0.58661956",
"0.5857979",
"0.58498526",
"0.58419967",
"0.58417064",
"0.5830656",
"0.58267665",
"0.5780797",
"0.57706386",
"0.5765554",
"0.5755444",
"0.5... | 0.74127245 | 0 |
Download a jar URI. | async def _download_jars(
self, uri: str, logger: Optional[logging.Logger] = default_logger
):
try:
jar_file = await download_and_unpack_package(
uri, self._resources_dir, self._gcs_aio_client, logger=logger
)
except Exception as e:
raise R... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _download_from_url(self, url):\n target_file_name = self.dir + \"/\" + url.split('/')[-1].split('?')[0]\n urllib.urlretrieve (url, target_file_name)",
"def _download(url, outpath=None, dirname=None, branch='master', release=None):\n six.print_('downloading...')\n outfolder = outpath or os... | [
"0.6878704",
"0.6823005",
"0.6765299",
"0.67443496",
"0.672472",
"0.65095174",
"0.64747316",
"0.6447837",
"0.63558346",
"0.62665766",
"0.62546325",
"0.62373096",
"0.6230308",
"0.6222487",
"0.62218195",
"0.6216078",
"0.6216078",
"0.62140566",
"0.6175067",
"0.6155264",
"0.61466... | 0.69873255 | 0 |
Implements a polynomial learning rate of the form (1/nw) | def polynomial_learning_rate(n, w=0.5):
assert n > 0, "Make sure the number of times a state action pair has been observed is always greater than 0 before calling polynomial_learning_rate"
return 1./n**w | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_rate(self, t):\n # return self.init_learning_rate * (1 - t)\n return self.init_learning_rate / (1 + t)\n # return self.init_learning_rate * exp(-t)\n # return self.init_learning_rate * (.005 / self.init_learning_rate) ** t",
"def exponentialLearningRate(base):\n def fu... | [
"0.6654315",
"0.66402304",
"0.6613906",
"0.6513235",
"0.64861625",
"0.64501995",
"0.63714004",
"0.6363292",
"0.63441026",
"0.62656987",
"0.62390316",
"0.62067163",
"0.62067163",
"0.62005514",
"0.616968",
"0.61533827",
"0.6133514",
"0.6133514",
"0.6092227",
"0.6049452",
"0.604... | 0.8037298 | 0 |
Query client to get the practitioner's patient list | def get_patient_list(self, client):
self._patient_list = client.get_patient_list(self.id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_patients(self):\n return",
"def get_patient_list(self):\n return self._patient_list",
"def get_patient_data(self, client):\n for patient in self._monitored_patients.get_patient_list():\n # print(\"Requesting data for \" + patient.first_name+\" \"+patient.last_name+\"...\... | [
"0.6473012",
"0.6200664",
"0.5929303",
"0.59278613",
"0.59198064",
"0.5768752",
"0.5707701",
"0.5612031",
"0.5579454",
"0.5469084",
"0.5455913",
"0.54373837",
"0.5435617",
"0.5366657",
"0.53431135",
"0.5327053",
"0.5318471",
"0.5302202",
"0.5292539",
"0.5275686",
"0.5255918",... | 0.67707795 | 0 |
For each patient in the practitioner's monitored patient list, retrieve their data from the server | def get_patient_data(self, client):
for patient in self._monitored_patients.get_patient_list():
# print("Requesting data for " + patient.first_name+" "+patient.last_name+"...")
patient.update_data(client.get_patient_data(patient.id)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_patient_list(self, client):\n self._patient_list = client.get_patient_list(self.id)",
"def get_patients(self):\n return",
"def see_all():\n database = get_connection()\n patients_in_db = []\n patient: dict = database.patients.find()\n for p in patient:\n pat = p[\"patie... | [
"0.6629279",
"0.6568286",
"0.65445",
"0.6223222",
"0.60501635",
"0.5896784",
"0.5879684",
"0.57728606",
"0.565185",
"0.56371266",
"0.5596385",
"0.5589422",
"0.5585452",
"0.5550535",
"0.55420274",
"0.5493593",
"0.5476058",
"0.54563004",
"0.5411978",
"0.5362406",
"0.5329139",
... | 0.7766716 | 0 |
Add patient to the monitor list from the all patients list | def add_patient_monitor(self, patient_name):
for patient in self._patient_list.get_patient_list():
if patient_name == patient.first_name + " " + patient.last_name:
self._monitored_patients.add_patient(patient) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_patient(self, patient):\n if isinstance(patient, Patient):\n self._patient_list.append(patient)\n self.calculate_avg_cholesterol()",
"def update_patients(self, list):\n\n self.llista.delete(0, tk.END)\n for i in range(len(list)):\n self.llista.insert(... | [
"0.6347838",
"0.6320095",
"0.6128955",
"0.6099652",
"0.5824647",
"0.5669928",
"0.5381946",
"0.5372163",
"0.5362081",
"0.53102386",
"0.5252708",
"0.52468544",
"0.5185292",
"0.50818354",
"0.50702804",
"0.5063018",
"0.5057603",
"0.50574607",
"0.5031157",
"0.50095963",
"0.5009006... | 0.74789894 | 0 |
Remove patient from monitor list | def remove_patient_monitor(self, patient_name):
self._monitored_patients.remove_patient(patient_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_monitor(self):\n self._monitored_patients = PatientList()",
"def remove_monitor(monitor_id):\n g = mongo.db[app.config['GLOBAL_COLLECTION']]\n gdata = g.find_one(dict(), {'_id': 0})\n print(monitor_id)\n ga = GoogleAlerts(gdata['email'], gdata['password'])\n ga.authenticate()\n ... | [
"0.7407303",
"0.65054905",
"0.6071041",
"0.6051505",
"0.5979856",
"0.58976924",
"0.58892506",
"0.5792517",
"0.5757586",
"0.5683679",
"0.5680123",
"0.56612855",
"0.5654478",
"0.5638736",
"0.56229955",
"0.5587177",
"0.55870295",
"0.55831707",
"0.5560551",
"0.5553754",
"0.553496... | 0.7048552 | 1 |
Reset the monitored patients list | def clear_monitor(self):
self._monitored_patients = PatientList() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resetPlayerList(self):\n self.playerList = []",
"def reset_data_recorder(self):\n\n self.t_values = []\n self.x_values = []\n self.tau_values = []",
"def reset(self):\n reset_system_health_series()",
"def reset(self):\n self._data = []",
"def resetUsers():\n glo... | [
"0.63767904",
"0.63581616",
"0.6337571",
"0.6307555",
"0.6248766",
"0.6225761",
"0.62064785",
"0.6205428",
"0.6204301",
"0.6186645",
"0.61765885",
"0.61660004",
"0.60977095",
"0.6091881",
"0.6090129",
"0.60878223",
"0.6086508",
"0.6082881",
"0.6076582",
"0.60503036",
"0.60502... | 0.8055673 | 0 |
Add the patient to the patient list and recalculate avg cholesterol | def add_patient(self, patient):
if isinstance(patient, Patient):
self._patient_list.append(patient)
self.calculate_avg_cholesterol() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def avg_num_visits_patient(self):\n pass",
"def calculate_avg_cholesterol(self):\n total = 0\n no_of_valid_patients = 0\n for patient in self._patient_list:\n try:\n total += patient.get_cholesterol_data()[0]\n no_of_valid_patients += 1\n ... | [
"0.60794705",
"0.5896264",
"0.5746469",
"0.56437236",
"0.5553276",
"0.5531608",
"0.55159146",
"0.54730564",
"0.5434685",
"0.5412077",
"0.5378525",
"0.5354515",
"0.5350805",
"0.5337589",
"0.5321583",
"0.53007406",
"0.529966",
"0.5275353",
"0.5252502",
"0.52446043",
"0.5235613"... | 0.7625794 | 0 |
Remove patient with the given name | def remove_patient(self, patient_name):
for i in range(len(self)):
selected_patient = self._patient_list[i]
if patient_name == selected_patient.first_name + " " + selected_patient.last_name:
self._patient_list.pop(i)
self.calculate_avg_cholesterol()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(name):",
"def remove(name):\n del person_database[name]",
"def rm_person():\n # get person name from user\n responses = accept_inputs([\"Person name\"])\n person_name = responses[\"Person name\"]\n # check for existence of person\n results = query_with_results(\"select id from person where n... | [
"0.750902",
"0.7405967",
"0.6991705",
"0.6893029",
"0.6882131",
"0.67190564",
"0.6682343",
"0.6679356",
"0.6566834",
"0.6520179",
"0.6490527",
"0.6459752",
"0.6419736",
"0.6412036",
"0.6363453",
"0.63517666",
"0.6299661",
"0.629465",
"0.6292144",
"0.62912965",
"0.6287894",
... | 0.75734454 | 0 |
Getter method for the list of patients | def get_patient_list(self):
return self._patient_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_patients(self):\n return",
"def get_patient_list(self, client):\n self._patient_list = client.get_patient_list(self.id)",
"def get(self):\n all_patients = model_patient.query.all()\n return jsonify(all_patients)",
"def getPatients(self):\n if not self.patients.choic... | [
"0.83076537",
"0.75237614",
"0.7165529",
"0.7019929",
"0.63093877",
"0.6288992",
"0.62888664",
"0.61578315",
"0.6133857",
"0.60420316",
"0.59725815",
"0.59300333",
"0.59086293",
"0.5895699",
"0.5863118",
"0.5838831",
"0.5823298",
"0.5802317",
"0.5790686",
"0.5783136",
"0.5761... | 0.86567974 | 0 |
Find patient with the given name | def select_patient(self, patient_name):
for i in range(len(self)):
selected_patient = self._patient_list[i]
if patient_name == selected_patient.first_name + " " + selected_patient.last_name:
return selected_patient
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(self, name):\n\n name = name.lower().strip()\n exact_names = get_close_matches(name, self.possible_names, n=1)\n if not exact_names:\n return None\n else:\n exact_name = exact_names[0]\n id = self.df_possible_names[self.df_possible_names['name... | [
"0.65410453",
"0.64271235",
"0.63665813",
"0.633591",
"0.6325891",
"0.62507224",
"0.62497336",
"0.62015235",
"0.61805177",
"0.6152043",
"0.6144992",
"0.61369663",
"0.61330307",
"0.6123447",
"0.61093545",
"0.6081271",
"0.608047",
"0.607569",
"0.599046",
"0.59851915",
"0.598364... | 0.7499407 | 0 |
Calculate average cholesterol of all patients If patient has no cholesterol data, they are ignored | def calculate_avg_cholesterol(self):
total = 0
no_of_valid_patients = 0
for patient in self._patient_list:
try:
total += patient.get_cholesterol_data()[0]
no_of_valid_patients += 1
except AttributeError:
continue
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def averageDominationCount(leaf):\n averageDominationCount = np.nanmean(leaf.calDominationCount())\n return averageDominationCount",
"def calcAverage(dat):\n return sum(dat)/len(dat)",
"def batting_average(df,start_year,end_year,bat_met,player_name):\n\n base_fields = ['H','AB']\n emp_list = che... | [
"0.6298497",
"0.61703765",
"0.603771",
"0.59793043",
"0.5961882",
"0.5876234",
"0.58576447",
"0.58462703",
"0.58457214",
"0.58445007",
"0.58436364",
"0.58422744",
"0.5831334",
"0.57236063",
"0.57181925",
"0.56984377",
"0.5671662",
"0.5671279",
"0.5671279",
"0.56465757",
"0.56... | 0.7487059 | 0 |
Helper to create a Variable stored on CPU memory. | def _variable_on_cpu(name, shape, initializer, trainable = True):
with tf.device('/cpu:0'):
var = tf.get_variable(name, shape, initializer=initializer, trainable = trainable)
return var | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _variable_on_cpu(name, shape, initializer):\n with tf.device('/cpu:0'):\n dtype = tf.float32\n var = tf.get_variable(name, shape, initializer=initializer, dtype=dtype)\n return var",
"def _variable_on_cpu(name, shape, initializer):\n with tf.device('/cpu:0'):\n dtype = tf.float3... | [
"0.6677603",
"0.6677603",
"0.66557324",
"0.6650669",
"0.6561501",
"0.6552209",
"0.6532292",
"0.6519638",
"0.6515672",
"0.6498396",
"0.6447161",
"0.63890946",
"0.6377066",
"0.63579035",
"0.6342367",
"0.6342367",
"0.63155484",
"0.63096213",
"0.62526655",
"0.6182907",
"0.6123600... | 0.66882116 | 0 |
add leaky relu layer | def _add_leaky_relu(hl_tensor, leaky_param):
return tf.maximum(hl_tensor, tf.mul(leaky_param, hl_tensor)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_leaky_relu(g, op, block):\n\n alpha = op.attr(\"alpha\")\n x = g.get_node(op.input(\"X\")[0])\n out = _op.nn.leaky_relu(x, alpha=alpha)\n g.add_node(op.output(\"Out\")[0], out)",
"def make_leaky(net: nn.Module, leak: float = 0.2) -> nn.Module:\n def do_it(m: nn.Module) -> nn.Module:\n ... | [
"0.66270137",
"0.65977484",
"0.658509",
"0.65391964",
"0.6505456",
"0.6469088",
"0.643801",
"0.643752",
"0.6395083",
"0.638309",
"0.6296739",
"0.6291487",
"0.6265566",
"0.6173588",
"0.6151767",
"0.6140381",
"0.61133206",
"0.60983187",
"0.60966843",
"0.5993868",
"0.5982271",
... | 0.6641197 | 0 |
3d average pool layer | def _avg_pool3(x, ksize, strides, name):
pool = tf.nn.avg_pool3d(x, ksize = ksize, strides = strides,
padding = 'VALID', name = name)
return pool | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def avg_pool3d(input, kernel_size, stride=1, padding=0, ceil_mode=False):\n return _pool('AVG', utils._triple, **locals())",
"def avg_pool3d(input, ksize, strides, padding, data_format=\"NDHWC\", name=None): # pylint: disable=redefined-builtin\n with ops.name_scope(name, \"AvgPool3D\", [input]) as name:\n ... | [
"0.71829695",
"0.6880422",
"0.6654039",
"0.66025543",
"0.655478",
"0.6549917",
"0.6522013",
"0.6423354",
"0.6423186",
"0.62474144",
"0.62447995",
"0.61971706",
"0.61574334",
"0.61561435",
"0.61540276",
"0.61267376",
"0.61063224",
"0.61060435",
"0.6097661",
"0.6022569",
"0.598... | 0.7235534 | 0 |
Given a directory path to start, looks for filenames in the directory, and then each parent directory successively, until found. Returns tuple (candidates, path). | def find_candidates_in_parent_dirs(filenames, path):
candidates = [filename for filename in filenames
if os.path.exists(os.path.join(path, filename))]
if not candidates:
parent_dir = os.path.join(path, '..')
if os.path.abspath(parent_dir) != os.path.abspath(path):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_folder(startpath, folder_name, first_occurrence=False):\n candidates = []\n for root, dirs, files in os.walk(startpath):\n for d in dirs:\n if d == folder_name.strip('/'):\n if first_occurrence:\n candidates.append(os.path.abspath(root + '/' + d))\... | [
"0.6888166",
"0.6649314",
"0.654585",
"0.65055346",
"0.63376766",
"0.6318664",
"0.626144",
"0.62060845",
"0.6189229",
"0.6188247",
"0.6138768",
"0.61079556",
"0.60975707",
"0.6085025",
"0.60789895",
"0.60708904",
"0.6052941",
"0.60421807",
"0.60420406",
"0.6041359",
"0.602537... | 0.77151185 | 0 |
Removes any words containing digits like fligh numbers, phone number etc | def remove_flight_numbers(text):
return ' '.join(word for word in text.split() if not any(char.isdigit() for char in word)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_words_digits(text):\n return \" \".join([word for word in str(text).split() if not any(c.isdigit() for c in word) ])",
"def stripword( s ) :\n return re.sub( '[\\W\\d]', '', s )",
"def removeNumbers(self, words):\n\t\treturn re.sub(r'\\d', '', words)",
"def sanitize_text(text):\n return... | [
"0.8487759",
"0.78358305",
"0.775658",
"0.73313",
"0.72857094",
"0.72296715",
"0.7228846",
"0.7227922",
"0.72268903",
"0.71626186",
"0.7154582",
"0.71416676",
"0.71087503",
"0.71003777",
"0.70956796",
"0.70505774",
"0.70334387",
"0.70186734",
"0.7014774",
"0.6977059",
"0.6970... | 0.7885486 | 1 |
pushshift.io's Reddit archives are compressed in different formats over time. Find the correct filename given the date. | def find_reddit_filename(wildcards):
yearmonth = wildcards.year + '-' + wildcards.month
if yearmonth <= '2017-11':
ext = '.bz2'
elif yearmonth <= '2018-10':
ext = '.xz'
else:
ext = '.zst'
return DATA + "/downloaded/reddit/" + yearmonth + ext | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_zip_file_url_for_specific_date(date):\n date_format = date.strftime('%d%m%y')\n return __class__.href_pattern.format(date_format)",
"def get_archive_filename():\r\n today = datetime.date.today()\r\n return str(today)",
"def gen_filename_from_date(path,date,autoincrement = True):\n ... | [
"0.6548199",
"0.6423656",
"0.6148775",
"0.5926651",
"0.59204835",
"0.5764852",
"0.5671795",
"0.5668141",
"0.56277394",
"0.56209695",
"0.5613353",
"0.55873984",
"0.5582913",
"0.55802494",
"0.5544131",
"0.5535669",
"0.551915",
"0.5513528",
"0.5506223",
"0.5499908",
"0.54785347"... | 0.7414133 | 0 |
Get all the sources of word counts we have in a language. | def language_count_sources(lang):
return [
DATA + "/counts/{source}/{lang}.txt".format(source=source, lang=lang)
for source in LANGUAGE_SOURCES[lang]
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multisource_counts_to_merge(multisource, lang):\n result = [\n _count_filename(source, lang)\n for source in MERGED_SOURCES[multisource]\n if lang in SOURCE_LANGUAGES[source]\n ]\n return result",
"def language_text_sources(lang):\n return [\n DATA + \"/tokenized/{sour... | [
"0.6437999",
"0.6354548",
"0.59641296",
"0.5802575",
"0.5790304",
"0.5753598",
"0.5729502",
"0.5714558",
"0.56884634",
"0.5630879",
"0.5625249",
"0.5615212",
"0.5581965",
"0.5549736",
"0.5501632",
"0.54856443",
"0.5466191",
"0.54459345",
"0.5438521",
"0.54131645",
"0.5384228"... | 0.7888476 | 0 |
Get all the sources of tokenized text we have in a language. | def language_text_sources(lang):
return [
DATA + "/tokenized/{source}/{lang}.txt".format(source=source, lang=lang)
for source in LANGUAGE_SOURCES[lang]
if source in FULL_TEXT_SOURCES
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_languages(self):\r\n \r\n # tokenize, clean and filter document tokens \r\n toks = [re.sub(r'[^a-zA-Z]','', tok.text.lower().strip()) for tok in self.doc]\r\n toks = [tok for tok in toks if len(tok)>1 and tok in LANGUAGES]\r\n toks = sorted(set(toks))\r\n ... | [
"0.6808751",
"0.6602341",
"0.65438026",
"0.6541259",
"0.6345355",
"0.6345355",
"0.62279546",
"0.61624664",
"0.6071694",
"0.6071694",
"0.6071694",
"0.6071694",
"0.60606",
"0.6059048",
"0.5987303",
"0.59685606",
"0.593609",
"0.5931265",
"0.5897387",
"0.58759075",
"0.5802738",
... | 0.79785043 | 0 |
Given a multisource name like 'news' and a language code, find which sources of counts should be merged to produce it. | def multisource_counts_to_merge(multisource, lang):
result = [
_count_filename(source, lang)
for source in MERGED_SOURCES[multisource]
if lang in SOURCE_LANGUAGES[source]
]
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def language_count_sources(lang):\n return [\n DATA + \"/counts/{source}/{lang}.txt\".format(source=source, lang=lang)\n for source in LANGUAGE_SOURCES[lang]\n ]",
"def sources(source):\n\n source2 = models.Source(name=u\"Bob's Funerals.com\", url=u\"http://www.bobsfunerals.com\")\n sou... | [
"0.6476298",
"0.5664169",
"0.54164404",
"0.5403179",
"0.5313563",
"0.51924914",
"0.5011071",
"0.49869028",
"0.49731225",
"0.49561828",
"0.4951889",
"0.49437946",
"0.49339575",
"0.49018767",
"0.4884029",
"0.48553824",
"0.4843885",
"0.48337176",
"0.4828485",
"0.48259106",
"0.48... | 0.76582414 | 0 |
Given a language code in ParaCrawl, we find the "paired" file that contains monolingual tokenized data from that language. ParaCrawl is parallel data, so its input files refer to language pairs. In practice, each language pair is English and a nonEnglish language. So the result for most languages is that they are paire... | def paracrawl_language_pair_source(lang):
if lang == 'en':
other = 'fr'
else:
other = 'en'
lang1, lang2 = sorted([lang, other])
langpair = '{}_{}'.format(lang1, lang2)
return DATA + "/tokenized/paracrawl-paired/{langpair}.{lang}.txt".format(langpair=langpair, lang=lang) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translationText(language, listOfWords):\n txt = open(language+\".txt\", mode=\"r\").readlines()\n translatedWords = []\n for word in listOfWords:\n for line in txt:\n if line.split()[0] == word:\n translatedWords.append(line.split()[1])\n return translatedWords",
... | [
"0.55892974",
"0.5528118",
"0.5515096",
"0.54099923",
"0.5397135",
"0.537212",
"0.5364681",
"0.53629816",
"0.5347864",
"0.5310293",
"0.52782893",
"0.5263946",
"0.5245933",
"0.52381843",
"0.5238012",
"0.5229207",
"0.52261126",
"0.5188704",
"0.518311",
"0.51773405",
"0.5173565"... | 0.76984686 | 0 |
Get trigger by trigger id and start git workflow associated. | def trigger_workflow(self, trigger_id, commit_sha='',
status_url=None, collab_url=None):
# Note: self.context will be None at this point as this is a
# non-authenticated request.
db_obj = objects.registry.Assembly.get_by_trigger_id(None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_trigger_by_id(self, trigger_id):\n return self.triggers[trigger_id]",
"def fetch_by_id(self, trigger_id):\n result = self._client.get(self._full_path(trigger_id + '/state'))\n if 'state' in result:\n trigger = self._client.get(self._full_path(trigger_id))\n retu... | [
"0.6945729",
"0.62667257",
"0.5965356",
"0.5943977",
"0.5858999",
"0.5767159",
"0.5696369",
"0.56085205",
"0.55933714",
"0.55431855",
"0.5526502",
"0.5483214",
"0.54804486",
"0.5407957",
"0.5399822",
"0.53422755",
"0.5314913",
"0.5291426",
"0.5261431",
"0.51868975",
"0.512513... | 0.6352503 | 1 |
Return all assemblies, based on the query provided. | def get_all(self):
return objects.registry.AssemblyList.get_all(self.context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def package_all(q):\n\n query = (q.dict_of_lists())[\"q\"][0]\n datasets = p.toolkit.get_action(\"package_search\")(\n {}, data_dict={\"q\": query, \"include_private\": True}\n )\n\n result = datasets[\"results\"]\n results = []\n for res in result:\n results.append(res)\n return... | [
"0.59221876",
"0.57674015",
"0.55610645",
"0.55106276",
"0.5507275",
"0.54957044",
"0.5429782",
"0.5363507",
"0.5353214",
"0.5123019",
"0.50999445",
"0.5084327",
"0.5032342",
"0.50054187",
"0.50022805",
"0.49877578",
"0.49617597",
"0.49112418",
"0.48922423",
"0.48880613",
"0.... | 0.64414144 | 0 |
Returns True iff a chatter can be activated on the model's form views, i.e. if it is a custom model (since we can make it inherit from mail.thread), or it already inherits from mail.thread. | def is_chatter_allowed(self, model):
Model = request.env[model]
return Model._custom or isinstance(Model, type(request.env['mail.thread'])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_view_permissions(self, obj):\n queryset = self.model.objects.filter(pk=obj.pk)\n if hasattr(queryset, 'has_view_permissions'):\n return queryset.has_view_permissions( PyFormsMiddleware.user() )\n else:\n return True",
"def uses_usercase(self):\n return a... | [
"0.6115297",
"0.5955316",
"0.5916017",
"0.58894145",
"0.57932717",
"0.57909715",
"0.5783127",
"0.5749649",
"0.5746116",
"0.57435966",
"0.57211596",
"0.56949604",
"0.56927466",
"0.56890917",
"0.56578463",
"0.56559616",
"0.559266",
"0.559266",
"0.559266",
"0.55788153",
"0.55685... | 0.7348025 | 0 |
Open a view for translating the field(s) of the record (model, id). | def _get_studio_action_translations(self, model, **kwargs):
domain = ['|', ('name', '=', model.model), ('name', 'ilike', model.model + ',')]
# search view + its inheritancies
views = request.env['ir.ui.view'].search([('model', '=', model.model)])
domain = ['|', '&', ('name', '=', 'ir.ui... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_migrate_view_fields(self):\n self.test_view = RecordView.create(\n self.testcoll, test_view_id, test_view_create_values\n )\n migrate_coll_data(self.testcoll)\n # Read field definition and check for inline field list\n view_data = self.check_entity_values(... | [
"0.5074276",
"0.50698423",
"0.5038963",
"0.5035691",
"0.50303924",
"0.50299984",
"0.5016612",
"0.49554166",
"0.4932844",
"0.49023816",
"0.48956478",
"0.48940113",
"0.48839295",
"0.48726508",
"0.48695204",
"0.4864835",
"0.4864338",
"0.48637855",
"0.4852656",
"0.4843753",
"0.48... | 0.5943181 | 0 |
Create a new menu , linked to a new action associated to the model_id | def create_new_menu(self, name, model_id, is_app=False, parent_id=None, icon=None):
# create the action
model = request.env['ir.model'].browse(model_id)
new_action = request.env['ir.actions.act_window'].create({
'name': name,
'res_model': model.model,
'help': ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_menu():",
"def create_menus( self ):",
"def restaurantMenuItemNew(restaurant_id):\n try:\n restaurant = session.query(Restaurant).filter_by(id=restaurant_id).one()\n if request.method == 'POST':\n if request.form['name']:\n newItem = MenuItem(name=request.f... | [
"0.6816038",
"0.66699916",
"0.65619886",
"0.62834644",
"0.6270374",
"0.62515026",
"0.61413074",
"0.6103415",
"0.6014899",
"0.5994546",
"0.5990907",
"0.5984991",
"0.5979235",
"0.5972948",
"0.5971281",
"0.5969421",
"0.5925181",
"0.5908922",
"0.5885741",
"0.5874071",
"0.5808455"... | 0.7331614 | 0 |
Exports a zip file containing the 'studio_customization' module gathering all customizations done with Studio (customizations of existing apps and freshly created apps). | def export(self, token):
studio_module = request.env['ir.module.module'].get_studio_module()
data = request.env['ir.model.data'].search([('studio', '=', True)])
content = export.generate_archive(studio_module, data)
return request.make_response(content, headers=[
('Content-D... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_configurations():\n pass",
"def build_package_includes(self):\n location = self.options['location']\n sitezcml_path = os.path.join(location, 'etc', 'site.zcml')\n zcml = self.options.get('zcml')\n site_zcml = self.options.get('site-zcml')\n additional_zcml = self.... | [
"0.54642105",
"0.5087354",
"0.49709123",
"0.49552384",
"0.49165198",
"0.48934224",
"0.48820457",
"0.487595",
"0.47681433",
"0.47274783",
"0.47087747",
"0.46943507",
"0.4635901",
"0.46243486",
"0.4618999",
"0.46112907",
"0.4579613",
"0.45660037",
"0.4562099",
"0.4551834",
"0.4... | 0.65367186 | 0 |
Ecrit le nom dans self._nom. | def _set_nom(self, nouveau_nom):
self._nom = nouveau_nom | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nom(self):\n return self._nom",
"def nome(self):\n\n return self.__nome",
"def nombre(self) -> str:\n return self._nombre",
"def __str__(self):\n return self.nom",
"def __str__(self):\n return self.nom",
"def __str__(self):\n return self.nom",
"def __st... | [
"0.77840674",
"0.7456993",
"0.7332514",
"0.72257555",
"0.72257555",
"0.72257555",
"0.72257555",
"0.72257555",
"0.7148263",
"0.70737576",
"0.7070422",
"0.68932337",
"0.68317574",
"0.6826248",
"0.6705802",
"0.6662138",
"0.6648886",
"0.66418374",
"0.66198313",
"0.66132355",
"0.6... | 0.7776664 | 1 |
Fait gagner de l'XP au personnage. | def gagner_xp(self, niveau=None, xp=0, retour=True):
ancien_niveau = self.niveau
res = Personnage.gagner_xp(self, niveau, xp, retour)
importeur.hook["pnj:gagner_xp"].executer(self, niveau, xp, retour)
if self.niveau > ancien_niveau:
importeur.hook["pnj:gagner_niveau"].execute... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_xp(self):\n pass",
"def get_X_gcn(self, p):\n\n if p == 0:\n return preprocess_feature(self.X)\n else:\n return preprocess_feature(self._get_X_rdm(p))\n\n return rdm_feature(self.X, percent=p)",
"def x(self):\n pass",
"def g(self):\n ... | [
"0.6880218",
"0.56909996",
"0.56083816",
"0.5560952",
"0.55240375",
"0.5451451",
"0.5436478",
"0.54063666",
"0.5388223",
"0.53876704",
"0.5383432",
"0.53684527",
"0.5349016",
"0.5337466",
"0.5316359",
"0.5309959",
"0.53087145",
"0.5276371",
"0.5268031",
"0.52416223",
"0.52393... | 0.7363098 | 0 |
Le personnage self vient de tuer la victime. | def tuer(self, victime):
self.script["tue"].executer(personnage=victime, pnj=self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wall_time(self):",
"def _self_time(self):\r\n return self.duration() - sum([child.duration() for child in self.children])",
"def verif_victoire(self):\n\n if self._mot_en_cours == self._mot_a_trouver :\n return True\n else :\n return False",
"def getlife(self):\n ... | [
"0.5980434",
"0.58657086",
"0.57679105",
"0.5758027",
"0.5736961",
"0.5723264",
"0.5660789",
"0.5651134",
"0.5624631",
"0.5586687",
"0.55453277",
"0.55258965",
"0.5510504",
"0.55059576",
"0.55057245",
"0.54876184",
"0.54848033",
"0.54786915",
"0.54726285",
"0.5472027",
"0.545... | 0.6620466 | 0 |
Retourne True si le personnage est noyable, False sinon. | def noyable(self):
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __bool__(self):\n return self.__nonzero__()",
"def __nonzero__(self):\r\n return bool(assert_(self.obj, 'not %r' % self.obj))",
"def is_donor(self):\n return True",
"def __bool__(self):\n return self is TRUE",
"def __bool__(self):\n return not self.undefine",
"def _... | [
"0.6540811",
"0.65173805",
"0.6504292",
"0.6462654",
"0.6444503",
"0.64119697",
"0.635402",
"0.63263655",
"0.6298532",
"0.6295683",
"0.6285922",
"0.6284034",
"0.6282235",
"0.6278732",
"0.6273903",
"0.6253428",
"0.62380856",
"0.6231243",
"0.6231243",
"0.6210731",
"0.6136528",
... | 0.7022764 | 0 |
Accept reject sample from a probability distribution. | def accept_reject_sample(prob: Callable, n: int, limits: Space,
sample_and_weights_factory: Callable = UniformSampleAndWeights,
dtype=ztypes.float, prob_max: Union[None, int] = None,
efficiency_estimation: float = 1.0) -> tf.Tensor:
multiple... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prob_choice(p):\n \n return np.random.random_sample() < p",
"def AcceptOrReject(gamma):\n \n u = np.random.rand()\n if(u<gamma):\n return True\n else:\n return False",
"def sample(self, probability):\n return random.uniform(0, 1) < probability",
"def accept_sample(s... | [
"0.6598452",
"0.6459912",
"0.64536774",
"0.62979674",
"0.62703514",
"0.62582386",
"0.6248497",
"0.6233459",
"0.6233459",
"0.6225764",
"0.6088742",
"0.6076565",
"0.6037616",
"0.60076493",
"0.5997924",
"0.59746337",
"0.59586716",
"0.5936798",
"0.5931008",
"0.5904506",
"0.589437... | 0.667795 | 0 |
Return all extended pdfs that are daughters. | def extract_extended_pdfs(pdfs: Union[Iterable[ZfitPDF], ZfitPDF]) -> List[ZfitPDF]:
from ..models.functor import BaseFunctor
pdfs = convert_to_container(pdfs)
indep_pdfs = []
for pdf in pdfs:
if not pdf.is_extended:
continue
elif isinstance(pdf, BaseFunctor):
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_pdfs():\n\n return filter(lambda f: fnmatch.fnmatch(f, '*.pdf'), os.listdir(cwd))",
"def get_all_pdf(soup):\n \n list_to_update = []\n report = soup.find_all('div', class_='mb-4 clearfix')\n \n for a in report[0].find_all('a', href=True):\n sub_link = a['href']\n if 'i... | [
"0.61845917",
"0.54050064",
"0.5381452",
"0.5359397",
"0.5254018",
"0.5156865",
"0.5090544",
"0.50889254",
"0.50726396",
"0.49876747",
"0.49808538",
"0.49773595",
"0.49442625",
"0.49054474",
"0.48585248",
"0.4848331",
"0.48360482",
"0.48286647",
"0.48228446",
"0.47927624",
"0... | 0.6680698 | 0 |
Create a sample from extended pdfs by sampling poissonian using the yield. | def extended_sampling(pdfs: Union[Iterable[ZfitPDF], ZfitPDF], limits: Space) -> tf.Tensor:
samples = []
pdfs = convert_to_container(pdfs)
pdfs = extract_extended_pdfs(pdfs)
for pdf in pdfs:
n = tf.random.poisson(lam=pdf.get_yield(), shape=(), dtype=ztypes.float)
sample = pdf._single_ho... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rfd_poisson(ps,n):\n lam = sum(ps)\n G = len(ps)\n sample_q = lambda:nprandom.poisson(lam) # chromosomal occupancy approximately poisson.\n sampler = make_sampler(ps)\n return [direct_sampling_ps(ps,sample_q(),sampler) for i in xrange(n)]",
"def convert_to_poisson(dp):\n return np.random.po... | [
"0.5982566",
"0.5851933",
"0.5837932",
"0.5833508",
"0.5780479",
"0.56297106",
"0.5479673",
"0.5455545",
"0.5449404",
"0.53448313",
"0.5339353",
"0.5321194",
"0.5309528",
"0.53024966",
"0.5299598",
"0.5280745",
"0.5277724",
"0.5273923",
"0.5273923",
"0.52673286",
"0.52652013"... | 0.6336474 | 0 |
Find all the subscribers in the SuggestBot database for the current language version of Wikipedia, check if any of them are due up for receiving suggestions, and then post suggestions to their user talk page (or userspace subpage if that is set). | def post_suggestions(self):
# today is?
# Note: We use UTC as the basis for our calculations, because
# the Wikipedia API also returns timestamps as UTC, thus allowing
# us to correctly post suggestions to new subscribers who saw
# SuggestBot post to their user talk page earlier... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_instant_notification_subscribers(\n self,\n potential_subscribers = None,\n mentioned_users = None,\n exclude_list = None,\n ):\n #print '-----------... | [
"0.5789807",
"0.5548012",
"0.5399799",
"0.5373434",
"0.5297016",
"0.5262745",
"0.5190848",
"0.5156757",
"0.5143706",
"0.5134736",
"0.51071465",
"0.50839084",
"0.50619185",
"0.5059515",
"0.49956036",
"0.495569",
"0.491617",
"0.49068686",
"0.49051824",
"0.4902548",
"0.48760507"... | 0.7172281 | 0 |
Mapper to convert json row into a row with only comments and caption in string formats | def mapRow(row):
commentsRow = row.comments
captionRow = row.caption
comments = commentsRow.data # select comments
textComments = " ".join([x.text for x in comments]) # remove metadata from comments
if hasattr(captionRow, "edges"):
captions = captionRow.edges
textCaptions = " ".joi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_wiki_row(row):\n out = row.copy()\n # Split comma separated fields\n out['aliases'] = row['aliases'].split(',')\n out['descriptions'] = row['descriptions'].split(',')\n # Convert JSON string to dict\n out['claims'] = json.loads(row['claims'])\n return out",
"def __data_row_to_jso... | [
"0.65076196",
"0.6053189",
"0.5902629",
"0.57102025",
"0.57087696",
"0.5598717",
"0.5575147",
"0.55525213",
"0.55045193",
"0.54885995",
"0.5486372",
"0.53834856",
"0.53592014",
"0.533789",
"0.52786314",
"0.5270643",
"0.52492356",
"0.5215063",
"0.5192689",
"0.5192689",
"0.5163... | 0.73029524 | 0 |
Writes the processed RDD to output file | def writeToFile(rdd, parallelized, output, user, format, features):
fileEnd = "." + format
output_path = output + "/ig/" + user + "/" + user + fileEnd
if parallelized:
rdd.saveAsTextFile(output_path)
else:
arr = np.array(rdd.collect())
if not os.path.exists(os.path.dirname(output... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def beginFileOutput(self):\n self._outputFilepath = self.dataSet[self._outputFileLabel]\n self._outputFile = open(self._outputFilepath, 'w')",
"def writeto(self, fileout):\n \n dump_pkl(self.data, fileout)",
"def __export_file(self, filename, output):\n outfile = open(filenam... | [
"0.63989294",
"0.63781404",
"0.63742775",
"0.63496083",
"0.63116854",
"0.627859",
"0.627706",
"0.6234401",
"0.6204154",
"0.62020314",
"0.61875045",
"0.6172294",
"0.61649185",
"0.6143975",
"0.61350286",
"0.60889685",
"0.60889685",
"0.6072765",
"0.60644495",
"0.6057928",
"0.603... | 0.79359454 | 0 |
Cleans the output directory to make room for new outputs | def cleanOutputDir(output):
if os.path.exists(output) and os.path.isdir(output):
shutil.rmtree(output) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def devclean():\n click.echo(\"start clean your output folder...\")\n rm(OUTPUTDIR, recursive=True)",
"def clear_local_output_directory():\n output_path = '../output/*'\n files = glob.glob(output_path)\n for single_file in files:\n os.remove(single_file)",
"def clean_folde... | [
"0.8009365",
"0.78965557",
"0.77991366",
"0.7785498",
"0.77021986",
"0.75034577",
"0.7468919",
"0.7352185",
"0.7345541",
"0.73332447",
"0.7230946",
"0.7224569",
"0.72211844",
"0.7177135",
"0.7118948",
"0.71054673",
"0.7068527",
"0.70609295",
"0.70411116",
"0.70172423",
"0.699... | 0.81068283 | 0 |
Appends corpus files for all users to a single corpus file | def append_corpus(output):
files = []
output_path = output + "/ig/" + "ig_corpus.txt"
for root, directories, filenames in os.walk(output + "/ig/"):
for filename in filenames:
files.append(os.path.join(root, filename))
corpusfiles = filter(lambda x: ".txt" in x, files)
if not os.p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_corpus_to_file(output_file, corpus): \n \n file = open(output_file, 'w')\n for line in corpus: \n file.write(line)\n print ('Corpus has been writted in file')\n file.close()",
"def combine_documents(path=os.path.join(os.curdir, \"data/processed\"), name='corpus.txt'):\n outn... | [
"0.64785516",
"0.6462951",
"0.634865",
"0.6262649",
"0.611011",
"0.60758895",
"0.60436034",
"0.60298586",
"0.59843755",
"0.5975818",
"0.59066856",
"0.5899971",
"0.5875928",
"0.58434993",
"0.58300185",
"0.5774058",
"0.57641536",
"0.5749405",
"0.5739908",
"0.56826246",
"0.56734... | 0.7422377 | 0 |
Computes some basic statistics about the output corpus | def corpora_stats(output):
igFiles = []
for root, directories, filenames in os.walk(output + "/ig/"):
for filename in filenames:
igFiles.append(os.path.join(root, filename))
igFiles = filter(lambda x: ".txt" in x, igFiles)
words = []
for file in igFiles:
fileH = open(file... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def corpus_statistics(corpus, d_corp):\n print('There are {} types of a total of {} tokens in the corpus.\\n' .format(number_types(corpus), corpus_length(corpus)))\n print('There average token length is {}.\\n' .format(average_length(corpus)))\n print('The longest token is {}.\\n' .format(longest_token(co... | [
"0.75794345",
"0.7495605",
"0.73669267",
"0.6809367",
"0.6783773",
"0.6437376",
"0.63469523",
"0.6233378",
"0.6222066",
"0.619572",
"0.6162007",
"0.6081259",
"0.60806775",
"0.6079064",
"0.6075563",
"0.6050363",
"0.6045781",
"0.59997946",
"0.5998121",
"0.59935886",
"0.5982539"... | 0.7527568 | 1 |
Main function, orchestrates the pipeline. Creates the spark context, parses arguments, and parses all users. | def main():
sc = pyspark.SparkContext(conf=sparkConf())
sql = pyspark.SQLContext(sc)
args = parse_args()
cleanOutputDir(args.output)
users = os.listdir(args.input)
map(lambda user: parseUser(user, args, sql, args.partitions), users)
corpora_stats(args.output)
append_corpus(args.output) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cli():\n # Configuration\n AppConfig()\n\n # Parse the cli arguments\n parser = argparse.ArgumentParser()\n parser.add_argument('standard_data_path', help='path to the standard data directory')\n parser.add_argument('queue', help='job queue')\n parser.add_argument('--app-name', help='spark... | [
"0.66675025",
"0.653914",
"0.64703673",
"0.6123042",
"0.61154336",
"0.6108758",
"0.60041773",
"0.5920403",
"0.5776751",
"0.5748296",
"0.57471836",
"0.57071954",
"0.5682872",
"0.5638785",
"0.56291026",
"0.5625207",
"0.5623799",
"0.56191224",
"0.56022197",
"0.5595379",
"0.55856... | 0.72176826 | 0 |
Checks if a session exists for the given sender id, else create a new one | def find_session(sender_id):
session = db.sessions.find_one({'sender_id': sender_id})
if session is None:
session_id = str(uuid.uuid4())
db.sessions.insert_one({'createdAt': datetime.datetime.utcnow(), 'sender_id': sender_id, 'session_id': session_id})
else:
session_id = session[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_session(self):\n body = yield from self._fetch_json(URL_LOGIN, self._new_session_data)\n self.sma_sid = jmespath.search('result.sid', body)\n if self.sma_sid:\n return True\n\n msg = 'Could not start session, %s, got {}'.format(body)\n\n if body.get('err'):\n ... | [
"0.61570853",
"0.58773726",
"0.58149797",
"0.56339175",
"0.56324416",
"0.5605456",
"0.5528951",
"0.5513518",
"0.54047126",
"0.5401269",
"0.53964466",
"0.53947234",
"0.5350365",
"0.53205097",
"0.53166515",
"0.5314262",
"0.5306703",
"0.52829957",
"0.52487093",
"0.52188724",
"0.... | 0.7605206 | 0 |
Concatenates all messages in the session | def concatenate_session(session_id):
conversation = ""
for msg in db.messages.find({'session_id': session_id}):
conversation += (msg['message'] + "\n")
return conversation | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_message(): \n return \"<br>\".join(messages)",
"def consolidate_messages(self, msg):",
"def send_messages(messages):\n while messages:\n msg = messages.pop()\n sent_messages.append(msg)",
"def merge_messages(self, msg_list):\n return self.recv_instance.empty_msg.join(... | [
"0.6577893",
"0.64629614",
"0.626432",
"0.6199823",
"0.61209255",
"0.60572773",
"0.59363085",
"0.57713807",
"0.57195944",
"0.5715277",
"0.5674186",
"0.56590617",
"0.565153",
"0.55473465",
"0.55473465",
"0.55084664",
"0.5491512",
"0.5487544",
"0.5470719",
"0.5464526",
"0.54533... | 0.7290832 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.