code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def Lancement(base, requetes, config): <NEW_LINE> <INDENT> def add(event = None): <NEW_LINE> <INDENT> dictionnaire = stockage_question(requetes, config) <NEW_LINE> ajouter(root, dictionnaire, requetes, config, base) <NEW_LINE> <DEDENT> def suppr(event = None): <NEW_LINE> <INDENT> dictionnaire = stockage_question(requet... | fonction permettant le lancement du programme dans sa globalité
parametres:
base, une chaine de caracteres contenant le chemin d'accès vers une base de données ( celle permettant de répondre aux questions )
requetes, une chaine de caracteres avec le chemin d'accès aux dossier contenant les requetes et le fichie... | 625941da24f1403a92600e23 |
def shutil_which(pgm): <NEW_LINE> <INDENT> path = os.getenv('PATH') <NEW_LINE> for p in path.split(os.path.pathsep): <NEW_LINE> <INDENT> p = os.path.join(p, pgm) <NEW_LINE> if os.path.exists(p) and os.access(p, os.X_OK): <NEW_LINE> <INDENT> return p | Python 2 compatibility: backport of ``shutil.which()`` from Python 3 | 625941da4c3428357757c5e6 |
def policy_detached(name, policyName, principal, region=None, key=None, keyid=None, profile=None): <NEW_LINE> <INDENT> ret = {'name': policyName, 'result': True, 'comment': '', 'changes': {} } <NEW_LINE> r = __salt__['boto_iot.list_principal_policies'](principal=principal, region=region, key=key, keyid=keyid, profile=p... | Ensure policy is attached to the given principal.
name
The name of the state definition.
policyName
Name of the policy.
principal
The principal which can be a certificate ARN or a Cognito ID.
region
Region to connect to.
key
Secret key to be used.
keyid
Access key to be used.
profile
... | 625941da4f88993c3716c324 |
def getUnifiedErrorMessages(self): <NEW_LINE> <INDENT> error_log_list = self.getErrorLogMessages() <NEW_LINE> unified_info_list = set() <NEW_LINE> for error_log in error_log_list: <NEW_LINE> <INDENT> result = error_log.getResult() <NEW_LINE> info = error_log.getResultInfo() <NEW_LINE> unified_info_list.add((result.lowe... | Return unified error message (replace dynamic str away) as a list
Each element is in format (result_level, unified_info_str) | 625941da5fc7496912cc3c3d |
def get_char_width(char: str) -> int: <NEW_LINE> <INDENT> widths = [ (126, 1), (159, 0), (687, 1), (710, 0), (711, 1), (727, 0), (733, 1), (879, 0), (1154, 1), (1161, 0), (4347, 1), (4447, 2), (7467, 1), (7521, 0), (8369, 1), (8426, 0), (9000, 1), (9002, 2), (11021, 1), (12350, 2), (12351, 1), (12438, 2), (12442, 0), (... | 计算单个字符的宽度 | 625941da0fa83653e4657279 |
def searchTimeSizeFiles(runinfo): <NEW_LINE> <INDENT> path = os.getcwd() <NEW_LINE> print('full path =', os.path.abspath(path)) <NEW_LINE> files = os.listdir(path) <NEW_LINE> test_timeSizeDirs = re.compile("_TimeSize$", re.IGNORECASE) <NEW_LINE> timesize_dirs = [os.path.join(path, f) for f in files if test_timeSizeDirs... | so far we will use the current dir to search in | 625941dae8904600ed9f21ef |
def test_download_json(self): <NEW_LINE> <INDENT> json_obj = { 'Body': { 'this': 'that' } } <NEW_LINE> self.s3.put_object(Bucket=self.bucket, Key='prefix/test.json', Body=json.dumps(json_obj)) <NEW_LINE> out = s3.download_json('s3://%s/prefix/test.json' % self.bucket) <NEW_LINE> self.assertEqual(out, json_obj) <NEW_LIN... | Download file from S3 as JSON | 625941da92d797404e30444a |
def _PathIsHub(self, usb_sysfs_path): <NEW_LINE> <INDENT> if not os.path.exists(usb_sysfs_path): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> with open(os.path.join(usb_sysfs_path, 'bDeviceClass'), 'r') as classf: <NEW_LINE> <INDENT> return int(classf.read().strip(), 16) == usb.CLASS_HUB | Return whether |usb_sysfs_path| is a usb hub. | 625941dad53ae8145f87a52b |
def to_coord(self): <NEW_LINE> <INDENT> return self | Return this variable as an xarray.Coordinate | 625941da046cf37aa974d005 |
def handle_doc(doc): <NEW_LINE> <INDENT> pass | Handles the dictionary representing one document in results
:param doc: dictionary with document data
:return: nothing | 625941da1f5feb6acb0c4e0b |
def test_CreateInteractionChoiceSet(self): <NEW_LINE> <INDENT> params = OrderedDict() <NEW_LINE> params['choiceSet'] = Param(name='choiceSet', param_type=Array(element_type=Struct(name='Choice'))) <NEW_LINE> item = Function(name='CreateInteractionChoiceSet', function_id=EnumElement(name='CreateInteractionChoiceSetID'),... | generator/transformers/common_producer.py 67%
generator/transformers/functions_producer.py 63% | 625941da7b25080760e39717 |
def assign_context_word_scores(ngram_dict, comparison_dict, gram_name, train_test): <NEW_LINE> <INDENT> wordscore_dict = {} <NEW_LINE> lc_wordscore_list = [] <NEW_LINE> rc_wordscore_list = [] <NEW_LINE> for i in ngram_dict: <NEW_LINE> <INDENT> for j in ngram_dict[i]: <NEW_LINE> <INDENT> if 'bi' in gram_name: <NEW_LINE>... | Takes a dict of ngram scores, a comparison dict of scores lower order ngram
scores, a name (string) of the desired ngram length and whether it is part of
a train or test set. Returns a dict of context scores for later use in creating
ngram probabilities. Also saves dictionary as a pickle file. | 625941daa8370b7717052b5d |
def set_use_label(self, use_label): <NEW_LINE> <INDENT> self.use_label = use_label | Set which label use for evaluation | 625941da67a9b606de4a8177 |
def wsgi_app_mock( environ: Dict[str, str], response: webtest.TestResponse ) -> webtest.TestResponse: <NEW_LINE> <INDENT> self.assertEqual(environ, {'key': 'value'}) <NEW_LINE> self.assertEqual(type(response), webtest.TestResponse) <NEW_LINE> return response | Mock WSGI app.
Args:
environ: dict. Environment variables.
response: webtest.TestResponse. Response to return.
Returns:
webtest.TestResponse. Response. | 625941da4428ac0f6e5baab3 |
def testDumpACPITableUnknownChipset(self): <NEW_LINE> <INDENT> self.chipsec_mock.chipset.cs = UnsupportedChipset <NEW_LINE> args = chipsec_types.DumpACPITableRequest(table_signature="FACP") <NEW_LINE> self.RunAction(self.grr_chipsec_module.DumpACPITable, args) | By default, if the chipset is unknown, no exception is raised. | 625941dae1aae11d1e749f79 |
def _set_extra_headers(self): <NEW_LINE> <INDENT> headers = {} <NEW_LINE> headers.update({'Accept': 'application/vnd.github.squirrel-girl-preview'}) <NEW_LINE> return headers | Set extra headers for session | 625941da0c0af96317bb84a7 |
def seed_for(participant: models.Participant, lottery_key: str) -> str: <NEW_LINE> <INDENT> if not participant.pk: <NEW_LINE> <INDENT> raise ValueError("Can only get seed for participants saved to db!") <NEW_LINE> <DEDENT> return f"{participant.pk}-{lottery_key}-{settings.PRNG_SEED_SECRET}" | Return a seed to deterministically fetch pseudo-random numbers.
We want participants to be ranked based on (mostly) random criteria, but we
also want the ability to deterministically figure the results of a lottery
run in a test run. This method enables us to do both.
The seed must have the following properties:
1. ... | 625941dabf627c535bc1348f |
def read_file(self, file): <NEW_LINE> <INDENT> return self.sftp.open(file, "rb").read() | Read a file from SFTP. | 625941da656771135c3ebb31 |
def __new__(cls, name, *args, **kwargs): <NEW_LINE> <INDENT> if cls.__instance == None: <NEW_LINE> <INDENT> cls.__instance = object.__new__(cls) <NEW_LINE> return cls.__instance <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return cls.__instance | if xxx:
return object.__new__(cls)
else:
return 上一次创建的对象的引用 | 625941da0a366e3fb873eadc |
def set_Units(self, value): <NEW_LINE> <INDENT> InputSet._set_input(self, 'Units', value) | Set the value of the Units input for this Choreo. ((optional, string) The units of the datastream. Leave empty to keep existing Units. Type "BLANK" to clear existing Units. Ex: "Celsius".) | 625941da21bff66bcd684c0f |
def on_double(self, event): <NEW_LINE> <INDENT> index = self.options.curselection()[0] <NEW_LINE> category = self.entries[index] <NEW_LINE> text = help_text.display[category] <NEW_LINE> self.display.config(state = tk.NORMAL) <NEW_LINE> self.display.delete(1.0,tk.END) <NEW_LINE> self.display.insert(tk.INSERT,text) <NEW_... | Return the value selected by user with a double click from listbox
Display cooresponding Help_text dict entry in text box | 625941da7047854f462a16c6 |
def negSamplingCostAndGradient(predicted, target, outputVectors, dataset, K=10): <NEW_LINE> <INDENT> indices = [target] <NEW_LINE> indices.extend(getNegativeSamples(target, dataset, K)) <NEW_LINE> gradPred = np.zeros_like(predicted) <NEW_LINE> grad = np.zeros_like(outputVectors) <NEW_LINE> score = outputVectors[indices... | Negative sampling cost function for word2vec models
Implement the cost and gradients for one predicted word vector
and one target word vector as a building block for word2vec
models, using the negative sampling technique. K is the sample
size.
Note: See test_word2vec below for dataset's initialization.
Arguments/Ret... | 625941da63f4b57ef00013d2 |
def subreads(self, movie=None): <NEW_LINE> <INDENT> if movie: <NEW_LINE> <INDENT> s = movie.sOffs <NEW_LINE> e = movie.sOffs + movie.sLen <NEW_LINE> return self._nSubreads[s:e] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self._nSubreads | Numpy representation of subreads, optionally by movie. Array of alignment lengths. | 625941da71ff763f4b549950 |
def create(self, template_header, bug_info, config_obj_of_jira_relation, config_obj_of_authority, **kwargs): <NEW_LINE> <INDENT> self.request_argues.update({"atl_token": self.headers.get("Cookie").split(";")[0].split("=")[1]}) <NEW_LINE> self.get_main_info() <NEW_LINE> for no, bug_content in bug_info.items(): <NEW_LINE... | 创建jira | 625941da8a43f66fc4b54322 |
def intersect(self, rays): <NEW_LINE> <INDENT> padded_rays = np.atleast_3d(rays) <NEW_LINE> origins = padded_rays[0, :-1] <NEW_LINE> directions = padded_rays[1, :-1] <NEW_LINE> origins_2d = origins[:-1] <NEW_LINE> directions_2d = directions[:-1] <NEW_LINE> a = element_wise_dot( directions_2d, directions_2d, axis=0 ) <N... | For Cylinder intersections first find the intersection point with an infinite cylinder, than check if
the caps are intersected before or after the cylinder | 625941da5166f23b2e1a5419 |
def make_card_deck_list(): <NEW_LINE> <INDENT> card_list = list() <NEW_LINE> with open('./Rook/deck.json', 'r') as f: <NEW_LINE> <INDENT> rook_deck = json.load(f) <NEW_LINE> <DEDENT> rook_deck = rook_deck['ROOK DECK'] <NEW_LINE> for suit, number in rook_deck.items(): <NEW_LINE> <INDENT> for card in rook_deck[suit]: <NE... | This function takes in a dictionary of card suit and value pairs,
creates a list of Card objects and returns it | 625941da30c21e258bdfa75f |
def willr(data): <NEW_LINE> <INDENT> highest = data['High'].rolling(10).max() <NEW_LINE> lowest = data['Low'].rolling(10).min() <NEW_LINE> return (highest - data['Close']) / (highest - lowest) * 100 | Williams %R: Determine where today’s closing price fell within the
range of past 10-day’s transaction.
(highest - Close(t))/(highest - lowest)*100 | 625941da4e4d5625662d4695 |
def check(): <NEW_LINE> <INDENT> with open('sample1_R1.bam_stat.txt', 'r') as handle: <NEW_LINE> <INDENT> results = handle.readlines() <NEW_LINE> <DEDENT> assert results[5].split(':')[0] == 'Total records' <NEW_LINE> assert results[-1] == 'Proper-paired reads map to different chrom:0\n' | check for line lengths and that they are at least different sized | 625941da31939e2706e4d126 |
def twoSum(self, nums, target): <NEW_LINE> <INDENT> dic = {} <NEW_LINE> for i in range(len(nums)): <NEW_LINE> <INDENT> temp = target - nums[i] <NEW_LINE> if temp in dic: <NEW_LINE> <INDENT> return [dic[temp], i] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> dic[nums[i]] = i | :type nums: List[int]
:type target: int
:rtype: List[int] | 625941da97e22403b379d25b |
def contains_key(self, key): <NEW_LINE> <INDENT> hash = self._hash_function(key) <NEW_LINE> hash_index = hash % self.capacity <NEW_LINE> cur_bucket = self._buckets[hash_index] <NEW_LINE> if cur_bucket.contains(key): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False | Searches to see if a key exists within the hash table
Returns:
True if the key is found False otherwise | 625941da30dc7b7665901c24 |
def _set_index_symbol(self, symbol): <NEW_LINE> <INDENT> if symbol not in self._inverse_stack_symbol_d: <NEW_LINE> <INDENT> self._inverse_stack_symbol_d[symbol] = self._counter_symbol <NEW_LINE> self._counter_symbol += 1 <NEW_LINE> <DEDENT> symbol.index_cfg_converter = self._inverse_stack_symbol_d[symbol] | Set the symbol index | 625941da460517430c39443f |
def new_OFDPA_PORT_EVENT_MASK_tp(): <NEW_LINE> <INDENT> return _OFDPA_python.new_OFDPA_PORT_EVENT_MASK_tp() | new_OFDPA_PORT_EVENT_MASK_tp() -> OFDPA_PORT_EVENT_MASK_t * | 625941da3539df3088e2e60b |
def save(self, *args, **kwargs): <NEW_LINE> <INDENT> data = { 'date': self.date_to_pay, 'history': self.name, 'income': 0, 'expenses': self.value, } <NEW_LINE> Cash.objects.create(**data) <NEW_LINE> super(Bill, self).save(*args, **kwargs) | When a BIll is created, a Cash object is created
too. | 625941da2eb69b55b151cb72 |
def encrypt(string,key): <NEW_LINE> <INDENT> alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" <NEW_LINE> if len(key) != len(alphabet): <NEW_LINE> <INDENT> raise ValueError("The length of the key is not equal to the length of alphabet!") <NEW_LINE> <DEDENT> encryptString = "" <NEW_LINE> for letter in st... | This function will encrypt the string based on the key generated | 625941da55399d3f05588975 |
def test_update_user_prefs_situacao(self): <NEW_LINE> <INDENT> user_prefs = UserPrefs( user = self.u, alerta = 'SEMANAL', situacao = 'POSSIVEL CLIENTE' ) <NEW_LINE> self.contatoOK.update(add_to_set__user_prefs=user_prefs) <NEW_LINE> self.contatoOK.save() <NEW_LINE> user_prefs.situacao = 'PROJETO ATIVO' <NEW_LINE> Conta... | Testa a atualização do alerta de um usuário de semanal para mensal
para um determinado contato.
:return: | 625941da6e29344779a628d0 |
def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.help_name = "ouija" <NEW_LINE> self.names = { "ouija", "ouija board", "random words", "message from the other side", } <NEW_LINE> self.help_docs = "Ouija board function. Format: ouija <message>" | Constructor | 625941da07f4c71912b11744 |
@pytest.mark.historian <NEW_LINE> @pytest.mark.forwarder <NEW_LINE> def test_analysis_topic(publish_agent, query_agent): <NEW_LINE> <INDENT> print("\n** test_analysis_topic **") <NEW_LINE> oat_reading = random.uniform(30, 100) <NEW_LINE> mixed_reading = oat_reading + random.uniform(-5, 5) <NEW_LINE> damper_reading = ra... | Test if devices topic message is getting forwarded to historian running on
another instance. Test if topic name substitutions happened.
Publish to topic
'analysis/PNNL/BUILDING_1/Device/MixedAirTemperature' in volttron_instance1 and
query for topic
'PNNL/BUILDING1_ANON/Device/MixedAirTemperature' in volttron_instance2
... | 625941dad8ef3951e32437fe |
def getControllersDictIndex(self): <NEW_LINE> <INDENT> return self._getClassDictIndex(CONTROLLERS_PACKAGE,ControllerTemplate) | Get the index of available controller types
:return: A list of strings of controller type names | 625941da76d4e153a657edf2 |
def OnInit(self): <NEW_LINE> <INDENT> radio_stations = RadioStationList( self._get_config_pathname("radio_stations.xml")) <NEW_LINE> radiodns_services = RadioDnsServiceList( self._get_config_pathname("radiodns_services.xml")) <NEW_LINE> test_radiovis_services = TestRadioVisServiceList( self._get_config_pathname("test_r... | Load data from the config files and create the main window. | 625941dadd821e528d63b468 |
def processData( filename): <NEW_LINE> <INDENT> f = open(filename) <NEW_LINE> restaurantset = set() <NEW_LINE> raterset = set() <NEW_LINE> dictratings = {} <NEW_LINE> for line in f: <NEW_LINE> <INDENT> if "," in line: <NEW_LINE> <INDENT> linesplit = line.split(",") <NEW_LINE> for x in range(0, len(linesplit), 2): <NEW_... | Read data about food and raters and return the
information in a list of restaurants being rated and dictionary
of raters and their ratings of the restaurants. | 625941da0383005118ecf8a2 |
def sample(n, r): <NEW_LINE> <INDENT> rand = random.random <NEW_LINE> population = n <NEW_LINE> for samp in xrange(r, 0, -1): <NEW_LINE> <INDENT> cumprob = 1.0 <NEW_LINE> x = rand() <NEW_LINE> while x < cumprob: <NEW_LINE> <INDENT> cumprob -= cumprob * samp / population <NEW_LINE> population -= 1 <NEW_LINE> <DEDENT> yi... | random samples without replacement, refer to Donald E. Knuth TAOCP sec3.4.2
generate r numbers from [0, n] with order, better mem use than
random.sample | 625941da94891a1f4081bd6b |
def _createdir(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> os.makedirs(self._dir) <NEW_LINE> <DEDENT> except OSError: <NEW_LINE> <INDENT> raise EnvironmentError("Cache directory '%s' does not exist and" " could not be created'" % self._dir) | Tries to create the directories required for the temp file base dir | 625941da435de62698dfdf0d |
def seq2L(p1, p2): <NEW_LINE> <INDENT> return app(_first, p1, p2) | Parser e s (m t) a -> Parser e s (m t) b -> Parser e s (m t) a | 625941dab545ff76a89140d5 |
def string_join(inputs, separator="", name=None): <NEW_LINE> <INDENT> _ctx = _context._context or _context.context() <NEW_LINE> tld = _ctx._thread_local_data <NEW_LINE> if tld.is_eager: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> _result = pywrap_tfe.TFE_Py_FastPathExecute( _ctx._context_handle, tld.device_name, "Stri... | Joins the strings in the given list of string tensors into one tensor;
with the given separator (default is an empty separator).
Examples:
>>> s = ["hello", "world", "tensorflow"]
>>> tf.strings.join(s, " ")
<tf.Tensor: shape=(), dtype=string, numpy=b'hello world tensorflow'>
Args:
inputs: A list of at least 1 `T... | 625941da31939e2706e4d127 |
def validate_handle(handle): <NEW_LINE> <INDENT> package_reg = re.compile(r'^(\w+\.)+\w+$') <NEW_LINE> if package_reg.match(handle) is None: <NEW_LINE> <INDENT> error_msg = _(u'%s is not a valid application handle') % handle <NEW_LINE> raise ValidationError(error_msg) <NEW_LINE> <DEDENT> found_on_gplay = _is_app_in_sto... | Validate the given handle
Check regex, store urls, duplicate queries & total pending queries
:param handle: application handle to validate
:raise ValidationError: if any of the checks fails | 625941da50812a4eaa59c5e0 |
def send_response_full(connection, body, content_type='text/plain; charset=UTF-8', code=200, http_version='HTTP/1.1', headers=None, connection_status='close'): <NEW_LINE> <INDENT> response = generate_response_code(code, http_version=http_version) <NEW_LINE> response = add_response_header('Content-Type', content_type, r... | 发送响应
:param connection_status: 是否关闭
:param connection:
:param http_version:
:param body:
:param content_type:
:param code:
:param headers:
:return: | 625941dabde94217f36830af |
def add_product(self, product): <NEW_LINE> <INDENT> shop_product = self.shopify.Product( attributes={ 'title': product.name, 'body_html': product.description, 'vendor': product.division, } ) <NEW_LINE> created = shop_product.save() <NEW_LINE> shop_product.options = [ { 'name': 'Color', 'position': 1, }, { 'name': 'Size... | Create a new Shopify product from local Product model.
Create a new product on Shopify with a new handle and product id and
return a tuple with the Shopify product and Boolean for creation
success.
returns (Bool created, Obj product) | 625941da26238365f5f0f132 |
def test_invalid_update_news_without_title(self): <NEW_LINE> <INDENT> self.client.force_authenticate(self.superuser) <NEW_LINE> self.data['title'] = "" <NEW_LINE> response = self.client.put(self.url, self.data) <NEW_LINE> self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) | Can't Update news with title empty. | 625941da8e05c05ec3eea637 |
def store_temporary_dataframe( data_frame: pd.DataFrame, workflow, ): <NEW_LINE> <INDENT> table_name = workflow.get_upload_table_name() <NEW_LINE> column_unique = pandas.are_unique_columns(data_frame) <NEW_LINE> pandas.store_table(data_frame, table_name) <NEW_LINE> df_column_types = sql.get_df_column_types(table_name) ... | Store a temporary dataframe.
:param data_frame: Data frame to store
:param workflow: Data frame will belong to this workflow
:return: List of three lists:
- Data frame columns
- Column types (OnTask)
- List of booleans denoting if the column is unique | 625941dad58c6744b4257f1f |
def set_validator(self, validator): <NEW_LINE> <INDENT> self.widget.SetValidator(validator) | Sets the validator for the widget.
| 625941da23e79379d52ee821 |
def supports_descendant_repository_query(self): <NEW_LINE> <INDENT> raise errors.Unimplemented() | Tests if a ``RepositoryQuery`` is available.
return: (boolean) - ``true`` if a repository query is available,
``false`` otherwise
*compliance: mandatory -- This method must be implemented.* | 625941dafb3f5b602dac3956 |
def createEmpires(self): <NEW_LINE> <INDENT> for empireID, myEmpireDict in self.shipBattle.empiresDict.iteritems(): <NEW_LINE> <INDENT> self.jamming[empireID] = 0 <NEW_LINE> myEmpire = empire.Empire(myEmpireDict) <NEW_LINE> myEmpire.setMyGalaxy(self) <NEW_LINE> self.empireEndSim[empireID] = 0 <NEW_LINE> for droneDesign... | Take shipBattle empires dict and add Empires to Simulator | 625941da460517430c394440 |
def __cmp__(self, other): <NEW_LINE> <INDENT> return cmp(self.__index__, other.__index__) | This makes sort() on sequences of widget objects use the _widget_index
for sorting | 625941da507cdc57c6306fa1 |
def scan(self): <NEW_LINE> <INDENT> self.gui.statusLabel.setText('Scanning...') <NEW_LINE> self.gui.statusLabel.repaint() <NEW_LINE> self.gui.dupWidget.clear() <NEW_LINE> self.gui.filesWidget.clear() <NEW_LINE> self.gui.detailsBrowser.setPlainText('') <NEW_LINE> self.gui.selectedWidget.clear() <NEW_LINE> directory = se... | Scan a directory. | 625941dae5267d203edcdf5a |
def wages_from_c200(data_c200, pss_by_year): <NEW_LINE> <INDENT> for earning in ['remuta', 'remutb', 'remutc', 'remu', 'remutot']: <NEW_LINE> <INDENT> data_c200.loc[:, earning] = clean_earning(data_c200.loc[:, earning]) <NEW_LINE> <DEDENT> sal_tranches = data_c200.loc[:, ['remuta', 'remutb', 'remutc']].copy().replace(0... | This function reworks on wages at the c200 level:
- gather information split in different variables (remuxxx)
Hyp: as the cap for tranche C is very high, we consider that sal_brut_deplaf can be
approximate by sal_brut_plaf when missing | 625941da7b180e01f3dc4ab9 |
@app.route("/word_cat/<category_id>", methods=["GET", "POST"]) <NEW_LINE> def word_cat(category_id): <NEW_LINE> <INDENT> category = mongo.db.categories.find_one({"_id": ObjectId(category_id)}) <NEW_LINE> words = list(mongo.db.words.find()) <NEW_LINE> return render_template("word_cat.html", category=category, words=word... | push category and id for category with words in category | 625941da046cf37aa974d006 |
def BackwardMovement(S1,S2): <NEW_LINE> <INDENT> end_pt_S1 = S1[len(S1)-1] <NEW_LINE> starting_pt_S2 = S2[0] <NEW_LINE> Manhattan_dist =np.sum (end_pt_S1-starting_pt_S2) <NEW_LINE> return Manhattan_dist | Return 1 feature Backward Movement
:param S1:
:param S2:
:return: | 625941da8a43f66fc4b54323 |
def get_bool(self, option, argument=None): <NEW_LINE> <INDENT> return bool(self.get(option, argument)) | Get data and coerce to a boolean if necessary. | 625941da30bbd722463cc089 |
def copy(self): <NEW_LINE> <INDENT> return copy.deepcopy(self) | Makes a safe copy of the model. | 625941da21a7993f00bc7fb4 |
def login(self, url, data, fails_with): <NEW_LINE> <INDENT> result = False <NEW_LINE> if self.open(url.encode('utf-8'), post_data=encode_dict(data)): <NEW_LINE> <INDENT> result = True <NEW_LINE> if fails_with in self.content: <NEW_LINE> <INDENT> self.status = 'Wrong username or password' <NEW_LINE> result = False <NEW_... | Login wrapper around ``open``
Args:
url (str): The URL to open
data (dict): POST login data
fails_with (str): String that must **not** be included in the response's content
Returns:
bool: Whether or not login was successful | 625941dad53ae8145f87a52c |
@cli.command() <NEW_LINE> @click.option("--package", help="Installs just the given package from the given control file") <NEW_LINE> @click.option("--dry-run", count=True, default=False, help="Run the command without actually installing packages") <NEW_LINE> @click.argument("control_file") <NEW_LINE> def install(package... | Install runtime-dependencies a debian package | 625941da377c676e91272468 |
def name(self, boolean): <NEW_LINE> <INDENT> return str() | C++ signature:
std::string name(ShipDesign {lvalue},bool)
:param boolean:
:type boolean: bool
:rtype str | 625941da8da39b475bd65237 |
def getColumns(self): <NEW_LINE> <INDENT> return self.columns | Get grid columns count. | 625941da99cbb53fe6792ea7 |
@lpbot.module.rule('.*') <NEW_LINE> @lpbot.module.event('NICK') <NEW_LINE> @lpbot.module.priority('high') <NEW_LINE> @lpbot.module.thread(False) <NEW_LINE> @lpbot.module.unblockable <NEW_LINE> def track_nicks(bot, trigger): <NEW_LINE> <INDENT> old = trigger.nick <NEW_LINE> new = Identifier(trigger) <NEW_LINE> if old ==... | Track nickname changes and maintain our chanops list accordingly. | 625941da435de62698dfdf0e |
def depart_start_of_file(self, node): <NEW_LINE> <INDENT> dprint() <NEW_LINE> self.end_state() | end of a file | 625941da5fcc89381b1e1982 |
def exportAttrsForGlobalViewPoint(self): <NEW_LINE> <INDENT> data = OrderedDict() <NEW_LINE> data['fileType'] = self.fileType <NEW_LINE> data['filename'] = self.filename <NEW_LINE> if self.genomicPlotAxes is not None: <NEW_LINE> <INDENT> data['data-files'] = OrderedDict() <NEW_LINE> for i in range(len(self.genomicPlotA... | Export constant attribute for this plot as dictionary
| 625941daa05bb46b383ecae1 |
def draw_sample(self, random_state=None): <NEW_LINE> <INDENT> return self.draw_samples(1, random_state=random_state)[0] | Draws a single sample value from this parameter.
Parameters
----------
random_state : None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional
A seed or random number generator to use during the sampling
process. ... | 625941daa8ecb033257d338d |
def is_allowed_oauth_client_id(self, client_id): <NEW_LINE> <INDENT> return client_id in self.allowed_client_ids | True if given OAuth2 client_id can be used to authenticate the user. | 625941da293b9510aa2c3554 |
def init(self): <NEW_LINE> <INDENT> if not super(IFCTSHAPEPROFILEDEF,self).init(): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> arg = self.args.getNext() <NEW_LINE> if not isUnset(arg): <NEW_LINE> <INDENT> self.Depth= spfToInteger(arg) <NEW_LINE> <DEDENT> arg = self.args.getNext() <NEW_LINE> if not isUnset(arg)... | get every argument's value and parse inverses | 625941da3617ad0b5ed681b7 |
def pc_input_buffers_full(self, *args): <NEW_LINE> <INDENT> return _blocks_swig5.unpack_k_bits_bb_sptr_pc_input_buffers_full(self, *args) | pc_input_buffers_full(unpack_k_bits_bb_sptr self, int which) -> float
pc_input_buffers_full(unpack_k_bits_bb_sptr self) -> pmt_vector_float | 625941da498bea3a759b9d6f |
def __init__(self): <NEW_LINE> <INDENT> self.Limit = None <NEW_LINE> self.Offset = None <NEW_LINE> self.Filters = None | :param Limit: 返回数量,默认为10,最大值为100。
:type Limit: int
:param Offset: 偏移量,默认为0。
:type Offset: int
:param Filters: 过滤条件。
<li>Keywords - String - 是否必填:否 - 关键字(进程名称)</li>
:type Filters: list of Filter
| 625941da711fe17d82542626 |
def reverseList(self, head): <NEW_LINE> <INDENT> def reverse(head, prev=None): <NEW_LINE> <INDENT> if not head: <NEW_LINE> <INDENT> return prev <NEW_LINE> <DEDENT> node = head.next <NEW_LINE> head.next = prev <NEW_LINE> return reverse(node, head) <NEW_LINE> <DEDENT> return reverse(head) | :type head: ListNode
:rtype: ListNode | 625941da090684286d50efa9 |
@pytest.mark.parametrize("plugin", Plugin_List) <NEW_LINE> def test_workflow_join_1(plugin): <NEW_LINE> <INDENT> nA = Node(inputs={"a": np.array([3, 4, 5])}, mapper="a", joinByKey=["a"], interface=Function_Interface(funA, ["out"]), name="nA") <NEW_LINE> wf = Workflow(nodes=[nA], name="workflow_1", workingdir="{}_test_j... | graph: A | 625941dafff4ab517eb2f6fe |
def generate_csr_with_http_info(self, body, **kwargs): <NEW_LINE> <INDENT> all_params = ['body'] <NEW_LINE> all_params.append('async_req') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW_LINE> all_params.append('_request_timeout') <NEW_LINE> params = locals()... | Generate a New Certificate Signing Request # noqa: E501
Creates a new certificate signing request (CSR). A CSR is encrypted text that contains information about your organization (organization name, country, and so on) and your Web server's public key, which is a public certificate the is generated on the server that... | 625941da85dfad0860c3b11d |
def hadoop_fs_test(stdout, stderr, environ, *args): <NEW_LINE> <INDENT> if len(args) < 1: <NEW_LINE> <INDENT> print('Usage: java FsShell [-test -[ezd] <src>]', file=stderr) <NEW_LINE> <DEDENT> if os.path.exists(hdfs_uri_to_real_path(args[1], environ)): <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <... | Implements hadoop fs -test. | 625941da07f4c71912b11745 |
def generate_3d_assembly_output_file(ai_3d_conf, ai_output_filename, ai_brep=True, ai_stl=False, ai_slice_xyz=[]): <NEW_LINE> <INDENT> print("Compute with FreeCAD the 3D assembly {:s}".format(ai_output_filename)) <NEW_LINE> fc_assembly = figures_to_freecad_assembly(ai_3d_conf) <NEW_LINE> freecad_object_output_file(fc_a... | implement the swith --output_file_basename for 3D assembly
| 625941da5e10d32532c5f1e7 |
def rncg(s, rep=rep01): <NEW_LINE> <INDENT> return rep(ncg(s)) | REGEX: build repeate non-capturing group. | 625941daadb09d7d5db6ca4f |
def truncate(number, decimals=0): <NEW_LINE> <INDENT> if not isinstance(decimals, int): <NEW_LINE> <INDENT> raise TypeError("decimal places must be an integer.") <NEW_LINE> <DEDENT> elif decimals < 0: <NEW_LINE> <INDENT> raise ValueError("decimal places has to be 0 or more.") <NEW_LINE> <DEDENT> elif decimals == 0: <NE... | Returns a value truncated to a specific number of decimal places. | 625941da236d856c2ad44a9e |
def support_jsonp(f): <NEW_LINE> <INDENT> @wraps(f) <NEW_LINE> def decorated_function(*args, **kwargs): <NEW_LINE> <INDENT> callback = flask.request.args.get('callback', False) <NEW_LINE> if callback: <NEW_LINE> <INDENT> content = str(callback) + '(' + str(f(*args,**kwargs)) + ')' <NEW_LINE> return flask.current_app.re... | Wraps JSONified output for JSONP | 625941da6fece00bbac2da02 |
def _csgrstd(rstbrut, csg_taux_plein, _P): <NEW_LINE> <INDENT> plaf_ss = 12*_P.cotsoc.gen.plaf_ss <NEW_LINE> csg = scaleBaremes(_P.csg.retraite, plaf_ss) <NEW_LINE> taux_plein = csg.plein.deduc.calc(rstbrut) <NEW_LINE> taux_reduit = csg.reduit.deduc.calc(rstbrut) <NEW_LINE> csgrstd = csg_taux_plein*taux_plein + not_(cs... | CSG déductible sur les allocations chômage | 625941da1b99ca400220ad73 |
def _relJmp(self, bits, ofs): <NEW_LINE> <INDENT> ofs = asSigned(bits, ofs) <NEW_LINE> ofs *= 2 <NEW_LINE> self.pc += ofs | do a relative jump with a signed offset width given bit width | 625941da5166f23b2e1a541a |
def check_moderator_permission(self, user, community): <NEW_LINE> <INDENT> if not user: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> elif Member.objects.filter( Q(user=user), Q(community=community), Q(status="1"), Q(role="1") | Q(role="0") ).exists(): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <N... | Verifies that user has moderator's rights on the community | 625941da97e22403b379d25c |
@task <NEW_LINE> def snap_participation_households(): <NEW_LINE> <INDENT> run_command('import_snap_participation_households') | fab staging imports.snap_participation_households Import SNAP Participation Households | 625941dac432627299f04f09 |
def get_ticker(self,product): <NEW_LINE> <INDENT> now = datetime.strftime(datetime.utcnow(),'%Y-%m-%dT%H:%M:%S.%fZ') <NEW_LINE> r = requests.get(self.api_url + '/pubticker/' + product) <NEW_LINE> data = loads(r.text) <NEW_LINE> data = self.clean_ticker(data) <NEW_LINE> data["tracker_timestamp"] = now <NEW_LINE> data["p... | Get current tick | 625941dabe7bc26dc91cd8bd |
@app.route('/api/v3/meals', methods=["POST"]) <NEW_LINE> def create_meal(): <NEW_LINE> <INDENT> pass | endpoint for creating a meal item.
---
parameters:
- name: x-access-token
in: header
type: string
required: true
- name: name
required: true
in: formData
type: string
- name: price
in: formData
type: integer
required: true
- name: in_menu
in: formData
type: boolean
... | 625941da57b8e32f5248375e |
def total_weight(p: Program, tower: list) -> int: <NEW_LINE> <INDENT> if not p.children: <NEW_LINE> <INDENT> return p.weight <NEW_LINE> <DEDENT> child_programs = [get_program(s, tower) for s in p.children] <NEW_LINE> child_weight = sum(total_weight(c, tower) for c in child_programs) <NEW_LINE> return p.weight + child_w... | Calculates the sum of the weights of p and all the programs above it. | 625941da50485f2cf553d05c |
def count(self, a, b): <NEW_LINE> <INDENT> delta = (b - a) * self.scale <NEW_LINE> self.sum_delta += delta <NEW_LINE> if delta > 0: <NEW_LINE> <INDENT> self.up += 1 <NEW_LINE> <DEDENT> elif delta < 0: <NEW_LINE> <INDENT> self.down += 1 | Count a pair of values. | 625941dae76e3b2f99f3aac9 |
def setUp(self): <NEW_LINE> <INDENT> get_token(self) <NEW_LINE> ItemMusicalOrganizationFactory.create_batch(6) | Run needed commands to have a fully working project | 625941da1d351010ab855ddd |
def test_get_organization_by_short_name(self): <NEW_LINE> <INDENT> api.add_organization({ 'name': 'local_organization_1ßßß', 'short_name': 'Orgx1', 'description': 'Local Organization 1 Descriptionßßß' }) <NEW_LINE> api.add_organization({ 'name': 'local_organization_2', 'short_name': 'Orgx2', 'description': 'Local Organ... | Unit Test: get_organization_by_short_name | 625941dad164cc6175783010 |
def add_directory(self, directory, with_subdir=False): <NEW_LINE> <INDENT> self._paths = None <NEW_LINE> directory = os.path.abspath(directory) <NEW_LINE> if directory is not None: <NEW_LINE> <INDENT> if with_subdir: <NEW_LINE> <INDENT> directory = os.path.join(directory, self.subdir) <NEW_LINE> <DEDENT> if directory n... | Adds an additional directory to the search path | 625941da7b180e01f3dc4aba |
def resize(self): <NEW_LINE> <INDENT> pass | It is the job of `resize` to appropriately modify the `rely` and `relx`
attributes of each item in `self.contained`. It should also modify the
`max_height` and `max_width` attributes as appropriate. Rarely, if ever,
should this method directly set the `height` and `width` attributes of
its contained Widgets and Contain... | 625941da26068e7796caefa3 |
def insert_event(self, book_name): <NEW_LINE> <INDENT> date = datetime.now() <NEW_LINE> return_date = (date + timedelta(days=7)).strftime("%Y-%m-%d") <NEW_LINE> time_start = "{}T06:00:00+10:00".format(return_date) <NEW_LINE> time_end = "{}T07:00:00+10:00".format(return_date) <NEW_LINE> event = { "summary": "Reminder: Y... | This method creates an event in the users calendar for when they
need to return a book. | 625941da67a9b606de4a8179 |
def check_url_ml(url): <NEW_LINE> <INDENT> normalized_url = UrlNormalize(url) <NEW_LINE> domain = normalized_url.get_hostname() <NEW_LINE> if not check_domain(domain) and not check_ip(domain): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> url_path = normalized_url.get_path() <NEW_LINE> if url_path != '' and url_... | 检测一个字符串是否是url
:param url:
:return: bool,如果该字符串是url返回True,否则返回False | 625941dab830903b967e9bca |
def dag_concurrency_check(parent_dag_name, child_dag_name, args): <NEW_LINE> <INDENT> dag = DAG( '{}.{}'.format(parent_dag_name, child_dag_name), default_args=args, ) <NEW_LINE> dag_concurrency_check_operator = ConcurrencyCheckOperator( task_id='dag_concurrency_check', dag=dag) <NEW_LINE> return dag | dag_concurrency_check is a sub-DAG that will will allow for a DAG to
determine if it is already running, and result in an error if so. | 625941da29b78933be1e5969 |
def get_power_up(self): <NEW_LINE> <INDENT> return self.power_up | Return this block's powerup. | 625941dae1aae11d1e749f7b |
def ticket_update(self, ticket_id, article=None, attachments=None, dynamic_fields=None, **kwargs): <NEW_LINE> <INDENT> if not self.session_id_store.value: <NEW_LINE> <INDENT> raise SessionNotCreated("Call session_create() or " "session_restore_or_set_up_new() first") <NEW_LINE> <DEDENT> self.operation = "TicketUpdate" ... | Update a Ticket
Args:
ticket_id (int): Ticket ID as integer value
article (Article): **optional** one *Article* that will be add to the ticket
attachments (list): list of one or more *Attachment* objects that will
be added to ticket. Also requires an *Article*!
dynamic_fields (list): *DynamicF... | 625941daf8510a7c17cf99bf |
def raw_FFI_lc_download(target_ID, sector, plot_tpf = False, plot_lc = False, save_path = '', from_file = False): <NEW_LINE> <INDENT> if from_file == True: <NEW_LINE> <INDENT> with open('Sector_{}_target_filenames.pkl'.format(sector), 'rb') as f: <NEW_LINE> <INDENT> target_filenames = pickle.load(f) <NEW_LINE> <DEDENT>... | Downloads and returns 30min cadence lightcurves based on SAP analysis of
the raw FFIs | 625941da656771135c3ebb33 |
def get_token_client(): <NEW_LINE> <INDENT> payload = { "grant_type": "client_credentials", "client_id": config.CLIENT_ID, "client_secret": config.CLIENT_SECRET } <NEW_LINE> url = "%s/%s/%s/token" % (config.HOST_SERVER, config.APP_ORG, config.APP_NAME) <NEW_LINE> success, result = requests.post(url, data=json.dumps(pay... | 使用app的client_id和client_secret获取授权token.
client_id 和 client_secret可以在环信管理后台的app详情页面看到
Path: /{org_name}/{app_name}/token
HTTP Method: POST
URL Params: 无
Request Headers: {“Content-Type”:”application/json”}
Request Body:
{
“grant_type”: “client_credentials”,
”client_id”: “{app的client_id}”,
”... | 625941dafff4ab517eb2f6ff |
def play_game(): <NEW_LINE> <INDENT> global key, mouse <NEW_LINE> player_action = None <NEW_LINE> mouse = libtcod.Mouse() <NEW_LINE> key = libtcod.Key() <NEW_LINE> while not libtcod.console_is_window_closed(): <NEW_LINE> <INDENT> libtcod.sys_check_for_event(libtcod.EVENT_KEY_PRESS | libtcod.EVENT_MOUSE, key, mouse) <NE... | play the game | 625941da3617ad0b5ed681b8 |
def companyParse(self): <NEW_LINE> <INDENT> company_oui = {} <NEW_LINE> for oui in self.oui_company: <NEW_LINE> <INDENT> if self.oui_company[oui][0] in company_oui: <NEW_LINE> <INDENT> company_oui[self.oui_company[oui][0]].append(oui) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> company_oui[self.oui_company[oui][0]] =... | generate a company to oui lookup dict | 625941da9b70327d1c4e1097 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.