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
Returns the 2 endpoints of an array of points from a line
def endpoints(line_points): neighbors = [] for p in line_points: aux = 0 for q in line_points: if np.linalg.norm(p-q) == 1: aux += 1 neighbors.append(aux) e_points = np.where(np.array(neighbors)==1) return line_points[e_points]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def endpoints_from_lines(lines):\n \n all_points = []\n for line in lines:\n for i in [0, -1]: # start and end point\n all_points.append(line.coords[i])\n \n unique_points = set(all_points)\n \n return [Point(p) for p in unique_points]", "def get_line_end_pts(line_segment, ...
[ "0.75531864", "0.7405382", "0.69150645", "0.6756434", "0.6724094", "0.6720841", "0.66821533", "0.6652843", "0.6637193", "0.65996283", "0.65701735", "0.6523543", "0.6521626", "0.65032506", "0.6477672", "0.64699537", "0.64601064", "0.6448242", "0.6385857", "0.63586706", "0.6358...
0.73925066
2
Get a logger for a specific purpose. Basic usage is to for each module that needs logging, call 'logger = logging.get_logger(__name__)' to set a modulelevel global logger.
def get_logger(name): return StyleAdapter(logging.getLogger(name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_logger():\r\n global logger\r\n \r\n if logger:\r\n return logger\r\n else:\r\n return create_logger()", "def get_logger(name):\n return logging.getLogger(name)", "def get_logger(module_name):\n def _logger():\n \"\"\" Callable used to obtain current logger object...
[ "0.7938005", "0.78668797", "0.78630835", "0.78493756", "0.784605", "0.780038", "0.7736073", "0.7707276", "0.77039444", "0.76648456", "0.7646837", "0.76465005", "0.7646473", "0.7603179", "0.75954074", "0.7564453", "0.75037366", "0.74899465", "0.747234", "0.7368471", "0.7366843...
0.0
-1
This method is used for both 'xcworkspace' and 'xcodeproj' classes. It returns a list of schemes that are labeled as 'user' or 'shared'.
def schemes(self): schemes = []; # shared schemes if XCSchemeHasSharedSchemes(self.path.obj_path) == True: shared_path = XCSchemeGetSharedPath(self.path.obj_path); shared_schemes = XCSchemeParseDirectory(shared_path); for scheme in shared_schemes: scheme.shared = True; scheme.container = self.path; schemes.append(scheme); # user schemes if XCSchemeHasUserSchemes(self.path.obj_path) == True: user_path = XCSchemeGetUserPath(self.path.obj_path); user_schemes = XCSchemeParseDirectory(user_path); for scheme in user_schemes: scheme.container = self.path; schemes.append(scheme); return schemes;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_known_schemes_for_multi_store():\n return location.SCHEME_TO_CLS_BACKEND_MAP.keys()", "def getSchemes(clazz):\n return [\"sftp\"]", "def get_uri_schemes(self):\n return list(sorted(self.backends.with_playlists.keys()))", "def get_uri_schemes(self) -> list[backend.UriScheme]:\n ...
[ "0.644051", "0.6145727", "0.60370487", "0.60277617", "0.59321177", "0.5927999", "0.58466095", "0.5695372", "0.55060184", "0.549612", "0.5412193", "0.53077865", "0.52500373", "0.52307934", "0.5067795", "0.50209284", "0.5003262", "0.49941736", "0.49602288", "0.49374494", "0.490...
0.7739919
0
This method is used for both 'xcworkspace' and 'xcodeproj' classes. It returns a two
def hasSchemeWithName(self, scheme_name): schemes = self.schemes(); found_scheme = None; scheme_filter = filter(lambda scheme: scheme.name == scheme_name, schemes); if len(scheme_filter) > 0: found_scheme = scheme_filter[0]; return (found_scheme != None, found_scheme);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _GetProjectAndAccount(self):\n if self.config.obfuscate:\n return ('me', 'myself@i')\n if not self.args.IsSpecified('project'):\n named_configs.ActivePropertiesFile().Invalidate()\n project = properties.VALUES.core.project.Get() or '<NO PROJECT SET>'\n account = properties.VALUES.core.acc...
[ "0.5939202", "0.5331718", "0.53269327", "0.52105683", "0.5156123", "0.5153325", "0.50393933", "0.49730104", "0.49730104", "0.49730104", "0.4952081", "0.49458227", "0.49184904", "0.4889443", "0.4889362", "0.4869489", "0.48354203", "0.48226613", "0.4821604", "0.48084083", "0.47...
0.0
-1
Display information about server or target
def func(self): account = self.account city_name = 'Phoenix' if not self.args else self.args a = Astral() a.solar_depression = 'civil' city = a[city_name] if not city: return timezone = city.timezone sun = city.sun(date=datetime.date.today(), local=True) account.msg('Information for %s/%s\n' % (city_name, city.region)) account.msg('Timezone: %s' % timezone) account.msg('Latitude: %.02f; Longitude: %.02f' % (city.latitude, city.longitude)) account.msg('Dawn: %s' % str(sun['dawn'])) account.msg('Sunrise: %s' % str(sun['sunrise'])) account.msg('Noon: %s' % str(sun['noon'])) account.msg('Sunset: %s' % str(sun['sunset'])) account.msg('Dusk: %s' % str(sun['dusk']))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_serverinfo(self, server):\n print('QManager server:', self._server)\n server_info = self._qm.get_server_info()\n for k, v in server_info.items():\n print(' %s: %s' % (k, v))", "def server_info(ctx):\n data = ctx.obj.get_server_info()\n output_json_data(data)", "asy...
[ "0.72389144", "0.70208263", "0.6947981", "0.6858957", "0.66273963", "0.6501815", "0.64122075", "0.626067", "0.6243138", "0.623907", "0.6233489", "0.6219578", "0.6212143", "0.6208515", "0.6188572", "0.6180633", "0.6169564", "0.6101906", "0.6085284", "0.6084221", "0.6083808", ...
0.0
-1
Given map and model estimate resolution by maximizing map CC(map, modelmap). As a byproduct, also provides CC and optimal overall Bfactor.
def __init__(self, map_data, xray_structure, d_min_min=None, nproc=1): unit_cell = xray_structure.unit_cell() d_min_end = round(maptbx.d_min_from_map( map_data=map_data, unit_cell=unit_cell, resolution_factor=0.1),1) d_min_start = round(maptbx.d_min_from_map( map_data=map_data, unit_cell=unit_cell, resolution_factor=0.5),1) if(d_min_min is not None and d_min_start<d_min_min): d_min_start=d_min_min step = (d_min_end-d_min_start)/10. b_range=[0,10,20,30,40,50,60,70,80,90,100,150,200] if(d_min_end>10): b_range = b_range + [300,400,500] result, b_iso, cc, radius = _resolution_from_map_and_model_helper( map = map_data, xray_structure = xray_structure, b_range = b_range, d_min_start = d_min_start, d_min_end = d_min_end, d_min_step = step, approximate = False, nproc = nproc, second = False) if(cc<0.5): self.d_min, self.b_iso, self.cc, self.radius = None,None,None,None else: if(d_min_min is not None and result<d_min_min): result=d_min_min scale=1 if(result<3): scale=2 b_range=[i for i in range(0,506,5)] d_min_start = round(result-result/2, 1) d_min_end = round(result+result/2*scale, 1) if(d_min_min is not None and d_min_start<d_min_min): d_min_start=d_min_min self.d_min, self.b_iso, self.cc, self.radius = _resolution_from_map_and_model_helper( map = map_data, xray_structure = xray_structure, b_range = b_range, d_min_start = d_min_start, d_min_end = d_min_end, d_min_step = 0.1, approximate = True, nproc = nproc, second = True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self):\n start = timer()\n # encode into milp\n me = MILPEncoder(MILPSolver.prob,\n MILPSolver.params.logger.LOGFILE, \n MILPSolver.params.INTRA_DEP_CONSTRS,\n MILPSolver.params.INTER_DEP_CONSTRS)\n if MIL...
[ "0.5714574", "0.57091874", "0.56935656", "0.560293", "0.54859185", "0.54807884", "0.5452945", "0.54312307", "0.5425042", "0.5412584", "0.53376436", "0.53328913", "0.5325986", "0.53229344", "0.5320904", "0.5318339", "0.53176457", "0.5300573", "0.5285679", "0.52541053", "0.5253...
0.0
-1
Test if the code is generated by a given feature.
def test_generate(monkeypatch, capsys): monkeypatch.setattr(sys, "argv", ["", "generate", os.path.join(PATH, "generate.feature")]) main() out, err = capsys.readouterr() assert out == textwrap.dedent( ''' # coding=utf-8 """Code generation feature tests.""" from pytest_bdd import ( given, scenario, then, when, ) @scenario('scripts/generate.feature', 'Given and when using the same fixture should not evaluate it twice') def test_given_and_when_using_the_same_fixture_should_not_evaluate_it_twice(): """Given and when using the same fixture should not evaluate it twice.""" @given('1 have a fixture (appends 1 to a list) in reuse syntax') def have_a_fixture_appends_1_to_a_list_in_reuse_syntax(): """1 have a fixture (appends 1 to a list) in reuse syntax.""" raise NotImplementedError @given('I have an empty list') def i_have_an_empty_list(): """I have an empty list.""" raise NotImplementedError @when('I use this fixture') def i_use_this_fixture(): """I use this fixture.""" raise NotImplementedError @then('my list should be [1]') def my_list_should_be_1(): """my list should be [1].""" raise NotImplementedError '''[ 1: ].replace( u"'", u"'" ) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def need_feature_generation(self):\n if self.feature_cmd_params:\n return True\n return False", "def need_feature_generation(self):\n if self.feature_cmd_params:\n return True\n return False", "def is_codegen(self):\r\n return self.has_label('codegen')", "...
[ "0.65903217", "0.65903217", "0.644704", "0.6116954", "0.59947085", "0.5969095", "0.5945452", "0.5891829", "0.5681718", "0.5662601", "0.55940044", "0.5539872", "0.54797906", "0.5448133", "0.54353863", "0.5412818", "0.54071283", "0.533634", "0.5321914", "0.53043", "0.5292037", ...
0.5757439
8
Returns a normalized 2D gauss kernel array for convolutions
def gauss_kernel(size, size_y=None): size = int(size) if not size_y: size_y = size else: size_y = int(size_y) x, y = mgrid[-size: size + 1, -size_y: size_y + 1] g = exp(-(x ** 2 / float(size) + y ** 2 / float(size_y))) return g / g.sum()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_gauss_kernel(sigma, samples):\n p = ny.ceil (2*ny.sqrt(2*ny.log(2))*sigma)\n r = ny.linspace(-p, p, samples)\n x,y = ny.meshgrid(r, r)\n b=bivariate_normal(x,y,sigma,sigma)\n A=(1/ny.sum(b))\n B=A*b\n return x,y,B", "def test_gauss_kernel():\n\n gauss = gauss_kernel(2, 5)\n\n a...
[ "0.6883207", "0.67762655", "0.64694875", "0.63874155", "0.6357571", "0.63324594", "0.6317897", "0.630675", "0.62914956", "0.62589204", "0.62336004", "0.616739", "0.6149477", "0.61113864", "0.6096338", "0.605444", "0.60538787", "0.60399646", "0.6037839", "0.6003877", "0.599997...
0.60346377
19
returns x and y derivatives of a 2D gauss kernel array for convolutions
def gauss_derivative_kernels(size, size_y=None): size = int(size) if not size_y: size_y = size else: size_y = int(size_y) y, x = mgrid[-size: size + 1, -size_y: size_y + 1] # x and y derivatives of a 2D gaussian with standard dev half of size # (ignore scale factor) gx = - x * exp(-(x ** 2 / float((0.5 * size) ** 2) + y ** 2 / float((0.5 * size_y) ** 2))) gy = - y * exp(-(x ** 2 / float((0.5 * size) ** 2) + y ** 2 / float((0.5 * size_y) ** 2))) return gx, gy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gauss_derivatives(im, n, ny=None):\n\n gx, gy = gauss_derivative_kernels(n, size_y=ny)\n\n imx = signal.convolve(im, gx, mode='same')\n imy = signal.convolve(im, gy, mode='same')\n\n return imx, imy", "def test_gauss_kernel():\n\n gauss = gauss_kernel(2, 5)\n\n assert gauss.shape == (5, 5)\...
[ "0.6464445", "0.6400031", "0.6292199", "0.62704843", "0.622417", "0.6203519", "0.6186446", "0.6149553", "0.6084668", "0.59506327", "0.5876299", "0.586569", "0.58355033", "0.58145", "0.58079106", "0.5799519", "0.57833916", "0.5765829", "0.57556885", "0.57517755", "0.5751735", ...
0.6867467
0
returns x and y derivatives of an image using gaussian derivative filters of size n. The optional argument ny allows for a different size in the y direction.
def gauss_derivatives(im, n, ny=None): gx, gy = gauss_derivative_kernels(n, size_y=ny) imx = signal.convolve(im, gx, mode='same') imy = signal.convolve(im, gy, mode='same') return imx, imy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gauss_derivative_kernels(size, size_y=None):\n size = int(size)\n if not size_y:\n size_y = size\n else:\n size_y = int(size_y)\n y, x = mgrid[-size: size + 1, -size_y: size_y + 1]\n\n # x and y derivatives of a 2D gaussian with standard dev half of size\n # (ignore scale factor...
[ "0.61548144", "0.5981589", "0.5959965", "0.58838403", "0.58367634", "0.57715976", "0.5677056", "0.5670111", "0.56048477", "0.56043017", "0.55708915", "0.5549236", "0.5539912", "0.5506071", "0.549919", "0.54970866", "0.53928995", "0.5380421", "0.53599995", "0.5349", "0.5330634...
0.8174752
0
Decorator that can be used to cache ReusableBytesIO objects intended for reading. The decorator makes sure the objects are immutable and reset to position 0. The decorated function can either return pure ReusableBytesIO objects or dicts.
def buffer_object_cacher(key=None, maxsize=None): if not config.enable_caching: return lambda x: x def decorator(fun): # Cache the results. cached_fun = cachetools.cached(cachetools.LRUCache(maxsize=maxsize), key=lambda *x,**y: cachetools.keys.hashkey(key(*x,**y)))(fun) # Reset the buffer(s) on every cache-hit so it's readable again. def rewind_wrapper(*args, **kwargs): results = cached_fun(*args, **kwargs) if isinstance(results, dict): for buffer in results.values(): buffer.seek(0) else: results.seek(0) return results return rewind_wrapper return decorator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_buffer():\n return BytesIO()", "def cached_load(filepath: str) -> io.BytesIO:\n with open(filepath, 'rb') as f:\n return io.BytesIO(f.read())", "def disk_memoize(path):\n def decorator(f):\n @functools.wraps(f)\n def g(*a, **kw):\n kwargs = to_kwargs(f, *a, **k...
[ "0.6126323", "0.59865415", "0.5825444", "0.58154047", "0.57380855", "0.5698068", "0.5697662", "0.55716634", "0.55687535", "0.55656105", "0.5557927", "0.5528658", "0.54908526", "0.5479148", "0.54592925", "0.54238856", "0.54096276", "0.5385697", "0.53558767", "0.5354645", "0.53...
0.63631254
0
Returns a tuple representing the hardware specs.
def getHardware(self): return (self.vendorId, self.deviceId, self.physicalMemory, self.osInfo, self.cpuSpeed[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_hardware_info(self) -> list:\n model = ctypes.create_string_buffer(8)\n model_size = ctypes.c_ulong(8)\n type_num = ctypes.c_ushort()\n channel_num = ctypes.c_ushort()\n notes = ctypes.create_string_buffer(48)\n notes_size = ctypes.c_ulong(48)\n firmware_ve...
[ "0.7078182", "0.6386408", "0.60863703", "0.60038155", "0.5982613", "0.59652555", "0.59633815", "0.594874", "0.59447217", "0.5936363", "0.58740854", "0.5844497", "0.5777375", "0.5739162", "0.5714293", "0.56568074", "0.5644492", "0.56364363", "0.5634876", "0.563088", "0.56237",...
0.7476962
0
Returns true if the other session or sample has the same hardware specs as this one, false otherwise.
def sameHardware(self, other): return (self.vendorId == other.vendorId and \ self.deviceId == other.deviceId and \ self.physicalMemory == other.physicalMemory and \ self.osInfo == other.osInfo and \ self.cpuSpeed[0] == other.cpuSpeed[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _on_same_device(self, other: \"PArray\") -> bool:\n this_device = self._current_device_index\n return this_device in other._array", "def match(uspec1, uspec2):\n \n if uspec1.is_power_onoff() and uspec2.is_power_onoff():\n return True\n \n if uspec1.number_windows() != uspec2...
[ "0.6838293", "0.666635", "0.65126216", "0.64928484", "0.63411206", "0.6300568", "0.62982696", "0.61403143", "0.6127172", "0.6109003", "0.6074839", "0.60358554", "0.59964126", "0.59953624", "0.5989709", "0.59614843", "0.59588736", "0.59384286", "0.59161776", "0.5901873", "0.58...
0.7975851
0
Calculates the average FPS for this player, over all of the player's different sessions.
def calcFrameRate(self): tot = 0 count = 0 for session in self.sessions: for sample in session.samples: if not sample.isLoading: tot += sample.fps count += 1 if count: self.avgFps = tot / count self.lowFps = (self.avgFps < 10) self.highFps = (self.avgFps > 25)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fps(self):\n \n return self.fps, self.average_fps", "def get_fps(self):\n return self._num_frames / (datetime.now() - self._start).total_seconds()", "def update_fps(self, fps):\n self.fps_history.append(fps)\n if len(self.fps_history) > FPS_AVERAGES:\n self...
[ "0.635384", "0.6108307", "0.6086766", "0.59754205", "0.59748524", "0.5926207", "0.5866448", "0.5856975", "0.58385223", "0.5776392", "0.57533216", "0.57494795", "0.5631522", "0.55880743", "0.5585366", "0.5568593", "0.5568593", "0.5568593", "0.55296254", "0.5512434", "0.5473437...
0.72921765
0
Reads the clientfps lines from the indicated logfile, and writes card_performance.csv, without building up large tables.
def quickAnalyzeCards(self, filename): assert filename.endswith('.txt') file = open(filename, 'r') quickCards = {} for line in file: line = line.strip() if not line: continue columns = line.split('|') if columns[1] != 'client-fps': continue sample = Sample(line, columns) if sample.isLoading: continue if sample.vendorId == None or sample.deviceId == None: continue # Now accumulate this sample into the cards table. options = quickCards.setdefault((sample.vendorId, sample.deviceId), {}) totFps, count = options.get(sample.gameOptionsCode, (0, 0)) totFps += sample.fps count += 1 options[sample.gameOptionsCode] = (totFps, count) file = open('card_performance.csv', 'w') deviceList = quickCards.keys() deviceList.sort() for deviceTuple in deviceList: options = quickCards[deviceTuple] codes = options.keys() codes.sort() for gameOptionsCode in codes: totFps, count = options[gameOptionsCode] avgFps = totFps / count print >> file, '%s, %s, %s, %s' % ( self.__formatDevice(deviceTuple), gameOptionsCode, avgFps, count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grep_log_files_put_to_csv_output(path):\n log_process = LogProcess()\n log_process.log_path = path\n log_process.output_path = os.path.join(path, \"temp\")\n obj_file.cleanup_dir(log_process.output_path)\n csv_alarm, no_contact = log_process.altc()\n csv_alarm_history = log_process.lgjc()\n ...
[ "0.55250233", "0.54603183", "0.5450724", "0.5413982", "0.5379444", "0.53514105", "0.52793115", "0.52764195", "0.5269211", "0.5259841", "0.5198763", "0.5174568", "0.5164108", "0.5136736", "0.5116632", "0.5114831", "0.51126087", "0.5108278", "0.5103108", "0.50868624", "0.507331...
0.5976573
0
Reads the clientfps lines from the indicated logfile into the Analyzer. This is the main interface to read raw data from the server.
def readText(self, filename, firstLine = 0, lastLine = None): assert filename.endswith('.txt') file = open(filename, 'r') self.samples = [] li = 0 while li < firstLine: if not file.readline(): return li += 1 while lastLine == None or li < lastLine: line = file.readline() if not line: return li += 1 line = line.strip() if line: columns = line.split('|') if columns[1] == 'client-fps': self.samples.append(Sample(line, columns))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_log(self):\n\n line_regex = compile(r\"\\[I\\]\\s*\\(\\d+ms\\)[^\\d]+(?P<counter>\\d+)\"\n r\"[^\\d]+(?P<timestamp>\\d+(\\.\\d+)?)[^\\d]+\"\n r\"(?P<acceleration>\\d+);\")\n values = []\n with open(self.filepath) as file:\n ...
[ "0.6168366", "0.61174154", "0.60710835", "0.57544655", "0.5584042", "0.5498605", "0.5488151", "0.547809", "0.54696566", "0.54012346", "0.5350959", "0.5345476", "0.53420615", "0.53355366", "0.5307551", "0.5307535", "0.52456975", "0.52440536", "0.5232471", "0.52123123", "0.5182...
0.5063487
35
Does the work of analyzing all of the data read in the previous call to readText(). This is the meat of the analyzer.
def analyze(self): self.makeSessions() self.collectPlayers() self.__analyze()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def analyse(self):\n logging.info(\"transferring text to CorpusCook...\")\n\n paragraphs = self.text.split('\\n\\n')\n print(\"mean length of splitted lines\", (mean([len(p) for p in paragraphs])))\n\n # If TIKA resolved '\\n'\n if (mean([len(p) for p in paragraphs])) > 80:\n ...
[ "0.68422043", "0.6633991", "0.65388185", "0.637483", "0.6279562", "0.6157252", "0.61434984", "0.610618", "0.6089409", "0.6081509", "0.60237473", "0.5994796", "0.59370583", "0.59326017", "0.5893664", "0.5862024", "0.5855501", "0.58262473", "0.58164513", "0.58102053", "0.580787...
0.0
-1
Write the samples for all players with less than 10 fps average frame rate to the indicated text file. This generates a new log file that may be analyzed independently.
def writeLowPlayers(self, filename): assert filename.endswith('.txt') file = open(filename, 'w') samples = [] for player in self.players: if player.lowFps: for session in player.sessions: for sample in session.samples: sample.write(file)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_logs(self):\n for i in range(30):\n with open('{}-{}.log'.format(self._log_file_path, i), 'a') as log_file:\n for _ in range(self._log_rate):\n log_file.write(self._log_record + '\\n')", "def debug_file(self, pkt_count, attack_count, data_list, ds_calc_time, ds_vals, metric_means...
[ "0.6171279", "0.59173375", "0.5693433", "0.5600852", "0.555415", "0.5504344", "0.54048634", "0.53820014", "0.5346854", "0.53364265", "0.53228056", "0.52732503", "0.52012616", "0.5186444", "0.517446", "0.5160905", "0.51368034", "0.5127677", "0.51274544", "0.5126001", "0.512328...
0.72644055
0
Writes the entire analyzer to a pickle file, for saving it across sessions. Not terribly useful, since you can always just read the text file again. This is a little bit faster, though.
def writePickle(self, filename): assert filename.endswith('.pkl') file = open(filename, 'wb') cPickle.dump(self, file, cPickle.HIGHEST_PROTOCOL)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, filename=\"matpipe.p\"):\n temp_backend = self.learner.backend\n self.learner._backend = self.learner.backend.fitted_pipeline_\n for obj in [self, self.learner, self.reducer, self.cleaner,\n self.autofeaturizer]:\n obj._logger = None\n with o...
[ "0.63167715", "0.61267745", "0.61015433", "0.608488", "0.6059269", "0.6031452", "0.5898048", "0.58106905", "0.5757367", "0.57421386", "0.571337", "0.5705606", "0.56701314", "0.5667776", "0.56589854", "0.56589836", "0.5654374", "0.56400377", "0.56398267", "0.5634741", "0.56241...
0.0
-1
Internal method to collect individual clientfps samples into related sessions.
def makeSessions(self): sessionDict = {} self.sessions = [] for sample in self.samples: session = sessionDict.get(sample.avId, None) if session: # Is this still the same session? elapsedA = sample.date - session.endDate assert elapsedA >= 0 elapsedB = sample.timeInGame - session.timeInGame if elapsedB < 0: # Reported time-in-game smaller than last sample. session = None elif elapsedA > 1800 or elapsedB > 1800: # Too much time elapsed between consecutive # samples. session = None elif not session.sameHardware(sample): # New hardware. session = None if not session: session = Session(sample) sessionDict[sample.avId] = session self.sessions.append(session) else: session.addSample(sample) for session in self.sessions: session.calcFrameRate()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_samples(self):\n self.replay_buffer = self.collect_initial_batch(\n self.replay_buffer, self.acm_pre_train_samples\n )", "def collect_samples(self):\n # TODO refactor this to not to duplicate collect from DDPG\n # - not so easy due to logger :(\n col...
[ "0.6620976", "0.6284045", "0.59943616", "0.5915122", "0.5489073", "0.5375032", "0.5372684", "0.53488225", "0.532472", "0.531502", "0.531284", "0.5284829", "0.52701354", "0.5267627", "0.52433234", "0.52414626", "0.5237697", "0.5233825", "0.5217491", "0.5209853", "0.5200325", ...
0.6239438
2
Internal method to group individual sessions by player.
def collectPlayers(self): playerDict = {} self.hardware = {} for session in self.sessions: player = playerDict.get(session.avId, None) if not player: player = Player(session.avId) playerDict[session.avId] = player player.addSession(session) self.hardware.setdefault((player, session.getHardware()), []).append(session) self.players = playerDict.values() for player in self.players: player.calcFrameRate()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _group_sessions(self, sessions):\n session_dict = collections.defaultdict(list)\n for session in sessions:\n session_dict[session.query].append(session)\n return session_dict", "def get_groups_of_player(self, player: str) -> list:\n return [group for group in self._grou...
[ "0.6594691", "0.6511603", "0.6109347", "0.6027776", "0.5668092", "0.56667185", "0.5573631", "0.5494839", "0.5469459", "0.5462861", "0.54250926", "0.5422447", "0.54118776", "0.54043454", "0.5363722", "0.5343578", "0.52973384", "0.5274449", "0.52449733", "0.52271664", "0.519147...
0.6386398
2
The cpu speed is in 100's of MHz.
def __formatCpuSpeed(self, cpuSpeed): return '%.1f GHz' % (cpuSpeed / 10.0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cpu_speed(self):\n\t\treturn call_sdk_function('PrlSrvCfg_GetCpuSpeed', self.handle)", "def speed(self):\n return 1 # speed system not implemented yet", "def frequency(self):\n return self.reference_clock_speed / 4096 / self.prescale_reg", "def speed(self) -> int:", "def speed(self) -> in...
[ "0.74917567", "0.74589694", "0.7335953", "0.7257771", "0.7257771", "0.7203033", "0.7179013", "0.71334624", "0.71179646", "0.71057755", "0.7099538", "0.7064058", "0.7020678", "0.6938121", "0.6884253", "0.687121", "0.687121", "0.6864354", "0.6832936", "0.6808417", "0.6804985", ...
0.73974395
2
Returns total number of players whose avg fps is less than 10, total number of players whose avg fps is between 10 and 25, and total number of players whose avg fps is more than 25.
def __countPlayers(self, players): numLow = sum(map(lambda p: p.lowFps, players)) numHigh = sum(map(lambda p: p.highFps, players)) numMed = len(players) - numLow - numHigh return '%s, %s, %s' % (numLow, numMed, numHigh)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stats(detections, faces):\n vp, fp, fn, vn = 0, 0, 0, 0\n max_label = np.max(faces[:, 0])\n for i in range(max_label + 1):\n detections_i = get_label_with_index(detections, i)\n faces_i = get_label_with_index(faces, i)\n local_vp = 0\n for face in faces_i:\n foun...
[ "0.60739285", "0.59108806", "0.5869163", "0.5824232", "0.5684692", "0.56706446", "0.56420135", "0.55896056", "0.557531", "0.55514854", "0.5549805", "0.551023", "0.5500134", "0.54782814", "0.5471912", "0.544629", "0.5406683", "0.5397825", "0.5371873", "0.53278965", "0.5309981"...
0.63204354
0
Reads PCIList, which contains a list of the known PCI devices by vendor ID/device ID. See
def readPCIList(self): self.vendors = {} self.devices = {} vendorId = None vendorName = None for line in PCIList.split('\n'): stripped = line.lstrip() if not stripped or stripped[0] == ';': continue if line[0] != '\t': # A vendor line. vendorId, vendorName = line.split('\t', 1) vendorId = int(vendorId, 16) self.vendors[vendorId] = vendorName.strip() else: # A device line, continuing the previous vendor. deviceId, deviceName = line[1:].split('\t', 1) deviceId = deviceId.split(' ', 1)[0] try: deviceId = int(deviceId, 16) except: deviceId = None self.devices[(vendorId, deviceId)] = deviceName.strip() self.addExtraDevices()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_pci_devices(self):\n\n system = self._get_host_details()\n if ('links' in system['Oem']['Hp'] and\n 'PCIDevices' in system['Oem']['Hp']['links']):\n # Get the PCI URI and Settings\n pci_uri = system['Oem']['Hp']['links']['PCIDevices']['href']\n ...
[ "0.6974894", "0.6744383", "0.6441267", "0.59418535", "0.588758", "0.5535207", "0.55204946", "0.5497702", "0.5481925", "0.5473312", "0.54184794", "0.5417257", "0.54155695", "0.5406843", "0.5379454", "0.53526473", "0.5350712", "0.53472716", "0.53472596", "0.53421974", "0.532810...
0.8187731
0
Adds extra device names that we know explicitly from some external source.
def addExtraDevices(self): # These tables were extracted from # pirates/src/piratesgui/GameOptions.py. ati_device_list = [ ["ATI MOBILITY/RADEON X700", 0x5653], [1, "Radeon X1950 XTX Uber - Limited Edition", 0x7248], [1, "Radeon X1950 XTX Uber - Limited Edition Secondary", 0x7268], [1, "Radeon X800 CrossFire Edition", 0x554D], [1, "Radeon X800 CrossFire Edition Secondary", 0x556D], [1, "Radeon X850 CrossFire Edition", 0x5D52], [1, "Radeon X850 CrossFire Edition Secondary", 0x5D72], ["Radeon X550/X700 Series", 0x564F], ["ATI FireGL T2", 0x4154], ["ATI FireGL T2 Secondary", 0x4174], ["ATI FireGL V3100", 0x5B64], ["ATI FireGL V3100 Secondary", 0x5B74], ["ATI FireGL V3200", 0x3E54], ["ATI FireGL V3200 Secondary", 0x3E74], ["ATI FireGL V3300", 0x7152], ["ATI FireGL V3300 Secondary", 0x7172], ["ATI FireGL V3350", 0x7153], ["ATI FireGL V3350 Secondary", 0x7173], ["ATI FireGL V3400", 0x71D2], ["ATI FireGL V3400 Secondary", 0x71F2], ["ATI FireGL V5000", 0x5E48], ["ATI FireGL V5000 Secondary", 0x5E68], ["ATI FireGL V5100", 0x5551], ["ATI FireGL V5100 Secondary", 0x5571], ["ATI FireGL V5200", 0x71DA], ["ATI FireGL V5200 Secondary", 0x71FA], ["ATI FireGL V5300", 0x7105], ["ATI FireGL V5300 Secondary", 0x7125], ["ATI FireGL V7100", 0x5550], ["ATI FireGL V7100 Secondary", 0x5570], ["ATI FireGL V7200", 0x5D50], ["ATI FireGL V7200 ", 0x7104], ["ATI FireGL V7200 Secondary", 0x5D70], ["ATI FireGL V7200 Secondary ", 0x7124], ["ATI FireGL V7300", 0x710E], ["ATI FireGL V7300 Secondary", 0x712E], ["ATI FireGL V7350", 0x710F], ["ATI FireGL V7350 Secondary", 0x712F], ["ATI FireGL X1", 0x4E47], ["ATI FireGL X1 Secondary", 0x4E67], ["ATI FireGL X2-256/X2-256t", 0x4E4B], ["ATI FireGL X2-256/X2-256t Secondary", 0x4E6B], ["ATI FireGL X3-256", 0x4A4D], ["ATI FireGL X3-256 Secondary", 0x4A6D], ["ATI FireGL Z1", 0x4147], ["ATI FireGL Z1 Secondary", 0x4167], ["ATI FireMV 2200", 0x5B65], ["ATI FireMV 2200 Secondary", 0x5B75], ["ATI FireMV 2250", 0x719B], ["ATI FireMV 2250 Secondary", 0x71BB], ["ATI FireMV 2400", 0x3151], ["ATI FireMV 2400 Secondary", 0x3171], ["ATI FireStream 2U", 0x724E], ["ATI FireStream 2U Secondary", 0x726E], ["ATI MOBILITY FIRE GL 7800", 0x4C58], ["ATI MOBILITY FIRE GL T2/T2e", 0x4E54], ["ATI MOBILITY FireGL V3100", 0x5464], ["ATI MOBILITY FireGL V3200", 0x3154], ["ATI MOBILITY FireGL V5000", 0x564A], ["ATI MOBILITY FireGL V5000 ", 0x564B], ["ATI MOBILITY FireGL V5100", 0x5D49], ["ATI MOBILITY FireGL V5200", 0x71C4], ["ATI MOBILITY FireGL V5250", 0x71D4], ["ATI MOBILITY FireGL V7100", 0x7106], ["ATI MOBILITY FireGL V7200", 0x7103], ["ATI MOBILITY RADEON", 0x4C59], ["ATI MOBILITY RADEON 7500", 0x4C57], ["ATI MOBILITY RADEON 9500", 0x4E52], ["ATI MOBILITY RADEON 9550", 0x4E56], ["ATI MOBILITY RADEON 9600/9700 Series", 0x4E50], ["ATI MOBILITY RADEON 9800", 0x4A4E], ["ATI Mobility Radeon HD 2300", 0x7210], ["ATI Mobility Radeon HD 2300 ", 0x7211], ["ATI Mobility Radeon HD 2400", 0x94C9], ["ATI Mobility Radeon HD 2400 XT", 0x94C8], [1, "ATI Mobility Radeon HD 2600", 0x9581], [1, "ATI Mobility Radeon HD 2600 XT", 0x9583], ["ATI Mobility Radeon X1300", 0x714A], ["ATI Mobility Radeon X1300 ", 0x7149], ["ATI Mobility Radeon X1300 ", 0x714B], ["ATI Mobility Radeon X1300 ", 0x714C], ["ATI Mobility Radeon X1350", 0x718B], ["ATI Mobility Radeon X1350 ", 0x718C], ["ATI Mobility Radeon X1350 ", 0x7196], ["ATI Mobility Radeon X1400", 0x7145], ["ATI Mobility Radeon X1450", 0x7186], ["ATI Mobility Radeon X1450 ", 0x718D], ["ATI Mobility Radeon X1600", 0x71C5], ["ATI Mobility Radeon X1700", 0x71D5], ["ATI Mobility Radeon X1700 ", 0x71DE], ["ATI Mobility Radeon X1700 XT", 0x71D6], [1, "ATI Mobility Radeon X1800", 0x7102], [1, "ATI Mobility Radeon X1800 XT", 0x7101], [1, "ATI Mobility Radeon X1900", 0x7284], [1, "ATI Mobility Radeon X2300", 0x718A], [1, "ATI Mobility Radeon X2300 ", 0x7188], ["ATI MOBILITY RADEON X300", 0x5461], ["ATI MOBILITY RADEON X300 ", 0x5460], ["ATI MOBILITY RADEON X300 ", 0x3152], ["ATI MOBILITY RADEON X600", 0x3150], ["ATI MOBILITY RADEON X600 SE", 0x5462], ["ATI MOBILITY RADEON X700", 0x5652], ["ATI MOBILITY RADEON X700 ", 0x5653], ["ATI MOBILITY RADEON X700 Secondary", 0x5673], [1, "ATI MOBILITY RADEON X800", 0x5D4A], [1, "ATI MOBILITY RADEON X800 XT", 0x5D48], ["ATI Radeon 9550/X1050 Series", 0x4153], ["ATI Radeon 9550/X1050 Series Secondary", 0x4173], ["ATI RADEON 9600 Series", 0x4150], ["ATI RADEON 9600 Series ", 0x4E51], ["ATI RADEON 9600 Series ", 0x4151], ["ATI RADEON 9600 Series ", 0x4155], ["ATI RADEON 9600 Series ", 0x4152], ["ATI RADEON 9600 Series Secondary", 0x4E71], ["ATI RADEON 9600 Series Secondary ", 0x4171], ["ATI RADEON 9600 Series Secondary ", 0x4170], ["ATI RADEON 9600 Series Secondary ", 0x4175], ["ATI RADEON 9600 Series Secondary ", 0x4172], [1, "ATI Radeon HD 2900 XT", 0x9402], [1, "ATI Radeon HD 2900 XT ", 0x9403], [1, "ATI Radeon HD 2900 XT ", 0x9400], [1, "ATI Radeon HD 2900 XT ", 0x9401], ["ATI Radeon X1200 Series", 0x791E], ["ATI Radeon X1200 Series ", 0x791F], [1, "ATI Radeon X1950 GT", 0x7288], [1, "ATI Radeon X1950 GT Secondary", 0x72A8], [1, "ATI RADEON X800 GT", 0x554E], [1, "ATI RADEON X800 GT Secondary", 0x556E], [1, "ATI RADEON X800 XL", 0x554D], [1, "ATI RADEON X800 XL Secondary", 0x556D], [1, "ATI RADEON X850 PRO", 0x4B4B], [1, "ATI RADEON X850 PRO Secondary", 0x4B6B], [1, "ATI RADEON X850 SE", 0x4B4A], [1, "ATI RADEON X850 SE Secondary", 0x4B6A], [1, "ATI RADEON X850 XT", 0x4B49], [1, "ATI RADEON X850 XT Platinum Edition", 0x4B4C], [1, "ATI RADEON X850 XT Platinum Edition Secondary", 0x4B6C], [1, "ATI RADEON X850 XT Secondary", 0x4B69], ["ATI Radeon Xpress 1200 Series", 0x793F], ["ATI Radeon Xpress 1200 Series ", 0x7941], ["ATI Radeon Xpress 1200 Series ", 0x7942], ["ATI Radeon Xpress Series", 0x5A61], ["ATI Radeon Xpress Series ", 0x5A63], ["ATI Radeon Xpress Series ", 0x5A62], ["ATI Radeon Xpress Series ", 0x5A41], ["ATI Radeon Xpress Series ", 0x5A43], ["ATI Radeon Xpress Series ", 0x5A42], ["ATI Radeon Xpress Series ", 0x5954], ["ATI Radeon Xpress Series ", 0x5854], ["ATI Radeon Xpress Series ", 0x5955], ["ATI Radeon Xpress Series ", 0x5974], ["ATI Radeon Xpress Series ", 0x5874], ["ATI Radeon Xpress Series ", 0x5975], ["Radeon 9500", 0x4144], ["Radeon 9500 ", 0x4149], ["Radeon 9500 PRO / 9700", 0x4E45], ["Radeon 9500 PRO / 9700 Secondary", 0x4E65], ["Radeon 9500 Secondary", 0x4164], ["Radeon 9500 Secondary ", 0x4169], ["Radeon 9600 TX", 0x4E46], ["Radeon 9600 TX Secondary", 0x4E66], ["Radeon 9600TX", 0x4146], ["Radeon 9600TX Secondary", 0x4166], ["Radeon 9700 PRO", 0x4E44], ["Radeon 9700 PRO Secondary", 0x4E64], ["Radeon 9800", 0x4E49], ["Radeon 9800 PRO", 0x4E48], ["Radeon 9800 PRO Secondary", 0x4E68], ["Radeon 9800 SE", 0x4148], ["Radeon 9800 SE Secondary", 0x4168], ["Radeon 9800 Secondary", 0x4E69], ["Radeon 9800 XT", 0x4E4A], ["Radeon 9800 XT Secondary", 0x4E6A], ["Radeon X1300 / X1550 Series", 0x7146], ["Radeon X1300 / X1550 Series Secondary", 0x7166], ["Radeon X1300 Series", 0x714E], ["Radeon X1300 Series ", 0x715E], ["Radeon X1300 Series ", 0x714D], ["Radeon X1300 Series ", 0x71C3], ["Radeon X1300 Series ", 0x718F], ["Radeon X1300 Series Secondary", 0x716E], ["Radeon X1300 Series Secondary ", 0x717E], ["Radeon X1300 Series Secondary ", 0x716D], ["Radeon X1300 Series Secondary ", 0x71E3], ["Radeon X1300 Series Secondary ", 0x71AF], ["Radeon X1300/X1550 Series", 0x7142], ["Radeon X1300/X1550 Series ", 0x7180], ["Radeon X1300/X1550 Series ", 0x7183], ["Radeon X1300/X1550 Series ", 0x7187], ["Radeon X1300/X1550 Series Secondary", 0x7162], ["Radeon X1300/X1550 Series Secondary ", 0x71A0], ["Radeon X1300/X1550 Series Secondary ", 0x71A3], ["Radeon X1300/X1550 Series Secondary ", 0x71A7], ["Radeon X1550 64-bit", 0x7147], ["Radeon X1550 64-bit ", 0x715F], ["Radeon X1550 64-bit ", 0x719F], ["Radeon X1550 64-bit Secondary", 0x7167], ["Radeon X1550 64-bit Secondary ", 0x717F], ["Radeon X1550 Series", 0x7143], ["Radeon X1550 Series ", 0x7193], ["Radeon X1550 Series Secondary", 0x7163], ["Radeon X1550 Series Secondary ", 0x71B3], ["Radeon X1600 Pro / Radeon X1300 XT", 0x71CE], ["Radeon X1600 Pro / Radeon X1300 XT Secondary", 0x71EE], ["Radeon X1600 Series", 0x7140], ["Radeon X1600 Series ", 0x71C0], ["Radeon X1600 Series ", 0x71C2], ["Radeon X1600 Series ", 0x71C6], ["Radeon X1600 Series ", 0x7181], ["Radeon X1600 Series ", 0x71CD], ["Radeon X1600 Series Secondary", 0x7160], ["Radeon X1600 Series Secondary ", 0x71E2], ["Radeon X1600 Series Secondary ", 0x71E6], ["Radeon X1600 Series Secondary ", 0x71A1], ["Radeon X1600 Series Secondary ", 0x71ED], ["Radeon X1600 Series Secondary ", 0x71E0], ["Radeon X1650 Series", 0x71C1], ["Radeon X1650 Series ", 0x7293], ["Radeon X1650 Series ", 0x7291], ["Radeon X1650 Series ", 0x71C7], ["Radeon X1650 Series Secondary", 0x71E1], ["Radeon X1650 Series Secondary ", 0x72B3], ["Radeon X1650 Series Secondary ", 0x72B1], ["Radeon X1650 Series Secondary ", 0x71E7], [1, "Radeon X1800 Series", 0x7100], [1, "Radeon X1800 Series ", 0x7108], [1, "Radeon X1800 Series ", 0x7109], [1, "Radeon X1800 Series ", 0x710A], [1, "Radeon X1800 Series ", 0x710B], [1, "Radeon X1800 Series ", 0x710C], [1, "Radeon X1800 Series Secondary", 0x7120], [1, "Radeon X1800 Series Secondary ", 0x7128], [1, "Radeon X1800 Series Secondary ", 0x7129], [1, "Radeon X1800 Series Secondary ", 0x712A], [1, "Radeon X1800 Series Secondary ", 0x712B], [1, "Radeon X1800 Series Secondary ", 0x712C], [1, "Radeon X1900 Series", 0x7243], [1, "Radeon X1900 Series ", 0x7245], [1, "Radeon X1900 Series ", 0x7246], [1, "Radeon X1900 Series ", 0x7247], [1, "Radeon X1900 Series ", 0x7248], [1, "Radeon X1900 Series ", 0x7249], [1, "Radeon X1900 Series ", 0x724A], [1, "Radeon X1900 Series ", 0x724B], [1, "Radeon X1900 Series ", 0x724C], [1, "Radeon X1900 Series ", 0x724D], [1, "Radeon X1900 Series ", 0x724F], [1, "Radeon X1900 Series Secondary", 0x7263], [1, "Radeon X1900 Series Secondary ", 0x7265], [1, "Radeon X1900 Series Secondary ", 0x7266], [1, "Radeon X1900 Series Secondary ", 0x7267], [1, "Radeon X1900 Series Secondary ", 0x7268], [1, "Radeon X1900 Series Secondary ", 0x7269], [1, "Radeon X1900 Series Secondary ", 0x726A], [1, "Radeon X1900 Series Secondary ", 0x726B], [1, "Radeon X1900 Series Secondary ", 0x726C], [1, "Radeon X1900 Series Secondary ", 0x726D], [1, "Radeon X1900 Series Secondary ", 0x726F], [1, "Radeon X1950 Series", 0x7280], [1, "Radeon X1950 Series ", 0x7240], [1, "Radeon X1950 Series ", 0x7244], [1, "Radeon X1950 Series Secondary", 0x72A0], [1, "Radeon X1950 Series Secondary ", 0x7260], [1, "Radeon X1950 Series Secondary ", 0x7264], ["Radeon X300/X550/X1050 Series", 0x5B60], ["Radeon X300/X550/X1050 Series ", 0x5B63], ["Radeon X300/X550/X1050 Series Secondary", 0x5B73], ["Radeon X300/X550/X1050 Series Secondary ", 0x5B70], ["Radeon X550/X700 Series ", 0x5657], ["Radeon X550/X700 Series Secondary", 0x5677], ["Radeon X600 Series", 0x5B62], ["Radeon X600 Series Secondary", 0x5B72], ["Radeon X600/X550 Series", 0x3E50], ["Radeon X600/X550 Series Secondary", 0x3E70], ["Radeon X700", 0x5E4D], ["Radeon X700 PRO", 0x5E4B], ["Radeon X700 PRO Secondary", 0x5E6B], ["Radeon X700 SE", 0x5E4C], ["Radeon X700 SE Secondary", 0x5E6C], ["Radeon X700 Secondary", 0x5E6D], ["Radeon X700 XT", 0x5E4A], ["Radeon X700 XT Secondary", 0x5E6A], ["Radeon X700/X550 Series", 0x5E4F], ["Radeon X700/X550 Series Secondary", 0x5E6F], [1, "Radeon X800 GT", 0x554B], [1, "Radeon X800 GT Secondary", 0x556B], [1, "Radeon X800 GTO", 0x5549], [1, "Radeon X800 GTO ", 0x554F], [1, "Radeon X800 GTO ", 0x5D4F], [1, "Radeon X800 GTO Secondary", 0x5569], [1, "Radeon X800 GTO Secondary ", 0x556F], [1, "Radeon X800 GTO Secondary ", 0x5D6F], [1, "Radeon X800 PRO", 0x4A49], [1, "Radeon X800 PRO Secondary", 0x4A69], [1, "Radeon X800 SE", 0x4A4F], [1, "Radeon X800 SE Secondary", 0x4A6F], [1, "Radeon X800 Series", 0x4A48], [1, "Radeon X800 Series ", 0x4A4A], [1, "Radeon X800 Series ", 0x4A4C], [1, "Radeon X800 Series ", 0x5548], [1, "Radeon X800 Series Secondary", 0x4A68], [1, "Radeon X800 Series Secondary ", 0x4A6A], [1, "Radeon X800 Series Secondary ", 0x4A6C], [1, "Radeon X800 Series Secondary ", 0x5568], [1, "Radeon X800 VE", 0x4A54], [1, "Radeon X800 VE Secondary", 0x4A74], [1, "Radeon X800 XT", 0x4A4B], [1, "Radeon X800 XT ", 0x5D57], [1, "Radeon X800 XT Platinum Edition", 0x4A50], [1, "Radeon X800 XT Platinum Edition ", 0x554A], [1, "Radeon X800 XT Platinum Edition Secondary", 0x4A70], [1, "Radeon X800 XT Platinum Edition Secondary ", 0x556A], [1, "Radeon X800 XT Secondary", 0x4A6B], [1, "Radeon X800 XT Secondary ", 0x5D77], [1, "Radeon X850 XT", 0x5D52], [1, "Radeon X850 XT Platinum Edition", 0x5D4D], [1, "Radeon X850 XT Platinum Edition Secondary", 0x5D6D], [1, "Radeon X850 XT Secondary", 0x5D72], ] vendorId = 0x1002 for entry in ati_device_list: if len(entry) == 3: flag, deviceName, deviceId = entry else: deviceName, deviceId = entry self.devices[(vendorId, deviceId)] = deviceName.strip() nvidia_device_list = [ [0x014F, "GeForce 6200"], [0x00F3, "GeForce 6200"], [0x0221, "GeForce 6200"], [0x0163, "GeForce 6200 LE"], [0x0162, "GeForce 6200SE TurboCache(TM)"], [0x0161, "GeForce 6200 TurboCache(TM)"], [0x0162, "GeForce 6200SE TurboCache(TM)"], [0x0160, "GeForce 6500"], [1, 0x0141, "GeForce 6600"], [1, 0x00F2, "GeForce 6600"], [1, 0x0140, "GeForce 6600 GT"], [1, 0x00F1, "GeForce 6600 GT"], [1, 0x0142, "GeForce 6600 LE"], [1, 0x00F4, "GeForce 6600 LE"], [1, 0x0143, "GeForce 6600 VE"], [1, 0x0147, "GeForce 6700 XL"], [1, 0x0041, "GeForce 6800"], [1, 0x00C1, "GeForce 6800"], [1, 0x0047, "GeForce 6800 GS"], [1, 0x00F6, "GeForce 6800 GS"], [1, 0x00C0, "GeForce 6800 GS"], [1, 0x0045, "GeForce 6800 GT"], [1, 0x00F9, "GeForce 6800 Series GPU"], [1, 0x00C2, "GeForce 6800 LE"], [1, 0x0040, "GeForce 6800 Ultra"], [1, 0x00F9, "GeForce 6800 Series GPU"], [1, 0x0043, "GeForce 6800 XE"], [1, 0x0048, "GeForce 6800 XT"], [1, 0x0218, "GeForce 6800 XT"], [1, 0x00C3, "GeForce 6800 XT"], [0x01DF, "GeForce 7300 GS"], [0x0393, "GeForce 7300 GT"], [0x01D1, "GeForce 7300 LE"], [0x01D3, "GeForce 7300 SE"], [0x01DD, "GeForce 7500 LE"], [1, 0x0392, "GeForce 7600 GS"], [1, 0x0392, "GeForce 7600 GS"], [1, 0x02E1, "GeForce 7600 GS"], [1, 0x0391, "GeForce 7600 GT"], [1, 0x0394, "GeForce 7600 LE"], [1, 0x00F5, "GeForce 7800 GS"], [1, 0x0092, "GeForce 7800 GT"], [1, 0x0091, "GeForce 7800 GTX"], [1, 0x0291, "GeForce 7900 GT/GTO"], [1, 0x0290, "GeForce 7900 GTX"], [1, 0x0293, "GeForce 7900 GX2"], [1, 0x0294, "GeForce 7950 GX2"], [0x0322, "GeForce FX 5200"], [0x0321, "GeForce FX 5200 Ultra"], [0x0323, "GeForce FX 5200LE"], [0x0326, "GeForce FX 5500"], [0x0326, "GeForce FX 5500"], [0x0312, "GeForce FX 5600"], [0x0311, "GeForce FX 5600 Ultra"], [0x0314, "GeForce FX 5600XT"], [0x0342, "GeForce FX 5700"], [0x0341, "GeForce FX 5700 Ultra"], [0x0343, "GeForce FX 5700LE"], [0x0344, "GeForce FX 5700VE"], [0x0302, "GeForce FX 5800"], [0x0301, "GeForce FX 5800 Ultra"], [0x0331, "GeForce FX 5900"], [0x0330, "GeForce FX 5900 Ultra"], [0x0333, "GeForce FX 5950 Ultra"], [0x0324, "GeForce FX Go5200 64M"], [0x031A, "GeForce FX Go5600"], [0x0347, "GeForce FX Go5700"], [0x0167, "GeForce Go 6200/6400"], [0x0168, "GeForce Go 6200/6400"], [1, 0x0148, "GeForce Go 6600"], [1, 0x00c8, "GeForce Go 6800"], [1, 0x00c9, "GeForce Go 6800 Ultra"], [1, 0x0098, "GeForce Go 7800"], [1, 0x0099, "GeForce Go 7800 GTX"], [1, 0x0298, "GeForce Go 7900 GS"], [1, 0x0299, "GeForce Go 7900 GTX"], [0x0185, "GeForce MX 4000"], [0x00FA, "GeForce PCX 5750"], [0x00FB, "GeForce PCX 5900"], [0x0110, "GeForce2 MX/MX 400"], [0x0111, "GeForce2 MX200"], [0x0110, "GeForce2 MX/MX 400"], [0x0200, "GeForce3"], [0x0201, "GeForce3 Ti200"], [0x0202, "GeForce3 Ti500"], [0x0172, "GeForce4 MX 420"], [0x0171, "GeForce4 MX 440"], [0x0181, "GeForce4 MX 440 with AGP8X"], [0x0173, "GeForce4 MX 440-SE"], [0x0170, "GeForce4 MX 460"], [0x0253, "GeForce4 Ti 4200"], [0x0281, "GeForce4 Ti 4200 with AGP8X"], [0x0251, "GeForce4 Ti 4400"], [0x0250, "GeForce4 Ti 4600"], [0x0280, "GeForce4 Ti 4800"], [0x0282, "GeForce4 Ti 4800SE"], [0x0203, "Quadro DCC"], [0x0309, "Quadro FX 1000"], [0x034E, "Quadro FX 1100"], [0x00FE, "Quadro FX 1300"], [0x00CE, "Quadro FX 1400"], [0x0308, "Quadro FX 2000"], [0x0338, "Quadro FX 3000"], [0x00FD, "Quadro PCI-E Series"], [1, 0x00F8, "Quadro FX 3400/4400"], [1, 0x00CD, "Quadro FX 3450/4000 SDI"], [1, 0x004E, "Quadro FX 4000"], [1, 0x00CD, "Quadro FX 3450/4000 SDI"], [1, 0x00F8, "Quadro FX 3400/4400"], [1, 0x009D, "Quadro FX 4500"], [1, 0x029F, "Quadro FX 4500 X2"], [0x032B, "Quadro FX 500/FX 600"], [0x014E, "Quadro FX 540"], [0x014C, "Quadro FX 540 MXM"], [0x032B, "Quadro FX 500/FX 600"], [0X033F, "Quadro FX 700"], [0x034C, "Quadro FX Go1000"], [0x00CC, "Quadro FX Go1400"], [0x031C, "Quadro FX Go700"], [0x018A, "Quadro NVS with AGP8X"], [0x032A, "Quadro NVS 280 PCI"], [0x00FD, "Quadro PCI-E Series"], [0x0165, "Quadro NVS 285"], [0x017A, "Quadro NVS"], [0x018A, "Quadro NVS with AGP8X"], [0x0113, "Quadro2 MXR/EX"], [0x017A, "Quadro NVS"], [0x018B, "Quadro4 380 XGL"], [0x0178, "Quadro4 550 XGL"], [0x0188, "Quadro4 580 XGL"], [0x025B, "Quadro4 700 XGL"], [0x0259, "Quadro4 750 XGL"], [0x0258, "Quadro4 900 XGL"], [0x0288, "Quadro4 980 XGL"], [0x028C, "Quadro4 Go700"], [1, 0x0295, "NVIDIA GeForce 7950 GT"], [0x03D0, "NVIDIA GeForce 6100 nForce 430"], [0x03D1, "NVIDIA GeForce 6100 nForce 405"], [0x03D2, "NVIDIA GeForce 6100 nForce 400"], [0x0241, "NVIDIA GeForce 6150 LE"], [0x0242, "NVIDIA GeForce 6100"], [0x0245, "NVIDIA Quadro NVS 210S / NVIDIA GeForce 6150LE"], [1, 0x029C, "NVIDIA Quadro FX 5500"], [1, 0x0191, "NVIDIA GeForce 8800 GTX"], [1, 0x0193, "NVIDIA GeForce 8800 GTS"], [1, 0x0400, "NVIDIA GeForce 8600 GTS"], [1, 0x0402, "NVIDIA GeForce 8600 GT"], [0x0421, "NVIDIA GeForce 8500 GT"], [0x0422, "NVIDIA GeForce 8400 GS"], [0x0423, "NVIDIA GeForce 8300 GS"], ] vendorId = 0x10de for entry in nvidia_device_list: if len(entry) == 3: flag, deviceId, deviceName = entry else: deviceId, deviceName = entry self.devices[(vendorId, deviceId)] = deviceName.strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_extra_args(self):\n self.parser.add_argument('--device', dest='device', type=str, help='Device ID, e.g. d--0001')", "def addDevice(self, node, fullDeviceName, device):", "def load_devices():", "def addDeviceDescriptor(string: str, deviceDescriptor: cern.japc.core.DeviceDescriptor) -> None:\n ...
[ "0.6235411", "0.6018107", "0.5875037", "0.5769226", "0.5737719", "0.5699172", "0.5628838", "0.56115973", "0.55473393", "0.5530301", "0.5512926", "0.55042124", "0.54661566", "0.5442146", "0.54258853", "0.5409304", "0.53862745", "0.5350149", "0.53231454", "0.52631706", "0.52626...
0.64580566
0
Calculates frequencies of samples.
def freq_counts(self, arrs, lens): no_nans = reduce(np.logical_and, [~np.isnan(a) if bn.anynan(a) else np.ones(self.m).astype(bool) for a in arrs]) combined = reduce(add, [arrs[i][no_nans]*reduce(mul, lens[:i]) for i in range(1, len(arrs))], arrs[0][no_nans]) return np.bincount(combined.astype(np.int32, copy=False), minlength=reduce(mul, lens)).astype(float)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frequencies(self):\r\n\r\n self.method['Fs'] = self.method.get('Fs', self.input.sampling_rate)\r\n NFFT = self.method.get('NFFT', 64)\r\n Fs = self.method.get('Fs')\r\n freqs = tsu.get_freqs(Fs, NFFT)\r\n lb_idx, ub_idx = tsu.get_bounds(freqs, self.lb, self.ub)\r\n\r\n ...
[ "0.7766813", "0.7707529", "0.76741445", "0.7562953", "0.7418545", "0.739534", "0.7392773", "0.71362615", "0.6976485", "0.69558024", "0.690897", "0.6903706", "0.6876598", "0.68592876", "0.6843024", "0.68283325", "0.6793091", "0.67241335", "0.67124856", "0.6667002", "0.66569775...
0.63803333
43
Counts the frequencies of samples of given variables ``vars`` and calculates probabilities with additive smoothing.
def get_probs(self, *vars): freqs = self.freq_counts([self.data.get_column_view(v)[0] for v in vars], [len(v.values) for v in vars]) k = np.prod([len(v.values) for v in vars]) return (freqs + self.alpha) / (np.sum(freqs) + self.alpha*k)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_posterior_probs(vars_):\n vars_.weighted_sums += np.power(vars_.dprime_map[vars_.focus],2) * vars_.visual_field\n vars_.post_probs = np.exp(vars_.weighted_sums) * vars_.prior_prob\n vars_.post_probs /= np.sum(vars_.post_probs)", "def countVarFreq(list_models_vars_freq):\n list_variables_to...
[ "0.57587546", "0.5575326", "0.53477293", "0.52793074", "0.51654255", "0.5154966", "0.5104432", "0.50244606", "0.49709153", "0.49697486", "0.49534038", "0.491249", "0.4908834", "0.48904198", "0.48888883", "0.48864844", "0.48855996", "0.48635137", "0.4834516", "0.48303828", "0....
0.7346631
0
Entropy of a given distribution.
def h(self, probs): return np.sum(-p*np.log2(p) if p > 0 else 0 for p in np.nditer(probs))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(dist):\n #dist = array([max(d,1e-100) for d in dist])\n dist = dist + 1e-20\n return dot(dist,(log(1.0/dist) * (1.0/log(2.0))).T)", "def entropyDistributed(distribution):\n return -sum(map(lambda p : p * log(p, 2), distribution))", "def _graph_fn_entropy(distribution):\n return d...
[ "0.7871747", "0.78487754", "0.76791704", "0.7365083", "0.73631096", "0.73386323", "0.73318344", "0.7179662", "0.7174629", "0.71570325", "0.70973134", "0.7095", "0.70855933", "0.7081814", "0.7046893", "0.7035079", "0.70043415", "0.6972333", "0.6965106", "0.69620615", "0.696116...
0.0
-1
If not given, computes the absolute total info gain for attributes a and b. Generates an Interaction object.
def attribute_interactions(self, a, b, total_rel_ig_ab=None): var_a = self.data.domain.variables[a] var_b = self.data.domain.variables[b] ig_a = self.info_gains[var_a.name] ig_b = self.info_gains[var_b.name] if not total_rel_ig_ab: ig_ab = ig_a + ig_b - (self.class_entropy + self.h(self.get_probs(var_a, var_b))) + \ self.h(self.get_probs(var_a, var_b, self.data.domain.variables[-1])) else: ig_ab = ig_a + ig_b - total_rel_ig_ab * self.class_entropy inter = Interaction(var_a, var_b, ig_a, ig_b, ig_ab, self.class_entropy) return inter
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infoGain(self,attr, data, target_attr):\n remainder = 0\n p = 0\n ent = 0\n for ele in target_attr:\n if ele == 1:\n p +=1\n \n q = p / (len(target_attr)) \n if 0 < q < 1:\n ent = -((q * math.log2(q)) + ((1-q) * math....
[ "0.6119889", "0.5544115", "0.5507098", "0.54734284", "0.54698795", "0.53078294", "0.53001773", "0.52430487", "0.52211547", "0.5215387", "0.52137595", "0.5157385", "0.51392186", "0.5137646", "0.50982416", "0.5096558", "0.50840324", "0.50741106", "0.50459766", "0.50332594", "0....
0.6960144
0
Computes a symetric matrix containing the relative total information gain for all possible pairs of attributes.
def interaction_matrix(self): self.int_M_called = True int_M = np.zeros((self.n, self.n)) for k in range(self.n): for j in range(k+1): o = self.attribute_interactions(k, j) int_M[k, j] = o.rel_total_ig_ab # Store total information gain int_M[j, k] = o.rel_total_ig_ab # TODO: Maybe storing interactions too is not a bad idea # TODO: We can than easily sort either by total gain or by positive interaction for k in range(self.n): int_M[k, k] = self.info_gains[self.data.domain.attributes[k].name] self.int_matrix = Orange.misc.distmatrix.DistMatrix(int_M)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def information_gain(Y, attr):\n initial_gain = entropy(Y)\n\n temp_Y = Y.tolist()\n temp_attr = attr.tolist()\n\n temp_attr = list(np.unique(attr))\n\n for a in temp_attr:\n l = []\n count = 0\n for j in attr:\n if (j == a):\n l.append(temp_Y[count])\n...
[ "0.6507828", "0.6414944", "0.626524", "0.6232345", "0.58820426", "0.5660079", "0.5539918", "0.551693", "0.5509508", "0.5486035", "0.5465803", "0.5443954", "0.54394644", "0.5417441", "0.5393869", "0.5381921", "0.5350407", "0.5318583", "0.52740175", "0.52646095", "0.52236044", ...
0.5677631
5
Computes the Interaction objects for n most informative pairs of attributes. For this to work, ``interaction_matrix`` must be called first. It uses a partial sort and then a full sort on the remaining n elements to get the indices of attributes.
def get_top_att(self, n): if not self.int_M_called: raise IndexError("Call interaction_matrix first!") flat_indices = np.argpartition(np.tril(-self.int_matrix, -1).ravel(), n - 1)[:n] # TODO: Consider using the partial sort from the bottleneck module for faster sorting row_indices, col_indices = np.unravel_index(flat_indices, self.int_matrix.shape) min_elements_order = np.argsort(-self.int_matrix[row_indices, col_indices]) row_indices, col_indices = row_indices[min_elements_order], col_indices[min_elements_order] return [self.attribute_interactions(row_indices[k], col_indices[k], self.int_matrix[row_indices[k], col_indices[k]]) for k in range(n)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interaction_matrix(self):\n\n self.int_M_called = True\n int_M = np.zeros((self.n, self.n))\n for k in range(self.n):\n for j in range(k+1):\n o = self.attribute_interactions(k, j)\n int_M[k, j] = o.rel_total_ig_ab # Store total information gain\n ...
[ "0.60471845", "0.54465884", "0.52681583", "0.5024728", "0.4996432", "0.49814323", "0.49585322", "0.49543592", "0.49077043", "0.4857076", "0.48561823", "0.48455074", "0.4830593", "0.48272932", "0.48052135", "0.47973144", "0.47867075", "0.4769542", "0.47667968", "0.47630936", "...
0.72928554
0
Train the models with the train dataset
def entrainement(self, trainData, trainLabels, testData, testLabels, test, classes, test_ids): if self.classifieur == 1: svc_linear = SVC(probability=True, kernel='linear', gamma='auto') AdaBoost_params = { 'n_estimators': [5, 10, 15, 20], 'learning_rate': [0.01, 0.05, 0.1, 0.3, 1], } clf = AdaBoostClassifier(algorithm='SAMME', base_estimator=svc_linear) AdaBoost_search = GridSearchCV(clf, param_grid=AdaBoost_params, cv=3) AdaBoost_search.fit(trainData, trainLabels) AdaBoost_accuracy = AdaBoost_search.score(testData, testLabels) print("AdaBoost_search accuracy: {:.2f}%".format(AdaBoost_accuracy * 100)) print("AdaBoost_search search best parameters: {}".format(AdaBoost_search.best_params_)) if self.classifieur == 2: # construct the set of hyperparameters to tune k_range = np.arange(2, 31, 1) hparams = {"n_neighbors": k_range, "metric": ["euclidean", "cityblock"]} # tune the hyperparameters via a cross-validated grid search print("tuning hyperparameters via grid search") clf = KNeighborsClassifier() grid = GridSearchCV(clf, hparams, cv=3, scoring='accuracy') grid.fit(trainData, trainLabels) knn_accuracy = grid.score(testData, testLabels) print("KNN grid search accuracy: {:.2f}%".format(knn_accuracy * 100)) print("KNN grid search best parameters: {}".format(grid.best_params_)) # kaggle test_predictions = grid.predict_proba(test) # Format DataFrame submission = pd.DataFrame(test_predictions, columns=classes) submission.insert(0, 'id', test_ids) submission.reset_index() # Export Submission submission.to_csv('submission.csv', index=False) submission.tail() if self.classifieur == 3: # Set the parameters for cross-validation tuned_parameters = [{'kernel': ['rbf'], 'gamma': [1e-2, 1e-3, 1e-4, 1e-5], 'C': [0.001, 0.10, 0.1, 10, 25, 50, 100, 1000]}, {'kernel': ['sigmoid'], 'gamma': [1e-2, 1e-3, 1e-4, 1e-5], 'C': [0.001, 0.10, 0.1, 10, 25, 50, 100, 1000]}, {'kernel': ['linear'], 'C': [0.001, 0.10, 0.1, 10, 25, 50, 100, 1000]} ] scores = ['precision', 'recall'] for score in scores: print("# Tuning hyper-parameters for %s" % score) print() clf = GridSearchCV(SVC(C=1, probability=True), tuned_parameters, cv=3, scoring='%s_macro' % score) clf.fit(trainData, trainLabels) svm_accuracy = clf.score(testData, testLabels) print("SVM grid search accuracy: {:.2f}%".format(svm_accuracy * 100)) print("SVM grid search best parameters: {}".format(clf.best_params_)) # kaggle test_predictions = clf.predict_proba(test) # Format DataFrame submission = pd.DataFrame(test_predictions, columns=classes) submission.insert(0, 'id', test_ids) submission.reset_index() # Export Submission submission.to_csv('submission.csv', index=False) submission.tail() if self.classifieur == 4: Logistic_Regression_params= { 'penalty': ('l1', 'l2', ), 'C': [0.001, 0.01, 0.1, 1, 10, 11, 20, 100, ], } clf = LogisticRegression() param_search = GridSearchCV(clf, param_grid=Logistic_Regression_params, cv=3) param_search.fit(trainData,trainLabels) accuracy = param_search.score(testData, testLabels) print("regression logistic search accuracy: {:.2f}%".format(accuracy * 100)) print("regression logistic search best parameters: {}".format(param_search.best_params_)) if self.classifieur == 5: Perceptron_params = { 'penalty': ('l1', 'l2', ), 'alpha': [0.0001, 0.1, 0.01, ], 'max_iter': [100, 500, 700], 'tol': [1e-3]} clf = Perceptron() perceptron_search = GridSearchCV(clf, param_grid=Perceptron_params, cv=3) perceptron_search.fit(trainData,trainLabels) perceptron_accuracy = perceptron_search.score(testData, testLabels) print("perceptron search accuracy: {:.2f}%".format(perceptron_accuracy * 100)) print("perceptron search best parameters: {}".format(perceptron_search.best_params_)) if self.classifieur == 6: RandomForest_params= { 'max_depth': (5, 10, 20, 50, 100, 1000), 'n_estimators': (10, 50, 100)} clf = RandomForestClassifier() RandomForest_search= RandomizedSearchCV(clf, RandomForest_params, cv=3) RandomForest_search.fit(trainData, trainLabels) RandomForest_accuracy = RandomForest_search.score(testData, testLabels) print("RandomForest search accuracy: {:.2f}%".format(RandomForest_accuracy * 100)) print("RandomForest logistic search best parameters: {}".format(RandomForest_search.best_params_))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self):\n\t\tself.model.fit(self.training_data, self.training_labels)", "def train(self, x_data, y_data):\n for model in self.list_of_models:\n model.fit(x_data, y_data)\n self.trained_models.append(model)", "def set_train(self):\n for m in self.models.values():\n ...
[ "0.85705304", "0.81666774", "0.8045999", "0.8045258", "0.79215825", "0.784289", "0.7838864", "0.77854425", "0.7752612", "0.7748808", "0.77232707", "0.76623434", "0.7646475", "0.7645696", "0.7623885", "0.7589835", "0.7571589", "0.7557546", "0.7549086", "0.7526105", "0.7521501"...
0.0
-1
Returns subdict of `kwargs` with the keys that match the names of arguments in `fun`'s signature.
def filter_extra_accepted_kwargs(fun, kwargs, skip_positional=0): sig = inspect.signature(fun) # the params from signature with up to skip_positional filtered out # (less only if there is not enough of positional args) params = [(name, param) for i, (name, param) in enumerate(sig.parameters.items()) if i >= skip_positional or param.kind not in [inspect.Parameter.POSITIONAL_OR_KEYWORD, inspect.Parameter.POSITIONAL_ONLY]] extra = [ name for (name, param) in params if param.kind in [inspect.Parameter.POSITIONAL_OR_KEYWORD, inspect.Parameter.KEYWORD_ONLY] ] return {name: value for name, value in kwargs.items() if name in extra}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def appropriate_kwargs(kwargs, func):\n sig = inspect.signature(func)\n filter_keys = [\n param.name\n for param in sig.parameters.values()\n if param.kind == param.POSITIONAL_OR_KEYWORD and param.name in kwargs.keys()\n ]\n appropriate_dict = {filter_key: kwargs[filter_key] for fi...
[ "0.7756075", "0.75575936", "0.7026198", "0.701601", "0.6970035", "0.6854365", "0.6675852", "0.6675852", "0.66426367", "0.662578", "0.65232116", "0.6503449", "0.647175", "0.64479893", "0.61948097", "0.6167109", "0.6133175", "0.6125426", "0.61196697", "0.6109005", "0.6103811", ...
0.70694536
2
Returns the list of names of args/kwargs without defaults from `fun` signature.
def get_required_kwargs(fun, skip_positional=0): sig = inspect.signature(fun) # the params from signature with up to skip_positional filtered out # (less only if there is not enough of positional args) params = [(name, param) for i, (name, param) in enumerate(sig.parameters.items()) if i >= skip_positional or param.kind not in [inspect.Parameter.POSITIONAL_OR_KEYWORD, inspect.Parameter.POSITIONAL_ONLY]] return [ name for name, param in params if param.default is inspect.Parameter.empty and param.kind in [inspect.Parameter.POSITIONAL_OR_KEYWORD, inspect.Parameter.KEYWORD_ONLY] ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getArgs(func):\n # exclude the defaults at the end (hence the [:-1])\n args = list(utils.flatten(inspect.getargspec(func)[:-1]))\n return set(args).difference(set([None]))", "def list_kwargs(func):\n \n details = inspect.getargspec(func)\n nopt = len(details.defaults)\n \n return deta...
[ "0.7373131", "0.70837766", "0.70198065", "0.6812793", "0.6719347", "0.66698635", "0.66303456", "0.65023136", "0.6472078", "0.6378711", "0.63185936", "0.63058794", "0.62759775", "0.6262447", "0.6222361", "0.62066025", "0.6155284", "0.59993124", "0.59842724", "0.5961036", "0.59...
0.7168854
1
Returns the number of arguments that can be passed positionally to the `fun` call.
def get_num_positional_args(fun): sig = inspect.signature(fun) return len([ name for name, param in sig.parameters.items() if param.kind in [inspect.Parameter.POSITIONAL_OR_KEYWORD, inspect.Parameter.POSITIONAL_ONLY] ])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_arg_count(fun):\n if isclass(fun):\n return len(signature(fun.__call__).parameters)\n return len(signature(fun).parameters)", "def _fun_arg_count(f):\n args = getargspec(f).args\n if args and args[0] == 'self':\n args = args[1:]\n return len(args)", "def _arg_count(func):\n...
[ "0.82862073", "0.7959749", "0.77881014", "0.7670227", "0.7434592", "0.72237825", "0.7108183", "0.691844", "0.68648636", "0.68646204", "0.6769415", "0.6768247", "0.6761568", "0.61890286", "0.6176186", "0.61286736", "0.61255735", "0.60913527", "0.6069686", "0.6035605", "0.60069...
0.77555364
3
When a team is created, its survey is automatically created.
def test_create_team_creates_survey(self): user = User.create(name='User Foo', email='user@foo.com') user.put() code = 'trout viper' team_response = self.testapp.post_json( '/api/teams', { 'name': 'Team Foo', 'code': code, 'program_id': self.ep_program.uid, }, headers=self.login_headers(user), ) team_dict = json.loads(team_response.body) survey_result = Survey.get(team_id=team_dict['uid']) self.assertEqual(len(survey_result), 1) survey = survey_result[0] return user, team_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_teams_create(self):\n pass", "def test_create_team(self):\n pass", "def test_generate_survey(self):\n\n result = generate_survey.apply((self.user.id,\n self.report.get_daily().id)).get()\n self.assertTrue(result, \"should create a surv...
[ "0.6586207", "0.6538541", "0.64314604", "0.6378735", "0.63344073", "0.6198191", "0.61724335", "0.6105733", "0.6045564", "0.60214174", "0.59957623", "0.59651864", "0.5957437", "0.5896016", "0.5873307", "0.5823892", "0.5811888", "0.5769924", "0.57607037", "0.5720423", "0.569084...
0.75194645
0
You can get the survey for a team you own.
def test_get_for_team(self): user, team_dict = self.test_create_team_creates_survey() response = self.testapp.get( '/api/teams/{}/survey'.format(team_dict['uid']), headers=self.login_headers(user), ) survey_dict = json.loads(response.body) self.assertTrue(survey_dict['uid'].startswith('Survey'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_questionnaire(self, url, survey_path):\n pass", "def getSurveys(self, **kwargs):\n response = self.request(\"getSurveys\", **kwargs)\n # print response\n surveys = None\n if response:\n surveys = OrderedDict()\n for survey in response[\"Result\"][\...
[ "0.6343129", "0.631515", "0.6284795", "0.6031469", "0.58984464", "0.58517706", "0.5640203", "0.56234926", "0.5607942", "0.55881244", "0.55276686", "0.5523524", "0.55202866", "0.54980105", "0.5456152", "0.545253", "0.53732574", "0.5364306", "0.53133166", "0.52972543", "0.52571...
0.757884
0
You can't get a survey for someone else's team.
def test_get_for_other_forbidden(self): user, team_dict = self.test_create_team_creates_survey() other = User.create(name='Other', email='other@foo.com') other.put() self.testapp.get( '/api/teams/{}/survey'.format(team_dict['uid']), headers=self.login_headers(other), status=403, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_for_team(self):\n user, team_dict = self.test_create_team_creates_survey()\n response = self.testapp.get(\n '/api/teams/{}/survey'.format(team_dict['uid']),\n headers=self.login_headers(user),\n )\n survey_dict = json.loads(response.body)\n self...
[ "0.7120516", "0.6282421", "0.626813", "0.618336", "0.6113319", "0.6037205", "0.598216", "0.5848799", "0.57429224", "0.5724888", "0.570673", "0.5694278", "0.5633859", "0.5616271", "0.56087244", "0.5571042", "0.5523372", "0.55163455", "0.5508447", "0.55008894", "0.54575586", ...
0.67539746
1
PUT response has special jwt giving permission on Neptune.
def test_put_issues_allowed_endpoints_jwt(self): team_id = 'Team_foo' survey = Survey.create(team_id=team_id) survey.put() user = User.create(name='foo', email='foo@bar.com', owned_teams=[team_id]) user.put() # Add some classrooms c1 = Classroom.create(name='C1', team_id=team_id, code='a a', contact_id='User_contact') c2 = Classroom.create(name='C2', team_id=team_id, code='b b', contact_id='User_contact') Classroom.put_multi([c1, c2]) response = self.testapp.put_json( '/api/surveys/{}'.format(survey.uid), {'metrics': ['Metric_001', 'Metric_002']}, headers=self.login_headers(user), ) jwt = response.headers['Authorization'][7:] # drop "Bearer " payload, error = jwt_helper.decode(jwt) # Should include an endpoint for each classroom. self.assertEqual( set(payload['allowed_endpoints']), { 'PUT //neptune/api/codes/a-a', 'PUT //neptune/api/codes/b-b', }, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_movie_not_authenticated(self):\n data = {'title': 'The Mask 2'}\n response = self.client.patch(self.url, data, format='json')\n self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)", "def put(self, op_id: str) -> Response:\n data = request.get_json()\n\n ...
[ "0.64163506", "0.62620705", "0.61206746", "0.60228735", "0.5972664", "0.5971649", "0.59323764", "0.5917572", "0.5852224", "0.5852224", "0.5821447", "0.58134544", "0.5795793", "0.5792033", "0.57747847", "0.5765895", "0.57658184", "0.5719392", "0.5705449", "0.56970286", "0.5659...
0.559168
30
PUT response has special jwt giving permission on Neptune.
def test_put_artifact_url_sends_email(self): user = User.create(name='foo', email='foo@bar.com') team = Team.create(name="Foo Team", captain_id=user.uid, program_id="Program_foo") survey = Survey.create(team_id=team.uid) user.owned_teams = [team.uid] team.put() survey.put() user.put() artifact_url = 'https://www.example.com/artifact' # Not changing the artifact does NOT trigger an email. self.testapp.put_json( '/api/surveys/{}'.format(survey.uid), {'meta': {'artifact_url': ''}}, headers=self.login_headers(user), ) self.assertEqual(Email.count(), 0) # Changing it triggers an email. self.testapp.put_json( '/api/surveys/{}'.format(survey.uid), {'meta': {'artifact_use': 'true', 'artifact_url': artifact_url}}, headers=self.login_headers(user), ) emails = Email.get() self.assertEqual(len(emails), 1) email = emails[0] self.assertIn(artifact_url, email.html) self.assertIn(team.name, email.html) # Sending a PUT **without** changing it does NOT trigger an email. self.testapp.put_json( '/api/surveys/{}'.format(survey.uid), {'meta': {'artifact_use': 'true', 'artifact_url': artifact_url}}, headers=self.login_headers(user), ) self.assertEqual(Email.count(), 1) # same as before
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_movie_not_authenticated(self):\n data = {'title': 'The Mask 2'}\n response = self.client.patch(self.url, data, format='json')\n self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)", "def put(self, op_id: str) -> Response:\n data = request.get_json()\n\n ...
[ "0.64163506", "0.62620705", "0.61206746", "0.60228735", "0.5972664", "0.5971649", "0.59323764", "0.5917572", "0.5852224", "0.5852224", "0.5821447", "0.58134544", "0.5795793", "0.5792033", "0.57747847", "0.5765895", "0.57658184", "0.5719392", "0.5705449", "0.56970286", "0.5659...
0.0
-1
Client dict should have portalfriendly metric labels.
def test_metric_labels(self): team_id = 'Team_foo' m1 = Metric.create(name='Foo Condition', label='foo_condition') m2 = Metric.create(name='Bar Condition', label='bar_condition') Metric.put_multi([m1, m2]) survey = Survey.create(team_id=team_id, metrics=[m1.uid, m2.uid]) survey.put() user = User.create(name='foo', email='foo@bar.com', owned_teams=[team_id]) user.put() response = self.testapp.get( '/api/surveys/{}'.format(survey.uid), headers=self.login_headers(user), ) logging.info(response.body) self.assertEqual( json.loads(response.body)['metric_labels'], {m1.uid: 'foo_condition', m2.uid: 'bar_condition'}, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_host_configuration_metrics1(self):\n pass", "def test_get_host_configuration_metrics(self):\n pass", "def mock_client_fixture():\n with mock.patch(f\"{PROMETHEUS_PATH}.prometheus_client\") as client:\n counter_client = mock.MagicMock()\n client.Counter = mock.MagicMo...
[ "0.58376956", "0.57469577", "0.5601619", "0.5601619", "0.5514434", "0.55044305", "0.5325245", "0.5324136", "0.5164732", "0.5106117", "0.50848985", "0.5079339", "0.5064023", "0.50074315", "0.5007054", "0.4984392", "0.4983079", "0.4963031", "0.49587086", "0.4958586", "0.4957912...
0.57984996
1
Returns the `path` size in bytes and isvalidate.
def _get_run_info(self, path, creation_date): total = 0 try: for entry in os.scandir(path): # Only evaluates size of files and not folders inside raw/proc if entry.is_file(): # if it's a file, use stat() function total += entry.stat().st_size except NotADirectoryError: # if `path` isn't a directory, get the file size then total = os.path.getsize(path) except PermissionError: # if for whatever reason we can't open the folder, return 0 return 0 if os.path.isdir(path): validator = RunValidator(path) elif path.endswith(".h5"): validator = FileValidator(H5File(path).files[0]) else: return 0 try: validator.run_checks() except Exception: pass return total, str(ValidationError(validator.problems))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getsize(path):\n return get_instance(path).getsize(path)", "def size(path):", "def getsize(self, path):\n return os.path.getsize(path)", "def getsize(path):\n return stat(path).st_size", "def filesize(self, path):\n arinfo = self._handle.getmember(path)\n return arinfo.si...
[ "0.80022764", "0.7961166", "0.7923643", "0.76660985", "0.75245374", "0.75245374", "0.75192183", "0.75192183", "0.7501242", "0.7407785", "0.73885095", "0.7332099", "0.72183996", "0.71414423", "0.7121279", "0.70584697", "0.7013595", "0.6994066", "0.69744694", "0.69534856", "0.6...
0.0
-1
Validates that the two password inputs match.
def clean_password2(self): if self.clean_data.get('password1', None) and self.clean_data.get('password2', None) and \ self.clean_data['password1'] == self.clean_data['password2']: return self.clean_data['password2'] raise forms.ValidationError(u'You must type the same password each time')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_password(password1: str, password2: str) -> bool:\n if password1 == password2:\n return True\n else:\n raise ValueError('Пароли не совпадают')", "def clean_password(self):\n password1 = self.cleaned_data.get('password1')\n password2 = self.cleaned_data.get('password2')...
[ "0.79399914", "0.7775991", "0.75286", "0.751961", "0.7506222", "0.7504838", "0.745747", "0.745747", "0.74129796", "0.7394356", "0.7387584", "0.7368053", "0.73406", "0.73406", "0.7324741", "0.73213553", "0.73095393", "0.7277372", "0.72607356", "0.72343296", "0.7186055", "0.7...
0.71904254
20
Pause pattern while self.pauseNow is True return imediatly if self.playStatus == False
def pauseCheck(self): while (self.playStatus == False and self.pauseNow == True): self.isPause = True time.sleep(.25) self.isPause = False return self.playStatus
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pause(self):\n while 1:\n if self.is_paused:\n time.sleep(1)\n else:\n break", "def pause(self):\n if self.status()['state'] == \"playing\":\n self.toggle_pause()", "def test_pause(self):\n source = procedural.WhiteNoise(0.5)\n ...
[ "0.7879247", "0.7591245", "0.75521106", "0.7544259", "0.7394605", "0.72653115", "0.72582483", "0.72100365", "0.7209901", "0.7202345", "0.7187789", "0.7187789", "0.7176371", "0.7118577", "0.71078545", "0.70944405", "0.70625925", "0.70505774", "0.70505774", "0.70348316", "0.703...
0.78421515
1
For now, we are only returning the label for the first authorization.
def get_label(self): auth = self.authorizations[0] return auth.label
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_label ( self ):\n if self._label is not None:\n return self._label\n return user_name_for( self.name )", "def _get_label(self):\n return self.label", "def _get_label ( self ):\n if self._label is not None:\n return self._label\n return self.name...
[ "0.7064338", "0.6762954", "0.65058815", "0.6465353", "0.6465353", "0.6465353", "0.6465353", "0.6433205", "0.6383421", "0.6355541", "0.6347802", "0.6343887", "0.63365865", "0.6327651", "0.6327651", "0.6300275", "0.6296131", "0.6296131", "0.6296131", "0.6296131", "0.6296131", ...
0.8055274
0
Loads an image from a file path
def load(image_path): out = None ##################################### # START YOUR CODE HERE # ##################################### # Use skimage io.imread out = io.imread(image_path) ###################################### # END OF YOUR CODE # ###################################### return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_image(file_path):\r\n return Image.open(file_path)", "def load(path) -> Image:\n return Image.open(path)", "def load_image(self, path):\n if path:\n self.original_image = cv2.imread(path, 1)\n self.prepare_images()", "def load_image(path_to_image, image_name):\...
[ "0.8446908", "0.84077847", "0.8087019", "0.806678", "0.7929188", "0.7838928", "0.7817189", "0.772309", "0.7489495", "0.74410564", "0.7429996", "0.73706484", "0.7364877", "0.7321371", "0.72911817", "0.7271072", "0.7242877", "0.7225145", "0.720523", "0.71573806", "0.71072674", ...
0.7374733
11
Change the value of every pixel by following x_n = 0.5x_p^2 where x_n is the new value and x_p is the original value
def change_value(image): out = None ##################################### # START YOUR CODE HERE # ##################################### image = image / 255 out = np.empty_like(image) height, width, _ = image.shape for h in range(height): for w in range(width): x_p = image[h,w] x_n = (x_p * x_p) * 0.5 out[h,w] = x_n ###################################### # END OF YOUR CODE # ###################################### return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_X(X):\n _X = swap_pixels(X.X)\n\n X.update(_X)\n\n return X", "def recolorPixels(x,y,px, newColorArray):\r\n for i in range(0+coeff1*x,coeff1+coeff1*x):\r\n for j in range(0+coeff1*y,coeff1+coeff1*y):\r\n px[i,j]=newColorArray[x][y]", "def set_pixel(self, x, y, value):\...
[ "0.6009499", "0.6003074", "0.5953545", "0.58825284", "0.5864363", "0.57073236", "0.5685161", "0.56669635", "0.56421584", "0.55719", "0.5569989", "0.5528347", "0.55130744", "0.54917955", "0.54803175", "0.5448064", "0.5439173", "0.5424856", "0.5372966", "0.5365994", "0.53644747...
0.7488139
0
Change image to gray scale
def convert_to_grey_scale(image): out = None ##################################### # START YOUR CODE HERE # ##################################### out = color.rgb2gray(image) ###################################### # END OF YOUR CODE # ###################################### return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_gray_scale(img):\r\n #reading image\r\n im = Image.open(\"filename\")\r\n\r\n if im.mode != \"L\":\r\n im = im.convert(\"L\")\r\n\r\n return img", "def convertImageToGrey(self):\n self.cnvImgTest.convertToGreyscale()", "def gray_scale_img(img):\n if len(img.shape) ==...
[ "0.7942807", "0.769168", "0.76889527", "0.7666961", "0.76355445", "0.7625111", "0.7581593", "0.7507202", "0.7507202", "0.75054574", "0.7501831", "0.74930036", "0.7488352", "0.7467151", "0.72188574", "0.7216018", "0.7204566", "0.7200213", "0.71970624", "0.71568024", "0.7147095...
0.7499669
11
Find successors (including those that result in dining) to this state. But a state where the cannibals can dine has no successors.
def csuccessors(state): M1, C1, B1, M2, C2, B2 = state assert B1 is 1 or B2 is 1 pairs = {} moves = [(0,1), (1,0), (1,1), (2,0), (0,2)] if C1 > M1 or C2 > M2: return pairs # more cannibals than missionaries if B1 is 1: B1, B2 = 0, 1 for m, c in moves: if M1 - m >= 0 and C1 - c >= 0: state = (M1-m, C1-c, B1, M2+m, C2+c, B2) action = 'M' * m + 'C' * c + '->' pairs[state] = action else: B1, B2 = 1, 0 for m, c in moves: if M2 - m >= 0 and C2 - c >= 0: state = (M1+m, C1+c, B1, M2-m, C2-c, B2) action = '<-' + 'M' * m + 'C' * c pairs[state] = action return pairs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def successorStates(self, state):\n currentState = state[1]\n successors = []\n for action in Directions.CARDINAL:\n x, y = state[0] # currentPosition\n print(\"State: {}\".format(state[0]))\n dx, dy = Actions.directionToVector(action)\n nextx, n...
[ "0.6894618", "0.68291223", "0.67817956", "0.6704799", "0.66240865", "0.64933735", "0.6401269", "0.6368074", "0.63232535", "0.6315073", "0.63110363", "0.6297232", "0.62779444", "0.62356126", "0.6207891", "0.61754274", "0.6164512", "0.61620885", "0.60629934", "0.60273325", "0.5...
0.6236211
13
Solve the missionaries and cannibals problem.
def solve(start=(3,3,1,0,0,0), goal=None): if goal is None: goal = (0, 0, 0) + start[:3] if start == goal: return [start] explored = set() # explored states frontier = [ [start] ] # ordered list of paths taken while frontier: path = frontier.pop(0) s = path[-1] for (state, action) in csuccessors(s).items(): if state not in explored: explored.add(state) path2 = path + [action, state] if state == goal: return path2 else: frontier.append(path2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self):", "def solve(self):\n for step in self.run.values():\n step.solve()", "def solve(self):\n pass", "def solve(self):\n pass", "def main():\r\n # Instantiate the data problem.\r\n data = create_data_model()\r\n\r\n # Create the routing index manager.\r...
[ "0.6371754", "0.61560553", "0.60753506", "0.60753506", "0.6040063", "0.5984552", "0.5885841", "0.5864889", "0.58444935", "0.5786145", "0.57801163", "0.57695884", "0.57650137", "0.5738106", "0.57322955", "0.57266694", "0.56898814", "0.5668505", "0.5639238", "0.56376314", "0.56...
0.0
-1
Initialize your data structure here.
def __init__(self): self.nums, self.set = [], set()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_empty(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__...
[ "0.7765608", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7595176", "0.75853467", "0.7558298", "0.7530608", "0.7530608", "0.7530608", "0.7530608", "0.7530608", "0.74971247", "0.74971247", "0.7478105", "0.7477832", "0.7477832", "0.7477832", ...
0.0
-1
Inserts a value to the set. Returns true if the set did not already contain the specified element.
def insert(self, val: int) -> bool: if val not in self.set: self.nums.append(val); self.set.add(val); return True; return False;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, val: int) -> bool:\n if val not in self.set:\n self.set.add(val)\n return True\n return False", "def insert(self, val: int) -> bool:\n if val not in self.value_set:\n self.value_set.add(val)\n self.values.append(val)\n r...
[ "0.7981581", "0.76095164", "0.7475566", "0.7245517", "0.721515", "0.72014433", "0.7169923", "0.71647173", "0.7147763", "0.7050221", "0.6949471", "0.6948543", "0.692912", "0.6911351", "0.69021297", "0.68781555", "0.68749684", "0.68749684", "0.68749684", "0.68749684", "0.687496...
0.75030303
2
Removes a value from the set. Returns true if the set contained the specified element.
def remove(self, val: int) -> bool: if val in self.set: self.set.remove(val); self.nums.remove(val); return True; return False;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, val: int) -> bool:\n if val in self.set:\n self.set.remove(val)\n return True\n return False", "def remove(self, val: int) -> bool:\n temp = self.randomSet.pop(val, False)\n return True if temp != False else temp", "def remove(self, val: int) -...
[ "0.7793552", "0.7472986", "0.7311967", "0.7115737", "0.70873374", "0.69927806", "0.6945106", "0.68983823", "0.68566453", "0.68520516", "0.68365693", "0.68351394", "0.68248504", "0.6823558", "0.6823558", "0.6814836", "0.67781126", "0.67604584", "0.67402226", "0.6724619", "0.67...
0.7555588
1
Get a random element from the set.
def getRandom(self) -> int: return self.nums[random.randint(0, len(self.nums) - 1)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRandom(self):\n return self.nums[random.randint(0, len(self.nums) - 1)]\n\n # Your RandomizedSet object will be instantiated and called as such:\n # obj = RandomizedSet()\n # param_1 = obj.insert(val)\n # param_2 = obj.remove(val)\n # param_3 = obj.getRandom()", "...
[ "0.77060276", "0.738916", "0.7296881", "0.72187954", "0.6871744", "0.68453854", "0.68330806", "0.67740154", "0.67226046", "0.6703282", "0.6665089", "0.66356236", "0.66217655", "0.6612035", "0.66000897", "0.6567767", "0.6477719", "0.6462421", "0.64428514", "0.64162946", "0.640...
0.0
-1
Extract data and the respective labels from a file
def get_data(dataf): with open(dataf) as f: label = [] e_val = [] for line in f: label.append(float(line.split()[1])) e_val.append(-1 * float(line.split()[0])) return label, e_val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_data(feature_file, label_file):", "def get_labeled_data(filename):\n e = []\n y = []\n with open(filename) as f:\n for line in f:\n e.append(line[1:-1])\n y.append(category_mapping[abbreviation_mapping[line[0]]])\n return e, y", "def extract_labels(filename):\n print('Extracting', fi...
[ "0.78632253", "0.7686063", "0.7579877", "0.7308805", "0.7265475", "0.7195249", "0.7183214", "0.7164446", "0.7081873", "0.7065159", "0.7054382", "0.7001995", "0.69624895", "0.69351774", "0.69117355", "0.69072485", "0.69013715", "0.68989193", "0.68852144", "0.6870289", "0.68665...
0.6445296
79
Print a ROC curve given lists of coordinates (fpr, tpr)
def roc2(fpr, tpr, roc_auc): plt.figure() plt.plot(fpr, tpr, color='darkorange', lw=2, label='ROC curve (area = %0.2f)' % roc_auc) plt.plot([0, 1], [0, 1], color='navy', lw=1, linestyle='--') plt.xlim([0.0, 1.0]) plt.ylim([0.0, 1.05]) plt.xlabel('False Positive Rate') plt.ylabel('True Positive Rate') plt.title('Receiver operating characteristic') plt.legend(loc="lower right") plt.show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_roc_curve(fpr, tpr, labels=None, size_inch=(5, 5), dpi=160, show=False, block=False):\n if not isinstance(fpr, np.ndarray) or not isinstance(tpr, np.ndarray):\n raise AssertionError(\"invalid inputs\")\n if fpr.shape != tpr.shape:\n raise AssertionError(\"mismatched input sizes\")\n ...
[ "0.73913735", "0.7386855", "0.7301513", "0.73008204", "0.72942024", "0.722823", "0.7214494", "0.7154316", "0.70779616", "0.70447993", "0.7016029", "0.7015976", "0.6989623", "0.6985157", "0.6965045", "0.6962366", "0.6947648", "0.69254315", "0.6915011", "0.68359005", "0.6800327...
0.7168564
7
Add an HTML max length validator and/or a CKEditor configuration based on what is configured in settings for the current placeholder.
def get_form(self, request, obj=None, change=False, **kwargs): form = super().get_form(request, obj=obj, change=change, **kwargs) placeholder_id = request.GET.get("placeholder_id") if not placeholder_id and not obj: return form if placeholder_id: placeholder = Placeholder.objects.only("slot").get(id=placeholder_id) else: placeholder = obj.placeholder for configuration in SIMPLETEXT_CONFIGURATION: if ( "placeholders" not in configuration or placeholder.slot in configuration["placeholders"] ): break else: configuration = {} body_field = form.base_fields["body"] if configuration.get("max_length"): body_field.validators.append( HTMLMaxLengthValidator(configuration["max_length"]) ) if configuration.get("ckeditor"): body_field.widget = TextEditorWidget( configuration=configuration["ckeditor"] ) return form
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _adjust_max_comment_length(form, field_name='comment'):\r\n form.base_fields['comment'].max_length = DEFAULT_MAX_COMMENT_LENGTH", "def clean_content_length(field_name, min_length=0, max_length=500):\n\n @check_field_is_empty(field_name)\n def wrapper(self):\n \"\"\"Decorator wrapper method.\n \"\"...
[ "0.55875015", "0.5479618", "0.5419644", "0.5283157", "0.52528405", "0.522794", "0.52224386", "0.5122975", "0.50060946", "0.50013745", "0.494857", "0.49309137", "0.48792347", "0.48636127", "0.48341784", "0.48145968", "0.48143637", "0.4809541", "0.47800308", "0.47724333", "0.47...
0.45268467
51
Build plugin context passed to its template to perform rendering
def render(self, context, instance, placeholder): context = super().render(context, instance, placeholder) context.update({"instance": instance}) return context
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(self):\n\n template_string = parseValues(self.data)[1]\n context = self.context\n\n # Run the prebuild plugins, we can't use the standard method here because\n # plugins can chain-modify the context and data.\n for plugin in self.site._plugins:\n if hasattr(...
[ "0.67031616", "0.6571523", "0.6424486", "0.6072535", "0.5999363", "0.582176", "0.5783573", "0.5759585", "0.57382077", "0.57181376", "0.56852263", "0.5682577", "0.5667774", "0.5642691", "0.5627336", "0.5583352", "0.55389804", "0.5489847", "0.54796433", "0.54766", "0.54761475",...
0.0
-1
Call whoami and expect an output
def test_call_command(self): p = call('whoami', shell=False, executable=None, path=None) self.assertIsInstance(p, Response) self.assertIsInstance(p.stdout, str) self.assertIsInstance(p.stderr, str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def whoami(ctx):\n ctx.setup_logger(format='')\n AuthCmd(ctx).whoami()", "def whoami(self):", "def whoami():\n all_informations = run('uname -a',quiet=True)\n fqdn = run('hostname -f',quiet=True)\n print(yellow('Informations : ')+all_informations)\n print(yellow('FQDN : ')+fqdn)", "def run_...
[ "0.7652164", "0.7329425", "0.73260736", "0.67614555", "0.6689236", "0.65300286", "0.6431658", "0.6374339", "0.6258411", "0.6235286", "0.60788286", "0.6035754", "0.6007168", "0.5951228", "0.5930895", "0.59141916", "0.5905599", "0.5892375", "0.5845104", "0.5716784", "0.56899244...
0.71804494
3
PROVN representation of qualified name in a string.
def provn_representation(self): return '"%s" %%%% xsd:anyURI' % self._uri
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _namespace_to_unicode(self):\n\t\treturn u\":\".join(self.namespace_parts)", "def fully_qualified_name(self) -> str:\n return pulumi.get(self, \"fully_qualified_name\")", "def get_qualified_name(self):\n return self.attributes[\"qualifiedName\"]", "def provn_representation(self):\n r...
[ "0.6337318", "0.62333804", "0.6226227", "0.6200508", "0.61675906", "0.614249", "0.61223435", "0.60970294", "0.6077363", "0.60522175", "0.60409945", "0.6036419", "0.5949034", "0.59314924", "0.5897743", "0.5884507", "0.5878005", "0.5872136", "0.58412665", "0.582367", "0.5798794...
0.56616455
30
Namespace of qualified name.
def namespace(self): return self._namespace
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNamespace(self):\n pass;", "def namespace(self):\n assert self._namespace\n return self._namespace", "def namespace(self):\n name = self._name if self._name is not None else '<unnamed>'\n if self._parent is None:\n return name\n return '.'.join([self._parent....
[ "0.79194593", "0.77542627", "0.7565962", "0.74886805", "0.7448928", "0.7448831", "0.7446291", "0.73636454", "0.72533864", "0.7240882", "0.71560305", "0.71484077", "0.7054701", "0.7054701", "0.7054701", "0.6985228", "0.6875989", "0.68536323", "0.68068796", "0.6781957", "0.6757...
0.7325897
8
Local part of qualified name.
def localpart(self): return self._localpart
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_local_prefix(self, stmt, qname):\n pref, colon, name = qname.partition(\":\")\n if colon and pref == stmt.i_module.i_prefix:\n return name\n else:\n return qname", "def local_var_name(global_name):\n return global_name.split(':')[-1].split('.')[-1]", ...
[ "0.7030537", "0.6942859", "0.68614817", "0.67557806", "0.67522043", "0.67152476", "0.66734105", "0.6602574", "0.6508001", "0.63670015", "0.6364165", "0.62062585", "0.615663", "0.615663", "0.6099846", "0.60868347", "0.60564834", "0.5949142", "0.5933793", "0.5860535", "0.586053...
0.5870647
19
PROVN representation of qualified name in a string.
def provn_representation(self): return "'%s'" % self._str
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _namespace_to_unicode(self):\n\t\treturn u\":\".join(self.namespace_parts)", "def fully_qualified_name(self) -> str:\n return pulumi.get(self, \"fully_qualified_name\")", "def get_qualified_name(self):\n return self.attributes[\"qualifiedName\"]", "def full_namespace(self) -> str:\n ...
[ "0.6337318", "0.62333804", "0.6226227", "0.61675906", "0.614249", "0.61223435", "0.60970294", "0.6077363", "0.60522175", "0.60409945", "0.6036419", "0.5949034", "0.59314924", "0.5897743", "0.5884507", "0.5878005", "0.5872136", "0.58412665", "0.582367", "0.57987946", "0.579400...
0.6200508
3
Indicates whether the identifier provided is contained in this namespace.
def contains(self, identifier): uri = identifier if isinstance(identifier, six.string_types) else ( identifier.uri if isinstance(identifier, Identifier) else None ) return uri.startswith(self._uri) if uri else False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __contains__(self, identifier):\n # following breaks some tests, what is the expected behaviour?\n # return any(m.unique_id.endswith(identifier) for m in self)\n return any(m.unique_id == identifier for m in self)", "def is_declared(self, identifier: str) -> bool:\n if identifier ...
[ "0.695668", "0.6656405", "0.6532839", "0.64874536", "0.6400062", "0.63559645", "0.6343124", "0.6330577", "0.6319895", "0.6311052", "0.6293539", "0.62231743", "0.619792", "0.6197703", "0.6196918", "0.6167409", "0.6140008", "0.60929984", "0.60690624", "0.60648376", "0.60636157"...
0.77918166
0
Returns the qualified name of the identifier given using the namespace prefix.
def qname(self, identifier): uri = identifier if isinstance(identifier, six.string_types) else ( identifier.uri if isinstance(identifier, Identifier) else None ) if uri and uri.startswith(self._uri): return QualifiedName(self, uri[len(self._uri):]) else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prefix_to_ns(self, prefix):\n defin = self.module.i_ctx.get_module(\n self.module.i_prefixes[prefix][0])\n return defin.search_one(\"namespace\").arg", "def _getPrefix(self, namespaceURI):\r\n prefixDict = self._getPrefixDict()\r\n if prefixDict.has_key(namespaceURI):\r...
[ "0.769194", "0.7337281", "0.7326206", "0.7299526", "0.72524375", "0.7053602", "0.69734764", "0.69541156", "0.6775588", "0.6710584", "0.67020273", "0.66632754", "0.66148424", "0.65285033", "0.6503347", "0.64935726", "0.64636904", "0.64574414", "0.6445418", "0.6430217", "0.6414...
0.6731498
9
Init new stack based on Dynamic Array DO NOT CHANGE THIS METHOD IN ANY WAY
def __init__(self): self.da = DynamicArray()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self):\n if self.size == 0:\n self.size = int(input(\"Enter size of the stack to be created: \"))\n self.arr = [None] * self.size", "def __init__(self):\n self.data = ArrayStack(10)", "def __init__(self):\n self.stack = collections.deque([])", "def create_sta...
[ "0.7457198", "0.7331999", "0.7084405", "0.70811796", "0.69233215", "0.69006336", "0.686873", "0.6843798", "0.6843798", "0.6843798", "0.6843798", "0.6843798", "0.6843798", "0.6843798", "0.6843798", "0.6843798", "0.6843798", "0.6843798", "0.67822534", "0.6761566", "0.6733388", ...
0.5693851
96
Return content of stack in humanreadable form DO NOT CHANGE THIS METHOD IN ANY WAY
def __str__(self) -> str: out = "STACK: " + str(self.da.length()) + " elements. [" out += ', '.join([str(self.da.get_at_index(_)) for _ in range(self.da.length())]) return out + ']'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return str(self.stack)", "def getStackString(self):\n return \"\".join(self.stack[:0:-1])", "def __str__(self) -> str:\n res = '*** top of stack ***\\n'\n\n # iterate through the stack.\n # Note: we are using our __iter__ method here\n for element...
[ "0.786926", "0.7739289", "0.76698506", "0.7501194", "0.7452612", "0.72843957", "0.72662354", "0.72662354", "0.72662354", "0.72662354", "0.72380555", "0.70351225", "0.698751", "0.698751", "0.69223225", "0.69223225", "0.6841419", "0.6660907", "0.649776", "0.6488226", "0.6484695...
0.65129346
18
Return True is the stack is empty, False otherwise DO NOT CHANGE THIS METHOD IN ANY WAY
def is_empty(self) -> bool: return self.da.is_empty()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty(self) -> bool:\n if len(self.stack)==0:\n return True\n else:\n return False", "def empty(self):\r\n return self.stack == []", "def empty(self):\r\n return len(self.stack) == 0", "def empty(self):\n return self.stack == []", "def is_empty(s...
[ "0.9123999", "0.90650344", "0.9026214", "0.895296", "0.8951374", "0.8931137", "0.8931137", "0.8905325", "0.8888884", "0.88337415", "0.87710994", "0.87356853", "0.8720948", "0.8720948", "0.8673681", "0.8637049", "0.86131716", "0.85480964", "0.8546706", "0.8510701", "0.8494888"...
0.0
-1
Return number of elements currently in the stack DO NOT CHANGE THIS METHOD IN ANY WAY
def size(self) -> int: return self.da.length()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size(self):\n return self.N # Number of items in the stack", "def size(self): #returns the size or number of items in the stack\n if self.is_empty():\n return 0\n else:\n return self.num_items", "def __len__(self):\n return len(self.stack)", ...
[ "0.8630269", "0.8159148", "0.80723697", "0.79899883", "0.7947353", "0.7894318", "0.78837955", "0.78837955", "0.7862439", "0.76882833", "0.75424826", "0.74320614", "0.69482553", "0.69482553", "0.69375956", "0.6909171", "0.6868728", "0.67909694", "0.6777687", "0.67611516", "0.6...
0.0
-1
push function adds the values into the dynamic array
def push(self, value: object) -> None: self.da.append(value) pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self, value): ################# <-\n self.lst = self.lst +[value]", "def add(self, value):\n self.arr.append(value)", "def push(self, value):\n self.last = self.current\n self.current = np.array(value)", "def add_values(self, *values, replace=False):\n\n if replace...
[ "0.67537516", "0.6736303", "0.64801556", "0.62559104", "0.6243577", "0.6235336", "0.62251127", "0.62170935", "0.62170935", "0.6210711", "0.62074614", "0.62074614", "0.61923796", "0.6175564", "0.61663246", "0.6152777", "0.61274415", "0.6088337", "0.6059232", "0.60531515", "0.6...
0.62030673
12
pop function removes the top element of the stack and returns it. If the stack is empty, it raises Stack Exception
def pop(self) -> object: if self.is_empty()== True: # if size of array is 0, raise exception raise StackException else: top_stack = self.da.get_at_index(self.size()-1) # initialize the top of the stack (last element) self.da.remove_at_index(self.size()-1) # remove it return top_stack # return variable pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop():\n stack = _get_stack()\n return _pop(stack)", "def pop(self):\n if not self.isEmpty():\n self.top -= 1\n return self.stack.pop()\n else:\n raise Exception(\"Stack Underflow\")", "def pop(self):\n # Making sure that the stack is not empty\n ...
[ "0.8852038", "0.86380845", "0.86031", "0.8600234", "0.84228384", "0.83492935", "0.834905", "0.831788", "0.82513225", "0.82470196", "0.82214785", "0.82048887", "0.8192677", "0.8191675", "0.81529903", "0.81526566", "0.8116631", "0.80768657", "0.80718434", "0.807138", "0.8042891...
0.86377245
2
top function returns the top of stack without removing it
def top(self) -> object: if self.is_empty()== True: # if size of array is 0, raise exception raise StackException return self.da.get_at_index(self.size()-1) # return the top of the stack (last element) pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top(stack):\n if empty_stack(stack):\n raise IndexError(\"Stack is empty!\")\n else:\n return stack.top.value", "def top(self):\n if self.stack == []:\n return None\n return self.stack[-1]", "def top(state):\n if len(state[STACK]) <= 0:\n return -1\n ...
[ "0.8395421", "0.83918774", "0.8216723", "0.8180373", "0.8177605", "0.80990005", "0.7987349", "0.7987349", "0.79455775", "0.7768455", "0.7682946", "0.7681656", "0.7681302", "0.765822", "0.76458704", "0.7643049", "0.76326025", "0.76272935", "0.757025", "0.7557962", "0.7517474",...
0.74650156
22
Retrieves credentials to run functional tests Credentials are either read from the environment or from a config file ('functional_creds.conf'). Environment variables override those from the config file. The 'functional_creds.conf' file is the clean and new way to use (by default tox 2.0 does not pass environment variables).
def credentials(): username = os.environ.get('OS_USERNAME') password = os.environ.get('OS_PASSWORD') tenant_name = (os.environ.get('OS_TENANT_NAME') or os.environ.get('OS_PROJECT_NAME')) auth_url = os.environ.get('OS_AUTH_URL') config = configparser.RawConfigParser() if config.read(_CREDS_FILE): username = username or config.get('admin', 'user') password = password or config.get('admin', 'pass') tenant_name = tenant_name or config.get('admin', 'tenant') auth_url = auth_url or config.get('auth', 'uri') return { 'username': username, 'password': password, 'tenant_name': tenant_name, 'uri': auth_url }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cfg_credentials(context):\n arguments = {\n '--config': context.config_file,\n 'authorize': False,\n 'account_summary': False\n }\n pychex_cli = PychexCli(arguments)\n pychex_cli.read_config()\n # Check that the values pulled from the read_config method match what we\n # ...
[ "0.67632484", "0.66186816", "0.6517438", "0.6489512", "0.64814514", "0.64630115", "0.6462314", "0.64449906", "0.64166945", "0.64114285", "0.6402676", "0.64013535", "0.6397005", "0.6397005", "0.63863087", "0.6372507", "0.6362634", "0.63454527", "0.6343021", "0.6340192", "0.634...
0.6198195
38
Verify that output table has headers item listed in field_names.
def assertTableHeaders(self, output_lines, field_names): table = self.parser.table(output_lines) headers = table['headers'] for field in field_names: self.assertIn(field, headers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_show_fields(self, show_output, field_names):\n\n # field_names = ['name', 'description']\n # show_output = [{'name': 'fc2b98d8faed4126b9e371eda045ade2'},\n # {'description': 'description-821397086'}]\n # this next line creates a flattened list of all 'keys' (like 'na...
[ "0.71665496", "0.69928867", "0.69691926", "0.6916123", "0.6892314", "0.682082", "0.6780092", "0.67301995", "0.6690977", "0.66392064", "0.6528734", "0.6500211", "0.6498844", "0.64815634", "0.6458742", "0.64520425", "0.63763213", "0.62508994", "0.62471277", "0.6220344", "0.6196...
0.84269035
0
Check presence of common object properties.
def assert_object_details(self, expected, items): for value in expected: self.assertIn(value, items)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_properties(self):\r\n for prop in self.mandatory_properties:\r\n if not hasattr(self, prop):\r\n raise NameError(prop)", "def _has_valid_mandatory_properties(self):\n for prop in self.mandatory_properties:\n if not hasattr(self, prop):\n ...
[ "0.68361294", "0.6376488", "0.6125492", "0.6087755", "0.57784665", "0.57475066", "0.5743678", "0.57321405", "0.5681644", "0.56455135", "0.56306636", "0.5630123", "0.56212044", "0.55530804", "0.55530804", "0.55285686", "0.5517225", "0.5502944", "0.54334295", "0.5424331", "0.53...
0.0
-1
Create a dictionary from an output
def _get_property_from_output(self, output): obj = {} items = self.parser.listing(output) for item in items: obj[item['Property']] = str(item['Value']) return obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_output(output):\n lines = output.splitlines()[3:-1]\n r = {}\n for line in lines:\n kv = filter(None, line.split('|'))\n kv = [x.strip() for x in kv]\n r.update({kv[0]: kv[1]})\n return r", "def _get_output_dictionary(self):\n\n return_dictionary = {}\n\n ...
[ "0.7458908", "0.6636358", "0.6539277", "0.64794725", "0.6453821", "0.64392745", "0.6378547", "0.6347167", "0.6300203", "0.62663984", "0.6249434", "0.6200246", "0.617561", "0.6171171", "0.61182153", "0.6114068", "0.61129606", "0.60749435", "0.6059385", "0.6053162", "0.60514975...
0.6664644
1
Wait until object reaches given status.
def wait_for_object_status(self, object_name, object_id, status, timeout=120, interval=3): cmd = self.object_cmd(object_name, 'show') start_time = time.time() while time.time() - start_time < timeout: if status in self.cinder(cmd, params=object_id): break time.sleep(interval) else: self.fail("%s %s did not reach status %s after %d seconds." % (object_name, object_id, status, timeout))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_for_status(self, status):\n code = self.instance.state['Code']\n while code != status:\n time.sleep(3)\n self.instance.reload()\n code = self.instance.state['Code']", "def check_completion(self):\n\n time.sleep(3)\n while self.status == 0:\n ...
[ "0.73892504", "0.72170204", "0.71951866", "0.70215213", "0.6863582", "0.6744071", "0.6706966", "0.66450965", "0.6635064", "0.65745586", "0.6519117", "0.6512439", "0.65002567", "0.6495888", "0.6489756", "0.6467292", "0.6467292", "0.6445491", "0.6445491", "0.64176154", "0.64089...
0.7880691
0
Check that object deleted successfully.
def check_object_deleted(self, object_name, object_id, timeout=60): cmd = self.object_cmd(object_name, 'show') try: start_time = time.time() while time.time() - start_time < timeout: if object_id not in self.cinder(cmd, params=object_id): break except exceptions.CommandFailed: pass else: self.fail("%s %s not deleted after %d seconds." % (object_name, object_id, timeout))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _objectDeleted(self, obj):\n pass", "def do_deleting(self, request, obj, obj_display, obj_id):\n try:\n with transaction.atomic(savepoint=False):\n self.log_deletion(request, obj, obj_display)\n self.delete_model(request, obj)\n\n return s...
[ "0.7490332", "0.7215603", "0.7164006", "0.7086588", "0.70412916", "0.70006657", "0.69678736", "0.6930805", "0.6886216", "0.68708795", "0.68376404", "0.68198115", "0.6819284", "0.6812539", "0.679975", "0.67971224", "0.6778325", "0.6737792", "0.6717377", "0.66977274", "0.669110...
0.7400769
1
Delete specified object by ID.
def object_delete(self, object_name, object_id): cmd = self.object_cmd(object_name, 'list') cmd_delete = self.object_cmd(object_name, 'delete') if object_id in self.cinder(cmd): self.cinder(cmd_delete, params=object_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_object(self, id):\n return self.request(\n \"{0}/{1}\".format(self.version, id), method=\"DELETE\"\n )", "def delete_object(self, id):\n self.request(id, post_args={\"method\": \"delete\"})", "def delete(self, id):\n raise NotImplementedError", "def delete(se...
[ "0.8803958", "0.87934405", "0.81774986", "0.8085157", "0.80095756", "0.7923544", "0.7919969", "0.7898343", "0.78820676", "0.77202994", "0.7683921", "0.7647502", "0.7644657", "0.764196", "0.7593901", "0.75881594", "0.7587561", "0.7587561", "0.7587561", "0.7587561", "0.7587561"...
0.7656951
11
A simple solution that runs in O(N) in time and space
def simple_solution(self, dominoes: str) -> str: dominoes = list(dominoes) nodes = [(-1, 'L')] + [(i, x) for i, x in enumerate(dominoes) if x != '.'] + [ (len(dominoes), 'R')] for (i, x), (j, y) in zip(nodes, nodes[1:]): if x == y: for k in range(i + 1, j): dominoes[k] = x elif x == 'R' and y == 'L': k, l = i, j while k < l: dominoes[k] = x dominoes[l] = y k, l = k + 1, l - 1 if ((j - i + 1) % 2) != 0: dominoes[(j + i) // 2] = '.' return ''.join(dominoes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(number): # O(N)\n m = {\n 0: 0,\n 1: 1\n } # O(1)\n\n for i in range(2, number + 1): # O(N)\n m[i] = m[i - 1] + m[i - 2] ...
[ "0.67670864", "0.6457243", "0.63699317", "0.63602734", "0.63394123", "0.62733823", "0.625933", "0.6256404", "0.62069196", "0.611461", "0.61137253", "0.6109911", "0.61087", "0.60923487", "0.6089412", "0.6086909", "0.6074533", "0.60509086", "0.6021961", "0.60112464", "0.6007973...
0.0
-1
Another solution that runs in O(N) in time and space
def prefix_sums(self, dominoes: str) -> str: dominoes = list(dominoes) R = [1 if dominoes[0] == 'R' else 0] L = [1 if dominoes[-1] == 'L' else 0] for domino in dominoes[1:]: if domino == 'L': R.append(0) elif domino == 'R': R.append(1) else: R.append(R[-1] + 1 if R[-1] > 0 else 0) for domino in reversed(dominoes[:-1]): if domino == 'R': L.append(0) elif domino == 'L': L.append(1) else: L.append(L[-1] + 1 if L[-1] > 0 else 0) for i in range(len(dominoes)): j = len(dominoes) - i - 1 if R[i] == L[j]: dominoes[i] = '.' elif R[i] == 0 or L[j] == 0: dominoes[i] = 'R' if L[j] == 0 else 'L' else: dominoes[i] = 'R' if R[i] < L[j] else 'L' return ''.join(dominoes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(number): # O(N)\n m = {\n 0: 0,\n 1: 1\n } # O(1)\n\n for i in range(2, number + 1): # O(N)\n m[i] = m[i - 1] + m[i - 2] ...
[ "0.65543354", "0.6385863", "0.6259286", "0.62479013", "0.62419236", "0.62313765", "0.6225552", "0.61846197", "0.6164834", "0.6109419", "0.6085789", "0.60311127", "0.600526", "0.5996835", "0.5993575", "0.59864", "0.59821874", "0.596685", "0.59272826", "0.59256256", "0.5907769"...
0.0
-1
There are N dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push some of the dominoes either to the left or to the right. After each second, each domino that is falling to the left pushes the adjacent domino on the left. Similarly, the dominoes falling to the right push their adjacent dominoes standing on the right. When a vertical domino has dominoes falling on it from both sides, it stays still due to the balance of the forces. For the purposes of this question, we will consider that a falling domino expends no additional force to a falling or already fallen domino. Given a string "S" representing the initial state. S[i] = 'L', if the ith domino has been pushed to the left; S[i] = 'R', if the ith domino has been pushed to the right; S[i] = '.', if the ith domino has not been pushed. Return a string representing the final state.
def pushDominoes(self, dominoes: str) -> str: return self.simple_solution(dominoes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pushDominoes(self, dominoes: str) -> str:\n\n N = len(dominoes)\n dist_R = [-1] * N\n dist_L = [-1] * N\n\n count = -1\n for i in range(N):\n if dominoes[i] == 'R':\n count = 0\n elif dominoes[i] == 'L':\n count = -1\n ...
[ "0.6008191", "0.57589865", "0.5368744", "0.53219604", "0.5282038", "0.5232123", "0.52019006", "0.5195394", "0.5173366", "0.5168104", "0.51569736", "0.5141222", "0.51304805", "0.5118984", "0.5097344", "0.50960946", "0.5071667", "0.5049941", "0.5035389", "0.5035274", "0.5012075...
0.0
-1
check sparsemaxloss kernel against numpy
def _test_sparsemax_loss_against_numpy(self, dtype, random, use_gpu): z = random.uniform(low=-3, high=3, size=(test_obs, 10)) q = np.zeros((test_obs, 10)) q[np.arange(0, test_obs), random.randint(0, 10, size=test_obs)] = 1 tf_loss_op, tf_loss_out = self._tf_sparsemax_loss(z, q, dtype, use_gpu) np_loss = self._np_sparsemax_loss(z, q).astype(dtype) self.assertAllCloseAccordingToType( np_loss, tf_loss_out, half_atol=1e-2, half_rtol=5e-3) self.assertShapeEqual(np_loss, tf_loss_op)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_sparsemax_loss_positive(self, dtype, random, use_gpu):\n z = random.uniform(low=-3, high=3, size=(test_obs, 10))\n q = np.zeros((test_obs, 10))\n q[np.arange(0, test_obs), random.randint(0, 10, size=test_obs)] = 1\n\n tf_loss_op, tf_loss_out = self._tf_sparsemax_loss(z, q, dtype, use_gpu)\n\n...
[ "0.6425822", "0.64143616", "0.6307287", "0.61605656", "0.6009254", "0.5761981", "0.5626876", "0.5618227", "0.5602798", "0.5556589", "0.55460817", "0.55382633", "0.5535278", "0.5496034", "0.5479103", "0.545446", "0.5430234", "0.542532", "0.5417887", "0.54107744", "0.5393759", ...
0.6560093
0
check sparsemaxloss transfers nan
def _test_sparsemax_loss_of_nan(self, dtype, random, use_gpu): q = np.asarray([[0, 0, 1], [0, 0, 1], [0, 0, 1]]) z_nan = np.asarray([[0, np.nan, 0], [0, np.nan, np.nan], [np.nan, np.nan, np.nan]]).astype(dtype) _, tf_loss_nan = self._tf_sparsemax_loss(z_nan, q, dtype, use_gpu) self.assertAllCloseAccordingToType([np.nan, np.nan, np.nan], tf_loss_nan)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_sparsemax_loss_of_inf(self, dtype, random, use_gpu):\n q = np.asarray([[0, 0, 1], [0, 0, 1], [0, 0, 1], [0, 0, 1]])\n z_neg = np.asarray([\n [0, -np.inf, 0],\n [0, -np.inf, -np.inf],\n [-np.inf, -np.inf, 0],\n [-np.inf, -np.inf, -np.inf],\n ]).astype(dtype)\n z_pos...
[ "0.6993612", "0.68045354", "0.6742524", "0.64270777", "0.6119363", "0.59418494", "0.5930874", "0.5891737", "0.583687", "0.58328086", "0.57153714", "0.567385", "0.56433874", "0.5623153", "0.5609487", "0.5586741", "0.5584325", "0.5562963", "0.5493455", "0.5464474", "0.54510564"...
0.7484194
0
check sparsemaxloss is infinity safe
def _test_sparsemax_loss_of_inf(self, dtype, random, use_gpu): q = np.asarray([[0, 0, 1], [0, 0, 1], [0, 0, 1], [0, 0, 1]]) z_neg = np.asarray([ [0, -np.inf, 0], [0, -np.inf, -np.inf], [-np.inf, -np.inf, 0], [-np.inf, -np.inf, -np.inf], ]).astype(dtype) z_pos = np.asarray([[0, np.inf, 0], [0, np.inf, np.inf], [np.inf, np.inf, 0], [np.inf, np.inf, np.inf]]).astype(dtype) z_mix = np.asarray([[0, np.inf, 0], [0, np.inf, -np.inf], [-np.inf, np.inf, 0], [-np.inf, np.inf, -np.inf]]).astype(dtype) _, tf_loss_neg = self._tf_sparsemax_loss(z_neg, q, dtype, use_gpu) self.assertAllCloseAccordingToType([0.25, np.inf, 0, np.nan], tf_loss_neg) _, tf_loss_pos = self._tf_sparsemax_loss(z_pos, q, dtype, use_gpu) self.assertAllCloseAccordingToType([np.nan, np.nan, np.nan, np.nan], tf_loss_pos) _, tf_loss_mix = self._tf_sparsemax_loss(z_mix, q, dtype, use_gpu) self.assertAllCloseAccordingToType([np.nan, np.nan, np.nan, np.nan], tf_loss_mix)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_sparsemax_loss_of_nan(self, dtype, random, use_gpu):\n q = np.asarray([[0, 0, 1], [0, 0, 1], [0, 0, 1]])\n z_nan = np.asarray([[0, np.nan, 0], [0, np.nan, np.nan],\n [np.nan, np.nan, np.nan]]).astype(dtype)\n\n _, tf_loss_nan = self._tf_sparsemax_loss(z_nan, q, dtype, use_...
[ "0.72919095", "0.7114687", "0.6878583", "0.6437763", "0.6230124", "0.6111207", "0.60838383", "0.60647756", "0.6005", "0.58566064", "0.5836664", "0.5805594", "0.57603514", "0.5743544", "0.5705851", "0.56542385", "0.5634526", "0.5634205", "0.56317574", "0.5618935", "0.55948126"...
0.7511145
0
check sparsemaxloss proposition 3
def _test_constant_add(self, dtype, random, use_gpu): z = random.uniform(low=-3, high=3, size=(test_obs, 10)) c = random.uniform(low=-3, high=3, size=(test_obs, 1)) q = np.zeros((test_obs, 10)) q[np.arange(0, test_obs), np.random.randint(0, 10, size=test_obs)] = 1 _, tf_loss_zpc = self._tf_sparsemax_loss(z + c, q, dtype, use_gpu) _, tf_loss_z = self._tf_sparsemax_loss(z, q, dtype, use_gpu) self.assertAllCloseAccordingToType( tf_loss_zpc, tf_loss_z, float_atol=5e-6, float_rtol=5e-6, half_atol=1e-2, half_rtol=1e-2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_sparsemax_loss_positive(self, dtype, random, use_gpu):\n z = random.uniform(low=-3, high=3, size=(test_obs, 10))\n q = np.zeros((test_obs, 10))\n q[np.arange(0, test_obs), random.randint(0, 10, size=test_obs)] = 1\n\n tf_loss_op, tf_loss_out = self._tf_sparsemax_loss(z, q, dtype, use_gpu)\n\n...
[ "0.66934943", "0.6259219", "0.60644525", "0.5932874", "0.5896964", "0.57575476", "0.5734909", "0.57317626", "0.5721183", "0.5685912", "0.5658947", "0.56559056", "0.56359863", "0.5633538", "0.55814755", "0.5575781", "0.5545625", "0.55320644", "0.55299217", "0.552717", "0.55233...
0.0
-1
check sparsemaxloss proposition 4
def _test_sparsemax_loss_positive(self, dtype, random, use_gpu): z = random.uniform(low=-3, high=3, size=(test_obs, 10)) q = np.zeros((test_obs, 10)) q[np.arange(0, test_obs), random.randint(0, 10, size=test_obs)] = 1 tf_loss_op, tf_loss_out = self._tf_sparsemax_loss(z, q, dtype, use_gpu) self.assertAllCloseAccordingToType(np.abs(tf_loss_out), tf_loss_out) self.assertShapeEqual(np.zeros(test_obs), tf_loss_op)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_sparsemax_loss_zero(self, dtype, random, use_gpu):\n # construct z and q, such that z_k >= 1 + max_{j!=k} z_k holds for\n # delta_0 = 1.\n z = random.uniform(low=-3, high=3, size=(test_obs, 10))\n z[:, 0] = np.max(z, axis=1) + 1.05\n\n q = np.zeros((test_obs, 10))\n q[:, 0] = 1\n\n t...
[ "0.6196355", "0.6067124", "0.6020071", "0.5861591", "0.58333623", "0.5814174", "0.5738434", "0.56803995", "0.5659591", "0.5651032", "0.56506085", "0.5645035", "0.5634631", "0.5630038", "0.56013834", "0.55691886", "0.5534191", "0.5532042", "0.5531974", "0.5514072", "0.5472693"...
0.660775
0
check sparsemaxloss proposition 5
def _test_sparsemax_loss_zero(self, dtype, random, use_gpu): # construct z and q, such that z_k >= 1 + max_{j!=k} z_k holds for # delta_0 = 1. z = random.uniform(low=-3, high=3, size=(test_obs, 10)) z[:, 0] = np.max(z, axis=1) + 1.05 q = np.zeros((test_obs, 10)) q[:, 0] = 1 tf_loss_op, tf_loss_out = self._tf_sparsemax_loss(z, q, dtype, use_gpu) tf_sparsemax_op, tf_sparsemax_out = self._tf_sparsemax(z, dtype, use_gpu) self.assertAllCloseAccordingToType(np.zeros(test_obs), tf_loss_out) self.assertShapeEqual(np.zeros(test_obs), tf_loss_op) self.assertAllCloseAccordingToType(q, tf_sparsemax_out) self.assertShapeEqual(q, tf_sparsemax_op)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_sparsemax_loss_positive(self, dtype, random, use_gpu):\n z = random.uniform(low=-3, high=3, size=(test_obs, 10))\n q = np.zeros((test_obs, 10))\n q[np.arange(0, test_obs), random.randint(0, 10, size=test_obs)] = 1\n\n tf_loss_op, tf_loss_out = self._tf_sparsemax_loss(z, q, dtype, use_gpu)\n\n...
[ "0.6566375", "0.6140244", "0.6020924", "0.583102", "0.5816435", "0.5766244", "0.57547736", "0.5742387", "0.5733611", "0.5728958", "0.569015", "0.56716436", "0.5660839", "0.56137866", "0.5600897", "0.55933416", "0.55928576", "0.5521913", "0.54795593", "0.5471057", "0.54647976"...
0.61877185
1
check sparsemaxloss Rop, against estimatedloss Rop
def _test_gradient_against_estimate(self, dtype, random, use_gpu): z = random.uniform(low=-3, high=3, size=(test_obs, 10)).astype(dtype) q = np.zeros((test_obs, 10)).astype(dtype) q[np.arange(0, test_obs), np.random.randint(0, 10, size=test_obs)] = 1 logits = array_ops.placeholder(dtype, name='z') sparsemax_op = sparsemax(logits) loss_op = sparsemax_loss(logits, sparsemax_op, q) with self.test_session(use_gpu=use_gpu): err = gradient_checker.compute_gradient_error( logits, z.shape, loss_op, (test_obs,), x_init_value=z, delta=1e-9) self.assertLess(err, 1e-4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test(args, model, device, data, target):\n model.eval()\n test_loss = 0\n correct = 0\n data, target = data.to(device), target.to(device)\n output = model(data)\n # Final result will be average of averages of the same size\n test_loss += F.nll_loss(output, target, reduction='mean').item()\...
[ "0.59559137", "0.5920649", "0.5891724", "0.58784205", "0.5843466", "0.5749206", "0.5714167", "0.5698575", "0.5662596", "0.56607074", "0.56145835", "0.55982244", "0.55072397", "0.54940027", "0.54862463", "0.5481414", "0.547548", "0.54676175", "0.5464912", "0.5449157", "0.54412...
0.0
-1
check sparsemaxloss Rop, against numpy Rop
def _test_gradient_against_numpy(self, dtype, random, use_gpu): z = random.uniform(low=-3, high=3, size=(test_obs, 10)) q = np.zeros((test_obs, 10)) q[np.arange(0, test_obs), np.random.randint(0, 10, size=test_obs)] = 1 logits = constant_op.constant(z.astype(dtype), name='z') sparsemax_op = sparsemax(logits) loss_op = sparsemax_loss(logits, sparsemax_op, q.astype(dtype)) loss_grad_op = gradients_impl.gradients(loss_op, [logits])[0] with self.test_session(use_gpu=use_gpu): tf_grad = loss_grad_op.eval() np_grad = self._np_sparsemax_loss_grad(z, q).astype(dtype) self.assertAllCloseAccordingToType( np_grad, tf_grad, half_atol=1e-2, half_rtol=5e-3) self.assertShapeEqual(np_grad, loss_grad_op)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_sparsemax_loss_against_numpy(self, dtype, random, use_gpu):\n z = random.uniform(low=-3, high=3, size=(test_obs, 10))\n q = np.zeros((test_obs, 10))\n q[np.arange(0, test_obs), random.randint(0, 10, size=test_obs)] = 1\n\n tf_loss_op, tf_loss_out = self._tf_sparsemax_loss(z, q, dtype, use_gpu...
[ "0.608403", "0.5973735", "0.571578", "0.5632115", "0.54965043", "0.5486409", "0.5408095", "0.5354363", "0.5288926", "0.5264263", "0.5211011", "0.5193525", "0.5165354", "0.51506674", "0.50947654", "0.50944364", "0.50929224", "0.508245", "0.5064704", "0.50560075", "0.5050354", ...
0.54233766
6
Accepts rows of timesortable data
def put(self, data): if len(data) == 0: return [] new_data = [] sorted_data = self._sort(data) sorted_data_iterator = iter(sorted_data) earliest_data = next(sorted_data_iterator) earliest_timestamp = self.get_hash(earliest_data) new_buffer = OrderedDict() try: for timestamp in self.buffer: if timestamp < earliest_timestamp: pass else: while True: if earliest_timestamp in self.buffer: pass else: new_buffer[earliest_timestamp] = True new_data.append(earliest_data) earliest_data = next(sorted_data_iterator) earliest_timestamp = self.get_hash(earliest_data) if timestamp < earliest_timestamp: break while True: new_buffer[earliest_timestamp] = True new_data.append(earliest_data) earliest_data = next(sorted_data_iterator) earliest_timestamp = self.get_hash(earliest_data) except StopIteration: pass self.buffer = new_buffer return new_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sort_time(self):\n time = np.copy(self.data[\"time\"][:])\n ind_sorted = np.argsort(time)\n ind_valid: list[int] = []\n for ind in ind_sorted:\n if time[ind] not in time[ind_valid]:\n ind_valid.append(ind)\n n_time = len(time)\n for key, arra...
[ "0.62110686", "0.5617712", "0.5604052", "0.55013937", "0.5485576", "0.54825485", "0.5480284", "0.53317887", "0.5248092", "0.5174748", "0.5161101", "0.51461595", "0.51112086", "0.51031595", "0.50956035", "0.50943315", "0.5072948", "0.5051467", "0.49987826", "0.4959382", "0.495...
0.0
-1
ExportResponseMetadata a model defined in Swagger
def __init__(self, export_host=None, export_date=None, requested_object_list=None, exported_object_list=None): # noqa: E501 # noqa: E501 self._export_host = None self._export_date = None self._requested_object_list = None self._exported_object_list = None self.discriminator = None if export_host is not None: self.export_host = export_host if export_date is not None: self.export_date = export_date if requested_object_list is not None: self.requested_object_list = requested_object_list if exported_object_list is not None: self.exported_object_list = exported_object_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_model_metadata(\n self,\n model_name: str,\n model_version: str = ...,\n headers: dict[str, t.Any] = ...,\n as_json: t.Literal[False] = ...,\n ) -> service_pb2.ModelMetadataResponse:", "def api_documentation(api: str, summary: str, in_model: BaseModel,\n ...
[ "0.6050486", "0.5972756", "0.5801244", "0.56295675", "0.5604811", "0.55415565", "0.5516606", "0.5497246", "0.54778665", "0.54568404", "0.5436918", "0.54210794", "0.5404738", "0.53839225", "0.5312669", "0.5309557", "0.53045684", "0.52979773", "0.5291329", "0.52629024", "0.5245...
0.0
-1
Sets the export_host of this ExportResponseMetadata.
def export_host(self, export_host): self._export_host = export_host
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_host(self, response_host):\n\n self._response_host = response_host", "def response_host(self, response_host):\n\n self._response_host = response_host", "def host(self, host):\n\n self._host = host", "def host(self, host):\n\n self._host = host", "def host(self, host...
[ "0.7138213", "0.7138213", "0.644298", "0.644298", "0.644298", "0.644298", "0.6365714", "0.6363546", "0.6119689", "0.5977553", "0.5908788", "0.58681583", "0.5725987", "0.5704862", "0.5632454", "0.5604846", "0.5604846", "0.5506752", "0.5506752", "0.5476766", "0.54253507", "0....
0.8150576
0
Sets the export_date of this ExportResponseMetadata.
def export_date(self, export_date): self._export_date = export_date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_date(self, date):\n self.data['date'] = date", "def set_date(self, date):\n self.date = date\n return", "def set_date(self, date):\n self.date = date", "def date(self, date):\n\n self._date = date", "def date(self, date):\n\n self._date = date", "def date...
[ "0.64057446", "0.63387674", "0.63318104", "0.62219906", "0.62219906", "0.62219906", "0.62219906", "0.62219906", "0.6208642", "0.6150361", "0.6148115", "0.597754", "0.59448314", "0.59330714", "0.5932477", "0.5932477", "0.59302837", "0.59251916", "0.5893984", "0.5889508", "0.58...
0.8478781
0
Sets the requested_object_list of this ExportResponseMetadata.
def requested_object_list(self, requested_object_list): self._requested_object_list = requested_object_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exported_object_list(self, exported_object_list):\n\n self._exported_object_list = exported_object_list", "def set_response_list(self, r_list):\n self.response_list = r_list", "def set_objects(self, objects: list):\n self._objects = objects", "def set_object_list(self, query, fields,...
[ "0.65758", "0.58558273", "0.5800644", "0.5349972", "0.51523393", "0.5088856", "0.5084719", "0.5048292", "0.50420725", "0.5036184", "0.50234246", "0.50130266", "0.4954567", "0.4948551", "0.49092585", "0.49018076", "0.49018076", "0.48524174", "0.48476678", "0.47991368", "0.4791...
0.843938
0
Sets the exported_object_list of this ExportResponseMetadata.
def exported_object_list(self, exported_object_list): self._exported_object_list = exported_object_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, export_host=None, export_date=None, requested_object_list=None, exported_object_list=None): # noqa: E501 # noqa: E501\n\n self._export_host = None\n self._export_date = None\n self._requested_object_list = None\n self._exported_object_list = None\n self.discr...
[ "0.57387066", "0.572405", "0.5720836", "0.50837755", "0.5052673", "0.4954005", "0.49233595", "0.48638776", "0.48131937", "0.47819278", "0.47225076", "0.47225076", "0.47171348", "0.46870238", "0.46680313", "0.46198332", "0.46057516", "0.45436734", "0.45278898", "0.45272794", "...
0.8515711
0
Returns the model properties as a dict
def to_dict(self): result = {} for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value if issubclass(ExportResponseMetadata, dict): for key, value in self.items(): result[key] = value return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return self.properties", "def to_dict(self):\n return self.properties", "def get_properties(self):\n return self.properties", "def asdict(self):\n return self._prop_dict", "def json(self):\n rv = {\n prop: getattr(self, prop)\n f...
[ "0.7751993", "0.7751993", "0.73391134", "0.7334895", "0.7297356", "0.727818", "0.7159078", "0.71578115", "0.71494967", "0.71494967", "0.71283495", "0.71275014", "0.7122587", "0.71079814", "0.7060394", "0.7043251", "0.7034103", "0.70233124", "0.69635814", "0.69586295", "0.6900...
0.0
-1
Returns the string representation of the model
def to_str(self): return pprint.pformat(self.to_dict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self) -> str:\n # noinspection PyUnresolvedReferences\n opts = self._meta\n if self.name_field:\n result = str(opts.get_field(self.name_field).value_from_object(self))\n else:\n ...
[ "0.85856134", "0.7814518", "0.77898884", "0.7751367", "0.7751367", "0.7712228", "0.76981676", "0.76700574", "0.7651133", "0.7597206", "0.75800353", "0.7568254", "0.7538184", "0.75228703", "0.7515832", "0.7498764", "0.74850684", "0.74850684", "0.7467648", "0.74488163", "0.7442...
0.0
-1
For `print` and `pprint`
def __repr__(self): return self.to_str()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pprint(*args, **kwargs):\n if PRINTING:\n print(*args, **kwargs)", "def print_out():\n pass", "def custom_print(*objects):\n print(*objects, sep=OFS, end=ORS)", "def _print(self, *args):\n return _ida_hexrays.vd_printer_t__print(self, *args)", "def _printable(self):\n ...
[ "0.75577617", "0.73375154", "0.6986672", "0.698475", "0.6944995", "0.692333", "0.6899106", "0.6898902", "0.68146646", "0.6806209", "0.6753795", "0.67497987", "0.6744008", "0.6700308", "0.6691256", "0.6674591", "0.6658083", "0.66091245", "0.6606931", "0.6601862", "0.6563738", ...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, ExportResponseMetadata): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1