code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def execute_symbolically(self, mission: Mission) -> List[Mission]: <NEW_LINE> <INDENT> rng = random.Random(1000) <NEW_LINE> commands = mission.commands <NEW_LINE> all_paths = [] <NEW_LINE> all_missions = [] <NEW_LINE> self._dfs(commands, 0, [], all_paths) <NEW_LINE> for bp in all_paths: <NEW_LINE> <INDENT> logger.info(... | Having the sequense of actions in `mission` this function
will generate parameters for those actions in order to
explore all possible action branches. | 625941e9c432627299f050f6 |
def test_drange_vector(self): <NEW_LINE> <INDENT> np.random.seed(140) <NEW_LINE> n_samples = 1000 <NEW_LINE> angle_in = np.random.random_sample(n_samples)*10.0*np.pi+2.0*np.pi <NEW_LINE> angle_in = np.append(angle_in, np.random.random_sample(n_samples)*(-10.0)*np.pi) <NEW_LINE> test_angle = pal.drangeVector(angle_in) <... | Test that drangeVector returns results consistent with drange | 625941e9d164cc61757831fb |
def load_graph(self, file_name: str) -> None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> with open(file_name, 'r') as f: <NEW_LINE> <INDENT> self.parse_graph(f.readlines()) <NEW_LINE> <DEDENT> <DEDENT> except Exception as exc: <NEW_LINE> <INDENT> raise errors.E2CSessionError(exc) | Opens the specified file and builds up the graph.
:type file_name: str
:param file_name: The filename to load from file.
:rtype: None | 625941e97cff6e4e81117e32 |
def escapeButton(self): <NEW_LINE> <INDENT> return QAbstractButton | QMessageBox.escapeButton() -> QAbstractButton | 625941e971ff763f4b549b40 |
def set_stock_empty(): <NEW_LINE> <INDENT> return _set_stock(False) | 设置食物库存为空(置空) | 625941e93346ee7daa2b321c |
def isPalindrome(self, head): <NEW_LINE> <INDENT> slow = fast = head <NEW_LINE> while fast and fast.next: <NEW_LINE> <INDENT> fast = fast.next.next <NEW_LINE> slow = slow.next <NEW_LINE> <DEDENT> tail = None <NEW_LINE> while slow: <NEW_LINE> <INDENT> slow.next, slow, tail = tail, slow.next, slow <NEW_LINE> <DEDENT> whi... | :type head: ListNode
:rtype: bool | 625941e9a4f1c619b28b04da |
def get_serializer_from_filename(filename): <NEW_LINE> <INDENT> logger.debug("filename: '%s'", filename) <NEW_LINE> extension = os.path.splitext(filename)[1].lower() <NEW_LINE> logger.debug("extension: '%s'", extension) <NEW_LINE> if extension == ".json": <NEW_LINE> <INDENT> retval = _JSONSerializer() <NEW_LINE> <DEDEN... | Obtain a serializer object from a filename
Parameters
----------
filename: str
Filename to determine the serializer type from
Returns
-------
serializer: :class:`Serializer`
A serializer object for handling the requested data format
Example
-------
>>> filename = '/path/to/json/file.json'
>>> serializer = ge... | 625941e9ad47b63b2c50a42b |
def velocity_control(self, target_velocity): <NEW_LINE> <INDENT> return self.KP_A * (target_velocity - self.velocity) | Control the velocity of the vehicle.
Using a simple proportional controller.
:param target_velocity: the desired velocity
:return: an acceleration command [m/s2] | 625941e9cdde0d52a9e534e3 |
def shift(self, x, s): <NEW_LINE> <INDENT> from sage.rings.all import ZZ <NEW_LINE> x = self.domain().coerce(x) <NEW_LINE> s = self.value_group()(s) <NEW_LINE> if s == 0: <NEW_LINE> <INDENT> return x <NEW_LINE> <DEDENT> s = ZZ(s / self.value_group().gen()) <NEW_LINE> if s > 0: <NEW_LINE> <INDENT> return x * self.unifor... | Shift ``x`` in its expansion with respect to :meth:`uniformizer` by
``s`` "digits".
For non-negative ``s``, this just returns ``x`` multiplied by a
power of the uniformizer `\pi`.
For negative ``s``, it does the same but when not over a field, it
drops coefficients in the `\pi`-adic expension which have negative
valu... | 625941e90a50d4780f667342 |
def reloadFile(self): <NEW_LINE> <INDENT> logging.debug('Application: reloadFile()') <NEW_LINE> try: <NEW_LINE> <INDENT> if self.currentTabController().filename() and self.currentTabController().allowClose(): <NEW_LINE> <INDENT> self.currentTabController().refresh() <NEW_LINE> self.currentTabController().setModified(Fa... | Tells current tab controller to refresh.
| 625941e9097d151d1a223304 |
def get_method(self, url): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> req = urllib.request.Request(url) <NEW_LINE> response = urllib.request.urlopen(req) <NEW_LINE> thePage = response.read() <NEW_LINE> return thePage <NEW_LINE> <DEDENT> except urllib.error.HTTPError as ex: <NEW_LINE> <INDENT> if ex.code == 404: <NEW_... | Only used inside the site for forwardning requests. | 625941e95fdd1c0f98dc06e2 |
@schedule_app.route("/") <NEW_LINE> @login_required <NEW_LINE> def index(): <NEW_LINE> <INDENT> if current_user.is_admin: <NEW_LINE> <INDENT> return redirect(url_for("admin")) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return redirect(url_for("set_availability", pid=current_user.pid)) | Dump the headers | 625941e923849d37ff7b3538 |
def read_string(self): <NEW_LINE> <INDENT> s="" <NEW_LINE> while self.is_digit(self.reader.current_char()) or self.is_letter(self.reader.current_char()) or self.reader.current_char()==" ": <NEW_LINE> <INDENT> s+=self.reader.current_char() <NEW_LINE> self.reader.next_char() <NEW_LINE> <DEDENT> return s... | Lit et renvoit une suite de lettre ou de chiffres: utile pour les balises | 625941e956b00c62f0f14b09 |
def angular_dist(r1,d1,r2,d2): <NEW_LINE> <INDENT> b=np.cos(d1)*np.cos(d2)*np.sin(np.abs(r1-r2)/2)**2 <NEW_LINE> a=np.sin(np.abs(d1-d2)/2)**2 <NEW_LINE> return 2.0*np.arcsin(np.sqrt(a+b)) | all angle are in radian | 625941e9c4546d3d9de72ee5 |
def slice(self, start_index: int, quantity: int) -> object: <NEW_LINE> <INDENT> if not isinstance(start_index, int) or start_index < 0 or start_index > self.size - 1: <NEW_LINE> <INDENT> raise DynamicArrayException <NEW_LINE> <DEDENT> if (start_index + quantity - 1) > self.size - 1: <NEW_LINE> <INDENT> raise DynamicArr... | This method outputs Dynamic Array with consideration to arguments
It contributes with integers from index and returns new Dynamic Array
from previous Dynamic Array starting with element at start index. | 625941e955399d3f05588b64 |
def what_is_left(self): <NEW_LINE> <INDENT> removed = False <NEW_LINE> for i in range(3): <NEW_LINE> <INDENT> for j in range(3): <NEW_LINE> <INDENT> m,k = i//3,j//3 <NEW_LINE> removed |= self.deduce_line(self.what_is_left_in_line(m,k),m,k) <NEW_LINE> <DEDENT> <DEDENT> for i in range(0,9,3): <NEW_LINE> <INDENT> for j in... | finds out what numbers are left and adds them as solutions | 625941e9099cdd3c635f1105 |
def __init__(self,content, **kwargs): <NEW_LINE> <INDENT> super(DataFileNode,self).__init__(**kwargs) <NEW_LINE> self.df_content = content | Arguments:
- `self`:
- `content`: | 625941e94527f215b584c8ff |
def get_page(self, target_url): <NEW_LINE> <INDENT> resource_url = self._version.absolute_url(self._uri) <NEW_LINE> if not target_url.startswith(resource_url): <NEW_LINE> <INDENT> raise TwilioException('Invalid target_url for AlertInstance resource.') <NEW_LINE> <DEDENT> response = self._version.domain.twilio.request( ... | Retrieve a specific page of AlertInstance records from the API.
Request is executed immediately
:param str target_url: API-generated URL for the requested results page
:returns: Page of AlertInstance
:rtype: twilio.rest.monitor.v1.alert.AlertPage | 625941e9d486a94d0b98e5f3 |
@logit(logfile='func2.log') <NEW_LINE> def myfunc2(): <NEW_LINE> <INDENT> pass | MyFunc2 | 625941e94d74a7450ccd4672 |
def disableWorkspace(self): <NEW_LINE> <INDENT> for tabId in xrange( self.tab.count() ): <NEW_LINE> <INDENT> doc = self.tab.widget(tabId) <NEW_LINE> if isinstance(doc, WelcomePage): <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> doc.setEnabled(False) <NEW_LINE> <DEDENT> currentTab = self.tab.currentIndex() <NEW_LINE>... | Disable the workspace except the welcome page | 625941e9627d3e7fe0d692fe |
def test_result_list_set_empty_value_display_on_admin_site(self): <NEW_LINE> <INDENT> new_child = Child.objects.create(name='name', parent=None) <NEW_LINE> request = self.factory.get('/child/') <NEW_LINE> admin.site.empty_value_display = '???' <NEW_LINE> m = ChildAdmin(Child, admin.site) <NEW_LINE> cl = ChangeList(requ... | Empty value display can be set on AdminSite. | 625941e9a219f33f34628e10 |
def parse_g( source ): <NEW_LINE> <INDENT> return ( int(number_text) for c in get_columns( *strip_head( source, source.readline() ) ) for number_text in c.split() ) | Generator function parsing.
>>> import io
>>> data = io.StringIO('''\
... The First 1,000 Primes
... (the 1,000th is 7919)
... For more information on primes see http://primes.utm.edu/
...
... 2 3 5 7 11 13 17 19 23 29... | 625941e9f548e778e58cda2d |
@app.route('/login', methods=['GET', 'POST']) <NEW_LINE> def login(): <NEW_LINE> <INDENT> if 'username' in session: <NEW_LINE> <INDENT> return redirect(url_for('index')) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if request.method == 'POST': <NEW_LINE> <INDENT> request_username = request.form['username'] <NEW_LINE> ... | The login method for the driver.
:return: index.html upon successful login, login.html if unsuccessful | 625941e9851cf427c661a9b8 |
def irfft(x, n=None, axis=-1, overwrite_x=False): <NEW_LINE> <INDENT> tmp = _asfarray(x) <NEW_LINE> if not numpy.isrealobj(tmp): <NEW_LINE> <INDENT> raise TypeError("1st argument must be real sequence") <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> work_function = _DTYPE_TO_RFFT[tmp.dtype] <NEW_LINE> <DEDENT> except Key... | Return inverse discrete Fourier transform of real sequence x.
The contents of `x` are interpreted as the output of the `rfft`
function.
Parameters
----------
x : array_like
Transformed data to invert.
n : int, optional
Length of the inverse Fourier transform.
If n < x.shape[axis], x is truncated.
If n... | 625941e9a79ad161976cc5f2 |
def wash_languages(lns): <NEW_LINE> <INDENT> from invenio.config import CFG_SITE_LANG, CFG_SITE_LANGS <NEW_LINE> for ln in lns: <NEW_LINE> <INDENT> if ln: <NEW_LINE> <INDENT> ln = ln.replace('-', '_') <NEW_LINE> if ln in CFG_SITE_LANGS: <NEW_LINE> <INDENT> return ln <NEW_LINE> <DEDENT> elif ln[:2] in CFG_SITE_LANGS: <N... | Check in the languages list if there's at least one of the allowed langs.
Return it in case of success, return the default language otherwise. | 625941e9ff9c53063f47c69e |
def __iter__(self) -> MyListIterator: <NEW_LINE> <INDENT> return MyListIterator(self, True) | Returns an iterator that allows iteration over this list.
Ref: https://thispointer.com/python-how-to-make-a-class-iterable-create-iterator-class-for-it/
Args:
Returns:
an iterator that allows iteration over this list. | 625941e971ff763f4b549b41 |
def test_bucketlist_controller_can_create_bucketlist(self): <NEW_LINE> <INDENT> new_bucketlist_details = ("NewName", "Description: Optional") <NEW_LINE> new_bucketlist = self.bucketlist_controller.add_bucketlist(new_bucketlist_details) <NEW_LINE> self.assertEqual(isinstance(new_bucketlist[0], BucketList), True) <NEW_LI... | Asserting that a bucketlist controller can create a bucketlist | 625941e957b8e32f5248394b |
def settings(): <NEW_LINE> <INDENT> @mc_states.utils.lazy_subregistry_get(__salt__, __name) <NEW_LINE> def _settings(): <NEW_LINE> <INDENT> _salt = __salt__ <NEW_LINE> grains = __grains__ <NEW_LINE> pillar = __pillar__ <NEW_LINE> nodetypes_registry = _salt['mc_nodetypes.registry']() <NEW_LINE> locs = _salt['mc_location... | snmpd settings
SNMPDRUN
yes
MIBS
/usr/share/mibs
SNMPDOPTS
-Lsd -Lf /dev/null -p /var/run/snmpd.pid
TRAPDRUN
no
TRAPDOPTS
-Lsd -p /var/run/snmptrapd.pid
agentAddress
udp:161,udp6:[::1]:161
default_user
user
default_key
... | 625941e94f6381625f114ee8 |
def delay_t(iterable, duration, fillvalue=0.0, srate=None): <NEW_LINE> <INDENT> if srate is None: <NEW_LINE> <INDENT> srate = get_srate() <NEW_LINE> <DEDENT> return delay(iterable, int(srate * duration), fillvalue) | Delays the evaluation of iterable by 'duration'. | 625941e9566aa707497f4a0f |
def test_line(): <NEW_LINE> <INDENT> a = pyedahelper.fast_plot(df=df, x="col_int", y="col_flt", plot_type="line") <NEW_LINE> assert a.height == 600 <NEW_LINE> assert a.width == 900 <NEW_LINE> assert a.mark == "line" <NEW_LINE> assert "col_int" in a.encoding['x']['shorthand'] <NEW_LINE> assert "col_flt" in a.encoding['y... | Function tests line plots created by pyedahelper.fast_plot function. | 625941e9dc8b845886cb59e4 |
def has_argument(self, argument): <NEW_LINE> <INDENT> setup_cfg = self.get_content_of_file('setup.cfg') <NEW_LINE> if setup_cfg: <NEW_LINE> <INDENT> argument_re = re.compile(r'\b' + format(argument) + '\s*=') <NEW_LINE> if argument_re.search(setup_cfg): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> setup... | A simple method that finds out if setup() function from setup.py
is called with given argument.
Args:
argument: argument to look for
Returns:
True if argument is used, False otherwise | 625941e9a17c0f6771cbe4fc |
def parse_text_match_pairwise_pad_data(line, func_args): <NEW_LINE> <INDENT> seq_len = func_args[0] <NEW_LINE> pad_id = func_args[1] <NEW_LINE> group = line.strip().split("\t") <NEW_LINE> if len(group) != 3: <NEW_LINE> <INDENT> logging.warning( "the line not conform to format(query_terms, postitle_terms, negtitle_terms... | pairwise parse | 625941e9d99f1b3c44c67a33 |
def put_configuration_set_tracking_options(ConfigurationSetName=None, CustomRedirectDomain=None): <NEW_LINE> <INDENT> pass | Specify a custom domain to use for open and click tracking elements in email that you send using Amazon Pinpoint.
See also: AWS API Documentation
Exceptions
:example: response = client.put_configuration_set_tracking_options(
ConfigurationSetName='string',
CustomRedirectDomain='... | 625941e9b57a9660fec33d38 |
def test_load(): <NEW_LINE> <INDENT> m = flopy.modflow.Modflow.load('MNW2-Fig28.nam', model_ws=mf2005pth, verbose=True, forgive=False) <NEW_LINE> m.change_model_ws(cpth) <NEW_LINE> assert m.has_package('MNW2') <NEW_LINE> assert m.has_package('MNWI') <NEW_LINE> m2 = flopy.modflow.Modflow('br', model_ws=cpth) <NEW_LINE> ... | t027 test load of MNW2 Package | 625941e921a7993f00bc81a5 |
def list_members(self, lb_id, pool_id, params=None): <NEW_LINE> <INDENT> url = self._MEMBERS_URL.format(lb_id=lb_id, pool_id=pool_id) <NEW_LINE> if params: <NEW_LINE> <INDENT> url = "{0}?{1}".format(url, parse.urlencode(params)) <NEW_LINE> <DEDENT> resp, body = self.get(url) <NEW_LINE> body = jsonutils.loads(body) <NEW... | List all Members. | 625941e956ac1b37e6264673 |
def get_y(self, y: int) -> int: <NEW_LINE> <INDENT> return int(self.ratio_y * y) | Get parent Y coordinate for destination Y
:param y: Destination X coordinate
:return: Parent X coordinate based on `y ratio`
>>> nn = NearestNeighbour(imread("digital_image_processing/image_data/lena.jpg",
... 1), 100, 100)
>>> nn.ratio_y = 0.5
>>> nn.get_y(4)
2 | 625941e9e1aae11d1e74a169 |
def calc_package(self, query: str) -> Package: <NEW_LINE> <INDENT> log.info('Query:', query) <NEW_LINE> query = query.strip().lower() <NEW_LINE> matches = self.context.calc_intents(query) <NEW_LINE> matches = [i for i in matches if i.confidence > 0.5] <NEW_LINE> packages = self._run_prehandlers(matches) <NEW_LINE> resu... | Find the best intent and run the handler to find the result
Args:
query: input sentence
Returns:
package: object containing display data from skill | 625941e9099cdd3c635f1106 |
def inputGender(message): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> userInput = input(message) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> print("blah") <NEW_LINE> continue <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if userInput.isdigit(): <NEW_LINE> <INDENT> print("... | Prompt user for thier gender. userInput must be 'M', 'F', 'MALE', 'FEMALE'. | 625941e98da39b475bd65427 |
def world_cup_get_season_id_by_number(_number: int) -> (int, int): <NEW_LINE> <INDENT> rtn, err = 0, ErrorCode.ERROR_PASS <NEW_LINE> try: <NEW_LINE> <INDENT> num_country_map = dict(QSF.world_cup_get_season_id_orderd_by_date()) <NEW_LINE> <DEDENT> except MySQLError: <NEW_LINE> <INDENT> err = ErrorCode.ERROR_MYSQL_ERROR ... | 通过世界杯编号查询season id
:param _number: 指定的世界杯编号,目前只支持1~21
:return: 返回切界杯的season id以及错误码
不支持的_number,error返回ERROR_NUMBER_OUT_OF_RANGE | 625941e994891a1f4081bf59 |
def isDead(item): <NEW_LINE> <INDENT> return (item is None or isitemref(item) or (item.itsStatus & DEAD_FLAGS) != 0 ) | Return True if the item is None, an itemref, stale, or deferred. | 625941e910dbd63aa1bd304f |
def dropEvent(self, event) -> None: <NEW_LINE> <INDENT> if self._root is None: <NEW_LINE> <INDENT> self._root = self._drag_drop_root <NEW_LINE> self.on_new_root() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> p = Plot(self._drag_drop_root) <NEW_LINE> p.show() <NEW_LINE> windows.append(p) <NEW_LINE> <DEDENT> event.accep... | Overrides :meth:`QtWidgets.QWidget.dropEvent`. | 625941e97d847024c06be76d |
def ccsValidator(results=None): <NEW_LINE> <INDENT> if results is None: <NEW_LINE> <INDENT> results = [] <NEW_LINE> <DEDENT> files = glob.glob('*/*.fits') <NEW_LINE> files += glob.glob('*/*.txt') <NEW_LINE> files += glob.glob('pd-values*.txt') <NEW_LINE> files += glob.glob('*.png') <NEW_LINE> files += glob.glob('*.seq'... | Persist standard file patterns, e.g., '*.fits', 'pd-values*.txt', 'Photo*.txt',
using lcatr.schema. | 625941e9b5575c28eb68e4b2 |
def top_sort_dfs(edges: List[List[int]]) -> List[int]: <NEW_LINE> <INDENT> order = [] <NEW_LINE> GRAY, BLACK = 1, 2 <NEW_LINE> def dfs(u: int) -> bool: <NEW_LINE> <INDENT> if u in visited: <NEW_LINE> <INDENT> if visited[u] == BLACK: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if visited[u] == GRAY: <NEW_LINE> <... | Topological sort using DFS and graph coloring. | 625941e95e10d32532c5f3d2 |
def _threshold_and_support(input, dim=0, mask=None): <NEW_LINE> <INDENT> if mask is not None: <NEW_LINE> <INDENT> input.masked_fill_(mask==0,-1e9) <NEW_LINE> <DEDENT> input_srt, _ = torch.sort(input, descending=True, dim=dim) <NEW_LINE> input_cumsum = input_srt.cumsum(dim) - 1 <NEW_LINE> rhos = _make_ix_like(input, dim... | Sparsemax building block: compute the threshold
Parameters:
input: any dimension
dim: dimension along which to apply the sparsemax
Returns:
the threshold value | 625941e9fbf16365ca6f667b |
def delete(self): <NEW_LINE> <INDENT> return self.rm() | remove file/dir, alias of .rm(), does not raise error on file/dir not existing | 625941e921bff66bcd684dfb |
def test_var_index_exprn_minus1(): <NEW_LINE> <INDENT> dag = dag_from_strings(["a(i) = 2.0 * b(i)"]) <NEW_LINE> anode = dag._nodes["a(i)"] <NEW_LINE> var = anode.variable <NEW_LINE> var._index_exprns[0] += "-1-1+1" <NEW_LINE> assert var.indices[0] == "i-1" | Test the code that attempts to simplify array-index expressions
when the net increment to an index is negative | 625941e9aad79263cf390ef6 |
def _asset_from_sym(self, sym): <NEW_LINE> <INDENT> sym = sym.split(":")[0] <NEW_LINE> if sym not in self._instruments_list: <NEW_LINE> <INDENT> raise SymbolNotFound(f"no instruments with symbol {sym}") <NEW_LINE> <DEDENT> base, quote = tuple(sym.split('/')) <NEW_LINE> if not base or not quote: <NEW_LINE> <INDENT> rais... | Create an asset from a matching entry in the instruments list. | 625941e9bde94217f368329a |
def test_observers_names_type(self): <NEW_LINE> <INDENT> for checklist in checklists: <NEW_LINE> <INDENT> self.assertIsInstance(checklist['observers']['names'], list, msg=checklist['source']) | Verify the observers is a list. | 625941e9b7558d58953c53b7 |
def p_expression_PLUS_UND_MINUS(p): <NEW_LINE> <INDENT> if p[2] == '+': <NEW_LINE> <INDENT> p[0] = p[1] + p[3] <NEW_LINE> <DEDENT> elif p[2] == '-': <NEW_LINE> <INDENT> p[0] = p[1] - p[3] | expression : expression PLUS term
| expression MINUS term | 625941e98c3a87329515886e |
def get_page(self, url): <NEW_LINE> <INDENT> scheme, netloc, path, _, _, _ = urlparse(url) <NEW_LINE> if scheme == 'file' and os.path.isdir(url2pathname(path)): <NEW_LINE> <INDENT> url = urljoin(ensure_slash(url), 'base_html.html') <NEW_LINE> <DEDENT> if url in self._page_cache: <NEW_LINE> <INDENT> result = self._page_... | Get the HTML for an URL, possibly from an in-memory cache.
XXX TODO Note: this cache is never actually cleared. It's assumed that
the data won't get stale over the lifetime of a locator instance (not
necessarily true for the default_locator). | 625941e921a7993f00bc81a6 |
def AddLegend(self, cmd=None, showDialog=None): <NEW_LINE> <INDENT> if self.legend.IsShown() and showDialog is None: <NEW_LINE> <INDENT> self.legend.Hide() <NEW_LINE> return <NEW_LINE> <DEDENT> if cmd: <NEW_LINE> <INDENT> self.legend.cmd = cmd <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> layers = self._giface.GetLayer... | Handler for legend map decoration menu selection. | 625941e9167d2b6e31219042 |
def get_bpt_event_date_list(event_id): <NEW_LINE> <INDENT> url = "?".join(['http://www.brownpapertickets.com/api2/datelist', 'id=%s&event_id=%s']) <NEW_LINE> date_call = url % (get_bpt_developer_id(), event_id) <NEW_LINE> date_xml = perform_bpt_api_call(date_call) <NEW_LINE> if date_xml is None: <NEW_LINE> <INDENT> ret... | Used to get the list of date identifiers from the BPT website for
the given event.
event_id - the event id for the event to query
Returns: the date list requested, as a python list. | 625941e9b7558d58953c53b8 |
def __init__( self, usb_device = None, path = None, bus = None, device = None, idVendor = None, idProduct = None, product = None, manufacturer = None ): <NEW_LINE> <INDENT> if usb_device is None: <NEW_LINE> <INDENT> self.path = path <NEW_LINE> self.bus = bus <NEW_LINE> self.device = device <NEW_LINE> self.idVendor = id... | Construct a USB device out of a device from the USB
translation library or using the known arguments bus, device
number etc. Note if a USB device is instantiated using
attributes ALL necessary attributes must be provided. | 625941e9e76e3b2f99f3acb2 |
def fp_two_one(self, event): <NEW_LINE> <INDENT> if event.button() == QtCore.Qt.LeftButton: <NEW_LINE> <INDENT> self.remove_fp_two() <NEW_LINE> self.fp_one() | change Layout two to one | 625941e9dd821e528d63b653 |
def error(msg, out_streams): <NEW_LINE> <INDENT> for stream in out_streams: <NEW_LINE> <INDENT> stream.send_error(msg) <NEW_LINE> <DEDENT> exit(1) | Forward message to the error handling email address | 625941e9d6c5a102081444fc |
def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> context = super(PatientCreateView, self).get_context_data(**kwargs) <NEW_LINE> context['study'] = Study.objects.get(pk=self.kwargs.get('pk', None)) <NEW_LINE> return context | We need to also get the study object and pass it to the template. | 625941e9baa26c4b54cb15c8 |
def random_dijkstra(): <NEW_LINE> <INDENT> random_path = Graph.random_dijkstra(TOPOLOGY) <NEW_LINE> return random_path[1:] | calculate the random path | 625941e99f2886367277ad37 |
def validate_arguments(func, args, kwargs, drop_extra=True): <NEW_LINE> <INDENT> warnings.warn( "'utils.validate_arguments' is deprecated and will be removed" " in Werkzeug 2.1. Use 'inspect.signature' instead.", DeprecationWarning, stacklevel=2, ) <NEW_LINE> parser = _parse_signature(func) <NEW_LINE> args, kwargs, mis... | Checks if the function accepts the arguments and keyword arguments.
Returns a new ``(args, kwargs)`` tuple that can safely be passed to
the function without causing a `TypeError` because the function signature
is incompatible. If `drop_extra` is set to `True` (which is the default)
any extra positional or keyword argu... | 625941e9adb09d7d5db6cc3a |
def _set_articles(self, num_of_articles): <NEW_LINE> <INDENT> if isinstance(num_of_articles, int): <NEW_LINE> <INDENT> self.num_of_articles = num_of_articles <NEW_LINE> <DEDENT> if self.campaign_reference and num_of_articles > -1: <NEW_LINE> <INDENT> sqlquery = 'UPDATE campaign SET articles=%s WHERE ' ... | Set articles number in DB using campaign reference..
:param num_of_articles:
:return: | 625941e9d8ef3951e32439eb |
def trimxy_spec(self, key): <NEW_LINE> <INDENT> if key in 'eE': <NEW_LINE> <INDENT> xRange = self.plot_spec1D.getViewBox().state['viewRange'][0] <NEW_LINE> x0 = xRange[0] <NEW_LINE> x1 = xRange[1] <NEW_LINE> xnew = self.mouse_x_spec1D <NEW_LINE> if key=='E': x1=xnew <NEW_LINE> else: x0=xnew <NEW_LINE> self.plot_spec1D.... | Trim plotting region in wavelength (x) and/or flux (y) | 625941e96e29344779a62abe |
def prepare_settings(self, setting_values): <NEW_LINE> <INDENT> setting_count = len(setting_values) <NEW_LINE> step_parent_count = ((setting_count - FIXED_SETTING_COUNT) / VARIABLE_SETTING_COUNT) <NEW_LINE> assert len(self.step_parent_names) > 0 <NEW_LINE> self.step_parent_names = self.step_parent_names[:1] <NEW_LINE> ... | Do any sort of adjustment to the settings required for the given values
setting_values - the values for the settings just prior to mapping
as done by set_settings_from_values
This method allows a module to specialize itself according to
the number of settings and their value. For instance, a module th... | 625941e9507cdc57c6307193 |
def GetConsumedFilesFromJobItem(item): <NEW_LINE> <INDENT> from lib.report.parser.Package import ReportItem <NEW_LINE> assert isinstance(item, ReportItem) <NEW_LINE> if not hasattr(item, u'HasEntities') or not item.HasEntities(): <NEW_LINE> <INDENT> return () <NEW_LINE> <DEDENT> return [ entity.GetRecording(recordingIn... | Filtert aus dem übergebenen TraceAnalyeJob-Element die konsumierten Dateien.
:param item: Element, in dem gesucht wird
:type item: ReportItem
:return: Liste der konsumierten Dateien als Pfad
:rtype: list[Recording] | 625941e95fc7496912cc3e2b |
def node_to_home(self): <NEW_LINE> <INDENT> next_node = self.node_shortest_path(self.home) <NEW_LINE> return next_node | Returns the next node on the shortest path toward home | 625941e95e10d32532c5f3d3 |
def fernald(data, lidar_constant, lidar_ratio, betam, fill_index=0, fill_aver_num=1, C_contains_E=False, apply_on_data=False): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> start_i = data['first_data_bin'] <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> start_i = 0 <NEW_LINE> <DEDENT> dz = data['bin_size'] / 1000.0 <NEW... | fernald 1984's retrieval method.
data: a LidarDataset object which contains normalized data or a faked one (dict-like).
lidar_constant: lidar constant.
lidar_ratio: lidar ratio.
betam: molecular backscatter
fill_index: data below this index will be filled with value above
fill_aver_num: fill lower part with this number... | 625941e982261d6c526ab954 |
def DidRunPage(self, platform): <NEW_LINE> <INDENT> pass | Called after the test run method was run, even if it failed. | 625941e9f8510a7c17cf9bad |
def get_mapping(): <NEW_LINE> <INDENT> pass | Returns the principal mapping as a dictionary, mapping old IDs (key)
to new IDs (value). | 625941e99c8ee82313fbbc25 |
def setProprietairesContent(self): <NEW_LINE> <INDENT> if self.feature.fieldNameIndex('proprietaire') == -1: <NEW_LINE> <INDENT> html = 'Les données MAJIC n\'ont pas été trouvées dans la base de données' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> item = 'proprietaires' <NEW_LINE> html = CadastreCommon.getItemHtml(it... | Get proprietaires data
and set the dialog content | 625941e9d53ae8145f87a714 |
def create_mosaic_image(self, mode="distance", closer_to_clust=True, blend_original=True, blend_ratio=1.0): <NEW_LINE> <INDENT> tilesize = self.tilesize <NEW_LINE> self.mosaic = np.zeros((self.shp[0]*tilesize[0],self.shp[1]*tilesize[1],3)) <NEW_LINE> assignments = np.zeros(self.cluster_array.shape) <NEW_LINE> ni,nj = s... | mosaic image creation from tile images with cluster assignments | 625941e9796e427e537b0a78 |
def history(self): <NEW_LINE> <INDENT> return _cpptutorial_swig.myqpskdemod_cb_sptr_history(self) | history(myqpskdemod_cb_sptr self) -> unsigned int | 625941e97d847024c06be76e |
def get_industry_sector(): <NEW_LINE> <INDENT> sector_df = read_industry_info() <NEW_LINE> return np.unique(sector_df.loc[0]) | Returns the Bloomberg industry sector
:return : [array] of Bloomberg industry sectors | 625941e9fff4ab517eb2f8ed |
def transform_hip(hipparcos): <NEW_LINE> <INDENT> _transform_hip = novaslib.transform_hip <NEW_LINE> _transform_hip.argtypes = (POINTER(CatEntry), POINTER(CatEntry)) <NEW_LINE> _transform_hip.restype = None <NEW_LINE> hip_2000 = CatEntry() <NEW_LINE> _transform_hip(byref(hipparcos), byref(hip_2000)) <NEW_LINE> return h... | To convert Hipparcos catalog data at epoch J1991.25 to epoch
J2000.0, for use within NOVAS. To be used only for Hipparcos or
Tycho stars with linear space motion. Both input and output data
is in the ICRS.
*Parameters*
hipparcos : CatEntry
Instance of CatEntry type object containing an entry from
t... | 625941e93317a56b8693a0fb |
def get_ref_seq_dict(ref_seq): <NEW_LINE> <INDENT> return SeqIO.to_dict(SeqIO.parse(ref_seq, 'fasta')) if ref_seq else None | get ref seq dict | 625941e96aa9bd52df037255 |
def __init__(__self__, *, secret_name: str): <NEW_LINE> <INDENT> pulumi.set(__self__, "secret_name", secret_name) | :param str secret_name: The name of the secret for a virtual gateway's Transport Layer Security (TLS) Secret Discovery Service validation context trust. | 625941e976d4e153a657efe1 |
def square(x_input): <NEW_LINE> <INDENT> return x_input*x_input | x_input: int or float. | 625941e9283ffb24f3c55daa |
def __add_qualifications_to_objects(self, **survey_avg_results_dict): <NEW_LINE> <INDENT> with open(self.RESULT_FILE_ANSWERS, 'r', encoding='utf-8') as respostes: <NEW_LINE> <INDENT> respostes_reader = csv.DictReader(respostes) <NEW_LINE> for respostes_row in respostes_reader: <NEW_LINE> <INDENT> item_number = 1 <NEW_L... | Descripció: Emplena els resultats per ítem de cada objecte a survey_avg_results_dict.
Entrada: Diccionari amb els cicles i objectes.
Sortida: Diccionari actualitzat amb el total de punts per ítem, nombre de respostes per ítem i mitjana per ítem de cada objecte. | 625941e91d351010ab855fc9 |
def __iter__(self) -> Iterator[ecole.scip.Model]: <NEW_LINE> <INDENT> ... | Return itself as an iterator. | 625941e991f36d47f21ac9a5 |
def stop(self, timeout=None): <NEW_LINE> <INDENT> self.close() <NEW_LINE> self._thread.join(timeout) <NEW_LINE> asyncore.close_all(map=self._map, ignore_all=True) <NEW_LINE> self._thread = None | Stop the thread by closing the server instance.
Wait for the server thread to terminate.
:param timeout: How long to wait for the server thread
to terminate. | 625941e938b623060ff0b29b |
def add_menu_options(self, menu): <NEW_LINE> <INDENT> category_name = _("Report Options") <NEW_LINE> all_tags = [] <NEW_LINE> for handle in self.__db.get_tag_handles(sort_handles=True): <NEW_LINE> <INDENT> tag = self.__db.get_tag_from_handle(handle) <NEW_LINE> all_tags.append(tag.get_name()) <NEW_LINE> <DEDENT> if len(... | Add options to the menu for the tag report. | 625941e92eb69b55b151cd64 |
def test_authorize_user_denied_access(self): <NEW_LINE> <INDENT> site_adapter_mock = Mock(spec=ImplicitGrantSiteAdapter) <NEW_LINE> site_adapter_mock.user_has_denied_access.return_value = True <NEW_LINE> auth_mixin = AuthorizeMixin(site_adapter=site_adapter_mock) <NEW_LINE> with self.assertRaises(OAuthInvalidError): <N... | AuthorizeMixin.authorize should raise an OAuthUserError if the user did not authorize the request | 625941e9f7d966606f6aa4b8 |
@pytest.yield_fixture(scope="function") <NEW_LINE> def cd_tempdir(request): <NEW_LINE> <INDENT> gc_barrier() <NEW_LINE> cwd = os.getcwd() <NEW_LINE> path = _create_tempdir(request) <NEW_LINE> os.chdir(path) <NEW_LINE> yield path <NEW_LINE> os.chdir(cwd) | Return a unique directory name for this test function instance.
Deletes and re-creates directory from previous test runs but lets
the directory stay after the test run for eventual inspection.
Returns the directory name, derived from the test file and function
plus a sequence number to work with parameterized tests.
... | 625941e985dfad0860c3b30a |
def check_hda_json_for_key_value( self, hda_id, key, value, use_string_contains=False ): <NEW_LINE> <INDENT> hda = dict() <NEW_LINE> for history_item in self.get_history_from_api(): <NEW_LINE> <INDENT> if history_item[ 'id' ] == hda_id: <NEW_LINE> <INDENT> hda = self.json_from_url( history_item[ 'url' ] ) <NEW_LINE> br... | Uses the history API to determine whether the current history:
(1) Has a history dataset with the required ID.
(2) That dataset has the required key.
(3) The contents of that key match the provided value.
If use_string_contains=True, this will perform a substring match, otherwise an exact match. | 625941e91f5feb6acb0c4ff8 |
def GetParams(self): <NEW_LINE> <INDENT> input_name = "input" <NEW_LINE> input_dims = [2, 32, 32, 3] <NEW_LINE> output_name = "output" <NEW_LINE> g = ops.Graph() <NEW_LINE> with g.as_default(): <NEW_LINE> <INDENT> inp = array_ops.placeholder( dtype=dtypes.float32, shape=input_dims, name=input_name) <NEW_LINE> with g.de... | Create a graph containing two segment. | 625941e93617ad0b5ed683a5 |
def viterbi(evidence_vector, states, prior_probs, transition_probs, emission_paras): <NEW_LINE> <INDENT> if not len(evidence_vector): <NEW_LINE> <INDENT> return [], 0.0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> seq = [] <NEW_LINE> probability = 0.0 <NEW_LINE> word = 0 <NEW_LINE> while word < len(states): <NEW_LINE>... | Viterbi Algorithm to calculate the most likely states give the evidence.
Args:
evidence_vector (list): List of right hand Y-axis positions (interger).
states (list): List of all states in a word. No transition between words.
example: ['B1', 'B2', 'B3', 'Bend']
prior_probs (dict): prior... | 625941e9596a897236089f68 |
def search(self, text): <NEW_LINE> <INDENT> key = self.__hash__(self, text) <NEW_LINE> searcher = self._searchers.get(key) <NEW_LINE> if not searcher: <NEW_LINE> <INDENT> searcher = ReverseFileSearcher(self.filename, text) <NEW_LINE> self._searchers[key] = searcher <NEW_LINE> <DEDENT> position = searcher.find() <NEW_LI... | Find text in log file from current position
returns a tuple containing:
absolute position,
position in result buffer,
result buffer (the actual file contents) | 625941e9e5267d203edce145 |
def read_x_value(x_string): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return float(x_string.strip()) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> return None | Parse string to float.
Args:
x_string: String
Returns:
Float, if possible to parse, or None. | 625941e971ff763f4b549b42 |
@task <NEW_LINE> def swap_live(name=None): <NEW_LINE> <INDENT> if name is None: <NEW_LINE> <INDENT> name = dealias_build("_stage") <NEW_LINE> <DEDENT> live = dealias_build("_live") <NEW_LINE> with cd("/code/deploy/builds"): <NEW_LINE> <INDENT> docker_exec( "ln -snvf %s _stage" % live, "ln -snvf %s _live" % name) <NEW_L... | Swap the specified build (default: _stage) with _live | 625941e96fb2d068a760f553 |
def create_metadata_proxy(self, body, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.create_metadata_proxy_with_http_info(body, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self.create_metadata_proxy_with_... | Create a metadata proxy # noqa: E501
Create a metadata proxy # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_metadata_proxy(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param Meta... | 625941e960cbc95b062c69f2 |
def exists(self): <NEW_LINE> <INDENT> return os.path.exists(self._tracking_path) | Check if tracking file exists.
@rtype: bool
@return: true if tracking file exists, false otherwise | 625941e9d53ae8145f87a715 |
@click.command() <NEW_LINE> @click.argument("source", type=click.Path(exists=True, file_okay=False, path_type=Path)) <NEW_LINE> @click.argument("destination", type=click.Path(exists=True, file_okay=False, path_type=Path)) <NEW_LINE> def main(source: Path, destination: Path): <NEW_LINE> <INDENT> compare(source, destinat... | Compare two folders of images, with the possibility to copy from one to the other.
SOURCE: Source folder, these are the "new" images.
DESTINATION: Destination folder. Images that are copied ends up here. | 625941e9dc8b845886cb59e5 |
def makedirs(dir_list): <NEW_LINE> <INDENT> for dir in dir_list: <NEW_LINE> <INDENT> if not os.path.exists(dir): <NEW_LINE> <INDENT> os.makedirs(dir) | Helper function to create a list of directories.
:param dir_list: a list of directories to be created | 625941e9cdde0d52a9e534e5 |
def undo(): <NEW_LINE> <INDENT> if len(ordered_list)==0: <NEW_LINE> <INDENT> error("Error", "There is nothing in the order to undo") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> del ordered_list[-1] <NEW_LINE> <DEDENT> update_order_listbox() <NEW_LINE> update_total_price() | Undo the last order that was appended to the list | 625941e9de87d2750b860246 |
def restart(): <NEW_LINE> <INDENT> with cd(env.code_dir): <NEW_LINE> <INDENT> run("touch %s/qn/wsgi.py" % env.code_dir) | Restart the wsgi process | 625941e9cc0a2c11143dd340 |
def test_projects_updated_incorrect_status(self): <NEW_LINE> <INDENT> create_project(self.session) <NEW_LINE> for project in self.session.query(models.Project).filter(models.Project.id == 1): <NEW_LINE> <INDENT> project.logs = "Version retrieved correctly" <NEW_LINE> <DEDENT> self.session.commit() <NEW_LINE> output = s... | Assert that `anitya.ui.project_updated` shows flash message
when incorrect status is provided. | 625941e944b2445a33932541 |
def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.strength = 0 <NEW_LINE> self.points = 0 <NEW_LINE> self.series_wins = 0 | :param name: | 625941e930dc7b7665901e10 |
def refresh(self): <NEW_LINE> <INDENT> headers = Headers({"content-type": "application/json", "accept": "application/json"}) <NEW_LINE> dataset_object = self.connection.api_call( "GET", ["datasets", self.id], headers=headers, model=Resource ) <NEW_LINE> self.raw_model = dataset_object.raw_model <NEW_LINE> return True | Refresh Resource model from API backend.
Returns:
bool: True, if it is able to refresh the model,
False otherwise. | 625941e9c4546d3d9de72ee7 |
def _process_resources(self, resources): <NEW_LINE> <INDENT> self.attr['resources'], self.attr['location_resources'] = [], [] <NEW_LINE> for resource in resources: <NEW_LINE> <INDENT> if isinstance(resource, tuple): <NEW_LINE> <INDENT> src, dst = resource <NEW_LINE> <DEDENT> elif isinstance(resource, str): <NEW_LINE> <... | Process resources which could be regular files/directories or
location references. | 625941e9925a0f43d254a32a |
def reset(self): <NEW_LINE> <INDENT> self.steps = [] | t.reset() restores a pipeline template to its initial state. | 625941e95fcc89381b1e1b71 |
def test_open_handle(self): <NEW_LINE> <INDENT> fcp = FlowCenterPhonePage(self.driver) <NEW_LINE> fcp.wait_Tabloading_show_then_hide() <NEW_LINE> fcp.switch_flow_center_byname('经办') <NEW_LINE> fcp.wait_Tabloading_show_then_hide() <NEW_LINE> fcp.click_processing_first_data() <NEW_LINE> self.assertTrue(fcp.find_element('... | 打开经办测试 | 625941e99b70327d1c4e1286 |
def get_board_size(self): <NEW_LINE> <INDENT> pass | Returns:
(x,y): a tuple of board dimensions | 625941e9bde94217f368329b |
def days_until_due(duedate): <NEW_LINE> <INDENT> dt = datetime.strptime(slugify(duedate), '%Y-%m-%d %a') <NEW_LINE> timediff = dt - const.today <NEW_LINE> return timediff.days | Calculate the (int) number of days left until a task's due date.
Args:
duedate (str): format should be '<%Y-%m-%d %a>' (including brackets) | 625941e9bf627c535bc1367e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.