code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
@dev.command() <NEW_LINE> @click.pass_context <NEW_LINE> @click.argument("input", nargs=1, required=True, callback=alias_checker) <NEW_LINE> @click.argument("software", nargs=1, required=False, callback=alias_checker) <NEW_LINE> @click.argument("fp_or_searchkey", nargs=1, required=False, callback=alias_checker) <NEW_LI...
This command can be used to save or search keybindings for different softwares. yoda dev keybindings INPUT[add,search] SOFTWARE_NAME[default: None] FILE_TO_ADD_OR_ACTION_TO_SEARCH[default:None]
625941b12c8b7c6e89b35542
def get_search(): <NEW_LINE> <INDENT> return Search(client)
Returns a search object allowing to perform queries.
625941b1d164cc6175782ac4
def testClosesAutoset(self): <NEW_LINE> <INDENT> s = Survey.objects.create(title=self.t, opens=self.sd) <NEW_LINE> self.assertEqual(s.closes, datetime.date(2010, 1, 4), "closes not autoset to 7 days after opens, expected %s but got %s" % (datetime.date(2010, 1, 4), s.closes))
Tests for the Survey override method
625941b13539df3088e2e0c2
@checkpoint_controller.route('/list-checkpoints/add-checkpoint', methods=['GET', 'POST']) <NEW_LINE> @login_required <NEW_LINE> @required_roles('Mentor') <NEW_LINE> def add_checkpoint(): <NEW_LINE> <INDENT> user = user_session(session['user'], session['type']) <NEW_LINE> if isinstance(user, Mentor): <NEW_LINE> <INDENT>...
GET: returns add assistant formula POST: returns list of assistant with new assistant added
625941b132920d7e50b27f4b
def _make_request(token, method_name, method='get', params=None, files=None, base_url=API_URL): <NEW_LINE> <INDENT> request_url = base_url.format(token, method_name) <NEW_LINE> logger.debug("Request: method={0} url={1} params={2} files={3}".format(method, request_url, params, files)) <NEW_LINE> read_timeout = READ_TIME...
Makes a request to the Telegram API. :param token: The bot's API token. (Created with @BotFather) :param method_name: Name of the API method to be called. (E.g. 'getUpdates') :param method: HTTP method to be used. Defaults to 'get'. :param params: Optional parameters. Should be a dictionary with key-value pairs. :param...
625941b1e5267d203edcda20
def dot_product(self, o): <NEW_LINE> <INDENT> return self.x * o.x + self.y * o.y
Returns the dot product of vectors self and o
625941b1d7e4931a7ee9dc9b
def _domain_event_tray_change_cb(conn, domain, dev, reason, opaque): <NEW_LINE> <INDENT> _salt_send_domain_event( opaque, conn, domain, opaque["event"], { "dev": dev, "reason": _get_libvirt_enum_string("VIR_DOMAIN_EVENT_TRAY_CHANGE_", reason), }, )
Domain tray change events handler
625941b182261d6c526ab21b
def __add__(self, other): <NEW_LINE> <INDENT> newRect = RECT() <NEW_LINE> newRect.left = self.left + other.left <NEW_LINE> newRect.right = self.right + other.left <NEW_LINE> newRect.top = self.top + other.top <NEW_LINE> newRect.bottom = self.bottom + other.top <NEW_LINE> return newRect
Allow two rects to be added using +
625941b1e8904600ed9f1ca1
def build_menu(self): <NEW_LINE> <INDENT> self.menu = Menu(self)
Create a new instance of the menu widget
625941b1be7bc26dc91cd385
def get_deposit_spend_secret_hash(script_hex): <NEW_LINE> <INDENT> validate_deposit_script(script_hex) <NEW_LINE> opcode, data, disassembled = get_word(h2b(script_hex), 9) <NEW_LINE> return b2h(data)
Return spend secret hash for given deposit script.
625941b1d486a94d0b98dec8
def fail(self, text="FAIL"): <NEW_LINE> <INDENT> _text = text if text else "FAIL" <NEW_LINE> self._freeze(_text)
Set fail finalizer to a spinner.
625941b16aa9bd52df036b19
def format_error(msg) -> str: <NEW_LINE> <INDENT> return f":x: **{msg}**"
Command error format for user.
625941b13317a56b869399e4
def run(self): <NEW_LINE> <INDENT> suspended = False <NEW_LINE> if self._dbus_interface is None: <NEW_LINE> <INDENT> time.sleep(2) <NEW_LINE> self.load_dbus() <NEW_LINE> <DEDENT> while not self._shutdown: <NEW_LINE> <INDENT> if self._active: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if self._dbus_interface is None: ...
Thread run loop
625941b185dfad0860c3abd8
def fit(self,X,y): <NEW_LINE> <INDENT> weight = np.ones(X.shape[0]) / float(X.shape[0]) <NEW_LINE> for i in range(self.n_weakers_limit): <NEW_LINE> <INDENT> clf = DecisionTreeClassifier(max_depth=5) <NEW_LINE> self.weak_classifier_sets.append(clf.fit(X,y,sample_weight=weight)) <NEW_LINE> y_calcu = self.weak_classifier_...
Build a boosted classifier from the training set (X, y). Args: X: An ndarray indicating the samples to be trained, which shape should be (n_samples,n_features). y: An ndarray indicating the ground-truth labels correspond to X, which shape should be (n_samples,1).
625941b173bcbd0ca4b2bdf5
def test_host_is_a_url(self): <NEW_LINE> <INDENT> with self.assertRaises(SystemExit) as cm: <NEW_LINE> <INDENT> APIDownload(credentials={}, host='www.1') <NEW_LINE> <DEDENT> error_msg = 'The variable host is not a valid URL e.g: "http://apidomain.com"' <NEW_LINE> self.assertEqual(cm.exception.args[0].msg, error_msg)
The host must be a URL
625941b131939e2706e4cbf2
def openDb(connDetails:str): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> cnxn = pyodbc.connect(co.deobfuscate(connDetails)) <NEW_LINE> <DEDENT> except Exception as ex: <NEW_LINE> <INDENT> logging.error("Cannot connect to the Database - please check database connection details.") <NEW_LINE> logging.error(ex) <NEW_LINE>...
This function opens the connection to the Database Input: - connDetails: connection string for pyodbc in a safe way, i.e. with try except mechanism Output: - cnxn: output of pyodbc.connect
625941b18e71fb1e9831d52e
def __init__(self): <NEW_LINE> <INDENT> self.context = None <NEW_LINE> self.daemonize = 0 <NEW_LINE> self.pmconfig = pmconfig.pmConfig(self) <NEW_LINE> self.opts = self.options() <NEW_LINE> self.keys = ('source', 'output', 'derived', 'header', 'globals', 'samples', 'interval', 'type', 'precision', 'daemonize', 'influx_...
Construct object, prepare for command line handling
625941b16fece00bbac2d4b3
@commands.command("alarm-volume") <NEW_LINE> @click.argument("host", required=1) <NEW_LINE> @click.option("--mode", "-M", type=str, required=1, help="'get' or 'set'") <NEW_LINE> @click.option("--volume", "-V", type=float) <NEW_LINE> def alarm_volume(host, mode, volume=None): <NEW_LINE> <INDENT> import googledevices.cli...
Get or set alarm volume.
625941b17047854f462a118d
def stuff(): <NEW_LINE> <INDENT> return dict()
I am not doing anything here. Look elsewhere.
625941b1de87d2750b85fb06
def list_pending(): <NEW_LINE> <INDENT> return pisi.db.installdb.InstallDB().list_pending()
Return a list of configuration pending packages -> list_of_strings
625941b167a9b606de4a7c3d
def __call__(self): <NEW_LINE> <INDENT> return self
python.org: Protocol factory callable returning a protocol implementation. :since: v1.0.0
625941b1b545ff76a8913b9a
def difference(self, E): <NEW_LINE> <INDENT> if not isinstance(E, DictSet): <NEW_LINE> <INDENT> E = DictSet(copy(E)) <NEW_LINE> <DEDENT> foo = deepcopy(self) <NEW_LINE> for k in set(foo.keys()) | set(E.keys()): <NEW_LINE> <INDENT> foo.setdefault(k, []) <NEW_LINE> foo[k].difference_update(E.get(k, [])) <NEW_LINE> if not...
Return the difference of the sets of self with the sets of E. (i.e. all elements that are in the sets of this DictSet but not the others.) DS-E <==> DS.difference(E)
625941b1462c4b4f79d1d44e
def clean(self, value): <NEW_LINE> <INDENT> clean_data = [] <NEW_LINE> errors = ErrorList() <NEW_LINE> if not value or isinstance(value, (list, tuple)): <NEW_LINE> <INDENT> if not value or not [v for v in value if v not in validators.EMPTY_VALUES]: <NEW_LINE> <INDENT> if self.required: <NEW_LINE> <INDENT> raise Validat...
Only the default language should be required.
625941b166673b3332b91e0f
def high_change3(dic, num): <NEW_LINE> <INDENT> life_list = [dic[i].loc[dic[i].index[-1], 't1'] for i in range(len(dic)-1)] <NEW_LINE> sorted_nums = sorted(enumerate(life_list), key=lambda x: x[1]) <NEW_LINE> df = pd.DataFrame(sorted_nums, columns=['idx', 'num']) <NEW_LINE> num_machine = len(dic)-1 <NEW_LINE> idx_start...
策略3:停掉运行时间处于中间的num台高压泵 params: dic:记录设备运行信息的字典,可变 num:需要停掉的设备数目 return: idx:num个需要停机的设备的编号
625941b1e8904600ed9f1ca2
def getDiskInfo(): <NEW_LINE> <INDENT> disk_list = [] <NEW_LINE> all_total = 0 <NEW_LINE> used_total = 0 <NEW_LINE> for part in psutil.disk_partitions(all=False): <NEW_LINE> <INDENT> if 'cdrom' in part.opts or part.fstype == '': <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> mount_point = part.mountpoint <NEW_LINE> u...
disk_partitions() : 파티션 나뉘어져 있는 디스크 정보 리스트를 반환 disk_usage(path) : path의 용량 정보들을 튜플형태로 반환
625941b126238365f5f0ebea
def __del__(self): <NEW_LINE> <INDENT> self.wavFile.close() <NEW_LINE> self.asFile.close()
Close the file objects opened at creation.
625941b1460517430c393f13
def _get_fields(feature): <NEW_LINE> <INDENT> fields = {} <NEW_LINE> for i in xrange(feature.GetFieldCount()): <NEW_LINE> <INDENT> field_def = feature.GetFieldDefnRef(i) <NEW_LINE> name = field_def.GetName().lower() <NEW_LINE> value = feature.GetField(i) <NEW_LINE> fields[name] = value <NEW_LINE> <DEDENT> return fields
Return a dict with all fields in the given feature. feature - an OGR feature. Returns an assembled python dict with a mapping of fieldname -> fieldvalue
625941b1097d151d1a222bdd
def __init__(self, OF, c_name): <NEW_LINE> <INDENT> assert isinstance(OF, LowLevelType) <NEW_LINE> if isinstance(OF, Typedef): <NEW_LINE> <INDENT> OF = OF.OF <NEW_LINE> <DEDENT> self.OF = OF <NEW_LINE> self.c_name = c_name
@param OF: the equivalent rffi type @param c_name: the name we want in C code
625941b1d8ef3951e32432b7
def test_reversed_coordinates(): <NEW_LINE> <INDENT> N = 20 <NEW_LINE> s = xr.DataArray( np.random.rand(N) + 1j * np.random.rand(N), dims="x", coords={"x": np.arange(N // 2, -N // 2, -1) + 2}, ) <NEW_LINE> s2 = s.sortby("x") <NEW_LINE> xrt.assert_allclose( xrft.dft(s, dim="x", true_phase=True), xrft.dft(s2, dim="x", tr...
Reversed coordinates should not impact dft with true_phase = True
625941b10a50d4780f666c0d
def found_terminator(self): <NEW_LINE> <INDENT> self.log.debug('>> ' + self._inbuf) <NEW_LINE> self._inbuf.extend(b'\r\n') <NEW_LINE> try: <NEW_LINE> <INDENT> msg = IRCMessage(str(self._inbuf)) <NEW_LINE> <DEDENT> except IRCError as error: <NEW_LINE> <INDENT> self.log.error("Invalid IRC Message") <NEW_LINE> self.log.de...
asynchat connection handler. Internal.
625941b1b7558d58953c4c9d
def cellnormals(surface): <NEW_LINE> <INDENT> normals = vtk.vtkPolyDataNormals() <NEW_LINE> normals.SetInput(surface) <NEW_LINE> normals.ComputePointNormalsOff() <NEW_LINE> normals.ComputeCellNormalsOn() <NEW_LINE> normals.Update() <NEW_LINE> return normals.GetOutput()
Add cell normals.
625941b176d4e153a657e8a9
def test_validate_activatable(): <NEW_LINE> <INDENT> base = ActivateEnvBase() <NEW_LINE> base.validate_activatable() <NEW_LINE> os.environ['AIIDA_PROJECT_ACTIVE'] = 'a_loaded_project' <NEW_LINE> with pytest.raises(Exception) as exception: <NEW_LINE> <INDENT> base.validate_activatable() <NEW_LINE> <DEDENT> assert "needs...
Check that we only activate if no another project is active
625941b18e7ae83300e4ad4d
def _activation_summary(tensor): <NEW_LINE> <INDENT> tf.summary.histogram(tensor.op.name + '/activations', tensor) <NEW_LINE> tf.summary.scalar(tensor.op.name + '/sparsity', tf.nn.zero_fraction(tensor))
Create summaries for a given tensor. Args: tensor: a tf.Tensor. Returns: None.
625941b13317a56b869399e6
def ls(self, count = 200): <NEW_LINE> <INDENT> return self._manager.ls_notes(self['id'], count)
list all notes in this notebook
625941b123849d37ff7b2e14
def savehistory(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if self.searchquery.text().isEmpty(): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> elif unicode(self.searchquery.text()) in self.history: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if len(self.history) > 10: <NEW_LINE> <INDENT> self.h...
Will be done everytime when "OK" is klicked and the browser is opened Is saving the last 10 entered searchstring. :return: True or False
625941b1adb09d7d5db6c516
def update(self): <NEW_LINE> <INDENT> self.json = c.get_document(self.uri.did).json() <NEW_LINE> self.e_list = c.element_list(self.uri.as_dict()).json()
All client calls to update this instance with Onshape.
625941b1f9cc0f698b140381
def _cast_value(self, value): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> value = int(value) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> if value.lower().strip() in ["true", "t", "1", "yes"]: <NEW_LINE> <INDENT> value = True <NEW_LINE> <DEDENT> elif value.lower().strip() in ["false", "f", "no", "0"]: <N...
Soportados: int, bool, str
625941b145492302aab5e040
def ReorderPageSet(self, results_file): <NEW_LINE> <INDENT> page_set_dict = {} <NEW_LINE> for page in self.user_stories: <NEW_LINE> <INDENT> page_set_dict[page.url] = page <NEW_LINE> <DEDENT> user_stories = [] <NEW_LINE> with open(results_file, 'rb') as csv_file: <NEW_LINE> <INDENT> csv_reader = csv.reader(csv_file) <N...
Reorders this page set based on the results of a past run.
625941b163b5f9789fde6e61
def gen_logger(logger_name: str = None) -> logging.Logger: <NEW_LINE> <INDENT> logger = logging.getLogger(str(random.random())) <NEW_LINE> logger.setLevel(logging.DEBUG) <NEW_LINE> logger.name = logger_name <NEW_LINE> if logger_name is None: <NEW_LINE> <INDENT> formatter = logging.Formatter('[%(asctime)s] [%(levelname)...
generate logger by Python standard library `logging` todo add other handlers Notes: 1. recommend a third-party module `loguru`, more powerful and pleasant
625941b1de87d2750b85fb07
def extract_quotes(html: str = HTML) -> dict: <NEW_LINE> <INDENT> quotes = re.findall(r"<p>(.*\"(.*)\" - (.*)\"?)<\/p>", html) <NEW_LINE> return {quote[2].strip(): quote[1].strip() for quote in quotes}
See instructions in the Bite description
625941b13c8af77a43ae3522
def times_to_intervals(simulation_times): <NEW_LINE> <INDENT> intervals = [] <NEW_LINE> for i, time in enumerate(simulation_times): <NEW_LINE> <INDENT> if i < len(simulation_times) - 1: <NEW_LINE> <INDENT> interval = (time, simulation_times[i + 1]) <NEW_LINE> intervals.append(interval) <NEW_LINE> <DEDENT> <DEDENT> retu...
>>> times_to_intervals([0, 4, 5, 8, 9, 12]) [(0, 4), (4, 5), (5, 8), (8, 9), (9, 12)]
625941b130bbd722463cbb45
def begin_create_or_update( self, resource_group_name, virtual_hub_name, route_table_name, virtual_hub_route_table_v2_parameters, **kwargs ): <NEW_LINE> <INDENT> polling = kwargs.pop('polling', True) <NEW_LINE> cls = kwargs.pop('cls', None) <NEW_LINE> lro_delay = kwargs.pop( 'polling_interval', self._config.polling_int...
Creates a VirtualHubRouteTableV2 resource if it doesn't exist else updates the existing VirtualHubRouteTableV2. :param resource_group_name: The resource group name of the VirtualHub. :type resource_group_name: str :param virtual_hub_name: The name of the VirtualHub. :type virtual_hub_name: str :param route_table_name:...
625941b192d797404e303f0d
def execute(self, loadbalancer, listeners): <NEW_LINE> <INDENT> LOG.debug("Mark ACTIVE in DB for load balancer id: %s " "and listener ids: %s", loadbalancer.id, ', '.join([l.id for l in listeners])) <NEW_LINE> self.loadbalancer_repo.update(db_apis.get_session(), loadbalancer.id, provisioning_status=constants.ACTIVE) <N...
Mark the load balancer and listeners as active in DB. :param loadbalancer: Load balancer object to be updated :param listeners: Listener objects to be updated :returns: None
625941b1b545ff76a8913b9c
def processor_affinity(self): <NEW_LINE> <INDENT> return _blocks_swig2.abs_ff_sptr_processor_affinity(self)
processor_affinity(abs_ff_sptr self) -> std::vector< int,std::allocator< int > >
625941b121a7993f00bc7a69
def _auto_progress_api(api, interval=0.2): <NEW_LINE> <INDENT> with suppress(BaseFakeAPI.NoMoreStatesError): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> time.sleep(interval) <NEW_LINE> api.progress()
Progress a `BaseFakeAPI` instacn every `interval` seconds until reaching the final state.
625941b1462c4b4f79d1d44f
def set_request_uri(self, uri): <NEW_LINE> <INDENT> parsed = urllib.parse.urlparse(uri, allow_fragments=False) <NEW_LINE> if parsed.scheme != 'coap': <NEW_LINE> <INDENT> self.opt.proxy_uri = uri <NEW_LINE> return <NEW_LINE> <DEDENT> if parsed.username or parsed.password: <NEW_LINE> <INDENT> raise ValueError("User name ...
Parse a given URI into the uri_* fields of the options. The remote does not get set automatically; instead, the remote data is stored in the uri_host and uri_port options. That is because name resolution is coupled with network specifics the protocol will know better by the time the message is sent. Whatever sends the...
625941b1507cdc57c6306a4d
def fn_float16(self, value): <NEW_LINE> <INDENT> if is_ndarray(value) or isinstance(value, (list, tuple)): <NEW_LINE> <INDENT> return self._to_ndarray(value).astype('float16') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return float(value)
Return the value cast to a 16-bit float (numpy array) or a Python float (single value). :param value: The number. :return: The number as a float.
625941b13539df3088e2e0c6
def _get_page(self, url: str) -> str: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> response = requests.get(url, timeout=15, headers=self.HEADERS) <NEW_LINE> response.raise_for_status() <NEW_LINE> if 'Проверка, что Вы не робот' in response.text: <NEW_LINE> <INDENT> logger.warning(f'CAPCHA...
Скачивает html страницу по заданному url
625941b1d164cc6175782ac9
def to_dict(self): <NEW_LINE> <INDENT> d = {'accepted': self.accepted} <NEW_LINE> if not self.accepted and bool(self.rejection_reason): <NEW_LINE> <INDENT> d['rejection_reason'] = self.rejection_reason <NEW_LINE> <DEDENT> d['verified_identity'] = self.identity.to_dict() <NEW_LINE> d['expiration_date'] = self.expiration...
convert object to dict
625941b126238365f5f0ebec
def text_from_html(html): <NEW_LINE> <INDENT> parser = _GetText() <NEW_LINE> parser.feed(html) <NEW_LINE> return "".join(parser.texts)
text = text_from_html(html) Gets the text from the HTML representation Parameters ---------- html : str or unicode HTML Representation Returns ------- text : str or unicode Just the textual content of `html`
625941b182261d6c526ab21f
def load_model(self, filepath): <NEW_LINE> <INDENT> f = open(filepath, "r") <NEW_LINE> lines = f.readlines() <NEW_LINE> self.vcnt, bicnt = map(int, lines[0].split()) <NEW_LINE> for i in xrange(1, self.vcnt+1): <NEW_LINE> <INDENT> word, cnt = lines[i].split() <NEW_LINE> self.unigramdict[word] = float(cnt) <NEW_LINE> <DE...
load the model defined in save_model
625941b18e05c05ec3eea0f3
def check_turned_away_face_from_plane(face,plane_normal,sign = 1.0, local_sys = None, strict = False): <NEW_LINE> <INDENT> if local_sys is None: <NEW_LINE> <INDENT> if strict: <NEW_LINE> <INDENT> if sign*inner_product(face.getNormal(),plane_normal) > 0.0: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_L...
Definition: A face is called turned away from a plane iff <n_p,n_f(x)> >= 0 for all x in the face, where n_p is the normal of the plane, and n_f(x) the normal of the face in a point x. Analogously: A face is called strictly turned away iff <n_p,n_f(x)> >...
625941b1627d3e7fe0d68bca
def scoring(machine, strand): <NEW_LINE> <INDENT> score = sum(machine.consume(char) for char in strand) <NEW_LINE> machine.reset() <NEW_LINE> return score
the total score produced by running `strand` through `machine`
625941b1d486a94d0b98decc
def _linear_learning_rate(num_linear_feature_columns): <NEW_LINE> <INDENT> default_learning_rate = 1. / math.sqrt(num_linear_feature_columns) <NEW_LINE> return min(_LINEAR_LEARNING_RATE, default_learning_rate)
Returns the default learning rate of the linear model. The calculation is a historical artifact of this initial implementation, but has proven a reasonable choice. Args: num_linear_feature_columns: The number of feature columns of the linear model. Returns: A float.
625941b1099cdd3c635f09e1
def disable_sel_expired(modeladmin, request, queryset): <NEW_LINE> <INDENT> querylen = len(queryset) <NEW_LINE> discnt = disable_expired(queryset) <NEW_LINE> pstr = plural(querylen, 'paste') <NEW_LINE> msg = 'Disabled {} of {} selected {}.'.format(discnt, querylen, pstr) <NEW_LINE> modeladmin.message_user(request, msg,...
Disable selected expired pastes.
625941b16aa9bd52df036b1e
def get_scale(x): <NEW_LINE> <INDENT> scales = [20, 50, 100, 200, 400, 600, 800, 1000] <NEW_LINE> for scale in scales: <NEW_LINE> <INDENT> if x <= scale: <NEW_LINE> <INDENT> return scale <NEW_LINE> <DEDENT> <DEDENT> return x
Finds the lowest scale where x <= scale.
625941b123849d37ff7b2e16
def control(z, z_target, ctrl, t=None, w=None, f=None): <NEW_LINE> <INDENT> z_t = z_target(t) <NEW_LINE> dz_t = (z_target(t+.05)-z_target(t-.05))/.1 <NEW_LINE> d2z_t = (z_target(t+.05)-2.*z_target(t)+z_target(t-.05))/.05**2 <NEW_LINE> if ctrl['mode'] is 'sliding': <NEW_LINE> <INDENT> x2 = w <NEW_LINE> f2 = f._f(z, ctrl...
Implements the control of the float position
625941b1b57a9660fec335fb
def frustumShellVol(rb_0, rt_0, t, h, diamFlag=False): <NEW_LINE> <INDENT> if diamFlag: <NEW_LINE> <INDENT> rb, rt = 0.5 * rb_0, 0.5 * rt_0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> rb, rt = rb_0, rt_0 <NEW_LINE> <DEDENT> rb_o = rb <NEW_LINE> rb_i = rb - t <NEW_LINE> rt_o = rt <NEW_LINE> rt_i = rt - t <NEW_LINE> re...
This function returns a frustum shell's volume (for computing mass with density) with radii or diameter inputs. NOTE: This is for a frustum SHELL, not a solid INPUTS: Parameters ---------- rb : float (scalar/vector), base radius rt : float (scalar/vector), top radius t : float (scalar/vector), thickness h : float...
625941b17c178a314d6ef1d5
def parse_data(data_file): <NEW_LINE> <INDENT> csvfile = open(data_file, 'r') <NEW_LINE> csvreader = csv.reader(csvfile) <NEW_LINE> key_url_list = {line[0]: line[1] for line in csvreader} <NEW_LINE> return key_url_list
read index files
625941b10c0af96317bb7f6d
def close(self): <NEW_LINE> <INDENT> if not self.bng: <NEW_LINE> <INDENT> raise BNGError('Scenario needs to be loaded into a BeamNGpy ' 'instance to be stopped.') <NEW_LINE> <DEDENT> for vehicle in self.vehicles: <NEW_LINE> <INDENT> vehicle.close() <NEW_LINE> <DEDENT> self.bng = None <NEW_LINE> self.logger.debug('Remov...
Closes open connections and allocations of the scenario.
625941b173bcbd0ca4b2bdf9
def _validate_scalarization_parameter_shape( multi_objectives: tf.Tensor, params: Dict[str, Union[Sequence[ScalarFloat], tf.Tensor]]): <NEW_LINE> <INDENT> for param_name, param_value in params.items(): <NEW_LINE> <INDENT> param_shape = tf.convert_to_tensor(param_value).shape <NEW_LINE> if param_shape.rank != 1 and not ...
A private helper that validates the shapes of scalarization parameters. Every scalarization parameter in the input dictionary is either a 1-D tensor or `Sequence`, or a tensor whose shape matches the shape of the input `multi_objectives` tensor. This is invoked by the `Scalarizer.call` method. Args: multi_objective...
625941b145492302aab5e041
def test_normal_gpu(self): <NEW_LINE> <INDENT> self.yaml_config_name = sys._getframe().f_code.co_name + '.yaml' <NEW_LINE> self.yaml_content["runner"][0]["device"] = 'gpu' <NEW_LINE> self.run_yaml() <NEW_LINE> built_in.equals(self.pro.returncode, 0, self.err_msg) <NEW_LINE> built_in.not_contains(self.err, 'Traceback', ...
test normal yaml construct by RankDNN base in gpu.
625941b14f6381625f1147c3
def calc_slope_distance_ver_lines(mat, ratio=0.3, search_range=30.0, radius=9, sensitive=0.1, bgr="bright", denoise=True, norm=True, subpixel=True): <NEW_LINE> <INDENT> if denoise is True: <NEW_LINE> <INDENT> mat = ndi.gaussian_filter(mat, 3) <NEW_LINE> <DEDENT> mat_roi = prep._select_roi(mat, ratio, square=True) <NEW_...
Calculate the representative distance between vertical lines and the representative slope of these lines using the ROI around the middle of a line-pattern image. Parameters ---------- mat : array_like 2D array. ratio : float Used to select the ROI around the middle of an image. search_range : float Search ...
625941b12c8b7c6e89b35548
def setShowPercentTextFlag(self, flag): <NEW_LINE> <INDENT> self.showPercentText = flag
Sets the flag that indicates that the text for the percent should be displayed.
625941b1293b9510aa2c3017
def _get_client(self): <NEW_LINE> <INDENT> url = "http://10.182.155.37/UserAuthentication.asmx?WSDL" <NEW_LINE> client = Client(url) <NEW_LINE> return client
contacts the webservice and gets a client with suds :return: client object
625941b130bbd722463cbb47
def weights_from_rewards(self, rewards): <NEW_LINE> <INDENT> return reps_weights_from_rewards(rewards, self.rel_entropy_bound, self.min_temperature)
Wrapper function for reps_weights_from_rewards
625941b18a43f66fc4b53def
def _ws_data(self, ws): <NEW_LINE> <INDENT> data = {'obj': ws, 'id': ws.id, 'url': ws.absolute_url(), 'template_title': ws.getWorksheetTemplateTitle(), 'remarks': ws.getRemarks(), 'date_printed': self.ulocalized_time(DateTime(), long_format=1), 'date_created': self.ulocalized_time(ws.created(), long_format=1)} <NEW_LIN...
Creates an ws dict, accessible from the view and from each specific template. Keys: obj, id, url, template_title, remarks, date_printed, ars, createdby, analyst, printedby, analyses_titles, portal, laboratory
625941b10a366e3fb873e593
def build(self, baserepo=None, ref=None, baseconfig=None, message_id=None, subject=None, emails=set(), patch_url_list=[], makeopts=None): <NEW_LINE> <INDENT> params = dict() <NEW_LINE> if baserepo is not None: <NEW_LINE> <INDENT> params["baserepo"] = baserepo <NEW_LINE> <DEDENT> if ref is not None: <NEW_LINE> <INDENT> ...
Submit a build of a patch series. Args: baserepo: Baseline Git repo URL. ref: Baseline Git reference to test. baseconfig: Kernel configuration URL. message_id: Value of the "Message-Id" header of the e-mail message representing the series, or None if ...
625941b126238365f5f0ebee
def addLookAt(self, geoPoint): <NEW_LINE> <INDENT> self.checkAnd() <NEW_LINE> self._requestString += ("lookat=" + str(geoPoint)) <NEW_LINE> return self
Добавляет параметр поиска по изображениям, направленных в направлении указанной точки Не имеет смысла без использования addCloseTo(geoPoint) или addBbox(geoMin, geoMax) :param: geoPoint - объект типа model.GeoPoint, указывающий точку, на которую должны быть направлены изображения из ответа
625941b115baa723493c3cf6
def create(self): <NEW_LINE> <INDENT> genes = [] <NEW_LINE> u_bounds = [] <NEW_LINE> l_bounds = [] <NEW_LINE> for i in range(self.n_ins, self.n_ins + self.n_fun_nodes): <NEW_LINE> <INDENT> upper_bound = self.n_funs - 1 <NEW_LINE> lower_bound = 0 <NEW_LINE> function_gene = randint(0, upper_bound) <NEW_LINE> genes.append...
Create an individual primitives Returns ------- tuple tuple holding list of genes and list of bounds
625941b1cdde0d52a9e52db3
def parseRules(self, rule_tuple): <NEW_LINE> <INDENT> valid_rule = re.compile("^[a-z]+\*?\d[a-z]*[>\.]?$") <NEW_LINE> self.rule_dictionary = {} <NEW_LINE> for rule in rule_tuple: <NEW_LINE> <INDENT> if not valid_rule.match(rule): <NEW_LINE> <INDENT> raise ValueError("The rule {0} is invalid".format(rule)) <NEW_LINE> <D...
Validate the set of rules used in this stemmer.
625941b191af0d3eaac9b796
def tertiary_semclass1(self): <NEW_LINE> <INDENT> vals = self.semclass1_values() <NEW_LINE> if len(vals) >= 3: <NEW_LINE> <INDENT> return vals[2] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return None
ConnHeadSemClass1 has fields separated by dots. This function returns the third (as a str) if there is one, else None. Values (except None): Chosen alternative, Conjunctive, Contra-expectation, Disjunctive, Equivalence, Expectation, Factual past, Factual present, General, Generalization, Hypothetical, Implicit assert...
625941b14a966d76dd550d8f
def __init__(self, addr=None, dev_cat=None, sub_cat=None, firmware=None, is_ack=None): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.addr = addr <NEW_LINE> self.dev_cat = dev_cat <NEW_LINE> self.sub_cat = sub_cat <NEW_LINE> self.firmware = firmware <NEW_LINE> self.is_ack = is_ack
Constructor Args: is_ack (bool): True for ACK, False for NAK. None for output commands to the modem.
625941b1e5267d203edcda27
def mouseDoubleClickEvent(self, event): <NEW_LINE> <INDENT> super(XNodeScene, self).mouseDoubleClickEvent(event) <NEW_LINE> if event.button() == Qt.LeftButton: <NEW_LINE> <INDENT> item = self.itemAt(event.scenePos()) <NEW_LINE> if not item: <NEW_LINE> <INDENT> self.clearSelection() <NEW_LINE> <DEDENT> else: <NEW_LINE> ...
Emits the node double clicked event when a node is double clicked. :param event | <QMouseDoubleClickEvent>
625941b16aa9bd52df036b20
def __init__(self, n: int): <NEW_LINE> <INDENT> super(DiscreteConjunctionsCounter, self).__init__(n) <NEW_LINE> self.n = n
Initializes the object that counts all possible discrete conjunctions over the finite chain Ln. Args: n: An integer, representing the dimension of the finite chain.
625941b10383005118ecf363
def initialize_agents(config): <NEW_LINE> <INDENT> buyer_prices = [np.arange(config.lowprice, get_random_high_buyer(config.lowprice, config.highprice), .50) for _ in range(config.nbuyers)] <NEW_LINE> seller_prices = [np.arange(get_random_low_seller(config.lowprice, config.highprice), config.highprice + .5, .50) for _ i...
Initializes agents using the config files. Does 2 things: Makes a list of buyers, all buyers have a random price range from (lowest - random number) Makes a list of sellers, all sellers have a random price range from (random number - highest)
625941b185dfad0860c3abdc
def kidFile(): <NEW_LINE> <INDENT> from os import path as osp <NEW_LINE> from lib.KidDir import KidFile <NEW_LINE> PATH = osp.dirname(osp.abspath(__file__)) <NEW_LINE> FIRST = 'kidFile' <NEW_LINE> SECONDE = 'codeVs.py' <NEW_LINE> THIRD = '.docker' <NEW_LINE> FOUR = '.docker.png' <NEW_LINE> path1 = osp.join(PATH,FIRST)...
KidFile
625941b1711fe17d825420fb
@registry.register_hparams <NEW_LINE> def basic_conv_l1(): <NEW_LINE> <INDENT> hparams = basic_conv() <NEW_LINE> hparams.target_modality = "video:l1" <NEW_LINE> hparams.video_modality_loss_cutoff = 3.0 <NEW_LINE> return hparams
Basic conv model with L1 modality.
625941b1b5575c28eb68dd7b
def webmks(request): <NEW_LINE> <INDENT> vm_name = request.GET.get("url") <NEW_LINE> weburl = get_webmks_url(vm_name) <NEW_LINE> if weburl == 0: <NEW_LINE> <INDENT> return HttpResponse("Server is not powerOn!") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> url = { 'weburl':weburl } <NEW_LINE> return render(request, 'we...
vmware vsphere virtual machine web console
625941b1f9cc0f698b140385
def find_missing_images_in_es_via_swift(es, days): <NEW_LINE> <INDENT> imageList = get_swift_images(es, days) <NEW_LINE> docs = generate_image_docs(imageList) <NEW_LINE> docsNotFound = {} <NEW_LINE> if len(docs) > 0: <NEW_LINE> <INDENT> response = multi_get_from_es_index(index=os.environ['ES_REGISTRY_INDEX'], doc_type=...
Get the registry Image names that are present in Swift but absent in the registry ES index @return List of image ids
625941b13c8af77a43ae3526
@login_required <NEW_LINE> def admin_moderate_del(request, msg_id): <NEW_LINE> <INDENT> u <NEW_LINE> msg = get_object_or_404(Message, id=msg_id) <NEW_LINE> if request.method == 'POST': <NEW_LINE> <INDENT> form = CauseForm(request.POST) <NEW_LINE> if form.is_valid(): <NEW_LINE> <INDENT> if ( msg.group and msg.group.is_s...
Модерация. Удалить сообщение.
625941b156ac1b37e6263f62
def GetPC(self): <NEW_LINE> <INDENT> return _lldb.SBFrame_GetPC(self)
GetPC(SBFrame self) -> lldb::addr_t
625941b1507cdc57c6306a50
def test_post_ois_data(self, testapp): <NEW_LINE> <INDENT> department = Department.create(name="Good Police Department", short_name="GPD", load_defaults=False) <NEW_LINE> extractor, envs = Extractor.from_department_and_password(department=department, password="password") <NEW_LINE> testapp.authorization = ('Basic', (ex...
New OIS data from the extractor is processed as expected.
625941b166673b3332b91e15
def pushButtonSaveToFileClicked(self): <NEW_LINE> <INDENT> fileDir = self.settings.value('fileDir') or '' <NEW_LINE> file = QtWidgets.QFileDialog.getSaveFileName(self, "Save new Data File", fileDir, 'TreeTime Files (*.trt)')[0] <NEW_LINE> if file != '': <NEW_LINE> <INDENT> self.labelCurrentFile.setText(file) <NEW_LINE>...
Callback for the save-file button. Saves the current data to a new file and keeps that file connected.
625941b11f5feb6acb0c48dc
def get_color(self, key): <NEW_LINE> <INDENT> return Gdk.Color(*self.get_value(key).unpack())
Returns a Gdk.Color using the values from the specified setting, which should be a 3-tuple of RGB values
625941b1d164cc6175782acd
def rvs(self, dim, size=1, random_state=None): <NEW_LINE> <INDENT> random_state = self._get_random_state(random_state) <NEW_LINE> size = int(size) <NEW_LINE> if size > 1: <NEW_LINE> <INDENT> return np.array([self.rvs(dim, size=1, random_state=random_state) for i in range(size)]) <NEW_LINE> <DEDENT> dim = self._process_...
Draw random samples from O(N). Parameters ---------- dim : integer Dimension of rotation space (N). size : integer, optional Number of samples to draw (default 1). Returns ------- rvs : ndarray or scalar Random size N-dimensional matrices, dimension (size, dim, dim)
625941b1d99f1b3c44c67320
def check_packet_record(pckt, data): <NEW_LINE> <INDENT> return (data[DOMAIN_CELL_INDEX] == pckt[DNSQR].qname) and (pckt[DNSQR].qclass is IN_CLASS)
:param pckt: sniffed dns query packet :param data: data line from database dns records :return: boolean value if packet matches line
625941b1956e5f7376d70bfc
def bempp_grid_from_data_set(grid_data_set): <NEW_LINE> <INDENT> from bempp.api import grid_from_element_data <NEW_LINE> return grid_from_element_data(grid_data_set.grid.vertices, grid_data_set.grid.elements, grid_data_set.grid.domain_indices)
Convert a grid data set to Bempp grid.
625941b1627d3e7fe0d68bce
def _build_wsdl_url_from_endpoint(self): <NEW_LINE> <INDENT> raise NotImplementedError
you need to implement this method in subclasses, each service has different wsdl file locations
625941b18e7ae83300e4ad53
def test_manage_snapshot_missing_volume_id(self): <NEW_LINE> <INDENT> body = {'snapshot': {'ref': 'fake_ref'}} <NEW_LINE> res = self._get_resp_post(body) <NEW_LINE> self.assertEqual(HTTPStatus.BAD_REQUEST, res.status_int)
Test correct failure when volume_id is not specified.
625941b1099cdd3c635f09e5
def register(self, account, markup=0.01, **tx_arguments): <NEW_LINE> <INDENT> tx_args = self.tx_arguments(**tx_arguments) <NEW_LINE> account = Web3.toChecksumAddress(account) <NEW_LINE> tx_receipt = self.sc.registerVendor( account, int(markup * self.precision), tx_args) <NEW_LINE> tx_receipt.info() <NEW_LINE> receipt_t...
Allows to register a vendor @param account Vendor address @param markup Markup which vendor will perceive from mint/redeem operations
625941b185dfad0860c3abdd
def finalize_install(): <NEW_LINE> <INDENT> subprocess.call(["rm", "-f", tsconfig.CONFIG_PATH + '/dnsmasq.leases']) <NEW_LINE> console_log("Updating system parameters...") <NEW_LINE> i = 1 <NEW_LINE> system_update = False <NEW_LINE> while i < 10: <NEW_LINE> <INDENT> time.sleep(20) <NEW_LINE> LOG.info("Attempt %d to upd...
Complete the installation
625941b1293b9510aa2c301a
def __init__(self): <NEW_LINE> <INDENT> self._contents = [[Color.Blank for _ in range(Board.SIZE)] for _ in range(Board.SIZE)]
Initialize a blank Board, of size Board.SIZE x Board.SIZE
625941b17c178a314d6ef1d7
def init(args): <NEW_LINE> <INDENT> wm = create_watermark(get_correct_wm(args, __name__.split('.')[-1])) <NEW_LINE> return Lsb(args.bands, args.dest_dir, args.format, wm, args.suffix, args.position)
Returns initialized Lsb (writer) object from arguments passed from command line.
625941b1b5575c28eb68dd7d
def scanfourier(original_image, minimum_intensity_threshold, size_of_scan_box, ring_threshold, rastering_interval, image_crop_factor): <NEW_LINE> <INDENT> cropped_center, minimum_peak_separation_distance, pixel_distances = setup_fourier_scan(image_crop_factor, size_of_scan_box) <NEW_LINE> num_x_rasters = int((original_...
The main loop. Raster over an image and determine whether the subsections are crystalline. :param original_image: The original image to process :param minimum_intensity_threshold: The minimum intensity of a peak in fourier transform :param size_of_scan_box: The size of the region which is Fourier transformed :param rin...
625941b150812a4eaa59c0ab
def start(self): <NEW_LINE> <INDENT> raise NotImplemented
start the task
625941b1adb09d7d5db6c51c
def get_clusters_at(self, level = 0): <NEW_LINE> <INDENT> self.construct_name(force = False) <NEW_LINE> if not hasattr(self,'clusters'): <NEW_LINE> <INDENT> self.clusters = xr.open_dataarray(self.filepath) <NEW_LINE> <DEDENT> if level is not None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return(self.clusters.sel(di...
Method to get the georeferenced cluster array at a certain dissimilarity level If level = None, the cluster dataset is loaded but none are returned. NOTE: Because NA's are probably present, xarray will convert the integer clustid's to the float32 dtype.
625941b145492302aab5e043
def _unstar_repo(owner, repo): <NEW_LINE> <INDENT> api_result = _send_delete_request('https://api.github.com/user/starred/' + owner + '/' + repo, CREDENTIAL) <NEW_LINE> return api_result
you can execute the command like below in your terminal for test(not include prompt symbol '$'): $ curl -i -u "mynameisny" -X DELETE -H "Content-Length: 0" "https://api.github.com/user/starred/ningyu/demo"
625941b131939e2706e4cbfa
def which(program): <NEW_LINE> <INDENT> def _is_exe(fpath): <NEW_LINE> <INDENT> return os.path.isfile(fpath) and os.access(fpath, os.X_OK) <NEW_LINE> <DEDENT> fpath, fname = os.path.split(program) <NEW_LINE> if fpath and _is_exe(program): <NEW_LINE> <INDENT> return program <NEW_LINE> <DEDENT> for path in os.environ['PA...
Get the path of an executable program in the $PATH environment variable :param program: str Name of the executable :return: str Full path to the executable in $PATH or None if not found
625941b16fece00bbac2d4bb
def fontHeight(self, font=None): <NEW_LINE> <INDENT> portsaver = _PortSaver(self) <NEW_LINE> self._prepareToDraw() <NEW_LINE> if font: self._setFont(font) <NEW_LINE> fontinfo = Qd.GetFontInfo() <NEW_LINE> return fontinfo[0] + fontinfo[1] + fontinfo[3]
Find the line height of the given font.
625941b1d8ef3951e32432be