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
Geocode the addresses and build an address table
def build_addresses(self): from ambry.geo.geocoders import DstkGeocoder facilities = self.partitions.find(table='facilities') def address_gen(): for row in facilities.query("SELECT * FROM facilities"): address = "{}, {}, {} {}".format(row['dba_address1'], r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geolocate_address(self):\n self.geolocator = Nominatim(user_agent=\"fundaft\")\n\n # If latitude / longitude are missing, try to geocode them on the basis\n # of the address \n self.coords = [self.get_coords(address) if np.isnan(lat)\n else (lat, lon) for address...
[ "0.69380814", "0.63339984", "0.61368567", "0.60685796", "0.6055097", "0.6045649", "0.60010093", "0.5977058", "0.5975706", "0.59695", "0.59433144", "0.5934059", "0.5919156", "0.5903649", "0.5892241", "0.5878959", "0.5866598", "0.5815604", "0.5803367", "0.57603157", "0.5752638"...
0.74458176
0
Build the facilities_blockgroups crosswalk file to assign facilities to blockgroups.
def build_block_cross(self): from ambry.geo.util import find_geo_containment, find_containment from geoid import civick lr = self.init_log_rate(3000) def gen_bound(): boundaries = self.library.dep('blockgroups').partition # Note, ogc_fid is the pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_output_block_groups():\n for dept in Department.list():\n yield {\n 'name': dept.name,\n 'file_dep': [dept.block_groups_path],\n 'targets': [dept.block_groups_output],\n 'actions': ['cp %(dependencies)s %(targets)s'],\n 'clean': True,\n ...
[ "0.56382924", "0.520446", "0.51788396", "0.51779836", "0.5162532", "0.5090228", "0.50537544", "0.5002893", "0.49870488", "0.4973123", "0.49609685", "0.49350616", "0.49249336", "0.49217957", "0.49188414", "0.49178317", "0.49041072", "0.4886093", "0.4883396", "0.48815715", "0.4...
0.64450157
0
Reduce the other tables into an index file.
def build_index(self): geoids = self.partitions.find_or_new(table='facilities_geoids') addresses = self.partitions.find_or_new(table='facilities_addresses') facilities = self.partitions.find(table='facilities') facilities.attach(addresses,'addresses') f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_main_index(self):\n\n for miEntry in self.mainIndex:\n self.db_file.write(miEntry.get_representation())", "def rebuild_index():\n print('Building indexes...')\n print(data_fldr)\n ndx = []\n for root, _, files in os.walk(data_fldr):\n for f in files:\n if...
[ "0.6912929", "0.6577959", "0.6545943", "0.6352996", "0.63359225", "0.63046604", "0.6291554", "0.61112195", "0.5960785", "0.5952407", "0.5822844", "0.58169097", "0.5808023", "0.5807799", "0.5798762", "0.5763611", "0.57315314", "0.57153785", "0.5706715", "0.56997806", "0.568499...
0.5537276
31
A simple test of optimal surface track planning.
def get_problem(): #User Defined Terrain Elevation #def terr( x_pos, y_pos ): #Defines terrain elevation [m] as a function of x and y positions [m] # elev=100.0*(np.sin(0.5*(x_pos/1000.0)))**2.0 #User defined elevation map # return elev #User Defined Tunnel Cost #def tunnel(depth...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_test_case(radio, lines):\n calc_reachable_surface_and_people(radio, lines)", "def test_near_surface_consistency():\n bead_diameter = 0.5\n shared_pars = {\n \"bead_diameter\": bead_diameter,\n \"viscosity\": 1.1e-3,\n \"temperature\": 25,\n \"rho_sample\": 997.0,\n ...
[ "0.6245726", "0.60930556", "0.6059802", "0.6037508", "0.5950827", "0.5878456", "0.58778876", "0.5790422", "0.57015586", "0.56652015", "0.56494457", "0.56464714", "0.5607968", "0.56062734", "0.5596145", "0.5572339", "0.5570861", "0.5561573", "0.55565536", "0.5544901", "0.55263...
0.604783
3
Save the output of a page.
def save_page_as(browser, file_name): with open(file_name, "w") as fout: fout.write(browser.find_element_by_tag_name("pre").text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, url, output):\n\n shutil.copy2(self.get(url), output)", "def save(self):\n\n self.image.save(\"./output/\" + self.name + \" pg\" + str(self._page) + \".png\")", "def save(self):\n html_file = '{}/{}.html'.format(self.web_dir, self.title)\n f = open(html_file, 'wt')\n ...
[ "0.66293526", "0.6609784", "0.6572552", "0.6560706", "0.65367365", "0.65367365", "0.6536091", "0.6527938", "0.64825183", "0.64825183", "0.6482113", "0.6425487", "0.6413646", "0.63316184", "0.6321284", "0.62754583", "0.6204742", "0.6138787", "0.61341715", "0.6049299", "0.60304...
0.6551325
4
This will run through all of the web interface using selenium. The input should be a pdb_file full path. It will download the wrappers/bonds as PDB_NAME_wrappers.txt and PDB_NAME_bonds.txt.
def run_wrappa(browser, pdb_file): # Wrappa has 3 MB limit if os.path.getsize(pdb_file) > 3000000: logging.warn("%s is too large (size is %d), skipping", pdb_file, os.path.getsize(pdb_file)) return False if os.path.isfile(pdb_file[:-4] + "_bonds.txt"): logging.warn("%s has already b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dl_pdb(url_dom, pdb_id, dom_sid):\n good_url = re.sub(r'(output=html)', 'output=txt', url_dom)\n\n print(\"Dowloading the good domain of \" + pdb_id + \".pdb from the SCOP \" +\n \"website...\")\n urlreq.urlretrieve(good_url, \"data/\" + dom_sid + '.pdb')\n print(\"Download finished !\\n\"...
[ "0.59274244", "0.56355226", "0.536841", "0.53651416", "0.53063196", "0.5264013", "0.51971424", "0.5158493", "0.515513", "0.5132952", "0.50971687", "0.50108147", "0.49585226", "0.49400154", "0.49312222", "0.49199107", "0.4919623", "0.48803052", "0.48767388", "0.48723873", "0.4...
0.67259806
0
Process an entire directory.
def process_directory(browser, directory): count = 0 for pdb in find_pdb_files(directory): if run_wrappa(browser, pdb): logging.info("Processed %s", pdb) count += 1 logging.info("Fully processed %d pdb files", count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_directory(dir, exiftool_path):\n for path_object in pathlib.Path(dir).glob(\"**/*\"):\n if path_object.is_file():\n verbose(f\"Processing file {path_object}\")\n process_file(path_object, exiftool_path)\n elif path_object.is_dir():\n verbose(f\"Processi...
[ "0.74806327", "0.69765097", "0.6911258", "0.68828917", "0.6699814", "0.6596943", "0.6446851", "0.64204353", "0.6374668", "0.6371428", "0.635032", "0.6334338", "0.6243484", "0.62296623", "0.62202525", "0.6153718", "0.6110154", "0.608197", "0.604784", "0.6047755", "0.601703", ...
0.6256297
12
Initialize the browser and logging
def initialize(): logging.basicConfig(level=logging.INFO) browser = webdriver.Firefox() browser.get("http://www.wrappa.org/") browser.find_element_by_name("termsAccepted").click() browser.find_element_by_name("termsAccepted").submit() return browser
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_browser(self):\n try:\n (_, vc) = kerberos.authGSSClientInit(\"HTTP@login.cern.ch\")\n kerberos.authGSSClientStep(vc, \"\")\n token = kerberos.authGSSClientResponse(vc)\n\n headers = {'Authorization': 'Negotiate ' + token}\n\n ...
[ "0.7013459", "0.6830828", "0.6612664", "0.65255183", "0.6481511", "0.64625454", "0.64242846", "0.64142096", "0.6391442", "0.637468", "0.6351662", "0.62974656", "0.6258856", "0.62359196", "0.6218822", "0.6189709", "0.6141654", "0.6133717", "0.61203575", "0.61070716", "0.608114...
0.6619295
2
Run the main functionality of this script.
def main(): browser = initialize() process_directory(browser, "data") browser.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run():\n main()", "def run_script(self):\n pass", "def main(self) -> None:\n pass", "def main():\n pass", "def test_script(self) -> None:\n main()", "def main():\n print(\"It works!!! ;-)\")\n ###TODO### do something with the various methods/functions of this file...
[ "0.7874369", "0.76656425", "0.76504254", "0.76126516", "0.75893056", "0.7542043", "0.74852145", "0.7463449", "0.74556905", "0.7413074", "0.7359027", "0.73464495", "0.7322997", "0.7322997", "0.7240368", "0.7223227", "0.72157013", "0.7199882", "0.7174716", "0.7174716", "0.71747...
0.0
-1
Generic function to take write .rst files and convert to pdf/html. Accepts a report template and dictionary. Writes rst once with full paths for image files and generates a pdf, then strips leading path components and writes again, generating an html file that exepects to live in the same directory as report images.
def write_workflow_report(workflow_name, report_template, report_dict): from os.path import exists, basename from subprocess import check_output # Plug the values into the template for the pdf file report_rst_text = report_template % report_dict # Write the rst file and convert to pdf report_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_report(template_filename, report_title, report_dir):\n\n def inner(output_dir: Optional[str] = None):\n output_dir = output_dir or report_dir\n with open(template_filename) as fd:\n template = jinja2.Template(fd.read())\n\n template.globals.update(\n {\"da...
[ "0.61397487", "0.5963483", "0.5911825", "0.58263385", "0.57665575", "0.5704803", "0.56863654", "0.56828785", "0.5679785", "0.5642886", "0.55997115", "0.5599295", "0.55712205", "0.5511724", "0.5507876", "0.5451432", "0.54270923", "0.534096", "0.53085405", "0.53046376", "0.5291...
0.7019554
0
Returns a tuple (ss, os, se) such that self == ss 2se and other = os 2se.
def _align(self, other): ss, se = self.sig, self.exp if isinstance(other, BigFloat): os, oe = other.sig, other.exp else: os, oe = other, 0 if ss == 0.: se = oe elif os == 0.: pass elif se > oe: os = math.ldexp(o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _s2(self):\n return (self.t2, self.q2, self.p2)", "def crossOver(self, _other):\n # find the mid-point\n pivot = len(self.genes) / 2\n # swap the values around the mid-point\n newChrom1 = self.genes[0:pivot] + _other.genes[pivot:len(_other.genes)]\n newChrom2 = _othe...
[ "0.6395726", "0.58184373", "0.5734322", "0.5717132", "0.5638304", "0.5572401", "0.553687", "0.54646516", "0.5444255", "0.54324365", "0.5390148", "0.53857905", "0.5369056", "0.53504604", "0.53241765", "0.5317845", "0.5306058", "0.5298514", "0.52790314", "0.5249261", "0.5229869...
0.5469189
7
S.feed(handle, consumer) Feed in a BLAST report for scanning. handle is a filelike object that contains the BLAST report. consumer is a Consumer object that will receive events as the report is scanned.
def feed(self, handle, consumer): if isinstance(handle, File.UndoHandle): uhandle = handle else: uhandle = File.UndoHandle(handle) # Try to fast-forward to the beginning of the blast report. read_and_call_until(uhandle, consumer.noevent, contains='BLAST') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feed(self, handle, consumer, do_features=...): # -> bool:\n ...", "def handle_feed(\n actapi: act.api.Act,\n user_agent: Text,\n proxies: Optional[Dict[Text, Text]] = None,\n verify_ssl: bool = True,\n output_format: Text = \"json\",\n) -> None:\n\n feed = download_feed(user_agent, p...
[ "0.63534445", "0.5767998", "0.5734903", "0.5599733", "0.54569304", "0.5154365", "0.5127441", "0.50028217", "0.49828988", "0.4976283", "0.49430162", "0.4887362", "0.4875427", "0.4865234", "0.4799642", "0.47539532", "0.4745771", "0.47228912", "0.4705688", "0.46607345", "0.46272...
0.79035497
0
__init__(self, handle, parser=None) Create a new iterator. handle is a filelike object. parser is an optional Parser object to change the results into another form. If set to None, then the raw contents of the file will be returned.
def __init__(self, handle, parser=None): try: handle.readline except AttributeError: raise ValueError( "I expected a file handle or file-like object, got %s" % type(handle)) self._uhandle = File.UndoHandle(handle) self._parser = par...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, filename_or_filelike, parsers, infinite=False):\r\n self._buffer = Buffer(filename_or_filelike, infinite)\r\n self._head = None\r\n self._tail = []\r\n self._infinite = infinite\r\n self._parsers = parsers", "def parse(handle):\n while True:\n record = __read(handle)\n...
[ "0.660054", "0.64937556", "0.64242435", "0.62476397", "0.6212507", "0.61535454", "0.61245406", "0.6013856", "0.60070837", "0.5989043", "0.59788716", "0.59192413", "0.5907069", "0.59050333", "0.5888246", "0.5883761", "0.5880786", "0.587317", "0.5855551", "0.58549863", "0.58399...
0.6423827
3
next(self) > object Return the next Blast record from the file. If no more records, return None.
def next(self): lines = [] query = False while 1: line = self._uhandle.readline() if not line: break # If I've reached the next one, then put the line back and stop. if lines and (line.startswith('BLAST') o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _next(self, filename):\n try:\n return self.tmp_read[filename]['reader'].__next__()\n except StopIteration:\n return None", "def __next__(self):\n try:\n next_record = next(self.records)\n self.all_records.append(next_record)\n retur...
[ "0.69588554", "0.6904435", "0.6851931", "0.66342896", "0.652028", "0.64878345", "0.6429976", "0.6358846", "0.62886494", "0.62753236", "0.62223315", "0.62091005", "0.62091005", "0.6207237", "0.61904114", "0.6156381", "0.6149515", "0.6137225", "0.6125767", "0.61171055", "0.6112...
0.73920125
0
Execute and retrieve data from standalone BLASTPALL as handles (OBSOLETE). NOTE This function is obsolete, you are encouraged to the command line wrapper Bio.Blast.Applications.BlastallCommandline instead. Execute and retrieve data from blastall. blastcmd is the command used to launch the 'blastall' executable. program...
def blastall(blastcmd, program, database, infile, align_view='7', **keywds): _security_check_parameters(keywds) att2param = { 'matrix' : '-M', 'gap_open' : '-G', 'gap_extend' : '-E', 'nuc_match' : '-r', 'nuc_mismatch' : '-q', 'query_genetic_code' : '-Q', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rpsblast(blastcmd, database, infile, align_view=\"7\", **keywds):\n\n import warnings\n warnings.warn(\"This function is obsolete, you are encouraged to the command line wrapper Bio.Blast.Applications.BlastrpsCommandline instead.\", PendingDeprecationWarning)\n _security_check_parameters(keywds)\n ...
[ "0.6584838", "0.6572283", "0.650212", "0.6392259", "0.61772364", "0.6139482", "0.6132713", "0.6076423", "0.59617484", "0.58901364", "0.5859545", "0.5780147", "0.5600362", "0.5597818", "0.5547912", "0.54921067", "0.54734504", "0.54669", "0.5431532", "0.5394897", "0.5355753", ...
0.7728994
0
Execute and retrieve data from standalone BLASTPGP as handles (OBSOLETE). NOTE This function is obsolete, you are encouraged to the command line wrapper Bio.Blast.Applications.BlastpgpCommandline instead. Execute and retrieve data from blastpgp. blastcmd is the command used to launch the 'blastpgp' executable. database...
def blastpgp(blastcmd, database, infile, align_view='7', **keywds): import warnings warnings.warn("This function is obsolete, you are encouraged to the command line wrapper Bio.Blast.Applications.BlastpgpCommandline instead.", PendingDeprecationWarning) _security_check_parameters(keywds) att2param = {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rpsblast(blastcmd, database, infile, align_view=\"7\", **keywds):\n\n import warnings\n warnings.warn(\"This function is obsolete, you are encouraged to the command line wrapper Bio.Blast.Applications.BlastrpsCommandline instead.\", PendingDeprecationWarning)\n _security_check_parameters(keywds)\n ...
[ "0.69132483", "0.63498545", "0.6059055", "0.5686107", "0.5529276", "0.5422737", "0.54194593", "0.54177874", "0.54152125", "0.5406426", "0.53167474", "0.5235951", "0.52318496", "0.52102786", "0.5169427", "0.5141408", "0.5137818", "0.5122259", "0.5119625", "0.50635177", "0.4977...
0.821216
0
Execute and retrieve data from standalone RPSBLAST as handles (OBSOLETE). NOTE This function is obsolete, you are encouraged to the command line wrapper Bio.Blast.Applications.RpsBlastCommandline instead. Execute and retrieve data from standalone RPSBLAST. blastcmd is the command used to launch the 'rpsblast' executabl...
def rpsblast(blastcmd, database, infile, align_view="7", **keywds): import warnings warnings.warn("This function is obsolete, you are encouraged to the command line wrapper Bio.Blast.Applications.BlastrpsCommandline instead.", PendingDeprecationWarning) _security_check_parameters(keywds) att2param...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blastall(blastcmd, program, database, infile, align_view='7', **keywds):\n\n _security_check_parameters(keywds)\n\n att2param = {\n 'matrix' : '-M',\n 'gap_open' : '-G',\n 'gap_extend' : '-E',\n 'nuc_match' : '-r',\n 'nuc_mismatch' : '-q',\n 'query_genetic_code' ...
[ "0.6567743", "0.6469183", "0.62038195", "0.6169676", "0.5998038", "0.5889682", "0.57250804", "0.5698743", "0.55632794", "0.55214614", "0.5490336", "0.53914905", "0.52392304", "0.5195957", "0.51946354", "0.51559067", "0.5152533", "0.5110173", "0.5094674", "0.50776154", "0.5056...
0.74148107
0
Start BLAST and returns handles for stdout and stderr (PRIVATE). Expects a command line wrapper object from Bio.Blast.Applications
def _invoke_blast(cline): import subprocess, sys blast_cmd = cline.program_name if not os.path.exists(blast_cmd): raise ValueError("BLAST executable does not exist at %s" % blast_cmd) #We don't need to supply any piped input, but we setup the #standard input pipe anyway as a work around for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\targs = sys.argv[1:]\n\t# If stdin is not empty (being piped to)\n\tif not sys.stdin.isatty():\n\t\targs += sys.stdin.readlines()\n\tcommand = Main()\n\tcatch = lnk.errors.Catch(1)\n\tcatch.catch(command.main, args, standalone_mode=False)", "def blastn_commandline(cls):\n command = generate_...
[ "0.60168827", "0.5796402", "0.56809795", "0.56387544", "0.55868495", "0.55859977", "0.5585382", "0.55839694", "0.556747", "0.55591005", "0.5537728", "0.5533495", "0.5521777", "0.54482013", "0.5421747", "0.54031545", "0.5402231", "0.5383822", "0.53771955", "0.5370251", "0.5368...
0.66386735
0
Look for any attempt to insert a command into a parameter. e.g. blastall(..., matrix='IDENTITY F 0; rm rf /etc/passwd') Looks for ";" or "&&" in the strings (Unix and Windows syntax for appending a command line), or ">", "<" or "|" (redirection) and if any are found raises an exception.
def _security_check_parameters(param_dict): for key, value in param_dict.iteritems(): str_value = str(value) # Could easily be an int or a float for bad_str in [";", "&&", ">", "<", "|"]: if bad_str in str_value: raise ValueError("Rejecting suspicious argument for %s" % k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(arg):\n print('Invalid command!!!')\n return", "def check_command_option ( params, string, delete ) :\n i = 0\n value = None\n size = len(string)\n for line in params :\n tmp = line.find(string)\n if tmp != -1:\n start = tmp + size\n sel_string = line[start:]\n...
[ "0.5516845", "0.544766", "0.5256055", "0.5216134", "0.5210952", "0.51746213", "0.51712734", "0.5170301", "0.50894815", "0.5085504", "0.5056917", "0.50542396", "0.5010198", "0.49849024", "0.49724904", "0.49721122", "0.49657324", "0.4952978", "0.49087477", "0.4908186", "0.49081...
0.45623043
84
Initialize a parser that tries to catch BlastErrors.
def __init__(self, bad_report_handle = None): self._bad_report_handle = bad_report_handle #self._b_parser = BlastParser() self._scanner = _Scanner() self._consumer = _BlastErrorConsumer()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, parser=None):", "def __init__(self, parser: Any = None):", "def __init__(self, *args, **kw):\n self.parser = Parser(*args, **kw)", "def test_create_new_gerber_parser(self):\n parser = Gerber()\n assert parser != None", "def _parse(self):\n try:\n # ...
[ "0.6177303", "0.6087029", "0.6007341", "0.5901439", "0.58615685", "0.5810311", "0.57898545", "0.5760166", "0.5715188", "0.5695503", "0.56734216", "0.55885917", "0.55627733", "0.5551707", "0.552452", "0.5515549", "0.55094403", "0.5507326", "0.5501497", "0.54901755", "0.5484418...
0.685799
0
Parse a handle, attempting to diagnose errors.
def parse(self, handle): results = handle.read() try: self._scanner.feed(File.StringHandle(results), self._consumer) except ValueError, msg: # if we have a bad_report_file, save the info to it first if self._bad_report_handle: # send the info ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _diagnose_error(self, handle, data_record):\n line = handle.readline()\n\n while line:\n # 'Searchingdone' instead of 'Searching......done' seems\n # to indicate a failure to perform the BLAST due to\n # low quality sequence\n if line.startswith('Search...
[ "0.5839811", "0.57687813", "0.5528219", "0.550164", "0.5492486", "0.54591936", "0.53429043", "0.5302302", "0.5275931", "0.5261604", "0.5244928", "0.5179438", "0.5175663", "0.51575375", "0.5084481", "0.50780374", "0.5070664", "0.5024885", "0.5024073", "0.5020243", "0.5017326",...
0.6661924
0
Attempt to diagnose an error in the passed handle.
def _diagnose_error(self, handle, data_record): line = handle.readline() while line: # 'Searchingdone' instead of 'Searching......done' seems # to indicate a failure to perform the BLAST due to # low quality sequence if line.startswith('Searchingdone'): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def myHandleError(self, record):\n if raiseExceptions:\n ei = sys.exc_info()\n try:\n traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr)\n except IOError:\n pass # see issue 5971\n finally:\n del ei\n raise", "def myHandleErr...
[ "0.5868295", "0.5868295", "0.5857427", "0.5809658", "0.57716674", "0.57299936", "0.56281805", "0.5510797", "0.5452078", "0.5449711", "0.5429637", "0.5401915", "0.53741544", "0.537217", "0.5346068", "0.53016144", "0.52907413", "0.5285683", "0.5241748", "0.52281684", "0.521598"...
0.625596
0
Decrease dataset size by cutting requested classes smaller
def cut_classes(self, dataset, classes, max_size, label): # Cherry picked classes class_dfs = [] for c in classes: picked_data = dataset.loc[(dataset.loc[:,label] == c),:].reset_index(drop=True) class_dfs.append(picked_data.loc[0:min(len(picked_data), max_size),:]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce_class_size(dataset, reductionType, targetSize):\n\n classes = []\n classesContent = []\n ds_reduced = []\n originalDataset = dataset.copy()\n absOriginalLength = len(originalDataset)\n absTargetLength = 0\n targetMultiplicator = 0\n\n # calc absolute length to reduce to\n if (...
[ "0.73414516", "0.68224937", "0.6783226", "0.61126554", "0.5833041", "0.5807217", "0.58048767", "0.5798329", "0.5755408", "0.5639198", "0.56274307", "0.5619286", "0.56011754", "0.5576871", "0.5574115", "0.5558189", "0.55560374", "0.5554359", "0.55406946", "0.55294955", "0.5526...
0.7343867
0
Read data from csv file(s). Download it from bucket if necessary
def read_data(self, filenames, options, return_meta=False, starttime=None, endtime=None): datasets = [] for f in filenames: self._download_from_bucket(f, f) # Train data = pd.read_csv(f) missing = list(set(options.feature_params + options.meta_params + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_csv(self):\n self.function_name = '_read_csv'\n with open(os.path.join(self.task.downloads, self.csv_name)) as csv_file:\n reader = csv.reader(csv_file, dialect='excel')\n for row in reader:\n self.input_data.append(row)", "def get_data(self, csv_file)...
[ "0.7593931", "0.7458136", "0.68267214", "0.6822595", "0.6803702", "0.67914087", "0.6693794", "0.6651758", "0.6616796", "0.65952367", "0.65435183", "0.6531869", "0.6531744", "0.65138364", "0.64998", "0.6495586", "0.64892405", "0.6439336", "0.6396185", "0.6388481", "0.638525", ...
0.0
-1
Read dataset from csv file
def dataset_from_csv(self, filename, time_column='point_in_time'): return pd.from_csv(filename, parse_dates=[time_column])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_csv():", "def import_dataset(fpath):\r\n data = read_csv(fpath)\r\n print(data.head())\r\n print(data.shape)\r\n return data", "def read_csv_file(self):\n pass", "def get_data(self, csv_file):\n pass", "def load_dataset(path):\n training_data = []\n with open(path) ...
[ "0.8204799", "0.7876769", "0.7653028", "0.75579506", "0.75462687", "0.75183547", "0.7368106", "0.7286648", "0.72799456", "0.72481275", "0.72224563", "0.72130066", "0.7149342", "0.71446097", "0.7073659", "0.7058565", "0.7058565", "0.70395625", "0.7026945", "0.7018416", "0.6979...
0.66013277
80
Load model from given path
def load_model(self, filename, force=False): logging.info('Loading model from {}...'.format(filename)) self._download_from_bucket(filename, filename, force=force) return load(filename)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(self, path):\n pass", "def load_model(self, model_path: str):", "def load(path_to_model):\n pass", "def load(self, path):\n load_model(path, self)", "def load(\n self,\n modelLoadPath\n ):\n pass", "def load_model(self, filename):\r\n ...
[ "0.9228965", "0.92242205", "0.9149288", "0.8840297", "0.8454119", "0.83156914", "0.8249172", "0.81690043", "0.8082159", "0.8082159", "0.8082159", "0.80672306", "0.8018819", "0.79090095", "0.7872045", "0.7852293", "0.7831616", "0.78075683", "0.7792753", "0.77516305", "0.774972...
0.0
-1
Save model to given path
def save_model(self, model, save_path): fname = save_path + '/model.joblib' self.save_scikit_file(model, fname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(path_to_model):\n pass", "def save_model(self, model_path: str):", "def save_model(self, path):\n pass", "def save_model(self, path):\n self._model.save(path)", "def save(\n self,\n modelSavePath\n ):\n pass", "def save_model(model, model_file...
[ "0.9202552", "0.9176283", "0.91679114", "0.8975784", "0.8690684", "0.85802096", "0.84203047", "0.84203047", "0.84203047", "0.8403265", "0.831876", "0.8127629", "0.8099618", "0.80517006", "0.80517006", "0.80517006", "0.80350155", "0.8020828", "0.8006828", "0.79838645", "0.7981...
0.7732066
40
Store Pandas DataFrame to csv file and upload it to bucket if ext_filename is set
def df_to_csv(self, df, local_filename, store_header=True): Path(os.path.dirname(local_filename)).mkdir(parents=True, exist_ok=True) if df is not None and len(df) > 0: df.to_csv(local_filename, header=store_header, index_label='id') logging.info('Stored data to {}'.format(local_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_gcs(df, file, bucket=settings.ASSETS.BUCKET):\n output_file = NamedTemporaryFile().name\n df.to_csv(output_file, compression=\"gzip\", index=False)\n upload_blob(bucket, output_file, file)", "def save_csv(self, bucket, key, df, compression=None, **kwargs):\n data_obj = df.to_csv(**kwa...
[ "0.73861694", "0.7355157", "0.7178081", "0.70948577", "0.68517673", "0.6824397", "0.6741467", "0.669252", "0.66792345", "0.6650497", "0.64886904", "0.6458609", "0.6369256", "0.6365549", "0.6350224", "0.6322278", "0.6280271", "0.6247275", "0.6216646", "0.62012947", "0.62007916...
0.6855781
4
Save prediction results to csv file for visualisation purposes.
def save_prediction(self, meta, y_pred, y, filename): df = pd.DataFrame(meta) df['y_pred'] = y_pred df['y'] = y print(df) df.loc[:, 'id'] = df.index self.df_to_csv(df, filename, store_header=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_results(predictions, filename):\n with open(filename, 'w') as f:\n f.write(\"id,ACTION\\n\")\n for i, pred in enumerate(predictions):\n f.write(\"%d,%f\\n\" % (i + 1, pred))", "def save_prediction(self):\n if DataLoader.data is None:\n messagebox.showerror(\...
[ "0.7703693", "0.7628422", "0.7522447", "0.74385107", "0.74357957", "0.7419766", "0.7419766", "0.736686", "0.73543096", "0.732228", "0.7308786", "0.7291229", "0.71699023", "0.71563935", "0.711707", "0.7090318", "0.7074257", "0.7062179", "0.70042425", "0.6984243", "0.6929999", ...
0.76600194
1
Upload all files from folder to bucket
def _upload_dir_to_bucket(self, path, ext_path): for file in os.listdir(path): self._upload_to_bucket(path+'/'+file, ext_path+'/'+file)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_files_s3(files, bucket):\n \n print('************************************')\n print('Uploading files to s3 bucket...')\n print('************************************')\n \n for i in range(len(files)):\n upload_file_s3(files[i], bucket)\n \n print('**********************...
[ "0.7796129", "0.76484376", "0.76440495", "0.7522285", "0.73205024", "0.7259498", "0.71569556", "0.69658166", "0.68993825", "0.6886849", "0.6884797", "0.67420983", "0.67358345", "0.6709969", "0.6703498", "0.66821843", "0.66715854", "0.66610366", "0.6659203", "0.6640648", "0.66...
0.7838725
0
Upload file to bucket if bucket is set and ext_filename is not None
def _upload_to_bucket(self, filename, ext_filename): if ext_filename is None: return if self.s3: self.bucket.upload_file(filename, ext_filename) logging.info('Uploaded {} to S3 with name {}'.format(filename, ext_filename)) if self.gs: try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_file(\n self, bucket_id: uplink.Path, filename: uplink.Path, file: uplink.Body\n ):\n pass", "def upload_file(Filename=None, Bucket=None, Key=None, ExtraArgs=None, Callback=None, Config=None):\n pass", "def upload_file(file, bucket_path, bucket=S3_BUCKET):\n # Bucket path sho...
[ "0.7600532", "0.74214303", "0.7285555", "0.7134322", "0.71040857", "0.71002007", "0.7091589", "0.7090663", "0.7078668", "0.707424", "0.70586765", "0.69802374", "0.69690824", "0.6930814", "0.69067895", "0.687239", "0.6847536", "0.68146276", "0.679449", "0.6766457", "0.67521816...
0.85554653
0
Download all files from bucket and save them to 'local_path'
def _download_dir_from_bucket(self, ext_path, local_path, force=False): if os.path.exists(local_path) and not force: logging.info('Path {} already exists. Not overwriting...'.format(local_path)) return if os.path.exists(local_path) and force: logging.info('Path {} alr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self, local_path): # noqa: D402\n data_location = self.download_url\n data_location = rewrite_s3_links_locally(data_location)\n response = requests.get(data_location)\n write_file_locally(response.content, local_path)", "def download_file(s3_path, local_path):\n s3.meta.c...
[ "0.71020555", "0.7054091", "0.7037894", "0.69815624", "0.6956301", "0.6908696", "0.68448865", "0.6791386", "0.6786215", "0.67604995", "0.67517626", "0.6706798", "0.66289604", "0.66087854", "0.65796745", "0.6552148", "0.6546638", "0.6536262", "0.650691", "0.6451316", "0.639979...
0.7218672
0
Download file from bucket and save it to 'local_filename'
def _download_from_bucket(self, ext_filename, local_filename, force=False): if os.path.exists(local_filename) and not force: logging.info('File {} already exists. Not overwriting...'.format(local_filename)) return if os.path.exists(local_filename) and force: logging.i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_file(s3_path, local_path):\n s3.meta.client.download_file(bucket_name, s3_path, local_path)", "def download_file(self, bucket_name, key_name, local_file_location):\n try:\n self.logger.info(\"Downloading {}/{} from S3 to {}\".format(bucket_name, key_name, local_file_location))\n...
[ "0.78716594", "0.7565938", "0.7506007", "0.7422166", "0.73331714", "0.7330301", "0.73252624", "0.72543865", "0.72113806", "0.7189365", "0.71500474", "0.71356577", "0.71005404", "0.70790374", "0.7073477", "0.70685893", "0.7034173", "0.7021857", "0.7018799", "0.700558", "0.7002...
0.8098665
0
Write dict to csv
def write_csv(self, _dict, filename): with open(filename, 'w') as f: f.write('"'+'";"'.join(_dict.keys())+'"\n') for i in np.arange(len(_dict[list(_dict.keys())[0]])): values = [] for col in _dict.keys(): try: va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_csv(dictionary):\n\n with open(constant.METADATA_FILE, 'a', newline='') as file:\n writer = csv.DictWriter(file, fieldnames=dictionary.keys())\n try:\n writer.writerow(dictionary)\n except Exception:\n writeable = {k: str(v).encode(\"u...
[ "0.7983023", "0.7943461", "0.783072", "0.77171206", "0.7651803", "0.759917", "0.74783075", "0.74677414", "0.7440997", "0.73911995", "0.7378188", "0.7358301", "0.73346764", "0.730085", "0.72421634", "0.71908385", "0.7184285", "0.70639104", "0.70443135", "0.7028854", "0.7022237...
0.77528626
3
Report CV results and save them to file
def report_cv_results(self, results, scores=['score'], filename=None, n_top=5): res = "" for score in scores: res += "{}\n".format(score) res += "-------------------------------\n" for i in range(1, n_top + 1): candidates = np.flatnonzero(results['ran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_report(cv_rfc, lrc, x_test_variable, y_test_dep):\n # Ensure the function works\n try:\n cls.classification_report_image(\n cv_rfc, lrc, x_test_variable, y_test_dep)\n logging.info(\"Successfully Plotting Classification Results\")\n except Exception as err:\n loggi...
[ "0.65733397", "0.65376616", "0.6398993", "0.6282908", "0.6274721", "0.62072086", "0.6165067", "0.6141804", "0.6075014", "0.60728824", "0.60719407", "0.603311", "0.60245275", "0.59826034", "0.5944425", "0.5938252", "0.5937966", "0.5919031", "0.5869347", "0.5869213", "0.5863098...
0.68240047
0
Converts semitones to a frequency ratio.
def note2ratio(note, cents=0): ratio = 2 ** ((note + cents / 100) / 12) return ratio
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def note_to_frequency(note: str) -> float:\n n = note_to_semitone_diff(note)\n return semitone_diff_to_frequency(n)", "def semitone_diff_to_frequency(n: float) -> float:\n return A4 * A**n", "def tone_to_freq(tone):\n return math.pow(2, (tone - 69.0) / 12.0) * 440.0", "def mils_to_freq(m):\n f =...
[ "0.66941917", "0.62452257", "0.61423874", "0.59736025", "0.59571517", "0.5940214", "0.58182615", "0.57695127", "0.5769478", "0.57671577", "0.5761906", "0.57532406", "0.57212424", "0.5698925", "0.5671393", "0.5625438", "0.5600801", "0.55989605", "0.5550985", "0.554083", "0.554...
0.5483081
30
Converts a MIDI note to an absolute frequency (Hz).
def note2pitch(note, cents=0): freq = 440 * note2ratio(note - 69, cents) return freq
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def midi_to_frequency(midi_note: Union[float, int]) -> float:\n half_tone = 2 ** (1 / 12)\n return 440. * half_tone ** (midi_note - 69.)", "def midi_to_frequency(midi_note):\n return round(440.0 * 2 ** ((midi_note - 69) * (1.0 / 12.0)), 1)", "def frequency_to_midi(frequency):\n return int(round(69 ...
[ "0.85632294", "0.8555195", "0.7809018", "0.76916444", "0.76909", "0.7609475", "0.73957795", "0.7357539", "0.68921965", "0.6823227", "0.642791", "0.635542", "0.62684774", "0.62144744", "0.61403704", "0.6117158", "0.60560155", "0.60481584", "0.59112316", "0.5830432", "0.5820512...
0.6841872
9
locate droplets in a (potentially periodic) data set on a Cartesian grid This function locates droplets respecting periodic boundary conditions.
def _locate_droplets_in_mask_cartesian( grid: CartesianGridBase, mask: np.ndarray ) -> Emulsion: if mask.shape != grid.shape: raise ValueError( f"The shape {mask.shape} of the data is not compatible with the grid " f"shape {grid.shape}" ) # pad the array to simulate ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _locate_droplets_in_mask_cylindrical(\n grid: CylindricalSymGrid, mask: np.ndarray\n) -> Emulsion:\n assert np.all(mask.shape == grid.shape)\n\n if grid.periodic[1]:\n # locate droplets respecting periodic boundary conditions in z-direction\n\n # pad the array to simulate periodic bounda...
[ "0.76811284", "0.6554566", "0.6185524", "0.58874184", "0.5519401", "0.5501593", "0.54900706", "0.53688544", "0.52624065", "0.5220514", "0.51110923", "0.5086385", "0.506581", "0.50574595", "0.502888", "0.5023648", "0.49670285", "0.49498272", "0.4919114", "0.4904832", "0.490381...
0.71093625
1
locates droplets in a binary data set on a spherical grid
def _locate_droplets_in_mask_spherical( grid: SphericalSymGridBase, mask: np.ndarray ) -> Emulsion: assert np.all(mask.shape == grid.shape) # locate clusters in the binary image labels, num_labels = ndimage.label(mask) if num_labels == 0: return Emulsion([], grid=grid) # locate cluster...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _locate_droplets_in_mask_cylindrical_single(\n grid: CylindricalSymGrid, mask: np.ndarray\n) -> Emulsion:\n # locate the individual clusters\n labels, num_features = ndimage.label(mask)\n if num_features == 0:\n return Emulsion([], grid=grid)\n\n # locate clusters on the symmetry axis\n ...
[ "0.6334625", "0.6326938", "0.6280052", "0.62748045", "0.6138442", "0.5841916", "0.5814795", "0.5784163", "0.5732394", "0.5644218", "0.56330884", "0.5590427", "0.5507217", "0.54709375", "0.5447573", "0.5432364", "0.5410063", "0.54034096", "0.53786707", "0.5365377", "0.53360826...
0.6527605
0
locate droplets in a data set on a single cylindrical grid
def _locate_droplets_in_mask_cylindrical_single( grid: CylindricalSymGrid, mask: np.ndarray ) -> Emulsion: # locate the individual clusters labels, num_features = ndimage.label(mask) if num_features == 0: return Emulsion([], grid=grid) # locate clusters on the symmetry axis object_slice...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _locate_droplets_in_mask_cylindrical(\n grid: CylindricalSymGrid, mask: np.ndarray\n) -> Emulsion:\n assert np.all(mask.shape == grid.shape)\n\n if grid.periodic[1]:\n # locate droplets respecting periodic boundary conditions in z-direction\n\n # pad the array to simulate periodic bounda...
[ "0.69664097", "0.6491768", "0.5973075", "0.58128065", "0.5637239", "0.5464887", "0.5392235", "0.53456414", "0.52834636", "0.5262984", "0.5244792", "0.5209711", "0.51998144", "0.5157793", "0.51553285", "0.5138001", "0.5137105", "0.50955933", "0.50665283", "0.50569886", "0.5023...
0.6496282
1
locate droplets in a data set on a (periodic) cylindrical grid This function locates droplets respecting periodic boundary conditions.
def _locate_droplets_in_mask_cylindrical( grid: CylindricalSymGrid, mask: np.ndarray ) -> Emulsion: assert np.all(mask.shape == grid.shape) if grid.periodic[1]: # locate droplets respecting periodic boundary conditions in z-direction # pad the array to simulate periodic boundary conditions...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _locate_droplets_in_mask_cartesian(\n grid: CartesianGridBase, mask: np.ndarray\n) -> Emulsion:\n if mask.shape != grid.shape:\n raise ValueError(\n f\"The shape {mask.shape} of the data is not compatible with the grid \"\n f\"shape {grid.shape}\"\n )\n\n # pad the ...
[ "0.65388036", "0.6282355", "0.60239565", "0.56848073", "0.5602002", "0.5525652", "0.5487211", "0.5334124", "0.52467597", "0.52423966", "0.5184897", "0.5184084", "0.5181235", "0.5123486", "0.50454843", "0.50172555", "0.5012011", "0.5001637", "0.4987533", "0.49609968", "0.49154...
0.7693398
0
locates droplets in a binary image This function locates droplets respecting periodic boundary conditions.
def locate_droplets_in_mask(grid: GridBase, mask: np.ndarray) -> Emulsion: if isinstance(grid, CartesianGridBase): return _locate_droplets_in_mask_cartesian(grid, mask) elif isinstance(grid, SphericalSymGridBase): return _locate_droplets_in_mask_spherical(grid, mask) elif isinstance(grid, Cy...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _locate_droplets_in_mask_cylindrical(\n grid: CylindricalSymGrid, mask: np.ndarray\n) -> Emulsion:\n assert np.all(mask.shape == grid.shape)\n\n if grid.periodic[1]:\n # locate droplets respecting periodic boundary conditions in z-direction\n\n # pad the array to simulate periodic bounda...
[ "0.6522768", "0.6040752", "0.57896006", "0.56517047", "0.53571475", "0.5320738", "0.53031105", "0.52876234", "0.5226796", "0.5225108", "0.52121025", "0.5194813", "0.51447505", "0.51299435", "0.51052696", "0.5103004", "0.5084089", "0.50367755", "0.50339913", "0.5022701", "0.50...
0.5706668
3
Locates droplets in the phase field This uses a binarized image to locate clusters of large concentration in the phase field, which are interpreted as droplets. Basic quantities, like position and size, are determined for these clusters.
def locate_droplets( phase_field: ScalarField, threshold: Union[float, str] = 0.5, modes: int = 0, minimal_radius: float = 0, refine: bool = False, interface_width: Optional[float] = None, ) -> Emulsion: assert isinstance(phase_field, ScalarField) dim = phase_field.grid.dim # dimensiona...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _locate_droplets_in_mask_cylindrical(\n grid: CylindricalSymGrid, mask: np.ndarray\n) -> Emulsion:\n assert np.all(mask.shape == grid.shape)\n\n if grid.periodic[1]:\n # locate droplets respecting periodic boundary conditions in z-direction\n\n # pad the array to simulate periodic bounda...
[ "0.58779204", "0.58106714", "0.5760057", "0.54264325", "0.51649725", "0.51187783", "0.5067118", "0.50534153", "0.50534153", "0.50201076", "0.5005486", "0.49400416", "0.49284068", "0.49158067", "0.4898579", "0.48766935", "0.48485488", "0.4811385", "0.47815025", "0.47782052", "...
0.63500845
0
Refines droplet parameters by fitting to phase field This function varies droplet parameters, like position, size, interface width, and potential perturbation amplitudes until the overlap with the respective phase field region is maximized. Here, we use a constraint fitting routine.
def refine_droplet( phase_field: ScalarField, droplet: DiffuseDroplet, least_squares_params: Optional[Dict[str, Any]] = None, ) -> DiffuseDroplet: assert isinstance(phase_field, ScalarField) if least_squares_params is None: least_squares_params = {} if not isinstance(droplet, DiffuseDro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constrain_pars(model_info, pars):\n name = model_info['id']\n # if it is a product model, then just look at the form factor since\n # none of the structure factors need any constraints.\n if '*' in name:\n name = name.split('*')[0]\n\n if name == 'capped_cylinder' and pars['cap_radius'] <...
[ "0.5658608", "0.5568899", "0.5530349", "0.50715446", "0.50218", "0.5020094", "0.4985122", "0.49686703", "0.49606922", "0.49477375", "0.49405155", "0.49347383", "0.49186304", "0.49127778", "0.4878627", "0.4878266", "0.4875737", "0.4857548", "0.48561665", "0.48514897", "0.48336...
0.68589544
0
helper function evaluating the residuals
def _image_deviation(params): # generate the droplet data_flat[free] = params droplet.data = unstructured_to_structured(data_flat, dtype=dtype) droplet.check_data() img = droplet._get_phase_field(phase_field.grid)[mask] return img - data_mask
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _residuals(params: List[float], xs: np.ndarray, ys: np.ndarray) -> float:\n return _model(params=params, xs=xs) - ys", "def test_regress_residuals(self):\r\n x = [1.0, 2.0, 3.0, 4.0, 5.0]\r\n y = [2.1, 4.2, 5.9, 8.4, 9.6]\r\n result = regress_residuals(x, y)\r\n self.assertFloa...
[ "0.7320508", "0.7305285", "0.7213396", "0.7173056", "0.712406", "0.7102462", "0.70347035", "0.7033834", "0.69194746", "0.6867707", "0.68257517", "0.6764814", "0.67319787", "0.6726427", "0.67212373", "0.6712413", "0.6711433", "0.66375005", "0.662009", "0.6562867", "0.6550673",...
0.0
-1
Calculates the structure factor associated with a field Here, the structure factor is basically the power spectral density of the field `scalar_field` normalized so that regridding or rescaling the field does not change the result.
def get_structure_factor( scalar_field: ScalarField, smoothing: Union[None, float, str] = "auto", wave_numbers: Union[Sequence[float], str] = "auto", add_zero: bool = False, ) -> Tuple[np.ndarray, np.ndarray]: logger = logging.getLogger(__name__) if not isinstance(scalar_field, ScalarField): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_length_scale(\n scalar_field: ScalarField,\n method: str = \"structure_factor_maximum\",\n full_output: bool = False,\n smoothing: Optional[float] = None,\n) -> Union[float, Tuple[float, Any]]:\n logger = logging.getLogger(__name__)\n\n if method == \"structure_factor_mean\" or method == ...
[ "0.5794057", "0.5752112", "0.575145", "0.5655662", "0.56215703", "0.55155873", "0.53893906", "0.53778607", "0.5346394", "0.5300327", "0.5237999", "0.5237276", "0.5218443", "0.5210143", "0.5189513", "0.5166773", "0.51101947", "0.51071626", "0.51015085", "0.50777686", "0.507221...
0.72728807
0
Calculates a length scale associated with a phase field
def get_length_scale( scalar_field: ScalarField, method: str = "structure_factor_maximum", full_output: bool = False, smoothing: Optional[float] = None, ) -> Union[float, Tuple[float, Any]]: logger = logging.getLogger(__name__) if method == "structure_factor_mean" or method == "structure_factor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _genLenScale(self):\n # TODO: this function is an interface to specify non-stationary length scale field\n #pdb.set_trace()\n lenXField = self.lenXYZ[0, 0] * np.ones(self.nCell_kl)\n lenYField = self.lenXYZ[0, 1] * np.ones(self.nCell_kl)\n lenZField = self.lenXYZ[0, 2] * np.o...
[ "0.64969856", "0.63864374", "0.62350655", "0.61815274", "0.6077555", "0.606852", "0.6043921", "0.60372156", "0.59805477", "0.5970135", "0.5894647", "0.5884695", "0.58408797", "0.57489544", "0.57403296", "0.5724256", "0.5720597", "0.57079536", "0.56437135", "0.56151897", "0.56...
0.5466085
30
Create and return a stub test.
def CreateStubTest(phases=None, params=None): # pylint: disable=invalid-name test_metadata = htftest.TestMetadata('foo') # pylint: disable=protected-access if params is not None: test_metadata._parameter_list = ( parameters.TestParameterList(params.parameters)) return htftest.HTFTest(test_metadata,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateStubTest(phases=None): # pylint: disable=invalid-name\n test_metadata = phase_data.TestMetadata('foo')\n return phase_data.phase_data(test_metadata, phases or [])", "def test_stub(self):\n pass", "def create_stub(cls, proto_py_module, stub_name):\n\n return cls.create_stubs(proto_py_...
[ "0.7049483", "0.68726027", "0.65086746", "0.6226904", "0.59744567", "0.5875409", "0.5875409", "0.5869115", "0.5800327", "0.57175136", "0.5705263", "0.5691941", "0.5661378", "0.5658473", "0.5648882", "0.5639574", "0.5630987", "0.5609541", "0.55923575", "0.55062956", "0.5492857...
0.74640894
0
Check and execute SQL query.\n
def execute_sql(self, query, fetch_all=False): conn = self.create_connection() data = "No data" if conn: cursor = conn.cursor() try: if not fetch_all: data = cursor.execute(query).fetchone() else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runSql(self, sql):\r\n cursor = self.c.cursor()\r\n cursor.execute(sql)\r\n self.c.commit()\r\n cursor.close()\r\n return True", "def _execute_command(self):\n try:\n self.dw.execute_sql_command(self.query)\n except Exception as e:\n rais...
[ "0.768884", "0.7345641", "0.73389775", "0.72793216", "0.7249028", "0.7143606", "0.7142273", "0.71377736", "0.7134015", "0.7111478", "0.7067246", "0.7045598", "0.7043706", "0.7039179", "0.7033459", "0.70103806", "0.6997722", "0.6948682", "0.68709505", "0.6867144", "0.6858851",...
0.6287861
85
Check support 'rsm_ctx' type by handler.
def can_handle(self, rsm_ctx): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_handle(self, rsm_ctx):\n return not rsm_ctx.instance.type", "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_RESULT", "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_USAGE", "def can_handle(self, rsm_ctx):\n return rsm...
[ "0.74689585", "0.70099974", "0.63154733", "0.63154733", "0.63154733", "0.6160821", "0.6151702", "0.6090428", "0.588008", "0.5670612", "0.51465267", "0.5136682", "0.50325125", "0.4972726", "0.49691087", "0.49583092", "0.4916923", "0.48963133", "0.48802957", "0.48705983", "0.48...
0.68423736
2
Logic which should be executed for given 'rsm_ctx'.
def handle(self, rsm_ctx): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_RESULT", "def handle(self, rsm_ctx):\n rsm_ctx.log(\n 'info',\n 'Starting executing for \"list\" operation for get usage ...'\n )\n\n execution_id = rsm_ctx.run_execution(wait=False)\n ...
[ "0.61911374", "0.6145054", "0.5788437", "0.57324094", "0.56074697", "0.5554602", "0.5442962", "0.5299849", "0.5204402", "0.5140094", "0.5080645", "0.5065991", "0.5039015", "0.5039015", "0.5039015", "0.5005746", "0.49829862", "0.49768415", "0.49702245", "0.4969788", "0.4960261...
0.7899221
0
Check support 'rsm_ctx' type by handler. Instance should be None.
def can_handle(self, rsm_ctx): return not rsm_ctx.instance.type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_handle(self, rsm_ctx):\n return False", "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_RESULT", "def handle(self, rsm_ctx):\n rsm_ctx.log(\n 'info',\n 'Node instance has type with is not supported by '\n 'Resource Manage...
[ "0.6648118", "0.6646733", "0.63854903", "0.62018675", "0.62018675", "0.62018675", "0.6113427", "0.60652363", "0.5710701", "0.5709683", "0.5318473", "0.5054878", "0.4966977", "0.4897182", "0.4872651", "0.48110458", "0.47685593", "0.47521907", "0.47270998", "0.4708487", "0.4706...
0.7572694
0
Logic which should be executed for given 'rsm_ctx'. Write to log message that type is unsupported.
def handle(self, rsm_ctx): rsm_ctx.log( 'info', 'Node instance has type with is not supported by ' 'Resource Management Plugin. Skipping' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_handle(self, rsm_ctx):\n return not rsm_ctx.instance.type", "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_RESULT", "def handle(self, rsm_ctx):\n pass", "def can_handle(self, rsm_ctx):\n return False", "def _process_msg(cls, msg):\n ra...
[ "0.6189271", "0.5799024", "0.5745125", "0.5314854", "0.5146376", "0.51199263", "0.48813412", "0.48813412", "0.48813412", "0.48692715", "0.4823746", "0.48163384", "0.4791396", "0.4765693", "0.47391534", "0.47356078", "0.47062707", "0.46968287", "0.46908936", "0.46611562", "0.4...
0.690277
0
Check support 'rsm_ctx' type by handler. Instance should be NODE_TYPE_PROJECT.
def can_handle(self, rsm_ctx): return rsm_ctx.instance.type == NODE_TYPE_PROJECT
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(self, rsm_ctx):\n rsm_ctx.log(\n 'info',\n 'Node instance has type with is not supported by '\n 'Resource Management Plugin. Skipping'\n )", "def can_handle(self, rsm_ctx):\n return not rsm_ctx.instance.type", "def can_handle(self, rsm_ctx):\n ...
[ "0.6362641", "0.61811864", "0.61003655", "0.57622105", "0.5663", "0.5663", "0.5663", "0.5303613", "0.50670636", "0.49746954", "0.49681306", "0.48913604", "0.47937822", "0.47625598", "0.47432458", "0.46864262", "0.4640284", "0.46303535", "0.46094924", "0.45498383", "0.45277175...
0.76011074
0
Logic which should be executed for given 'rsm_ctx'. Run resolve project on 'rsm_ctx'.
def handle(self, rsm_ctx): rsm_ctx.log('info', 'Processing of project started') rsm_ctx.resolve_project()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval(hw, r):\n\n # Check that the hw path exists and is a directory. If so, try\n # to determine if the student has committed a build directory.\n if os.path.isdir(hw):\n find_build_dir(hw, r)\n return True\n else:\n # Diagnose the error and try to locate the actual\n # project directory.\n ...
[ "0.56092745", "0.5602606", "0.555728", "0.55155736", "0.5420812", "0.5266047", "0.522466", "0.5147111", "0.514152", "0.5106763", "0.5106763", "0.5106763", "0.5088506", "0.5057311", "0.5047965", "0.5040335", "0.5024697", "0.5017567", "0.4963319", "0.49532133", "0.49410152", ...
0.76606447
0
Value can be converted to float
def _is_number(value): try: float(value) return True except (TypeError, ValueError): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_float(check):", "def is_floatable(value):\n\n try:\n float(value)\n return True\n except:\n return False", "def is_float(self, value):\n try:\n float(value)\n return True\n except ValueError:\n return False", "def isFloat...
[ "0.7923817", "0.7842085", "0.7800239", "0.7773039", "0.75973934", "0.75700945", "0.75588197", "0.7510939", "0.74300903", "0.7415103", "0.74027425", "0.73520124", "0.72850275", "0.7264162", "0.71817464", "0.71205866", "0.7051001", "0.70206624", "0.6991285", "0.6888179", "0.687...
0.63328683
78
Value is list or tuple
def _is_iterable(value): return isinstance(value, list) or isinstance(value, tuple)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_tuple_or_list(value):\n return isinstance(value, list) or isinstance(value, tuple)", "def is_scalar(value):\n return not isinstance(value, (list, tuple, dict))", "def str_or_list(value):\n if isinstance(value, list):\n return value\n return [value]", "def _validate_value(self, val):...
[ "0.80901796", "0.7016031", "0.69459575", "0.6917107", "0.6909713", "0.6767196", "0.6727752", "0.6698764", "0.6672742", "0.6606919", "0.6548094", "0.65068436", "0.6476749", "0.64688283", "0.6458819", "0.6438381", "0.6418", "0.6414167", "0.64104503", "0.63726103", "0.63726103",...
0.68827224
5
Set value by resource managment context instance
def _set_value(rsm_ctx, value, value_type, resource_name=None): value_dict = {value_type: value} if resource_name: value_dict['resource_name'] = resource_name rsm_ctx.log('debug', 'Setting {}', value_dict) rsm_ctx.set_value(**value_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_resource_data(self, resource, meta):", "def update_context(self, ctx):\r\n assert isinstance(ctx, dict)\r\n ctx[str(self.context_id)] = self.value", "def set_attribute(self, context: ResourceCommandContext, obj_ref: str, attr_name: str, attr_value: str) -> None:\n self.handler.set_...
[ "0.7004103", "0.64217883", "0.63418335", "0.63214225", "0.63117516", "0.62844723", "0.6276568", "0.6202078", "0.6202078", "0.6191413", "0.61662775", "0.6094014", "0.6078255", "0.6006722", "0.60014075", "0.5977802", "0.59605306", "0.5909131", "0.5898597", "0.5889289", "0.58892...
0.6990149
1
Check support 'rsm_ctx' type by handler. Instance should be NODE_TYPE_QUOTA.
def can_handle(self, rsm_ctx): return rsm_ctx.instance.type == NODE_TYPE_QUOTA
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_handle(self, rsm_ctx):\n return not rsm_ctx.instance.type", "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_USAGE", "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_USAGE", "def can_handle(self, rsm_ctx):\n return rsm_...
[ "0.6811578", "0.6618091", "0.6618091", "0.6618091", "0.65914714", "0.63905466", "0.633495", "0.6178352", "0.5966573", "0.57266796", "0.52386665", "0.5188582", "0.5182612", "0.48737982", "0.4849607", "0.48398957", "0.48367012", "0.48311907", "0.4817003", "0.4806151", "0.480050...
0.7906162
0
Logic which should be executed for given 'rsm_ctx'. Process quota state from properties and run set_value on 'rsm_ctx'.
def handle(self, rsm_ctx): self._process_runtime_properties( rsm_ctx, rsm_ctx.instance.runtime_properties, self.VALUE_TYPE_QUOTA )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(self, rsm_ctx):\n pass", "def handle(self, rsm_ctx):\n runtime_properties = rsm_ctx.get_execution_result()\n\n rsm_ctx.log(\n 'info',\n 'Got {} runtime_properties after execution',\n runtime_properties.keys()\n )\n\n self._process_run...
[ "0.5784707", "0.57681483", "0.5694401", "0.565285", "0.554098", "0.5526146", "0.55199933", "0.5502226", "0.5368012", "0.52405834", "0.52204037", "0.52040344", "0.5194511", "0.51885706", "0.5176698", "0.5157406", "0.51350015", "0.50702596", "0.5042467", "0.50392616", "0.503521...
0.7451228
0
Check support 'rsm_ctx' type by handler. Instance should be NODE_TYPE_USAGE.
def can_handle(self, rsm_ctx): return rsm_ctx.instance.type == NODE_TYPE_USAGE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_RESULT", "def can_handle(self, rsm_ctx):\n return not rsm_ctx.instance.type", "def handle(self, rsm_ctx):\n rsm_ctx.log(\n 'info',\n 'Node instance has type with is not supported by '\n ...
[ "0.68845487", "0.6870086", "0.6720605", "0.65307677", "0.6116541", "0.5959433", "0.5403402", "0.5394847", "0.52130985", "0.51359606", "0.50499636", "0.5031325", "0.50037795", "0.4988742", "0.4931527", "0.48985812", "0.48725662", "0.48347872", "0.47168615", "0.471334", "0.4712...
0.74504733
2
Logic which should be executed for given 'rsm_ctx'. Process state from properties and run set_value on 'rsm_ctx'.
def handle(self, rsm_ctx): rsm_ctx.log('info', 'Executing "list" operation for get usage ...') runtime_properties = rsm_ctx.run_execution() rsm_ctx.log( 'info', 'Got {} runtime_properties after execution', runtime_properties.keys() ) self._pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(self, rsm_ctx):\n runtime_properties = rsm_ctx.get_execution_result()\n\n rsm_ctx.log(\n 'info',\n 'Got {} runtime_properties after execution',\n runtime_properties.keys()\n )\n\n self._process_runtime_properties(\n rsm_ctx,\n ...
[ "0.70196915", "0.6495517", "0.6103459", "0.58350176", "0.5490284", "0.5385307", "0.53602254", "0.5344496", "0.5338183", "0.5319866", "0.5295569", "0.5289274", "0.5206606", "0.5166721", "0.51118433", "0.5051935", "0.5042953", "0.5034518", "0.5019281", "0.5019281", "0.4992732",...
0.56913376
4
Check support 'rsm_ctx' type by handler. Instance should be NODE_TYPE_USAGE.
def can_handle(self, rsm_ctx): return rsm_ctx.instance.type == NODE_TYPE_USAGE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_RESULT", "def can_handle(self, rsm_ctx):\n return not rsm_ctx.instance.type", "def handle(self, rsm_ctx):\n rsm_ctx.log(\n 'info',\n 'Node instance has type with is not supported by '\n ...
[ "0.68845487", "0.6870086", "0.6720605", "0.65307677", "0.6116541", "0.5959433", "0.5403402", "0.5394847", "0.52130985", "0.51359606", "0.50499636", "0.5031325", "0.50037795", "0.4988742", "0.4931527", "0.48985812", "0.48725662", "0.48347872", "0.47168615", "0.471334", "0.4712...
0.74504733
1
Logic which should be executed for given 'rsm_ctx'. Run execution on 'rsm_ctx'.
def handle(self, rsm_ctx): rsm_ctx.log( 'info', 'Starting executing for "list" operation for get usage ...' ) execution_id = rsm_ctx.run_execution(wait=False) rsm_ctx.log( 'info', 'Execution started with ID: {} ...'.format(execution_id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(self, rsm_ctx):\n pass", "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_RESULT", "def handle(self, rsm_ctx):\n runtime_properties = rsm_ctx.get_execution_result()\n\n rsm_ctx.log(\n 'info',\n 'Got {} runtime_properties af...
[ "0.7543212", "0.58339036", "0.5705841", "0.56092376", "0.5581437", "0.5514848", "0.54928815", "0.5442906", "0.54387003", "0.54118896", "0.54112417", "0.54038066", "0.53368837", "0.53190327", "0.5260661", "0.5252265", "0.5252265", "0.52007675", "0.5192384", "0.51621497", "0.51...
0.6470867
1
Check support 'rsm_ctx' type by handler. Instance should be NODE_TYPE_USAGE.
def can_handle(self, rsm_ctx): return rsm_ctx.instance.type == NODE_TYPE_USAGE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_RESULT", "def can_handle(self, rsm_ctx):\n return not rsm_ctx.instance.type", "def handle(self, rsm_ctx):\n rsm_ctx.log(\n 'info',\n 'Node instance has type with is not supported by '\n ...
[ "0.68845487", "0.6870086", "0.6720605", "0.65307677", "0.6116541", "0.5959433", "0.5403402", "0.5394847", "0.52130985", "0.51359606", "0.50499636", "0.5031325", "0.50037795", "0.4988742", "0.4931527", "0.48985812", "0.48725662", "0.48347872", "0.47168615", "0.471334", "0.4712...
0.74504733
0
Logic which should be executed for given 'rsm_ctx'. Process state from properties and run set_value on 'rsm_ctx'.
def handle(self, rsm_ctx): runtime_properties = rsm_ctx.get_execution_result() rsm_ctx.log( 'info', 'Got {} runtime_properties after execution', runtime_properties.keys() ) self._process_runtime_properties( rsm_ctx, runtime_pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(self, rsm_ctx):\n pass", "def handle(self, rsm_ctx):\n self._process_runtime_properties(\n rsm_ctx,\n rsm_ctx.instance.runtime_properties,\n self.VALUE_TYPE_QUOTA\n )", "def handle(self, rsm_ctx):\n rsm_ctx.log(\n 'info',\n ...
[ "0.6495517", "0.6103459", "0.58350176", "0.56913376", "0.5490284", "0.5385307", "0.53602254", "0.5344496", "0.5338183", "0.5319866", "0.5295569", "0.5289274", "0.5206606", "0.5166721", "0.51118433", "0.5051935", "0.5042953", "0.5034518", "0.5019281", "0.5019281", "0.4992732",...
0.70196915
0
Key in SUPPRESS list
def _suppress(self, key): return key in self.SUPPRESS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keys(self, data, installer_context):", "def key(key):\n return key", "def secondary_keys(self):", "def _GetKeyString(self):", "def _GetKeyString(self):", "def extract_key_usage(self, ext):\n res = []\n fields = KU_FIELDS[:]\n\n # \"error-on-access\", real funny\n if...
[ "0.59111524", "0.56453145", "0.55836684", "0.547909", "0.547909", "0.544734", "0.5446958", "0.542185", "0.5421237", "0.5421237", "0.5408113", "0.54074985", "0.5386925", "0.5340487", "0.5334346", "0.5295114", "0.52809834", "0.52733964", "0.52320004", "0.5206396", "0.5179361", ...
0.57660186
1
Translate key by translate dict
def _translate(self, key): return self.TRANSLATE.get(key, key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(key, dictionary):\n if key in dictionary:\n return dictionary[key]\n if key in dictionary.values():\n return key\n raise Exception(\"no entry {} in dictionary {}\".format(key, dictionary))", "def _make_trans_from_dict(translations):\n\n from_str = ''\n to_str = ...
[ "0.7452892", "0.7021639", "0.6875848", "0.6788803", "0.6653619", "0.65519345", "0.6360589", "0.6328695", "0.62527615", "0.6251204", "0.6133195", "0.6096026", "0.6090223", "0.60032105", "0.5933524", "0.5926303", "0.59189796", "0.59064764", "0.59049064", "0.5901391", "0.5849293...
0.74695766
0
Check support 'rsm_ctx' type by handler. Instance should be NODE_TYPE_QUOTA and SYSTEM_NAME_OPENSTACK in 'system_name'.
def can_handle(self, rsm_ctx): return super(OpenstackQuotaHandler, self).can_handle(rsm_ctx) and \ SYSTEM_NAME_OPENSTACK in rsm_ctx.instance.system_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_QUOTA", "def can_handle(self, rsm_ctx):\n return not rsm_ctx.instance.type", "def handle(self, rsm_ctx):\n rsm_ctx.log(\n 'info',\n 'Node instance has type with is not supported by '\n ...
[ "0.6766187", "0.6549585", "0.6380219", "0.62915754", "0.62915754", "0.62915754", "0.6178638", "0.58965355", "0.5851137", "0.5643693", "0.51984125", "0.51205176", "0.5115497", "0.50924265", "0.50415015", "0.49992657", "0.4892618", "0.4861141", "0.4819281", "0.47552007", "0.474...
0.70649564
0
Check support 'rsm_ctx' type by handler. Instance should be NODE_TYPE_RESULT.
def can_handle(self, rsm_ctx): return rsm_ctx.instance.type == NODE_TYPE_RESULT
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_handle(self, rsm_ctx):\n return not rsm_ctx.instance.type", "def handle(self, rsm_ctx):\n rsm_ctx.log(\n 'info',\n 'Node instance has type with is not supported by '\n 'Resource Management Plugin. Skipping'\n )", "def can_handle(self, rsm_ctx):\n ...
[ "0.6539492", "0.6527251", "0.6194596", "0.6194596", "0.6194596", "0.58348286", "0.57641536", "0.57499075", "0.52276134", "0.5095498", "0.5037327", "0.4948946", "0.49151015", "0.48483157", "0.4833058", "0.47804075", "0.47727802", "0.47572267", "0.47519362", "0.46803394", "0.46...
0.77807736
0
Logic which should be executed for given 'rsm_ctx'. Dump state to runtime properties.
def handle(self, rsm_ctx): rsm_ctx.log( 'info', 'Dumping gathered data to runtime_properties of {} node instance', rsm_ctx.instance.id ) rsm_ctx.add_result_instance_id() rsm_ctx.set_runtime_properties({ 'data': rsm_ctx.dump() })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(self, rsm_ctx):\n pass", "def handle(self, rsm_ctx):\n runtime_properties = rsm_ctx.get_execution_result()\n\n rsm_ctx.log(\n 'info',\n 'Got {} runtime_properties after execution',\n runtime_properties.keys()\n )\n\n self._process_run...
[ "0.6944394", "0.60357314", "0.55758333", "0.54697585", "0.52686495", "0.52058613", "0.5138877", "0.5134144", "0.5079232", "0.505829", "0.50382674", "0.49983215", "0.49911332", "0.49770048", "0.49382457", "0.49272338", "0.49066004", "0.49020687", "0.4894868", "0.48867136", "0....
0.68619585
1
Parse email and fetch body and all attachments
def process(self) -> None: self.parsed = email.message_from_bytes(self.rawmailcontent, policy=email.policy.EmailPolicy()) # type: email.message.EmailMessage self.subject = self.parsed["subject"] if self.parsed["X-Jicket-Initial-ReplyID"] is not None and self.parsed["X-Jicket-Initial-ReplyID...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attachments(self):\n for part in self.email.walk():\n filename = part.get_filename()\n if filename:\n yield {\n 'type': part.get_content_type(),\n 'name': filename,\n 'content': part.get_payload()\n ...
[ "0.7289167", "0.7050197", "0.6997125", "0.691478", "0.6847485", "0.6782379", "0.6653624", "0.6652672", "0.6556684", "0.6554713", "0.65465385", "0.64429235", "0.63888156", "0.6334647", "0.6334638", "0.63264215", "0.63119566", "0.6293829", "0.62374306", "0.6211863", "0.6208671"...
0.6103129
23
Determine ticket id either from existing subject line or from uid If the Subject line contains an ID, it is taken. If it doesn't, a new one is generated.
def determine_ticket_ID(self): hashid = hashids.Hashids(salt=self.config.idSalt, alphabet=self.config.idAlphabet, min_length=self.config.idMinLength) # See if hashid is set in headers if self.parsed["X-Jicket-HashID"] is not None: self.tickethash = self.parsed["X-Jicket-HashID"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subject_id(self, rec:str) -> int:\n raise NotImplementedError", "def get_ticket_id():\n return str(time.time()) + str(uuid.uuid4())", "def _get_ticket_id(self, str):\n pat = r'^\\s*#(\\d+)'\n try:\n return int(re.search(pat, str).group(1))\n except:\n ...
[ "0.6021244", "0.5966582", "0.5956366", "0.5919215", "0.58400536", "0.5819156", "0.5633356", "0.55684143", "0.5405211", "0.5354974", "0.5307806", "0.5300704", "0.5289483", "0.52597475", "0.5240629", "0.5164551", "0.51528645", "0.5145069", "0.51301694", "0.5126908", "0.51150215...
0.6965168
0
Convert text bodies to text that can be attached to an issue
def textfrombodies(self) -> str: type_priority = ["plain", "html", "other"] # TODO: Make configurable for texttype in type_priority: if texttype == "plain" and texttype in self.textbodies: """Text is plain, so it can be used verbatim""" return self.textbodie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self, text):\r\n return text", "def generate_body(issue):\n markdown = \"### {}\\n\".format(issue.pop('title'))\n for k, v in issue.iteritems():\n markdown += \"- {}: {}\\n\".format(k, v)\n return markdown", "def convert_to_markdown(self, text: str) -> str:", "def get_te...
[ "0.61873615", "0.6027262", "0.58918947", "0.5888332", "0.5878906", "0.5850792", "0.58205616", "0.5773772", "0.5754406", "0.5704299", "0.56952536", "0.56866527", "0.5672063", "0.56352043", "0.562836", "0.56220996", "0.56156236", "0.5604763", "0.56015706", "0.55987185", "0.5596...
0.71296585
0
Generate and store filter visualization from the layer which has the name layer_name
def _visualization_by_layer_name(graph, value_feed_dict, input_tensor, layer_name, method, path_logdir, path_outdir): start = -time.time() is_success = True sess = tf.get_default_session() if not(graph is sess.graph): print('Error, the graph input is not the graph of the current session!!...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize_conv_layers(self, layer_name='conv1', savefig_path=\"\"):\n\n # The name of the layer we want to visualize\n layer_idx = [idx for idx, layer in enumerate(self.model.layers) if layer.name == layer_name][0]\n\n # Visualize all filters in this layer.\n filters = np.arange(get...
[ "0.7655164", "0.6384714", "0.62325126", "0.61411214", "0.6135185", "0.6132402", "0.6027748", "0.5923901", "0.57606256", "0.5759872", "0.57537097", "0.56610745", "0.5656004", "0.5562257", "0.5550621", "0.5546116", "0.55282956", "0.55201566", "0.54682773", "0.5464753", "0.54402...
0.591035
8
Save the given TF session at PATH = "./model/tmpmodel"
def _save_model(graph_or_sess): if isinstance(graph_or_sess, tf.Graph): ops = graph_or_sess.get_operations() for op in ops: if 'variable' in op.type.lower(): raise ValueError('Please input a frozen graph (no variables). Or pass in the session object.') wit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\n\n self.saver.save(self.sess, self.path + '/tensorflow-model', global_step=self.counter.count)", "def save_session(self):\n\n # Checkpoint directory. Tensorflow assumes this directory already exists so we need to create it\n checkpoint_dir = os.path.abspath(os.path.join(self.FLA...
[ "0.77613735", "0.756965", "0.75423574", "0.73797125", "0.7366821", "0.7349892", "0.71762145", "0.7025819", "0.6998633", "0.6955972", "0.69415617", "0.6939384", "0.6921636", "0.6920539", "0.6881578", "0.6872373", "0.6870211", "0.68608505", "0.6825167", "0.6805065", "0.6735286"...
0.79623353
0
Create a payment request
async def handler( # request: Request, # data: Type = Body(...), ): # if data.login: # phone = pre_process_phone(data.login) # TODO: optimize # users = User.get(phone=phone, fields={}) # if not users: # user = await reg( # request.state.network, # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(**data):\n http_client = HttpClient()\n response, _ = http_client.post(routes.url(routes.PAYMENT_RESOURCE), data)\n return resources.Payment(**response)", "def create_payment(self,\n body):\n\n return super().new_api_call_builder.request(\n ...
[ "0.7397122", "0.734215", "0.73036724", "0.72973806", "0.7033883", "0.68124586", "0.67511296", "0.666257", "0.6546402", "0.6542952", "0.6472428", "0.6377905", "0.63751334", "0.6369861", "0.6327559", "0.6319745", "0.62663484", "0.6245251", "0.6211057", "0.6210941", "0.620603", ...
0.0
-1
Create the menu for the given page.
def create_menu(page): menu = [] # menu.append('<span class="header">Topics</span>') for title, target in NAV.items(): if isinstance(target, str): if target.startswith(("https://", "http://", "/")): menu.append(f"<a href='target'>{title}</a>") else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_menu():", "def create_menus( self ):", "def create_page(self):", "def makeMenu(self):\n\t\tself.fileMenu = self.menuBar().addMenu(self.tr(\"&Arquivo\"))\n\t\tself.fileMenu.addAction(self.newAct)\n\t\tself.fileMenu.addAction(self.openAct)\n\t\tself.fileMenu.addAction(self.saveAct)\n\t\tself.fileMen...
[ "0.7953719", "0.7641607", "0.68760747", "0.6603763", "0.6581625", "0.64528054", "0.6363082", "0.63517344", "0.63144433", "0.6308878", "0.6294457", "0.6290151", "0.62464404", "0.6218153", "0.62176347", "0.61810255", "0.61615777", "0.61258054", "0.6091273", "0.60853565", "0.608...
0.75303257
2
Returns a dict of all the assets representing the website.
def create_assets(): assets = {} # Load all static files for root, dirs, files in os.walk(STATIC_DIR): for fname in files: filename = os.path.join(root, fname) with open(filename, "rb") as f: assets[os.path.relpath(filename, STATIC_DIR)] = f.read() # Col...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assets(self):\n return self._assets.values()", "def assets(self):\n if self._assets_cache:\n return self._assets_cache\n asset_defaults = Section.assets.value\n ret_val = dict([(obj.name, obj.value) for obj in asset_defaults])\n config_vals = self._section_as_dic...
[ "0.7230876", "0.7184012", "0.71277297", "0.6934314", "0.690391", "0.6811948", "0.6533416", "0.6524576", "0.65065795", "0.64822066", "0.64755744", "0.6446894", "0.6166549", "0.6141786", "0.60954094", "0.607226", "0.6046502", "0.60265654", "0.598493", "0.59681714", "0.5937015",...
0.6620338
6
Main function that exports the page to the file system.
def main(): # Create / clean output dir if os.path.isdir(OUT_DIR): shutil.rmtree(OUT_DIR) os.mkdir(OUT_DIR) # Write all assets to the directory for fname, bb in create_assets().items(): filename = os.path.join(OUT_DIR, fname) dirname = os.path.dirname(filename) if no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_export(pages_param, out_filename):\r\n\r\n url = 'http://lesswrong.wikia.com/index.php?title=Special:Export&action=submit'\r\n data = urllib.urlencode({'catname': '', 'pages': pages_param, 'templates': '1'})\r\n feed = urllib2.urlopen(url, data)\r\n buf = feed.read()\r\n\r\n out = open(out_f...
[ "0.6242838", "0.6205668", "0.61027384", "0.6068051", "0.60625726", "0.60530096", "0.60515726", "0.6032723", "0.6000273", "0.59828967", "0.5980305", "0.5956715", "0.59546864", "0.5913301", "0.5887891", "0.5887746", "0.5863963", "0.5854072", "0.5851922", "0.58476967", "0.582200...
0.5347785
83
Fix the markdown links based on the pages that we know.
def _fix_links(self, text, page_names): for n in page_names: text = text.replace(f"]({n})", f"]({n}.html)") text = text.replace(f"]({n}.md)", f"]({n}.html)") return text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_page_markdown(self, markdown, **kwargs):\n for autolink in self.config[\"autolinks\"]:\n markdown = replace_autolink_references(markdown, autolink[\"reference_prefix\"], autolink[\"target_url\"])\n\n return markdown", "def fix_links():\n pass", "def on_page_markdown(self, mar...
[ "0.7468987", "0.70825726", "0.6409713", "0.6033815", "0.5947633", "0.5921285", "0.5885464", "0.5884731", "0.5832796", "0.58249164", "0.57960886", "0.5768971", "0.57507855", "0.5704053", "0.55767506", "0.5538461", "0.5510497", "0.5480508", "0.54325324", "0.54244053", "0.540460...
0.7852134
0
Split the markdown into parts based on sections. Each part is either text or a tuple representing a section.
def _split(self): text = self.md self.parts = parts = [] self.headers = headers = [] lines = [] # Split in parts for line in text.splitlines(): if line.startswith(("# ", "## ", "### ", "#### ", "##### ")): # Finish pending lines ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_into_sections(text):\n headings_regex = re.compile(\n r'^={1,6}.*?={1,6}(?: *<!--.*?-->)?\\s*$', flags=re.M\n )\n sections = list()\n last_match_start = 0\n for match in headings_regex.finditer(text):\n match_start = match.start()\n if match_start > 0:\n sec...
[ "0.6592996", "0.62733644", "0.60852915", "0.6063004", "0.5859374", "0.5849308", "0.5828487", "0.5798614", "0.57628095", "0.5672283", "0.56307954", "0.5625874", "0.55943716", "0.5592244", "0.55725014", "0.55567396", "0.55356854", "0.5535604", "0.552459", "0.55119103", "0.54861...
0.77850777
0
Like shutil.copytree, but directories are ok to already exist.
def copydir(src, dst): for item in os.listdir(src): s, d = os.path.join(src, item), os.path.join(dst, item) if os.path.isdir(s): if not os.path.isdir(d): os.mkdir(d) copydir(s, d) else: shutil.copy(s, d)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copyTree(source_path, dest_path):\n if python_version >= 0x380:\n # Python 3.8+ has dirs_exist_ok\n return shutil.copytree(source_path, dest_path, dirs_exist_ok=True)\n\n from distutils.dir_util import copy_tree\n\n return copy_tree(source_path, dest_path)", "def copytree(src, dst, sym...
[ "0.76453364", "0.7595197", "0.7575192", "0.7490962", "0.7490962", "0.7461569", "0.7440433", "0.73278916", "0.73096585", "0.7305022", "0.73040694", "0.72519433", "0.72396713", "0.72249675", "0.7192792", "0.71545213", "0.7129808", "0.71095115", "0.70991516", "0.7082636", "0.704...
0.6830687
30
Validate a redirected error response. All the URL components should match the original redirect_uri, with the exception of the parameters, which should contain an 'error' and an 'error_description' field of the provided types.
def assertValidRedirect(self, response, redirect_uri, expected_status_code, **kwargs): self.assertEqual(expected_status_code, response.status_code) # Split the url into parts. location = response.headers.get('Location') location_url = urlparse.urlparse(locati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_response(self, error, **kwargs):\n oauthlib_error = error.oauthlib_error\n error_response = {\n 'error': oauthlib_error,\n 'url': '{0}?{1}'.format(oauthlib_error.redirect_uri, oauthlib_error.urlencoded)\n }\n error_response.update(kwargs)\n\n if is...
[ "0.7122628", "0.65730166", "0.62523395", "0.6000711", "0.59799373", "0.58929646", "0.58686644", "0.58485216", "0.5775962", "0.5717465", "0.5591549", "0.5570456", "0.5543242", "0.5461019", "0.543455", "0.543455", "0.5410617", "0.5404725", "0.54023296", "0.5393356", "0.5376724"...
0.6597871
1
This test ensures that the authorize request against the oauth endpoint succeeds with expected values.
def test_valid_authorize_request(self): random_state = six.text_type(uuid.uuid4()) # Simple GET with various parameters response = self.get_json(path='/openid/authorize', expect_errors=True, state=random_state, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_oauth(self):\n oauth_headers = self._get_oauth_headers(self.user)\n self.client.logout()\n response = self.client.get(self.path(), **oauth_headers)\n assert response.status_code == 200\n body = {'user_id': 'staff', 'action': 'allow'}\n response = self.client.post(...
[ "0.74779457", "0.74457616", "0.72292477", "0.7201043", "0.7180546", "0.7083249", "0.7080737", "0.701164", "0.70015174", "0.6941109", "0.69249433", "0.68833077", "0.67708033", "0.6765852", "0.6744", "0.67292756", "0.66937137", "0.6668326", "0.6645099", "0.6577298", "0.65717685...
0.8130674
0
Assert that an invalid response_type redirects back to the redirect_uri and provides the expected error response.
def test_authorize_invalid_response_type(self): invalid_params = self.valid_params.copy() invalid_params['response_type'] = 'invalid_code' # Simple GET with invalid code parameters random_state = six.text_type(uuid.uuid4()) response = self.get_json(path='/openid/authorize', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_http_error_raise_with_redirect(self):\n\n resp = self.r(\n HTTPError(http_status.HTTP_201_CREATED, redirect_url='http://google.com/')\n )\n\n self.assertIsInstance(\n resp, werkzeug.wrappers.Response\n )\n\n self.assertEqual(302, resp.status_code)\n...
[ "0.75191337", "0.72961164", "0.7171664", "0.70651674", "0.6875958", "0.67515904", "0.6627203", "0.6615773", "0.65987235", "0.6589537", "0.6552112", "0.6536879", "0.6508044", "0.6480439", "0.63691235", "0.6355215", "0.6341384", "0.6288093", "0.62804973", "0.62268054", "0.61819...
0.7701483
0
Assert that an nonexistent response_type redirects back to the redirect_uri and provides the expected error response.
def test_authorize_no_response_type(self): invalid_params = self.valid_params.copy() del invalid_params['response_type'] # Simple GET with invalid code parameters random_state = six.text_type(uuid.uuid4()) response = self.get_json(path='/openid/authorize', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_authorize_invalid_response_type(self):\n invalid_params = self.valid_params.copy()\n invalid_params['response_type'] = 'invalid_code'\n\n # Simple GET with invalid code parameters\n random_state = six.text_type(uuid.uuid4())\n response = self.get_json(path='/openid/autho...
[ "0.7420597", "0.7164122", "0.6910888", "0.6648324", "0.6642587", "0.6474151", "0.64672065", "0.6405829", "0.6382179", "0.6363759", "0.63207835", "0.6319008", "0.62895614", "0.6289121", "0.62787527", "0.6247881", "0.6192791", "0.61116356", "0.61116356", "0.60881925", "0.608715...
0.73475444
1
Assert that a nonexistent client redirects back to the redirect_uri and provides the expected error response.
def test_authorize_no_client(self): invalid_params = self.valid_params.copy() del invalid_params['client_id'] # Simple GET with invalid code parameters random_state = six.text_type(uuid.uuid4()) response = self.get_json(path='/openid/authorize', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_http_error_raise_with_redirect(self):\n\n resp = self.r(\n HTTPError(http_status.HTTP_201_CREATED, redirect_url='http://google.com/')\n )\n\n self.assertIsInstance(\n resp, werkzeug.wrappers.Response\n )\n\n self.assertEqual(302, resp.status_code)\n...
[ "0.7657027", "0.7071766", "0.6945941", "0.6851474", "0.68442667", "0.6824086", "0.6791853", "0.67458946", "0.67314863", "0.66679996", "0.6664417", "0.6653209", "0.6645142", "0.6616033", "0.65255606", "0.6516541", "0.6504525", "0.6504525", "0.6461596", "0.64065444", "0.6398890...
0.6766306
7
Assert that an invalid client redirects back to the redirect_uri and provides the expected error response.
def test_authorize_invalid_client(self): invalid_params = self.valid_params.copy() invalid_params['client_id'] = 'invalid_client' # Simple GET with invalid code parameters random_state = six.text_type(uuid.uuid4()) response = self.get_json(path='/openid/authorize', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_http_error_raise_with_redirect(self):\n\n resp = self.r(\n HTTPError(http_status.HTTP_201_CREATED, redirect_url='http://google.com/')\n )\n\n self.assertIsInstance(\n resp, werkzeug.wrappers.Response\n )\n\n self.assertEqual(302, resp.status_code)\n...
[ "0.7972389", "0.7369733", "0.72958344", "0.71539176", "0.7042015", "0.70395124", "0.69947994", "0.6865802", "0.68044996", "0.6787957", "0.67493385", "0.6748754", "0.6746671", "0.66689926", "0.6647042", "0.66368335", "0.65603876", "0.65603876", "0.6511094", "0.64935255", "0.64...
0.7174641
3
Assert that an invalid scope redirects back to the redirect_uri and provides the expected error response.
def test_authorize_invalid_scope(self): invalid_params = self.valid_params.copy() invalid_params['scope'] = 'invalid_scope' # Simple GET with invalid code parameters random_state = six.text_type(uuid.uuid4()) response = self.get_json(path='/openid/authorize', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_authorize_invalid_redirect_uri(self):\n invalid_params = self.valid_params.copy()\n invalid_params['redirect_uri'] = 'not_a_valid_uri'\n\n # Simple GET with invalid code parameters\n random_state = six.text_type(uuid.uuid4())\n response = self.get_json(path='/openid/auth...
[ "0.75373936", "0.7251968", "0.7147685", "0.7066093", "0.6928313", "0.6903567", "0.66213906", "0.65763414", "0.65235853", "0.6513123", "0.6497357", "0.626261", "0.61775184", "0.61602324", "0.61488956", "0.6142485", "0.6129963", "0.6106142", "0.60907656", "0.5985967", "0.598029...
0.7770297
0
Assert that a nonexistent scope redirects back to the redirect_uri and provides the expected error response.
def test_authorize_no_scope(self): invalid_params = self.valid_params.copy() del invalid_params['scope'] # Simple GET with invalid code parameters random_state = six.text_type(uuid.uuid4()) response = self.get_json(path='/openid/authorize', expec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_authorize_invalid_scope(self):\n invalid_params = self.valid_params.copy()\n invalid_params['scope'] = 'invalid_scope'\n\n # Simple GET with invalid code parameters\n random_state = six.text_type(uuid.uuid4())\n response = self.get_json(path='/openid/authorize',\n ...
[ "0.75156254", "0.7148414", "0.7028421", "0.7019475", "0.7017566", "0.67602414", "0.6492892", "0.6403846", "0.6372125", "0.62288857", "0.6219358", "0.6178828", "0.6163945", "0.61515033", "0.6126656", "0.6096851", "0.60844594", "0.6039896", "0.6037854", "0.6014855", "0.5999588"...
0.72937465
1
Assert that an invalid redirect_uri returns a 400 message with the appropriate error message encoded in the body of the response.
def test_authorize_invalid_redirect_uri(self): invalid_params = self.valid_params.copy() invalid_params['redirect_uri'] = 'not_a_valid_uri' # Simple GET with invalid code parameters random_state = six.text_type(uuid.uuid4()) response = self.get_json(path='/openid/authorize', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_response_request(self, mock_post):\n self._mock_response(mock_post, valid=False)\n\n random_state = six.text_type(uuid.uuid4())\n\n # Simple GET with various parameters\n response = self.get_json(path='/openid/authorize_return',\n expect_...
[ "0.7055511", "0.70326936", "0.6937571", "0.6726953", "0.6695739", "0.6667875", "0.6663773", "0.6658823", "0.66554034", "0.6631071", "0.6492055", "0.6474287", "0.6418554", "0.6386279", "0.6319697", "0.6296205", "0.6216002", "0.6185745", "0.61735564", "0.6173064", "0.6152858", ...
0.76964027
0
Assert that a nonexistent redirect_uri returns a 400 message with the appropriate error message encoded in the body of the response.
def test_authorize_no_redirect_uri(self): invalid_params = self.valid_params.copy() del invalid_params['redirect_uri'] # Simple GET with invalid code parameters random_state = six.text_type(uuid.uuid4()) response = self.get_json(path='/openid/authorize', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_authorize_invalid_redirect_uri(self):\n invalid_params = self.valid_params.copy()\n invalid_params['redirect_uri'] = 'not_a_valid_uri'\n\n # Simple GET with invalid code parameters\n random_state = six.text_type(uuid.uuid4())\n response = self.get_json(path='/openid/auth...
[ "0.7718685", "0.7033793", "0.6927159", "0.69097126", "0.69086397", "0.6898485", "0.6685903", "0.66302705", "0.65627855", "0.652894", "0.6524669", "0.649647", "0.6418248", "0.6401584", "0.6385468", "0.6310627", "0.6294222", "0.62791204", "0.6268177", "0.6264218", "0.62368065",...
0.7158007
1
Set the mock response from the openid endpoint to either true or false.
def _mock_response(self, mock_post, valid=True): mock_post.return_value.status_code = 200 if valid: mock_post.return_value.content = \ 'is_valid:true\nns:http://specs.openid.net/auth/2.0\n' else: mock_post.return_value.content = \ 'is_vali...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_boolean(self):\n endpoint = self.api.boolean\n assert endpoint.openapi_types['body'] == (bool,)\n assert endpoint.settings['response_type'] == (bool,)", "def test_update_true(self, mock_decorator):\n BceInstitutionRepository.create(\n uai='0802145Z', is_institution...
[ "0.6240062", "0.6088881", "0.6007175", "0.59424764", "0.5702211", "0.5642949", "0.56002766", "0.5597038", "0.5544386", "0.5502624", "0.5480442", "0.5476116", "0.54389155", "0.54300946", "0.54158604", "0.5402787", "0.53936625", "0.538996", "0.53734565", "0.5373242", "0.5370819...
0.6738863
0
This test ensures that the authorize request against the oauth endpoint succeeds with expected values.
def test_valid_response_request(self, mock_post): self._mock_response(mock_post, valid=True) random_state = six.text_type(uuid.uuid4()) # Simple GET with various parameters response = self.get_json(path='/openid/authorize_return', expect_errors=True, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_valid_authorize_request(self):\n\n random_state = six.text_type(uuid.uuid4())\n\n # Simple GET with various parameters\n response = self.get_json(path='/openid/authorize',\n expect_errors=True,\n state=random_state,\n ...
[ "0.8130674", "0.74779457", "0.74457616", "0.72292477", "0.7201043", "0.7180546", "0.7083249", "0.7080737", "0.701164", "0.70015174", "0.6941109", "0.69249433", "0.68833077", "0.67708033", "0.6765852", "0.6744", "0.67292756", "0.66937137", "0.6668326", "0.6645099", "0.6577298"...
0.6195167
65
This test ensures that a failed authorize request against the oauth endpoint succeeds with expected values.
def test_invalid_response_request(self, mock_post): self._mock_response(mock_post, valid=False) random_state = six.text_type(uuid.uuid4()) # Simple GET with various parameters response = self.get_json(path='/openid/authorize_return', expect_errors=True,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_valid_authorize_request(self):\n\n random_state = six.text_type(uuid.uuid4())\n\n # Simple GET with various parameters\n response = self.get_json(path='/openid/authorize',\n expect_errors=True,\n state=random_state,\n ...
[ "0.7597083", "0.7115931", "0.694993", "0.68572766", "0.68270195", "0.6803584", "0.6794347", "0.676999", "0.67678714", "0.6765921", "0.67112833", "0.6678244", "0.6673607", "0.6663366", "0.66527706", "0.6631267", "0.6621901", "0.6595489", "0.65829533", "0.65740633", "0.6573677"...
0.64417315
33
If the oauth response to storyboard is valid, but does not include a first name, it should error.
def test_invalid_redirect_no_name(self, mock_post): self._mock_response(mock_post, valid=True) random_state = six.text_type(uuid.uuid4()) invalid_params = self.valid_params.copy() del invalid_params['openid.sreg.fullname'] # Simple GET with various parameters response ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_account_failed_no_first_name(self):\n data = self.user_data.copy()\n data.pop('first_name')\n response = self.client.post(self.url, data, format='json')\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)\n self.assertEqual(response.data.get('mes...
[ "0.6980607", "0.67532706", "0.6614332", "0.6510425", "0.64004356", "0.6313224", "0.6111399", "0.6058819", "0.59927726", "0.5954338", "0.5952154", "0.59172636", "0.59120643", "0.5908101", "0.59018046", "0.5901233", "0.59007126", "0.58297175", "0.58180857", "0.57916963", "0.578...
0.56890607
27
If the oauth response to storyboard is valid, but does not include a first name, it should error.
def test_invalid_redirect_no_email(self, mock_post): self._mock_response(mock_post, valid=True) random_state = six.text_type(uuid.uuid4()) invalid_params = self.valid_params.copy() del invalid_params['openid.sreg.email'] # Simple GET with various parameters response = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_account_failed_no_first_name(self):\n data = self.user_data.copy()\n data.pop('first_name')\n response = self.client.post(self.url, data, format='json')\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)\n self.assertEqual(response.data.get('mes...
[ "0.69797575", "0.6752162", "0.6614019", "0.6509065", "0.6398914", "0.63115096", "0.6110045", "0.60614777", "0.5992452", "0.5954809", "0.59498775", "0.5918439", "0.5910095", "0.5906559", "0.59022", "0.5900585", "0.59002507", "0.58284384", "0.5816681", "0.579075", "0.57799935",...
0.0
-1
This test ensures that the access token request may execute properly with a valid token.
def test_valid_access_request(self): # Generate a valid auth token with base.HybridSessionManager(): authorization_code = auth_api.authorization_code_save({ 'user_id': 2, 'state': 'test_state', 'code': 'test_valid_code' }) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_read_o_auth_access_token(self):\n pass", "def test_create_o_auth_access_token(self):\n pass", "def test_access_token_get(self):\n client = oauth.Client(self.consumer, None)\n resp, content = client.request(self._uri('request_token'), \"GET\")\n\n self.assertEqual(int...
[ "0.8008994", "0.79901123", "0.7986423", "0.7827258", "0.76730573", "0.7581791", "0.7542795", "0.7538852", "0.7517634", "0.7500351", "0.7455751", "0.7445823", "0.7411423", "0.73875546", "0.7371738", "0.7253156", "0.72491294", "0.72450924", "0.72399", "0.7238495", "0.72369736",...
0.82178074
0
Assert that a newly created access token is valid if storyboard is installed in a multitude of timezones.
def test_valid_access_token_time(self): # Store the old TZ info, if it exists. old_tz = None if 'TZ' in os.environ: old_tz = os.environ['TZ'] # Convert now into every possible timezone out there :) for name in self.tested_timezones: # Override the 'defa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_expired_access_token_time(self):\n\n expired = datetime.datetime.now(pytz.utc) - datetime.timedelta(\n minutes=6)\n\n # Store the old TZ info, if it exists.\n old_tz = None\n if 'TZ' in os.environ:\n old_tz = os.environ['TZ']\n\n # Convert now into ...
[ "0.6694041", "0.60501355", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5809005", "0.5798218", "0.56382155", ...
0.74466926
0