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
Get the scaling ratios required to upsample for the whole world. If resolution is None, then assume it will be upsampled to the native destination resolution. See Dataset.GetNativeResolution() If places is not None, rounds the ratios to the number of decimal places specified.
def GetWorldScalingRatios(self, resolution=None, places=None): if resolution is None: resolution = self.GetNativeResolution() spatial_ref = self.GetSpatialReference() world = spatial_ref.GetWorldExtents().dimensions src_pixel_sizes = XY(x=world.x / self.RasterXSize, y=world.y / self.RasterYSize) dst_pixel_sizes = spatial_ref.GetPixelDimensions(resolution=resolution) xscale = abs(src_pixel_sizes.x / dst_pixel_sizes.x) # Make sure that yscale fits within the whole world yscale = min(xscale, abs(src_pixel_sizes.y / dst_pixel_sizes.y)) if places is not None: xscale = round(xscale, places) yscale = round(yscale, places) return XY(x=xscale, y=yscale)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetScalingRatios(self, resolution=None, places=None):\n if resolution is None:\n resolution = self.GetNativeResolution(transform=None)\n\n # Get the pixel dimensions in map units. There is no custom transform,\n # because it makes no sense to compute a pixel ratio for a\n ...
[ "0.74602205", "0.533336", "0.5087092", "0.50720173", "0.50386196", "0.49780598", "0.49676868", "0.49499795", "0.48785496", "0.48708156", "0.4858904", "0.48400638", "0.48303235", "0.48303235", "0.47874883", "0.47874883", "0.47874883", "0.47721013", "0.4771545", "0.47600517", "...
0.72415364
1
Returns an iterable of TMS tiles that are outside this Dataset.
def GetWorldTmsBorders(self, resolution=None, transform=None): world_extents = self.GetWorldTmsExtents(resolution=resolution, transform=transform) data_extents = self.GetTmsExtents(resolution=resolution, transform=transform) return (XY(x, y) for x in range(world_extents.lower_left.x, world_extents.upper_right.x) for y in range(world_extents.lower_left.y, world_extents.upper_right.y) if XY(x, y) not in data_extents)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_tiles(self):\n return list(filter(None, self.empty))", "def find_tiles(self):\n lat1, lat2 = self.bbox.south, self.bbox.north\n lon1, lon2 = self.bbox.west, self.bbox.east\n # convert to geographic bounding box\n minlat, minlon = min(lat1, lat2), min(lon1, lon2)\n ...
[ "0.664918", "0.65654457", "0.64280045", "0.61701643", "0.61044884", "0.6099539", "0.6057754", "0.60419196", "0.60385936", "0.60150456", "0.60135376", "0.5999694", "0.5931338", "0.59044945", "0.5892273", "0.585954", "0.57977283", "0.5784656", "0.5774202", "0.5733227", "0.57330...
0.5349394
53
Generate a GeoTIFF from a vrt string
def render(self, outputfile, cmd=GDALTRANSLATE, working_memory=1024, compress=None, tempdir=None): tmpfile = NamedTemporaryFile( suffix='.tif', prefix='gdalrender', dir=os.path.dirname(outputfile), delete=False ) try: with self.get_tempfile(dir=tempdir) as inputfile: warp_cmd = [ cmd, '-q', # Quiet - FIXME: Use logging '-of', 'GTiff', # Output to GeoTIFF '-co', 'BIGTIFF=IF_SAFER', # Use BigTIFF if >2GB '-co', 'NUM_THREADS=ALL_CPUS', # multithreaded compression for GeoTiff # gdal_translate does not support the following # '-multi', # Use multiple processes # '-overwrite', # Overwrite outputfile ] # Set the working memory so that gdalwarp doesn't stall of disk # I/O warp_cmd.extend([ # gdal_translate does not support -wm # '-wm', working_memory, '--config', 'GDAL_CACHEMAX', working_memory ]) # Use compression compress = str(compress).upper() if compress and compress != 'NONE': warp_cmd.extend(['-co', 'COMPRESS=%s' % compress]) if compress in ('LZW', 'DEFLATE'): warp_cmd.extend(['-co', 'PREDICTOR=2']) # Run gdalwarp and output to tmpfile.name warp_cmd.extend([inputfile.name, tmpfile.name]) check_output_gdal([str(e) for e in warp_cmd]) # If it succeeds, then we move it to overwrite the actual # output os.rename(tmpfile.name, outputfile) return outputfile finally: rmfile(tmpfile.name, ignore_missing=True) rmfile(tmpfile.name + '.aux.xml', ignore_missing=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ascii_to_tiff(infile, outfile, refIm):", "def convert_vrt(fname, out_fname, dataset_name='dataset',\n compression=H5CompressionFilter.LZF, filter_opts=None,\n attrs=None):\n with h5py.File(out_fname) as fid:\n with rasterio.open(fname) as rds:\n # set defaul...
[ "0.5859697", "0.5527902", "0.54801387", "0.5408986", "0.5402602", "0.53733236", "0.535592", "0.52642715", "0.51979923", "0.5132323", "0.5090385", "0.5080128", "0.50617826", "0.50474924", "0.49894196", "0.4950945", "0.49262798", "0.4917392", "0.49108842", "0.49036774", "0.4900...
0.0
-1
Create a FooterHtml object
def __init__(self, footer_html=None): self._footer_html = None if footer_html is not None: self.footer_html = footer_html
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_footer(self):\n self.footer = '</div>' \\\n '</div>' \\\n '</div>' \\\n '<div class=\"footer\">' \\\n '<div class=\"container\">' \\\n '<p class=\"text-muted\">Copyright Harm Brugge 2014.</p>' \\...
[ "0.76971847", "0.744824", "0.73707694", "0.72728646", "0.7272721", "0.72693896", "0.7252219", "0.7141228", "0.7088616", "0.70732653", "0.7065509", "0.6761187", "0.6724753", "0.67033243", "0.66451037", "0.6532951", "0.6486145", "0.6434139", "0.63833433", "0.63833433", "0.63632...
0.6722909
13
The html content of your footer.
def footer_html(self): return self._footer_html
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n return self.footer_html", "def get_footer(self):\n self.footer = '</div>' \\\n '</div>' \\\n '</div>' \\\n '<div class=\"footer\">' \\\n '<div class=\"container\">' \\\n '<p cla...
[ "0.84020877", "0.83206654", "0.77823853", "0.7600698", "0.7569941", "0.75131357", "0.74960965", "0.7441762", "0.7427407", "0.74167025", "0.7381049", "0.7381049", "0.73269355", "0.73111933", "0.73045343", "0.71055436", "0.7100233", "0.70798254", "0.7018429", "0.69782525", "0.6...
0.8446734
0
The html content of your footer.
def footer_html(self, html): self._footer_html = html
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def footer_html(self):\n return self._footer_html", "def get(self):\n return self.footer_html", "def get_footer(self):\n self.footer = '</div>' \\\n '</div>' \\\n '</div>' \\\n '<div class=\"footer\">' \\\n ...
[ "0.8446734", "0.84020877", "0.83206654", "0.77823853", "0.7600698", "0.7569941", "0.75131357", "0.7441762", "0.7427407", "0.74167025", "0.7381049", "0.7381049", "0.73269355", "0.73111933", "0.73045343", "0.71055436", "0.7100233", "0.70798254", "0.7018429", "0.69782525", "0.68...
0.74960965
7
Get a JSONready representation of this FooterHtml.
def get(self): return self.footer_html
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def footer_html(self):\n return self._footer_html", "def get_footer(self):\n self.footer = '</div>' \\\n '</div>' \\\n '</div>' \\\n '<div class=\"footer\">' \\\n '<div class=\"container\">' \\\n ...
[ "0.73172146", "0.66936934", "0.6251055", "0.6243386", "0.6088809", "0.60859615", "0.6078452", "0.6061365", "0.6044317", "0.58748573", "0.5841819", "0.58229464", "0.58227277", "0.57736146", "0.5748268", "0.57245976", "0.5719315", "0.5718041", "0.57159793", "0.57119656", "0.569...
0.7223077
1
unauthorized access is forbidden
def test_artifactpriority_list_api_unauthorized(self): # get response response = self.client.get('/api/artifactpriority/') # compare self.assertEqual(response.status_code, 401)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forbidden():\n return HttpError(403)", "def get_authenticated_denied(self):", "def forbidden(request):\n return Response(render_template('core/forbidden.html'),\n status=401, mimetype='text/html')", "def access_forbidden(e):\n return render_template(\"error/403.html\"), 40...
[ "0.8034033", "0.7552204", "0.737518", "0.73615354", "0.73118114", "0.7307068", "0.7258209", "0.7217089", "0.72039396", "0.7159985", "0.714443", "0.7120388", "0.71163434", "0.7105373", "0.71046525", "0.70585066", "0.7024013", "0.7016623", "0.7005272", "0.69919777", "0.69636977...
0.0
-1
test redirect with appending slash
def test_artifactpriority_list_api_redirect(self): # login testuser self.client.login( username='testuser_artifactpriority_api', password='IktrZIZLncwTbOBD9Bhw' ) # create url destination = urllib.parse.quote('/api/artifactpriority/', safe='/') # get response response = self.client.get('/api/artifactpriority', follow=True) # compare self.assertRedirects( response, destination, status_code=301, target_status_code=200 )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_append_slash_redirect(self):\n request = self.rf.get(\"/slash\")\n r = CommonMiddleware(get_response_empty).process_request(request)\n self.assertIsNone(r)\n response = HttpResponseNotFound()\n r = CommonMiddleware(get_response_empty).process_response(request, response)\...
[ "0.7745988", "0.7601577", "0.749149", "0.69618195", "0.69307077", "0.68707025", "0.6825404", "0.66935575", "0.66655666", "0.6664395", "0.6626923", "0.6614033", "0.65820646", "0.65820646", "0.6524852", "0.65176207", "0.6499768", "0.64643717", "0.64202327", "0.6407755", "0.6398...
0.0
-1
unauthorized access is forbidden
def test_artifactpriority_detail_api_unauthorized(self): # get object artifactpriority_api_1 = Artifactpriority.objects.get( artifactpriority_name='artifactpriority_api_1' ) # get response response = self.client.get( '/api/artifactpriority/' + str(artifactpriority_api_1.artifactpriority_id) + '/' ) # compare self.assertEqual(response.status_code, 401)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forbidden():\n return HttpError(403)", "def get_authenticated_denied(self):", "def forbidden(request):\n return Response(render_template('core/forbidden.html'),\n status=401, mimetype='text/html')", "def access_forbidden(e):\n return render_template(\"error/403.html\"), 40...
[ "0.8034033", "0.7552204", "0.737518", "0.73615354", "0.73118114", "0.7307068", "0.7258209", "0.7217089", "0.72039396", "0.7159985", "0.714443", "0.7120388", "0.71163434", "0.7105373", "0.71046525", "0.70585066", "0.7024013", "0.7016623", "0.7005272", "0.69919777", "0.69636977...
0.0
-1
test redirect with appending slash
def test_artifactpriority_detail_api_redirect(self): # get object artifactpriority_api_1 = Artifactpriority.objects.get( artifactpriority_name='artifactpriority_api_1' ) # login testuser self.client.login( username='testuser_artifactpriority_api', password='IktrZIZLncwTbOBD9Bhw' ) # create url destination = urllib.parse.quote( '/api/artifactpriority/' + str(artifactpriority_api_1.artifactpriority_id) + '/', safe='/', ) # get response response = self.client.get( '/api/artifactpriority/' + str(artifactpriority_api_1.artifactpriority_id), follow=True, ) # compare self.assertRedirects( response, destination, status_code=301, target_status_code=200 )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_append_slash_redirect(self):\n request = self.rf.get(\"/slash\")\n r = CommonMiddleware(get_response_empty).process_request(request)\n self.assertIsNone(r)\n response = HttpResponseNotFound()\n r = CommonMiddleware(get_response_empty).process_response(request, response)\...
[ "0.7745988", "0.7601577", "0.749149", "0.69618195", "0.69307077", "0.68707025", "0.6825404", "0.66935575", "0.66655666", "0.6664395", "0.6626923", "0.6614033", "0.65820646", "0.65820646", "0.6524852", "0.65176207", "0.6499768", "0.64643717", "0.64202327", "0.6407755", "0.6398...
0.0
-1
Test initialization under Q.
def test_init_q(self): riskfree = .01 lmbd = .01 lmbd_s = .5 lmbd_y = .5 mean_v = .5 kappa_s = 1.5 kappa_y = .5 eta_s = .1 eta_y = .01 rho = -.5 param = CentTendParam(riskfree=riskfree, lmbd=lmbd, lmbd_s=lmbd_s, lmbd_y=lmbd_y, mean_v=mean_v, kappa_s=kappa_s, kappa_y=kappa_y, eta_s=eta_s, eta_y=eta_y, rho=rho, measure='Q') kappa_sq = kappa_s - lmbd_s * eta_s kappa_yq = kappa_y - lmbd_y * eta_y scale = kappa_s / kappa_sq self.assertEqual(param.measure, 'Q') self.assertEqual(param.riskfree, riskfree) self.assertEqual(param.lmbd, 0) self.assertEqual(param.lmbd_s, lmbd_s) self.assertEqual(param.lmbd_y, lmbd_y) self.assertEqual(param.mean_v, mean_v * kappa_y / kappa_yq * scale) self.assertEqual(param.kappa_s, kappa_sq) self.assertEqual(param.kappa_y, kappa_yq) self.assertEqual(param.eta_s, eta_s) self.assertEqual(param.eta_y, eta_y * scale**.5) self.assertEqual(param.rho, rho) self.assertTrue(param.is_valid()) with warnings.catch_warnings(): warnings.simplefilter("ignore") param.convert_to_q()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init(q: qreg) -> control:\n\n return", "def test_init(self):\r\n sq = SeqQualBad('Q', None)\r\n self.assertEqual(sq.Name, 'Q')\r\n self.assertEqual(sq.F, None)\r\n self.assertEqual(sq.FailedIds, [])", "def __init__(self,Q=None):\n \n self.Q = Q", "def test_01_...
[ "0.79838145", "0.74229264", "0.7260709", "0.7092228", "0.69702667", "0.69632655", "0.6950236", "0.68146306", "0.68144906", "0.67040694", "0.66863024", "0.6641684", "0.6620748", "0.6618044", "0.6603013", "0.6602111", "0.65866554", "0.65761757", "0.6568877", "0.6567648", "0.655...
0.65442336
30
Test from theta under Q.
def test_from_theta_q(self): riskfree = .01 lmbd = .01 lmbd_s = .5 lmbd_y = .5 mean_v = .5 kappa_s = 1.5 kappa_y = .5 eta_s = .1 eta_y = .01 rho = -.5 theta = [riskfree, mean_v, kappa_s, kappa_y, eta_s, eta_y, rho, lmbd, lmbd_s, lmbd_y] param = CentTendParam.from_theta(theta, measure='Q') kappa_sq = kappa_s - lmbd_s * eta_s kappa_yq = kappa_y - lmbd_y * eta_y scale = kappa_s / kappa_sq self.assertEqual(param.measure, 'Q') self.assertEqual(param.riskfree, riskfree) self.assertEqual(param.lmbd, 0) self.assertEqual(param.lmbd_s, lmbd_s) self.assertEqual(param.lmbd_y, lmbd_y) self.assertEqual(param.mean_v, mean_v * kappa_y / kappa_yq * scale) self.assertEqual(param.kappa_s, kappa_sq) self.assertEqual(param.kappa_y, kappa_yq) self.assertEqual(param.eta_s, eta_s) self.assertEqual(param.eta_y, eta_y * scale**.5) self.assertEqual(param.rho, rho) self.assertTrue(param.is_valid())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def theta_given_s(theta, q):\n if q == 0:\n return .3333\n else:\n if theta == 0:\n return 0.25\n elif theta == 1:\n return 0.25\n else:\n return 0.5", "def test_q(self):\n assert np.allclose(self.stepper.q, self.ODE.exact(self.stepper.t),...
[ "0.6844436", "0.66966224", "0.61778736", "0.61521673", "0.612918", "0.61256754", "0.60950434", "0.6005836", "0.59359986", "0.59097683", "0.58760226", "0.5869871", "0.579352", "0.57821816", "0.577765", "0.57773805", "0.5768191", "0.5727558", "0.56556517", "0.56249905", "0.5595...
0.6628237
2
Test conversion to Q.
def test_convert_to_q(self): riskfree = .01 lmbd = .01 lmbd_s = .5 lmbd_y = .5 mean_v = .5 kappa_s = 1.5 kappa_y = .5 eta_s = .1 eta_y = .01 rho = -.5 theta = [riskfree, mean_v, kappa_s, kappa_y, eta_s, eta_y, rho, lmbd, lmbd_s, lmbd_y] param = CentTendParam.from_theta(theta) param.convert_to_q() kappa_sq = kappa_s - lmbd_s * eta_s kappa_yq = kappa_y - lmbd_y * eta_y scale = kappa_s / kappa_sq self.assertEqual(param.measure, 'Q') self.assertEqual(param.riskfree, riskfree) self.assertEqual(param.lmbd, 0) self.assertEqual(param.lmbd_s, lmbd_s) self.assertEqual(param.lmbd_y, lmbd_y) self.assertEqual(param.mean_v, mean_v * kappa_y / kappa_yq * scale) self.assertEqual(param.kappa_s, kappa_sq) self.assertEqual(param.kappa_y, kappa_yq) self.assertEqual(param.eta_s, eta_s) self.assertEqual(param.eta_y, eta_y * scale**.5) self.assertEqual(param.rho, rho) self.assertTrue(param.is_valid())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_Q(self):\n return isinstance(self,Q)", "def test_decode_qdc(self):\n self.assertEqual(td.qdc(), decoder.decode_qdc(BytesIO(td.qdc(True))))", "def test_qing(self):\n fun = get_problem('qing', self.dimension, -500, 500)\n self.assertAlmostEqual(fun(self.array10), 584.0, delta=1...
[ "0.67130417", "0.621103", "0.61342704", "0.5916669", "0.58767176", "0.57915777", "0.5747716", "0.5717606", "0.57136637", "0.5693663", "0.5692092", "0.5674936", "0.5654241", "0.56443626", "0.56386477", "0.5627663", "0.5570281", "0.55655336", "0.55531347", "0.5550286", "0.55312...
0.61365926
2
Returns all the SKU's names which are available in the database.
def get_all_skus(): sku_ids = set() for sku_id in sku_database.find({}, {"_id": 0, "SKU_id": 1}): if sku_id.get("SKU_id"): sku_ids.add(sku_id["SKU_id"]) else: continue return list(sku_ids)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sku_name(self) -> str:\n return pulumi.get(self, \"sku_name\")", "def sku_name(self) -> str:\n return pulumi.get(self, \"sku_name\")", "def sku_name(self) -> str:\n return pulumi.get(self, \"sku_name\")", "def getNames(self) -> List[unicode]:\n ...", "def sku_name(self) -> p...
[ "0.62859315", "0.62859315", "0.62859315", "0.6216947", "0.6172846", "0.59829146", "0.59336996", "0.5914514", "0.5886475", "0.58093053", "0.58093053", "0.5785581", "0.57802486", "0.57603806", "0.5718735", "0.57042855", "0.5676707", "0.56748796", "0.5674839", "0.5670397", "0.56...
0.72144353
0
For given sku_id, status and time span, it queries and returns back the data.
def get_sku_id(sku_id, status, start_time, end_time): all_data = [] if not (sku_id, status, start_time, end_time): return all_data for i in sku_database.find({"SKU_id": sku_id, "Status": status}, {"_id": 0}): if start_time < i["Time_stamp"] < end_time: all_data.append(i) else: continue return all_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timespan(self, timespan=None, timezone=None):\r\n url = '{0}/{1}'.format(self.get_pull_url(), 'timespan')\r\n params = base.get_params(('timespan', 'timezone'), locals())\r\n\r\n return http.Request('GET', url, params), parsers.parse_json", "def query_tas_status(self):\n response ...
[ "0.5370444", "0.53211254", "0.53194", "0.5045779", "0.49320626", "0.48997423", "0.48471904", "0.4833045", "0.48287934", "0.48239887", "0.47896585", "0.47663978", "0.47641006", "0.47459877", "0.4742183", "0.47376695", "0.473765", "0.4669849", "0.46652684", "0.46615025", "0.463...
0.6179882
0
Get the status of the given id
def get_status_of_id(sku_id): if not sku_id: return None status_query = list(sku_database.find({"SKU_unit": int(sku_id)}, {'_id': 0, 'Status': 1})) status = status_query[0]["Status"] return status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_status_by_id(cls, request, id):\n return request.dbsession.query(cls).get(id).status", "def status(self, id):", "def get_status(id):\n task = run_ctx_request.AsyncResult(id)\n if task.state == states.PENDING:\n abort(404)\n if task.state == states.RECEIVED or task.state == states...
[ "0.8681815", "0.80947495", "0.77845645", "0.7430623", "0.7410559", "0.7287429", "0.7247795", "0.7225844", "0.72096854", "0.71210665", "0.69675994", "0.69470584", "0.6917927", "0.69042987", "0.68739104", "0.6839439", "0.6839439", "0.6839439", "0.6763738", "0.6757584", "0.67065...
0.7535763
3
From a given list of SKU id's and status as mentioned, it checks whether the criteria is matching and returns the matching values.
def get_status_skus(sku_list, status): values = [] if not (sku_list, status): return values for sku_id in sku_list: status_query = list(sku_database.find({"SKU_unit": int(sku_id), "Status": status}, {'_id': 0, 'Status': 1})) if status_query: values.append(sku_id) return values
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sku_id(sku_id, status, start_time, end_time):\n all_data = []\n if not (sku_id, status, start_time, end_time):\n return all_data\n\n for i in sku_database.find({\"SKU_id\": sku_id, \"Status\": status}, {\"_id\": 0}):\n if start_time < i[\"Time_stamp\"] < end_time:\n all_da...
[ "0.56345564", "0.5322471", "0.52859175", "0.52649534", "0.5165805", "0.5100922", "0.5077354", "0.50569147", "0.5036123", "0.50279695", "0.50128347", "0.5012462", "0.4975206", "0.49740142", "0.49417433", "0.493961", "0.48568138", "0.4840273", "0.48359197", "0.48324963", "0.482...
0.7839895
0
Converts a signal name to canonical form.
def name2signal(string): try: v = int(string) except ValueError: if "_" in string: raise ValueError("could not convert %r to signal name" % string) s = string.upper() if not s.startswith("SIG"): s = "SIG" + s v = getattr(signal, s, None) if isinstance(v, int): return s raise ValueError("could not convert %r to signal name" % string) if v >= signal.NSIG: raise ValueError("unsupported signal on this platform: %s" % string) for name in dir(signal): if "_" in name: continue if getattr(signal, name) == v: return name raise ValueError("unsupported signal on this platform: %s" % string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def canonical_name(self, name):\n raise NotImplementedError", "def _signal_to_common_name(signal: domain.Signal) -> str: # pragma: no cover\n stationb_map: domain.SIGNAL_MAP = {\n (550.0, 10.0, 610.0, 20.0): \"mRFP1\",\n (430.0, 10.0, 480.0, 10.0): \"ECFP\",\n (500.0, 10.0, 530.0,...
[ "0.70679617", "0.672173", "0.66685057", "0.6528386", "0.6398456", "0.6284975", "0.6257678", "0.6253902", "0.6199662", "0.6199662", "0.6164654", "0.61454165", "0.6111997", "0.5949534", "0.58953434", "0.58953434", "0.58953434", "0.5865084", "0.5847952", "0.57750165", "0.5761741...
0.66648597
3
Disable an alarm. This will prevent the alarm from executing until reenabled or until the application is restarted.
def disable(self, name: str): self._get_backend().disable_alarm(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_disable(self) -> None:\n self._cancel_notification_cycle()", "def on_disable(self) -> None:\n self._cancel_automation()", "def on_disable(self) -> None:\n self._on_stop_cycle({})", "def stop_alarm(self):\n self.out_power.pulse()", "def disable(self):\n self._enable...
[ "0.7147774", "0.7090431", "0.6920151", "0.6847871", "0.6707151", "0.66669804", "0.66627", "0.66279423", "0.656082", "0.65437007", "0.6541512", "0.6485868", "0.6448139", "0.6370838", "0.6320564", "0.6306733", "0.62469566", "0.62280416", "0.62151366", "0.6210067", "0.6168819", ...
0.80944586
0
Dismiss the alarm that is currently running.
def dismiss(self): self._get_backend().dismiss_alarm()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dismiss_reminder(self):\n qry = ServiceOperationQuery(self, \"dismissReminder\")\n self.context.add_query(qry)\n return self", "def stop_animation(self):\n if self.animate_alarm:\n self.loop.remove_alarm(self.animate_alarm)\n self.animate_alarm = None", "async ...
[ "0.6770825", "0.6504499", "0.6491621", "0.6473124", "0.6453558", "0.6367585", "0.6321344", "0.61386096", "0.60624015", "0.60624015", "0.59958225", "0.5922445", "0.5870512", "0.5868287", "0.5867719", "0.5865545", "0.58586764", "0.58586764", "0.58152795", "0.58013976", "0.57735...
0.8574007
0
Snooze the alarm that is currently running for the specified number of seconds. The alarm will stop and resume again later.
def snooze(self, interval: Optional[float] = 300.0): self._get_backend().snooze_alarm(interval=interval)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sleep(self, seconds):\n\n # We schedule an alarm signal for x=seconds out in the future.\n # noinspection PyUnusedLocal\n def handle_alarm(signal_num, frame):\n pass\n\n signal.signal(signal.SIGALRM, handle_alarm)\n signal.alarm(seconds)\n\n # Wait for eithe...
[ "0.6919186", "0.6612018", "0.6467028", "0.6446055", "0.6190884", "0.6190884", "0.6155103", "0.6068098", "0.60492384", "0.60356086", "0.60265136", "0.601966", "0.6012515", "0.6003812", "0.5942315", "0.59309816", "0.59265506", "0.59265506", "0.5859484", "0.5822939", "0.5798656"...
0.7325651
0
Get the list of configured alarms.
def get_alarms(self) -> List[Dict[str, Any]]: return [alarm.to_dict() for alarm in self._get_backend().get_alarms()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_alarms() -> List[Dict[str, Any]]:\n return __alarm_info.values()", "def get_alarms(region):\n\n client = boto3.client(\"cloudwatch\", region_name=region)\n\n describe_response = client.describe_alarms()\n\n alarms = describe_response[\"MetricAlarms\"]\n\n return alarms", "def getAlarms(s...
[ "0.78672135", "0.7273389", "0.71997935", "0.7173401", "0.70782715", "0.7007334", "0.6998015", "0.6914195", "0.6863513", "0.61937827", "0.61905473", "0.6153018", "0.6041094", "0.60307056", "0.5874066", "0.5827018", "0.5747757", "0.56293756", "0.5591793", "0.5573276", "0.554210...
0.7816481
1
Organization a model defined in Swagger
def __init__(self, country=None, person_name=None, state_province_county=None, email=None, phone_number=None, address_line1=None, address_line2=None, zip_post_code=None, city=None, name=None): # noqa: E501 # noqa: E501 self._country = None self._person_name = None self._state_province_county = None self._email = None self._phone_number = None self._address_line1 = None self._address_line2 = None self._zip_post_code = None self._city = None self._name = None self.discriminator = None if country is not None: self.country = country if person_name is not None: self.person_name = person_name if state_province_county is not None: self.state_province_county = state_province_county if email is not None: self.email = email if phone_number is not None: self.phone_number = phone_number if address_line1 is not None: self.address_line1 = address_line1 if address_line2 is not None: self.address_line2 = address_line2 if zip_post_code is not None: self.zip_post_code = zip_post_code if city is not None: self.city = city if name is not None: self.name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opt_model_create_rest_api():\n request_json = request.get_json()\n OptimModelRequestAPI(request_json).validate()\n return create_model_data(request_json)", "def create_model(self, ApiId: str, Name: str, Schema: str, ContentType: str = None, Description: str = None) -> Dict:\n pass", "def __...
[ "0.6377022", "0.6078088", "0.58630645", "0.5785033", "0.5765188", "0.5756673", "0.57561225", "0.573102", "0.5684268", "0.5679472", "0.5679472", "0.5679472", "0.5673386", "0.56596184", "0.56596184", "0.56596184", "0.56596184", "0.56596184", "0.5653947", "0.5642673", "0.5626254...
0.0
-1
Sets the country of this Organization.
def country(self, country): self._country = country
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def country(self, country):\n if country is None:\n raise ValueError(\"Invalid value for `country`, must not be `None`\")\n\n self._country = country", "def domain_settings_set_country(self, country):\n return self._request('domain/settings/set_country', inspect_args_func(inspect....
[ "0.7712507", "0.71704066", "0.6832151", "0.6527378", "0.65113974", "0.62519395", "0.62519395", "0.6071815", "0.6042363", "0.5949575", "0.5870461", "0.56637245", "0.558508", "0.5546206", "0.5546206", "0.55045587", "0.54971576", "0.5478352", "0.5457733", "0.5457733", "0.5406521...
0.76674914
5
Sets the person_name of this Organization.
def person_name(self, person_name): self._person_name = person_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_name(self, PersonName):\r\n self.name = PersonName", "def org_name(self, org_name):\n\n self._org_name = org_name", "def org_name(self, org_name):\n\n self._org_name = org_name", "def set_person(self, person):\n if person.upper() == UNKNOWN.upper():\n self.perso...
[ "0.7833753", "0.7134179", "0.7134179", "0.6688187", "0.65317196", "0.65317196", "0.65103024", "0.65103024", "0.65096503", "0.6446856", "0.64192414", "0.6416891", "0.63956535", "0.63956535", "0.63956535", "0.63956535", "0.63956535", "0.63945746", "0.63945746", "0.6344165", "0....
0.8247543
1
Sets the state_province_county of this Organization.
def state_province_county(self, state_province_county): self._state_province_county = state_province_county
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def county(self, county):\n\n self._county = county", "def county(self, county):\n\n self._county = county", "def nationality(self, nationality):\n\n self._nationality = nationality", "def nationality(self, nationality):\n\n self._nationality = nationality", "def set_city_count(...
[ "0.64520186", "0.64520186", "0.51732033", "0.51732033", "0.51432556", "0.4989287", "0.488448", "0.48415154", "0.47505423", "0.46348393", "0.4630611", "0.46284756", "0.45552388", "0.45378423", "0.4523382", "0.45212606", "0.45178837", "0.44777262", "0.4427605", "0.4427605", "0....
0.8909677
0
Sets the email of this Organization.
def email(self, email): self._email = email
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setEmail(self, email):\n self.email = email\n return self", "def email(self, email: str):\n\n self._email = email", "def email(self, email):\n if self.local_vars_configuration.client_side_validation and email is None: # noqa: E501\n raise ValueError(\"Invalid value f...
[ "0.8130456", "0.7738362", "0.7542091", "0.7482652", "0.7326202", "0.72683007", "0.72421545", "0.71375", "0.71375", "0.686361", "0.686361", "0.686361", "0.66893005", "0.6623506", "0.6539565", "0.65185577", "0.64557123", "0.6449671", "0.6417425", "0.63945293", "0.6345876", "0...
0.7769974
9
Sets the phone_number of this Organization.
def phone_number(self, phone_number): self._phone_number = phone_number
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def person_phone_number(self, person_phone_number):\n\n self._person_phone_number = person_phone_number", "def phone(self, new_number):\n self._phone.number = new_number", "def mobile_phone_number(self, mobile_phone_number):\n\n self._mobile_phone_number = mobile_phone_number", "def setP...
[ "0.7575966", "0.7262518", "0.7254966", "0.7023407", "0.69712853", "0.68257356", "0.6815127", "0.67999643", "0.6795196", "0.6795196", "0.6795196", "0.6795196", "0.6795196", "0.6791341", "0.6722033", "0.67016137", "0.6508162", "0.63192666", "0.6278706", "0.62630147", "0.6222011...
0.81304574
1
Sets the address_line1 of this Organization.
def address_line1(self, address_line1): self._address_line1 = address_line1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def address_line1(self, address_line1):\n if address_line1 is None:\n raise ValueError(\n \"Invalid value for `address_line1`, must not be `None`\"\n ) # noqa: E501\n\n self._address_line1 = address_line1", "def principal_address_line1(self, principal_address_l...
[ "0.8497842", "0.7957488", "0.7876892", "0.7850841", "0.77656263", "0.70708996", "0.70708996", "0.70708996", "0.689766", "0.6551664", "0.65369886", "0.64015824", "0.6390496", "0.6295419", "0.6270153", "0.6252031", "0.62348896", "0.6188278", "0.61339515", "0.6105675", "0.608727...
0.8811455
0
Sets the address_line2 of this Organization.
def address_line2(self, address_line2): self._address_line2 = address_line2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def address_2(self, address_2):\n\n self._address_2 = address_2", "def principal_address_line2(self, principal_address_line2):\n\n self._principal_address_line2 = principal_address_line2", "def street_line_2(self, street_line_2):\n\n self._street_line_2 = street_line_2", "def address2(se...
[ "0.79640037", "0.7917009", "0.7910908", "0.78585726", "0.71762484", "0.71762484", "0.7049437", "0.6794425", "0.6462342", "0.64471567", "0.64098936", "0.6366884", "0.63469005", "0.6327694", "0.62689376", "0.62077683", "0.60219824", "0.60010564", "0.60010564", "0.59956384", "0....
0.88047636
1
Sets the zip_post_code of this Organization.
def zip_post_code(self, zip_post_code): self._zip_post_code = zip_post_code
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zipcode(self, zipcode):\n self._zipcode = zipcode", "def zip_code(self, zip_code):\n\n self._zip_code = zip_code", "def postal_code(self, postal_code):\n\n self._postal_code = postal_code", "def postal_code(self, postal_code):\n\n self._postal_code = postal_code", "def posta...
[ "0.7381539", "0.7371916", "0.70360076", "0.70360076", "0.70360076", "0.69919515", "0.67918134", "0.67918134", "0.67918134", "0.6679859", "0.65118146", "0.6351724", "0.61154234", "0.6063556", "0.6023592", "0.59138143", "0.58627266", "0.56648487", "0.56164485", "0.55818355", "0...
0.84573597
0
Sets the city of this Organization.
def city(self, city): self._city = city
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def city(self, city):\n self._city = city", "def city(self, city):\n # type: (string_types) -> None\n\n if city is not None:\n if not isinstance(city, string_types):\n raise TypeError(\"Invalid type for `city`, type has to be `string_types`\")\n\n self._city ...
[ "0.8256088", "0.7434127", "0.715741", "0.7125765", "0.70390105", "0.6859149", "0.6617845", "0.65802497", "0.6554839", "0.6554839", "0.6554839", "0.6554839", "0.6554839", "0.6495286", "0.6381163", "0.634089", "0.63268566", "0.63185745", "0.6303239", "0.6295937", "0.6295937", ...
0.8241868
9
Sets the name of this Organization.
def name(self, name): self._name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def org_name(self, org_name):\n\n self._org_name = org_name", "def org_name(self, org_name):\n\n self._org_name = org_name", "def set_name(self, name):\n self._name = name", "def SetName(self, name):\n self.name = name", "def set_name(self, name: str):\n self._name = name...
[ "0.759724", "0.759724", "0.75542027", "0.755328", "0.7494422", "0.7469748", "0.7469748", "0.7469748", "0.7469748", "0.7469748", "0.74372435", "0.74372435", "0.73873687", "0.7347915", "0.7347915", "0.733082", "0.73160726", "0.7291633", "0.7268685", "0.72510606", "0.7188799", ...
0.0
-1
Returns the model properties as a dict
def to_dict(self): result = {} for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value if issubclass(Organization, dict): for key, value in self.items(): result[key] = value return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return self.properties", "def to_dict(self):\n return self.properties", "def get_properties(self):\n return self.properties", "def asdict(self):\n return self._prop_dict", "def json(self):\n rv = {\n prop: getattr(self, prop)\n f...
[ "0.7751993", "0.7751993", "0.73391134", "0.7334895", "0.7297356", "0.727818", "0.7159078", "0.71578115", "0.71494967", "0.71494967", "0.71283495", "0.71275014", "0.7122587", "0.71079814", "0.7060394", "0.7043251", "0.7034103", "0.70233124", "0.69635814", "0.69586295", "0.6900...
0.0
-1
Returns the string representation of the model
def to_str(self): return pprint.pformat(self.to_dict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self) -> str:\n # noinspection PyUnresolvedReferences\n opts = self._meta\n if self.name_field:\n result = str(opts.get_field(self.name_field).value_from_object(self))\n else:\n ...
[ "0.85856134", "0.7814518", "0.77898884", "0.7751367", "0.7751367", "0.7712228", "0.76981676", "0.76700574", "0.7651133", "0.7597206", "0.75800353", "0.7568254", "0.7538184", "0.75228703", "0.7515832", "0.7498764", "0.74850684", "0.74850684", "0.7467648", "0.74488163", "0.7442...
0.0
-1
For `print` and `pprint`
def __repr__(self): return self.to_str()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pprint(*args, **kwargs):\n if PRINTING:\n print(*args, **kwargs)", "def print_out():\n pass", "def custom_print(*objects):\n print(*objects, sep=OFS, end=ORS)", "def _print(self, *args):\n return _ida_hexrays.vd_printer_t__print(self, *args)", "def _printable(self):\n ...
[ "0.75577617", "0.73375154", "0.6986672", "0.698475", "0.6944995", "0.692333", "0.6899106", "0.6898902", "0.68146646", "0.6806209", "0.6753795", "0.67497987", "0.6744008", "0.6700308", "0.6691256", "0.6674591", "0.6658083", "0.66091245", "0.6606931", "0.6601862", "0.6563738", ...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Organization): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
find vertex with minimum weight
def find_suitable_vertex(incident_vertexes: List[int], used: Set[int], terms: List[int]) -> Tuple[int, int]: weight, vertex = INF, INF for i in range(len(incident_vertexes)): if incident_vertexes[i] < weight and terms[i] not in used: weight = incident_vertexes[i] vertex = terms[i] return weight, vertex # вес ребра, номер последний вершины - конец ребра
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_min_weight_edge(self, weight, visited):\n minimum = INF\n min_index = None\n for v in range(self.vertices):\n if weight[v] < minimum and not visited[v]:\n minimum = weight[v]\n min_index = v\n return min_index", "def find_min(self, A,...
[ "0.7971822", "0.7408999", "0.7256268", "0.6921469", "0.6910666", "0.686184", "0.6673513", "0.6541637", "0.65068144", "0.6502696", "0.6480919", "0.64556634", "0.6346771", "0.63144493", "0.62669945", "0.62147427", "0.61931205", "0.61720634", "0.6159165", "0.61385703", "0.613195...
0.7048187
3
Assume the value in mu_list is ascending. Assume mu=one is failure
def get_label_from_mu(mu_all, mu_list): mu_list.insert(-1, 1.0) # add one to end; end means lowest reward num_label_level = len(mu_list) label_level_list = np.linspace(1.0, 0.0, num_label_level) # Convert list to dic with key as mu and value as label label_dic = {} for mu, label in zip(mu_list, label_level_list): label_dic[mu] = label # Assign label based on mu label_all = [] for mu in mu_all: label_all += [label_dic[mu]] return label_all
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_good(self, m, n, rank, mu=2, ka=2):\n sr = random.random()\n s = []\n s.append(sr)\n for r in range(rank-1):\n newele = s[-1] * (1 + ka * random.random() / (rank-1))\n s.append(newele)\n s.reverse()\n \n # best_u = None\n # ...
[ "0.6373463", "0.6199289", "0.6165148", "0.6024897", "0.60122585", "0.59807706", "0.5785042", "0.5725333", "0.5695361", "0.5641516", "0.5622558", "0.5540344", "0.55360234", "0.55046725", "0.54993856", "0.5480164", "0.54566556", "0.5363416", "0.535079", "0.53319746", "0.5316501...
0.58873326
6
Use in `__init__()` only; assign all args/kwargs to instance attributes. To maintain precedence of args provided to subclasses, call this in the subclass before `super().__init__()` if `save__init__args()` also appears in base class, or use `overwrite=True`. With `subclass_only==True`, only args/kwargs listed in current subclass apply.
def save__init__args(values, underscore=False, overwrite=False, subclass_only=False): prefix = "_" if underscore else "" self = values['self'] args = list() Classes = type(self).mro() if subclass_only: Classes = Classes[:1] for Cls in Classes: # class inheritances if '__init__' in vars(Cls): args += getfullargspec(Cls.__init__).args[1:] for arg in args: attr = prefix + arg if arg in values and (not hasattr(self, attr) or overwrite): setattr(self, attr, values[arg])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init_subclass__(cls, **kwargs):\n super().__init_subclass__(**kwargs)\n cls.__init__ = _wrap_init(cls.__init__, cls.__post_init_check)", "def kwargs_to_parent(cls):\n original_init = cls.__init__\n\n def new_init(self, *args, **kwargs):\n # pass only those kwargs to the dataclass...
[ "0.6435379", "0.6124592", "0.59995186", "0.5889906", "0.5642248", "0.551526", "0.5499164", "0.5485295", "0.54716355", "0.54716355", "0.5430047", "0.5418889", "0.53908145", "0.53908145", "0.53908145", "0.53908145", "0.53908145", "0.53908145", "0.53908145", "0.53908145", "0.539...
0.7307496
0
Check if the OpenLDAP container is up.
def is_ldap_up(host, port): conn = ldap.initialize(f'ldap://{host}:{port}') conn.simple_bind_s(LDAP_BINDDN, LDAP_SECRET) # The OpenLDAP server is pretty quick to start up but it can still be building the indices # or computing the memberOf property. So check and wait until that's done before we let the # tests proceed, otherwise we get all kinds of crazy errors. # conn.search returns either True or False, depending on if the query succeeded or not. As # long as the query doesn't succeed we're still starting up. res = conn.search_s('dc=planetexpress,dc=com', ldap.SCOPE_BASE, '(objectclass=*)') return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_server_up(self):\n print \"Connecting to Mongo at %s:%s\" % (self.hostname, self.port)\n try:\n # TODO: update this to use new pymongo Client\n self.api = pymongo.Connection(self.hostname, self.port)\n return True\n except (AutoReconnect, ConnectionFa...
[ "0.6554002", "0.646989", "0.642654", "0.64182204", "0.63442534", "0.6322428", "0.6279061", "0.6246154", "0.6180694", "0.6163434", "0.6151141", "0.61259544", "0.6092133", "0.60640645", "0.6042775", "0.60386544", "0.60356444", "0.6010722", "0.59878546", "0.5981053", "0.5968419"...
0.716125
0
The OpenLDAP container to test against.
def openldap(docker_ip, docker_services): host, port = docker_ip, docker_services.port_for('openldap', 389) docker_services.wait_until_responsive( timeout=600, pause=10, check=lambda: is_ldap_up(host, port)) global LDAP_HOST global LDAP_PORT LDAP_HOST = host LDAP_PORT = port return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_container(self):\n pass", "def get_container(self, account, container):\n \n pass", "def test_show_container(self):\n pass", "def app(openldap):\n _app = flask.Flask(__name__)\n _app.config['LDAP_URI'] = f'ldap://{LDAP_HOST}:{LDAP_PORT}'\n _app.config['LDAP_B...
[ "0.61387736", "0.5880962", "0.57707727", "0.55800897", "0.5526084", "0.5511952", "0.54033214", "0.5372437", "0.52986604", "0.5272887", "0.52577835", "0.51881355", "0.51881355", "0.5154575", "0.5133689", "0.5107609", "0.51014864", "0.51009005", "0.51006734", "0.5086614", "0.50...
0.6203799
0
An application for the tests.
def app(openldap): _app = flask.Flask(__name__) _app.config['LDAP_URI'] = f'ldap://{LDAP_HOST}:{LDAP_PORT}' _app.config['LDAP_BINDDN'] = LDAP_BINDDN _app.config['LDAP_SECRET'] = LDAP_SECRET LDAP(_app) ctx = _app.test_request_context() ctx.push() yield _app
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def application():\n yield create_test_application()", "def testapp():\n from space_rocks import main\n app = main({})\n from webtest import TestApp\n return TestApp(app)", "def app() -> Generator:\n app = create_app({\"TESTING\": True})\n\n yield app", "def application(self):\n i...
[ "0.82671756", "0.81794083", "0.80875695", "0.7958443", "0.79312617", "0.77322614", "0.77322614", "0.77322614", "0.77094376", "0.76604795", "0.7629246", "0.7622498", "0.7535449", "0.75292844", "0.7502602", "0.7494712", "0.7456499", "0.7428539", "0.737914", "0.73678696", "0.734...
0.0
-1
Returns the gr_amount without bill between the party and supplier.
def get_gr(supplier_id: int, party_id: int) -> int: # Open a new connection db, cursor = db_connector.cursor() query = "select gr_amount from supplier_party_account where supplier_id = '{}' AND party_id = '{}'".format( supplier_id, party_id) cursor.execute(query) data = cursor.fetchall() db.disconnect() if len(data) == 0: return 0 return int(data[0][0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_usable_gr(supplier_id: int, party_id: int) -> int:\n # Open a new connection\n db, cursor = db_connector.cursor()\n\n query = \"select SUM(settle_amount) from gr_settle where supplier_id = '{}' AND party_id = '{}'\".format(\n supplier_id, party_id)\n cursor.execute(query)\n data = cur...
[ "0.65945584", "0.5881917", "0.5234184", "0.52274364", "0.5213804", "0.5200786", "0.5200704", "0.5107766", "0.501036", "0.49734", "0.49710652", "0.49704546", "0.49508998", "0.4943134", "0.4939742", "0.49362305", "0.4931719", "0.49290752", "0.49084964", "0.4873696", "0.48604906...
0.66093844
0
Gets the usable gr_amount
def get_usable_gr(supplier_id: int, party_id: int) -> int: # Open a new connection db, cursor = db_connector.cursor() query = "select SUM(settle_amount) from gr_settle where supplier_id = '{}' AND party_id = '{}'".format( supplier_id, party_id) cursor.execute(query) data = cursor.fetchall() db.disconnect() if data[0][0] is None: return get_gr(supplier_id, party_id) else: return get_gr(supplier_id, party_id) - int(data[0][0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getamount(self):\n return self.__amount", "def get_gr(supplier_id: int, party_id: int) -> int:\n # Open a new connection\n db, cursor = db_connector.cursor()\n\n query = \"select gr_amount from supplier_party_account where supplier_id = '{}' AND party_id = '{}'\".format(\n supplier_id, par...
[ "0.68214357", "0.68126625", "0.66985095", "0.6473604", "0.6365867", "0.63424534", "0.63424534", "0.6316719", "0.623471", "0.6230868", "0.622357", "0.622357", "0.62221104", "0.61813056", "0.61567175", "0.61359364", "0.6116038", "0.61114824", "0.61012554", "0.60943663", "0.6081...
0.6732322
2
Get the gr_between dates used to settle the account
def get_gr_between_dates(supplier_id: int, party_id: int, start_date: str, end_date: str) -> int: # Open a new connection db, cursor = db_connector.cursor() start_date = str(datetime.datetime.strptime(start_date, "%d/%m/%Y")) end_date = str(datetime.datetime.strptime(end_date, "%d/%m/%Y")) query = "select SUM(settle_amount) from gr_settle where " \ "party_id = '{}' AND supplier_id = '{}' AND " \ "start_date >= '{}' AND end_date <= '{}';".format(party_id, supplier_id, start_date, end_date) cursor.execute(query) data = cursor.fetchall() db.disconnect() if data[0][0] is None or len(data) == 0 or data[0][0] == 0: return -1 return data[0][0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rate_between(self, from_date, to_date):\n print(\"override the above\")", "def date_range(self):\n start_date = input(\"Enter a start date in the format DD/MM/YYYY> \")\n end_date = input(\"Enter an end date in the format DD/MM/YYYY> \")\n return start_date, end_date", "def date...
[ "0.60416496", "0.5759463", "0.56746733", "0.55839163", "0.5545205", "0.55324453", "0.54982615", "0.54696906", "0.54090685", "0.5405709", "0.54010266", "0.5398621", "0.53888017", "0.5384724", "0.53818357", "0.537875", "0.53136253", "0.53007126", "0.5292468", "0.5280808", "0.52...
0.6374636
0
Split off parameter part from path. Returns tuple (pathwithoutparam, param)
def splitparams(path): if '/' in path: i = path.find(';', path.rfind('/')) else: i = path.find(';') if i < 0: return path, '' return path[:i], path[i + 1:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _GetPathParamsFromPath(path: str) -> List[str]:\n path_params = []\n\n components = path.split(\"/\")\n for component in components:\n if _IsPathParameter(component):\n normalized_component = _NormalizePathComponent(component)\n normalized_component = normalized_component[1:-1]\n path_para...
[ "0.674751", "0.6523064", "0.6511854", "0.64421445", "0.641207", "0.6401571", "0.6344312", "0.63051647", "0.62601167", "0.6211556", "0.61409175", "0.61268425", "0.61259776", "0.6124089", "0.6106624", "0.6058917", "0.6055915", "0.6025726", "0.6003291", "0.599609", "0.59699416",...
0.8304237
0
Return regular expression pattern with given host for URL testing.
def safe_host_pattern(host): return "(?i)%s://%s%s(#%s)?" % \ (_safe_scheme_pattern, host, _safe_path_pattern, _safe_fragment_pattern)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url(regex, view):\n return RegexPattern(regex, view)", "def get_hostmask_regex(mask):\n mask = re.escape(mask)\n mask = mask.replace(r'\\*', '.*')\n return re.compile(mask + '$', re.I)", "def _compile_audience_pattern(self, pattern):\n re_pattern = fnmatch.translate(pattern)\n if ...
[ "0.6459515", "0.6248357", "0.5812781", "0.57181805", "0.5674186", "0.56623316", "0.5633071", "0.5583016", "0.55545926", "0.55380994", "0.55205655", "0.5495875", "0.5463588", "0.5458524", "0.5437907", "0.5387938", "0.5373938", "0.5351687", "0.53417546", "0.53417546", "0.534175...
0.7322857
0
Parse a query given as a string argument.
def parse_qsl(qs, keep_blank_values=0, strict_parsing=0): pairs = [] name_value_amp = qs.split('&') for name_value in name_value_amp: if ';' in name_value: pairs.extend([x, ';'] for x in name_value.split(';')) pairs[-1][1] = '&' else: pairs.append([name_value, '&']) pairs[-1][1] = '' r = [] for name_value, sep in pairs: nv = name_value.split('=', 1) if len(nv) != 2: if strict_parsing: raise ValueError("bad query field: %r" % name_value) elif len(nv) == 1: # None value indicates missing equal sign nv = (nv[0], None) else: continue if nv[1] or keep_blank_values: name = urllib.unquote(nv[0].replace('+', ' ')) if nv[1]: value = urllib.unquote(nv[1].replace('+', ' ')) else: value = nv[1] r.append((name, value, sep)) return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_query(query):\n qlist = []\n splitted = query.split(\"&\")\n for entry in splitted:\n cmd, arg = entry.split(\"=\")\n qlist.append((cmd, arg))\n return qlist", "def _parsed_query(self, query_string):\r\n return urlparse(se...
[ "0.6770412", "0.66441345", "0.6639585", "0.6633932", "0.6599556", "0.65507025", "0.6502794", "0.6495754", "0.64781725", "0.63631403", "0.6356323", "0.62238264", "0.62083244", "0.62080956", "0.6205427", "0.6139065", "0.6117859", "0.61134577", "0.6103953", "0.6038121", "0.60208...
0.5299957
71
Encode hostname as internationalized domain name (IDN) according to RFC 3490.
def idna_encode(host): if host and isinstance(host, unicode): try: host.encode('ascii') return host, False except UnicodeError: uhost = host.encode('idna').decode('ascii') return uhost, uhost != host return host, False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def idna_encode(self, domain):\n try:\n if isinstance(domain, str):\n domain = domain.decode('utf-8')\n return domain.encode('idna')\n except UnicodeError:\n return domain", "def _convert_to_idn(url):\n # this function should only be called with a ...
[ "0.67306507", "0.6296275", "0.60186315", "0.5950868", "0.59477776", "0.59150565", "0.5861521", "0.585729", "0.56459177", "0.5601266", "0.55888164", "0.5584511", "0.5578367", "0.5569673", "0.5569479", "0.5557148", "0.55279016", "0.55123955", "0.5506608", "0.5506079", "0.546108...
0.59071285
6
Unquote and fix hostname. Returns is_idn.
def url_fix_host(urlparts): # if not urlparts[1]: # urlparts[2] = urllib.unquote(urlparts[2]) # return False userpass, netloc = urllib.splituser(urlparts[1]) if userpass: userpass = urllib.unquote(userpass) netloc, is_idn = idna_encode(urllib.unquote(netloc).lower()) # a leading backslash in path causes urlsplit() to add the # path components up to the first slash to host # try to find this case... i = netloc.find("\\") if i != -1: # ...and fix it by prepending the misplaced components to the path comps = netloc[i:] # note: still has leading backslash if not urlparts[2] or urlparts[2] == '/': urlparts[2] = comps else: urlparts[2] = "%s%s" % (comps, urllib.unquote(urlparts[2])) netloc = netloc[:i] else: # a leading ? in path causes urlsplit() to add the query to the # host name i = netloc.find("?") if i != -1: netloc, urlparts[3] = netloc.split('?', 1) # path urlparts[2] = urllib.unquote(urlparts[2]) if userpass and userpass != ':': # append AT for easy concatenation userpass += "@" else: userpass = "" if urlparts[0] in default_ports: dport = default_ports[urlparts[0]] host, port = splitport(netloc, port=dport) host = host.rstrip('. ') if port != dport: host = "%s:%d" % (host, port) netloc = host urlparts[1] = userpass + netloc return is_idn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def idna_encode(host):\n if host and isinstance(host, unicode):\n try:\n host.encode('ascii')\n return host, False\n except UnicodeError:\n uhost = host.encode('idna').decode('ascii')\n return uhost, uhost != host\n return host, False", "def test_sa...
[ "0.6449013", "0.6380736", "0.63365686", "0.6324431", "0.61450845", "0.605697", "0.6042931", "0.5928755", "0.589544", "0.58683395", "0.58616215", "0.58118397", "0.5743484", "0.56844443", "0.5675291", "0.56356144", "0.56274545", "0.561817", "0.56118816", "0.5569066", "0.5540591...
0.66974527
0
Fix common typos in given URL like forgotten colon.
def url_fix_common_typos(url): if url.startswith("http//"): url = "http://" + url[6:] elif url.startswith("https//"): url = "https://" + url[7:] return url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_url(cls, url: str):\r\n ...", "def _fix_url(url):\n\n if not url.startswith('http'):\n url = 'http://' + url\n\n return url", "def correct_url(self, url: str) -> str:\n # check if url has \"http://\" prefix\n if \"http://\" not in url:\n if \"https://\" not ...
[ "0.770113", "0.73291516", "0.68543786", "0.6504218", "0.64858186", "0.6459376", "0.6437735", "0.63930553", "0.6289801", "0.6263048", "0.6251412", "0.62297577", "0.62242717", "0.613285", "0.61042875", "0.60988045", "0.60984194", "0.6093388", "0.606762", "0.60473937", "0.603849...
0.7982654
0
Split query part of mailto url if found.
def url_fix_mailto_urlsplit(urlparts): if "?" in urlparts[2]: urlparts[2], urlparts[3] = urlparts[2].split('?', 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _urlparse_splitquery(url):\r\n\r\n qpart = url.split(\"?\", 1)\r\n if len(qpart) == 2:\r\n query = qpart[1]\r\n else:\r\n query = \"\"\r\n\r\n return qpart[0], query", "def test_split_url_for_query_1(self):\n url = \"testurl.com\"\n\n output = split_url_for_query(url)\n\n self....
[ "0.67279136", "0.6404292", "0.6209104", "0.61731404", "0.6047626", "0.5870148", "0.5843502", "0.56338006", "0.55826217", "0.55750227", "0.5401481", "0.5397454", "0.5378606", "0.5351534", "0.53454334", "0.5219765", "0.5213521", "0.5209964", "0.5108182", "0.5093666", "0.5083529...
0.7407154
0
Parse and rejoin the given CGI query.
def url_parse_query(query, encoding=None): if isinstance(query, unicode): if encoding is None: encoding = url_encoding query = query.encode(encoding, 'ignore') query = query.replace('?', '') l = set() for k, v, sep in parse_qsl(query, True): k = url_quote_part(k, '/-:,;') if not k: continue if v: v = url_quote_part(v, '/-:,;') l.add("%s=%s" % (k, v)) elif v is None: l.add("%s" % k) else: # some sites do not work when the equal sign is missing l.add("%s=" % k) query = '&'.join(sorted(l)) return query
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_query(request):\n\n querystring = request.uri['query']\n fp = StringIO(querystring)\n\n headers = {}\n headers['content-type'] = request.message.get('content-type')\n headers['content-length'] = request.message.get('content-length')\n\n environ = {}\n environ['REQUEST_METHOD'] = requ...
[ "0.6525811", "0.57684", "0.5745191", "0.56635463", "0.560149", "0.5542734", "0.55224484", "0.54659873", "0.544222", "0.5429328", "0.5382041", "0.5341693", "0.5314705", "0.53040624", "0.5260107", "0.5229328", "0.5132951", "0.5106477", "0.5103963", "0.50939167", "0.5092407", ...
0.55001813
7
Same as urlparse.urlunsplit but with extra UNC path handling for Windows OS.
def urlunsplit(urlparts): res = urlparse.urlunsplit(urlparts) if os.name == 'nt' and urlparts[0] == 'file' and '|' not in urlparts[2]: # UNC paths must have 4 slashes: 'file:////server/path' # Depending on the path in urlparts[2], urlparse.urlunsplit() # left only two or three slashes. This is fixed below repl = 'file://' if urlparts[2].startswith('//') else 'file:/' res = res.replace('file:', repl) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urlparse(url):\n\tunquote_url=urllib.parse.unquote(url)\n\treturn unquote_url", "def _split_url(url):\n return url[1:].split('/')", "def split(path):\r\n if path.lower().startswith(\"smb://\"):\r\n if '/' not in path[6:]:\r\n path = path.replace(\"smb://\", \"smb:///\", 1)\r\n ...
[ "0.6627455", "0.65837115", "0.64844257", "0.64534926", "0.62631977", "0.6174686", "0.6172689", "0.6165752", "0.61646414", "0.61592484", "0.61030483", "0.610288", "0.60629", "0.6021757", "0.601455", "0.59292614", "0.5918131", "0.5909229", "0.58973026", "0.58960414", "0.5895975...
0.851646
0
Normalize the given URL which must be quoted. Supports unicode hostnames (IDNA encoding) according to RFC 3490.
def url_norm(url, encoding=None, strip=False, lowercase_path=False, remove_fragment=False): if strip: url = url.strip() if isinstance(url, unicode): # try to decode the URL to ascii since urllib.unquote() # handles non-unicode strings differently try: url = url.encode('ascii') except UnicodeEncodeError: pass encode_unicode = True else: encode_unicode = False urlparts = list(urlparse.urlsplit(url)) #fix missing scheme if not urlparts[0] or not urlparts[1]: urlparts = list(fix_missing_scheme(url, urlparts)) elif urlparts[0] not in default_scheme_for_port: # Todo: find the scheme with the min edit distance pass # scheme if not http_scheme_pattern.match(urlparts[0]): raise InvalidUrl(url) urlparts[0] = urllib.unquote(urlparts[0]).lower() # host (with path or query side effects) is_idn = url_fix_host(urlparts) # query urlparts[3] = url_parse_query(urlparts[3], encoding=encoding) if urlparts[0] in urlparse.uses_relative: # URL has a hierarchical path we should norm if not urlparts[2]: # Empty path is allowed if both query and fragment are also empty. # Note that in relative links, urlparts[0] might be empty. # In this case, do not make any assumptions. if urlparts[0] and (urlparts[3] or urlparts[4]): urlparts[2] = '/' else: # fix redundant path parts urlparts[2] = collapse_segments(urlparts[2]) if not remove_fragment: # anchor urlparts[4] = urllib.unquote(urlparts[4]) # quote parts again urlparts[0] = url_quote_part(urlparts[0], encoding=encoding) # scheme urlparts[1] = url_quote_part(urlparts[1], safechars='@:', encoding=encoding) # host urlparts[2] = url_quote_part(urlparts[2], safechars=_nopathquote_chars, encoding=encoding) # path if lowercase_path: urlparts[2] = urlparts[2].lower() if remove_fragment: urlparts[4] = '' else: urlparts[4] = url_quote_part(urlparts[4], encoding=encoding) # anchor if not urlparts[2]: urlparts[2] = '/' res = urlunsplit(urlparts) if encode_unicode: res = unicode(res) return res, is_idn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_url(url):\r\n s = url\r\n url = url.encode('utf8')\r\n url = ''.join([urllib.quote(c) if ord(c) >= 127 else c for c in url])\r\n return url", "def normalize_url(self, url):\n pass", "def normalize_url(url):\n # print(url)\n if not url.startswith('http://') and not url...
[ "0.7231952", "0.71399534", "0.7058466", "0.7057212", "0.70551896", "0.70489985", "0.6984675", "0.68768114", "0.6773047", "0.66777515", "0.66775155", "0.66144353", "0.65716875", "0.65457124", "0.65359807", "0.6512017", "0.65024763", "0.6485514", "0.6482304", "0.64756083", "0.6...
0.6782342
8
Remove all redundant segments from the given URL path.
def collapse_segments(path): # replace backslashes # note: this is _against_ the specification (which would require # backslashes to be left alone, and finally quoted with '%5C') # But replacing has several positive effects: # - Prevents path attacks on Windows systems (using \.. parent refs) # - Fixes bad URLs where users used backslashes instead of slashes. # This is a far more probable case than users having an intentional # backslash in the path name. if path.startswith('\\'): path = path.replace('\\', '/') # shrink multiple slashes to one slash path = _slashes_ro.sub("/", path) # collapse redundant path segments path = _thisdir_ro.sub("", path) path = _samedir_ro.sub("/", path) # collapse parent path segments # note: here we exploit the fact that the replacements happen # to be from left to right (see also _parentdir_ro above) newpath = _parentdir_ro.sub("/", path) while newpath != path: path = newpath newpath = _parentdir_ro.sub("/", path) # collapse parent path segments of relative paths # (ie. without leading slash) newpath = _relparentdir_ro.sub("", path) while newpath != path: path = newpath newpath = _relparentdir_ro.sub("", path) path = path.rstrip('.') return path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_path(path):\n return [endpoint for endpoint in path if len(endpoint) > 23]", "def _path_parts(path):\n # clean it up. this removes duplicate '/' characters and any that may\n # exist at the front or end of the path.\n return [pp for pp in path.split(\"/\") if pp]", "def _cleanup_path(...
[ "0.6450385", "0.6239961", "0.5978938", "0.59626806", "0.5718302", "0.569636", "0.56911194", "0.56904846", "0.5625951", "0.55506724", "0.5532755", "0.54659814", "0.54363185", "0.54363185", "0.5388287", "0.53852487", "0.53558075", "0.5342201", "0.53362674", "0.5325359", "0.5310...
0.5898762
4
Wrap urllib.quote() to support unicode strings. A unicode string is first converted to UTF8. After that urllib.quote() is called.
def url_quote_part(s, safechars='/', encoding=None): if isinstance(s, unicode): if encoding is None: encoding = url_encoding s = s.encode(encoding, 'ignore') return urllib.quote(s, safechars)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unicode_quote(value):\n return quote(value.encode('utf-8'))", "def unicode_quote(s):\n if isinstance(s, unicode):\n return quote(s.encode(\"utf-8\"))\n else:\n return quote(str(s))", "def _quote(src, encoding=\"utf-8\"):\n if isinstance(src, unicode):\n src = src.encode(enc...
[ "0.756562", "0.7546129", "0.7493154", "0.7138185", "0.6648861", "0.6499509", "0.6496231", "0.6401295", "0.63460577", "0.6345967", "0.6233761", "0.622644", "0.62058586", "0.6182652", "0.6180141", "0.6175421", "0.6170337", "0.6098198", "0.6041469", "0.6020512", "0.6014165", "...
0.64992213
6
Return True if host part of url matches an entry in given domain list.
def match_url(url, domainlist): if not url: return False return match_host(url_split(url)[1], domainlist)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_host(host, domainlist):\n if not host:\n return False\n for domain in domainlist:\n if domain.startswith('.'):\n if host.endswith(domain):\n return True\n elif host == domain:\n return True\n return False", "def matches(self, url):\n ...
[ "0.8105381", "0.7370516", "0.7126605", "0.6921519", "0.6796388", "0.6785669", "0.67464596", "0.6718634", "0.6564882", "0.654149", "0.6427154", "0.636126", "0.6316495", "0.6279034", "0.62371093", "0.62335455", "0.62335455", "0.6123072", "0.6119781", "0.60940176", "0.6078012", ...
0.83841044
0
Return True if host matches an entry in given domain list.
def match_host(host, domainlist): if not host: return False for domain in domainlist: if domain.startswith('.'): if host.endswith(domain): return True elif host == domain: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_url(url, domainlist):\n if not url:\n return False\n return match_host(url_split(url)[1], domainlist)", "def matches_hostname(self, hostname):\n return hostname in self.hostnames", "def domain_in_ip_whois_match(self, domain, ip):\n try:\n domain_ip_desc = self.ge...
[ "0.718514", "0.7060217", "0.69207466", "0.6798229", "0.6687461", "0.6494838", "0.6165921", "0.61154306", "0.6060035", "0.6051432", "0.6046193", "0.60253114", "0.5941196", "0.59102017", "0.5872509", "0.5855687", "0.5823825", "0.5729784", "0.5715016", "0.5689225", "0.5683604", ...
0.83065116
0
Check if url needs percent quoting. Note that the method does only check basic character sets, and not any other syntax. The URL might still be syntactically incorrect even when it is properly quoted.
def url_needs_quoting(url): if url.rstrip() != url: # handle trailing whitespace as a special case # since '$' matches immediately before a end-of-line return True return not _safe_url_chars_ro.match(url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unreserved_percentencoding():\n assert (normalize_url(\"http://www.example.com/%7Eusername/\") ==\n \"http://www.example.com/~username\")\n assert (normalize_url('http://example.com/foo%23bar') ==\n 'http://example.com/foo%23bar')\n assert (normalize_url('http://example.com/...
[ "0.7206755", "0.7197858", "0.70679295", "0.6783549", "0.66798353", "0.6624512", "0.65184194", "0.6379363", "0.6148199", "0.60375714", "0.59809166", "0.596141", "0.59491706", "0.59333074", "0.59282386", "0.5914704", "0.5908903", "0.5879197", "0.58755445", "0.58680904", "0.5833...
0.7765809
0
Split url in a tuple (scheme, hostname, port, document) where hostname is always lowercased.
def url_split(url): scheme, netloc = urllib.splittype(url) host, document = urllib.splithost(netloc) port = default_ports.get(scheme, 0) if host: host = host.lower() host, port = splitport(host, port=port) return scheme, host, port, document
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _urlparse_splitscheme(url):\r\n # The scheme is valid only if it contains these characters.\r\n scheme_chars = \\\r\n \"abcdefghijklmnopqrstuvwxyz0123456789+-.\"\r\n\r\n scheme = \"\"\r\n rest = url\r\n\r\n spart = url.split(\":\", 1)\r\n if len(spart) == 2:\r\n\r\n # Normalize the scheme.\r\n s...
[ "0.76368946", "0.7406988", "0.730206", "0.7067206", "0.6825835", "0.6800534", "0.6762756", "0.6522388", "0.65156657", "0.6501163", "0.64795834", "0.6466989", "0.64476293", "0.6421604", "0.64123183", "0.6403636", "0.63985515", "0.63941145", "0.6280987", "0.6277661", "0.6268658...
0.8727553
0
Rejoin URL parts to a string.
def url_unsplit(parts): if parts[2] == default_ports.get(parts[0]): return "%s://%s%s" % (parts[0], parts[1], parts[3]) return "%s://%s:%d%s" % parts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _url_join(self, *parts):\n return \"/\".join(map(lambda fragment: fragment.rstrip('/'), parts))", "def url_join(*parts):\n parts = parts or [\"\"]\n clean_parts = [part.strip(\"/\") for part in parts if part]\n if not parts[-1]:\n # Empty last element should add a trailing slash\n ...
[ "0.789799", "0.76372606", "0.7635184", "0.7324334", "0.7313276", "0.72960657", "0.72905284", "0.7280653", "0.72795635", "0.72734", "0.7244201", "0.7212807", "0.7209664", "0.7034434", "0.6943335", "0.69341743", "0.68809646", "0.6825387", "0.6815612", "0.6801993", "0.6796151", ...
0.6047936
40
Split optional port number from host. If host has no port number, the given default port is returned.
def splitport(host, port=0): if ":" in host: shost, sport = host.split(":", 1) iport = is_numeric_port(sport) if iport: host, port = shost, iport elif not sport: # empty port, ie. the host was "hostname:" host = shost else: # For an invalid non-empty port leave the host name as is pass return host, port
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_host_port(hostport):\n if hostport is None:\n return (None, None)\n formatted_host = __host_per_rfc_2732(hostport)\n # The \"bogus\" is to make it look like a real, parseable URL.\n parsed = urlparse(\"bogus://%s\" % (formatted_host)) \n return (None if parsed.hostname == \"non...
[ "0.7247916", "0.6927607", "0.67452", "0.67267126", "0.65689474", "0.6426588", "0.621696", "0.6187966", "0.6167272", "0.61081445", "0.60974115", "0.6052857", "0.60080606", "0.5999279", "0.59521306", "0.59521306", "0.59521306", "0.59521306", "0.5936923", "0.5901868", "0.5845402...
0.806005
0
Remove anchor part and trailing index.html from URL.
def shorten_duplicate_content_url(url): if '#' in url: url = url.split('#', 1)[0] if url.endswith('index.html'): return url[:-10] if url.endswith('index.htm'): return url[:-9] return url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanUrl(url):\n\turl_clean = url.replace(' ','%20')\n\t\"\"\" add /index.html where necessary \"\"\"\n\tif (url[-1:]=='/'):\n\t\turl_clean += 'index.html'\n\telif (url[-5:].find('.') == -1):\n\t\t url_clean += '/index.html'\n\treturn url_clean", "def make_clean_url(url):\n return urlparse.urldefrag(url)[...
[ "0.7404366", "0.62768435", "0.61985534", "0.60928565", "0.6062319", "0.606141", "0.60366935", "0.60153073", "0.59648734", "0.5918957", "0.58407116", "0.58144933", "0.57838774", "0.5777596", "0.57617307", "0.57545966", "0.5725759", "0.5723972", "0.5707598", "0.5680764", "0.565...
0.6469476
1
Check if both URLs are allowed to point to the same content.
def is_duplicate_content_url(url1, url2): if url1 == url2: return True if url2 in url1: url1 = shorten_duplicate_content_url(url1) if not url2.endswith('/') and url1.endswith('/'): url2 += '/' return url1 == url2 if url1 in url2: url2 = shorten_duplicate_content_url(url2) if not url1.endswith('/') and url2.endswith('/'): url1 += '/' return url1 == url2 return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urlEqual(url_1, url_2):\n parse_result_1 = urlparse(url_1)\n parse_result_2 = urlparse(url_2)\n\n return (parse_result_1[:4] == parse_result_2[:4] and\n parse_qs(parse_result_1[5]) == parse_qs(parse_result_2[5]))", "def same_origin(url1, url2):\n p1, p2 = urlparse.urlparse(url1), urlpa...
[ "0.71224326", "0.6801178", "0.64278007", "0.637694", "0.63402057", "0.63119143", "0.6286929", "0.62371063", "0.61779445", "0.61676055", "0.6156955", "0.6119644", "0.6043208", "0.60181797", "0.6006415", "0.599031", "0.5972156", "0.59510684", "0.59472144", "0.5881061", "0.58000...
0.7777119
0
Get all pictures for a user.
def get(self): parser = reqparse.RequestParser() parser.add_argument("user_id", type=int, location="args", required=True) args = parser.parse_args() try: #get user from database user = User.query.filter(User.id==args.user_id).first() if not user: return Response(status=404, message="User not found.").__dict__,404 return Response(status=200, message="Pictures found.", value=[p.dict_repr() for p in user.pictures.all()])\ .__dict__, 200 except Exception as e: app.logger.error(e) return Response(status=500, message="Internal server error.").__dict__,500
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_images_for_user(username):\n\n user = get_user_by_username(username)\n return user.images", "def photos_by_user(user_id):\n photos = Photo.query.filter(Photo.user_id == user_id).all()\n return photos", "def get_photos(self, user_id):\n\n json_photos = self._receive_photos_from_vk...
[ "0.82408994", "0.7924064", "0.7504495", "0.74764735", "0.73077625", "0.7238596", "0.7227505", "0.7195243", "0.7164508", "0.68571115", "0.68380666", "0.682172", "0.67821753", "0.6758035", "0.6673719", "0.66615057", "0.66207945", "0.6405108", "0.62852436", "0.62733775", "0.6262...
0.6921353
9
Test case for get_list
def test_get_list(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_listtem_using_get(self):\n pass", "def test_list(self):\n pass", "def test_list(self):\n pass", "def test_get_list8(self):\n pass", "def get_list(self, *args, **kwargs):\n pass", "def get_list(self, *args, **kwargs):\n pass", "def test_get_direct_acces...
[ "0.81973624", "0.8002237", "0.8002237", "0.7820368", "0.7754413", "0.7754413", "0.7502839", "0.7356105", "0.7302355", "0.7302355", "0.7302355", "0.72928464", "0.7265907", "0.7265907", "0.72070205", "0.7167211", "0.7133098", "0.7123853", "0.70505875", "0.70505875", "0.70437384...
0.90654755
0
Test case for get_machine_translate_settings_for_project_template
def test_get_machine_translate_settings_for_project_template(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_mt_settings(self):\n pass", "def test_get_translation_resources(self):\n pass", "def test_settings(self):\n \n self.assertTrue(settings.USE_I18N, msg=\"setting USE_I18N must be True to have languages working\")", "def test_supported_translations_retrieval(self):\n\t\t...
[ "0.6423906", "0.6117541", "0.60545284", "0.5706983", "0.56479394", "0.5599774", "0.5585604", "0.55680823", "0.5561398", "0.55571604", "0.5517412", "0.54765046", "0.54490405", "0.54315364", "0.5409706", "0.53768295", "0.5358784", "0.5356838", "0.53433293", "0.5304261", "0.5282...
0.957297
0
Test case for get_mt_settings
def test_get_mt_settings(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def settings():\n return SettingsMock.instance()", "def settings():\n return _get_settings()[1]", "def test_act_on_settings(self):\n pass # TODO(tlarsen)", "def test_act_on_settings(self):\n pass # TODO(tlarsen)", "def test_get_property_success(self):\r\n self.assertEqual(self.co...
[ "0.65869504", "0.6371646", "0.6219875", "0.6219875", "0.61787194", "0.61251485", "0.60651237", "0.6051131", "0.60047513", "0.5982245", "0.5963559", "0.59536403", "0.5907354", "0.59069467", "0.58953136", "0.5894668", "0.5894059", "0.5894059", "0.58797795", "0.5873697", "0.5863...
0.9280966
0