partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
FloatEntry.set_bind
Sets key bindings.
hcam_widgets/widgets.py
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>',...
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", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L879-L897
[ "def", "set_bind", "(", "self", ")", ":", "self", ".", "bind", "(", "'<Button-1>'", ",", "lambda", "e", ":", "self", ".", "add", "(", "0.1", ")", ")", "self", ".", "bind", "(", "'<Button-3>'", ",", "lambda", "e", ":", "self", ".", "sub", "(", "0....
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
FloatEntry.set_unbind
Unsets key bindings.
hcam_widgets/widgets.py
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....
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", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L899-L917
[ "def", "set_unbind", "(", "self", ")", ":", "self", ".", "unbind", "(", "'<Button-1>'", ")", "self", ".", "unbind", "(", "'<Button-3>'", ")", "self", ".", "unbind", "(", "'<Up>'", ")", "self", ".", "unbind", "(", "'<Down>'", ")", "self", ".", "unbind",...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
RangedFloat.set_bind
Sets key bindings -- we need this more than once
hcam_widgets/widgets.py
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))
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L989-L995
[ "def", "set_bind", "(", "self", ")", ":", "FloatEntry", ".", "set_bind", "(", "self", ")", "self", ".", "bind", "(", "'<Next>'", ",", "lambda", "e", ":", "self", ".", "set", "(", "self", ".", "fmin", ")", ")", "self", ".", "bind", "(", "'<Prior>'",...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
RangedFloat.validate
Applies the validation criteria. Returns value, new value, or None if invalid. Overload this in derived classes.
hcam_widgets/widgets.py
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) ...
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", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1005-L1021
[ "def", "validate", "(", "self", ",", "value", ")", ":", "try", ":", "# trap blank fields here", "if", "not", "self", ".", "blank", "or", "value", ":", "v", "=", "float", "(", "value", ")", "if", "(", "self", ".", "allowzero", "and", "v", "!=", "0", ...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
RangedFloat.add
Adds num to the current value
hcam_widgets/widgets.py
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)))
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1023-L1031
[ "def", "add", "(", "self", ",", "num", ")", ":", "try", ":", "val", "=", "self", ".", "value", "(", ")", "+", "num", "except", ":", "val", "=", "num", "self", ".", "set", "(", "min", "(", "self", ".", "fmax", ",", "max", "(", "self", ".", "...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
RangedFloat.ok
Returns True if OK to use, else False
hcam_widgets/widgets.py
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
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1043-L1054
[ "def", "ok", "(", "self", ")", ":", "try", ":", "v", "=", "float", "(", "self", ".", "_value", ")", "if", "v", "<", "self", ".", "fmin", "or", "v", ">", "self", ".", "fmax", ":", "return", "False", "else", ":", "return", "True", "except", ":", ...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Expose.validate
This prevents setting any value more precise than 0.00001
hcam_widgets/widgets.py
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 ...
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1177-L1191
[ "def", "validate", "(", "self", ",", "value", ")", ":", "try", ":", "# trap blank fields here", "if", "value", ":", "v", "=", "float", "(", "value", ")", "if", "(", "v", "!=", "0", "and", "v", "<", "self", ".", "fmin", ")", "or", "v", ">", "self"...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Expose.set_min
Updates minimum value
hcam_widgets/widgets.py
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)
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1202-L1210
[ "def", "set_min", "(", "self", ",", "fmin", ")", ":", "if", "round", "(", "100000", "*", "fmin", ")", "!=", "100000", "*", "fmin", ":", "raise", "DriverError", "(", "'utils.widgets.Expose.set_min: '", "+", "'fmin must be a multiple of 0.00001'", ")", "self", "...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
ActButton.disable
Disable the button, if in non-expert mode; unset its activity flag come-what-may.
hcam_widgets/widgets.py
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
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", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1445-L1452
[ "def", "disable", "(", "self", ")", ":", "if", "not", "self", ".", "_expert", ":", "self", ".", "config", "(", "state", "=", "'disable'", ")", "self", ".", "_active", "=", "False" ]
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
ActButton.setNonExpert
Turns off 'expert' status whereby to allow a button to be disabled
hcam_widgets/widgets.py
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()
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1462-L1470
[ "def", "setNonExpert", "(", "self", ")", ":", "self", ".", "_expert", "=", "False", "if", "self", ".", "_active", ":", "self", ".", "enable", "(", ")", "else", ":", "self", ".", "disable", "(", ")" ]
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Sexagesimal.validate
Applies the validation criteria. Returns value, new value, or None if invalid.
hcam_widgets/widgets.py
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
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", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1527-L1536
[ "def", "validate", "(", "self", ",", "value", ")", ":", "try", ":", "coord", ".", "Angle", "(", "value", ",", "unit", "=", "self", ".", "unit", ")", "return", "value", "except", "ValueError", ":", "return", "None" ]
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Sexagesimal.set
Sets the current value equal to num
hcam_widgets/widgets.py
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())
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1547-L1552
[ "def", "set", "(", "self", ",", "num", ")", ":", "self", ".", "_value", "=", "coord", ".", "Angle", "(", "num", ",", "unit", "=", "u", ".", "deg", ")", "self", ".", "_variable", ".", "set", "(", "self", ".", "as_string", "(", ")", ")" ]
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Sexagesimal.add
Adds an angle to the value
hcam_widgets/widgets.py
def add(self, quantity): """ Adds an angle to the value """ newvalue = self._value + quantity self.set(newvalue.deg)
def add(self, quantity): """ Adds an angle to the value """ newvalue = self._value + quantity self.set(newvalue.deg)
[ "Adds", "an", "angle", "to", "the", "value" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1555-L1560
[ "def", "add", "(", "self", ",", "quantity", ")", ":", "newvalue", "=", "self", ".", "_value", "+", "quantity", "self", ".", "set", "(", "newvalue", ".", "deg", ")" ]
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Sexagesimal.sub
Subtracts an angle from the value
hcam_widgets/widgets.py
def sub(self, quantity): """ Subtracts an angle from the value """ newvalue = self._value - quantity self.set(newvalue.deg)
def sub(self, quantity): """ Subtracts an angle from the value """ newvalue = self._value - quantity self.set(newvalue.deg)
[ "Subtracts", "an", "angle", "from", "the", "value" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1563-L1568
[ "def", "sub", "(", "self", ",", "quantity", ")", ":", "newvalue", "=", "self", ".", "_value", "-", "quantity", "self", ".", "set", "(", "newvalue", ".", "deg", ")" ]
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Sexagesimal.ok
Returns True if OK to use, else False
hcam_widgets/widgets.py
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
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1570-L1578
[ "def", "ok", "(", "self", ")", ":", "try", ":", "coord", ".", "Angle", "(", "self", ".", "_value", ",", "unit", "=", "u", ".", "deg", ")", "return", "True", "except", "ValueError", ":", "return", "False" ]
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Sexagesimal._callback
This gets called on any attempt to change the value
hcam_widgets/widgets.py
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: ...
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1628-L1644
[ "def", "_callback", "(", "self", ",", "*", "dummy", ")", ":", "# retrieve the value from the Entry", "value", "=", "self", ".", "_variable", ".", "get", "(", ")", "# run the validation. Returns None if no good", "newvalue", "=", "self", ".", "validate", "(", "valu...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Stop.act
Carries out the action associated with Stop button
hcam_widgets/widgets.py
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...
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1719-L1749
[ "def", "act", "(", "self", ")", ":", "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", ...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Stop.check
Checks the status of the stop exposure command This is run in background and can take a few seconds
hcam_widgets/widgets.py
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 ...
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1751-L1816
[ "def", "check", "(", "self", ")", ":", "g", "=", "get_root", "(", "self", ")", ".", "globals", "if", "self", ".", "stopped_ok", ":", "# Exposure stopped OK; modify buttons", "self", ".", "disable", "(", ")", "# try and write FITS table before enabling start button, ...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Target.modver
Switches colour of verify button
hcam_widgets/widgets.py
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']) ...
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1940-L1962
[ "def", "modver", "(", "self", ",", "*", "args", ")", ":", "g", "=", "get_root", "(", "self", ")", ".", "globals", "if", "self", ".", "ok", "(", ")", ":", "tname", "=", "self", ".", "val", ".", "get", "(", ")", "if", "tname", "in", "self", "."...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Target.act
Carries out the action associated with Verify button
hcam_widgets/widgets.py
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: ...
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1964-L1992
[ "def", "act", "(", "self", ")", ":", "tname", "=", "self", ".", "val", ".", "get", "(", ")", "g", "=", "get_root", "(", "self", ")", ".", "globals", "g", ".", "clog", ".", "info", "(", "'Checking '", "+", "tname", "+", "' in simbad'", ")", "try",...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
PowerOn.act
Power on action
hcam_widgets/widgets.py
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): ...
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2262-L2298
[ "def", "act", "(", "self", ")", ":", "g", "=", "get_root", "(", "self", ")", ".", "globals", "g", ".", "clog", ".", "debug", "(", "'Power on pressed'", ")", "if", "execCommand", "(", "g", ",", "'online'", ")", ":", "g", ".", "clog", ".", "info", ...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
InstSetup.setExpertLevel
Set expert level
hcam_widgets/widgets.py
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...
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2373-L2412
[ "def", "setExpertLevel", "(", "self", ")", ":", "g", "=", "get_root", "(", "self", ")", ".", "globals", "level", "=", "g", ".", "cpars", "[", "'expert_level'", "]", "# first define which buttons are visible", "if", "level", "==", "0", ":", "# simple layout", ...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Switch.setExpertLevel
Modifies widget according to expertise level, which in this case is just matter of hiding or revealing the button to set CCD temps
hcam_widgets/widgets.py
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...
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2477-L2491
[ "def", "setExpertLevel", "(", "self", ")", ":", "g", "=", "get_root", "(", "self", ")", ".", "globals", "level", "=", "g", ".", "cpars", "[", "'expert_level'", "]", "if", "level", "==", "0", ":", "if", "self", ".", "val", ".", "get", "(", ")", "=...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Timer.start
Starts the timer from zero
hcam_widgets/widgets.py
def start(self): """ Starts the timer from zero """ self.startTime = time.time() self.configure(text='{0:<d} s'.format(0)) self.update()
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2580-L2586
[ "def", "start", "(", "self", ")", ":", "self", ".", "startTime", "=", "time", ".", "time", "(", ")", "self", ".", "configure", "(", "text", "=", "'{0:<d} s'", ".", "format", "(", "0", ")", ")", "self", ".", "update", "(", ")" ]
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Timer.update
Updates @ 10Hz to give smooth running clock, checks run status @0.2Hz to reduce load on servers.
hcam_widgets/widgets.py
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...
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2588-L2647
[ "def", "update", "(", "self", ")", ":", "g", "=", "get_root", "(", "self", ")", ".", "globals", "try", ":", "self", ".", "count", "+=", "1", "delta", "=", "int", "(", "round", "(", "time", ".", "time", "(", ")", "-", "self", ".", "startTime", "...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
InfoFrame.dumpJSON
Return dictionary of data for FITS headers.
hcam_widgets/widgets.py
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...
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", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2751-L2766
[ "def", "dumpJSON", "(", "self", ")", ":", "g", "=", "get_root", "(", "self", ")", ".", "globals", "return", "dict", "(", "RA", "=", "self", ".", "ra", "[", "'text'", "]", ",", "DEC", "=", "self", ".", "dec", "[", "'text'", "]", ",", "tel", "=",...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
InfoFrame.update_tcs_table
Periodically update a table of info from the TCS. Only works at GTC
hcam_widgets/widgets.py
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...
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", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2774-L2793
[ "def", "update_tcs_table", "(", "self", ")", ":", "g", "=", "get_root", "(", "self", ")", ".", "globals", "if", "not", "g", ".", "cpars", "[", "'tcs_on'", "]", "or", "not", "g", ".", "cpars", "[", "'telins_name'", "]", ".", "lower", "(", ")", "==",...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
InfoFrame.update_tcs
Periodically update TCS info. A long running process, so run in a thread and fill a queue
hcam_widgets/widgets.py
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...
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", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2795-L2829
[ "def", "update_tcs", "(", "self", ")", ":", "g", "=", "get_root", "(", "self", ")", ".", "globals", "if", "not", "g", ".", "cpars", "[", "'tcs_on'", "]", ":", "self", ".", "after", "(", "20000", ",", "self", ".", "update_tcs", ")", "return", "if", ...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
InfoFrame.update_slidepos
Periodically update the slide position. Also farmed out to a thread to avoid hanging GUI main thread
hcam_widgets/widgets.py
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...
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", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2831-L2855
[ "def", "update_slidepos", "(", "self", ")", ":", "g", "=", "get_root", "(", "self", ")", ".", "globals", "if", "not", "g", ".", "cpars", "[", "'focal_plane_slide_on'", "]", ":", "self", ".", "after", "(", "20000", ",", "self", ".", "update_slidepos", "...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
InfoFrame.update
Updates run & tel status window. Runs once every 2 seconds.
hcam_widgets/widgets.py
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']: ...
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", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2857-L2991
[ "def", "update", "(", "self", ")", ":", "g", "=", "get_root", "(", "self", ")", ".", "globals", "if", "g", ".", "astro", "is", "None", "or", "g", ".", "fpslide", "is", "None", ":", "self", ".", "after", "(", "100", ",", "self", ".", "update", "...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
AstroFrame.update
Updates @ 10Hz to give smooth running clock.
hcam_widgets/widgets.py
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...
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3081-L3195
[ "def", "update", "(", "self", ")", ":", "try", ":", "# update counter", "self", ".", "counter", "+=", "1", "g", "=", "get_root", "(", "self", ")", ".", "globals", "# current time", "now", "=", "Time", ".", "now", "(", ")", "# configure times", "self", ...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
WinPairs.check
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.
hcam_widgets/widgets.py
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...
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", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3337-L3449
[ "def", "check", "(", "self", ")", ":", "status", "=", "True", "synced", "=", "True", "xbin", "=", "self", ".", "xbin", ".", "value", "(", ")", "ybin", "=", "self", ".", "ybin", ".", "value", "(", ")", "npair", "=", "self", ".", "npair", ".", "v...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
WinPairs.sync
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.
hcam_widgets/widgets.py
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 ?? ...
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", "nothi...
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3451-L3477
[ "def", "sync", "(", "self", ")", ":", "# needs some mods for ultracam ??", "xbin", "=", "self", ".", "xbin", ".", "value", "(", ")", "ybin", "=", "self", ".", "ybin", ".", "value", "(", ")", "n", "=", "0", "for", "xsl", ",", "xsr", ",", "ys", ",", ...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
WinPairs.freeze
Freeze (disable) all settings so they can't be altered
hcam_widgets/widgets.py
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() ...
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3479-L3495
[ "def", "freeze", "(", "self", ")", ":", "for", "xsl", ",", "xsr", ",", "ys", ",", "nx", ",", "ny", "in", "zip", "(", "self", ".", "xsl", ",", "self", ".", "xsr", ",", "self", ".", "ys", ",", "self", ".", "nx", ",", "self", ".", "ny", ")", ...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
WinPairs.disable
Disable all but possibly not binning, which is needed for FF apps Parameters --------- everything : bool disable binning as well
hcam_widgets/widgets.py
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() ...
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3505-L3518
[ "def", "disable", "(", "self", ",", "everything", "=", "False", ")", ":", "self", ".", "freeze", "(", ")", "if", "not", "everything", ":", "self", ".", "xbin", ".", "enable", "(", ")", "self", ".", "ybin", ".", "enable", "(", ")", "self", ".", "f...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
WinPairs.enable
Enables WinPair settings
hcam_widgets/widgets.py
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...
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3520-L3548
[ "def", "enable", "(", "self", ")", ":", "npair", "=", "self", ".", "npair", ".", "value", "(", ")", "for", "label", ",", "xsl", ",", "xsr", ",", "ys", ",", "nx", ",", "ny", "in", "zip", "(", "self", ".", "label", "[", ":", "npair", "]", ",", ...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
WinQuads.check
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
hcam_widgets/widgets.py
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...
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", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3720-L3835
[ "def", "check", "(", "self", ")", ":", "status", "=", "synced", "=", "True", "xbin", "=", "self", ".", "xbin", ".", "value", "(", ")", "ybin", "=", "self", ".", "ybin", ".", "value", "(", ")", "nquad", "=", "self", ".", "nquad", ".", "value", "...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
WinQuads.sync
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.
hcam_widgets/widgets.py
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...
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", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3837-L3871
[ "def", "sync", "(", "self", ")", ":", "xbin", "=", "self", ".", "xbin", ".", "value", "(", ")", "ybin", "=", "self", ".", "ybin", ".", "value", "(", ")", "if", "xbin", "==", "1", "and", "ybin", "==", "1", ":", "self", ".", "sbutt", ".", "conf...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
WinQuads.freeze
Freeze (disable) all settings
hcam_widgets/widgets.py
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...
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3873-L3885
[ "def", "freeze", "(", "self", ")", ":", "for", "fields", "in", "zip", "(", "self", ".", "xsll", ",", "self", ".", "xsul", ",", "self", ".", "xslr", ",", "self", ".", "xsur", ",", "self", ".", "ys", ",", "self", ".", "nx", ",", "self", ".", "n...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
WinQuads.enable
Enables WinQuad setting
hcam_widgets/widgets.py
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],...
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3910-L3934
[ "def", "enable", "(", "self", ")", ":", "nquad", "=", "self", ".", "nquad", ".", "value", "(", ")", "for", "label", ",", "xsll", ",", "xsul", ",", "xslr", ",", "xsur", ",", "ys", ",", "nx", ",", "ny", "in", "zip", "(", "self", ".", "label", "...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Windows.check
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.
hcam_widgets/widgets.py
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 ...
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", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L4077-L4177
[ "def", "check", "(", "self", ")", ":", "status", "=", "True", "synced", "=", "True", "xbin", "=", "self", ".", "xbin", ".", "value", "(", ")", "ybin", "=", "self", ".", "ybin", ".", "value", "(", ")", "nwin", "=", "self", ".", "nwin", ".", "val...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Windows.sync
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
hcam_widgets/widgets.py
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...
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", "nothi...
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L4179-L4203
[ "def", "sync", "(", "self", ",", "*", "args", ")", ":", "xbin", "=", "self", ".", "xbin", ".", "value", "(", ")", "ybin", "=", "self", ".", "ybin", ".", "value", "(", ")", "n", "=", "0", "for", "xs", ",", "ys", ",", "nx", ",", "ny", "in", ...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Windows.freeze
Freeze all settings so they can't be altered
hcam_widgets/widgets.py
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() ...
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L4205-L4219
[ "def", "freeze", "(", "self", ")", ":", "for", "xs", ",", "ys", ",", "nx", ",", "ny", "in", "zip", "(", "self", ".", "xs", ",", "self", ".", "ys", ",", "self", ".", "nx", ",", "self", ".", "ny", ")", ":", "xs", ".", "disable", "(", ")", "...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
Windows.enable
Enables all settings
hcam_widgets/widgets.py
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') ...
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" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L4229-L4255
[ "def", "enable", "(", "self", ")", ":", "nwin", "=", "self", ".", "nwin", ".", "value", "(", ")", "for", "label", ",", "xs", ",", "ys", ",", "nx", ",", "ny", "in", "zip", "(", "self", ".", "label", "[", ":", "nwin", "]", ",", "self", ".", "...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
APlugin.check_download
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: ...
unidown/plugin/a_plugin.py
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...
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", "." ]
IceflowRE/unidown
python
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L190-L211
[ "def", "check_download", "(", "self", ",", "link_item_dict", ":", "Dict", "[", "str", ",", "LinkItem", "]", ",", "folder", ":", "Path", ",", "log", ":", "bool", "=", "True", ")", "->", "Tuple", "[", "Dict", "[", "str", ",", "LinkItem", "]", ",", "D...
2a6f82ab780bb825668bfc55b67c11c4f72ec05c
train
APlugin.delete_data
Delete everything which is related to the plugin. **Do not use if you do not know what you do!**
unidown/plugin/a_plugin.py
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()
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!", "**" ]
IceflowRE/unidown
python
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L221-L228
[ "def", "delete_data", "(", "self", ")", ":", "self", ".", "clean_up", "(", ")", "tools", ".", "delete_dir_rec", "(", "self", ".", "_download_path", ")", "if", "self", ".", "_save_state_file", ".", "exists", "(", ")", ":", "self", ".", "_save_state_file", ...
2a6f82ab780bb825668bfc55b67c11c4f72ec05c
train
APlugin.download_as_file
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 ...
unidown/plugin/a_plugin.py
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 ...
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", "." ]
IceflowRE/unidown
python
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L230-L260
[ "def", "download_as_file", "(", "self", ",", "url", ":", "str", ",", "folder", ":", "Path", ",", "name", ":", "str", ",", "delay", ":", "float", "=", "0", ")", "->", "str", ":", "while", "folder", ".", "joinpath", "(", "name", ")", ".", "exists", ...
2a6f82ab780bb825668bfc55b67c11c4f72ec05c
train
APlugin.download
.. 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...
unidown/plugin/a_plugin.py
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...
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", "::" ]
IceflowRE/unidown
python
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L262-L315
[ "def", "download", "(", "self", ",", "link_item_dict", ":", "Dict", "[", "str", ",", "LinkItem", "]", ",", "folder", ":", "Path", ",", "desc", ":", "str", ",", "unit", ":", "str", ",", "delay", ":", "float", "=", "0", ")", "->", "List", "[", "str...
2a6f82ab780bb825668bfc55b67c11c4f72ec05c
train
APlugin._create_save_state
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
unidown/plugin/a_plugin.py
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: ...
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", "." ]
IceflowRE/unidown
python
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L317-L326
[ "def", "_create_save_state", "(", "self", ",", "link_item_dict", ":", "Dict", "[", "str", ",", "LinkItem", "]", ")", "->", "SaveState", ":", "return", "SaveState", "(", "dynamic_data", ".", "SAVE_STATE_VERSION", ",", "self", ".", "info", ",", "self", ".", ...
2a6f82ab780bb825668bfc55b67c11c4f72ec05c
train
APlugin.save_save_state
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]
unidown/plugin/a_plugin.py
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...
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", "." ]
IceflowRE/unidown
python
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L328-L337
[ "def", "save_save_state", "(", "self", ",", "data_dict", ":", "Dict", "[", "str", ",", "LinkItem", "]", ")", ":", "# TODO: add progressbar", "json_data", "=", "json_format", ".", "MessageToJson", "(", "self", ".", "_create_save_state", "(", "data_dict", ")", "...
2a6f82ab780bb825668bfc55b67c11c4f72ec05c
train
APlugin.load_save_state
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...
unidown/plugin/a_plugin.py
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...
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", "." ]
IceflowRE/unidown
python
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L339-L379
[ "def", "load_save_state", "(", "self", ")", "->", "SaveState", ":", "if", "not", "self", ".", "_save_state_file", ".", "exists", "(", ")", ":", "self", ".", "log", ".", "info", "(", "\"No savestate file found.\"", ")", "return", "SaveState", "(", "dynamic_da...
2a6f82ab780bb825668bfc55b67c11c4f72ec05c
train
APlugin.get_updated_data
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]
unidown/plugin/a_plugin.py
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...
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", "." ]
IceflowRE/unidown
python
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L381-L403
[ "def", "get_updated_data", "(", "self", ",", "old_data", ":", "Dict", "[", "str", ",", "LinkItem", "]", ")", "->", "Dict", "[", "str", ",", "LinkItem", "]", ":", "if", "not", "self", ".", "download_data", ":", "return", "{", "}", "new_link_item_dict", ...
2a6f82ab780bb825668bfc55b67c11c4f72ec05c
train
APlugin.update_dict
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 ...
unidown/plugin/a_plugin.py
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...
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", ".", "up...
IceflowRE/unidown
python
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L405-L419
[ "def", "update_dict", "(", "self", ",", "base", ":", "Dict", "[", "str", ",", "LinkItem", "]", ",", "new", ":", "Dict", "[", "str", ",", "LinkItem", "]", ")", ":", "if", "logging", ".", "INFO", ">=", "logging", ".", "getLevelName", "(", "dynamic_data...
2a6f82ab780bb825668bfc55b67c11c4f72ec05c
train
APlugin._get_options_dic
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 ...
unidown/plugin/a_plugin.py
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...
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", "." ]
IceflowRE/unidown
python
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L421-L437
[ "def", "_get_options_dic", "(", "self", ",", "options", ":", "List", "[", "str", "]", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "options_dic", "=", "{", "}", "for", "option", "in", "options", ":", "cur_option", "=", "option", ".", "split",...
2a6f82ab780bb825668bfc55b67c11c4f72ec05c
train
APlugin.get_plugins
Get all available plugins for unidown. :return: plugin name list :rtype: Dict[str, ~pkg_resources.EntryPoint]
unidown/plugin/a_plugin.py
def get_plugins() -> Dict[str, pkg_resources.EntryPoint]: """ Get all available plugins for unidown. :return: plugin name list :rtype: Dict[str, ~pkg_resources.EntryPoint] """ return {entry.name: entry for entry in pkg_resources.iter_entry_points('unidown.plugin')}
def get_plugins() -> Dict[str, pkg_resources.EntryPoint]: """ Get all available plugins for unidown. :return: plugin name list :rtype: Dict[str, ~pkg_resources.EntryPoint] """ return {entry.name: entry for entry in pkg_resources.iter_entry_points('unidown.plugin')}
[ "Get", "all", "available", "plugins", "for", "unidown", "." ]
IceflowRE/unidown
python
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L440-L447
[ "def", "get_plugins", "(", ")", "->", "Dict", "[", "str", ",", "pkg_resources", ".", "EntryPoint", "]", ":", "return", "{", "entry", ".", "name", ":", "entry", "for", "entry", "in", "pkg_resources", ".", "iter_entry_points", "(", "'unidown.plugin'", ")", "...
2a6f82ab780bb825668bfc55b67c11c4f72ec05c
train
_equation_of_time
Find the difference between apparent and mean solar time Parameters ---------- t : `~astropy.time.Time` times (array) Returns ---------- ret1 : `~astropy.units.Quantity` the equation of time
hcam_widgets/astro.py
def _equation_of_time(t): """ Find the difference between apparent and mean solar time Parameters ---------- t : `~astropy.time.Time` times (array) Returns ---------- ret1 : `~astropy.units.Quantity` the equation of time """ # Julian centuries since J2000.0 ...
def _equation_of_time(t): """ Find the difference between apparent and mean solar time Parameters ---------- t : `~astropy.time.Time` times (array) Returns ---------- ret1 : `~astropy.units.Quantity` the equation of time """ # Julian centuries since J2000.0 ...
[ "Find", "the", "difference", "between", "apparent", "and", "mean", "solar", "time" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/astro.py#L15-L53
[ "def", "_equation_of_time", "(", "t", ")", ":", "# Julian centuries since J2000.0", "T", "=", "(", "t", "-", "Time", "(", "\"J2000\"", ")", ")", ".", "to", "(", "u", ".", "year", ")", ".", "value", "/", "100", "# obliquity of ecliptic (Meeus 1998, eq 22.2)", ...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
_astropy_time_from_LST
Convert a Local Sidereal Time to an astropy Time object. The local time is related to the LST through the RA of the Sun. This routine uses this relationship to convert a LST to an astropy time object. Returns ------- ret1 : `~astropy.time.Time` time corresponding to LST
hcam_widgets/astro.py
def _astropy_time_from_LST(t, LST, location, prev_next): """ Convert a Local Sidereal Time to an astropy Time object. The local time is related to the LST through the RA of the Sun. This routine uses this relationship to convert a LST to an astropy time object. Returns ------- ret1 : `...
def _astropy_time_from_LST(t, LST, location, prev_next): """ Convert a Local Sidereal Time to an astropy Time object. The local time is related to the LST through the RA of the Sun. This routine uses this relationship to convert a LST to an astropy time object. Returns ------- ret1 : `...
[ "Convert", "a", "Local", "Sidereal", "Time", "to", "an", "astropy", "Time", "object", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/astro.py#L56-L97
[ "def", "_astropy_time_from_LST", "(", "t", ",", "LST", ",", "location", ",", "prev_next", ")", ":", "# now we need to figure out time to return from LST", "raSun", "=", "coord", ".", "get_sun", "(", "t", ")", ".", "ra", "# calculate Greenwich Apparent Solar Time, which ...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
_rise_set_trig
Crude time at next rise/set of ``target`` using spherical trig. This method is ~15 times faster than `_calcriseset`, and inherently does *not* take the atmosphere into account. The time returned should not be used in calculations; the purpose of this routine is to supply a guess to `_calcriseset`. ...
hcam_widgets/astro.py
def _rise_set_trig(t, target, location, prev_next, rise_set): """ Crude time at next rise/set of ``target`` using spherical trig. This method is ~15 times faster than `_calcriseset`, and inherently does *not* take the atmosphere into account. The time returned should not be used in calculations; t...
def _rise_set_trig(t, target, location, prev_next, rise_set): """ Crude time at next rise/set of ``target`` using spherical trig. This method is ~15 times faster than `_calcriseset`, and inherently does *not* take the atmosphere into account. The time returned should not be used in calculations; t...
[ "Crude", "time", "at", "next", "rise", "/", "set", "of", "target", "using", "spherical", "trig", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/astro.py#L100-L150
[ "def", "_rise_set_trig", "(", "t", ",", "target", ",", "location", ",", "prev_next", ",", "rise_set", ")", ":", "dec", "=", "target", ".", "transform_to", "(", "coord", ".", "ICRS", ")", ".", "dec", "with", "warnings", ".", "catch_warnings", "(", ")", ...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
calc_riseset
Time at next rise/set of ``target``. Parameters ---------- t : `~astropy.time.Time` or other (see below) Time of observation. This will be passed in as the first argument to the `~astropy.time.Time` initializer, so it can be anything that `~astropy.time.Time` will accept (including ...
hcam_widgets/astro.py
def calc_riseset(t, target_name, location, prev_next, rise_set, horizon): """ Time at next rise/set of ``target``. Parameters ---------- t : `~astropy.time.Time` or other (see below) Time of observation. This will be passed in as the first argument to the `~astropy.time.Time` initia...
def calc_riseset(t, target_name, location, prev_next, rise_set, horizon): """ Time at next rise/set of ``target``. Parameters ---------- t : `~astropy.time.Time` or other (see below) Time of observation. This will be passed in as the first argument to the `~astropy.time.Time` initia...
[ "Time", "at", "next", "rise", "/", "set", "of", "target", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/astro.py#L153-L198
[ "def", "calc_riseset", "(", "t", ",", "target_name", ",", "location", ",", "prev_next", ",", "rise_set", ",", "horizon", ")", ":", "target", "=", "coord", ".", "get_body", "(", "target_name", ",", "t", ")", "t0", "=", "_rise_set_trig", "(", "t", ",", "...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
_horiz_cross
Find time ``t`` when values in array ``a`` go from negative to positive or positive to negative (exclude endpoints) ``return_limits`` will return nearest times to zero-crossing. Parameters ---------- t : `~astropy.time.Time` Grid of times alt : `~astropy.units.Quantity` Grid of...
hcam_widgets/astro.py
def _horiz_cross(t, alt, rise_set, horizon=0*u.degree): """ Find time ``t`` when values in array ``a`` go from negative to positive or positive to negative (exclude endpoints) ``return_limits`` will return nearest times to zero-crossing. Parameters ---------- t : `~astropy.time.Time` ...
def _horiz_cross(t, alt, rise_set, horizon=0*u.degree): """ Find time ``t`` when values in array ``a`` go from negative to positive or positive to negative (exclude endpoints) ``return_limits`` will return nearest times to zero-crossing. Parameters ---------- t : `~astropy.time.Time` ...
[ "Find", "time", "t", "when", "values", "in", "array", "a", "go", "from", "negative", "to", "positive", "or", "positive", "to", "negative", "(", "exclude", "endpoints", ")" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/astro.py#L202-L248
[ "def", "_horiz_cross", "(", "t", ",", "alt", ",", "rise_set", ",", "horizon", "=", "0", "*", "u", ".", "degree", ")", ":", "if", "rise_set", "==", "'rising'", ":", "# Find index where altitude goes from below to above horizon", "condition", "=", "(", "alt", "[...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
_two_point_interp
Do linear interpolation between two ``altitudes`` at two ``times`` to determine the time where the altitude goes through zero. Parameters ---------- times : `~astropy.time.Time` Two times for linear interpolation between altitudes : array of `~astropy.units.Quantity` Two altitu...
hcam_widgets/astro.py
def _two_point_interp(times, altitudes, horizon=0*u.deg): """ Do linear interpolation between two ``altitudes`` at two ``times`` to determine the time where the altitude goes through zero. Parameters ---------- times : `~astropy.time.Time` Two times for linear interpolation between ...
def _two_point_interp(times, altitudes, horizon=0*u.deg): """ Do linear interpolation between two ``altitudes`` at two ``times`` to determine the time where the altitude goes through zero. Parameters ---------- times : `~astropy.time.Time` Two times for linear interpolation between ...
[ "Do", "linear", "interpolation", "between", "two", "altitudes", "at", "two", "times", "to", "determine", "the", "time", "where", "the", "altitude", "goes", "through", "zero", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/astro.py#L252-L281
[ "def", "_two_point_interp", "(", "times", ",", "altitudes", ",", "horizon", "=", "0", "*", "u", ".", "deg", ")", ":", "if", "not", "isinstance", "(", "times", ",", "Time", ")", ":", "return", "MAGIC_TIME", "else", ":", "slope", "=", "(", "altitudes", ...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
init_dirs
Initialize the main directories. :param main_dir: main directory :type main_dir: ~pathlib.Path :param logfilepath: log file :type logfilepath: ~pathlib.Path
unidown/dynamic_data.py
def init_dirs(main_dir: Path, logfilepath: Path): """ Initialize the main directories. :param main_dir: main directory :type main_dir: ~pathlib.Path :param logfilepath: log file :type logfilepath: ~pathlib.Path """ global MAIN_DIR, TEMP_DIR, DOWNLOAD_DIR, SAVESTAT_DIR, LOGFILE_PATH ...
def init_dirs(main_dir: Path, logfilepath: Path): """ Initialize the main directories. :param main_dir: main directory :type main_dir: ~pathlib.Path :param logfilepath: log file :type logfilepath: ~pathlib.Path """ global MAIN_DIR, TEMP_DIR, DOWNLOAD_DIR, SAVESTAT_DIR, LOGFILE_PATH ...
[ "Initialize", "the", "main", "directories", "." ]
IceflowRE/unidown
python
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/dynamic_data.py#L37-L51
[ "def", "init_dirs", "(", "main_dir", ":", "Path", ",", "logfilepath", ":", "Path", ")", ":", "global", "MAIN_DIR", ",", "TEMP_DIR", ",", "DOWNLOAD_DIR", ",", "SAVESTAT_DIR", ",", "LOGFILE_PATH", "MAIN_DIR", "=", "main_dir", "TEMP_DIR", "=", "MAIN_DIR", ".", ...
2a6f82ab780bb825668bfc55b67c11c4f72ec05c
train
reset
Reset all dynamic variables to the default values.
unidown/dynamic_data.py
def reset(): """ Reset all dynamic variables to the default values. """ global MAIN_DIR, TEMP_DIR, DOWNLOAD_DIR, SAVESTAT_DIR, LOGFILE_PATH, USING_CORES, LOG_LEVEL, DISABLE_TQDM, \ SAVE_STATE_VERSION MAIN_DIR = Path('./') TEMP_DIR = MAIN_DIR.joinpath(Path('temp/')) DOWNLOAD_DIR = MAI...
def reset(): """ Reset all dynamic variables to the default values. """ global MAIN_DIR, TEMP_DIR, DOWNLOAD_DIR, SAVESTAT_DIR, LOGFILE_PATH, USING_CORES, LOG_LEVEL, DISABLE_TQDM, \ SAVE_STATE_VERSION MAIN_DIR = Path('./') TEMP_DIR = MAIN_DIR.joinpath(Path('temp/')) DOWNLOAD_DIR = MAI...
[ "Reset", "all", "dynamic", "variables", "to", "the", "default", "values", "." ]
IceflowRE/unidown
python
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/dynamic_data.py#L54-L70
[ "def", "reset", "(", ")", ":", "global", "MAIN_DIR", ",", "TEMP_DIR", ",", "DOWNLOAD_DIR", ",", "SAVESTAT_DIR", ",", "LOGFILE_PATH", ",", "USING_CORES", ",", "LOG_LEVEL", ",", "DISABLE_TQDM", ",", "SAVE_STATE_VERSION", "MAIN_DIR", "=", "Path", "(", "'./'", ")"...
2a6f82ab780bb825668bfc55b67c11c4f72ec05c
train
check_dirs
Check the directories if they exist. :raises FileExistsError: if a file exists but is not a directory
unidown/dynamic_data.py
def check_dirs(): """ Check the directories if they exist. :raises FileExistsError: if a file exists but is not a directory """ dirs = [MAIN_DIR, TEMP_DIR, DOWNLOAD_DIR, SAVESTAT_DIR] for directory in dirs: if directory.exists() and not directory.is_dir(): raise FileExistsEr...
def check_dirs(): """ Check the directories if they exist. :raises FileExistsError: if a file exists but is not a directory """ dirs = [MAIN_DIR, TEMP_DIR, DOWNLOAD_DIR, SAVESTAT_DIR] for directory in dirs: if directory.exists() and not directory.is_dir(): raise FileExistsEr...
[ "Check", "the", "directories", "if", "they", "exist", "." ]
IceflowRE/unidown
python
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/dynamic_data.py#L73-L82
[ "def", "check_dirs", "(", ")", ":", "dirs", "=", "[", "MAIN_DIR", ",", "TEMP_DIR", ",", "DOWNLOAD_DIR", ",", "SAVESTAT_DIR", "]", "for", "directory", "in", "dirs", ":", "if", "directory", ".", "exists", "(", ")", "and", "not", "directory", ".", "is_dir",...
2a6f82ab780bb825668bfc55b67c11c4f72ec05c
train
parse_hstring
Parse a single item from the telescope server into name, value, comment.
hcam_widgets/gtc/headers.py
def parse_hstring(hs): """ Parse a single item from the telescope server into name, value, comment. """ # split the string on = and /, also stripping whitespace and annoying quotes name, value, comment = yield_three( [val.strip().strip("'") for val in filter(None, re.split("[=/]+", hs))] ...
def parse_hstring(hs): """ Parse a single item from the telescope server into name, value, comment. """ # split the string on = and /, also stripping whitespace and annoying quotes name, value, comment = yield_three( [val.strip().strip("'") for val in filter(None, re.split("[=/]+", hs))] ...
[ "Parse", "a", "single", "item", "from", "the", "telescope", "server", "into", "name", "value", "comment", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/gtc/headers.py#L27-L43
[ "def", "parse_hstring", "(", "hs", ")", ":", "# split the string on = and /, also stripping whitespace and annoying quotes", "name", ",", "value", ",", "comment", "=", "yield_three", "(", "[", "val", ".", "strip", "(", ")", ".", "strip", "(", "\"'\"", ")", "for", ...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
create_header_from_telpars
Create a list of fits header items from GTC telescope pars. The GTC telescope server gives a list of string describing FITS header items such as RA, DEC, etc. Arguments --------- telpars : list list returned by server call to getTelescopeParams
hcam_widgets/gtc/headers.py
def create_header_from_telpars(telpars): """ Create a list of fits header items from GTC telescope pars. The GTC telescope server gives a list of string describing FITS header items such as RA, DEC, etc. Arguments --------- telpars : list list returned by server call to getTelescop...
def create_header_from_telpars(telpars): """ Create a list of fits header items from GTC telescope pars. The GTC telescope server gives a list of string describing FITS header items such as RA, DEC, etc. Arguments --------- telpars : list list returned by server call to getTelescop...
[ "Create", "a", "list", "of", "fits", "header", "items", "from", "GTC", "telescope", "pars", "." ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/gtc/headers.py#L46-L72
[ "def", "create_header_from_telpars", "(", "telpars", ")", ":", "# pars is a list of strings describing tel info in FITS", "# style, each entry in the list is a different class of", "# thing (weather, telescope, instrument etc).", "# first, we munge it into a single list of strings, each one", "#...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
add_gtc_header_table_row
Add a row with current values to GTC table Arguments --------- t : `~astropy.table.Table` The table to append row to telpars : list list returned by server call to getTelescopeParams
hcam_widgets/gtc/headers.py
def add_gtc_header_table_row(t, telpars): """ Add a row with current values to GTC table Arguments --------- t : `~astropy.table.Table` The table to append row to telpars : list list returned by server call to getTelescopeParams """ now = Time.now().mjd hdr = create_...
def add_gtc_header_table_row(t, telpars): """ Add a row with current values to GTC table Arguments --------- t : `~astropy.table.Table` The table to append row to telpars : list list returned by server call to getTelescopeParams """ now = Time.now().mjd hdr = create_...
[ "Add", "a", "row", "with", "current", "values", "to", "GTC", "table" ]
HiPERCAM/hcam_widgets
python
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/gtc/headers.py#L80-L99
[ "def", "add_gtc_header_table_row", "(", "t", ",", "telpars", ")", ":", "now", "=", "Time", ".", "now", "(", ")", ".", "mjd", "hdr", "=", "create_header_from_telpars", "(", "telpars", ")", "# make dictionary of vals to put in table", "vals", "=", "{", "k", ":",...
7219f0d96dd3a8ebe3139c7f542a72c02d02fce8
train
PluginInfo.from_protobuf
Constructor from protobuf. :param proto: protobuf structure :type proto: ~unidown.plugin.protobuf.plugin_info_pb2.PluginInfoProto :return: the PluginInfo :rtype: ~unidown.plugin.plugin_info.PluginInfo :raises ValueError: name of PluginInfo does not exist or is empty inside the p...
unidown/plugin/plugin_info.py
def from_protobuf(cls, proto: PluginInfoProto) -> PluginInfo: """ Constructor from protobuf. :param proto: protobuf structure :type proto: ~unidown.plugin.protobuf.plugin_info_pb2.PluginInfoProto :return: the PluginInfo :rtype: ~unidown.plugin.plugin_info.PluginInfo ...
def from_protobuf(cls, proto: PluginInfoProto) -> PluginInfo: """ Constructor from protobuf. :param proto: protobuf structure :type proto: ~unidown.plugin.protobuf.plugin_info_pb2.PluginInfoProto :return: the PluginInfo :rtype: ~unidown.plugin.plugin_info.PluginInfo ...
[ "Constructor", "from", "protobuf", "." ]
IceflowRE/unidown
python
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/plugin_info.py#L48-L66
[ "def", "from_protobuf", "(", "cls", ",", "proto", ":", "PluginInfoProto", ")", "->", "PluginInfo", ":", "if", "proto", ".", "name", "==", "\"\"", ":", "raise", "ValueError", "(", "\"name of PluginInfo does not exist or is empty inside the protobuf.\"", ")", "elif", ...
2a6f82ab780bb825668bfc55b67c11c4f72ec05c
train
PluginInfo.to_protobuf
Create protobuf item. :return: protobuf structure :rtype: ~unidown.plugin.protobuf.link_item_pb2.PluginInfoProto
unidown/plugin/plugin_info.py
def to_protobuf(self) -> PluginInfoProto: """ Create protobuf item. :return: protobuf structure :rtype: ~unidown.plugin.protobuf.link_item_pb2.PluginInfoProto """ proto = PluginInfoProto() proto.name = self.name proto.version = str(self.version) p...
def to_protobuf(self) -> PluginInfoProto: """ Create protobuf item. :return: protobuf structure :rtype: ~unidown.plugin.protobuf.link_item_pb2.PluginInfoProto """ proto = PluginInfoProto() proto.name = self.name proto.version = str(self.version) p...
[ "Create", "protobuf", "item", "." ]
IceflowRE/unidown
python
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/plugin_info.py#L79-L90
[ "def", "to_protobuf", "(", "self", ")", "->", "PluginInfoProto", ":", "proto", "=", "PluginInfoProto", "(", ")", "proto", ".", "name", "=", "self", ".", "name", "proto", ".", "version", "=", "str", "(", "self", ".", "version", ")", "proto", ".", "host"...
2a6f82ab780bb825668bfc55b67c11c4f72ec05c
train
SaveState.from_protobuf
Constructor from protobuf. Can raise ValueErrors from called from_protobuf() parsers. :param proto: protobuf structure :type proto: ~unidown.plugin.protobuf.save_state_pb2.SaveStateProto :return: the SaveState :rtype: ~unidown.plugin.save_state.SaveState :raises ValueError: vers...
unidown/plugin/save_state.py
def from_protobuf(cls, proto: SaveStateProto) -> SaveState: """ Constructor from protobuf. Can raise ValueErrors from called from_protobuf() parsers. :param proto: protobuf structure :type proto: ~unidown.plugin.protobuf.save_state_pb2.SaveStateProto :return: the SaveState ...
def from_protobuf(cls, proto: SaveStateProto) -> SaveState: """ Constructor from protobuf. Can raise ValueErrors from called from_protobuf() parsers. :param proto: protobuf structure :type proto: ~unidown.plugin.protobuf.save_state_pb2.SaveStateProto :return: the SaveState ...
[ "Constructor", "from", "protobuf", ".", "Can", "raise", "ValueErrors", "from", "called", "from_protobuf", "()", "parsers", "." ]
IceflowRE/unidown
python
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/save_state.py#L55-L76
[ "def", "from_protobuf", "(", "cls", ",", "proto", ":", "SaveStateProto", ")", "->", "SaveState", ":", "data_dict", "=", "{", "}", "for", "key", ",", "link_item", "in", "proto", ".", "data", ".", "items", "(", ")", ":", "data_dict", "[", "key", "]", "...
2a6f82ab780bb825668bfc55b67c11c4f72ec05c
train
SaveState.to_protobuf
Create protobuf item. :return: protobuf structure :rtype: ~unidown.plugin.protobuf.save_state_pb2.SaveStateProto
unidown/plugin/save_state.py
def to_protobuf(self) -> SaveStateProto: """ Create protobuf item. :return: protobuf structure :rtype: ~unidown.plugin.protobuf.save_state_pb2.SaveStateProto """ result = SaveStateProto() result.version = str(self.version) result.last_update.CopyFrom(date...
def to_protobuf(self) -> SaveStateProto: """ Create protobuf item. :return: protobuf structure :rtype: ~unidown.plugin.protobuf.save_state_pb2.SaveStateProto """ result = SaveStateProto() result.version = str(self.version) result.last_update.CopyFrom(date...
[ "Create", "protobuf", "item", "." ]
IceflowRE/unidown
python
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/save_state.py#L78-L91
[ "def", "to_protobuf", "(", "self", ")", "->", "SaveStateProto", ":", "result", "=", "SaveStateProto", "(", ")", "result", ".", "version", "=", "str", "(", "self", ".", "version", ")", "result", ".", "last_update", ".", "CopyFrom", "(", "datetime_to_timestamp...
2a6f82ab780bb825668bfc55b67c11c4f72ec05c
train
definite_article
Returns the definite article (der/die/das/die) for a given word.
textblob_de/ext/_pattern/text/de/inflect.py
def definite_article(word, gender=MALE, role=SUBJECT): """ Returns the definite article (der/die/das/die) for a given word. """ return article_definite.get((gender[:1].lower(), role[:3].lower()))
def definite_article(word, gender=MALE, role=SUBJECT): """ Returns the definite article (der/die/das/die) for a given word. """ return article_definite.get((gender[:1].lower(), role[:3].lower()))
[ "Returns", "the", "definite", "article", "(", "der", "/", "die", "/", "das", "/", "die", ")", "for", "a", "given", "word", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/ext/_pattern/text/de/inflect.py#L87-L90
[ "def", "definite_article", "(", "word", ",", "gender", "=", "MALE", ",", "role", "=", "SUBJECT", ")", ":", "return", "article_definite", ".", "get", "(", "(", "gender", "[", ":", "1", "]", ".", "lower", "(", ")", ",", "role", "[", ":", "3", "]", ...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
indefinite_article
Returns the indefinite article (ein) for a given word.
textblob_de/ext/_pattern/text/de/inflect.py
def indefinite_article(word, gender=MALE, role=SUBJECT): """ Returns the indefinite article (ein) for a given word. """ return article_indefinite.get((gender[:1].lower(), role[:3].lower()))
def indefinite_article(word, gender=MALE, role=SUBJECT): """ Returns the indefinite article (ein) for a given word. """ return article_indefinite.get((gender[:1].lower(), role[:3].lower()))
[ "Returns", "the", "indefinite", "article", "(", "ein", ")", "for", "a", "given", "word", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/ext/_pattern/text/de/inflect.py#L92-L95
[ "def", "indefinite_article", "(", "word", ",", "gender", "=", "MALE", ",", "role", "=", "SUBJECT", ")", ":", "return", "article_indefinite", ".", "get", "(", "(", "gender", "[", ":", "1", "]", ".", "lower", "(", ")", ",", "role", "[", ":", "3", "]"...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
article
Returns the indefinite (ein) or definite (der/die/das/die) article for the given word.
textblob_de/ext/_pattern/text/de/inflect.py
def article(word, function=INDEFINITE, gender=MALE, role=SUBJECT): """ Returns the indefinite (ein) or definite (der/die/das/die) article for the given word. """ return function == DEFINITE \ and definite_article(word, gender, role) \ or indefinite_article(word, gender, role)
def article(word, function=INDEFINITE, gender=MALE, role=SUBJECT): """ Returns the indefinite (ein) or definite (der/die/das/die) article for the given word. """ return function == DEFINITE \ and definite_article(word, gender, role) \ or indefinite_article(word, gender, role)
[ "Returns", "the", "indefinite", "(", "ein", ")", "or", "definite", "(", "der", "/", "die", "/", "das", "/", "die", ")", "article", "for", "the", "given", "word", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/ext/_pattern/text/de/inflect.py#L100-L105
[ "def", "article", "(", "word", ",", "function", "=", "INDEFINITE", ",", "gender", "=", "MALE", ",", "role", "=", "SUBJECT", ")", ":", "return", "function", "==", "DEFINITE", "and", "definite_article", "(", "word", ",", "gender", ",", "role", ")", "or", ...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
referenced
Returns a string with the article + the word.
textblob_de/ext/_pattern/text/de/inflect.py
def referenced(word, article=INDEFINITE, gender=MALE, role=SUBJECT): """ Returns a string with the article + the word. """ return "%s %s" % (_article(word, article, gender, role), word)
def referenced(word, article=INDEFINITE, gender=MALE, role=SUBJECT): """ Returns a string with the article + the word. """ return "%s %s" % (_article(word, article, gender, role), word)
[ "Returns", "a", "string", "with", "the", "article", "+", "the", "word", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/ext/_pattern/text/de/inflect.py#L108-L111
[ "def", "referenced", "(", "word", ",", "article", "=", "INDEFINITE", ",", "gender", "=", "MALE", ",", "role", "=", "SUBJECT", ")", ":", "return", "\"%s %s\"", "%", "(", "_article", "(", "word", ",", "article", ",", "gender", ",", "role", ")", ",", "w...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
gender
Returns the gender (MALE, FEMALE or NEUTRAL) for nouns (majority vote). Returns None for words that are not nouns.
textblob_de/ext/_pattern/text/de/inflect.py
def gender(word, pos=NOUN): """ Returns the gender (MALE, FEMALE or NEUTRAL) for nouns (majority vote). Returns None for words that are not nouns. """ w = word.lower() if pos == NOUN: # Default rules (baseline = 32%). if w.endswith(gender_masculine): return MASCULINE ...
def gender(word, pos=NOUN): """ Returns the gender (MALE, FEMALE or NEUTRAL) for nouns (majority vote). Returns None for words that are not nouns. """ w = word.lower() if pos == NOUN: # Default rules (baseline = 32%). if w.endswith(gender_masculine): return MASCULINE ...
[ "Returns", "the", "gender", "(", "MALE", "FEMALE", "or", "NEUTRAL", ")", "for", "nouns", "(", "majority", "vote", ")", ".", "Returns", "None", "for", "words", "that", "are", "not", "nouns", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/ext/_pattern/text/de/inflect.py#L147-L163
[ "def", "gender", "(", "word", ",", "pos", "=", "NOUN", ")", ":", "w", "=", "word", ".", "lower", "(", ")", "if", "pos", "==", "NOUN", ":", "# Default rules (baseline = 32%).", "if", "w", ".", "endswith", "(", "gender_masculine", ")", ":", "return", "MA...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
pluralize
Returns the plural of a given word. The inflection is based on probability rather than gender and role.
textblob_de/ext/_pattern/text/de/inflect.py
def pluralize(word, pos=NOUN, gender=MALE, role=SUBJECT, custom={}): """ Returns the plural of a given word. The inflection is based on probability rather than gender and role. """ w = word.lower().capitalize() if word in custom: return custom[word] if pos == NOUN: for a, b i...
def pluralize(word, pos=NOUN, gender=MALE, role=SUBJECT, custom={}): """ Returns the plural of a given word. The inflection is based on probability rather than gender and role. """ w = word.lower().capitalize() if word in custom: return custom[word] if pos == NOUN: for a, b i...
[ "Returns", "the", "plural", "of", "a", "given", "word", ".", "The", "inflection", "is", "based", "on", "probability", "rather", "than", "gender", "and", "role", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/ext/_pattern/text/de/inflect.py#L212-L262
[ "def", "pluralize", "(", "word", ",", "pos", "=", "NOUN", ",", "gender", "=", "MALE", ",", "role", "=", "SUBJECT", ",", "custom", "=", "{", "}", ")", ":", "w", "=", "word", ".", "lower", "(", ")", ".", "capitalize", "(", ")", "if", "word", "in"...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
singularize
Returns the singular of a given word. The inflection is based on probability rather than gender and role.
textblob_de/ext/_pattern/text/de/inflect.py
def singularize(word, pos=NOUN, gender=MALE, role=SUBJECT, custom={}): """ Returns the singular of a given word. The inflection is based on probability rather than gender and role. """ w = word.lower().capitalize() if word in custom: return custom[word] if word in singular: r...
def singularize(word, pos=NOUN, gender=MALE, role=SUBJECT, custom={}): """ Returns the singular of a given word. The inflection is based on probability rather than gender and role. """ w = word.lower().capitalize() if word in custom: return custom[word] if word in singular: r...
[ "Returns", "the", "singular", "of", "a", "given", "word", ".", "The", "inflection", "is", "based", "on", "probability", "rather", "than", "gender", "and", "role", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/ext/_pattern/text/de/inflect.py#L317-L339
[ "def", "singularize", "(", "word", ",", "pos", "=", "NOUN", ",", "gender", "=", "MALE", ",", "role", "=", "SUBJECT", ",", "custom", "=", "{", "}", ")", ":", "w", "=", "word", ".", "lower", "(", ")", ".", "capitalize", "(", ")", "if", "word", "i...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
attributive
For a predicative adjective, returns the attributive form (lowercase). In German, the attributive is formed with -e, -em, -en, -er or -es, depending on gender (masculine, feminine, neuter or plural) and role (nominative, accusative, dative, genitive).
textblob_de/ext/_pattern/text/de/inflect.py
def attributive(adjective, gender=MALE, role=SUBJECT, article=None): """ For a predicative adjective, returns the attributive form (lowercase). In German, the attributive is formed with -e, -em, -en, -er or -es, depending on gender (masculine, feminine, neuter or plural) and role (nominative...
def attributive(adjective, gender=MALE, role=SUBJECT, article=None): """ For a predicative adjective, returns the attributive form (lowercase). In German, the attributive is formed with -e, -em, -en, -er or -es, depending on gender (masculine, feminine, neuter or plural) and role (nominative...
[ "For", "a", "predicative", "adjective", "returns", "the", "attributive", "form", "(", "lowercase", ")", ".", "In", "German", "the", "attributive", "is", "formed", "with", "-", "e", "-", "em", "-", "en", "-", "er", "or", "-", "es", "depending", "on", "g...
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/ext/_pattern/text/de/inflect.py#L517-L541
[ "def", "attributive", "(", "adjective", ",", "gender", "=", "MALE", ",", "role", "=", "SUBJECT", ",", "article", "=", "None", ")", ":", "w", ",", "g", ",", "c", ",", "a", "=", "adjective", ".", "lower", "(", ")", ",", "gender", "[", ":", "1", "...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
predicative
Returns the predicative adjective (lowercase). In German, the attributive form preceding a noun is always used: "ein kleiner Junge" => strong, masculine, nominative, "eine schöne Frau" => mixed, feminine, nominative, "der kleine Prinz" => weak, masculine, nominative, etc. The pre...
textblob_de/ext/_pattern/text/de/inflect.py
def predicative(adjective): """ Returns the predicative adjective (lowercase). In German, the attributive form preceding a noun is always used: "ein kleiner Junge" => strong, masculine, nominative, "eine schöne Frau" => mixed, feminine, nominative, "der kleine Prinz" => weak, masculi...
def predicative(adjective): """ Returns the predicative adjective (lowercase). In German, the attributive form preceding a noun is always used: "ein kleiner Junge" => strong, masculine, nominative, "eine schöne Frau" => mixed, feminine, nominative, "der kleine Prinz" => weak, masculi...
[ "Returns", "the", "predicative", "adjective", "(", "lowercase", ")", ".", "In", "German", "the", "attributive", "form", "preceding", "a", "noun", "is", "always", "used", ":", "ein", "kleiner", "Junge", "=", ">", "strong", "masculine", "nominative", "eine", "...
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/ext/_pattern/text/de/inflect.py#L543-L561
[ "def", "predicative", "(", "adjective", ")", ":", "w", "=", "adjective", ".", "lower", "(", ")", "if", "len", "(", "w", ")", ">", "3", ":", "for", "suffix", "in", "(", "\"em\"", ",", "\"en\"", ",", "\"er\"", ",", "\"es\"", ",", "\"e\"", ")", ":",...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
grade
Returns the comparative or superlative form of the given (inflected) adjective.
textblob_de/ext/_pattern/text/de/inflect.py
def grade(adjective, suffix=COMPARATIVE): """ Returns the comparative or superlative form of the given (inflected) adjective. """ b = predicative(adjective) # groß => großt, schön => schönst if suffix == SUPERLATIVE and b.endswith(("s", u"ß")): suffix = suffix[1:] # große => großere, sch...
def grade(adjective, suffix=COMPARATIVE): """ Returns the comparative or superlative form of the given (inflected) adjective. """ b = predicative(adjective) # groß => großt, schön => schönst if suffix == SUPERLATIVE and b.endswith(("s", u"ß")): suffix = suffix[1:] # große => großere, sch...
[ "Returns", "the", "comparative", "or", "superlative", "form", "of", "the", "given", "(", "inflected", ")", "adjective", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/ext/_pattern/text/de/inflect.py#L568-L576
[ "def", "grade", "(", "adjective", ",", "suffix", "=", "COMPARATIVE", ")", ":", "b", "=", "predicative", "(", "adjective", ")", "# groß => großt, schön => schönst", "if", "suffix", "==", "SUPERLATIVE", "and", "b", ".", "endswith", "(", "(", "\"s\"", ",", "u\"...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
Verbs.find_lemma
Returns the base form of the given inflected verb, using a rule-based approach.
textblob_de/ext/_pattern/text/de/inflect.py
def find_lemma(self, verb): """ Returns the base form of the given inflected verb, using a rule-based approach. """ v = verb.lower() # Common prefixes: be-finden and emp-finden probably inflect like finden. if not (v.startswith("ge") and v.endswith("t")): # Probably gerund. ...
def find_lemma(self, verb): """ Returns the base form of the given inflected verb, using a rule-based approach. """ v = verb.lower() # Common prefixes: be-finden and emp-finden probably inflect like finden. if not (v.startswith("ge") and v.endswith("t")): # Probably gerund. ...
[ "Returns", "the", "base", "form", "of", "the", "given", "inflected", "verb", "using", "a", "rule", "-", "based", "approach", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/ext/_pattern/text/de/inflect.py#L372-L413
[ "def", "find_lemma", "(", "self", ",", "verb", ")", ":", "v", "=", "verb", ".", "lower", "(", ")", "# Common prefixes: be-finden and emp-finden probably inflect like finden.", "if", "not", "(", "v", ".", "startswith", "(", "\"ge\"", ")", "and", "v", ".", "ends...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
Verbs.find_lexeme
For a regular verb (base form), returns the forms using a rule-based approach.
textblob_de/ext/_pattern/text/de/inflect.py
def find_lexeme(self, verb): """ For a regular verb (base form), returns the forms using a rule-based approach. """ v = verb.lower() # Stem = infinitive minus -en, -ln, -rn. b = b0 = re.sub("en$", "", re.sub("ln$", "l", re.sub("rn$", "r", v))) # Split common prefixes. ...
def find_lexeme(self, verb): """ For a regular verb (base form), returns the forms using a rule-based approach. """ v = verb.lower() # Stem = infinitive minus -en, -ln, -rn. b = b0 = re.sub("en$", "", re.sub("ln$", "l", re.sub("rn$", "r", v))) # Split common prefixes. ...
[ "For", "a", "regular", "verb", "(", "base", "form", ")", "returns", "the", "forms", "using", "a", "rule", "-", "based", "approach", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/ext/_pattern/text/de/inflect.py#L415-L464
[ "def", "find_lexeme", "(", "self", ",", "verb", ")", ":", "v", "=", "verb", ".", "lower", "(", ")", "# Stem = infinitive minus -en, -ln, -rn.", "b", "=", "b0", "=", "re", ".", "sub", "(", "\"en$\"", ",", "\"\"", ",", "re", ".", "sub", "(", "\"ln$\"", ...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
Verbs.tenses
Returns a list of possible tenses for the given inflected verb.
textblob_de/ext/_pattern/text/de/inflect.py
def tenses(self, verb, parse=True): """ Returns a list of possible tenses for the given inflected verb. """ tenses = _Verbs.tenses(self, verb, parse) if len(tenses) == 0: # auswirkte => wirkte aus for prefix in prefix_separable: if verb.startswith(...
def tenses(self, verb, parse=True): """ Returns a list of possible tenses for the given inflected verb. """ tenses = _Verbs.tenses(self, verb, parse) if len(tenses) == 0: # auswirkte => wirkte aus for prefix in prefix_separable: if verb.startswith(...
[ "Returns", "a", "list", "of", "possible", "tenses", "for", "the", "given", "inflected", "verb", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/ext/_pattern/text/de/inflect.py#L466-L476
[ "def", "tenses", "(", "self", ",", "verb", ",", "parse", "=", "True", ")", ":", "tenses", "=", "_Verbs", ".", "tenses", "(", "self", ",", "verb", ",", "parse", ")", "if", "len", "(", "tenses", ")", "==", "0", ":", "# auswirkte => wirkte aus", "for", ...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
_get_words_from_dataset
Return a set of all words in a dataset. :param dataset: A list of tuples of the form ``(words, label)`` where ``words`` is either a string of a list of tokens.
textblob_de/classifiers.py
def _get_words_from_dataset(dataset): """Return a set of all words in a dataset. :param dataset: A list of tuples of the form ``(words, label)`` where ``words`` is either a string of a list of tokens. """ # Words may be either a string or a list of tokens. Return an iterator # of tokens ac...
def _get_words_from_dataset(dataset): """Return a set of all words in a dataset. :param dataset: A list of tuples of the form ``(words, label)`` where ``words`` is either a string of a list of tokens. """ # Words may be either a string or a list of tokens. Return an iterator # of tokens ac...
[ "Return", "a", "set", "of", "all", "words", "in", "a", "dataset", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/classifiers.py#L57-L72
[ "def", "_get_words_from_dataset", "(", "dataset", ")", ":", "# Words may be either a string or a list of tokens. Return an iterator", "# of tokens accordingly", "def", "tokenize", "(", "words", ")", ":", "if", "isinstance", "(", "words", ",", "basestring", ")", ":", "retu...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
basic_extractor
A basic document feature extractor that returns a dict indicating what words in ``train_set`` are contained in ``document``. :param document: The text to extract features from. Can be a string or an iterable. :param list train_set: Training data set, a list of tuples of the form ``(words, label)``.
textblob_de/classifiers.py
def basic_extractor(document, train_set): """A basic document feature extractor that returns a dict indicating what words in ``train_set`` are contained in ``document``. :param document: The text to extract features from. Can be a string or an iterable. :param list train_set: Training data set, a list ...
def basic_extractor(document, train_set): """A basic document feature extractor that returns a dict indicating what words in ``train_set`` are contained in ``document``. :param document: The text to extract features from. Can be a string or an iterable. :param list train_set: Training data set, a list ...
[ "A", "basic", "document", "feature", "extractor", "that", "returns", "a", "dict", "indicating", "what", "words", "in", "train_set", "are", "contained", "in", "document", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/classifiers.py#L84-L97
[ "def", "basic_extractor", "(", "document", ",", "train_set", ")", ":", "word_features", "=", "_get_words_from_dataset", "(", "train_set", ")", "tokens", "=", "_get_document_tokens", "(", "document", ")", "features", "=", "dict", "(", "(", "(", "u'contains({0})'", ...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
contains_extractor
A basic document feature extractor that returns a dict of words that the document contains.
textblob_de/classifiers.py
def contains_extractor(document): """A basic document feature extractor that returns a dict of words that the document contains.""" tokens = _get_document_tokens(document) features = dict((u'contains({0})'.format(w), True) for w in tokens) return features
def contains_extractor(document): """A basic document feature extractor that returns a dict of words that the document contains.""" tokens = _get_document_tokens(document) features = dict((u'contains({0})'.format(w), True) for w in tokens) return features
[ "A", "basic", "document", "feature", "extractor", "that", "returns", "a", "dict", "of", "words", "that", "the", "document", "contains", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/classifiers.py#L100-L105
[ "def", "contains_extractor", "(", "document", ")", ":", "tokens", "=", "_get_document_tokens", "(", "document", ")", "features", "=", "dict", "(", "(", "u'contains({0})'", ".", "format", "(", "w", ")", ",", "True", ")", "for", "w", "in", "tokens", ")", "...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
BaseClassifier._read_data
Reads a data file and returns and iterable that can be used as testing or training data.
textblob_de/classifiers.py
def _read_data(self, dataset, format=None): """Reads a data file and returns and iterable that can be used as testing or training data.""" # Attempt to detect file format if "format" isn't specified if not format: format_class = formats.detect(dataset) else: ...
def _read_data(self, dataset, format=None): """Reads a data file and returns and iterable that can be used as testing or training data.""" # Attempt to detect file format if "format" isn't specified if not format: format_class = formats.detect(dataset) else: ...
[ "Reads", "a", "data", "file", "and", "returns", "and", "iterable", "that", "can", "be", "used", "as", "testing", "or", "training", "data", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/classifiers.py#L138-L148
[ "def", "_read_data", "(", "self", ",", "dataset", ",", "format", "=", "None", ")", ":", "# Attempt to detect file format if \"format\" isn't specified", "if", "not", "format", ":", "format_class", "=", "formats", ".", "detect", "(", "dataset", ")", "else", ":", ...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
BaseClassifier.extract_features
Extracts features from a body of text. :rtype: dictionary of features
textblob_de/classifiers.py
def extract_features(self, text): """Extracts features from a body of text. :rtype: dictionary of features """ # Feature extractor may take one or two arguments try: return self.feature_extractor(text, self.train_set) except (TypeError, AttributeError): ...
def extract_features(self, text): """Extracts features from a body of text. :rtype: dictionary of features """ # Feature extractor may take one or two arguments try: return self.feature_extractor(text, self.train_set) except (TypeError, AttributeError): ...
[ "Extracts", "features", "from", "a", "body", "of", "text", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/classifiers.py#L167-L177
[ "def", "extract_features", "(", "self", ",", "text", ")", ":", "# Feature extractor may take one or two arguments", "try", ":", "return", "self", ".", "feature_extractor", "(", "text", ",", "self", ".", "train_set", ")", "except", "(", "TypeError", ",", "Attribute...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
NLTKClassifier.train
Train the classifier with a labeled feature set and return the classifier. Takes the same arguments as the wrapped NLTK class. This method is implicitly called when calling ``classify`` or ``accuracy`` methods and is included only to allow passing in arguments to the ``train`` method of ...
textblob_de/classifiers.py
def train(self, *args, **kwargs): """Train the classifier with a labeled feature set and return the classifier. Takes the same arguments as the wrapped NLTK class. This method is implicitly called when calling ``classify`` or ``accuracy`` methods and is included only to allow passing in ...
def train(self, *args, **kwargs): """Train the classifier with a labeled feature set and return the classifier. Takes the same arguments as the wrapped NLTK class. This method is implicitly called when calling ``classify`` or ``accuracy`` methods and is included only to allow passing in ...
[ "Train", "the", "classifier", "with", "a", "labeled", "feature", "set", "and", "return", "the", "classifier", ".", "Takes", "the", "same", "arguments", "as", "the", "wrapped", "NLTK", "class", ".", "This", "method", "is", "implicitly", "called", "when", "cal...
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/classifiers.py#L224-L242
[ "def", "train", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "self", ".", "classifier", "=", "self", ".", "nltk_class", ".", "train", "(", "self", ".", "train_features", ",", "*", "args", ",", "*", "*", "kwargs", ...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
NLTKClassifier.classify
Classifies the text. :param str text: A string of text.
textblob_de/classifiers.py
def classify(self, text): """Classifies the text. :param str text: A string of text. """ text_features = self.extract_features(text) return self.classifier.classify(text_features)
def classify(self, text): """Classifies the text. :param str text: A string of text. """ text_features = self.extract_features(text) return self.classifier.classify(text_features)
[ "Classifies", "the", "text", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/classifiers.py#L248-L255
[ "def", "classify", "(", "self", ",", "text", ")", ":", "text_features", "=", "self", ".", "extract_features", "(", "text", ")", "return", "self", ".", "classifier", ".", "classify", "(", "text_features", ")" ]
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
NLTKClassifier.accuracy
Compute the accuracy on a test set. :param test_set: A list of tuples of the form ``(text, label)``, or a filename. :param format: If ``test_set`` is a filename, the file format, e.g. ``"csv"`` or ``"json"``. If ``None``, will attempt to detect the file format.
textblob_de/classifiers.py
def accuracy(self, test_set, format=None): """Compute the accuracy on a test set. :param test_set: A list of tuples of the form ``(text, label)``, or a filename. :param format: If ``test_set`` is a filename, the file format, e.g. ``"csv"`` or ``"json"``. If ``None``, wil...
def accuracy(self, test_set, format=None): """Compute the accuracy on a test set. :param test_set: A list of tuples of the form ``(text, label)``, or a filename. :param format: If ``test_set`` is a filename, the file format, e.g. ``"csv"`` or ``"json"``. If ``None``, wil...
[ "Compute", "the", "accuracy", "on", "a", "test", "set", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/classifiers.py#L257-L272
[ "def", "accuracy", "(", "self", ",", "test_set", ",", "format", "=", "None", ")", ":", "if", "isinstance", "(", "test_set", ",", "basestring", ")", ":", "# test_set is a filename", "test_data", "=", "self", ".", "_read_data", "(", "test_set", ")", "else", ...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
NLTKClassifier.update
Update the classifier with new training data and re-trains the classifier. :param new_data: New data as a list of tuples of the form ``(text, label)``.
textblob_de/classifiers.py
def update(self, new_data, *args, **kwargs): '''Update the classifier with new training data and re-trains the classifier. :param new_data: New data as a list of tuples of the form ``(text, label)``. ''' self.train_set += new_data self.train_features = [(self...
def update(self, new_data, *args, **kwargs): '''Update the classifier with new training data and re-trains the classifier. :param new_data: New data as a list of tuples of the form ``(text, label)``. ''' self.train_set += new_data self.train_features = [(self...
[ "Update", "the", "classifier", "with", "new", "training", "data", "and", "re", "-", "trains", "the", "classifier", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/classifiers.py#L274-L290
[ "def", "update", "(", "self", ",", "new_data", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "train_set", "+=", "new_data", "self", ".", "train_features", "=", "[", "(", "self", ".", "extract_features", "(", "d", ")", ",", "c", ...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
NaiveBayesClassifier.prob_classify
Return the label probability distribution for classifying a string of text. Example: :: >>> classifier = NaiveBayesClassifier(train_data) >>> prob_dist = classifier.prob_classify("I feel happy this morning.") >>> prob_dist.max() 'positive' ...
textblob_de/classifiers.py
def prob_classify(self, text): """Return the label probability distribution for classifying a string of text. Example: :: >>> classifier = NaiveBayesClassifier(train_data) >>> prob_dist = classifier.prob_classify("I feel happy this morning.") >>> pro...
def prob_classify(self, text): """Return the label probability distribution for classifying a string of text. Example: :: >>> classifier = NaiveBayesClassifier(train_data) >>> prob_dist = classifier.prob_classify("I feel happy this morning.") >>> pro...
[ "Return", "the", "label", "probability", "distribution", "for", "classifying", "a", "string", "of", "text", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/classifiers.py#L312-L330
[ "def", "prob_classify", "(", "self", ",", "text", ")", ":", "text_features", "=", "self", ".", "extract_features", "(", "text", ")", "return", "self", ".", "classifier", ".", "prob_classify", "(", "text_features", ")" ]
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
PositiveNaiveBayesClassifier.train
Train the classifier with a labeled and unlabeled feature sets and return the classifier. Takes the same arguments as the wrapped NLTK class. This method is implicitly called when calling ``classify`` or ``accuracy`` methods and is included only to allow passing in arguments to the ``tra...
textblob_de/classifiers.py
def train(self, *args, **kwargs): """Train the classifier with a labeled and unlabeled feature sets and return the classifier. Takes the same arguments as the wrapped NLTK class. This method is implicitly called when calling ``classify`` or ``accuracy`` methods and is included only to al...
def train(self, *args, **kwargs): """Train the classifier with a labeled and unlabeled feature sets and return the classifier. Takes the same arguments as the wrapped NLTK class. This method is implicitly called when calling ``classify`` or ``accuracy`` methods and is included only to al...
[ "Train", "the", "classifier", "with", "a", "labeled", "and", "unlabeled", "feature", "sets", "and", "return", "the", "classifier", ".", "Takes", "the", "same", "arguments", "as", "the", "wrapped", "NLTK", "class", ".", "This", "method", "is", "implicitly", "...
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/classifiers.py#L453-L466
[ "def", "train", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "classifier", "=", "self", ".", "nltk_class", ".", "train", "(", "self", ".", "positive_features", ",", "self", ".", "unlabeled_features", ",", "self", ".", ...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
PositiveNaiveBayesClassifier.update
Update the classifier with new data and re-trains the classifier. :param new_positive_data: List of new, labeled strings. :param new_unlabeled_data: List of new, unlabeled strings.
textblob_de/classifiers.py
def update(self, new_positive_data=None, new_unlabeled_data=None, positive_prob_prior=0.5, *args, **kwargs): '''Update the classifier with new data and re-trains the classifier. :param new_positive_data: List of new, labeled strings. :param new_unlabeled_da...
def update(self, new_positive_data=None, new_unlabeled_data=None, positive_prob_prior=0.5, *args, **kwargs): '''Update the classifier with new data and re-trains the classifier. :param new_positive_data: List of new, labeled strings. :param new_unlabeled_da...
[ "Update", "the", "classifier", "with", "new", "data", "and", "re", "-", "trains", "the", "classifier", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/classifiers.py#L468-L490
[ "def", "update", "(", "self", ",", "new_positive_data", "=", "None", ",", "new_unlabeled_data", "=", "None", ",", "positive_prob_prior", "=", "0.5", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "positive_prob_prior", "=", "positive_prob_...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
MaxEntClassifier.prob_classify
Return the label probability distribution for classifying a string of text. Example: :: >>> classifier = MaxEntClassifier(train_data) >>> prob_dist = classifier.prob_classify("I feel happy this morning.") >>> prob_dist.max() 'positive' ...
textblob_de/classifiers.py
def prob_classify(self, text): """Return the label probability distribution for classifying a string of text. Example: :: >>> classifier = MaxEntClassifier(train_data) >>> prob_dist = classifier.prob_classify("I feel happy this morning.") >>> prob_di...
def prob_classify(self, text): """Return the label probability distribution for classifying a string of text. Example: :: >>> classifier = MaxEntClassifier(train_data) >>> prob_dist = classifier.prob_classify("I feel happy this morning.") >>> prob_di...
[ "Return", "the", "label", "probability", "distribution", "for", "classifying", "a", "string", "of", "text", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/classifiers.py#L497-L515
[ "def", "prob_classify", "(", "self", ",", "text", ")", ":", "feats", "=", "self", ".", "extract_features", "(", "text", ")", "return", "self", ".", "classifier", ".", "prob_classify", "(", "feats", ")" ]
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
PatternParserLemmatizer.lemmatize
Return a list of (lemma, tag) tuples. :param str text: A string.
textblob_de/lemmatizers.py
def lemmatize(self, text): """Return a list of (lemma, tag) tuples. :param str text: A string. """ #: Do not process empty strings (Issue #3) if text.strip() == "": return [] parsed_sentences = self._parse_text(text) _lemmalist = [] for s in ...
def lemmatize(self, text): """Return a list of (lemma, tag) tuples. :param str text: A string. """ #: Do not process empty strings (Issue #3) if text.strip() == "": return [] parsed_sentences = self._parse_text(text) _lemmalist = [] for s in ...
[ "Return", "a", "list", "of", "(", "lemma", "tag", ")", "tuples", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/lemmatizers.py#L43-L80
[ "def", "lemmatize", "(", "self", ",", "text", ")", ":", "#: Do not process empty strings (Issue #3)", "if", "text", ".", "strip", "(", ")", "==", "\"\"", ":", "return", "[", "]", "parsed_sentences", "=", "self", ".", "_parse_text", "(", "text", ")", "_lemmal...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
PatternParserLemmatizer._parse_text
Parse text (string) and return list of parsed sentences (strings). Each sentence consists of space separated token elements and the token format returned by the PatternParser is WORD/TAG/PHRASE/ROLE/LEMMA (separated by a forward slash '/') :param str text: A string.
textblob_de/lemmatizers.py
def _parse_text(self, text): """Parse text (string) and return list of parsed sentences (strings). Each sentence consists of space separated token elements and the token format returned by the PatternParser is WORD/TAG/PHRASE/ROLE/LEMMA (separated by a forward slash '/') :param...
def _parse_text(self, text): """Parse text (string) and return list of parsed sentences (strings). Each sentence consists of space separated token elements and the token format returned by the PatternParser is WORD/TAG/PHRASE/ROLE/LEMMA (separated by a forward slash '/') :param...
[ "Parse", "text", "(", "string", ")", "and", "return", "list", "of", "parsed", "sentences", "(", "strings", ")", "." ]
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/lemmatizers.py#L82-L96
[ "def", "_parse_text", "(", "self", ",", "text", ")", ":", "# Fix for issue #1", "text", "=", "text", ".", "replace", "(", "\"/\"", ",", "\" FORWARDSLASH \"", ")", "_tokenized", "=", "\" \"", ".", "join", "(", "self", ".", "tokenizer", ".", "tokenize", "(",...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1
train
_match
Returns True if the pattern matches the given word string. The pattern can include a wildcard (*front, back*, *both*, in*side), or it can be a compiled regular expression.
textblob_de/ext/_pattern/text/search.py
def _match(string, pattern): """ Returns True if the pattern matches the given word string. The pattern can include a wildcard (*front, back*, *both*, in*side), or it can be a compiled regular expression. """ p = pattern try: if p[:1] == WILDCARD and (p[-1:] == WILDCARD and p[1:-...
def _match(string, pattern): """ Returns True if the pattern matches the given word string. The pattern can include a wildcard (*front, back*, *both*, in*side), or it can be a compiled regular expression. """ p = pattern try: if p[:1] == WILDCARD and (p[-1:] == WILDCARD and p[1:-...
[ "Returns", "True", "if", "the", "pattern", "matches", "the", "given", "word", "string", ".", "The", "pattern", "can", "include", "a", "wildcard", "(", "*", "front", "back", "*", "*", "both", "*", "in", "*", "side", ")", "or", "it", "can", "be", "a", ...
markuskiller/textblob-de
python
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/ext/_pattern/text/search.py#L101-L121
[ "def", "_match", "(", "string", ",", "pattern", ")", ":", "p", "=", "pattern", "try", ":", "if", "p", "[", ":", "1", "]", "==", "WILDCARD", "and", "(", "p", "[", "-", "1", ":", "]", "==", "WILDCARD", "and", "p", "[", "1", ":", "-", "1", "]"...
1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1