code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def run(self): <NEW_LINE> <INDENT> test(int(self.verbosity))
Run command.
625941dacb5e8a47e48b7d5d
def __init__(self,Ntrips): <NEW_LINE> <INDENT> self.dmap=pickle.load(open("../data/xmap.pickle","rb")) <NEW_LINE> self.wmap=pickle.load(open("../data/wmap.pickle","rb")) <NEW_LINE> self.tmap={} <NEW_LINE> self.gifts=pickle.load(open("../data/GiftIds.pickle","rb")) <NEW_LINE> self.trips=[[] for i in np.arange(Ntrips)] <...
Creates an m-Traveling Salesmen object. Used for the Holiday FICO kaggle competition, where Santa must deliver all packages with as little distance -- or in this case, a specified metric called reindeer weariness -- as possible. ATTRIBUTES: dmap: a dictionary lookup table, where, given a giftID, you are returned...
625941daa05bb46b383ecad7
def list_benchmarks(): <NEW_LINE> <INDENT> return [b['name'] for b in _BENCHMARKS]
Retuns a list of all the benchmark dictionaries registed by this module :return: ([dict]) the benchmarks
625941da7cff6e4e81117c3c
def connect(self): <NEW_LINE> <INDENT> db_settings = self.__settings__ <NEW_LINE> self.db_instance = MySQLDatabase(db_settings['SCHEMA'], host=db_settings['HOST'], port=int(db_settings['PORT']), user=db_settings['USER'], passwd=db_settings['PASSWORD']) <NEW_LINE> self.db_instance.connect() <NEW_LINE> if self.db_instanc...
Connects to the specified DB Returns:
625941daa8ecb033257d3383
def effect_thickness_on_gvd(): <NEW_LINE> <INDENT> path_to_file = "database/glass/schott/N-BK7.yml" <NEW_LINE> paf = path_to_ri_database + path_to_file <NEW_LINE> fig = plt.figure() <NEW_LINE> n_ax = 1 <NEW_LINE> ax = [0] * n_ax <NEW_LINE> ax[0] = fig.add_subplot(111) <NEW_LINE> um_range = [0.3, 2.5] <NEW_LINE> wl_um, ...
Compare the effects of two different thicknesses on the pulse length.
625941daaad79263cf390cfb
def toggleTurtles(self): <NEW_LINE> <INDENT> for spiro in self.spiros: <NEW_LINE> <INDENT> if spiro.t.isvisible(): <NEW_LINE> <INDENT> spiro.t.hideturtle() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> spiro.t.showturtle()
Will show or hide arrow cursor.
625941da15baa723493c422e
def mavenLabel(maveninfo): <NEW_LINE> <INDENT> return '%(group_id)s-%(artifact_id)s-%(version)s' % maveninfo
Return a user-friendly label for the given maveninfo. maveninfo is a dict as returned by kojihub:getMavenBuild().
625941da925a0f43d254a130
def create_package_list(base): <NEW_LINE> <INDENT> return ([base] + ['{}.{}'.format(base, pkg) for pkg in find_packages(base)])
Get all packages under the base directory
625941da8c3a873295158674
def calc_rate(self, data=None): <NEW_LINE> <INDENT> if data is None: <NEW_LINE> <INDENT> data = self.data <NEW_LINE> <DEDENT> if type(data) != list: <NEW_LINE> <INDENT> data = data.values.tolist() <NEW_LINE> <DEDENT> clouds = [i[-1] for i in data] <NEW_LINE> if len(clouds) == 0: <NEW_LINE> <INDENT> return "No scenes se...
Calculate the cloud cover rate of Landsat scenes.
625941da5fc7496912cc3c35
def _toTex(self) -> str: <NEW_LINE> <INDENT> return self.proofTree._toTex() + "\n\t\\RightLabel{\\texttt{shift}}\n\t\\UnaryInfC{$" + self.eval().toTex() + "$}"
Converts the proof tree in TeX code. This method should not be called directly, use :meth:`UnnamedOpetope.RuleInstance.toTex` instead.
625941da009cb60464c63667
def column_correlations(self, X): <NEW_LINE> <INDENT> self._check_is_fitted() <NEW_LINE> X_global = self._build_X_global(X) <NEW_LINE> row_pc = self._row_coordinates_from_global(X_global) <NEW_LINE> return pd.DataFrame({ component: { feature: row_pc[component].corr(X_global[feature]) for feature in X_global.columns } f...
Returns the column correlations.
625941da4a966d76dd5512c8
def _check_adapt_map_input(self, ins, varname=''): <NEW_LINE> <INDENT> aus = None <NEW_LINE> navs = self.axes_manager.navigation_shape <NEW_LINE> if isinstance(ins, Number): <NEW_LINE> <INDENT> aus = BaseSignal(ins).T <NEW_LINE> return aus <NEW_LINE> <DEDENT> elif isinstance(ins, np.ndarray): <NEW_LINE> <INDENT> if ins...
Check and adapt an input parameter that will work with the map function for this signal. An adapted signal is returned in case it works. If it does not work, a meaningful ValueError is returned instead. Parameters ---------- ins : {number, ndarray, hs.signals.BaseSignal} One of the following: - Single number. - N...
625941da3c8af77a43ae3a59
def GetCaptionStyle(self): <NEW_LINE> <INDENT> return self._captionBar.GetCaptionStyle()
Returns the current style of the captionbar in a CaptionBarStyle class. This can be used to change and set back the changes.
625941dafff4ab517eb2f6f4
def apart_full_decomposition(P, Q): <NEW_LINE> <INDENT> f, x, U = P/Q, P.gen, [] <NEW_LINE> u = Function('u')(x) <NEW_LINE> a = Dummy('a') <NEW_LINE> partial = S(0) <NEW_LINE> for d, n in Q.sqf_list_include(all=True): <NEW_LINE> <INDENT> b = d.as_expr() <NEW_LINE> U += [ u.diff(x, n-1) ] <NEW_LINE> h = cancel(f*b**n) /...
Bronstein's full partial fraction decomposition algorithm. Given a univariate rational function ``f``, performing only GCD operations over the algebraic closure of the initial ground domain of definition, compute full partial fraction decomposition with fractions having linear denominators. Note that no factorization...
625941da498bea3a759b9d66
def merge_row(row): <NEW_LINE> <INDENT> global score <NEW_LINE> row = [i for i in row if i] <NEW_LINE> row_length = len(row) <NEW_LINE> if row_length == 0: <NEW_LINE> <INDENT> return [0, 0, 0, 0] <NEW_LINE> <DEDENT> if row_length == 1: <NEW_LINE> <INDENT> return row + [0, 0, 0] <NEW_LINE> <DEDENT> if row_length == 2: <...
The algorithm for this is quite complicated; in the interest of optimization, it has been replaced with a bunch of logic.
625941da07f4c71912b1173b
def build_model(train_dataset, normed_train_data, train_labels): <NEW_LINE> <INDENT> model = keras.Sequential([ layers.Dense(64, activation=tf.nn.relu, input_shape=[len(train_dataset.keys())]), layers.Dense(64, activation=tf.nn.relu), layers.Dense(1) ]) <NEW_LINE> optimizer = tf.keras.optimizers.RMSprop(0.001) <NEW_LIN...
Builds a sequential model with: - 2 densely connected (Dense) layers - 1 Output layer returning a single continuous value Then trains the model using an early stop in order to stop the training when the model is not improving anymore. Returns the trained model and the history of the training
625941dab7558d58953c51c7
@pytest.mark.parametrize('iter, result', TEST_CARDS) <NEW_LINE> def test_sort_cards(iter, result): <NEW_LINE> <INDENT> from sort_cards import sort_cards <NEW_LINE> assert sort_cards(iter) == result
Return a sorted list of cards.
625941dabe7bc26dc91cd8b3
def proper_motion(g0, g1): <NEW_LINE> <INDENT> from astropy.coordinates import SkyCoord <NEW_LINE> c0 = SkyCoord(ra=g0.ra, dec=g0.dec, frame='icrs') <NEW_LINE> c1 = SkyCoord(ra=g1.ra, dec=g1.dec, frame='icrs') <NEW_LINE> dt = (g1.date - g0.date).jd * u.day <NEW_LINE> mu = (c0.separation(c1) / dt).to(u.arcsec / u.hr) <N...
Proper motion from two `Geom` instances. Parameters ---------- g0, g1 : Geom Two positions of the target. `g0.date < g1.date` is assumed. Returns ------- mu : Quantity The proper motion. phi : Angle The position angle of the proper motion.
625941da66656f66f7cbc463
def run(self): <NEW_LINE> <INDENT> self.script.execute( self.cursor, list(self.args), self.kwargs, self.prepare_params ) <NEW_LINE> self._has_been_executed = True <NEW_LINE> self._result_cache = None <NEW_LINE> return self
Execute the query using the DBAPI driver.
625941da66656f66f7cbc464
def test_iadd_1(self): <NEW_LINE> <INDENT> self.u1 += self.u2 <NEW_LINE> self.assertEqual(str(self.u1), 'MultiSet([1, 1, 2])')
Test iaddition function with one empty multiset
625941da97e22403b379d252
def __bool__(self): <NEW_LINE> <INDENT> return self.secs or self.nsecs
Check if time value is zero
625941da7b25080760e3970f
def _render_js_bundle(context, extension, name): <NEW_LINE> <INDENT> return _render_bundle(context, ExtensionJavascriptNode, extension, name, 'JS')
Render a given JavaScript bundle. Args: context (dict): The template rendering context. extension (djblets.extensions.extension.Extension): The extension instance. name (unicode): The name of the JS bundle to render. Returns: django.utils.safetext.SafeText: The rendered H...
625941da1b99ca400220ad69
def register_applications(applications, **kwargs): <NEW_LINE> <INDENT> return list(register_application_models(applications, **kwargs))
A simple convenience wrapper around the :func:`stdnet.odm.register_application_models` generator. It return s a list of registered models.
625941da50485f2cf553d052
def __init__(self, field, gens, coerce=True): <NEW_LINE> <INDENT> if not isinstance(field, number_field.NumberField_generic): <NEW_LINE> <INDENT> raise TypeError("field (=%s) must be a number field."%field) <NEW_LINE> <DEDENT> if len(gens)==0: <NEW_LINE> <INDENT> raise ValueError("gens must have length at least 1 (zero...
INPUT: field -- a number field x -- a list of NumberFieldElements of the field, not all zero EXAMPLES:: sage: NumberField(x^2 + 1, 'a').ideal(7) Fractional ideal (7)
625941dad18da76e23532790
def evalNumbers(expr): <NEW_LINE> <INDENT> if expr.is_number: <NEW_LINE> <INDENT> return expr.evalf() <NEW_LINE> <DEDENT> elif expr.is_Mul: <NEW_LINE> <INDENT> result = S.One <NEW_LINE> for arg in expr.args: <NEW_LINE> <INDENT> newresult = evalNumbers(arg) <NEW_LINE> result *= newresult <NEW_LINE> <DEDENT> <DEDENT> eli...
Replaces all numbers with symbols, this is to make gcd faster when fractions get too big Also returns checks that need to be all >= 0
625941da7b25080760e39710
def three1_beta1(portal): <NEW_LINE> <INDENT> actions = getToolByName(portal, 'portal_actions') <NEW_LINE> if 'iterate_checkin' in actions.object_buttons.objectIds(): <NEW_LINE> <INDENT> loadMigrationProfile( portal, 'profile-plone.app.upgrade.v32:3.2a1-3.2a2-iterate')
3.1.7 -> 3.2beta1
625941da8c0ade5d55d3ec74
def hasOutputs(self): <NEW_LINE> <INDENT> return len(self.outputs)
Has outputs ?
625941da56ac1b37e6264483
def region_wms_metadata(request): <NEW_LINE> <INDENT> response = {} <NEW_LINE> if request.is_ajax() and request.method == "POST": <NEW_LINE> <INDENT> post_info = request.POST <NEW_LINE> aquifer_name = post_info.get("aquifer_name") <NEW_LINE> file_name = post_info.get("file_name") <NEW_LINE> region_id = post_info.get("r...
Ajax controller to get the min and max for a selected interpolation netcdf file
625941daff9c53063f47c4aa
def test_xml_encoding(self): <NEW_LINE> <INDENT> data = "This & that and 2&lt;y&lt;3 is > there." <NEW_LINE> expected_data = "This &amp; that and 2&lt;y&lt;3 is > there." <NEW_LINE> self.assertEqual(MathMLParser.html_to_text(data), expected_data)
Test that HTML entities are kept.
625941da26238365f5f0f129
def check_background_noise(options, track): <NEW_LINE> <INDENT> if not is_bigwig(track['path']): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> percentage = get_top_bins_percentage(options.bin_size, options.top_bins, track['path']) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> ...
Check if there is backgrond noise in the track
625941da26068e7796caef99
def _build_cmd(self): <NEW_LINE> <INDENT> task = self.worker.task <NEW_LINE> path = task.info("rsh_path") or "rsh" <NEW_LINE> user = task.info("rsh_user") <NEW_LINE> options = task.info("rsh_options") <NEW_LINE> cmd_l = [os.path.expanduser(pathc) for pathc in shlex.split(path)] <NEW_LINE> if user: <NEW_LINE> <INDENT> c...
Build the shell command line to start the rsh commmand. Return an array of command and arguments.
625941da99fddb7c1c9de648
def test__list_fields(self): <NEW_LINE> <INDENT> model = self.model <NEW_LINE> fields = model._list_fields() <NEW_LINE> self.assertEqual(set(fields), set(self.fields_ans))
Check the _list_fields function. Compare with the answer.
625941da0c0af96317bb849f
def __init__(self, p1_turn: bool, size: int = None, letter_values: List = None, ley_lines: List = None) -> None: <NEW_LINE> <INDENT> self.p1_turn = p1_turn <NEW_LINE> if not size: <NEW_LINE> <INDENT> self.size = int(input("Enter a board size from 1 - 5: ")) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.size = size...
Initializes the game's state. Overwrites the initializer from the superclass. >>> x1 = StonehengeGamestate(True, 3) >>> x1.letter_values [['A', 'B'], ['C', 'D', 'E'], ['F', 'G', 'H', 'I'], ['J', 'K', 'L']] >>> x1.num_ley_lines 12 >>> x1.size 3
625941dabf627c535bc13487
def embedded_type2_sets(self): <NEW_LINE> <INDENT> set_array = [] <NEW_LINE> primary_domain, secondary_domain, set_array = self.to_array_explicit() <NEW_LINE> index_array = np.indices(set_array.shape)[0] <NEW_LINE> col_gen = [index_array[set_array[:, x] > 0, x] for x in range((set_array.shape)[1])] <NEW_LINE> domain_in...
Lists all the type 2 embedded sets of this gt2fs. List will contain tuples in the form [(sec_grade_1, sec_domain_1, pri_domain_1), ... , (sec_grade_n, sec_domain_n, pri_domain_n)] Reference: ---------- J. M. Mendel and R. I. B. John, “Type-2 fuzzy sets made simple,” IEEE Trans. Fuzzy Systems, vol. 10, no. 2, pp. 117–1...
625941da566aa707497f481d
def append(self, data, next = None): <NEW_LINE> <INDENT> if self.head == None: <NEW_LINE> <INDENT> self.head = Node(data) <NEW_LINE> self.tail = self.head <NEW_LINE> len += 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.tail.next = Node(data) <NEW_LINE> self.tail = self.tail.next <NEW_LINE> len += 1
Adds a Node to the end of the linked list
625941dad8ef3951e32437f5
def __array__(self): <NEW_LINE> <INDENT> type_name = "int" <NEW_LINE> s = len(self) <NEW_LINE> if type_name == "float": <NEW_LINE> <INDENT> a = np.ndarray(shape=(s,), dtype=np.float32) <NEW_LINE> <DEDENT> elif type_name == "double": <NEW_LINE> <INDENT> a = np.ndarray(shape=(s,), dtype=np.float) <NEW_LINE> <DEDENT> else...
Enable access to this data as a numpy array, via np.asarray(v)
625941da6fece00bbac2d9f9
def get_refund_info(self): <NEW_LINE> <INDENT> return self._refund
Return the reason for the refund
625941dae64d504609d74af7
def get_name(self): <NEW_LINE> <INDENT> name = None <NEW_LINE> sfputil_helper = SfpUtilHelper() <NEW_LINE> sfputil_helper.read_porttab_mappings(self.__get_path_to_port_config_file()) <NEW_LINE> name = sfputil_helper.logical[self.__index] or "Unknown" <NEW_LINE> return name
Retrieves the name of the device Returns: string: The name of the device
625941da462c4b4f79d1d988
def existing_url(**kwargs): <NEW_LINE> <INDENT> url_base = "/axapi/v3/event" <NEW_LINE> f_dict = {} <NEW_LINE> return url_base.format(**f_dict)
Return the URL for an existing resource
625941da236d856c2ad44a95
def offer_draw(self): <NEW_LINE> <INDENT> with self.lock: <NEW_LINE> <INDENT> self.pending_offer = True <NEW_LINE> self.draw_offered.notify_all()
Offers a draw.
625941da097d151d1a223110
def get_object_list(self, request): <NEW_LINE> <INDENT> return self.get_search_query_set(request)
By default search lists all objects in haystack
625941da3c8af77a43ae3a5a
def search_makerID_and_modelID(mk, md, car_json_file): <NEW_LINE> <INDENT> data = json.load(open(car_json_file)) <NEW_LINE> data = data['all'] <NEW_LINE> mk = mk.lower() <NEW_LINE> md = md.lower() <NEW_LINE> if mk == "mb" or mk == "benz" or mk == "mercedes": <NEW_LINE> <INDENT> mk = "mercedes-benz" <NEW_LINE> <DEDENT> ...
search maker id and model id Args: mk: maker string md: model string car_json_file: cars.com mk-md json file Returns: (mkid, mdid): maker id, model id
625941dacdde0d52a9e532ed
@_get_client <NEW_LINE> def subject_member_count(client, subject_id): <NEW_LINE> <INDENT> return client.subject_member_count(subject_id=subject_id)
Return the number of subject members for this subject :param subject_id: identifier of subject entity
625941da8a349b6b435e842b
def train( self, data, logl=0, save_model=True ) : <NEW_LINE> <INDENT> raise NotImplementedError("Concrete subclasses need to implement this!")
train a model
625941da82261d6c526ab75a
def set_Tweet(self, value): <NEW_LINE> <INDENT> super(CreatePhotoPostWithURLInputSet, self)._set_input('Tweet', value)
Set the value of the Tweet input for this Choreo. ((optional, string) Manages the autotweet (if enabled) for this post. Set to "off" for no tweet. Enter text to override the default tweet.)
625941da99cbb53fe6792e9e
def k_fold(self, k=10, order="fixed", seed=None): <NEW_LINE> <INDENT> all_indices = range(len(self.data)) <NEW_LINE> if order != "fixed": <NEW_LINE> <INDENT> random.seed(seed) <NEW_LINE> random.shuffle(all_indices) <NEW_LINE> <DEDENT> folds = [all_indices[i::k] for i in range(k)] <NEW_LINE> all_indices = set(all_indice...
:param k: number of fold :param order: "fixed" for not shuffling, other string for random :param seed: random seed :return: k-time generator if {"train": train, "valid": valid}
625941da26068e7796caef9a
def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.request = kwargs.pop("request") <NEW_LINE> super(InitialCustomAccountForm, self).__init__( *args, **kwargs ) <NEW_LINE> self.fields["address_state"] = forms.ChoiceField( choices=STATE_CHOICES_BY_COUNTRY[self.country] ) <NEW_LINE> self.fields["currency"] = fo...
Instantiate no fields based on `fields_needed` initially.
625941dab57a9660fec33b3f
def collect_runs_to_purge(self): <NEW_LINE> <INDENT> if self.race_slug: <NEW_LINE> <INDENT> matching_races = [race for race in self.status.races() if slug_for_race(race) == self.race_slug] <NEW_LINE> if len(matching_races) < 1: <NEW_LINE> <INDENT> msg = "Found no races matching slug {}.".format(self.race_slug) <NEW_LIN...
Find runs that need to be compressed
625941da50485f2cf553d053
def all_exist(self, arr): <NEW_LINE> <INDENT> count = self.counting(arr) <NEW_LINE> missing = None <NEW_LINE> for num, c in enumerate(count[1:]): <NEW_LINE> <INDENT> if c == 0: <NEW_LINE> <INDENT> return False, num+1 <NEW_LINE> <DEDENT> <DEDENT> return True, missing
verify that there is at least one of each number present
625941da7cff6e4e81117c3d
def buildGraph(nodes, ngrams=None): <NEW_LINE> <INDENT> gr = nx.Graph() <NEW_LINE> gr.add_nodes_from(nodes) <NEW_LINE> nodePairs = list(itertools.combinations(nodes, 2)) <NEW_LINE> for pair in nodePairs: <NEW_LINE> <INDENT> firstString = pair[0] <NEW_LINE> secondString = pair[1] <NEW_LINE> if ngrams: <NEW_LINE> <INDENT...
nodes - list of hashables that represents the nodes of the graph
625941dab57a9660fec33b40
def fire_bullet(ai_settings, screen, ship, bullets): <NEW_LINE> <INDENT> if len(bullets) < ai_settings.bullet_allowed: <NEW_LINE> <INDENT> new_bullet = Bullet(ai_settings, screen, ship) <NEW_LINE> bullets.add(new_bullet)
如果没有到限制,就发射子弹
625941daa79ad161976cc3fe
def position(self, axis): <NEW_LINE> <INDENT> axis = axis.upper() <NEW_LINE> if axis not in self._last_val: <NEW_LINE> <INDENT> raise GCodeException('Undefined axis %s' % axis) <NEW_LINE> <DEDENT> return self._last_val[axis]
The current position of the specified axis. Args: axis: The axis name - i.e. 'X', 'Y', 'Z', 'A', etc. Returns: The current position of the named axis as a float value.
625941da167d2b6e31218e4d
def _check_swarm_state(self): <NEW_LINE> <INDENT> if ((self._swarm_state == enums.PRE_FLIGHT) and (rospy.has_param("flight_ready")) and (bool(rospy.get_param("flight_ready")))): <NEW_LINE> <INDENT> self._update_swarm_state(enums.FLIGHT_READY) <NEW_LINE> <DEDENT> elif self._swarm_state == enums.PRE...
Determines when to conduct swarm state changes
625941da5510c4643540f696
def process_statspecs_file(filepath): <NEW_LINE> <INDENT> with open(filepath) as fd: <NEW_LINE> <INDENT> directive = yaml.load(fd) <NEW_LINE> <DEDENT> return process_statspecs(directive)
Process a statspecs file, yaml format.
625941dabe383301e01b5739
def lookup(self): <NEW_LINE> <INDENT> farmer = Farmer.query.filter_by(btc_addr=self.btc_addr).first() <NEW_LINE> if not farmer: <NEW_LINE> <INDENT> msg = "Address not registered: {0}".format(self.btc_addr) <NEW_LINE> logger.warning(msg) <NEW_LINE> raise LookupError(msg) <NEW_LINE> <DEDENT> return farmer
Return the Farmer object for the bitcoin address passed.
625941daa05bb46b383ecad8
def test_with_csrf_token(self, mocker): <NEW_LINE> <INDENT> client = bindings.BodhiClient() <NEW_LINE> client.csrf_token = 'a token' <NEW_LINE> client.send_request = mocker.MagicMock(return_value='response') <NEW_LINE> csrf = client.csrf() <NEW_LINE> assert csrf == 'a token' <NEW_LINE> assert client.send_request.call_c...
Test the method when csrf_token is set.
625941dae8904600ed9f21e8
def version_parts(self, best: bool = False) -> Tuple[str, str, str]: <NEW_LINE> <INDENT> version_str = self.version(best=best) <NEW_LINE> if version_str: <NEW_LINE> <INDENT> version_regex = re.compile(r"(\d+)\.?(\d+)?\.?(\d+)?") <NEW_LINE> matches = version_regex.match(version_str) <NEW_LINE> if matches: <NEW_LINE> <IN...
Return the version of the OS distribution, as a tuple of version numbers. For details, see :func:`distro.version_parts`.
625941da96565a6dacc8f983
@pytest.mark.django_db <NEW_LINE> def test_create_dummy_data(): <NEW_LINE> <INDENT> management.call_command('create_dummy_data', '1')
Tests that the create_dummy_data management command runs through. It's important for local development.
625941da8da39b475bd6522e
def unget_command(self): <NEW_LINE> <INDENT> name = self.check_repo_name(self.args.name) <NEW_LINE> if name and name in self.repos: <NEW_LINE> <INDENT> repo_path = os.path.relpath(os.path.join(self.args.dir, self.config['repos'][name]['path'] or name)) <NEW_LINE> repo_type = self.config['repos'][name]['type'] <NEW_LINE...
Remove a repository defined in the Mr. Repo repository from the local system.
625941da435de62698dfdf05
def __next_clock_cycle(self): <NEW_LINE> <INDENT> cycle = 0 <NEW_LINE> while True: <NEW_LINE> <INDENT> self._clock_value = cycle <NEW_LINE> Logger().log(["Time: {0}".format(self._clock_value)]) <NEW_LINE> self.notify({"clock" : self._clock_value}) <NEW_LINE> yield cycle <NEW_LINE> cycle += 1
Generator
625941dab545ff76a89140cd
def pure_complex(v, or_real=False): <NEW_LINE> <INDENT> h, t = v.as_coeff_Add() <NEW_LINE> if not t: <NEW_LINE> <INDENT> if or_real: <NEW_LINE> <INDENT> return h, t <NEW_LINE> <DEDENT> return <NEW_LINE> <DEDENT> c, i = t.as_coeff_Mul() <NEW_LINE> if i is S.ImaginaryUnit: <NEW_LINE> <INDENT> return h, c
Return a and b if v matches a + I*b where b is not zero and a and b are Numbers, else None. If `or_real` is True then 0 will be returned for `b` if `v` is a real number. Examples ======== >>> from sympy.core.evalf import pure_complex >>> from sympy import sqrt, I, S >>> a, b, surd = S(2), S(3), sqrt(2) >>> pure_compl...
625941da4e696a04525c9704
def __init__(self, *args, **kwds): <NEW_LINE> <INDENT> if args or kwds: <NEW_LINE> <INDENT> super(VecOfDoubles, self).__init__(*args, **kwds) <NEW_LINE> if self.dbl_vec is None: <NEW_LINE> <INDENT> self.dbl_vec = [] <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> self.dbl_vec = []
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix in-order arguments and keyword arguments. The available fields are: dbl_vec :param args: complete set...
625941da7d847024c06be577
def create_subtable_image(img1, img2, start_row): <NEW_LINE> <INDENT> h1 = img1.shape[0] <NEW_LINE> w1 = img1.shape[1] <NEW_LINE> max_tile_size = 2 ** 12 <NEW_LINE> number_of_rows = int(math.ceil((h1 - start_row) / (max_tile_size * 1.0))) <NEW_LINE> number_of_cols = int(math.ceil(w1 / (max_tile_size * 1.0))) <NEW_LINE>...
Creates subtable images with dimensions that are mutliples of tiles sizes at the lowest zoom level. Takes in two images as numpy arrays and rounds out the first image by concatenating the top part of the second image. Args: img1 (numpy.ndarray): First image img2 (numpy.ndarray): Second image start_row (in...
625941da31939e2706e4d11f
def AddBinaryAt(self, binary, load_address): <NEW_LINE> <INDENT> self._load_addresses[binary] = load_address
Register a new shared library or executable.
625941dab5575c28eb68e2bb
def rbegin(self) -> "std::vector< math::linear::VectorN< 3,double > >::reverse_iterator": <NEW_LINE> <INDENT> return _math_poly.Vector3Coefficients_rbegin(self)
rbegin(Vector3Coefficients self) -> std::vector< math::linear::VectorN< 3,double > >::reverse_iterator
625941da004d5f362079a5ea
def encounter_color(self, color, target_stream): <NEW_LINE> <INDENT> self._write(unixColors[color], target_stream)
Write the unix color directly to the stream.
625941da0a50d4780f66714d
def make_dataset(example_proto, input_shape, training, max_neighbors, include_key=False): <NEW_LINE> <INDENT> def make_parse_example_fn(feature_spec): <NEW_LINE> <INDENT> def parse_example(serialized_example_proto): <NEW_LINE> <INDENT> feature_dict = tf.io.parse_single_example(serialized_example_proto, feature_spec) <N...
Construct a tf.data.Dataset from the given Example.
625941da8a43f66fc4b5431b
def tensor_array_size_v2_eager_fallback(handle, flow_in, name=None, ctx=None): <NEW_LINE> <INDENT> _ctx = ctx if ctx else _context.context() <NEW_LINE> handle = _ops.convert_to_tensor(handle, _dtypes.string) <NEW_LINE> flow_in = _ops.convert_to_tensor(flow_in, _dtypes.float32) <NEW_LINE> _inputs_flat = [handle, flow_in...
This is the slowpath function for Eager mode. This is for function tensor_array_size_v2
625941da046cf37aa974cffe
def test_motd(): <NEW_LINE> <INDENT> assert like("MOTD", pack_command("MOTD"))
MOTD command
625941da16aa5153ce362730
def deprecate_import(current, modulename, fromlist, renames = None): <NEW_LINE> <INDENT> import sys <NEW_LINE> module = __import__(modulename, fromlist = fromlist) <NEW_LINE> for position, objname in enumerate(fromlist): <NEW_LINE> <INDENT> obj = getattr(module, objname) <NEW_LINE> newobj = deprecated(obj, "{0}.{1}".fo...
Import objects from one module into another, wrapping them with a DeprecationWarning
625941da004d5f362079a5eb
def add_walls(): <NEW_LINE> <INDENT> def assign_unit_starting_coords(wall_carver_list): <NEW_LINE> <INDENT> wall_carver_list[0].coord = self.pacman_coords[0] <NEW_LINE> wall_carver_list[1].coord = self.ghost_coords[0] <NEW_LINE> <DEDENT> wall_carvers = [wall_carver_class.WallCarver(random.randint(0, self.width), random...
Places (carves out) walls in the world such that every non-wall cell is accessible from every other non-wall cell.
625941dadc8b845886cb57ef
def videoRect(self): <NEW_LINE> <INDENT> return self.targetRect
Returns a rectangle of the video. :return: A QtCore.QRect representing the painted zone.
625941da377c676e91272461
def AssociateDhcpIpWithAddressIp(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> params = request._serialize() <NEW_LINE> body = self.call("AssociateDhcpIpWithAddressIp", params) <NEW_LINE> response = json.loads(body) <NEW_LINE> if "Error" not in response["Response"]: <NEW_LINE> <INDENT> model = models.Ass...
本接口(AssociateDhcpIpWithAddressIp)用于DhcpIp绑定弹性公网IP(EIP)。<br /> :param request: Request instance for AssociateDhcpIpWithAddressIp. :type request: :class:`tencentcloud.vpc.v20170312.models.AssociateDhcpIpWithAddressIpRequest` :rtype: :class:`tencentcloud.vpc.v20170312.models.AssociateDhcpIpWithAddressIpResponse`
625941da7cff6e4e81117c3e
def head_directory(self, mdir): <NEW_LINE> <INDENT> log.debug('HEAD ListDirectory %r', mdir) <NEW_LINE> res, content = self._request(mdir, "HEAD") <NEW_LINE> if res["status"] != "200": <NEW_LINE> <INDENT> raise errors.MantaAPIError(res, content) <NEW_LINE> <DEDENT> return res
HEAD method on ListDirectory https://apidocs.joyent.com/manta/api.html#ListDirectory This is not strictly a documented Manta API call. However it is provided to allow access to the useful 'result-set-size' header. @param mdir {str} A manta path, e.g. '/trent/stor/mydir'. @returns The response object, which acts as a ...
625941dacb5e8a47e48b7d5f
def __init__(self, component_name, component_value, allowed_values): <NEW_LINE> <INDENT> super(UnpermittedComponentError, self).__init__( "{} was required to be one of {!r} but was {!r}".format( component_name, list(sorted(allowed_values)), component_value, ), component_name, component_value, allowed_values, ) <NEW_LIN...
Initialize the error with the unpermitted component.
625941da2ae34c7f2600d3ea
def vlines(self, x, stroke=None, colormap=None, palette=None, opacity=1.0, title=None, style=None, id=None): <NEW_LINE> <INDENT> table = toyplot.data.Table() <NEW_LINE> table["x"] = _require_scalar_vector(x) <NEW_LINE> table["stroke"] = _broadcast_object(stroke, table.shape[0]) <NEW_LINE> table["opacity"] = _broadcast_...
Add vertical line(s) to the axes. Vertical lines are convenient because they're guaranteed to fill the axes from top to bottom regardless of the axes size. Parameters ---------- x: array-like set of X coordinates One vertical line will be drawn through each X coordinate provided. title: string, optional Human-rea...
625941da956e5f7376d71125
def get_data(path,master_labels_arr): <NEW_LINE> <INDENT> image_paths = glob.glob(path + '/**/*.jpg', recursive=True) <NEW_LINE> labels = [] <NEW_LINE> labels = [ master_labels_arr.index(re.search(".*/(.*).jpg", image_path).group(1)[:-5]) for image_path in image_paths ] <NEW_LINE> return image_paths, labels
Return image_paths, labels such that label[i] corresponds to image_paths[i]. image_paths: list of strings labels: list/np array of labels
625941da1d351010ab855dd4
def GetClipboardText(primary_selection=False): <NEW_LINE> <INDENT> global use_x11_primary_selection <NEW_LINE> global non_x11_primary_selection <NEW_LINE> success = False <NEW_LINE> if primary_selection: <NEW_LINE> <INDENT> if use_x11_primary_selection: <NEW_LINE> <INDENT> wx.TheClipboard.UsePrimarySelection(primary_se...
Returns the current clipboard value. On non-X11 systems, there's only one clipboard. However, on X11 there are two: the primary selection and the clipboard. Due to a current wxWidgets limitation, only one of those clipboards is available at a time, and stuffing data into one cancels out the other. The calling metho...
625941da4e696a04525c9705
def get_copy(self): <NEW_LINE> <INDENT> mat = NifFormat.InertiaMatrix() <NEW_LINE> mat.m_11 = self.m_11 <NEW_LINE> mat.m_12 = self.m_12 <NEW_LINE> mat.m_13 = self.m_13 <NEW_LINE> mat.m_14 = self.m_14 <NEW_LINE> mat.m_21 = self.m_21 <NEW_LINE> mat.m_22 = self.m_22 <NEW_LINE> mat.m_23 = self.m_23 <NEW_LINE> mat.m_24 = se...
Return a copy of the matrix.
625941daec188e330fd5aa53
def click_left_panel_open_div(driver): <NEW_LINE> <INDENT> panel_open_close_container = driver.find_element_by_class_name("panelOpenCloseContainer") <NEW_LINE> panel_open_close_container_div = panel_open_close_container.find_element_by_class_name("leftSidePanelCollapseOpen") <NEW_LINE> panel_open_close_container_div.cl...
Method to click on left panel div
625941da4a966d76dd5512ca
def __init__(self, type='categorical', sep='__', suffix = None): <NEW_LINE> <INDENT> self.type = type <NEW_LINE> self.sep = sep <NEW_LINE> self.suffix = sep + suffix if not suffix is None else ''
:param type: type of target variable, if not "categorical" than target will be assumed to be numerical :param sep: separator for new column names :param suffix: suffix for column name, if None, the new columns will be formed based on feature name + feature value for single class or numerical type. for multiclass, targe...
625941da85dfad0860c3b114
def isWordGuessed(secretWord, lettersGuessed): <NEW_LINE> <INDENT> aDict = {} <NEW_LINE> for letter in lettersGuessed: <NEW_LINE> <INDENT> if letter not in aDict: <NEW_LINE> <INDENT> aDict[letter] = letter <NEW_LINE> <DEDENT> <DEDENT> secretWordletters = list(secretWord) <NEW_LINE> for letter in secretWordletters: <NEW...
secretWord: string, the word the user is guessing lettersGuessed: list, what letters have been guessed so far returns: boolean, True if all the letters of secretWord are in lettersGuessed; False otherwise
625941da21a7993f00bc7fad
def handle_timer (self): <NEW_LINE> <INDENT> self.update_all_neighbors()
Called periodically. When called, your router should send tables to neighbors. It also might not be a bad place to check for whether any entries have expired.
625941da3eb6a72ae02ec79c
@register.filter <NEW_LINE> def to_null(string): <NEW_LINE> <INDENT> return 'null' if string is None else string
Usage:: {{ string|to_null}}
625941dade87d2750b86004e
def p_sp_unlabeled_control_loop(self, p): <NEW_LINE> <INDENT> p[0] = [('loop',p[2])]
sp_unlabeled_control : LOOP sp_proc_stmts1 END LOOP
625941da91af0d3eaac9bcd4
def step_many_repulsive(ips_input, walkers, maxiter=20): <NEW_LINE> <INDENT> stepl = ips_input['stepl'] <NEW_LINE> threshold = ips_input['dissociated'] <NEW_LINE> Flist = walker_net_forces(walkers, weight='1/R') <NEW_LINE> nprocs = ips_input['nprocs'] <NEW_LINE> coordtype = ips_input['coordtype'] <NEW_LINE> unitS = wal...
Use a pairwise pseudo-force between walkers to define the direction in which each will move. Then find a new point for each walker.
625941da498bea3a759b9d68
def perms(A: List[int]) -> List[List[int]]: <NEW_LINE> <INDENT> return list(map(list, itertools.permutations(A)))
A! all permutations of A
625941da0fa83653e4657273
def generate_previews(self) -> list: <NEW_LINE> <INDENT> print( '%s.generate_previews called' % (self.__class__.__name__) ) <NEW_LINE> print('+- Get original file') <NEW_LINE> print('+- "Print" each page to a high-res image') <NEW_LINE> print(' +- Resize/convert each to output format') <NEW_LINE> print('+- Return lis...
Generates a set of preview-images of the asset.
625941daadb09d7d5db6ca47
def NotSupportedYet(type): <NEW_LINE> <INDENT> def GetUnknownValue(attr): <NEW_LINE> <INDENT> raise ValueError("\"%s\" type isn't supported by \"xmlclass\" yet!" % type) <NEW_LINE> <DEDENT> return GetUnknownValue
Function that generates a function that point out to user that datatype used is not supported by xmlclass yet @param type: data type @return: function generated
625941da44b2445a3393234d
def col_to_timestamp(df, colname, timezone='UTC'): <NEW_LINE> <INDENT> if colname in df.columns: <NEW_LINE> <INDENT> print("start") <NEW_LINE> print(colname, df[colname].dtypes) <NEW_LINE> print(df[colname].head()) <NEW_LINE> if np.issubdtype(df[colname].dtype, np.datetime64) == False: <NEW_LINE> <INDENT> try: <NEW_LIN...
shitload of print statements, since this is a place where I found lots of issues. Will be removed it this proves itself.
625941da283ffb24f3c55bb8
@UI.route('/request/package/', methods=('GET', 'POST')) <NEW_LINE> @packager_login_required <NEW_LINE> def package_request_new(): <NEW_LINE> <INDENT> collections = pkgdb2.lib.search_collection( SESSION, '*', 'Under Development') <NEW_LINE> collections.reverse() <NEW_LINE> active_collections = pkgdb2.lib.search_collecti...
Page to request a new package.
625941da07f4c71912b1173d
def __init__(self): <NEW_LINE> <INDENT> self.db_schema_file = os.path.join('settings', 'db_schema.txt') <NEW_LINE> self.relative_path_pointer = '/media/data_cifs/' <NEW_LINE> self.image_list_path = 'image_lists' <NEW_LINE> self.package_indices = [ 'exp_1_validation', 'train' ] <NEW_LINE> self.image_paths = [ '/media/da...
User configuration for creating and updating the serrelab image database
625941da5e10d32532c5f1df
def convert_originals(): <NEW_LINE> <INDENT> for i, f in enumerate(sorted(os.listdir(ORIG_DIR), key=extract_num_part)): <NEW_LINE> <INDENT> command = '{} -gravity center -crop {}x{}+0+0 {} {}' .format(CONVERT, x_original, y_original, ORIG_DIR + f, WORK_DIR + str(i).zfill(5) + '.JPG') <NEW_LINE> print(command...
Converts originals to the initial resolutions, writing them to the work dir in the same time
625941da379a373c97cfadff
def _downsample(self, how, **kwargs): <NEW_LINE> <INDENT> if self.kind == "timestamp": <NEW_LINE> <INDENT> return super()._downsample(how, **kwargs) <NEW_LINE> <DEDENT> how = com.get_cython_func(how) or how <NEW_LINE> ax = self.ax <NEW_LINE> if is_subperiod(ax.freq, self.freq): <NEW_LINE> <INDENT> return self._groupby_...
Downsample the cython defined function. Parameters ---------- how : string / cython mapped function **kwargs : kw args passed to how function
625941da5e10d32532c5f1e0
def from_string(s: str): <NEW_LINE> <INDENT> obj = json.loads(s) <NEW_LINE> assert isinstance(obj, dict) <NEW_LINE> message_type = obj['message_type'] <NEW_LINE> if message_type == 'BackToZero': <NEW_LINE> <INDENT> return BackToZero.from_dict(obj) <NEW_LINE> <DEDENT> if message_type == 'OutputStart': <NEW_LINE> <INDENT...
return an appropriate subclass of Message
625941dabe7bc26dc91cd8b5
def area(self): <NEW_LINE> <INDENT> return self.__size * self.__size
int: Return area of square.
625941dabaa26c4b54cb13d6
def get_fire_objs(self): <NEW_LINE> <INDENT> return self._fireObjs
Return fireObjs list :return: list int fireObjs
625941da66656f66f7cbc466
def test_first_app_sets_hospital(self): <NEW_LINE> <INDENT> bhh = Hospital.objects.get(name='Beacon Hills Hospital') <NEW_LINE> dph = Hospital.objects.get(name='Devenford Prep Hospital') <NEW_LINE> pat_derek = Patient.objects.get(user=User.objects.get(username='Derek Hale')) <NEW_LINE> doc_deaton = Doctor.objects.get(u...
Asserts that appointments and doctors properly correspond to hospitals :return:
625941da97e22403b379d254
def __str__(self): <NEW_LINE> <INDENT> if len(self.children) == 0: <NEW_LINE> <INDENT> return str(self.value) <NEW_LINE> <DEDENT> ans = "(" <NEW_LINE> ans += str(self.children[0]) <NEW_LINE> ans += str(self.value) <NEW_LINE> ans += str(self.children[1]) <NEW_LINE> ans += ")" <NEW_LINE> return ans
Generate a string representation for an arithmetic expression
625941da50485f2cf553d054
def validate_patient_address( self, value: Text, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any], ) -> Dict[Text, Any]: <NEW_LINE> <INDENT> return {"patient_address": value}
Validate user name.
625941daa79ad161976cc3ff