code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def destroy(self): <NEW_LINE> <INDENT> assert self._as_parameter_ <NEW_LINE> zzub_audiodriver_destroy(self)
Disassociate audio driver and player.
625941e65f7d997b87174ee8
def deserialize_numpy(self, str, numpy): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if self.thermal_sources is None: <NEW_LINE> <INDENT> self.thermal_sources = None <NEW_LINE> <DEDENT> end = 0 <NEW_LINE> start = end <NEW_LINE> end += 4 <NEW_LINE> (length,) = _struct_I.unpack(str[start:end]) <NEW_LINE> self.thermal_so...
unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module
625941e6711fe17d825427ae
def mouseReleaseEvent(self, event): <NEW_LINE> <INDENT> if event.button() == Qt.LeftButton: <NEW_LINE> <INDENT> self._drag_origin = None <NEW_LINE> <DEDENT> widget = self.widget <NEW_LINE> type(widget).mouseReleaseEvent(widget, event)
Handle the mouse release event for the drag operation.
625941e6b7558d58953c5357
def startVNF (self, vnf_id): <NEW_LINE> <INDENT> raise NotImplementedError
Start VNF. :param vnf_id: VNF ID (mandatory) :type vnf_id: str :return: reply data :rtype: dict :raise: :any:`exceptions.NotImplementedError`
625941e6796e427e537b0a16
def __init__(self, config, missing_env_vars_to_configure, missing_env_vars_to_provide): <NEW_LINE> <INDENT> self._config = deepcopy(config) <NEW_LINE> self._missing_env_vars_to_configure = missing_env_vars_to_configure <NEW_LINE> self._missing_env_vars_to_provide = missing_env_vars_to_provide
Create a ProviderAnalysis.
625941e63346ee7daa2b31bc
def delete(self, file_id, token=""): <NEW_LINE> <INDENT> body = {'file_id': file_id} <NEW_LINE> if not token: <NEW_LINE> <INDENT> if os.getenv("GOPUBLISH_TOKEN"): <NEW_LINE> <INDENT> token = os.getenv("GOPUBLISH_TOKEN") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise GopublishTokenMissingError("Missing token: eithe...
Delete a file (admin_restricted) :type file_id: str :param file_id: File id :type token: str :param token: Your Gopublish token. :rtype: dict :return: Dictionnary containing the response
625941e6cad5886f8bd27425
def bubbleSort(array): <NEW_LINE> <INDENT> if not array: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> for i in range(0, len(array)): <NEW_LINE> <INDENT> flag = False <NEW_LINE> for j in range(0, len(array) - i - 1): <NEW_LINE> <INDENT> if array[j] > array[j + 1]: <NEW_LINE> <INDENT> arr...
冒泡排序
625941e6be383301e01b58ca
@Li_7.equilib_zeroize <NEW_LINE> @functools.lru_cache(maxsize=8) <NEW_LINE> @Li_7.nacreII <NEW_LINE> def H3He4_Li7g(T): <NEW_LINE> <INDENT> T9 = constants.to_norm_tempreture(T, units="T9") <NEW_LINE> base_rate = 8.20 * 10**5 * T9**(-2./3) * math.exp(-8.081/T9**(1./3)) * ( + 1.0 - 0.389 * T9 + 0.134 * T9**2 - 1.81 * 10*...
NACRE I and II
625941e699cbb53fe6793032
def __init__(self, transport=None, channel=None, credentials=None, client_config=None, client_info=None): <NEW_LINE> <INDENT> if client_config is not None: <NEW_LINE> <INDENT> warnings.warn( 'The `client_config` argument is deprecated.', PendingDeprecationWarning, stacklevel=2) <NEW_LINE> <DEDENT> else: <NEW_LINE> <IND...
Constructor. Args: transport (Union[~.VideoServiceGrpcTransport, Callable[[~.Credentials, type], ~.VideoServiceGrpcTransport]): A transport instance, responsible for actually making the API calls. The default transport uses the gRPC protocol. This argument may also be a callable...
625941e676e4537e8c351ac2
def forward(self, state, action): <NEW_LINE> <INDENT> xs = F.relu(self.fcs1(state)) <NEW_LINE> x = torch.cat((xs, action), dim=1) <NEW_LINE> x = F.relu(self.fc2(x)) <NEW_LINE> return self.fc3(x)
Build a critic (value) network that maps (state, action) pairs -> Q-values. Actions are inputed in first hidden layer.
625941e6cdde0d52a9e53483
def pCenterBack(team, workingPlay): <NEW_LINE> <INDENT> workingPlay.setSubRole(PBConstants.CENTER_BACK) <NEW_LINE> x,y = team.getPointBetweenBallAndGoal(team.brain.ball, PBConstants.DEFENDER_BALL_DIST) <NEW_LINE> x = MyMath.clip(x, PBConstants.SWEEPER_X, PBConstants.STOPPER_X) <NEW_LINE> y = MyMath.clip(y, PBConstants....
position center back
625941e61f037a2d8b946649
def get_open_trackers_from_local() -> List[str]: <NEW_LINE> <INDENT> with open(path.join(path.dirname(__file__), 'repo', OPEN_TRACKERS_FILENAME)) as f: <NEW_LINE> <INDENT> open_trackers = map(str.strip, f.readlines()) <NEW_LINE> <DEDENT> return list(open_trackers)
Returns open trackers announce URLs list from local backup.
625941e630bbd722463cc215
def gcd(a, b): <NEW_LINE> <INDENT> while b != 0: <NEW_LINE> <INDENT> a, b = b, a % b <NEW_LINE> <DEDENT> return a
欧几里得算法求最大公约数 gcd(a, b) = gcd(b, a%b), gcd(a, 0) = a :param a: :param b: :return:
625941e6b5575c28eb68e450
def max_profit_withcool(array): <NEW_LINE> <INDENT> if len(array) < 2: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> buy1, buy2, profit1, profit2 = -array[0], -array[0], 0, 0 <NEW_LINE> for i in array: <NEW_LINE> <INDENT> buy1 = buy2 <NEW_LINE> buy2 = max(buy2, profit1-i) <NEW_LINE> profit1 = profit2 <NEW_LINE> profit...
买进卖出要有一天冷却时间的最大收益
625941e65e10d32532c5f372
def update(self, request, pk=None): <NEW_LINE> <INDENT> customer = Customer.objects.get(pk=pk) <NEW_LINE> customer.address = request.data["address"] <NEW_LINE> customer.phone_number = request.data["phone_number"] <NEW_LINE> customer.save() <NEW_LINE> user = User.objects.get(pk=customer.user.id) <NEW_LINE> user.first_na...
Handle PUT requests Returns: Response -- Empty body with 204 status code
625941e6d164cc617578319c
def set_line_property(self, bits, stopbit, parity, break_=0): <NEW_LINE> <INDENT> bytelength = {7: Ftdi.BITS_7, 8: Ftdi.BITS_8} <NEW_LINE> parities = {'N': Ftdi.PARITY_NONE, 'O': Ftdi.PARITY_ODD, 'E': Ftdi.PARITY_EVEN, 'M': Ftdi.PARITY_MARK, 'S': Ftdi.PARITY_SPACE} <NEW_LINE> stopbits = {1: Ftdi.STOP_BIT_1, 1.5: Ftdi.S...
Configure the (RS232) UART characteristics. Parity accepts one of the following strings: * ``N`` for no parity bit * ``O`` for odd parity bit * ``E`` for even parity bit * ``M`` for parity bit always set * ``S`` for parity bit always reset :param int bits: data bit count :param float stopbit: stop bit count :param st...
625941e6507cdc57c6307132
def build_wide_deep_model(dnn_hidden_units=[64, 32], nembeds=3): <NEW_LINE> <INDENT> inputs = create_input_layers() <NEW_LINE> wide_fc, deep_fc = create_feature_columns(nembeds) <NEW_LINE> wide_inputs = tf.keras.layers.DenseFeatures( feature_columns=wide_fc.values(), name="wide_inputs")(inputs) <NEW_LINE> deep_inputs =...
Builds wide and deep model using Keras Functional API. Returns: `tf.keras.models.Model` object.
625941e616aa5153ce3628c5
def extract_patient_accession_timepoints(patient_id: int): <NEW_LINE> <INDENT> time_url = ("https://www.hiv.lanl.gov/components/sequence/HIV/search/d_search.comp" "?ssam_pat_id={}&ssam_postfirstsample_days=*&ssam_poststarttreatment_days=*" "&ssam_postendtreatment_days=*&ssam_postseroconv_days=*&ssam_postinfect_days=*&s...
Load large sequence accession table with timepoint information for patient_id.
625941e650812a4eaa59c76a
def set_text(self, oid, text): <NEW_LINE> <INDENT> return self.uiAutomatorHelper.api_instance.ui_object2_set_text_post(oid=oid, body=Text(text))
Sets the text content if this object is an editable field. :see https://github.com/dtmilano/CulebraTester2-public/blob/master/openapi.yaml :param oid: the oid :param text: the text :return: the result of the operation
625941e6eab8aa0e5d26dfa6
def get_urls(api_views=None, social_views=None, saml_views=None): <NEW_LINE> <INDENT> return [ path('api/v1/', include(get_api_urls(api_views))), path('', include(get_private_store_urls())), path('radius/social-login/', include(get_social_urls(social_views))), path('radius/saml2/', include(get_saml_urls(saml_views))), ...
Returns a list of urlpatterns Arguements: api_views(optional): views for Radius API social_view(optional): views for social login (if enabled) saml_views(optional): views for saml login (if enabled)
625941e6d58c6744b42580ab
def setup_keyspace(self, keyspace_name): <NEW_LINE> <INDENT> setup_cql = self.setup_cql(keyspace_name) <NEW_LINE> try: <NEW_LINE> <INDENT> self._exec_cql(setup_cql) <NEW_LINE> <DEDENT> except ProgrammingError as pe: <NEW_LINE> <INDENT> if (self.overwrite_keyspaces and "Cannot add existing keyspace" in pe.message): <NEW...
Creates a keyspace given the setup cql, which should include keyspace creation as well as schema setup. :param keyspace_name: what the name of the keyspace is to create :type keyspace_name: ``str`` :raises: :class:`cql.apivalues.ProgrammingError` if there was an error executing the cql or connecting to the cluste...
625941e6ec188e330fd5abe3
def __init__(self): <NEW_LINE> <INDENT> super(Sht2xI2cCmdSoftReset, self).__init__( command=0xFE, tx_data=b'', rx_length=None, read_delay=0., timeout=0., post_processing_time=0.015, )
Constructs a new command.
625941e6462c4b4f79d1db1c
def screen_size(): <NEW_LINE> <INDENT> return ( ctypes.windll.user32.GetSystemMetrics(0), ctypes.windll.user32.GetSystemMetrics(1), )
Returns the width and height of the screen as a two-integer tuple. Returns: (width, height) tuple of the screen size, in pixels.
625941e63539df3088e2e798
@api.route('/lab/remove_image', methods=['POST']) <NEW_LINE> @requires_roles('admin', 'teacher') <NEW_LINE> @error_handling <NEW_LINE> def lab_remove_image(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> lab_id = flask.request.values['lab_id'] <NEW_LINE> image_id = flask.request.values['image_id'] <NEW_LINE> lab_m = La...
Delete a specified image from a specified lab. flask.request input: * **lab_id**: Lab id of the lab where the image should be removed. * **image_id**: The image id of the image that should be removed form the lab.
625941e6377c676e912725f4
def pc_input_buffers_full_var(self, *args): <NEW_LINE> <INDENT> return _guyu_swig.print_data_f_sptr_pc_input_buffers_full_var(self, *args)
pc_input_buffers_full_var(print_data_f_sptr self, int which) -> float pc_input_buffers_full_var(print_data_f_sptr self) -> pmt_vector_float
625941e6a8370b7717052cea
def test_get_batch(self): <NEW_LINE> <INDENT> block = self.create_block() <NEW_LINE> block_store = self.create_block_store() <NEW_LINE> block_store.update_chain([block]) <NEW_LINE> batch = block.batches[0] <NEW_LINE> batch_id = batch.header_signature <NEW_LINE> stored = block_store.get_batch(batch_id) <NEW_LINE> self.a...
Test BlockStore retrieval of a batch by id.
625941e63d592f4c4ed1d4af
def _list_scan_positions(self, xstart, xspacing, ystart, yspacing, nx, ny, dxx=0.0, dxy=0.0, dyy=0.0, dyx=0.0): <NEW_LINE> <INDENT> xl = [] <NEW_LINE> yl = [] <NEW_LINE> for i in range(ny): <NEW_LINE> <INDENT> for j in range(nx): <NEW_LINE> <INDENT> xl.append(self._x_position(xstart, xspacing, j, i, dxx=dxx, dxy=dxy))...
Return lists of x and y positions for use in a BlueSky list_scan plan. Calculates x and y positions for a sample grid given any non-idealities in the grid alignment. Parameters ---------- xstart : float Initial x position (e.g. x position of target "zero"). xspacing : float Ideal spacing for grid. ystart : ...
625941e62eb69b55b151cd02
def DrawEye(pnt, img): <NEW_LINE> <INDENT> index = img.TransformPhysicalPointToIndex(pnt) <NEW_LINE> spacing = img.GetSpacing() <NEW_LINE> EYE_MAX_RADIUS = 15 <NEW_LINE> indexstart = [int(math.floor(-EYE_MAX_RADIUS * e)) for e in spacing] <NEW_LINE> indexstop = [int(math.ceil(+EYE_MAX_RADIUS * e)) for e in spacing] <NE...
Eye diameters are less than 30mm (typically average about 24mm)
625941e6bf627c535bc1361d
def table_from_rows(self, *rows, **kwargs): <NEW_LINE> <INDENT> return self.table(rows, **kwargs)
makes a table from the passed in rows :param *rows: list, each passed in list will be one row :param **kwargs: see table()
625941e631939e2706e4d2b1
def __detail(self, sale): <NEW_LINE> <INDENT> message = '{0}: {1}円({2})' <NEW_LINE> return message.format(sale.fruit.name, sale.total, sale.number)
販売情報の内訳を以下のようなフォーマットで取得 'ブルーベリー: 3000円(10)' :param sale: 販売情報 :type sale: Sale :returns: 販売情報の内訳 :rtype: str
625941e6cb5e8a47e48b7ef1
def compute_alignment_matrix_test(): <NEW_LINE> <INDENT> seq_x = 'AC' <NEW_LINE> seq_y = 'TAG' <NEW_LINE> alphabet = set(seq_x + seq_y) <NEW_LINE> diag_score = 5 <NEW_LINE> off_diag_score = 2 <NEW_LINE> dash_score = -4 <NEW_LINE> scoring_matrix = build_scoring_matrix(alphabet, diag_score, off_diag_score, dash_score) <N...
Run unit tests for compute_alignment_matrix function
625941e6a17c0f6771cbe49d
def max_noutput_items(self): <NEW_LINE> <INDENT> return _blocks_swig4.patterned_interleaver_sptr_max_noutput_items(self)
max_noutput_items(patterned_interleaver_sptr self) -> int
625941e6c432627299f05096
def cast(*args): <NEW_LINE> <INDENT> return _itkMeshSourcePython.itkMeshSourceMD2Q_cast(*args)
cast(itkLightObject obj) -> itkMeshSourceMD2Q
625941e6293b9510aa2c36df
def predict_labels(self, dists, k=1): <NEW_LINE> <INDENT> num_test = dists.shape[0] <NEW_LINE> y_pred = np.zeros(num_test) <NEW_LINE> for i in xrange(num_test): <NEW_LINE> <INDENT> closest_y = [] <NEW_LINE> labels = self.y_train[np.argsort(dists[i,:])].flatten() <NEW_LINE> closest_y = labels[0:k] <NEW_LINE> c = Counter...
Given a matrix of distances between test points and training points, predict a label for each test point. Input: dists - A num_test x num_train array where dists[i, j] gives the distance between the ith test point and the jth training point. Output: y - A vector of length num_test where y[i] is the predicted la...
625941e60a50d4780f6672e3
def test001_count_paragraphs(self): <NEW_LINE> <INDENT> self.assertEqual( len(list(self.doc.paragraphs())) , 3)
Sanity check - Paragraph count
625941e6a05bb46b383ecc6b
def mask_chunk(chunk): <NEW_LINE> <INDENT> for i in range(len(chunk)): <NEW_LINE> <INDENT> row2 = chunk[i] * 1 <NEW_LINE> m = (chunk[i] == 0) + np.isnan(chunk[i]) <NEW_LINE> if np.sum(m) != 0: <NEW_LINE> <INDENT> row2[m] = np.nan <NEW_LINE> mean = np.nanmean(row2) <NEW_LINE> if np.isnan(mean): <NEW_LINE> <INDENT> chunk...
Replaces zero masking of RFI with the mean of the relevant frequency channel
625941e692d797404e3045d9
def _evaluate_expressions(self, gdfs): <NEW_LINE> <INDENT> return (self._evaluate_group_dataframe(gdf) for gdf in gdfs)
Evaluate all group dataframes Parameters ---------- gdfs : list Dataframes for each group Returns ------- out : list Result dataframes for each group
625941e67b180e01f3dc4c42
def test_gaussian(data, p_threshold=0.05): <NEW_LINE> <INDENT> timesteps = data.shape[1] <NEW_LINE> p_values = np.zeros(timesteps) <NEW_LINE> for t in range(timesteps): <NEW_LINE> <INDENT> _, p_values[t] = shapiro(data[:, t]) <NEW_LINE> <DEDENT> significant_timesteps = p_values <= p_threshold <NEW_LINE> sig = np.sum(si...
Test whether the distributions over multiple timesteps are normal distributions using a Shapiro-Wilk Test.
625941e671ff763f4b549ae0
def __next__(self): <NEW_LINE> <INDENT> if self.size == 0: <NEW_LINE> <INDENT> raise StopIteration <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.dequeue()
overriding this method implements the next method for the iterator :return: calls the dequeue() method to get the appropriate value to return and remove it from the queue :raises StopIteration: if there are no elements in the queue
625941e666673b3332b924de
def __init__(self, connection, sub, frame, destinations, mid, body, content_type=None, content_length=None): <NEW_LINE> <INDENT> self._connection = connection <NEW_LINE> self._sub = sub <NEW_LINE> self._frame = frame <NEW_LINE> self._mid = mid <NEW_LINE> self._body = body <NEW_LINE> self._content_type = content_type <N...
Initialize a new :class:`Message` instance.
625941e663f4b57ef000155a
def symbols_w_prop(self, prop): <NEW_LINE> <INDENT> bitmap = self.props[prop] <NEW_LINE> return set([symbol for symbol in self.alphabet if bitmap & symbol])
Returns symbols from the automaton's alphabet which contain the given atomic proposition.
625941e666673b3332b924df
def get_meta(self, key: Optional[str] = None ) -> Union[Mapping[str, str], Optional[str]]: <NEW_LINE> <INDENT> raise NotImplementedError
Get metadata value for collection. Return the value of the property ``key``. If ``key`` is ``None`` return a dict with all properties
625941e64c3428357757c773
def join_children(self): <NEW_LINE> <INDENT> self.neighbors["back"] = self <NEW_LINE> max = len(self.selections) <NEW_LINE> for i, ch in enumerate(self.selections): <NEW_LINE> <INDENT> ch.neighbors["up"] = self.selections[(i - 1) % max] <NEW_LINE> ch.neighbors["down"] = self.selections[(i + 1) % max] <NEW_LINE> ch.neig...
Override of navstate's join_children implementation to not link back neighbors, as there are none!
625941e6d53ae8145f87a6b5
def unregister_key(self, key: str) -> None: <NEW_LINE> <INDENT> self._del_key(key) <NEW_LINE> self._build_printable()
Remove the handler associated with a key
625941e696565a6dacc8fb17
def download_fast(self,date,FA='af',del1=True,checkinv=False,quiet=True,prevopt=True): <NEW_LINE> <INDENT> targets,destinations=self.daily_files(date,FA) <NEW_LINE> log=os.path.join(self.logFolder,'download.log') <NEW_LINE> if not os.path.isdir(self.logFolder): os.makedirs(self.logFolder) <NEW_LINE> open(log,'a').write...
Downloads all the self.egrep variables for date. By default both analysis and forecast data is downloaded. Used by download_current and download_range (use then instead) Inputs: date, FA ('f'orecast of 'a'nalysis or 'af') del1, if the original version is grib1, the conversion to grib2 is done and the version 1...
625941e6baa26c4b54cb1569
def create_settings_notification(self, settings_notification, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async'): <NEW_LINE> <INDENT> return self.create_settings_notification_with_http_info(settings_notification, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDEN...
create_settings_notification # noqa: E501 Create a new global notification rule. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.create_settings_notification(settings_notification, async=True) >>> result = thread.get(...
625941e697e22403b379d3e9
def get_svmrank_parser_ext(): <NEW_LINE> <INDENT> path = "pytorchltr/datasets/svmrank/parser" <NEW_LINE> pyx_path = os.path.join(path, "svmrank_parser.pyx") <NEW_LINE> c_path = os.path.join(path, "svmrank_parser.c") <NEW_LINE> if CAN_CYTHONIZE and os.path.exists(pyx_path): <NEW_LINE> <INDENT> return cythonize([Extensio...
Gets the svmrank parser extension. This uses cython if possible when building from source, otherwise uses the packaged .c files to compile directly.
625941e6167d2b6e31218fe2
def main(): <NEW_LINE> <INDENT> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'borrower_tracker.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...
Run administrative tasks.
625941e69f2886367277acd7
def change(self, new_value): <NEW_LINE> <INDENT> self.answer = new_value
Changes the filter property
625941e68a43f66fc4b544ae
def test_o2o_cross_database_protection(self): <NEW_LINE> <INDENT> alice = User.objects.db_manager('default').create_user('alice', 'alice@example.com') <NEW_LINE> bob = User.objects.db_manager('other').create_user('bob', 'bob@example.com') <NEW_LINE> alice_profile = UserProfile.objects.create(user=alice, flavor='chocola...
Operations that involve sharing FK objects across databases raise an error
625941e6d164cc617578319d
def set_floating(self, floating): <NEW_LINE> <INDENT> if not self._guard & FLOATED_GUARD: <NEW_LINE> <INDENT> self._guard |= FLOATED_GUARD <NEW_LINE> try: <NEW_LINE> <INDENT> self.widget.SetFloating(floating) <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDENT> self._guard &= ~FLOATED_GUARD
Set the floating staet on the underlying widget.
625941e6287bf620b61d3eaf
def shift(p, a): <NEW_LINE> <INDENT> return Polynomial(p.coeffs + [0.0]*a)
:param a: integer :return: a new polynomial, multiplied by x**a. Just adds zeros for new low-order coefficients.
625941e6656771135c3ebcc2
def ajax_players_table(request,week): <NEW_LINE> <INDENT> if not _validAjaxRequest(request): <NEW_LINE> <INDENT> return HttpResponse(status=400) <NEW_LINE> <DEDENT> if not _validGetRequest(request): <NEW_LINE> <INDENT> return HttpResponse(status=400) <NEW_LINE> <DEDENT> if not week is None: <NEW_LINE> <INDENT> try: <NE...
returns the players table for the specified week if week is None, returns the full table for all played weeks
625941e68da39b475bd653c7
def _get_nebula_repository_path(self, name, force_new=False): <NEW_LINE> <INDENT> git_dir = self.source_code_manager.get_local_repository_path(name) <NEW_LINE> original_repo_path = os.path.abspath(git_dir) <NEW_LINE> options = self.options <NEW_LINE> nebula_repo_path = os.path.join(options.scratch_dir, 'build', name) <...
Return the path to the repository for nebula to build. If the repository does not exist then one will be cloned from the source repository. Nebula gets confused by our tags because it expects the Netflix ones. Since we dont understand how to change nebula and dont want to invest the time into it, we're just going to ...
625941e67047854f462a1852
def resize_image(image, *args, **kwargs): <NEW_LINE> <INDENT> if image is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> assert image.ndim == 3 and image.shape[2] in [1, 3] <NEW_LINE> image = cv2.resize(image, *args, **kwargs) <NEW_LINE> if image.ndim == 2: <NEW_LINE> <INDENT> return image[:, :, np.newaxis] ...
Resizes image. This is a wrap of `cv2.resize()`. NOTE: THe channel order of the input image will not be changed. Args: image: Image to resize.
625941e6d4950a0f3b08c797
def get_le_neutral(dtype): <NEW_LINE> <INDENT> if dtype.kind == "f": <NEW_LINE> <INDENT> return var("INFINITY") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise NotImplementedError("less")
Return a number y that satisfies (x <= y) for all y.
625941e6f7d966606f6aa457
def guess_payload_class(self, payload): <NEW_LINE> <INDENT> plen = len(payload) <NEW_LINE> if plen - 4 in [16, 20, 32, 64]: <NEW_LINE> <INDENT> return NTPAuthenticator <NEW_LINE> <DEDENT> elif plen > _NTP_AUTH_MD5_TAIL_SIZE: <NEW_LINE> <INDENT> return NTPExtensions <NEW_LINE> <DEDENT> return Packet.guess_payload_class(...
Handles NTPv4 extensions and MAC part (when authentication is used.)
625941e66e29344779a62a5e
def _goto(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> definitions = self.script.goto_assignments() <NEW_LINE> if all(d.type == 'import' for d in definitions): <NEW_LINE> <INDENT> definitions = self.script.get_definition() <NEW_LINE> <DEDENT> <DEDENT> except NotFoundError: <NEW_LINE> <INDENT> return <NEW_LINE> <...
Jedi "go to Definitions" functionality :rtype: list of (str, int, int) or None
625941e6d6c5a1020814449c
def search(needle): <NEW_LINE> <INDENT> east, north = geo.utms() <NEW_LINE> url = "http://reisapi.ruter.no/Place/GetPlaces/" + str(needle) + "?location=(x="+east+",y="+north+")&counties=Oslo&counties=Akershus" <NEW_LINE> resp = requests.get(url) <NEW_LINE> if resp.status_code != 200: <NEW_LINE> <INDENT> rais...
Search for stoppesteder near the location of the device
625941e61b99ca400220af01
def delete(self, microbit_filename): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> with microfs.get_serial() as serial: <NEW_LINE> <INDENT> microfs.rm(microbit_filename, serial) <NEW_LINE> <DEDENT> self.on_delete_file.emit(microbit_filename) <NEW_LINE> <DEDENT> except Exception as ex: <NEW_LINE> <INDENT> logger.error(ex...
Delete the referenced file on the micro:bit's filesystem. Emit the name of the file when complete, or emit a failure signal.
625941e68c3a87329515880e
def test_generate_all_input_files(cli): <NEW_LINE> <INDENT> cli.run("lasif create_new_iteration 1 8.0 100.0 SES3D_4_1") <NEW_LINE> ac = "lasif.components.actions.ActionsComponent." <NEW_LINE> with mock.patch(ac + "generate_input_files") as patch: <NEW_LINE> <INDENT> out = cli.run("lasif generate_all_input_files 1 " "--...
Mock test for generate_all_input_files.
625941e6460517430c3945c8
def crash(self): <NEW_LINE> <INDENT> sys.exit(0)
Immediately crashes this server
625941e68a349b6b435e85c1
def testDatabitsGroups(self): <NEW_LINE> <INDENT> p = self.p <NEW_LINE> p.D0_D3 = 14 <NEW_LINE> self.assertEqual(p._data, 0x0e) <NEW_LINE> p.D0_D3 = 0 <NEW_LINE> p.D4_D7 = 13 <NEW_LINE> self.assertEqual(p._data, 0xd0) <NEW_LINE> p.D0_D3 = p.D4_D7 = 0xa <NEW_LINE> self.assertEqual(p._data, 0xaa) <NEW_LINE> for x in rang...
nibbles D0..D7
625941e655399d3f05588b05
def create_Kff_Matrix(model,Af, Ks): <NEW_LINE> <INDENT> Kff = Af.T@Ks@Af <NEW_LINE> return Kff
Returns Kff, the stiffness matrix for the free DOFs
625941e66fece00bbac2db92
def list_orgs( cmd, app_id: str, token: str, api_version: str, max_pages=0, central_dns_suffix=CENTRAL_ENDPOINT, ) -> List[OrganizationV1_1_preview]: <NEW_LINE> <INDENT> orgs = [] <NEW_LINE> url = "https://{}.{}/{}".format(app_id, central_dns_suffix, BASE_PATH) <NEW_LINE> pages_processed = 0 <NEW_LINE> while (max_pages...
Get a list of all organizations in IoTC app Args: cmd: command passed into az app_id: name of app (used for forming request URL) token: (OPTIONAL) authorization token to fetch role details from IoTC. MUST INCLUDE type (e.g. 'SharedAccessToken ...', 'Bearer ...') central_dns_suffix: {centralDnsS...
625941e676d4e153a657ef80
def load(self, filename): <NEW_LINE> <INDENT> with open(filename, 'rb') as f: <NEW_LINE> <INDENT> data = pickle.load(f) <NEW_LINE> <DEDENT> self.W_input_to_hidden1=data['wi'] <NEW_LINE> self.W_hidden1_to_hidden2=data['wh'] <NEW_LINE> self.W_hidden2_to_output = data['wo']
Load neural network (weights) from a file.
625941e67b25080760e398a5
def check_for_upload_needed(self): <NEW_LINE> <INDENT> copy = [] <NEW_LINE> copy.extend(self.might_need_to_sign) <NEW_LINE> for keyid in copy: <NEW_LINE> <INDENT> if self.keys and keyid not in self.keys: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> if keyid in self.sign_data: <NEW_LINE> <INDENT> if self.sign_data[k...
Walk through keys without our sig and determine their status.
625941e63617ad0b5ed68345
def _deepfoolx(model, x, epochs, eta, clip_min, clip_max, min_prob): <NEW_LINE> <INDENT> y0 = tf.stop_gradient(model(x)) <NEW_LINE> y0 = tf.reshape(y0, [-1]) <NEW_LINE> k0 = tf.argmax(y0) <NEW_LINE> ydim = y0.get_shape().as_list()[0] <NEW_LINE> xdim = x.get_shape().as_list()[1:] <NEW_LINE> xflat = _prod(xdim) <NEW_LINE...
DeepFool for multi-class classifiers. Assumes that the final label is the label with the maximum values.
625941e6d18da76e23532929
def reward_leap_up_back(self, action, resolving_leap_bonus=5.0, leaping_twice_punishment=-5.0): <NEW_LINE> <INDENT> leap_outcome = self.detect_leap_up_back(action) <NEW_LINE> if leap_outcome == LEAP_RESOLVED: <NEW_LINE> <INDENT> tf.logging.debug('Leap resolved, awarding %s', resolving_leap_bonus) <NEW_LINE> return reso...
Applies punishment and reward based on the principle leap up leap back. Large interval jumps (more than a fifth) should be followed by moving back in the same direction. Args: action: One-hot encoding of the chosen action. resolving_leap_bonus: Amount of reward dispensed for resolving a previous leap. leaping...
625941e691af0d3eaac9be6b
def addresses(self): <NEW_LINE> <INDENT> r=[] <NEW_LINE> for addr in IPv4Network("{}/{}".format(self.ip(), self.netmask()), strict=False): <NEW_LINE> <INDENT> r.append(addr) <NEW_LINE> <DEDENT> return r
List of strings with all ip addresses in the net of the interface
625941e60383005118ecfa2f
def updatePositionAndClean(self): <NEW_LINE> <INDENT> curr_pos = self.getRobotPosition() <NEW_LINE> self.room.cleanTileAtPosition(curr_pos) <NEW_LINE> while True: <NEW_LINE> <INDENT> new_pos=curr_pos.getNewPosition(self.d, self.speed) <NEW_LINE> if self.room.isPositionInRoom(new_pos): <NEW_LINE> <INDENT> self.setRobotP...
Simulate the passage of a single time-step. Move the robot to a new position and mark the tile it is on as having been cleaned.
625941e6d486a94d0b98e595
def test_open_reuse_number(self): <NEW_LINE> <INDENT> with Session(devices={b'A': self.output_path()}, current_device='A') as s: <NEW_LINE> <INDENT> s.execute('open "TEST" for output as 1') <NEW_LINE> s.execute('open "TEST2" for output as 1') <NEW_LINE> output = [_row.strip() for _row in self.get_text(s)] <NEW_LINE> <D...
Test opening to a number taht's already in use.
625941e6a934411ee3751ae3
def resoults_parsing(beams, supports, r, Naming_r): <NEW_LINE> <INDENT> naming = [_.Naming_fe for _ in beams] <NEW_LINE> Naming = np.vstack(naming) <NEW_LINE> Naming = np.array(Naming, dtype='U25') <NEW_LINE> Resoult = np.zeros(len(Naming)) <NEW_LINE> for num_, Name_ in enumerate(Naming): <NEW_LINE> <INDENT> for num, n...
Splits calculated resoults according to beams/trusses
625941e624f1403a92600fb1
def index_queryset(self, using=None): <NEW_LINE> <INDENT> return self.get_model().objects.filter(reply=False, updated_at__lte=timezone.now())
Used when the entire index for model is updated.
625941e631939e2706e4d2b2
def white_balance_match_global(im1, im2, scale=4): <NEW_LINE> <INDENT> w, h = im1.size <NEW_LINE> if scale != 1: <NEW_LINE> <INDENT> im1 = im1.resize((w * scale, h * scale), resample=Image.BILINEAR) <NEW_LINE> <DEDENT> im1 = to_tensor(im1) <NEW_LINE> im2 = to_tensor(im2) <NEW_LINE> C, H, W = im1.shape <NEW_LINE> ave1 =...
Global white balance match based on Gray World AWB algorithm Input, output PIL Image :param im1: supposed to be LR (reference) :param im2: HR :return:
625941e6b545ff76a8914263
def load_config(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.config = config.Config() <NEW_LINE> self.config.load(self.args.config, self.args.variants) <NEW_LINE> if self.args.manifest: <NEW_LINE> <INDENT> self.config.manifest = self.args.manifest <NEW_LINE> <DEDENT> <DEDENT> except ConfigurationError as ex...
Load the configuration
625941e685dfad0860c3b2aa
def overlay_gateway_map_vlan_vni_auto(self, **kwargs): <NEW_LINE> <INDENT> config = ET.Element("config") <NEW_LINE> overlay_gateway = ET.SubElement(config, "overlay-gateway", xmlns="urn:brocade.com:mgmt:brocade-tunnels") <NEW_LINE> name_key = ET.SubElement(overlay_gateway, "name") <NEW_LINE> name_key.text = kwargs.pop(...
Auto Generated Code
625941e6e5267d203edce0e6
def _formclusters(sortedargs, max_depth=None, n_relax=1): <NEW_LINE> <INDENT> labels = [[] for i in range(sortedargs.shape[0])] <NEW_LINE> if max_depth is not None: <NEW_LINE> <INDENT> max_depth -= 1 <NEW_LINE> if max_depth < 0: <NEW_LINE> <INDENT> return labels <NEW_LINE> <DEDENT> <DEDENT> maxargs = sortedargs[:, 0] <...
CHUNX-PARTITION: Recursive algorithm for returning labeled data from the argument sorted array of significance factors with every eigenvector for every data entry. Parameters ---------- sortedargs : array-like, shape=(n_samples, n_singularcomponents), the argument sorted array of significance factors with e...
625941e6796e427e537b0a18
def isBlack(): <NEW_LINE> <INDENT> return getItemValue('Sys_LightLevel', LIGHT_LEVEL['BRIGHT']) <= LIGHT_LEVEL['BLACK']
Returns true if black, otherwise false
625941e6099cdd3c635f10a7
def getFeelsLike( T=10, V=25 ): <NEW_LINE> <INDENT> FeelsLike = T <NEW_LINE> if round( ( V + .0 ) / 1.609344 ) > 4: <NEW_LINE> <INDENT> FeelsLike = ( 13.12 + ( 0.6215 * T ) - ( 11.37 * V**0.16 ) + ( 0.3965 * T * V**0.16 ) ) <NEW_LINE> <DEDENT> return str( round( FeelsLike ) )
The formula to calculate the equivalent temperature related to the wind chill is: T(REF) = 13.12 + 0.6215 * T - 11.37 * V**0.16 + 0.3965 * T * V**0.16 Or: T(REF): is the equivalent temperature in degrees Celsius V: is the wind speed in km/h measured at 10m height T: is the temperature of the air in degrees Celsius...
625941e601c39578d7e7528a
def affine_forward(x, w, b): <NEW_LINE> <INDENT> out = None <NEW_LINE> N = x.shape[0] <NEW_LINE> x_row = x.reshape(N, -1) <NEW_LINE> out = np.dot(x_row, w) + b <NEW_LINE> cache = (x, w, b) <NEW_LINE> return out, cache
Computes the forward pass for an affine (fully-connected) layer. The input x has shape (N, d_1, ..., d_k) and contains a minibatch of N examples, where each example x[i] has shape (d_1, ..., d_k). We will reshape each input into a vector of dimension D = d_1 * ... * d_k, and then transform it to an output v...
625941e6ab23a570cc2505d4
def testHandle(self): <NEW_LINE> <INDENT> previous = self.baseline['output'] <NEW_LINE> current = self.current['output'] <NEW_LINE> self.assertIntegerListEqual( sorted(self.ExtractColumn(current, 0, 2)), sorted(self.ExtractColumn(previous, 0, 2))) <NEW_LINE> self.assertListEqual( sorted(self.ExtractColumn(previous, 2, ...
Test the modules plugin.
625941e663f4b57ef000155b
def element_ratio_sum(self): <NEW_LINE> <INDENT> return self._chemical_composition.element_ratio_sum()
Returns the sum of all relative ratios of elements (not relative masses)
625941e6be7bc26dc91cda46
def _handler_method_name(root_op: str): <NEW_LINE> <INDENT> return '_handle_' + root_op
Convert a root operation string to the name of a method on ClientHandler
625941e6b5575c28eb68e452
def add_padding(self): <NEW_LINE> <INDENT> self.data += b'\x00' * 8
Add 8 byte zero padding at the end of data
625941e615baa723493c43c7
@staff_member_required <NEW_LINE> def indicator_batch_list(request): <NEW_LINE> <INDENT> return render_to_response('admin/indicator_batch_list.html', {'batches': map(lambda b: _collect_batch_info(b), os.listdir('./media/batches/'))}, context_instance=RequestContext(request))
Displays the status of an indicator debug batch. The directory with the name specified by the uuid parameter is searched for output, debug and log files. Return 404 if not found. If log.txt exists, but the "end batch" marker isn't found, output the log file contents, but do not offer a download link. If the batch is ...
625941e68e71fb1e9831dbf6
def send_confirmation_email(base_url, drone_operator): <NEW_LINE> <INDENT> EmailConfirmation.objects.filter( drone_operator=drone_operator).update( deleted=datetime.datetime.utcnow()) <NEW_LINE> unique_url, unique_code = users_utils.generate_confirmation_url( base_url, drone_operator.id) <NEW_LINE> EmailConfirmation.ob...
Sends out a confirmation email to a registering drone operator. Adds a row to the confirmation table.
625941e6090684286d50f13a
def depth(current_data): <NEW_LINE> <INDENT> from numpy import ma <NEW_LINE> drytol = getattr(current_data.user, 'dry_tolerance', drytol_default) <NEW_LINE> q = current_data.q <NEW_LINE> h = q[0,:] <NEW_LINE> depth = ma.masked_where(h<=drytol, h) <NEW_LINE> return depth
Return a masked array containing the depth of fluid only in wet cells.
625941e63d592f4c4ed1d4b0
def process_queue(self): <NEW_LINE> <INDENT> done = False <NEW_LINE> progs = [] <NEW_LINE> while True: <NEW_LINE> <INDENT> if self.complete: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> prog = self.progress_queue.get_nowait() <NEW_LINE> <DEDENT> except queue.Empty: <NEW_LINE> <INDENT> break <N...
Updates progress by checking progress_queue
625941e65e10d32532c5f374
def clear_element(element): <NEW_LINE> <INDENT> tail = element.tail <NEW_LINE> element.clear() <NEW_LINE> element.tail = tail
In an XHTML tree, remove all sub-elements of a given element. We can't properly remove an XML element while traversing the tree. But we can clean it. Remove its text and children. However the tail must be preserved because it belong to the next element, so re-attach.
625941e64f6381625f114e8b
def add(self, p): <NEW_LINE> <INDENT> self.points.append(p)
add a point to the polygon point list
625941e64f6381625f114e8a
def list_of_combs(arr): <NEW_LINE> <INDENT> for i in range(2, len(arr)+1): <NEW_LINE> <INDENT> listing = [list(x) for x in itertools.combinations(arr, i)] <NEW_LINE> combs.extend(listing) <NEW_LINE> <DEDENT> return combs
returns a list of all subsets of a list
625941e64e4d5625662d4821
def main(): <NEW_LINE> <INDENT> reporter = rose.reporter.Reporter() <NEW_LINE> add_meta_paths() <NEW_LINE> opts, args = parse_macro_args() <NEW_LINE> confs = scan_rose_directory(opts.conf_dir, suite_only=opts.suite_only) <NEW_LINE> if not confs: <NEW_LINE> <INDENT> reporter(ERROR_LOAD_CONFIG_DIR.format(opts.conf_dir), ...
Run rose macro.
625941e6a05bb46b383ecc6c
@pytest_fixture_plus <NEW_LINE> @pytest.mark.parametrize("windows", ["y", "n"], ids=lambda yn: f"win:{yn}") <NEW_LINE> @pytest.mark.parametrize("use_docker", ["y", "n"], ids=lambda yn: f"docker:{yn}") <NEW_LINE> @pytest.mark.parametrize("use_celery", ["y", "n"], ids=lambda yn: f"celery:{yn}") <NEW_LINE> @pytest.mark.pa...
Fixture that parametrize the function where it's used.
625941e650485f2cf553d1ea
def parse_company_name(words): <NEW_LINE> <INDENT> if len(words) == 1 and words[0].isdigit(): <NEW_LINE> <INDENT> return (None, words[0]) <NEW_LINE> <DEDENT> document = None <NEW_LINE> last_word = words[-1] <NEW_LINE> if last_word.isdigit() and len(last_word) == 11: <NEW_LINE> <INDENT> document = words.pop() <NEW_LINE>...
>>> parse_company_name(['FULANO', 'DE', 'TAL', '12345678901']) ('12345678901', 'FULANO DE TAL') >>> parse_company_name(['FULANO', 'DE', 'TAL', 'CPF', '12345678901']) ('12345678901', 'FULANO DE TAL') >>> parse_company_name(['FULANO', 'DE', 'TAL', '-', 'CPF', '12345678901']) ('12345678901', 'FULANO DE TAL') >>> parse_com...
625941e650812a4eaa59c76c
def __get_comment( self, comment_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> kwargs['_reques...
Get comment. # noqa: E501 Returns the comment with the specified ID. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_comment(comment_id, async_req=True) >>> result = thread.get() Args: comment_id (str): ...
625941e68c0ade5d55d3ee0d
def __single_turn(self): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> color = input(MSG_CHOOSE_CAR) <NEW_LINE> for car in self.__board.cars: <NEW_LINE> <INDENT> if car.color == color: <NEW_LINE> <INDENT> direction = gh.get_direction() <NEW_LINE> while not self.__check_direction(car, direction) or ...
Note - this function is here to guide you and it is *not mandatory* to implement it. The logic defined by this function must be implemented but if you wish to do so in another function (or some other functions) it is ok. The function runs one round of the game : 1. gh.report board to the screen 2. Get user's i...
625941e6eab8aa0e5d26dfa8
def add_tag(self, data): <NEW_LINE> <INDENT> if not isinstance(data, str): <NEW_LINE> <INDENT> raise AttributeError(ErrorCodes.e4070.value.format(data)) <NEW_LINE> <DEDENT> prop = self._resource_properties['tags'] <NEW_LINE> ro = RequestObject() <NEW_LINE> ro.set_description('api filter by tag "{0}"'.format(data)) <NEW...
filter api results by tag
625941e6eab8aa0e5d26dfa9
def test_nonetype(self): <NEW_LINE> <INDENT> xres = IFDRational(72) <NEW_LINE> yres = IFDRational(72) <NEW_LINE> self.assertTrue(xres._val is not None) <NEW_LINE> self.assertTrue(xres.numerator is not None) <NEW_LINE> self.assertTrue(xres.denominator is not None) <NEW_LINE> self.assertTrue(yres._val is not None) <NEW_L...
Fails if the _delegate function doesn't return a valid function
625941e656b00c62f0f14aab
def parse_from_string(self, spec): <NEW_LINE> <INDENT> self._clear() <NEW_LINE> splits = [x.split(":") for x in spec.split("/")] <NEW_LINE> for y in splits: <NEW_LINE> <INDENT> ly = len(y) <NEW_LINE> if y: <NEW_LINE> <INDENT> if ly == 2 and y[0] == "job": <NEW_LINE> <INDENT> self.job = y[1] <NEW_LINE> <DEDENT> elif ly ...
Parse a `DeviceSpec` name into its components. Args: spec: a string of the form /job:<name>/replica:<id>/task:<id>/device:CPU:<id> or /job:<name>/replica:<id>/task:<id>/device:GPU:<id> as cpu and gpu are mutually exclusive. All entries are optional. Returns: The `DeviceSpec`. Raises: ValueError: if...
625941e6baa26c4b54cb156a