code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def reset_metrics(self): <NEW_LINE> <INDENT> super().reset_metrics() <NEW_LINE> del self.observations[:] <NEW_LINE> del self.labels[:]
Reset metrics, observations and labels.
625941c7046cf37aa974cd9a
def print_peak_data(sp) : <NEW_LINE> <INDENT> for field in sp.fields : print(field, end=' ') <NEW_LINE> print('')
Prints input data string(line)
625941c785dfad0860c3aeac
def create_slug(self, instance_before): <NEW_LINE> <INDENT> reserved_slugs = self.get_reserved_slugs() <NEW_LINE> if not instance_before: <NEW_LINE> <INDENT> self.slug = unique_slug(self.__class__, create_slug(self.name), reserved_slugs=reserved_slugs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if not instance_befor...
Create and make unique slug. If passed instance before save(), checks if new slug (in admin edit for example) unique and make unique if not. :param instance_before: Category instance before save()
625941c7d164cc6175782d9e
def get_all_users(self) -> List[User]: <NEW_LINE> <INDENT> return self._session.query(User).all()
Get all users in the system.
625941c76fece00bbac2d78e
def registerComponent(name, title, component): <NEW_LINE> <INDENT> comp_registry[name] = RegistryItem(name, title, component)
registerComponent. :param name: :param title: :param component:
625941c756b00c62f0f146aa
def translation_project_dir_exists(language, project): <NEW_LINE> <INDENT> if project.get_treestyle() == "gnu": <NEW_LINE> <INDENT> if language.code == 'templates': <NEW_LINE> <INDENT> for dirpath, dirnames, filenames in os.walk(project.get_real_path()): <NEW_LINE> <INDENT> for filename in filenames: <NEW_LINE> <INDENT...
Tests if there are translation files corresponding to the given :param:`language` and :param:`project`.
625941c7d6c5a1020814409b
def _SigSegvHandler(self, signal_number, stack_frame): <NEW_LINE> <INDENT> self._OnCriticalError() <NEW_LINE> if self._original_sigsegv_handler is not None: <NEW_LINE> <INDENT> signal.signal(signal.SIGSEGV, self._original_sigsegv_handler) <NEW_LINE> os.kill(self._pid, signal.SIGSEGV)
Signal handler for the SIGSEGV signal. Args: signal_number (int): numeric representation of the signal. stack_frame (frame): current stack frame or None.
625941c776d4e153a657eb82
def deleteFactSheetHasIfaceConsumer(self, ID, relationID, **kwargs): <NEW_LINE> <INDENT> allParams = ['ID', 'relationID'] <NEW_LINE> params = locals() <NEW_LINE> for (key, val) in params['kwargs'].iteritems(): <NEW_LINE> <INDENT> if key not in allParams: <NEW_LINE> <INDENT> raise TypeError("Got an unexpected keyword ar...
Delete relation by a given relationID Args: ID, str: Unique ID (required) relationID, str: Unique ID of the Relation (required) Returns:
625941c7099cdd3c635f0cad
def test_program_init_method(): <NEW_LINE> <INDENT> params = {'function_set': [add2, sub2, mul2, div2, sqrt1, log1, abs1, max2, min2], 'arities': {1: [sqrt1, log1, abs1], 2: [add2, sub2, mul2, div2, max2, min2]}, 'init_depth': (2, 6), 'n_features': 10, 'const_range': (-1.0, 1.0), 'metric': 'mean absolute error', 'p_poi...
Check 'full' creates longer and deeper programs than other methods
625941c7fff4ab517eb2f48d
def get_os_sp(os_platform): <NEW_LINE> <INDENT> if os_platform == 'windows': <NEW_LINE> <INDENT> return platform.win32_ver()[2][2:] <NEW_LINE> <DEDENT> return ''
Get OS service pack (for Windows) :param os_platform: os :return: SP
625941c745492302aab5e314
def server_loop(local_port, netemu_ip, netemu_port): <NEW_LINE> <INDENT> server_sock = RatSocket(debug_mode=True) <NEW_LINE> server_sock.listen("127.0.0.1", local_port, 1) <NEW_LINE> print(MSG_LISTENING) <NEW_LINE> client = server_sock.accept() <NEW_LINE> while (server_sock.current_state != State.SOCK_CLOSED): <NEW_LIN...
The main loop of the server.
625941c7cc0a2c11143dcee2
def handle_notification(self, headers, content): <NEW_LINE> <INDENT> timestamp = time.time() <NEW_LINE> seq = headers['seq'] <NEW_LINE> sid = headers['sid'] <NEW_LINE> subscription = self.subscriptions_map.get_subscription(sid) <NEW_LINE> if subscription: <NEW_LINE> <INDENT> service = subscription.service <NEW_LINE> se...
Handle a ``NOTIFY`` request by building an `Event` object and sending it to the relevant Subscription object. A ``NOTIFY`` request will be sent by a Sonos device when a state variable changes. See the `UPnP Spec §4.3 [pdf] <http://upnp.org/specs/arch/UPnP-arch -DeviceArchitecture-v1.1.pdf>`_ for details. Args: h...
625941c7be7bc26dc91cd653
def update(self, mapping): <NEW_LINE> <INDENT> self._mapping = {} <NEW_LINE> self._modifiers = [] <NEW_LINE> for bp_name, action_name in mapping.iteritems(): <NEW_LINE> <INDENT> button, modifiers = button_press_parse(bp_name) <NEW_LINE> if not self._mapping.has_key(modifiers): <NEW_LINE> <INDENT> self._mapping[modifier...
Updates from a prefs sub-hash. :param mapping: dict of button_press_name()s to action names. A reference is not maintained.
625941c782261d6c526ab4ef
def __init__(self, sphere: Sphere, total_step, direction: Direction, boundaries, current_step=np.nan): <NEW_LINE> <INDENT> self.sphere = sphere <NEW_LINE> self.total_step = total_step <NEW_LINE> self.current_step = current_step <NEW_LINE> self.direction = direction <NEW_LINE> self.boundaries = boundaries
The characteristic of the step to be perform :type sphere: Sphere :param total_step: total step left for the current move of spheres :param current_step: step sphere is about to perform :param direction: of the step :type boundaries: list
625941c756ac1b37e6264223
def _get_diagnostics(self, instance): <NEW_LINE> <INDENT> vm_ref = vm_util.get_vm_ref(self._session, instance) <NEW_LINE> lst_properties = ["summary.config", "summary.quickStats", "summary.runtime"] <NEW_LINE> vm_props = self._session._call_method(vutil, "get_object_properties_dict", vm_ref, lst_properties) <NEW_LINE> ...
Return data about VM diagnostics.
625941c7d53ae8145f87a2c3
def update(self, request, **kwargs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> api = request.data <NEW_LINE> api_body = { 'name': api['name'], 'body': api['body'], 'url': api['url'], 'method': api['method'], 'id': api['id'], } <NEW_LINE> obj = models.API.objects.filter(id=api_body['id']).count() <NEW_LINE> if obj ==...
更新接口
625941c74428ac0f6e5ba843
def match_lines_to_runs(lines, runs): <NEW_LINE> <INDENT> match_count = 0 <NEW_LINE> from summit_core import find_closest_date, search_for_attr_value <NEW_LINE> logger = logging.getLogger(__name__) <NEW_LINE> for line in lines: <NEW_LINE> <INDENT> run_dates = [run.date for run in runs] <NEW_LINE> [match, diff] = find_c...
This takes a list of PaLine and GcRun objects and matched them by date, within a tolerance. When matching objects, it WILL modify their parameters and status if warranted. :param lines: list, of PaLine objects that are unmatched :param runs: list, of GcRun objects that are unmatched :return: (lines, runs, match_count)...
625941c726238365f5f0eebe
def do_query(self): <NEW_LINE> <INDENT> print("[*] Beginning Arin Query") <NEW_LINE> logger.info('Starting ARIN Query for ' + self.domain) <NEW_LINE> try: <NEW_LINE> <INDENT> org_name = self._lookup_org() <NEW_LINE> if not org_name: <NEW_LINE> <INDENT> raise ValueError("[!] Org name was not found ARIN query cannot cont...
Queries ARIN CIDR ranges for the domain passed in on instantiation Returns:
625941c7d486a94d0b98e197
def get_id(typ, data): <NEW_LINE> <INDENT> data_df = pd.DataFrame(data, index=[0]) <NEW_LINE> code_name = '{}Code'.format(typ) <NEW_LINE> table_name = '{}s'.format(typ.lower()) <NEW_LINE> id_name = '{}ID'.format(typ) <NEW_LINE> code = data[code_name] <NEW_LINE> check_by = [code_name] <NEW_LINE> append_non_duplicates(ta...
gets either the siteid or variableid from the db :param typ: String. Either "Site" or "Variable" :param data: Dict. the site or variable data :return: int. id of site or variable
625941c7d8ef3951e324358f
def test_util_login_true(self): <NEW_LINE> <INDENT> assert True
True should not assert.
625941c7a219f33f346289bd
def readlines(self): <NEW_LINE> <INDENT> self._preread_check() <NEW_LINE> lines = [] <NEW_LINE> while True: <NEW_LINE> <INDENT> s = self.readline() <NEW_LINE> if not s: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> lines.append(s) <NEW_LINE> <DEDENT> return lines
Returns all lines from the file in a list.
625941c7ff9c53063f47c246
def test_eval_create_loss_loss_fn(self): <NEW_LINE> <INDENT> loss = np.array([[1.], [2.]], dtype=np.float32) <NEW_LINE> logits_input = np.array([[-10.], [10.]], dtype=np.float32) <NEW_LINE> labels_input = np.array([[1], [0]], dtype=np.int64) <NEW_LINE> def _loss_fn(labels, logits): <NEW_LINE> <INDENT> check_labels = co...
Tests head.create_loss for eval mode and custom loss_fn.
625941c73d592f4c4ed1d0c2
def __init__(self, *args, **kwds): <NEW_LINE> <INDENT> if args or kwds: <NEW_LINE> <INDENT> super(message, self).__init__(*args, **kwds) <NEW_LINE> if self.A is None: <NEW_LINE> <INDENT> self.A = 0 <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> self.A = 0
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix in-order arguments and keyword arguments. The available fields are: A :param args: complete set of fi...
625941c7ad47b63b2c509fd1
def test_groupButtons(self): <NEW_LINE> <INDENT> from collections import defaultdict <NEW_LINE> b1 = CustomFeatureButton({"name": "Button 1", "category": "Cat 1"}) <NEW_LINE> b2 = CustomFeatureButton({"name": "Button 2", "isCheckable": True}) <NEW_LINE> b3 = CustomFeatureButton({"name": "Button 3", "color": (10, 2, 45,...
Tests if grouping buttons work
625941c73346ee7daa2b2dbd
def _get_binding_record(self): <NEW_LINE> <INDENT> binding = self.binder.get_bindings(domain=[('id', '=', self.binding_id)]) <NEW_LINE> assert len(binding) <= 1, "More than one binding record returned!" <NEW_LINE> if binding: <NEW_LINE> <INDENT> assert binding.id == self.binding_id, "Id of returned binding does not mat...
Return the binding record
625941c7f9cc0f698b14064e
def kline_data(self,symbol,size,type,start_time): <NEW_LINE> <INDENT> tm = time.strptime(start_time, '%Y-%m-%d %H:%M') <NEW_LINE> t = int(time.mktime(tm)) <NEW_LINE> url = self.KLINE_DATA_URL <NEW_LINE> return self._request(url, symbol=symbol, size=size, type=type, time=t)
Get the K-line data,1 <= size <= 2880, start_time: %Y-%m-%d %H-%M tyoe:minute1:1minute minute5:5minute minute15:15minute minute30:30minute hour1:1hour hour4:4hour hour8:8hour hour12:12hour day1:1day week1:1week
625941c7cdde0d52a9e53084
def get_threshold_from_pdfs(self, data_m, term, center, *args, **kwargs): <NEW_LINE> <INDENT> term, threshold, normal, abnormal = self._pdf_updates(term=term, data_m=data_m, center=center) <NEW_LINE> return threshold
SQ/SITA returned the most likely mode of the two pfs used in the procedure The quote above leaves some room for interpretation. So we interpret it as: 0) Normalize both PDFs (mathematically speaking PDFs are always normalized) 1) Find the two modes of the two PDFs and the corresponding probability at that dB 2) Report...
625941c792d797404e3041dc
def rnn_forward(x, h0, Wx, Wh, b): <NEW_LINE> <INDENT> h, cache = None, None <NEW_LINE> N, T, D = x.shape <NEW_LINE> N, H = h0.shape <NEW_LINE> cache = [] <NEW_LINE> h = np.zeros((N, T, H)) <NEW_LINE> prev_h = h0 <NEW_LINE> for t in range(T): <NEW_LINE> <INDENT> x_t = x[:,t,:] <NEW_LINE> next_h, cache_t = rnn_step_forw...
Run a vanilla RNN forward on an entire sequence of data. We assume an input sequence composed of T vectors, each of dimension D. The RNN uses a hidden size of H, and we work over a minibatch containing N sequences. After running the RNN forward, we return the hidden states for all timesteps. Inputs: - x: Input data fo...
625941c7796e427e537b0617
def get_many(self, keys, version=None): <NEW_LINE> <INDENT> recovered_data = SortedDict() <NEW_LINE> new_keys = map(lambda key: self.make_key(key, version=version), keys) <NEW_LINE> map_keys = dict(zip(new_keys, keys)) <NEW_LINE> caches = self.get_caches(new_keys) <NEW_LINE> for cache, keys in caches.items(): <NEW_LINE...
Retrieve many keys.
625941c7b7558d58953c4f68
def test_php(self): <NEW_LINE> <INDENT> lines = self._get_lines("helloworld.php") <NEW_LINE> self.assertEqual(len(lines[0]), 2) <NEW_LINE> self.assertEqual(lines[0][0], (1, 'class HelloWorld {\n')) <NEW_LINE> self.assertEqual(lines[0][1], (2, '\tfunction helloWorld() {\n')) <NEW_LINE> self.assertEqual(len(lines[1]), 3)...
Testing interesting lines scanner with a PHP file
625941c7c4546d3d9de72a85
def get_choice_key(self): <NEW_LINE> <INDENT> if not self.choices: <NEW_LINE> <INDENT> return self._choice_key <NEW_LINE> <DEDENT> return self.keytransform(self._choice_key)
The choice key is the current selected key in the *choices* attribute. This method get the choice key that is currently selected. Returns ------- Currently selected key in the *choices* attribute.
625941c75fc7496912cc39d0
def bold(s): <NEW_LINE> <INDENT> return f'\x02{s}\x02'
Returns the string s, bolded.
625941c79b70327d1c4e0e27
def test_ambiguous_object(self): <NEW_LINE> <INDENT> test_urls = [ ('urlobject-view', [], {}), ('urlobject-view', [37, 42], {}), ('urlobject-view', [], {'arg1': 42, 'arg2': 37}), ] <NEW_LINE> for name, args, kwargs in test_urls: <NEW_LINE> <INDENT> with self.subTest(name=name, args=args, kwargs=kwargs): <NEW_LINE> <IND...
Names deployed via dynamic URL objects that require namespaces can't be resolved.
625941c7ec188e330fd5a7f3
def get_core(self): <NEW_LINE> <INDENT> core = Bcfg2.Server.Core.Core() <NEW_LINE> core.load_plugins() <NEW_LINE> core.block_for_fam_events(handle_events=True) <NEW_LINE> signal.signal(signal.SIGINT, get_sigint_handler(core)) <NEW_LINE> return core
Get a server core, with events handled
625941c724f1403a92600bba
def connect(self): <NEW_LINE> <INDENT> return connectWS(self)
Connect the client factory to the WebSocket server Returns: An instance of twisted.internet.interfaces.IConnector
625941c74f6381625f114a8d
def GetOutsideValue(self): <NEW_LINE> <INDENT> return _itkMaskImageFilterPython.itkMaskImageFilterIRGBAUS2IUL2IRGBAUS2_GetOutsideValue(self)
GetOutsideValue(self) -> itkRGBAPixelUS
625941c7a05bb46b383ec875
def holidays(self, start=None, end=None, return_name=False): <NEW_LINE> <INDENT> if self.rules is None: <NEW_LINE> <INDENT> raise Exception( f"Holiday Calendar {self.name} does not have any rules specified" ) <NEW_LINE> <DEDENT> if start is None: <NEW_LINE> <INDENT> start = AbstractHolidayCalendar.start_date <NEW_LINE>...
Returns a curve with holidays between start_date and end_date Parameters ---------- start : starting date, datetime-like, optional end : ending date, datetime-like, optional return_name : bool, optional If True, return a series that has dates and holiday names. False will only return a DatetimeIndex of dates. ...
625941c7cc40096d615959a3
def _RootListingExceptionHandler(cls, e): <NEW_LINE> <INDENT> cls.logger.error(str(e))
Simple exception handler for exceptions during listing URLs to sync.
625941c7283ffb24f3c55955
def banner(request): <NEW_LINE> <INDENT> if hasattr(request, 'user') and request.user.is_authenticated: <NEW_LINE> <INDENT> return {'banner': Config.objects.get(pk='banner').text} <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return ()
This context processor just add a "banner" key that's allways available
625941c70a366e3fb873e86c
def savefig(self, figname, device=None): <NEW_LINE> <INDENT> ext = get_file_ext(figname) <NEW_LINE> if device is None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> device = ext2device.get(ext.lower()) <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise ValueError("Unsupported device for extension {}".format(...
generating a figure file by ``filename`` which includes an extension. This method is adapted from PyGrace.grace Args: figname (str) device (str)
625941c74e4d5625662d442b
def get(self, object_name): <NEW_LINE> <INDENT> if object_name in self: <NEW_LINE> <INDENT> return Object(obj=self.container.get_object(object_name)) <NEW_LINE> <DEDENT> return None
Return an object or None if it doesn't exist :param object_name: :return: Object
625941c7d18da76e23532528
def run(self, exposure): <NEW_LINE> <INDENT> raise NotImplementedError("Amp offset task should be retargeted by a camera specific version.")
Calculate amp offset values, determine corrective pedestals for each amp, and update the input exposure in-place. This task is currently not implemented, and should be retargeted by a camera specific version. Parameters ---------- exposure : `lsst.afw.image.Exposure` Exposure to be corrected for any amp offsets.
625941c74f6381625f114a8e
def load_mnist(path, mode = 'train'): <NEW_LINE> <INDENT> kind = {'train':'train', 'test':'t10k'} <NEW_LINE> labels_path = os.path.join(path, "%s-labels-idx1-ubyte"% kind[mode]) <NEW_LINE> images_path = os.path.join(path, "%s-images-idx3-ubyte"% kind[mode]) <NEW_LINE> with open(labels_path,'rb') as lbpath: <NEW_LINE> <...
Load MNIST data from path
625941c7ac7a0e7691ed4120
def weekDatesCalendar(target): <NEW_LINE> <INDENT> sunday = startOfWeek(target) <NEW_LINE> return [sunday + timedelta(i) for i in range(0, 7)]
returns a list of week dates for target's week
625941c7d58c6744b4257cb3
def get_children_count(self, parentId): <NEW_LINE> <INDENT> c = self.conn.cursor() <NEW_LINE> count = c.execute("select count(*) from journal where parentId = %d" % parentId).fetchone()[0] <NEW_LINE> c.close() <NEW_LINE> return count
get children count
625941c7baa26c4b54cb1173
def query_1(): <NEW_LINE> <INDENT> print("query_1()") <NEW_LINE> current_time = datetime.datetime.now(timezone('UTC')) <NEW_LINE> start_time = (current_time - datetime.timedelta(hours=1)) <NEW_LINE> end_time = current_time <NEW_LINE> air_pressure_data = AirPressure.query.filter( AirPressure.created_datetime.between(sta...
1時間のデータを対象
625941c7adb09d7d5db6c7e3
def selectedIndex(self): <NEW_LINE> <INDENT> if self.mw.treeWorld.selectedIndexes(): <NEW_LINE> <INDENT> return self.mw.treeWorld.currentIndex() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return QModelIndex()
Returns the selected index in the treeView.
625941c7cb5e8a47e48b7afe
def eval(self, update_iter, num_eval=None, force_eval=False) -> Dict[str, float]: <NEW_LINE> <INDENT> if ( (self.episode_count > 0) or (self.args.num_steps <= 1) or self.should_start_with_eval or force_eval ): <NEW_LINE> <INDENT> total_num_steps = self.updater.get_completed_update_steps(update_iter + 1) <NEW_LINE> eval...
Returns the evaluation result.
625941c74d74a7450ccd4216
def process_ubam(bam, **kwargs): <NEW_LINE> <INDENT> logging.info("Nanoget: Starting to collect statistics from ubam file {}.".format(bam)) <NEW_LINE> samfile = pysam.AlignmentFile(bam, "rb", check_sq=False) <NEW_LINE> if not samfile.has_index(): <NEW_LINE> <INDENT> pysam.index(bam) <NEW_LINE> samfile = pysam.Alignment...
Extracting metrics from unaligned bam format Extracting lengths
625941c782261d6c526ab4f0
def do_sklearn(self, X, y, X_fc, model): <NEW_LINE> <INDENT> clf = None <NEW_LINE> Xtr, Xtst, ytr, ytst = train_test_split(X, y) <NEW_LINE> if model == LIN_REG: <NEW_LINE> <INDENT> clf = LinearRegression() <NEW_LINE> <DEDENT> elif model == BAGGING: <NEW_LINE> <INDENT> clf = BaggingRegressor() <NEW_LINE> <DEDENT> el...
do_sklearn(self, X, y, X_fc, model): Carries out the functionality of sklearn
625941c7d7e4931a7ee9df70
def linkElectron(inLep, inLepIdx, lepCollection, genPartCollection): <NEW_LINE> <INDENT> linkChain = [] <NEW_LINE> lepIdx = -1 <NEW_LINE> if inLepIdx == "find": <NEW_LINE> <INDENT> for Idx, lep in enumerate(lepCollection): <NEW_LINE> <INDENT> if inLep == lep: <NEW_LINE> <INDENT> lepIdx = Idx <NEW_LINE> break <NEW_LINE>...
process input Electron, find lineage within gen particles pass "find" as inLepIdx of particle to trigger finding within the method
625941c73539df3088e2e39d
def test_undo_redo_actions(self): <NEW_LINE> <INDENT> undo_action = self.model.createUndoAction(prefix="undo") <NEW_LINE> redo_action = self.model.createRedoAction(prefix="redo") <NEW_LINE> self.assertFalse(undo_action.isEnabled()) <NEW_LINE> self.assertFalse(redo_action.isEnabled()) <NEW_LINE> self.assertEqual("undo "...
Tests whether the action generator for undo redo works correctly. Especially if they correctly track the changes in the model
625941c7fff4ab517eb2f48e
@pytest.fixture <NEW_LINE> def rec_vm_before_change(): <NEW_LINE> <INDENT> with recovering_vm(LOADED_CD_DEVICE_XML, LOADING_CD_METADATA_XML) as vm: <NEW_LINE> <INDENT> yield vm
Fake VM recovering from CD change. CD metadata was update, but CD in the VM hasn't been changed yet.
625941c7097d151d1a222ead
def bare_silicon_model(ox_thick=18, ox_sld=2.0e-6, ox_rough=3.0, si_rough=3.0): <NEW_LINE> <INDENT> _incoming=Layer(name='air', thickness=np.inf, nsld_real=0, nsld_imaginary=0, msld_rho=0, msld_phi=0, msld_theta=0, roughness=0, roughness_model=RoughnessModel.NONE, sublayers=10) <NEW_LINE> _oxide = Layer(name='SiOx', th...
Generate a bare silicon substrate in air
625941c7187af65679ca5171
def wait_for_job_state(self, jid, want_state, timeout=None): <NEW_LINE> <INDENT> LOG.info('waiting for job state %s', want_state) <NEW_LINE> time_start = time.time() <NEW_LINE> while True: <NEW_LINE> <INDENT> job = self.get_job(jid) <NEW_LINE> have_state = self.get_job_state(job) <NEW_LINE> LOG.debug('want %s, have %s'...
Wait until a job reaches want_state. This calls get_job, so jid may be either a raw job id or a job uri. If timeout is not None, raise a TimeoutError if the job does not reach the specified state in timeout seconds.
625941c77c178a314d6ef4b1
def variantsFromConsensus(refWindow, refSequenceInWindow, cssSequenceInWindow, cssQvInWindow=None, siteCoverage=None, effectiveSiteCoverage=None, aligner="affine", ai=None, diploid=False): <NEW_LINE> <INDENT> refId, refStart, refEnd = refWindow <NEW_LINE> if diploid: <NEW_LINE> <INDENT> align = cc.AlignAffineIupac <NEW...
Compare the consensus and the reference in this window, returning a list of variants.
625941c75fdd1c0f98dc0286
def _get_heketi_client_version_str(hostname=None): <NEW_LINE> <INDENT> if not hostname: <NEW_LINE> <INDENT> openshift_config = g.config.get("cns", g.config.get("openshift")) <NEW_LINE> heketi_config = openshift_config['heketi_config'] <NEW_LINE> hostname = heketi_config['heketi_client_node'].strip() <NEW_LINE> <DEDENT>...
Gets Heketi client package version from heketi client node. Args: hostname (str): Node on which the version check command should run. Returns: str : heketi version, i.e. '7.0.0-1' Raises: 'exceptions.ExecutionError' if failed to get version
625941c730dc7b76659019ba
def unique_id(self): <NEW_LINE> <INDENT> return _vocoder_swig.vocoder_gsm_fr_encode_sp_sptr_unique_id(self)
unique_id(self) -> long
625941c7c4546d3d9de72a86
def print_info_content(summary_info, fout=None, rep_record=0): <NEW_LINE> <INDENT> fout = fout or sys.stdout <NEW_LINE> if not summary_info.ic_vector: <NEW_LINE> <INDENT> summary_info.information_content() <NEW_LINE> <DEDENT> rep_sequence = summary_info.alignment[rep_record].seq <NEW_LINE> for pos, ic in enumerate(summ...
3 column output: position, aa in representative sequence, ic_vector value.
625941c7d486a94d0b98e198
@pytest.mark.function <NEW_LINE> @pytest.mark.run(order=1) <NEW_LINE> def test__shorten_long_schema_error_messages(): <NEW_LINE> <INDENT> error_messages = ["stuff that comes at the beginning in {'key': 'value'}"] <NEW_LINE> error_messages = validators._shorten_long_schema_error_messages(error_messages) <NEW_LINE> if er...
Tests that function
625941c707f4c71912b114d4
def write_csv(data_dic_lst, path): <NEW_LINE> <INDENT> headers = [i for i in data_dic_lst[0].keys()] <NEW_LINE> with open(path, 'w', encoding='ansi', newline='') as f: <NEW_LINE> <INDENT> f_csv = csv.DictWriter(f, headers) <NEW_LINE> f_csv.writeheader() <NEW_LINE> f_csv.writerows(data_dic_lst)
写入 csv :param data_dic_lst: 字典列表 :param path: 路径 :return: none
625941c723e79379d52ee5b8
def test_includes(self): <NEW_LINE> <INDENT> date = datetime.date(1999, 12, 31) <NEW_LINE> person = self.Person(name='Test', age=10, other=20, birth_date=date) <NEW_LINE> computer = self.Computer(name='foo', vendor='bar', buy_date=date) <NEW_LINE> self.session.add(person) <NEW_LINE> person.computers.append(computer) <N...
Test for specifying included columns on instances and their related models using postprocessors.
625941c7cc0a2c11143dcee3
def _model_fn(features, labels=None, mode=None, params=None): <NEW_LINE> <INDENT> is_training = mode <NEW_LINE> momentum = params.momentum <NEW_LINE> tower_features = features <NEW_LINE> tower_labels = labels <NEW_LINE> tower_losses = [] <NEW_LINE> tower_grads = [] <NEW_LINE> tower_preds = [] <NEW_LINE> tower_mses = []...
Model body. Support single host, one or more GPU training. Parameter distribution can be either one of the following scheme. 1. CPU is the parameter server and manages gradient updates. 2. Parameters are distributed evenly across all GPUs, and the first GPU manages gradient updates. Args: features: a list of tens...
625941c715baa723493c3fc8
def login_user(self, login, password): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.report_user_activity(login, password) <NEW_LINE> result = self._db.users.update_one({'login': login, 'password': password}, {'$set': {'online': True}}) <NEW_LINE> self.report_login_event(login, password, result) <NEW_LINE> <DEDENT>...
Tries to log user in. :param str login: User's login. :param str password: User's password. :return None.
625941c73cc13d1c6d3c73cd
def kodi_setart_dict(self): <NEW_LINE> <INDENT> outdict = {} <NEW_LINE> if self.tall: <NEW_LINE> <INDENT> outdict['poster'] = self.medium_tall.source <NEW_LINE> <DEDENT> if self.wide: <NEW_LINE> <INDENT> outdict['banner'] = self.medium_wide.source <NEW_LINE> outdict['fanart'] = self.medium_wide.source <NEW_LINE> <DEDEN...
Helper function for working with ListItem.setArt :return: a dictionary formatted for Kodi
625941c79c8ee82313fbb7c8
def plot_genre_pie(genre, values, year): <NEW_LINE> <INDENT> pylab.pie(values, labels=genre, autopct='%1.1f%%') <NEW_LINE> pylab.title("Video Games Sales per Genre in {}".format(year)) <NEW_LINE> pylab.show()
This function plots the global sales per genre in a year. parameters: genre: list of genres that corresponds to y order values: list of global sales sorted in descending order year: the year of the genre data (int) Returns: None
625941c77b180e01f3dc4852
def clapEnable(self, onoff=0x01): <NEW_LINE> <INDENT> logging.debug('clapEnable: Sending Command 0x1E.') <NEW_LINE> self.gt.charWriteCmd(0x13, [0x1E, onoff])
Enable clap recognition
625941c707d97122c41788dc
def cell_volume(a=None, b=None, c=None, alpha=None, beta=None, gamma=None): <NEW_LINE> <INDENT> from math import cos, radians, sqrt <NEW_LINE> if a is None: <NEW_LINE> <INDENT> raise TypeError('missing lattice parameters') <NEW_LINE> <DEDENT> if b is None: <NEW_LINE> <INDENT> b = a <NEW_LINE> <DEDENT> if c is None: <NE...
Compute cell volume from lattice parameters. :Parameters: *a*, *b*, *c* : float | |Ang| Lattice spacings. *a* is required. *b* and *c* default to *a*. *alpha*, *beta*, *gamma* : float | |deg| Lattice angles. *alpha* defaults to 90\ |deg|. *beta* and *gamma* default to *alpha*....
625941c763b5f9789fde7138
def test_retrieve_owner_by_pk_fails(self): <NEW_LINE> <INDENT> response = self.client.get(self.bad_url, format='json') <NEW_LINE> self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
Ensure that NOT FOUND status returned for bad id
625941c785dfad0860c3aeae
def test_heroes_integrity(self): <NEW_LINE> <INDENT> self.assertEqual(len(heroes), 120)
Test that length of flatten heroes is 120 playable characters as there are in dota
625941c7377c676e912721fc
def timestamp_in_range(self, timestamp): <NEW_LINE> <INDENT> if self.xlim_low is not None and timestamp < self.xlim_low: <NEW_LINE> <INDENT> return -1 <NEW_LINE> <DEDENT> if self.xlim_high is not None and timestamp > self.xlim_high: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> return 0
check if a timestamp is in current limits return -1 if too low return 1 if too high return 0 if in range
625941c766673b3332b920e4
def test_no_commit_during_exception(engine): <NEW_LINE> <INDENT> tx = NoopTransaction(engine) <NEW_LINE> with pytest.raises(ZeroDivisionError): <NEW_LINE> <INDENT> with tx: <NEW_LINE> <INDENT> raise ZeroDivisionError <NEW_LINE> <DEDENT> <DEDENT> tx.prepared.commit.assert_not_called()
Transaction.__exit__ shouldn't commit if the block raised an exception
625941c7be383301e01b54db
def showTransform(img, M): <NEW_LINE> <INDENT> h, w = img.shape <NEW_LINE> pts = np.float32([[0, 0], [0, h-1], [w-1, h-1], [w-1, 0]]).reshape( -1, 1, 2) <NEW_LINE> dst = cv2.perspectiveTransform(pts, M) <NEW_LINE> imgH = cv2.polylines(img, [np.int32(dst)], isClosed=True, color=255, thickness=3, lineType=cv2.LINE_AA) <N...
Draw the transform M onto IMG
625941c791af0d3eaac9ba6b
def generate_pyuic4_wrapper(target_config): <NEW_LINE> <INDENT> wrapper = 'pyuic4.bat' if target_config.py_platform == 'win32' else 'pyuic4' <NEW_LINE> inform("Generating the %s wrapper..." % wrapper) <NEW_LINE> exe = quote(target_config.pyuic_interpreter) <NEW_LINE> script = quote( os.path.join(target_config.module_di...
Create a platform dependent executable wrapper for the pyuic.py script. target_config is the target configuration. Returns the platform specific name of the wrapper.
625941c77d847024c06be30e
def test_valid_format_invalid_time(self): <NEW_LINE> <INDENT> hour = '53:01' <NEW_LINE> field = SharpHourField() <NEW_LINE> with self.assertRaisesMessage( ValidationError, expected_message=( u"'{}' value has the correct format (HH:MM[:ss[.uuuuuu]]) " u"but it is an invalid time.".format(hour) ) ): <NEW_LINE> <INDENT> f...
Invalid time with proper format should raise ValidationError directly from TimeField
625941c767a9b606de4a7f0e
def getbinsize(A): <NEW_LINE> <INDENT> return 3.5*np.std(A)/len(A)**(1/3.)
Estimate appropriate binsize for histogram using Scott's rule. Parameters ---------- A: `array` Values for which to estimate an appropriate bin size.
625941c73539df3088e2e39e
def i_xx_prime(self): <NEW_LINE> <INDENT> return 0.0
Mass Moment of Inertia on the xx'-axis
625941c745492302aab5e316
def home(request): <NEW_LINE> <INDENT> user = request.user <NEW_LINE> if user.is_anonymous and not request.session.get('report_ids'): <NEW_LINE> <INDENT> messages.error(request, "You are not allowed to be here") <NEW_LINE> return redirect("home") <NEW_LINE> <DEDENT> tab_context = get_tab_counts(request.user, request.se...
Just redirect to the detail view for the user. This page exists solely because settings.LOGIN_REDIRECT_URL needs to redirect to a "simple" URL (i.e. we can't use variables in the URL)
625941c7a8370b77170528f3
def test_list_ikepolicies_with_pagination_emulated(self): <NEW_LINE> <INDENT> with contextlib.nested(self.ikepolicy(name='ikepolicy1'), self.ikepolicy(name='ikepolicy2'), self.ikepolicy(name='ikepolicy3') ) as (ikepolicy1, ikepolicy2, ikepolicy3): <NEW_LINE> <INDENT> self._test_list_with_pagination('ikepolicy', (ikepol...
Test case to list all ikepolicies with pagination.
625941c7a4f1c619b28b008f
def callback(self, method, *args): <NEW_LINE> <INDENT> assert not self.completed, 'callback already completed' <NEW_LINE> assert self.callbackMethod is None, 'callback: no method defined' <NEW_LINE> self.callbackMethod = method <NEW_LINE> self.__callbackArgs = args <NEW_LINE> if Debug.deferredBlock: <NEW_LINE> <INDENT>...
to be done after all users answered
625941c75510c4643540f43a
def isBalanced(self, root): <NEW_LINE> <INDENT> if not root: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if abs(self._height(root.left) - self._height(root.right)) <=1: <NEW_LINE> <INDENT> return self.isBalanced(root.left) and self.isBalanced(root.right) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return Fals...
:type root: TreeNode :rtype: bool
625941c7a8370b77170528f4
def default_get(self, cr, uid, field_list, context=None): <NEW_LINE> <INDENT> context = context or {} <NEW_LINE> res = super(CancelFyc, self).default_get(cr, uid, field_list, context=context) <NEW_LINE> if context.get('active_id'): <NEW_LINE> <INDENT> fyc_obj = self.pool['account.fiscalyear.closing'] <NEW_LINE> fyc = f...
This function gets default values @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param fields: List of fields for default value @param context: A standard dictionary for contextual values @return : default values of fields.
625941c7bde94217f3682e45
def __init__(self, parent = None): <NEW_LINE> <INDENT> QMenu.__init__(self, parent) <NEW_LINE> self.__maxRows = -1 <NEW_LINE> self.__firstSeparator = -1 <NEW_LINE> self.__maxWidth = -1 <NEW_LINE> self.__statusBarTextRole = 0 <NEW_LINE> self.__separatorRole = 0 <NEW_LINE> self.__model = None <NEW_LINE> self.__root = QMo...
Constructor @param parent reference to the parent widget (QWidget)
625941c73c8af77a43ae37f3
def __init__(self): <NEW_LINE> <INDENT> self.fenster = tkinter.Tk() <NEW_LINE> self.fenster.resizable(width=False, height=False) <NEW_LINE> self.fenster.geometry(str(FENSTER_BREITE) + "x" + str(FENSTER_HOEHE)) <NEW_LINE> self.spielfeld = spielfeld.Spielfeld() <NEW_LINE> self.statistik = statistik.Statistik() <NEW_LINE>...
Instanziiere. Erstellt das Hauptspielfenster und initialisiert die einzelnen Spielkomponenten.
625941c7d53ae8145f87a2c5
def __init__(self, connection): <NEW_LINE> <INDENT> self.connection = connection <NEW_LINE> self.operation = "" <NEW_LINE> self.arraysize = connection.replysize <NEW_LINE> self.rowcount = -1 <NEW_LINE> self.description = None <NEW_LINE> self.rownumber = -1 <NEW_LINE> self.__executed = None <NEW_LINE> self.__offset = 0 ...
This read-only attribute return a reference to the Connection object on which the cursor was created.
625941c7097d151d1a222eae
def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.elements = args <NEW_LINE> self.angle = kwargs.pop("angle", Angle(0.0, "deg")) <NEW_LINE> if not isinstance(self.angle, Angle): raise ValueError("Angle must be an Astropy Angle object") <NEW_LINE> super(CompositeRegion, self).__init__(**kwargs)
The constructor ... :param args: :param kwargs:
625941c77d43ff24873a2cf4
@jit(nopython=True) <NEW_LINE> def isolate_true(data): <NEW_LINE> <INDENT> data_backwards = data[::-1] <NEW_LINE> x = [] <NEW_LINE> for i in range(len(data) - 1): <NEW_LINE> <INDENT> if data_backwards[i] and data_backwards[i+1]: <NEW_LINE> <INDENT> x.append(0) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> x.append(data...
Turn all Trues except the first into Falses in a run of Trues.
625941c7d486a94d0b98e199
def mock_invalid_user_response(mocker, settings): <NEW_LINE> <INDENT> get_invalid_user_url = ( "%s/api/v1/user/?format=json&username=INVALID_USER" ) % settings.general.mytardis_url <NEW_LINE> mocker.get(get_invalid_user_url, text=EMPTY_LIST_RESPONSE)
Mock looking up an invalid user
625941c7460517430c3941db
def delete_event(self, event): <NEW_LINE> <INDENT> self._delete('events', self._build_params(uuid=event))
Deletes an existing campaign event :param event: event object or UUID
625941c70a366e3fb873e86d
def get_reward(self, streetlearn): <NEW_LINE> <INDENT> if self._num_steps_this_goal > self._goal_timeout: <NEW_LINE> <INDENT> logging.info('%d Courier target TIMEOUT (%d steps)', streetlearn.frame_count, self._num_steps_this_goal) <NEW_LINE> self._num_steps_this_goal = 0 <NEW_LINE> self._pick_random_goal(streetlearn) <...
Looks at current_pano_id and collects any reward found there. Args: streetlearn: A streetlearn instance. Returns: reward: the reward from the last step.
625941c7287bf620b61d3ab8
def get_number_row(game_settings, alien_height, ship_height): <NEW_LINE> <INDENT> available_space_y = (game_settings.screen_height - (3 * alien_height) - ship_height) <NEW_LINE> number_rows = int(available_space_y / (2 * alien_height)) <NEW_LINE> return number_rows
Determine the number of alien rows that fit on the screen :rtype: int :param game_settings: :param alien_height: :param ship_height: :return number_rows:
625941c72ae34c7f2600d185
def set_linked_journal_id(self): <NEW_LINE> <INDENT> for record in self: <NEW_LINE> <INDENT> selected_journal = record.linked_journal_id <NEW_LINE> if record.num_journals_without_account == 0: <NEW_LINE> <INDENT> company = self.env.company <NEW_LINE> selected_journal = self.env['account.journal'].create({ 'name': recor...
Called when saving the wizard.
625941c78e05c05ec3eea3c7
def network_run(args, platform, version, config): <NEW_LINE> <INDENT> core_ci = AnsibleCoreCI(args, platform, version, stage=args.remote_stage, provider=args.remote_provider, load=False) <NEW_LINE> core_ci.load(config) <NEW_LINE> core_ci.wait() <NEW_LINE> manage = ManageNetworkCI(args, core_ci) <NEW_LINE> manage.wait()...
:type args: NetworkIntegrationConfig :type platform: str :type version: str :type config: dict[str, str] :rtype: AnsibleCoreCI
625941c7b57a9660fec338d7
def list_resource_types(self, ctxt): <NEW_LINE> <INDENT> return self.call(ctxt, self.make_msg('list_resource_types'), topic=_engine_topic(self.topic, ctxt, None))
Get a list of valid resource types. :param ctxt: RPC context.
625941c7f8510a7c17cf9750
def check_func_status(self, function, namespace, timeout=30): <NEW_LINE> <INDENT> status = '' <NEW_LINE> while (True): <NEW_LINE> <INDENT> if timeout == 0: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> funcJsonStr = ScfClient(self.region).get_function(function, namespace) <NEW_LINE> if funcJsonStr == None: <NEW_LINE> <...
:param timeout: check function status timeout :return 0 status normal 1 status can't update 2 function not found
625941c71f5feb6acb0c4ba6
def _Remap(self, x, x0, x1, y0, y1): <NEW_LINE> <INDENT> return y0 + (x - x0) * float(y1 - y0)/(x1 - x0)
Linearly map from [x0, x1] unto [y0, y1].
625941c723849d37ff7b30e4
def get_info(self): <NEW_LINE> <INDENT> return {'type': 'MITREAttack', 'attack_tactic': self.rule['attack_tactic'], 'attack_name': self.rule['attack_name'], 'attack_id': self.rule['attack_id']}
This information is logged into ElasticSearch for us to use
625941c78da39b475bd64fc7
def closeEvent(self, event): <NEW_LINE> <INDENT> self.closing = True <NEW_LINE> if hasattr(self,'serversocket'): <NEW_LINE> <INDENT> self.serversocket.close() <NEW_LINE> if hasattr(self,"client1"): <NEW_LINE> <INDENT> self.client1.close() <NEW_LINE> <DEDENT> if hasattr(self,"client2"): <NEW_LINE> <INDENT> self.client2....
Reagiert auf das Close-Event und beendet offene Verbindungen. :param event: :return: None
625941c732920d7e50b28223
def __str__(self): <NEW_LINE> <INDENT> return "Wrong value %r to check against a range." % (self.value)
Typecasting into a string for error output.
625941c796565a6dacc8f71f
def test_fixture_loaded(self): <NEW_LINE> <INDENT> question = Question.objects.get() <NEW_LINE> self.assertEqual( 'What is your favorite color?', question.question_text) <NEW_LINE> self.assertEqual(datetime(1975, 4, 9), question.pub_date) <NEW_LINE> choice = question.choice_set.get() <NEW_LINE> self.assertEqual("Blue."...
Test that fixture was loaded.
625941c7377c676e912721fd