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
Iterate over all hosts in the configured environment.
def iter_hosts(): environmentdef = _get_environmentdef() for host in environmentdef.hosts(): # fabric needs the host if we're calling from main() with this_hostname(host.host): yield host
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_hosts_and_roles():\n environmentdef = _get_environmentdef()\n\n for host_and_role in environmentdef.all():\n # fabric needs the host if we're calling from main()\n with this_hostname(host_and_role.host):\n yield host_and_role", "def all_hosts(self):\n ...", "def g...
[ "0.7910496", "0.7700077", "0.6888776", "0.68519026", "0.67762613", "0.6761311", "0.671776", "0.65915793", "0.65915793", "0.6575619", "0.6548611", "0.6548611", "0.64787936", "0.64138263", "0.63953847", "0.6352524", "0.6312351", "0.62983984", "0.6268376", "0.62409633", "0.62282...
0.85509855
0
Iterate over all hosts and roles in the configured environment.
def iter_hosts_and_roles(): environmentdef = _get_environmentdef() for host_and_role in environmentdef.all(): # fabric needs the host if we're calling from main() with this_hostname(host_and_role.host): yield host_and_role
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_hosts():\n environmentdef = _get_environmentdef()\n\n for host in environmentdef.hosts():\n # fabric needs the host if we're calling from main()\n with this_hostname(host.host):\n yield host", "def all_hosts(self):\n ...", "def deploy_environments(self):\n ...
[ "0.7540506", "0.68634295", "0.6734753", "0.6482466", "0.6400778", "0.6058315", "0.60366553", "0.5947669", "0.5942589", "0.58594257", "0.5844923", "0.57926667", "0.5766427", "0.57496643", "0.5656427", "0.5587259", "0.5566266", "0.55491513", "0.55491513", "0.553944", "0.5537098...
0.854959
0
Collect and configure the configuration options for instantiation of Scaffold and child classes. This method operates by taking an argument list in ArgParse format and creating an argument list. The argument list is created by invoking the configuration_option method defined by each of the progenitor classes derived fr...
def _execute_configuration(self, argv=None): if argv is None: argv = [] # just create an empty arg list arg_parser = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter) # if this is the command line args directly, them we need to remove the ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure(self, args):\n pass", "def config(self, *args, cnf=None, **kwargs): # cnf=None,\n # some for frame, some for children, some for both\n debug_b = kwargs.get(\"debug\", self.default_debug)\n if cnf and isinstance(cnf, (dict, collections.OrderedDict)):\n kwargs....
[ "0.59727573", "0.5760519", "0.5513255", "0.54259294", "0.5410951", "0.53889775", "0.53889775", "0.53889775", "0.53875566", "0.5378751", "0.5326934", "0.5286303", "0.5241962", "0.52353686", "0.5199434", "0.5159001", "0.5139721", "0.5134693", "0.5126395", "0.51209337", "0.50927...
0.64978266
0
Validate inputs that might depend on each other and cannot be validated by the spec. Also define dictionary `inputs` in the context, that will contain the inputs for the calculation that will be launched in the `run_calculation` step.
def validate_inputs(self): self.ctx.inputs = AttributeDict(self.exposed_inputs(FleurCalculation)) self.ctx.max_queue_nodes = self.inputs.add_comp_para['max_queue_nodes'] self.ctx.max_queue_wallclock_sec = self.inputs.add_comp_para['max_queue_wallclock_sec'] input_options = self.inputs....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_inputs(self, extra_inputs=[]):\n pass", "def validate_inputs(self, input_dict):\n if not self.in_distributed_mode:\n required_keys = {\n 'project_value_usd',\n 'foundation_cost_usd',\n 'construct_duration',\n 'num_h...
[ "0.65034956", "0.64181006", "0.61677456", "0.6144808", "0.6021667", "0.6015336", "0.596513", "0.5963825", "0.59117913", "0.5884635", "0.5870501", "0.58672786", "0.5835859", "0.5801322", "0.57919276", "0.5688777", "0.56788653", "0.5661981", "0.5644625", "0.5610465", "0.5603277...
0.69409364
0
This routine checks if the total number of requested cpus is a factor of kpts and makes an optimisation. If suggested number of num_mpiprocs_per_machine is 60% smaller than requested, it throws an exit code and calculation stop withour submission.
def check_kpts(self): if 'fleurinp' in self.ctx.inputs: fleurinp = self.ctx.inputs.fleurinp else: fleurinp = get_fleurinp_from_remote_data(self.ctx.inputs.parent_folder) only_even_MPI = self.inputs.add_comp_para['only_even_MPI'] forbid_single_mpi = self.inputs.ad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def workersNeeded(k, m):\n # formula: k/m\n from math import ceil\n return ceil(float(k)/float(m))", "def determine_jobs_per_pool(numpools, totaljobs):\n cluster = os.environ['CC_CLUSTER']\n if cluster in ['graham', 'beluga']:\n jobs_per_pool = math.floor(totaljobs / numpools)\n else:\n ...
[ "0.6427951", "0.6030099", "0.5964466", "0.57977664", "0.5685874", "0.5683077", "0.56660026", "0.55924076", "0.55720013", "0.55593735", "0.5512766", "0.5433339", "0.5409715", "0.54059696", "0.54053944", "0.538924", "0.5377437", "0.53727514", "0.5364178", "0.53556436", "0.53220...
0.7223724
0
Calculation failed for unknown reason.
def _handle_general_error(self, calculation): self.ctx.restart_calc = calculation self.ctx.is_finished = True self.report('Calculation failed for a reason that can not be resolved automatically') self.results() return ProcessHandlerReport(True, self.exit_codes.ERROR_SOMETHING_WEN...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unexpected_error(self, exception):", "def test_value_error(self):\n self._error_test(ValueError)", "def _ValueMismatch(how_much):\n return 'Values mismatch, %s' % how_much", "def failed(self):\n\t\tpass", "def _debug_calc_error(self, line):\n debug(\"RPN Calculator Error: %s\" % line)", ...
[ "0.6252275", "0.61572564", "0.6130475", "0.61248606", "0.60657954", "0.6015355", "0.6000163", "0.5994426", "0.59731823", "0.5971241", "0.5969168", "0.594006", "0.5929817", "0.58756495", "0.58731556", "0.58456093", "0.58395815", "0.58315194", "0.581081", "0.5800833", "0.579858...
0.6983805
0
Sometimes relaxation calculation fails with Diraq problem which is usually caused by problems with reusing charge density. In this case we resubmit the calculation, dropping the input cdn.
def _handle_dirac_equation(self, calculation): # try to drop remote folder and see if it helps is_fleurinp_from_relax = False if 'fleurinp' in self.ctx.inputs: if 'relax.xml' in self.ctx.inputs.fleurinp.files: is_fleurinp_from_relax = True if 'parent_folder'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _invalidate_cdns(comparison: wood.comparison.Comparison, domain: str) \\\n -> None:\n # first, as closest to the source\n cloudfront = wood.cloudfront.Invalidator(\n CF_CLIENT,\n os.environ['CLOUDFRONT_DISTRIBUTION'],\n 'Deploying ' + os.environ['TRAVIS_TAG'])\n cloudfront....
[ "0.56138307", "0.5231401", "0.50161755", "0.50055397", "0.4850702", "0.4842591", "0.48163563", "0.47885635", "0.4756971", "0.4743173", "0.47394258", "0.46810076", "0.4679003", "0.4651907", "0.46171993", "0.45979854", "0.45827895", "0.45751816", "0.45602107", "0.4557385", "0.4...
0.5585418
1
Calculation failed due to lack of memory. Probably works for JURECA only, has to be tested for other systems.
def _handle_not_enough_memory(self, calculation): if not self.ctx.can_be_optimised: self.ctx.restart_calc = calculation self.ctx.is_finished = True self.report('I am not allowed to optimize your settings. Consider providing at least' 'num_machines and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_out_of_memory(self) -> bool:\n return pulumi.get(self, \"device_out_of_memory\")", "def check_if_sufficient_memory():\n percent_memory = psutil.virtual_memory().percent\n if percent_memory > 75:\n raise ValueError('Please use a device with more CPU ram or a smaller data...
[ "0.62032247", "0.61942124", "0.6174753", "0.61299205", "0.60466856", "0.6010006", "0.60041094", "0.59668463", "0.5957401", "0.5885092", "0.584892", "0.5836465", "0.5833703", "0.58225185", "0.5818302", "0.577025", "0.574529", "0.57291704", "0.571808", "0.5713655", "0.567599", ...
0.7342122
0
If calculation fails due to time limits, we simply resubmit it.
def _handle_time_limits(self, calculation): from aiida.common.exceptions import NotExistent # if previous calculation failed for the same reason, do not restart try: prev_calculation_remote = calculation.base.links.get_incoming().get_node_by_label('parent_folder') prev_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resubmit(self, *args, **kwargs):\n self.retry()", "def resubmit(self):\n self.keep_data = True\n ManagedJob.submit(self)", "def _prevent_dos(cls):\n if cls._last_query is not None:\n if time.time() - cls._last_query < cls._dos_timeout:\n raise RuntimeE...
[ "0.65991277", "0.5806208", "0.56202286", "0.55866534", "0.55750173", "0.55712885", "0.54455066", "0.5393084", "0.52936095", "0.5235407", "0.516206", "0.5125437", "0.5121226", "0.5103697", "0.50745785", "0.506592", "0.5048986", "0.5037014", "0.50357914", "0.50325423", "0.50302...
0.7021555
0
Check whether the remote folder of the given calculation can be resubmitted
def _is_remote_reusable(inputs, calculation): can_use_remote = False #If no charge density file is available to restart from the calculation will except #with a not nice error message. So we can only reuse the charge density if these files are available retrieved_filenames = calculation.base.links.get_o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_r_res(res, o_exp, g_exp, p_exp):\n print green(\"Checking %s owner, group, permissions. \"\n \"Expected: %s, %s, %s\" % (res, o_exp, g_exp, p_exp))\n if exists(res):\n resp = run('stat -c %%U,%%G,%%a %s' % res)\n o_act, g_act, p_act = map(str.strip, resp.split(','))\n i...
[ "0.56634974", "0.5623166", "0.5564346", "0.5473562", "0.5453664", "0.5434945", "0.5402862", "0.5300802", "0.5294283", "0.52819175", "0.5272065", "0.5257104", "0.52426213", "0.52416456", "0.5234071", "0.522212", "0.52155894", "0.5203311", "0.5197153", "0.51871717", "0.51684946...
0.6226816
0
Returns the names for each theme.
def theme_names(self): return [theme.get('name', 'Error') for theme in self.themes]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_themes(self):\n return sorted(self.themes.values(), key=attrgetter('identifier'))", "async def _themelist_heist(self, ctx):\r\n themes = [os.path.join(x).replace('.txt', '')\r\n for x in os.listdir(str(bundled_data_path(self))) if x.endswith(\".txt\")]\r\n if len(th...
[ "0.7258863", "0.6952347", "0.6912411", "0.6716671", "0.6630141", "0.64585596", "0.6454502", "0.6368853", "0.6253226", "0.60954094", "0.60813916", "0.6052403", "0.59760046", "0.5926315", "0.59095395", "0.59089017", "0.59021604", "0.5872757", "0.58303183", "0.5825799", "0.58223...
0.7720638
0
Returns the theme named name. Paramters
def theme_named(self, name): for theme in self.themes: if theme.get('name', 'Error') == name: return theme
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_theme(self) -> str:\n return self.theme or self.account.theme", "def theme_name(context):\n return {'THEME_NAME': settings.THEME_NAME}", "def _get_theme_selected():\n\n try:\n theme_selected = Configuration.objects.filter(group='theme', key='selected')[0]\n theme_name = theme...
[ "0.7531055", "0.74231696", "0.73877615", "0.7128187", "0.6642205", "0.6520001", "0.63895035", "0.6328346", "0.62944263", "0.62397254", "0.61943275", "0.61603075", "0.61520386", "0.60468477", "0.604257", "0.603625", "0.5970078", "0.59646434", "0.58963805", "0.58963805", "0.588...
0.7830729
0
create a list of num_visualize most frequent words to visualize on TensorBoard. saved to visualization/vocab_[num_visualize].tsv
def most_common_words(visual_fld, num_visualize): words = open(os.path.join(visual_fld, 'vocab.tsv'), 'r').readlines()[:num_visualize] words = [word for word in words] file = open(os.path.join(visual_fld, 'vocab_' + str(num_visualize) + '.tsv'), 'w') for word in words: file.write(word) file....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_common_words(n):\n with open(os.path.join('visualization', 'vocab.tsv')) as fd:\n words = fd.readlines()[:n]\n words = [word for word in words]\n save_path = os.path.join('visualization', 'vocab_' + str(n) + '.tsv')\n with open(save_path, 'w') as fd:\n for word in words:\n ...
[ "0.69499654", "0.6873924", "0.6560038", "0.6346649", "0.6343481", "0.6298415", "0.62436503", "0.62128407", "0.62004054", "0.6171968", "0.61594397", "0.6136616", "0.61123174", "0.61083573", "0.6105296", "0.60912186", "0.6069283", "0.60650533", "0.6037844", "0.6019598", "0.6019...
0.78078437
0
Compute a gradient clipping coefficient based on gradient norm.
def clip_gradient(model, clip): totalnorm = 0 for p in model.parameters(): modulenorm = p.grad.data.norm() totalnorm += modulenorm ** 2 totalnorm = math.sqrt(totalnorm) return min(1, clip / (totalnorm + 1e-6))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clip_gradient(parameters, clip):\n totalnorm = 0\n for p in parameters:\n modulenorm = p.grad.data.norm()\n totalnorm += modulenorm ** 2\n totalnorm = math.sqrt(totalnorm)\n return min(1, clip / (totalnorm + 1e-6))", "def clip_gradient(model, clip_norm):\n totalnorm = 0\n for ...
[ "0.8147986", "0.7765412", "0.7751863", "0.76277953", "0.695568", "0.69115525", "0.6853288", "0.6753333", "0.65958244", "0.6575392", "0.64888096", "0.64880824", "0.64880824", "0.64880824", "0.64880824", "0.64880824", "0.6483369", "0.64782876", "0.64637333", "0.6421132", "0.641...
0.77999336
1
Sends mail through localhost. Takes error message and intended recipient as arguments.
def sendmail(message, recipient): import smtplib fromaddr = "pythonprogram@someaddress.com" toaddrs = recipient + "@someaddress.com" # Add the From: and To: headers at the start! msg = ("From: %s\r\nTo: %s\r\n\r\n" %(fromaddr, ", ".join(toaddrs))) msg = msg + str(message[0]) + message[1]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_email():\n send_mail(\"You've got some problem.\", 'REPAIR IT', 'dimazarj2009@rambler.ru',\n ['dimazarj2009@rambler.ru'], fail_silently=False,)", "def send_email(recipient, subject, message):\n from_email = os.getenv(\"EMAIL_SENDER\")\n status = send_mail(subject, message, from_ema...
[ "0.689734", "0.68238056", "0.67969203", "0.67854875", "0.6722981", "0.6706382", "0.66780823", "0.6659879", "0.6632274", "0.6586996", "0.6578835", "0.65707225", "0.65678155", "0.6551127", "0.6550663", "0.6516752", "0.6514903", "0.6490638", "0.6483144", "0.6421124", "0.6411392"...
0.71500117
0
Forms the MySQL statement according to the type of statement
def form(self, table, column, info): info = info.replace(" ","") data = info.split(',') value = "'" + data[0] for i in xrange(1, len(data)): value = value + "', '" + data[i] value = value + "'" if self.type == "select": statement = """SELECT * FRO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mogrify_sql_statement(self, content):\n sql = content[0]\n args = content[1]\n\n if self.dbmi.__name__ == \"psycopg2\":\n if len(args) == 0:\n return sql\n else:\n if self.connected:\n try:\n retu...
[ "0.67627823", "0.6405724", "0.62800163", "0.62758744", "0.62433076", "0.62364", "0.616363", "0.616363", "0.6151442", "0.6109276", "0.60840946", "0.60178655", "0.6013414", "0.59979403", "0.59541327", "0.5899089", "0.5895892", "0.58537436", "0.58370644", "0.5822611", "0.5812459...
0.6494392
1
The main function creates and controls the MySQLStatement instance in accordance with the user's input.
def main(): request = MySQLStatement() try: request.type(statement_type) phrase = request.form(table, columns, values) cur = connection(database) results = request.execute(phrase, table, cur) print "Results:\n", results except MySQLdb.Error, e: sendmail(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n db_config_params = config.get_db_config('psql')\n print(f'Connecting to {db_config_params[\"database\"]} database.')\n\n try:\n # Will commit and close the connection\n with psycopg2.connect(**db_config_params) as connection:\n with connection.cursor() as cursor:\n...
[ "0.6042446", "0.5995758", "0.5982489", "0.5947622", "0.5874833", "0.58425796", "0.58405966", "0.58399653", "0.58202523", "0.5805545", "0.57275486", "0.5722384", "0.5654296", "0.56375355", "0.56349766", "0.56290597", "0.5610471", "0.5603635", "0.55781364", "0.55664927", "0.556...
0.6977296
0
A shortcut to create a program from a list of nodes.
def make_program(*nodes: base.Node, name: str = 'launchpad'): program = Program(name) for node in nodes: program.add_node(node) return program
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def program(self, p):\n return Tree('program', self.flatten([p[0], self.assemble_pre(p), p[-1], self.assemble_post(p)]))", "def naoapp_from_nodes(nodes: Iterable[Node], name: Optional[str] = None) -> EObject:\n naoapp = create_nao_app(name)\n\n for node in nodes:\n if isinstance(node, str):\n...
[ "0.6518654", "0.6015565", "0.58595204", "0.578393", "0.56553143", "0.56381935", "0.5632635", "0.5630788", "0.5589796", "0.557004", "0.55266714", "0.5481917", "0.545592", "0.54360104", "0.5401403", "0.5400513", "0.53400344", "0.53092164", "0.5300324", "0.52743846", "0.5270165"...
0.8402239
0
returns the probability of a loss
def get_probability_loss(self): return sum(self._loss)/len(self._loss)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_loss(self):\n return self.loss / self.cnt", "def calculate_perplexity(loss):\n return math.exp(float(loss)) if loss < 300 else float(\"inf\")", "def loss_fn(gr_truth, pred):\n return 100 * dice_loss(pred, gr_truth) + softmax_weighted_loss(pred, gr_truth)", "def compute_perplexity(self,lo...
[ "0.7341477", "0.7320893", "0.7283728", "0.7255013", "0.7058322", "0.6869744", "0.6852506", "0.68454576", "0.6808673", "0.67566216", "0.67345244", "0.6734427", "0.67288667", "0.669272", "0.66677886", "0.66516596", "0.6648021", "0.6635887", "0.6624248", "0.6623514", "0.6592672"...
0.8464279
0
Applies a variety of morphological operations to improve the detection of worms in the image. Takes 0.030 s on MUSSORGSKY for a typical frame region Takes 0.030 s in MATLAB too
def applyMorphologicalCleaning(self, image):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opencv_watershed(masked, mask) -> JSON_TYPE:\n # For code and detailed explanation see:\n # http://datahacker.rs/007-opencv-projects-image-segmentation-with-watershed-algorithm/\n threshold: int = 30\n gray = cv2.cvtColor(masked, cv2.COLOR_RGB2GRAY)\n ret, thresh_img = cv2.threshold(gray, threshold, 255, ...
[ "0.65355736", "0.6473547", "0.64311", "0.6263216", "0.62291163", "0.6213835", "0.6212398", "0.6122163", "0.6105487", "0.6096114", "0.6086078", "0.6071784", "0.60656536", "0.6019311", "0.6004523", "0.5987301", "0.5977021", "0.5973511", "0.59590006", "0.58881074", "0.58683956",...
0.66678315
0
Returns the expected length of a worm in pixels
def expectedWormLengthPixels(self): return self.expectedWormLength * self.pixelSize
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expectedWormWidthPixels(self):\n return self.expectedWormWidth * self.pixelSize", "def expectedWormAreaPixels(self):\n return (self.expectedWormLengthPixels() *\n self.expectedWormWidthPixels())", "def expected_width(self):\n\t\treturn self.expected_tile_width * TILE_SIZE", "...
[ "0.8244467", "0.8022066", "0.69394803", "0.69284886", "0.6762979", "0.6723164", "0.67015916", "0.6696571", "0.66843605", "0.6677998", "0.66742945", "0.66742945", "0.66243905", "0.66107994", "0.6608493", "0.65981203", "0.65740395", "0.6571899", "0.6568617", "0.6567508", "0.655...
0.8826927
0
Returns the expected width of a worm in pixels
def expectedWormWidthPixels(self): return self.expectedWormWidth * self.pixelSize
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expectedWormLengthPixels(self):\n return self.expectedWormLength * self.pixelSize", "def expectedWormAreaPixels(self):\n return (self.expectedWormLengthPixels() *\n self.expectedWormWidthPixels())", "def expected_width(self):\n\t\treturn self.expected_tile_width * TILE_SIZE", ...
[ "0.8727775", "0.8110919", "0.76305985", "0.7280164", "0.7265112", "0.7265112", "0.7258589", "0.7256211", "0.71888053", "0.7146611", "0.71129113", "0.7068588", "0.70651734", "0.69710493", "0.69633764", "0.6955219", "0.69506395", "0.6926095", "0.6923818", "0.68646485", "0.68444...
0.8916768
0
Returns the expected area of a worm in pixels^2
def expectedWormAreaPixels(self): return (self.expectedWormLengthPixels() * self.expectedWormWidthPixels())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expectedWormLengthPixels(self):\n return self.expectedWormLength * self.pixelSize", "def expectedWormWidthPixels(self):\n return self.expectedWormWidth * self.pixelSize", "def area(self):\n return (self.baselength1 + self.baselength2)*self.height/2", "def calculatearea(self):\r\n ...
[ "0.7789178", "0.7446952", "0.7030117", "0.69242394", "0.6878883", "0.6873281", "0.6855485", "0.68246317", "0.68091375", "0.6784426", "0.67748386", "0.6773014", "0.6773014", "0.6773014", "0.6769887", "0.6769031", "0.67459565", "0.6729685", "0.6729039", "0.6729039", "0.67229944...
0.8538401
0
identifies 1connected pixels in image
def find1Cpixels(bwImage): # fills pixels matching the following neighborhoods: hoods = [[[1, 0, 0], [0, 1, 0], [0, 0, 0]], [[0, 1, 0], [0, 1, 0], [0, 0, 0]], [[0, 0, 1], [0, 1, 0], [0, 0, 0]], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_connected_components(img):\n already_labeled = []\n connected_components = []\n pixel_queue = []\n\n def get_fg_neighbors(row,col):\n neighbors = []\n min_row = max(row-1,0)\n max_row = min(row+1, len(img)-1)\n min_col = max(col-1,0)\n max_col = min(col+1, len...
[ "0.67353606", "0.64837974", "0.6289281", "0.6251869", "0.61137533", "0.61011904", "0.6097949", "0.6023865", "0.59963226", "0.5957583", "0.594644", "0.59217316", "0.5913436", "0.5849925", "0.5835818", "0.5831764", "0.5820142", "0.5816046", "0.58062387", "0.580293", "0.5754704"...
0.65457845
1
Pass derivatives for ``BCEWithLogitsLoss``.
def __init__(self): super().__init__(derivatives=BCELossWithLogitsDerivatives())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logit_deriv(y):\n# if y.any() < 0.0 or y.any() > 1.0:\n# raise Exception\n\n return y*(1-y)", "def log_deriv(error):\n return logistic(error) * (1 - logistic(error))", "def grad_log(self, X):\n # \"\"\"\n # Evaluate the gradients (with respect to the input) of the log density at...
[ "0.6481594", "0.6424053", "0.63064575", "0.6297935", "0.625778", "0.6238681", "0.611762", "0.61082166", "0.61020076", "0.609516", "0.6054016", "0.60381144", "0.59755427", "0.5962243", "0.5959694", "0.59567314", "0.5955284", "0.5947826", "0.59466773", "0.592355", "0.5887919", ...
0.7059597
0
Finds a contour around the receipt in the given image. Returns the bounding box and the binary image
def find_receipt_box(image): # gray = cv.cvtColor(image, cv.COLOR_BGR2GRAY) gray = cv.medianBlur(image, 15, 0) _, thresh = cv.threshold(gray, 255, 125, cv.THRESH_BINARY | cv.THRESH_OTSU) k = np.ones((25, 25)) thresh = cv.erode(thresh, k, iterations=1) thresh = cv.dilate(thresh, k, iterations=1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bounding_box(image, contour=None, threshold=3):\n\tif contour is None:\n\t\tcontour = get_contour(image, threshold)\n\tx,y,w,h = cv2.boundingRect(contour)\n\treturn x,y,w,h", "def __CalculateBoundingBox(self, contour):\r\n return cv2.boundingRect(contour)", "def getContours(img):\n # mode: ge...
[ "0.7282263", "0.68694973", "0.68464077", "0.68229955", "0.6734574", "0.66763926", "0.66333264", "0.66296864", "0.6615171", "0.660898", "0.66065305", "0.6586541", "0.6553041", "0.6537641", "0.65121055", "0.6505251", "0.64883983", "0.6454428", "0.6434605", "0.6429481", "0.64195...
0.774083
0
Test init with non json key file and missing email.
def test_init_non_json_missing_email(self, mock_creds): file_data = 'non json file data' file_mock = mock.mock_open(read_data=file_data) with mock.patch.object(moves.builtins, 'open', file_mock): self.assertRaises(errors.Credentials, credentials.Credenti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init__no_sdk_key_no_datafile__fails(self, _):\n self.assertRaisesRegex(\n optimizely_exceptions.InvalidInputException,\n enums.Errors.MISSING_SDK_KEY,\n config_manager.PollingConfigManager,\n sdk_key=None,\n datafile=None,\n )", "def t...
[ "0.68744725", "0.654331", "0.6461079", "0.64047074", "0.63574666", "0.6303295", "0.63016367", "0.6261505", "0.6252979", "0.6211485", "0.6189455", "0.6182504", "0.6163482", "0.6162276", "0.61177176", "0.6114639", "0.6086393", "0.60850567", "0.6052264", "0.6031609", "0.6025217"...
0.7144054
0
Test authorization property calls get_access_token only once.
def test_authorization_multiple_accesses(self, mock_init, mock_get_token): creds = credentials.Credentials('file') # On real init we would have had access_token set to None creds.access_token = None auth = creds.authorization mock_get_token.reset_mock() # Second access t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_authorization_multiple_calls(self, mock_init, mock_get_token):\n creds = credentials.Credentials('file')\n # On real init we would have had access_token set to None\n creds.access_token = None\n\n auth = creds.authorization\n self.assertEqual('Bearer access_token1', auth...
[ "0.7895886", "0.76905346", "0.76446456", "0.74612314", "0.74475473", "0.74305445", "0.7299959", "0.7283797", "0.7104629", "0.7042228", "0.6972487", "0.69698286", "0.6869024", "0.6785857", "0.678008", "0.6760709", "0.6660409", "0.6640978", "0.66331893", "0.6628063", "0.6572015...
0.7820785
1
Extract all the concets in VIVO and organize them into a dictionary keyed by concept uri. Data for the concept includes the concet name and all concepts cooccuring withthe concept and the count of the cooccurances
def make_concordance(debug=False): query = """ SELECT ?uri ?name WHERE { ?uri a skos:Concept . ?uri rdfs:label ?name . }""" result = vivo_sparql_query(query) if 'results' in result and 'bindings' in result['results']: rows = result["results"]["bindings"] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conc_view(request):\n\n usecase = request.session['usecase']\n mode = request.session['mode']\n auto_required = request.GET.get('ns_id',None)\n jsonDict = {}\n concepts = {}\n notEmpty = False\n jsonDict['concepts'] = []\n if mode == 'Human' or auto_required == 'Human':\n cursor ...
[ "0.5418935", "0.5362905", "0.53080165", "0.5284093", "0.5210203", "0.5147663", "0.51077056", "0.51052934", "0.50854486", "0.50604564", "0.49951088", "0.49834344", "0.4982595", "0.49386713", "0.49360242", "0.49229965", "0.48820272", "0.4874132", "0.4856547", "0.4853245", "0.48...
0.57901496
0
Calculate the Spin Husimi Q function with several different methods
def spin_husimi_qfunc(density_op, theta, phi, *, method="su2"): if method == "qutip": Q, *_ = spin_q_function(density_op, theta, phi) return Q elif method == "vectorised": return my_spin_q_func(density_op, theta, phi) elif method == "su2": st = np.sin(theta / 2) ct = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,N,Nup=None,m=None,S=\"1/2\",pauli=True,Ns_block_est=None,**blocks):\n\t\tself._S = S\n\t\tself._pauli = pauli\n\t\tsps,S = S_dict[S]\n\n\t\t_Np = blocks.get(\"_Np\")\n\t\tif _Np is not None:\n\t\t\tblocks.pop(\"_Np\")\n\n\t\tif Nup is not None and m is not None:\n\t\t\traise ValueError(\"Cannot u...
[ "0.6354455", "0.6159749", "0.6126755", "0.61128736", "0.6071058", "0.6035555", "0.5982305", "0.59708756", "0.59104294", "0.5900433", "0.5893215", "0.5892762", "0.58843714", "0.5870295", "0.58481216", "0.5845346", "0.5827665", "0.5801865", "0.57402676", "0.5728017", "0.5704767...
0.672495
0
three dimensional ring == donut
def getDonut(width=2, size=(25, 25, 25)): x, y, z = size assert width < z / 2 # This is a single planr slice of ring ringPlane = getRing(0.25, 0.5, size=(x, y)) # Stack up those slices starting form the center donutArray = np.zeros(size, dtype=np.uint8) zStart = z // 2 for n in range(w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get3D_rod():\n\n volume = torch.zeros(1,1,55,54,53)\n length = 15\n st = [27,26,25]\n\n volume[:,:,st[0]:st[0]+length,st[1],st[2]] = 0.5\n volume[:,:,st[0]+length:st[0]+length+2,st[1],st[2]] = 0.2\n\n volume[:,:,st[0],st[1]:st[1]+length,st[2]] = 0.5\n volume[:,:,st[0],st[1]+length:st[1]+le...
[ "0.5994227", "0.597689", "0.59562117", "0.58594376", "0.5723472", "0.5711916", "0.56528497", "0.5633358", "0.5583794", "0.55731803", "0.5569958", "0.5561673", "0.55482274", "0.54741275", "0.5465758", "0.54635954", "0.54532015", "0.543831", "0.5433319", "0.5432072", "0.5422506...
0.60835534
0
Handles listing of a suppression
def handleList(self, confInfo): # Get requested action actionStr = str(self.requestedAction) if actionStr in Suppressions.REQUESTED_ACTIONS: actionStr = Suppressions.REQUESTED_ACTIONS[actionStr] logger.info('Entering %s', actionStr) self.handleRe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _suppressions(self) -> List:\n sonar, sonar_id = self._metric_source, self._sonar_id()\n return [\n (sonar.false_positives(sonar_id), sonar.false_positives_url(sonar_id),\n \"Gemarkeerd als false positive in SonarQube\"),\n (sonar.wont_fix(sonar_id), sonar.wont_f...
[ "0.6130301", "0.56398046", "0.5369711", "0.52884704", "0.5170377", "0.5068834", "0.50438356", "0.5002317", "0.49404103", "0.48739675", "0.4846101", "0.4832185", "0.48252943", "0.47704157", "0.47433895", "0.47108907", "0.47060955", "0.47040573", "0.46864858", "0.4675897", "0.4...
0.60984266
1
Set all children of the mother.
def set_children(self, mother, list_of_children): # convert name to Member node (should check for validity) mom_node = self.names_to_nodes[mother] # add each child for c in list_of_children: # create Member node for a child c_member = Member(c) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def children(self, children):\n\n self._children = children", "def mother(self, mother):\n\n self.logger.debug(\"In 'mother' setter.\")\n\n self._mother = mother", "def children(self, children: List[str]):\n self._children = children", "def merge(self, other):\n\n for child...
[ "0.734248", "0.69697934", "0.6584644", "0.6153177", "0.60747075", "0.6070873", "0.60659856", "0.60421443", "0.60118943", "0.59690195", "0.59659046", "0.58826023", "0.5866769", "0.5770859", "0.5762908", "0.57455945", "0.5716129", "0.5696516", "0.5661855", "0.5633855", "0.56323...
0.75118077
0
Returns True or False whether mother is parent of kid.
def is_parent(self, mother, kid): mom_node = self.names_to_nodes[mother] child_node = self.names_to_nodes[kid] return child_node.is_parent(mom_node)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_child(self, kid, mother): \n mom_node = self.names_to_nodes[mother] \n child_node = self.names_to_nodes[kid]\n return mom_node.is_child(child_node)", "def is_parent_of(self):\n return self.hasLabel('parent_of')", "def is_parent(self):\n if self.parent is not N...
[ "0.80169153", "0.74951684", "0.7280462", "0.70526224", "0.70287514", "0.6987182", "0.6921831", "0.68984866", "0.68793654", "0.6846206", "0.6814198", "0.67726576", "0.6771329", "0.67204875", "0.6716895", "0.6639984", "0.65548", "0.64817095", "0.6472184", "0.6467613", "0.639665...
0.9071732
0
Returns True or False whether kid is child of mother.
def is_child(self, kid, mother): mom_node = self.names_to_nodes[mother] child_node = self.names_to_nodes[kid] return mom_node.is_child(child_node)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_parent(self, mother, kid):\n mom_node = self.names_to_nodes[mother]\n child_node = self.names_to_nodes[kid]\n return child_node.is_parent(mom_node)", "def islchild(self):\n\t\tif (self.parent() and self.parent().lchild() is self): #TODO is or == here\n\t\t\treturn True\n\t\treturn Fal...
[ "0.8315885", "0.71324116", "0.6747198", "0.6661903", "0.6639666", "0.6492157", "0.6373245", "0.6372516", "0.6327259", "0.6291338", "0.62321055", "0.62055343", "0.61911947", "0.6158149", "0.6145503", "0.61367714", "0.6121585", "0.6106901", "0.60978127", "0.60832584", "0.607467...
0.90128684
0
Plays a rock paper scissor game.
def rock_paper_scissors(): rps = ["rock", "paper", "scissors"] wannaplay = input("do you want to play rock paper scissors? ") if wannaplay == "yes": computerpick = random.choice(rps) playerpick = input("what do you choose?") if computerpick == "rock": if playerpick == "sc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rps_function():\n randNumber = random.randint(1,3)\n companswer = \"Scissor\"\n if randNumber == 1:\n companswer = \"Rock\"\n elif randNumber == 2:\n companswer = \"Paper\"\n\n answer = q.select(\"Select Rock, Paper or Scissors\", choices=[\"Rock\", \"Paper\", \"Scissor\"]).ask()\n...
[ "0.750096", "0.7410081", "0.7398093", "0.71720374", "0.7101077", "0.6921496", "0.6833837", "0.6805485", "0.6779715", "0.674888", "0.67327815", "0.66555387", "0.65526086", "0.6416332", "0.63682306", "0.6348505", "0.6294415", "0.626929", "0.62690926", "0.6255445", "0.6220852", ...
0.75045514
0
Get the key through a value.
def get(cls, value): for k in cls: if k.value == value: return k raise KeyError(f'Cannot get key by value "{value}" of {cls}')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_key(self, value):\n return [item[0] for item in self.items() if item[1] == value]", "def get_key(value, key, key_mapping):\n # return corrected key if necessary\n if value in key_mapping:\n return key_mapping[value]\n else:\n return key", "def get_value(self, key):\n ...
[ "0.7385323", "0.723014", "0.7229782", "0.71842974", "0.7058891", "0.70198286", "0.7003825", "0.696437", "0.69577265", "0.69577265", "0.6892879", "0.68312", "0.6806357", "0.6791824", "0.6772619", "0.67528397", "0.67462474", "0.67276", "0.6703884", "0.6666332", "0.66516215", ...
0.74683553
0
Handle coreutils sort program calls. kwargs are passed directly from the calling method (self.coreutils_sort). This method figures out, given how this BedTool was constructed, what to send to BEDTools programs for example, an open file to stdin with the `` argument, or a filename with the `a` argument. instream can be ...
def handle_coreutils_sort_kwargs(self, prog='sort', instream=None, **kwargs): pybedtools.logger.debug( 'BedTool.handle_coreutils_sort_kwargs() got these kwargs:\n%s', pprint.pformat(kwargs)) stdin = None # Decide how to send instream to sort. # If it's a BedTool, then get underlying st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_coreutils_sort(cmds, tmpfn=None, stdin=None):\n input_is_stream = stdin is not None\n output_is_stream = tmpfn is None\n\n try:\n # coming from an iterator, sending as iterator\n if input_is_stream and output_is_stream:\n logger.debug('helpers.call_coreutils_sort(): input...
[ "0.6487", "0.6014295", "0.59828156", "0.5957099", "0.58909535", "0.58579415", "0.57027805", "0.5670048", "0.5639752", "0.55985063", "0.5484366", "0.54731995", "0.5454082", "0.53757876", "0.53659403", "0.53461003", "0.5317991", "0.5308527", "0.52931905", "0.5283914", "0.528279...
0.8322617
0
self.X = self.scale ((self.I+.5)/self.dims) + self.translate[0] self.Y = self.scale ((self.J+.5)/self.dims) + self.translate[1] self.Z = self.scale ((self.K+.5)/self.dims) + self.translate[2] klopt dit, centroid vs vertice?
def getVerticePosition(self): #def getvoxelpos(model,scale,dims,translate,i,j,k): #centroid! return(self.X,self.Y,self.Z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_transform(self):\n\n self.a = self.scale * self.pixel_size * math.cos(self.angle)\n self.d = self.scale * self.pixel_size * math.sin(self.angle)\n self.b = self.d\n self.e = -self.a\n self.c = self.point.x() - self.a*self.width/2.0 - self.b*self.height/2.0\n sel...
[ "0.65914005", "0.62660307", "0.6223246", "0.6215001", "0.61629564", "0.6092061", "0.60622925", "0.60315686", "0.59930974", "0.5960418", "0.59403527", "0.58944416", "0.58935773", "0.5860332", "0.5838723", "0.5804709", "0.57786584", "0.5751499", "0.5742603", "0.5736815", "0.571...
0.65904313
1
Returns the unit vector of the vector.
def unit_vector(vector): #print 'unit_vector' #print vector #print type(vector) #npvector = np.array(vector) return vector / np.linalg.norm(vector)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_unit_vector(self, v):\n return v / np.linalg.norm(v)", "def get_unit_vector(self, vector):\n return vector / la.norm(vector)", "def unit(self):\r\n return Vector(self.x/self.length(), self.y/self.length())", "def unit_vector(self,vector):\n return vector / np.linalg.norm(...
[ "0.8344175", "0.83402044", "0.83041203", "0.8288785", "0.82710177", "0.8263843", "0.8237869", "0.8219826", "0.8203201", "0.8180198", "0.8180198", "0.8180198", "0.8157419", "0.8116172", "0.8116172", "0.8116172", "0.8116172", "0.8116172", "0.8116172", "0.8116172", "0.8116172", ...
0.8355314
0
Save model to a pickle located at `path`
def save(self, path=None): if path is None: path = os.path.join(logger.get_dir(), "model.pkl") with tempfile.TemporaryDirectory() as td: save_state(os.path.join(td, "model")) arc_name = os.path.join(td, "packed.zip") with zipfile.ZipFile(arc_name, 'w') as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_model(path: Path, model, config: dict):\n with open(path / \"model.pkl\", \"wb\") as p:\n pickle.dump(model, p)", "def save_model(self, model_path: str):", "def save_model(self, path):\n try:\n # os.makedirs(osp.dirname(path), exist_ok=1)\n joblib.dump(self.model...
[ "0.8343345", "0.82849115", "0.8255774", "0.8195521", "0.812088", "0.811873", "0.81159204", "0.8067455", "0.80491817", "0.8037566", "0.79844445", "0.79807764", "0.7958724", "0.7958179", "0.7957779", "0.7957779", "0.7957779", "0.7957779", "0.7957779", "0.79518974", "0.7929536",...
0.8308253
1
Returns solar noon in UTC based on 15degree timezones 0+7.5 LonDegE degrees longitude (180, 180)
def solar_noon_utc(LonDegE): _timezone = array([-180, -172.5, -157.5, -142.5, -127.5, -112.5, -97.5, -82.5, -67.5, -52.5, -37.5, -22.5, -7.5, 7.5, 22.5, 37.5, 52.5, 67.5, 82.5, 97.5, 112.5, 127.5, 142.5, 157.5, 172.5, 180]).repeat(2, 0)[1:-1].reshape(-1, 2) for i, (low, high) in enumer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solar_noon_utc(self, date, longitude):\n \n julianday = self._julianday(date.day, date.month, date.year)\n\n newt = self._jday_to_jcentury(julianday + 0.5 + longitude / 360.0)\n\n eqtime = self._eq_of_time(newt)\n timeUTC = 720.0 + (longitude * 4.0) - eqtime\n\n timeUT...
[ "0.7740273", "0.7307561", "0.66411364", "0.6506474", "0.63228154", "0.6086006", "0.60650945", "0.59655005", "0.5950196", "0.58575976", "0.5804963", "0.571009", "0.56786376", "0.5671527", "0.56711406", "0.5661509", "0.55940235", "0.5587174", "0.5566008", "0.5562385", "0.554714...
0.8134964
0
Return H2O in molecules/cm3 from RH (0100) and TEMP in K
def h2o_from_rh_and_temp(RH, TEMP): TC = TEMP - 273.15 frh = RH / 100. svp_millibar = 6.11 * 10**((7.5 * TC)/(TC+237.3)) svp_pa = svp_millibar * 100 vp_pa = svp_pa * frh molecule_per_cubic_m = vp_pa * Avogadro / R / TEMP molecule_per_cubic_cm = molecule_per_cubic_m * centi**3 #print RH, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_kJmol_H(en_kJmol):\n return en_kJmol*kJmol_H", "def convert_H_kJmol(en_H):\n return en_H/kJmol_H", "def _interpolate(self, omch2, h0):\n omch2_index = (\n 1.0\n * (self.CAMBGenerator.om_resolution - 1)\n * (omch2 - self.CAMBGenerator.omch2s[0])\n ...
[ "0.61853594", "0.6184384", "0.60567206", "0.59652984", "0.59272593", "0.5913445", "0.5850375", "0.58474433", "0.58063", "0.57514226", "0.5714237", "0.56115186", "0.5605412", "0.5601908", "0.5598818", "0.55978", "0.5578653", "0.553241", "0.5524964", "0.55216324", "0.5519483", ...
0.8166439
0
Initialize a std environemnt
def initstdenv(TEMP = 298., P = 101325., ): defenv = dict(TEMP = TEMP, P = P) Update_M(None, defenv) update_func_world(None, defenv) del defenv
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env_init(self, environ) -> None:\n environ.update(self._env)", "def init_environment(self):\n # import outside of cell so we don't get a traceback\n from sage import all_cmdline\n from sage.repl.user_globals import initialize_globals\n initialize_globals(all_cmdline, self.s...
[ "0.78905386", "0.68618715", "0.684195", "0.67915463", "0.6729603", "0.6674742", "0.6674742", "0.664368", "0.664368", "0.664368", "0.664368", "0.664368", "0.664368", "0.66347665", "0.65710366", "0.65572655", "0.6504112", "0.64964134", "0.64956427", "0.64724296", "0.6459391", ...
0.69671196
1
It executes the operational command specified in ExecuteOpCommandRequest. This is a streaming api
def ExecuteOpCommand(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 execute(self, operation, args=None, stream=None):\n\t\toperations = (op.strip() for op in operation.split(';') if len(op.strip()) > 0)\n\t\tfor op in operations:\n\t\t\tself._cursor.execute(op, args, stream)", "def _execute(self, op, time):\n raise NotImplementedError", "def _execute(self, operation...
[ "0.62977266", "0.6248494", "0.61532646", "0.6142459", "0.6104838", "0.6104838", "0.6085375", "0.59639215", "0.59632427", "0.5900692", "0.58296674", "0.58149034", "0.5807367", "0.5790972", "0.57798266", "0.5776241", "0.5772453", "0.5762894", "0.57367265", "0.57348263", "0.5726...
0.69569457
0
This RPC will return the configuration in the ephemeral database for Path specified in the request
def GetEphemeralConfig(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 get_config():\n \n logger.info('Reading current configuration...')\n dburl = dbconn.DbURL()\n array = gparray.GpArray.initFromCatalog(dburl, utility=True)\n \n master_hostname = array.master.getSegmentHostName()\n master_port = array.master.getSegmentPort()\n \n cmd = pg.ReadPostmast...
[ "0.608123", "0.5972893", "0.59728444", "0.59629196", "0.59391654", "0.5928784", "0.5928323", "0.5898113", "0.5890517", "0.5886857", "0.58864236", "0.5850932", "0.578761", "0.5762752", "0.5748512", "0.5739804", "0.5733208", "0.57262355", "0.57109916", "0.57003474", "0.5687199"...
0.64693755
0
Loads a vtk legacy file containing a ``POLYDATA`` data set.
def loadVTKPolydataFile(infile): lines = None with open(infile, 'rt') as f: lines = f.readlines() lines = [l.strip() for l in lines] if lines[3] != 'DATASET POLYDATA': raise ValueError('Only the POLYDATA data type is supported') nVertices = int(lines[4].split()[1]) nPolygons...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LoadAirplane():\n return vtkInterface.PolyData(planefile)", "def LoadSphere():\n return vtkInterface.PolyData(spherefile)", "def LoadAnt():\n return vtkInterface.PolyData(antfile)", "def vtk_poly_data_reader(*args, **kwargs):\n import itk\n instance = itk.VTKPolyDataReader.New(*args, **kwa...
[ "0.6520159", "0.6206392", "0.6044322", "0.593907", "0.58290815", "0.57562786", "0.57135546", "0.57100546", "0.5676715", "0.55836934", "0.5565394", "0.5552351", "0.5487743", "0.5470019", "0.54155517", "0.5395341", "0.53579533", "0.5325618", "0.5309513", "0.52755684", "0.526423...
0.66082287
0
Test deleting a node from the Linked List given the node
def test_delete_node(self): myObj = DLinkedList() myObj.append(120) myObj.append(100) myObj.detete_node(myObj.head.next) myObj.detete_node(myObj.head) self.assertEqual(myObj.get_head(), None) self.assertEqual(myObj.get_tail(), None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete(self):\n delete_test_list = DoubleLinkedList()\n delete_test_list.push(12)\n delete_test_list.push(123)\n delete_test_list.push(1234)\n delete_test_list.push(12345)\n delete_test_list.delete(123)\n self.assertEqual(delete_test_list.get_list()[1].get_...
[ "0.77454996", "0.7493485", "0.7448162", "0.73564255", "0.72997785", "0.72987473", "0.72086656", "0.7175921", "0.71111983", "0.7077631", "0.7053784", "0.7014586", "0.6996175", "0.6982428", "0.6972671", "0.6948289", "0.69095546", "0.6896277", "0.689281", "0.6872303", "0.6867929...
0.80006564
0
Get the relative path to a key, and interpolate any variables.
def relative(self, key): return key.format(**self.variables)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_full_path(base_path, key):\n if base_path is None or base_path == \"\":\n return key\n else:\n return f'{base_path}.{key}'", "def get_path(self, key):\n return get_path(self, key)", "def getpath(self, key, default=''):\n path = self.get(key, default)\n if not p...
[ "0.6943975", "0.6829048", "0.67739993", "0.6203362", "0.61925447", "0.6159862", "0.6120714", "0.6109145", "0.60976887", "0.6090251", "0.6041428", "0.5993864", "0.59911925", "0.59568715", "0.5873986", "0.5815901", "0.57980573", "0.5768069", "0.5754944", "0.5723729", "0.5722231...
0.83270055
0
Takes file as input & returns a dictionary having name of layers with their code
def ret_layer_index(file): names={} for i in range(len(file[0])): print(file[0][i][0][0][0]) names[file[0][i][0][0][0][0]]=i print("Success layer_index") return names
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_layers(layer_data: Dict[str, Any]) -> List[Layer]:\n try:\n l_data = layer_data['kicad_pcb']\n l_data = get_dict_by_key(l_data, 'layers')\n res: List[Layer] = list()\n for layer in l_data['layers']:\n layer_data = list(layer.values())[0]\n new_layer = La...
[ "0.6601989", "0.57129955", "0.5639008", "0.560721", "0.5606075", "0.5594143", "0.5582873", "0.55770516", "0.5558078", "0.5530599", "0.55162555", "0.5506606", "0.5502152", "0.5493619", "0.549006", "0.54861146", "0.54860806", "0.5472988", "0.5392519", "0.5348343", "0.5339827", ...
0.69127524
0
Asks for Layer Name & returns its weights & bias
def weight(layer_name): layer_no=names[layer_name] wb =file[0][layer_no][0][0][2] w=wb[0][0] b=wb[0][1] name=file[0][layer_no][0][0][0] assert name==layer_name print("Success weight") return w,b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_weights(layer_name, weights):\n W = weights[layer_name][0]\n b = weights[layer_name][1]\n return W, b", "def _weights(self, layer_idx, expected_layer_name):\n # wb = self.vgg_layers[0][layer_idx][0][0][2] # based on old vgg-model shape\n wb = self.vgg_layers[layer_idx][0][0][0]\n ...
[ "0.769681", "0.7051314", "0.6843317", "0.6679663", "0.6650008", "0.64984983", "0.6454928", "0.64294505", "0.6346056", "0.632202", "0.6310458", "0.6304479", "0.629971", "0.62903816", "0.62841886", "0.6228249", "0.619185", "0.61850435", "0.6099327", "0.6082102", "0.60804623", ...
0.7055207
1
Factory method that creates instances of Commands.
def create_command(cmd, args): for cls in BaseCommand.__subclasses__(): if cls.cmd() == cmd: return cls(args) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factory(cmd, **default_kwargs):\n cmd = resolve_command(cmd)\n return Command(cmd)", "def create_command(text, commands):\n\n class CustomCommand(BaseCommand):\n description = text\n\n def run(self):\n for cmd in commands:\n subprocess.check_call(cmd)\...
[ "0.77212965", "0.7032438", "0.6761256", "0.6738144", "0.6737949", "0.66892767", "0.65790683", "0.6435456", "0.6411627", "0.63867044", "0.63033515", "0.6226866", "0.6216166", "0.62152654", "0.6166775", "0.61436707", "0.61365944", "0.61067134", "0.6098293", "0.60730743", "0.607...
0.74121934
1
Initialize traced object, if no ancestors set as original. Params
def __init__(self, ancestors=None, **kwargs): super().__init__(**kwargs) if ancestors is None: self.ancestors = {self.id} # if given a set of traced objects elif all(hasattr(a, 'ancestors') for a in ancestors): self.ancestors = set(a for a.ance...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, root: Node = None):\n # this alllows us to initialize by copying an existing tree\n self.root = deepcopy(root)\n if self.root:\n self.root.parent = None\n self.size = 0 if not self.root else self.root.subtree_size()", "def _initialize_trees(self):", "de...
[ "0.60746163", "0.60187507", "0.59897757", "0.595329", "0.595329", "0.5941847", "0.5906284", "0.59024626", "0.5844147", "0.58139676", "0.5748215", "0.57252055", "0.570266", "0.5681593", "0.5663118", "0.5646708", "0.5646708", "0.5619471", "0.55794793", "0.55546564", "0.55523866...
0.7730512
0
Calculates the diff between left and right descriptors of a given ID and remove those descriptors if they're found (even if the data lenght is not the same and no diff is made)
def diff_right_left(id): all_diff_data = ID.diff(id, ["left","right"]) if not all_diff_data or not all_diff_data["left_right"]: abort(400) ID.remove_all(id, ["left","right"]) return jsonify(all_diff_data["left_right"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_diff(diff_type, old, new, full_replace):\n\n assert isinstance(old, pd.DataFrame) and \\\n isinstance(new, pd.DataFrame)\n \n # Move indices into first column and diff:\n if diff_type=='edge':\n old.index = old['out'].rename('id').str.cat(old['class'], sep=' ').str.cat(old['in'],...
[ "0.5716218", "0.54892826", "0.54396135", "0.5423753", "0.52242434", "0.5181026", "0.51796293", "0.5175143", "0.5114235", "0.51056516", "0.50674254", "0.5061342", "0.5046947", "0.4999883", "0.49800155", "0.4977742", "0.496952", "0.4944485", "0.4938212", "0.4937691", "0.4937502...
0.65736
0
Returns true only if value only has base64 chars (AZ,az,09,+ or /)
def _is_base64(value): #http://stackoverflow.com/questions/12315398/verify-is-a-string-is-encoded-in-base64-python try: enc = base64.b64encode(base64.b64decode(value)).strip() return enc == value except TypeError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_base64(string):\n return (not re.match('^[0-9]+$', string)) and \\\n (len(string) % 4 == 0) and \\\n re.match('^[A-Za-z0-9+/]+[=]{0,2}$', string)", "def check_valid_fernet(value):\n try:\n decoded = base64.urlsafe_b64decode(value)\n if len(decoded) != 32: return False\n ...
[ "0.75376165", "0.6660873", "0.6390815", "0.62936556", "0.62341654", "0.61789536", "0.61456996", "0.6140673", "0.6122247", "0.61070514", "0.6105221", "0.605362", "0.5988506", "0.59264135", "0.5913553", "0.59056365", "0.5861987", "0.58494276", "0.584896", "0.58418304", "0.58176...
0.74352163
1
Method for getting spec (slope, intercept, and distance)of a line between two input nodes
def lineSpec(node1, node2): if node1 == node2: m = 0 b = 0 d = -1 return m, b, d elif node1[0] == node2[0]: # parallel to y axis m = True b = node1[0] d = abs(node2[1] - node1[1]) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line(intercept, slope, x):\n return slope*x + intercept", "def straight_line(p1,p2,spec):\n\tx1,y1 = p1; x2,y2 = p2\n\t\n\tm = (y2-y1) / (x2-x1)\n\tx = np.arange(x1-0.01, x2+0.01, 0.01) \n\n\ty = m *(x-x1) + y1\n\tf = np.vectorize(interp1d(x,y,kind = 'linear'))\n\twave,flux,error = Select_Data(spec,[x1,x2...
[ "0.6451279", "0.64389384", "0.64339787", "0.6394776", "0.6359633", "0.63476884", "0.63330454", "0.6279322", "0.62377495", "0.62317026", "0.62202334", "0.62163717", "0.62038505", "0.6199211", "0.6154437", "0.6083388", "0.60706365", "0.6053787", "0.60472196", "0.6045286", "0.60...
0.75205994
0
Method for check if a point is on a line of two input nodes
def isPointOnLine(node1, node2, point): m, b, d = geometry.lineSpec(node1, node2) if d == -1: # if two nodes are the same if node1 == point: return True else: return False else: if m == True: # parallel to y axis ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_line_on_line(feature_1: Sequence, feature_2: Sequence) -> bool:\n\n line_on_line = False\n\n for coords in feature_1:\n\n line_on_line = boolean_point_on_line(coords, feature_2)\n if not line_on_line:\n break\n\n return line_on_line", "def is_on_line(p0, p1, p2, threshold...
[ "0.7680441", "0.72791266", "0.72598773", "0.7229416", "0.7149842", "0.7118311", "0.70014083", "0.6968032", "0.6960087", "0.69312257", "0.6921836", "0.6818162", "0.6794699", "0.6747872", "0.6708229", "0.67055196", "0.66977257", "0.6689392", "0.66460174", "0.6636113", "0.663479...
0.8405849
0
Method for finding the nearest point on a straight infinite line form by two nodes from a point. This cannot guarantee the output point is on the line created by the two nodes.
def findNearPointOnLine(node1, node2, point): p=point[0] q=point[1] a=node1[0] b=node1[1] c=node2[0] d=node2[1] x = ((a-p)*(d-b) + (q-b)*(c-a)) / ((d-b)**2+(c-a)**2) * (d-b) + p y = ((a-p)*(d-b) + (q-b)*(c-a)) / ((d-b)**2+(c-a)**2) * (a-c) + q ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _nearest_point_on_line(begin, end, point):\n b2e = _vec_sub(end, begin)\n b2p = _vec_sub(point, begin)\n nom = _vec_dot(b2p, b2e)\n denom = _vec_dot(b2e, b2e)\n if denom == 0.0:\n return begin\n u = nom / denom\n if u <= 0.0:\n return begin\n elif u >= 1.0:\n return...
[ "0.77361304", "0.70569193", "0.7019063", "0.69980234", "0.6875616", "0.6832375", "0.67795867", "0.66944176", "0.66812617", "0.6653641", "0.65695083", "0.6550996", "0.6511778", "0.643356", "0.64276004", "0.6389354", "0.6371056", "0.63599604", "0.6348785", "0.6342428", "0.62946...
0.75606936
1
Method for finding a point aparting distance from node1 on the line of node1 and node2
def findPointOnLine(node1, node2, distance): m, b, _ = geometry.lineSpec(node1, node2) xy = [] if m == True: # parallel to y axis xy.append(node1[0]) if node1[1] <= node2[1]: xy.append(node1[1] + distance) else: xy.appe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _distance(point, line_point1, line_point2):\n vec1 = line_point1 - point\n vec2 = line_point2 - point\n distance = np.abs(np.cross(vec1,vec2)) / np.linalg.norm(line_point1-line_point2)\n return distance", "def dist(self, node_0, node_1):\n coord_0, coord_1 =...
[ "0.78486764", "0.7772905", "0.77105194", "0.7643902", "0.76115584", "0.7591048", "0.75867337", "0.7571585", "0.75705403", "0.75335133", "0.751012", "0.7489887", "0.74810356", "0.74765587", "0.745396", "0.7451045", "0.7425503", "0.7415635", "0.74038196", "0.739252", "0.7383984...
0.7934334
0
Method for adding distance of edges in the input polyline graph
def addDistance(graph): distanceList = graphCalculate._calculateDistance(graph) for dist, edge in zip(distanceList, graph.edges(data=True)): edge[2]['distance'] = dist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_route(self, distance, start, destination):\r\n self.edges[start].append(Edge(distance, start, destination))\r\n self.edges[destination].append(Edge(distance, destination, start))", "def add_edge_length(self, a, b):\n return tuple(sum(x) for x in zip(a, b))", "def add_edge(self, hea...
[ "0.6155043", "0.60934085", "0.59992814", "0.5963997", "0.5940718", "0.5813212", "0.5783025", "0.5766937", "0.57058024", "0.56310856", "0.5620658", "0.56138706", "0.55951095", "0.55636686", "0.5558129", "0.555403", "0.5535461", "0.5529423", "0.5522943", "0.5488319", "0.5471577...
0.6729137
0
Method for adding center point coordinate of edges in the input polyline graph
def addCenter(graph, decimals=6): for edge in graph.edges(data=True): prevVertex = None distnaceToGo = (edge[2]['distance']) / 2 for ind, vertex in enumerate(edge[2]['coordinates']): if ind == 0: prevVertex = vertex else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linecenter(l):\n return scale3(add(l[0],l[1]),0.5)", "def center_point(polyline):\n\tpts = unique(polyline.points)\n\treturn sum(pts) / len(pts)", "def _get_centeroids(self, pts, max_dist=None):\n\n if max_dist == None:\n max_dist=self.maximum_edge_point_distance\n dist=0\n ...
[ "0.6084878", "0.59466", "0.5711031", "0.5524282", "0.5428348", "0.54245806", "0.54113805", "0.5388478", "0.53779316", "0.53748965", "0.53740066", "0.53666896", "0.5362555", "0.53590935", "0.5354654", "0.5314077", "0.5302965", "0.5298477", "0.52940285", "0.5271814", "0.5259291...
0.6953455
0
Method for split a polyline type graph at individual points of input point list
def splitLineAtPoint_backup(lineGraph, pointGraph, decimals=6): lineGraphCopy = lineGraph.copy() attrs = set(list(lineGraphCopy.edges(data=True)[0][2].keys())) remains = set(['Ind', 'coordinates'] + list(attrs)) delAttrs = attrs.difference(remains) for edge in lineGraphC...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _splitPoints(self, points, split):\n # validate split\n if not split:\n return [points]\n\n # complete split with adding start and end frames\n if split[0] != 0:\n split.insert(0, 0)\n\n if split[-1] != len(points):\n split.append(len(points))...
[ "0.67998856", "0.66619223", "0.653087", "0.65113443", "0.6290985", "0.62897", "0.6256244", "0.62556493", "0.6109894", "0.60932153", "0.6074621", "0.6041772", "0.6017787", "0.6017787", "0.59619707", "0.5960364", "0.5947106", "0.59310067", "0.58920723", "0.588944", "0.5880745",...
0.67909324
1
Method for finding the nearest polyline feature and assign its id to the point feature
def nearest(pntGraph, lineGraph, criterion='', threshold=0): _, spatialJoinDict = spatialjoin._spatialjoin(pntGraph, lineGraph, criterion, threshold) for point in pntGraph.nodes(data=True): point[1]['nearEdge'] = spatialJoinDict[point[1]['Ind']] print('The Ind of the nearest polyline...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FindClosestPoint(self, ):\n ...", "def GetPolyline(polyline):\r\n pass", "def closest_point_on_line(point, line):\n a, b = line\n ab = subtract_vectors(b, a)\n ap = subtract_vectors(point, a)\n c = vector_component(ap, ab)\n return add_vectors(a, c)", "def pointOnPolyline(pol...
[ "0.58856577", "0.57838166", "0.57008946", "0.5634862", "0.5630022", "0.5601748", "0.55993795", "0.558194", "0.55417174", "0.55406046", "0.55187804", "0.5510421", "0.55025625", "0.5490259", "0.5469013", "0.5468764", "0.5464201", "0.54499555", "0.54330933", "0.539997", "0.53940...
0.6583394
0
Method for calculating Kernel Density Estimate using lixel graph and lixel center graph
def graphKDE(lixelGraph, lxcenterGraph, bandwidth, kernel = 'gaussian', diverge=True): lookupDict, neighborsDict = interpolate._initiaize(lixelGraph, lxcenterGraph) kernelDensity = [] for edge in lixelGraph.edges(data=True): # extract center center = edg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kde_sklearn(x, x_grid, bandwidth=0.8, **kwargs):\n \n kde_skl = KernelDensity(bandwidth=bandwidth, **kwargs)\n #kde_skl = KernelDensity()\n kde_skl.fit(x[:, np.newaxis])\n # score_samples() returns the log-likelihood of the samples\n log_pdf = kde_skl.score_samples(x_grid[:, np.newaxis])\n \...
[ "0.6486337", "0.6314231", "0.61171484", "0.6048283", "0.6029227", "0.6027887", "0.60014385", "0.59912324", "0.5986975", "0.59588397", "0.59415406", "0.5940148", "0.58967996", "0.58856153", "0.5872332", "0.5861797", "0.5856806", "0.58517444", "0.5849654", "0.5847358", "0.58076...
0.70913154
0
Build an (unmatched) Instruction, associating it with its position in the basic block inst is the underlying instruction bl is the basicblock ind is the index within the block
def __init__(self, inst: ghidra.program.model.listing.Instruction, bl: ghidra.program.model.correlate.Block, ind: int): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_before(self, insert_pos_inst):\n basic_block = insert_pos_inst.basic_block\n if basic_block is None:\n raise IRError('Instruction is not in basic block')\n idx = basic_block.insts.index(insert_pos_inst)\n self.basic_block = basic_block\n basic_block.insts.in...
[ "0.54089177", "0.53801286", "0.5352882", "0.52677023", "0.5266958", "0.5243323", "0.5199354", "0.5110709", "0.50466216", "0.50159264", "0.5007612", "0.50075775", "0.49738052", "0.4972269", "0.49516445", "0.49250692", "0.49246922", "0.49146828", "0.48947528", "0.48822913", "0....
0.6372575
0
Returns the names of all methods in instance.
def get_all_methods(instance): return [m for m in dir(instance) if callable(getattr(instance, m))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_methods(self):\n return list(self.methods.keys())", "def __methods(cls):\n _dict = {}\n __methodDict(cls, _dict)\n return _dict.keys()", "def _methods_of(cls):\n # The idea of unbound methods exists in Python 2 and was removed in\n # Python 3, so \"inspect.ismethod\" is used here...
[ "0.7544593", "0.75153947", "0.73296356", "0.73012394", "0.7163949", "0.7074049", "0.69875395", "0.69749326", "0.69501805", "0.6946275", "0.69447255", "0.6912542", "0.68510944", "0.6850766", "0.6804206", "0.6756036", "0.66882116", "0.6621522", "0.6556511", "0.6556312", "0.6552...
0.8095408
0
Returns all superclasses of a given class. Omits root 'object' superclass.
def get_all_superclasses(cls): classes = [] for superclass in cls.__bases__: for c in get_all_superclasses(superclass): if c is not object and c not in classes: classes.append(c) for superclass in cls.__bases__: if superclass is not object and superclass not in classes: classes.append(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_superclasses(self, t):\n if isinstance(t, pytd.ClassType):\n return sum((self.get_superclasses(c) for c in t.cls.bases), [t])\n elif isinstance(t, pytd.AnythingType):\n # All types, even \"?\", inherit from object.\n return [pytd.NamedType(\"builtins.object\")]\n elif isinstance(t, ...
[ "0.8128446", "0.7904593", "0.76706064", "0.7356925", "0.7299216", "0.7298937", "0.7248306", "0.7214031", "0.72014976", "0.71969557", "0.71818876", "0.70861506", "0.70846164", "0.70526284", "0.6906375", "0.6894315", "0.6840234", "0.6840234", "0.6828879", "0.68240535", "0.67702...
0.83050585
0
Decorator for subclasses of SpirvTest. This decorator checks that a class meets the requirements (see below) for a test case class, and then puts the class in a certain testsuite. The class needs to be a subclass of SpirvTest. The class needs to have spirv_args defined as a list. The class needs to define at least one ...
def inside_spirv_testsuite(testsuite_name): def actual_decorator(cls): if not inspect.isclass(cls): raise SpirvTestException('Test case should be a class') if not issubclass(cls, SpirvTest): raise SpirvTestException( 'All test cases should be subclasses of SpirvTest') if 'spirv_args...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instantiate_for_spirv_args(self, testcase):\n raise PlaceHolderException('Subclass should implement this function.')", "def test_missing_args_class_method(cls, test, x, y, z=3): # noqa: D213, D407", "def test_missing_args_class_method(cls, test, x, y, _, z=3): # noqa: D213, D407", "def stresstest(*a...
[ "0.6226221", "0.5778021", "0.5723504", "0.5623994", "0.5386769", "0.53586173", "0.53486973", "0.5343685", "0.53372765", "0.53223234", "0.5275434", "0.52489024", "0.5246204", "0.52387094", "0.52306575", "0.5212795", "0.5159625", "0.514989", "0.5147672", "0.5121937", "0.508925"...
0.74752784
0
Call this to notify the manager of the results of a test run.
def notify_result(self, test_case, success, message): self.num_successes += 1 if success else 0 self.num_failures += 0 if success else 1 counter_string = str(self.num_successes + self.num_failures) + '/' + str( self.num_tests) print('%-10s %-40s ' % (counter_string, test_case.test.name()) + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_tests(self):\n with self.report.timer.record(\"run\"):\n self.result.report.extend(self._run_tests())", "def on_trial_result(self, trial_runner, trial, result):\n\n raise NotImplementedError", "def v2_runner_on_ok(self, result, **kwargs):\n host = result._host\n t...
[ "0.6538823", "0.6422982", "0.6359315", "0.632417", "0.62801874", "0.62801874", "0.6255941", "0.6240914", "0.6189011", "0.6168655", "0.61665624", "0.610696", "0.6042014", "0.6017867", "0.60114545", "0.59857684", "0.5957382", "0.5944966", "0.5927798", "0.5916158", "0.59042597",...
0.6880045
0
Add this to the current list of test cases.
def add_test(self, testsuite, test): self.tests[testsuite].append(TestCase(test, self)) self.num_tests += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addTest(self, test):\r\n self.tests.append(test)\r\n return", "def add_test_case(self, test_case_name, test_case):\n\n self._test_cases[test_case_name] = test_case", "def add_test(self,test):\n l = test.id.split('.')\n s_obj = self\n while len(l) > 0:\n ...
[ "0.74710965", "0.6681017", "0.66113114", "0.6555657", "0.64308447", "0.6297083", "0.62622756", "0.61307585", "0.60939205", "0.6092288", "0.60853016", "0.6073061", "0.6071977", "0.60318005", "0.6010071", "0.59990704", "0.5983233", "0.59458035", "0.5877944", "0.5833173", "0.582...
0.7225753
1
Transform data in R2 to R3 using (x0, x1, x02 + x12)
def to_r3(x0, x1): assert isinstance(x0, np.ndarray) and isinstance(x1, np.ndarray) x2 = x0**2 + x1**2 return np.column_stack((x0, x1, x2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zyx_r_to_xyz(zyx3_r, zyx2_r, zyx1_r):\n\n # Calcolo l'elemento 1:3 della prima matrice (s1s3 + c1c3s2)\n s2_xyz = (math.sin(zyx1_r) * math.sin(zyx3_r)) + (math.cos(zyx1_r) * math.cos(zyx3_r) * math.sin(zyx2_r))\n\n # Calcolo l'elemento 2:3 della prima matrice (c3s1s2 - c1s3)\n minus...
[ "0.6243692", "0.5910569", "0.580519", "0.5664462", "0.55951613", "0.54431033", "0.54365546", "0.5386842", "0.53800195", "0.53476155", "0.5227179", "0.52213526", "0.51651746", "0.5108305", "0.5096154", "0.5093997", "0.50659764", "0.50621516", "0.5059059", "0.5034081", "0.50138...
0.718779
0
Plot the maximal margin hyperplane
def maximal_margin_hyperplane(svc, X, y, margins=True, support_vectors=True): assert isinstance(svc, sklearn.svm.classes.SVC) assert X.shape[1] == 2, 'X must be of shape (n_samples, 2)' x_min = X[:, 0].min() x_max = X[:, 0].max() w = svc.coef_[0] a = -w[0] / w[1] xx = np.linspace(x_min * 2, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_hyperplane(w, xmin, xmax, iter = None, alpha=None, color=None,linestyle=None):\n # Find the points on the dividing hyperplane\n # using p[0]w[0] + p[1]w[1] = -w[2], or p[1] = (-p[0]w[0] - w[2])/w[1]\n x_points = [xmin, xmax]\n y_points = [(-xmin * w[0] - w[2]) / w[1], (-xmax * w[0] - w[2])...
[ "0.61700726", "0.6025355", "0.5893999", "0.58517927", "0.58352804", "0.58185583", "0.565352", "0.55892843", "0.5532176", "0.5465143", "0.54141", "0.5405243", "0.539903", "0.5394629", "0.5394343", "0.5373196", "0.5347143", "0.533831", "0.5336869", "0.5334815", "0.53315145", ...
0.6607197
0
Resize images in a directory to (96, 96)
def resize_multiple_images(src_path, dst_path): for filename in os.listdir(src_path): img=Image.open(src_path+'/'+filename) new_img = img.resize((96,96,)) #new_img.resize(96,96,1) if not os.path.exists(dst_path): os.makedirs(dst_path) new_img.save(dst_path+'/'+fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize_image(parent_directory, img_columns,img_rows):\n\t#List of img files in the directory for the specific simulation file\n\tlisting = os.listdir(parent_directory)\n\t#Number of img files in the directory for the specific simulation file\n\tnum_samples = len(listing)\n\t#Create Directory to store the re-si...
[ "0.7107839", "0.6936147", "0.689036", "0.6818816", "0.6762907", "0.6667828", "0.66594255", "0.661895", "0.6618789", "0.6519556", "0.65115166", "0.64919275", "0.6480161", "0.6460946", "0.63959557", "0.6357291", "0.6343345", "0.6335286", "0.6324837", "0.6312655", "0.62835974", ...
0.80307746
0
Returns the list of points that form a diamond around the origin Makes concentric diamonds around a point (up to the specified radius), and returns all points within that diamond.
def diamond_points(self, x, y): points = [] orig_x = x orig_y = y # Origin points.append((x, y)) for i in range(1, self.blur_radius + 1): # Top points.append((orig_x, orig_y - i)) # NE side for x, y in zip(range(0, i), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_pilars_positions(distance, radius, x, y, width, height):\n pair_distance = (2 * radius) + (distance - 2*radius)\n \n pilars_x_axis = int(width / pair_distance)\n pilars_y_axis = int(height / pair_distance)\n\n gap_x_axis = (width - (pilars_x_axis * pair_distance))/2 + radius#gap bot...
[ "0.6377734", "0.59727514", "0.5951497", "0.5924464", "0.5909327", "0.58221114", "0.58133495", "0.58070815", "0.58048433", "0.57863474", "0.57779366", "0.5671457", "0.566336", "0.5597406", "0.55871665", "0.5570411", "0.55536747", "0.554404", "0.55429155", "0.5536369", "0.55312...
0.6943269
0
Sorts a directory of images based on color Opens a directory, gets the file list, and determines the color at specific points in the images (using a simple blur), downsamples to a lower bitdepth and stores the filename in a dictionary, based on the color signature. When completed, it will rename the files based on the ...
def sort(self): img_files = os.listdir(self.path) img_list = {} for img_file in img_files: filename = os.path.join(self.path, img_file) try: img = Image.open(filename) except: continue print "Analyzing %s" % img...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sorted_image_files(directory,priority='png'):\n \n #First get a list of file, start with priority, then all other image file types\n im_types = ['png','jpg','bmp','tif']\n im_types.remove(priority)\n \n file_list = glob(directory+'/*.'+priority)\n if not file_list:\n for im_type...
[ "0.6273056", "0.62001663", "0.60583323", "0.6025301", "0.59285295", "0.5837411", "0.58021957", "0.5762743", "0.5725515", "0.56800365", "0.567251", "0.5666186", "0.56645143", "0.56630886", "0.5657774", "0.5646535", "0.5626649", "0.5610571", "0.5593051", "0.5592624", "0.5586713...
0.7799002
0
Calculates period payment for a participant/investor
def period_payment(yearly_payments_percentage, client_cost_reduction, days_with_payments, days_for_discount_rate): yearly_payments_percentage = Fraction(str(yearly_payments_percentage)) client_cost_reduction = Fraction(str(client_cost_reduction)) if days_with_payments == 0: paym...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate(self):\r\n if self.__calculation_type == self.__DIFFERENTIATED_PAY:\r\n for month in range(1, self.__principal_term+1):\r\n self.__differentiated_pay.append(\r\n ceil(\r\n (self.__credit_principal/self.__principal_term)\r\n ...
[ "0.63640165", "0.6239729", "0.62235343", "0.6089876", "0.6042792", "0.5874432", "0.5756261", "0.5711801", "0.57064474", "0.5667006", "0.56217843", "0.5590697", "0.5503676", "0.5464572", "0.54236966", "0.54011095", "0.5397782", "0.536016", "0.534035", "0.5338979", "0.53381306"...
0.68127066
0
Check what a calendar will produce over time Simulates the check over time each `interval` hours for the given number of days. Results are printed to stdout.
def check_plan(url: str = None, start=None, days: int = 7, interval: int = 1): if start is None: start = autoscaler.utcnow() if url is None: url = os.environ["PLACEHOLDER_ICS_URL"] if url.startswith("http"): try: import requests_cache except ImportError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(self):\n\t\tfails = 0\n\t\tworktime_month = timedelta(hours=0)\n\t\tworktime_homeoffice = timedelta(hours=0)\n\t\tfor num in self.workdays:\n\t\t\tday = self.workdays[num]\n\t\t\tif day.daytype == DayType.work:\t\n\t\t\t\tfails += day.check(num)\n\t\t\t\tworktime = day.getWorkingTime()\n\t\t\t\tworktime_...
[ "0.5447444", "0.53098947", "0.53098947", "0.5306287", "0.5216087", "0.5157219", "0.51223516", "0.51186854", "0.5118139", "0.5097978", "0.5097125", "0.50757796", "0.5070578", "0.5068074", "0.50670826", "0.50561845", "0.50168663", "0.50091326", "0.495509", "0.494829", "0.492594...
0.55069774
0
Removing job from the machine by job number
def removeJob(self, job_number): job = self.retrieveJob(job_number) job_type = job.getType() - 1 del (self.assigned_jobs[job_number]) self.span -= job.getLength() self.types[job_type] = self.types[job_type] - 1 self.types_sums[job_type] = self.types_sums[job_type] - job.l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeAllJobs():\n for machine in machines_list:\n cur_jobs = dict(machine.assigned_jobs)\n for key, job in cur_jobs.items():\n if key != job.number:\n print(\"SOMETHING WENT WRONG\")\n num = job.number\n machine.removeJob(num)\n # pri...
[ "0.7421874", "0.7309826", "0.71536756", "0.68997353", "0.68017876", "0.67936313", "0.6754053", "0.6726761", "0.6607716", "0.65110505", "0.6487919", "0.6240919", "0.62099046", "0.6176015", "0.60776836", "0.60231984", "0.6004194", "0.597981", "0.596579", "0.5940471", "0.5932711...
0.77850246
0
Check how many different types do I have
def checkDiffTypes(self): count = 0 for t in self.types: if t > 0: count = count + 1 return count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_types_count():\n return len(type_dict.keys())", "def get_check_types():", "def N(self) -> int:\n n_types = len(self)\n return n_types", "def number_types(corpus):\n number_of_types = len(set(corpus))\n return number_of_types", "def _only_one_type(self):\n num_larger_th...
[ "0.73166287", "0.67643", "0.66399634", "0.6639378", "0.6612182", "0.6581364", "0.6491502", "0.6327805", "0.6210133", "0.6206833", "0.6193836", "0.6170218", "0.615249", "0.611738", "0.6109333", "0.6102406", "0.60987073", "0.6083452", "0.6080267", "0.6060567", "0.6057694", "0...
0.7223393
1
Creates and returns a machines list
def createMachines(): machines = [] for i in range(0, num_of_machines): cur_machine = Machine(i) machines.append(cur_machine) return machines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_machines(self):\n\n active_machines = self.get_active_machines()\n approved_machines = [machine for machine in TestMachine.objects.filter(approved=True) if machine.url in active_machines]\n\n machines = []\n for machine in approved_machines:\n browsers = []\n ...
[ "0.7277237", "0.716681", "0.69067675", "0.6785116", "0.661546", "0.6581618", "0.65398395", "0.6482614", "0.6368925", "0.63658136", "0.6332056", "0.6114782", "0.6054699", "0.5973721", "0.59544647", "0.59112966", "0.58951885", "0.58756334", "0.5858451", "0.5841948", "0.5839832"...
0.8474166
0
Create and returns a list of jobs objects
def createJobs(): jobs_list = [] for job in raw_jobs: cur_job = Job(int(job[0]), int(job[1]), int(job[2])) print("Created job: index:", cur_job.number, "Length:", cur_job.length, "Type", cur_job.type, file=debug_file) jobs_list.append(cur_job) print("-----------------FINISHED CREATIN...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jobs(self):\n return JobCollection(client=self)", "def jobs():\n result = []\n out = subprocess.check_output([\"/bin/launchctl\", \"list\"]).decode()\n for row in out.splitlines()[1:]:\n result.append(Job(row))\n return result", "def get(self):\n # TODO: auth\n retur...
[ "0.7465103", "0.7424576", "0.7350301", "0.71968544", "0.715372", "0.71410674", "0.7127707", "0.711594", "0.71115655", "0.7108732", "0.7099585", "0.70986056", "0.70986056", "0.7005212", "0.7004711", "0.6979075", "0.6971866", "0.6962218", "0.6960627", "0.69491625", "0.6934878",...
0.86365247
0
creating a chromosome returning a list of size num_of_jobs , each index is job number, value is the assigned machine
def createChrom(): ch = [0]*num_of_jobs for i in range(num_of_jobs): legal = False while not legal: machine_rand = randint(0,num_of_machines-1) ch[i] = machine_rand machines_list[machine_rand].addJob(jobs_list[i]) if machines_list[machine_rand].isL...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutate(chromosome:list):\n # how_many_to_mutate = randint(0,len(chromosome[0]))\n t = [i for i in range(len(chromosome[0]))]\n # how_many_to_mutate = randint(1,5)\n\n # 3 this is the maximum indices to mutate\n indices_to_mutate = choice(t, 3, replace=False)\n\n # now needs to simulate as if ...
[ "0.626436", "0.6249818", "0.61409795", "0.6133391", "0.61266434", "0.60257053", "0.59072524", "0.5733377", "0.5727004", "0.5721946", "0.56100655", "0.5607305", "0.5547366", "0.5509575", "0.54031605", "0.53904086", "0.5365497", "0.53322136", "0.5284141", "0.52328986", "0.52248...
0.73280805
0
returns current maximum makespan
def makeSpan(): max_span = 0 for machine in machines_list: if machine.span > max_span: max_span = machine.span return max_span
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_maxth(self):\n return self.__maxth", "def _get_maxth(self):\n return self.__maxth", "def _get_maxth(self):\n return self.__maxth", "def _get_maxth(self):\n return self.__maxth", "def _get_maxth(self):\n return self.__maxth", "def _get_maxth(self):\n return self.__maxth", "def...
[ "0.6362002", "0.6362002", "0.6362002", "0.6362002", "0.6362002", "0.6362002", "0.62888575", "0.62325543", "0.62109536", "0.6200191", "0.6172188", "0.6149351", "0.60451996", "0.5982796", "0.5982753", "0.59522766", "0.59421057", "0.5883013", "0.5864392", "0.58401245", "0.583810...
0.80475074
0
Prints a given population
def printPop(population: list): for p in population: print(p)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def population_print(population, value):\n increase_amount = population_increase(population)\n decrease_amount = population_decrease(population)\n print(\"{0} gophers were born. {1} died.\".format(int(increase_amount), int(decrease_amount)))\n population = population + int(increase_amount) - int(decre...
[ "0.7834367", "0.7422378", "0.69772786", "0.6808476", "0.63140506", "0.6311883", "0.6278352", "0.6250763", "0.6165213", "0.6154639", "0.6107561", "0.6094757", "0.6040907", "0.6021256", "0.5991143", "0.59907424", "0.5980408", "0.59054685", "0.59025395", "0.58846396", "0.5864683...
0.8027886
0
selections of parent according to a given probavilities
def selection(probs): # pick 2 parents out of this distribution t = [i for i in range(len(probs))] draw = choice(t, 2, p=probs, replace=False) return draw
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def selectAll(self,parent):\n\t\tif parent.IsOk() and self.tree.ItemHasChildren(parent):\n\t\t\tchild, cookie = self.tree.GetFirstChild(parent)\n\t\t\twhile child:\n\t\t\t\tobj = self.tree.GetPyData(child)\n\t\t\t\tselect = obj != \"1\" and obj != \"2\"\n\t\t\t\tif child not in self.tree.GetSelections() and select...
[ "0.6074033", "0.5989669", "0.5956892", "0.5952324", "0.5909788", "0.58560634", "0.5782979", "0.5709041", "0.5553071", "0.5548773", "0.5518206", "0.5503263", "0.5502207", "0.5486302", "0.5482949", "0.5402333", "0.5388914", "0.53848284", "0.53766775", "0.534261", "0.5321972", ...
0.6750221
0
Sanitizes a string so it could be used as part of a filename. If restricted is set, use a stricter subset of allowed characters. Set is_id if this is not an arbitrary string, but an ID that should be kept if possible.
def sanitize_filename(s, restricted=False, is_id=False): def replace_insane(char): if restricted and char in ACCENT_CHARS: return ACCENT_CHARS[char] if char == '?' or ord(char) < 32 or ord(char) == 127: return '' elif char == '"': return '' if restricted e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize(s, strict=True):\n allowed = ''.join(\n [\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',\n 'abcdefghijklmnopqrstuvwxyz',\n '0123456789',\n ]\n )\n\n if not strict:\n allowed += '-_.'\n\n s = str(s).replace(' ', '_')\n\n return ''.join([i for i in s...
[ "0.6425492", "0.6252466", "0.61610687", "0.61091113", "0.60681653", "0.60572934", "0.59674186", "0.59613883", "0.5878622", "0.5859218", "0.5815915", "0.58132446", "0.58079904", "0.5792112", "0.5777289", "0.5761631", "0.5663602", "0.5633081", "0.56095046", "0.5603764", "0.5588...
0.8018548
1
The timestep() function computes the advective timestep (CFL) constraint. The CFL constraint says that information cannot propagate further than one zone per timestep. We use the driver.cfl parameter to control what fraction of the CFL step we actually take.
def method_compute_timestep(self): myg = self.cc_data.grid cfl = self.rp.get_param("driver.cfl") u = self.cc_data.get_var("x-velocity") v = self.cc_data.get_var("y-velocity") # the timestep is min(dx/|u|, dy|v|) xtmp = ytmp = 1.e33 if not abs(u).max() == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_time_step():\n\n dt = Hydro.compute_time_step()\n\n return dt", "def time_constant_abf(abf, epoch_start):\n p0 = abf.sweepEpochs.p1s[epoch_start]\n p1 = abf.sweepEpochs.p1s[epoch_start + 1]\n\n t = abf.sweepX[p0:p1] - abf.sweepX[p0]\n V = abf.sweepY[p0:p1]\n\n return time_constant(...
[ "0.548368", "0.5451081", "0.5376065", "0.53658915", "0.52995604", "0.5277291", "0.5237473", "0.5094272", "0.5093074", "0.5057781", "0.5020378", "0.49587402", "0.4957557", "0.49569103", "0.49017346", "0.4890603", "0.4834348", "0.4832244", "0.482499", "0.4817781", "0.48057222",...
0.5789472
0
preevolve is called before we being the timestepping loop. For the low Mach solver, this does an initial projection on the velocity field and then goes through the full evolution to get the value of phi. The fluid state (rho, u, v) is then reset to values before this evolve.
def preevolve(self): self.in_preevolve = True myg = self.cc_data.grid rho = self.cc_data.get_var("density") u = self.cc_data.get_var("x-velocity") v = self.cc_data.get_var("y-velocity") self.cc_data.fill_BC("density") self.cc_data.fill_BC("x-velocity") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evolve(self):\n\n rho = self.cc_data.get_var(\"density\")\n u = self.cc_data.get_var(\"x-velocity\")\n v = self.cc_data.get_var(\"y-velocity\")\n\n gradp_x = self.cc_data.get_var(\"gradp_x\")\n gradp_y = self.cc_data.get_var(\"gradp_y\")\n\n # note: the base state quan...
[ "0.6187677", "0.6041225", "0.5963481", "0.5738393", "0.5676262", "0.56750685", "0.5612032", "0.5611723", "0.5580519", "0.5546617", "0.5523533", "0.54433066", "0.5443045", "0.542925", "0.54243726", "0.53828454", "0.5374413", "0.5347353", "0.53319997", "0.53300595", "0.53299206...
0.72240627
0
Opening a Spark session and adding it to the context
def open_spark_session(config: Config): if not config.session_exists("SparkSession"): config.debug("SparkSession", "Opening Spark session") session = SparkSess(config).spark config.add_session("SparkSession", session) config.debug("SparkSession", f"Spark session added to sessions ope...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_sparksession():\n return SparkSession.builder.\\\n appName(\"Transforming the historical parking occupancy and blockface datasets\").\\\n getOrCreate()", "def create_spark_session():\n return SparkSession.builder \\\n .appName(\"Dataframe Reader\") \\...
[ "0.75017834", "0.7359141", "0.7211331", "0.72099054", "0.7173464", "0.7130308", "0.7130308", "0.7130308", "0.7130308", "0.71239", "0.71140575", "0.71140575", "0.71140575", "0.71140575", "0.71140575", "0.71140575", "0.71140575", "0.71140575", "0.71140575", "0.71039414", "0.709...
0.780664
0
Generate a random number every 1 second and emit to a socketio instance (broadcast) Ideally to be run in a separate thread?
def randomNumberGenerator(self): #infinite loop of magical random numbers print "Making random numbers" while not thread_stop_event.isSet(): global counter #if counter == 8: # emit('done', {'data': 'finito'}) # break ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def background_thread():\n count = 0\n while True:\n time.sleep(10)\n count += 1\n socketio.emit('my response',\n {'data': 'Server generated event', 'count': count},\n namespace='/test')", "def randomNumberGenerator(self):\n # infinite l...
[ "0.7129029", "0.70103854", "0.69725", "0.6917894", "0.6677476", "0.60470027", "0.60444736", "0.58454525", "0.5698992", "0.5640968", "0.5483434", "0.5442896", "0.5430689", "0.5343313", "0.5335054", "0.5331392", "0.5330254", "0.53162056", "0.53125906", "0.52694863", "0.526682",...
0.7050479
1
Obtain a piece of HTML for a new progress bar (should be called through AJAX)
def progress_bar_new() -> str: pb_id = int(request.args['pb_id']) has_insights = request.args['has_insights'] == 'true' # Obtain progress bar details. Only show the user@host part if it doesn't equal the user@host of this process # (in case someone connected to this dashboard from another machine or us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getProgress(self):", "def progress_bar(progress):\n bar_length = 50\n block = int(round(bar_length * progress))\n text = 'Progress: [{0}] {1}'.format('#' * block + '-' * (bar_length - block),\n progress * 100)\n # Print progress after removing the previous p...
[ "0.6647668", "0.6396388", "0.63699394", "0.6366449", "0.6340822", "0.61912984", "0.6169967", "0.6152464", "0.61337185", "0.61337185", "0.60970765", "0.6074654", "0.60169065", "0.6010347", "0.6006588", "0.59941936", "0.59628475", "0.59440225", "0.59330946", "0.59311444", "0.59...
0.69494396
0
Starts a new MPIRE dashboard
def start_dashboard(port_range: Sequence = range(8080, 8100)) -> Dict[str, Union[int, str]]: global _DASHBOARD_MANAGER, _DASHBOARD_TQDM_DICT, _DASHBOARD_TQDM_DETAILS_DICT if not DASHBOARD_STARTED_EVENT.is_set(): # Prevent signal from propagating to child process with DisableKeyboardInterruptSi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dashboard():", "def run_dashboard(\n self, force: bool = False, _dev: Optional[Path] = None\n ) -> Process:\n\n if force:\n self.stop_dashboard(force=force)\n\n if Tru.dashboard_proc is not None:\n raise ValueError(\n \"Dashboard already running. \...
[ "0.6546257", "0.6125507", "0.6099835", "0.57874626", "0.5767364", "0.5765759", "0.5601417", "0.5524074", "0.5521138", "0.5501144", "0.5462243", "0.5416196", "0.53694373", "0.5365707", "0.5350448", "0.53450316", "0.5335294", "0.53161323", "0.52930707", "0.5291861", "0.5284087"...
0.63922703
1
A Gaussian curve. x = Variable t = time shift sigma = standard deviation
def Gaussian(x,t,sigma): return np.exp(-(x-t)**2/(2*sigma**2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Gaussian(x, t, sigma):\n return np.exp(-(x - t)**2 / (2 * sigma**2))", "def gaussian(t, params):\n DeprecationWarning(\"Using standard width. Better use gaussian_sigma.\")\n params['sigma'] = Qty(\n value=params['t_final'].get_value()/6,\n min_val=params['t_final'].get_value()/8,\n...
[ "0.83320016", "0.7339864", "0.7333446", "0.7279984", "0.7018672", "0.7011184", "0.69803935", "0.6786999", "0.6783696", "0.6764284", "0.6679132", "0.66568184", "0.6604135", "0.6589584", "0.65724736", "0.65704215", "0.653733", "0.6516346", "0.6471396", "0.6454611", "0.6428911",...
0.8445372
0
Return the broker url based on environment variables
def broker_url(settings): broker = 'amqp://' broker += settings.get('BROKER_USER') or 'guest' broker += ':' + (settings.get('BROKER_PASSWORD') or 'guest') broker += '@' + (settings.get('BROKER_HOST') or 'localhost') broker += ':' + (settings.get('BROKER_PORT') or '5672') return broker
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def broker_url(host):\n return '{broker_scheme}://{username}:{password}@{host}:{port}//'.format(host=host, **CONFIG_JOB_QUEUE)", "def get_server_url():\n try:\n url = os.environ['API_HOST']\n # print('[ OK ] Server url loaded: ', url)\n except KeyError:\n url = 'http://localhost:3...
[ "0.7707761", "0.70065045", "0.69603246", "0.68007356", "0.6759248", "0.66489595", "0.6419536", "0.63853437", "0.6333034", "0.6239412", "0.6222605", "0.6185681", "0.6172291", "0.6129939", "0.6114642", "0.609799", "0.6084983", "0.6034623", "0.59930116", "0.59909225", "0.5986465...
0.7796811
0
this lets you see whether one privilege is "higher" than another, though it's really meant more for display sorting than determining ability to do something, since possession of a "higher" privilege doesn't necessarily imply the ability to do anything a "lower" privilege can.
def comparator(cls, priv1, priv2): priv1_idx = cls._ORDERED_PRIV_LIST.index(priv1) priv2_idx = cls._ORDERED_PRIV_LIST.index(priv2) if priv1_idx == priv2_idx: return 0 if priv1_idx < priv2_idx: return -1 return 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __gt__(self, other):\n return other < self._cmpkey()", "def __gt__(self, other):\n return self.abs2phy.__gt__(other)", "def __gt__(self, other):\n return self.abs2phy.__gt__(other)", "def __gt__(self, other):\n if other.num_of_certified_applications > self.num_of_certified...
[ "0.5892672", "0.58163613", "0.58163613", "0.57768315", "0.5751311", "0.57469845", "0.57055604", "0.5687826", "0.56395966", "0.5633531", "0.56155765", "0.5608583", "0.5601823", "0.5601157", "0.559949", "0.5594099", "0.5594099", "0.5586501", "0.5576287", "0.556291", "0.555138",...
0.6286243
0
Returns counts of answers per weekdays (first value is Monday etc)
def weekday_activity(frame): data = DataFrame() data['weekday'] = DatetimeIndex(frame.inserted).weekday counts = DataFrame(arange(7)*0) return (counts[0]+data.weekday.value_counts()).fillna(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_weeklyFrequency(self):\n\n if len(self.fields) == 0:\n return None\n\n if self.validator.validate(self.fields) == False:\n return None\n\n weeklyFrequency = 0\n dayFields = ['day1','day2','day3','day4','day5','day6','day7']\n for dayField in dayField...
[ "0.64603704", "0.6336756", "0.62370455", "0.6056633", "0.6042096", "0.58491486", "0.5818919", "0.5745223", "0.5736226", "0.5682482", "0.56750184", "0.56536543", "0.5605499", "0.55914366", "0.5563621", "0.5530639", "0.55278695", "0.55278695", "0.5446818", "0.5445078", "0.54235...
0.64842105
0
Returns number of users for every time period
def number_of_users(frame, frequency = 'M'): times = frame.groupby('user').apply(lambda x: x.inserted.values[0]) times = times.reset_index() times = times.set_index(DatetimeIndex(times[0])) return times.resample(frequency,how=len).user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_inactive_attendeelog_user_count(self, activeperiod_weeks=5):\n now = self.now\n total_user_count = len(list(self.client.smartsleep.attendeelogs.find({}).distinct(\"userId\")))\n result = []\n for i in range(activeperiod_weeks):\n pipeline = [\n {'$matc...
[ "0.69386184", "0.6787131", "0.67775035", "0.6766791", "0.6641417", "0.6611704", "0.65491414", "0.65473014", "0.64781046", "0.6446204", "0.64097637", "0.6383045", "0.63483405", "0.6344501", "0.63093805", "0.62714756", "0.62644064", "0.62492377", "0.62413704", "0.6195851", "0.6...
0.74530303
0
Returns number of answers for every time period
def number_of_answers(frame, frequency= 'M'): result = frame.set_index(DatetimeIndex(frame.inserted)) if frequency=='M': result = result.groupby(['user',lambda x: x.year,lambda x: x.month]) elif frequency == 'W': result = result.groupby(['user',lambda x: x.year,lambda x: x.week]) e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(time):\n \n return len(events(time))", "def get_n_answers(self):\n return len(self.df)", "def num_trials(self):", "def count():", "def correct_answers(self):\n return self.tasks.filter(answer=F('question__solution')).count()", "def tally(self):\n return self.count", "...
[ "0.6015431", "0.5904631", "0.5897732", "0.5877168", "0.5855183", "0.5806179", "0.5803191", "0.5787229", "0.5786506", "0.5786506", "0.5786506", "0.575544", "0.57322735", "0.57292557", "0.57093704", "0.5704312", "0.5685799", "0.567424", "0.56668025", "0.56576383", "0.56425613",...
0.70868635
0
sum days since purchase between all copies of a given book and get an average from today why average? some book copies may be bought at different dates.
def get_days_since_purchase(database, ISBN_list): date_format = "%d/%m/%Y" todays_date = date.today().strftime(date_format) avg_days_since_purchases = [] for book in range(len(ISBN_list)): # print("ISBN: " + str(ISBN_list[book])) sum_days_per_book = 0 copies_found = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aveVolumeCalc(ins, date):\n cal = ins.Currency().Calendar()\n enddate = cal.AdjustBankingDays(date, 0)\n startdate = cal.AdjustBankingDays(date, AVERAGING_PERIOD)\n\n prices=[]\n histprices = acm.FPrice.Select(\"instrument = %s and market = '%s' \\\n and day > '%s' and day...
[ "0.6412541", "0.6261", "0.6225761", "0.5845206", "0.5767818", "0.5742252", "0.5664643", "0.56512445", "0.5637922", "0.5613285", "0.55788803", "0.55427676", "0.55362433", "0.5493713", "0.5491794", "0.54895586", "0.5481498", "0.5471503", "0.5467752", "0.5466771", "0.5459487", ...
0.75977814
0
Create a rotatable instance of this hit box. The internal ``PointList`` is transferred directly instead of deepcopied, so care should be taken if using a mutable internal representation.
def create_rotatable( self, angle: float = 0.0, ) -> RotatableHitBox: return RotatableHitBox( self._points, position=self._position, scale=self._scale, angle=angle )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __copy__(self) -> 'Plane':\n return self.__class__(self._normal, self._distance_from_origin)", "def _rotate(self):\n new_points = list()\n for i in range(len(self._points)):\n x = self._points[i][0]\n y = self._points[i][1]\n new_x = self._center[0] + sel...
[ "0.5573029", "0.5551235", "0.53923625", "0.53923625", "0.5275601", "0.5178709", "0.51570475", "0.5082338", "0.50811464", "0.5065062", "0.5035872", "0.5031376", "0.4983563", "0.49818492", "0.49745435", "0.4967136", "0.49613687", "0.49301225", "0.49218398", "0.4920458", "0.4906...
0.7346769
0