code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def TotalPriceHouse(Total): <NEW_LINE> <INDENT> Total_list = [] <NEW_LINE> Obtain_Total = BeautifulSoup(str(Total), 'lxml') <NEW_LINE> Total_one = Obtain_Total.fjind_all(class_='second') <NEW_LINE> for i in Total_one: <NEW_LINE> <INDENT> Get_Span = BeautifulSoup(str(i), 'lxml') <NEW_LINE> Get_Span_one = Get_Span.string...
房屋总价 @param Total: @return:
625941db8e71fb1e9831da7e
def rotateSegments(self, segRotation, segRetention): <NEW_LINE> <INDENT> if segRotation > 0 and self._currentSize >= segRotation: <NEW_LINE> <INDENT> with self.new_txn() as txn: <NEW_LINE> <INDENT> segmentId = self.new_segment(txn) <NEW_LINE> segment = Segment(txn, self, segmentId) <NEW_LINE> segment.set_meta(txn, u'cr...
Allocate a new Segment, making it the new current segment.
625941db1f5feb6acb0c4e22
def test_scheme(self): <NEW_LINE> <INDENT> for scheme in ("s3", "s3a", "s3n", "hdfs", "file", "http", "https", "gs", "azure"): <NEW_LINE> <INDENT> parsed_uri = smart_open_lib._parse_uri(scheme + "://mybucket/mykey") <NEW_LINE> self.assertEqual(parsed_uri.scheme, scheme) <NEW_LINE> <DEDENT> self.assertRaises(NotImplemen...
Do URIs schemes parse correctly?
625941dbcc0a2c11143dd166
def relative_rate(self): <NEW_LINE> <INDENT> return _atsc_swig.atsc_equalizer_sptr_relative_rate(self)
relative_rate(atsc_equalizer_sptr self) -> double
625941db38b623060ff0b0c3
def test_anonymize_participant_left_event(self): <NEW_LINE> <INDENT> user = create_test_user("OtherUser", "otheruser@example.com") <NEW_LINE> request = self.get_request(user) <NEW_LINE> set_owner(self.thread, self.user) <NEW_LINE> make_participants_aware(user, self.thread) <NEW_LINE> add_participant(request, self.threa...
participant left event is anonymized by user.anonymize_data
625941db8e7ae83300e4b2a3
def test_export_uncommitted_no_tree(self): <NEW_LINE> <INDENT> tree = self.example_branch() <NEW_LINE> tree.bzrdir.destroy_workingtree() <NEW_LINE> os.chdir('branch') <NEW_LINE> self.run_bzr_error( ['bzr: ERROR: --uncommitted requires a working tree'], 'export --uncommitted latest')
Test --uncommitted option only works with a working tree.
625941db26238365f5f0f147
def make_trait_text_igen(trait_card: TraitCard, width: Natural, height: Natural) -> ImageGenerator: <NEW_LINE> <INDENT> return TextIGen(width=width, height=height, text=trait_card.name)
Make a TraitCard Text IGen :param trait_card: The Trait Card :param width: The width of the IGen :param height: The height of the IGen :return: The IGen
625941dbadb09d7d5db6ca63
def ano_syn0_2(data, mask): <NEW_LINE> <INDENT> pad_len = mean_pad_len(mask) <NEW_LINE> data, mask = remove_pad(data, mask) <NEW_LINE> n_ex, n_seq, n_fea = data.shape <NEW_LINE> intcol = [] <NEW_LINE> floatcol = np.arange(n_fea) <NEW_LINE> gen = MultipleSyntheticDataGenerator(data, intcol, floatcol) <NEW_LINE> data = g...
Remove padding, apply MultipleSyntheticDataGenerator, and restore padding
625941db7047854f462a16dc
def get_filled_buffer3x3(frame_history=1): <NEW_LINE> <INDENT> observation_space = gym.spaces.Box(low=0, high=255, shape=(2, 2, 2), dtype=int) <NEW_LINE> action_space = gym.spaces.Box(low=-1.0, high=1.0, shape=(2, 2, 2), dtype=float) <NEW_LINE> buffer = CircularVecEnvBufferBackend( 20, num_envs=2, observation_space=obs...
Return simple preinitialized buffer
625941db7b180e01f3dc4ace
def test_data_type5(): <NEW_LINE> <INDENT> C = [[7,11,56,45], [20,21,74,12], [42], [52], [90,213,9], [101, 34, 45]] <NEW_LINE> C = np.array(C) <NEW_LINE> df = pd.DataFrame(data=C.T)
Test input data type, and that the function returns an error if the input type is incorrect- data is a 3d dataframe
625941db56ac1b37e62644a1
def codeblock(text): <NEW_LINE> <INDENT> return "```\n" + text + "\n```"
Returns text in a Markdown-style code block :param text: Str :return: Str
625941db7b25080760e3972e
def analog_signal_arrays_by_segment(self): <NEW_LINE> <INDENT> return {}
Return a dictionary (indexed by Segment) of lists of AnalogSignalArray objects. If analog signals arrays not attached to a Segment are selected, their dictionary key will be ``DataProvider.no_segment``.
625941db236d856c2ad44ab3
def createWPList(routeGeoJSON): <NEW_LINE> <INDENT> WPList = [] <NEW_LINE> data = json.loads(routeGeoJSON) <NEW_LINE> for element in data["features"][0]["properties"]["segments"][0]["steps"]: <NEW_LINE> <INDENT> WPList.append(element["way_points"]) <NEW_LINE> <DEDENT> return WPList
create a list of way points to match to coordinates for stop over points
625941db4e4d5625662d46aa
def __init__(self, *args): <NEW_LINE> <INDENT> _itkContinuousIndexPython.itkContinuousIndexD2_swiginit(self,_itkContinuousIndexPython.new_itkContinuousIndexD2(*args))
__init__(self) -> itkContinuousIndexD2 __init__(self, itkContinuousIndexD2 r) -> itkContinuousIndexD2 __init__(self, double r) -> itkContinuousIndexD2 __init__(self, itkIndex2 index) -> itkContinuousIndexD2
625941dbec188e330fd5aa70
def get_train_valid_loader( self, data_dir, batch_size, random_seed, valid_size=0.1, shuffle=True, show_sample=False, num_workers=4, pin_memory=False, ): <NEW_LINE> <INDENT> assert (valid_size >= 0) and (valid_size <= 1), "validation size should be between [0, 1]." <NEW_LINE> normalize = transforms.Normalize((0.5,), (0...
Function to load fashion mnist dataset and create training and validation batch for training. :param data_dir: path directory to the dataset. :param batch_size: how many samples per batch to load. :param random_seed: fix seed for reproducibility. :param valid_size: percentage split of the training set used for the vali...
625941db187af65679ca53f5
def slugify(value, hyphenate=True, lower=True): <NEW_LINE> <INDENT> import unicodedata <NEW_LINE> value = unicodedata.normalize('NFKD', value).strip() <NEW_LINE> replacement = '-' if hyphenate else '' <NEW_LINE> if lower: value = value.lower() <NEW_LINE> return _CHANGEME_RE.sub(replacement, value)
Normalizes string, converts to lowercase, removes non-alpha characters, and converts spaces to hyphens.
625941db82261d6c526ab778
def create_openmm_simulation(self, openmm_system, topology, positions, integrator, return_integrator=False, seed=0): <NEW_LINE> <INDENT> if integrator == 'Langevin': <NEW_LINE> <INDENT> integrator_obj = OM.LangevinIntegrator(self.temp, self.fric_coeff, self.step_size) <NEW_LINE> integrator_obj.setRandomNumberSeed(seed...
Creates an OpenMM simulation object given an OpenMM system, topology, and positions Parameters ---------- openmm_system : OpenMM system object topology : OpenMM topology object positions : OpenMM Vec3 vector contains the positions of the system in nm integrator : str What type of integrator to use. Currently ...
625941db23849d37ff7b3363
def get_unique_vals(infile, colname, xrange=None, yrange=None): <NEW_LINE> <INDENT> fname = infile <NEW_LINE> if xrange is not None: <NEW_LINE> <INDENT> fname += "[x={}:{}]".format(*xrange) <NEW_LINE> <DEDENT> if yrange is not None: <NEW_LINE> <INDENT> fname += "[y={}:{}]".format(*yrange) <NEW_LINE> <DEDENT> return fil...
Returns an array of the unique values for a column in the input file. An error is thrown if the column does not exist. If the column is empty then None is returned. If xrange is given then it is used as a filter on the x values in the file; [x={}:{}] is added to infile where xrange is assumed to be a pair of values. ...
625941db30c21e258bdfa774
def findMin(self, nums): <NEW_LINE> <INDENT> min_val = nums[0] <NEW_LINE> for i in nums: <NEW_LINE> <INDENT> if (i < min_val): <NEW_LINE> <INDENT> min_val = i <NEW_LINE> <DEDENT> <DEDENT> return min_val
:type nums: List[int] :rtype: int
625941db0a50d4780f66716a
def deep_cnn_rnn_model(input_dim,filters,kernel_size,conv_stride,conv_border_mode, units, output_dim=29): <NEW_LINE> <INDENT> input_data = Input(name='the_input', shape=(None, input_dim)) <NEW_LINE> conv_1d = Conv1D(filters, kernel_size, strides=conv_stride, padding=conv_border_mode,activation='relu',name='conv1d')(inp...
Build a bidirectional recurrent network for speech
625941db3317a56b86939f28
def update_actuation_state(self, peer, sender, bus, topic, headers, message): <NEW_LINE> <INDENT> _log.debug('{}: update_actuation_state.'.format(self.agent_name)) <NEW_LINE> _log.debug('{}: current state: {} - updated state: {}'.format(self.agent_name, self.actuate_enabled, message)) <NEW_LINE> if not self.actuate_ena...
Subscribe to device data from message bus. :param peer: :param sender: :param bus: :param topic: :param headers: :param message: :return:
625941db8a349b6b435e8449
def test_get_timeseries(self): <NEW_LINE> <INDENT> epsg, bbox = self.epsg_bbox <NEW_LINE> dem_file = path.join(shyftdata_dir, "netcdf", "etopo180.nc") <NEW_LINE> n_hours = 30 <NEW_LINE> t0 = self.start_date + api.deltahours(7) <NEW_LINE> period = api.UtcPeriod(t0, t0 + api.deltahours(n_hours)) <NEW_LINE> repos = GFSDat...
Simple regression test of OpenDAP data repository.
625941db627d3e7fe0d69127
def thevenin(self): <NEW_LINE> <INDENT> Voc = self.Voc <NEW_LINE> Z = self.Z <NEW_LINE> if Voc.is_superposition and not Z.is_real: <NEW_LINE> <INDENT> print('Warning, detected superposition with reactive impedance,' ' using s-domain.') <NEW_LINE> Voc = Voc.laplace() <NEW_LINE> <DEDENT> elif Voc.is_ac: <NEW_LINE> <INDEN...
Simplify to a Thevenin network
625941db30c21e258bdfa775
def compute_A(self, M, B, X, mask_M, mask_B): <NEW_LINE> <INDENT> one_dt = 1./float(self.time_step) <NEW_LINE> A = M[0]*0.5+ M[1]*one_dt <NEW_LINE> dprint1("A", A) <NEW_LINE> return A, np.any(mask_M)
M/dt u_1 + K/2 u_1 = M/dt u_0 - K/2 u_0 + b
625941db097d151d1a22312e
def post_pause_track(self, auth_header): <NEW_LINE> <INDENT> pause_track_endpoint = f'{self.SPOTIFY_API_URL}/me/player/pause' <NEW_LINE> pause_track = requests.post( pause_track_endpoint, header=auth_header ) <NEW_LINE> return pause_track
Pause user playback.
625941dbb830903b967e9bdf
def NormalizePath(path, sep="/"): <NEW_LINE> <INDENT> if not path: <NEW_LINE> <INDENT> return sep <NEW_LINE> <DEDENT> path = SmartUnicode(path) <NEW_LINE> path_list = path.split(sep) <NEW_LINE> if path_list[0] in [".", "..", ""]: <NEW_LINE> <INDENT> path_list.pop(0) <NEW_LINE> <DEDENT> i = 0 <NEW_LINE> while True: <NEW...
A sane implementation of os.path.normpath. The standard implementation treats leading / and // as different leading to incorrect normal forms. NOTE: Its ok to use a relative path here (without leading /) but any /../ will still be removed anchoring the path at the top level (e.g. foo/../../../../bar => bar). Args: ...
625941db94891a1f4081bd80
def iqReceived(self, cnx, iq): <NEW_LINE> <INDENT> typ = iq.getType() <NEW_LINE> ns = iq.getQueryNS() <NEW_LINE> if (NS_VERSION == ns) and ('get' == typ): <NEW_LINE> <INDENT> name = Node('name') <NEW_LINE> name.setData(LIB_NAME) <NEW_LINE> version = Node('version') <NEW_LINE> version.setData(LIB_VERSION) <NEW_LINE> rep...
Default handler for IQ stanzas.
625941db56b00c62f0f14931
def list_tag(self, root, parse_table): <NEW_LINE> <INDENT> self.logger.debug("list tag, parsing:\n{}\nWith parse table\n{}" .format(etree.tostring(root).decode(), parse_table)) <NEW_LINE> self.check_root_tag(root.tag, parse_table['tag']) <NEW_LINE> element_pt = parse_table['element parse table'] <NEW_LINE> callback_typ...
Parse a tag that is a list of elements. **Example** Parse table:: option_parse_table = {'tag': 'option', 'type': 'attribute'} { 'type': 'list', 'element_parse_table': option_parse_table, 'skip len': True } Input:: <options> <option name="arg1" value="foo"/> <option name="arg2" ...
625941db7cff6e4e81117c5b
def collect_symbols(self): <NEW_LINE> <INDENT> symbols = set() <NEW_LINE> all_items = self.__left_items + self.__right_items <NEW_LINE> for item in all_items: <NEW_LINE> <INDENT> for symbol in item.get_coefficient().free_symbols: <NEW_LINE> <INDENT> symbols.add(symbol.name) <NEW_LINE> <DEDENT> <DEDENT> return symbols
Collect all symbols. :rtype: set[str] :return: A set that contains all symbols.
625941db91f36d47f21ac7cb
def apply_data_sampling_for_file(odict, sequence_size): <NEW_LINE> <INDENT> if sequence_size < 1 or len(odict) < sequence_size: <NEW_LINE> <INDENT> return [list(odict.keys())] <NEW_LINE> <DEDENT> sequences = [] <NEW_LINE> tmplist = list(odict.keys()) <NEW_LINE> for i in range(len(odict) - sequence_size + 1): <NEW_LINE>...
data sampling, trim utterances sequence into sequences of continuous utterances :param odict: OrderedDict{} (number in torch) :return: [indices size config.sequence_size]
625941dbd268445f265b5144
def test_init(self): <NEW_LINE> <INDENT> olw = ObjListWindow() <NEW_LINE> self.assertIsInstance(olw, QDialog) <NEW_LINE> self.assertEqual(olw.tableWidth, None) <NEW_LINE> self.assertEqual(olw.proxyModel, None) <NEW_LINE> self.assertFalse(olw.gridLayout) <NEW_LINE> self.assertIsInstance(olw.currLayout, QVBoxLayout) <NEW...
test the __init__ function
625941dba8ecb033257d33a2
def _accept_next(self): <NEW_LINE> <INDENT> self._accept_update() <NEW_LINE> proc = self._process <NEW_LINE> throttling = proc['throttling'] <NEW_LINE> if proc['aborted'] or not proc['queue']: <NEW_LINE> <INDENT> self._accept_done() <NEW_LINE> return <NEW_LINE> <DEDENT> if throttling['calls'] and max(throttli...
Pop the next note off the queue, if not throttled, and process.
625941dbfb3f5b602dac396c
def list_functions(self, database_name): <NEW_LINE> <INDENT> return list(self._j_catalog.listFunctions(database_name))
List the names of all functions in the given database. An empty list is returned if none is registered. :param database_name: Name of the database. :return: A list of the names of the functions in this database. :raise: CatalogException in case of any runtime exception. DatabaseNotExistException if the databas...
625941db50812a4eaa59c5f5
def is_prime(number): <NEW_LINE> <INDENT> return number > 1 and all(number % d for d in range(2, int(number)))
Check if number is prime.
625941db656771135c3ebb48
def process_label_and_tag(self): <NEW_LINE> <INDENT> out = self.empty_col() <NEW_LINE> if self.label is not None: <NEW_LINE> <INDENT> out += self.label.process(self.df) + " " <NEW_LINE> <DEDENT> if self.tag is not None: <NEW_LINE> <INDENT> out += self.tag.process(self.df) <NEW_LINE> <DEDENT> return out
Process the label and tag into a unique column. Returns ------- out : pandas.Series A column where each row is the processed label and tag.
625941db8c3a873295158693
def bind_mount(rootfs, path, local_path): <NEW_LINE> <INDENT> bind_data = local_path.split('=') <NEW_LINE> if len(bind_data) > 2: <NEW_LINE> <INDENT> LOG.error('Bind data [ %s ] is incorrectly formatted' % bind_data) <NEW_LINE> raise SystemExit('ERROR') <NEW_LINE> <DEDENT> elif len(bind_data) == 2: <NEW_LINE> <INDENT> ...
Bind a local path to to the container. The method will examine the provided bind local_path and if it has 2 entries after spiting on "=" then the stated index 0 will is used as the local path and index 1 is used for the container path. This is useful when you have multiple container which may be binding to a that cou...
625941db099cdd3c635f0f30
def __init__(self, pressure_json): <NEW_LINE> <INDENT> self.pressure = pressure_json
Constructor - this takes an individual observations summary period's station pressure json. { "maxMB": 1024, "maxIN": 30.24, "minMB": 1020, "minIN": 30.12, "avgMB": 1021.4, "avgIN": 30.16, "count": 23 },
625941dba219f33f34628c3c
def test_post_duplicate(self): <NEW_LINE> <INDENT> self._post_repository() <NEW_LINE> self._post_repository(expected_status=409)
Testing the POST repositories/ API with a duplicate repository
625941dbb7558d58953c51e6
def _moderate_discard(self): <NEW_LINE> <INDENT> channel_ids = self.mapped('res_id') <NEW_LINE> moderators = self.env['mail.channel'].browse(channel_ids).mapped('moderator_ids') <NEW_LINE> authors = self.mapped('author_id') <NEW_LINE> partner_to_pid = {} <NEW_LINE> for moderator in moderators: <NEW_LINE> <INDENT> partn...
Notify deletion of messages to their moderators and authors and then delete them.
625941db0383005118ecf8b8
def partition(self, head, x): <NEW_LINE> <INDENT> if not head: <NEW_LINE> <INDENT> return head <NEW_LINE> <DEDENT> new_head = None <NEW_LINE> small = new_head <NEW_LINE> big_head = None <NEW_LINE> big = big_head <NEW_LINE> while head: <NEW_LINE> <INDENT> if head.val >= x: <NEW_LINE> <INDENT> if big: <NEW_LINE> <INDENT>...
:type head: ListNode :type x: int :rtype: ListNode
625941db004d5f362079a608
def color_selector(default=(0, 0, 1), label=None, widget=None, hide_box=False): <NEW_LINE> <INDENT> kwds = {"value": Color(default).html_color(), "concise": hide_box} <NEW_LINE> if label is not None: <NEW_LINE> <INDENT> kwds["description"] = label <NEW_LINE> <DEDENT> return SageColorPicker(**kwds)
A widget for choosing a color. INPUT: - ``default`` -- initial value - ``label`` -- optional label - ``hide_box`` -- (boolean) if True, do not show the textbox EXAMPLES:: sage: from sage.repl.ipython_kernel.all_jupyter import color_selector sage: w = color_selector("orange", label="color me"); w SageC...
625941dbf8510a7c17cf99d4
def __init__(self): <NEW_LINE> <INDENT> super(GenratorPlikuTestowego, self).__init__() <NEW_LINE> self.czest_liter = [] <NEW_LINE> self.suma = float(0) <NEW_LINE> if os.path.exists(PLIK_TRENINGOWY): <NEW_LINE> <INDENT> os.remove(PLIK_TRENINGOWY)
Konstruktor klasy Jeśli istnieje plik z poprzedniego generowania jest usuwany
625941dba17c0f6771cbe326
def case_switch(self, widget): <NEW_LINE> <INDENT> if widget.get_active(): <NEW_LINE> <INDENT> self.config.set('SearchOptions', 'case_sensitive', 'True') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.config.set('SearchOptions', 'case_sensitive', 'False')
callback for switch cases button
625941db15fb5d323cde0dea
@SkipUnless(server_has_mergeinfo) <NEW_LINE> @Issue(3094) <NEW_LINE> def merge_range_predates_history(sbox): <NEW_LINE> <INDENT> sbox.build() <NEW_LINE> wc_dir = sbox.wc_dir <NEW_LINE> iota_path = sbox.ospath('iota') <NEW_LINE> trunk_file_path = sbox.ospath('trunk/file') <NEW_LINE> trunk_url = sbox.repo_url + "/trunk" ...
merge range predates history
625941db5fcc89381b1e1998
def __init__(self): <NEW_LINE> <INDENT> self.max_h = list() <NEW_LINE> self.min_h = list() <NEW_LINE> heapify(self.max_h) <NEW_LINE> heapify(self.min_h)
initialize your data structure here.
625941db1f037a2d8b9464d4
def addSummary(self, metricClass, **metrics): <NEW_LINE> <INDENT> if not self.summaries.has_key(metricClass): <NEW_LINE> <INDENT> self.summaries[metricClass] = {} <NEW_LINE> <DEDENT> self.summaries[metricClass].update(metrics) <NEW_LINE> return
_addSummary_ Add a performance summary for the metric class name provided. Duplicate metric keys will be updated
625941db287bf620b61d3d39
def _parse_addr(self, addr): <NEW_LINE> <INDENT> ipv = 0 <NEW_LINE> ipnum = -1 <NEW_LINE> ipvalidateresult = self._validate_addr(addr) <NEW_LINE> if (ipvalidateresult == False): <NEW_LINE> <INDENT> return ipv, ipnum <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> a, b = struct.unpack('!QQ', socket.inet_pton(socket.AF_INET...
Parses address and returns IP version. Raises exception on invalid argument
625941db63f4b57ef00013e9
def write(self, logger=None, action=None): <NEW_LINE> <INDENT> if logger is None: <NEW_LINE> <INDENT> logger = _output._DEFAULT_LOGGER <NEW_LINE> <DEDENT> logged_dict = self._freeze(action=action) <NEW_LINE> logger.write(dict(logged_dict), self._serializer)
Write the message to the given logger. This will additionally include a timestamp, the action context if any, and any other fields. Byte field names will be converted to Unicode. @type logger: L{eliot.ILogger} or C{None} indicating the default one. @param action: The L{Action} which is the context for this message....
625941dbff9c53063f47c4c9
def get_system(): <NEW_LINE> <INDENT> if 'google.colab' in sys.modules: <NEW_LINE> <INDENT> return Constant.SYS_GOOGLE_COLAB <NEW_LINE> <DEDENT> if os.name == 'posix': <NEW_LINE> <INDENT> return Constant.SYS_LINUX <NEW_LINE> <DEDENT> if os.name == 'nt': <NEW_LINE> <INDENT> return Constant.SYS_WINDOWS <NEW_LINE> <DEDENT...
Get the current system environment. If the current system is not supported, raise an exception. Returns: A string to represent the current OS name. "posix" stands for Linux, Mac or Solaris architecture. "nt" stands for Windows system.
625941db2ae34c7f2600d407
def on_set_volume(self, volume: float) -> None: <NEW_LINE> <INDENT> pass
Called when the volume should be changed.
625941db16aa5153ce36274e
@pytest.mark.parametrize("duration_tuple", [ (0, 3), (2, 5), (0, 5), ]) <NEW_LINE> def test_validate_duration(duration_tuple): <NEW_LINE> <INDENT> dr = DataReader("test_file.csv") <NEW_LINE> time_array = np.array([1, 2, 3, 4]) <NEW_LINE> with pytest.raises(ValueError): <NEW_LINE> <INDENT> dr.validate_duration(time_arra...
Tests the validate_duration function, which ensures that a user specified duration in the construction of the data reader object is within the range of time values read in from the CSV file. Returns ------- None
625941db498bea3a759b9d85
def send_slack_message (channel, text): <NEW_LINE> <INDENT> slack_key = os.environ['SLACK_KEY'] <NEW_LINE> try : <NEW_LINE> <INDENT> slack_client = SlackClient(slack_key) <NEW_LINE> slack_client.api_call("chat.postMessage", channel=channel, text=text, as_user='haenec') <NEW_LINE> return True <NEW_LINE> <DEDENT> except ...
send a message by slack
625941db7b180e01f3dc4acf
def parse_var(self, var): <NEW_LINE> <INDENT> [name, numbers] = var.split("_") <NEW_LINE> part_list = [int(n) for n in re.sub('([0-9])',r'\1 ',numbers.replace('m','-')).split(' ')[:-1]] <NEW_LINE> return name, part_list
parse_var(var): parses variables into name and list of particles
625941db460517430c394456
def check_verf(self, rverf, cred): <NEW_LINE> <INDENT> pass
Raise error if there is a problem with reply verifier
625941db21a7993f00bc7fcb
def asymmetric_fit_plot(d, params): <NEW_LINE> <INDENT> dataplot = hv.Scatter((d.xum, d.Xasym * 1e6), label='data', kdims=['um'], vdims=['uV']) <NEW_LINE> fitx = np.linspace(min(d.xum), max(d.xum), 200) <NEW_LINE> fit = box_func(fitx/1e6, **params) * 1e6 <NEW_LINE> fitplot = hv.Curve((fitx, fit), label='fit', kdims=['u...
Quick intensity plot. Compare data with params generated curve. Args: params: (center, height, width, fwhm, cutoff_fwhm, npoints)
625941db236d856c2ad44ab4
def test_encrypt_for_same_key(self): <NEW_LINE> <INDENT> correct = 'Yjxy ktw xfrj pjd = 5.' <NEW_LINE> self.assertEqual(encrypt('Test for same key = 5.', 5), correct)
Does encrypt and decrypt return same message if key is the same?
625941dbd10714528d5fffbd
def add_dir(self, directory): <NEW_LINE> <INDENT> image_endings = ('.png',) <NEW_LINE> files = os.listdir(directory) <NEW_LINE> accepted_files = [] <NEW_LINE> for f in files: <NEW_LINE> <INDENT> if f.endswith(image_endings): <NEW_LINE> <INDENT> accepted_files.append(os.path.join(directory, f)) <NEW_LINE> <DEDENT> <DEDE...
Adds images and joypad input from a directory :param directory: string, directory which contains the required files :return: None
625941db4a966d76dd5512e8
def test_comparingPrereleases(self): <NEW_LINE> <INDENT> va = Version("whatever", 1, 0, 0, prerelease=1) <NEW_LINE> vb = Version("whatever", 1, 0, 0, prerelease=2) <NEW_LINE> self.assertTrue(va < vb) <NEW_LINE> self.assertFalse(va > vb) <NEW_LINE> self.assertNotEqual(va, vb)
The value specified as the prerelease is used in version comparisons.
625941db91af0d3eaac9bcf2
def g_expr(expr): <NEW_LINE> <INDENT> uid = expr[0] <NEW_LINE> if uid == "RELOP": <NEW_LINE> <INDENT> return g_expr_rel(expr) <NEW_LINE> <DEDENT> if uid == "ASSIGN": <NEW_LINE> <INDENT> return g_expr_assignment(expr) <NEW_LINE> <DEDENT> elif uid == "INDEX": <NEW_LINE> <INDENT> return g_expr_index(expr) <NEW_LINE> <DEDE...
Generate an expression.
625941db23e79379d52ee838
def get_neighbours(self): <NEW_LINE> <INDENT> result = sorted(self.__adjacent.items(), key=operator.itemgetter(1)) <NEW_LINE> result.reverse() <NEW_LINE> return result
Fetches the map of (neighbours, weight) sorted by weight
625941db6aa9bd52df03707c
def acquire_conn(self): <NEW_LINE> <INDENT> conn = self._pool.getconn() <NEW_LINE> if self.auto_reconnect: <NEW_LINE> <INDENT> conn = self._check_connection(conn=conn) <NEW_LINE> <DEDENT> return conn
Get new pool connection :return: psycopg2 connection object :raise: psycopg2.pool.PoolError: when is no available connections
625941dbad47b63b2c50a255
def mlbarrests(self, irc, msg, args): <NEW_LINE> <INDENT> url = self._b64decode('aHR0cDovL2FycmVzdG5hdGlvbi5jb20vY2F0ZWdvcnkvcHJvLWJhc2ViYWxsLw==') <NEW_LINE> try: <NEW_LINE> <INDENT> req = urllib2.Request(url) <NEW_LINE> html = (urllib2.urlopen(req)).read() <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> irc.reply("Fa...
Display the last 5 MLB arrests.
625941db0fa83653e4657290
def convolve_grayscale_padding(images, kernel, padding): <NEW_LINE> <INDENT> m = images.shape[0] <NEW_LINE> h = images.shape[1] <NEW_LINE> w = images.shape[2] <NEW_LINE> kh = kernel.shape[0] <NEW_LINE> kw = kernel.shape[1] <NEW_LINE> ph = padding[0] <NEW_LINE> pw = padding[1] <NEW_LINE> output_h = h - kh + 1 + (2*ph) <...
images: numpy.ndarray w/ shape (m, h, w) kernel: numpy.ndarray w/ shape (kh, kw) padding: tuple of (ph, pw) Returns: a numpy.ndarray cotaining convolved images m: num of images h: height in pixels of images w: width in pixels of images kh: height of the kernel kw: width of the kernel
625941db3346ee7daa2b3044
def __init__(self, string): <NEW_LINE> <INDENT> Enum.__init__(string)
:type string: :class:`str` :param string: String value for the :class:`ResultType` instance.
625941dbd53ae8145f87a542
def _exitBootloader(self) : <NEW_LINE> <INDENT> self._connection.transfer(self._BroadcastAddress, self._BroadcastCommandExitBootloader, [], 0)
Tell all modulos to exit their bootloader and begin normal operation
625941dbde87d2750b86006c
def retrieve(self, s, e, gra): <NEW_LINE> <INDENT> st = self.round_down_ts_gra(s, gra) <NEW_LINE> et = self.round_up_ts_gra(e, gra) <NEW_LINE> i = bisect.bisect_left(self.ts_keys, st) <NEW_LINE> j = bisect.bisect_right(self.ts_keys, et) <NEW_LINE> res = [] <NEW_LINE> for k in range(i, j): <NEW_LINE> <INDENT> res.extend...
:type s: str :type e: str :type gra: str :rtype: List[int]
625941db8e7ae83300e4b2a4
def search(self, query): <NEW_LINE> <INDENT> if re.search('\s*bitches$', query): <NEW_LINE> <INDENT> query = re.sub("\s*bitches$", "", query) <NEW_LINE> <DEDENT> if query in ["/a/","/c/","/w/","/m/","/cgl/","/cm/","/f/","/n/","/jp/","/vp/","/v/","/vg/","/vr/","/co/","/g/","/tv/","/k/","/o/","/an/","/tg/","/sp/","/asp/"...
Search for anything the user wants. Wrapper for every search method we have.
625941db462c4b4f79d1d9a7
def _set_django_attributes(tracer, request): <NEW_LINE> <INDENT> django_user = getattr(request, 'user', None) <NEW_LINE> if django_user is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> user_id = django_user.pk <NEW_LINE> user_name = django_user.get_username() <NEW_LINE> if user_id is not None: <NEW_LINE> <INDENT...
Set the django related attributes.
625941dba4f1c619b28b030a
def partial_update(self, request, pk): <NEW_LINE> <INDENT> if request.data['workout'].get('owner', False): <NEW_LINE> <INDENT> del request.data['workout']['owner'] <NEW_LINE> <DEDENT> workout = get_object_or_404(Workout, pk=pk) <NEW_LINE> if not request.user.id == workout.owner.id: <NEW_LINE> <INDENT> raise PermissionD...
Update Request
625941db3d592f4c4ed1d33f
def init_categoryset(self, category, inputs=None): <NEW_LINE> <INDENT> inputs = inputs if inputs and isinstance(inputs, list) else [] <NEW_LINE> categoryset = { 'output': category, 'inputs': inputs } <NEW_LINE> self.save(categoryset, self._category_to_file(category))
Initialize a new dataset :param filename: the filename of the file in which we want to store the new object
625941db92d797404e304462
def _groupby(data, key): <NEW_LINE> <INDENT> for k, index in _arg_groupby(data, key): <NEW_LINE> <INDENT> d = {a: b[index] for a,b in data.items()} <NEW_LINE> yield k, data.__class__(d)
create an iterator which returns (key, DataFrame) grouped by each value of key(value)
625941db07d97122c4178b68
def createList3(item1,item2,item3): <NEW_LINE> <INDENT> return([item1,item2,item3])
Creates a list from the 3 arguments This preserves the order in which the arguments are supplied
625941db8e71fb1e9831da7f
def p_body_stub(p): <NEW_LINE> <INDENT> pass
body_stub : TASK BODY simple_name IS SEPARATE ';' | PACKAGE BODY compound_name IS SEPARATE ';' | subprog_spec IS SEPARATE ';' | PROTECTED BODY simple_name IS SEPARATE ';'
625941db4428ac0f6e5baacb
def _open( self, path: str, mode: str = "rb", block_size: int = None, autocommit: bool = True, cache_options: dict = {}, cache_type="readahead", metadata=None, **kwargs, ): <NEW_LINE> <INDENT> logger.debug(f"_open: {path}") <NEW_LINE> return AzureBlobFile( fs=self, path=path, mode=mode, block_size=block_size, autocomm...
Open a file on the datalake, or a block blob Parameters ---------- path: str Path to file to open mode: str What mode to open the file in - defaults to "rb" block_size: int Size per block for multi-part downloads. autocommit: bool Whether or not to write to the destination directly cache_type: str ...
625941db8a349b6b435e844a
def map(args): <NEW_LINE> <INDENT> p = OptionParser(map.__doc__) <NEW_LINE> p.add_option("-o", dest="outfile", default=None, help="Output prefix.cas file [default: %default]") <NEW_LINE> p.add_option("-s", dest="size", default=0, type="int", help="Use paired end mapping with insert [default: %default]") <NEW_LINE> p.ad...
%prog map reference fastqfiles Use `clc_ref_assemble` to map the read files to a reference. Use a non-zero -s option to turn on paired end mode.
625941db596a897236089d95
def __init__(self, levels: List[str] = None, **kwargs): <NEW_LINE> <INDENT> if not levels: <NEW_LINE> <INDENT> levels = ['debug', 'info', 'warning', 'error', 'critical'] <NEW_LINE> <DEDENT> self.levels = levels <NEW_LINE> kwargs.setdefault('transform_case', 'lower') <NEW_LINE> kwargs.setdefault('transform_strip', True)...
:param levels: list of log levels. If not specified, the default Python log levels will be used: ``debug``, ``info``, ``warning``, ``error``, and ``critical``.
625941dbbd1bec0571d90906
def findReleaseFromRPM(installedRPMSData): <NEW_LINE> <INDENT> return None
This function will get the release information based on the redhat-release rpm that is installed. @return: Returns a DistroRelease object that contains information about the Distrobution Release. @rtype: DistroRelease @param installedRPMSData: List of installed rpms. @type installedRPMSData: Array
625941db5166f23b2e1a5430
def load_wordlist(f): <NEW_LINE> <INDENT> wordlist = f.readlines() <NEW_LINE> return sanitize_wordlist(wordlist)
Retrieves valid words (and errors) from the given line-delimited input source returns a wordlist and list of errors found
625941db8e7ae83300e4b2a5
def test_schedules_schedule_e_get(self): <NEW_LINE> <INDENT> pass
Test case for schedules_schedule_e_get
625941db7d847024c06be596
def load(location, option): <NEW_LINE> <INDENT> return pickledb(location, option)
Return a pickledb object. location is the path to the json file.
625941dbadb09d7d5db6ca65
def program(self): <NEW_LINE> <INDENT> self.eat(PROGRAM) <NEW_LINE> var_node = self.variable() <NEW_LINE> prog_name = var_node.value <NEW_LINE> self.eat(SEMI) <NEW_LINE> block_node = self.block() <NEW_LINE> node = Program(prog_name, block_node) <NEW_LINE> self.eat(DOT) <NEW_LINE> return node
program: PROGRAM variable SEMI block DOT
625941db99fddb7c1c9de668
def UDP_recv(self): <NEW_LINE> <INDENT> success = False <NEW_LINE> ans_bytes = None <NEW_LINE> try: <NEW_LINE> <INDENT> ans_bytes = self._sock.recv(4096) <NEW_LINE> success = True <NEW_LINE> <DEDENT> except socket.timeout as err: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> raise <NEW_LINE> ...
Receive one UDP packet at a time when available. Returns: success (bool): True if a packet was received successfully, False otherwise. ans_bytes: UDP packet received from the device. None if unsuccessful.
625941dbbaa26c4b54cb13f4
def is_user_logged_in(client, user=None): <NEW_LINE> <INDENT> has_user_id_key = '_auth_user_id' in client.session.keys() <NEW_LINE> if not has_user_id_key: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if user is None: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return client.session['_auth_user_id'] == ...
Check if user is logged in
625941db7047854f462a16de
def __init__(self, domain, turbine=None, site_ids=None, function_space=None, n_time_steps=None): <NEW_LINE> <INDENT> if function_space is None: <NEW_LINE> <INDENT> function_space = FunctionSpace(self.domain.mesh, "CG", 2) <NEW_LINE> <DEDENT> self._turbine_function_space = function_space <NEW_LINE> self._turbine_density...
Create an empty Farm.
625941dbf7d966606f6aa2df
def update_web_service_scan_latest(scan_uuid=None, org_uuid=None): <NEW_LINE> <INDENT> return update_web_service_scan_latest_state(scan_uuid=scan_uuid, latest_state=True, org_uuid=org_uuid)
Update the referenced web service scan and set it as the latest scan to have been run. :param scan_uuid: The UUID of the web service scan to update records for. :param org_uuid: The UUID of the organization that owns the web service scan. :return: The Elasticsearch response.
625941db7c178a314d6ef73b
def clean_leader(self): <NEW_LINE> <INDENT> group_students = Student.objects.filter(student_group = self.instance) <NEW_LINE> if len(group_students)>0 and self.cleaned_data['leader'] not in group_students: <NEW_LINE> <INDENT> raise ValidationError(_(u"Student do not belong to the current group"), code='invalid') <NEW_L...
Check if selected student belongs to the group. If not then he cant be a leader of this group
625941db82261d6c526ab77a
def HornbeckHanes_simplified(Ed, sigma_e, sigma_h, Nd, ni, ne0, nh0, temp, tau_bkg): <NEW_LINE> <INDENT> vth_e, vth_h = tm.update(temp=temp) <NEW_LINE> Vt = C.k * temp / C.e <NEW_LINE> nh1 = ni * np.exp(-Ed / Vt) <NEW_LINE> ne1 = ni * np.exp(Ed / Vt) <NEW_LINE> Ef = np.log(ni / nh0) * Vt <NEW_LINE> if nh0 > ne0: <NEW_L...
Calculates the time constant from hornbeck and Hanes Simplified model. This is equation 13 from 10.1103/PhysRev.97.311 Parameters ---------- Ed : Energy level of the defect from the intrinsic level sigma_e : The capture cross section of electrons sigma_h : The capture cross section of holes ni : The i...
625941dbd8ef3951e3243815
def test_check_errors_catches_all_exceptions(self): <NEW_LINE> <INDENT> filename = self.temporary_file('test_exception.py') <NEW_LINE> filename.write_text('raise Exception') <NEW_LINE> with extend_sys_path(str(filename.parent)): <NEW_LINE> <INDENT> with self.assertRaises(Exception): <NEW_LINE> <INDENT> autoreload.check...
Since Python may raise arbitrary exceptions when importing code, check_errors() must catch Exception, not just some subclasses.
625941dbb57a9660fec33b5f
def add_embers_ids(obj, parent_id=None, derived_ids=None): <NEW_LINE> <INDENT> if not obj.has_key('embersId'): <NEW_LINE> <INDENT> obj['embersId'] = hashlib.sha1(str(obj)).hexdigest() <NEW_LINE> <DEDENT> if parent_id: <NEW_LINE> <INDENT> obj['parentId'] = parent_id <NEW_LINE> <DEDENT> if derived_ids: <NEW_LINE> <INDENT...
Create an EMBERS identifier for an object if none exists. The id is just a SHA1 hash of the object content.
625941db23849d37ff7b3365
def parameters(self) -> List["Parameter"]: <NEW_LINE> <INDENT> return [self]
Returns itself as a parameter.
625941db50485f2cf553d073
def load(fp, expand_includes=True, include_position=False, include_comments=False): <NEW_LINE> <INDENT> p = Parser(expand_includes=expand_includes, include_comments=include_comments) <NEW_LINE> ast = p.load(fp) <NEW_LINE> m = MapfileToDict(include_position=include_position, include_comments=include_comments) <NEW_LINE>...
Load a Mapfile from an open file or file-like object. Parameters ---------- fp: file A file-like object expand_includes: boolean Load any ``INCLUDE`` files in the MapFile include_comments: boolean Include or discard comment strings from the Mapfile - *experimental* include_position: boolean Include ...
625941db29b78933be1e5980
def delete(self): <NEW_LINE> <INDENT> return self._boolean(self._delete(self._api), 204, 404)
Delete this subscription. :returns: True if successful, False otherwise :rtype: bool
625941db462c4b4f79d1d9a8
def submit_res(self): <NEW_LINE> <INDENT> if self.l1.curselection() == (): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> index = int(self.l1.curselection()[0]) <NEW_LINE> value = self.l1.get(index) <NEW_LINE> print("You selected item ", index, value) <NEW_LINE> cbor_data = None <NEW_LINE> my_qos = self.level.get() <NE...
get the oic/res data will set a sequence of actions in play: - get oic/res from the device (with UDN) from the list - get the url of the IDD resource - get the url of the IDD file - show the IDD file in a popup window
625941db0a50d4780f66716c
def grownup(self, delta_days): <NEW_LINE> <INDENT> self._days_old += delta_days <NEW_LINE> for body in self._celestial_bodies: <NEW_LINE> <INDENT> body.grownup(delta_days)
Increase the system age days in delta_days days. :param delta_days: amount of days that the system's age is going to be incremented. :return: None
625941dbb57a9660fec33b60
def get_limits(self, page_reverse=None, requestslib_kwargs=None): <NEW_LINE> <INDENT> params = {'page_reverse': page_reverse} <NEW_LINE> url = self.limits_url <NEW_LINE> resp = self.request('GET', url, params=params, response_entity_type=Limits, requestslib_kwargs=requestslib_kwargs) <NEW_LINE> return resp
@summary: Shows rate limit user information @return: get limits response @rtype: Requests.response
625941db92d797404e304463
def zoom(self, factor): <NEW_LINE> <INDENT> self._camera.Zoom(factor) <NEW_LINE> Render(self._render_view)
Decrease the view angle by the specified factor. A value greater than 1 is a zoom-in, a value less than 1 is a zoom-out.
625941dba934411ee375196c
def iter_memory_snapshot(self, minAddr = None, maxAddr = None): <NEW_LINE> <INDENT> memory = self.get_memory_map(minAddr, maxAddr) <NEW_LINE> if not memory: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> filenames = self.get_mapped_filenames(memory) <NEW_LINE> <DEDENT> except WindowsError as e:...
Returns an iterator that allows you to go through the memory contents of a process. It's basically the same as the L{take_memory_snapshot} method, but it takes the snapshot of each memory region as it goes, as opposed to taking the whole snapshot at once. This allows you to work with very large snapshots without a sig...
625941dbb5575c28eb68e2da
def __init__(self, environment: Environment): <NEW_LINE> <INDENT> self._env = environment
Initialized the element Args: environment: Environment to associate with
625941db96565a6dacc8f9a2
def get_listeners(self): <NEW_LINE> <INDENT> listeners = list() <NEW_LINE> for intf in self.interfaces: <NEW_LINE> <INDENT> for listener in intf.inet_addresses: <NEW_LINE> <INDENT> if isinstance (listener, Listener): <NEW_LINE> <INDENT> listeners.append(listener) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> return listeners
Return list of Listeners on current Node :return: List of Listener objects
625941db379a373c97cfae1e
def unsure_response(intent, session): <NEW_LINE> <INDENT> session_attributes = {} <NEW_LINE> card_title = "AIM - unsure response" <NEW_LINE> speech_output = "I'm sorry, I didn't get that. Say help if you need it." <NEW_LINE> reprompt_text = "Do you want to send or receive a message." <NEW_LINE> should_end_session = Fal...
Will be returned to the user if Alexa was unsure about the intent.
625941db4d74a7450ccd449c