code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def bake_action( obj, *, action, frames, **kwargs ): <NEW_LINE> <INDENT> if not (kwargs.get("do_pose") or kwargs.get("do_object")): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> action, = bake_action_objects( [(obj, action)], frames=frames, **kwargs, ) <NEW_LINE> return action | :arg obj: Object to bake.
:type obj: :class:`bpy.types.Object`
:arg action: An action to bake the data into, or None for a new action
to be created.
:type action: :class:`bpy.types.Action` or None
:arg frames: Frames to bake.
:type frames: iterable of int
:return: an action or None
:rtype: :class:`bpy.types.Action` | 625941b38e05c05ec3eea124 |
def ConfigureLexer(self, keyword): <NEW_LINE> <INDENT> import peppy.editra.style_specs as style_specs <NEW_LINE> custom = None <NEW_LINE> if hasattr(self, 'stc_lexer_id') and self.stc_lexer_id is not None: <NEW_LINE> <INDENT> lexer = self.stc_lexer_id <NEW_LINE> if hasattr(lexer, 'styleText'): <NEW_LINE> <INDENT> custo... | Sets Lexer and Lexer Keywords for the specified keyword
@param keyword: a peppy major mode keyword | 625941b3a17c0f6771cbde0e |
def add_card(name): <NEW_LINE> <INDENT> query_params = { "name": name, "idList": TO_DO_LIST_ID, "key": TRELLO_KEY, "token": TRELLO_TOKEN} <NEW_LINE> requrl = f"{TRELLO_URL}/1/cards" <NEW_LINE> response = requests.post(requrl, params=query_params) <NEW_LINE> return(response.json()) | Adds a new card on the 'To Do' list to the 'ToDo App using Trello' board in Trello
Args:
name: The name of the card. This comes from ndex.html,
Returns:
json object from requests library. | 625941b326238365f5f0ec1c |
def __init__(self, logger): <NEW_LINE> <INDENT> self.logger = logger <NEW_LINE> self.api = _TaigaAPI(host=config.TAIGA_HOST) | Init TaigaAPI object and logger. | 625941b3be7bc26dc91cd3ba |
def appendInside(self, *__args): <NEW_LINE> <INDENT> pass | QWebElement.appendInside(QString)
QWebElement.appendInside(QWebElement) | 625941b35f7d997b8717484f |
def actions(board): <NEW_LINE> <INDENT> possibleActions = set() <NEW_LINE> for i, row in enumerate(board): <NEW_LINE> <INDENT> for j, value in enumerate(row): <NEW_LINE> <INDENT> if value == EMPTY: <NEW_LINE> <INDENT> possibleActions.add((i, j)) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> return possibleActions | Returns set of all possible actions (i, j) available on the board. | 625941b330bbd722463cbb76 |
def put_blobs(self, blobs): <NEW_LINE> <INDENT> blobrefs = {} <NEW_LINE> for blob in blobs: <NEW_LINE> <INDENT> blobrefs[compute_hash(blob)] = blob <NEW_LINE> <DEDENT> blobrefs_all = frozenset(blobrefs.keys()) <NEW_LINE> stat_res = self._stat(blobrefs_all) <NEW_LINE> upload_url = stat_res['uploadUrl'] <NEW_LINE> max_up... | Upload blobs using with standard multi-part upload.
Returns a dict with received (blobref and size) and skipped (blobref only) | 625941b3a79ad161976cbefa |
def test_lidar(self): <NEW_LINE> <INDENT> rospy.init_node('test_node', anonymous=True) <NEW_LINE> msg = rospy.wait_for_message( "/carla/ego_vehicle/lidar", PointCloud2, timeout=TIMEOUT) <NEW_LINE> self.assertEqual(msg.header.frame_id, "ego_vehicle/lidar") | Tests Lidar sensor node | 625941b3167d2b6e31218952 |
def __init__(self, assess=None, count=None, id_2=None): <NEW_LINE> <INDENT> self._assess = None <NEW_LINE> self._count = None <NEW_LINE> self._id_2 = None <NEW_LINE> self.discriminator = None <NEW_LINE> if assess is not None: <NEW_LINE> <INDENT> self.assess = assess <NEW_LINE> <DEDENT> self.count = count <NEW_LINE> if ... | CompatibilitiesSsdActiveIdParams - a model defined in Swagger | 625941b3656771135c3eb626 |
def checkInputCRS(self): <NEW_LINE> <INDENT> crsList = [] <NEW_LINE> for param in self.parameters: <NEW_LINE> <INDENT> if isinstance(param, (ParameterRaster, ParameterVector, ParameterMultipleInput)): <NEW_LINE> <INDENT> if param.value: <NEW_LINE> <INDENT> if isinstance(param, ParameterMultipleInput): <NEW_LINE> <INDEN... | It checks that all input layers use the same CRS. If so,
returns True. False otherwise. | 625941b385dfad0860c3ac0c |
def format_grid( self, visited_style: str = "reverse", add_coords: bool = True, coords_style: str = "italic bold fg:ansibrightcyan") -> FormattedText: <NEW_LINE> <INDENT> style_pairs = [] <NEW_LINE> coord_column_padding = len("{0:d}".format(self.height)) <NEW_LINE> for i, row in enumerate(self.grid): <NEW_LINE> <INDENT... | Format the grid as a single string.
Args:
visited_style: The style string to apply to tiles which have been visited.
add_coords: Show coordinates in the top and left edges of the screen.
coords_style: The style string to apply to the coordinates. | 625941b330bbd722463cbb77 |
def table_model(self): <NEW_LINE> <INDENT> model = PandasModel(self.df) <NEW_LINE> self.tableview.setModel(model) <NEW_LINE> header = self.tableview.horizontalHeader() <NEW_LINE> header.setSectionResizeMode(0, QHeaderView.ResizeToContents) <NEW_LINE> header.setSectionResizeMode(1, QHeaderView.ResizeToContents) <NEW_LIN... | Tabla con los datos. | 625941b360cbc95b062c62fd |
def active(self, pos): <NEW_LINE> <INDENT> self._active_pos = pos | Set a given position active
:param: string pos
This will set a given gridref as being an active cell for the ciphertext,
colouring it red on the grid | 625941b3e64d504609d745f4 |
def scoreExtension(seq, seqbdd, mat, posSeq=0, posSeqbdd=0, sens=1): <NEW_LINE> <INDENT> s = [0] <NEW_LINE> sum_score = 0 <NEW_LINE> seuil = 15 <NEW_LINE> debut = 0 <NEW_LINE> if(sens == -1): <NEW_LINE> <INDENT> debut = -1 <NEW_LINE> l = -(min(posSeq, posSeqbdd)+1) <NEW_LINE> if(posSeq == 0 or posSeqbdd == 0): <NEW_LIN... | Calcul le score (à partir de la matrice de score mat) de l'allongement
d'un hit à la position posSeq (séquence seq) et posSeqbdd (séquence seqbdd)
vers la droite (sens = 1) ou la gauche (sens = -1).
Retourne les position d'arret de l'alignement sur les 2 seq et le score. | 625941b30a50d4780f666c43 |
def bb_i2c_open(self, SDA, SCL, baud=100000): <NEW_LINE> <INDENT> extents = [struct.pack("I", baud)] <NEW_LINE> return _u2i(_pigpio_command_ext( self.sl, _PI_CMD_BI2CO, SDA, SCL, 4, extents)) | This function selects a pair of gpios for bit banging I2C at a
specified baud rate.
Bit banging I2C allows for certain operations which are not possible
with the standard I2C driver.
o baud rates as low as 50
o repeated starts
o clock stretching
o I2C on any pair of spare gpios
SDA:= 0-31
SCL:= 0-31
baud:= 50-5000... | 625941b338b623060ff0abaa |
def getNoticeHtml_Reply_NewsComment(self, notice, news_comment): <NEW_LINE> <INDENT> check = self.writeNewsCommentInfos(notice, news_comment) <NEW_LINE> return site_helper.page_render_nobase.user.notices.ReplyNewsComment(notice, news_comment) if check else None | ../page/user/notices/ReplyNewsComment.html | 625941b36fece00bbac2d4ef |
def south(self, distance): <NEW_LINE> <INDENT> return self.pointAtDistance(distance, bearing = pi) | Create a Point at the specified distance due sourth of this Point
:param distance: Distance in meters
:type distance: float
:returns: :class:`model.Point` -- A Point south of this point | 625941b355399d3f05588467 |
def reset_stats(self): <NEW_LINE> <INDENT> self.ship_left = self.ai_settings.ship_limit <NEW_LINE> self.score = 0 <NEW_LINE> self.level = 1 | Reset statistics for new game. | 625941b37c178a314d6ef20c |
def _display_smaller(apartment_list, amount, list_new): <NEW_LINE> <INDENT> ok = 0 <NEW_LINE> if check_number(amount) == False: <NEW_LINE> <INDENT> return -2 <NEW_LINE> <DEDENT> for apt in apartment_list: <NEW_LINE> <INDENT> if apt["amount"] < int(amount): <NEW_LINE> <INDENT> ok = 1 <NEW_LINE> list_new.append(apt) <NEW... | The following function :
> Copies all the entries that have the expenses smaller then a given amount & puts them in a new list
>>>input : Apartment List; Apartment Number; New Empty List;
>>>output : New List; Or an Numeric Value; | 625941b350812a4eaa59c0db |
def value_to_class_index(bin_arr, val_arr): <NEW_LINE> <INDENT> return np.digitize(val_arr,bin_arr,right=True)-1 | Compare the values to a bin list and return the classs indices
according to the results.
Parameter(s):
bin_arr: A list of numbers.
val_arr: The array to be classified.
Return(s):
Classes' indexes. | 625941b38e7ae83300e4ad80 |
def download_files(filenames, server, dirname=''): <NEW_LINE> <INDENT> filenames = to_filename_strings(filenames, strip_names=False, strip_dirs=True, use_cal_dict=True) <NEW_LINE> back_end_fn = _get_back_end(server, 'download_files') <NEW_LINE> if dirname: <NEW_LINE> <INDENT> if not os.path.isdir(dirname): <NEW_LINE> <... | Download a list of files from the specified server, skipping any that
already exist in the target directory.
User authentication is not supported yet (ie. can't get proprietary data).
Parameters
----------
filenames : list of (convertible to str) or str or calibration dict
The names of the files to request from ... | 625941b382261d6c526ab257 |
def split_message(self, message): <NEW_LINE> <INDENT> work_0 = message % self.modulos[0] <NEW_LINE> message //= self.modulos[0] <NEW_LINE> work_1 = message % self.modulos[1] <NEW_LINE> return [ work_0, work_1 ] | Split message into working parts. Return a list of parts. | 625941b3ec188e330fd5a55d |
def factory(self, configparser, *args, **kwargs): <NEW_LINE> <INDENT> class_type = configparser['class_name'] <NEW_LINE> new_module = __import__(self.module_name + '.lib.models.' + class_type, fromlist=[type]) <NEW_LINE> new_class = getattr(new_module, class_type) <NEW_LINE> return new_class(configparser, **kwargs) | Factory function for Asset Class objects
:param configparser: Configuration dictonary
:return factory_class: Asset Class decendent of type listed in config_dict | 625941b3d164cc6175782b02 |
def enqueue(self, item): <NEW_LINE> <INDENT> if self.is_full(): <NEW_LINE> <INDENT> raise OverflowQueueError() <NEW_LINE> <DEDENT> self.tail += 1 <NEW_LINE> self.data.insert(0, item) | add new item into the queue | 625941b3293b9510aa2c304e |
@utils.arg('id', metavar='<SERVER_ID>', help='ID of virtual server to start') <NEW_LINE> @utils.arg('--qemu-version', metavar='<QEMU_VERSION>', help='Suggest a qemu version') <NEW_LINE> def do_server_start(client, args): <NEW_LINE> <INDENT> kwargs = {} <NEW_LINE> if args.qemu_version: <NEW_LINE> <INDENT> kwargs['qemu_v... | Start a virtual server | 625941b330c21e258bdfa251 |
def chi_square_calculator(tweets_data_dic): <NEW_LINE> <INDENT> index = 0 <NEW_LINE> classes_index = dict() <NEW_LINE> for c in np.unique(np.array(list(tweets_data_dic['airline_sentiment']))): <NEW_LINE> <INDENT> classes_index.update({c: index}) <NEW_LINE> index += 1 <NEW_LINE> <DEDENT> terms_index = dict() <NEW_LINE> ... | :param tweets_data_dic: a dictionary of tweets data that only have 'text' and 'airline_sentiment' keys
:return chi_square_table: an np.array object that cell ij contains chi_square value for term j and class i | 625941b330c21e258bdfa252 |
def setResponse(self, *args): <NEW_LINE> <INDENT> return _DataModel.Sensor_setResponse(self, *args) | setResponse(Sensor self, std::string const & response) | 625941b3c432627299f049fb |
def type_of_prev(sequence, interval, firstValue=None, absentValue=None): <NEW_LINE> <INDENT> return _sequence_operation(Oper_type_of_prev, sequence, interval, firstValue, false, absentValue) | Returns an integer expression that represents the type of the interval variable that is previous.
This function returns an integer expression that represents the type of the interval variable
that is previous to *interval* in sequence variable *sequence*. When *interval* is present and is
the first interval of *sequen... | 625941b3a934411ee3751450 |
def test_worker_sets_death(self): <NEW_LINE> <INDENT> q = Queue() <NEW_LINE> w = Worker([q]) <NEW_LINE> w.register_death() <NEW_LINE> death_date = w.death_date <NEW_LINE> self.assertIsNotNone(death_date) <NEW_LINE> self.assertEqual(type(death_date).__name__, 'datetime') | Ensure worker correctly sets worker death date. | 625941b3711fe17d82542131 |
def get_kline(self, market, type=None, since=None, size=None): <NEW_LINE> <INDENT> URL = 'http://api.zb.cn/data/v1/kline' <NEW_LINE> params = {'market': market} <NEW_LINE> if type is not None: <NEW_LINE> <INDENT> params['type'] = type <NEW_LINE> <DEDENT> if since is not None: <NEW_LINE> <INDENT> params['since'] = since... | K line
https://www.zb.com/i/developer/restApi#market
:param str market: ex) btc_usdt
:param str type:
1min
3min
5min
15min
30min
1day
3day
1week
1hour
2hour
4hour
6hour
12hour
:param int since: From this timestamp
:param int size: Limit of returning data(default 1000,... | 625941b3e64d504609d745f5 |
def compute_per(ref, hyp, normalize=True): <NEW_LINE> <INDENT> phone_set = set(ref + hyp) <NEW_LINE> phone2char = dict(zip(phone_set, range(len(phone_set)))) <NEW_LINE> phones_ref = [chr(phone2char[p]) for p in ref] <NEW_LINE> phones_hyp = [chr(phone2char[p]) for p in hyp] <NEW_LINE> per = lev.distance(''.join(phones_r... | Compute Phone Error Rate.
Args:
ref (list): phones in the reference transcript
hyp (list): phones in the predicted transcript
normalize (bool, optional): if True, divide by the length of str_true
Returns:
per (float): Phone Error Rate between str_true and str_pred | 625941b32ae34c7f2600cee6 |
def get(self, save): <NEW_LINE> <INDENT> tree = fromstring(requests.get(self.START_URL).text) <NEW_LINE> yearobjects = tree.xpath('//*/ul[@class="tab-header"]/li//a') <NEW_LINE> year_links = [ self.START_URL + l.attrib["href"] for l in yearobjects if "href" in l.attrib ] <NEW_LINE> for year_link in year_links: <NEW_LIN... | Fetches articles from Banco Santander Central Hispano | 625941b301c39578d7e74bf9 |
def strtime(time, accurate=False): <NEW_LINE> <INDENT> time = time_tuple(int(time)) <NEW_LINE> if time[0] > 0: <NEW_LINE> <INDENT> return '{:02}:{:02}:{:02}'.format(*time[:-1]) <NEW_LINE> <DEDENT> elif accurate: <NEW_LINE> <INDENT> return '{:02}:{:02}.{}0'.format(*time[1:3], time[3] // 100) <NEW_LINE> <DEDENT> else: <N... | Return a string from the given milliseconds time.
:returns:
hh:mm:ss when > 59min
mm:ss:00 when < 1h and accurate=False
mm:ss:z0 when < 1h and accurate=True | 625941b30c0af96317bb7f9e |
def unifiedorder(self, product, openid=None, trade_type=None): <NEW_LINE> <INDENT> assert isinstance(product, dict) <NEW_LINE> assert trade_type in ('JSAPI', 'NATIVE') <NEW_LINE> post_dict = { 'appid': self.appid, 'attach': product['attach'], 'body': product['body'], 'mch_id': self.mch_id, 'nonce_str': self.generate_no... | 统一下单接口 | 625941b3004d5f362079a0ed |
def _generate_audio_file(self): <NEW_LINE> <INDENT> pico2wave_exec_path = ["/usr/bin/pico2wave"] <NEW_LINE> tmp_path = self.file_path+".wav" <NEW_LINE> pico2wave_options = ["-l=%s" % self.language, "-w=%s" % tmp_path] <NEW_LINE> final_command = list() <NEW_LINE> final_command.extend(pico2wave_exec_path) <NEW_LINE> fina... | Generic method used as a Callback in TTSModule
- must provided the audio file and write it on the disk
.. raises:: FailToLoadSoundFile | 625941b3283ffb24f3c556c3 |
def get_height(self) -> Optional[int]: <NEW_LINE> <INDENT> flags = decode_flags(VmbFrameFlags, self._frame.receiveFlags) <NEW_LINE> if VmbFrameFlags.Dimension not in flags: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> return self._frame.height | Get image height in pixels.
Returns:
Image height in pixels if dimension data is provided by the camera.
None if dimension data is not provided by the camera. | 625941b321a7993f00bc7a9d |
def get_schema(): <NEW_LINE> <INDENT> return { 'schema': { 'schema_version': { 'type': 'integer', 'default': 2, }, 'name': { 'schema_version': 1, 'title': 'Graphite connection name', 'comment': 'Unique Graphite connection name', 'type': 'string', 'required': True, 'empty': False, 'unique': True, }, 'carbon_address': { ... | Schema structure of this resource
:return: schema dictionary
:rtype: dict | 625941b3bde94217f3682bb2 |
def parse(line): <NEW_LINE> <INDENT> data = json.loads(line) <NEW_LINE> return data['PRODUCT_ID'], data['CATEGORY_ID'], data['BRAND'], data['DESCRIPTION'], data['NAME'], data['PRICE'], data['LAST_UPDATE_DATE'] | Parsing JSON messages from Kafka Producer | 625941b3d58c6744b4257a16 |
def test_list_config_file(self): <NEW_LINE> <INDENT> pass | Test case for list_config_file
List config files | 625941b324f1403a92600927 |
def get_i18n(factory=I18n, key=_i18n_registry_key, request=None): <NEW_LINE> <INDENT> request = request or webapp2.get_request() <NEW_LINE> i18n = request.registry.get(key) <NEW_LINE> if not i18n: <NEW_LINE> <INDENT> i18n = request.registry[key] = factory(request) <NEW_LINE> <DEDENT> return i18n | Returns an instance of :class:`I18n` from the request registry.
It'll try to get it from the current request registry, and if it is not
registered it'll be instantiated and registered. A second call to this
function will return the same instance.
:param factory:
The callable used to build and register the instanc... | 625941b399fddb7c1c9de14d |
def test_remove_unregistered_torrent(self): <NEW_LINE> <INDENT> self.ltmgr.initialize() <NEW_LINE> mock_handle = MockObject() <NEW_LINE> mock_handle.is_valid = lambda: False <NEW_LINE> alert = type('torrent_removed_alert', (object, ), dict(handle=mock_handle, info_hash='0'*20)) <NEW_LINE> self.ltmgr.process_alert(alert... | Tests a successful removal status of torrents which aren't known | 625941b35fc7496912cc373b |
def chooseAppropriateRule(self, ruleSymbol): <NEW_LINE> <INDENT> RightRule = Rules[ruleSymbol][0] <NEW_LINE> for RightRule in Rules[ruleSymbol]: <NEW_LINE> <INDENT> if (self.inputSymbol in self.findFirstSymbols(RightRule)): <NEW_LINE> <INDENT> return RightRule <NEW_LINE> <DEDENT> <DEDENT> return None | Effects: Returns rule that begins with symbol "inputSymbol"
if more than one rule has this left part. | 625941b310dbd63aa1bd2966 |
def _extract_alignment_region(alignment_seq_with_flanking, annotation): <NEW_LINE> <INDENT> align_stripped = alignment_seq_with_flanking.strip("-") <NEW_LINE> display_start = int(annotation["al_display_start"]) <NEW_LINE> if int(annotation["al_start"]) <= int(annotation["al_stop"]): <NEW_LINE> <INDENT> start = int(anno... | Extract alignment region (PRIVATE).
Helper function for the main parsing code.
To get the actual pairwise alignment sequences, we must first
translate the un-gapped sequence based coordinates into positions
in the gapped sequence (which may have a flanking region shown
using leading - characters). To date, I have ne... | 625941b3b57a9660fec33633 |
def set_kickstart(self,kickstart): <NEW_LINE> <INDENT> if kickstart == "<<inherit>>": <NEW_LINE> <INDENT> self.kickstart = kickstart <NEW_LINE> return True <NEW_LINE> <DEDENT> if utils.find_kickstart(kickstart): <NEW_LINE> <INDENT> self.kickstart = kickstart <NEW_LINE> return True <NEW_LINE> <DEDENT> raise CX(_("kickst... | Sets the kickstart. This must be a NFS, HTTP, or FTP URL.
Or filesystem path. Minor checking of the URL is performed here. | 625941b3cdde0d52a9e52dea |
def get_age_group(age_joined): <NEW_LINE> <INDENT> bins = [17,25,35,45,55,120] <NEW_LINE> group_names = ['18-25','26-35','36-45','46-55','>55'] <NEW_LINE> age_joined['age_decade'] = pd.cut(age_joined['Age'], bins, labels=group_names) <NEW_LINE> return age_joined | Create a new column as age_decade
Input:
-------
pandas dataframe
Output:
-------
pandas dataframe with a new column 'age_decade' | 625941b3adb09d7d5db6c549 |
def __init__(self, baseurl=None, orKeywords=False, version="1.0"): <NEW_LINE> <INDENT> if not baseurl: baseurl = RegistryService.STSCI_REGISTRY_BASEURL <NEW_LINE> super(RegistryQuery, self).__init__(baseurl, "vaoreg", version) <NEW_LINE> self._kw = [] <NEW_LINE> self._preds = [] <NEW_LINE> self._svctype = None <NEW_LI... | create the query instance
Parameters
----------
baseurl : str
the base URL for the VAO registry. If None, it will
be set to the public VAO registry at STScI.
orKeywords : bool
if True, keyword constraints will by default be
OR-ed together; that is, a resource that matches
any of the keywords will be ... | 625941b326068e7796caea8d |
def simulationWithDrug(numViruses, maxPop, maxBirthProb, clearProb, resistances, mutProb, numTrials): <NEW_LINE> <INDENT> viruses = list(ResistantVirus(maxBirthProb, clearProb, resistances, mutProb) for i in range(numViruses)) <NEW_LINE> totalv = [0] * 300 <NEW_LINE> resisv = [0] * 300 <NEW_LINE> for i in range(numTria... | Runs simulations and plots graphs for problem 5.
For each of numTrials trials, instantiates a patient, runs a simulation for
150 timesteps, adds guttagonol, and runs the simulation for an additional
150 timesteps. At the end plots the average virus population size
(for both the total virus population and the guttagon... | 625941b3d7e4931a7ee9dcd1 |
def setUp(self): <NEW_LINE> <INDENT> TestController.setUp(self) <NEW_LINE> self.serials = [] | setup the Test Controller | 625941b3435de62698dfda0a |
def TestInstStatusCollector(): <NEW_LINE> <INDENT> enabled_hypervisors = qa_config.GetEnabledHypervisors() <NEW_LINE> is_xen = (constants.HT_XEN_PVM in enabled_hypervisors or constants.HT_XEN_HVM in enabled_hypervisors) <NEW_LINE> if not is_xen: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> AssertCommand([MON_COLLECTO... | Test the Xen instance status collector.
| 625941b30383005118ecf39a |
def clear_all_object_of_bucket(oss_instance, bucket): <NEW_LINE> <INDENT> return clear_all_objects_in_bucket(oss_instance, bucket) | clean all objects in bucket, after that, it will delete this bucket. | 625941b331939e2706e4cc27 |
def chunk_and_write_dataframe(dataframe_to_write: pd.DataFrame, measurement: str, user_id: str, df_client, batch_size: int = 5000) -> bool: <NEW_LINE> <INDENT> chunk_nb = math.ceil(len(dataframe_to_write) / batch_size) <NEW_LINE> dataframe_chunk_list = np.array_split(dataframe_to_write, chunk_nb) <NEW_LINE> for chunk i... | Split the input dataframe in chunk and write them sequentially for perfomance issues
:param dataframe_to_write: pandas dataframe to write in influxDB
:param measurement: measurement name of dataframe to write
:param user_id: id of user
:return: | 625941b363f4b57ef0000ee1 |
def test_notification_getunreadcount(self): <NEW_LINE> <INDENT> pass | Test case for notification_getunreadcount
Get the number of unread notifications # noqa: E501 | 625941b34527f215b584c217 |
def nginx_accel(request,app): <NEW_LINE> <INDENT> allowed = False <NEW_LINE> if allowed: <NEW_LINE> <INDENT> response = HttpResponse() <NEW_LINE> response['Content-Type']="" <NEW_LINE> response['X-Accel-Redirect'] = request.get_full_path() <NEW_LINE> return response <NEW_LINE> <DEDENT> return HttpResponseForbidden() | default django view, where id is an argument that identifies
the ressource to be protected | 625941b323e79379d52ee31f |
def __call__(self, e1, e2): <NEW_LINE> <INDENT> if self.nobias: <NEW_LINE> <INDENT> return bilinear.bilinear(e1, e2, self.W) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return bilinear.bilinear(e1, e2, self.W, self.V1, self.V2, self.b) | Applies the bilinear function to inputs and the internal parameters.
Args:
e1 (~chainer.Variable): Left input.
e2 (~chainer.Variable): Right input.
Returns:
~chainer.Variable: Output variable. | 625941b3507cdc57c6306a87 |
def _send_mail(self, request, user, **kwargs): <NEW_LINE> <INDENT> kwargs['context'] = self.get_context_data(request, user) <NEW_LINE> mail_kwargs = { "subject": self.get_subject(**kwargs), "message": self.get_message(**kwargs), "from_email": (settings.DEFAULT_FROM_EMAIL), "recipient_list": [user.email], } <NEW_LINE> t... | _send_mail() will actually send the email | 625941b366656f66f7cbbf62 |
@cli.command() <NEW_LINE> @click.argument('mode', type=click.Choice(['update', 'replace']), metavar='<update|replace>') <NEW_LINE> @click.option('-a', '--all-repos', is_flag=True, help='Use all accessible repositories.') <NEW_LINE> @click.option('-d', '--dry-run', is_flag=True, help='Doesn\'t make any changes to GitHub... | Run labels processingpython -m pip install --extra-index-url https://test.pypi.org/pypi labelord_klememi1 | 625941b3167d2b6e31218954 |
def sanity_filter(frames): <NEW_LINE> <INDENT> lst = [frame for frame in frames if check_frame(frame, debug=global_debug)] <NEW_LINE> print('Dropped {} frames'.format(len(frames) - len(lst)), file=sys.stderr) <NEW_LINE> return lst | Filter the frames to those passed the sanity check | 625941b34f88993c3716be2b |
def _get_links(): <NEW_LINE> <INDENT> import lxml.html as lh <NEW_LINE> url = 'http://gdelt.utdallas.edu/data/dailyupdates/?O=D' <NEW_LINE> page = requests.get(url) <NEW_LINE> text = lh.fromstring(page.content) <NEW_LINE> urls = text.xpath('//a/@href') <NEW_LINE> urls = [url for url in urls if '.zip' in url] <NEW_LINE>... | Private function to obtain the links for the daily update files from
the GDELT website. Requires requests and lxmlself. | 625941b3de87d2750b85fb43 |
def _create_dialog_with_widget(self, title, bundle, widget_class, *args, **kwargs): <NEW_LINE> <INDENT> parent = self._get_dialog_parent() <NEW_LINE> widget = self._create_widget(widget_class, *args, **kwargs) <NEW_LINE> self._apply_external_stylesheet(bundle, widget) <NEW_LINE> dialog = self._create_dialog(title, bund... | Convenience method to create an sgtk TankQDialog with a widget instantiated from
widget_class embedded in the main section.
.. note:: For more information, see the documentation for :meth:`show_dialog()`.
:param title: The title of the window
:param bundle: The app, engine or framework object that is associated with ... | 625941b3b545ff76a8913bd7 |
def enumerate(self): <NEW_LINE> <INDENT> pass | Enumerate system attributes | 625941b3d7e4931a7ee9dcd2 |
def createDictionary(): <NEW_LINE> <INDENT> dictionaryFile = open("dictionary.txt") <NEW_LINE> for line in dictionaryFile: <NEW_LINE> <INDENT> line = line.strip() <NEW_LINE> DICTIONARY.append(line) <NEW_LINE> <DEDENT> dictionaryFile.close() | Reads from "dictionary.txt" and construct a list of valid words. | 625941b3d164cc6175782b03 |
def _get_all_descendant_nodes(name_object, taxid: str) -> List[str]: <NEW_LINE> <INDENT> descendant_nodes: List[str] = [taxid] <NEW_LINE> if len(name_object[taxid].children) > 0: <NEW_LINE> <INDENT> for child in name_object[taxid].children: <NEW_LINE> <INDENT> descendant_nodes = descendant_nodes + _get_all_descendant_n... | Get all descendant of a node | 625941b338b623060ff0abac |
def extract_matching_pattern(regex, group_name, unfiltered_list): <NEW_LINE> <INDENT> result = '' <NEW_LINE> filtered_list = filter(regex.search, unfiltered_list) <NEW_LINE> if len(filtered_list) == 1: <NEW_LINE> <INDENT> filtered_string = ''.join(filtered_list) <NEW_LINE> result = regex.search(filtered_string).group(g... | Return the desired group_name from a list of matching patterns
@param regex : a regular expression with named groups
@param group_name : the desired matching group name value
@param unfiltered_list : a list of matches
@rtype : the string value | 625941b37cff6e4e81117741 |
def _GenServerPrimaryKey(self, file): <NEW_LINE> <INDENT> pass | Generate the data members that define the object primary key
Identifier _key_members contains (string, name) which is already
present in IFMapIdentifier. | 625941b350485f2cf553cb4f |
def kolonnerTilListe(lst, svar): <NEW_LINE> <INDENT> a, b, c = delInnListe(lst) <NEW_LINE> if svar == "v": <NEW_LINE> <INDENT> return b+a+c <NEW_LINE> <DEDENT> elif svar == "m": <NEW_LINE> <INDENT> return a+b+c <NEW_LINE> <DEDENT> elif svar == "h": <NEW_LINE> <INDENT> return a+c+b | Denne funksjonen tar inn en liste og et svar,
undersoker hva svaret er, og lager en ny liste av den gamle listen utifra
hva svaret var. | 625941b3507cdc57c6306a88 |
def getResults(self): <NEW_LINE> <INDENT> if self._results: <NEW_LINE> <INDENT> return self._results <NEW_LINE> <DEDENT> if self._xmlDoc: <NEW_LINE> <INDENT> entryElements = self._xmlDoc.getElementsByTagNameNS(ATOM_NS, 'entry') <NEW_LINE> entries = [] <NEW_LINE> for entryElement in entryElements: <NEW_LINE> <INDENT> ch... | Overriding to make it work with a list instead of a dict. | 625941b39b70327d1c4e0b8a |
def ReleaseUnmanagedResources(self,*args): <NEW_LINE> <INDENT> pass | ReleaseUnmanagedResources(self: GroundConductorSizeSet) | 625941b38e7ae83300e4ad82 |
def reset(self): <NEW_LINE> <INDENT> self.counter[2] = 0 | 将第 2 级别的计数置为 0 | 625941b3091ae35668666d1d |
def setup_scanner(hass, config: dict, see, discovery_info=None): <NEW_LINE> <INDENT> username = config.get(CONF_USERNAME) <NEW_LINE> password = config.get(CONF_PASSWORD) <NEW_LINE> account = config.get(CONF_ACCOUNTNAME, slugify(username.partition('@')[0])) <NEW_LINE> max_interval = config.get(CONF_MAX_INTERVAL) <NEW_LI... | Set up the iCloud Scanner. | 625941b37d43ff24873a2a5a |
def configure( always_display_bottom = None, arrow_head_character = None, arrow_tail_character = None, arrow_head_color = None, arrow_tail_color = None, code_color = None, display_arrow = None, display_link = None, display_locals = None,... | Configure settings governing how exceptions are displayed. | 625941b316aa5153ce36222e |
@templatefunc('revset(query[, formatargs...])') <NEW_LINE> def revset(context, mapping, args): <NEW_LINE> <INDENT> if not len(args) > 0: <NEW_LINE> <INDENT> raise error.ParseError(_("revset expects one or more arguments")) <NEW_LINE> <DEDENT> raw = evalstring(context, mapping, args[0]) <NEW_LINE> ctx = mapping['ctx'] <... | Execute a revision set query. See
:hg:`help revset`. | 625941b3d6c5a10208143dfd |
def test_init_wrong_mistyped_domain(self): <NEW_LINE> <INDENT> self.assertRaises( TypeError, ServerName, **{ "domain" : 1234, } ) | Tests that an ServerName object cannot be instantiated and a TypeError exception is raised
if a domain is passed in, but it's not a string. | 625941b363b5f9789fde6e9c |
def fetch_master_data(params): <NEW_LINE> <INDENT> result = select(params) <NEW_LINE> return result.fetchall() | Fetch official unique company name from database
Arg:
req_params (dict): Http request parameters using search (database or BigQuery) or identify name string.
Return:
list: fetch result. converted SQLAlchemy.ResultProxy obj to list obj | 625941b3f7d966606f6a9dbf |
def setPositionsAndForm ( self, pos, form ): <NEW_LINE> <INDENT> self.positions = numpy.array(pos ) <NEW_LINE> self.functionalForms = form | Construct and ideal tube directly from an array of positions and functional forms
:param pos: Array of points where the peaks or edges should be in Metres
:param form: Array of functional forms of the points 1=peak, 2=edge | 625941b36e29344779a623cd |
def extend_volume(self, volume, new_size): <NEW_LINE> <INDENT> client = self._login() <NEW_LINE> try: <NEW_LINE> <INDENT> volume_info = client.getVolumeByName(volume['name']) <NEW_LINE> options = {'size': int(new_size) * units.Gi} <NEW_LINE> client.modifyVolume(volume_info['id'], options) <NEW_LINE> <DEDENT> except Exc... | Extend the size of an existing volume. | 625941b3ec188e330fd5a55f |
def save_metadata(self): <NEW_LINE> <INDENT> labels = [] <NEW_LINE> if os.path.isdir(self.metadata_dest_dir): <NEW_LINE> <INDENT> shutil.rmtree(self.metadata_dest_dir, ignore_errors=True) <NEW_LINE> <DEDENT> os.makedirs(self.metadata_dest_dir) <NEW_LINE> filenames = glob.glob(os.path.join(self.dest_dir, '*')) <NEW_LINE... | Function to get metadata infomation such as list of image names, and labels | 625941b3d164cc6175782b04 |
def create_response_and_send_mail(wizard, token, partner_id, email): <NEW_LINE> <INDENT> url = wizard.survey_id.public_url <NEW_LINE> url = urlparse.urlparse(url).path[1:] <NEW_LINE> if token: <NEW_LINE> <INDENT> url = url + '/' + token <NEW_LINE> <DEDENT> values = { 'model': None, 'res_id': None, 'subject': wizard.sub... | Create one mail by recipients and replace __URL__ by link with identification token | 625941b3293b9510aa2c3050 |
def anchors_for_shape( image_shape, pyramid_levels=None, ratios=None, scales=None, strides=None, sizes=None, shapes_callback=None, ): <NEW_LINE> <INDENT> if pyramid_levels is None: <NEW_LINE> <INDENT> pyramid_levels = [2, 3, 4] <NEW_LINE> <DEDENT> if strides is None: <NEW_LINE> <INDENT> strides = [2 ** x for x in pyram... | Generators anchors for a given shape.
Args
image_shape: The shape of the image.
pyramid_levels: List of ints representing which pyramids to use (defaults to [3, 4, 5, 6, 7]).
ratios: List of ratios with which anchors are generated (defaults to [0.5, 1, 2]).
scales: List of scales with which anchors are... | 625941b3293b9510aa2c3051 |
def print_menu(exits, room_items, inv_items): <NEW_LINE> <INDENT> print("You can:") <NEW_LINE> for direction in exits: <NEW_LINE> <INDENT> print_exit(direction, exit_leads_to(exits, direction)) <NEW_LINE> <DEDENT> for item_takeable in room_items: <NEW_LINE> <INDENT> print("TAKE " + item_takeable["id"].upper() + " to ta... | This function displays the menu of available actions to the player. The
argument exits is a dictionary of exits as exemplified in map.py. The
arguments room_items and inv_items are the items lying around in the room
and carried by the player respectively. The menu should, for each exit,
call the function print_exit() t... | 625941b373bcbd0ca4b2be33 |
def run_scan(self): <NEW_LINE> <INDENT> self.load_net_config() <NEW_LINE> self.scan_ips() <NEW_LINE> self.save_to_file() | Spusti skenovani dle nactene konfigurace | 625941b399cbb53fe679299e |
@pytest.fixture <NEW_LINE> def get_token() -> str: <NEW_LINE> <INDENT> env_path = Path(__file__).parent.parent / ".env" <NEW_LINE> load_dotenv(dotenv_path=env_path, override=True, verbose=True) <NEW_LINE> joplin_key = os.getenv("JOPLIN_KEY") <NEW_LINE> if not joplin_key: <NEW_LINE> <INDENT> raise EnvironmentError("no J... | put the token of the Joplin WebClipper config page
:return: | 625941b3cc40096d6159570b |
def generate_random_uint_between(low, high, rand_func=generate_random_bytes): <NEW_LINE> <INDENT> if not (is_integer(low) and is_integer(high)): <NEW_LINE> <INDENT> raise TypeError("unsupported argument types(s): %r and %r" % (type(low).__name__, type(high).__name__)) <NEW_LINE> <DEDENT> if low >= high: <NEW_LINE> <... | Generates a random long integer between low and high, not including high.
:param low:
Low
:param high:
High
:param rand_func:
Random bytes generator function.
:returns:
Random unsigned long integer value. | 625941b3ff9c53063f47bfb5 |
def construct_graph(self, _contract): <NEW_LINE> <INDENT> for f in _contract.functions + _contract.constructor_as_list: <NEW_LINE> <INDENT> if f.name in ['slitherConstructorVariables', 'slitherConstructorConstantVariables'] or not f.is_public_or_external: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> for dependency ... | Constructs the graph by connecting nodes with edges. | 625941b323849d37ff7b2e49 |
def filter_macro(func, *args, **kwargs): <NEW_LINE> <INDENT> filter_partial = partial(func, *args, **kwargs) <NEW_LINE> class FilterMacroMeta(FilterMeta): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def __new__(mcs, name, bases, attrs): <NEW_LINE> <INDENT> for attr in WRAPPER_ASSIGNMENTS: <NEW_LINE> <INDENT> if hasatt... | Promotes a function that returns a filter into its own filter type.
Example::
@filter_macro
def String():
return Unicode | Strip | NotEmpty
# You can now use `String` anywhere you would use a regular Filter:
(String | Split(':')).apply('...')
You can also use ``filter_macro`` to create parti... | 625941b31f037a2d8b945fb5 |
def test_get_a_specific_template(self): <NEW_LINE> <INDENT> uid_list = ('centos-7', 'debian-8') <NEW_LINE> for uid in uid_list: <NEW_LINE> <INDENT> template = Template.get_template(uid) <NEW_LINE> self.assertEqual(uid, template.uid) | get_template should return the correct template | 625941b33346ee7daa2b2b1e |
def collect_sql(self, plan): <NEW_LINE> <INDENT> statements = [] <NEW_LINE> state = None <NEW_LINE> for migration, backwards in plan: <NEW_LINE> <INDENT> with self.connection.schema_editor(collect_sql=True, atomic=migration.atomic) as schema_editor: <NEW_LINE> <INDENT> if state is None: <NEW_LINE> <INDENT> state = self... | Take a migration plan and return a list of collected SQL statements
that represent the best-efforts version of that plan. | 625941b3d58c6744b4257a17 |
def send_activation_mail(*, request, user): <NEW_LINE> <INDENT> token = default_token_generator.make_token(user=user) <NEW_LINE> uidb64 = urlsafe_base64_encode(force_bytes(user.pk)) <NEW_LINE> domain = request.META['HTTP_HOST'] <NEW_LINE> path = reverse('register_confirm', kwargs={'uidb64': uidb64, 'token': token}) <NE... | Generate activation token and construct activation URL.
:param user: (User) Registered user instance. | 625941b3099cdd3c635f0a13 |
def __init__(self, iface): <NEW_LINE> <INDENT> super(SortNumber, self).__init__() <NEW_LINE> self.iface = iface <NEW_LINE> self.plugin_dir = os.path.dirname(__file__) <NEW_LINE> locale = QSettings().value('locale/userLocale')[0:2] <NEW_LINE> locale_path = os.path.join( self.plugin_dir, 'i18n', 'SortNumber_{}.qm'.format... | Constructor.
:param iface: An interface instance that will be passed to this class
which provides the hook by which you can manipulate the QGIS
application at run time.
:type iface: QgsInterface | 625941b315baa723493c3d28 |
def fixedp(f,x0,tol=10e-6,maxiter=100): <NEW_LINE> <INDENT> e = 1 <NEW_LINE> l=.99 <NEW_LINE> i = 0 <NEW_LINE> xp = [] <NEW_LINE> while(e > tol and i < maxiter): <NEW_LINE> <INDENT> print("iter %d --> x = %e\n" % (i,x0) ) <NEW_LINE> x = l*x0+(1-l)*f(x0) <NEW_LINE> l = .99*l <NEW_LINE> e = norm(x0-x) <NEW_LINE> x0 = x <... | Fixed point algorithm | 625941b33346ee7daa2b2b1f |
def test_manual_baudrate(self, serial_ports, serial, mock_format_response): <NEW_LINE> <INDENT> main("--baudrate 115200 --format".split()) <NEW_LINE> serial.assert_called_once_with("/dev/ttyUSB5", 115200, timeout=2.0) | Baudrate should be overrideable. | 625941b32ae34c7f2600cee8 |
def test(): <NEW_LINE> <INDENT> pass | test func
:return: none | 625941b3004d5f362079a0ef |
def get_nodes_lines(self, **kwargs): <NEW_LINE> <INDENT> params = {'Nodes': util.ints_to_string(kwargs.get('nodes', []))} <NEW_LINE> result = self.make_request('bus', 'get_nodes_lines', **params) <NEW_LINE> if not util.check_result(result): <NEW_LINE> <INDENT> return False, result.get('resultDescription', 'UNKNOWN ERRO... | Obtain stop IDs, coordinates and line information.
Args:
nodes (list[int] | int): nodes to query, may be empty to get
all nodes.
Returns:
Status boolean and parsed response (list[NodeLinesItem]), or message
string in case of error. | 625941b3627d3e7fe0d68c05 |
def test_GetPlayerBans_str_valid(self): <NEW_LINE> <INDENT> status = self.iSteamUser.GetPlayerBans( steamids=PUBLIC_PROFILE, ).json.status_code <NEW_LINE> self.assertEqual( status, 200, 'Error retrieving player bans. Received Status ' + ' ({0}) instead of Status (200).'.format(status), ) | Test to make sure we get a response code of 200 OK from a public
profile. | 625941b356ac1b37e6263f98 |
def __init__(self, value: int, position: list = []) -> None: <NEW_LINE> <INDENT> super().__init__(position) <NEW_LINE> self._value = value <NEW_LINE> object_data = const.MAZE_OBJ[value] <NEW_LINE> if object_data[1] is not None: <NEW_LINE> <INDENT> self.load_from_file(path.join(const.IMG_FOLDER, object_data[1])) <NEW_LI... | Create a new MazeObject.
- Value should be an integer reprenstig the type of case, value should
be as in MAZE_OBJECT_TYPE.
- Position should be a list of 2 integer representing the position as
Row -> Column or None if not yet set.
The image file, or any cropping data are loaded from "const.py" | 625941b37b25080760e3921a |
def test_missing_requirements_file(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> activate('pip>=0.8.3') <NEW_LINE> <DEDENT> except RuntimeError: <NEW_LINE> <INDENT> raise SkipTest("This version of pip is so old that it doesn't even " "handle the IOError opening the file itself properly.") <NEW_LINE> <DEDENT> with... | Check that pip's InstallationError exception (when the specified
requirements file doesn't exist) is handled gracefully. | 625941b3d10714528d5ffa9b |
def test_build(self): <NEW_LINE> <INDENT> _, temp = tempfile.mkstemp() <NEW_LINE> body = { 'sha': uuid.uuid4().hex, 'slug_size': 4096000, 'procfile': json.dumps({'web': 'node server.js'}), 'url': 'http://deis.local/slugs/1c52739bbf3a44d3bfb9a58f7bbdd5fb.tar.gz', 'checksum': uuid.uuid4().hex, } <NEW_LINE> with open(temp... | Test that a user can publish a new build. | 625941b35fc7496912cc373d |
def test_Failure_string_representation(self): <NEW_LINE> <INDENT> self.assertEqual("Failure(42, Because it is that way)", str(Failure(42, "Because it is that way"))) | Validates the string representation of the `Failure` object | 625941b394891a1f4081b85f |
def RemoveSource(self,source): <NEW_LINE> <INDENT> self._sources.RemoveSource(source) | Remove a source object
Parameters
----------
source : Source
Source object to remove from active sources | 625941b3e8904600ed9f1ce0 |
def transform(self, X: Iterable[TFingerprint], y: Optional[numpy.ndarray] = None, **transform_params: Any) -> numpy.ndarray: <NEW_LINE> <INDENT> return numpy.array([unpack_fingerprint(x) for x in X], dtype=numpy.float64) | :param X: source of fingerprints
:param y: unused
:param transform_params: unused
:return: a numpy array containing the densely unpacked fingerprints | 625941b35fdd1c0f98dbffec |
def jump(self, oldr, oldc, newr, newc): <NEW_LINE> <INDENT> self.move(oldr, oldc, newr, newc) <NEW_LINE> jumpr = (oldr + newr) // 2 <NEW_LINE> jumpc = (oldc + newc) // 2 <NEW_LINE> self.squares[(jumpr, jumpc)].clear_checker() | CheckersGame.jump(oldr,oldc,newr,newc)
jumps the piece that's on square (oldr,oldc) to square (newr,newc)
and removes the piece in between that got jumped over | 625941b3b5575c28eb68ddb4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.