sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
def checkUpdate(self, *args): """ Updates values after first checking instrument parameters are OK. This is not integrated within update to prevent ifinite recursion since update gets called from ipars. """ g = get_root(self).globals if not self.check(): ...
Updates values after first checking instrument parameters are OK. This is not integrated within update to prevent ifinite recursion since update gets called from ipars.
entailment
def check(self): """ Checks values """ status = True g = get_root(self).globals if self.mag.ok(): self.mag.config(bg=g.COL['main']) else: self.mag.config(bg=g.COL['warn']) status = False if self.airmass.ok(): ...
Checks values
entailment
def update(self, *args): """ Updates values. You should run a check on the instrument and target parameters before calling this. """ g = get_root(self).globals expTime, deadTime, cycleTime, dutyCycle, frameRate = g.ipars.timing() total, peak, peakSat, peakWarn, s...
Updates values. You should run a check on the instrument and target parameters before calling this.
entailment
def counts(self, expTime, cycleTime, ap_scale=1.6, ndiv=5): """ Computes counts per pixel, total counts, sky counts etc given current magnitude, seeing etc. You should run a check on the instrument parameters before calling this. expTime : exposure time per frame (seco...
Computes counts per pixel, total counts, sky counts etc given current magnitude, seeing etc. You should run a check on the instrument parameters before calling this. expTime : exposure time per frame (seconds) cycleTime : sampling, cadence (seconds) ap_scale : apertur...
entailment
def disable(self): """ Disable the button, if in non-expert mode. """ w.ActButton.disable(self) g = get_root(self).globals if self._expert: self.config(bg=g.COL['start']) else: self.config(bg=g.COL['startD'])
Disable the button, if in non-expert mode.
entailment
def setExpert(self): """ Turns on 'expert' status whereby the button is always enabled, regardless of its activity status. """ w.ActButton.setExpert(self) g = get_root(self).globals self.config(bg=g.COL['start'])
Turns on 'expert' status whereby the button is always enabled, regardless of its activity status.
entailment
def act(self): """ Carries out action associated with start button """ g = get_root(self).globals # check binning against overscan msg = """ HiperCAM has an o/scan of 50 pixels. Your binning does not fit into this region. Some columns will contain ...
Carries out action associated with start button
entailment
def act(self): """ Carries out the action associated with the Load button """ g = get_root(self).globals fname = filedialog.askopenfilename( defaultextension='.json', filetypes=[('json files', '.json'), ('fits files', '.fits')], initialdir=g.cp...
Carries out the action associated with the Load button
entailment
def act(self): """ Carries out the action associated with the Save button """ g = get_root(self).globals g.clog.info('\nSaving current application to disk') # check instrument parameters if not g.ipars.check(): g.clog.warn('Invalid instrument paramete...
Carries out the action associated with the Save button
entailment
def act(self): """ Carries out the action associated with the Unfreeze button """ g = get_root(self).globals g.ipars.unfreeze() g.rpars.unfreeze() g.observe.load.enable() self.disable()
Carries out the action associated with the Unfreeze button
entailment
def setExpertLevel(self): """ Set expert level """ g = get_root(self).globals level = g.cpars['expert_level'] # now set whether buttons are permanently enabled or not if level == 0 or level == 1: self.load.setNonExpert() self.save.setNonEx...
Set expert level
entailment
def process_factory_meta_options( mcs_args: McsArgs, default_factory_class: Type[MetaOptionsFactory] = MetaOptionsFactory, factory_attr_name: str = META_OPTIONS_FACTORY_CLASS_ATTR_NAME) \ -> MetaOptionsFactory: """ Main entry point for consumer metaclasses. Usage:: from ...
Main entry point for consumer metaclasses. Usage:: from py_meta_utils import (AbstractMetaOption, McsArgs, MetaOptionsFactory, process_factory_meta_options) class YourMetaOptionsFactory(MetaOptionsFactory): _options = [AbstractMetaOption] class...
entailment
def deep_getattr(clsdict: Dict[str, Any], bases: Tuple[Type[object], ...], name: str, default: Any = _missing) -> Any: """ Acts just like ``getattr`` would on a constructed class object, except this operates on the pre-construction class dictionary and base...
Acts just like ``getattr`` would on a constructed class object, except this operates on the pre-construction class dictionary and base classes. In other words, first we look for the attribute in the class dictionary, and then we search all the base classes (in method resolution order), finally returning the...
entailment
def getattr(self, name, default: Any = _missing): """ Convenience method equivalent to ``deep_getattr(mcs_args.clsdict, mcs_args.bases, 'attr_name'[, default])`` """ return deep_getattr(self.clsdict, self.bases, name, default)
Convenience method equivalent to ``deep_getattr(mcs_args.clsdict, mcs_args.bases, 'attr_name'[, default])``
entailment
def qualname(self) -> str: """ Returns the fully qualified name of the class-under-construction, if possible, otherwise just the class name. """ if self.module: return self.module + '.' + self.name return self.name
Returns the fully qualified name of the class-under-construction, if possible, otherwise just the class name.
entailment
def is_abstract(self) -> bool: """ Whether or not the class-under-construction was declared as abstract (**NOTE:** this property is usable even *before* the :class:`MetaOptionsFactory` has run) """ meta_value = getattr(self.clsdict.get('Meta'), 'abstract', False) return s...
Whether or not the class-under-construction was declared as abstract (**NOTE:** this property is usable even *before* the :class:`MetaOptionsFactory` has run)
entailment
def get_value(self, Meta: Type[object], base_classes_meta, mcs_args: McsArgs) -> Any: """ Returns the value for ``self.name`` given the class-under-construction's class ``Meta``. If it's not found there, and ``self.inherit == True`` and there is a base class that has a class ``Meta``, us...
Returns the value for ``self.name`` given the class-under-construction's class ``Meta``. If it's not found there, and ``self.inherit == True`` and there is a base class that has a class ``Meta``, use that value, otherwise ``self.default``. :param Meta: the class ``Meta`` (if any) from the class...
entailment
def _get_meta_options(self) -> List[MetaOption]: """ Returns a list of :class:`MetaOption` instances that this factory supports. """ return [option if isinstance(option, MetaOption) else option() for option in self._options]
Returns a list of :class:`MetaOption` instances that this factory supports.
entailment
def _contribute_to_class(self, mcs_args: McsArgs): """ Where the magic happens. Takes one parameter, the :class:`McsArgs` of the class-under-construction, and processes the declared ``class Meta`` from it (if any). We fill ourself with the declared meta options' name/value pairs, ...
Where the magic happens. Takes one parameter, the :class:`McsArgs` of the class-under-construction, and processes the declared ``class Meta`` from it (if any). We fill ourself with the declared meta options' name/value pairs, give the declared meta options a chance to also contribute to the clas...
entailment
def _fill_from_meta(self, Meta: Type[object], base_classes_meta, mcs_args: McsArgs): """ Iterate over our supported meta options, and set attributes on the factory instance (self) for each meta option's name/value. Raises ``TypeError`` if we discover any unsupported meta options on the c...
Iterate over our supported meta options, and set attributes on the factory instance (self) for each meta option's name/value. Raises ``TypeError`` if we discover any unsupported meta options on the class-under-construction's ``class Meta``.
entailment
def get_object(self, binding_name, cls): """ Get a reference to a remote object using CORBA """ return self._state.get_object(self, binding_name, cls)
Get a reference to a remote object using CORBA
entailment
def get_object(conn, binding_name, object_cls): """ Get a reference to a remote object using CORBA """ try: obj = conn.rootContext.resolve(binding_name) narrowed = obj._narrow(object_cls) except CORBA.TRANSIENT: raise IOError('Attempt to retrie...
Get a reference to a remote object using CORBA
entailment
def set(self, num): """ Sets the current value equal to num """ self._value = str(int(num)) self._variable.set(self._value)
Sets the current value equal to num
entailment
def on_key_release_repeat(self, *dummy): """ Avoid repeated trigger of callback. When holding a key down, multiple key press and release events are fired in succession. Debouncing is implemented to squash these. """ self.has_prev_key_release = self.after_idle(self.on_key...
Avoid repeated trigger of callback. When holding a key down, multiple key press and release events are fired in succession. Debouncing is implemented to squash these.
entailment
def set_bind(self): """ Sets key bindings. """ # Arrow keys and enter self.bind('<Up>', lambda e: self.on_key_press_repeat('Up')) self.bind('<Down>', lambda e: self.on_key_press_repeat('Down')) self.bind('<Shift-Up>', lambda e: self.on_key_press_repeat('Shift-Up')...
Sets key bindings.
entailment
def _pollMouse(self): """ Polls @10Hz, with a slight delay at the start. """ if self._mouseJustPressed: delay = 300 self._mouseJustPressed = False else: delay = 100 if self._leftMousePressed: self.add(1) ...
Polls @10Hz, with a slight delay at the start.
entailment
def _callback(self, *dummy): """ This gets called on any attempt to change the value """ # retrieve the value from the Entry value = self._variable.get() # run the validation. Returns None if no good newvalue = self.validate(value) if newvalue is None: ...
This gets called on any attempt to change the value
entailment
def set_bind(self): """ Sets key bindings -- we need this more than once """ IntegerEntry.set_bind(self) self.bind('<Next>', lambda e: self.set(0))
Sets key bindings -- we need this more than once
entailment
def validate(self, value): """ Applies the validation criteria. Returns value, new value, or None if invalid. Overload this in derived classes. """ try: # trap blank fields here if not self.blank or value: v = int(value) ...
Applies the validation criteria. Returns value, new value, or None if invalid. Overload this in derived classes.
entailment
def add(self, num): """ Adds num to the current value """ try: val = self.value() + num except: val = num self.set(max(0, val))
Adds num to the current value
entailment
def sub(self, num): """ Subtracts num from the current value """ try: val = self.value() - num except: val = -num self.set(max(0, val))
Subtracts num from the current value
entailment
def ok(self): """ Returns True if OK to use, else False """ try: v = int(self._value) if v < 0: return False else: return True except: return False
Returns True if OK to use, else False
entailment
def set_bind(self): """ Sets key bindings -- we need this more than once """ IntegerEntry.set_bind(self) self.bind('<Next>', lambda e: self.set(self.imin)) self.bind('<Prior>', lambda e: self.set(self.imax))
Sets key bindings -- we need this more than once
entailment
def validate(self, value): """ Applies the validation criteria. Returns value, new value, or None if invalid. Overload this in derived classes. """ try: # trap blank fields here if not self.blank or value: v = int(value) ...
Applies the validation criteria. Returns value, new value, or None if invalid. Overload this in derived classes.
entailment
def add(self, num): """ Adds num to the current value """ try: val = self.value() + num except: val = num self.set(min(self.imax, max(self.imin, val)))
Adds num to the current value
entailment
def ok(self): """ Returns True if OK to use, else False """ try: v = int(self._value) if v < self.imin or v > self.imax: return False else: return True except: return False
Returns True if OK to use, else False
entailment
def set_bind(self): """ Sets key bindings -- we need this more than once """ RangedInt.set_bind(self) self.unbind('<Next>') self.unbind('<Prior>') self.bind('<Next>', lambda e: self.set(self._min())) self.bind('<Prior>', lambda e: self.set(self._max()))
Sets key bindings -- we need this more than once
entailment
def add(self, num): """ Adds num to the current value, jumping up the next multiple of mfac if the result is not a multiple already """ try: val = self.value() + num except: val = num chunk = self.mfac.value() if val % chunk > 0: ...
Adds num to the current value, jumping up the next multiple of mfac if the result is not a multiple already
entailment
def ok(self): """ Returns True if OK to use, else False """ try: v = int(self._value) chunk = self.mfac.value() if v < self.imin or v > self.imax or (v % chunk != 0): return False else: return True ex...
Returns True if OK to use, else False
entailment
def set_bind(self): """ Sets key bindings -- we need this more than once """ IntegerEntry.set_bind(self) self.unbind('<Shift-Up>') self.unbind('<Shift-Down>') self.unbind('<Control-Up>') self.unbind('<Control-Down>') self.unbind('<Double-Button-1>'...
Sets key bindings -- we need this more than once
entailment
def set_unbind(self): """ Unsets key bindings -- we need this more than once """ IntegerEntry.set_unbind(self) self.unbind('<Button-1>') self.unbind('<Button-3>') self.unbind('<Up>') self.unbind('<Down>') self.unbind('<Enter>') self.unbind(...
Unsets key bindings -- we need this more than once
entailment
def validate(self, value): """ Applies the validation criteria. Returns value, new value, or None if invalid. Overload this in derived classes. """ try: v = int(value) if v not in self.allowed: return None return value ...
Applies the validation criteria. Returns value, new value, or None if invalid. Overload this in derived classes.
entailment
def set(self, num): """ Sets current value to num """ if self.validate(num) is not None: self.index = self.allowed.index(num) IntegerEntry.set(self, num)
Sets current value to num
entailment
def add(self, num): """ Adds num to the current value """ self.index = max(0, min(len(self.allowed)-1, self.index+num)) self.set(self.allowed[self.index])
Adds num to the current value
entailment
def validate(self, value): """ Applies the validation criteria. Returns value, new value, or None if invalid. Overload this in derived classes. """ try: # trap blank fields here if not self.blank or value: float(value) ...
Applies the validation criteria. Returns value, new value, or None if invalid. Overload this in derived classes.
entailment
def set(self, num): """ Sets the current value equal to num """ self._value = str(round(float(num), self.nplaces)) self._variable.set(self._value)
Sets the current value equal to num
entailment
def set_bind(self): """ Sets key bindings. """ self.bind('<Button-1>', lambda e: self.add(0.1)) self.bind('<Button-3>', lambda e: self.sub(0.1)) self.bind('<Up>', lambda e: self.add(0.1)) self.bind('<Down>', lambda e: self.sub(0.1)) self.bind('<Shift-Up>',...
Sets key bindings.
entailment
def set_unbind(self): """ Unsets key bindings. """ self.unbind('<Button-1>') self.unbind('<Button-3>') self.unbind('<Up>') self.unbind('<Down>') self.unbind('<Shift-Up>') self.unbind('<Shift-Down>') self.unbind('<Control-Up>') self....
Unsets key bindings.
entailment
def set_bind(self): """ Sets key bindings -- we need this more than once """ FloatEntry.set_bind(self) self.bind('<Next>', lambda e: self.set(self.fmin)) self.bind('<Prior>', lambda e: self.set(self.fmax))
Sets key bindings -- we need this more than once
entailment
def validate(self, value): """ Applies the validation criteria. Returns value, new value, or None if invalid. Overload this in derived classes. """ try: # trap blank fields here if not self.blank or value: v = float(value) ...
Applies the validation criteria. Returns value, new value, or None if invalid. Overload this in derived classes.
entailment
def add(self, num): """ Adds num to the current value """ try: val = self.value() + num except: val = num self.set(min(self.fmax, max(self.fmin, val)))
Adds num to the current value
entailment
def ok(self): """ Returns True if OK to use, else False """ try: v = float(self._value) if v < self.fmin or v > self.fmax: return False else: return True except: return False
Returns True if OK to use, else False
entailment
def validate(self, value): """ This prevents setting any value more precise than 0.00001 """ try: # trap blank fields here if value: v = float(value) if (v != 0 and v < self.fmin) or v > self.fmax: return None ...
This prevents setting any value more precise than 0.00001
entailment
def set_min(self, fmin): """ Updates minimum value """ if round(100000*fmin) != 100000*fmin: raise DriverError('utils.widgets.Expose.set_min: ' + 'fmin must be a multiple of 0.00001') self.fmin = fmin self.set(self.fmin)
Updates minimum value
entailment
def disable(self): """ Disable the button, if in non-expert mode; unset its activity flag come-what-may. """ if not self._expert: self.config(state='disable') self._active = False
Disable the button, if in non-expert mode; unset its activity flag come-what-may.
entailment
def setNonExpert(self): """ Turns off 'expert' status whereby to allow a button to be disabled """ self._expert = False if self._active: self.enable() else: self.disable()
Turns off 'expert' status whereby to allow a button to be disabled
entailment
def validate(self, value): """ Applies the validation criteria. Returns value, new value, or None if invalid. """ try: coord.Angle(value, unit=self.unit) return value except ValueError: return None
Applies the validation criteria. Returns value, new value, or None if invalid.
entailment
def set(self, num): """ Sets the current value equal to num """ self._value = coord.Angle(num, unit=u.deg) self._variable.set(self.as_string())
Sets the current value equal to num
entailment
def add(self, quantity): """ Adds an angle to the value """ newvalue = self._value + quantity self.set(newvalue.deg)
Adds an angle to the value
entailment
def sub(self, quantity): """ Subtracts an angle from the value """ newvalue = self._value - quantity self.set(newvalue.deg)
Subtracts an angle from the value
entailment
def ok(self): """ Returns True if OK to use, else False """ try: coord.Angle(self._value, unit=u.deg) return True except ValueError: return False
Returns True if OK to use, else False
entailment
def _callback(self, *dummy): """ This gets called on any attempt to change the value """ # retrieve the value from the Entry value = self._variable.get() # run the validation. Returns None if no good newvalue = self.validate(value) if newvalue is None: ...
This gets called on any attempt to change the value
entailment
def act(self): """ Carries out the action associated with Stop button """ g = get_root(self).globals g.clog.debug('Stop pressed') # Stop exposure meter # do this first, so timer doesn't also try to enable idle mode g.info.timer.stop() def stop_in...
Carries out the action associated with Stop button
entailment
def check(self): """ Checks the status of the stop exposure command This is run in background and can take a few seconds """ g = get_root(self).globals if self.stopped_ok: # Exposure stopped OK; modify buttons self.disable() # try and ...
Checks the status of the stop exposure command This is run in background and can take a few seconds
entailment
def modver(self, *args): """ Switches colour of verify button """ g = get_root(self).globals if self.ok(): tname = self.val.get() if tname in self.successes: # known to be in simbad self.verify.config(bg=g.COL['start']) ...
Switches colour of verify button
entailment
def act(self): """ Carries out the action associated with Verify button """ tname = self.val.get() g = get_root(self).globals g.clog.info('Checking ' + tname + ' in simbad') try: ret = checkSimbad(g, tname) if len(ret) == 0: ...
Carries out the action associated with Verify button
entailment
def act(self): """ Power on action """ g = get_root(self).globals g.clog.debug('Power on pressed') if execCommand(g, 'online'): g.clog.info('ESO server online') g.cpars['eso_server_online'] = True if not isPoweredOn(g): ...
Power on action
entailment
def setExpertLevel(self): """ Set expert level """ g = get_root(self).globals level = g.cpars['expert_level'] # first define which buttons are visible if level == 0: # simple layout for button in self.all_buttons: button.gr...
Set expert level
entailment
def setExpertLevel(self): """ Modifies widget according to expertise level, which in this case is just matter of hiding or revealing the button to set CCD temps """ g = get_root(self).globals level = g.cpars['expert_level'] if level == 0: if se...
Modifies widget according to expertise level, which in this case is just matter of hiding or revealing the button to set CCD temps
entailment
def start(self): """ Starts the timer from zero """ self.startTime = time.time() self.configure(text='{0:<d} s'.format(0)) self.update()
Starts the timer from zero
entailment
def update(self): """ Updates @ 10Hz to give smooth running clock, checks run status @0.2Hz to reduce load on servers. """ g = get_root(self).globals try: self.count += 1 delta = int(round(time.time() - self.startTime)) self.configure(t...
Updates @ 10Hz to give smooth running clock, checks run status @0.2Hz to reduce load on servers.
entailment
def dumpJSON(self): """ Return dictionary of data for FITS headers. """ g = get_root(self).globals return dict( RA=self.ra['text'], DEC=self.dec['text'], tel=g.cpars['telins_name'], alt=self._getVal(self.alt), az=self._g...
Return dictionary of data for FITS headers.
entailment
def update_tcs_table(self): """ Periodically update a table of info from the TCS. Only works at GTC """ g = get_root(self).globals if not g.cpars['tcs_on'] or not g.cpars['telins_name'].lower() == 'gtc': self.after(60000, self.update_tcs_table) re...
Periodically update a table of info from the TCS. Only works at GTC
entailment
def update_tcs(self): """ Periodically update TCS info. A long running process, so run in a thread and fill a queue """ g = get_root(self).globals if not g.cpars['tcs_on']: self.after(20000, self.update_tcs) return if g.cpars['telins_nam...
Periodically update TCS info. A long running process, so run in a thread and fill a queue
entailment
def update_slidepos(self): """ Periodically update the slide position. Also farmed out to a thread to avoid hanging GUI main thread """ g = get_root(self).globals if not g.cpars['focal_plane_slide_on']: self.after(20000, self.update_slidepos) retu...
Periodically update the slide position. Also farmed out to a thread to avoid hanging GUI main thread
entailment
def update(self): """ Updates run & tel status window. Runs once every 2 seconds. """ g = get_root(self).globals if g.astro is None or g.fpslide is None: self.after(100, self.update) return try: if g.cpars['tcs_on']: ...
Updates run & tel status window. Runs once every 2 seconds.
entailment
def update(self): """ Updates @ 10Hz to give smooth running clock. """ try: # update counter self.counter += 1 g = get_root(self).globals # current time now = Time.now() # configure times self.utc.con...
Updates @ 10Hz to give smooth running clock.
entailment
def check(self): """ Checks the values of the window pairs. If any problems are found, it flags them by changing the background colour. Returns (status, synced) status : flag for whether parameters are viable at all synced : flag for whether the windows are synchron...
Checks the values of the window pairs. If any problems are found, it flags them by changing the background colour. Returns (status, synced) status : flag for whether parameters are viable at all synced : flag for whether the windows are synchronised.
entailment
def sync(self): """ Synchronise the settings. This means that the pixel start values are shifted downwards so that they are synchronised with a full-frame binned version. This does nothing if the binning factors == 1. """ # needs some mods for ultracam ?? ...
Synchronise the settings. This means that the pixel start values are shifted downwards so that they are synchronised with a full-frame binned version. This does nothing if the binning factors == 1.
entailment
def freeze(self): """ Freeze (disable) all settings so they can't be altered """ for xsl, xsr, ys, nx, ny in \ zip(self.xsl, self.xsr, self.ys, self.nx, self.ny): xsl.disable() xsr.disable() ys.disable() ...
Freeze (disable) all settings so they can't be altered
entailment
def disable(self, everything=False): """ Disable all but possibly not binning, which is needed for FF apps Parameters --------- everything : bool disable binning as well """ self.freeze() if not everything: self.xbin.enable() ...
Disable all but possibly not binning, which is needed for FF apps Parameters --------- everything : bool disable binning as well
entailment
def enable(self): """ Enables WinPair settings """ npair = self.npair.value() for label, xsl, xsr, ys, nx, ny in \ zip(self.label[:npair], self.xsl[:npair], self.xsr[:npair], self.ys[:npair], self.nx[:npair], self.ny[:npair]): label...
Enables WinPair settings
entailment
def check(self): """ Checks the values of the window quads. If any problems are found it flags the offending window by changing the background colour. Returns: status : bool """ status = synced = True xbin = self.xbin.value() ybin = self.ybin...
Checks the values of the window quads. If any problems are found it flags the offending window by changing the background colour. Returns: status : bool
entailment
def sync(self): """ Synchronise the settings. This routine changes the window settings so that the pixel start values are shifted downwards until they are synchronised with a full-frame binned version. This does nothing if the binning factor is 1. """ xbi...
Synchronise the settings. This routine changes the window settings so that the pixel start values are shifted downwards until they are synchronised with a full-frame binned version. This does nothing if the binning factor is 1.
entailment
def freeze(self): """ Freeze (disable) all settings """ for fields in zip(self.xsll, self.xsul, self.xslr, self.xsur, self.ys, self.nx, self.ny): for field in fields: field.disable() self.nquad.disable() self.xbin.disa...
Freeze (disable) all settings
entailment
def enable(self): """ Enables WinQuad setting """ nquad = self.nquad.value() for label, xsll, xsul, xslr, xsur, ys, nx, ny in \ zip(self.label[:nquad], self.xsll[:nquad], self.xsul[:nquad], self.xslr[:nquad], self.xsur[:nquad], self.ys[:nquad],...
Enables WinQuad setting
entailment
def check(self): """ Checks the values of the windows. If any problems are found, it flags them by changing the background colour. Only active windows are checked. Returns status, flag for whether parameters are viable. """ status = True synced = True ...
Checks the values of the windows. If any problems are found, it flags them by changing the background colour. Only active windows are checked. Returns status, flag for whether parameters are viable.
entailment
def sync(self, *args): """ Synchronise the settings. This means that the pixel start values are shifted downwards so that they are synchronised with a full-frame binned version. This does nothing if the binning factor == 1 """ xbin = self.xbin.value() ybin...
Synchronise the settings. This means that the pixel start values are shifted downwards so that they are synchronised with a full-frame binned version. This does nothing if the binning factor == 1
entailment
def freeze(self): """ Freeze all settings so they can't be altered """ for xs, ys, nx, ny in \ zip(self.xs, self.ys, self.nx, self.ny): xs.disable() ys.disable() nx.disable() ny.disable() self.nwin.disable() ...
Freeze all settings so they can't be altered
entailment
def enable(self): """ Enables all settings """ nwin = self.nwin.value() for label, xs, ys, nx, ny in \ zip(self.label[:nwin], self.xs[:nwin], self.ys[:nwin], self.nx[:nwin], self.ny[:nwin]): label.config(state='normal') ...
Enables all settings
entailment
def check_download(self, link_item_dict: Dict[str, LinkItem], folder: Path, log: bool = True) -> Tuple[ Dict[str, LinkItem], Dict[str, LinkItem]]: """ Check if the download of the given dict was successful. No proving if the content of the file is correct too. :param link_item_dict: dic...
Check if the download of the given dict was successful. No proving if the content of the file is correct too. :param link_item_dict: dict which to check :type link_item_dict: Dict[str, ~unidown.plugin.link_item.LinkItem] :param folder: folder where the downloads are saved :type folder: ...
entailment
def delete_data(self): """ Delete everything which is related to the plugin. **Do not use if you do not know what you do!** """ self.clean_up() tools.delete_dir_rec(self._download_path) if self._save_state_file.exists(): self._save_state_file.unlink()
Delete everything which is related to the plugin. **Do not use if you do not know what you do!**
entailment
def download_as_file(self, url: str, folder: Path, name: str, delay: float = 0) -> str: """ Download the given url to the given target folder. :param url: link :type url: str :param folder: target folder :type folder: ~pathlib.Path :param name: target file name ...
Download the given url to the given target folder. :param url: link :type url: str :param folder: target folder :type folder: ~pathlib.Path :param name: target file name :type name: str :param delay: after download wait in seconds :type delay: float ...
entailment
def download(self, link_item_dict: Dict[str, LinkItem], folder: Path, desc: str, unit: str, delay: float = 0) -> \ List[str]: """ .. warning:: The parameters may change in future versions. (e.g. change order and accept another host) Download the given LinkItem dict from...
.. warning:: The parameters may change in future versions. (e.g. change order and accept another host) Download the given LinkItem dict from the plugins host, to the given path. Proceeded with multiple connections :attr:`~unidown.plugin.a_plugin.APlugin._simul_downloads`. After :fu...
entailment
def _create_save_state(self, link_item_dict: Dict[str, LinkItem]) -> SaveState: """ Create protobuf savestate of the module and the given data. :param link_item_dict: data :type link_item_dict: Dict[str, ~unidown.plugin.link_item.LinkItem] :return: the savestate :rtype: ...
Create protobuf savestate of the module and the given data. :param link_item_dict: data :type link_item_dict: Dict[str, ~unidown.plugin.link_item.LinkItem] :return: the savestate :rtype: ~unidown.plugin.save_state.SaveState
entailment
def save_save_state(self, data_dict: Dict[str, LinkItem]): # TODO: add progressbar """ Save meta data about the downloaded things and the plugin to file. :param data_dict: data :type data_dict: Dict[link, ~unidown.plugin.link_item.LinkItem] """ json_data = json_format.M...
Save meta data about the downloaded things and the plugin to file. :param data_dict: data :type data_dict: Dict[link, ~unidown.plugin.link_item.LinkItem]
entailment
def load_save_state(self) -> SaveState: """ Load the savestate of the plugin. :return: savestate :rtype: ~unidown.plugin.save_state.SaveState :raises ~unidown.plugin.exceptions.PluginException: broken savestate json :raises ~unidown.plugin.exceptions.PluginException: dif...
Load the savestate of the plugin. :return: savestate :rtype: ~unidown.plugin.save_state.SaveState :raises ~unidown.plugin.exceptions.PluginException: broken savestate json :raises ~unidown.plugin.exceptions.PluginException: different savestate versions :raises ~unidown.plugin.ex...
entailment
def get_updated_data(self, old_data: Dict[str, LinkItem]) -> Dict[str, LinkItem]: """ Get links who needs to be downloaded by comparing old and the new data. :param old_data: old data :type old_data: Dict[str, ~unidown.plugin.link_item.LinkItem] :return: data which is newer or d...
Get links who needs to be downloaded by comparing old and the new data. :param old_data: old data :type old_data: Dict[str, ~unidown.plugin.link_item.LinkItem] :return: data which is newer or dont exist in the old one :rtype: Dict[str, ~unidown.plugin.link_item.LinkItem]
entailment
def update_dict(self, base: Dict[str, LinkItem], new: Dict[str, LinkItem]): """ Use for updating save state dicts and get the new save state dict. Provides a debug option at info level. Updates the base dict. Basically executes `base.update(new)`. :param base: base dict **gets overridde...
Use for updating save state dicts and get the new save state dict. Provides a debug option at info level. Updates the base dict. Basically executes `base.update(new)`. :param base: base dict **gets overridden!** :type base: Dict[str, ~unidown.plugin.link_item.LinkItem] :param new: data ...
entailment
def _get_options_dic(self, options: List[str]) -> Dict[str, str]: """ Convert the option list to a dictionary where the key is the option and the value is the related option. Is called in the init. :param options: options given to the plugin. :type options: List[str] :re...
Convert the option list to a dictionary where the key is the option and the value is the related option. Is called in the init. :param options: options given to the plugin. :type options: List[str] :return: dictionary which contains the option key as str related to the option string ...
entailment