query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Calculate the Lorenz curve graph based on the weight of the nodes.
def calculate_lorenz_curve(graph, type, steps=100): vertices = {} total_weight = 0.0 for node in graph.nodes(): if graph.node[node]['type'] is type: vertices[node] = graph.node[node]['weight'] total_weight += graph.node[node]['weight'] print 'Total Weight:', total_weight step_size = len(vertices.keys()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def laplacian(G,nodelist=None,weight='weight'):\n try:\n import numpy as np\n except ImportError:\n raise ImportError(\n \"laplacian() requires numpy: http://scipy.org/ \")\n # this isn't the most efficient way to do this...\n if G.is_multigraph():\n A=np.asarray(nx.to_num...
[ "0.61697334", "0.5985262", "0.57928765", "0.5774828", "0.5718139", "0.57098746", "0.56282556", "0.56156987", "0.561296", "0.5546312", "0.55331117", "0.5505912", "0.55016", "0.54956394", "0.54727376", "0.54492074", "0.54362154", "0.5434964", "0.54281646", "0.54253894", "0.5422...
0.6974506
0
Create and insert a salesman in DB. Return this salesman.
def create(self, **kwargs): self.Salesman.SalesmanSchema(kwargs) salesman = self.Salesman.Salesman(**kwargs) self._dbsession.add(salesman) return salesman
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self):\n db.session.add(self)\n db.session.commit()", "def insert(self):\n db.session.add(self)\n db.session.commit()", "def insert(self):\n db.session.add(self)\n db.session.commit()", "def insert(self):\n db.session.add(self)\n db.session.c...
[ "0.61802167", "0.6086429", "0.6086429", "0.6086429", "0.60064095", "0.5817878", "0.5795104", "0.5790183", "0.5750525", "0.5674662", "0.5659894", "0.55962473", "0.55460125", "0.5523515", "0.5506935", "0.5506935", "0.5506935", "0.5506935", "0.5506935", "0.5506935", "0.5506935",...
0.83125734
0
Update a salesman. Return False if there is no update or the updated salesman.
def update(self, salesman_id=None, salesman=None, **kwargs): salesman = self._get(salesman_id, salesman) salesman_dict = {k: getattr(salesman, k) for k in salesman.create_dict if getattr(salesman, k) is not None} new_salesman_dict = salesman_dict.copy() item_to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, **validated_data):\n updated = self._provision(validated_data)\n if updated:\n try:\n db.session.commit()\n return True\n except Exception as error:\n db.session.rollback()\n print(error.args)\n ...
[ "0.54279137", "0.5248786", "0.5225192", "0.5171629", "0.5153626", "0.5130111", "0.5093068", "0.50651497", "0.5039609", "0.5020056", "0.49453017", "0.4910194", "0.48789948", "0.48310226", "0.48208135", "0.48175666", "0.48078495", "0.47769818", "0.4775985", "0.4775985", "0.4768...
0.7559009
0
Set the commission formulae of a salesman. Return False if there is no update or the updated salesman.
def set_commissions_formulae(self, salesman_id=None, salesman=None, commissions_formulae=None): if commissions_formulae is None: raise TypeError('commissions_formulae missing') salesman = self._get(salesman_id, salesman) if commissions_formulae == salesman.commissions_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setFormula(self, *args):\n return _libsbml.KineticLaw_setFormula(self, *args)", "def setFormula(self, *args):\n return _libsbml.Rule_setFormula(self, *args)", "def isSetFormula(self):\n return _libsbml.KineticLaw_isSetFormula(self)", "def isSetFormula(self):\n return _libsbml....
[ "0.5631036", "0.5510063", "0.54576015", "0.5227687", "0.5168512", "0.51609457", "0.5027287", "0.49783978", "0.4966199", "0.49557495", "0.4914359", "0.48699042", "0.48342544", "0.48213744", "0.4819287", "0.4814658", "0.48145792", "0.47860384", "0.47783843", "0.47650018", "0.47...
0.798566
0
New York Times case data by county
def get_nyt(): counties = pd.read_csv('https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv') counties['deaths'] = counties['deaths'].astype(float) counties['cases'] = counties['cases'].astype(float) return counties
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_covid_stats_by_county(state, county):\n url = \"https://corona.lmao.ninja/v2/jhucsse/counties/\" + county\n response = requests.get(url)\n data = response.json()\n counties = []\n for res in data:\n if res[\"province\"] == state:\n county1 = res[\"county\"]\n upd...
[ "0.76770914", "0.6829904", "0.6720135", "0.6696589", "0.6209203", "0.6139221", "0.6116386", "0.602759", "0.5986183", "0.5914345", "0.5897523", "0.5850794", "0.58177316", "0.57914954", "0.57755387", "0.5766568", "0.57457167", "0.57380635", "0.57225364", "0.56570256", "0.563618...
0.62347186
4
NYT most recent case count only merged with census density data
def merge_recent(nyt, census): nyt['name'] = [county + ', ' + state for county, state in zip(nyt['county'].values, nyt['state'].values)] del nyt['county'] del nyt['state'] sorted_cases = nyt[:len(nyt)].sort_values(by=['name', 'date'], inplace=False) recent_cases = sorted_cases.drop_duplicates(subset...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_county_case_info(date=None):\n def get_latest_case_info(url, column_name):\n df = fetch_df(url)\n col = df.columns[-1]\n if date is not None:\n if not date in df.columns:\n raise Exception('Date {} not in dataset or not in proper format'.format(date))\n ...
[ "0.66494733", "0.57787514", "0.5734458", "0.5731972", "0.5592073", "0.5574256", "0.5548086", "0.55144674", "0.5508588", "0.54565537", "0.5449514", "0.5423221", "0.54035956", "0.53978556", "0.53924435", "0.53587765", "0.5358537", "0.53479904", "0.5324095", "0.5274466", "0.5264...
0.6022568
1
a function that takes a list and return a list that includes just int values
def filter_list(l): return list(filter(lambda x: type(x) == int, l))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ints(xs: Iterable) -> list[int]:\n return lmap(int, xs)", "def toIntList(values):\n\treturn list(map(lambda va: int(va), values))", "def get_list_of_int2(self):\n pass", "def test_to_int_list(self):\n self.assertEqual(to_int_list([u\"3\", None, \"asdf\", u\"42\"]), [3, 0, 0, 42])", "de...
[ "0.77845734", "0.74443513", "0.70452034", "0.70050794", "0.69857043", "0.6981452", "0.672748", "0.668111", "0.666364", "0.6624211", "0.64351004", "0.6340502", "0.63118035", "0.62968373", "0.62313205", "0.619445", "0.61752886", "0.607293", "0.6064448", "0.6038841", "0.603878",...
0.7127826
2
Calculates position of an object around a circle after some time with interval dt.
def CalculatePosition(radius,velocity,time,dt): # Initial conditions theta = 0 xini = radius * np.cos(theta) yini = radius * np.sin(theta) t = 0 # Store positions and time xposition = [xini] yposition = [yini] storedtime = [t] # Calculate positions while t < ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_position(self, dt):\n self._x += self._vx * dt\n self._y += self._vy * dt\n\n # TODO: Add timer countdown if infected and logic for dying/recovering.", "def move(self, dt):\n w_px = self.meter_to_cart(self.vw)\n # delta_theta = delta_s/r\n self.theta += self.v...
[ "0.68143946", "0.6695585", "0.6501338", "0.6077402", "0.6071127", "0.5974124", "0.59736204", "0.59488606", "0.5938238", "0.58743864", "0.58348894", "0.583335", "0.58260334", "0.5783727", "0.57738256", "0.57213885", "0.5694227", "0.5692534", "0.5640608", "0.56402296", "0.56323...
0.68198085
0
Calculate positions of multiple objects around a circle.
def MultiplePositions(radius,velocity,time,dt): # Stop the calculation when the outermost point takes a whole revolution # Outermost point position outerposition = radius[len(radius)-1] # Calculate the positions of outermost point: xouter = CalculatePosition(radius[len(radius)-1],velocity[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def objects_radius(self, centre, radius):", "def get_circle_coords(self, radius, divider, count,center_x, center_y):\n\n angle_deg = (360/divider)*count\n angle = radians(angle_deg-(90 + (360/divider)))\n x = radius*cos(angle) + center_x;\n y = radius*sin(angle) + center_y;\n r...
[ "0.6573711", "0.6500878", "0.6470239", "0.64024395", "0.6312665", "0.6311622", "0.62207884", "0.6218778", "0.62045026", "0.6172052", "0.6139447", "0.6115408", "0.60919094", "0.60410416", "0.60351837", "0.6013027", "0.60069835", "0.5990119", "0.5984226", "0.59842", "0.5969877"...
0.65115094
1
View function for home page of site.
def index(request, template_name='index.html'): context_dict = {} model = Uni column_headers = ['rank', 'name', 'location', 'city', 'scores_overall'] check_fields = ['scores_citations', 'scores_industry_income', 'scores_international_outlook', 'scores_research', 'scores_teaching', 'stats_student_staff_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(request):\n\treturn render(request, \"compta/home.html\")", "def home_page(request):\r\n return render(request, 'ez_main/home_page.html')", "def home(request):\r\n return render(request, 'home.html')", "def homepage(request):\n\treturn render(request, 'core/homepage.html')", "def homepage(req...
[ "0.8493426", "0.84268916", "0.83415145", "0.83306193", "0.82976943", "0.8295291", "0.8276345", "0.82545686", "0.82155704", "0.8132563", "0.81246215", "0.81224865", "0.8121264", "0.81049734", "0.8098485", "0.80935514", "0.80935514", "0.80935514", "0.80935514", "0.80935514", "0...
0.0
-1
Get the current gpu usage. Returns
def get_gpu_memory_map(): result = subprocess.check_output( [ 'nvidia-smi', '--query-gpu=memory.used', '--format=csv,nounits,noheader' ])#, encoding='utf-8') # Convert lines into a dictionary gpu_memory = [int(x) for x in result.strip().split('\n')] gpu_memory_map...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_gpu_mem_usage(self):\n assert self.network_generator is not None, \\\n \"Unable to measure network memory utilization without generator function\"\n\n dispatcher = MulticoreDispatcher(1)\n dispatcher.run(get_model_gpu_allocation, self.network_generator)\n mem_usage = dispatcher.join()[0]\...
[ "0.8035778", "0.77536726", "0.77282935", "0.7487686", "0.7445043", "0.7313413", "0.7313413", "0.7313413", "0.7280727", "0.7255568", "0.7211469", "0.71804446", "0.7127425", "0.7010632", "0.7010632", "0.69851494", "0.69810337", "0.6917472", "0.6861583", "0.686003", "0.68554324"...
0.0
-1
Receiving tick data and do computations
def on_book(context, quote_type, quote): date, filterTime = str(context.config.trading_date), int(quote.int_time) # print(quote.symbol, quote.int_time) if ((filterTime > 93000000) and (filterTime < 113000000)) or ( (filterTime > 130000000) and (filterTime < 150000000)): # print ("Trading T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_tick(self, tick):\n pass", "def tick(self):", "def update_job_tick(self, tick):", "def tick(self):\n pass", "def tick(self):\n pass", "def tick(self):\r\n pass", "def tick(self, tick):\n pass", "def tick(self, tick):\n pass", "def on_tick(self, ...
[ "0.7545108", "0.6828843", "0.65505284", "0.65361184", "0.65361184", "0.6525136", "0.65122926", "0.65122926", "0.6487955", "0.6453157", "0.636641", "0.63243717", "0.6292392", "0.62816334", "0.6254067", "0.6214015", "0.6212171", "0.62024945", "0.62010115", "0.6149372", "0.61199...
0.0
-1
Receiving information on trade results
def on_response(context, response_type, response): if response.status in (OrderStatus.SUCCEED.value, OrderStatus.PARTED.value) and response_type == 0: if response.exe_volume == 0: return if response.direction == Direction.BUY.value: if response.open_close == OpenClose.OPEN.va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_trade(self, trade):\n print trade", "async def on_trade_receive(self, trade: \"steam.TradeOffer\") -> None:", "async def on_trade_send(self, trade: \"steam.TradeOffer\") -> None:", "def run(self):\n pair = self.args.get('<pair>')\n\n self.validate(pair)\n market = self...
[ "0.682889", "0.6653092", "0.62368613", "0.6188609", "0.6183495", "0.6100708", "0.60158306", "0.6010278", "0.58669657", "0.58581984", "0.5733536", "0.57114035", "0.57089674", "0.56982636", "0.5676665", "0.56563145", "0.56352496", "0.5634542", "0.5623408", "0.56134933", "0.5609...
0.52577525
89
A Timer function with preset timer interval.
def on_timer(context, data_type, data): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __set_interval(self, func, sec):\n\n def func_wrapper():\n self.__set_interval(func, sec)\n func()\n\n t = threading.Timer(sec, func_wrapper)\n t.start()\n return t", "def create_timer(function, time):\n timer = Timer()\n timer.timeout.connect(f...
[ "0.7623464", "0.74680775", "0.71940523", "0.7175581", "0.7170886", "0.7155051", "0.70665896", "0.6965988", "0.6789375", "0.674858", "0.6688875", "0.6659328", "0.6630618", "0.6613371", "0.66007763", "0.659167", "0.65842026", "0.65802866", "0.6554546", "0.65529996", "0.6484858"...
0.0
-1
Call at the end of each trading session, clear all variables
def on_session_finish(context): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup_and_reset(self):\n self.mem.set(self.mem.META_PLAN, None)\n self.mem.set(self.mem.META_GOALS, None)\n self.mem.set(self.mem.META_CURR_GOAL, None)", "def _reset(self):", "def cleanup_after_session(self):\n\n self._aprs_service.reset_tracker()", "def reset():", "def reset(...
[ "0.6945473", "0.6932736", "0.690246", "0.6889315", "0.6889315", "0.6889315", "0.6827815", "0.6827815", "0.680752", "0.6779512", "0.6773059", "0.66883445", "0.66594106", "0.66361755", "0.66361755", "0.66361755", "0.66361755", "0.6633274", "0.6633274", "0.6606949", "0.65916944"...
0.0
-1
Initialize with an existent context
def __init__(self, context): self.__context = context.getApiContext()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_with_context(self, context):\n pass", "def initialize(self, context):\n pass", "def initialize(self, context):\n pass", "def initialize(self, context):\n pass", "def initialize(self, context):\r\n pass", "def initialize(self, context):\n raise NotImpleme...
[ "0.8680355", "0.80463785", "0.80463785", "0.80463785", "0.8040309", "0.8038214", "0.7847549", "0.7847549", "0.7847549", "0.7847549", "0.7847549", "0.7847549", "0.7847549", "0.7847549", "0.7847549", "0.7847549", "0.7847549", "0.7847549", "0.7847549", "0.7847549", "0.7847549", ...
0.7174684
41
Creates a new datacenter
def create_datacenter(self, name, location, rs_address): log.info("Creating datacenter %s at %s..." % (name, location)) datacenter = Datacenter.builder(self.__context) \ .name(name) \ .location(location) \ .remoteServices(rs_address, AbiquoE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_data_center(\n dc_name, cluster_name, host_name, comp_version=config.COMPATIBILITY_VERSION\n):\n testflow.step(\"Add data-center %s\", dc_name)\n assert ll_dc.addDataCenter(\n True, name=dc_name, local=False, version=comp_version\n ), \"Failed to create dc %s\" % dc_name\n\n testfl...
[ "0.71436054", "0.6854401", "0.68000853", "0.66635144", "0.6579462", "0.645192", "0.62347233", "0.6209931", "0.60344267", "0.59921485", "0.58602756", "0.5857226", "0.5770692", "0.57693875", "0.57291585", "0.5673177", "0.564252", "0.564252", "0.56083393", "0.560283", "0.5579511...
0.7115503
1
Creates a new rack
def create_rack(self, datacenter, name, vlan_id_min, vlan_id_max, nrsq): log.info("Adding rack %s..." % name) rack = Rack.builder(self.__context, datacenter) \ .name(name) \ .vlanIdMin(vlan_id_min) \ .vlanIdMax(vlan_id_max) \ .nrsq(nrsq) \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fusion_api_add_rack(self, body, api=None, headers=None):\n return self.rack.create(body, api, headers)", "def create_stack(Name=None, Region=None, VpcId=None, Attributes=None, ServiceRoleArn=None, DefaultInstanceProfileArn=None, DefaultOs=None, HostnameTheme=None, DefaultAvailabilityZone=None, Def...
[ "0.5731745", "0.5350707", "0.53393763", "0.53384423", "0.5296091", "0.5239721", "0.52332866", "0.52140033", "0.5193469", "0.5193469", "0.5127653", "0.5095804", "0.5093371", "0.50695837", "0.50252014", "0.5025094", "0.5003722", "0.50027835", "0.49996632", "0.49757338", "0.4974...
0.6487994
0
Creates a new machine
def create_machine(self, rack, hyp, address, user, password, datastore, vswitch): log.info("Adding %s hypervisor at %s..." % (hyp, address)) datacenter = rack.getDatacenter() # Discover machine info with the Discovery Manager remote service machine = datacenter.discoverSingl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createMachine():\n cd('/')\n machine = create(machineName, 'UnixMachine')\n cd('Machines/'+machineName+'/NodeManager/'+machineName)\n cmo.setName(machineName)\n cmo.setListenAddress(hostname)", "def machine_new(node=\"dev\", driver='virtualbox'):\n machine = Dockerizing(driver)\n\n # Che...
[ "0.829687", "0.82842714", "0.7538887", "0.7434876", "0.74281883", "0.74240506", "0.7402554", "0.73032427", "0.7276672", "0.72117895", "0.70031244", "0.697305", "0.69065183", "0.68884516", "0.6740426", "0.6725909", "0.6515277", "0.65015304", "0.64961565", "0.6485947", "0.64803...
0.72930247
8
Creates the default infrastructure compute entities.
def create_infrastructure_compute(config, context): log.info("### Configuring infrastructure ###") comp = InfrastructureCompute(context) rs_address = config.get("datacenter", "rs") \ if config.has_option("datacenter", "rs") \ else context.getApiContext().getEndpoint().getHost() d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_infrastructure_storage(config, context, dc):\n print \"### Configuring storage ###\"\n storage = InfrastructureStorage(context)\n tier = storage.configure_tiers(dc, config.get(\"tier\", \"name\"))\n try: \n user = config.get(\"device\", \"user\")\n password= config.get(\"device...
[ "0.6158783", "0.60312074", "0.5879258", "0.5680778", "0.5614755", "0.5404508", "0.5369365", "0.5341656", "0.52965254", "0.52809167", "0.52513313", "0.5248991", "0.52394885", "0.52330923", "0.520033", "0.51824903", "0.51824903", "0.51648235", "0.5156057", "0.51496494", "0.5147...
0.69378626
0
Cleans up previously created infrastructure compute resources
def cleanup_infrastructure_compute(config, context): log.info("### Cleaning up infrastructure ###") admin = context.getAdministrationService() for datacenter in admin.listDatacenters(): cleanup_infrastructure_storage(config, datacenter) cleanup_infrastructure_network(config, datacenter) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanupResources():\n None", "def finalizer():\n for resource_type in pods, pvcs, storageclasses, secrets:\n for resource in resource_type:\n resource.delete()\n resource.ocp.wait_for_delete(resource.name)\n if pools:\n # Delete only the RBD ...
[ "0.7537821", "0.7452589", "0.7419435", "0.7336632", "0.7252372", "0.7234718", "0.7166905", "0.7032153", "0.69838613", "0.6968813", "0.68726987", "0.6845922", "0.683998", "0.6813877", "0.680531", "0.6766662", "0.67335284", "0.67247486", "0.6697108", "0.6697108", "0.6697108", ...
0.7529746
1
Filter to display date correctly.
def format_date(value): try: return value.strftime('%d/%m/%Y') except: return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_display_date(self):\n return ''", "def filter_simple_date(value: datetime) -> str:\n return value.strftime(\"%Y-%m-%d\")", "def filter_project_date(s):\n return datetime.strptime(s, '%Y-%m-%d').strftime('%B %Y')", "def filter_formatdate(val, format_str):\n if not isinstance(val, (d...
[ "0.72578436", "0.7099721", "0.6540319", "0.63209057", "0.6271501", "0.62119335", "0.60948944", "0.6031777", "0.6027745", "0.60139525", "0.59964126", "0.59527475", "0.590289", "0.58997744", "0.58856505", "0.58827037", "0.5848989", "0.58228445", "0.5805669", "0.57836074", "0.57...
0.0
-1
Filter to display date and time correctly.
def format_datetime(value): try: return value.strftime('%d/%m/%Y %Hh%i') except: return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_display_date(self):\n return ''", "def filter_simple_date(value: datetime) -> str:\n return value.strftime(\"%Y-%m-%d\")", "def datetimefilter(value, format='%b %d'):\n\n return value.strftime(format)", "def validtimefilter(self, hito):\n\t\tif self.horadesde == \"\" and self.horahast...
[ "0.644055", "0.6047849", "0.59053224", "0.58727205", "0.57669264", "0.5712048", "0.56771386", "0.5589378", "0.5569981", "0.5543087", "0.553032", "0.5492645", "0.5480813", "0.5460648", "0.5451267", "0.54431355", "0.54368234", "0.54264677", "0.53963417", "0.53898895", "0.538142...
0.0
-1
Render the document using secretary.
def render(self, context): engine = Renderer() engine.environment.filters['format_date'] = format_date engine.environment.filters['format_datetime'] = format_datetime result = engine.render(self.template, **context) response = HttpResponse( content_type='application/v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _render(self) -> None:\n pass", "def dspyRender(self):\n pass", "def document(self):\n ...", "def main():\n return render_template('doc.html', docid=queue.pop(0))", "def render(self):\n pass", "def render(self):\n pass", "def render(self):\n pass", "de...
[ "0.5947269", "0.59465855", "0.59451085", "0.59050834", "0.57595533", "0.57595533", "0.57595533", "0.57595533", "0.57595533", "0.57595533", "0.5728399", "0.56710607", "0.5656817", "0.56483203", "0.5627183", "0.56006396", "0.5592281", "0.550266", "0.5474393", "0.5470123", "0.54...
0.53398323
33
Create an array of the given shape and populate it with random samples from a uniform distribution over [0, 1).
def test_data(): batch_size = 10 input_dim = 28 test_data = np.random.rand(batch_size, input_dim) return test_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_init(self, shape):\n return np.random.randn(shape[0],shape[1])*0.01", "def ndarray(self, shape=(None,), dtype=\"float64\"):\n shape = tuple(i if i is not None else self.int(20) for i in shape)\n return (100 * self.rng.random(numpy.prod(shape))\n - 50).reshape(shape)...
[ "0.7742863", "0.7600855", "0.7438788", "0.73372513", "0.73372513", "0.7225661", "0.70718646", "0.6932274", "0.689363", "0.6843742", "0.68274975", "0.6786792", "0.67669463", "0.6762449", "0.6760896", "0.6744737", "0.6633466", "0.66286033", "0.66112137", "0.6599423", "0.6539307...
0.0
-1
Create a chessboard with of the size passed in. Don't return anything, print the output to stdout
def create_chessboard(size=8): r1 = (WHITE + BLACK) * int((size / 2)) + "\n" r2 = (BLACK + WHITE) * int((size / 2)) + "\n" print((r1 + r2) * int((size / 2)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_chessboard(size=8):\r\n\r\n def _create_even_line(size):\r\n return ''.join([WHITE if i % 2 else BLACK for i in range(size)])\r\n \r\n even_line = _create_even_line(size)\r\n odd_line = even_line[::-1]\r\n \r\n print('\\n'.join(even_line if line % 2 else odd_line for line in range(size)...
[ "0.79357535", "0.6987011", "0.68661624", "0.68543833", "0.68187064", "0.68181366", "0.6788091", "0.6741951", "0.6613889", "0.6524536", "0.6518203", "0.64458066", "0.63901216", "0.63888204", "0.63836443", "0.6348464", "0.6335169", "0.630147", "0.62831014", "0.62610894", "0.625...
0.8453823
0
Evaluation without the densecrf with the dice coefficient
def eval_net(net, loader, device, loss_criterion, writer, global_step, iou_absent=1.0, img_type=torch.float32, mask_type=torch.float32 ): net.eval() n_val = len(loader) # the number of batch ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dice_coeff(self):\n a, c, _, b = self.to_ccw()\n return _div(2 * a, 2 * a + b + c)", "def soft_dice(y_true, y_pred):\r\n smooth = 1\r\n intersection = K.sum((y_true * y_pred)[:,1:,:,:,:])\r\n coeff = (2. * intersection + smooth) / (K.sum(y_true[:,1:,:,:,:]) + K.sum(y_pred[:,1:,:,:,:])...
[ "0.6412998", "0.6389011", "0.6355393", "0.62975246", "0.624973", "0.6172522", "0.6172522", "0.60769427", "0.607475", "0.6066489", "0.6044514", "0.6011115", "0.59932584", "0.5967287", "0.59622765", "0.5859621", "0.585533", "0.5823352", "0.5822936", "0.5818695", "0.5811715", ...
0.0
-1
Prints profile parameters from credentials file (~/.aws/credentials) as evalable environment variables
def profile_to_env(): parser = argparse.ArgumentParser(description=profile_to_env.__doc__) parser.add_argument("-t", "--target-role", action="store_true", help="Output also azure_default_role_arn") parser.add_argument("-r", "--role-arn", help="Output also the role given here as the target role for the profi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aws_credentials():\n os.environ['AWS_ACCESS_KEY_ID'] = 'testing'\n os.environ['AWS_SECRET_ACCESS_KEY'] = 'testing'\n os.environ['AWS_SECURITY_TOKEN'] = 'testing'\n os.environ['REGION'] = 'region'", "def aws_credentials():\n os.environ['AWS_ACCESS_KEY_ID'] = 'testing'\n os.environ['AWS_SECRET_AC...
[ "0.63308054", "0.6250225", "0.62485486", "0.6236004", "0.62349755", "0.6216572", "0.6216572", "0.6216572", "0.61766446", "0.61766446", "0.6161644", "0.6127176", "0.61246246", "0.58668566", "0.5831417", "0.5773495", "0.5698812", "0.5667367", "0.5665289", "0.5597459", "0.553797...
0.6741683
0
Prints profile expiry from credentials file (~/.aws/credentials) as evalable environment variables
def profile_expiry_to_env(): parser = argparse.ArgumentParser(description=profile_expiry_to_env.__doc__) if "_ARGCOMPLETE" in os.environ: parser.add_argument("profile", help="The profile to read expiry info from").completer = \ ChoicesCompleter(read_expiring_profiles()) argcomplete.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli_read_profile_expiry():\n parser = argparse.ArgumentParser(description=cli_read_profile_expiry.__doc__)\n parser.add_argument(\"profile\", help=\"The profile to read expiry info from\").completer = \\\n ChoicesCompleter(read_expiring_profiles())\n argcomplete.autocomplete(parser)\n args =...
[ "0.6548482", "0.5855601", "0.58411586", "0.5837414", "0.5820175", "0.5790486", "0.5790486", "0.5790486", "0.5755642", "0.5755642", "0.5731502", "0.5716918", "0.57167935", "0.5633017", "0.5630155", "0.5487631", "0.5353106", "0.52786773", "0.5207291", "0.5152932", "0.5141173", ...
0.6968569
0
Read expiry field from credentials file, which is there if the login happened with awsazurelogin or another tool that implements the same logic (none currently known).
def cli_read_profile_expiry(): parser = argparse.ArgumentParser(description=cli_read_profile_expiry.__doc__) parser.add_argument("profile", help="The profile to read expiry info from").completer = \ ChoicesCompleter(read_expiring_profiles()) argcomplete.autocomplete(parser) args = parser.parse_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __current_authentication_token(self):\n if os.path.isfile(self.token_filename):\n with open(self.token_filename, 'r') as f:\n (stored_token, expires) = f.read().split(' ')\n t = time.time()\n if int(expires) > t:\n return stored_token\n ...
[ "0.6109317", "0.6085308", "0.567565", "0.5628693", "0.56222045", "0.5604095", "0.5502567", "0.5475754", "0.5461474", "0.5450802", "0.5450802", "0.54422814", "0.5395103", "0.5377671", "0.5337329", "0.53343487", "0.53001094", "0.52941716", "0.52911586", "0.5280445", "0.5258242"...
0.5775382
2
Enable a configured profile. Simple IAM user, AzureAD and ndt assumerole profiles are supported
def cli_enable_profile(): parser = argparse.ArgumentParser(description=cli_enable_profile.__doc__) type_select = parser.add_mutually_exclusive_group(required=False) type_select.add_argument("-i", "--iam", action="store_true", help="IAM user type profile") type_select.add_argument("-a", "--azure", action...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable(self,\n profile_id=None):\n if profile_id is None:\n self._enabled = True\n else:\n self._profiles[profile_id] = True", "def set_authentication_profile(profile=None, deploy=False):\n\n if not profile:\n raise CommandExecutionError(\"Profile n...
[ "0.71673536", "0.64258325", "0.63383347", "0.60237646", "0.5901494", "0.5857726", "0.579151", "0.57829446", "0.5696671", "0.56693006", "0.56515276", "0.55771184", "0.55110115", "0.5508152", "0.5491759", "0.54747105", "0.5444639", "0.5444156", "0.5412009", "0.54075176", "0.540...
0.79776365
0
Returns bath correlation function corresponding to sites n and m
def get_coft(self,n,m): if self.aggregate is None: return self.CC.get_coft(n,m) else: bn = self.aggregate.which_band[n] bm = self.aggregate.which_band[m] if ((bn == 0) and (bm == 0)): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correlation(self,M,operator,site_i,site_j):\n minsite = min(site_i,site_j)\n maxsite = max(site_i,site_j)\n u = np.array([[1]])\n for i in range(0,minsite):\n M[i] = np.tensordot(u, M[i],axes=(-1,1)).transpose(1,0,2)\n l,u = self.left_cannonical(M[i])\n ...
[ "0.6553331", "0.6165291", "0.58071154", "0.580665", "0.5793636", "0.5748681", "0.5747484", "0.5693638", "0.56576204", "0.56557727", "0.56543887", "0.5653871", "0.56365675", "0.563383", "0.56281304", "0.56240153", "0.5588957", "0.55614537", "0.5528162", "0.5519735", "0.5518904...
0.55334294
18
Returns bath correlation based on electronic signatures
def get_coft_elsig(self,n_sig,m_sig): nb = numpy.sum(n_sig) mb = numpy.sum(m_sig) indices = [] if mb == nb: ni = 0 for na in n_sig: mi = 0 for ma in m_sig: if ((na == 1) and (ma == 1))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correlation(quantum_dict,amber_dict):\n quantum = []\n amber = []\n for key in quantum_dict:\n quantum.append(float(quantum_dict[key]))\n amber.append(float(amber_dict[key]))\n #calculation of Pearson r\n r2 = (stats.pearsonr(quantum,amber)[0])**2\n #save on a file and print it ...
[ "0.63488114", "0.62848485", "0.6047995", "0.6018281", "0.58385664", "0.5588309", "0.5588078", "0.55334115", "0.55104893", "0.54719424", "0.54552907", "0.5405545", "0.5357435", "0.5356881", "0.5356063", "0.5345035", "0.53445596", "0.53443223", "0.53265566", "0.53036493", "0.52...
0.0
-1
Return the csv file as a string, downloading it if needed.
def _csv_get(page): cache_key = reverse('timetable.views.display') ret = cache.get(cache_key) if ret is not None: print 'hola' return ret else: print 'ciao' ret = _csv_download(page) cache.set(cache_key, ret, timeout=15) # cache lasts 15 seconds return r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_csv(review_channel):\n with open (review_channel.file_name) as file:\n return file.read()\n return \"\"", "def filedownload(df):\r\n csv = df.to_csv(index=False)\r\n b64 = base64.b64encode(csv.encode()).decode() # some strings <-> bytes conversions necessary here\r\n href = f'<a ...
[ "0.6842649", "0.65962785", "0.6524794", "0.64998114", "0.6483942", "0.6482614", "0.6441559", "0.6441559", "0.6399803", "0.63203645", "0.6185887", "0.6182948", "0.6153171", "0.61451536", "0.6101371", "0.6064251", "0.60365987", "0.6020367", "0.60178626", "0.6007211", "0.5987546...
0.5425745
72
Return the downloaded csv as a string.
def _csv_download(page): # gc = gspread.login(page.timetable.google_user, page.timetable.google_passwd) gc = googleoauth.authenticate_google_docs() csv_file = gc.open('WebValley2019') # gsession = gss.Client(page.timetable.google_user, page.timetable.google_passwd) # ss = gss.Spreadsheet(page.timet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_csv_string(self, **kwargs):\n ...", "def fetch_csv(review_channel):\n with open (review_channel.file_name) as file:\n return file.read()\n return \"\"", "def get_csv(self, url='https://www.iana.org/assignments/tls-parameters/tls-parameters-4.csv'):\n\n response = get(url)\n ...
[ "0.70107824", "0.6992931", "0.67082936", "0.6705797", "0.6666311", "0.64880955", "0.64880955", "0.63866955", "0.63839954", "0.6300836", "0.62980056", "0.62911814", "0.62879175", "0.6278986", "0.62764406", "0.6265928", "0.6248372", "0.624086", "0.62308633", "0.6174883", "0.616...
0.64542496
7
Print text as a fancy header
def h1(text): print(Fore.GREEN + '\n%s'%text) line = "" for ii in range(len(text)): line += "-" print(Fore.GREEN + line) print(Fore.WHITE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def section_header(text):\n\n print \"---- %s ----\" % text", "def print_header():\n print(\"STEM Center Temperature Project\")\n print(\"Shaotong Wen\")", "def print_header(name, texfile):\n texfile.write('\\n')\n texfile.write('%--------------------\\n')\n texfile.write('%---' + name.upper(...
[ "0.82920736", "0.7862711", "0.7833466", "0.76119107", "0.757169", "0.7568934", "0.75400376", "0.753188", "0.75272566", "0.7466177", "0.74052215", "0.74035394", "0.73589253", "0.7324786", "0.72954893", "0.7273341", "0.7255003", "0.719552", "0.71698904", "0.71689737", "0.715923...
0.7154892
21
Print something in red
def printRed(text): print(Fore.RED + text + Fore.WHITE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_red(msg: str = None) -> None:\n if msg is None:\n raise Exception(\"msg was not defined\")\n\n print(Fore.RED + msg)\n print(Style.RESET_ALL + \"\", end=\"\")", "def print_green(msg: str = None) -> None:\n if msg is None:\n raise Exception(\"msg was not defined\")\n\n print...
[ "0.7844057", "0.76571864", "0.72239184", "0.7149927", "0.70288014", "0.70163584", "0.69991595", "0.6988605", "0.6988605", "0.6988605", "0.6988605", "0.698294", "0.6976125", "0.69745344", "0.6963944", "0.6963944", "0.6963944", "0.6963944", "0.69105566", "0.6903078", "0.6901880...
0.80345446
0
Run a subprocess call with some printing and stuff
def callSubprocess(args, test=False): print(Fore.MAGENTA), for arg in args: print arg, print(Fore.WHITE) if not test: subprocess.call(args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def system_call(command):\n print(\"\\n### {}\".format(command))\n stderr = subprocess.STDOUT\n pipe = subprocess.Popen(\n command,\n stdout=subprocess.PIPE,\n stderr=subprocess.STDOUT,\n shell=True,\n )\n stdout, stderr = pipe.communicate()\n print(stdout)", "def ru...
[ "0.74172086", "0.72924894", "0.70098263", "0.6968202", "0.68901086", "0.68606615", "0.6839701", "0.6801746", "0.67945224", "0.676581", "0.6753861", "0.6706629", "0.67058957", "0.66742986", "0.66731685", "0.6653105", "0.6648998", "0.6636191", "0.662624", "0.6626091", "0.662071...
0.73385876
1
Print the sidereal times of a dada file. Now reads DADA header
def computeLstFromDada(filename): d = dada.DadaReader(filename, n_int=0) telescope = d.header["TELESCOPE"] if telescope in ('LEDA', 'LWAOVRO', 'LWA-OVRO', 'LEDAOVRO', 'LEDA512', 'LEDA-OVRO'): h3("Data appears to be from LWAOVRO") site = ledafits_config.ovro elif tele...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_snc(snc_file):\r\n with open(snc_file, 'rb') as f:\r\n filebytes = f.read()\r\n i = 352 # end of header\r\n\r\n sampleStamp = []\r\n sampleTime = []\r\n while i < len(filebytes):\r\n sampleStamp.append(unpack('<i', filebytes[i:(i + 4)])[0])\r\n i += 4\r\n sampl...
[ "0.5786813", "0.5596807", "0.55537003", "0.5467872", "0.5450625", "0.54284793", "0.5415443", "0.53824365", "0.53529125", "0.53363365", "0.5327654", "0.529744", "0.52864784", "0.52804893", "0.524197", "0.5240428", "0.52306235", "0.51868236", "0.51856166", "0.5177022", "0.51532...
0.5660324
1
Open a file, search for substitutions, output to a new file
def findAndReplace(replace_dict, filename_in, filename_out, test_mode=False): f = open(filename_in) lines = f.readlines() f.close() print "Generating %s"%filename_out for i in range(len(lines)): for k in replace_dict.keys(): (lines[i], n_subs) = re.subn("\$"+k+"\$", str(repl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_replace(filename, search, replace):\n with open(filename, 'r') as f:\n filedata = f.read()\n modified_data = re.sub(search, replace, filedata, flags=re.M)\n with open(filename, 'w') as f:\n f.write(modified_data)", "def substitute_string_in_tstest_file(file_name, replacement...
[ "0.6585422", "0.6346805", "0.62100327", "0.6163291", "0.6157919", "0.60739005", "0.6070354", "0.60581696", "0.6037719", "0.6031715", "0.6011967", "0.59645915", "0.5952919", "0.5941673", "0.5922524", "0.59156567", "0.58986694", "0.58595127", "0.5852155", "0.5840234", "0.583505...
0.6218162
2
Generate header for corr2uvfits
def generateHeader(param_dict, filename_out, test_mode=False, template="uvfits_headers/header.tpl"): findAndReplace(param_dict, template,filename_out, test_mode)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_roi_header(**param):\n hdr_list = ['== Integration ROI ==']\n method = [i for i in list(param.keys()) if \"pos\" in i][0].split('_pos')[0]\n hdr_list.append('Integration method: {}'.format(method))\n\n for k, v in list(param.items()):\n hdr_list.append('{}: {}'.format(k, v))\n\n head...
[ "0.706126", "0.6851616", "0.68311733", "0.6776908", "0.6771392", "0.67515165", "0.6741585", "0.6740746", "0.6712894", "0.6668977", "0.66587687", "0.6636849", "0.6636847", "0.65992546", "0.657819", "0.6571183", "0.6547306", "0.65389186", "0.6521988", "0.65072596", "0.65061957"...
0.7028798
1
interactive of ip reverse
def interactive_ip_reverse(): while True: ip=input("Input IP: ").strip() if not re.match(r"^(\d{1,3}\.){3}\d{1,3}$",ip): print("\"%s\" is not a valid IP!"%ip) print("-"*100) continue jobs=[ # gevent.spawn(ip_location, ip), g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_ip(self, domain_or_ip, limit=None):\n params = {}\n if limit:\n params = {'limit':limit}\n if re.search('^(\\d{1,3}\\.){3}(\\d{1,3})$',domain_or_ip):\n uri = '/v1/{}/host-domains/'\n else:\n uri = '/v1/{}/reverse-ip/'\n return self.api...
[ "0.66558707", "0.6445157", "0.6230643", "0.59917784", "0.5846518", "0.58067155", "0.57389295", "0.5678243", "0.56706375", "0.55527616", "0.55294704", "0.54846996", "0.5458878", "0.53976476", "0.53787875", "0.5371206", "0.5370891", "0.5307846", "0.5247299", "0.52192914", "0.51...
0.76797676
0
Initialize an ``Enum`` instance.
def __init__(self, name, value, makehex=False): self.name = name self.value = value self.makehex = makehex # An EnumSet this is a member of self.eset = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, cls):\n super(EnumType, self).__init__()\n self._cls = cls", "def __init__(self, enum_type, *args, **kwargs):\n\n super().__init__(*args, **kwargs)\n self.enum_type = enum_type\n self.__member_type = type(list(self.enum_type)[0].value)", "def __init__ (\n\t...
[ "0.7107288", "0.69833463", "0.69292015", "0.690227", "0.68173903", "0.68103707", "0.665686", "0.66497475", "0.65261114", "0.6376893", "0.6243077", "0.6220041", "0.6094137", "0.60892695", "0.6042967", "0.60352397", "0.6032946", "0.6012411", "0.59891033", "0.5954984", "0.591812...
0.4946952
70
Return a representation of this enumeration value.
def __repr__(self): return (('<%s "%s" (0x%x)>' if self.makehex else '<%s "%s" (%d)>') % (self.__class__.__name__, self.name, self.value))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return str(self.value)", "def __repr__(self):\n return str(self.value)", "def __repr__(self) -> str:\n return self.value", "def __repr__(self):\n return \"{}(value={})\".format(self.__class__.__name__, self.value)", "def __repr__(self):\n return \"{}...
[ "0.7571263", "0.7571263", "0.75241333", "0.7411102", "0.7411102", "0.72029716", "0.71417725", "0.71417725", "0.71417725", "0.71417725", "0.71417725", "0.71417725", "0.7103676", "0.7103676", "0.7054559", "0.7053413", "0.70528144", "0.70528144", "0.70528144", "0.70528144", "0.7...
0.7048697
21
Return the string value of this enumeration value.
def __str__(self): return self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value_str(self):\n return self._to_str(self.value)", "def value(self) -> str:\n return self._value", "def value(self) -> str:\n return self._value", "def value(self) -> str:\n return self._value", "def __str__(self) -> str:\n return self.value", "def __str__(self) -...
[ "0.7601487", "0.7523455", "0.7523455", "0.7523455", "0.7508723", "0.7508723", "0.7508723", "0.7508723", "0.7508723", "0.74946505", "0.73985773", "0.73917675", "0.7370103", "0.7370103", "0.7370103", "0.7370103", "0.7370103", "0.7370103", "0.7312625", "0.7312625", "0.7312625", ...
0.0
-1
Return the integer value of this enumeration value.
def __int__(self): return self.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getInteger(self):\n assert self._is_int is True\n return self._value", "def getIntValue(self):\n return _libsbml.ConversionOption_getIntValue(self)", "def value(self) -> int:\n return self._value", "def as_int(self):\n try:\n value = int(self.value)\n ...
[ "0.8002492", "0.794652", "0.78711575", "0.77714574", "0.7649917", "0.75862646", "0.75367266", "0.74797934", "0.74039876", "0.72981304", "0.72179556", "0.7200783", "0.7188201", "0.71697557", "0.7160898", "0.71501225", "0.7130304", "0.70437694", "0.7033411", "0.69967794", "0.69...
0.73491544
9
Determine if this enumeration value is less than another enumeration value.
def __lt__(self, other): if isinstance(other, Enum): return self.value < other.value elif isinstance(other, six.integer_types): return self.value < other elif isinstance(other, six.string_types): # Try using the EnumSet to map string to value if n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __lt__(self, other):\n return self._value < other.value_in_unit(self.unit)", "def __lt__(self, value):\n self = self.__le__(value)\n return self.__invert__()", "def __lt__(self, other):\n if isinstance(other, float):\n return self.floatvalue < other\n else:\n ...
[ "0.77640927", "0.7508274", "0.7376907", "0.73396534", "0.7323031", "0.7304748", "0.7287356", "0.72632676", "0.72499466", "0.72279114", "0.72279114", "0.72005916", "0.7183365", "0.71374536", "0.71103644", "0.70999706", "0.7098833", "0.70803833", "0.70787066", "0.70640475", "0....
0.71303654
14
Initialize an ``EnumSet`` instance.
def __init__(self, *options): # Initialize the list of options self.opts = options # Build the indexes self.by_name = {} self.by_value = {} for opt in options: self.by_name[opt.name] = opt self.by_value[opt.value] = opt # Tell the en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, eset, invalidator='invalidate'):\n\n # Initialize the superclass\n super(EnumAttr, self).__init__(invalidator)\n\n # Save the EnumSet\n self.eset = eset", "def __init__(self, eset, flags=None):\n\n # Store the EnumSet\n self.eset = eset\n\n # In...
[ "0.70647514", "0.6891172", "0.6552653", "0.5735773", "0.5567346", "0.5457639", "0.54303426", "0.5382551", "0.5382551", "0.538176", "0.5276102", "0.52433836", "0.522152", "0.52100253", "0.52092737", "0.51665574", "0.5113172", "0.50380796", "0.49864528", "0.49567413", "0.493149...
0.556235
5
Determine the number of options contained within the ``EnumSet`` instance.
def __len__(self): return len(self.by_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_of_choices(self) -> int:\n return len(self._choices)", "def choices(self):\n self._choices = self.getChoices()\n return len(self._choices)", "def __len__(self):\n return len(self._enums)", "def __len__(self):\n return len(self._opts) + len(self._groups)", "def...
[ "0.71791655", "0.692308", "0.68106925", "0.6607", "0.65172154", "0.64987546", "0.64216137", "0.63446486", "0.620711", "0.61528575", "0.6135118", "0.60672617", "0.60482633", "0.6048155", "0.60394466", "0.5983859", "0.59663296", "0.59662783", "0.5944988", "0.594224", "0.58795",...
0.56543607
33
Iterate over the options contained within the ``EnumSet`` instance.
def __iter__(self): return iter(self.opts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n\n for opt in self.eset:\n if self.bitflags & int(opt):\n yield opt", "def __iter__(self):\n return iter(self._enums)", "def get_specific_options(cls):\n for option in cls._specific_options.items():\n yield option", "def get_optio...
[ "0.7435088", "0.7206195", "0.69140226", "0.6835153", "0.64133775", "0.6399336", "0.6395826", "0.6387736", "0.6161692", "0.6024614", "0.59485453", "0.58820975", "0.5874532", "0.58559334", "0.58411586", "0.58286965", "0.5800793", "0.5760022", "0.57337606", "0.5728123", "0.56550...
0.6437454
4
Determine if a given value is a valid value according to the ``EnumSet`` instance.
def __contains__(self, value): try: # Just use __getitem__() self[value] except KeyError: return False else: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_value(self, value):\n return value in self.values", "def is_enum_value(enumeration, potential_value):\n try:\n enumeration(potential_value)\n except ValueError:\n return False\n\n return True", "def check_enum(enumerator, value):\n is_valid = False\n for data in...
[ "0.7323835", "0.7305464", "0.6910795", "0.6523067", "0.6516213", "0.6510942", "0.63045233", "0.6255381", "0.62167794", "0.61287653", "0.6104601", "0.60826045", "0.6080636", "0.60782737", "0.6070152", "0.606908", "0.6027388", "0.60220504", "0.59301656", "0.59273416", "0.588327...
0.0
-1
Get the ``Enum`` instance that corresponds to a given value.
def __getitem__(self, value): # Select the correct index if isinstance(value, six.integer_types): idx = self.by_value elif isinstance(value, six.string_types): idx = self.by_name else: raise KeyError(value) # Look up the value in that index ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Enum(enum, value, default=None):\n if value is None:\n return default\n\n for pair in enum:\n if pair.value == value:\n return pair\n\n raise KeyError(\"Value '{}' not contained in enum type\".format(value))", "def from_value(cls, value):\n value = value if value else...
[ "0.73513293", "0.7113392", "0.70431536", "0.6828842", "0.63866574", "0.6363991", "0.6359738", "0.635457", "0.6319415", "0.614704", "0.6078008", "0.59553546", "0.5918053", "0.58428687", "0.58351207", "0.5812783", "0.57587", "0.57513916", "0.57059544", "0.5705742", "0.5684842",...
0.0
-1
Construct a ``FlagSet`` from this ``EnumSet`` instance.
def flagset(self, flags=None): return FlagSet(self, flags)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, eset, flags=None):\n\n # Store the EnumSet\n self.eset = eset\n\n # Initialize the flags\n self.bitflags = 0\n self.flags = set()\n\n # Routine to call if we're modified\n self._notify = None\n\n # Process the flags that were set\n i...
[ "0.684265", "0.6717586", "0.64065474", "0.61438274", "0.60595673", "0.59785277", "0.5597284", "0.52705204", "0.5201559", "0.51301944", "0.50747067", "0.5051974", "0.50294566", "0.49907878", "0.49886325", "0.4908961", "0.48859864", "0.48733738", "0.4863849", "0.4858615", "0.48...
0.6772877
1
Construct an ``EnumAttr`` from this ``EnumSet`` instance.
def attr(self): return EnumAttr(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, eset, invalidator='invalidate'):\n\n # Initialize the superclass\n super(EnumAttr, self).__init__(invalidator)\n\n # Save the EnumSet\n self.eset = eset", "def __init__(self, eset, invalidator='invalidate'):\n\n # Initialize the superclass\n super(Flag...
[ "0.6876052", "0.60064405", "0.5596352", "0.55440545", "0.54308647", "0.5390676", "0.5377266", "0.53603077", "0.5320629", "0.530252", "0.5269718", "0.5245316", "0.5220791", "0.5206996", "0.5182474", "0.51805717", "0.5168795", "0.5149678", "0.5147749", "0.51453966", "0.51028717...
0.7049603
0
Construct a ``FlagSetAttr`` from this ``EnumSet`` instance.
def flags(self): return FlagSetAttr(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, eset, invalidator='invalidate'):\n\n # Initialize the superclass\n super(FlagSetAttr, self).__init__(invalidator)\n\n # Save the EnumSet\n self.eset = eset", "def __init__(self, eset, invalidator='invalidate'):\n\n # Initialize the superclass\n super(E...
[ "0.68628246", "0.64354247", "0.60697484", "0.5878465", "0.58728904", "0.5784921", "0.5717447", "0.5555458", "0.5312354", "0.51613283", "0.50998247", "0.5003668", "0.49232012", "0.48911116", "0.4842956", "0.4807952", "0.48032108", "0.47879228", "0.47613692", "0.47541246", "0.4...
0.66749763
1
Initialize a ``FlagSet`` instance.
def __init__(self, eset, flags=None): # Store the EnumSet self.eset = eset # Initialize the flags self.bitflags = 0 self.flags = set() # Routine to call if we're modified self._notify = None # Process the flags that were set if isinstance(flags...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, eset, invalidator='invalidate'):\n\n # Initialize the superclass\n super(FlagSetAttr, self).__init__(invalidator)\n\n # Save the EnumSet\n self.eset = eset", "def flagset(self, flags=None):\n\n return FlagSet(self, flags)", "def __init__(self, *args):\n ...
[ "0.64819515", "0.63964987", "0.56189543", "0.5566477", "0.5560987", "0.5417575", "0.52496475", "0.5185117", "0.5179554", "0.5157495", "0.5156784", "0.5125656", "0.5108871", "0.5105964", "0.5104121", "0.5084199", "0.50583917", "0.5032526", "0.49541607", "0.49460858", "0.494453...
0.6524963
0
Return a representation of this flag set value.
def __repr__(self): flags = [str(flg) for flg in self.eset if str(flg) in self.flags] return ('<%s [%s] (0x%x)>' % ( self.__class__.__name__, ', '.join(flags), self.bitflags))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value(self):\n return self.flags.value", "def __repr__(self):\n return str(self.value)", "def __repr__(self):\n return str(self.value)", "def __repr__(self) -> str:\n return self.value", "def __repr__(self):\n return \"{}\".format(self.val)", "def __repr__(self):\n ...
[ "0.7542472", "0.7306205", "0.7306205", "0.7257615", "0.7083576", "0.7083576", "0.70539933", "0.70539933", "0.70539933", "0.70224345", "0.70214075", "0.7007531", "0.6999591", "0.69629383", "0.69629383", "0.69612974", "0.6951024", "0.68730843", "0.68730843", "0.68730843", "0.68...
0.6842399
23
Returns the integer value of the ``FlagSet`` instance.
def __int__(self): return self.bitflags
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getIntValue(self):\n return _libsbml.ConversionOption_getIntValue(self)", "def getInteger(self):\n assert self._is_int is True\n return self._value", "def getInteger(self):\n return self.value if self.isInteger() else None", "def value(self):\n return self.flags.value",...
[ "0.6825961", "0.665534", "0.6627674", "0.65717775", "0.6472054", "0.6319629", "0.61889774", "0.6121189", "0.60988444", "0.6097307", "0.60915667", "0.60781896", "0.6070961", "0.583031", "0.583031", "0.57825035", "0.5715237", "0.57027614", "0.56987846", "0.56672263", "0.5628851...
0.6200325
6
Determine if the ``FlagSet`` instance contains the specified flags.
def __contains__(self, flag): if isinstance(flag, six.integer_types): # Pretty easy return (self.bitflags & flag) == flag elif isinstance(flag, six.string_types): # Simple string return flag in self.flags else: try: # M...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flagSet():\r\n for flag in flags:\r\n if flags[flag]:\r\n return True\r\n return False", "def has(self, *options: str) -> bool:\n return bool(self.flags & self.mask(*options))", "def supports_feature(flags: Set[str], feature: str) -> bool:\n\n if not isinstance(feature, st...
[ "0.7395332", "0.70454514", "0.6428682", "0.6359156", "0.63465047", "0.62633365", "0.5987054", "0.5924127", "0.590645", "0.5763223", "0.571385", "0.5619686", "0.54595345", "0.5436726", "0.5432826", "0.54285216", "0.5423442", "0.54006237", "0.53594786", "0.5264322", "0.52434474...
0.7988177
0
Iterate over the flags contained within the ``FlagSet`` instance.
def __iter__(self): for opt in self.eset: if self.bitflags & int(opt): yield opt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_all():\n for i in flags:\n print(i)", "def flagSet():\r\n for flag in flags:\r\n if flags[flag]:\r\n return True\r\n return False", "def flags(self):\n return list(self._flags_generator())", "def flags(self):\n return self.__flag_set", "def process_...
[ "0.6518555", "0.6327646", "0.62502426", "0.61422515", "0.60469395", "0.59845054", "0.5980491", "0.5960565", "0.5954546", "0.58856064", "0.585419", "0.58485126", "0.57815963", "0.57815963", "0.57815963", "0.57815963", "0.57522607", "0.5748207", "0.5748207", "0.5748207", "0.574...
0.718754
0
Determine the number of flags set.
def __len__(self): return len(self.flags)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_flag_count(self):\n done = self.cur.execute(\"SELECT video_ID FROM flags\")\n return done", "def countCmdLineFlags(options, flag):\n counter = 0\n # make sure only flag was supplied\n for key, value in options.__dict__.items():\n if key == flag:\n next\n #...
[ "0.7078012", "0.6832917", "0.66732156", "0.6644083", "0.64806825", "0.6419411", "0.6406578", "0.64009017", "0.6394799", "0.6365754", "0.62850374", "0.6284501", "0.62693596", "0.6268682", "0.6248366", "0.6245902", "0.6245397", "0.6241673", "0.62223226", "0.62160933", "0.621576...
0.723476
0
Set a flag on the ``FlagSet`` instance.
def add(self, flag): try: # Resolve the flag flag = self.eset[flag] except KeyError: raise TypeError('Unknown bit flag %r' % flag) # Save the current bitflags previous = self.bitflags self.bitflags |= int(flag) self.flags.add(str(fla...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setFlag(self, flag, value) -> None:\n ...", "def set_flag(self, set_flag):\n\n self._set_flag = set_flag", "def setflag(self, flag):\n\t\treturn pservlet.pipe_set_flag(self._pipe_desc, flag)", "def set_flag(self, new):\n self.flag = new", "def setFlag(self, whichFlag, whichValue):\...
[ "0.79334056", "0.78819585", "0.6803233", "0.6640877", "0.65292543", "0.6506619", "0.6333389", "0.62331724", "0.6188897", "0.6052757", "0.5954927", "0.59147894", "0.59008735", "0.5793065", "0.5773603", "0.5747209", "0.56538755", "0.5638114", "0.5633914", "0.55112404", "0.55015...
0.5600747
19
Discard a flag on the ``FlagSet`` instance.
def discard(self, flag): try: # Resolve the flag flag = self.eset[flag] except KeyError: return # Save the current bitflags previous = self.bitflags self.bitflags &= ~int(flag) self.flags.discard(str(flag)) # Call the notifi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setDiscardFlag(self, flag, on=True):\r\n if on:\r\n self.__data.discardFlags |= flag\r\n else:\r\n self.__data.discardFlags &= ~flag", "def setDiscardFlags(self, flags):\r\n self.__data.discardFlags = flags", "def discard(self, item):\n try:\n se...
[ "0.7705357", "0.7167262", "0.65679157", "0.61577463", "0.61577463", "0.6107064", "0.6039238", "0.59883547", "0.59009844", "0.5894775", "0.56465137", "0.55505514", "0.54692906", "0.5387131", "0.5349529", "0.53450084", "0.5329477", "0.53255093", "0.5220295", "0.5217501", "0.518...
0.7911526
0
Register a routine to be called if the value of this ``FlagSet`` instance is altered.
def notify(self, notifier): self._notify = notifier
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_mutate_hook(self, hook):\n self._mutate_hooks.add(hook)", "def setFlag(self, flag, value) -> None:\n ...", "def on_set(self, callback):\n self._set_callback = callback if callable(callback) else _void", "def on_set(self, callback):\n self._set_callback = callback if c...
[ "0.64411956", "0.6092635", "0.58898175", "0.58898175", "0.5619722", "0.5608832", "0.5608292", "0.5518308", "0.5451412", "0.5444401", "0.54421264", "0.54293525", "0.54184556", "0.5388592", "0.53881866", "0.5382569", "0.53778046", "0.53555846", "0.53442913", "0.53413755", "0.53...
0.0
-1
Initialize an ``EnumAttr`` instance.
def __init__(self, eset, invalidator='invalidate'): # Initialize the superclass super(EnumAttr, self).__init__(invalidator) # Save the EnumSet self.eset = eset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr(self):\n\n return EnumAttr(self)", "def __init__(self, node, declare):\n symbol.__init__(self, node, declare, \"enum\", \"Enumeration\")\n # check if values are required, must be true or false\n val_req = getOptionalTag(node, \"valuesRequired\", \"false\")\n if val_req...
[ "0.6581085", "0.63450205", "0.6230454", "0.60921705", "0.59040815", "0.5869061", "0.5846382", "0.5828544", "0.580048", "0.57501423", "0.5714125", "0.5693442", "0.5684198", "0.5657441", "0.5615489", "0.5602678", "0.55878705", "0.55800617", "0.5535318", "0.544706", "0.5345185",...
0.6413726
1
Canonicalize a value. This implementation returns the corresponding ``Enum`` value from the ``EnumSet`` specified at initialization.
def prepare(self, instance, value): try: return self.eset[value] except KeyError: raise AttributeError( 'Invalid value for attribute %s: %r' % (self.attr_name, value) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_python(self, value):\n if isinstance(value, self.enum_class):\n return value\n value = super(self.__class__, self).to_python(value)\n if isinstance(value, int):\n return self.enum_class(value)\n assert value is None\n return None", "def get_prep_val...
[ "0.57567173", "0.5645661", "0.54367954", "0.53182817", "0.5155281", "0.5131945", "0.50391257", "0.4990143", "0.494559", "0.49313572", "0.4926061", "0.49163398", "0.48853543", "0.4877798", "0.48573652", "0.4844941", "0.47871658", "0.4778595", "0.47566354", "0.47526324", "0.472...
0.0
-1
Initialize a ``FlagSetAttr`` instance.
def __init__(self, eset, invalidator='invalidate'): # Initialize the superclass super(FlagSetAttr, self).__init__(invalidator) # Save the EnumSet self.eset = eset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, eset, flags=None):\n\n # Store the EnumSet\n self.eset = eset\n\n # Initialize the flags\n self.bitflags = 0\n self.flags = set()\n\n # Routine to call if we're modified\n self._notify = None\n\n # Process the flags that were set\n i...
[ "0.6014541", "0.5964356", "0.5957173", "0.5914509", "0.58628297", "0.58485585", "0.5797345", "0.5684662", "0.5607551", "0.55607164", "0.5557966", "0.53762037", "0.53533566", "0.5348422", "0.5291797", "0.52211326", "0.52210116", "0.52180463", "0.5195433", "0.5183904", "0.51824...
0.6945288
0
Canonicalize a value. This implementation returns a properly initialized ``FlagSet`` instance representing the flags present in the value.
def prepare(self, instance, value): if value is None: value = self.eset.flagset() elif not isinstance(value, FlagSet): try: value = self.eset.flagset(value) except TypeError as err: raise AttributeError( 'Invalid va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_frozen_set( val ):\n if isinstance(val, str):\n return frozenset([ val ])\n else:\n return frozenset(val)", "def to_python(self, value):\n if value is None:\n return value\n value = super(BitOptionsField, self).to_python(value)\n return BitOptions(self.o...
[ "0.5340108", "0.51910216", "0.51479906", "0.49118093", "0.4807485", "0.47855693", "0.47730023", "0.47664246", "0.47013116", "0.46304798", "0.45760348", "0.45731136", "0.45589054", "0.45469943", "0.45257044", "0.45244804", "0.44937068", "0.44820303", "0.44639876", "0.44278997", ...
0.47375327
8
Ensures consensus between label sources and produces new array of labels
def get_consensus(current_labels, *label_deltas): if len(label_deltas) < 1: raise AttributeError('No labels provided to get consensus.') elif len(label_deltas) < 2: ResourceWarning('Only provided a single list of labels, so consensus has no function.') return label_deltas[0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract_labels(srcs):\n # Tuples are already labels.\n if type(srcs) == type(()):\n return list(srcs)\n return []", "def propagate_labels_simple(regions,labels):\n rlabels,_ = label(regions)\n cors = correspondences(rlabels,labels,False)\n outputs = zeros(amax(rlabels)+1,'i')\n for o,i in ...
[ "0.6356899", "0.6301545", "0.62637705", "0.62113", "0.61413956", "0.60253775", "0.60156864", "0.60105354", "0.59959155", "0.5992031", "0.59661824", "0.58954823", "0.5860893", "0.58519316", "0.5841007", "0.5832715", "0.580656", "0.5794653", "0.5782863", "0.57728225", "0.576205...
0.5490632
55
return the value of the leaf.
def get_value(self): return self.has_element
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value(self):\n return self.node_value", "def value(self):\n return self.get_attribute(\"value\", str(self.children))", "def root_value(self):\n return self.__root.get_value()", "def getValue(self):\n return self.left.getValue() * self.right.getValue()", "def getValue(self):\...
[ "0.7584183", "0.74287105", "0.72799546", "0.71956635", "0.7195397", "0.7125679", "0.70963955", "0.70634305", "0.7052746", "0.70278317", "0.6973677", "0.6958364", "0.6943193", "0.6938028", "0.6904835", "0.6868729", "0.6849748", "0.68365365", "0.68341076", "0.6829099", "0.68290...
0.0
-1
Return a list of points dicretize to insert in the Bloom filter.
def set_value(self, has_element_new): self.has_element = has_element_new
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_points(self):\n if not '_list_of_points' in self.__dict__.keys():\n self._list_of_points = [] \n for point in self['point'].items():\n self._list_of_points.append(point[1])", "def GetPointsInBucket(self, , p_int=..., p_int=..., p_int=...):\n ...", "def ...
[ "0.6165554", "0.60585093", "0.59465003", "0.5888925", "0.5823174", "0.58029276", "0.5771406", "0.5735438", "0.5707122", "0.5699866", "0.5691705", "0.56813824", "0.5674069", "0.56730986", "0.5671026", "0.5665035", "0.564061", "0.56264085", "0.56229264", "0.5597572", "0.5580116...
0.0
-1
Change the value of a leaf.
def change_leaf_value(self, place, has_element_new): self.has_element = has_element_new
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_leaf_value(self, general_node, hasElement):\n raise NotImplementedError", "def set_leaf_node(self, leaf_value):\n\n if not self.empty:\n try:\n node_key = self.node_key\n except AttributeError:\n node_key = '_'\n raise ValueError(\n 'Cannot...
[ "0.7373481", "0.7356872", "0.7241843", "0.7241843", "0.7241843", "0.7160703", "0.70186853", "0.69240654", "0.6714368", "0.66426975", "0.66408634", "0.651929", "0.6513814", "0.65103656", "0.64918673", "0.64739937", "0.64487374", "0.64138734", "0.64097065", "0.63773704", "0.636...
0.71334285
6
Change the value of a leaf.
def print_data(self): print("LEAF With value : " + str(self.has_element))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_leaf_value(self, general_node, hasElement):\n raise NotImplementedError", "def set_leaf_node(self, leaf_value):\n\n if not self.empty:\n try:\n node_key = self.node_key\n except AttributeError:\n node_key = '_'\n raise ValueError(\n 'Cannot...
[ "0.7373481", "0.7356872", "0.7241843", "0.7241843", "0.7241843", "0.7160703", "0.71334285", "0.70186853", "0.69240654", "0.6714368", "0.66426975", "0.66408634", "0.651929", "0.6513814", "0.65103656", "0.64918673", "0.64739937", "0.64487374", "0.64138734", "0.64097065", "0.637...
0.0
-1
set the dimension of the widget
def updateScrollArea(self): iconx = [] icony = [] if len(self.icons) > 0: for item in self.icons: iconx.append(item.x()) icony.append(item.y()) self.setMinimumWidth(max(iconx)+75) self.setMinimumHeight(max(icony)+75)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_size(self):\n if self.width_key is not None:\n width = config.get(self.width_key)\n height = config.get(self.height_key)\n self.window.resize(width, height)", "def set_widget_size(self, widget_size):\n v = self.viewport\n v.projection.widget_rect = R...
[ "0.75665665", "0.75065076", "0.7234669", "0.7200692", "0.71382374", "0.7049707", "0.7049707", "0.70164937", "0.70091134", "0.69761163", "0.6898656", "0.6858285", "0.6847134", "0.6843323", "0.68431526", "0.6813155", "0.6813155", "0.6813155", "0.6813155", "0.6813155", "0.681315...
0.0
-1
Generates an array of graph edges (distances between cities) provided by the user; initializes the problem.
def process_file(): global distances_between_cities global number_of_cities global unvisited_cities text_file = open(sys.argv[1].strip('\r')) distances_between_cities = [[int(i) for i in line.strip("\r\n").split()[1:]] for line in text_file.readlines()[1:]] number_of_cities = len(distances_betw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_graph(number_of_nodes):\n cities = []\n size = int(math.sqrt(number_of_nodes))\n if size*size != number_of_nodes:\n raise ArgumentError(\"At the moment generate_graph() only takes perfect squares (3, 16, 25 etc.). Feel free to improve it.\")\n test = 0\n for position in range(0, ...
[ "0.6672344", "0.6151244", "0.6140065", "0.5968648", "0.59297085", "0.5890891", "0.58750945", "0.58508825", "0.5695845", "0.56620294", "0.5625347", "0.56179255", "0.5592077", "0.5575446", "0.5540775", "0.5526343", "0.55093086", "0.5470963", "0.542336", "0.5420447", "0.53853434...
0.4974963
85
Moves a city from the list of unvisited cities to the list of visited ones.
def visit_city(city): visited_cities.append(city) unvisited_cities.remove(city)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def travel_next(city, city_list, tour, all_tours):\n city.traversed = 1\n tour.append(city)\n is_end = True\n \n for next_city in city_list:\n if(next_city.traversed is not 1):\n travel_next(next_city, city_list, tour, all_tours)\n next_city.traversed = 0\n is...
[ "0.65666753", "0.6503452", "0.6051666", "0.59114844", "0.5849416", "0.58344364", "0.5657373", "0.5644101", "0.56237173", "0.5520811", "0.5504626", "0.54924834", "0.5433857", "0.541804", "0.53408176", "0.5340503", "0.5338157", "0.53203654", "0.5307929", "0.5307929", "0.5307929...
0.78725225
0
Prints total distance and path, according to the requested format.
def show_results(): print 'Distancia total: ', total_distance print 'Ruta: ', visited_cities
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_solution(data, manager, routing, assignment):\r\n total_distance = 0\r\n total_load = 0\r\n for vehicle_id in range(data['num_vehicles']):\r\n index = routing.Start(vehicle_id)\r\n plan_output = 'Route for vehicle {}:\\n'.format(vehicle_id+1)\r\n route_distance = 0\r\n ...
[ "0.65207016", "0.6443496", "0.64101577", "0.63230896", "0.63190776", "0.61177903", "0.61135155", "0.60745275", "0.6043531", "0.5941169", "0.5770125", "0.57318", "0.5708874", "0.56846815", "0.56756645", "0.5674721", "0.5668784", "0.565484", "0.5652177", "0.56067735", "0.558495...
0.589219
10
We convert Data from the format PosScfBC.schema.json to Scf_Pos_ZScr_vals
def PosScfBCDataToZScrPointsForValues(PosScfBC_fp, op_fp, analysis_type): with open(PosScfBC_fp, "r") as f: PosScfBC_d = json.loads(f.read()) if analysis_type == "0": Scf_Pos_ZScr_vals = GetZScrInfoForAllScaffolds(PosScfBC_d) elif analysis_type == "1": Scf_Pos_ZScr_vals = GetZScr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetZScrInfoForAllScaffolds(PosScfBC_d):\n total_pos_and_nIns_l = []\n\n # We initially run through the scaffolds to get SD, mean\n for scf in PosScfBC_d[\"scaffolds\"].keys():\n scf_info = PosScfBC_d[\"scaffolds\"][scf]\n pos_and_nIns_l = [[int(x), scf_info[\"positions\"][x][\"nIns\"]] f...
[ "0.56657326", "0.5521152", "0.53005815", "0.5252095", "0.50889254", "0.5049737", "0.50323945", "0.49730736", "0.49445271", "0.49313352", "0.491731", "0.49049857", "0.488291", "0.4882402", "0.48749822", "0.4852411", "0.4832353", "0.48288804", "0.4810229", "0.4808238", "0.47967...
0.65343136
0
We calculate the ZScr over the individual scaffolds in the genome Input is the same as to the function PosScfBCDataToZScrPointsForValues above.
def GetZScrInfoForIndividualScaffolds(PosScfBC_d): Scf_Pos_ZScr_vals = {"scaffolds": {}} for scf_name in PosScfBC_d["scaffolds"].keys(): scf_info = PosScfBC_d["scaffolds"][scf_name] pos_and_nIns_l = [[int(x), scf_info["positions"][x]["nIns"]] for x in \ scf_info["positions"].ke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetZScrInfoForAllScaffolds(PosScfBC_d):\n total_pos_and_nIns_l = []\n\n # We initially run through the scaffolds to get SD, mean\n for scf in PosScfBC_d[\"scaffolds\"].keys():\n scf_info = PosScfBC_d[\"scaffolds\"][scf]\n pos_and_nIns_l = [[int(x), scf_info[\"positions\"][x][\"nIns\"]] f...
[ "0.7223206", "0.6110108", "0.57937723", "0.56277347", "0.55523914", "0.541697", "0.5352479", "0.5330102", "0.5263481", "0.51990825", "0.51827395", "0.5105967", "0.50682276", "0.5040792", "0.50048345", "0.4997109", "0.4978912", "0.4974794", "0.49712288", "0.4946973", "0.494254...
0.6503895
1
We calculate the ZScr over all the insertions for the genome Instead of calculating SD and mean for each scaffold, we calculate these stats over the entire genome. We return information without the values with Standard Deviations below 0 to minimize size of JSON file. Input is the same as to the function PosScfBCDataTo...
def GetZScrInfoForAllScaffolds(PosScfBC_d): total_pos_and_nIns_l = [] # We initially run through the scaffolds to get SD, mean for scf in PosScfBC_d["scaffolds"].keys(): scf_info = PosScfBC_d["scaffolds"][scf] pos_and_nIns_l = [[int(x), scf_info["positions"][x]["nIns"]] for x in \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetZScrInfoForIndividualScaffolds(PosScfBC_d):\n Scf_Pos_ZScr_vals = {\"scaffolds\": {}}\n\n for scf_name in PosScfBC_d[\"scaffolds\"].keys():\n scf_info = PosScfBC_d[\"scaffolds\"][scf_name]\n\n pos_and_nIns_l = [[int(x), scf_info[\"positions\"][x][\"nIns\"]] for x in \\\n s...
[ "0.7047891", "0.6128534", "0.56608206", "0.5634555", "0.5603958", "0.5495317", "0.5444786", "0.5407131", "0.53483766", "0.5233515", "0.5173635", "0.51629716", "0.51305306", "0.51079404", "0.5100728", "0.5080563", "0.5062883", "0.50543565", "0.50170743", "0.5014622", "0.500641...
0.8187482
0
We take position and num insertion values and get ZScrs for each
def GetSdPointsForValues(pos_and_nIns_l): just_insertions_l = [x[1] for x in pos_and_nIns_l] mean = float(sum(just_insertions_l))/float(len(just_insertions_l)) SD = GetStandardDeviation(just_insertions_l, mean) max_z, pos_to_Zscr_l = GetZScrValuesForPoints(pos_and_nIns_l, mean, SD) return mean, S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetZScrInfoForAllScaffolds(PosScfBC_d):\n total_pos_and_nIns_l = []\n\n # We initially run through the scaffolds to get SD, mean\n for scf in PosScfBC_d[\"scaffolds\"].keys():\n scf_info = PosScfBC_d[\"scaffolds\"][scf]\n pos_and_nIns_l = [[int(x), scf_info[\"positions\"][x][\"nIns\"]] f...
[ "0.64052576", "0.60223925", "0.60028183", "0.58648205", "0.58425575", "0.5630345", "0.5581364", "0.5539338", "0.55384266", "0.5521107", "0.54145986", "0.53885657", "0.53803265", "0.5365115", "0.53607315", "0.53453445", "0.53404", "0.5330038", "0.5320947", "0.5316835", "0.5301...
0.54702485
10
We take position and num insertion values and get ZScrs for each
def GetZScrValuesForPoints(pos_and_nIns_l, mean, SD): if SD == 0.0: return [0,[]] pos_to_ZScrs_list = [] max_z_scr = 0 for tup in pos_and_nIns_l: Zscr = float(tup[1] - mean)/float(SD) pos_to_ZScrs_list.append([tup[0], Zscr]) if Zscr > max_z_scr: max_z_scr ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetZScrInfoForAllScaffolds(PosScfBC_d):\n total_pos_and_nIns_l = []\n\n # We initially run through the scaffolds to get SD, mean\n for scf in PosScfBC_d[\"scaffolds\"].keys():\n scf_info = PosScfBC_d[\"scaffolds\"][scf]\n pos_and_nIns_l = [[int(x), scf_info[\"positions\"][x][\"nIns\"]] f...
[ "0.64086527", "0.6003098", "0.5867654", "0.58437455", "0.5629926", "0.5586101", "0.5543061", "0.55379725", "0.5523238", "0.54702884", "0.54187083", "0.5392553", "0.53826857", "0.53677815", "0.5359348", "0.53465724", "0.5340052", "0.53313917", "0.53248686", "0.53190124", "0.53...
0.6023835
1
We get the Standard Deviation from a list of values
def GetStandardDeviation(vals_l, mean): sum_deviations_squared = 0 for x in vals_l: sum_deviations_squared += (x - mean)**2 return math.sqrt(float(sum_deviations_squared)/float(len(vals_l)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def standard_deviation(xs: List[float]) -> float:\n return math.sqrt(variance(xs))", "def standard_deviation(xs: List[float]) -> float:\n return math.sqrt(variance(xs))", "def standard_deviation(list):\n num_items = len(list)\n mean = sum(list) / num_items\n differences = [x - mean for x in list...
[ "0.8306644", "0.8306644", "0.8242509", "0.81545484", "0.8140727", "0.8098427", "0.80929816", "0.7941785", "0.78990495", "0.7796602", "0.776382", "0.7724832", "0.77089417", "0.77046096", "0.7700815", "0.76083463", "0.75963557", "0.7581973", "0.7578446", "0.7535481", "0.7466478...
0.78543085
9
create group with self.group_name
def handle(self, *args, **options): new_group, created = Group.objects.get_or_create(name=options.get('group_name')) self.stdout.write(f"Group {options.get('group_name')} created")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __create_new_group(self, group_name) -> None:\n group = Group(name=group_name)\n group.save()\n\n self.__add_permission_to_group(group)", "def createGroup(self, name):\n new_group = ET.SubElement(self._root,'group')\n group_name = ET.SubElement(new_group, 'name')\n group_name.te...
[ "0.793713", "0.7912866", "0.7871815", "0.7871815", "0.77479357", "0.76928174", "0.7688527", "0.7647989", "0.76178503", "0.76024514", "0.7601728", "0.75940365", "0.7494128", "0.7493788", "0.74841785", "0.74725604", "0.7445585", "0.74118996", "0.7402275", "0.7391942", "0.729491...
0.74172026
17
read image array from path
def read_image(path, file_format='nii.gz'): path = path + '.' + file_format if file_format == 'npy': image = np.load(path) elif file_format == 'npz': image = np.load(path)['arr_0'] elif file_format in ('png', 'jpg'): image = np.array(imageio.imread(path)) elif file_format == ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_img(img_path): \n return sitk.GetArrayFromImage(sitk.ReadImage(img_path))", "def read_img(img_path):\n return sitk.GetArrayFromImage(sitk.ReadImage(img_path))", "def read(path: Union[Path, str]) -> np.ndarray:\n return _reader.imread(str(path))", "def read_img(path):\n img = Image...
[ "0.82496095", "0.81218743", "0.7793593", "0.7757927", "0.7590854", "0.75600046", "0.7487416", "0.74257445", "0.73979604", "0.73953956", "0.7373224", "0.7345489", "0.7255888", "0.72278416", "0.71967065", "0.7193456", "0.7182356", "0.71809053", "0.71283764", "0.70733464", "0.70...
0.6331901
94
Combine Labeller classes dynamically. The Labeller class aims to split plot labeling in ArviZ into atomic tasks to maximize extensibility, and the few classes provided are designed with small deviations from the base class, in many cases only one method is modified by the child class. It is to be expected then to want ...
def mix_labellers(labellers, class_name="MixtureLabeller"): return type(class_name, labellers, {})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_labels(self):\n raise NotImplementedError()", "def get_labels(self):\n raise NotImplementedError()", "def get_labels(self):\n raise NotImplementedError()", "def get_labels(self):\r\n raise NotImplementedError()", "def getLabel2(*args):", "def getLabel2(*args):", "def __init__(self, ...
[ "0.56585646", "0.56585646", "0.56585646", "0.5630137", "0.56291884", "0.56291884", "0.55772626", "0.5538508", "0.5498137", "0.54862446", "0.5434813", "0.54181445", "0.5408373", "0.5408373", "0.5408373", "0.5404845", "0.5381343", "0.5381343", "0.5381343", "0.5381343", "0.53813...
0.6857345
0
generates the python script that will daemonize the call to run script
def generateDaemonizer(working_dir="."): py_template = """#!/usr/bin/python import daemon import subprocess with daemon.DaemonContext(working_directory="."): proc = subprocess.Popen(["nohup", "bash", "run.sh"]) """ py_sh = open(os.path.join(working_dir, "daemonize.py"), "w") py_sh.write(py_template) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def script_generator(self):\n analyze_tool = \"/home/haihuam/Projects/RepPoints/mmdetection/tools/analyze_logs.py\"\n ex_options = self.global_setting.get('analyze_options', str())\n py = self.global_setting.get('python', sys.executable)\n if os.access(py, os.X_OK):\n content...
[ "0.66752326", "0.645501", "0.6352275", "0.6271266", "0.62107617", "0.6055067", "0.60431343", "0.6040542", "0.597326", "0.5939872", "0.5934565", "0.585356", "0.58412933", "0.58219093", "0.5772267", "0.57570595", "0.5752123", "0.5752123", "0.5752123", "0.5752123", "0.5752123", ...
0.7831942
0
Return signed distance to plane of point.
def plane_distance(p, plane): x, y, z = p A, B, C, D = plane return A*x + B*y + C*z + D
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distanceTo(self, point):\n return np.linalg.norm([self.x - point.x, self.y - point.y, self.z - point.z])", "def distance_point_signed(self, point: array_like) -> np.float64:\n vector_to_point = Vector.from_points(self.point, point)\n\n return self.normal.scalar_projection(vector_to_point...
[ "0.76925886", "0.76642305", "0.7587384", "0.7395862", "0.7382959", "0.71116424", "0.71096134", "0.7101791", "0.70624435", "0.70609105", "0.68975526", "0.6842688", "0.6742767", "0.66442484", "0.66334695", "0.65379184", "0.65276915", "0.6486572", "0.6456276", "0.6456276", "0.64...
0.6764644
12
Reduce ndarray data via binaveraging for specified peraxis bin sizes. For a 3D input data with shape (D, H, W) and axes_s of [s1, s2, s3], the output value result[0, 0, 0] will contain the average
def bin_reduce(data, axes_s): d1 = data # sort axes by stride distance to optimize for locality # doesn't seem to make much difference on modern systems... axes = [ (axis, d1.strides[axis]) for axis in range(d1.ndim) ] axes.sort(key=lambda p: p[1]) assert len(axes_s) == data.ndim #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rebin(a, *args):\n shape = a.shape\n lenShape = len(shape)\n #factor = np.asarray(shape) / np.asarray(args)\n #print factor\n evList = ['a.reshape('] + ['args[%d],factor[%d],' % (i, i) for i in range(lenShape)] + [')'] + ['.mean(%d)' % (i + 1) for i in range(lenShape)]\n return eval(''.join(e...
[ "0.6197544", "0.6139096", "0.6051382", "0.5896235", "0.5862351", "0.57766837", "0.5664513", "0.56489617", "0.5627115", "0.5602402", "0.5573364", "0.55187595", "0.551417", "0.5482396", "0.5384104", "0.5372279", "0.53614336", "0.5357239", "0.53565305", "0.53510183", "0.53490233...
0.71066993
0
Wrap an image source given by filename or an existing tifffile.TiffFile instance.
def __init__(self, src, _output_plan=None): if isinstance(src, str): self.tf = tifffile.TiffFile(src) elif isinstance(src, tifffile.TiffFile): self.tf = src elif isinstance(src, TiffLazyNDArray): self.tf = src.tf tfimg = self.tf.series[0] page...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(*args, **kwargs):\n return TiffFileTileSource(*args, **kwargs)", "def load_image(fname):\n return load_tiff(fname)", "def open(*args, **kwargs):\n return GDALFileTileSource(*args, **kwargs)", "def _image(filename):\n return TK.PhotoImage(file=filename)", "def get_image(filename):\n...
[ "0.6704651", "0.59940434", "0.5843271", "0.5614258", "0.5372813", "0.5368938", "0.5334533", "0.5243926", "0.5218252", "0.52171", "0.52042305", "0.51773345", "0.51763964", "0.51749897", "0.5154558", "0.5137648", "0.51336586", "0.5132648", "0.51294935", "0.5125649", "0.5113626"...
0.48983687
40
Restructure to preferred TCZYX or CZYX form...
def canonicalize(data): data = data.transpose(*[d for d in map(data.axes.find, 'TCIZYX') if d >= 0]) projection = [] if 'T' in data.axes and data.shape[0] == 1: projection.append(0) # remove trivial T dimension if 'C' not in data.axes: projection.append(None) # add trivial C dimension ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tax_court_citation_extractor(self):\n\n test_pairs = (\n (\n \"\"\" 1 UNITED STATES TAX COURT REPORT (2018)\n\n\n\n UNITED STATES TAX COURT\n\n\n\n BENTLEY COURT II LIMITED PARTNERSHIP, B.F. BENTLEY, INC., TAX\n MATTERS PARTNER, Petitio...
[ "0.55862325", "0.5523278", "0.5387969", "0.53619444", "0.5274147", "0.5196478", "0.51292235", "0.51178896", "0.5037327", "0.5011835", "0.4984608", "0.4979913", "0.49527147", "0.49317342", "0.4925733", "0.49204636", "0.4911744", "0.49004143", "0.48934817", "0.48891628", "0.488...
0.0
-1
Load named file using TIFF reader, returning (data, metadata). Keep temporarily for backwardcompatibility...
def load_tiff(fname): data = TiffLazyNDArray(fname) try: data = canonicalize(data) except Exception as e: print(e) # special case for raw TIFF (not LSM, not OME) if data.ndim == 3: data = data[(None,slice(None),slice(None),slice(None))] # add fake color dimension ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_image(fname):\n return load_tiff(fname)", "def load_tiff(self):\n\n try:\n # Byte order\n h = bytes(self.tif_file.read(2))\n self.byteOrder = {b'II': 'little', b'MM': 'big'}[h]\n assert (self.byteOrder == 'little' or self.byteOrder == 'big')\n ...
[ "0.7372688", "0.72276574", "0.6451952", "0.63730574", "0.63536483", "0.6299473", "0.6247352", "0.6202761", "0.61148506", "0.6113087", "0.6061809", "0.60330236", "0.602107", "0.6011453", "0.5996214", "0.5994353", "0.5974746", "0.59672064", "0.5890447", "0.589004", "0.58861125"...
0.7757786
0
Load named file, returning (data, metadata). Keep temporarily for backwardcompatibility...
def load_image(fname): return load_tiff(fname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_metadata_from_file(filename):\n try:\n extension = os.path.splitext(filename)[1]\n return _metadata_loader[extension](filename)\n except KeyError:\n raise TypeError('Cannot read metadata from file %s, extension %s not ' \n 'supported at this time' % (filen...
[ "0.6966622", "0.69461375", "0.6804987", "0.6643008", "0.6639517", "0.6627387", "0.6598097", "0.6546597", "0.6538457", "0.649459", "0.64599204", "0.6399604", "0.6391517", "0.638861", "0.6387665", "0.6366153", "0.63047683", "0.63035756", "0.63002837", "0.6292373", "0.62892354",...
0.0
-1
Load and mangle TIFF image file.
def load_and_mangle_image(fname): I, meta = load_image(fname) try: voxel_size = tuple(map(float, os.getenv('ZYX_IMAGE_GRID').split(","))) print("ZYX_IMAGE_GRID environment forces image grid of %s micron." % (voxel_size,)) assert len(voxel_size) == 3 except: try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_image(fname):\n return load_tiff(fname)", "def load_tiff(fname):\n data = TiffLazyNDArray(fname)\n try:\n data = canonicalize(data)\n except Exception as e:\n print(e)\n # special case for raw TIFF (not LSM, not OME)\n if data.ndim == 3:\n data = data[(...
[ "0.74826205", "0.6993402", "0.69227684", "0.66210544", "0.6599251", "0.6066964", "0.60387707", "0.59640896", "0.5937128", "0.5929207", "0.58596927", "0.58146137", "0.5788013", "0.57823527", "0.57540816", "0.57411677", "0.5713845", "0.57103294", "0.5702574", "0.5649415", "0.56...
0.5230164
45
Returns true for all nmap hosts
def all_hosts(*args, **kwargs): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include_hostnames(nmap_host):\n if nmap_host.hostnames:\n return True\n return False", "def include_up_hosts(nmap_host):\n if nmap_host.status == 'up':\n return True\n return False", "def is_all_in_one(config):\n return len(filtered_hosts(config, exclude=False)) == 1", "def _...
[ "0.7856385", "0.7316101", "0.6537969", "0.6532694", "0.63546425", "0.625155", "0.62461436", "0.6220048", "0.6021829", "0.5954068", "0.59428406", "0.5856537", "0.5827691", "0.57918847", "0.5787338", "0.57788503", "0.5762706", "0.57573164", "0.5747384", "0.57212675", "0.5707575...
0.7151465
2
Imports the given nmap result.
def import_nmap(result, tag, check_function=all_hosts, import_services=False): host_search = HostSearch(arguments=False) service_search = ServiceSearch() parser = NmapParser() report = parser.parse_fromstring(result) imported_hosts = 0 imported_services = 0 for nmap_host in report.hosts: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_nmap_results(cls, info, output_filename):\n\n # Parse the scan results.\n # On error log the exception and continue.\n results = []\n hostmap = {}\n if info:\n hostmap[info.address] = info\n try:\n tree = ET.parse(output_filename)\n ...
[ "0.5647757", "0.56106627", "0.5591286", "0.549616", "0.4903906", "0.4893976", "0.48800737", "0.48766825", "0.48130697", "0.47719243", "0.4759616", "0.47524032", "0.47438028", "0.47294953", "0.47147262", "0.47070262", "0.46990514", "0.46663794", "0.46645853", "0.46533662", "0....
0.7243553
0
Function to filter out hosts with hostnames
def include_hostnames(nmap_host): if nmap_host.hostnames: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _filter_hosts(self, request_spec, hosts, filter_properties,\n hostname_prefix):\n \n LOG.info(\"jach:hosts %(hosts)s\" % locals())\n\n hosts = [host for host in hosts if host.startswith(hostname_prefix)]\n return hosts", "def _filter_hosts(self, hosts, spec_obj):\n\n ignore...
[ "0.75791645", "0.7554701", "0.6532992", "0.6315638", "0.62809354", "0.620142", "0.6124951", "0.6123341", "0.6045403", "0.604436", "0.604436", "0.60286456", "0.6028337", "0.6026617", "0.59784096", "0.59284055", "0.592523", "0.59235", "0.59115773", "0.5893987", "0.5893246", "...
0.67825294
2
Includes only hosts that have the status 'up'
def include_up_hosts(nmap_host): if nmap_host.status == 'up': return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reports_enabled_hosts_as_up(self):\n compute1 = self.start_service('compute', host='host1')\n compute2 = self.start_service('compute', host='host2')\n hosts = self.scheduler.driver.hosts_up(self.context, 'compute')\n self.assertEqual(2, len(hosts))\n compute1.kill()\n ...
[ "0.6929452", "0.6754496", "0.6679417", "0.64882976", "0.6351302", "0.6138063", "0.6076717", "0.60622376", "0.6043503", "0.6015993", "0.5977318", "0.5946986", "0.5894877", "0.5889159", "0.5798418", "0.5779504", "0.576346", "0.57560277", "0.56222934", "0.5565237", "0.5488756", ...
0.83082455
0
Start an nmap process with the given args on the given ips.
def nmap(nmap_args, ips): config = Config() arguments = ['nmap', '-Pn'] arguments.extend(ips) arguments.extend(nmap_args) output_file = '' now = datetime.datetime.now() if not '-oA' in nmap_args: output_name = 'nmap_jackal_{}'.format(now.strftime("%Y-%m-%d %H:%M")) path_name ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(args):\n if '-' in args['-p']:\n tmp = args['-p'].split('-')\n tgtPorts = [str(i) for i in xrange(int(tmp[0]), int(tmp[1])+1)]\n else:\n tgtPorts = [args['-p']]\n tgtHost = args['-H']\n for tgtPort in tgtPorts:\n nmapScan(tgtHost, tgtPort)", "def nmap_discover():\...
[ "0.71778214", "0.65890396", "0.65784913", "0.61431664", "0.6127237", "0.60971135", "0.59005636", "0.535779", "0.5355618", "0.52643454", "0.5208361", "0.5177667", "0.51740116", "0.5138187", "0.5101425", "0.5043745", "0.5043745", "0.5043745", "0.5043745", "0.5043745", "0.503599...
0.7662415
0
This function retrieves ranges from jackal
def nmap_discover(): rs = RangeSearch() rs_parser = rs.argparser arg = argparse.ArgumentParser(parents=[rs_parser], conflict_handler='resolve') arg.add_argument('type', metavar='type', \ help='The type of nmap scan to do, choose from ping or lookup', \ type=str, choices=['ping', 'lookup'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_range(self):\n pass", "def ranges(self):\n return self._ranges", "def new_ranges(rs):\n return tuple(chain(*[new_range(r) for r in rs]))", "def merge_ranges():", "def get_ranges(self) -> typing.List[typing.Tuple[float, float]]:\n return self.ranges[:]", "def get_range...
[ "0.67254317", "0.6671901", "0.65360165", "0.6414671", "0.63947725", "0.63859135", "0.6361172", "0.6350114", "0.63340735", "0.6305744", "0.6270962", "0.6250254", "0.6222137", "0.620299", "0.6201252", "0.61670315", "0.6165873", "0.61564016", "0.6138788", "0.6117077", "0.6041335...
0.0
-1