code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def split_first(line, separator): <NEW_LINE> <INDENT> parts = line.split(separator) <NEW_LINE> return parts[0], separator.join(parts[1:])
Split a string to (first part, remainder)
625941df5510c4643540f73e
def show_corpus_analysis(self): <NEW_LINE> <INDENT> print('Size of vocabulary: %d' % self.vocabs.get_num_of_words()) <NEW_LINE> print('Number of running words: %d' % self.running_wrds_num) <NEW_LINE> print('Number of sentences: %d' % self.sent_num) <NEW_LINE> print('Average sentence length: %.2f' % self.avg_sent_len) <...
Show corpus data analysis
625941df30c21e258bdfa801
def version(self): <NEW_LINE> <INDENT> return str(Shell.git("describe", "--tags"))[:-1]
returns the verison of the code from github :rtype: the git tags
625941df379a373c97cfaea8
def Integral(f,a,b,dx): <NEW_LINE> <INDENT> if a >= b: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> x = a <NEW_LINE> S = 0 <NEW_LINE> while (x <= b): <NEW_LINE> <INDENT> S += f(x)*dx <NEW_LINE> x += dx <NEW_LINE> <DEDENT> return S
Definite Integral of f on interval [a,b] incrementing by dx. Note a recursive definition can not be used since Python stack limit. Instead the integral was summed up directly.
625941df4d74a7450ccd4526
def __str__(self): <NEW_LINE> <INDENT> return '[' + self._type_str() + ' (size {0} from {1})]'.format(self.size, self.pos)
create a short but informative textual representation of self
625941dfdc8b845886cb5898
def setURL(self, url): <NEW_LINE> <INDENT> self._URL_recibida = url
return la URL válida de TVE que se le pasa a la clase
625941df7d43ff24873a3004
def buy(self, stock_code, price, amount=0, volume=0, entrust_prop='limit'): <NEW_LINE> <INDENT> market_type = helpers.get_stock_type(stock_code) <NEW_LINE> bsflag = None <NEW_LINE> if entrust_prop == 'limit': <NEW_LINE> <INDENT> bsflag = '0B' <NEW_LINE> <DEDENT> elif entrust_prop == 'market_cancel': <NEW_LINE> <INDENT>...
买入股票 :param stock_code: 股票代码 :param price: 买入价格 :param amount: 买入股数 :param volume: 买入总金额 由 volume / price 取整, 若指定 price 则此参数无效 :param entrust_prop: 委托类型 'limit' 限价单 , 'market' 市价单, 'market_cancel' 五档即时成交剩余转限制
625941df26068e7796caf045
def setSession(self, session): <NEW_LINE> <INDENT> self.session = session <NEW_LINE> model = session.models.executions <NEW_LINE> model.symbolIcon = symbolIcon <NEW_LINE> self.executionsView.setModel(model)
Configures this instance for a session. @param session Session instance @return None
625941dfd53ae8145f87a5cc
def _get_dict_entry(self, field_name, idx, key, value, values_list=None): <NEW_LINE> <INDENT> _key_field_name = DictWidget._key_field_name_tpl.format(field_name, idx) <NEW_LINE> if self.key_widget: <NEW_LINE> <INDENT> if isinstance(self.key_widget, type): <NEW_LINE> <INDENT> self.key_widget = self.key_widget() <NEW_LIN...
Returns a tuple (pair) with a rendered key and value input field. `field_name` and `id` will be used in the names of the input fields.
625941df31939e2706e4d1c7
def __init__(self, s_instrument): <NEW_LINE> <INDENT> self.book_bid = BidSide() <NEW_LINE> self.book_ask = AskSide() <NEW_LINE> self.s_instrument = s_instrument <NEW_LINE> self.f_time = 0 <NEW_LINE> self.s_time = '' <NEW_LINE> self.stop_iteration = False <NEW_LINE> self.stop_time = None <NEW_LINE> self.i_last_order_id ...
Initialize a LimitOrderBook object. Save all parameters as attributes :param s_instrument: string. name of the instrument of book
625941df5fc7496912cc3ce0
def part1_answer_counter(people: list[str]) -> int: <NEW_LINE> <INDENT> return len(set("".join(people)))
Count the number of questions to which _anyone_ answered "yes" :param people: group data for the people in the group :return: number of yes answers
625941dfad47b63b2c50a2e0
def get_data_for_graph_xaxis(key, data_list): <NEW_LINE> <INDENT> data = [] <NEW_LINE> for row in data_list: <NEW_LINE> <INDENT> if row[key] not in data: <NEW_LINE> <INDENT> data.append(row[key]) <NEW_LINE> <DEDENT> <DEDENT> return data
Extract a specific jkey from the data_list and retunr and array of unique values to be use in Graph as xaxis :param key: :param data_list: :return:
625941df32920d7e50b28535
def add_roast_event(self, event): <NEW_LINE> <INDENT> event_time = self.get_roast_time() <NEW_LINE> def get_valid_config(): <NEW_LINE> <INDENT> config = self.get_roast_properties()['last']['config'] <NEW_LINE> if not config['valid']: <NEW_LINE> <INDENT> self._log.debug("Invalid config at event time, retrying...") <NEW_...
Add an event to the roast log. This method should be used for registering events that may be worth tracking like first crack, second crack and the dropping of coffee. Similar to the standard reading output from the roaster, manually created events will include the current configuration reading, time and metadata passe...
625941dfa8370b7717052c00
def test7(self): <NEW_LINE> <INDENT> particles = create_nested_multiple(3,[1.0|units.MSun, 1.2|units.MSun, 0.9|units.MSun], [1.0|units.AU, 100.0|units.AU], [0.1, 0.5], [0.01, 80.0*numpy.pi/180.0], [0.01, 0.01], [0.01, 0.01]) <NEW_LINE> binaries = particles[particles.is_binary] <NEW_LINE> stars = particles - binaries <N...
test collision detection in 3-body system
625941df6fb2d068a760f404
def POST(request_environ, registration_context, portlet_context, runtime_context, user_context, markup_params, interaction_params, ): <NEW_LINE> <INDENT> pass
Return a BlockingInteractionResponse
625941dfcdde0d52a9e53397
def _get_language_modeling_inputs(filename, delimiter="\n", repeat=1, append_space_to_final_punctionation=True): <NEW_LINE> <INDENT> with tf.gfile.Open(filename) as f: <NEW_LINE> <INDENT> text = f.read() <NEW_LINE> <DEDENT> inputs = text.split(delimiter) <NEW_LINE> if not inputs[-1]: <NEW_LINE> <INDENT> inputs.pop() <N...
Read a file of partial texts to continue. The purpose of append_space_to_final_punctionation is that SubwordTokenizer groups punctuation and the ensuing space in the same token. Adding a space causes the token to be completed. Args: filename: a string delimiter: a string repeat: an integer - we repeat the enti...
625941dfcc40096d61595cb1
def get_alphas(self): <NEW_LINE> <INDENT> return [c for c in self.element.iter() if ('id' in c.attrib) and ('a_' in c.get('id'))]
Use the 'kineticLaw' from GNW sbml document :return:
625941df956e5f7376d711ce
def update_total(self): <NEW_LINE> <INDENT> self.total = self.cart.total <NEW_LINE> self.save() <NEW_LINE> return self.total
Updates total sum in order according to cart total.
625941df3346ee7daa2b30d0
def test_computerlab_listlabs(self): <NEW_LINE> <INDENT> pass
Test case for computerlab_listlabs View a list of the locations that use the Computer Lab add-on # noqa: E501
625941df566aa707497f48c6
def __register_special_options(self): <NEW_LINE> <INDENT> self._parser.add_argument( "-m", "--mirror", action="store_true", dest="mirror", default=False, help="Take packages from \\fInon-marked\\fR " "repository if can't find in marked one. Useful if build in " "marked repository could not be completed in full due to "...
Registers the options that control specific combirepo behaviour.
625941dfcad5886f8bd2733b
def loop_subdivision(vertices,simplices): <NEW_LINE> <INDENT> edges = set() <NEW_LINE> for s in simplices: <NEW_LINE> <INDENT> edges.update([frozenset(x) for x in combinations(ravel(s),2)]) <NEW_LINE> <DEDENT> edge_index_map = {} <NEW_LINE> for n,e in enumerate(edges): <NEW_LINE> <INDENT> edge_index_map[e] = len(vertic...
Given a triangle mesh represented by the matrices (vertices,simplices), return new vertex and simplex arrays for the Loop subdivided mesh.
625941df63f4b57ef0001472
def _targeting_priority(self, attacking_unit, unit1, unit2): <NEW_LINE> <INDENT> if unit2['stability'] <= 0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if unit1 is None: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if unit1['id'] > 3 and unit2['id'] < 4: <NEW_LINE> <INDENT> return True <NEW_LINE> <DED...
Return true if unit2 has a higher priority than unit1 when attacked by 'attacking_unit'. The priority is defined by the following rules: 1) Prioritize Information over Firewalls 2) Choose the nearest target(s). Note that the potential targets could include multiple locations if they are the same distanc...
625941df91f36d47f21ac858
def overlap_new(self, toktype, debug=False): <NEW_LINE> <INDENT> ne_overlap = set(token for token in self._overlap if self.ne_all(token)) <NEW_LINE> if toktype == 'ne': <NEW_LINE> <INDENT> if debug: <NEW_LINE> <INDENT> print("ne overlap", ne_overlap) <NEW_LINE> <DEDENT> return ne_overlap <NEW_LINE> <DEDENT> elif toktyp...
Compute the overlap between text and hypothesis. :param toktype: distinguish Named Entities from ordinary words :type toktype: 'ne' or 'word'
625941df566aa707497f48c7
def save_as_json(self, out_fname): <NEW_LINE> <INDENT> with open(out_fname, 'w') as out_f: <NEW_LINE> <INDENT> json.dump(self.tilespec, out_f, sort_keys=True, indent=4)
Saves the mfov as a tilespec (used for debugging).
625941df046cf37aa974d0a7
def onFitRangeView(self, xmin=None, xmax=None): <NEW_LINE> <INDENT> tempx = [] <NEW_LINE> tempdx = [] <NEW_LINE> tempy = [] <NEW_LINE> tempdy = [] <NEW_LINE> if self.dx is None: <NEW_LINE> <INDENT> self.dx = numpy.zeros(len(self.x)) <NEW_LINE> <DEDENT> if self.dy is None: <NEW_LINE> <INDENT> self.dy = numpy.zeros(len(s...
It limits View data range to plot from min to max :param xmin: the minimum value of x to plot. :param xmax: the maximum value of x to plot
625941dfab23a570cc2504e7
def main(): <NEW_LINE> <INDENT> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'WeatherProyect.settings') <NEW_LINE> try: <NEW_LINE> <INDENT> from django.core.management import execute_from_command_line <NEW_LINE> <DEDENT> except ImportError as exc: <NEW_LINE> <INDENT> raise ImportError( "Couldn't import Django. Are y...
Run administrative tasks.
625941df187af65679ca5482
def cmd_uh(self, args, msg): <NEW_LINE> <INDENT> return self.cmd_price(['U-HVIX'] + args, msg)
Returns the price of a item in U-HVIX
625941df4f88993c3716c3c7
def test_parameters_kfold_fail(self): <NEW_LINE> <INDENT> scaler = MinMaxScaler(copy=False, feature_range=(-1, 1)) <NEW_LINE> classifier = GaussianNB() <NEW_LINE> split = {'split_method': 'kfolds', 'n_splits': 'fail'} <NEW_LINE> data = 'data_0inches.npy' <NEW_LINE> labels = 'labels_0inches.npy' <NEW_LINE> plots = {'plo...
Test that it run an experiment unsucessfully
625941df7d847024c06be621
def _createDialog(self): <NEW_LINE> <INDENT> self.dialog.setMinimumWidth(640) <NEW_LINE> self.dialog.setMinimumHeight(640) <NEW_LINE> self.dialog.setWindowTitle(catalog.i18nc("@title:window", "Crash Report")) <NEW_LINE> if self.has_started: <NEW_LINE> <INDENT> self.dialog.finished.connect(self._close) <NEW_LINE> <DEDEN...
Creates a modal dialog.
625941df50812a4eaa59c681
def updates(begin_date, end_date, do_externals, verbose=False, testing=False, force=False): <NEW_LINE> <INDENT> global CONFIGURATION <NEW_LINE> CONFIGURATION = lifehacking_config.load_config() <NEW_LINE> os.makedirs(FILECONF('general', 'charts'), exist_ok=True) <NEW_LINE> if do_externals: <NEW_LINE> <INDENT> if verbose...
Update my Quantified Self record files, which are generally CSV files with a row for each day. This also prepares some files for making charts. Finally, it calls the dashboard code, which uses matplotlib to make the charts, as well as generating the HTML they are embedded in. The argument do_externals says whether t...
625941df462c4b4f79d1da33
def p_text_action(p) : <NEW_LINE> <INDENT> t = 'text ( text="'+p[3]['text']+'"' <NEW_LINE> t = addValue(t,'size',p) <NEW_LINE> t = addString(t,'spacing',p) <NEW_LINE> t = addString(t,'font',p) <NEW_LINE> t = addString(t,'direction',p) <NEW_LINE> t = addString(t,'language',p) <NEW_LINE> t = addString(t,'script',p) <NEW_...
text_action : text LPAREN keywordargument_list RPAREN SEMICOL
625941dfad47b63b2c50a2e1
def test_paraboloid1(self): <NEW_LINE> <INDENT> self.engine = TracerEngine(self.assembly) <NEW_LINE> params = self.engine.ray_tracer(self._bund,1,.05)[0] <NEW_LINE> correct_params = N.c_[[0,0,0],[0,0.618033989, 0.381966011]] <NEW_LINE> N.testing.assert_array_almost_equal(params, correct_params)
Tests a paraboloid
625941df73bcbd0ca4b2c3d9
def create_child(self, name): <NEW_LINE> <INDENT> Category(name, parent=self)
Create a new child category with the given name
625941df283ffb24f3c55c60
def _empty(starts, stops, steps): <NEW_LINE> <INDENT> for start, stop, step in zip(starts, stops, steps): <NEW_LINE> <INDENT> if step * (stop - start) <= 0: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> return False
Report whether there is an empty range in the triples or not.
625941df5e10d32532c5f288
def delete_subscription( self, integration_key, id, **kwargs ): <NEW_LINE> <INDENT> kwargs['async_req'] = kwargs.get( 'async_req', False ) <NEW_LINE> kwargs['_return_http_data_only'] = kwargs.get( '_return_http_data_only', True ) <NEW_LINE> kwargs['_preload_content'] = kwargs.get( '_preload_content', True ) <NEW_LINE> ...
Delete audit log subscription # noqa: E501 Delete an audit log subscription. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_subscription(integration_key, id, async_req=True) >>> result = thread.get() Arg...
625941df3cc13d1c6d3c76db
def test_message_len(self): <NEW_LINE> <INDENT> error_inserts = 0 <NEW_LINE> for i in range(0, self.max_insertions): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.mongo_db.insert({'i' : i}) <NEW_LINE> <DEDENT> except OperationFailure: <NEW_LINE> <INDENT> error_inserts += 1 <NEW_LINE> <DEDENT> <DEDENT> consumer = Si...
Makes sure we get all the messages
625941df21a7993f00bc8058
def PurplePrplGotAccountIdle(self, arg_account, arg_idle, arg_idle_time, *arg, **kw): <NEW_LINE> <INDENT> return self._dbus_object.PurplePrplGotAccountIdle( arg_account, arg_idle, arg_idle_time, *arg, **kw)
PurplePrplGotAccountIdle method: Parameters ---------- account: type: i, direction: in; idle: type: i, direction: in; idle_time: type: i, direction: in;
625941df8e05c05ec3eea6da
def removeTest(self, name, numTest=0): <NEW_LINE> <INDENT> for i in range(len(self.tabTests)): <NEW_LINE> <INDENT> if(name == self.tabTests[i][0]): <NEW_LINE> <INDENT> if(numTest == 0): <NEW_LINE> <INDENT> self.tabTests.pop(i) <NEW_LINE> return <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.tabTests[i].pop(numTest)...
supprime un test si numModel=0 tous les tests de name seront supprimés, sinon juste celui à l'indice numModel name = nom du test à supprimer (une chaine de charactères) numTest = l'indice du test à supprimer
625941dfb57a9660fec33beb
def get_template(): <NEW_LINE> <INDENT> with open('templates/latex_template_document') as template_file: <NEW_LINE> <INDENT> template = {'document':template_file.read().split()} <NEW_LINE> <DEDENT> with open('templates/latex_template_replace') as template_file: <NEW_LINE> <INDENT> template['replace'] = [(lambda x: x if...
Parse the template files and return a dictionary of them.
625941dfd486a94d0b98e4aa
def setResolvedFlag(self, wuConfigId, resolvedFlag): <NEW_LINE> <INDENT> self._modifyByWorkUnitConfigId( wuConfigId, ['resolvedFlag'], [resolvedFlag])
Set the resolved flag of a wuConfigId.
625941df24f1403a92600ec6
@login_required <NEW_LINE> def choose_transcripts(request): <NEW_LINE> <INDENT> error, validated_data = validate_transcripts_request(request, include_html5=True) <NEW_LINE> if error: <NEW_LINE> <INDENT> response = error_response({}, error) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> video = v...
Create/Update edx transcript in DS with chosen html5 subtitles from contentstore. Returns: status `Success` and resulted `edx_video_id` value Or error in case of validation failures.
625941df9f2886367277abee
def GetTestModules(): <NEW_LINE> <INDENT> testable_modules = [] <NEW_LINE> base_path = os.path.dirname(os.path.realpath(__file__)) <NEW_LINE> for dirpath, _, files in os.walk(base_path): <NEW_LINE> <INDENT> for f in files: <NEW_LINE> <INDENT> if f.endswith("_test.py") and f != os.path.basename(__file__): <NEW_LINE> <IN...
Return list of testable modules. We need to find all the test files (*_test.py) and get their relative path (internal/lib/utils_test.py) and translate it to an import path and strip the py ext (internal.lib.utils_test). Returns: List of strings (the testable module import path).
625941df1d351010ab855e7e
def set_SSECKey(self, value): <NEW_LINE> <INDENT> super(PutObjectInputSet, self)._set_input('SSECKey', value)
Set the value of the SSECKey input for this Choreo. ((optional, string) The customer-provided AES-256 256-bit (32-byte) encryption key for Amazon S3 to use to encrypt or decrypt your data.)
625941df656771135c3ebbd5
def one_hot_encoding(idx, size=2000): <NEW_LINE> <INDENT> vec = np.zeros((size, )) <NEW_LINE> vec[idx] = 1 <NEW_LINE> return vec
Converts word indexes to one-hot-encoded format. Arguments: idx -- int, number that represents the unique index the original word was mapped to. size -- int, the size of one-hot-encoding. Returns: vec -- numpy.ndarray shape(size, ), vector corresponding to one-hot-encoded idx.
625941df9b70327d1c4e1139
def add_to_cart(request, id): <NEW_LINE> <INDENT> quantity = int(request.POST.get('quantity')) <NEW_LINE> feature = get_object_or_404(Features, id=id) <NEW_LINE> feature.views -= 1 <NEW_LINE> feature.save() <NEW_LINE> cart = request.session.get('cart', {}) <NEW_LINE> cart[id] = cart.get(id, quantity) <NEW_LINE> cart[id...
Add a feature ticket to the cart
625941dfbaa26c4b54cb147f
def test_fetch_no_result(self): <NEW_LINE> <INDENT> conn = self.connect() <NEW_LINE> c = conn.cursor() <NEW_LINE> c.execute("create table test_nr (b varchar(32))") <NEW_LINE> try: <NEW_LINE> <INDENT> data = "pymysql" <NEW_LINE> c.execute("insert into test_nr (b) values (%s)", (data,)) <NEW_LINE> self.assertEqual(None, ...
test a fetchone() with no rows
625941df377c676e9127250a
def __iter__(self): <NEW_LINE> <INDENT> return iter(self.records)
Iterates through stored warnings
625941df0fa83653e465731c
def getNonInstallableProfiles(self): <NEW_LINE> <INDENT> return [ 'collective.tiles.githubgist:uninstall', ]
Hide uninstall profile from site-creation and quickinstaller
625941dfb5575c28eb68e366
def modify_title(self, titleId: str, title: dict): <NEW_LINE> <INDENT> return self.call("PUT", f"/eholdings/titles/{titleId}", data=title)
Update Custom Title. ``PUT /eholdings/titles/{titleId}`` Args: titleId (str) title (dict): See Schema below Returns: dict: See Schema below Raises: OkapiRequestUnprocessableEntity: Unprocessable Entity Schema: .. literalinclude:: ../files/Titles_modify_title_request.schema .. literalinclud...
625941df090684286d50f04d
def layer_mapproxy(request, catalog_slug, layer_uuid, path_info): <NEW_LINE> <INDENT> layer = get_object_or_404(Layer, uuid=layer_uuid, catalog__slug=catalog_slug) <NEW_LINE> if layer.service.type in ('Hypermap:WorldMap','Hypermap:WorldMap2',): <NEW_LINE> <INDENT> layer.service.url = layer.url <NEW_LINE> <DEDENT> mp, y...
Get Layer with matching catalog and uuid
625941dfcdde0d52a9e53398
def get_email(self, instance): <NEW_LINE> <INDENT> return instance.user.email
Get email from the linked user object
625941df67a9b606de4a821a
def populate(self, items): <NEW_LINE> <INDENT> if items and self._box.get_visible(): <NEW_LINE> <INDENT> GLib.idle_add(self._add_items, items) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> LazyLoadingView.populate(self)
Populate items @param items
625941df7b25080760e397bb
def test_15a_onoff(self, caplog, api_mock): <NEW_LINE> <INDENT> self.mock_api.return_value = ({"code": 0}, 200) <NEW_LINE> vswitch15a = VeSyncOutlet15A(DEV_LIST_DETAIL, self.vesync_obj) <NEW_LINE> head = helpers.req_headers(self.vesync_obj) <NEW_LINE> body = helpers.req_body(self.vesync_obj, 'devicestatus') <NEW_LINE> ...
Test 15A Device On/Off Methods.
625941df8a43f66fc4b543c5
def test_init(self): <NEW_LINE> <INDENT> msg = 'Object is not an top.IdentityType' <NEW_LINE> self.assertIsInstance(self._identity_type, top.IdentityType, msg)
Test initialisation of an IdentityType object.
625941df8a349b6b435e84d6
def to_csv(filename, data): <NEW_LINE> <INDENT> with open(filename,'w') as f: <NEW_LINE> <INDENT> writer = csv.writer(f,delimiter=',', quotechar='"', quoting=csv.QUOTE_ALL) <NEW_LINE> for item in data: <NEW_LINE> <INDENT> writer.writerow([item,data[item]])
filename = name of the file data = a dict with key == isin and string as value.
625941dfa4f1c619b28b0395
def test_create_challenge_activity(self): <NEW_LINE> <INDENT> pass
Test case for create_challenge_activity Create a challenge activity
625941df38b623060ff0b150
def sum_digits(num): <NEW_LINE> <INDENT> return sum([int(i) for i in str(num)])
Return the sum of the digits in num.
625941df0383005118ecf945
def before_update(self, old): <NEW_LINE> <INDENT> return
Callback called before an update occurs. Should return None to allow the update to happen. If anything else is returned the update will not occur and the returned value will be the return of the update function
625941df30bbd722463cc12b
def setState(self, state): <NEW_LINE> <INDENT> self._positionIdx = self.choices.index(state['_position']) <NEW_LINE> self._bestPositionIdx = self.choices.index(state['bestPosition']) <NEW_LINE> self._bestResult = state['bestResult']
See comments in base class.
625941df091ae356686672bc
@app.route("/iframe_src") <NEW_LINE> def iframe_src_same(): <NEW_LINE> <INDENT> return render_template('iframe.html', iframe_host=MY_HOST)
An iframe loading a page from the same host should succeed
625941dfff9c53063f47c555
def getFiles(self): <NEW_LINE> <INDENT> return self.__files
Get a list of all the regular files found.
625941df0c0af96317bb854b
def __call__(self,data): <NEW_LINE> <INDENT> args = self.parse_args(data) <NEW_LINE> log.debug('args: %s' % args) <NEW_LINE> if 'add-room' in args: <NEW_LINE> <INDENT> log.debug('found add room in args') <NEW_LINE> self.add_rooms(args.get('add-room').split(',')) <NEW_LINE> <DEDENT> if 'remove-room' in args: <NEW_LINE> ...
socket receives more data
625941dfcb5e8a47e48b7e09
def test_partialUpdate(self): <NEW_LINE> <INDENT> httpretty.register_uri(httpretty.PATCH, 'http://petstore.swagger.wordnik.com/api/pet/0', status=200, content_type='application/json', body=json.dumps([pet_Tom, pet_Sue]) ) <NEW_LINE> resp = client.request(app.op['partialUpdate']( petId=0, body=pet_Tom )) <NEW_LINE> self...
Pet.partialUpdate
625941df10dbd63aa1bd2f05
@app.route("/sign_in", methods=['POST']) <NEW_LINE> def sign_in(): <NEW_LINE> <INDENT> data = request.get_json() <NEW_LINE> result = database_helper.find_user(data['email'], password=data['password'], status='LOGIN') <NEW_LINE> if result: <NEW_LINE> <INDENT> letters = "abcdefghiklmnopqrstuvwwxyzABCDEFGHIJKLMNOPQRSTUVWX...
:return: status 200 and a token if sign in successfully, otherwise status 400.
625941dfd4950a0f3b08c6ae
def getPluginPath(maxLen): <NEW_LINE> <INDENT> return ""
Returns the TeamSpeak 3 client's pluginpath. @param maxLen: the size of the buffer passed to the clientlib. Optional, defaults to 256 @type maxLen: int @return: the pluginpath @rtype: str
625941df23849d37ff7b33f0
def as_dict(self): <NEW_LINE> <INDENT> schema = {} <NEW_LINE> for attr in self._attributes: <NEW_LINE> <INDENT> schema[attr.name] = { 'type': getattr(attr, 'type', attr.typ), 'name': attr.name, 'description': getattr(attr, 'description', ''), 'required': getattr(attr, 'required', False), } <NEW_LINE> <DEDENT> return sc...
returns a dict containing keys for the different attributes, and for each of them, a dict containing information about them:: >>> schema.as_dict() {'foo': {'type': 'string', 'location': 'body', 'description': 'yeah', 'required': True}, 'bar': {'type': 'string', ...
625941df287bf620b61d3dc5
def quadrature(): <NEW_LINE> <INDENT> return Quadrature1Din3DQuadratic()
Factory for Quadrature1Din3DQuadratic.
625941dfcad5886f8bd2733c
@view_config(request_method="POST", routes=['server_extend_boost', 'server_by_id_extend_boost'], renderer='json', permission="use") <NEW_LINE> def extend_boost_on_server(request): <NEW_LINE> <INDENT> vm_id, actor_id = _resolve_vm(request) <NEW_LINE> hours = int(request.POST['hours']) <NEW_LINE> cores, ram = server.get_...
Extends the Boost period on a server by adding a new deboost timeout, if the user can afford it, and debiting the cost.
625941dfadb09d7d5db6caf1
def die_roll(x): <NEW_LINE> <INDENT> rng = random.Random() <NEW_LINE> roll = rng.randint(1, x) <NEW_LINE> return roll
Rolls a die with x sides
625941dfe76e3b2f99f3ab6a
def test_create_server2(self): <NEW_LINE> <INDENT> mongo = mongo_libs.create_instance(self.config_name, self.config_dir, mongo_class.Server) <NEW_LINE> self.assertTrue(isinstance(mongo, mongo_class.Server))
Function: test_create_server2 Description: Test creating Server class instance. Arguments:
625941df6fece00bbac2daa5
def get_initiator(self): <NEW_LINE> <INDENT> file_path = '/etc/iscsi/initiatorname.iscsi' <NEW_LINE> try: <NEW_LINE> <INDENT> lines, _err = self._execute('cat', file_path, run_as_root=True, root_helper=self._root_helper) <NEW_LINE> for l in lines.split('\n'): <NEW_LINE> <INDENT> if l.startswith('InitiatorName='): <NEW_...
Secure helper to read file as root.
625941df56b00c62f0f149bf
def write_states_dataset(fobj, source, slug, start_year=None, end_year=None, adjusted=True, delta=False): <NEW_LINE> <INDENT> fields = ["fips", "State"] <NEW_LINE> start_year = start_year or int(elmr.app.config['STARTYEAR']) <NEW_LINE> end_year = end_year or int(elmr.app.config['ENDYEAR']) <NEW_LINE> for year in xran...
Writes a geographic csv of the series to the open file-like object passed in as `fobj`. Each row is an individual state, and each column is the period for the series. You may also specify seasonally adjusted with the `adjusted` boolean. The source can be either "LAUS" or "CESSM". The slug should be the URL-safe slug t...
625941df5fdd1c0f98dc0598
def create_client(client_class, db, server_id, plugin_id, page_id, steamid, auth_method, auth_token, session_id, request_type): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> server = servers[server_id] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> return None, None, None, None, build_error( "Unknown Server.",...
:return: server, wrp, user, client, error
625941df377c676e9127250b
def set_process_owner(uid, gid): <NEW_LINE> <INDENT> gid = abs(gid) & 0x7FFFFFFF <NEW_LINE> os.setgid(gid) <NEW_LINE> os.setuid(uid)
Set user and group of workers processes: Must setgid before uid, or permission denied.
625941df96565a6dacc8fa2e
def __init__(self, env_fns): <NEW_LINE> <INDENT> self.closed = False <NEW_LINE> nenvs = len(env_fns) <NEW_LINE> self.remotes, self.work_remotes = zip(*[Pipe() for _ in range(nenvs)]) <NEW_LINE> self.ps = [Process(target=worker, args=(work_remote, remote, CloudpickleWrapper(env_fn))) for (work_remote, remote, env_fn) in...
envs: list of gym environments to run in subprocesses
625941df82261d6c526ab807
@pytest.mark.skipif(sys.platform == 'win32', reason=("Lapack's eigh is not deterministic across ", "platforms. The sign of some eigenvectors is ", "flipped on win32.")) <NEW_LINE> def test_matches_athletes(): <NEW_LINE> <INDENT> X, y = datasets.load_athletes() <NEW_LINE> sir = SlicedInverseRegression(n_directions=4, n_...
Test that the resutls match the R dr package on a ais dataset.
625941df99fddb7c1c9de6f3
def insert(self, index, key, item): <NEW_LINE> <INDENT> self._data.__dict__.insert(index, key, item)
Insert key:item at index.
625941df8e71fb1e9831db0b
def test_function_runs(self): <NEW_LINE> <INDENT> analyze_text(self.filename)
Basic test to check if function runs.
625941df21a7993f00bc8059
def select_by_index(self, index): <NEW_LINE> <INDENT> match = str(index) <NEW_LINE> for opt in self.options: <NEW_LINE> <INDENT> if opt.get_attribute("index") == match: <NEW_LINE> <INDENT> self._setSelected(opt) <NEW_LINE> return <NEW_LINE> <DEDENT> <DEDENT> raise NoSuchElementException("Could not locate element with i...
Select the option at the given index. This is done by examining the "index" attribute of an element, and not merely by counting. :Args: - index - The option at this index will be selected throws NoSuchElementException If there is no option with specified index in SELECT
625941df851cf427c661a870
def visitEntry(self, ctx: parse.EntryContext): <NEW_LINE> <INDENT> return str(self.visit(ctx.castle_input()).evaluate(self.state))
entry castle_input EOF
625941df4d74a7450ccd4527
def set_shared_values(variables, values, borrow=False): <NEW_LINE> <INDENT> for variable, value in safe_zip(variables, values): <NEW_LINE> <INDENT> assert value.shape == variable.get_value().shape, "Shape mismatch! Value had shape %s, expected %s" % (str(value.shape), str(variable.get_value().shape)) <NEW_LI...
This sets the shared variables' values from a list of variables to the values specified in a list :param variables: the list of shared variables to set values :type variables: List(shared_variable) :param values: the list of values to set the shared variables to :type values: List :param borrow: the borrow argument ...
625941df91af0d3eaac9bd7f
def setRelation(self): <NEW_LINE> <INDENT> self.relatives["root"] = self.div_cns[0] <NEW_LINE> self.relatives["elbow"] = self.div_cns[self.settings["div0"] + 2] <NEW_LINE> self.relatives["wrist"] = self.div_cns[-1] <NEW_LINE> self.relatives["eff"] = self.eff_loc <NEW_LINE> self.jointRelatives["root"] = 0 <NEW_LINE> sel...
Set the relation beetween object from guide to rig
625941df4527f215b584c7b7
def add_task(self, task): <NEW_LINE> <INDENT> self.tasks.append(task)
add task to operation :param kser.sequencing.task.Task task: task to add
625941df30c21e258bdfa803
def kron_trmm(A, x, uplo=None, trans=None): <NEW_LINE> <INDENT> if len(x.shape) == 1: <NEW_LINE> <INDENT> x = x.reshape((x.shape[0], 1), order='F') <NEW_LINE> <DEDENT> if not isinstance(A, tuple): <NEW_LINE> <INDENT> aA = () <NEW_LINE> for a in A: <NEW_LINE> <INDENT> aA += (a,) <NEW_LINE> <DEDENT> A = aA <NEW_LINE> <DE...
Solve a triangular system in place. A is assumed to be a tuple of numpy arrays. x has to be a Fortran array.
625941dff7d966606f6aa36c
def parChecker2(parstr): <NEW_LINE> <INDENT> par = parstr.split() <NEW_LINE> leng = len(par) <NEW_LINE> index = 0 <NEW_LINE> stack = Stack() <NEW_LINE> match = True <NEW_LINE> while index < leng and match: <NEW_LINE> <INDENT> token = par[index] <NEW_LINE> if token in '({[': <NEW_LINE> <INDENT> stack.push(token) <NEW...
检查各种括号是否匹配
625941df379a373c97cfaeaa
def handle_entityref(self, name): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> codepoint = html_entities.name2codepoint[name] <NEW_LINE> char = six.unichr(codepoint) <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> char = '' <NEW_LINE> <DEDENT> self._handle_ref(name, char)
Called when an entity ref like '&mdash;' is found `name` is the entity ref without ampersand and semicolon (e.g. `mdash`)
625941dffbf16365ca6f652d
def compare_results(single_cancer_df, pancancer_df=None, identifier='gene', metric='auroc', correction=False, correction_method='fdr_bh', correction_alpha=0.05, verbose=False): <NEW_LINE> <INDENT> if pancancer_df is None: <NEW_LINE> <INDENT> results_df = compare_control(single_cancer_df, identifier, metric, verbose) <N...
Compare cross-validation results between two experimental conditions. Main uses for this are comparing an experiment against its negative control (shuffled labels), and for comparing two experimental conditions against one another. Note that this currently uses an unpaired t-test to compare results. TODO this could p...
625941df2eb69b55b151cc17
def tx_serialization_order(provider: Provider, blockhash: str, txid: str) -> int: <NEW_LINE> <INDENT> return provider.getblock(blockhash)["tx"].index(txid)
find index of this tx in the blockid
625941df82261d6c526ab808
def read(self, last_id=None, count=None, block=None, is_reverse=False): <NEW_LINE> <INDENT> if not last_id: <NEW_LINE> <INDENT> if not is_reverse: <NEW_LINE> <INDENT> last_id = "0-0" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> last_id = "$" <NEW_LINE> <DEDENT> <DEDENT> return self.database.xread({self.cache_key: last...
获取信息 xread命令中的streams指的是 字典表形式{流的名称:消息id} :param last_id: 已被读取的最后一条消息的id :param count: :param block: 阻塞时间(毫秒) :param is_reverse: 是否从头读取,默认从头读取 :return:
625941df4f88993c3716c3c8
def topic_set_pre(self, _requirement_set): <NEW_LINE> <INDENT> tracer.debug("Called") <NEW_LINE> versfd = file(self._output_filename, "w") <NEW_LINE> versfd.write("%s\n" % self.__used_vcs_id) <NEW_LINE> versfd.close()
This is call in the RequirementSet pre-phase.
625941dfd53ae8145f87a5ce
def _read_cell_data (self, i) : <NEW_LINE> <INDENT> latticevecs = self.latticevecs.reshape(self.nvecs*3) <NEW_LINE> latticevecs[:] = self.file_object.read('History','LatticeVectors(%i)'%(i+1)) <NEW_LINE> latticevecs *= bohr_to_angstrom <NEW_LINE> self.cell[:self.nvecs] = self.latticevecs <NEW_LINE> cell = self.cell <NE...
Read the cell data at step i
625941df5fc7496912cc3ce2
def __exit__(self, exc_type, exc_val, exc_tb): <NEW_LINE> <INDENT> if self.enabled: <NEW_LINE> <INDENT> gl.glBindTexture(gl.GL_TEXTURE_2D, 0) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._log.warning("Attempting to disable an inactive texture.") <NEW_LINE> <DEDENT> return False
Disable the texture. :param exc_type: :param exc_val: :param exc_tb: :return:
625941df31939e2706e4d1c9
def InterpretGroupNonCommand(self, MessageObject): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> return MessageObject
This command will interpret all the group send non commands. Variables: MessageObject ``object`` is the message object that has to be modified
625941df6fece00bbac2daa6
def trSymb(transition): <NEW_LINE> <INDENT> return transition[0][1]
Given a transition represented as ((Q,symb),Q'), return symb.
625941df925a0f43d254a1de
def header(self): <NEW_LINE> <INDENT> return _flatten(self.header_list)
return a comma-separated string for L{header_list} @rtype: str
625941df6fb2d068a760f406
def sort_car_models(cars=cars): <NEW_LINE> <INDENT> return {key: sorted(val) for key, val in cars.items()}
return a copy of the cars dict with the car models (values) sorted alphabetically
625941df23849d37ff7b33f1
def chunks(string, size=1): <NEW_LINE> <INDENT> for i in range(0, len(string), size): <NEW_LINE> <INDENT> yield string[i: i + size]
Splits `string` in chunks of size `size` Returns a generator. Raises `ValueError` if `size == 0`.
625941df50485f2cf553d0ff
def get_squeeze_dims( xarray_obj, dim: Union[Hashable, Iterable[Hashable], None] = None, axis: Union[int, Iterable[int], None] = None, ) -> List[Hashable]: <NEW_LINE> <INDENT> if dim is not None and axis is not None: <NEW_LINE> <INDENT> raise ValueError("cannot use both parameters `axis` and `dim`") <NEW_LINE> <DEDENT>...
Get a list of dimensions to squeeze out.
625941df55399d3f05588a1a
def convert_entity(self, entity): <NEW_LINE> <INDENT> pass
Convert an entity and return its' schema
625941dfaad79263cf390daa
def normalize_simple(matrix, mask): <NEW_LINE> <INDENT> normal_matrix = matrix / matrix.sum(0) <NEW_LINE> normal_matrix[np.invert(np.isfinite(normal_matrix))] = 0 <NEW_LINE> for mask_val in np.unique(mask): <NEW_LINE> <INDENT> y = normal_matrix[:, np.where(mask == mask_val)[0]] <NEW_LINE> y = np.apply_along_axis(zscore...
Normalizes a matrix by columns, and then by rows. With multiple time-series, the data are normalized to the within-series total, not the entire data set total. Parameters ---------- matrix: np.matrix Time-series matrix of abundance counts. Rows are sequences, columns are samples/time-points. mask: list or np.a...
625941df91f36d47f21ac85a