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
Quickly plot multiple images at once. each arr has to be a list of 2D or 3D images Example ======= x = np.ones((200,200)) plot_some([x],[x]) x = np.ones((5,200,200)) plot_some(x,x,x)
def plot_some(*arr, **kwargs): title_list = kwargs.pop('title_list',None) pmin = kwargs.pop('pmin',0) pmax = kwargs.pop('pmax',100) cmap = kwargs.pop('cmap','magma') imshow_kwargs = kwargs return _plot_some(arr=arr, title_list=title_list, pmin=pmin, pmax=pmax, cmap=cmap, **imshow_kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PlotImages(x):\r\n # 5.1 Create figure-window and axes\r\n _, ax = plt.subplots(nrows = 2, ncols= 3)\r\n # 5.2\r\n ax[0,0].imshow(x[0, :].reshape(75,75))\r\n ax[0,1].imshow(x[1, :].reshape(75,75))\r\n ax[0,2].imshow(x[2, :].reshape(75,75))\r\n ax[1,0].imshow(x[3, :].reshape(75,75))\r\n ...
[ "0.70711166", "0.7066877", "0.701081", "0.6905507", "0.68050313", "0.6788474", "0.6689471", "0.6664214", "0.6644253", "0.66416115", "0.6564791", "0.6560931", "0.6557468", "0.65556717", "0.6523524", "0.6523524", "0.6523524", "0.6478707", "0.6459929", "0.6411923", "0.64117026",...
0.7205167
0
plots a matrix of images arr = [ X_1, X_2, ..., X_n] where each X_i is a list of images
def _plot_some(arr, title_list=None, pmin=0, pmax=100, cmap='magma', **imshow_kwargs): import matplotlib.pyplot as plt imshow_kwargs['cmap'] = cmap def make_acceptable(a): return np.asarray(a) def color_image(a): return np.stack(map(to_color,a)) if 1 < a.shape[-1] <= 3 else a def ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_n_image(X, n):\n pic_size = int(np.sqrt(X.shape[1]))\n grid_size = int(np.sqrt(n))\n\n first_n_images = X[:n, :]\n\n fig, ax_array = plt.subplots(nrows=grid_size, ncols=grid_size,sharey=True, sharex=True, figsize=(8, 8))\n\n for r in range(grid_size):\n for c in range(grid_size):\n ...
[ "0.7608688", "0.7593615", "0.72672635", "0.7190524", "0.7189609", "0.71369797", "0.7067448", "0.7022683", "0.6996279", "0.6992667", "0.6962755", "0.690849", "0.68871385", "0.6861115", "0.6765002", "0.6743826", "0.6743826", "0.6743826", "0.6743197", "0.6733798", "0.6728061", ...
0.6642395
29
Converts a 2D or 3D stack to a colored image (maximal 3 channels).
def to_color(arr, pmin=1, pmax=99.8, gamma=1., colors=((0, 1, 0), (1, 0, 1), (0, 1, 1))): if not arr.ndim in (2,3): raise ValueError("only 2d or 3d arrays supported") if arr.ndim ==2: arr = arr[np.newaxis] ind_min = np.argmin(arr.shape) arr = np.moveaxis(arr, ind_min, 0).astype(np.floa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_3d(im_stack):\n im_stack /= 127.5\n im_stack -= 1.0\n return im_stack", "def batch_rgb2gray(imstack):\n grayim = np.zeros((imstack.shape[0], imstack.shape[1], imstack.shape[2]), \"float32\")\n for i in range(grayim.shape[0]):\n grayim[i] = rgb2gray(imstack[i].astype(\"uint8\"...
[ "0.67036676", "0.62252903", "0.6009412", "0.59640753", "0.59429044", "0.59268093", "0.57883483", "0.57472986", "0.5678458", "0.5621185", "0.5615368", "0.5583152", "0.5572368", "0.5548536", "0.5517618", "0.5498324", "0.5489708", "0.5468431", "0.54646695", "0.54549956", "0.5444...
0.0
-1
Generate default DataKeepers for VarLoadSpeed workflow
def gen_datakeeper_list(self): datakeeper_list = [] simu = self.parent # Save speed datakeeper_list.append( DataKeeper( name="Speed", symbol="N0", unit="rpm", keeper="lambda output: output.elec.N0", ) ) # Get default datakeeper ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_savers(self):\n with self.graph.as_default():\n #Loop through to find variables to ignore\n all_vars = tf.compat.v1.global_variables()\n load_vars = [v for v in all_vars if v not in self.full_model_load_ignore]\n self.full_saver = tf.compat.v1.train.Saver(max_to_keep=self.param...
[ "0.60901564", "0.5736703", "0.5667407", "0.5600917", "0.55990887", "0.5540418", "0.55107814", "0.54961354", "0.5494534", "0.54596895", "0.5437185", "0.5413207", "0.5400129", "0.5386552", "0.5373071", "0.53684455", "0.5367128", "0.5360437", "0.52821386", "0.5277415", "0.525839...
0.5209084
28
On which days did more than 1% of requests lead to errors?
def daily_error_gt_1pct(db): query = """ select day, round(error_pct,2) as error_pct from ( select day, ( ( sum(occurance) filter(where status != '200 OK') / sum(occurance) ) * 100 ) as error_pct from ( select to_char(time, 'Month DD, YYYY') as day,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def days_with_request():\n\n # To print information\n information_string = '3. Days with more than ' \\\n '1% of request that lead to an error:\\n'\n\n # Query string\n query = \"\"\"select * from (select date(time),\n round(100.0*sum(case log.status\n whe...
[ "0.74429655", "0.73769623", "0.70260245", "0.70131814", "0.69248164", "0.6859821", "0.68585485", "0.6589264", "0.6509256", "0.64472634", "0.6404929", "0.6339969", "0.63344014", "0.62129766", "0.61929214", "0.61694694", "0.60457176", "0.59663457", "0.5903446", "0.5840939", "0....
0.6823604
7
Initialise the QEMAdapter instance. This constructor initialises the adapter instance, extracting the appropriate configuration options passed in by the server, creating a InterfaceData object to interact with the sevrer and backplane handlers and starting a period update loop within the tornado IOLoop instance to hand...
def __init__(self, **kwargs): # Initialise the superclass ApiAdapter - this parses the keyword arguments # into the options used below. super(InterfaceAdapter, self).__init__(**kwargs) interface_options = { 'working_dir' : str(self.options.get('working_directory')), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(\n self, config: interface.BaseConfig, session_manager: ClientSessionManager\n ):\n super().__init__(max_calls=1) # To StateProducer via interface.AppleTV\n self._config = config\n self._session_manager = session_manager\n self._protocols_to_setup: Queue[SetupDat...
[ "0.6246754", "0.6134311", "0.60056937", "0.59435606", "0.59399885", "0.5938015", "0.58114725", "0.5783236", "0.57771885", "0.57014894", "0.56744635", "0.5656668", "0.56562054", "0.5633026", "0.5632867", "0.5621585", "0.5616236", "0.56147224", "0.56017303", "0.55965614", "0.55...
0.684456
0
Handle an HTTP GET request. This method handles an HTTP GET request routed to the adapter. This passes the path of the request to the underlying InterfaceData instance, where it is interpreted and returned as a dictionary containing the appropriate parameter tree.
def get(self, path, request): try: #Check for metadata argument metadata = False if "Accept" in request.headers: splitted = request.headers["Accept"].split(';') if len(splitted) > 1: splitted = splitted[1:] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_GET(self):\n\n try:\n self.parsed_url = urllib.parse.urlsplit(self.path)\n self.request_params = dict(urllib.parse.parse_qsl(self.parsed_url.query))\n\n handler = self._dispatch_on_path()\n\n if isinstance(handler, Handler):\n\n self._check_r...
[ "0.7317181", "0.7053826", "0.68583715", "0.6845075", "0.6772212", "0.6740971", "0.6593313", "0.65820014", "0.65498316", "0.653717", "0.64670396", "0.64539516", "0.64454687", "0.6416539", "0.64149696", "0.63978124", "0.63909775", "0.6355734", "0.63305265", "0.6291063", "0.6269...
0.65356284
10
Handle an HTTP PUT request. This method handles an HTTP PUT request routed to the adapter.This decodes the JSON body of the request into a dict, and passes the result with the request path to the underlying InterfaceData instance, where it is parsed and appropriate actions taken.
def put(self, path, request): try: data = json_decode(request.body) self.interface_data.set(path, data) response = self.interface_data.get(path, False) status_code = 200 except MetadataParameterError as e: response = {'error': str(e)} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self, path, request):\n\n content_type = 'application/json'\n\n try:\n data = json_decode(request.body)\n self.fileInterface.set(path, data)\n response = self.fileInterface.get(path)\n status_code = 200\n except FileInterfaceError as e:\n ...
[ "0.7248065", "0.6955489", "0.6941687", "0.6785341", "0.6680217", "0.6676589", "0.66458213", "0.6615419", "0.6500376", "0.64675933", "0.64273846", "0.6404214", "0.6280552", "0.62804186", "0.62793255", "0.6271429", "0.6265722", "0.6231033", "0.6231033", "0.6231033", "0.618072",...
0.7927173
0
Handle background update loop tasks. This method polls the sensors in the background and is executed periodically in the tornado IOLoop instance.
def update_loop(self): # Handle background tasks #self.interface_data.backplane.poll_all_sensors() # Schedule the update loop to run in the IOLoop instance again after appropriate # interval IOLoop.instance().call_later(self.update_interval, self.update_loop)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n while True:\n # Do something\n print('Doing something imporant in the background')\n\n self.loadData()\n time.sleep(self.interval)", "def add_update_loop(self):\n l = LoopingCall(self.update_active_node)\n l.clock = self.reactor\n ...
[ "0.66790515", "0.6355443", "0.634593", "0.6324028", "0.6284374", "0.62757915", "0.62316465", "0.62310386", "0.6216169", "0.6204409", "0.6203999", "0.61990917", "0.6163417", "0.61604416", "0.6124282", "0.6124282", "0.61110944", "0.60961056", "0.60944873", "0.60881984", "0.6076...
0.8306783
0
Returns a mesh of squares in the xyplane where each unit is one of the two given colors and adjacent squares have opposite colors.
def checkerboard( radius: int = 4, color1: Tuple[float, ...] = (0.0, 0.0, 0.0), color2: Tuple[float, ...] = (1.0, 1.0, 1.0), device: Optional[torch.types._device] = None, ) -> Meshes: if device is None: device = torch.device("cpu") if radius < 1: raise ValueError("radius must be...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_square_triangle_mesh():\n vertices = np.array(\n ((0, 0, 0), (1, 0, 0), (0, 1, 0), (1, 1, 0), (0.5, 0.5, 0)),\n dtype=np.float32)\n faces = np.array(\n ((0, 1, 4), (1, 3, 4), (3, 2, 4), (2, 0, 4)), dtype=np.int32)\n return vertices, faces", "def yield_isosceles_triangles(cls):\n ...
[ "0.63428485", "0.6201984", "0.607834", "0.60289735", "0.58987814", "0.5778267", "0.5738428", "0.5700882", "0.5674927", "0.562093", "0.5596301", "0.5584693", "0.5582065", "0.55752957", "0.55621064", "0.5553264", "0.5553264", "0.55416226", "0.5519514", "0.5519514", "0.5519514",...
0.5708757
7
Saves a new baseline file into the port's baseline directory. The file will be named simply "expected", suitable for use as the expected results in a later run.
def _save_baseline_data(self, data, modifier, generate_new_baseline=True): port = self._port fs = port._filesystem if generate_new_baseline: relative_dir = fs.dirname(self._testname) baseline_path = port.baseline_path() output_dir = fs.join(baseline_path, rel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_test_baseline(self, file_name):\n return os.path.abspath(\n os.path.join(\n os.path.abspath(__file__),\n u'..',\n u'baselines',\n file_name))", "def bless_output(self):\n actual_output_file = path.splitext(self.source_na...
[ "0.61419886", "0.61045825", "0.5936975", "0.56854904", "0.5615434", "0.5565428", "0.55316305", "0.5527674", "0.54743046", "0.54691416", "0.54440033", "0.53628296", "0.53045976", "0.5276994", "0.5240396", "0.52365404", "0.5218536", "0.52183956", "0.5201798", "0.51563257", "0.5...
0.676486
0
Receives the output from a DumpRenderTree process, subjects it to a number of tests, and returns a list of failure types the test produced.
def _process_output(self, driver_output): fs = self._port._filesystem failures = self._handle_error(driver_output) expected_driver_output = self._expected_driver_output() # Check the output and save the results. start_time = time.time() time_for_diffs = {} for te...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_failed_tests_info():\n global g_failed_testnames\n global g_failed_test_paths\n\n if os.path.isfile(g_temp_filename):\n console_file = open(g_temp_filename,'r') # open temp file that stored jenkins job console output\n try:\n for each_line in console_file: # go throu...
[ "0.6139017", "0.58134925", "0.5801882", "0.57782215", "0.57617205", "0.575985", "0.57558024", "0.57512224", "0.5713094", "0.5690147", "0.56870687", "0.5684887", "0.5628258", "0.5627857", "0.5616837", "0.5599172", "0.55200875", "0.5511547", "0.5509322", "0.5497192", "0.5496381...
0.55722797
16
Returns the name/category of the budget.
def name(self) -> str: return str(self.category.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def budget_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"budget_name\")", "def budget_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"budget_name\")", "def budget_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"budget_name\")", "def get...
[ "0.7660619", "0.7269922", "0.7156352", "0.6941515", "0.687923", "0.6801441", "0.67427135", "0.672864", "0.67025054", "0.6613733", "0.65991443", "0.6553266", "0.6553266", "0.6445341", "0.6432643", "0.6391167", "0.6386544", "0.6358142", "0.6309232", "0.6306965", "0.6273415", ...
0.7123988
3
A property that calculates the exceeded ratio (amount spent / total amount) of this budget.
def exceeded_ratio(self) -> float: return self.amount_spent / self.total_amount
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def budget_used(self):\n return int(self.total_spent() / self.budget() * 100.0)", "def percent_raised(self):\n total_cost = self.total_cost()\n if total_cost:\n return round(self.total_raised() * 100 / total_cost, 2)\n else:\n return 0", "def ratio(self):\n ...
[ "0.6591943", "0.6559081", "0.63274586", "0.6305053", "0.6276677", "0.62711346", "0.6237848", "0.6213536", "0.6212942", "0.61523706", "0.61523706", "0.6116475", "0.6113221", "0.6110212", "0.60746557", "0.6064563", "0.6050357", "0.60138005", "0.5991126", "0.5988578", "0.5982346...
0.83884895
0
Read only property of the _locked attribute, to determine if this budget is locked.
def locked(self) -> bool: return self._locked
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_locked(self):\n return self._is_locked", "def locked(self):\n return self.is_locked", "def locked(self) -> bool:\n return pulumi.get(self, \"locked\")", "def is_locked(self):\r\n pass", "def is_locked(self):\n ret_val = self._is_locked()\n return ret_val", ...
[ "0.7902527", "0.77848", "0.7781904", "0.7753825", "0.76652926", "0.7660343", "0.7645482", "0.7565413", "0.75639856", "0.7493816", "0.74647826", "0.74602294", "0.7433045", "0.7423135", "0.74167967", "0.74167967", "0.74167967", "0.73956585", "0.73792064", "0.7378929", "0.728194...
0.7400543
17
Adds a budget to the dictionary.
def add_budget(self, budget: Budget) -> None: self.budgets[budget.category] = budget
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deposit(self, amount, budget):\r\n if budget != \"Total Balance\":\r\n assert budget in self.budgets, \"Specified budget doesn't exist\"\r\n self.budgets[budget] += float(amount)\r\n self.balance += float(amount)", "def declare_new_budget(date, exp_data):\n\n exp_list =...
[ "0.63456917", "0.60231787", "0.5939616", "0.59035134", "0.5890429", "0.5828401", "0.5779284", "0.57482374", "0.5545248", "0.5494234", "0.5493827", "0.5463563", "0.5444056", "0.5438311", "0.54316634", "0.5424708", "0.54197586", "0.540606", "0.5402471", "0.53940505", "0.5336805...
0.7852479
0
Finds and returns budget stored in the dictionary.
def get_budget(self, category: BudgetCategory) -> Budget: return self.budgets.get(category, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def budget(self):\n return self._budget", "def get_budget_by_name(self, budget_name):\n return next((budget for budget in self.budgets\n if budget.name.lower() == budget_name.lower()), None)", "def getBudget(movieInfo):\n if \"budget\" in movieInfo:\n return int(movi...
[ "0.644745", "0.6405999", "0.62401956", "0.60685647", "0.6040692", "0.5716305", "0.5598385", "0.5519935", "0.5446943", "0.54325116", "0.54259604", "0.5413207", "0.535384", "0.53050965", "0.5295184", "0.5284351", "0.5279604", "0.5254645", "0.5236342", "0.52344924", "0.5230984",...
0.64537567
0
Returns budgets stored in the dictionary as a list.
def get_budgets(self) -> list: return list(self.budgets.values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_budgets(self) -> list:\n return self.budget_manager.get_budgets()", "def view_budgets(self) -> None:\n Menu.prompt_view_budgets()\n for budget in self.user.budget_manager:\n print(f\"{budget}\\n\")", "def get_expenses(budget):\n return sum(expense['bgt'] for expense i...
[ "0.74353254", "0.6164198", "0.6107933", "0.6100253", "0.58037996", "0.5798786", "0.57337105", "0.5695821", "0.56689733", "0.566745", "0.56575996", "0.5653672", "0.5653672", "0.5638305", "0.56300706", "0.5625624", "0.5610835", "0.5596588", "0.5596588", "0.5596588", "0.5596588"...
0.8426276
0
Counts and returns the number of locked budgets.
def no_locked_budgets(self) -> int: count = 0 for budget in self.budgets.values(): if budget.locked: count += 1 return count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outstanding(self):\n return sum(\n transfer.lock.amount\n for transfer in self.locked.values()\n )", "def budget_used(self):\n return int(self.total_spent() / self.budget() * 100.0)", "def count_total(self):\n\t\twith self._c_lock: # I can't believe I implemented ...
[ "0.64319116", "0.59869766", "0.5931925", "0.5908128", "0.5878541", "0.58729374", "0.58525044", "0.5819347", "0.58104414", "0.57775193", "0.5762641", "0.5753774", "0.57415694", "0.57415694", "0.57394975", "0.57261735", "0.57024676", "0.5688358", "0.5645157", "0.563684", "0.562...
0.85815716
0
Creates and returns a budget from user input for the given budget category.
def create_budget(budget_category: BudgetCategory) -> Budget: amount = -1 while amount <= 0: amount = float(input(f'Enter {budget_category.value} budget: ')) if amount <= 0: print('Budget amount must be greater than 0! Please enter ' 'again!'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_budget(self, category: BudgetCategory) -> Budget:\n return self.budgets.get(category, None)", "def execute_budgets_menu() -> BudgetCategory:\n categories = list(BudgetCategory)\n no_budgets = len(categories)\n choice = -1\n print('Select a budget category:')\n wh...
[ "0.6900647", "0.683713", "0.6413041", "0.62244904", "0.6032063", "0.5851567", "0.58220255", "0.57313067", "0.5693593", "0.55933374", "0.54202634", "0.54114354", "0.5408077", "0.5401938", "0.53535455", "0.5352132", "0.53383446", "0.5330315", "0.5309922", "0.5308046", "0.528334...
0.85561347
0
Prompts the user for the amount of each budget. These budgets will be added to a BudgetManager. The manager then will be returned out.
def create_budget_manager(cls) -> BudgetManager: manager = BudgetManager() for category in list(BudgetCategory): budget = cls.create_budget(category) manager.add_budget(budget) return manager
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_budgets(self) -> None:\n Menu.prompt_view_budgets()\n for budget in self.user.budget_manager:\n print(f\"{budget}\\n\")", "def declare_new_budget(date, exp_data):\n\n exp_list = exp_data[env.EXPENSE_DATA_KEY]\n local_budget = {}\n month_total = util.get_float_input(\n ...
[ "0.71636736", "0.61009943", "0.604694", "0.6036869", "0.59618825", "0.5900128", "0.5894699", "0.57592595", "0.56952924", "0.5673455", "0.5662743", "0.5650943", "0.5648747", "0.56033427", "0.55529106", "0.5543389", "0.5530661", "0.55166674", "0.549556", "0.5487224", "0.5478001...
0.5490783
19
Presents the budget menu for the user to select and returns the budget category that user chooses.
def execute_budgets_menu() -> BudgetCategory: categories = list(BudgetCategory) no_budgets = len(categories) choice = -1 print('Select a budget category:') while choice < 1 or choice > no_budgets: for idx, category in enumerate(categories): print(f' {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def category_choice(self):\n self.leave_category_choice = 1\n while self.leave_category_choice:\n print(fr.FR[15])\n for element in config.CATEGORIES:\n print(str(config.CATEGORIES.index(element)+1)\n + \" : \" + element)\n self.cat...
[ "0.65938395", "0.6233436", "0.6190896", "0.61505425", "0.6138054", "0.604541", "0.5960599", "0.5843633", "0.5817664", "0.5801775", "0.5791902", "0.5737235", "0.57300234", "0.56732094", "0.56335896", "0.56010336", "0.55867344", "0.55579084", "0.55082554", "0.5506753", "0.54915...
0.8198939
0
Sets up and returns a BudgetManager with each budget of amount $100.
def load_test_budget_manager(cls) -> BudgetManager: manager = BudgetManager() for category in list(BudgetCategory): budget = Budget(category, 100) manager.add_budget(budget) return manager
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_budget_manager(cls) -> BudgetManager:\n manager = BudgetManager()\n for category in list(BudgetCategory):\n budget = cls.create_budget(category)\n manager.add_budget(budget)\n return manager", "def __init__(self, bank_account_no: str, bank_name: str,\n ...
[ "0.7738722", "0.6067128", "0.5915157", "0.5754487", "0.57359993", "0.5603405", "0.5476045", "0.5440444", "0.5365476", "0.52967113", "0.52317", "0.5221079", "0.52009493", "0.5193181", "0.5189404", "0.51420105", "0.5124656", "0.5121084", "0.5118158", "0.508111", "0.50754696", ...
0.77666306
0
The sandbox is subdivided in self.box_shape boxes and each box is analysed. An R and theta array is returned.
def process_sandbox(self, data): return mapfeatures.process_window(data, self.box_shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def box(self):\n r2 = self.radius\n res = [self.x - r2, self.y - r2, self.x + r2, self.y + r2]\n return res", "def get_boxes(self):\r\n\r\n boxes = [(\" \", self.worldbox.tl, self.worldbox.br)]\r\n# boxes = []\r\n boxes += [(\".\", b.tl, b.br) for b in self.wallboxes]\r\...
[ "0.57753634", "0.57500136", "0.5702575", "0.5616116", "0.55639243", "0.54722744", "0.54668117", "0.53439415", "0.5328033", "0.5326278", "0.52923673", "0.52458465", "0.5231402", "0.5204559", "0.5186256", "0.51697683", "0.5161667", "0.5140625", "0.5140335", "0.51207787", "0.509...
0.5444292
7
Looks for the best match between the tuple of the sandbox and all Europe tuples.
def correlate_sandbox(self, tuple_sb, tuple_eur, plot=False) -> tuple: # Initialize parameters with extreme values cost_best = 10000 position_best = -1 # Initialize solution vector if plot: cost_all = [] # Extract parameters from tuple R_sb, theta_sb = tuple_sb R_eur, theta_eur =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_best_offer(\n self, all_offers: List[Tuple[str, Dict]]\n ) -> Tuple[List, float]:\n bests, best_gain = [], 0\n\n for partner, offers in all_offers:\n partial_asgt = self._neighbors_values.copy()\n current_partner = self._neighbor_var(partner)\n\n #...
[ "0.5896853", "0.5688851", "0.5675493", "0.5655122", "0.5638799", "0.5624046", "0.55762094", "0.5547533", "0.54540485", "0.54252297", "0.5417066", "0.53604704", "0.5357901", "0.5335932", "0.5335924", "0.5314372", "0.5297954", "0.5288686", "0.52860814", "0.5281672", "0.52807474...
0.60800743
0
The minimal distance between a bunch of vectors is searched.
def vector_substraction(self, th_eur, r_eur, th_sb, r_sb): # Initialize the cost vector cost = [] # Loop through the fraction of europe and calculate the vector cost for i in range(1, len(r_eur)): # Check if the location is just sea and nothing else. Do not take this position. if (np.su...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_min_distance():\n return np.argmin(d)", "def _minimum_distance(self,arg):\n return min([abs(arg-e) for e in self if not e is arg])", "def smallest_distance(self, clusters):\n i, j = numpy.unravel_index(numpy.argmin(clusters), clusters.shape)\n return clusters[i, j], i, j", "d...
[ "0.73687935", "0.67609227", "0.67483205", "0.6721468", "0.6635303", "0.6502757", "0.6498622", "0.64140505", "0.6376266", "0.6340204", "0.6319625", "0.6301285", "0.6261604", "0.6236108", "0.6235101", "0.6223768", "0.6221162", "0.621856", "0.6218279", "0.61902165", "0.6160359",...
0.0
-1
Load application configurations and models. Import each application module and then each model module. It is threadsafe and idempotent, but not reentrant.
def populate(self, workspace, installed_apps=None): if self.ready: return # populate() might be called by two threads in parallel on servers # that create threads before initializing the WSGI callable. with self._lock: if self.ready: return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _populate(self):\n if self.loaded:\n return\n # Note that we want to use the import lock here - the app loading is\n # in many cases initiated implicitly by importing, and thus it is\n # possible to end up in deadlock when one thread initiates loading\n # without h...
[ "0.6745917", "0.6733646", "0.6592259", "0.65557784", "0.63941354", "0.63707244", "0.6354497", "0.63299286", "0.62991405", "0.628444", "0.62597865", "0.6241433", "0.62310606", "0.61505884", "0.6121388", "0.6119536", "0.6091743", "0.60726917", "0.60283834", "0.5982072", "0.5923...
0.6525624
4
Raise an exception if all apps haven't been imported yet.
def check_apps_ready(self): if not self.apps_ready: raise RuntimeError("Apps aren't loaded yet.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_import_app(self):\n dirs.attempt_app_import(\"mediabrute\")\n with self.assertRaises(ImproperlyConfigured):\n dirs.attempt_app_import(\"NONONONONO\")", "def _load_installed_applications(self):\n for application in self.settings.get('apps', None) or []:\n path =...
[ "0.63963807", "0.63125914", "0.6118928", "0.6049964", "0.59116197", "0.5881896", "0.5864091", "0.58242136", "0.5800848", "0.57961357", "0.5771751", "0.574039", "0.5713385", "0.57008845", "0.56540954", "0.56355935", "0.55529803", "0.55522925", "0.5543512", "0.55320776", "0.552...
0.7175082
0
Raise an exception if all models haven't been imported yet.
def check_models_ready(self): if not self.models_ready: raise RuntimeError("Models aren't loaded yet.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_all():\n\n # count the number of files loaded\n count = 0\n\n # get model name\n model_name_list = [model for data_models in settings.OBJECT_DATA_MODELS\n for model in data_models]\n\n model_name_list += [model for model in settings.OTHER_DATA_MODELS]\n\n # import...
[ "0.6702693", "0.6597641", "0.63824916", "0.6288562", "0.61351323", "0.605479", "0.60163903", "0.5974453", "0.5934281", "0.5840787", "0.57924795", "0.57813746", "0.57655495", "0.5670896", "0.5662005", "0.565143", "0.56474614", "0.5552075", "0.553675", "0.55349326", "0.55294484...
0.70884115
0
Import applications and return an iterable of app configs.
def get_app_configs(self): self.check_apps_ready() return self.app_configs.values()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_installed_applications(self):\n for application in self.settings.get('apps', None) or []:\n path = None\n if isinstance(application, six.string_types):\n application_name = application\n if application.startswith('gordon.contrib.'):\n ...
[ "0.7147316", "0.6836849", "0.6666008", "0.6357849", "0.62566024", "0.6244669", "0.6241416", "0.61968774", "0.61936617", "0.6067515", "0.60390776", "0.6026536", "0.601573", "0.598151", "0.5948439", "0.5910892", "0.5884694", "0.58798975", "0.58368564", "0.58337295", "0.5828102"...
0.6826606
2
Import applications and returns an app config for the given label. Raise LookupError if no application exists with this label.
def get_app_config(self, app_label): self.check_apps_ready() try: return self.app_configs[app_label] except KeyError: message = "No installed app with label '%s'." % app_label for app_config in self.get_app_configs(): if app_config.name == app_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_app(self, app_label, emptyOK=False):\n self._populate()\n imp.acquire_lock()\n try:\n app_name = extract_app_name(app_label)\n if app_name is None:\n raise ImproperlyConfigured('App with label %s could not be '\n 'found' % app_lab...
[ "0.6948026", "0.60602397", "0.5971664", "0.5592162", "0.5575013", "0.5373725", "0.5323228", "0.53103024", "0.52559143", "0.52429235", "0.5188659", "0.51339275", "0.51230484", "0.51016665", "0.5075056", "0.5073376", "0.50494814", "0.5046278", "0.5040093", "0.49333227", "0.4921...
0.7493551
0
Check whether an application with this name exists in the registry. app_name is the full name of the app e.g. 'restful_falcon.contrib.admin'.
def is_installed(self, app_name): self.check_apps_ready() return any(ac.name == app_name for ac in self.app_configs.values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_appname(appname):\n return appname in Registry.monomers", "def is_app_exists(self, name, app_path) -> bool:\n ah_write = self.get_iis_object()\n section = ah_write.GetAdminSection(\"system.applicationHost/sites\", \"MACHINE/WEBROOT/APPHOST\")\n collection = section.Collection\...
[ "0.8244724", "0.79095787", "0.737276", "0.7302646", "0.67597425", "0.6723505", "0.6713614", "0.66180587", "0.66102314", "0.65533984", "0.65130615", "0.6512317", "0.65088826", "0.642864", "0.64203596", "0.6358602", "0.63582283", "0.63429815", "0.62443733", "0.62442684", "0.620...
0.7581279
2
Recall metric. Only computes a batchwise average of recall. Computes the recall, a metric for multilabel classification of how many relevant items are selected.
def recall(y_true, y_pred): true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) possible_positives = K.sum(K.round(K.clip(y_true, 0, 1))) recall = true_positives / (possible_positives + K.epsilon()) return recall
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recall(y_true, y_pred, average, labels):\n\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n result = None\n\n m = len(y_true)\n n = len(labels)\n\n confusion_matrix = get_confusion_matrix(y_true, y_pred, labels).T\n\n if average == \"micro\":\n numerator = np.t...
[ "0.76052207", "0.74484503", "0.74047023", "0.7281549", "0.7209793", "0.7166467", "0.71581", "0.7145881", "0.7145881", "0.7145881", "0.7145881", "0.7145881", "0.7145881", "0.7132385", "0.71016103", "0.70670533", "0.70652425", "0.7063426", "0.7063426", "0.7063426", "0.7063426",...
0.7097688
33
Precision metric. Only computes a batchwise average of precision. Computes the precision, a metric for multilabel classification of how many selected items are relevant.
def precision(y_true, y_pred): true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1))) precision = true_positives / (predicted_positives + K.epsilon()) return precision
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(self):\n self.overall_precision = precision_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_precision = precision_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)", "def comp...
[ "0.7489052", "0.7288358", "0.7159325", "0.715323", "0.7065856", "0.6984727", "0.6964892", "0.69536865", "0.6912471", "0.68334424", "0.68176156", "0.68093187", "0.6804945", "0.6804945", "0.6804945", "0.6804945", "0.6804945", "0.6804945", "0.67855513", "0.67575085", "0.67575085...
0.675501
44
Test packet generation and fake send.
def test_generate_and_send(mock_sr): # mock send packets mock_sr.return_value = fake_sr_return() # init generator netprobify = NetProbify() netprobify.instantiate_generator() # generate packets TARGET.generate_packets(GROUP, netprobify.id_gen) assert len(TARGET.packets) == 10 asser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_send(self):\n msg_flag = self.instance.send(self.msg_short)\n assert(msg_flag)\n msg_flag, msg_recv = self.driver.recv(self.timeout)\n assert(msg_flag)\n nt.assert_equal(msg_recv, self.msg_short)", "def test_send_network(self) :\n symbol = 'A' \n oProtoc...
[ "0.6892069", "0.66339993", "0.649775", "0.6465824", "0.6439808", "0.6425743", "0.63774353", "0.63420707", "0.63226706", "0.6289918", "0.62796855", "0.62690765", "0.62690526", "0.625604", "0.624448", "0.62306184", "0.61947006", "0.61494166", "0.6146559", "0.6113945", "0.604760...
0.7693772
0
Text that 's in contractions is not lemmatized as '.
def test_issue401(EN, text, i): tokens = EN(text) assert tokens[i].lemma_ != "'"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_contractions(text):\r\n return contractions.fix(text)", "def _replace_contractions(text):\n return contractions.fix(text)", "def replace_contractions(text):\n return contractions.fix(text)", "def replace_contractions(text):\n return contractions.fix(text)", "def expand_contractions(...
[ "0.6775942", "0.6719504", "0.66563076", "0.66563076", "0.6441767", "0.63712335", "0.6275531", "0.62549996", "0.6237941", "0.61390126", "0.6138355", "0.61180866", "0.6060835", "0.60040885", "0.59310406", "0.58554614", "0.58482164", "0.5792963", "0.57772267", "0.57377017", "0.5...
0.5456694
43
Returns an HTTP response object that redirects to the supplied URL with the supplied query parameters applied.
def HttpResponseRedirectWithQuery(redirect_uri, query_params): nq = "?" for pname in query_params.keys(): if query_params[pname]: redirect_uri += nq + pname + "=" + quote(query_params[pname]) nq = "&" return HttpResponseRedirect(redirect_uri)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect_to():\n\n args_dict = request.args.items()\n args = CaseInsensitiveDict(args_dict)\n\n # We need to build the response manually and convert to UTF-8 to prevent\n # werkzeug from \"fixing\" the URL. This endpoint should set the Location\n # header to the exact string supplied.\n respo...
[ "0.6659504", "0.64636075", "0.63889945", "0.63879377", "0.610228", "0.60225797", "0.60220236", "0.6000811", "0.59948146", "0.5985534", "0.58978784", "0.5849514", "0.58246356", "0.5768415", "0.5704956", "0.5704761", "0.57001656", "0.56676114", "0.5625186", "0.5616323", "0.5571...
0.66205907
1
Returns an HTTP response object that is used at the end of an authentication flow. It redirects to the user_profile_url stored in the current session, with continuation to the supplied continuation_url, with the userid for the (attempted) authentication as a further query parameter.
def HttpResponseRedirectLogin(request, message=None): user_profile_url = request.session.get('user_profile_url', reverse("AnnalistSiteView")) query_params = {} if 'continuation_url' in request.session: query_params['continuation_url'] = request.session['continuation_url'] if 'recent_userid' in r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_authenticated_user(self, redirect_uri, client_id, client_secret,\n code, callback, extra_fields=None):\n logging.debug('gau ' + redirect_uri)\n http = tornado.httpclient.AsyncHTTPClient()\n args = {\n \"redirect_uri\": redirect_uri,\n \"co...
[ "0.59704", "0.57576066", "0.57576066", "0.56492937", "0.56403655", "0.5556867", "0.5509907", "0.5499047", "0.54631555", "0.54217714", "0.538807", "0.5379946", "0.5378877", "0.5330215", "0.5329715", "0.53291154", "0.5300578", "0.5300578", "0.5294871", "0.5291251", "0.52382874"...
0.53972936
10
Utility function that creates dictionary representation of an object.
def object_to_dict(obj, strip): t = type(obj) d = copy.copy(obj.__dict__) for member in strip: if member in d: del d[member] d['_class'] = t.__name__ d['_module'] = t.__module__ return d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def todict(obj):\n if isinstance(obj, str):\n return obj\n elif isinstance(obj, enum.Enum):\n return str(obj)\n elif isinstance(obj, dict):\n return dict((key, todict(val)) for key, val in obj.items())\n elif isinstance(obj, collections.Iterable):\n return [todict(val) for v...
[ "0.7310001", "0.7195056", "0.70770437", "0.705504", "0.70312023", "0.7030219", "0.7020099", "0.7001358", "0.6902885", "0.68736845", "0.67525834", "0.67378587", "0.66853493", "0.66853493", "0.66723883", "0.666358", "0.6656492", "0.66415584", "0.6622443", "0.65721786", "0.65451...
0.69886494
8
Return a response corresponding to the given key.
def __getitem__(self, key): # Sanity check: This might be easy. # If the URL is an exact match via. the regular `dict` lookup, # then just return that. no = object() super_answer = super(Registry, self).get(key, no) if super_answer != no: return super_answer ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def read(self, key: str) -> ResponseOrKey:", "def get(self, key, headers=Headers()):", "def get(self, key):\n return self.execute_command(self.GET_CMD, key)", "def get(self, key):\n \n print(\"Getting from node {}\".format(self.url))\n\n (headers, content) = self.http_client...
[ "0.7400327", "0.70474446", "0.68870306", "0.6693863", "0.662304", "0.6497534", "0.6377405", "0.6365614", "0.6348494", "0.6304377", "0.6297758", "0.62936944", "0.6262766", "0.62330174", "0.62269306", "0.62030137", "0.6202612", "0.6189245", "0.61835074", "0.61835074", "0.616490...
0.0
-1
Return the full method and URL, as a string.
def __str__(self): # Start with the basic URI. answer = '%s %s' % (self.method, self.uri) # Append any keyword arguments to the query-string if self.qs: qs_list = [] for key, values in self.qs.items(): # Convert `values` to a list if it's not one...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_method_url(self):\n formatter = \"json\"\n if self.method:\n url = \"%s/%d/%s/%s.%s\" % (self.base_url, self.version,\n self.account, self.method,\n formatter)\n request_url = requests.head(url, p...
[ "0.7257215", "0.6996861", "0.6880669", "0.6531301", "0.65246946", "0.6417852", "0.6371235", "0.63354814", "0.6317191", "0.6285708", "0.62852126", "0.62748575", "0.62604576", "0.6250731", "0.6239291", "0.62013763", "0.6184284", "0.6173069", "0.61529315", "0.61058116", "0.60952...
0.65113395
5
Return True if this URL is an exact superset of the URL provided by `other`.
def is_exact_superset_of(self, other): # If this is a string of some kind, convert it to a URL. if isinstance(other, (six.text_type, six.binary_type)): other = self.__class__(other) # Type check! if not hasattr(other, 'qs') or not hasattr(other, 'uri'): raise Typ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_strict_superset(self, other):\n return self.is_superset(other) and self != other", "def is_superset(self, other):\n \n for element in other:\n if element not in self:\n return False\n\n return True", "def is_superset(self, other):\n if isinsta...
[ "0.71028805", "0.69356734", "0.68522155", "0.68476844", "0.65793014", "0.6502486", "0.63076425", "0.6304706", "0.6214503", "0.6210435", "0.62005806", "0.61623186", "0.61595505", "0.6034027", "0.60209525", "0.59925973", "0.59876674", "0.59673166", "0.59448874", "0.5917174", "0...
0.82324034
0
Prepares the note response
def note_repr(key): return { 'url': request.host_url.rstrip('/') + url_for('notes_detail', key=key), 'text': notes[key] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_note(self):\n if self._report_data and self._report_data['note']:\n note = self._report_data['note']\n if note.get('createDateTime'):\n note['createDateTime'] = Report._to_report_datetime(note.get('createDateTime'))\n if note.get('expiryDateTime') and...
[ "0.6375515", "0.57853264", "0.5783189", "0.57436967", "0.56131977", "0.559248", "0.5586506", "0.55410945", "0.5422713", "0.5422447", "0.5408178", "0.5375322", "0.52852714", "0.5280615", "0.5269546", "0.5258682", "0.52485454", "0.5236615", "0.5225189", "0.5219878", "0.5215029"...
0.49806014
55
Retrieve, update or delete note instances.
def notes_detail(key): if request.method == 'PUT': note = str(request.data.get('text', '')) notes[key] = note return note_repr(key) elif request.method == 'DELETE': notes.pop(key, None) return '', status.HTTP_204_NO_CONTENT # request.method == 'GET' if key not i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_note():\n\n return Note.query.all()", "def notes(self):\n return reapy.NoteList(self)", "def get_notes(self, note_limit=200):\n return Note.get_by_person_record_id(\n self.subdomain, self.record_id, limit=note_limit)", "def ls(self, count = 200):\n return self._mana...
[ "0.6639361", "0.617886", "0.6110275", "0.60966027", "0.5886469", "0.58836895", "0.58836895", "0.5878445", "0.58600885", "0.5844162", "0.5819225", "0.5809799", "0.58091563", "0.5807114", "0.58009684", "0.57272816", "0.5714965", "0.5691968", "0.56813973", "0.56525964", "0.56464...
0.555653
30
Redirects to front page.
def mainpage(): return render_template('presence_weekday.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root_redirect():\r\n return redirect(url_for(\"display_top\"))", "def home_page():\n return redirect(url_for(_DEFAULT_ROUTE, _external=True))", "def start_page():\n if not _home:\n abort(404)\n return redirect(_home)", "def start_page():\n if not _home:\n abort(404)\n retu...
[ "0.7155309", "0.71402824", "0.7081907", "0.7081907", "0.6828993", "0.68113315", "0.680891", "0.663342", "0.6594873", "0.6594873", "0.6594873", "0.65614533", "0.6539556", "0.65361327", "0.6511136", "0.65066427", "0.64762396", "0.6432043", "0.6339064", "0.6331238", "0.63289326"...
0.0
-1
Redirects to mean_time_weekday page.
def mean_time(): return render_template('mean_time_weekday.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(request):\n today = datetime.date.today()\n return HttpResponseRedirect(\"%s/newsletter/%d/%d/%d/\" % (SUBSITE, today.year, today.month, today.day))", "def mainpage():\n return render_template('presence_weekday.html')", "def mainpage(name=None):\n if not name:\n return redirect(url_...
[ "0.62515265", "0.6238297", "0.5995797", "0.5972302", "0.5677064", "0.5641092", "0.55807924", "0.5452718", "0.5416457", "0.53435457", "0.5311708", "0.5308008", "0.5263703", "0.52506274", "0.52275354", "0.52275354", "0.52275354", "0.52263916", "0.5193816", "0.5187562", "0.51827...
0.6704054
0
Redirects to presence_start_end page.
def start_end(): return render_template('presence_start_end.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_page():\n if not _home:\n abort(404)\n return redirect(_home)", "def start_page():\n if not _home:\n abort(404)\n return redirect(_home)", "def toLanding():\n return redirect(url_for('landingurl'))", "def get(self, request):\n return redirect('start:home')", "d...
[ "0.5971557", "0.5971557", "0.5943474", "0.57099074", "0.57099074", "0.57099074", "0.55752295", "0.5566747", "0.5566221", "0.55043846", "0.54831034", "0.5478961", "0.5430729", "0.5429293", "0.5403134", "0.5393614", "0.53604597", "0.52630067", "0.52586526", "0.5183116", "0.5173...
0.666048
0
Users listing for dropdown.
def users_view(): users = get_users() data = get_data() result = [{'user_id': i, 'name': users[i]} for i in users.keys() if int(i) in data.keys()] #import pdb; pdb.set_trace() result.sort(key=lambda item: item['name'], cmp=locale.strcoll) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_users():\r\n users = User.query.order_by(User.last_name,User.first_name).all()\r\n return render_template('list.html', users=users)", "def KLP_Users_list(request):\n\n # get logged in user\n\n user = request.user\n if user.id:\n\n # check logged in user permissions, to get user lis...
[ "0.7448725", "0.73301697", "0.7327242", "0.7327242", "0.7327242", "0.7327242", "0.7327242", "0.7327242", "0.7318417", "0.73143923", "0.7297931", "0.72241616", "0.7139011", "0.712823", "0.71233916", "0.69906664", "0.6973133", "0.6961896", "0.6916275", "0.69009453", "0.688397",...
0.0
-1
Returns mean presence time of given user grouped by weekday.
def mean_time_weekday_view(user_id): #import pdb; pdb.set_trace() data = get_data() if user_id not in data: log.debug('User %s not found!', user_id) return [] weekdays = group_by_weekday(data[user_id]) result = [(calendar.day_abbr[weekday], mean(intervals)) for weekday...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_time_weekday_view(user_id=None):\n data = get_data()\n if not user_id:\n raise abort(400)\n\n if user_id not in data:\n log.debug('User %s not found!', user_id)\n return []\n\n weekdays = group_by_weekday(data[user_id])\n result = [(calendar.day_abbr[weekday], mean(inte...
[ "0.7820907", "0.6851208", "0.6848811", "0.6119349", "0.6025002", "0.5929798", "0.5753107", "0.5695754", "0.5610047", "0.5583093", "0.5531452", "0.5494475", "0.547884", "0.53997254", "0.53785306", "0.5343953", "0.5343953", "0.53423256", "0.53400195", "0.52665937", "0.5253249",...
0.7910484
0
Returns total presence time of given user grouped by weekday.
def presence_weekday_view(user_id): data = get_data() if user_id not in data: log.debug('User %s not found!', user_id) return [] weekdays = group_by_weekday(data[user_id]) result = [(calendar.day_abbr[weekday], sum(intervals)) for weekday, intervals in weekdays.items()] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def presence_weekday_view(user_id=None):\n data = get_data()\n if not user_id:\n raise abort(400)\n\n if user_id not in data:\n log.debug('User %s not found!', user_id)\n return []\n\n weekdays = group_by_weekday(data[user_id])\n result = [(calendar.day_abbr[weekday], sum(interv...
[ "0.7513305", "0.666141", "0.6574399", "0.64891076", "0.5944046", "0.59074956", "0.58471644", "0.5814486", "0.57856905", "0.5762274", "0.5762274", "0.5672877", "0.5672623", "0.5629637", "0.54893243", "0.5468925", "0.54269946", "0.540859", "0.54045403", "0.5379421", "0.5338772"...
0.75307816
0
Returns mean start and end hours grouped by weekday.
def presence_start_end_view(user_id): data = get_data() if user_id not in data: log.debug('User %s not found!', user_id) return [] result_start, result_stop = group_by_weekday_start_end(data[user_id]) result = [] for i in range(7): result.append(( calendar.day_ab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_time_weekday_view(user_id):\n #import pdb; pdb.set_trace()\n data = get_data()\n if user_id not in data:\n log.debug('User %s not found!', user_id)\n return []\n\n weekdays = group_by_weekday(data[user_id])\n result = [(calendar.day_abbr[weekday], mean(intervals))\n ...
[ "0.70767546", "0.691566", "0.60244334", "0.6006631", "0.59523463", "0.5813882", "0.5720163", "0.57031125", "0.56863064", "0.56797594", "0.56209344", "0.5582896", "0.55791557", "0.55611074", "0.55569315", "0.54988813", "0.5399546", "0.53779376", "0.53592837", "0.5350021", "0.5...
0.50501186
35
Returns labels associated with Image.
def labels(self) -> Dict[str, str]: return self.attrs.get("Labels", {})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_labels(path):\n client = vision.ImageAnnotatorClient()\n\n with io.open(path, 'rb') as image_file:\n content = image_file.read()\n\n image = vision.types.Image(content=content)\n\n response = client.label_detection(image=image)\n labels = response.label_annotations\n #print('Lab...
[ "0.7138663", "0.7133516", "0.7130016", "0.7122506", "0.7111845", "0.7087622", "0.70217323", "0.7000098", "0.7000098", "0.7000098", "0.7000098", "0.7000098", "0.7000098", "0.7000098", "0.7000098", "0.7000098", "0.7000098", "0.7000098", "0.7000098", "0.7000098", "0.7000098", ...
0.0
-1
Returns tags from Image.
def tags(self) -> List[str]: if "RepoTags" in self.attrs: return [tag for tag in self.attrs["RepoTags"] if tag != "<none>:<none>"] return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tags(self):\n tags = []\n for image in self.client.images.list():\n for tag in image.tags:\n if tag.startswith(self.repository_name):\n tokens = tag.split(':')\n tags.append(tokens[1])\n return tags", "def get_image_tags...
[ "0.7594638", "0.7571425", "0.72571933", "0.69148505", "0.69091725", "0.662919", "0.65037465", "0.65037465", "0.6470392", "0.63407135", "0.62951803", "0.61895055", "0.6180819", "0.6146112", "0.61458826", "0.6142214", "0.6104417", "0.60859585", "0.60708004", "0.60700417", "0.60...
0.0
-1
Returns history of the Image.
def history(self) -> List[Dict[str, Any]]: response = self.client.get(f"/images/{self.id}/history") body = response.json() if response.status_code == 200: return body if response.status_code == 404: raise ImageNotFound(body["cause"], response=response, explanat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dohistory(self, *args, **kwargs):\n return _image.image_dohistory(self, *args, **kwargs)", "def history():", "def history(self):\n return self.info['history']", "def get_history(self):\n return self.history", "def history(self):\n return self.board.history", "def history(s...
[ "0.82483864", "0.7789621", "0.7495005", "0.7354837", "0.7303717", "0.7291426", "0.7291426", "0.72496754", "0.72476786", "0.7220276", "0.7191091", "0.71893007", "0.71339124", "0.7076902", "0.6949881", "0.68829805", "0.68773735", "0.68484914", "0.68127704", "0.68097353", "0.678...
0.83448565
0
Returns Image as tarball.
def save( self, chunk_size: Optional[int] = 2097152, named: Union[str, bool] = False ) -> Iterator[bytes]: _ = named response = self.client.get(f"/images/{self.id}/get", stream=True) if response.status_code == 200: return response.iter_content(chunk_size=chunk_size) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_to_tgz(image, quiet):\n\n temp_dir = tempfile.mkdtemp()\n tar_file = path.join(temp_dir, path.basename(image) + '.tar')\n tar_gz_file = tar_file + '.gz'\n\n cmd = ['singularity', 'export', '-f', tar_file, image]\n\n if not quiet:\n sys.stderr.write(\"Exporting image to .tar\\n\")\n\...
[ "0.6866923", "0.6039955", "0.602726", "0.6003644", "0.5970418", "0.5964112", "0.5886299", "0.5867114", "0.58565104", "0.5853468", "0.58134466", "0.5777255", "0.57716244", "0.57533777", "0.57440144", "0.5714641", "0.5710571", "0.56837445", "0.5678078", "0.56721973", "0.5660147...
0.0
-1
Tag Image into repository.
def tag(self, repository: str, tag: Optional[str], force: bool = False) -> bool: _ = force params = {"repo": repository} if tag is not None: params["tag"] = tag response = self.client.post(f"/images/{self.id}/tag", params=params) if response.status_code == 201: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag(self, **kwargs):\n return self.getField('image').tag(self, **kwargs)", "def tag(self, **kwargs):\n return self.getField('image').tag(self, **kwargs)", "def tag(self, image, repo, tag):\n check_blacklist(repo)\n logger.info(\"Tagging Docker image {} as {}:{}\".format(image, r...
[ "0.71349096", "0.71349096", "0.71301895", "0.70288086", "0.68998545", "0.6836816", "0.6630423", "0.66236347", "0.6545502", "0.64330405", "0.63881534", "0.6354384", "0.6343031", "0.63360643", "0.6188394", "0.61422634", "0.6105857", "0.61012286", "0.6098683", "0.6093301", "0.60...
0.71320766
2
Getter function returns user id against the specified email.
def get_id(self, email): query = self._db.User.select(self._db.User.c.email == email) query = query.with_only_columns([self._db.User.c.id_, ]) record = query.execute().fetchone() return record[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_id(email):\n try:\n user = session.query(User).filter_by(email=email).one()\n return user.id\n except:\n return None", "def getUserID(email):\r\n try:\r\n session = DBSession()\r\n return session.query(User).filter_by(email=email).one().id\r\n except:\r...
[ "0.81937325", "0.8104995", "0.80850965", "0.8067864", "0.8065274", "0.80627054", "0.80515283", "0.7991437", "0.7979025", "0.7979025", "0.794362", "0.7879122", "0.7856898", "0.7781442", "0.7704244", "0.7685305", "0.7562969", "0.7524555", "0.7518592", "0.7483379", "0.74065524",...
0.84576696
0
Getter function returns the specified user's email.
def get_email(self, id_): query = self._db.User.select(self._db.User.c.id_ == id_) query = query.with_only_columns([self._db.User.c.email, ]) record = query.execute().fetchone() return record[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_email(self):\n member = self.get_user()\n if member:\n return member.getProperty('email')", "def get_email(obj):\r\n return obj.user.email", "def user_email(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"user_email\")", "def get(self):\n user_i...
[ "0.87113273", "0.82361025", "0.7884297", "0.78725815", "0.78565764", "0.7744766", "0.764593", "0.755152", "0.7539069", "0.7512469", "0.7478125", "0.7477021", "0.7456686", "0.744357", "0.74370015", "0.74066263", "0.73810107", "0.7358525", "0.73503655", "0.73461527", "0.7274743...
0.7104593
30
Getter function returns the specified user infomation. SELECT Profile.name_, Profile.kana, Profile.nickname, ... from Profile inner join User on Profile.userId = User.id_ inner join Prefecture on Profile.prefectureId = Prefecture.id_;
def get_all(self, id_): joined_query = self._db.User.join( self._db.Profile, self._db.User.c.id_ == self._db.Profile.c.userId) joined_query = joined_query.join( self._db.Prefecture, self._db.Profile.c.prefectureId == self._db.Prefecture.c.id_) joined_query = joined_query...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getdat(user):\r\n profile = user.profile\r\n return [user.username, user.email] + [getattr(profile, xkey, '') for xkey in profkeys]", "def get_user_profile(self):\n return self.request('get', 'id/users')", "def get_profile():\n\n if request['user_id']:\n\n user = User.selec...
[ "0.6711432", "0.64871967", "0.6378424", "0.63459224", "0.63411635", "0.6307972", "0.62849563", "0.62816036", "0.62378174", "0.62269497", "0.6220193", "0.62060094", "0.6197635", "0.61876595", "0.61854666", "0.61354107", "0.6124501", "0.6111729", "0.610672", "0.6106198", "0.609...
0.0
-1
Update account information against the specified user id.
def update_account_with(self, id_, **kwargs): self.update_user_with(id_, **kwargs) self.update_profile_with(id_, **kwargs) # TODO: # self.update_prefecture_with(id_, kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_user(id):\n pass", "def update_user(self):\n self.client.force_authenticate(user=self.user)\n self.response = self.client.patch(\n reverse(\n 'edit_account',kwargs={ 'pk': self.user.id}),\n self.updated_data, format='json'\n )\n s...
[ "0.7563365", "0.75483066", "0.7502834", "0.7481452", "0.7370565", "0.72471577", "0.7134882", "0.71121", "0.7078587", "0.70584905", "0.7002422", "0.6990923", "0.6987949", "0.69791096", "0.6962229", "0.6920091", "0.68333936", "0.68257654", "0.6802805", "0.6716634", "0.6700307",...
0.77432007
0
Generator function which returns ability records with the specified users and below query. SELECT Profile.lastName, Profile.firstName, ... FROM User INNER JOIN Profile ON Profile.userId = User.id_ INNER JOIN UsersAbility ON User.id_ = UsersAbility.userId INNER JOIN Ability ON UsersAbility.abilityId = Ability.id_;
def yield_record(self, user_ids=[], columns=None): filter_ = None if user_ids: filter_ = self._db.User.c.id_ == user_ids[0] for user_id in user_ids[1:]: filter_ |= self._db.User.c.id_ == user_id if columns: columns = [col for col in columns if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_models_organization_get_abilities_member_user(self):\n access = factories.UserOrganizationAccessFactory(role=\"member\")\n\n with self.assertNumQueries(1):\n abilities = access.organization.get_abilities(access.user)\n\n self.assertEqual(\n abilities,\n ...
[ "0.5391291", "0.5223448", "0.5184904", "0.5113543", "0.49423173", "0.49127218", "0.48708478", "0.4827274", "0.48093134", "0.48089716", "0.48043194", "0.47699356", "0.47529572", "0.47479445", "0.47470778", "0.47262278", "0.47191784", "0.47191784", "0.47117633", "0.4708607", "0...
0.72041345
0
Get the number of requests. SELECT COUNT() FROM Request INNER JOIN UsersRequest ON UsersRequest.requestId = Request.id_;
def _get_request_count(self): joined_query = self._db.Request.join( self._db.UsersRequest, self._db.UsersRequest.c.requestId == self._db.Request.c.id_) joined_query = joined_query.select().with_only_columns([func.count()]) res = joined_query.execute() return [_ for _ in res]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def friend_request_count(self) -> int:\n e = await self.request.request(url=f'https://friends.roblox.com/v1/user/friend-requests/count', method='get',\n )\n return e['count']", "def count(self):\n return len(self._request_sessions)", "def client_...
[ "0.69484293", "0.6632788", "0.65044624", "0.6379204", "0.6297678", "0.6280874", "0.62785643", "0.62650543", "0.62540686", "0.6237054", "0.6202207", "0.61585265", "0.61410373", "0.6129518", "0.6103263", "0.61020875", "0.609978", "0.6065355", "0.60639393", "0.60524714", "0.6030...
0.8224526
0
Generator function which returns request records with below query. SELECT Profile.lastName, Profile.firstName, Profile.lastKanaName, Profile.firstKanaName, Request.detail FROM User INNER JOIN Profile ON User.id = Profile.userId INNER JOIN UsersRequest ON User.id_ = UsersRequest.userId INNER JOIN Request ON UsersRequest...
def yield_record(self, user_ids=[], columns=None): filter_ = None if user_ids: filter_ = self._db.User.c.id_ == user_ids[0] for user_id in user_ids[1:]: filter_ |= self._db.User.c.id_ == user_id if columns: columns = [col for col in columns if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yield_record(self, user_ids=[], columns=None):\n filter_ = None\n if user_ids:\n filter_ = self._db.User.c.id_ == user_ids[0]\n for user_id in user_ids[1:]:\n filter_ |= self._db.User.c.id_ == user_id\n\n if columns:\n columns = [col for col ...
[ "0.607708", "0.5801224", "0.563434", "0.5436275", "0.5435522", "0.54041797", "0.5401012", "0.52706105", "0.5223789", "0.52082694", "0.5188554", "0.5173161", "0.5173011", "0.5165055", "0.5140934", "0.51273125", "0.5110731", "0.5102614", "0.5070352", "0.5065051", "0.5059272", ...
0.70053494
0
Generator function which returns prefectures with below query. SELECT Prefecture.id_, Prefecture.name_ FROM Prefecture;
def yield_record(self, columns=None): query = self._db.Prefecture.select().with_only_columns(self.get_all_column()) for record in query.execute(): yield record
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_one():\n puppies = session.query(Puppy.name).order_by(Puppy.name.asc()).all()\n\n for puppy in puppies:\n print puppy.name", "def _getAllProvas(self):\n return self.execSql(\"select_all_provas\")", "def get_people(self):\n cursor = self.cur()\n cursor.execute('SELECT...
[ "0.5559843", "0.5441475", "0.5225257", "0.5199897", "0.51973164", "0.518491", "0.5142329", "0.5121006", "0.5119528", "0.5104191", "0.5100354", "0.5074651", "0.5074651", "0.50393736", "0.5030389", "0.50123405", "0.49912012", "0.4979582", "0.4968754", "0.49064863", "0.4904445",...
0.6172738
0
Disggregations should split data along the transformed dimension
def test_disaggregation_operation(self, space, time, expected): data = np.array([[1]]) intermediate = Adaptor.convert_with_coefficients(data, space, 0) actual = Adaptor.convert_with_coefficients(intermediate, time, 1) np.testing.assert_allclose(actual, expected, rtol=1e-2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_dataset(self):", "def _postprocess(self, outs, das, params):\n outs = super()._postprocess(outs, das, params)\n\n for i in range(len(outs)):\n if \"group\" in outs[i].dims:\n outs[i] = outs[i].squeeze(\"group\", drop=True)\n\n return outs", "def dime...
[ "0.621968", "0.6202799", "0.61711615", "0.5748643", "0.5718049", "0.5630885", "0.55704653", "0.55564606", "0.5521332", "0.548884", "0.54875845", "0.54647595", "0.5454543", "0.54487014", "0.54333174", "0.54291487", "0.5418553", "0.54017574", "0.5387758", "0.5380691", "0.536761...
0.51870686
53
Aggregations should collect data along the transformed dimension
def test_aggregation_operation(self, space, time, expected): # Two regions, three intervals data = np.array([[333.333, 333.333, 333.333], [333.333, 333.333, 333.333]]) intermediate = Adaptor.convert_with_coefficients(data, space, 0) actual = Adaptor.convert_with_coefficients(intermediate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _aggregation_target(self):\n ...", "def get_results_from_aggregation_sources(self, context):", "def aggregator():\n return Aggregator(\n agg_col=\"col_a\", values_col=\"col_b\", aggregates=[\"min\", \"max\", \"avg\", \"sum\"]\n )", "def aggregate(global_params, running_aggregate, aggr...
[ "0.6487456", "0.60881907", "0.60661906", "0.6037719", "0.5968184", "0.59415835", "0.5932226", "0.59083897", "0.5887001", "0.5827151", "0.5749039", "0.57236975", "0.56986797", "0.56873745", "0.56847465", "0.5674025", "0.5640821", "0.56200093", "0.56139773", "0.5605245", "0.559...
0.5151263
93
Operations over 3dimensional data
def test_multidimensional_operation(self): # start with something (1, 2, 3) data = np.array([[[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]]]) # split 1st dim (2, 2, 3) coefficients = np.ones((1, 2)) / 2 expected = np.array( [[[0.0, 0.5, 1.0], [1.5, 2.0, 2.5]], [[0.0, 0.5, 1.0], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computeCenters3d(self, data):\n\n\n for i in range(self.nPoints):\n print(\"Label of point \", i, \" is \", self.labels[i])\n for j in range(3):\n self.centers[self.labels[i]][j] += data[i][j]\n\n for c in range(self.n):\n for j in range(3):\n ...
[ "0.649511", "0.64435244", "0.6118735", "0.6059016", "0.60539794", "0.6026208", "0.5995588", "0.59794426", "0.59654516", "0.59632635", "0.5910405", "0.5840366", "0.582828", "0.58131075", "0.57950956", "0.5764925", "0.57469416", "0.57458824", "0.5715937", "0.5696391", "0.569589...
0.62115836
2
Test the TabularOutputFormatter class.
def test_tabular_output_formatter(): headers = ["text", "numeric"] data = [ ["abc", Decimal(1)], ["defg", Decimal("11.1")], ["hi", Decimal("1.1")], ["Pablo\rß\n", 0], ] expected = dedent( """\ +-------+---------+ | text | numeric | +------...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_headless_tabulate_format():\n formatter = TabularOutputFormatter(format_name=\"minimal\")\n headers = [\"text\", \"numeric\"]\n data = [[\"a\"], [\"b\"], [\"c\"]]\n expected = \"a\\nb\\nc\"\n assert expected == \"\\n\".join(\n TabularOutputFormatter().format_output(\n iter...
[ "0.7598825", "0.6803152", "0.6683861", "0.6668478", "0.6604555", "0.64349806", "0.6323238", "0.6221877", "0.62087774", "0.6080011", "0.59904414", "0.59258485", "0.5906039", "0.57514274", "0.57006407", "0.5679148", "0.56766784", "0.5619825", "0.5604824", "0.55946857", "0.55943...
0.7742016
0
Test the ascii_escaped output format.
def test_tabular_output_escaped(): headers = ["text", "numeric"] data = [ ["abc", Decimal(1)], ["defg", Decimal("11.1")], ["hi", Decimal("1.1")], ["Pablo\rß\n", 0], ] expected = dedent( """\ +------------+---------+ | text | numeric | ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_plain_ansi(self):\n irc_ansi = irc.parse_ansi_to_irc(string.printable)\n ansi_irc = irc.parse_irc_to_ansi(string.printable)\n self.assertEqual(irc_ansi, string.printable)\n self.assertEqual(ansi_irc, string.printable)", "def is_printable(c):\n return ord(c)>=32 or c in ['\...
[ "0.6732766", "0.6406619", "0.6277316", "0.6251546", "0.61997485", "0.6184127", "0.6170037", "0.6024704", "0.6006847", "0.5948027", "0.5901922", "0.58854496", "0.58677125", "0.5860605", "0.5801056", "0.5801056", "0.5796908", "0.5796908", "0.5795084", "0.57895523", "0.5780044",...
0.6542039
1
Test the format_output wrapper.
def test_tabular_format_output_wrapper(): data = [["1", None], ["2", "Sam"], ["3", "Joe"]] headers = ["id", "name"] expected = dedent( """\ +----+------+ | id | name | +----+------+ | 1 | N/A | | 2 | Sam | | 3 | Joe | +----+------+""" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_output_formatting_func(self, sample: Any):\n try:\n if not type(sample) == iter:\n self._formatting_func_return_types(format=sample)\n return True\n except Exception:\n raise ValueError(\n f\"formatting_func must return {self._f...
[ "0.7369798", "0.70274675", "0.67627716", "0.6762203", "0.6761139", "0.6622697", "0.65406054", "0.6526979", "0.64411855", "0.6382983", "0.6381997", "0.6381733", "0.63810277", "0.63721865", "0.6358712", "0.6331598", "0.63055885", "0.62849057", "0.62764215", "0.62751293", "0.627...
0.5988137
53
Test that additional preprocessors are run.
def test_additional_preprocessors(): def hello_world(data, headers, **_): def hello_world_data(data): for row in data: for i, value in enumerate(row): if value == "hello": row[i] = "{}, world".format(value) yield row ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_processor(self):", "def test_preprocessed_data(self):\n self.assertEqual(self.tester.preprocessed_data, [1, 2])", "def pre_process(self):\n pass", "def pre_process(self):\n pass", "def pre_process(self):\n pass", "def pre_process(self):\n pass", "def pre_proce...
[ "0.6938419", "0.5952152", "0.5880601", "0.5880601", "0.5880601", "0.5880601", "0.5880601", "0.57874", "0.5712376", "0.56677914", "0.5662688", "0.55605817", "0.55309963", "0.54661083", "0.5465676", "0.5465676", "0.5465676", "0.5465676", "0.54530454", "0.5423807", "0.53889424",...
0.6088411
1
Test the the format_name attribute be set and retrieved.
def test_format_name_attribute(): formatter = TabularOutputFormatter(format_name="plain") assert formatter.format_name == "plain" formatter.format_name = "simple" assert formatter.format_name == "simple" with pytest.raises(ValueError): formatter.format_name = "foobar"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_format_metadata(self):\n\n format_metadata = self.group_tr.getFormatMetadata()\n self.assertIsInstance(format_metadata, OCIO.FormatMetadata)\n self.assertEqual(format_metadata.getName(), 'ROOT')", "def format_(self):\n return self.set_format or self.default_format or self.FAL...
[ "0.6153331", "0.6076459", "0.6012055", "0.59826183", "0.592901", "0.58396417", "0.5767246", "0.5702269", "0.5685611", "0.56719285", "0.56719285", "0.5670935", "0.5660645", "0.56290805", "0.5619688", "0.5610569", "0.5610569", "0.5579394", "0.5572902", "0.55696183", "0.5552509"...
0.6804895
0
Test that a headless formatter doesn't display headers
def test_headless_tabulate_format(): formatter = TabularOutputFormatter(format_name="minimal") headers = ["text", "numeric"] data = [["a"], ["b"], ["c"]] expected = "a\nb\nc" assert expected == "\n".join( TabularOutputFormatter().format_output( iter(data), headers, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_headers(self):\n msg = self.shortDescription()\n self.assertTrue(False, msg=msg)\n pass", "def test_raw_empty(self):\n self.assertRaisesHeaderError([''])", "def test_header_constructor_without_separator(self):\n\n expected = False\n actual = self.file_instance...
[ "0.63604164", "0.63151926", "0.6163514", "0.6104256", "0.6095177", "0.60750955", "0.6004281", "0.60040116", "0.586322", "0.5856205", "0.5847177", "0.5778657", "0.57778144", "0.5774725", "0.57422394", "0.5724278", "0.572363", "0.5721617", "0.5695007", "0.56886226", "0.5687411"...
0.68265456
0
Test that TabularOutputFormatter rejects unknown formats.
def test_unsupported_format(): formatter = TabularOutputFormatter() with pytest.raises(ValueError): formatter.format_name = "foobar" with pytest.raises(ValueError): formatter.format_output((), (), format_name="foobar")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_all_text_type(extra_kwargs):\n data = [[1, \"\", None, Decimal(2)]]\n headers = [\"col1\", \"col2\", \"col3\", \"col4\"]\n output_formatter = TabularOutputFormatter()\n for format_name in output_formatter.supported_formats:\n for row in output_formatter.format_output(\n iter(...
[ "0.70976675", "0.6928261", "0.6896788", "0.68242085", "0.6706267", "0.6496966", "0.6446614", "0.64220536", "0.63867015", "0.63490313", "0.63261265", "0.6246182", "0.62458897", "0.6236886", "0.6201243", "0.6187324", "0.61603105", "0.6087869", "0.6058924", "0.6046744", "0.60211...
0.8258656
0
Test that ANSI escape codes work with tabulate.
def test_tabulate_ansi_escape_in_default_value(): data = [["1", None], ["2", "Sam"], ["3", "Joe"]] headers = ["id", "name"] styled = format_output( iter(data), headers, format_name="psql", missing_value="\x1b[38;5;10mNULL\x1b[39m", ) unstyled = format_output( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_asciitable_m_pretty_ansi(self):\n input = '''\n┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓ \n┃\\x1b[1m \\x1b[0m\\x1b[1mReleased \\x1b[0m\\x1b[1m \\x1b[0m┃\\x1b[1m \\x1b[0m\\x1b[1mTitle \\x1b[0m\\x1b[1m \\x1b[0...
[ "0.70575464", "0.653272", "0.6358273", "0.6196326", "0.60648966", "0.58987457", "0.58536655", "0.58270675", "0.5749906", "0.5715439", "0.5708848", "0.5671626", "0.56693846", "0.56251574", "0.55986124", "0.5450305", "0.544031", "0.540491", "0.5401781", "0.53985673", "0.5381614...
0.71552247
0
Test that _get_type returns the expected type.
def test_get_type(): formatter = TabularOutputFormatter() tests = ( (1, int), (2.0, float), (b"binary", binary_type), ("text", text_type), (None, type(None)), ((), text_type), ) for value, data_type in tests: assert data_type is formatter._get_ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testTheType(self, theTestType):\n \n pass", "def test_get_types(self):\n pass", "def test_type_error(self):\n self._error_test(TypeError)", "def test_type(self):\n return self._test_type", "def check_type(self):\n return True", "def test_expected_type(val, exp_type):...
[ "0.7581937", "0.74386394", "0.71448725", "0.7063024", "0.689651", "0.6880583", "0.6850508", "0.68018067", "0.67980486", "0.67575514", "0.67144805", "0.6710216", "0.67087543", "0.6700503", "0.6680118", "0.6680118", "0.6680118", "0.6680118", "0.6680118", "0.6680118", "0.6680118...
0.6922414
4
Test that provided column types are passed to preprocessors.
def test_provide_column_types(): expected_column_types = (bool, float) data = ((1, 1.0), (0, 2)) headers = ("a", "b") def preprocessor(data, headers, column_types=(), **_): assert expected_column_types == column_types return data, headers format_output( data, header...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_type_in_col(arch, **kwargs):\n return all(\n attrib.isdigit()\n for attrib in arch.xpath('//@col')\n )", "def _column_type(strings, has_invisible=True, numparse=True):\n types = [_type(s, has_invisible, numparse) for s in strings]\n return reduce(_more_generic, types, bool)", ...
[ "0.69267917", "0.68872726", "0.65001106", "0.61542696", "0.60413736", "0.5988151", "0.59039944", "0.5828359", "0.5757172", "0.5706538", "0.5698194", "0.56468266", "0.564525", "0.564525", "0.5624118", "0.56221634", "0.5595887", "0.5567571", "0.5535115", "0.55180484", "0.551586...
0.7498186
0
Test that all output formatters accept iterable
def test_enforce_iterable(): formatter = TabularOutputFormatter() loremipsum = ( "lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod".split( " " ) ) for format_name in formatter.supported_formats: formatter.format_name = format_name try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_output_formatting_func(self, sample: Any):\n try:\n if not type(sample) == iter:\n self._formatting_func_return_types(format=sample)\n return True\n except Exception:\n raise ValueError(\n f\"formatting_func must return {self._f...
[ "0.70609593", "0.6536862", "0.626699", "0.6217377", "0.61381465", "0.61156595", "0.6076685", "0.60205024", "0.60205024", "0.59102875", "0.5902321", "0.58030295", "0.5667096", "0.5649909", "0.56128067", "0.5604238", "0.5603586", "0.5540967", "0.5523543", "0.55017066", "0.54822...
0.83657736
0
Test the TabularOutputFormatter class.
def test_all_text_type(extra_kwargs): data = [[1, "", None, Decimal(2)]] headers = ["col1", "col2", "col3", "col4"] output_formatter = TabularOutputFormatter() for format_name in output_formatter.supported_formats: for row in output_formatter.format_output( iter(data), headers, forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tabular_output_formatter():\n headers = [\"text\", \"numeric\"]\n data = [\n [\"abc\", Decimal(1)],\n [\"defg\", Decimal(\"11.1\")],\n [\"hi\", Decimal(\"1.1\")],\n [\"Pablo\\rß\\n\", 0],\n ]\n expected = dedent(\n \"\"\"\\\n +-------+---------+\n ...
[ "0.7742016", "0.7598825", "0.6803152", "0.6683861", "0.6668478", "0.6604555", "0.64349806", "0.6221877", "0.62087774", "0.6080011", "0.59904414", "0.59258485", "0.5906039", "0.57514274", "0.57006407", "0.5679148", "0.56766784", "0.5619825", "0.5604824", "0.55946857", "0.55943...
0.6323238
7
coroutine Open a cluster, connecting to all available hosts as specified in configuration.
async def open(cls, loop, *, aliases=None, configfile=None, **config): cluster = cls(loop, aliases=aliases, **config) if configfile: cluster.config_from_file(configfile) await cluster.establish_hosts() return cluster
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(ctx, config):\n log.info('Opening connections...')\n remotes = []\n machs = []\n for name in ctx.config['targets'].iterkeys():\n machs.append(name)\n for t, key in ctx.config['targets'].iteritems():\n t = misc.canonicalize_hostname(t)\n log.debug('connecting to %s', ...
[ "0.67443687", "0.6651427", "0.64465094", "0.63779134", "0.62812424", "0.6279923", "0.6241238", "0.6115502", "0.59951556", "0.5991341", "0.5940241", "0.5907062", "0.58718926", "0.58476406", "0.58214194", "0.5781779", "0.5775787", "0.5634603", "0.5625746", "0.5581556", "0.55773...
0.7019515
0
coroutine Get connection from next available host in a round robin fashion.
async def get_connection(self, hostname=None): if not self._hosts: await self.establish_hosts() if hostname: try: host = self._hostmap[hostname] except KeyError: raise exception.ConfigError( 'Unknown host: {}'.format...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _connect(self):\n for attempt in range(1, self.num_attempts + 1):\n try:\n conn = self.rabbitmq_context.get_connection(self.timeout)\n chan = conn.channel()\n return (conn, chan)\n except AMQPError as ex:\n if attempt >= s...
[ "0.65758437", "0.60254616", "0.5965089", "0.58990353", "0.5885591", "0.57209206", "0.56956804", "0.5667477", "0.5656335", "0.563919", "0.5549618", "0.5547971", "0.55371743", "0.55303013", "0.55273753", "0.55196035", "0.5503916", "0.5498301", "0.5498018", "0.54843074", "0.5479...
0.59024113
3
coroutine Connect to all hosts as specified in configuration.
async def establish_hosts(self): scheme = self._config['scheme'] hosts = self._config['hosts'] port = self._config['port'] for hostname in hosts: url = '{}://{}:{}/gremlin'.format(scheme, hostname, port) host = await driver.GremlinServer.open( url,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_connect(self, args):\r\n for host in self.host:\r\n client = paramiko.SSHClient()\r\n client.set_missing_host_key_policy(paramiko.AutoAddPolicy())\r\n client.connect(host[0], username=host[1], password=host[2])\r\n self.connections.append(client)", "def c...
[ "0.76126385", "0.69372785", "0.68551636", "0.67098475", "0.6545347", "0.65244", "0.6407366", "0.63640463", "0.6282757", "0.61959034", "0.6195543", "0.61844474", "0.6115662", "0.61116165", "0.60936683", "0.60836387", "0.60481113", "0.60062855", "0.59707445", "0.5946551", "0.59...
0.7258675
1
Load configuration from from file.
def config_from_file(self, filename): if filename.endswith('yml') or filename.endswith('yaml'): self.config_from_yaml(filename) elif filename.endswith('.json'): self.config_from_json(filename) else: raise exception.ConfigurationError('Unknown config file forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(file):\n _config.load(file)", "def load_config(self, config_file):\n self.config = ConfigParser.ConfigParser()\n self.config.read(config_file)", "def load_config(self):\r\n with open('config.json', 'r') as f:\r\n self.config = json.load(f)", "def loadConf(self):\n\...
[ "0.8430217", "0.78977937", "0.7896458", "0.78061134", "0.77894324", "0.7721845", "0.76945454", "0.76910096", "0.7682791", "0.760624", "0.75849247", "0.7573283", "0.7562032", "0.7558948", "0.7533638", "0.7493862", "0.7468128", "0.74427754", "0.7439994", "0.74397856", "0.741206...
0.746959
16
Load configuration from from YAML file.
def config_from_yaml(self, filename): with open(filename, 'r') as f: config = yaml.load(f) config = self._process_config_imports(config) self._config.update(config)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yaml(cls, file=None):\n if file is None: file = f'{rcp.base_path}cfg.yml'\n try:\n with open(file, 'r') as f:\n config = yaml.load(f, Loader=yaml.FullLoader)\n cfg.__dict__ = config\n return cfg\n except FileNotFoundError:\n p...
[ "0.79749984", "0.7948293", "0.7870235", "0.7864097", "0.7782877", "0.7770844", "0.7759317", "0.7758727", "0.77337193", "0.77292687", "0.7688582", "0.7679165", "0.76457", "0.7640206", "0.7639675", "0.76378214", "0.7629019", "0.76260763", "0.75758195", "0.7562336", "0.7479118",...
0.78772604
2
Load configuration from from JSON file.
def config_from_json(self, filename): with open(filename, 'r') as f: config = json.load(f) config = self._process_config_imports(config) self.config.update(config)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(self):\r\n with open('config.json', 'r') as f:\r\n self.config = json.load(f)", "def loadConf(self):\n\n with open(self.configFile) as f:\n self.config = json.load(f)", "def load_config():\n global config\n\n with open(\"config.json\") as f:\n js...
[ "0.8539941", "0.82377046", "0.8098964", "0.80969477", "0.8014216", "0.80130273", "0.79837704", "0.79833937", "0.79324776", "0.7875829", "0.78704065", "0.78406453", "0.78028023", "0.77925986", "0.7734833", "0.7696995", "0.7658866", "0.76542926", "0.76527035", "0.763015", "0.76...
0.84245086
1
Load configuration from Python module.
def config_from_module(self, module): if isinstance(module, str): module = importlib.import_module(module) config = dict() for item in dir(module): if not item.startswith('_') and item.lower() in self.DEFAULT_CONFIG: config[item.lower()] = getattr(module, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load():\n # get (or create) config path\n p = initialize()\n return load_config(open(p['config']))", "def load_config(self):\n pass", "def import_configuration(module_name, data_dir):\n\n try:\n debug(\"Attempting to load {module_name}.py from {data_dir}\",\n module_n...
[ "0.7303593", "0.7138871", "0.71056706", "0.7068878", "0.7045024", "0.701708", "0.6915462", "0.68093777", "0.6704642", "0.6702429", "0.66010815", "0.6574525", "0.65442324", "0.6477583", "0.64685637", "0.6463062", "0.64604574", "0.6456965", "0.64501286", "0.6439395", "0.6414435...
0.6922377
6
coroutine Get a connected client. Main API method.
async def connect(self, hostname=None, aliases=None): aliases = aliases or self._aliases if not self._hosts: await self.establish_hosts() # if session: # host = self._hosts.popleft() # client = client.SessionedClient(host, self._loop, session, # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client():\n\n client = Client()\n return client", "async def get_client_async(\n client_id: str, x_additional_headers: Optional[Dict[str, str]] = None, **kwargs\n):\n request = GetClient.create(\n client_id=client_id,\n )\n return await run_request_async(\n request, additional...
[ "0.70981216", "0.69342744", "0.69309705", "0.68255496", "0.677095", "0.67015225", "0.66983896", "0.6686263", "0.6632668", "0.66281176", "0.6584124", "0.6577778", "0.6531688", "0.65143883", "0.6509944", "0.6434681", "0.64121413", "0.64000314", "0.6398781", "0.6397054", "0.6340...
0.0
-1
coroutine Close cluster and all connected hosts.
async def close(self): waiters = [] while self._hosts: host = self._hosts.popleft() waiters.append(host.close()) await asyncio.gather(*waiters, loop=self._loop) self._closed = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n self.cluster.shutdown()", "def close(self):\n if self.connected:\n self._close_cluster()", "def shutdown_cluster(self):\n self.cluster.shutdown()", "def close(self):\n for conn in self._conns:\n conn.send((self.CLOSE,()))", "def cluster_shutdown():\n ...
[ "0.80359495", "0.7946197", "0.73420334", "0.70863855", "0.68911695", "0.6771123", "0.65967685", "0.6574503", "0.6539615", "0.6539615", "0.6539615", "0.65233886", "0.65046805", "0.6472192", "0.64719164", "0.64410585", "0.636139", "0.6355587", "0.63540643", "0.632373", "0.63053...
0.7704905
2
Get the greatest common dividisor.
def _gcd_f(a, b): return a if b == 0 else _gcd_f(b, a % b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def greatest_common_divisor(x: int, y: int) -> int:\n while y != 0:\n (x, y) = (y, x % y)\n return x", "def greatest_common_divisor(a: int, b: int) -> int:\n#[SOLUTION]\n while b:\n a, b = b, a % b\n return a", "def gcd_algo(a,b):\n i = max(a,b)\n j = min(a,b)\n\n if j == 0:\...
[ "0.76645106", "0.74440897", "0.70103806", "0.70037377", "0.6842229", "0.68309116", "0.6827134", "0.6827134", "0.6815804", "0.6798665", "0.67862236", "0.6785387", "0.6770141", "0.6755159", "0.66933185", "0.66908", "0.6687727", "0.66838616", "0.66838616", "0.66838616", "0.66838...
0.6431989
64
Get the least common multiple.
def _lcm_f(a, b): return int((a * b) / _gcd_f(a, b))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def least_common_multiple(number1, number2):\n return number1 * number2 // math.gcd(number1, number2)", "def least_common_multiple2(number1, number2, number3, number4):\n return least_common_multiple((number1 * number2 // math.gcd(number1, number2)),\n (number3 * number4 // ...
[ "0.7903114", "0.75025064", "0.73285586", "0.7166786", "0.6805132", "0.6473004", "0.6357267", "0.62809765", "0.61856556", "0.61782134", "0.61521375", "0.61483604", "0.6133332", "0.61324215", "0.60736656", "0.6026523", "0.60008913", "0.60008913", "0.60008913", "0.59906423", "0....
0.55290264
75
For global_average_pooling, DPU will do padding to replace rectangle kernel to squre kernel.
def _get_dpu_kernel_size(kh, kw): new_k = _lcm_f(kh, kw) return new_k, new_k
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avg_pool2d(input, kernel_size, stride=1, padding=0, ceil_mode=False):\n return _pool('AVG', utils._pair, **locals())", "def global_avg_pooling(self, x: tf.Tensor) -> tf.Tensor:\n x = tf.reduce_mean(x, [1, 2], name='pool5', keepdims=True)\n x = slim.conv2d(x, self.num_classes, [1, 1], activat...
[ "0.6771808", "0.67420304", "0.66497076", "0.6578936", "0.64375925", "0.6418065", "0.6361562", "0.6351175", "0.633016", "0.6306614", "0.629251", "0.61938196", "0.61428696", "0.6023366", "0.6018505", "0.5975755", "0.59645456", "0.5927973", "0.5879244", "0.5846322", "0.5787767",...
0.0
-1
Create a Vitis.GlobalAveragePooling2D Layer.
def __init__(self, **kwargs): super(VitisGlobalAveragePooling2D, self).__init__(**kwargs) self.rescale_factor = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n super(VitisAveragePooling2D, self).__init__(**kwargs)", "def _create_globalaveragepool(cls, onnx_node, inputs, opset_version):\n data_format = onnx_node.getattr(\"data_format\", 'channels_first')\n _, forward = cls._common_onnx_node_to_singa_op(onnx_node, inputs,\...
[ "0.61525106", "0.609915", "0.5919478", "0.5911318", "0.58175915", "0.5786517", "0.5785733", "0.5725473", "0.57131076", "0.57019055", "0.56622005", "0.5642687", "0.5559154", "0.54910403", "0.5473044", "0.5453422", "0.54310554", "0.54178834", "0.53916913", "0.5368832", "0.53341...
0.6580204
0
Create a Vitis.AveragePooling2D Layer.
def __init__(self, **kwargs): super(VitisAveragePooling2D, self).__init__(**kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n super(VitisGlobalAveragePooling2D, self).__init__(**kwargs)\n self.rescale_factor = None", "def avg_pool2d(input, kernel_size, stride=1, padding=0, ceil_mode=False):\n return _pool('AVG', utils._pair, **locals())", "def __init__(self, incoming, ksize=(1, 3, 3, 1), strid...
[ "0.6457442", "0.6351592", "0.63016933", "0.6263064", "0.6204219", "0.6127676", "0.6081943", "0.6059515", "0.605608", "0.5863216", "0.5845179", "0.5788462", "0.5774942", "0.57626235", "0.5740961", "0.57336354", "0.56914294", "0.5654503", "0.56451905", "0.56366557", "0.5619244"...
0.6591949
0
Check if this average_pooling can be converted to global_average_pooling.
def _is_global_pooling(self, input_shape): output_shape = self.compute_output_shape(input_shape).as_list() return output_shape[1] == 1 and output_shape[2] == 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_broadcast(self, op, op_reg_manager):\n op_slices = op_reg_manager.get_op_slices(op)\n op_groups = [op_reg_manager.get_op_group(op_slice)\n for op_slice in op_slices]\n return op_handler_util.get_op_size(op) == 1 and all(op_groups)", "def _create_globalaveragepool(cls, onnx_node, ...
[ "0.5702395", "0.5538844", "0.5531251", "0.55049336", "0.5397743", "0.5374523", "0.5364051", "0.53428036", "0.52849174", "0.5265467", "0.5254244", "0.52519786", "0.5186632", "0.5176284", "0.51702154", "0.5170172", "0.5161271", "0.51423174", "0.5126535", "0.50942713", "0.509141...
0.73045886
0
Return any restricted teams for particualr users that our plugin may define.
def restricted_teams(self, user): return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_teams():", "def get_available_teams(self):\n teams = self.request.user.team_set.filter(competition__is_open=True)\n if not teams.exists():\n msg = \"Can't send invites at this time. You're not\"\n msg += \" registered for any open competitions\"\n messages.e...
[ "0.6975286", "0.68651044", "0.6603281", "0.6549819", "0.6532676", "0.6517242", "0.6496614", "0.648852", "0.6457178", "0.6403878", "0.6360511", "0.6280246", "0.62778485", "0.62211406", "0.6210954", "0.6171425", "0.6165721", "0.6151758", "0.60374504", "0.60309184", "0.5981556",...
0.83617604
0
Given a (Django) USER object, return any extra roles defined by our plugin.
def roles(self, user): return {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_roles(user=None):\n if user is None:\n user = g.user\n return user.roles", "def token_auth_get_user_roles(user):\n print(user)\n return user.get_roles()", "def _listAllowedRolesAndUsers(self, user):\n result = list(user.getRoles())\n if hasattr(aq_base(...
[ "0.6987547", "0.69320935", "0.657485", "0.65712994", "0.623313", "0.6149452", "0.61279637", "0.5949688", "0.592528", "0.5896143", "0.5832695", "0.58255416", "0.58077645", "0.5799637", "0.5794509", "0.57523865", "0.5712782", "0.57127666", "0.56953585", "0.5647589", "0.5622482"...
0.66918993
2
Test with augmentations. If rescale is False, then returned bboxes will fit the scale of imgs[0].
def aug_test(self, imgs, img_metas, templates, proposals=None, rescale=False): # recompute feats to save memory #y = self.extract_feats(imgs, templates) proposal_list = self.aug_test_rpn(self.extract_feats(imgs, templates), img_metas, self.test_cfg.rpn) rcnn_test_cfg = self.test_cfg.rcnn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aug_test(self, imgs, img_metas, rescale=False):\n # recompute feats to save memory\n proposal_list = self.aug_test_rpn(\n self.extract_feats(imgs), img_metas, self.test_cfg.rpn)\n det_bboxes, det_labels = self.aug_test_bboxes(\n self.extract_feats(imgs), img_metas, pr...
[ "0.68419516", "0.6574216", "0.6549093", "0.6481572", "0.6396106", "0.63814837", "0.63660586", "0.63358074", "0.63159716", "0.6262087", "0.6254781", "0.62417847", "0.61867654", "0.6185712", "0.6176265", "0.61736345", "0.61701804", "0.61697906", "0.6157004", "0.61568195", "0.61...
0.6817737
1
Read data Size of returned data expected to be in range [1..size], otherwise BrokenPipeError must be raised. Reading scope must be entered for duration of reading.
def read(self, size): with self.reading: raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self, size: int = -1) -> bytes:\n if self.size_read >= self.chunksize:\n return b''\n if size < 0:\n size = self.chunksize - self.size_read\n if size > self.chunksize - self.size_read:\n size = self.chunksize - self.size_read\n data = self.file....
[ "0.7203594", "0.71555114", "0.68909967", "0.68868846", "0.6877114", "0.68765837", "0.678092", "0.6759065", "0.67104393", "0.6689464", "0.6680275", "0.66459846", "0.66349393", "0.66163135", "0.6571038", "0.65568054", "0.6509626", "0.6477556", "0.6435627", "0.64335006", "0.6431...
0.686824
6
Write data Returns length of written data. Writing scope must be entered for duration of writing.
def write(self, data): with self.writing: raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_data(self, data):\n print('Wrote %d bytes' % (len(data)))", "def _writeSomeData(self, data):\n if self.consumer is None:\n return 0\n self.consumer.write(data)\n return len(data)", "def write(self, data):\n return 0", "def write(self, data):\n wi...
[ "0.72757506", "0.72544014", "0.71922183", "0.6731189", "0.6619201", "0.6602798", "0.6471862", "0.64083594", "0.6364985", "0.63516694", "0.6344728", "0.63193315", "0.63137215", "0.63096243", "0.6309239", "0.6277473", "0.6271191", "0.62258345", "0.6195639", "0.61901796", "0.614...
0.6268723
17
Flush write buffers Must hook continuation to the current flush if any or start new one.
def flush(self):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flush( finishing=False, callback=None ):", "def flush(self):\n if self.index < self.bufsize:\n self.writer(\n self.linesep.join(self.read1_batch[0:self.index]),\n self.linesep.join(self.read2_batch[0:self.index]))\n else:\n self.writer(\n ...
[ "0.72197866", "0.6825687", "0.6762548", "0.67556584", "0.6626207", "0.65444833", "0.6481918", "0.6443816", "0.6437833", "0.6389314", "0.638791", "0.6369492", "0.6365876", "0.63625133", "0.6264878", "0.6097336", "0.60739243", "0.60723567", "0.6068778", "0.60441273", "0.6013682...
0.5962441
32