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
Edit rules Edit the rules that process inbound events
def edit_rules(): my_rules = rules.get_all_rules() my_rules.append(DEFAULT_RULE) selected_rule_id = select( label="Existing rules", options=[{"label": rule["name"], "value": rule["id"]} for rule in my_rules], ) # Rules have unique IDs from the database: logging.info(f"selected_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_rules():\n update_all_rules()\n return \"OK\"", "def edit_ongoing_rule():\n rules = request.json['rules']\n now = datetime.datetime.now()\n\n for rule in rules:\n rule['line_id'] = int(rule['line_id'])\n rule['time'] = convert_to_datetime(rule['time'])\n rule['inter...
[ "0.68029857", "0.6289704", "0.61724335", "0.60976857", "0.608838", "0.60482955", "0.60210454", "0.60100615", "0.5890595", "0.58173704", "0.57617265", "0.57586634", "0.5667582", "0.55736524", "0.5569121", "0.5536796", "0.5503093", "0.5500226", "0.5476203", "0.546313", "0.54610...
0.6884661
0
Start as many threads as ordered (provided by variable self.aOT). Also stores all threads in self.threads, so they can be stopped later as well.
def startWorkers(self): for i in range(self.aOT): t = thr.Thread(target=self.threadWorker) t.start() self.threads.append(t)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_threads(self):\r\n assert len(self.all_threads) > 0\r\n for thread in self.all_threads:\r\n thread.start()", "def start_workers(self):\n\n for thread in self.threads:\n thread.start()", "def create_and_start_threads(self):\r\n self.create_threads()\r\...
[ "0.7633587", "0.73176336", "0.72925687", "0.68801624", "0.68801624", "0.6800484", "0.67321104", "0.6644174", "0.6644174", "0.6593679", "0.65704525", "0.63864803", "0.6262484", "0.62089807", "0.6177471", "0.6156482", "0.61107695", "0.6069611", "0.6052761", "0.60488874", "0.602...
0.793661
0
Stem all the words in a given question.
def stemQuestion(self, question): stemmedquestion = [] for word in str(question).split(): if word not in self.wordsFilter: stemmedquestion.append(stem(word.lower())) return stemmedquestion
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stem_words(self, words):\n return self.stemmer.stemWords(words)", "def stemWords(self, words):\n\t\tif stemmer == \"lancaster\":\n\t\t\tstemmer = LancasterStemmer()\n\t\telif stemmer == \"snowbal\":\n\t\t\tstemmer = SnowballStemmer()\n\t\telif stemmer == \"porter\":\n\t\t\tstemmer = PorterStemmer()\n\...
[ "0.7243619", "0.7022568", "0.6754073", "0.6657073", "0.66218907", "0.66076064", "0.6532568", "0.6519146", "0.65048206", "0.6432638", "0.63969696", "0.6363052", "0.6363052", "0.6363052", "0.6363052", "0.6363052", "0.6288727", "0.6284742", "0.6284742", "0.6257301", "0.6246726",...
0.8044658
0
Create new problem entries in database from yml document stream. Can create a yml file with individual problems delimited into documents using the `` ... `` document stream syntax.
def bulk_create_problem_yml(self, path): with open(path, "r") as f: obj_all = yaml.load_all(f) for obj in obj_all: self.create_problem(**obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_problem_yml(self, path):\n with open(path, \"r\") as f:\n obj = yaml.load(f)\n\n self.create_problem(**obj)", "def create_problem_yaml(sbml_files: Union[str, List[str]],\n condition_files: Union[str, List[str]],\n measurement_files...
[ "0.61997813", "0.5509375", "0.5250607", "0.5211746", "0.51627785", "0.5148468", "0.50572896", "0.5039478", "0.5036629", "0.5018428", "0.4979809", "0.49567744", "0.49291268", "0.4919583", "0.48977384", "0.4887273", "0.4854094", "0.48412806", "0.4833363", "0.48256907", "0.48174...
0.65926623
0
Create new problem entry in database from yml file.
def create_problem_yml(self, path): with open(path, "r") as f: obj = yaml.load(f) self.create_problem(**obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bulk_create_problem_yml(self, path):\n with open(path, \"r\") as f:\n obj_all = yaml.load_all(f)\n for obj in obj_all:\n self.create_problem(**obj)", "def create_problem():\n # Admin check\n if not current_user.admin == 1:\n return serve_error('You mus...
[ "0.6484389", "0.6370863", "0.59666836", "0.5927601", "0.58917224", "0.5867778", "0.5842167", "0.58306783", "0.5819347", "0.5805411", "0.578956", "0.57660884", "0.56141496", "0.55846286", "0.5555678", "0.5531445", "0.5467168", "0.5451255", "0.5420608", "0.54112333", "0.5397463...
0.6735829
0
Return a list of problems in the database.
def get_problems(self): with self.__orm.session_scope() as session: try: problems = session.query(Problem.name).all() return [problem[0] for problem in problems] except NoResultFound: return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_problems():\n problems = list()\n solved = database.session.query(Submission).\\\n filter(Submission.username == current_user.username).\\\n filter(Submission.result == \"good\").\\\n all()\n solved_set = set()\n for solve in solved:\n solved_set.add(solv...
[ "0.69904286", "0.689693", "0.6717712", "0.6546775", "0.6248936", "0.61356276", "0.60820484", "0.6078774", "0.6023992", "0.5908121", "0.58521813", "0.5791114", "0.5778342", "0.5670173", "0.5617919", "0.5605232", "0.5605232", "0.5576442", "0.5553699", "0.5512389", "0.5427262", ...
0.7453994
0
Load dataset for given problem with given split.
def load_dataset(self, problem_name="", split="train"): orm = self.__orm username = "admin" # should be unused (unless submit new feature to db) with orm.session_scope() as session: if not problem_name: problem_name = session.query(Problem.name)\ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(self,split='train'):\n raise ValueError('Please implement me!')", "def load_data(self,split='train'):\n raise NotImplementedError", "def load_dataset(self, split='train'):\n path = self.args.data\n if not os.path.exists(path):\n raise FileNotFoundError(\n ...
[ "0.7480053", "0.747074", "0.720558", "0.7184102", "0.70533544", "0.6940336", "0.6938759", "0.69116545", "0.68739456", "0.68407923", "0.67328703", "0.6732657", "0.65436804", "0.648422", "0.6478639", "0.6476277", "0.64601445", "0.64307505", "0.63974446", "0.6391252", "0.6303175...
0.8008399
0
Get an approximated position of a vehicle at any point of time
def approximate_position(self, at_time: int) -> BasePosition: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPosition(self, cur_time=timezone.now()):\n # Get waypoints\n if hasattr(self, 'preprocessed_waypoints'):\n waypoints = self.preprocessed_waypoints\n else:\n # Load waypoints for obstacle, filter for consecutive duplicates\n all_wpts = self.waypoints.orde...
[ "0.6508476", "0.63860726", "0.636147", "0.62651974", "0.60823756", "0.59323627", "0.58962876", "0.58249325", "0.57726777", "0.577182", "0.5729244", "0.57171816", "0.56941193", "0.5686298", "0.5661377", "0.5648338", "0.56362337", "0.56322366", "0.5613614", "0.56059855", "0.556...
0.6622119
0
Distance traveled from the original position to an approximate position of a cetrain point of time
def traveled_distance(self, at_time: int) -> float: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ecliptic_position(self):\n vector = _ECLIPJ2000.dot(self.position.au)\n return Distance(vector)", "def euclidean_distance(self,):\n return sqrt(pow((self.pose1.x - self.pose2.x), 2) +\n pow((self.pose1.y - self.pose2.y), 2))", "def _calc_distance(self, checkpoint_loc...
[ "0.6589855", "0.64031625", "0.63883924", "0.6278429", "0.6271049", "0.6252697", "0.62145644", "0.6183875", "0.61374414", "0.6134414", "0.609672", "0.6093841", "0.60573226", "0.6027986", "0.6027986", "0.6016954", "0.5998085", "0.5989928", "0.59836787", "0.59779924", "0.5970454...
0.65310526
1
Return the LaTeX special characters and a corresponding error string
def forbidden_latex_chars(): tex_char = ['\\', '{', '}', '&', '[', ']', '^', '~'] chars = ', '.join(['"{char}"'.format(char=char) for char in tex_char]) message = _(u"Următoarele caractere sunt interzise și trebuie scoase : {chars}.".format(chars=chars)) return tex_char, message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escape_latex_characters(line):\n line = line.replace('\\\\', '\\\\textbackslash')\n line = line.replace('&', '\\&')\n line = line.replace('%', '\\%')\n line = line.replace('$', '\\$')\n line = line.replace('#', '\\#')\n line = line.replace('_', '\\_')\n line = line.replace('{', '\\{')\n ...
[ "0.62524474", "0.6218479", "0.61760634", "0.6106915", "0.60790557", "0.59577155", "0.5891351", "0.58853215", "0.58652323", "0.5775055", "0.5732504", "0.5689707", "0.5683134", "0.5635726", "0.56353235", "0.5581285", "0.55806285", "0.55648124", "0.5557515", "0.5553885", "0.5547...
0.75179136
0
Function used to get player and data for games between the start and end date range
def get_player_team_data(self, start_date, end_date = None, get_player_data_ind = True, get_team_data_ind = True, pre_player_data_dir = None, pre_team_data_dir = None): #Converts start and end date from string to datetime start_date = datetime....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_player_data(\n start_date: str = f\"{EARLIEST_SEASON_WITH_EXTENSIVE_PLAYER_STATS}-01-01\",\n end_date: str = str(date.today()),\n verbose: int = 1,\n) -> List[Dict[str, Any]]:\n if verbose == 1:\n print(\n f\"Fetching player data from between {start_date} and {end_date} \"\n...
[ "0.7217022", "0.65925366", "0.65881795", "0.65571594", "0.6556971", "0.64844286", "0.6317446", "0.6163747", "0.6094667", "0.60902554", "0.6062693", "0.60613227", "0.60085285", "0.5928634", "0.5907967", "0.5881291", "0.5858981", "0.5852907", "0.5847442", "0.5840196", "0.582685...
0.7116889
1
> (str) full name of the field with the name of the table included. i.e. the field |bar| in a table |foo| returns 'foo.bar'
def name(self): if self.table: return "{}.{}".format(self.table, self.field_name) return self.field_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def namehack(field):\n if field.endswith((\"attribute\", \"views\")):\n return field + \"__name\"\n else:\n return field", "def get_related_name(self, field=None):\n related_name = self.subrecord.__name__.lower()\n if field:\n related_name = \"{0}__{1}\".format(relate...
[ "0.69205326", "0.6881168", "0.6826993", "0.6584583", "0.65795636", "0.65795636", "0.6551517", "0.6536231", "0.65072536", "0.63897425", "0.63614273", "0.6269764", "0.6268629", "0.6237498", "0.62347585", "0.62013537", "0.6199085", "0.6191742", "0.61680526", "0.6143412", "0.6133...
0.77557653
0
Sends current value of drop down file list to get_file() and saves contents to events variable.
def send_file_name(): if value.get() == "----------------------": messagebox.showinfo("Choose File", "Please choose a file to edit.", parent=app_frame) return elif len(entries) != 0: messagebox.showinfo("Warning!", "You must first close the current file!", parent=app_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_file(self):\n pass", "def receiveFileFromDialog(self, paths):\n self.filesList.filesStartedLoading.emit(False)\n for p in paths:\n self.filesList.registerFile(None, QtCore.QString(p))\n self.filesList.filesFinishedLoading.emit(True)", "def selectFiles(self):\n\n...
[ "0.6390715", "0.624644", "0.6072101", "0.601609", "0.59868085", "0.5983324", "0.59812456", "0.596189", "0.59615093", "0.59475327", "0.5873696", "0.58421177", "0.5780616", "0.57759833", "0.5753058", "0.5729331", "0.5674728", "0.5668507", "0.56300676", "0.55968094", "0.5553564"...
0.66030127
0
Open the file to edit and read contents in to events list.
def get_file(file_to_edit): events = [] file_path = lrs_path + file_to_edit with open(file_path, "r") as the_file: filereader = csv.reader(the_file) for row in filereader: events.append(row) the_file.close() return events
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_input(file_path: str, data_formatter: DataFormatter) -> Stream:\n with open(file_path, \"r\") as f:\n content = f.readlines()\n events = Stream()\n for line in content:\n events.add_item(Event(line, data_formatter))\n events.close()\n return events", "def _load(self, filenam...
[ "0.64051765", "0.6239517", "0.6128682", "0.6004973", "0.60032636", "0.59520817", "0.59228414", "0.5887477", "0.5887477", "0.57675457", "0.57645625", "0.5748714", "0.5746571", "0.5715799", "0.57102877", "0.56773293", "0.5657386", "0.56479377", "0.5640856", "0.5597892", "0.5580...
0.75434244
0
Tests makeInset and useInset
def testMakeInset(self): # all ids small = Labels(data=self.small_array) ids=[1,2,5,7] desired_inset = [slice(0,3), slice(1,5)] np_test.assert_equal(small.findInset(ids=ids), desired_inset) small.makeInset(ids=ids) np_test.assert_equal(small.inset, desired_inset)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_inset_locator(self, bounds, trans):\n def inset_locator(ax, renderer):\n bbox = mtransforms.Bbox.from_bounds(*bounds)\n bb = mtransforms.TransformedBbox(bbox, trans)\n tr = self.figure.transFigure.inverted()\n bb = mtransforms.TransformedBbox(bb, tr)\n ...
[ "0.6361135", "0.5541073", "0.5483409", "0.5347032", "0.5241986", "0.51955086", "0.51911783", "0.5136891", "0.50874513", "0.5050792", "0.5041951", "0.50263894", "0.4981297", "0.49733314", "0.4969125", "0.49624497", "0.49620852", "0.49477723", "0.49254608", "0.49208865", "0.490...
0.74113864
0
Tests getPoints(mode='geodesic') and getPointsGeodesic(). Run several times because the methods tested depend on a random variable.
def testGetPointsGeodesic(self): for i in range(10): self.basicGetPointsGeodesic()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basicGetPointsGeodesic(self):\n\n # more geodesic, distance=2 (complicated because random)\n data = numpy.array([[0, 1, 1, 1, 2, 2, 2, 0],\n [0, 1, 1, 1, 2, 2, 2, 0],\n [0, 1, 1, 1, 2, 2, 2, 0]])\n labels = Labels(data=data)\n re...
[ "0.6299371", "0.58874136", "0.58374065", "0.5801667", "0.5795033", "0.5749049", "0.57166374", "0.56472635", "0.562469", "0.5586442", "0.55645484", "0.5560855", "0.5552215", "0.550962", "0.5506189", "0.5504319", "0.54882073", "0.5474092", "0.5473591", "0.5468628", "0.54185873"...
0.8351135
0
Single test for getPoints(mode='geodesic') and getPointsGeodesic().
def basicGetPointsGeodesic(self): # more geodesic, distance=2 (complicated because random) data = numpy.array([[0, 1, 1, 1, 2, 2, 2, 0], [0, 1, 1, 1, 2, 2, 2, 0], [0, 1, 1, 1, 2, 2, 2, 0]]) labels = Labels(data=data) result = label...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testGetPointsGeodesic(self):\n\n for i in range(10):\n self.basicGetPointsGeodesic()", "def geospatial(self):\n return bool(\n self.dataset.GetProjection() or\n (self.dataset.GetGCPProjection() and self.dataset.GetGCPs()) or\n self.dataset.GetGeoTrans...
[ "0.7228238", "0.62414855", "0.59653425", "0.5937499", "0.5887669", "0.56210893", "0.5615722", "0.5609805", "0.56017345", "0.55899805", "0.55500317", "0.55399203", "0.5539257", "0.55192065", "0.550209", "0.5491937", "0.5491439", "0.54660296", "0.545849", "0.5451511", "0.544212...
0.6788587
1
Return the attributes `h` (Total heat loss), `hlp` (Heat Loss Parameter per square meter), `h_fabric`, `h_bridging`, `h_vent`, `h_vent_annual` on the given dwelling object
def heat_loss(dwelling): # TODO: what is "h"? if dwelling.get('hlp') is not None: return dict(h=dwelling.hlp * dwelling.GFA, hlp=dwelling.hlp) UA = sum(e.Uvalue * e.area for e in dwelling.heat_loss_elements) A_bridging = sum(e.area for e in dwelling.heat_loss_elements if e.is_external) if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_demand_calc(dwelling):\n\n # TODO: modify functions to take only the arguments they need instead of the whole dwelling data.\n dwelling.update(ventilation(dwelling))\n\n dwelling.update(heat_loss(dwelling))\n\n dwelling.update(hot_water_use(dwelling))\n\n dwelling.update(lighting_consump...
[ "0.59208715", "0.57487935", "0.55831736", "0.5531533", "0.551731", "0.54339695", "0.53320193", "0.5328312", "0.530746", "0.52977926", "0.52972484", "0.5286722", "0.5277575", "0.52104133", "0.5186833", "0.51818717", "0.5173991", "0.5159216", "0.51519185", "0.5130649", "0.50925...
0.720957
0
Calculate the SAP energy demand for a dwelling
def perform_demand_calc(dwelling): # TODO: modify functions to take only the arguments they need instead of the whole dwelling data. dwelling.update(ventilation(dwelling)) dwelling.update(heat_loss(dwelling)) dwelling.update(hot_water_use(dwelling)) dwelling.update(lighting_consumption(dwelling)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ComputeEnergyConsumption(self):\r\n pass", "def perform_full_calc(dwelling):\n dwelling = perform_demand_calc(dwelling)\n dwelling.update(heating_systems_energy(dwelling))\n dwelling.update(appendix_m.pv(dwelling))\n dwelling.update(appendix_m.wind_turbines(dwelling))\n dwelling.update(...
[ "0.6600343", "0.64118046", "0.6172422", "0.6082626", "0.60701555", "0.5959659", "0.5950571", "0.58915526", "0.5886798", "0.5876974", "0.5857146", "0.5847542", "0.5726186", "0.5711322", "0.56956786", "0.5695321", "0.5692664", "0.56833786", "0.56779873", "0.5672595", "0.5665402...
0.68815106
0
Perform a full SAP worksheet calculation on a dwelling, adding the results to the dwelling provided. This performs a demand calculation, and a renewable energies calculation
def perform_full_calc(dwelling): dwelling = perform_demand_calc(dwelling) dwelling.update(heating_systems_energy(dwelling)) dwelling.update(appendix_m.pv(dwelling)) dwelling.update(appendix_m.wind_turbines(dwelling)) dwelling.update(appendix_m.hydro(dwelling)) dwelling.update(appendix_c.chp(dwel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_demand_calc(dwelling):\n\n # TODO: modify functions to take only the arguments they need instead of the whole dwelling data.\n dwelling.update(ventilation(dwelling))\n\n dwelling.update(heat_loss(dwelling))\n\n dwelling.update(hot_water_use(dwelling))\n\n dwelling.update(lighting_consump...
[ "0.739033", "0.60644275", "0.5957915", "0.5946374", "0.58137023", "0.5806559", "0.5777093", "0.5729225", "0.57091135", "0.56209016", "0.5604566", "0.5585306", "0.54862684", "0.5486228", "0.54801905", "0.54555106", "0.5446662", "0.53991157", "0.5393783", "0.5389663", "0.534816...
0.7647427
0
This function computes the surface area
def compute_surface_area(self): return np.sum(self._find_triangle_areas())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def surface_area(self) -> float:\n return 4 * np.pi * self.radius**2", "def surfaceArea(self):\n surfaceArea = self.sideLength**2 * 6\n return surfaceArea", "def getSurfaceArea(self) -> float:\n return self.area()", "def surface_area(self):\n return self._surface_area", "...
[ "0.80011004", "0.7844058", "0.76182777", "0.7455883", "0.7309027", "0.7252126", "0.72476107", "0.7167929", "0.7060911", "0.7034661", "0.7029887", "0.69332796", "0.6921517", "0.68879753", "0.688659", "0.6880711", "0.6879456", "0.68330854", "0.67889273", "0.6771197", "0.67643",...
0.83014
0
Given two arrays [m1, n], [m2,n], returns a [m1, m2] array where each entry is True if those rows match.
def intersect_2d(x1, x2): if x1.shape[1] != x2.shape[1]: raise ValueError("Input arrays must have same #columns") # This performs a matrix multiplication-esque thing between the two arrays # Instead of summing, we want the equality, so we reduce in that way res = (x1[..., None] == x2.T[None, .....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_array(array1, array2):", "def fits(a, b):\n return all(x & y for x, y in zip(a, b))", "def has_match(trajs_0, trajs_1):\n for i in range(len(trajs_0)):\n for j in range(len(trajs_1)):\n R = (trajs_0[i].get_slice()[:,:2] == trajs_1[j].get_slice()[:,:2])\n if isinsta...
[ "0.65438855", "0.6537962", "0.64174044", "0.62901217", "0.61515814", "0.6138679", "0.5988489", "0.5976403", "0.5972309", "0.59241295", "0.59137946", "0.5910354", "0.58483535", "0.5839954", "0.5832456", "0.5829371", "0.58285904", "0.5787698", "0.57538986", "0.57493615", "0.574...
0.7020224
0
Returns the indices that sort scores descending in a smart way
def argsort_desc(scores): return np.column_stack(np.unravel_index(np.argsort(-scores.ravel()), scores.shape))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_indices(scores: np.ndarray, shuffle_prop: float) -> np.ndarray:\n return _shuffle_subset(scores.argsort().argsort(), shuffle_prop)", "def __get_score_ordered(scores, idx):\t\n\treturn [x[1][idx] for x in sorted(scores.items())]", "def recommend_from_scores(scores: List[List[float]], n: int) -> List...
[ "0.6960895", "0.6871682", "0.6795757", "0.65629816", "0.6556796", "0.6461051", "0.6409348", "0.63616157", "0.633772", "0.63236696", "0.62087506", "0.62082416", "0.61969703", "0.61930555", "0.6136674", "0.6005333", "0.5997076", "0.59930086", "0.5972942", "0.5960499", "0.595686...
0.75126874
0
Given a set of predicted triplets, return the list of matching GT's for each of the given predictions
def _compute_pred_matches(gt_triplets, pred_triplets, gt_boxes, pred_boxes, iou_thresh=0.5, phrdet=False): # This performs a matrix multiplication-esque thing between the two arrays # Instead of summing, we want the equality, so we reduce in that way # The rows correspond to GT triplets, co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def performance_comparison_of_sets( predicted, known ):\n ### Example:\n ### predicted = Set( 2,3,4,5,10,11,12,13,14,15,20,21,22,23,24,25,26,27,28 )\n ### known = Set( 1,2,3,4,5,10,11,12,13,14,15, 21,22,23,24,25,26 )\n ### Return structure:\n ### [\n ### [ [2,3,4,5,10,11,12,13,14,...
[ "0.61147356", "0.5765611", "0.57320887", "0.5713905", "0.561453", "0.5602846", "0.5534629", "0.55314827", "0.55007005", "0.54617465", "0.5456477", "0.54511446", "0.5439374", "0.5414442", "0.5393676", "0.5371183", "0.53555274", "0.5344448", "0.5343099", "0.5323618", "0.5316275...
0.6012907
1
Function that calls Instance.set_deleted and catches any exception that may occur.
def delete_instance(instance, user): try: instance.set_deleted(timezone.now(), user) except FormInactiveError as e: raise ParseError(str(e)) from e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_delete_access_attempt(self, instance, **kwargs):", "def soft_delete(self, instance):\n self.destroy(instance)", "def _objectDeleted(self, obj):\n pass", "def versionable_post_delete(self, instance, timestamp):\n pass", "def versionable_pre_delete(self, instance, timestamp):\n ...
[ "0.66897786", "0.6640579", "0.64718956", "0.6322945", "0.62817174", "0.62663174", "0.6152274", "0.61403656", "0.6046786", "0.60244626", "0.6016413", "0.601435", "0.5948192", "0.5927294", "0.58903", "0.5888932", "0.588098", "0.587837", "0.5854496", "0.584458", "0.5839829", "...
0.6802433
0
Returns appropriate serializer class based on context.
def get_serializer_class(self): pk_lookup, dataid_lookup = self.lookup_fields form_pk = self.kwargs.get(pk_lookup) dataid = self.kwargs.get(dataid_lookup) fmt = self.kwargs.get("format", self.request.GET.get("format")) sort = self.request.GET.get("sort") fields = self.req...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_serializer_class(self):\n return self.serializer_class", "def get_serializer_class(self):\n assert self.serializer_class is not None, (\n \"'%s' should either include a `serializer_class` attribute, \"\n \"or override the `get_serializer_class()` method.\"\n ...
[ "0.77186406", "0.76763225", "0.7583893", "0.75552285", "0.75115997", "0.7477842", "0.7349744", "0.732208", "0.7279612", "0.72513735", "0.7245787", "0.72191036", "0.72121954", "0.7163859", "0.7149745", "0.71106553", "0.70974696", "0.7093688", "0.7093164", "0.7067511", "0.70468...
0.7712263
1
Returns a paginated queryset.
def paginate_queryset(self, queryset): if self.paginator is None: return None return self.paginator.paginate_queryset( queryset, self.request, view=self, count=self.data_count )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paginate_queryset(self, queryset):\n if self.paginator is None:\n return None\n return self.paginator.paginate_queryset(queryset, self.request, view=self)", "def paginate_queryset(self, queryset):\n if self.paginator is None:\n return None\n return self.pagin...
[ "0.78808343", "0.78808343", "0.7629857", "0.7568401", "0.7416892", "0.74030256", "0.72709703", "0.72709703", "0.7251473", "0.72404253", "0.71125746", "0.7033992", "0.6993326", "0.6931161", "0.6896108", "0.68769616", "0.685527", "0.6796368", "0.67700887", "0.6765375", "0.66695...
0.78830624
0
Get a StreamingHttpResponse response object
def _get_streaming_response(self): def get_json_string(item): """Returns the ``item`` Instance instance as a JSON string.""" return json.dumps(item.json if isinstance(item, Instance) else item) if self.kwargs.get("format") == "xml": response = StreamingHttpResponse(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stream(self):\n return ResponseStream(self)", "def response_as_stream(self) -> Any:\n raise NotImplementedError # pragma: no cover", "def response_handling(self) -> global___Snippet.StreamingResponseHandling:", "def response_handling(self) -> global___Snippet.StreamingResponseHandling:", ...
[ "0.767063", "0.7416034", "0.7012967", "0.7012967", "0.6969851", "0.68742424", "0.6605871", "0.6520931", "0.6400283", "0.6327227", "0.6286114", "0.62844795", "0.618682", "0.61518157", "0.6086295", "0.6071025", "0.6071025", "0.60105324", "0.59928113", "0.59779584", "0.591866", ...
0.79366857
0
Returns the ``item`` Instance instance as a JSON string.
def get_json_string(item): return json.dumps(item.json if isinstance(item, Instance) else item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _serialize_item(self, item_id: str, item: Pipeline) -> dict:\n return item.to_json()", "def __repr__(self):\n return f\"Item=(id={self.id},item_name={self.item_name},item_slug={self.item_slug})\"", "def __repr__(self):\n return '<Item {0} : {1}>'.format(self.item_id, self.item_name)", ...
[ "0.7664697", "0.7162026", "0.7117946", "0.6911071", "0.6823493", "0.6803025", "0.6772745", "0.6762667", "0.6739272", "0.6738411", "0.6654118", "0.66514206", "0.65619713", "0.6546932", "0.6546932", "0.65354466", "0.6527233", "0.6491184", "0.6487239", "0.64639443", "0.6459266",...
0.86737585
0
Returns a set of (week index, update type) tuples
def weeks_fetched(self, user): successes = set() for success in self.filter(user=user, status=m.Update.COMPLETE): successes.add((success.week_idx, success.type)) return successes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getWeeks(data: Sequence[HistoryElement]) -> Sequence[int]:\r\n _checkData(data)\r\n return [x.timeStamp.toDateTime().weekday() for x in data]", "def GetListOfWeeks(self):\n delta_days = (self.GetFridayOfLastFullWeek() - self.START_DATE).days\n delta_weeks = int(math.floor(delta_days / 7))\n we...
[ "0.6120125", "0.60366195", "0.5804807", "0.57050747", "0.55571145", "0.5357577", "0.52989227", "0.5227775", "0.52243876", "0.5218489", "0.52112573", "0.5182029", "0.51667124", "0.51035386", "0.5083654", "0.5068206", "0.50477016", "0.5036192", "0.5022804", "0.5009464", "0.4990...
0.61926204
0
Returns a generator of (user, count of updates in progress)
def updating_users(self): user_counts = self.values('user').filter(status=m.Update.IN_PROGRESS).annotate(count=Count('user')) for entry in user_counts: user = m.User.objects.get(id=entry['user']) yield user, entry['count']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_total_each_user():\r\n trans = transaction.begin()\r\n user_list = UserMgr.get_list(active=True)\r\n for user in user_list:\r\n StatBookmarkMgr.count_user_bookmarks(user.username)\r\n trans.commit()", "def counter_batch_accepts_counter_mutations_test(self):\n cursor = self.pre...
[ "0.57960415", "0.57137436", "0.55833614", "0.55669683", "0.5559869", "0.5415968", "0.5344817", "0.5328511", "0.5321689", "0.5294137", "0.52908075", "0.5283701", "0.52819383", "0.5270134", "0.5234338", "0.52178", "0.5208953", "0.52078104", "0.52028924", "0.5191646", "0.5159462...
0.80484724
0
Returns any update that's IN_PROGRESS for more than an hour
def stalled(self): oneHourAgo = datetime.today() - timedelta(hours = 1) return self.filter(status=m.Update.IN_PROGRESS, requestedAt__lte=oneHourAgo)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tasks_not_updated(request, query, state='submitted', hours_since_update=36, extra_str='(1=1)'):\n if 'status' in request.session['requestParams']:\n query['status'] = request.session['requestParams']['status']\n else:\n query['status'] = state\n if 'statenotupdated' in request.session['r...
[ "0.6096992", "0.587052", "0.5578453", "0.5522735", "0.5438874", "0.5422358", "0.53898716", "0.53732824", "0.53431284", "0.531127", "0.52927464", "0.5271256", "0.5264709", "0.5213381", "0.51641107", "0.5139483", "0.51327115", "0.5117717", "0.5117717", "0.5117717", "0.5117717",...
0.7538198
0
Returns a generator of weeks with most unique artists scrobbled.
def record_unique_artists_in_week(self, user, start, end, num=10): qs = self.user_weeks_between(user, start, end) \ .values('week_idx') \ .annotate(Count('artist')) \ .order_by('-artist__count')[:num] for r in qs: idx = r['week_idx'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mostFrequent(self, n=5):\r\n pass", "def get_mostFrequent(self, n=5):\r\n pass", "def GetListOfWeeks(self):\n delta_days = (self.GetFridayOfLastFullWeek() - self.START_DATE).days\n delta_weeks = int(math.floor(delta_days / 7))\n weeks = [self.START_DATE + dt.timedelta(days=7 * x) \n ...
[ "0.5435604", "0.5435604", "0.5316265", "0.52608997", "0.52595896", "0.52537256", "0.5251781", "0.522599", "0.516027", "0.50954574", "0.5080525", "0.50767154", "0.5069311", "0.5067429", "0.5006133", "0.49751127", "0.4955674", "0.49242568", "0.49237013", "0.49234274", "0.491516...
0.672771
0
Returns a basic query set of a user's data filtered to plays of particular artists, between start and end.
def user_weekly_plays_of_artists(self, user_id, artist_id, start, end): query = self.filter(user=user_id, artist=artist_id).order_by('week_idx') if start != ldates.idx_beginning or end != ldates.idx_last_sunday: query = query.filter(week_idx__range=(start, end)) return [(week_data.w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetArtists(self, start=0, end=0, sortmethod='artist', sortorder='ascending', filter=''):\n self.logger.debug(\"Fetching all artists in the music database\")\n try:\n xbmc = Server(self.url('/jsonrpc', True))\n sort = {'order': sortorder, 'method': sortmethod, 'ignorearticle'...
[ "0.65713817", "0.62819767", "0.6086399", "0.5897939", "0.5707841", "0.55241287", "0.5524061", "0.5481272", "0.5450652", "0.535093", "0.5305764", "0.52990735", "0.52561194", "0.5250819", "0.5247014", "0.5241949", "0.52326745", "0.521952", "0.5169513", "0.51664984", "0.5152122"...
0.646841
1
Find factors of num, in increasing order. >>> find_factors(10) [1, 2, 5, 10] >>> find_factors(11) [1, 11] >>> find_factors(111) [1, 3, 37, 111] >>> find_factors(321421) [1, 293, 1097, 321421]
def find_factors(num): factors = set() i = 1 while i*i < num: if num % i == 0: factors.add(i) factors.add(int(num/i)) i+=1 factors = list(factors) factors.sort() return factors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_factors(num):\n factors = []\n\n # Extend range by 1 to include num\n for i in range(1, num+1):\n if num % i == 0:\n factors.append(i)\n return factors", "def factors(num):\n\tif is_prime(num) == True:\n\t\tfactors = [1, num]\n\t\treturn factors\n\telse:\n\t\tfactors = [1]\n...
[ "0.8587653", "0.81951445", "0.81831396", "0.8080491", "0.7941649", "0.7896844", "0.7802897", "0.77760303", "0.7773974", "0.76784503", "0.7663789", "0.7661249", "0.7620093", "0.750173", "0.741434", "0.7364422", "0.7358033", "0.7344944", "0.73159957", "0.7259934", "0.7245798", ...
0.8437094
1
Process the keywords for the given component
def get_keywords_for_component(component, user_defined_keywords): output_keywords = [] input_keywords = user_defined_keywords # initialize with the user defined keywords input_keywords += component.split('/') # split the component if there are multiple terms involved for input_keyword in input_keyword...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keyword_extraction(file_content):\n\n # [question, question....]\n for key, value in file_content.items():\n seg, hidden = ltp.seg([key])\n # ner: [[('Nh', 2, 2)]]\n ner = ltp.ner(hidden)\n # keywords: [('PERSON', \"吴轩\")], tuple_item: ('Nh', 2, 2)\n keywords = [(tag_t...
[ "0.5812088", "0.57918507", "0.55647784", "0.55573857", "0.5487196", "0.54760396", "0.546415", "0.5446818", "0.5295191", "0.528454", "0.5282875", "0.52362025", "0.5217535", "0.52160937", "0.52061707", "0.5133049", "0.51226133", "0.512039", "0.50877815", "0.50626683", "0.505639...
0.7079821
0
Given a list of words, generate all potential combination of words in pairs
def generate_pairs_of_words(word_list): def pair_words(word_list, i, j, connector): return word_list[i] + connector + word_list[j] pairs = [] n = len(word_list) for i in range(n-1): for j in range(i+1, n): pairs.append(pair_words(word_list, i, j, ' ')) pairs.appen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_combination(wlist:list) -> list :\r\n\r\n if wlist and len(wlist)>1:\r\n return chain(*map(lambda x: combinations(wlist, x), range(1, len(wlist)+1)))\r\n else :\r\n return wlist", "def get_pairs(terms):\n return itertools.combinations(terms, 2)", "def find_pairs(words): \n ...
[ "0.7723539", "0.74257666", "0.7352363", "0.6786749", "0.67455274", "0.6643182", "0.66158676", "0.66040707", "0.6596281", "0.6596281", "0.6585903", "0.6577314", "0.65148395", "0.6471836", "0.6451061", "0.6432114", "0.64205796", "0.64113396", "0.6296403", "0.62510425", "0.62165...
0.827604
0
Check if a path points to a file or directory and if it has read or exec access rights.
def isAccessible(self,path): if isdir(path): return access(path, R_OK and X_OK and W_OK) else: return access(path, R_OK)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isPathExecutable(path):\n return os.path.isfile(path) and os.access(path, os.X_OK)", "def is_valid_path(path):\n if not os.path.exists(path):\n raise IOError(\"{path} is not a valid path\".format(path=path))\n if not os.access(path, os.R_OK):\n raise OSError(\"{path} is not a readable ...
[ "0.7121918", "0.70543575", "0.68055344", "0.6785841", "0.6785841", "0.67321527", "0.6600794", "0.65523005", "0.65245205", "0.63908297", "0.62918913", "0.6234298", "0.62216395", "0.621974", "0.6214841", "0.61981165", "0.6191218", "0.61509806", "0.6112042", "0.60897356", "0.607...
0.72072667
0
Add a CPS local file system object to a folder
def addCPSLocalFS(container, id, **kw): ob = CPSLocalFS(id, **kw) return CPSBase_adder(container, ob)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_object(local_path: str, file_name: str, configuration):\n pass", "def add_file(self, path):\n pass", "def put_object(self, account, container, object, content):#put a file to server\n \n pass", "def create_object(self, container_name, local_file, object_name):\n with open(l...
[ "0.6798031", "0.63411236", "0.62318945", "0.6201793", "0.6044068", "0.59653485", "0.5933506", "0.58449936", "0.5841136", "0.58149403", "0.5778442", "0.57666314", "0.5732546", "0.57216054", "0.57189363", "0.5698509", "0.5671398", "0.56620854", "0.5660115", "0.5656925", "0.5635...
0.6432148
1
build a Homebrew forumula file for lrosecore
def build_lrose_formula(tar_url, tar_name, formula_name): dash = tar_name.find('-') period = tar_name.find('.', dash) version = tar_name[dash+1:period] checksum = subprocess.check_output(("sha256sum", tar_name)) checksum = checksum.split()[0] formula = template.format(tar_url, version, checksum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_homebrew_formula(archive_url: str, head_url: str) -> str:\n repository_root = Path(__file__).parent.parent\n direct_requires = _get_dependencies(\n requirements_file=repository_root / 'requirements.txt',\n )\n indirect_requires = _get_dependencies(\n requirements_file=repository_r...
[ "0.59271795", "0.5161424", "0.51153964", "0.50794196", "0.49461532", "0.48992947", "0.48970073", "0.4855891", "0.4850761", "0.4779826", "0.47689286", "0.47110814", "0.4706798", "0.46762416", "0.4674272", "0.46457046", "0.4642398", "0.46235317", "0.46116403", "0.45985612", "0....
0.53471965
1
Updates our local poorly cached representation of a Vault server. This runs in a thread, one per Vault server. Probably needs more mutex.
def update_server(finished, server): name = server['name'] while not finished.wait(2): new_s = fetch_server(VAULTZ[name], server) if 'cluster_id' in new_s: my_cluster = [x['name'] for _name, x in iteritems(SERVERZ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_server_thread(server):\n client = None\n name = server['name']\n if name in VAULTZ:\n client = VAULTZ[name]\n else:\n client = VAULTZ[name] = get_vault(server)\n\n if name in SERVERZ:\n return SERVERZ[name]\n\n server = SERVERZ[name] = fetch_server(client, server)\n...
[ "0.6254933", "0.5772624", "0.5732598", "0.5688727", "0.5564018", "0.551672", "0.5488269", "0.5466718", "0.5388758", "0.5338336", "0.5329839", "0.5298457", "0.5295529", "0.5287433", "0.5282714", "0.52717865", "0.52582383", "0.52428687", "0.52365357", "0.52337533", "0.5221746",...
0.637584
0
Starts a thread responsible for updating local info on Vault servers
def start_server_thread(server): client = None name = server['name'] if name in VAULTZ: client = VAULTZ[name] else: client = VAULTZ[name] = get_vault(server) if name in SERVERZ: return SERVERZ[name] server = SERVERZ[name] = fetch_server(client, server) sthread = thr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _StartStatusUpdateThread(self):\n self._status_update_active = True\n self._status_update_thread = threading.Thread(\n name='Status update', target=self._StatusUpdateThreadMain)\n self._status_update_thread.start()", "def start(self):\n self.open()\n #t = Thread(target=self._cac...
[ "0.64313036", "0.6330135", "0.62208235", "0.6204642", "0.607325", "0.5856703", "0.58469695", "0.583723", "0.57949686", "0.5775334", "0.5775334", "0.57446307", "0.57366014", "0.57127655", "0.57127655", "0.57011217", "0.56858456", "0.5678261", "0.5667453", "0.5637588", "0.56285...
0.64510936
0
Fetches details from Vault, generating a complicate dict representing a server
def fetch_server(client, server): server_obj = { "name": server['name'], "url": server['url'], "client": client } if (server['name'] in SERVERZ) \ and ('cluster_members' in SERVERZ[server['name']]): clustered = SERVERZ[server['name']]['cluster_members'] server_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_servers(self):\n json_scheme = self.gen_def_json_scheme('GetServers')\n json_obj = self.call_method_post(method='GetServers', json_scheme=json_scheme)\n self.json_servers = json_obj\n # if this method is called I assume that i must re-read the data\n # so i reinitialize t...
[ "0.63295335", "0.6017063", "0.5981714", "0.5955315", "0.593461", "0.5877589", "0.58129734", "0.57993543", "0.57707304", "0.5751457", "0.5737767", "0.5727913", "0.569141", "0.5685779", "0.5670609", "0.56326616", "0.5612336", "0.5601548", "0.55832845", "0.5554736", "0.55362964"...
0.6626059
0
Builds up list of data arrays from all raft files (one array per CCD), plus list of segment names.
def get_scandata_raft(inputfile, datadir=''): raftarrays = [] if os.path.splitext(inputfile)[1] in [".fits", ".fz"]: # starts with 00 through 22 seglist = ["%d%d" % (i, j) for i in range(3) for j in range(3)] # when REB2 data is missing #seglist = ["%d%d" % (i, j) for i in range(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(files):\n data = []\n for fn in files:\n data += parse_data(fn).tolist()\n return np.array(data)", "def getDatasets(self, dirname, dataset_list):\r\n \r\n files = self.loadDirectory(dirname)\r\n \r\n result = []\r\n for dataset_name in dataset_list:...
[ "0.6153713", "0.6088378", "0.60083175", "0.59189504", "0.58487946", "0.57951975", "0.57138914", "0.571033", "0.5709755", "0.56899613", "0.56622064", "0.5660998", "0.5647151", "0.56439656", "0.561935", "0.561761", "0.56089336", "0.56031334", "0.55937725", "0.5593059", "0.55671...
0.6675086
0
Check whether this field is nullable, i.e., can be `None`.
def is_nullable(self) -> bool: # pragma: no cover pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_nullable(self) -> bool:\n return self.__nullable", "def is_nullable(self):\n return self._is_nullable", "def is_nullable(schema_obj):\n\n if isinstance(schema_obj, schema.Field):\n return schema_obj.is_nullable\n return False", "def is_null(self):\n return self.value is None...
[ "0.8449764", "0.83130455", "0.786248", "0.7661689", "0.74965847", "0.7488365", "0.7440954", "0.7377148", "0.73132867", "0.71837443", "0.7122148", "0.71193844", "0.71191525", "0.70252806", "0.6993334", "0.6983965", "0.6930141", "0.69181836", "0.68292755", "0.6795569", "0.67899...
0.84807235
0
Check if object is the type of data model class that this model adapter works with.
def is_model_type(obj: Any) -> bool: # pragma: no cover pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _isinstance(self, obj, raise_error=True):\n rv = isinstance(obj, self.__model__)\n if not rv and raise_error:\n raise ValueError('%s is not of type %s' % (obj, self.__model__))\n return rv", "def is_dataclass_instance(obj: Any) -> bool:\n return dataclasses.is_dataclass(obj...
[ "0.79185575", "0.75479585", "0.75399536", "0.7518996", "0.7395414", "0.7328052", "0.71795946", "0.7038402", "0.7015072", "0.68881327", "0.6878079", "0.68056995", "0.67854327", "0.67750436", "0.6754461", "0.6694614", "0.6690304", "0.66749346", "0.66486806", "0.66303533", "0.66...
0.78210646
1
Docstring for this data model.
def docstring(self) -> str: out = f"{self.model.__module__}.{self.model.__qualname__}" docstring = inspect.getdoc(self.model) if docstring: out += "\n\n" + docstring return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_definition(self):\n pass", "def description(self) -> str:\n raise NotImplementedError", "def description(self) -> str:\n raise NotImplementedError", "def description(self) -> str:\n raise NotImplementedError", "def description(self) -> str:\r\n raise NotImplemen...
[ "0.6768882", "0.674206", "0.674206", "0.674206", "0.6739793", "0.6739793", "0.6739793", "0.66971123", "0.66580635", "0.6608247", "0.6608247", "0.6567727", "0.65560997", "0.65560997", "0.65407693", "0.6489474", "0.64783865", "0.64439154", "0.64217913", "0.639244", "0.6386248",...
0.6756573
1
Returns the DOT language "HTMLlike" syntax specification of a table for this data model. It is used as the `label` attribute of data model's node in the graph's DOT representation.
def dot_label(self) -> str: rows = "\n".join(field.dot_row() for field in self.fields) return _table_template.format(name=self.name, rows=rows).replace("\n", "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _repr_html_(self):\n return (\n f'<b>{self.__class__.__name__}</b>'\n f'<br> <b>defined by:</b> {self._str_meta_()}'\n f'<br> <b>with columns:</b> {self._str_colnames()}'\n f'<br> {len(self)} objects'\n f'<br> {self._html_table()}'\n )", ...
[ "0.61612487", "0.61515945", "0.61384416", "0.61309093", "0.61250234", "0.6045786", "0.60448545", "0.59829056", "0.59372824", "0.5933345", "0.5923659", "0.5885648", "0.5885648", "0.58676755", "0.5851817", "0.58498627", "0.58488524", "0.58396506", "0.5816444", "0.57942003", "0....
0.7110429
0
Create decorator to register a concrete [`Model`][erdantic.base.Model] adapter subclass that will be identified under the key `type_name`. A concrete `Model` subclass must be registered for it to be available to the diagram creation workflow.
def register_model_adapter(type_name: str) -> Callable[[Type[Model]], Type[Model]]: def decorator(cls: type) -> type: global model_adapter_registry if not issubclass(cls, Model): raise ValueError("Only subclasses of Model can be registered.") model_adapter_registry[type_name] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RegisterModel(model_name):\n\n def decorator(f):\n MODEL_REGISTRY[model_name] = f\n return f\n\n return decorator", "def register_model(name):\n\n def register_model_cls(cls):\n if name in MODEL_REGISTRY:\n raise ValueError('Cannot register duplicate model ({})'.forma...
[ "0.66247785", "0.6454164", "0.61407036", "0.6008762", "0.57344675", "0.5627918", "0.55794394", "0.5565715", "0.5555287", "0.5550958", "0.55120885", "0.5458099", "0.5458099", "0.54393405", "0.54377514", "0.54216254", "0.5397311", "0.53699", "0.5312761", "0.53078943", "0.525186...
0.8330304
0
A product token for use in UserAgent headers.
def product_token(self): return 'gtr/{0}'.format(__version__)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cart_token(self):\n return self._dict.get('cart_token')", "def token(self) -> str:\n return pulumi.get(self, \"token\")", "def token(self) -> str:\n return pulumi.get(self, \"token\")", "def token(self) -> str:\n return pulumi.get(self, \"token\")", "def product(self) -> str...
[ "0.6108767", "0.60351366", "0.60351366", "0.60351366", "0.59434474", "0.5846661", "0.5842875", "0.5732221", "0.56980956", "0.56795764", "0.5656738", "0.5639308", "0.5635904", "0.5624893", "0.5620505", "0.5617921", "0.56037295", "0.56037295", "0.56037295", "0.55853003", "0.558...
0.80278295
0
Return all hidden inputs in elements list as a dict.
def _hidden_inputs_as_dict(self, elements): data = {} # Make sure elements is a list if not isinstance(elements, list): elements = [elements] for element in elements: for input in element.select('input[type=hidden]'): data[input.attrs['name']] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hidden(self, soup):\n hidden = soup.find_all(\"input\", {\"type\": \"hidden\"})\n return {field[\"name\"]: field[\"value\"] for field in hidden}", "def get_inputs(self):\n inputs = self.view.main_panel.get_inputs()\n result = {}\n for _input in inputs:\n valu...
[ "0.71392256", "0.655237", "0.624078", "0.61002916", "0.60492", "0.5750601", "0.57237935", "0.5712929", "0.5706916", "0.5644363", "0.56369454", "0.56110394", "0.5592949", "0.5583895", "0.55714357", "0.55714357", "0.55714357", "0.5556644", "0.5502055", "0.54522103", "0.53868526...
0.8503397
0
Fix the bank balance and return it as a float.
def _fix_balance(self, balance): return float(balance.replace(',', '.').replace(' ', ''))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_balance():\n return float(pareto.rvs(1.161))", "def balance(self) -> float:\n\t\tbalance = 0\n\t\tfor transaction in self.transactions:\n\t\t\tsign = 1 if transaction.receiving_account == self.__number else -1\n\t\t\tbalance += sign*transaction.usd*transaction.completed\n\t\t# The bank has infinit...
[ "0.72123927", "0.7061845", "0.7009867", "0.6872777", "0.67247254", "0.64945155", "0.64721006", "0.64484996", "0.6287387", "0.6281066", "0.62781847", "0.62356645", "0.6213261", "0.61990225", "0.6180062", "0.6111443", "0.61091805", "0.6072259", "0.6057195", "0.6021365", "0.6020...
0.7926201
0
Parse the token from body.
def _parse_token(self, body): token_match = re.search('var\s*token\s*=[\s\']*(\d+)', body) return int(token_match.group(1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_tokens(self, body):\n\n old_token = self.token\n old_json_token = self.json_token\n\n self.token = self._parse_token(body)\n self.json_token = self._parse_json_token(body)\n\n logger.debug('Token set to: %s (Old: %s)', self.token, old_token)\n logger.debug('JSON...
[ "0.7431582", "0.7366899", "0.6743963", "0.6730944", "0.66467994", "0.6132901", "0.58613884", "0.5779626", "0.57630026", "0.5718362", "0.57095325", "0.5676709", "0.564161", "0.56361425", "0.5579346", "0.5576902", "0.5567636", "0.5556165", "0.5551522", "0.5546756", "0.55331093"...
0.7520695
0
Parse the JSON token from body.
def _parse_json_token(self, body): token_match = re.search('var\s*jsonToken\s*=[\s\']*([\w-]+)', body) return token_match.group(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_tokens(self, body):\n\n old_token = self.token\n old_json_token = self.json_token\n\n self.token = self._parse_token(body)\n self.json_token = self._parse_json_token(body)\n\n logger.debug('Token set to: %s (Old: %s)', self.token, old_token)\n logger.debug('JSON...
[ "0.7015168", "0.6799475", "0.6467686", "0.60479337", "0.6021648", "0.5911621", "0.5891923", "0.5796345", "0.5792454", "0.5727298", "0.572379", "0.56894934", "0.5660755", "0.562958", "0.5594681", "0.5550532", "0.55383945", "0.5516941", "0.5512666", "0.54930973", "0.548546", ...
0.8396241
0
Parse and save tokens from body.
def _parse_tokens(self, body): old_token = self.token old_json_token = self.json_token self.token = self._parse_token(body) self.json_token = self._parse_json_token(body) logger.debug('Token set to: %s (Old: %s)', self.token, old_token) logger.debug('JSON token set to:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self, tokenizer):\n pass", "async def process(self, tokens):\n return await self.parser.process(tokens)", "def parse_tokens(self, tokens):\n for token in tokens:\n self.parse_token(token)", "def _parse_token(self, body):\n\n token_match = re.search('var\\s*tok...
[ "0.6242305", "0.6075056", "0.5916095", "0.5787497", "0.5784725", "0.5641238", "0.5510344", "0.54594046", "0.5448223", "0.54254425", "0.5420253", "0.5386509", "0.53751945", "0.53578675", "0.524982", "0.5234695", "0.5216267", "0.5213507", "0.5203124", "0.5129996", "0.5129147", ...
0.7977467
0
Parse and return list of all account transactions.
def _parse_account_transactions(self, body): transactions = [] soup = BeautifulSoup(body, 'html.parser') for row in soup.select('.history.data-list-wrapper-inner tr'): transaction = { 'date': row.select('td')[1].text, 'type': row.select('td')[2].sele...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listtransactions(self, account=None, count=10, from_=0, address=None):\n accounts = [account] if account is not None else list(self.listaccounts(as_dict=True).keys())\n return [TransactionInfo(**tx) for acc in accounts for\n tx in self.proxy.listtransactions(acc, count, from_) if\n...
[ "0.7151018", "0.7149907", "0.71008074", "0.6977178", "0.68028396", "0.67775965", "0.6729908", "0.66277045", "0.6610449", "0.6469714", "0.64354056", "0.6426669", "0.6411786", "0.6402797", "0.6374859", "0.6352835", "0.631962", "0.63142496", "0.6298551", "0.6292313", "0.62710595...
0.7749547
0
Fetch and return account transactions for account_number.
def get_account_transactions(self, account_number): logger.debug('Fetching account transactions for account %s', account_number) # Get javax.faces.ViewState from the last request last_req_hidden_inputs = self._hidden_inputs_as_dict( BeautifulSoup(self.last_req_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def balance(self, account_number: int): \n return self._accounts[account_number][1]", "def fetch_bank_transactions(self):\n return self.fetch('/bank_transactions')", "def get_account_transactions(self, min_row=0, max_row=100):\n data = {\n 'min_row': min_row,\n ...
[ "0.70014375", "0.676105", "0.6646065", "0.66168296", "0.65606546", "0.6340439", "0.6324217", "0.6267469", "0.62176937", "0.6165127", "0.61637956", "0.61499494", "0.61320525", "0.6065751", "0.6035426", "0.6016021", "0.59824365", "0.5944884", "0.59340096", "0.5916211", "0.58830...
0.81577533
0
Get active users in a given discord text channel.
def get_active_users(text_channel) -> List[discord.Member]: active_users = [] for m in text_channel.members: if m.status.name in ["online", "dnd"] and m.bot == False: active_users.append(m) return active_users
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_channel_users(channel):\n try:\n response = client.conversations_members(channel=channel)\n except SlackApiError as err:\n assert err.response[\"error\"]\n user_ids = response[\"members\"]\n return user_ids", "def get_channel_users(self, channel):\n data = {\n ...
[ "0.6941497", "0.68513894", "0.6534244", "0.6085032", "0.606758", "0.60283536", "0.59610504", "0.58857435", "0.58695865", "0.5821038", "0.582083", "0.5801356", "0.5788422", "0.5784686", "0.5753404", "0.57440823", "0.57334614", "0.5729438", "0.5721531", "0.5691711", "0.5660485"...
0.83590263
0
Returns 'combined_text' content directly within a taxon
def content_for_taxon(self, taxon): content_ids_for_taxon = list(self.content_taxon_mapping[self.content_taxon_mapping['taxon_id'] == taxon.content_id]['content_id']) return self.content[self.content['content_id'].isin(content_ids_for_taxon)]['combined_text'].to_list();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine_text(evt):\n global output\n output = output + evt.result.text\n print(evt.result.text)", "def get_text(self):\n text_complet = \"\"\n rez_dict = self.__results\n for i in range(0, len(rez_dict[\"text\"])):\n text = rez_dict[\"text\"][i]\n conf = in...
[ "0.58846337", "0.5353593", "0.52949023", "0.5253419", "0.5204414", "0.5158431", "0.5110012", "0.509821", "0.508579", "0.5081426", "0.50729656", "0.5067092", "0.5052136", "0.50272155", "0.50136214", "0.5013542", "0.50008446", "0.4993583", "0.49686253", "0.49405417", "0.4938850...
0.682943
0
Returns content all rows directly within a taxon
def content_rows_for_taxon(self, taxon): content_ids_for_taxon = list(self.content_taxon_mapping[self.content_taxon_mapping['taxon_id'] == taxon.content_id]['content_id']) return self.content[self.content['content_id'].isin(content_ids_for_taxon)];
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_for_taxon(self, taxon):\n content_ids_for_taxon = list(self.content_taxon_mapping[self.content_taxon_mapping['taxon_id'] == taxon.content_id]['content_id'])\n return self.content[self.content['content_id'].isin(content_ids_for_taxon)]['combined_text'].to_list();", "def fetch_by_id(self,...
[ "0.64229196", "0.56819576", "0.5645641", "0.5586926", "0.5515208", "0.54630274", "0.53902406", "0.5377141", "0.5305812", "0.5300794", "0.52996236", "0.5297317", "0.5270316", "0.5267102", "0.52174985", "0.51659465", "0.5137481", "0.5134758", "0.51278883", "0.51209366", "0.5120...
0.74151564
0
Returns the text value of the partition type
def get_type(self): return DOS_PARTITIONS[self.partition_type]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partition_description(self) -> pulumi.Output[Optional[Any]]:\n return pulumi.get(self, \"partition_description\")", "def get_partition_name(partition_type: PartitionType) -> str:\n if partition_type == PartitionType.TRAIN:\n return PARTITION_TRAIN_NAME\n \n elif partition_type == ...
[ "0.6335327", "0.6087373", "0.6078627", "0.59970003", "0.59606653", "0.5928415", "0.5862264", "0.581425", "0.57787377", "0.5752302", "0.57446164", "0.57380545", "0.56981283", "0.5688516", "0.5678651", "0.5604231", "0.55918556", "0.5568496", "0.55623966", "0.5558864", "0.555210...
0.6819308
0
Returns True if this partition is bootable
def is_bootable(self): return self.bootable_flag == 0x80
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_booted_from_volume(self, instance, disk_mapping=None):\n return not bool(instance.get('image_ref'))", "def is_booted(self):\n raise DeviceException(DeviceException.FEATURE_NOT_IMPLEMENTED)", "def pilotIsBootValid (self):\n return self.isBootValid()", "def isBootValid (self):\n ...
[ "0.73547786", "0.72385293", "0.71716297", "0.69085157", "0.65144926", "0.64562535", "0.6442269", "0.6433018", "0.6403243", "0.6394636", "0.63540614", "0.6322865", "0.6322865", "0.62819284", "0.6267639", "0.6255905", "0.6250459", "0.62429243", "0.62306994", "0.6191209", "0.611...
0.85575104
0
Returns True if the partition is an extended partition
def is_extended(self): return 'Extended' in self.get_type()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_partition(disk): #TODO: Could change to use \"Whole\" attrib. Good idea?\n\n return \"s\" in disk.split(\"disk\")[1]", "def is_extended(self):\n return self._parent is not None", "def isleaf(self):\n no_kids = super(PartitionDevice, self).isleaf\n # it is possible that the disk t...
[ "0.7014364", "0.63645893", "0.63630986", "0.636156", "0.6255593", "0.6198892", "0.6158038", "0.6097353", "0.59970516", "0.58780426", "0.58487046", "0.5628743", "0.5519968", "0.5459286", "0.54182494", "0.5402619", "0.5378279", "0.53673804", "0.53528774", "0.53508466", "0.53190...
0.691445
1
Returns True if signature = 0xAA55 (a valid MBR signature)
def validate_signature(self): return self.signature == 0xAA55
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def verify_signature(self, message: BasePendingMessage) -> bool:\n\n if message.signature is None:\n LOGGER.warning(\"'%s': missing signature.\", message.item_hash)\n return False\n\n try:\n signature = json.loads(message.signature)\n sigdata = base58...
[ "0.65580106", "0.648093", "0.64799976", "0.6410002", "0.64061147", "0.6272628", "0.6233012", "0.62279487", "0.6214497", "0.6153721", "0.6145588", "0.6126282", "0.61166954", "0.6076573", "0.59827954", "0.59784204", "0.5967099", "0.59625274", "0.5952577", "0.5951595", "0.591378...
0.84841055
0
Adds partitions from extended partitions to the MBR class
def add_partitions(self, disk): for partition in self.partitions: if 'Extended' in partition.get_type(): with open(disk, 'rb') as hd: hd.seek(partition.read_start) new_mbr = Mbr(hd.read(512), lba_offset=partition.lba) self.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_partition_list(self):\n raise NotImplementedError('Must be implemented in subclasses.')", "def newpart(self, device, primary, ncyls, swap=False):\n # This is a simple partitioning tool, which only supports\n # adding partitions sequentially, with all primary partitions\n # be...
[ "0.62553537", "0.62338024", "0.6184228", "0.6177974", "0.61490935", "0.60143113", "0.59943926", "0.595958", "0.595233", "0.574192", "0.5720558", "0.570915", "0.5700588", "0.5605133", "0.5552451", "0.55524147", "0.55502284", "0.55076903", "0.5502424", "0.5456309", "0.5442365",...
0.7340264
0
GZIP encode bytes object
def _gzipencode(content): import gzip out = BytesIO() f = gzip.GzipFile(fileobj=out, mode='w', compresslevel=5) f.write(content) f.close() return out.getvalue()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def b64_gz_json_encode(obj):\n # The |separators| argument is to densify the command line.\n return base64.b64encode(zlib.compress(\n json.dumps(obj or {}, sort_keys=True, separators=(',', ':')), 9))", "def encode(self, compress=0):\n raw = bytes(self._encode())\n return gzip.compress(raw, c...
[ "0.7058347", "0.7038002", "0.70237434", "0.69651395", "0.6945722", "0.6864719", "0.6820687", "0.67059284", "0.6684357", "0.66502655", "0.6574162", "0.6489864", "0.64450616", "0.6441168", "0.64198315", "0.64198315", "0.636657", "0.6334356", "0.6240513", "0.62067103", "0.617136...
0.7544876
0
Try to parse 'item' (string or integer) to enum 'type'
def _parse_enum(type, item): try: return type[item] except: return type(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertToEnumItem(byte: int, enumType: cern.japc.value.EnumType) -> cern.japc.value.EnumItem:\n ...", "def _get_item_type(item_dict):\n\n if 'object' in item_dict:\n item_type = 'object'\n elif 'module' in item_dict:\n item_type = 'module'\n elif 'clock' in i...
[ "0.67821544", "0.66704196", "0.66600126", "0.6387634", "0.63724065", "0.6335099", "0.63331234", "0.62657595", "0.62563825", "0.6107302", "0.60311896", "0.5965388", "0.58617616", "0.58300763", "0.58221483", "0.5804898", "0.5765457", "0.57585025", "0.5724611", "0.5699114", "0.5...
0.86925566
0
small script to populate relics for testing
def test_relic(): mongo_db = pymongo.MongoClient() init_db(mongo_db.roguesim_python) populate_db(mongo_db.roguesim_python)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_db(dbase):\n # In this order: Iron, Blood, Shadow, Fel, Storm\n wowhead_ids = []\n wowhead_ids.extend(item.get_ids_from_wowhead_by_type(-8))\n wowhead_ids.extend(item.get_ids_from_wowhead_by_type(-9))\n wowhead_ids.extend(item.get_ids_from_wowhead_by_type(-10))\n wowhead_ids.extend(i...
[ "0.6297669", "0.5585367", "0.5498943", "0.5468988", "0.5468988", "0.54151404", "0.53962183", "0.5380501", "0.53432065", "0.520739", "0.5203599", "0.5164569", "0.5147828", "0.5144866", "0.5131755", "0.51268554", "0.51264954", "0.51263267", "0.51216674", "0.5116029", "0.5076085...
0.6881789
0
Read KML data from cache, and download from repo if necessary
def read_kml(): global kmldata global CONFIG if type(kmldata) == type(None): if not os.path.exists(CONFIG["kmlfile"]): fiona.drvsupport.supported_drivers['KML'] = 'rw' kmldata = geopandas.read_file(CONFIG["kmlrepo"], driver="KML") os.makedirs(CONFIG["cachedir"],ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self, url: str):\n\n log.info(f\"Downloading KMZ file {basename(url)}\")\n kml = self.fetch(url)\n\n log.info(\"Parsing KML data\")\n self.iter_elems = iterparse(BytesIO(kml), events=(\"start\", \"end\"), resolve_entities=False)\n\n prod_items = {\n \"issuer\"...
[ "0.6442564", "0.61632365", "0.6131439", "0.6007126", "0.59295243", "0.59220517", "0.58809197", "0.5823584", "0.58158576", "0.57879627", "0.57863224", "0.5725393", "0.5719492", "0.5704884", "0.5697475", "0.5693312", "0.5687403", "0.56795806", "0.56612206", "0.56491363", "0.561...
0.7199014
0
Read CSV data from cache, and download from repo if necessary
def read_csv(): global csvdata global CONFIG if type(csvdata) == type(None): if not os.path.exists(CONFIG["csvfile"]): csvdata = pandas.read_csv(CONFIG["csvrepo"], na_values=["-999999","NOT AVAILABLE"]) os.makedirs(CONFIG["cachedir"],exist_ok=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_csv_cached(filename='../apps/naive_c_stats.csv', cache={}):\n if filename in cache:\n return cache[filename]\n if not os.path.exists(filename):\n ans = None\n else:\n ans = numpy.recfromcsv(filename)\n cache[filename] = ans\n return ans", "def _csv_get(page):\n cac...
[ "0.65985745", "0.65972996", "0.6584848", "0.63103306", "0.62697816", "0.6211688", "0.61880475", "0.6171694", "0.6123702", "0.6039283", "0.5928468", "0.59249216", "0.5912777", "0.59076524", "0.5897626", "0.5853826", "0.5804479", "0.578792", "0.5781011", "0.57711154", "0.574051...
0.6952292
0
Returns the utility id(s) at the given position(s) ARGUMENT pos (tuple) (latitude,longitude) of position pos (list) list of (latitude,longitude) positions RETURN int utility id if pos is a tuple list list of utility ids if pos is a list of tuples
def get_utility(pos): kml = read_kml() if type(pos[0]) in (list,tuple): # vector of positions return list(map(lambda x: list(kml[kml.contains(Point(x[1],x[0]))==True].index),pos)) else: # singleton return list(kml[kml.contains(Point(pos[1],pos[0]))].index)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id_from_position(self, position: PositionT) -> Union[int, Array]:\n int_pos = self._to_integer_position(position)\n ids = self._get_id_from_dict(self._int_position_to_site, int_pos)\n return ids", "def get_user_and_item_ids(self, data):\n\n vec_extract = np.vectorize(self.extract_...
[ "0.6022311", "0.5717848", "0.5675736", "0.54066074", "0.53870887", "0.53862596", "0.5323103", "0.52927417", "0.5261723", "0.52416205", "0.5208296", "0.5198828", "0.5192943", "0.5138359", "0.5123215", "0.5121656", "0.51213694", "0.51176745", "0.50980175", "0.5092307", "0.50701...
0.6860404
0
Compute the (latitude,longitude) tuple of the position given ARGUMENT pos (str) The position given as a commadelimeted string pos (tuple) The position given as a (lat,lon) tuple RETURN tuple The position given as a (lat,lon) tuple
def get_position(pos): if type(pos) is str: return list(map(lambda x: float(x),pos.split(","))) return pos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_coordinates(self, place):\n if re.match(r\"-?[\\d.]+,-?[\\d.]+\", place):\n return tuple(place.split(\",\"))\n return tuple(\n str(coord) for coord in self._geocoder.geosearch(place).coordinates\n )", "def parse_coords(geo: str) -> Tuple[float, float]:\n lat...
[ "0.70621926", "0.68079394", "0.6600164", "0.650143", "0.64311135", "0.6425078", "0.6422044", "0.63975847", "0.6376725", "0.6372813", "0.630666", "0.6303668", "0.617006", "0.61447626", "0.61388314", "0.61161673", "0.61083496", "0.60994375", "0.60494965", "0.6034523", "0.602417...
0.7531564
0
Return a subset of `returned_resource_set` that contains only resources created by the test suite.
def exclude_foreign_resources(returned_resource_set, expected_resource_set): expected_owners = {res.owner for res in expected_resource_set} return [ res for res in returned_resource_set if res.owner in expected_owners ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avail(self, time, resource_group):\n a = set()\n for r in self.resource_group.resources:\n pass", "def get_resources(self):\n res = set()\n res.update(self.get_inputs())\n res.update(self.get_outputs())\n return res", "def search_resources(self, conditional):\n r...
[ "0.5811197", "0.5749601", "0.5734158", "0.57138693", "0.56029826", "0.55906695", "0.55860853", "0.5571422", "0.5538224", "0.5534941", "0.55199194", "0.54968446", "0.548352", "0.54730636", "0.5462483", "0.54619956", "0.5407742", "0.5396251", "0.53668493", "0.5355272", "0.53521...
0.67035204
0
create an OpticsDescription and make sure it fails if units are missing
def test_construct_optics(): OpticsDescription( name="test", size_type=SizeType.LST, reflector_shape=ReflectorShape.PARABOLIC, n_mirrors=1, n_mirror_tiles=100, mirror_area=u.Quantity(550, u.m**2), equivalent_focal_length=u.Quantity(10, u.m), effective_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_construct_optics():\n OpticsDescription(\n name=\"test\",\n num_mirrors=1,\n num_mirror_tiles=100,\n mirror_area=u.Quantity(550, u.m ** 2),\n equivalent_focal_length=u.Quantity(10, u.m),\n )\n\n with pytest.raises(TypeError):\n OpticsDescription(\n ...
[ "0.7196217", "0.56905293", "0.55807394", "0.5456513", "0.5392586", "0.538737", "0.53750855", "0.5374919", "0.5374841", "0.53741705", "0.5371181", "0.5356631", "0.5356039", "0.5303193", "0.5301167", "0.52871114", "0.5274415", "0.52718306", "0.5246364", "0.52147675", "0.5199354...
0.78008306
0
Returns the city's weather
def get_weather(self): return self.__weather
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_weather(self):\n\n city = self.user_data[\"weatherSettings\"][\"weatherCity\"]\n country = self.user_data[\"weatherSettings\"][\"weatherCountry\"]\n\n host = \"weather.mios.com\"\n temp_scale = \"C\"\n url = \"http://%s/?tempFormat=%s&cityWeather=%s&countryWeather=%s\" % ...
[ "0.8158573", "0.7991035", "0.78909343", "0.779052", "0.7601341", "0.7493753", "0.7459171", "0.74171793", "0.7396342", "0.7393161", "0.7389976", "0.7368584", "0.7351321", "0.73313856", "0.72969973", "0.72741586", "0.7226426", "0.71553344", "0.7150858", "0.70951635", "0.7076162...
0.7998161
1
KPOINTS file written format
def write_output(self, user_kps=[]): if user_kps == []: kpoints = self.kps else: kpoints = user_kps if min(kpoints) > 0: fw = open('KPOINTS','w') fw.write('KPOINTS\n') fw.write('0\n') fw.write('Gamma\n') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def KPOINTS(points, header='', dest='.', gamma=True):\n print 'Making KPOINTS file...'\n if gamma:\n center = 'Gamma'\n else:\n center = 'Monkhorst'\n header = str(header)\n \n s = 'Automatic mesh %s' % header\n s += '\\n0' \n s += '\\n%s' % center\n s += '\\n%d %d %d' % (p...
[ "0.7680949", "0.64386225", "0.62907845", "0.62823975", "0.62431276", "0.6231152", "0.6125255", "0.612231", "0.6043202", "0.6021002", "0.59331673", "0.5904438", "0.5876673", "0.58739465", "0.5865406", "0.58551", "0.5840665", "0.58353406", "0.5817526", "0.5816389", "0.58064806"...
0.76395744
1
this function controls gameplay by iterating through the number of rounds and calling the perform_round function for each. the perform_round function returns the player to be removed for that round which is also called from this function.
def play_game(lst): number_of_rounds=lst.size-1 for round in range(1,number_of_rounds+1): number_of_passes=random.randint(-(2*lst.size),(2*lst.size)) remove_player(lst, perform_round(lst,number_of_passes)) cursor=lst.head print(cursor.data,"is the winner!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_round(self) -> None:\r\n self.collect_money()\r\n self.round_num += 1\r\n self.round_player_money = 0\r\n for player in self.players:\r\n player.set_already_raised(False)", "def play_round(self):\n print('='*10) # Round separation display\n print(f'Rou...
[ "0.6789043", "0.67241484", "0.640139", "0.63856524", "0.63816065", "0.6379626", "0.63466334", "0.6255803", "0.6233843", "0.62056315", "0.6128132", "0.6107873", "0.61034423", "0.60672474", "0.6036295", "0.6007066", "0.5978857", "0.59656787", "0.5963043", "0.59627223", "0.59405...
0.6738714
1
this function is called from the play_game function and it removes the player who was 'stuck with the potato' at the end of each round. it ensures that head and tail references remain intact and decrement the list accordingly
def remove_player(lst,player): print("Removing",player) cursor=lst.head while cursor.data!=player: cursor=cursor.next if cursor==lst.head: cursor.next.prev=lst.tail cursor.prev.next=cursor.next lst.head=cursor.next if cursor==lst.tail: cursor.next.prev=cursor....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeFromPlayerList(self):\n\t\tfor x in self.playerRemoveList:\n\t\t\tself.removePlayer(x)", "def cull(self) -> None:\n for player in self.players:\n to_remove = [creature for creature in player.battle_line if creature.damage_taken >= creature.power()]\n for creature in to_remo...
[ "0.65123177", "0.63221455", "0.63050866", "0.62616086", "0.62591946", "0.6235872", "0.6151183", "0.6131671", "0.605631", "0.60448986", "0.6034432", "0.60006094", "0.5953268", "0.5933007", "0.5919274", "0.5892594", "0.58757186", "0.5870959", "0.58654535", "0.5825909", "0.58150...
0.726261
0
Returns all scene assets.
def get_all_assets(self): return c4d.documents.GetAllAssets(self._document, False, '')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def returnAllAssets(self):\n return self.__assets", "def assets(self):\n return self._assets.values()", "def getAssets(self):\n return self.assets", "def get_assets(self):\n self.logger.debug(\"Fetching assets.\")\n return self._api_query(\"assets\")[\"assets\"]", "def ch...
[ "0.79148006", "0.7388927", "0.7363286", "0.7343612", "0.70494163", "0.6815413", "0.67707574", "0.6616679", "0.6502759", "0.64599687", "0.6388078", "0.63788337", "0.6294711", "0.629042", "0.62188584", "0.6144838", "0.6102181", "0.6045124", "0.5927903", "0.59136426", "0.5910713...
0.78163725
1
Returns a list of take settings for all takes in the scene.
def get_all_take_settings(self): take_settings = [] take_data = self._document.GetTakeData() def _traverse(take, depth): take_settings.append( C4dTakeSettings(self._main_thread_executor, take, take_data, depth, self._document)) for child_take in take.GetChild...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _list_settings(self, settings=None):\n if settings == None:\n settings = fileIO.load_json(\"settings.json\")\n print(\"The list of settings is: \")\n for i in settings:\n print(\"{0}: {1}\".format(i, settings[i]))\n return(None)", "def get_all_settings(profil...
[ "0.57145137", "0.56829137", "0.5681458", "0.56472075", "0.564445", "0.56234556", "0.55627966", "0.54923457", "0.54868585", "0.54854923", "0.54794174", "0.54638684", "0.54450613", "0.5429522", "0.5429522", "0.53882307", "0.5235746", "0.5195114", "0.51877916", "0.51831794", "0....
0.80501604
0
Returns name of the scene.
def get_scene_name(self): return self._document.GetDocumentName()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._scene_name", "def scene_name():\n\n pass", "def get_current_scene_name():\n\n scene_name = cmds.file(query=True, sceneName=True, shortName=True)\n scene_name = osp.splitext(scene_name)[0]\n\n return scene_name", "def bspb_sceneName():\n projectName = bs_pa...
[ "0.91623044", "0.859132", "0.8028259", "0.76417583", "0.72261703", "0.72261703", "0.71367395", "0.6990485", "0.68125004", "0.6693551", "0.66564184", "0.6653075", "0.6639346", "0.66376406", "0.66322047", "0.6629142", "0.6629142", "0.6629142", "0.6629142", "0.6629142", "0.66291...
0.8868723
1
Returns name of the scene without extension.
def get_scene_name_without_extension(self): return re.sub(r'\.c4d$', '', self.get_scene_name())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_scene_name(self):\n return self._document.GetDocumentName()", "def name(self):\n return self._scene_name", "def get_current_scene_name():\n\n scene_name = cmds.file(query=True, sceneName=True, shortName=True)\n scene_name = osp.splitext(scene_name)[0]\n\n return scene_name", "def s...
[ "0.77446645", "0.76176494", "0.75056267", "0.7391316", "0.6971184", "0.6722483", "0.6717563", "0.6558429", "0.64907384", "0.64628965", "0.6381981", "0.6360798", "0.6342684", "0.63157916", "0.6294775", "0.6282843", "0.6249788", "0.62023914", "0.62014425", "0.6194817", "0.61888...
0.8073612
0
Returns the path of the scene.
def get_scene_path(self): return self._maybe_fix_windows_path(self._document.GetDocumentPath())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def currentScenePath(self):\n logger.debug(\"Func: currentBaseScenePath/getter\")\n\n return os.path.join(self.projectDir, self._currentSceneInfo[\"Versions\"][self.currentVersionIndex-1][\"RelativePath\"])", "def currentBaseScenePath(self):\n logger.debug(\"Func: currentBaseScenePath/getter...
[ "0.7808846", "0.7336566", "0.70863146", "0.70296896", "0.7013405", "0.7013405", "0.6983869", "0.69631296", "0.6961136", "0.6953609", "0.6948439", "0.6935067", "0.6935067", "0.6935067", "0.6935067", "0.6891935", "0.6875375", "0.6852452", "0.6852452", "0.6852452", "0.6852452", ...
0.8036171
0
Checks if the provided document is the same as the one with which this instance was initialized.
def has_the_same_document(self, document): try: return document == self._document and document.GetDocumentPath() == \ self._document.GetDocumentPath() except ReferenceError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n if not isinstance(other, Document):\n return False\n\n return self.__dict__ == other.__dict__", "def validateDocument(self, doc):\n if doc is None: doc__o = None\n else: doc__o = doc._o\n ret = libxml2mod.xmlValidateDocument(self._o, doc__o...
[ "0.6909281", "0.66066235", "0.65212065", "0.64504385", "0.6407911", "0.63363045", "0.6308045", "0.6298419", "0.6292361", "0.6220213", "0.6178518", "0.6174105", "0.6146417", "0.61002827", "0.6076059", "0.60620683", "0.6045985", "0.6036641", "0.6031452", "0.6000527", "0.599361"...
0.8196296
0
Checks if the scene is saved.
def is_saved(self): return self.get_scene_path() != '' and not self._document.GetChanged()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsSaved(self):\n\t\treturn self.acad.ActiveDocument.Saved", "def check_is_saved(self):\n raise NotImplementedError()", "def _check_scene_open(self):\n return self._engine.current_file_path() is not None", "def is_saved(self):\n return self._slicerIsSaved", "def has_saved(self, even...
[ "0.73493844", "0.7254954", "0.7156946", "0.695256", "0.6739197", "0.6644546", "0.6619367", "0.6561541", "0.655039", "0.6498395", "0.6490378", "0.646278", "0.64500505", "0.631071", "0.63061804", "0.6293041", "0.62691706", "0.625628", "0.62528276", "0.61826736", "0.6141712", ...
0.86973995
0
\Theta(n^3) method to calculate the expected cost of the optimal BST.
def get_optimal_bst(p, q): assert p is not None assert q is not None assert len(p) == len(q) n = len(p) - 1 assert n >= 0 if n == 0: return 1.0, [] e = [[-1 for _ in range(0, n + 1)] for _ in range(0, n + 1)] root = [[-1 for _ in range(0, n)] for _ in range(0, n)] for i i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_best_way(self) -> int:\n node = self._find_lowest_cost_node()\n while node:\n cost = self.costs[node]\n neighbors = self.graph[node]\n for neighbor in neighbors.keys():\n node_cost = cost + neighbors[neighbor]\n if self.cost...
[ "0.68802005", "0.6709244", "0.62288725", "0.6184886", "0.6125053", "0.60624397", "0.59995437", "0.5982352", "0.59660757", "0.5932713", "0.5929007", "0.5865698", "0.5860287", "0.5847322", "0.58336675", "0.5827743", "0.58238465", "0.58049667", "0.5789467", "0.5785034", "0.57723...
0.6960742
0
\Theta(n^2) method to calculate the expected cost of the optimal BST. Takes use of Knuth's conclusion that a root matrix exists so that root[i][j1] <= root[i][j] <= root[i+1][j] for all i < j.
def get_optimal_bst_fast(p, q): assert p is not None assert q is not None assert len(p) == len(q) n = len(p) - 1 assert n >= 0 e = [[-1 for _ in range(0, n + 1)] for _ in range(0, n + 2)] w = [[-1 for _ in range(0, n + 1)] for _ in range(0, n + 2)] root = [[-1 for _ in range(0, n)] for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_optimal_bst(p, q):\n\n assert p is not None\n assert q is not None\n assert len(p) == len(q)\n n = len(p) - 1\n assert n >= 0\n\n if n == 0:\n return 1.0, []\n\n e = [[-1 for _ in range(0, n + 1)] for _ in range(0, n + 1)]\n root = [[-1 for _ in range(0, n)] for _ in range(0,...
[ "0.6906452", "0.60709584", "0.588671", "0.5770251", "0.57167107", "0.56957114", "0.56831235", "0.5621595", "0.5570404", "0.5544286", "0.5538527", "0.5525354", "0.55162233", "0.55161303", "0.5510437", "0.5503939", "0.5503517", "0.5502011", "0.5501439", "0.54870886", "0.5455407...
0.67792785
1
Recursively sort list or dict nested lists
def recursive_sort(obj): if isinstance(obj, dict): for key, val in obj.iteritems(): obj[key] = recursive_sort(val) _sorted = obj elif isinstance(obj, list): new_list = [] for val in obj: new_list.append(recursive_sort(val)) _sorted = sorted(new_l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sort_nodes(cls: Type, lst: List[Dict[str, Any]],\n by: str = 'item_title'):\n assert type(lst) == list\n lst.sort(key=lambda n: n[by])\n for n in lst:\n if 'nodes' in n:\n cls._sort_nodes(n['nodes'], by)", "def sort_tree(data_list, sort_key_p...
[ "0.6870522", "0.6836625", "0.6693552", "0.6647584", "0.6405208", "0.6400667", "0.637927", "0.6320867", "0.6313137", "0.6243161", "0.6231137", "0.6197422", "0.61671627", "0.61670756", "0.61259884", "0.60648847", "0.6053707", "0.6015906", "0.59107816", "0.5910119", "0.58951104"...
0.69302994
0
Executes a pigpio socket command.
def _pigpio_command(sock, cmd, p1, p2): if sock is not None: sock.send(struct.pack('IIII', cmd, p1, p2, 0)) x, y, z, res = struct.unpack('IIII', sock.recv(16)) return res else: raise _pigpioError("*** Module not started, call pigpio.start() ***")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pigpio_command_ext(sock, cmd, p1, p2, extents):\n if sock is not None:\n msg = struct.pack('IIII', cmd, p1, p2, 0)\n for ext in extents: msg += ext\n sock.sendall(msg)\n x, y, z, res = struct.unpack('IIII', sock.recv(16))\n return res\n else:\n raise _pigpioError(\"*** Modul...
[ "0.6749727", "0.6158536", "0.56130964", "0.55257773", "0.54540557", "0.544766", "0.5429975", "0.53793585", "0.53342295", "0.5333023", "0.5332043", "0.5328123", "0.53224134", "0.5302751", "0.5292858", "0.528122", "0.5278182", "0.5271519", "0.5267302", "0.52533823", "0.52503264...
0.81030446
0
Executes an extended pigpio socket command.
def _pigpio_command_ext(sock, cmd, p1, p2, extents): if sock is not None: msg = struct.pack('IIII', cmd, p1, p2, 0) for ext in extents: msg += ext sock.sendall(msg) x, y, z, res = struct.unpack('IIII', sock.recv(16)) return res else: raise _pigpioError("*** Module not started,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pigpio_command(sock, cmd, p1, p2):\n if sock is not None:\n sock.send(struct.pack('IIII', cmd, p1, p2, 0))\n x, y, z, res = struct.unpack('IIII', sock.recv(16))\n return res\n else:\n raise _pigpioError(\"*** Module not started, call pigpio.start() ***\")", "def eprt_cmd(self, proto...
[ "0.77093375", "0.56171656", "0.55937904", "0.5364864", "0.5340037", "0.5328134", "0.5307892", "0.5300608", "0.52866066", "0.5278818", "0.52584463", "0.5224311", "0.5205626", "0.52012485", "0.5194916", "0.5194699", "0.51928604", "0.518897", "0.51671207", "0.5155846", "0.515001...
0.77301323
0
Set the gpio mode.
def set_mode(gpio, mode): return _u2i(_pigpio_command(_control, _PI_CMD_MODES, gpio, mode))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setmode(self, mode):\n # ueberpruefe, ob der Modus gueltig ist\n if mode in [GPIO.BCM, GPIO.BOARD]:\n self.mode = mode\n print(f\"Modus auf {mode} gesetzt\")\n else:\n raise ValueError(\"An invalid mode was passed to setmode()\")", "def setup_gpio(self):\...
[ "0.73701143", "0.6988686", "0.6701568", "0.6627662", "0.66036546", "0.6546484", "0.6519655", "0.64256644", "0.63737124", "0.6357623", "0.63544023", "0.6337343", "0.6337022", "0.63302016", "0.63285375", "0.6321674", "0.62827396", "0.62731683", "0.62613213", "0.62119853", "0.61...
0.81758034
0
Get the gpio mode. Returns the gpio mode if OK, otherwise PI_BAD_GPIO.
def get_mode(gpio): return _u2i(_pigpio_command(_control, _PI_CMD_MODEG, gpio, 0))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gpio_status(self, mode=None):\n if mode == True:\n print('gtd: status(True), was {}'.format(repr(self.gpio_state)))\n # TODO: Turn on the GPIO for Heat and Fan\n self.gpio_state = True\n elif mode == False:\n print('gtd: status(False), was {}'.format(re...
[ "0.68460256", "0.651641", "0.64104354", "0.6068761", "0.60609215", "0.5901669", "0.5876019", "0.5844004", "0.582057", "0.57855934", "0.5780658", "0.577863", "0.5758183", "0.57478285", "0.5708945", "0.5695887", "0.5661123", "0.5659766", "0.5653747", "0.5627731", "0.56262314", ...
0.8368854
0
Set or clear the gpio pullup/down resistor. Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_PUD, or PI_NOT_PERMITTED.
def set_pull_up_down(gpio, pud): return _u2i(_pigpio_command(_control, _PI_CMD_PUD, gpio, pud))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gpio_set_input_pullup(self, pin: int) -> None:\n self._pins[pin - 1] = \"INPUT_PULLUP\"", "def set_pin_pullup(self, pin, value):\n pin = pin - 1\n if pin < 8:\n self.__port_a_pullup = self.__helper.updatebyte(\n self.__port_a_pullup, pin, value)\n sel...
[ "0.5966621", "0.5765362", "0.57463443", "0.5715893", "0.5691199", "0.5689781", "0.5672907", "0.5666626", "0.56485367", "0.551315", "0.5511797", "0.54891694", "0.5486965", "0.5470313", "0.54582816", "0.5456358", "0.53926957", "0.53535706", "0.534321", "0.5318191", "0.52833074"...
0.64496887
0
Read the gpio level. Returns the gpio level if OK, otherwise PI_BAD_GPIO.
def read(gpio): return _u2i(_pigpio_command(_control, _PI_CMD_READ, gpio, 0))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mode(gpio):\n return _u2i(_pigpio_command(_control, _PI_CMD_MODEG, gpio, 0))", "def _do_get_level(self):\n logging.info(__name__ + ' : Read level of channel 1')\n result = self._execute('R1')\n return float(result.replace(\"R\", \"\")) / 10", "def gpio(self) -> int:", "def read...
[ "0.6246546", "0.6178588", "0.61473036", "0.61233044", "0.6045374", "0.6043032", "0.597285", "0.5971351", "0.58981156", "0.58965963", "0.58692306", "0.5800032", "0.57912314", "0.57090676", "0.5700577", "0.5690867", "0.56805086", "0.56707335", "0.5591471", "0.55661803", "0.5558...
0.67489696
0
Write the gpio level. Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_LEVEL, or PI_NOT_PERMITTED.
def write(gpio, level): return _u2i(_pigpio_command(_control, _PI_CMD_WRITE, gpio, level))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_level(self, current_level):\n try:\n if isinstance(current_level, numbers.Number):\n if 1 <= current_level <= 3:\n current_level = str(current_level)\n self.store.put(LEVEL_STORE, level=current_level)\n except:\n pri...
[ "0.60646546", "0.55102795", "0.54987025", "0.54412705", "0.54124314", "0.5370314", "0.53354824", "0.5312178", "0.5277599", "0.5264569", "0.52260953", "0.522468", "0.5204833", "0.51930666", "0.516427", "0.5160129", "0.51343644", "0.50884634", "0.50754654", "0.5062609", "0.5013...
0.7548673
0
Start (nonzero dutycycle) or stop (0) PWM pulses on the gpio. Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_DUTYCYCLE, or PI_NOT_PERMITTED.
def set_PWM_dutycycle(user_gpio, dutycycle): return _u2i(_pigpio_command(_control, _PI_CMD_PWM, user_gpio, dutycycle))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_PWM_range(user_gpio):\n return _u2i(_pigpio_command(_control, _PI_CMD_PRG, user_gpio, 0))", "def __init__(self, servo_gpio, pi=None, pulse_left_ns=2500, pulse_right_ns=1000, pulse_centre_ns=None):\n\n self.gpio = servo_gpio\n\n if pi is None:\n self.pi = pi = pigpio.pi()\n ...
[ "0.59510094", "0.5841308", "0.5794132", "0.5698013", "0.5638398", "0.55871224", "0.5514766", "0.55016214", "0.54185426", "0.5373289", "0.5357235", "0.5293218", "0.52856135", "0.5219256", "0.52131397", "0.51952195", "0.5191489", "0.51635724", "0.5160985", "0.5146592", "0.51293...
0.66211385
0
Set the range of PWM values to be used on the gpio. Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_DUTYRANGE, or PI_NOT_PERMITTED.
def set_PWM_range(user_gpio, range_): return _u2i(_pigpio_command(_control, _PI_CMD_PRS, user_gpio, range_))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_PWM_range(user_gpio):\n return _u2i(_pigpio_command(_control, _PI_CMD_PRG, user_gpio, 0))", "def get_PWM_real_range(user_gpio):\n return _u2i(_pigpio_command(_control, _PI_CMD_PRRG, user_gpio, 0))", "def _set_pwm(self, raw_values):\n for i in range(len(self._pins)):\n self._pi.set...
[ "0.6903804", "0.64802706", "0.60067755", "0.58858705", "0.58708185", "0.58489203", "0.5753922", "0.5605951", "0.55939317", "0.5473511", "0.5472374", "0.54461926", "0.54359305", "0.54064345", "0.5387591", "0.5380408", "0.532704", "0.5324829", "0.5308869", "0.5295573", "0.52633...
0.7968123
0
Get the range of PWM values being used on the gpio. Returns the dutycycle range used for the gpio if OK, otherwise PI_BAD_USER_GPIO.
def get_PWM_range(user_gpio): return _u2i(_pigpio_command(_control, _PI_CMD_PRG, user_gpio, 0))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_PWM_real_range(user_gpio):\n return _u2i(_pigpio_command(_control, _PI_CMD_PRRG, user_gpio, 0))", "def set_PWM_range(user_gpio, range_):\n return _u2i(_pigpio_command(_control, _PI_CMD_PRS, user_gpio, range_))", "def get_PWM_frequency(user_gpio):\n return _u2i(_pigpio_command(_control, _PI_CMD_PF...
[ "0.765557", "0.66512173", "0.61994433", "0.6053772", "0.5918388", "0.5853133", "0.58236945", "0.57681507", "0.57501", "0.5722623", "0.5573397", "0.55700403", "0.5500223", "0.54832375", "0.546351", "0.5449539", "0.54490256", "0.54359204", "0.5433655", "0.5419566", "0.54105836"...
0.8118887
0
Get the real underlying range of PWM values being used on the gpio. Returns the real range used for the gpio if OK, otherwise PI_BAD_USER_GPIO.
def get_PWM_real_range(user_gpio): return _u2i(_pigpio_command(_control, _PI_CMD_PRRG, user_gpio, 0))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_PWM_range(user_gpio):\n return _u2i(_pigpio_command(_control, _PI_CMD_PRG, user_gpio, 0))", "def set_PWM_range(user_gpio, range_):\n return _u2i(_pigpio_command(_control, _PI_CMD_PRS, user_gpio, range_))", "def PWMvalue(self, v, minPWM, maxPWM):\n pwm = 0\n if math.fabs(v) > self.SPEE...
[ "0.8013507", "0.67188954", "0.5904552", "0.59033704", "0.5854003", "0.58518046", "0.58146846", "0.5794788", "0.57866156", "0.5736015", "0.5717286", "0.56514156", "0.5626798", "0.5618219", "0.55474925", "0.5529095", "0.5525325", "0.5523527", "0.55130154", "0.55095696", "0.5505...
0.8185473
0
Set the frequency (in Hz) of the PWM to be used on the gpio. Returns the numerically closest frequency if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_PERMITTED.
def set_PWM_frequency(user_gpio, frequency): return _u2i(_pigpio_command(_control, _PI_CMD_PFS, user_gpio, frequency))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_PWM_frequency(user_gpio):\n return _u2i(_pigpio_command(_control, _PI_CMD_PFG, user_gpio, 0))", "def set_pwm_freq(self, servo_frequency: int):\n prescaleval = float(self._frequency)\n prescaleval /= float(self._resolution)\n prescaleval /= float(servo_frequency)\n prescaleva...
[ "0.733027", "0.6947587", "0.66606504", "0.65479803", "0.6421843", "0.6393472", "0.6266007", "0.6158921", "0.61287534", "0.61092573", "0.60931885", "0.6061429", "0.6047837", "0.59890205", "0.5946561", "0.591042", "0.5868069", "0.58495045", "0.58495045", "0.5811198", "0.5799517...
0.78752476
0