code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def is_fallback(self): <NEW_LINE> <INDENT> return True
..seealso:: ckan.plugins.interfaces.IDatasetForm.is_fallback
625941e826238365f5f0f2f3
def average_calories(foods): <NEW_LINE> <INDENT> tot_cal = 0 <NEW_LINE> counter = 0 <NEW_LINE> for f in foods: <NEW_LINE> <INDENT> tot_cal += f.calories <NEW_LINE> counter += 1 <NEW_LINE> <DEDENT> avg = int(tot_cal / counter) <NEW_LINE> return avg
------------------------------------------------------- Determines the average calories in a list of foods. Use: a = average_calories(foods) ------------------------------------------------------- Preconditions: foods - a list of Food objects (list of Food) Postconditions: returns a - average calories in al...
625941e89b70327d1c4e1256
def delete(self): <NEW_LINE> <INDENT> db.session.delete(self) <NEW_LINE> db.session.commit()
Delete an org.
625941e85f7d997b87174f1a
def test(verbose): <NEW_LINE> <INDENT> return lib.measures_test(verbose)
Self test of this class.
625941e867a9b606de4a8335
def test_executeSqlParams(self): <NEW_LINE> <INDENT> dbConn = ichorORM.getDatabaseConnection() <NEW_LINE> gotException = False <NEW_LINE> try: <NEW_LINE> <INDENT> self._createTestTable(dropIfExists=True) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> gotException = e <NEW_LINE> <DEDENT> assert gotExcept...
test_executeSqlParams - Test executing SQL commands with params
625941e84f88993c3716c4e1
def create_packet(id, seqnum): <NEW_LINE> <INDENT> header = struct.pack('bbHHh', ICMP_ECHO_REQUEST, 0, 0, id, seqnum) <NEW_LINE> data = 192 * 'Q' <NEW_LINE> my_checksum = checksum(header + data) <NEW_LINE> header = struct.pack('bbHHh', ICMP_ECHO_REQUEST, 0, socket.htons(my_checksum), id, seqnum) <NEW_LINE> return heade...
Create a new echo request packet based on the given "id".
625941e8cc40096d61595dcd
def read_correct_lp_get_resolution(correct_lp_file): <NEW_LINE> <INDENT> with open(correct_lp_file, "r") as fh: <NEW_LINE> <INDENT> correct_lp = fh.readlines() <NEW_LINE> <DEDENT> rec = -1 <NEW_LINE> for j, record in enumerate(correct_lp): <NEW_LINE> <INDENT> if "RESOLUTION RANGE I/Sigma Chi^2 R-FACTOR R-FACTOR" in...
Read the CORRECT.LP file and get an estimate of the resolution limit. This should then be recycled to a rerun of CORRECT, from which the reflections will be merged to get the statistics.
625941e8d99f1b3c44c67a05
def _handle_minitor_alert(self, minitor_alert): <NEW_LINE> <INDENT> monitor = minitor_alert.monitor <NEW_LINE> alerts = monitor.alert_up if monitor.is_up() else monitor.alert_down <NEW_LINE> for alert in alerts: <NEW_LINE> <INDENT> self.alerts[alert].alert(str(minitor_alert), monitor)
Issues all alerts for a provided monitor
625941e8d58c6744b42580dc
def _getenv(names, *args): <NEW_LINE> <INDENT> if not isinstance(names, items_types): <NEW_LINE> <INDENT> names = [names] <NEW_LINE> <DEDENT> for name in names: <NEW_LINE> <INDENT> if name in os.environ: <NEW_LINE> <INDENT> return os.environ[name] <NEW_LINE> <DEDENT> name = name.replace('_', '') <NEW_LINE> if name in o...
Check for multiple environment variable values Two forms of the environment variable name will be checked, both with and without underscores. This allows for aliases such as CAS_HOST and CASHOST. Parameters ---------- names : string or list-of-strings Names of environment variables to look for *args : any, optio...
625941e8097d151d1a2232d6
def previous_directory(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return os.environ["OLDPWD"] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> return "~"
Where we were (in bash) before this directory
625941e863d6d428bbe4496f
def grouper2(result,key): <NEW_LINE> <INDENT> result[key] = yield from averager()
等同于下面两句
625941e80fa83653e4657437
def isHypervisor(self): <NEW_LINE> <INDENT> return True
Return True if the virt instance represents hypervisor environment otherwise it represents just one virtual server.
625941e8498bea3a759b9f2c
def _get_support_sound_mode_avr(self): <NEW_LINE> <INDENT> relevant_tags = {"selectSurround": None, "SurrMode": None} <NEW_LINE> try: <NEW_LINE> <INDENT> root = self.get_status_xml(self._urls.status) <NEW_LINE> <DEDENT> except (ValueError, requests.exceptions.RequestException): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDE...
Get if sound mode is supported from device. Method queries device via HTTP. Returns "True" if sound mode supported and "False" if not. This method is for pre 2016 AVR(-X) devices
625941e8a4f1c619b28b04ad
@app.route('/graph/<sub>') <NEW_LINE> def graph_endpoint(sub): <NEW_LINE> <INDENT> limit = request.args.get('limit') <NEW_LINE> limit = int(request.args.get('limit')) if limit else 100 <NEW_LINE> data = crawler.get_data(sub, limit=limit) <NEW_LINE> results = graph.get_heighest_weight_neighbour( graph.create_graph(data)...
Get graph based on subreddit. ?limit=int for the number of threads to crawl
625941e844b2445a33932511
def pc_work_time(self): <NEW_LINE> <INDENT> return _blocks_swig5.random_pdu_sptr_pc_work_time(self)
pc_work_time(random_pdu_sptr self) -> float
625941e81f037a2d8b94667b
def open_restaurant(self): <NEW_LINE> <INDENT> print(f"The {self.restaurant_name.title()} is now open!")
Informs that the restaurant is open
625941e8c4546d3d9de72eb7
def test_archive_workspace(client, mocker): <NEW_LINE> <INDENT> mocked_filename = mocker.patch.object( client, "_create_archive_filename", return_value=Path("structurizr-19-time.json.gz"), ) <NEW_LINE> mocked_open = mocker.mock_open(mock=mocker.Mock(spec_set=GzipFile)) <NEW_LINE> mocker.patch("gzip.open", mocked_open) ...
Expect that a filename is generated and JSON content is written to a file.
625941e86fece00bbac2dbc3
def _gamma_ray_line_energies(self): <NEW_LINE> <INDENT> return {"nu g": self.mx / 2.0}
Returns dict of final states and photon energies for final states containing monochromatic gamma ray lines.
625941e807f4c71912b11903
def first_leg_train_etd(self, origin_station_name='fremont', destination_station_name='pittburgh'): <NEW_LINE> <INDENT> if(origin_station_name is None): <NEW_LINE> <INDENT> origin_station_name = '' <NEW_LINE> <DEDENT> if(destination_station_name is None): <NEW_LINE> <INDENT> destination_station_name = '' <NEW_LINE> <DE...
this functions gives the ETD - it finds the final sation name for the line - "arrivig at " station input and then uses the output as one of the arguments (line_final_station_name) to run self.get_estimated_times to generate BART etd
625941e826068e7796caf165
def Tip_Cond_Pulse_Apply(self): <NEW_LINE> <INDENT> p = 'function' <NEW_LINE> out = _process(p, [self, "Tip_Cond_Pulse_Apply"], None)
Super powerful. Do something, then run the trigger function on completion
625941e8cad5886f8bd27457
def get_key(self): <NEW_LINE> <INDENT> print ("------- friends --------") <NEW_LINE> print (self.friends_str(), end="") <NEW_LINE> print ("------------------------") <NEW_LINE> UI = int(input("Enter friend number or 0 to cancel: ")) <NEW_LINE> keys = sorted(self.friends.keys()) <NEW_LINE> if UI > 0 and UI <= len(keys):...
Prints a list of friends and returns the key corresponding to a specific friend. Returns an integer value of the key chosen, or an empty string if the key is not valid
625941e845492302aab5e747
def labelling_gsom(self, data_X, data_y, index_col, label_col): <NEW_LINE> <INDENT> r = self.node_count <NEW_LINE> q=self.node_list[:self.node_count] <NEW_LINE> w=data_X <NEW_LINE> e=self.distance <NEW_LINE> out = scipy.spatial.distance.cdist(self.node_list[:self.node_count], data_X, self.distance) <NEW_LINE> data_y["o...
Identify the winner nodes for test dataset Predict the winning node for each data point and create a pandas dataframe need to provide both index column and label column :param data: :param index_col: :param label_col: :return:
625941e899cbb53fe6793064
def drop_columns_w_many_nans(df, missing_percent): <NEW_LINE> <INDENT> series = view_columns_w_many_nans(df, missing_percent=missing_percent) <NEW_LINE> list_of_cols = series.index.to_list() <NEW_LINE> df.drop(columns=list_of_cols) <NEW_LINE> print(list_of_cols) <NEW_LINE> return df
Takes df, missing percentage Drops the columns whose missing value is bigger than missing percentage Returns df
625941e8adb09d7d5db6cc0b
def test_compare_prerelease(): <NEW_LINE> <INDENT> assert Version(1, 0, 0) > Version(1, 0, 0, "beta") <NEW_LINE> assert Version(1, 0, 0) > (1, 0, 0, "beta") <NEW_LINE> assert Version(1, 0) > Version(1, 0, prerelease="beta") <NEW_LINE> assert Version(1, 0) > (1, 0, None, "beta") <NEW_LINE> assert Version(1, 0, 0, "beta"...
Pre-release have a lower precedence than the associated normal version.
625941e8cc0a2c11143dd311
def estimate_wcs_accuracies(self): <NEW_LINE> <INDENT> wcs = WCS(self.path) <NEW_LINE> ra, dec = wcs.all_pix2world(self.comb['xcentroid'], self.comb['ycentroid'], 1) <NEW_LINE> self.comb['ra_2'] = ra <NEW_LINE> self.comb['dec_2'] = dec <NEW_LINE> dra = self.comb['ra_1']-self.comb['ra_2'] <NEW_LINE> dra *= 3600 <NEW_LIN...
Estimates the accuracies of the WCS transformation :return:
625941e8dc8b845886cb59b5
def serialize_key(key: str) -> bytes: <NEW_LINE> <INDENT> return key.encode("utf-8")
Serializes a key to be ingested by a bigtable table row :param key: str :return: bytes
625941e84d74a7450ccd4644
def frequency(note, octave): <NEW_LINE> <INDENT> return (440.0 * np.exp(((octave-4)+(note-10)/12.0)*np.log(2)))
http://latecladeescape.com/t/Frecuencia+de+las+notas+musicales
625941e84f6381625f114ebb
def test_entity_ids(self): <NEW_LINE> <INDENT> run = RecorderRuns( start=datetime(2016, 7, 9, 11, 0, 0, tzinfo=dt.UTC), end=datetime(2016, 7, 9, 23, 0, 0, tzinfo=dt.UTC), closed_incorrect=False, created=datetime(2016, 7, 9, 11, 0, 0, tzinfo=dt.UTC), ) <NEW_LINE> self.session.add(run) <NEW_LINE> self.session.commit() <N...
Test if entity ids helper method works.
625941e8a05bb46b383ecc9c
def gen_rdf(rdf_fragment: str) -> str: <NEW_LINE> <INDENT> return f"""{rdf_header}""" + re.sub(r'<([^.:>]+)>', r':\1', rdf_fragment)
Edit rdf_fragment from the spec to be complete. We 1) Add the rdf header and 2) convert relative URI's into URI's based in the default space
625941e866656f66f7cbc62c
def get_stp_mst_detail_output_cist_port_oper_bpdu_guard(self, **kwargs): <NEW_LINE> <INDENT> config = ET.Element("config") <NEW_LINE> get_stp_mst_detail = ET.Element("get_stp_mst_detail") <NEW_LINE> config = get_stp_mst_detail <NEW_LINE> if kwargs.pop('delete_get_stp_mst_detail', False) is True: <NEW_LINE> <INDENT> del...
Auto Generated Code
625941e866673b3332b92510
def hit(): <NEW_LINE> <INDENT> global playing,chip_pool,deck,player_hand,dealer_hand,result,bet <NEW_LINE> if playing: <NEW_LINE> <INDENT> if player_hand.calc_val()<= 21: <NEW_LINE> <INDENT> player_hand.card_add(deck.deal()) <NEW_LINE> <DEDENT> print("player hand is %s" %player_hand) <NEW_LINE> if player_hand.calc_val(...
imlements the hit button
625941e84e4d5625662d4850
def generate_auth_sub_url(next, scopes, secure = False, session = True, request_url = atom.http_core.parse_uri( 'https://www.google.com/accounts/AuthSubRequest'), domain = 'default', scopes_param_prefix = 'auth_sub_scopes'): <NEW_LINE> <INDENT> if isinstance(next, str): <NEW_LINE> <INDENT> next = atom.http_core.Uri.par...
Constructs a URI for requesting a multiscope AuthSub token. The generated token will contain a URL parameter to pass along the requested scopes to the next URL. When the Google Accounts page redirects the broswser to the 'next' URL, it appends the single use AuthSub token value to the URL as a URL parameter with the k...
625941e88a43f66fc4b544df
def save(student): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> students_txt = open(filename,"a") <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> students_txt = open(filename,"w") <NEW_LINE> <DEDENT> for info in student: <NEW_LINE> <INDENT> students_txt.write(str(info) + "\n") <NEW_LINE> <DEDENT> student...
将学生信息保存到文件
625941e8d164cc61757831ce
def mappings(self, year=None): <NEW_LINE> <INDENT> mappings = [] <NEW_LINE> for yr, elecs in list(self.elections(year).items()): <NEW_LINE> <INDENT> mappings.extend(self._build_metadata(yr, elecs)) <NEW_LINE> <DEDENT> return mappings
Return array of dicts containing source url and standardized filename for raw results file, along with other pieces of metadata
625941e86fb2d068a760f524
def get_user(self): <NEW_LINE> <INDENT> return self.user
return the User who sent this Message
625941e85e10d32532c5f3a4
def shift(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> temp = self.tail.data <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> raise IndexError <NEW_LINE> <DEDENT> if self.head is self.tail: <NEW_LINE> <INDENT> self.head = self.tail = None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.tail = se...
Remove the very last ListItem from the list
625941e8be383301e01b58fc
def _create_database(self): <NEW_LINE> <INDENT> project_database_file_name = join(self._output_path, "project_database") <NEW_LINE> create_new = False <NEW_LINE> key = b"version" <NEW_LINE> version = str((7, sys.version)).encode() <NEW_LINE> database = None <NEW_LINE> try: <NEW_LINE> <INDENT> database = DataBase(projec...
Create a persistent database to store expensive parse results Check for Python version used to create the database is the same as the running python instance or re-create
625941e82c8b7c6e89b35c3c
def shell_to_string(self, command): <NEW_LINE> <INDENT> remote_in, remote_out, wait = self.popen2(command) <NEW_LINE> remote_in.close() <NEW_LINE> value = remote_out.read() <NEW_LINE> remote_out.close() <NEW_LINE> wait() <NEW_LINE> return value
Execute self.popen2; capture stdout as a string. Uses self.popen2, so it inherits those characteristics. Closes the command's stdin.
625941e8293b9510aa2c3710
def convert(self, out_dir=None): <NEW_LINE> <INDENT> self._load() <NEW_LINE> start_idx = [] <NEW_LINE> stop_idx = [] <NEW_LINE> for i, line in enumerate(self.log): <NEW_LINE> <INDENT> if line[0] == '*** LogFrame Start ***': <NEW_LINE> <INDENT> start_idx.append(i+1) <NEW_LINE> <DEDENT> if line[0] == '*** LogFrame End **...
Converts txt-file to tsv. Parameters ---------- out_dir : str Absolute path to desired directory to save tsv to (default: current directory).
625941e8d164cc61757831cf
def check_line_against_list(self, line, lname, tlist, tdef=0): <NEW_LINE> <INDENT> if show_func_seq: print('=== N ===') <NEW_LINE> txt = str(line.text()) <NEW_LINE> if txt not in tlist: <NEW_LINE> <INDENT> reset_val = tlist[tdef] <NEW_LINE> emesg = "%s '%s' not in %s\n(resetting to %s)" % (lname, txt, t...
if line text is not in tlist, show error and reset to tlist[tdef]
625941e8eab8aa0e5d26dfd9
def create(self, im, im_type, timeout=10): <NEW_LINE> <INDENT> params = { 'typeid': im_type, 'timeout': timeout, } <NEW_LINE> params.update(self.base_params) <NEW_LINE> files = {'image': ('a.jpg', im)} <NEW_LINE> r = requests.post('http://api.ruokuai.com/create.json', data=params, files=files, headers=self.headers) <NE...
im: 图片字节 im_type: 题目类型
625941e88e7ae83300e4b44d
def get_score(scr_str, dest_str, word_len): <NEW_LINE> <INDENT> count = word_len <NEW_LINE> for i in range(word_len): <NEW_LINE> <INDENT> if scr_str[i] == dest_str[i]: <NEW_LINE> <INDENT> count -= 1 <NEW_LINE> <DEDENT> <DEDENT> return count
Get the proximity score with the destination word
625941e8460517430c3945f8
def _partition(self): <NEW_LINE> <INDENT> text = self._cmd.text()[len(self._cmd.prefix()):] <NEW_LINE> if not text or not text.strip(): <NEW_LINE> <INDENT> return [], '', [] <NEW_LINE> <DEDENT> parser = runners.CommandParser() <NEW_LINE> result = parser.parse(text, fallback=True, keep=True) <NEW_LINE> parts = [x for x ...
Divide the commandline text into chunks around the cursor position. Return: ([parts_before_cursor], 'part_under_cursor', [parts_after_cursor])
625941e8187af65679ca559f
def stop(self): <NEW_LINE> <INDENT> self.stop_loop.set()
Flag the periodic operation to stop.
625941e81d351010ab855f9a
def createURLParserCtxt(filename, options): <NEW_LINE> <INDENT> ret = libxml2mod.xmlCreateURLParserCtxt(filename, options) <NEW_LINE> if ret is None:raise parserError('xmlCreateURLParserCtxt() failed') <NEW_LINE> return parserCtxt(_obj=ret)
Create a parser context for a file or URL content. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time and for file accesses
625941e857b8e32f5248391d
def recursive_star(turtle, n, r, depth, f): <NEW_LINE> <INDENT> if depth == 0: <NEW_LINE> <INDENT> star(turtle, n, f * 4) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> for k in range(0, n): <NEW_LINE> <INDENT> turtle.pendown() <NEW_LINE> turtle.forward(r) <NEW_LINE> recursive_star(turtle, n, f * r, depth - 1, f) <NEW_L...
At each point of the star, draw another smaller star, and so on, up to given depth. Rescale the stars by a factor f at each generation.
625941e863b5f9789fde7565
def events(self, last_id: Optional[str] = None): <NEW_LINE> <INDENT> return self._http.sse_request("/resources/events", last_id)
Fetches resource related events. :param last_id: ID of the last processed event, if provided, only events after the event with the provided ID will be returned. :return: iterator of resource events
625941e8baa26c4b54cb159a
def normalize_image(self, batch): <NEW_LINE> <INDENT> return np.array(batch) / 255.
Normalize image to [0,1] range. Args: batch: a single image or batch of images
625941e83317a56b8693a0cd
def __init__(self, key, secret): <NEW_LINE> <INDENT> self.key = key <NEW_LINE> self.secret = secret
Set the key and secret.
625941e88a43f66fc4b544e0
def addcommenttocommit(self, project_id, author, sha, path, line, note): <NEW_LINE> <INDENT> data = { 'author': author, 'note': note, 'path': path, 'line': line, 'line_type': 'new' } <NEW_LINE> request = requests.post( '{0}/{1}/repository/commits/{2}/comments'.format(self.projects_url, project_id, sha), headers=self.he...
Adds an inline comment to a specific commit :param project_id: project id :param author: The author info as returned by create mergerequest :param sha: The name of a repository branch or tag or if not given the default branch :param path: The file path :param line: The line number :param note: Text of comment :return:...
625941e896565a6dacc8fb49
def test_adds_fields_to_the_form(self): <NEW_LINE> <INDENT> form = DummyModelForm(self.user) <NEW_LINE> self.assertTrue('tags' in form.fields) <NEW_LINE> self.assertEqual(form.fields['tags'].help_text.encode(), b'Help text') <NEW_LINE> self.assertTrue('global_tags' in form.fields)
A form that inherits from ``UserTagsFormMixin`` should have the fields that are defined on the model's ``TAG_FIELDS`` options dict as form fields.
625941e823849d37ff7b350b
def update(self, **kwargs): <NEW_LINE> <INDENT> pass
更新日历 :param 多个 :return:
625941e88e7ae83300e4b44e
def save_emission_limit(): <NEW_LINE> <INDENT> emission_scalars = scalars.loc[scalars["carrier"] == "emission"] <NEW_LINE> filename = os.path.join(destination, "additional_scalars.csv") <NEW_LINE> save_df(emission_scalars, filename) <NEW_LINE> return
Saves emission limit to `destination`
625941e823e79379d52ee9de
def test_acceptResponseBeforeApplicationBox(self): <NEW_LINE> <INDENT> earlyBox = {'foo': 'bar'} <NEW_LINE> class EarlyReceiver: <NEW_LINE> <INDENT> def startReceivingBoxes(self, sender): <NEW_LINE> <INDENT> sender.sendBox(earlyBox) <NEW_LINE> <DEDENT> <DEDENT> object.__setattr__(self.factory, 'receiverFactory', EarlyR...
If the protocol L{_RouteConnector.accept} binds to a new route sends a box in its C{startReceivingBoxes} method, that box is sent to the network after the I{Connect} response is sent.
625941e82c8b7c6e89b35c3d
def test_init_closed_state(self): <NEW_LINE> <INDENT> mock_driver = MockDriver() <NEW_LINE> mock_driver.lower_limit_switch = True <NEW_LINE> door_model = Door("Test door", mock_driver, 1, 1, 2) <NEW_LINE> self.assertEqual(door_model.state.__class__.__name__, "ClosedState")
Pretend, the door is closed. This should result in closed state.
625941e8dd821e528d63b625
def resources_history( self, request, **kwargs ): <NEW_LINE> <INDENT> cls = kwargs.pop('cls', None) <NEW_LINE> error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } <NEW_LINE> error_map.update(kwargs.pop('error_map', {})) <NEW_LINE> api_version = "2020-04-01-preview" <NEW_...
List all snapshots of a resource for a given time interval. :param request: :type request: ~azure.mgmt.resourcegraph.models.ResourcesHistoryRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: object, or the result of cls(response) :rtype: object :raises: ~azure.cor...
625941e8ff9c53063f47c671
def location_list(self, name=''): <NEW_LINE> <INDENT> locations = self.jdbc_source.location_list(self.filterkey, self.parameterkey, name) <NEW_LINE> filter_name = self.jdbc_source.get_filter_name(self.filterkey) <NEW_LINE> parameter_name = self.jdbc_source.get_parameter_name(self.parameterkey) <NEW_LINE> locations = [ ...
Search locations by given name. Case insensitive wildcard matching is used.
625941e821a7993f00bc8177
def next_move(self, game, state, timeout): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> action = read_some_input('What is your move? \n') <NEW_LINE> stdout.flush() <NEW_LINE> if (action == "pass"): <NEW_LINE> <INDENT> return action <NEW_LINE> <DEDENT> row = int(action[0]) <NEW_LINE> col = index(ascii_lowercase, ...
Read 5d and convert to (5,4)
625941e8ec188e330fd5ac15
def remove_framework_envs_from_user(framework_tag): <NEW_LINE> <INDENT> profile_filepath = os.path.join(os.path.expanduser('~'), ".profile") <NEW_LINE> content = "" <NEW_LINE> framework_header = profile_tag.format(framework_tag) <NEW_LINE> try: <NEW_LINE> <INDENT> with open(profile_filepath, "r", encoding='utf-8') as f...
Remove all envs from user if found
625941e8009cb60464c6382d
def open_spider(self, spider): <NEW_LINE> <INDENT> self.file = open('sample_urls.txt', 'w') <NEW_LINE> if spider.auto_download: <NEW_LINE> <INDENT> self.download_folder = './downloads/' <NEW_LINE> if not os.path.exists(self.download_folder): <NEW_LINE> <INDENT> os.makedirs(self.download_folder) <NEW_LINE> <DEDENT> self...
Write the results to a file. :param spider: The spider used. :return: None
625941e8c432627299f050c9
def test_archive_status_code_200(self): <NEW_LINE> <INDENT> status_code = self.client.get(reverse('blog:archive')).status_code <NEW_LINE> self.assertEqual(status_code, 200)
blog:archive devuelve status_code 200.
625941e83c8af77a43ae3c25
def setUp(self): <NEW_LINE> <INDENT> plaso_timestamp = timelib.Timestamp() <NEW_LINE> self._event_timestamp = plaso_timestamp.CopyFromString( u'2012-06-27 18:17:01+00:00') <NEW_LINE> self._event_object = MySQL4n6TimeTestEvent(self._event_timestamp) <NEW_LINE> output_mediator = self._CreateOutputMediator() <NEW_LINE> se...
Sets up the objects needed for this test.
625941e821a7993f00bc8178
def post(self, request): <NEW_LINE> <INDENT> from job_notification import JobNotification <NEW_LINE> from lxml.etree import XMLSyntaxError, LxmlError <NEW_LINE> from notification import process_notification <NEW_LINE> from models import ImportJob <NEW_LINE> import traceback <NEW_LINE> logger.info("Received import notif...
Receives notifications from VS that a relevant import has taken place. Notification is set up in notification.py :param request: Django request object :return: Response
625941e8925a0f43d254a2fb
def play_motion(self, action, start_voice="好哦", done_voice=None, is_blocking=True): <NEW_LINE> <INDENT> if not self.is_action_done: <NEW_LINE> <INDENT> print("still acting.") <NEW_LINE> return <NEW_LINE> <DEDENT> self.is_action_done = False <NEW_LINE> if start_voice: <NEW_LINE> <INDENT> self.google_tts(start_voice) <NE...
Available page_num: -2 : BREAK -1 : STOP "ini_pose": initial pose # 0 : . 4 : Thank you 41: Introduction 24: Wow 23: Yes go 15: Sit down 1: Stand up 54: Clap please 27: Oops 38: Bye bye 111 : Intro01 115 : Intro02 118 : Intro03 # soccer 80 : Init pose 122 : Get up(Front) 123 : Get up(...
625941e856ac1b37e6264646
def query_to_vector(self, query_terms): <NEW_LINE> <INDENT> term_idf = {} <NEW_LINE> for term in query_terms: <NEW_LINE> <INDENT> if term in self.doc_freqs: <NEW_LINE> <INDENT> term_idf[term] = math.log10((self.doc_count*1.0)/self.doc_freqs[term]) <NEW_LINE> <DEDENT> <DEDENT> return term_idf
Convert a list of query terms into a dict mapping term to inverse document frequency (IDF). Compute IDF of term T as N / log10(document frequency of T), where N is the total number of documents. You may need to use the instance variables of the Index object to compute this. Do not modify the method signature. If a que...
625941e8956e5f7376d712ec
def Mkdir(path, parents = False): <NEW_LINE> <INDENT> if parents: <NEW_LINE> <INDENT> parentPath = "" <NEW_LINE> for dir in path.split(os.path.sep): <NEW_LINE> <INDENT> parentPath = os.path.join(parentPath, dir) <NEW_LINE> Mkdir(parentPath, parents = False) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> if not ...
Create a directory at the specified path. Make all parents if parents is True.
625941e866673b3332b92511
def click_delete(self): <NEW_LINE> <INDENT> with allure.step("点击删除按钮"): <NEW_LINE> <INDENT> self.steps("../../page_object/newhouse/newhouselist.yaml") <NEW_LINE> <DEDENT> self.tsleep(2) <NEW_LINE> return self
点击删除按钮 :return:
625941e821bff66bcd684dce
def reverseStr(string): <NEW_LINE> <INDENT> return string[::-1]
Reverse string
625941e83eb6a72ae02ec969
def _filter_data(self, item_path): <NEW_LINE> <INDENT> frames = BodyFileReader(item_path) <NEW_LINE> if len(frames) >= 60: <NEW_LINE> <INDENT> for frame in frames: <NEW_LINE> <INDENT> if len(frame) == 0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> return True <NEW_LINE> <DEDENT> return False
Return True to add this item and false otherwise. Args: item_path(str): path of the item. Todo: Refactor filter.
625941e8d4950a0f3b08c7c8
def command_admins(self, update): <NEW_LINE> <INDENT> message, reply_markup = 'This is the default response.', None <NEW_LINE> chat_id = utils.get_chat_id(update) <NEW_LINE> message = "admins:\n" <NEW_LINE> for admin in admins: <NEW_LINE> <INDENT> message += admin + '\n' <NEW_LINE> <DEDENT> if reply_markup is None: <NE...
laat alle admins zien.
625941e84a966d76dd551494
def test_pslib_1(self): <NEW_LINE> <INDENT> import paddle.fluid as fluid <NEW_LINE> from paddle.fluid.incubate.fleet.parameter_server.pslib import fleet <NEW_LINE> from paddle.fluid.incubate.fleet.parameter_server.pslib import PSLib <NEW_LINE> from paddle.fluid.incubate.fleet.base.role_maker import GeneralRoleMaker <NE...
Test cases for pslib.
625941e8fbf16365ca6f664d
def read_classes(classes_path): <NEW_LINE> <INDENT> with open(classes_path) as f: <NEW_LINE> <INDENT> class_names = f.readlines() <NEW_LINE> <DEDENT> class_names = [c.strip() for c in class_names] <NEW_LINE> return class_names
Reads classes from file. Args: classes_path (str): Path to file containing names of all classes. Returns: list: List containing names of all classes.
625941e8fb3f5b602dac3b18
def save(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return pmc.system.saveAs(self.path) <NEW_LINE> <DEDENT> except RuntimeError as err: <NEW_LINE> <INDENT> log.warning("Missing directories in path. Creating folders.") <NEW_LINE> self.folder_path.makedirs_p() <NEW_LINE> return pmc.system.saveAs(self.path)
Saves the scene file Returns: Path: The path to the scene file if successful
625941e83d592f4c4ed1d4e1
def populateMultiShipDesignList(self): <NEW_LINE> <INDENT> for shipDesignID in funcs.sortStringList(self.game.shipDesigns.keys()): <NEW_LINE> <INDENT> myShipDesign = self.game.shipDesignObjects[shipDesignID] <NEW_LINE> self.multidesignList.myScrolledList.addItem(text=myShipDesign.name, extraArgs=shipDesignID)
Fill the list with Ship designs
625941e85510c4643540f859
def add(self, entry): <NEW_LINE> <INDENT> self.entriesIndexingExpression += [entry] <NEW_LINE> return self
Add an entry to the indexing expression
625941e891f36d47f21ac977
def staging_test(): <NEW_LINE> <INDENT> env.project_dir = env.project + '_test' <NEW_LINE> env.environment = 'staging_test' <NEW_LINE> env.use_apache = False <NEW_LINE> env.hosts = ['fen-vz-atamis.fen.aptivate.org'] <NEW_LINE> _local_setup()
use staging environment on remote host to run tests
625941e8507cdc57c6307165
def attributes(self) -> Dict[str, str]: <NEW_LINE> <INDENT> length = c_bst_ulong() <NEW_LINE> sarr = ctypes.POINTER(ctypes.c_char_p)() <NEW_LINE> _check_call(_LIB.XGBoosterGetAttrNames(self.handle, ctypes.byref(length), ctypes.byref(sarr))) <NEW_LINE> attr_names = from_cstr_to_pystr(sarr, length) <NEW_LINE> return {n: ...
Get attributes stored in the Booster as a dictionary. Returns ------- result : dictionary of attribute_name: attribute_value pairs of strings. Returns an empty dict if there's no attributes.
625941e80fa83653e4657438
def open(self, node, **kwds): <NEW_LINE> <INDENT> uri = self.vnodes[node].uri <NEW_LINE> try: <NEW_LINE> <INDENT> return uri.open(**kwds) <NEW_LINE> <DEDENT> except OSError as error: <NEW_LINE> <INDENT> raise self.URISpecificationError(uri=uri, reason=str(error))
Open the file associated with {node}
625941e81d351010ab855f9b
def getSpecs(self): <NEW_LINE> <INDENT> content = {} <NEW_LINE> if len(self.roles) != 0: <NEW_LINE> <INDENT> content["roles"] = self.roles <NEW_LINE> <DEDENT> if self.password: <NEW_LINE> <INDENT> content["password"] = self.password <NEW_LINE> <DEDENT> return content
Get specs Returns: dict: Representation of the object
625941e8507cdc57c6307166
def read_item_names(): <NEW_LINE> <INDENT> file_name = (os.path.expanduser('./movies.dat')) <NEW_LINE> rid_to_name = {} <NEW_LINE> name_to_rid = {} <NEW_LINE> with io.open(file_name, 'r', encoding='ISO-8859-1') as f: <NEW_LINE> <INDENT> for line in f: <NEW_LINE> <INDENT> line = line.split('::') <NEW_LINE> rid_to_name[l...
获取电影名到电影id 和 电影id到电影名的映射
625941e8bf627c535bc1364f
def _parfor_lowering_finalize_reduction( parfor, redarrs, lowerer, parfor_reddict, ): <NEW_LINE> <INDENT> from numba.np.ufunc.parallel import get_thread_count <NEW_LINE> thread_count = get_thread_count() <NEW_LINE> for redvar_name, redarr_var in redarrs.items(): <NEW_LINE> <INDENT> redvar_typ = lowerer.fndesc.typemap[r...
Emit code to finalize the reduction from the intermediate values of each thread.
625941e8090684286d50f16d
def get_random_question_two(G, tag_node, initial_prob, initial_node): <NEW_LINE> <INDENT> bias = 10e-6 <NEW_LINE> neighbor_questions = list(G[tag_node]) <NEW_LINE> if len(neighbor_questions) >= 10000: <NEW_LINE> <INDENT> rand_idx = random.randint(0, len(neighbor_questions) - 1) <NEW_LINE> node = neighbor_questions[rand...
:param G: Graph :param tag_node: tag node :param initial_prob: initial probability :param initial_node: initial node so dont link back to it :return: a tag node and a probability of occurence
625941e8e5267d203edce117
def G(self): <NEW_LINE> <INDENT> v_name = self.code_list[self.list_current][0] <NEW_LINE> if len(self.pro_list): <NEW_LINE> <INDENT> v_proc = self.pro_list[-1].p_name <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> v_proc = 'main' <NEW_LINE> <DEDENT> v_kind = 0 <NEW_LINE> v_type = 'integer' <NEW_LINE> v_lev = self.curre...
<参数>→<变量>
625941e85fc7496912cc3dfe
def test_vector_components(): <NEW_LINE> <INDENT> components = get_wind_components(np.array([150, -150, 10, 20]), np.array([0, 90, 30, 45])) <NEW_LINE> results_should_be = [[0, 150, -5, -14.1421356], [-150, 0, -8.660254, -14.1421356]] <NEW_LINE> assert_array_almost_equal(results_should_be, components)
Test calculating wind components with vectors
625941e867a9b606de4a8337
def __init__(self, config, logdir): <NEW_LINE> <INDENT> self._config = config <NEW_LINE> self._logdir = logdir
Constructor. Args: config: A Luatable-like T object holding training config. logdir: String, a directory where checkpoints and summaries are written.
625941e88c0ade5d55d3ee3f
def solveSudoku(self, board): <NEW_LINE> <INDENT> def digui(row,col): <NEW_LINE> <INDENT> if row == 9: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if col == 9: <NEW_LINE> <INDENT> return digui(row + 1,0) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if board[row][col] == '.': <NEW_LINE> <INDENT> nums = set('123...
:type board: List[List[str]] :rtype: void Do not return anything, modify board in-place instead.
625941e89f2886367277ad0a
def remove_node(self, node: 'Node', cascading: bool): <NEW_LINE> <INDENT> if self is node: <NEW_LINE> <INDENT> raise ValueError("A Node cannot delete itself") <NEW_LINE> <DEDENT> parent = node.get_parent() <NEW_LINE> parent.children.remove(node) <NEW_LINE> if not cascading: <NEW_LINE> <INDENT> for child in node.get_chi...
Removes a node from the tree and handles the descendants accordingly. Args: node: The node to remove. cascading: If true, deletes all descendants of the node, if false, adds all children of the node to the nodes' parents' children. Raises a ValueError if the node to be deleted eq...
625941e8851cf427c661a98b
def distutils_dir_name(dir_name): <NEW_LINE> <INDENT> f = "{dirname}.{platform}-{version[0]}.{version[1]}" <NEW_LINE> return f.format(dirname=dir_name, platform=sysconfig.get_platform(), version=sys.version_info)
Returns the name of a distutils build directory
625941e8099cdd3c635f10d9
def _interp_evaluate(coefficients, t0, t1, t): <NEW_LINE> <INDENT> dtype = coefficients[0][0].dtype <NEW_LINE> device = coefficients[0][0].device <NEW_LINE> t0 = _convert_to_tensor(t0, dtype=dtype, device=device) <NEW_LINE> t1 = _convert_to_tensor(t1, dtype=dtype, device=device) <NEW_LINE> t = _convert_to_tensor(t, dty...
Evaluate polynomial interpolation at the given time point. Args: coefficients: list of Tensor coefficients as created by `interp_fit`. t0: scalar float64 Tensor giving the start of the interval. t1: scalar float64 Tensor giving the end of the interval. t: scalar float64 Tensor giving the desired interp...
625941e8377c676e91272627
def test_driver_2(): <NEW_LINE> <INDENT> args_list = [ 'tests/tests.csv', '-is', ',', '-target', 'class', '-g', '1', '-p', '2', '-cv', '2', '-s',' 45', '-config', 'TPOT light', '-v', '1' ] <NEW_LINE> args = _get_arg_parser().parse_args(args_list) <NEW_LINE> with captured_output() as (out, err): <NEW_LINE> <INDENT> tpot...
Assert that the tpot_driver() in TPOT driver outputs normal result with verbosity = 1.
625941e81f037a2d8b94667d
def display_weather(city, instance, fg=[255, 255, 255], bg=[0, 0, 0]): <NEW_LINE> <INDENT> condition = get_conditions(city) <NEW_LINE> instance.show_message( condition.text, text_color=fg, back_color=bg )
Display the curent weather
625941e876e4537e8c351af6
def status(self, stat, repo_dir_path): <NEW_LINE> <INDENT> self._check_sync(stat, repo_dir_path) <NEW_LINE> if os.path.exists(repo_dir_path): <NEW_LINE> <INDENT> self._status_summary(stat, repo_dir_path)
If the repo destination directory exists, ensure it is correct (from correct URL, correct branch or tag), and possibly update the source. If the repo destination directory does not exist, checkout the correct branch or tag.
625941e8566aa707497f49e3
def init_lambdas(self, from_cache=False, cache_file=None, full_information=True): <NEW_LINE> <INDENT> if from_cache: <NEW_LINE> <INDENT> objects = self.load_objects_from_cache(cache_file, AWSLambda) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> objects = self.lambda_client.get_all_lambdas(full_information=full_informat...
Init AWS lambdas @param from_cache: @param cache_file: @param full_information: @return:
625941e8cc0a2c11143dd313
def get_respiration_data(self, name): <NEW_LINE> <INDENT> return _moduleconnectorwrapper.PyX2M200_get_respiration_data(self, name)
get_respiration_data(PyX2M200 self, std::string const name) -> RespirationData Get one respiration data message from subscription queue. Parameters ---------- * `name` : Name of subscription Returns ------- A data object holding the resulting respiration data.
625941e8dc8b845886cb59b7
def on_resolve_vendor( self, name: str, source: str, target: str ) -> Optional[bool]: <NEW_LINE> <INDENT> pass
Event triggered when vendor is resolved # Arguments name: The name of the vendor source: The source configuration target: The target directory (may or may not exists yet) Return False to prevent the default automatic resolution
625941e83d592f4c4ed1d4e2
def impact_included(rule, impact): <NEW_LINE> <INDENT> if impact == 'minor' or impact is None: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> elif impact == 'serious': <NEW_LINE> <INDENT> if rule['impact'] != 'minor': <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> elif impact == 'critical': <NEW_LINE...
Filter violations with specified impact level or higher.
625941e8bde94217f368326d
def get_table_row(self, y: int) -> int: <NEW_LINE> <INDENT> for i in range(1, len(self._rows)): <NEW_LINE> <INDENT> if self._rows[i - 1] <= y < self._rows[i]: <NEW_LINE> <INDENT> return i <NEW_LINE> <DEDENT> <DEDENT> return None
Return the row index for a y coordinate
625941e8f548e778e58cda00
def string(self) -> str: <NEW_LINE> <INDENT> return self._data
Returns the build string from var. content
625941e8a219f33f34628de4
def testAlleleModDateSearch(self): <NEW_LINE> <INDENT> driver = self.driver <NEW_LINE> driver.find_element(By.ID, "modificationDate").send_keys("2004-11-17") <NEW_LINE> driver.find_element(By.ID, 'searchButton').click() <NEW_LINE> WebDriverWait(self.driver, 10).until(EC.text_to_be_present_in_element((By.ID, 'resultsTab...
@Status tests that an allele search using the Modified By field returns correct data @see pwi-allele-date-search-4
625941e866656f66f7cbc62e
def detectCapitalUse(self, word): <NEW_LINE> <INDENT> if len(word) == 1: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if ord(word[0]) > 96: <NEW_LINE> <INDENT> for char in word: <NEW_LINE> <INDENT> if ord(char) < 91: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> return True <NEW_LINE> <DEDENT> if...
:type word: str :rtype: bool
625941e84f6381625f114ebd