code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def to_png_image_base64( pil_image: Image.Image, png_image_compress_level: int = IMAGE_COMPRESS_LEVEL_PNG, ) -> str: <NEW_LINE> <INDENT> buffer: BytesIO = BytesIO() <NEW_LINE> pil_image.save( buffer, format="PNG", compress_level=png_image_compress_level ) <NEW_LINE> png_image_base64: str = base64.b64encode(buffer.getva...
Convert a PIL image to a PNG image encoded in Base64. Args: pil_image: PIL image Kwargs: png_image_compress_level: PNG image compress level (defaults to 6) Returns: PNG image encoded in Base64
625941f050485f2cf553d332
def _update_DA(self, user_act, user_action, state, DA): <NEW_LINE> <INDENT> intent_type = user_act <NEW_LINE> constraints = state.items() <NEW_LINE> kb_result = self.db.query(constraints) <NEW_LINE> self.kb_result = deepcopy(kb_result) <NEW_LINE> if intent_type == 'request': <NEW_LINE> <INDENT> if ("inform") not in DA:...
Answer user's utterance about any domain other than taxi or train.
625941f021bff66bcd684ee3
def covers(root, p): <NEW_LINE> <INDENT> if not root: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if root == p: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return covers(root.left, p) or covers(root.right, p)
Take O(n) time and O(1) space :param root: Tree Node Root :param p: Tree Node p :return: Result (Whether Root covers p)
625941f030bbd722463cc360
def itkInterpolateImageFilterIF2IF2_cast(*args): <NEW_LINE> <INDENT> return _itkInterpolateImageFilterPython.itkInterpolateImageFilterIF2IF2_cast(*args)
itkInterpolateImageFilterIF2IF2_cast(itkLightObject obj) -> itkInterpolateImageFilterIF2IF2
625941f076d4e153a657f0c8
def resume(self): <NEW_LINE> <INDENT> if self.paused: <NEW_LINE> <INDENT> self.pauseElapsed += time.time() - self.pauseInitTime <NEW_LINE> self.paused = False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print("Warning: Timer.resume() called without prior call to Timer.pause()")
Resumes the timer following call to .pause() method.
625941f0a8ecb033257d3661
def get_usecase_name(self): <NEW_LINE> <INDENT> return self._tc_parameters.get_ucase_name()
Return the name of the use case :rtype: string :return: Return use case name
625941f0a8370b7717052e34
def get_verification_key(self, user_id): <NEW_LINE> <INDENT> with self.engine.begin() as connection: <NEW_LINE> <INDENT> verify_row = connection.execute(cl_user_verification.select().where( cl_user_verification.c.user_id == user_id ).limit(1)).fetchone() <NEW_LINE> if verify_row is None: <NEW_LINE> <INDENT> key = uuid....
Get verification key for given user. If one does not exist yet, create one and return it. Updates the "date_sent" field of the verification key to the current date. :param user_id: id of user to get verification key for :return: verification key, or None if none found for user
625941f08a43f66fc4b545f5
def check_host_name_valid(service_type, host_name): <NEW_LINE> <INDENT> host_obj = None <NEW_LINE> if service_type == "svn": <NEW_LINE> <INDENT> host_obj = SVNHostInfo.objects.using("dtamper_svn_mysql").filter(protect_host_name=host_name).first() <NEW_LINE> <DEDENT> elif service_type == "web": <NEW_LINE> <INDENT> host_...
查询主机是否存在 :param service_type: :param host_name: :return:
625941f073bcbd0ca4b2c60c
def create_database(): <NEW_LINE> <INDENT> new_db = ".\\addresses.csv" <NEW_LINE> if exists(new_db) is False: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> with open(new_db, mode='a', encoding='utf-8', newline='') as db: <NEW_LINE> <INDENT> keys = ['CEP', 'Endereco', 'Numero', 'Bairro', 'UF', 'Cidade', 'Complemento', 'D...
This functions checks if the databse exists in the relative path of the system file. If it doesn't, creates a new csv file with a header in it, if it does, pass to the next instruction. :return: Returns the path to the csv file created or existing.
625941f0d10714528d600280
def __count_ingredients(self, text): <NEW_LINE> <INDENT> text_onegram, text_bigram, text_trigram = self.__get_ngrams(text) <NEW_LINE> food_ingred_counter = {} <NEW_LINE> for ingred_kind in self.food_ingred.keys(): <NEW_LINE> <INDENT> food_ingred_counter[ingred_kind] = [] <NEW_LINE> for ingred in self.food_ingred[ingred...
Count number of each ingredient from food composition Arguments text : str Text of food composition. Returns food_ingred_counter : dict key=ingredient, value=number of appearance Counts of food ingredients
625941f07047854f462a1999
def _handle_auth_msg(self, msg_dict): <NEW_LINE> <INDENT> client_login = msg_dict['user']['login'] <NEW_LINE> client_password = msg_dict['user']['password'] <NEW_LINE> authentication_success = self._db_connection.authenticate_client(client_login, client_password) <NEW_LINE> if authentication_success is True: <NEW_LINE>...
Authenticates client by checking hist account in the database. @param msg_dict: JSON message (dictionary). @return: None.
625941f03eb6a72ae02eca84
def get_sliceinfo(self, force_nonortho_mode: bool = False): <NEW_LINE> <INDENT> dimensions = self.view.data_view.dimensions <NEW_LINE> non_ortho_mode = True if force_nonortho_mode else self.view.data_view.nonorthogonal_mode <NEW_LINE> axes_angles = self.model.get_axes_angles(force_orthogonal=not non_ortho_mode) <NEW_LI...
:param force_nonortho_mode: if True then don't use orthogonal angles even if non_ortho mode == False - this is necessary because when non-ortho view is toggled the data_view is not updated at the point a new SliceInfo is created :return: a SliceInfo object describing the current slice and transform (which by de...
625941f066656f66f7cbc743
def createPlot(inTree): <NEW_LINE> <INDENT> fig = plt.figure(1, facecolor='white') <NEW_LINE> fig.clf() <NEW_LINE> axprops = dict(xticks=[], yticks=[]) <NEW_LINE> createPlot.ax1 = plt.subplot(111, frameon=False, **axprops) <NEW_LINE> plotTree.totalW = float(getNumLeafs(inTree)) <NEW_LINE> plotTree.totalD = float(getTre...
首先创建了一个新图并清空绘图区 然后在绘图区上绘制两个代表不同类型的树节点 :return:
625941f05f7d997b87175033
def test_read_file_returns_bitmap_instance(): <NEW_LINE> <INDENT> assert isinstance(Bitmap.read_file(BMP_FILE_PATH), Bitmap)
"Test that read_file function returns instance of Bitmap.
625941f00383005118ecfb77
def peek_next(self): <NEW_LINE> <INDENT> return self.schedule[0]
See the next scheduled item without removing it. :rtype: (float, ScheduledItem)
625941f0dd821e528d63b73b
def search(self, content_query=None, title_query=None, limit=None, topics=None, author=None, language=None, location=None, pub_start_date=None, pub_end_date=None, source=None, projections=None, timeout=60): <NEW_LINE> <INDENT> res_raw = self.es.search(index="news", timeout=timeout,body={ "size": limit, "_source": self....
Used to search articles stored on ES Args: content_query(str): query term to be used to search html_content title_query(str) [optional]: query term to be used to search title limit(int) [optional]: max number of articles to returna topics(list of str) [optional]: topics that should be associated with the artic...
625941f029b78933be1e5c3b
def appendSection(self, secName, gaugeDev, EVName=None, VVName=None, manifoldName=None, IVName=None, downstreamGVName=None): <NEW_LINE> <INDENT> if downstreamGVName != None: <NEW_LINE> <INDENT> GV2 = SolenoidValve(downstreamGVName) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> GV2 = None <NEW_LINE> <DEDENT> self.VSinde...
a vacuum section must have a vacuum gauge it should either have a set of evacuation/vent valves or be attached to a manifold through a isolation valve vacuum sections in a vacuum systems are continuous, separated by a GV the GV could be None, meaning the sections are effectively separated by a window
625941f0cdde0d52a9e535cf
@app.route("", methods=["GET"]) <NEW_LINE> def get_jobs(): <NEW_LINE> <INDENT> return jsonify({"jobs": [job.to_dict() for job in Job.query.all()]})
Get all registered jobs.
625941f0aad79263cf390fe0
def with_item_icon(self, element): <NEW_LINE> <INDENT> return self.add_element(element, assert_unique=False)
ItemIcon
625941f0d18da76e23532a74
def photo2svg(photo_path, post_id): <NEW_LINE> <INDENT> grayscale: np.ndarray = cv2.imread(photo_path, cv2.IMREAD_REDUCED_GRAYSCALE_2) <NEW_LINE> denoising: np.ndarray = cv2.fastNlMeansDenoising(grayscale) <NEW_LINE> binary, rectangles, binary_rgb = bounding_rectangles(denoising) <NEW_LINE> blank_lines = horizontal_bla...
照片转SVG :param photo_path: 照片文件的路径 :param post_id: 文章ID :param sess: 会话实例 :return: 段落ID
625941f0fbf16365ca6f6767
def check_online_status(): <NEW_LINE> <INDENT> urls = [GITHUB_API_URL + '/rate_limit', GITHUB_URL, GITHUB_API_URL] <NEW_LINE> num_repeats = 6 <NEW_LINE> errors = set() <NEW_LINE> for attempt in range(num_repeats): <NEW_LINE> <INDENT> url = urls[attempt % len(urls)] <NEW_LINE> try: <NEW_LINE> <INDENT> urlopen(url, timeo...
Check whether we currently are online Return True if online, else a list of error messages
625941f057b8e32f52483a35
def z_norm(result): <NEW_LINE> <INDENT> result = (result-min(result))/(max(result)-min(result)) <NEW_LINE> return result
Normalize Data. This fits all values between 0 and 1.
625941f05f7d997b87175034
def full(self): <NEW_LINE> <INDENT> if self.user: <NEW_LINE> <INDENT> if self.resource: <NEW_LINE> <INDENT> return f"{self.user}@{self.host}/{self.resource}" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return f"{self.user}@{self.host}" <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> if self.resource: <NEW_LINE...
Return the string representation of this JID. @rtype: L{str}
625941f07d847024c06be858
def getHEADMATCH(i, j): <NEW_LINE> <INDENT> return (i.head == j.head)
The two mentions have the same head word
625941f08c3a873295158958
def redef(obj, key, value, **kwargs): <NEW_LINE> <INDENT> return Redef(obj, key, value=value, **kwargs)
A static constructor helper function
625941f0a05bb46b383ecdb3
def main(anc, snps_vcf): <NEW_LINE> <INDENT> astates = store_anc(anc) <NEW_LINE> with gzip.open(snps_vcf, 'rt') as f: <NEW_LINE> <INDENT> for line in f: <NEW_LINE> <INDENT> if line.startswith('##'): <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> elif line.startswith('#CHROM'): <NEW_LINE> <INDENT> samples = line.strip...
Main function.
625941f038b623060ff0b384
def __init__(self, dispatcher): <NEW_LINE> <INDENT> self.dispatcher = dispatcher <NEW_LINE> self.configure() <NEW_LINE> attach_subscriptions(self, self.dispatcher)
:param LoggingDispatcher dispatcher:
625941f023849d37ff7b3621
def report(self, item): <NEW_LINE> <INDENT> if not isinstance(item.change.project.source, PagureSource): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if item.change.project.source.connection.canonical_hostname != self.connection.canonical_hostname: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if self...
Report on an event.
625941f0e1aae11d1e74a254
@register.filter <NEW_LINE> def identity(obj): <NEW_LINE> <INDENT> if hasattr(obj, '_concurrencymeta'): <NEW_LINE> <INDENT> return mark_safe("{0},{1}".format(unlocalize(obj.pk), get_revision_of_object(obj))) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return mark_safe(unlocalize(obj.pk))
returns a string representing "<pk>,<version>" of the passed object
625941f04a966d76dd5515ac
def delete(self, id): <NEW_LINE> <INDENT> for i, date in enumerate(self.dates): <NEW_LINE> <INDENT> if date[0] == id: <NEW_LINE> <INDENT> del self.dates[i] <NEW_LINE> self.save() <NEW_LINE> return
:param id: ID de l'event à suppriemr :type id: int
625941f0be383301e01b5a11
def test_default(self, test_csv): <NEW_LINE> <INDENT> init = InitFromCsv(test_csv) <NEW_LINE> cmp = Component('star') <NEW_LINE> cmp.set('v') <NEW_LINE> cmp.set('Teff') <NEW_LINE> init(cmp, 'a.fits') <NEW_LINE> assert 100 == cmp['v'] <NEW_LINE> assert 4800 == cmp['Teff']
Test default behaviour, filling all values from CSV.
625941f05166f23b2e1a56f0
def test_logout(self): <NEW_LINE> <INDENT> re = self.client.get('/logout', follow_redirects=True) <NEW_LINE> self.assertEqual(re.status_code, 200) <NEW_LINE> self.assertTrue("<title>Home</title>" in re.data.decode())
Test static logout view (redirect).
625941f045492302aab5e860
def testCloseCloseThenCloseCloseThenCloseCloseORF(self): <NEW_LINE> <INDENT> read = AARead('id', 'MADR*MAAA*MRRR*') <NEW_LINE> orfs = list(read.ORFs()) <NEW_LINE> self.assertEqual(3, len(orfs)) <NEW_LINE> orf = orfs[0] <NEW_LINE> self.assertEqual('ADR', orf.sequence) <NEW_LINE> self.assertEqual(1, orf.start) <NEW_LINE>...
An AA read that contains an ORF that is left and right closed followed by an internal ORF, followed by an ORF that is left and right closed must have the ORFs detected correctly when its ORFs method is called.
625941f08a43f66fc4b545f6
def get_game(self): <NEW_LINE> <INDENT> return self._game
Returns the current representation of the game string. Returns: (str): The string representation of the game.
625941f0507cdc57c6307280
def setPatientCode(self, patient_code): <NEW_LINE> <INDENT> self.patient_code = patient_code <NEW_LINE> self.update_header()
Sets the patientcode to @patient_code. This function is optional and can be called only after opening a file in writemode and before the first sample write action.
625941f0711fe17d825428f5
def test_non_empty_file(tmpdir): <NEW_LINE> <INDENT> runner = CliRunner() <NEW_LINE> path = tmpdir.join("hello.txt") <NEW_LINE> path.write("content") <NEW_LINE> assert path.read() == "content" <NEW_LINE> result = runner.invoke(cli.main, input=str(path)) <NEW_LINE> assert result.exit_code == 0 <NEW_LINE> assert '7B {}'....
Test file with single word in it.
625941f0293b9510aa2c3827
def color_print(self, message, choice="info"): <NEW_LINE> <INDENT> if choice == "info": <NEW_LINE> <INDENT> print("\033[47;36m %s \033[0m" % message) <NEW_LINE> <DEDENT> elif choice == "error": <NEW_LINE> <INDENT> print("\033[47;31m %s \033[0m" % message)
:param message:<str> 获取输入的信息 :param choice: <str> 选择的颜色种类 :return:
625941f09b70327d1c4e136f
def serialize(self, buff): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> _x = self.parent_name <NEW_LINE> length = len(_x) <NEW_LINE> if python3 or type(_x) == unicode: <NEW_LINE> <INDENT> _x = _x.encode('utf-8') <NEW_LINE> length = len(_x) <NEW_LINE> <DEDENT> if python3: <NEW_LINE> <INDENT> buff.write(struct.pack('<I%s...
serialize message into buffer :param buff: buffer, ``StringIO``
625941f0cad5886f8bd2756f
def save(self, user=None, forum=None, post=None): <NEW_LINE> <INDENT> current_app.pluggy.hook.flaskbb_event_topic_save_before(topic=self) <NEW_LINE> if self.id: <NEW_LINE> <INDENT> db.session.add(self) <NEW_LINE> db.session.commit() <NEW_LINE> current_app.pluggy.hook.flaskbb_event_topic_save_after( topic=self, is_new=F...
Saves a topic and returns the topic object. If no parameters are given, it will only update the topic. :param user: The user who has created the topic :param forum: The forum where the topic is stored :param post: The post object which is connected to the topic
625941f08c0ade5d55d3ef57
def __init__(self, ai_setting): <NEW_LINE> <INDENT> self.ai_setting = ai_setting <NEW_LINE> self.game_active = True <NEW_LINE> self.reset_starts() <NEW_LINE> self.score = 0 <NEW_LINE> self.game_active = False
初始化统计信息
625941f0091ae356686674ec
def polynomialJacobian(c, x, y): <NEW_LINE> <INDENT> pol = np.poly1d(c[::-1]) <NEW_LINE> dif = 2.0*(pol(x)-y) <NEW_LINE> der = np.zeros_like(c) <NEW_LINE> xp = np.ones_like(x) <NEW_LINE> for i in range(len(c)): <NEW_LINE> <INDENT> der[i] = dif.dot(xp) <NEW_LINE> xp = xp*x <NEW_LINE> <DEDENT> return der
Compute the jacobian of the residue, given the polynomial coefficients c, input x, and output y.
625941f0e76e3b2f99f3ad99
def re_check(self, kwargs) -> None: <NEW_LINE> <INDENT> es = kwargs["es"] <NEW_LINE> self.scheduled_re_checks.pop(es.id) <NEW_LINE> is_ok, msg = self.is_ok(es) <NEW_LINE> if is_ok: <NEW_LINE> <INDENT> self.log(f"{es.entity_accessor} was temporarily in a fail state.", "DEBUG") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDEN...
Do actions/notifications on failed entity state. This simple method is the whole point of this class...notifications and actions on non-compliant entity states. See `do_entity_check` for more info.
625941f0d4950a0f3b08c8de
def add_broker(self, broker_req_uri, broker_sub_uri): <NEW_LINE> <INDENT> self.broker_req_socket = self.context.socket(zmq.REQ) <NEW_LINE> self.broker_sub_socket = self.context.socket(zmq.SUB) <NEW_LINE> self.broker_req_socket.connect(broker_req_uri) <NEW_LINE> self.broker_sub_socket.connect(broker_sub_uri) <NEW_LINE> ...
Sets the (only) broker
625941f07cff6e4e81117f1d
def p_exponentiation(p): <NEW_LINE> <INDENT> pass
exponentiation : primary | primary STARSTAR exponentiation
625941f07b25080760e399ed
def import_export_nem12(input_file, zip_output=False): <NEW_LINE> <INDENT> ex = nr.read_nem_file(input_file) <NEW_LINE> m = NEM12(to_participant=ex.header.to_participant) <NEW_LINE> to_load = [] <NEW_LINE> for nmi in ex.readings: <NEW_LINE> <INDENT> nmi_configuration = "".join(list(ex.transactions[nmi].keys())) <NEW_LI...
Create export from import
625941f0d58c6744b42581f5
def load_igrf(ut): <NEW_LINE> <INDENT> global igrf, nmn,nyear, mns, years, yruts <NEW_LINE> try: isinstance(igrf, dict) <NEW_LINE> except: init_igrf() <NEW_LINE> if ut <= yruts[0]: yridx = 0 <NEW_LINE> elif ut >= yruts[-1]: yridx = -2 <NEW_LINE> else: <NEW_LINE> <INDENT> yridx = np.argwhere(yruts <= ut)[-1] <NEW_LINE> ...
Load the IGRF coefficients for the given time. :param ut: ut sec, a float. :return: g,h. The IGRF coef at given time.
625941f0099cdd3c635f11ef
def _generate_user_blocked_list(self): <NEW_LINE> <INDENT> self.user_blocked_list = [] <NEW_LINE> session_id = self.request["session_id"] <NEW_LINE> try: <NEW_LINE> <INDENT> s = Session.objects.get(id=session_id) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> raise RoundException("session_id does not exist") <NEW_LINE...
generate list of blocked assets for user based on session_id
625941f0442bda511e8be9a7
def _feature_word_embedding(self, text): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> simils = np.dot(self._prebuilt_vec, text.vector) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> return {"country_1" : "", "confid_a" : 0, "confid_b" : 0, "country_2" : ""} <NEW_LINE> <DEDENT> ranks = simils.argsort()[:...
Given a word, guess the appropriate country by word vector. Parameters --------- text: str the text to extract locations from. Returns ------- country_picking: dict The top two countries (ISO codes) and two measures confidence for the first choice.
625941f024f1403a926010f8
def Case_3_b(self,Points,Value): <NEW_LINE> <INDENT> return [self.SinglePointCalc(Points,Value,1), self.SinglePointCalc(Points,Value,2), self.TwoPointCalc(Points,Value,2,3), self.TwoPointCalc(Points,Value,0,3), self.SinglePointCalc(Points,Value,0)]
###################################################### We changed the mode. It is now much more direct by drawing tons of polygones. This avoinds so many pro- blems We have now X and check only three o 1 --- 1 I \ I I \ I o --- 1 ######################################################
625941f0a8ecb033257d3662
def write_out(data_obj, fn): <NEW_LINE> <INDENT> data_bytes = json.dumps(data_obj, sort_keys=True, indent=4, separators=(',', ': ')) <NEW_LINE> with open(SCRIPT_PATH + '/../dist/data/' + fn, "wb+") as json_f: <NEW_LINE> <INDENT> json_f.write(data_bytes.encode('utf-8'))
Write out JSON data
625941f08da39b475bd65513
def cpn_pmt(coupon_rate, face_value, n_pmts_per_year): <NEW_LINE> <INDENT> return coupon_rate * face_value / n_pmts_per_year
Returns the coupon payment amount for a bond Args: coupon_rate - coupon rate face_value - face value of the bond n_pmts_per_year - number of coupon payments per year
625941f0be383301e01b5a12
def test_oblate_ellipsoid_ignore_none(): <NEW_LINE> <INDENT> pmag = utils.ang2vec(7, -52, 13) <NEW_LINE> model_none = deepcopy(model) <NEW_LINE> model_none[1] = None <NEW_LINE> bx = oblate_ellipsoid.bx(x, y, z, [model[0], model[2]], F, inc, dec, demag=False, pmag=pmag) <NEW_LINE> by = oblate_ellipsoid.by(x, y, z, [mode...
Oblate ellipsoid ignores model elements that are None
625941f03617ad0b5ed6848e
def restoreShelves(): <NEW_LINE> <INDENT> scriptsDir = os.path.abspath(cmds.internalVar(usd=True)) <NEW_LINE> envDir = os.path.dirname(scriptsDir) <NEW_LINE> shelfDir = os.path.join(envDir, 'prefs', 'shelves') <NEW_LINE> for shelf in os.listdir(shelfDir): <NEW_LINE> <INDENT> if shelf.endswith('.deleted'): <NEW_LINE> <I...
Restores previously deleted shelves Raises: restartDialog()
625941f0ec188e330fd5ad2a
@home.route('/') <NEW_LINE> def homepage(): <NEW_LINE> <INDENT> return render_template('home/index.html', title="Welcome to Kaffier")
Render the homepage template on the / route
625941f08a349b6b435e870a
def average_hash(image_path, hash_size=8): <NEW_LINE> <INDENT> with open(image_path, 'rb') as f: <NEW_LINE> <INDENT> image = Image.open(f) <NEW_LINE> image = image.resize((hash_size, hash_size), Image.ANTIALIAS).convert('L') <NEW_LINE> pixels = list(image.getdata()) <NEW_LINE> avg = sum(pixels) / len(pixels) <NEW_LINE>...
Computes the average hash of the given image.
625941f03c8af77a43ae3d3f
def getModemInitString(self, unitCode=0): <NEW_LINE> <INDENT> resp = self.XAPCommand('MINIT', unitCode=unitCode) <NEW_LINE> return resp
Get the modem initialization string of the specified XAP800. unitCode - the unit code of the target XAP800
625941f056b00c62f0f14bf5
def get_matlab_record_values(self, is_ext_data=False): <NEW_LINE> <INDENT> values = [] <NEW_LINE> return values
Get the Matlab record values for this component.
625941f091af0d3eaac9bfb6
def get_default_config(self): <NEW_LINE> <INDENT> config = super(NfsdCollector, self).get_default_config() <NEW_LINE> config.update({ 'path': 'nfsd' }) <NEW_LINE> return config
Returns the default collector settings
625941f03cc13d1c6d3c790f
def _q_l(self, _i, _j, _x): <NEW_LINE> <INDENT> pcx = (self.p2[_i, _x] + self.p2[_j, _x]) <NEW_LINE> pc = (self.p1[_i] + self.p1[_j]) <NEW_LINE> px = self.p1[_x] <NEW_LINE> return pcx * math.log(pcx / (pc * px))
O(1)
625941f0d99f1b3c44c67b1c
def default(self, obj): <NEW_LINE> <INDENT> if isinstance(obj, Peer): <NEW_LINE> <INDENT> return dict(id = obj.id, ip = obj.ip, port = obj.port, utility_factor = obj.utility_factor) <NEW_LINE> <DEDENT> if isinstance(obj, PeerManager): <NEW_LINE> <INDENT> return dict(request_interval = obj.peer_timeout, peers = obj.peer...
Default handler for the encoder.
625941f060cbc95b062c6adb
def GetFileContent(self, file_hash): <NEW_LINE> <INDENT> data, retcode = RunShellWithReturnCode(["git", "show", file_hash], universal_newlines=False) <NEW_LINE> if retcode: <NEW_LINE> <INDENT> ErrorExit("Got error status from 'git show %s'" % file_hash) <NEW_LINE> <DEDENT> return data
Returns the content of a file identified by its git hash.
625941f001c39578d7e753d3
def gamma_random_expr(model, shape, scale): <NEW_LINE> <INDENT> code = '(const $ liftParameter $ ' <NEW_LINE> code += 'randomGamma ' <NEW_LINE> code += str(shape) <NEW_LINE> code += ' ' <NEW_LINE> code += str(scale) <NEW_LINE> code += ')' <NEW_LINE> return Expr(model, code)
Return an expression that returns the random value having the Gamma distribution by the specified shape and scale.
625941f021a7993f00bc8292
def shiftVector(imIn, imOut, vector, fill): <NEW_LINE> <INDENT> if imIn.getDepth()==32: <NEW_LINE> <INDENT> err = mambaCore.MB_ShiftVector32(imIn.mbIm, imOut.mbIm, vector[0], vector[1], fill) <NEW_LINE> <DEDENT> elif imIn.getDepth()==8: <NEW_LINE> <INDENT> err = mambaCore.MB_ShiftVector8(imIn.mbIm, imOut.mbIm, vector[0...
Shifts image 'imIn' by 'vector' (tuple with dx,dy). The emptied space is filled with 'fill' value. The result is put in 'imOut'. 'imIn' and 'imOut' can be 1-bit, 8-bit or 32-bit images of same size and depth.
625941f0293b9510aa2c3828
def is_way(elem): <NEW_LINE> <INDENT> motorways={'living_street', 'motorway_link', 'trunk', 'track', 'give_way', 'tertiary_link', 'tertiary', 'motorway_junction', 'residential', 'secondary_link', 'service', 'traffic_signals', 'trunk_link', 'primary', 'primary_link', 'raceway', 'motorway', 'crossing', 'secondary'} <NEW_...
vrati True, ak dany xml element popisuje motorovu cestu
625941f030bbd722463cc361
@user_blue.route('/info') <NEW_LINE> @login_in_data <NEW_LINE> def user_info(): <NEW_LINE> <INDENT> user = g.user <NEW_LINE> if not user: <NEW_LINE> <INDENT> return redirect(url_for('index.index')) <NEW_LINE> <DEDENT> context = { 'user':user } <NEW_LINE> return render_template('news/user.html', context=context)
个人中心入口
625941f00c0af96317bb877f
def validate(self, loader, print_freq=None): <NEW_LINE> <INDENT> return F.validate(self.model, loader, self.criterion, print_freq=print_freq)
Validate the model on a given datset using the dataloader provided.
625941f0462c4b4f79d1dc67
def handleMousePush(self, *args): <NEW_LINE> <INDENT> return _osgGA.FirstPersonManipulator_handleMousePush(self, *args)
handleMousePush(FirstPersonManipulator self, GUIEventAdapter ea, GUIActionAdapter us) -> bool
625941f0be8e80087fb211d1
def __deref__(self): <NEW_LINE> <INDENT> return _blocks_swig0.nop_sptr___deref__(self)
__deref__(nop_sptr self) -> nop
625941f0bde94217f3683383
def finishConnection(self): <NEW_LINE> <INDENT> return self.connectedServerAndClient( self.factory, self.reactor.tcpClients[0][2])
Establish the first attempted TCP connection using the SSH server which C{self.factory} can create.
625941f0460517430c39470d
def create_superuser(self, email, password, **kwargs): <NEW_LINE> <INDENT> if not email: <NEW_LINE> <INDENT> raise ValueError("Email is necessary to create a user") <NEW_LINE> <DEDENT> user = self.model(email=email, is_staff=True, is_superuser=True, **kwargs) <NEW_LINE> user.set_password(password) <NEW_LINE> user.save(...
Creates a superuser with email address and password
625941f04c3428357757c8bc
def test_success_01(self): <NEW_LINE> <INDENT> self.commonrecharge = CommonRecharge(self.base_driver) <NEW_LINE> self.commonrecharge.login032() <NEW_LINE> self.base_driver.click('x,//*[@id="main"]/div/ul/li[1]') <NEW_LINE> print('点击个人中心') <NEW_LINE> self.base_driver.click('x,//*[@id="main"]/div/section/div[1]/div[1]/di...
用户登陆密码---修改成功
625941f0099cdd3c635f11f0
def generate_query_id(self): <NEW_LINE> <INDENT> query_id = self.time_start.strftime("%Y-%m-%d") + '-' + self.time_end.strftime("%Y-%m-%d") + '-' + str(self.latitude_max) + '-' + str( self.latitude_min) + '-' + str(self.longitude_max) + '-' + str(self.longitude_min) + '-' + self.compositor + '-' + self.platform + '-' +...
Creates a Query ID based on a number of different attributes including start_time, end_time latitude_min and max, longitude_min and max, measurements, platform, product, and query_type Returns: query_id (string): The ID of the query built up by object attributes.
625941f066673b3332b92629
def has_blank_ids(idlist): <NEW_LINE> <INDENT> return not(all(k for k in idlist))
Search the list for empty ID fields and return true/false accordingly.
625941f06e29344779a62ba9
def set_watershed_boundary_condition_outlet_id(self, outlet_id, node_data, nodata_value=-9999.): <NEW_LINE> <INDENT> self.set_closed_boundaries_at_grid_edges(True, True, True, True) <NEW_LINE> self.set_nodata_nodes_to_closed(node_data, nodata_value) <NEW_LINE> self.status_at_node[outlet_id] = FIXED_VALUE_BOUNDARY
Set the boundary conditions for a watershed. All nodes with nodata_value are set to CLOSED_BOUNDARY (4). All nodes with data values are set to CORE_NODES (0), with the exception that the outlet node is set to a FIXED_VALUE_BOUNDARY (1). Note that the outer ring of the raster is set to CLOSED_BOUNDARY, even if there ar...
625941f071ff763f4b549c2e
def card_allowed(board, player): <NEW_LINE> <INDENT> i = 0 <NEW_LINE> allowed = [] <NEW_LINE> for card in player.hand: <NEW_LINE> <INDENT> if board.card_stack == [] or board.color == "w": <NEW_LINE> <INDENT> allowed = range(len(player.hand)) <NEW_LINE> return allowed <NEW_LINE> <DEDENT> if card.color == "w": <NEW_LINE>...
Args: player: a pyuno Player class in which their hand is being evaluated wether it has valid cards to play or not. board: a pyuno Board class in which its current stat is the determining factor wether a players card is valid or not. Returns: allowed: a list of cards allowed to be pla...
625941f09f2886367277ae21
def FinalOutput(self, mb): <NEW_LINE> <INDENT> mb.add_registration_code('bp::docstring_options doc_options( true, true, false );', tail=False) <NEW_LINE> mb.build_code_creator(module_name=self.module_name) <NEW_LINE> self.PostCodeCreation(mb) <NEW_LINE> self.AddAdditionalCode(mb) <NEW_LINE> if self.split: <NEW_LINE> <I...
Finalizes the output after generation of the bindings. Writes output to file.
625941f02c8b7c6e89b35d54
def obliquity(jd, algorithm=2006): <NEW_LINE> <INDENT> T = (jd - jd2000) / 36525.0 <NEW_LINE> if algorithm == 2006: <NEW_LINE> <INDENT> p = (-0.0000000434, -0.000000576, 0.00200340, -0.0001831, -46.836769, 84381.406) <NEW_LINE> corr = 0 <NEW_LINE> <DEDENT> elif algorithm == 2000: <NEW_LINE> <INDENT> p = (0.001813, -0.0...
Computes the obliquity of the Earth at the requested Julian Date. Parameters ---------- jd : scalar or array-like Julian date at which to compute the obliquity algorithm : int Year of algorithm based on IAU adoption. Can be 2006, 2000 or 1980. The 2006 algorithm is mentioned in Circular 179, but the canoni...
625941f05fdd1c0f98dc07ce
def run_vios_command_as_root(self, command, check_exit_code=True): <NEW_LINE> <INDENT> self._set_connection() <NEW_LINE> stdout, stderr = common.ssh_command_as_root( self._connection, command, check_exit_code=check_exit_code) <NEW_LINE> error_text = stderr.read() <NEW_LINE> if error_text: <NEW_LINE> <INDENT> LOG.warn(_...
Run a remote command as root using an active ssh connection. :param command: List of commands.
625941f06fece00bbac2dcde
def __init__(self, body, height, stay=False, out=False): <NEW_LINE> <INDENT> bounds = np.array([[0.], [height]]) <NEW_LINE> super(BaseHeightCondition, self).__init__(body, bounds=bounds, stay=stay, out=out)
Initialize the base height terminal condition. Args: body (Body): body instance. height (float): max height which defines the bound; the bounds will be defined to be between 0 and height. stay (bool): if True, it must stay in the bounds defined by in_bounds or out_bounds; if the position leaves the...
625941f026068e7796caf280
def getterms(): <NEW_LINE> <INDENT> if int(amazonvar.get()) == 1: <NEW_LINE> <INDENT> search_terms.append("[Amazon]") <NEW_LINE> <DEDENT> if int(bestbuyvar.get()) == 1: <NEW_LINE> <INDENT> search_terms.append("[Best Buy]") <NEW_LINE> <DEDENT> if int(gamersgatevar.get()) == 1: <NEW_LINE> <INDENT> search_terms.append("[G...
Fills the search_terms list based on which boxes were checked
625941f05510c4643540f96e
def stm_plot(flat_file, scan_dir=0, cmap=None, vmin=None, vmax=None, xy_ticks=4, z_ticks=4): <NEW_LINE> <INDENT> nm = 10 ** -9 <NEW_LINE> fig, ax = plt.subplots() <NEW_LINE> figure_data = (flat_file[scan_dir].data - np.amin(flat_file[scan_dir].data)) / nm <NEW_LINE> if cmap is None: <NEW_LINE> <INDENT> cmap = 'hot' <NE...
Function to plot STM topographic data. Arguments :param flat_file: An instance of an Omicron topography flat file. Optional Arguments :param scan_dir: Define which scane direction to use. fwd_up=0, bwd_up=1, fwd_dwn=2, bwd_dwn=3 :param cmap: Matplotlib colormap name. :param vmin: Use to manually define the minimum va...
625941f032920d7e50b2876d
def start(self): <NEW_LINE> <INDENT> self.thread.start()
Start the Flask-based Blockchain WebApp.
625941f08e71fb1e9831dd3f
def uniform(self, size=None, low=0.0, high=1.0, ndim=None, dtype=None): <NEW_LINE> <INDENT> offset = high - low <NEW_LINE> standard = self._sample('uniform', shape=size) <NEW_LINE> if low != 0.0: <NEW_LINE> <INDENT> standard -= low <NEW_LINE> <DEDENT> if offset != 1.0: <NEW_LINE> <INDENT> standard *= high - low <NEW_LI...
Sample a tensor of given size whose element from a uniform distribution between low and high. If the size argument is ambiguous on the number of dimensions, ndim may be a plain integer to supplement the missing information.
625941f04d74a7450ccd475d
def waveDrag(cd, mach): <NEW_LINE> <INDENT> adj = cd - .3 <NEW_LINE> if(mach < .5085): <NEW_LINE> <INDENT> nCd = .6827 * mach**3 - .4297 * mach**2 - .0358 * mach + .3 + adj <NEW_LINE> <DEDENT> elif(mach > .5085 and mach < 1.3618): <NEW_LINE> <INDENT> nCd = -0.7809 * mach**4 + 2.324 * mach**3 - 2.0189 * mach**2 + 0.6793...
CD??,ADJ??
625941f0377c676e9127273f
def Tcontrast(self, matrix, store=('t', 'effect', 'sd'), dispersion=None): <NEW_LINE> <INDENT> matrix = np.asarray(matrix) <NEW_LINE> if matrix.ndim == 1: <NEW_LINE> <INDENT> matrix = matrix[None] <NEW_LINE> <DEDENT> if matrix.shape[0] != 1: <NEW_LINE> <INDENT> raise ValueError("t contrasts should have only one row") <...
Compute a Tcontrast for a row vector `matrix` To get the t-statistic for a single column, use the 't' method. Parameters ---------- matrix : 1D array-like contrast matrix store : sequence, optional components of t to store in results output object. Defaults to all components ('t', 'effect', 'sd'). disp...
625941f0ab23a570cc250720
def decode_message(self, message_type, encoded_message): <NEW_LINE> <INDENT> encoded_message = six.ensure_str(encoded_message) <NEW_LINE> if not encoded_message.strip(): <NEW_LINE> <INDENT> return message_type() <NEW_LINE> <DEDENT> dictionary = json.loads(encoded_message) <NEW_LINE> message = self.__decode_dictionary(m...
Merge JSON structure to Message instance. Args: message_type: Message to decode data to. encoded_message: JSON encoded version of message. Returns: Decoded instance of message_type. Raises: ValueError: If encoded_message is not valid JSON. messages.ValidationError if merged message is not initialized.
625941f0be8e80087fb211d2
def wrap_input_stream(self, stream, replace_newlines=False): <NEW_LINE> <INDENT> if isinstance(stream, ( io.TextIOWrapper, io.StringIO, codecs.StreamReaderWriter, codecs.StreamReader, )): <NEW_LINE> <INDENT> stream = InputStreamWrapper(stream, self) <NEW_LINE> <DEDENT> if replace_newlines: <NEW_LINE> <INDENT> return Ne...
Wrap a stream so that we can read codepage bytes from it.
625941f0283ffb24f3c55e93
def draw(self, context): <NEW_LINE> <INDENT> super(LifelineItem, self).draw(context) <NEW_LINE> cr = context.cairo <NEW_LINE> cr.rectangle(0, 0, self.width, self.height) <NEW_LINE> cr.stroke() <NEW_LINE> if context.hovered or context.focused or self.lifetime.visible: <NEW_LINE> <INDENT> top = self.lifetime.top <NEW_LIN...
Draw lifeline. Lifeline's head is always drawn. Lifeline's lifetime is drawn when lifetime is visible.
625941f08a43f66fc4b545f7
def save_picture(form_picture): <NEW_LINE> <INDENT> random_hex = secrets.token_hex(8) <NEW_LINE> _, f_ext = os.path.splitext(form_picture.filename) <NEW_LINE> picture_fn = random_hex + f_ext <NEW_LINE> picture_path = os.path.join(app.root_path, 'static/profile_pics', picture_fn) <NEW_LINE> output_size = (125, 125) <NEW...
Preimenujem ime uploadane slike kako bi ime koje spremam u bazu bilo jedinstveno :param form_picture: :return: vraća ime slike
625941f0956e5f7376d71404
def hjelp(): <NEW_LINE> <INDENT> clear() <NEW_LINE> print() <NEW_LINE> print(Fore.BLACK + Back.LIGHTGREEN_EX + "..:::|| VELKOMMEN TIL BOMBS ||:::.." + Style.RESET_ALL) <NEW_LINE> sleep(0.1) <NEW_LINE> print() <NEW_LINE> print("~ I dette spillet skal du samle poeng i et rutenett.") <NEW_LINE> print("~ Poengene får du av...
Funksjon som gir spilleren starthjelp
625941f03346ee7daa2b3309
def wait_for_no_request(self, timeout=5.0): <NEW_LINE> <INDENT> self.__request = RequestStorage().pop(int(timeout)) <NEW_LINE> if self.__request is not None: <NEW_LINE> <INDENT> raise AssertionError("Request was received: %s." % self.__request) <NEW_LINE> <DEDENT> logger.info("Request is not received.")
Command to server to wait for no incoming request during specific time. This call is blocked until HTTP request arrives or timeout. Basically server receives all requests after \`Start Server\` and places them to internal queue. When test call function \`Wait For No Request\` it checks the queue and if it is not empty ...
625941f0d53ae8145f87a7fd
def __init__(self, vera_device, controller): <NEW_LINE> <INDENT> VeraDevice.__init__(self, vera_device, controller) <NEW_LINE> self.entity_id = ENTITY_ID_FORMAT.format(self.vera_id)
Initialize the Vera device.
625941f0796e427e537b0b63
def _update_volume_stats(self): <NEW_LINE> <INDENT> LOG.debug(_("Updating volume stats")) <NEW_LINE> data = {} <NEW_LINE> backend_name = self.configuration.safe_get('volume_backend_name') <NEW_LINE> data["volume_backend_name"] = backend_name or 'HuaweiISCSIDriver' <NEW_LINE> data['vendor_name'] = 'Huawei' <NEW_LINE> da...
Retrieve stats info from volume group.
625941f0d10714528d600283
def recvall(self, host, port, name): <NEW_LINE> <INDENT> xmldata = gmetricxml(host, port) <NEW_LINE> data = {} <NEW_LINE> for ip in xmldata.getips(name): <NEW_LINE> <INDENT> fragments = xmldata.getfragments(ip, name) <NEW_LINE> if (fragments): <NEW_LINE> <INDENT> data[ip] = self.reassembledata(fragments) <NEW_LINE> <DE...
Receive metric data from gmond/gmetad. Perform reassembly if necessary Data is returned for all IPs as a dictionary (IP address -> data).
625941f0851cf427c661aaa2
def __init__(self, node_id, x, y, optimistic_ctg): <NEW_LINE> <INDENT> self.node_id = int(node_id) <NEW_LINE> self.x = float(x) <NEW_LINE> self.y = float(y) <NEW_LINE> self.optimistic_ctg = float(optimistic_ctg) <NEW_LINE> if self.node_id == 1: <NEW_LINE> <INDENT> self.past_cost = 0 <NEW_LINE> self.est_tot_cost = self....
creates the node object, different values are used for the special case where the node is the first node in the path
625941f0cdde0d52a9e535d0
def copy(self, from_key, from_bucket, to_key, to_bucket=None, metadata=None, public=True): <NEW_LINE> <INDENT> to_bucket = self.bucket(to_bucket or from_bucket) <NEW_LINE> r = CopyRequest(self, from_key, from_bucket, to_key, to_bucket, metadata=metadata, public=public) <NEW_LINE> return self.run(r)
Copy a key contents to another key/bucket with an option to update metadata/public state Params: - from_key The source key - from_bucket The source bucket - to_key The target key - to_bucket (Optional) The target bucket, if not specified, tinys3 will use the `from_bucket` - ...
625941f0cdde0d52a9e535d1
def __init__(self, user): <NEW_LINE> <INDENT> super(UserDirectory, self).__init__() <NEW_LINE> self.__user__ = user
:param user: 必须传入用户对象
625941f02eb69b55b151ce50
def queryset(self, request, queryset): <NEW_LINE> <INDENT> from ..mpepu_infant.models import InfantEligibility <NEW_LINE> if self.used_parameters.get('willingness_rando', None): <NEW_LINE> <INDENT> if self.value == '(None)': <NEW_LINE> <INDENT> subject_identifiers = InfantEligibility.objects.exclude(rando_bf_duration__...
Returns the filtered queryset based on the value provided in the query string and retrievable via `self.value()`.
625941f0097d151d1a2233ef
def buildReadSummary(self,inputOgrDb,outputAbstractDb,classList): <NEW_LINE> <INDENT> self.signals.clearLog.emit() <NEW_LINE> inputType = self.conversionTypeDict[self.db.driverName()] <NEW_LINE> outputType = self.conversionTypeDict[outputAbstractDb.db.driverName()] <NEW_LINE> self.signals.updateLog.emit(self.tr('Conver...
Builds the conversion read summary
625941f0f8510a7c17cf9c99
def remove_role_from_user(self, context, user_id, role_id, tenant_id=None): <NEW_LINE> <INDENT> self.assert_admin(context) <NEW_LINE> if tenant_id is None: <NEW_LINE> <INDENT> raise Exception('User roles not supported: tenant_id required') <NEW_LINE> <DEDENT> self.identity_api.remove_role_from_user_and_tenant( context,...
Remove a role from a user and tenant pair. Since we're trying to ignore the idea of user-only roles we're not implementing them in hopes that the idea will die off.
625941f055399d3f05588c51