code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def write_doctree(self, docname, doctree): <NEW_LINE> <INDENT> doctree.reporter = None <NEW_LINE> doctree.transformer = None <NEW_LINE> doctree.settings.warning_stream = None <NEW_LINE> doctree.settings.env = None <NEW_LINE> doctree.settings.record_dependencies = None <NEW_LINE> doctree_filename = self.env.doc2path(doc... | Write the doctree to a file. | 625941cdf8510a7c17cf9804 |
def __init__(self,J=J,incC=C,fC=fC,scaleI=g,syndelay=syndelay,**kwargs): <NEW_LINE> <INDENT> self.J = J <NEW_LINE> self.incC = incC <NEW_LINE> self.fC = fC <NEW_LINE> self.excC = int(fC*incC) <NEW_LINE> self.scaleI = scaleI <NEW_LINE> self.syndelay = syndelay <NEW_LINE> ExcInhNetBase.__init__(self,**kwargs) | Overloads base (parent) class | 625941cd627d3e7fe0d68f57 |
def __contains__(self, x): <NEW_LINE> <INDENT> return x in self.left_cc or x in self.right_cc | EXAMPLES::
sage: from sage.combinat.combinat import Permutations_CC
sage: P = Permutations_CC(3).union(Permutations_CC(2))
sage: [1,2] in P
True
sage: [3,2,1] in P
True
sage: [1,2,3,4] in P
False | 625941cd1b99ca400220abb9 |
def is_prime(n): <NEW_LINE> <INDENT> if ((math.factorial(n - 1) + 1) % n != 0) or (n == 1): <NEW_LINE> <INDENT> prime = True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> prime = False <NEW_LINE> <DEDENT> return prime | >>> is_prime(2)
True
>>> is_prime(11)
True
>>> is_prime(8)
False | 625941cd0383005118ecf6ea |
def genRamped(pset, min_, max_, type_=None): <NEW_LINE> <INDENT> warnings.warn("gp.genRamped has been renamed. Use genHalfAndHalf instead.", FutureWarning) <NEW_LINE> return genHalfAndHalf(pset, min_, max_, type_) | .. deprecated:: 1.0
The function has been renamed. Use :func:`~deap.gp.genHalfAndHalf` instead. | 625941cd566aa707497f4670 |
def stop(self): <NEW_LINE> <INDENT> pass | Stop the module - used to stop own thread.
Called before program exit, may be used to finalize and stop the
separate thread if it is used. Do nothing unless overridden. | 625941cdd268445f265b4f76 |
def tif_to_png(path): <NEW_LINE> <INDENT> im = Image.open(path) <NEW_LINE> name = str(Path(path).parent) + "/" + str(Path(path).stem) <NEW_LINE> print("name:", name) <NEW_LINE> for i, page in enumerate(ImageSequence.Iterator(im)): <NEW_LINE> <INDENT> new_name = name.split('/')[-1] <NEW_LINE> print("new_name:", new_name... | Converte arquivo .tif para png splitando as páginas do documento.
| Parâmetros:
|-- path: Caminho do arquivo. | 625941cd4e4d5625662d44df |
def bake_lazy_loaders(): <NEW_LINE> <INDENT> strategies.LazyLoader._strategy_keys[:] = [] <NEW_LINE> BakedLazyLoader._strategy_keys[:] = [] <NEW_LINE> properties.RelationshipProperty.strategy_for( lazy="select")(BakedLazyLoader) <NEW_LINE> properties.RelationshipProperty.strategy_for( lazy=True)(BakedLazyLoader) <NEW_L... | Enable the use of baked queries for all lazyloaders systemwide.
This operation should be safe for all lazy loaders, and will reduce
Python overhead for these operations. | 625941cd090684286d50eded |
def test_scheduling(self): <NEW_LINE> <INDENT> cts = self.order.order_items() <NEW_LINE> commitment = cts[0] <NEW_LINE> visited = [] <NEW_LINE> process = commitment.generate_producing_process(self.user, visited, explode=True) <NEW_LINE> child_input = process.incoming_commitments()[0] <NEW_LINE> rt = child_input.resourc... | dependent demand explosion scheduling:
The explosion initially schedules everything
backwards from the end due date,
using ProcessType.estimated_duration.
Sometimes this will backschedule into the past,
especially if considering purchase lead times.
So those elements will need to be forward-scheduled,
which will move ... | 625941cd6fece00bbac2d846 |
def get_page(url): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> with urllib.request.urlopen(url) as url_file: <NEW_LINE> <INDENT> print(type(url_file)) <NEW_LINE> print(type(url_file.read)) <NEW_LINE> decoded_page = url_file.read().decode('UTF-8') <NEW_LINE> print(type(decoded_page)) <NEW_LINE> <DEDENT> return decoded_... | Gets a decoded page from the URL
Parameter:
url (string): url of the page to retrieve
Returns:
string containing the decoded page, or a blank string for errors | 625941cd4e696a04525c9553 |
def _is_custom_qs_manager(funcdef): <NEW_LINE> <INDENT> decors = getattr(funcdef, 'decorators', None) <NEW_LINE> if decors: <NEW_LINE> <INDENT> for dec in decors.get_children(): <NEW_LINE> <INDENT> attrname = 'name' if hasattr(dec, 'name') else 'attrname' <NEW_LINE> qs_name = 'queryset_manager' <NEW_LINE> try: <NEW_LIN... | Checks if a function definition is a queryset manager created
with the @queryset_manager decorator. | 625941cd3617ad0b5ed67fff |
def get_json_queue() -> list: <NEW_LINE> <INDENT> queue: List[YoutubeAudio] = player._queue.queue <NEW_LINE> return [dictify_YoutubeAudio(a) for a in queue] | Returns a JSON-friendly representation of the queue
:return: list | 625941cdb57a9660fec3398c |
def graph_search(problem, fringe): <NEW_LINE> <INDENT> closed = {} <NEW_LINE> fringe.append(Node(problem.initial)) <NEW_LINE> max_depth=0 <NEW_LINE> while fringe: <NEW_LINE> <INDENT> node = fringe.pop() <NEW_LINE> if node.depth>max_depth: <NEW_LINE> <INDENT> max_depth=node.depth <NEW_LINE> if max_depth<50 or max_depth ... | Search through the successors of a problem to find a goal.
The argument fringe should be an empty queue.
If two paths reach a state, only use the best one. [Fig. 3.18] | 625941cd3539df3088e2e452 |
def select_exports(self, request, queryset): <NEW_LINE> <INDENT> selected = ','.join(request.POST.getlist(admin.ACTION_CHECKBOX_NAME)) <NEW_LINE> regions = Region.objects.all() <NEW_LINE> return render_to_response(self.update_template, { 'regions': regions, 'selected': selected, 'opts': self.model._meta, }, context_ins... | Select exports to update. | 625941cd099cdd3c635f0d62 |
def rakuten_merge_email(old_value, new_value): <NEW_LINE> <INDENT> if old_value is None: <NEW_LINE> <INDENT> old_value = '' <NEW_LINE> <DEDENT> if new_value is None: <NEW_LINE> <INDENT> new_value = '' <NEW_LINE> <DEDENT> return ','.join(set(f'{old_value},{new_value}'.split(','))) | 乐天,合并邮箱字段
:param old_value:
:param new_value:
:return: | 625941cd91f36d47f21ac5fb |
def user_has_group(test_func): <NEW_LINE> <INDENT> def decorator(view_func): <NEW_LINE> <INDENT> @wraps(view_func, assigned=WRAPPER_ASSIGNMENTS) <NEW_LINE> def _wrapped_view(request, *args, **kwargs): <NEW_LINE> <INDENT> if test_func(request.user): <NEW_LINE> <INDENT> return view_func(request, *args, **kwargs) <NEW_LIN... | Decorator for views that checks that the user has the group,
raising HttpResponseForbidden page if necessary. The test should be a callable
that takes the user object and returns True if the user passes. | 625941cd82261d6c526ab5a7 |
def split_brick_into_tetrahedra (macroel_raw): <NEW_LINE> <INDENT> nodes = np.array(macroel_raw[1:-1]).reshape(3,(len(macroel_raw)-2)//3,order='F') <NEW_LINE> positions_encoding = bit_arrays(nodes) <NEW_LINE> singular_vertex_position = octant_encoding[np.where(positions_encoding==0)[0][0]] <NEW_LINE> pi ... | nodes: the array of eight vertices of an hexahedron which
has faces parallel to the axes. The columns of this input
array may be in any order, as long as the first one remains as
_the singular vertex_ (if any singular vertex is present in this
part of the mesh), and the program performs the local graduation towards
tha... | 625941cddc8b845886cb563c |
def uncategorizedimages_address(self, n=500): <NEW_LINE> <INDENT> return self.family.uncategorizedimages_address(self.lang, n) | Return path to Special:Uncategorizedimages. | 625941cd2c8b7c6e89b358c8 |
def show_pipelines(selection: Sequence[str], as_json=False) -> None: <NEW_LINE> <INDENT> pipelines = list_pipelines(selection) <NEW_LINE> if not pipelines: <NEW_LINE> <INDENT> if selection: <NEW_LINE> <INDENT> logger.warning("Found no pipelines matching glob pattern") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> logge... | List the currently installed pipelines, possibly using a subset based on the selection pattern.
Without a selection, prints an overview of the pipelines.
With selection of a single pipeline, digs into details of that selected pipeline.
If "as json" is chosen, then the output is JSON-formatted
and includes all fields,... | 625941cd4f88993c3716c16f |
def test1D(self): <NEW_LINE> <INDENT> self.assertAlmostEqual(self.comp.run(0.001),100.751, 2) | Test 1D model for a Lorentz Model | 625941cdcdde0d52a9e5313b |
def convert(view_width, view_height, df): <NEW_LINE> <INDENT> max_value = df.values.max() <NEW_LINE> min_value = df.values.min() <NEW_LINE> df = df - min_value <NEW_LINE> df = df / (max_value -min_value) <NEW_LINE> df = df * (view_height -10) + 5 <NEW_LINE> lines = [] <NEW_LINE> for i in range(len(df.columns)): <NEW_LI... | 转换值到屏幕点, pyglet的视图是以左下角为0,0
return: list df的每一列 [[x,y],...] | 625941cda8370b77170529a7 |
def AddSpinner(varSizer,label,SelCtrl,binding): <NEW_LINE> <INDENT> SelCtrl.Bind(wx.EVT_COMBOBOX,binding) <NEW_LINE> varSizer.Add(wx.StaticText(self,label=label)) <NEW_LINE> varSelSizer = wx.BoxSizer(wx.HORIZONTAL) <NEW_LINE> varSelSizer.Add(SelCtrl,0) <NEW_LINE> varSpin = wx.SpinButton(self,style=wx.SP_VERTICAL) <NEW_... | Add a label and a SpinButton to a Combo widget (SelCtrl)
Saves a pointer to the combo widget and the callback used by that widget | 625941cd1f5feb6acb0c4c58 |
def parse_duration(datestring): <NEW_LINE> <INDENT> if not isinstance(datestring, basestring): <NEW_LINE> <INDENT> raise TypeError("Expecting a string %r" % datestring) <NEW_LINE> <DEDENT> match = ISO8601_PERIOD_REGEX.match(datestring) <NEW_LINE> if not match: <NEW_LINE> <INDENT> if datestring.startswith("P"): <NEW_LIN... | Parses an ISO 8601 durations into datetime.timedelta or Duration objects.
If the ISO date string does not contain years or months, a timedelta instance
is returned, else a Duration instance is returned.
The following duration formats are supported:
-PnnW duration in weeks
-PnnYnnMnnDTnnHnnMnnS c... | 625941cdff9c53063f47c2fb |
def emoji_to_db(emoji): <NEW_LINE> <INDENT> emoji_type = "normal" <NEW_LINE> emoji_stored_value = emoji <NEW_LINE> if isinstance(emoji, discord.Emoji): <NEW_LINE> <INDENT> emoji_type = "custom" <NEW_LINE> emoji_stored_value = emoji.id <NEW_LINE> <DEDENT> return emoji_type, emoji_stored_value | Given a discord.Emoji object, extract its type and its ID if applicable.
:param emoji: a discord.Emoji object
:return: | 625941cd8e05c05ec3eea47c |
def _matrix_to_euler(self, rotmat): <NEW_LINE> <INDENT> ex = np.array([[1], [0], [0]]) <NEW_LINE> ez = np.array([[0], [0], [1]]) <NEW_LINE> exs = rotmat.T @ ex <NEW_LINE> ezs = rotmat.T @ ez <NEW_LINE> enodes = np.cross(ez.T, ezs.T).T <NEW_LINE> if np.linalg.norm(enodes) < 1e-10: <NEW_LINE> <INDENT> enodes = exs <NEW_L... | Returns three Euler angles alpha, beta, gamma (in radians) from a
rotation matrix. | 625941cd96565a6dacc8f7d3 |
def search_person(self, name, results=None): <NEW_LINE> <INDENT> if results is None: <NEW_LINE> <INDENT> results = self._results <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> results = int(results) <NEW_LINE> <DEDENT> except (ValueError, OverflowError): <NEW_LINE> <INDENT> results = 20 <NEW_LINE> <DEDENT> res = self._se... | Return a list of Person objects for a query for the given name.
The results argument is the maximum number of results to return. | 625941cda4f1c619b28b0141 |
def _acceptable(self, team): <NEW_LINE> <INDENT> current = [c for c in self.configurations if self._validateNoSpies(c, team)] <NEW_LINE> return bool(len(current) > 0) | Determine if this team is an acceptable one to vote for... | 625941cd56b00c62f0f14761 |
def testMapMetadataId(self): <NEW_LINE> <INDENT> self.assertEquals(identifier_mapping.mapMetadataId("logicalId"), (_datafinderNamespace, "logicalId")) <NEW_LINE> self.assertEquals(identifier_mapping.mapMetadataId(None), (_datafinderNamespace, None)) <NEW_LINE> self.assertEquals(identifier_mapping.mapMetadataId(CREATION... | Demonstrates the behavior of the mapMetadataId function. | 625941cdd164cc6175782e55 |
def restart_program(): <NEW_LINE> <INDENT> os.execv(sys.executable, ['sudo python'] + sys.argv) | Restarts the current program.
Note that this function does not return. Any cleanup action, like
saving data, must be done before calling this function. | 625941cdf7d966606f6aa10c |
def getItemAt(self, pos:'QPointF'): <NEW_LINE> <INDENT> return self.getView().itemAt(pos) | Shortcut for retrieving item at provided `Scene` position
:param pos: scene position
:type pos: ``QPointF``
:return: Qt Graphics Item at scene position
:rtype: ``QGraphicsItem`` | 625941cd07f4c71912b1158a |
def visit_module(self, node): <NEW_LINE> <INDENT> with open(node.file) as mod_fh: <NEW_LINE> <INDENT> for idx, line in enumerate(mod_fh.read().split(os.linesep)): <NEW_LINE> <INDENT> line = line.strip() <NEW_LINE> if line.endswith("\\") and "with " not in line and not line.startswith("#"): <NEW_LINE> <INDENT> self.add_... | Unnecessary backslashes.
:param node:
:return: | 625941cd30c21e258bdfa5a5 |
def polyval2d(x, y, m): <NEW_LINE> <INDENT> order = int(np.sqrt(len(m))) - 1 <NEW_LINE> ij = itertools.product(range(order+1), range(order+1)) <NEW_LINE> z = np.zeros_like(x) <NEW_LINE> for a, (i,j) in zip(m, ij): <NEW_LINE> <INDENT> z += a * x**i * y**j <NEW_LINE> <DEDENT> return z | Returns a 2-dim array of values with the parameters m from 'polyfit2d'.
e.g.: m = [a00,a01,a02,a03,a10,a11,a12,a13,a20,.....,a33] for order=3 | 625941cd21bff66bcd684a5b |
def validate(self): <NEW_LINE> <INDENT> examples = self.sorted_intent_examples() <NEW_LINE> for intent, group in groupby(examples, lambda e: e["intent"]): <NEW_LINE> <INDENT> size = len(list(group)) <NEW_LINE> if size < self.MIN_EXAMPLES_PER_INTENT: <NEW_LINE> <INDENT> template = u"Intent '{0}' has only {1} training ex... | Ensures that the loaded training data is valid, e.g. has a minimum of certain training examples. | 625941cd0c0af96317bb82f0 |
def set_livesettings_value(group_name, value_name, value): <NEW_LINE> <INDENT> mgr = ConfigurationSettings() <NEW_LINE> config_field = mgr.get_config(group_name, value_name) <NEW_LINE> config_field.update(value) | Gives ability to Set livesettings config values from code. | 625941cde8904600ed9f2035 |
def parse(src): <NEW_LINE> <INDENT> rt = libparser.parse(byref(post), src) <NEW_LINE> return ( rt, string_at(post.title, post.tsz), string_at(post.tpic, post.tpsz), post.body ) | Note: src should be ascii string | 625941cd44b2445a3393219e |
@json_view <NEW_LINE> def create(request): <NEW_LINE> <INDENT> data, code, valid = validator.create(request) <NEW_LINE> if valid: <NEW_LINE> <INDENT> if settings.ENV == 'production': <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> data, code, item = resource.create(request) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> ... | Create record | 625941cdd18da76e235325de |
def patch(self, path, data='', content_type='application/octet-stream', follow=False, secure=False, **extra): <NEW_LINE> <INDENT> response = super().patch(path, data=data, content_type=content_type, secure=secure, **extra) <NEW_LINE> if follow: <NEW_LINE> <INDENT> response = self._handle_redirects(response, data=data, ... | Send a resource to the server using PATCH. | 625941cdc4546d3d9de72b3c |
def get_datastore(self): <NEW_LINE> <INDENT> return self.plugins[DATASTORE_KEY] | Simple 'getter'
return: The loaded Datastore plugin implementation
rtype: elasticd.plugins.Datastore | 625941cd23e79379d52ee66c |
def findFirstSubstringOccurrence(s, x): <NEW_LINE> <INDENT> patt = x <NEW_LINE> text = s <NEW_LINE> if not patt or not text: <NEW_LINE> <INDENT> return -1 <NEW_LINE> <DEDENT> tbl = [0] * (1 + len(patt)) <NEW_LINE> i = 1; j = 0 <NEW_LINE> while i < len(patt): <NEW_LINE> <INDENT> if patt[i] == patt[j]: <NEW_LINE> <INDENT... | Find the first occurrances of @patt in @text
| 625941cd187af65679ca5227 |
def archieve_venv(filename, venv_path): <NEW_LINE> <INDENT> with tarfile.open(filename + '.tar.gz', 'w:gz') as tarf: <NEW_LINE> <INDENT> tarf.add(venv_path, arcname=os.path.basename(venv_path)) <NEW_LINE> tarf.close() | This method archieves a venv defined on :venv_path, producing a tar.gz file
with the :filename provided | 625941cda8ecb033257d31d5 |
def compile_play_args_to_animation_list(self, *args, **kwargs): <NEW_LINE> <INDENT> animations = Scene.compile_play_args_to_animation_list(self, *args, **kwargs) <NEW_LINE> if not self.any_pi_creatures_on_screen(): <NEW_LINE> <INDENT> return animations <NEW_LINE> <DEDENT> non_pi_creature_anims = [anim for anim in anima... | Add animations so that all pi creatures look at the
first mobject being animated with each .play call | 625941cd0a50d4780f666f9b |
def findWords(self, words): <NEW_LINE> <INDENT> row_1 = 'qwertyuiop' <NEW_LINE> row_2 = 'asdfghjkl' <NEW_LINE> row_3 = 'zcxvbnm' <NEW_LINE> rows = [row_1, row_2, row_3] <NEW_LINE> results = [] <NEW_LINE> for word in words: <NEW_LINE> <INDENT> for row in rows: <NEW_LINE> <INDENT> all_in = True <NEW_LINE> for c in word: ... | :type words: List[str]
:rtype: List[str] | 625941cd76d4e153a657ec39 |
def p_general_21(p): <NEW_LINE> <INDENT> p[0] = Node("cout"," ") | general : ENDL DOBLEMENORQUE ENDL | 625941cdad47b63b2c50a088 |
def Rscript(command, env={}, envAsArgs=True, R_HOME="", verbose=False): <NEW_LINE> <INDENT> Rscript = "RScript" <NEW_LINE> environ = os.environ <NEW_LINE> if environ["R_HOME"]: <NEW_LINE> <INDENT> Rscript = '"'+ environ["R_HOME"] + '/RScript"' <NEW_LINE> <DEDENT> elif R_HOME: <NEW_LINE> <INDENT> Rscript = '"'+ R_HOME ... | Rscript - call rscript interpreter
- we need to retun a JSON string from R script in the stdout
- (es: print {"success":"true","data":5} ) | 625941cd5fdd1c0f98dc033c |
@app.route('/') <NEW_LINE> @app.route('/entries') <NEW_LINE> def index(): <NEW_LINE> <INDENT> stream = models.Entry.select().limit(100) <NEW_LINE> return render_template('index.html', stream=stream) | Shows a list of recent entries. | 625941cd0383005118ecf6eb |
def soil_diff_millington_1959(Da_d1_d2, af_poros, poros=None, S=None): <NEW_LINE> <INDENT> Ds_Da_d1_d2 = (af_poros**(4/3)) * Da_d1_d2 <NEW_LINE> return Ds_Da_d1_d2 | Calculation of gas DIFFUSIVITY in the soil based on the Millington 1959
model. Requires an air-filled porosity value and a free-air gas diffusivity
value (which may be T and P corrected) | 625941cdc4546d3d9de72b3d |
@treeio_login_required <NEW_LINE> @handle_response_format <NEW_LINE> def order_view(request, order_id, response_format='html'): <NEW_LINE> <INDENT> profile = request.user.profile <NEW_LINE> order = get_object_or_404(SaleOrder, pk=order_id) <NEW_LINE> form = _do_update_record(profile, request, order) <NEW_LINE> if form.... | SaleOrder view | 625941cd60cbc95b062c664c |
def print_grid(grid): <NEW_LINE> <INDENT> for l in grid: <NEW_LINE> <INDENT> stdout.write('|') <NEW_LINE> for v in l: <NEW_LINE> <INDENT> stdout.write(" " + str(v)) <NEW_LINE> <DEDENT> stdout.write(' |\n') | Print grid | 625941cd15fb5d323cde0c18 |
def lift_get_position(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!') | Missing associated documentation comment in .proto file | 625941cdcb5e8a47e48b7bb3 |
def _populate_instance_for_create(self, context, instance, image, index, security_groups, instance_type): <NEW_LINE> <INDENT> if not instance.obj_attr_is_set('uuid'): <NEW_LINE> <INDENT> instance.uuid = str(uuid.uuid4()) <NEW_LINE> <DEDENT> instance.launch_index = index <NEW_LINE> instance.vm_state = vm_states.BUILDING... | Build the beginning of a new instance. | 625941cda05bb46b383ec92a |
def apply_policy(s): <NEW_LINE> <INDENT> global Policy <NEW_LINE> best = Policy[s] <NEW_LINE> return best | Return the action that your current best policy implies for state s. | 625941cd92d797404e304292 |
def calcDropSkillsParams(self, tmanCompDescrPickle, xpReuseFraction): <NEW_LINE> <INDENT> tmanCompDescr = pickle.loads(tmanCompDescrPickle) <NEW_LINE> tmanDescr = tankmen.TankmanDescr(tmanCompDescr) <NEW_LINE> tmanDescr.dropSkills(xpReuseFraction) <NEW_LINE> tankman = Tankman(tmanDescr.makeCompactDescr()) <NEW_LINE> re... | Recalculates tankman skills by given skills reuse fraction
@param tmanCompDescr: tankman string compact descriptor
@param xpReuseFraction: tankman experience reuse fraction
@return: (new skills count, last new skill level) | 625941cd76d4e153a657ec3a |
def find_nearby_stations(wundata): <NEW_LINE> <INDENT> nearby = [] <NEW_LINE> stationlist = wundata['location']['nearby_weather_stations']['pws']['station'] <NEW_LINE> for station in stationlist: <NEW_LINE> <INDENT> nearby.append((int(station['distance_mi']), station)) <NEW_LINE> <DEDENT> return nearby | Extract the nearby stations info in the wunderground data
into a sorted list. | 625941cd99cbb53fe6792cef |
def setWindow_(self, the_window): <NEW_LINE> <INDENT> self.window = the_window | Store our parent window | 625941cd94891a1f4081bbb2 |
def get_property_values(self, props): <NEW_LINE> <INDENT> return [self.get_property_value(prop) for prop in props] | Get the values of the specified properties
:param props: list of Properties
: return: NamedTuple with properties name and their values | 625941cd92d797404e304293 |
def convert_table_row(self, row): <NEW_LINE> <INDENT> row.replace_with(self.unwrap_contents(row) + '|\n') | convert_table_row
:param row: | 625941cd56ac1b37e62642d8 |
def help_text(self, event): <NEW_LINE> <INDENT> if event == 'Input Data': <NEW_LINE> <INDENT> text = texts(arg='ID') <NEW_LINE> self.ids.label.text = text <NEW_LINE> <DEDENT> elif event == 'Function Type': <NEW_LINE> <INDENT> text = texts(arg='C') <NEW_LINE> self.ids.label.text = text <NEW_LINE> <DEDENT> elif event == ... | takes button information and updates the popup text.
::
:param event: (str)
the string id of the pressed button.
::
:return: (none)
updates the GUI display without returning information to the class.
| 625941cdac7a0e7691ed41d5 |
def _get_languages(self): <NEW_LINE> <INDENT> term = [('translatable', '=', True)] <NEW_LINE> langs = self.env['res.lang'].search(term) <NEW_LINE> return [l.code for l in langs] | Hook method for languages to retrieve
:returns: list of language codes | 625941cd66656f66f7cbc2b4 |
def is_an_empty_group(self): <NEW_LINE> <INDENT> child_count = self.childCount() <NEW_LINE> if child_count == 0: <NEW_LINE> <INDENT> return self.item_data.node_type == PluginGlobals.instance().NODE_TYPE_FOLDER <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> for i in range(child_count): <NEW_LINE> <INDENT> if not self.chi... | Indicates if this item is an empty group | 625941cd4f6381625f114b44 |
def setTitle(title): <NEW_LINE> <INDENT> pass | simply set the title to a given value. Very primitive!
| 625941cdf7d966606f6aa10d |
def do_get_container(self, account_name, container_name): <NEW_LINE> <INDENT> (objects,) = self.conn.execute(sql.select([ sql.count('*'), ]).where( sql.objects.c.account == account_name ).where( sql.objects.c.container == container_name ).where( sql.objects.c.deleted == False )).fetchone() <NEW_LINE> if objects == 0: <... | Handle container-level GET operations. | 625941cd76e4537e8c35177c |
def encode_pubkey_entry(key): <NEW_LINE> <INDENT> if isinstance(key, keylib.ECPrivateKey): <NEW_LINE> <INDENT> pubkey = key.public_key() <NEW_LINE> <DEDENT> elif isinstance(key, keylib.ECPublicKey): <NEW_LINE> <INDENT> pubkey = key <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise NotImplementedError("No support for ... | key should be a key object, right now this means
keylib.ECPrivateKey or
keylib.ECPublicKey | 625941cd5fc7496912cc3a87 |
def test_set_dataio(self): <NEW_LINE> <INDENT> dataio = DataIO() <NEW_LINE> data = np.arange(30).reshape(5, 2, 3) <NEW_LINE> container = Data('wrapped_data', data) <NEW_LINE> container.set_dataio(dataio) <NEW_LINE> self.assertIs(dataio.data, data) <NEW_LINE> self.assertIs(dataio, container.data) | Test that Data.set_dataio works as intended | 625941cdaad79263cf390b4a |
def makeTable(self): <NEW_LINE> <INDENT> table = self.cotizacion.makeCotizacionTable() <NEW_LINE> subtotal = self.cotizacion.getSubtotal() <NEW_LINE> descuentos = -self.cotizacion.getDescuentos() <NEW_LINE> total = self.cotizacion.getTotal() <NEW_LINE> table_style = [] <NEW_LINE> for i, row in enumerate(table): <NEW_LI... | Función que genera la tabla en donde se enlistan los servicios, sus códigos, cantidad, precio unitatio,
precio total, el subtotal, el descuento total y el total a pagar | 625941cd851cf427c661a618 |
def _load_yaml_from_disk(self, path): <NEW_LINE> <INDENT> with open(path, 'r') as fh: <NEW_LINE> <INDENT> return yaml.load(fh, Loader=yaml.FullLoader) | Load a YAML file from disk and return the contents.
:param path: path to load from
:type path: str
:return: deserialized YAML file contents
:rtype: dict | 625941cd0c0af96317bb82f1 |
def test_get_status(self) -> None: <NEW_LINE> <INDENT> self.test_try_to_query_status_from_syntax_lookup() <NEW_LINE> actual = self.checker.get_status() <NEW_LINE> self.assertIsInstance(actual, AvailabilityCheckerStatus) | Tests the method that let us get the whole status object. | 625941cd7047854f462a1513 |
def clean_obsolete(): <NEW_LINE> <INDENT> obsolete_indexes = filter_dates() <NEW_LINE> for i in obsolete_indexes: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> es.indices.delete(i) <NEW_LINE> <DEDENT> except NotFoundError as e: <NEW_LINE> <INDENT> print(e) | Function purge obsolete indexes | 625941cd8e71fb1e9831d8b2 |
def get_password(self, interactive=False): <NEW_LINE> <INDENT> if interactive and not self.password: <NEW_LINE> <INDENT> self.password = click.prompt("password", hide_input=True, type=str) <NEW_LINE> <DEDENT> return self.password | user password | 625941cd656771135c3eb978 |
def drop_unique_constraint(migrate_engine, table_name, uc_name, *columns, **col_name_col_instance): <NEW_LINE> <INDENT> if migrate_engine.name == "sqlite": <NEW_LINE> <INDENT> _drop_unique_constraint_in_sqlite(migrate_engine, table_name, uc_name, **col_name_col_instance) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> me... | Drop unique constraint.
This method drops UC from table and works for mysql, postgresql and sqlite.
In mysql and postgresql we are able to use "alter table" constuction. In
sqlite is only one way to drop UC:
1) Create new table with same columns, indexes and constraints
(except one that we want to drop).
... | 625941cd9c8ee82313fbb87e |
def closeEvent(self, _e: QCloseEvent) -> None: <NEW_LINE> <INDENT> data = self._widget.saveGeometry().data() <NEW_LINE> geom = base64.b64encode(data).decode('ASCII') <NEW_LINE> configfiles.state['inspector']['window'] = geom | Save the geometry when closed. | 625941cd9f2886367277a996 |
def import_list(lst): <NEW_LINE> <INDENT> global DATA <NEW_LINE> DATA = lst[:] <NEW_LINE> return None | Add all the elements of the list 'lst' to DATA
Make sure this does not modify the input list 'lst' | 625941cd293b9510aa2c33a0 |
def load(name): <NEW_LINE> <INDENT> data = [] <NEW_LINE> filename = get_full_pathname(name) <NEW_LINE> if os.path.exists(filename): <NEW_LINE> <INDENT> with open(filename) as fin: <NEW_LINE> <INDENT> for entry in fin.readlines(): <NEW_LINE> <INDENT> data.append(entry.rstrip()) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> retu... | This method creates and loads a new journal.
:param name: The base name of the journal to load
:return: A new journal data structure populated with the file data | 625941cd73bcbd0ca4b2c17f |
@module.commands('magic') <NEW_LINE> def magic(bot, trigger): <NEW_LINE> <INDENT> if trigger.group(2): <NEW_LINE> <INDENT> bot.say('(\u2229 \u0361\u00B0 \u035C\u0296 \u0361\u00B0)\u2283\u2501\u2606\uFF9F. * \uFF65 \uFF61\uFF9F, * ' + trigger.group(2).strip()) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> bot.say('(\u22... | .magic [target] - Cast your magic wand! | 625941cd26238365f5f0ef77 |
def setUp(self): <NEW_LINE> <INDENT> self.LL = Linked_List() | Inits LL. | 625941cd287bf620b61d3b6d |
def fill_record_proceedings(r, entry): <NEW_LINE> <INDENT> _require_keys_in_entry(entry, ('title', 'year'), req_all=True) <NEW_LINE> _simple_fill(r, entry, ('title', 'year', 'volume', 'number', 'series', 'address', 'month', 'organization', 'note', 'key')) <NEW_LINE> _fill_editor(r, entry) <NEW_LINE> _fill_publisher(r, ... | handle 'proceedings' type
:param r: BibJSON record dict that will be filled
:param entry: bibtexparser entry that will be used to fill the BibJSON record
:return None | 625941cd5166f23b2e1a5262 |
def _iou_calculate(self, boxes1, boxes2): <NEW_LINE> <INDENT> with tf.name_scope('iou_calculate'): <NEW_LINE> <INDENT> ymin_1, xmin_1, ymax_1, xmax_1 = tf.split(boxes1, 4, axis=1) <NEW_LINE> ymin_2, xmin_2, ymax_2, xmax_2 = tf.unstack(boxes2, axis=1) <NEW_LINE> max_xmin, max_ymin = tf.maximum(xmin_1, xmin_2), tf.maximu... | Calculates the IOU of two boxes
:param boxes1: [n, 4] [ymin, xmin, ymax, xmax]
:param boxes2: [n, 4]
:return: Overlaps of each box pair (aka DICE score) | 625941cd435de62698dfdd56 |
def test_recipe_creation_with_empty_recipe_fields(self): <NEW_LINE> <INDENT> recipes = {"recipe_name": "", "recipe_procedure": ""} <NEW_LINE> response = self.client().post('/category/1/recipes/', headers={'x-access-token': self.access_token}, data=recipes) <NEW_LINE> self.assertEqual(response.status_code, 400) <NEW_LIN... | Test if the the recipe registration will be successful when any form field is empty
| 625941cd15baa723493c407f |
def get_donor(): <NEW_LINE> <INDENT> response = 'list' <NEW_LINE> while response == 'list': <NEW_LINE> <INDENT> response = input('\nWhat is the full name of the donor to whom you ' + 'would like to send a thank you?\nAlternatively, ' + 'type "list" for a list of current donors ' + 'or "q" to quit back to main menu.\n>>... | Get and return user input donor name | 625941cdbf627c535bc132d8 |
def __init__(self, color, initial_position): <NEW_LINE> <INDENT> ChessPiece.__init__(self, color, initial_position) <NEW_LINE> row, col = initial_position <NEW_LINE> self.name = 'King' <NEW_LINE> self.short_name = 'K' <NEW_LINE> self.may_jump = False <NEW_LINE> if color == 'white': <NEW_LINE> <INDENT> self.castle_field... | Create knight. | 625941cdd268445f265b4f78 |
def begin(self): <NEW_LINE> <INDENT> success = False <NEW_LINE> success &= self.query_model_str() <NEW_LINE> success &= self.query_fluid_name() <NEW_LINE> success &= self.query_max_flow_rate() <NEW_LINE> success &= self.query_setpoint() <NEW_LINE> success &= self.query_flow_rate() <NEW_LINE> return success | This function should run directly after having established a
connection to the device.
Query the model, fluid and the maximum mass flow rate of the MFC
and store these in the class member 'state's. The max flow rate is
mandatory to be known, because it is used to set and read the setpoint,
and to read the flow rate.
... | 625941cd566aa707497f4672 |
def intersection(a1, b1, c1, a2, b2, c2): <NEW_LINE> <INDENT> x = (c1*b2 - c2*b1) / (a1*b2 - a2*b1) <NEW_LINE> y = (a1*c2 - a2*c1) / (a1*b2 - a2*b1) <NEW_LINE> return x, y | Finds the intersection point of two lines. | 625941cd0383005118ecf6ec |
def __init__(self, target, echo=None, escape=None): <NEW_LINE> <INDENT> Socket._last_socket = self <NEW_LINE> if isinstance(target, (tuple, str)): <NEW_LINE> <INDENT> self.sock = socket.create_connection(target) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.sock = target <NEW_LINE> <DEDENT> if echo is None: <NEW_L... | Create a new socket connected to the target. | 625941cdf548e778e58cd687 |
def fl_format_syntax(node): <NEW_LINE> <INDENT> syntag = node.find("syntax") <NEW_LINE> if syntag is None: <NEW_LINE> <INDENT> return '' <NEW_LINE> <DEDENT> typetag = syntag[0] <NEW_LINE> if typetag.tag == "type": <NEW_LINE> <INDENT> mod_name = typetag.get("module") <NEW_LINE> name = typetag.get("name") <NEW_LINE> retu... | create string expression of syntax (mib data type)
input:
node: an Element which as "syntax" child element
return:
string | 625941cd8e7ae83300e4b0d6 |
def Flush(self): <NEW_LINE> <INDENT> if not self.batch: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> self.SendBatch() <NEW_LINE> <DEDENT> except urllib.error.HTTPError as err: <NEW_LINE> <INDENT> if err.code != 404: <NEW_LINE> <INDENT> raise <NEW_LINE> <DEDENT> logging.info('Old server detect... | Flush the current batch.
This first attempts to send the batch as a single request; if that
fails because the server doesn't support batching, the files are
sent one by one, and self.batching is reset to False.
At the end, self.batch and self.batch_size are reset. | 625941cd7b180e01f3dc4906 |
def get_prod_path(self, relative=False, file_ext="html"): <NEW_LINE> <INDENT> base = "" <NEW_LINE> if self.parent: <NEW_LINE> <INDENT> base = self.parent.get_prod_path(relative=relative) <NEW_LINE> <DEDENT> path = os.path.join(base, self.slug) <NEW_LINE> if self.has_extracts(): <NEW_LINE> <INDENT> path += "." + file_ex... | Get the physical path to the public version of the container. If the container have extracts, then it returns the final HTML file.
:param file_ext: the dumped file extension
:return:
:param relative: return a relative path instead of an absolute one
:type relative: bool
:return: physical path
:rtype: str | 625941cda934411ee375179d |
def swap_resp(ee, l, mrat): <NEW_LINE> <INDENT> A = Ageom*Aeff(ee, mrat) <NEW_LINE> T = transmission(ee, l) <NEW_LINE> return A*T | Compute swap response | 625941cd004d5f362079a43c |
def test_finding_before_hook_from_another_module(self): <NEW_LINE> <INDENT> methods_from_a_module = pyeature.Loader().load_steps(self.step_filename) <NEW_LINE> modules = [self.module, __import__('hook')] <NEW_LINE> methods = self.matcher.clause_methods_of(modules) <NEW_LINE> clause_method_names = [m.__name__ for m in m... | [매칭] 다른 모듈에서 before를 찾는다 | 625941cd099cdd3c635f0d64 |
def test_style_base(self): <NEW_LINE> <INDENT> style = pep8.StyleGuide() <NEW_LINE> m = style.check_files(["models/rectangle.py"]) <NEW_LINE> self.assertEqual(m.total_errors, 0, "fix pep8") | test pep8
| 625941cd91f36d47f21ac5fd |
def retrieve_user(self, user_id): <NEW_LINE> <INDENT> self.log.info(f"Retrieving user ID: {user_id}") <NEW_LINE> return self.call_api( endpoint=f"v1/users/{user_id}", method="GET", headers=self.send_json_header() ) | Retrieves the details of an existing Domo user.
https://developer.domo.com/docs/users-api-reference/users-2#Retrieve%20a%20user
:param user_id: The Domo user ID
:return: Returns a user object if valid user ID was provided. When requesting, if the user ID is related to a user that has been deleted,
a subset ... | 625941cd82261d6c526ab5a9 |
def to_bit_vector(value, size): <NEW_LINE> <INDENT> bv = "" <NEW_LINE> while(value > 0): <NEW_LINE> <INDENT> bv = str(value%2) + bv <NEW_LINE> value //= 2 <NEW_LINE> <DEDENT> bv = '0'*size + bv <NEW_LINE> return bv[-size:] | Transform a decimal value into VHDL bit vector value. | 625941cd0a366e3fb873e924 |
def fetch_var(name, scope=None, return_numpy=True): <NEW_LINE> <INDENT> assert isinstance(name, str) <NEW_LINE> if scope is None: <NEW_LINE> <INDENT> scope = global_scope() <NEW_LINE> <DEDENT> assert isinstance(scope, core.Scope) <NEW_LINE> var = scope.find_var(name) <NEW_LINE> assert var is not None, ( "Cannot find " ... | Fetch the value of the variable with the given name from the given scope
Args:
name(str): name of the variable. Typically, only persistable variables
can be found in the scope used for running the program.
scope(core.Scope|None): scope object. It should be the scope where
you pass to Executor.ru... | 625941cdcdde0d52a9e5313d |
def __init__(self, game, x, y): <NEW_LINE> <INDENT> super(Ship, self).__init__(image = Ship.image, x = x, y = y) <NEW_LINE> self.missile_wait = 0 <NEW_LINE> self.game = game | initialize a ship | 625941cda8370b77170529a9 |
def _find_switch_type(name): <NEW_LINE> <INDENT> if not name: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> import sim.api as api <NEW_LINE> if _issubclass(name, api.Entity): <NEW_LINE> <INDENT> return name <NEW_LINE> <DEDENT> module = _try_import(name, False) <NEW_LINE> if not module: <NEW_LINE> <INDENT> if "." ... | Tries to load a given entity by name.
Also works if it's just passed an entity! | 625941cdff9c53063f47c2fd |
def __update_parent(self, nid, identifier): <NEW_LINE> <INDENT> self[nid].parent = identifier | Returns something. | 625941cd94891a1f4081bbb3 |
def revert_line_vspaces(document): <NEW_LINE> <INDENT> insets = { "fullline*" : "\\vspace*{\\baselineskip}", "fullline" : "\\vspace{\\baselineskip}", "halfline*" : "\\vspace*{0.5\\baselineskip}", "halfline" : "\\vspace{0.5\\baselineskip}", } <NEW_LINE> for inset in insets.keys(): <NEW_LINE> <INDENT> i = 0 <NEW_LINE> j ... | Revert fulline and halfline vspaces to TeX | 625941cde76e3b2f99f3a915 |
def setup_frames(self): <NEW_LINE> <INDENT> self.frames.append( IMAGE_SLIDER.get_enemies('goomba_1')) <NEW_LINE> self.frames.append( IMAGE_SLIDER.get_enemies('goomba_2')) <NEW_LINE> self.frames.append( IMAGE_SLIDER.get_enemies('goomba_3')) <NEW_LINE> self.frames.append(pg.transform.flip(self.frames[0], False, True)) | Put the image frames in a list to be animated | 625941cdbe7bc26dc91cd70a |
def __init__(self, name, namespace, version, description, secure, gettext_domain, units_dir, jobs_dir, whitelists_dir, data_dir, bin_dir, locale_dir, base_dir, *, validate=False, validation_kwargs=None, check=True, context=None): <NEW_LINE> <INDENT> if namespace is None: <NEW_LINE> <INDENT> namespace = name.split(':', ... | Initialize a provider with a set of meta-data and directories.
:param name:
provider name / ID
:param namespace:
provider namespace
:param version:
provider version
:param description:
provider version
This is the untranslated version of this field. Implementations may
obtain the localized ... | 625941cdbaa26c4b54cb122a |
def parse_timedelta(value: Union[timedelta, str]) -> timedelta: <NEW_LINE> <INDENT> if isinstance(value, timedelta): <NEW_LINE> <INDENT> return value <NEW_LINE> <DEDENT> if not value: <NEW_LINE> <INDENT> return timedelta() <NEW_LINE> <DEDENT> amount, unit = value.lower().split(' ') <NEW_LINE> if not unit.endswith('s'):... | Parse a string like '5 days' into a timedelta object. Also allows timedeltas to pass through. | 625941cd66673b3332b9219b |
@mock.patch('random.random', return_value=0.1) <NEW_LINE> @mock.patch('fitness.generate_random_config', return_value=[200, 39, 0, 1, 0, 1033, 1933, 1, 0, 2, 3, 0, 1]) <NEW_LINE> def test_mutation(function1, function2): <NEW_LINE> <INDENT> population = [ [1523, 42, 0, 1, 1, 2045, 537, 1, 1, 2, 2, 0, 0], [1971, 117, 0, 1... | Test mutation function | 625941cdbd1bec0571d90739 |
def p_C(t): <NEW_LINE> <INDENT> pass | C : C estatuto
| empty | 625941cd925a0f43d2549f81 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.