code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def find_by_matriculation_number(self, matriculation_number): <NEW_LINE> <INDENT> result = [] <NEW_LINE> cursor = self._cnx.cursor() <NEW_LINE> command = "SELECT student_id, creation_date, name, google_id, role_id, matriculation_number, course_abbreviation FROM student WHERE matriculation_number='{}' ORDER BY matricula... | Auslesen eines Studenten durch die Matrikelnummer
:param matriculation_number
:return Student-Objekt, das der übergebenen Matrikelnummer entspricht | 625941e2167d2b6e31218f65 |
def test_supported_operations(self): <NEW_LINE> <INDENT> eq_(0, len(self.op.operations)) | Operands shouldn't support any operation by default | 625941e2cc40096d61595d1f |
def test_li_attr(): <NEW_LINE> <INDENT> li_txt = "This is second item" <NEW_LINE> li = Li(li_txt, style="color: red") <NEW_LINE> file_contents = render_result(li) <NEW_LINE> print(file_contents) <NEW_LINE> assert ('<li style="color: red">\n') in file_contents | Test list tag | 625941e2796e427e537b0999 |
def __del__(self): <NEW_LINE> <INDENT> if self.vlan == 0 or self.vlan == config.OAM_VLAN: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> cmd = "ip link delete {}".format(self.name) <NEW_LINE> print(cmd) <NEW_LINE> p = subprocess.Popen(cmd.split(" ")) | Supprimer l'interface. | 625941e245492302aab5e697 |
def states(self, predicate=None): <NEW_LINE> <INDENT> if predicate is None: <NEW_LINE> <INDENT> return self._get("states").json() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self._get("states/search", params={"predicate":predicate}).json() | Returns the list of states | 625941e23539df3088e2e71b |
def __init__(self, path, basename='.contentignore', use_default_ignores=True): <NEW_LINE> <INDENT> self.root = os.path.abspath(path) <NEW_LINE> self.invalid = [] <NEW_LINE> self._regexes = set() <NEW_LINE> self.basename = basename <NEW_LINE> self.parse_gitignore(os.path.join(os.path.dirname(self.root), basename)) <NEW_... | :param str path: Path to folder we want to know ignore
:param str basename: Basename of the "ignore file"
:param bool use_default_ignores: Auto-add all usual ignores? (ie: .git/ .gradle/ etc) | 625941e226068e7796caf0b5 |
def normalize_longitude(deg): <NEW_LINE> <INDENT> while deg < 0: <NEW_LINE> <INDENT> deg += 360 <NEW_LINE> <DEDENT> while deg > 360: <NEW_LINE> <INDENT> deg -= 360 <NEW_LINE> <DEDENT> return deg | Account for wrap around the globe. | 625941e28da39b475bd65348 |
def export_data_stage02_isotopomer_fittedMeasuredFragments_csv(self,simulation_ids_I,filename_O): <NEW_LINE> <INDENT> data_O = []; <NEW_LINE> for simulation_id in simulation_ids_I: <NEW_LINE> <INDENT> data_tmp =[]; <NEW_LINE> data_tmp = self.get_rows_simulationID_dataStage02IsotopomerFittedMeasuredFragments(simulation_... | export data_stage02_isotopomer_fittedMeasuredFragments
INPUT:
simulation_id_I = [] of string, simulation_id
filename_O = string, filename for export | 625941e221a7993f00bc80c6 |
def angle2(self, p1, p2): <NEW_LINE> <INDENT> v1 = (p1 - self) <NEW_LINE> v2 = (p2 - self) <NEW_LINE> return math.atan2(v1.cross(v2), v1.dot(v2)) | The angle formed by p1->self->p2.
The angle is negative if p1 is to the left of p2.
:return: an angle between -math.pi and math.pi. | 625941e2236d856c2ad44baf |
def process_challenge_response(self, aggregate, challenge, response): <NEW_LINE> <INDENT> unpacked, = struct.unpack(">B", response) <NEW_LINE> return process_challenge_response(aggregate, unpacked) | Given a response, update the current aggregate.
:param aggregate: the aggregate object
:type aggregate: dict
:param challenge: the sent challenge
:type challenge: str
:param response: the response to introduce
:type response: str
:return: the new aggregate
:rtype: dict | 625941e23346ee7daa2b313e |
def initbatch(self, recipe): <NEW_LINE> <INDENT> payload = [] <NEW_LINE> payload = vunlp.pack_recipe(recipe) <NEW_LINE> try: <NEW_LINE> <INDENT> mess = self.postrequest(vunlp.REQUEST_ID.format(url=self.url), payload) <NEW_LINE> self._id = vunlp.unpack_batchid(mess) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> ... | Initialize a new batch and provide the recipe.
Initializes variable _id
@param recipe: the parse-command to apply to the uploaded texts
@returns: the handle to connect to the batch. | 625941e27047854f462a17d5 |
def connect_to_db(engine_str, directory): <NEW_LINE> <INDENT> from sqlalchemy import create_engine <NEW_LINE> from sqlalchemy.orm import sessionmaker <NEW_LINE> with TempDir(directory): <NEW_LINE> <INDENT> engine = create_engine(engine_str) <NEW_LINE> <DEDENT> sessy = sessionmaker(bind=engine) <NEW_LINE> sess = sessy()... | Takes string name of the database to create/connect to, and the directory it should be in.
:param engine_str: connection string for the database
:param directory: directory the database should in (created?) in
:return: engine, session, Base
Example:
engine, session, Base = connect_to_db('sqlite:///reservoir.sqlite', ... | 625941e291f36d47f21ac8c6 |
def postsadd(request): <NEW_LINE> <INDENT> form, postdata = postsForm(request) <NEW_LINE> return render_to_response('postsadd.html', locals()) | 发帖 | 625941e266673b3332b92462 |
def apm_option(server,app,name,value): <NEW_LINE> <INDENT> aline = 'option %s = %f' %(name,value) <NEW_LINE> app = app.lower() <NEW_LINE> app.replace(" ","") <NEW_LINE> response = apm(server,app,aline) <NEW_LINE> return response | Load APM option
server = address of server
app = application name
name = {FV,MV,SV,CV}.option
value = numeric value of option | 625941e2bf627c535bc135a0 |
def index(request): <NEW_LINE> <INDENT> if request.user.is_authenticated(): <NEW_LINE> <INDENT> return HttpResponseRedirect('done') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return TemplateResponse(request, 'login/login_index.html', {'version': version}, RequestContext(request)) | Home view, displays login mechanism | 625941e285dfad0860c3b22c |
def test_edit_method_by_form(self): <NEW_LINE> <INDENT> m = Method.objects.get(id=1) <NEW_LINE> response = self.client.post(reverse('methods-edit-method', kwargs={'slug': m.slug}), {'method': "Update", 'method-title': "Hello", 'method-description': "Hello World", 'method-editor_comment': "Updated title"}) <NEW_LINE> se... | Make sure the edit method form works. | 625941e26aa9bd52df037176 |
def __init__(self, data, Cg, L, W, D = None): <NEW_LINE> <INDENT> self.raw_data = np.array(data, np.longfloat).copy() <NEW_LINE> self.conductivity_data = self.raw_data.copy()[:,0:2] <NEW_LINE> self.conductivity_data[:,1] = np.reciprocal(self.conductivity_data[:,1] * W / L) if D is None else np.reciprocal(self.conductiv... | Takes numpy array of the form array[rows, columns]
Requires columns to be of the form: [V_gate (Volts), Resistance (Ohms)]
Also takes Length L, Width W, and Thickness D to infer scaled material properties.
If 2D materials, thickness can be left as None, and units don't matter.
If 3D, thickness should in cm units (assum... | 625941e2d164cc617578311f |
def by_filter(selectables: T_Iterable, *, function: Callable[[T], Any]) -> T_Iterator: <NEW_LINE> <INDENT> return filter(function, selectables) | Basically just a type hinted version of filter (with the arguments swapped) | 625941e2d486a94d0b98e517 |
def set_collect(self, command, data): <NEW_LINE> <INDENT> collect_code = marshal.loads(data) <NEW_LINE> self.collect_fn = types.FunctionType(collect_code, globals(), "collect") <NEW_LINE> logging.debug("Client collect function set.") | Set collect function to be used by client.
Args:
command (str): Command currently being process.
data (str): Binary version of function code.
Returns:
None | 625941e299fddb7c1c9de75f |
def get_dst_create_db_statement(self, database=None): <NEW_LINE> <INDENT> dst_db_create_sql = "SHOW CREATE DATABASE " "{db}".format(db=database) <NEW_LINE> dst_db_create_statement = self.db_request(sql=dst_db_create_sql, fetch_method='fetchone')[1] <NEW_LINE> logging.debug("Destination database '%s' CREATE s... | Return result of SHOW CREATE DATABASE of the Destination | 625941e28a43f66fc4b54431 |
def profileChanged(self): <NEW_LINE> <INDENT> self.queue_resize() | Called when the profile has changed. | 625941e2a934411ee3751a65 |
def add_extra_safety_sensitivities(self, df_sensitivities): <NEW_LINE> <INDENT> self._df_sensitivities = df_sensitivities | Function to add safety sensitivity signal. In case not a minimum of three
data points can be found when determining the sensitivity variation, an safety
lookup is done in order to determine a next best approach
:param df_sensitivities: dataframe with sensitivities | 625941e27b25080760e39827 |
def generate_random_password(args): <NEW_LINE> <INDENT> new_password = [] <NEW_LINE> while len(new_password) < args.length: <NEW_LINE> <INDENT> char = chr((ord(os.urandom(1)) % (127 - 32)) + 32) <NEW_LINE> if args.charset and 'an' in args.charset and not char.isalnum(): <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> ... | Generate and return a random password. | 625941e2d8ef3951e324390e |
def sync_external_activities(filename='EloquaDB.db', start=None, end=99999): <NEW_LINE> <INDENT> db = ElqRest(filename=filename, sync='external') <NEW_LINE> db.export_external(start=start, end=end) | Syncs external activities to the database
:param filename: the name of the file you're dumping the data into
:param start: number of the record you wish to start you pull from, defaults to last record created
:param end: number of the last record you wish to pull, non-inclusive | 625941e25166f23b2e1a5529 |
def get_queryset(self): <NEW_LINE> <INDENT> return Question.objects.order_by('date')[:5] | Return the last five published questions. | 625941e23346ee7daa2b313f |
def make_rotation_about_axis(self, axis, angle): <NEW_LINE> <INDENT> c = cos(angle) <NEW_LINE> s = sin(angle) <NEW_LINE> omc = 1. - c <NEW_LINE> x, y, z = axis <NEW_LINE> self._m = [x*x*omc+c, y*x*omc+z*s, x*z*omc-y*s, 0., x*y*omc-z*s, y*y*omc+c, y*z*omc+x*s, 0., x*z*omc+y*s, y*z*omc-x*s, z*z*omc+c, 0., 0., ... | Makes a rotation Matrix44 around an axis.
axis -- An iterable containing the axis (three values)
angle -- The angle to rotate (in radians) | 625941e24527f215b584c823 |
def test_paulix_expectation(self, device, shots, tol): <NEW_LINE> <INDENT> theta = 0.432 <NEW_LINE> phi = 0.123 <NEW_LINE> dev = device(2) <NEW_LINE> dev.apply("RY", wires=[0], par=[theta]) <NEW_LINE> dev.apply("RY", wires=[1], par=[phi]) <NEW_LINE> dev.apply("CNOT", wires=[0, 1], par=[]) <NEW_LINE> O = qml.PauliX <NEW... | Test that PauliX expectation value is correct | 625941e2c4546d3d9de72e08 |
def new_trident(game_state): <NEW_LINE> <INDENT> c = Composite() <NEW_LINE> set_item_components(c, game_state) <NEW_LINE> set_melee_weapon_component(c) <NEW_LINE> c.set_child(Description("Trident", "A long stick with a with three sharp points at one end." "It's a useful weapon when you want to keep danger at bay.")) <N... | A composite component representing a Sword item. | 625941e2009cb60464c6377f |
def test_installed_skills_path_not_virtual_env(self): <NEW_LINE> <INDENT> with patch(self.mock_package + 'os.access') as os_patch: <NEW_LINE> <INDENT> os_patch.return_value = False <NEW_LINE> updater = SkillUpdater(self.message_bus_mock) <NEW_LINE> self.assertEqual( path.expanduser('~/.mycroft/.mycroft-skills'), update... | Test the property representing the installed skill file path. | 625941e24c3428357757c6f6 |
def setHdr(self, hdr): <NEW_LINE> <INDENT> self._hdr = hdr <NEW_LINE> return self._sendCommandSingleByte(COMMAND_SET_HDR, hdr, 0) | set HDR.
Parameters
----------
hdr
0 - HDR Off | 625941e299fddb7c1c9de760 |
def _create(self, addresses): <NEW_LINE> <INDENT> if not isinstance(addresses, list): <NEW_LINE> <INDENT> addresses = [addresses] <NEW_LINE> <DEDENT> if not self._mailAddress: <NEW_LINE> <INDENT> gLogger.warn("No mail address was provided. Mail not sent.") <NEW_LINE> return S_ERROR("No mail address was provided. Mail n... | create a mail object
:param list addresses: addresses
:return: S_OK(object)/S_ERROR() -- contain MIMEMultipart object | 625941e2596a897236089e8c |
@cache <NEW_LINE> def all_asset_types_for_project(project): <NEW_LINE> <INDENT> project = normalize_model_parameter(project) <NEW_LINE> path = "user/projects/%s/asset-types" % project["id"] <NEW_LINE> asset_types = client.fetch_all(path) <NEW_LINE> return sort_by_name(asset_types) | Args:
project (str / dict): The project dict or the project ID.
Returns:
list: Asset types for which the user has a task assigned for given
project. | 625941e20fa83653e4657389 |
def assert_regex(result, expected, msg=''): <NEW_LINE> <INDENT> assert re.search(expected, result), ( '%s%r not found in %r' % (_fmt_msg(msg), expected, result) ) | Assert that ``expected`` matches the result.
Parameters
----------
result : str
The string to search.
expected : str or compiled regex
The pattern to search for in ``result``.
msg : str, optional
An extra assertion message to print if this fails. | 625941e21f037a2d8b9465ce |
def get_sex(self): <NEW_LINE> <INDENT> return self._sex | (Binder) -> NoneType
Returns the sex of the binder | 625941e22c8b7c6e89b35b8e |
def ok_to_proceed(project, md_fields): <NEW_LINE> <INDENT> if meta_field(project, "Published", md_fields) != "Yes": <NEW_LINE> <INDENT> NOT_ADDED_TO_JSON[project["key"]] = "Not marked as published" <NEW_LINE> return False <NEW_LINE> <DEDENT> proj_key = get_project_key(project, md_fields) <NEW_LINE> if proj_key is None... | Check the various fields to make sure we can process this project | 625941e2be7bc26dc91cd9c9 |
def test_answer_with_multiple_attempt_correctly(self): <NEW_LINE> <INDENT> self.assertEqual( self.problem_page.submission_feedback, "You have used 0 of 3 attempts", "All 3 attempts are not available" ) <NEW_LINE> self.answer_problem("correct") <NEW_LINE> self.problem_page.click_submit() <NEW_LINE> self.assertTrue(self.... | Scenario: I can answer a problem with multiple attempts correctly and still reset the problem
Given I am viewing a "multiple choice" problem with "3" attempts
Then I should see "You have used 0 of 3 attempts" somewhere in the page
When I answer a "multiple choice" problem "correctly"
Then The "Reset" button does appea... | 625941e2596a897236089e8d |
def share_resource(self, resource_token, other_entity_ids): <NEW_LINE> <INDENT> if not resource_token: <NEW_LINE> <INDENT> raise InvalidParametersError('resource_token is empty or None') <NEW_LINE> <DEDENT> if not other_entity_ids: <NEW_LINE> <INDENT> raise InvalidParametersError('other_entity_ids is empty or None') <N... | Sends a blocking request to the HPIT server to share a particular resource with entities
other than it's original owner. Only the resource owner can send this request. Once a plugin
tells HPIT who the owner of a resource is, only that owner (NOT THE PLUGIN) can make this
request.
Input:
resource_token - The resour... | 625941e226238365f5f0f244 |
def __createTabWidthGui (self, mainSizer, parent): <NEW_LINE> <INDENT> tabSizer = wx.FlexGridSizer (0, 2) <NEW_LINE> tabSizer.AddGrowableCol(1) <NEW_LINE> tabWidthLabel = wx.StaticText(parent, -1, _(u"Tab Width (0 - Default Value)")) <NEW_LINE> self.tabWidthSpin = wx.SpinCtrl ( parent, style=wx.SP_ARROW_KEYS | wx.TE_AU... | Создать интерфейс, связанный с размером табуляции | 625941e26e29344779a629e1 |
def setUp(self) -> None: <NEW_LINE> <INDENT> self.handler = comms.proton_queue_adaptor.ProtonMessagingHandler( TEST_QUEUE_SINGLE_URL[0], TEST_QUEUE_NAME, TEST_QUEUE_USERNAME, TEST_QUEUE_PASSWORD, TEST_PROTON_MESSAGE) | Prepare service for testing. | 625941e2fff4ab517eb2f80e |
def get_vm_no_cpus(self, vmname): <NEW_LINE> <INDENT> vm_obj = self._get_vm_object_by_name(vmname) <NEW_LINE> config = vm_obj.summary.config <NEW_LINE> no_of_cpus = int(config.numCpu) <NEW_LINE> logger.info("VM:{} has {} CPUs".format(vmname, no_of_cpus)) <NEW_LINE> return no_of_cpus | method that gives number of cpu attached with vm.
Args:
:vmname (str): name of vm that user wants to get
no of cpu/cpus.
Returns:
:no of cpu (int): no of cpus are used. | 625941e2ab23a570cc250556 |
def addService(self, code): <NEW_LINE> <INDENT> if self.context == utils.Context.EDITOR_SERVICES: <NEW_LINE> <INDENT> parameters = { "servicecode":code, "description":"<Service description>", "nextservice":"", "autoreverse":0} <NEW_LINE> self._... | Adds an empty Service to the services list. | 625941e2fff4ab517eb2f80f |
def __travers_in_order(self, node): <NEW_LINE> <INDENT> if node.left_child is not None: <NEW_LINE> <INDENT> self.__travers_in_order(node.left_child) <NEW_LINE> <DEDENT> print("{}".format(node.data)) <NEW_LINE> if node.right_child is not None: <NEW_LINE> <INDENT> self.__travers_in_order(node.right_child) | Left sub-tree -> root -> right sub-tree | 625941e2d4950a0f3b08c71a |
def open_help(self): <NEW_LINE> <INDENT> webbrowser.open("https://github.com/aeberle55/rtarchiver/blob/master/README.md") | Opens a browser to the github readme | 625941e25fdd1c0f98dc0606 |
def validate_lease_id(form, field): <NEW_LINE> <INDENT> headers = BASE_HEADERS.copy() <NEW_LINE> headers['Authorization'] = 'Bearer {}'.format(flask_login.current_user.token) <NEW_LINE> url = '{}/api/lease/{}'.format(os.getenv('OAUTH_CLIENT_URL'), field.data) <NEW_LINE> response = requests.get(url, headers=headers) <NE... | API query to fetch lease number. | 625941e221a7993f00bc80c7 |
def to_json(self, indent=None) -> str: <NEW_LINE> <INDENT> return json.dumps( { 'walletName': self.wallet_name, 'walletKey': self.wallet_key, 'walletPath': self.wallet_path if hasattr(self, 'wallet_path') else None, 'verityUrl': self.verity_url, 'verityPublicDID': self.verity_public_did, 'verityPublicVerKey': self.veri... | Converts this object into a JSON object
Args:
indent (int): number to indent for pretty printing
Returns:
str: a string (JSON encoded) based on this context | 625941e2004d5f362079a702 |
def _remove_redundancy_dense(A): <NEW_LINE> <INDENT> A = A.T <NEW_LINE> tolapiv = 1e-8 <NEW_LINE> status = 0 <NEW_LINE> message = "" <NEW_LINE> A, status, message = _remove_zero_rows(A) <NEW_LINE> if status != 0: <NEW_LINE> <INDENT> return A, status, message <NEW_LINE> <DEDENT> m, n = A.shape <NEW_LINE> v = list(range(... | Eliminates redundant equations from system of equations defined by Ax = b
and identifies infeasibilities.
Parameters
----------
A : 2-D sparse matrix
An matrix representing the left-hand side of a system of equations
rhs : 1-D array
An array representing the right-hand side of a system of equations
Returns
----... | 625941e24f6381625f114e0d |
@tfmpl.figure_tensor <NEW_LINE> def draw_confusion_matrix(matrix): <NEW_LINE> <INDENT> fig = tfmpl.create_figure(figsize=(7,7)) <NEW_LINE> ax = fig.add_subplot(111) <NEW_LINE> ax.set_title('Confusion matrix for big5 classification') <NEW_LINE> tfmpl.plots.confusion_matrix.draw( ax, matrix, axis_labels=['0', '1'], norma... | Draw confusion matrix for MNIST. | 625941e2a17c0f6771cbe420 |
def testEntryFamilyItem(self): <NEW_LINE> <INDENT> pass | Test EntryFamilyItem | 625941e2462c4b4f79d1daa0 |
def __str__(self): <NEW_LINE> <INDENT> now_str = datetime.datetime.now().strftime('%Y-%m-%d - %H:%M') <NEW_LINE> missing_archs_str = '\n * **Missing architectures**: %s' % ', '.join(self.missing_archs) if self.missing_archs else '' <NEW_LINE> build_str = self.build <NEW_LINE> if self.args.verbose_test and self.args.ver... | Return report for product. | 625941e231939e2706e4d235 |
def attach_cylinder(self, name=u'cylinder', height=1, radius=1, frame_id=None, position=None, orientation=None): <NEW_LINE> <INDENT> cylinder = make_world_body_cylinder(name, height, radius) <NEW_LINE> pose = PoseStamped() <NEW_LINE> pose.header.stamp = rospy.Time.now() <NEW_LINE> pose.header.frame_id = str(frame_id) i... | Add a cylinder to the world and attach it to the robot at frame_id.
If pose is used, frame_id, position and orientation are ignored.
:type name: str
:type height: int
:param height: height of the cylinder. Default = 1
:type radius: int
:param radius: radius of the cylinder. Default = 1
:type frame_id: str
:type positio... | 625941e25510c4643540f7ac |
def __init__(self, params=None, simulation_distances=None): <NEW_LINE> <INDENT> self.js = js_calculation(params['DEER'], simulation_distances) | Do JS-Div calculation | 625941e22eb69b55b151cc86 |
def test_query_not_in_db(self): <NEW_LINE> <INDENT> result = self.search_eng.limited_multi_search('crocodile', 3, 0) <NEW_LINE> reference_dict = {} | Test that an empty dictionary is returned if the query is not
in database. | 625941e2baa26c4b54cb14ed |
def v1_variables_variable_name_causes_get(self, variable_name, **kwargs): <NEW_LINE> <INDENT> if variable_name is None: <NEW_LINE> <INDENT> raise ValueError("Missing the required parameter `variable_name` when calling `v1_variables_variable_name_causes_get`") <NEW_LINE> <DEDENT> all_params = ['variable_name'] <NEW_LINE... | Search user correlations for a given effect
Returns average of all correlations and votes for all user cause variables for a given effect
:param str variable_name: Effect variable name (required)
:return: list[Correlation] | 625941e2a79ad161976cc517 |
def test_default_fields(self): <NEW_LINE> <INDENT> self.assertEqual(list(self.org_admin.get_form(self.request).base_fields), ['name', 'short_name', 'description', 'logo', 'active']) | Test: organization default fields should be name, description and active. | 625941e2fb3f5b602dac3a69 |
def is_leaf(self, node): <NEW_LINE> <INDENT> if (node._left or node._right): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return True | Returns 'True' if node is a leaf of the Tree and 'False' otherwise. | 625941e22ae34c7f2600d502 |
def save(self, dict_): <NEW_LINE> <INDENT> with sqlitedict.SqliteDict(__db__, tablename=self.__name) as db: <NEW_LINE> <INDENT> db.update(dict_) <NEW_LINE> db.commit() | Save `dict_` | 625941e2d486a94d0b98e518 |
def getInput(default, prompt = ''): <NEW_LINE> <INDENT> answer = raw_input(prompt) <NEW_LINE> if answer: <NEW_LINE> <INDENT> return answer.strip() <NEW_LINE> <DEDENT> return default.strip() | Like raw_input() but with a default and automatic strip().
| 625941e2187af65679ca54f2 |
def __init__(self, c_regr=OLS(), st_regr=OLS(), fit_kwargs={}, c_fit_kwargs={}, st_fit_kwargs={}, c_constraints=[ConstraintNonneg()], st_constraints=[ConstraintNonneg()], max_iter=50, err_fcn=mse, tol_increase=0.0, tol_n_increase=10, tol_err_change=None, tol_n_above_min=10 ): <NEW_LINE> <INDENT> self.fit_kwargs = fit_k... | Multivariate Curve Resolution - Alternating Regression | 625941e2dd821e528d63b577 |
@uiCommandWrap <NEW_LINE> def grabColor(*args, **kwargs): <NEW_LINE> <INDENT> return cmds.grabColor(*args, **kwargs) | :rtype: UIObject | 625941e244b2445a33932465 |
def _is_parameters_ok(self): <NEW_LINE> <INDENT> if self.currency is None: <NEW_LINE> <INDENT> raise MissingParameterException("CryptoCurrency needs an currency") <NEW_LINE> <DEDENT> if self.target is None: <NEW_LINE> <INDENT> raise MissingParameterException("CryptoCurrency needs a target currency") <NEW_LINE> <DEDENT>... | Check if received parameters are ok to perform operations in the neuron.
:return: True if parameters are ok, raise an exception otherwise.
.. raises:: MissingParameterException, InvalidParameterException | 625941e263b5f9789fde74b8 |
def plot_l_1_vs_u_cpd(): <NEW_LINE> <INDENT> import matplotlib as mpl <NEW_LINE> from matplotlib import pyplot as plt <NEW_LINE> N = 10 <NEW_LINE> rankst = np.array([5, 7, 8, 10, 12, 20]).astype('int') <NEW_LINE> us, *lam_1_l = np.loadtxt( 'calculated/{}-site/lam_1_vs_u.txt'.format(N), unpack=True) <NEW_LINE> if len(la... | Make plots | 625941e230dc7b7665901d34 |
def setUp(self): <NEW_LINE> <INDENT> self.response = self.client.get('/map/') | Provide common response. | 625941e24e4d5625662d47a4 |
def do_su_login(self, group, user): <NEW_LINE> <INDENT> assert group and user <NEW_LINE> group_name = group['name'] if isinstance(group, Group) or isinstance(group, EIGroup) else str(group) <NEW_LINE> user_name = user['name'] if isinstance(user, User) or isinstance(user, EIUser) else str(user) <NEW_LINE> res = self.req... | Make "su" login (admin/operator only).
Arguments:
group (obj or int): The Group instance, or EIGroup instance, or a group name of the user to simulate.
user (obj or int): The User instance, or EIUser instance, or a user name of the user to simulate.
Return:
A success message. | 625941e28e7ae83300e4b39f |
def pc_input_buffers_full_avg(self, *args): <NEW_LINE> <INDENT> return _iio_swig.fmcomms5_source_sptr_pc_input_buffers_full_avg(self, *args) | pc_input_buffers_full_avg(fmcomms5_source_sptr self, int which) -> float
pc_input_buffers_full_avg(fmcomms5_source_sptr self) -> pmt_vector_float | 625941e2e76e3b2f99f3abd8 |
def process_source_lineage(grid_sdf, data_sdf, value_field=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> grid_sdf = geomotion.SpatialDataFrame.from_featureclass(grid_sdf) <NEW_LINE> data_sdf = geomotion.SpatialDataFrame.from_featureclass(data_sdf, fields=[value_field]) <NEW_LINE> index = data_sdf.sindex <NEW_LINE... | performs the operation to generate the | 625941e256b00c62f0f14a2d |
def rolling_shots_to_dict(self, df, dict_with_dates, colnames): <NEW_LINE> <INDENT> df_xefg_sum = pd.rolling_sum(df, window=self.steps, min_periods=self.min_games) <NEW_LINE> attempt_cols = [zone + '_attempt' for zone in processors.ShotsDataProcessor.shot_zones] <NEW_LINE> df_xefg_sum['tot_attempt'] = df_xefg_sum[attem... | Takes in a dataframe of xefg/shots data as well as a list of desired
column names to use for data. Populates the data into a dict keyed by
dates. | 625941e2d99f1b3c44c6795a |
def get_subreddit_ticker_timeseries(sub, stockList, verbose=False, reddit_timeframe="all"): <NEW_LINE> <INDENT> reddit = praw.Reddit( "bot1" ) <NEW_LINE> regexPattern = r'\b([A-Za-z][\S]+)\b' <NEW_LINE> blacklist = ["A", "I", "DD", "WSB", "YOLO", "RH", "EV", "PE", "ETH", "BTC", "E"] <NEW_LINE> tickerSeries = [] <NEW_LI... | Get a list of tuples of each time a ticker is mentioned in a given subreddit
Parameters
----------
sub : string
subreddit name e.g., "wallstreetbets"
stockList: list
list of stock tickers used to filter words that pass the regex pattern
Returns
-------
list
a list of tuples (ticker, time [in utc]) record... | 625941e23cc13d1c6d3c774a |
def is_downloaded(folder): <NEW_LINE> <INDENT> paths = [TRAIN_DATA_URL, TRAIN_LABELS_URL, TEST_DATA_URL, TEST_LABELS_URL] <NEW_LINE> for i in paths: <NEW_LINE> <INDENT> out_path = os.path.join(folder, os.path.splitext(os.path.basename(i))[0]) <NEW_LINE> if not os.path.isfile(out_path): <NEW_LINE> <INDENT> return False ... | Returns whether Fashion MNIST has been downloaded | 625941e2283ffb24f3c55ccf |
def printChatMessage(self, msg): <NEW_LINE> <INDENT> self.__debugConsoleWrite(msg) | Display a chat message to the debug console. | 625941e2cc40096d61595d21 |
def test_non_pollution(self, bash): <NEW_LINE> <INDENT> assert_bash_exec( bash, "foo() { local cur=; _pnames; }; foo; unset -f foo" ) | Test environment non-pollution, detected at teardown. | 625941e215fb5d323cde0ee6 |
def init(self, session, weight_files=None, exclude_var_list=None): <NEW_LINE> <INDENT> if exclude_var_list is None: <NEW_LINE> <INDENT> exclude_var_list = list() <NEW_LINE> <DEDENT> import pickle <NEW_LINE> if weight_files is None: <NEW_LINE> <INDENT> weight_files = ['./weights/handsegnet-rhd.pickle', './weights/posene... | Initializes weights from pickled python dictionaries.
Inputs:
session: tf.Session, Tensorflow session object containing the network graph
weight_files: list of str, Paths to the pickle files that are used to initialize network weights
exclude_var_list: list of str, Weights that should not be loaded | 625941e2cdde0d52a9e53407 |
def get_lines(stop_to_find): <NEW_LINE> <INDENT> list_of_lines = [] <NEW_LINE> for l, v in lines.items(): <NEW_LINE> <INDENT> if stop_to_find[0] in v: <NEW_LINE> <INDENT> list_of_lines.append(l) <NEW_LINE> <DEDENT> <DEDENT> return list_of_lines | Find the lines where a stop is located | 625941e28c0ade5d55d3ed90 |
def choose_action(self, state): <NEW_LINE> <INDENT> state_dict = self.q_values.get(state) <NEW_LINE> is_none = True <NEW_LINE> for k in state_dict: <NEW_LINE> <INDENT> if state_dict[k] != 0: <NEW_LINE> <INDENT> is_none = False <NEW_LINE> <DEDENT> <DEDENT> if random.random() > self.exploit_prob or is_none is True: <NEW_... | Selects an action based on epsilon-greedy strategy
:return: Next action to take | 625941e2e64d504609d74c12 |
def process_folder(dir_name, encoding, dry_run): <NEW_LINE> <INDENT> files = [] <NEW_LINE> for r, d, fl in os.walk(dir_name): <NEW_LINE> <INDENT> for f in fnmatch.filter(fl, '*.mp3'): <NEW_LINE> <INDENT> files.append(os.path.join(r, f)) <NEW_LINE> <DEDENT> <DEDENT> for file in files: <NEW_LINE> <INDENT> if eyed3.mp3.is... | Searches for mp3 files and converts tags.
| 625941e27d43ff24873a3075 |
def test_parse_args_input_directory_output_file(self): <NEW_LINE> <INDENT> config_file = "tests/sample_files/configuration1.xlsx" <NEW_LINE> with self.assertRaises(SystemExit) as cm1, self.assertLogs( level="CRITICAL" ) as cm2: <NEW_LINE> <INDENT> target.parse_args(["-id", "aa", "-o", "", "-c", config_file]) <NEW_LINE>... | Test running the script with -id with -o instead of -od parameter | 625941e257b8e32f52483870 |
def unregister_converter(self, converter_type): <NEW_LINE> <INDENT> del self._converters[converter_type] | Remove the registration for an converter type. | 625941e2b57a9660fec33c5b |
def test_show_leave_button_value_members_cant_leave(self): <NEW_LINE> <INDENT> group = GroupFactory.create(members_can_leave=False) <NEW_LINE> user = UserFactory.create() <NEW_LINE> group.add_member(user.userprofile) <NEW_LINE> url = reverse('groups:show_group', kwargs={'url': group.url}) <NEW_LINE> with self.login(use... | Don't show leave button for a group whose members_can_leave flag
is False, even for group member | 625941e230bbd722463cc19a |
def insert_mysql(host, id, name, img, status): <NEW_LINE> <INDENT> import pymysql, json <NEW_LINE> conn = pymysql.connect(**db_msg) <NEW_LINE> cur = conn.cursor() <NEW_LINE> sql = "INSERT %s " "SET host='%s', " "container_id='%s'," "container_name='%s'," "image='%s'," "statu... | 添加容器信息
:param host: 所在主机
:param id: 容器id
:param name: 容器名
:param img: 镜像名
:return: ret,inster 执行结果 | 625941e2f8510a7c17cf9ad1 |
def setup_module(): <NEW_LINE> <INDENT> Path(TMP_TEST_DIR / "xmod").mkdir(parents=True) <NEW_LINE> Path(TMP_TEST_DIR / "nomod").mkdir(parents=True) <NEW_LINE> make_empty_file(TMP_TEST_DIR / "xmod/__init__.py") <NEW_LINE> make_empty_file(TMP_TEST_DIR / "xmod/sub.py") <NEW_LINE> make_empty_file(TMP_TEST_DIR / "pack.py") ... | Setup testenvironment for the module:
| 625941e2627d3e7fe0d69223 |
def makefile(file_path, log_msg=None, verbose=False): <NEW_LINE> <INDENT> if not os.path.isfile(file_path): <NEW_LINE> <INDENT> with open(file_path, "a"): <NEW_LINE> <INDENT> os.utime(file_path, None) <NEW_LINE> <DEDENT> logger.info(log_msg) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if verbose is True: <NEW_LINE> <... | Make file.
Parameters
----------
file_path : string
the path of the file.
absolute path perferred
log_msg : string
print log message if there is any | 625941e2435de62698dfe020 |
def get_business_object_template(self,name): <NEW_LINE> <INDENT> return self.cache["business_object_templates"].get(name, None) | Returns a cached Business object template | 625941e2b5575c28eb68e3d6 |
def refresh(self): <NEW_LINE> <INDENT> for i in range(len(self.gridMap)): <NEW_LINE> <INDENT> correctY = MIN_Y + i * BRICKSIZE <NEW_LINE> for j in range(len(self.gridMap[i])): <NEW_LINE> <INDENT> curCell = self.gridMap[i][j] <NEW_LINE> if curCell != '0': <NEW_LINE> <INDENT> if curCell.y != correctY: <NEW_LINE> <INDENT>... | Called by self.clearFullLines during the self.handleFullLines routine.
Correct the y coordinate for each cell in the grid based on the cell's current row/index in the grid
These coordinates become skewed when one or more lines is filled and popped from the grid self.clearFullLines | 625941e2bf627c535bc135a2 |
def test_create_token_no_user(self): <NEW_LINE> <INDENT> payload = { "email": "test@user.com", "password": "123123test", } <NEW_LINE> response = self.client.post(TOKEN_URL, payload) <NEW_LINE> self.assertNotIn("token", response.data) <NEW_LINE> self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) | It should not create a token if user does not exist | 625941e255399d3f05588a88 |
def delete_projects(self, project_filter, verbose=False): <NEW_LINE> <INDENT> self.search_input = project_filter + '\n' <NEW_LINE> elements = self.browser.find_elements_by_partial_link_text(project_filter) <NEW_LINE> while len(elements) > 0: <NEW_LINE> <INDENT> for i in range(len(elements)): <NEW_LINE> <INDENT> element... | Removes all projects with 'test project' in the name. | 625941e299cbb53fe6792fb8 |
def train_state_ta(w, **kwargs): <NEW_LINE> <INDENT> train_count = w.index.values[0] <NEW_LINE> rnd_string, next_state_action, actions_scores = kwargs['agent'].act(kwargs['state']) <NEW_LINE> prev_action = int(kwargs['curr_action']) <NEW_LINE> curr_action = int(kwargs['curr_action']) if next_state_action in ... | Train the agent based on the input and output. | 625941e2c432627299f0501b |
def test_if_fires_on_topic_match(self): <NEW_LINE> <INDENT> assert _setup_component(self.hass, automation.DOMAIN, { automation.DOMAIN: { 'trigger': { 'platform': 'mqtt', 'topic': 'test-topic' }, 'action': { 'service': 'test.automation', 'data_template': { 'some': '{{ trigger.platform }} - {{ trigger.topic }}' ' - {{ tr... | Test if message is fired on topic match. | 625941e2ff9c53063f47c5c4 |
def start_patch(self, name, solo=False, **kwargs): <NEW_LINE> <INDENT> if name in patch_classes.keys(): <NEW_LINE> <INDENT> self.active_pats.append(patch_classes[name](self.config, **kwargs)) <NEW_LINE> if solo: <NEW_LINE> <INDENT> for each in self.active_pats: <NEW_LINE> <INDENT> if name != each.__class__.__name__: <N... | start a patch, stop all others | 625941e2fbf16365ca6f659e |
def GetStopSchedule(self): <NEW_LINE> <INDENT> self._UpdateStopSchedule() <NEW_LINE> tree = xml.etree.ElementTree.parse(self._cache_location) <NEW_LINE> root = tree.getroot() <NEW_LINE> loaded_routes = {} <NEW_LINE> for routes in root.findall('.//routes'): <NEW_LINE> <INDENT> for new_route in routes.getchildren(): <NEW... | Returns python objects representing a stop schedule.
Args:
agency_id: Integer agency ID to use. Default 1.
stop_id: Integer stop ID to use.
Returns:
Tuple of ({route short name: Route()}, {route_id: StopSchedule()}). | 625941e2d486a94d0b98e519 |
def __init__( self, type_, fget=None, fset=None, fdel=None, fvalidate=None, default=None, doc=None, abstract=False, readonly=False): <NEW_LINE> <INDENT> self._type = type_ <NEW_LINE> self._fget = fget <NEW_LINE> self._fset = fset <NEW_LINE> self._fdel = fdel <NEW_LINE> self._fvalidate = fvalidate <NEW_LINE> self._defau... | Initialises :class:`PropertyBase`
:param fget: Getter function for property
:type fget: func
:param fset: Setter function for property
:type fset: func
:param fdel: Deleter function for property
:type fdel: func
:param fvalidate: Validation function for property
:type fvalidate: func
:param default: The default value ... | 625941e29b70327d1c4e11a9 |
def removeObject(self, cloudletId, objectId, **kwargs): <NEW_LINE> <INDENT> allParams = ['cloudletId', 'objectId'] <NEW_LINE> params = locals() <NEW_LINE> for (key, val) in params['kwargs'].items(): <NEW_LINE> <INDENT> if key not in allParams: <NEW_LINE> <INDENT> raise TypeError("Got an unexpected keyword argument '%s'... | Removes an object from the Cloudlet.
Args:
cloudletId, str: The id of the users Cloudlet. (required)
objectId, str: Id of the object to be removed. (required)
Returns: ObjectResponse | 625941e2711fe17d82542735 |
def set_bnmodel_name(self, name): <NEW_LINE> <INDENT> self.bnmodel.set("NAME", str(name)) | Set the name of the BNMODEL.
Parameters
----------
name: str
Name of the BNModel.
Examples
--------
>>> from ProbabilityModel.readwrite.XMLBeliefNetwork import XBNWriter
>>> writer = XBNWriter()
>>> writer.set_bnmodel_name("Cancer") | 625941e25fdd1c0f98dc0607 |
def calc_quadrant(w, h, x, y): <NEW_LINE> <INDENT> if (x - w / 2) < 0 and (y - h / 2) < 0: <NEW_LINE> <INDENT> quadrant = 1 <NEW_LINE> <DEDENT> elif (x - w / 2) > 0 and (y - h / 2) < 0: <NEW_LINE> <INDENT> quadrant = 2 <NEW_LINE> <DEDENT> elif (x - w / 2) < 0 and (y - h / 2) > 0: <NEW_LINE> <INDENT> quadrant = 3 <NEW_L... | Screen Quadrants
+---+---+ 1) x < w/2 && y < h/2
| 1 | 2 | 2) x > w/2 && y < h/2
+---+---+ 3) x < w/2 && y > h/2
| 3 | 4 | 4) x > w/2 && y > h/2
+---+---+ | 625941e2046cf37aa974d116 |
def record_gradient(unused_op_name, unused_inputs, unused_attrs, unused_results, unused_ctx, unused_name): <NEW_LINE> <INDENT> pass | Import backprop if you want gradients recorded. | 625941e2d164cc6175783122 |
def test_can_get_meals(self): <NEW_LINE> <INDENT> token = self.get_user_token() <NEW_LINE> headers = {'Authorization': 'Bearer {}'.format(token)} <NEW_LINE> response = self.client.get(MEALS_URL, headers=headers) <NEW_LINE> self.assertEqual(response.status_code, 200) <NEW_LINE> self.assertTrue(loads(response.data.decode... | Test GET functionality of meals. | 625941e23346ee7daa2b3141 |
def SetFriendTags(request, callback, customData = None, extraHeaders = None): <NEW_LINE> <INDENT> if not PlayFabSettings._internalSettings.ClientSessionTicket: <NEW_LINE> <INDENT> raise PlayFabErrors.PlayFabException("Must be logged in to call this method") <NEW_LINE> <DEDENT> def wrappedCallback(playFabResult, error):... | Updates the tag list for a specified user in the friend list of the local user
https://docs.microsoft.com/rest/api/playfab/client/friend-list-management/setfriendtags | 625941e244b2445a33932466 |
def test_lookupSessionChannel(self): <NEW_LINE> <INDENT> avatar = IConchUser(self.store) <NEW_LINE> channel = avatar.lookupChannel('session', 65536, 16384, '') <NEW_LINE> self.assertTrue(isinstance(channel, SSHSession)) | L{ShellAccount.lookupChannel} returns an L{SSHSession} instance. (This
is because L{SSHSession} implements handlers for the standard SSH
requests issued to set up a shell.) | 625941e2d6c5a10208144421 |
def pc_nproduced(self): <NEW_LINE> <INDENT> return _filter_swig.interp_fir_filter_ccf_sptr_pc_nproduced(self) | pc_nproduced(interp_fir_filter_ccf_sptr self) -> float | 625941e20fa83653e465738b |
def _post(self, which_port, msg): <NEW_LINE> <INDENT> return _rfid_swig.tag_decoder_sptr__post(self, which_port, msg) | _post(tag_decoder_sptr self, swig_int_ptr which_port, swig_int_ptr msg) | 625941e210dbd63aa1bd2f75 |
def transpile(circuit: Any, output_format: str = "quantumflow") -> Any: <NEW_LINE> <INDENT> intermediate_form = _transpile_from(circuit) <NEW_LINE> final_form = _transpile_to(intermediate_form, output_format) <NEW_LINE> return final_form | Transpile a quantum circuit between different quantum libraries.
Different libraries support different sets of quantum gates. Unsupported gates
are automatically translated into equivalent sequences of
supported gates.
Supported Formats:
braket:
An Amazon braket Circuit.
cirq:
A Google cirq Ci... | 625941e20383005118ecf9b4 |
def advance_state_machine(): <NEW_LINE> <INDENT> global state_num <NEW_LINE> if state_num == 0: <NEW_LINE> <INDENT> red.color("black") <NEW_LINE> orange.color("black") <NEW_LINE> green.color("green") <NEW_LINE> state_num = 1 <NEW_LINE> wn.ontimer(advance_state_machine, 3000) <NEW_LINE> <DEDENT> elif state_num == 1: <NE... | Modify previous program then we can still realize
the rest of lights when they turn off.
Green, green and orange, orange, red. We number these states 0, 1, 2, 3.
With timer like exercise requisition. | 625941e2596a897236089e8e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.