repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | Start.setExpert | def setExpert(self):
"""
Turns on 'expert' status whereby the button is always enabled,
regardless of its activity status.
"""
w.ActButton.setExpert(self)
g = get_root(self).globals
self.config(bg=g.COL['start']) | python | def setExpert(self):
"""
Turns on 'expert' status whereby the button is always enabled,
regardless of its activity status.
"""
w.ActButton.setExpert(self)
g = get_root(self).globals
self.config(bg=g.COL['start']) | [
"def",
"setExpert",
"(",
"self",
")",
":",
"w",
".",
"ActButton",
".",
"setExpert",
"(",
"self",
")",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"self",
".",
"config",
"(",
"bg",
"=",
"g",
".",
"COL",
"[",
"'start'",
"]",
")"
] | Turns on 'expert' status whereby the button is always enabled,
regardless of its activity status. | [
"Turns",
"on",
"expert",
"status",
"whereby",
"the",
"button",
"is",
"always",
"enabled",
"regardless",
"of",
"its",
"activity",
"status",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1603-L1610 | train | Turn on expert status whereby the button is always enabled regardless of its activity status. |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | Start.act | def act(self):
"""
Carries out action associated with start button
"""
g = get_root(self).globals
# check binning against overscan
msg = """
HiperCAM has an o/scan of 50 pixels.
Your binning does not fit into this
region. Some columns will contain ... | python | def act(self):
"""
Carries out action associated with start button
"""
g = get_root(self).globals
# check binning against overscan
msg = """
HiperCAM has an o/scan of 50 pixels.
Your binning does not fit into this
region. Some columns will contain ... | [
"def",
"act",
"(",
"self",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"# check binning against overscan",
"msg",
"=",
"\"\"\"\n HiperCAM has an o/scan of 50 pixels.\n Your binning does not fit into this\n region. Some columns will contain... | Carries out action associated with start button | [
"Carries",
"out",
"action",
"associated",
"with",
"start",
"button"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1622-L1700 | train | Actually asks if user has permission to start a new entry in the database. |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | Load.act | def act(self):
"""
Carries out the action associated with the Load button
"""
g = get_root(self).globals
fname = filedialog.askopenfilename(
defaultextension='.json',
filetypes=[('json files', '.json'), ('fits files', '.fits')],
initialdir=g.cp... | python | def act(self):
"""
Carries out the action associated with the Load button
"""
g = get_root(self).globals
fname = filedialog.askopenfilename(
defaultextension='.json',
filetypes=[('json files', '.json'), ('fits files', '.fits')],
initialdir=g.cp... | [
"def",
"act",
"(",
"self",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"fname",
"=",
"filedialog",
".",
"askopenfilename",
"(",
"defaultextension",
"=",
"'.json'",
",",
"filetypes",
"=",
"[",
"(",
"'json files'",
",",
"'.json'",
")"... | Carries out the action associated with the Load button | [
"Carries",
"out",
"the",
"action",
"associated",
"with",
"the",
"Load",
"button"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1716-L1742 | train | Carries out the action associated with the Load button. |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | Save.act | def act(self):
"""
Carries out the action associated with the Save button
"""
g = get_root(self).globals
g.clog.info('\nSaving current application to disk')
# check instrument parameters
if not g.ipars.check():
g.clog.warn('Invalid instrument paramete... | python | def act(self):
"""
Carries out the action associated with the Save button
"""
g = get_root(self).globals
g.clog.info('\nSaving current application to disk')
# check instrument parameters
if not g.ipars.check():
g.clog.warn('Invalid instrument paramete... | [
"def",
"act",
"(",
"self",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"g",
".",
"clog",
".",
"info",
"(",
"'\\nSaving current application to disk'",
")",
"# check instrument parameters",
"if",
"not",
"g",
".",
"ipars",
".",
"check",
... | Carries out the action associated with the Save button | [
"Carries",
"out",
"the",
"action",
"associated",
"with",
"the",
"Save",
"button"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1757-L1790 | train | Carries out the action associated with the Save button. |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | Unfreeze.act | def act(self):
"""
Carries out the action associated with the Unfreeze button
"""
g = get_root(self).globals
g.ipars.unfreeze()
g.rpars.unfreeze()
g.observe.load.enable()
self.disable() | python | def act(self):
"""
Carries out the action associated with the Unfreeze button
"""
g = get_root(self).globals
g.ipars.unfreeze()
g.rpars.unfreeze()
g.observe.load.enable()
self.disable() | [
"def",
"act",
"(",
"self",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"g",
".",
"ipars",
".",
"unfreeze",
"(",
")",
"g",
".",
"rpars",
".",
"unfreeze",
"(",
")",
"g",
".",
"observe",
".",
"load",
".",
"enable",
"(",
")",
... | Carries out the action associated with the Unfreeze button | [
"Carries",
"out",
"the",
"action",
"associated",
"with",
"the",
"Unfreeze",
"button"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1804-L1812 | train | Carries out the action associated with the Unfreeze button |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | Observe.setExpertLevel | def setExpertLevel(self):
"""
Set expert level
"""
g = get_root(self).globals
level = g.cpars['expert_level']
# now set whether buttons are permanently enabled or not
if level == 0 or level == 1:
self.load.setNonExpert()
self.save.setNonEx... | python | def setExpertLevel(self):
"""
Set expert level
"""
g = get_root(self).globals
level = g.cpars['expert_level']
# now set whether buttons are permanently enabled or not
if level == 0 or level == 1:
self.load.setNonExpert()
self.save.setNonEx... | [
"def",
"setExpertLevel",
"(",
"self",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"level",
"=",
"g",
".",
"cpars",
"[",
"'expert_level'",
"]",
"# now set whether buttons are permanently enabled or not",
"if",
"level",
"==",
"0",
"or",
"le... | Set expert level | [
"Set",
"expert",
"level"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1846-L1866 | train | Set the expert level of the user s current user. |
briancappello/py-meta-utils | py_meta_utils.py | process_factory_meta_options | def process_factory_meta_options(
mcs_args: McsArgs,
default_factory_class: Type[MetaOptionsFactory] = MetaOptionsFactory,
factory_attr_name: str = META_OPTIONS_FACTORY_CLASS_ATTR_NAME) \
-> MetaOptionsFactory:
"""
Main entry point for consumer metaclasses. Usage::
from ... | python | def process_factory_meta_options(
mcs_args: McsArgs,
default_factory_class: Type[MetaOptionsFactory] = MetaOptionsFactory,
factory_attr_name: str = META_OPTIONS_FACTORY_CLASS_ATTR_NAME) \
-> MetaOptionsFactory:
"""
Main entry point for consumer metaclasses. Usage::
from ... | [
"def",
"process_factory_meta_options",
"(",
"mcs_args",
":",
"McsArgs",
",",
"default_factory_class",
":",
"Type",
"[",
"MetaOptionsFactory",
"]",
"=",
"MetaOptionsFactory",
",",
"factory_attr_name",
":",
"str",
"=",
"META_OPTIONS_FACTORY_CLASS_ATTR_NAME",
")",
"->",
"M... | Main entry point for consumer metaclasses. Usage::
from py_meta_utils import (AbstractMetaOption, McsArgs, MetaOptionsFactory,
process_factory_meta_options)
class YourMetaOptionsFactory(MetaOptionsFactory):
_options = [AbstractMetaOption]
class... | [
"Main",
"entry",
"point",
"for",
"consumer",
"metaclasses",
".",
"Usage",
"::"
] | 8de20be00768b7749dc2207a98331a9f23187918 | https://github.com/briancappello/py-meta-utils/blob/8de20be00768b7749dc2207a98331a9f23187918/py_meta_utils.py#L321-L386 | train | This function is used to create the meta options for the given base class. |
briancappello/py-meta-utils | py_meta_utils.py | deep_getattr | def deep_getattr(clsdict: Dict[str, Any],
bases: Tuple[Type[object], ...],
name: str,
default: Any = _missing) -> Any:
"""
Acts just like ``getattr`` would on a constructed class object, except this operates
on the pre-construction class dictionary and base... | python | def deep_getattr(clsdict: Dict[str, Any],
bases: Tuple[Type[object], ...],
name: str,
default: Any = _missing) -> Any:
"""
Acts just like ``getattr`` would on a constructed class object, except this operates
on the pre-construction class dictionary and base... | [
"def",
"deep_getattr",
"(",
"clsdict",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
",",
"bases",
":",
"Tuple",
"[",
"Type",
"[",
"object",
"]",
",",
"...",
"]",
",",
"name",
":",
"str",
",",
"default",
":",
"Any",
"=",
"_missing",
")",
"->",
"Any",... | Acts just like ``getattr`` would on a constructed class object, except this operates
on the pre-construction class dictionary and base classes. In other words, first we
look for the attribute in the class dictionary, and then we search all the base
classes (in method resolution order), finally returning the... | [
"Acts",
"just",
"like",
"getattr",
"would",
"on",
"a",
"constructed",
"class",
"object",
"except",
"this",
"operates",
"on",
"the",
"pre",
"-",
"construction",
"class",
"dictionary",
"and",
"base",
"classes",
".",
"In",
"other",
"words",
"first",
"we",
"look... | 8de20be00768b7749dc2207a98331a9f23187918 | https://github.com/briancappello/py-meta-utils/blob/8de20be00768b7749dc2207a98331a9f23187918/py_meta_utils.py#L437-L458 | train | This function operates on a class dictionary and base classes and returns the value of the attribute name. |
briancappello/py-meta-utils | py_meta_utils.py | McsArgs.getattr | def getattr(self, name, default: Any = _missing):
"""
Convenience method equivalent to
``deep_getattr(mcs_args.clsdict, mcs_args.bases, 'attr_name'[, default])``
"""
return deep_getattr(self.clsdict, self.bases, name, default) | python | def getattr(self, name, default: Any = _missing):
"""
Convenience method equivalent to
``deep_getattr(mcs_args.clsdict, mcs_args.bases, 'attr_name'[, default])``
"""
return deep_getattr(self.clsdict, self.bases, name, default) | [
"def",
"getattr",
"(",
"self",
",",
"name",
",",
"default",
":",
"Any",
"=",
"_missing",
")",
":",
"return",
"deep_getattr",
"(",
"self",
".",
"clsdict",
",",
"self",
".",
"bases",
",",
"name",
",",
"default",
")"
] | Convenience method equivalent to
``deep_getattr(mcs_args.clsdict, mcs_args.bases, 'attr_name'[, default])`` | [
"Convenience",
"method",
"equivalent",
"to",
"deep_getattr",
"(",
"mcs_args",
".",
"clsdict",
"mcs_args",
".",
"bases",
"attr_name",
"[",
"default",
"]",
")"
] | 8de20be00768b7749dc2207a98331a9f23187918 | https://github.com/briancappello/py-meta-utils/blob/8de20be00768b7749dc2207a98331a9f23187918/py_meta_utils.py#L42-L47 | train | Get the attribute of the base class. |
briancappello/py-meta-utils | py_meta_utils.py | McsArgs.qualname | def qualname(self) -> str:
"""
Returns the fully qualified name of the class-under-construction, if possible,
otherwise just the class name.
"""
if self.module:
return self.module + '.' + self.name
return self.name | python | def qualname(self) -> str:
"""
Returns the fully qualified name of the class-under-construction, if possible,
otherwise just the class name.
"""
if self.module:
return self.module + '.' + self.name
return self.name | [
"def",
"qualname",
"(",
"self",
")",
"->",
"str",
":",
"if",
"self",
".",
"module",
":",
"return",
"self",
".",
"module",
"+",
"'.'",
"+",
"self",
".",
"name",
"return",
"self",
".",
"name"
] | Returns the fully qualified name of the class-under-construction, if possible,
otherwise just the class name. | [
"Returns",
"the",
"fully",
"qualified",
"name",
"of",
"the",
"class",
"-",
"under",
"-",
"construction",
"if",
"possible",
"otherwise",
"just",
"the",
"class",
"name",
"."
] | 8de20be00768b7749dc2207a98331a9f23187918 | https://github.com/briancappello/py-meta-utils/blob/8de20be00768b7749dc2207a98331a9f23187918/py_meta_utils.py#L57-L64 | train | Returns the fully qualified name of the class. |
briancappello/py-meta-utils | py_meta_utils.py | McsArgs.is_abstract | def is_abstract(self) -> bool:
"""
Whether or not the class-under-construction was declared as abstract (**NOTE:**
this property is usable even *before* the :class:`MetaOptionsFactory` has run)
"""
meta_value = getattr(self.clsdict.get('Meta'), 'abstract', False)
return s... | python | def is_abstract(self) -> bool:
"""
Whether or not the class-under-construction was declared as abstract (**NOTE:**
this property is usable even *before* the :class:`MetaOptionsFactory` has run)
"""
meta_value = getattr(self.clsdict.get('Meta'), 'abstract', False)
return s... | [
"def",
"is_abstract",
"(",
"self",
")",
"->",
"bool",
":",
"meta_value",
"=",
"getattr",
"(",
"self",
".",
"clsdict",
".",
"get",
"(",
"'Meta'",
")",
",",
"'abstract'",
",",
"False",
")",
"return",
"self",
".",
"clsdict",
".",
"get",
"(",
"ABSTRACT_ATT... | Whether or not the class-under-construction was declared as abstract (**NOTE:**
this property is usable even *before* the :class:`MetaOptionsFactory` has run) | [
"Whether",
"or",
"not",
"the",
"class",
"-",
"under",
"-",
"construction",
"was",
"declared",
"as",
"abstract",
"(",
"**",
"NOTE",
":",
"**",
"this",
"property",
"is",
"usable",
"even",
"*",
"before",
"*",
"the",
":",
"class",
":",
"MetaOptionsFactory",
... | 8de20be00768b7749dc2207a98331a9f23187918 | https://github.com/briancappello/py-meta-utils/blob/8de20be00768b7749dc2207a98331a9f23187918/py_meta_utils.py#L76-L82 | train | Whether or not the class - under - construction was declared as abstract. |
briancappello/py-meta-utils | py_meta_utils.py | MetaOption.get_value | def get_value(self, Meta: Type[object], base_classes_meta, mcs_args: McsArgs) -> Any:
"""
Returns the value for ``self.name`` given the class-under-construction's class
``Meta``. If it's not found there, and ``self.inherit == True`` and there is a
base class that has a class ``Meta``, us... | python | def get_value(self, Meta: Type[object], base_classes_meta, mcs_args: McsArgs) -> Any:
"""
Returns the value for ``self.name`` given the class-under-construction's class
``Meta``. If it's not found there, and ``self.inherit == True`` and there is a
base class that has a class ``Meta``, us... | [
"def",
"get_value",
"(",
"self",
",",
"Meta",
":",
"Type",
"[",
"object",
"]",
",",
"base_classes_meta",
",",
"mcs_args",
":",
"McsArgs",
")",
"->",
"Any",
":",
"value",
"=",
"self",
".",
"default",
"if",
"self",
".",
"inherit",
"and",
"base_classes_meta... | Returns the value for ``self.name`` given the class-under-construction's class
``Meta``. If it's not found there, and ``self.inherit == True`` and there is a
base class that has a class ``Meta``, use that value, otherwise ``self.default``.
:param Meta: the class ``Meta`` (if any) from the class... | [
"Returns",
"the",
"value",
"for",
"self",
".",
"name",
"given",
"the",
"class",
"-",
"under",
"-",
"construction",
"s",
"class",
"Meta",
".",
"If",
"it",
"s",
"not",
"found",
"there",
"and",
"self",
".",
"inherit",
"==",
"True",
"and",
"there",
"is",
... | 8de20be00768b7749dc2207a98331a9f23187918 | https://github.com/briancappello/py-meta-utils/blob/8de20be00768b7749dc2207a98331a9f23187918/py_meta_utils.py#L113-L131 | train | Returns the value for self. name given the class - under - construction s class
Meta and McsArgs. |
briancappello/py-meta-utils | py_meta_utils.py | MetaOptionsFactory._get_meta_options | def _get_meta_options(self) -> List[MetaOption]:
"""
Returns a list of :class:`MetaOption` instances that this factory supports.
"""
return [option if isinstance(option, MetaOption) else option()
for option in self._options] | python | def _get_meta_options(self) -> List[MetaOption]:
"""
Returns a list of :class:`MetaOption` instances that this factory supports.
"""
return [option if isinstance(option, MetaOption) else option()
for option in self._options] | [
"def",
"_get_meta_options",
"(",
"self",
")",
"->",
"List",
"[",
"MetaOption",
"]",
":",
"return",
"[",
"option",
"if",
"isinstance",
"(",
"option",
",",
"MetaOption",
")",
"else",
"option",
"(",
")",
"for",
"option",
"in",
"self",
".",
"_options",
"]"
] | Returns a list of :class:`MetaOption` instances that this factory supports. | [
"Returns",
"a",
"list",
"of",
":",
"class",
":",
"MetaOption",
"instances",
"that",
"this",
"factory",
"supports",
"."
] | 8de20be00768b7749dc2207a98331a9f23187918 | https://github.com/briancappello/py-meta-utils/blob/8de20be00768b7749dc2207a98331a9f23187918/py_meta_utils.py#L245-L250 | train | Returns a list of MetaOption instances that this factory supports. |
briancappello/py-meta-utils | py_meta_utils.py | MetaOptionsFactory._contribute_to_class | def _contribute_to_class(self, mcs_args: McsArgs):
"""
Where the magic happens. Takes one parameter, the :class:`McsArgs` of the
class-under-construction, and processes the declared ``class Meta`` from
it (if any). We fill ourself with the declared meta options' name/value pairs,
... | python | def _contribute_to_class(self, mcs_args: McsArgs):
"""
Where the magic happens. Takes one parameter, the :class:`McsArgs` of the
class-under-construction, and processes the declared ``class Meta`` from
it (if any). We fill ourself with the declared meta options' name/value pairs,
... | [
"def",
"_contribute_to_class",
"(",
"self",
",",
"mcs_args",
":",
"McsArgs",
")",
":",
"self",
".",
"_mcs_args",
"=",
"mcs_args",
"Meta",
"=",
"mcs_args",
".",
"clsdict",
".",
"pop",
"(",
"'Meta'",
",",
"None",
")",
"# type: Type[object]",
"base_classes_meta",... | Where the magic happens. Takes one parameter, the :class:`McsArgs` of the
class-under-construction, and processes the declared ``class Meta`` from
it (if any). We fill ourself with the declared meta options' name/value pairs,
give the declared meta options a chance to also contribute to the clas... | [
"Where",
"the",
"magic",
"happens",
".",
"Takes",
"one",
"parameter",
"the",
":",
"class",
":",
"McsArgs",
"of",
"the",
"class",
"-",
"under",
"-",
"construction",
"and",
"processes",
"the",
"declared",
"class",
"Meta",
"from",
"it",
"(",
"if",
"any",
")... | 8de20be00768b7749dc2207a98331a9f23187918 | https://github.com/briancappello/py-meta-utils/blob/8de20be00768b7749dc2207a98331a9f23187918/py_meta_utils.py#L252-L273 | train | This method is called by _parse_and_contribute_to_class. |
briancappello/py-meta-utils | py_meta_utils.py | MetaOptionsFactory._fill_from_meta | def _fill_from_meta(self, Meta: Type[object], base_classes_meta, mcs_args: McsArgs):
"""
Iterate over our supported meta options, and set attributes on the factory
instance (self) for each meta option's name/value. Raises ``TypeError`` if
we discover any unsupported meta options on the c... | python | def _fill_from_meta(self, Meta: Type[object], base_classes_meta, mcs_args: McsArgs):
"""
Iterate over our supported meta options, and set attributes on the factory
instance (self) for each meta option's name/value. Raises ``TypeError`` if
we discover any unsupported meta options on the c... | [
"def",
"_fill_from_meta",
"(",
"self",
",",
"Meta",
":",
"Type",
"[",
"object",
"]",
",",
"base_classes_meta",
",",
"mcs_args",
":",
"McsArgs",
")",
":",
"# Exclude private/protected fields from the Meta",
"meta_attrs",
"=",
"{",
"}",
"if",
"not",
"Meta",
"else"... | Iterate over our supported meta options, and set attributes on the factory
instance (self) for each meta option's name/value. Raises ``TypeError`` if
we discover any unsupported meta options on the class-under-construction's
``class Meta``. | [
"Iterate",
"over",
"our",
"supported",
"meta",
"options",
"and",
"set",
"attributes",
"on",
"the",
"factory",
"instance",
"(",
"self",
")",
"for",
"each",
"meta",
"option",
"s",
"name",
"/",
"value",
".",
"Raises",
"TypeError",
"if",
"we",
"discover",
"any... | 8de20be00768b7749dc2207a98331a9f23187918 | https://github.com/briancappello/py-meta-utils/blob/8de20be00768b7749dc2207a98331a9f23187918/py_meta_utils.py#L275-L303 | train | Fill the instance with the values from the Meta object. |
HiPERCAM/hcam_widgets | hcam_widgets/gtc/corba.py | CORBAConnection.get_object | def get_object(self, binding_name, cls):
"""
Get a reference to a remote object using CORBA
"""
return self._state.get_object(self, binding_name, cls) | python | def get_object(self, binding_name, cls):
"""
Get a reference to a remote object using CORBA
"""
return self._state.get_object(self, binding_name, cls) | [
"def",
"get_object",
"(",
"self",
",",
"binding_name",
",",
"cls",
")",
":",
"return",
"self",
".",
"_state",
".",
"get_object",
"(",
"self",
",",
"binding_name",
",",
"cls",
")"
] | Get a reference to a remote object using CORBA | [
"Get",
"a",
"reference",
"to",
"a",
"remote",
"object",
"using",
"CORBA"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/gtc/corba.py#L40-L44 | train | Get a reference to an object using CORBA
|
HiPERCAM/hcam_widgets | hcam_widgets/gtc/corba.py | ReadyCORBAState.get_object | def get_object(conn, binding_name, object_cls):
"""
Get a reference to a remote object using CORBA
"""
try:
obj = conn.rootContext.resolve(binding_name)
narrowed = obj._narrow(object_cls)
except CORBA.TRANSIENT:
raise IOError('Attempt to retrie... | python | def get_object(conn, binding_name, object_cls):
"""
Get a reference to a remote object using CORBA
"""
try:
obj = conn.rootContext.resolve(binding_name)
narrowed = obj._narrow(object_cls)
except CORBA.TRANSIENT:
raise IOError('Attempt to retrie... | [
"def",
"get_object",
"(",
"conn",
",",
"binding_name",
",",
"object_cls",
")",
":",
"try",
":",
"obj",
"=",
"conn",
".",
"rootContext",
".",
"resolve",
"(",
"binding_name",
")",
"narrowed",
"=",
"obj",
".",
"_narrow",
"(",
"object_cls",
")",
"except",
"C... | Get a reference to a remote object using CORBA | [
"Get",
"a",
"reference",
"to",
"a",
"remote",
"object",
"using",
"CORBA"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/gtc/corba.py#L116-L129 | train | Get a reference to a remote object using CORBA. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | IntegerEntry.set | def set(self, num):
"""
Sets the current value equal to num
"""
self._value = str(int(num))
self._variable.set(self._value) | python | def set(self, num):
"""
Sets the current value equal to num
"""
self._value = str(int(num))
self._variable.set(self._value) | [
"def",
"set",
"(",
"self",
",",
"num",
")",
":",
"self",
".",
"_value",
"=",
"str",
"(",
"int",
"(",
"num",
")",
")",
"self",
".",
"_variable",
".",
"set",
"(",
"self",
".",
"_value",
")"
] | Sets the current value equal to num | [
"Sets",
"the",
"current",
"value",
"equal",
"to",
"num"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L142-L147 | train | Sets the current value equal to num
|
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | IntegerEntry.on_key_release_repeat | def on_key_release_repeat(self, *dummy):
"""
Avoid repeated trigger of callback.
When holding a key down, multiple key press and release events
are fired in succession. Debouncing is implemented to squash these.
"""
self.has_prev_key_release = self.after_idle(self.on_key... | python | def on_key_release_repeat(self, *dummy):
"""
Avoid repeated trigger of callback.
When holding a key down, multiple key press and release events
are fired in succession. Debouncing is implemented to squash these.
"""
self.has_prev_key_release = self.after_idle(self.on_key... | [
"def",
"on_key_release_repeat",
"(",
"self",
",",
"*",
"dummy",
")",
":",
"self",
".",
"has_prev_key_release",
"=",
"self",
".",
"after_idle",
"(",
"self",
".",
"on_key_release",
",",
"dummy",
")"
] | Avoid repeated trigger of callback.
When holding a key down, multiple key press and release events
are fired in succession. Debouncing is implemented to squash these. | [
"Avoid",
"repeated",
"trigger",
"of",
"callback",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L192-L199 | train | Avoid repeated trigger of callback.
|
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | IntegerEntry.set_bind | def set_bind(self):
"""
Sets key bindings.
"""
# Arrow keys and enter
self.bind('<Up>', lambda e: self.on_key_press_repeat('Up'))
self.bind('<Down>', lambda e: self.on_key_press_repeat('Down'))
self.bind('<Shift-Up>', lambda e: self.on_key_press_repeat('Shift-Up')... | python | def set_bind(self):
"""
Sets key bindings.
"""
# Arrow keys and enter
self.bind('<Up>', lambda e: self.on_key_press_repeat('Up'))
self.bind('<Down>', lambda e: self.on_key_press_repeat('Down'))
self.bind('<Shift-Up>', lambda e: self.on_key_press_repeat('Shift-Up')... | [
"def",
"set_bind",
"(",
"self",
")",
":",
"# Arrow keys and enter",
"self",
".",
"bind",
"(",
"'<Up>'",
",",
"lambda",
"e",
":",
"self",
".",
"on_key_press_repeat",
"(",
"'Up'",
")",
")",
"self",
".",
"bind",
"(",
"'<Down>'",
",",
"lambda",
"e",
":",
"... | Sets key bindings. | [
"Sets",
"key",
"bindings",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L218-L252 | train | Sets key bindings. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | IntegerEntry._pollMouse | def _pollMouse(self):
"""
Polls @10Hz, with a slight delay at the
start.
"""
if self._mouseJustPressed:
delay = 300
self._mouseJustPressed = False
else:
delay = 100
if self._leftMousePressed:
self.add(1)
... | python | def _pollMouse(self):
"""
Polls @10Hz, with a slight delay at the
start.
"""
if self._mouseJustPressed:
delay = 300
self._mouseJustPressed = False
else:
delay = 100
if self._leftMousePressed:
self.add(1)
... | [
"def",
"_pollMouse",
"(",
"self",
")",
":",
"if",
"self",
".",
"_mouseJustPressed",
":",
"delay",
"=",
"300",
"self",
".",
"_mouseJustPressed",
"=",
"False",
"else",
":",
"delay",
"=",
"100",
"if",
"self",
".",
"_leftMousePressed",
":",
"self",
".",
"add... | Polls @10Hz, with a slight delay at the
start. | [
"Polls"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L302-L327 | train | Polls at the mouse and adds a slight delay at the mouse end. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | IntegerEntry._callback | 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:
... | python | 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",
")",
":",
"# retrieve the value from the Entry",
"value",
"=",
"self",
".",
"_variable",
".",
"get",
"(",
")",
"# run the validation. Returns None if no good",
"newvalue",
"=",
"self",
".",
"validate",
"(",
"valu... | This gets called on any attempt to change the value | [
"This",
"gets",
"called",
"on",
"any",
"attempt",
"to",
"change",
"the",
"value"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L356-L378 | train | This is the callback function that is called when the value of the Entry
is changed. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | PosInt.set_bind | def set_bind(self):
"""
Sets key bindings -- we need this more than once
"""
IntegerEntry.set_bind(self)
self.bind('<Next>', lambda e: self.set(0)) | python | def set_bind(self):
"""
Sets key bindings -- we need this more than once
"""
IntegerEntry.set_bind(self)
self.bind('<Next>', lambda e: self.set(0)) | [
"def",
"set_bind",
"(",
"self",
")",
":",
"IntegerEntry",
".",
"set_bind",
"(",
"self",
")",
"self",
".",
"bind",
"(",
"'<Next>'",
",",
"lambda",
"e",
":",
"self",
".",
"set",
"(",
"0",
")",
")"
] | Sets key bindings -- we need this more than once | [
"Sets",
"key",
"bindings",
"--",
"we",
"need",
"this",
"more",
"than",
"once"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L416-L421 | train | Sets the key bindings for this entry |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | PosInt.validate | def validate(self, value):
"""
Applies the validation criteria.
Returns value, new value, or None if invalid.
Overload this in derived classes.
"""
try:
# trap blank fields here
if not self.blank or value:
v = int(value)
... | python | def validate(self, value):
"""
Applies the validation criteria.
Returns value, new value, or None if invalid.
Overload this in derived classes.
"""
try:
# trap blank fields here
if not self.blank or value:
v = int(value)
... | [
"def",
"validate",
"(",
"self",
",",
"value",
")",
":",
"try",
":",
"# trap blank fields here",
"if",
"not",
"self",
".",
"blank",
"or",
"value",
":",
"v",
"=",
"int",
"(",
"value",
")",
"if",
"v",
"<",
"0",
":",
"return",
"None",
"return",
"value",
... | Applies the validation criteria.
Returns value, new value, or None if invalid.
Overload this in derived classes. | [
"Applies",
"the",
"validation",
"criteria",
".",
"Returns",
"value",
"new",
"value",
"or",
"None",
"if",
"invalid",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L430-L445 | train | Validate the value of the recordstore entry. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | PosInt.add | def add(self, num):
"""
Adds num to the current value
"""
try:
val = self.value() + num
except:
val = num
self.set(max(0, val)) | python | def add(self, num):
"""
Adds num to the current value
"""
try:
val = self.value() + num
except:
val = num
self.set(max(0, val)) | [
"def",
"add",
"(",
"self",
",",
"num",
")",
":",
"try",
":",
"val",
"=",
"self",
".",
"value",
"(",
")",
"+",
"num",
"except",
":",
"val",
"=",
"num",
"self",
".",
"set",
"(",
"max",
"(",
"0",
",",
"val",
")",
")"
] | Adds num to the current value | [
"Adds",
"num",
"to",
"the",
"current",
"value"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L447-L455 | train | Adds num to the current value of the attribute. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | PosInt.sub | def sub(self, num):
"""
Subtracts num from the current value
"""
try:
val = self.value() - num
except:
val = -num
self.set(max(0, val)) | python | def sub(self, num):
"""
Subtracts num from the current value
"""
try:
val = self.value() - num
except:
val = -num
self.set(max(0, val)) | [
"def",
"sub",
"(",
"self",
",",
"num",
")",
":",
"try",
":",
"val",
"=",
"self",
".",
"value",
"(",
")",
"-",
"num",
"except",
":",
"val",
"=",
"-",
"num",
"self",
".",
"set",
"(",
"max",
"(",
"0",
",",
"val",
")",
")"
] | Subtracts num from the current value | [
"Subtracts",
"num",
"from",
"the",
"current",
"value"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L457-L465 | train | Subtracts num from the current value |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | PosInt.ok | def ok(self):
"""
Returns True if OK to use, else False
"""
try:
v = int(self._value)
if v < 0:
return False
else:
return True
except:
return False | python | def ok(self):
"""
Returns True if OK to use, else False
"""
try:
v = int(self._value)
if v < 0:
return False
else:
return True
except:
return False | [
"def",
"ok",
"(",
"self",
")",
":",
"try",
":",
"v",
"=",
"int",
"(",
"self",
".",
"_value",
")",
"if",
"v",
"<",
"0",
":",
"return",
"False",
"else",
":",
"return",
"True",
"except",
":",
"return",
"False"
] | Returns True if OK to use, else False | [
"Returns",
"True",
"if",
"OK",
"to",
"use",
"else",
"False"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L467-L478 | train | Returns True if OK to use False otherwise |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | RangedInt.set_bind | def set_bind(self):
"""
Sets key bindings -- we need this more than once
"""
IntegerEntry.set_bind(self)
self.bind('<Next>', lambda e: self.set(self.imin))
self.bind('<Prior>', lambda e: self.set(self.imax)) | python | def set_bind(self):
"""
Sets key bindings -- we need this more than once
"""
IntegerEntry.set_bind(self)
self.bind('<Next>', lambda e: self.set(self.imin))
self.bind('<Prior>', lambda e: self.set(self.imax)) | [
"def",
"set_bind",
"(",
"self",
")",
":",
"IntegerEntry",
".",
"set_bind",
"(",
"self",
")",
"self",
".",
"bind",
"(",
"'<Next>'",
",",
"lambda",
"e",
":",
"self",
".",
"set",
"(",
"self",
".",
"imin",
")",
")",
"self",
".",
"bind",
"(",
"'<Prior>'... | Sets key bindings -- we need this more than once | [
"Sets",
"key",
"bindings",
"--",
"we",
"need",
"this",
"more",
"than",
"once"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L504-L510 | train | Sets the key bindings for this entry |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | RangedInt.validate | def validate(self, value):
"""
Applies the validation criteria.
Returns value, new value, or None if invalid.
Overload this in derived classes.
"""
try:
# trap blank fields here
if not self.blank or value:
v = int(value)
... | python | def validate(self, value):
"""
Applies the validation criteria.
Returns value, new value, or None if invalid.
Overload this in derived classes.
"""
try:
# trap blank fields here
if not self.blank or value:
v = int(value)
... | [
"def",
"validate",
"(",
"self",
",",
"value",
")",
":",
"try",
":",
"# trap blank fields here",
"if",
"not",
"self",
".",
"blank",
"or",
"value",
":",
"v",
"=",
"int",
"(",
"value",
")",
"if",
"v",
"<",
"self",
".",
"imin",
"or",
"v",
">",
"self",
... | Applies the validation criteria.
Returns value, new value, or None if invalid.
Overload this in derived classes. | [
"Applies",
"the",
"validation",
"criteria",
".",
"Returns",
"value",
"new",
"value",
"or",
"None",
"if",
"invalid",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L520-L535 | train | Validate the value of the recordset. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | RangedInt.add | def add(self, num):
"""
Adds num to the current value
"""
try:
val = self.value() + num
except:
val = num
self.set(min(self.imax, max(self.imin, val))) | python | def add(self, num):
"""
Adds num to the current value
"""
try:
val = self.value() + num
except:
val = num
self.set(min(self.imax, max(self.imin, val))) | [
"def",
"add",
"(",
"self",
",",
"num",
")",
":",
"try",
":",
"val",
"=",
"self",
".",
"value",
"(",
")",
"+",
"num",
"except",
":",
"val",
"=",
"num",
"self",
".",
"set",
"(",
"min",
"(",
"self",
".",
"imax",
",",
"max",
"(",
"self",
".",
"... | Adds num to the current value | [
"Adds",
"num",
"to",
"the",
"current",
"value"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L537-L545 | train | Adds num to the current value |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | RangedInt.ok | def ok(self):
"""
Returns True if OK to use, else False
"""
try:
v = int(self._value)
if v < self.imin or v > self.imax:
return False
else:
return True
except:
return False | python | def ok(self):
"""
Returns True if OK to use, else False
"""
try:
v = int(self._value)
if v < self.imin or v > self.imax:
return False
else:
return True
except:
return False | [
"def",
"ok",
"(",
"self",
")",
":",
"try",
":",
"v",
"=",
"int",
"(",
"self",
".",
"_value",
")",
"if",
"v",
"<",
"self",
".",
"imin",
"or",
"v",
">",
"self",
".",
"imax",
":",
"return",
"False",
"else",
":",
"return",
"True",
"except",
":",
... | Returns True if OK to use, else False | [
"Returns",
"True",
"if",
"OK",
"to",
"use",
"else",
"False"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L557-L568 | train | Returns True if OK to use False otherwise |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | RangedMint.set_bind | def set_bind(self):
"""
Sets key bindings -- we need this more than once
"""
RangedInt.set_bind(self)
self.unbind('<Next>')
self.unbind('<Prior>')
self.bind('<Next>', lambda e: self.set(self._min()))
self.bind('<Prior>', lambda e: self.set(self._max())) | python | def set_bind(self):
"""
Sets key bindings -- we need this more than once
"""
RangedInt.set_bind(self)
self.unbind('<Next>')
self.unbind('<Prior>')
self.bind('<Next>', lambda e: self.set(self._min()))
self.bind('<Prior>', lambda e: self.set(self._max())) | [
"def",
"set_bind",
"(",
"self",
")",
":",
"RangedInt",
".",
"set_bind",
"(",
"self",
")",
"self",
".",
"unbind",
"(",
"'<Next>'",
")",
"self",
".",
"unbind",
"(",
"'<Prior>'",
")",
"self",
".",
"bind",
"(",
"'<Next>'",
",",
"lambda",
"e",
":",
"self"... | Sets key bindings -- we need this more than once | [
"Sets",
"key",
"bindings",
"--",
"we",
"need",
"this",
"more",
"than",
"once"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L589-L597 | train | Sets the key bindings for this instance. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | RangedMint.add | def add(self, num):
"""
Adds num to the current value, jumping up the next
multiple of mfac if the result is not a multiple already
"""
try:
val = self.value() + num
except:
val = num
chunk = self.mfac.value()
if val % chunk > 0:
... | python | def add(self, num):
"""
Adds num to the current value, jumping up the next
multiple of mfac if the result is not a multiple already
"""
try:
val = self.value() + num
except:
val = num
chunk = self.mfac.value()
if val % chunk > 0:
... | [
"def",
"add",
"(",
"self",
",",
"num",
")",
":",
"try",
":",
"val",
"=",
"self",
".",
"value",
"(",
")",
"+",
"num",
"except",
":",
"val",
"=",
"num",
"chunk",
"=",
"self",
".",
"mfac",
".",
"value",
"(",
")",
"if",
"val",
"%",
"chunk",
">",
... | Adds num to the current value, jumping up the next
multiple of mfac if the result is not a multiple already | [
"Adds",
"num",
"to",
"the",
"current",
"value",
"jumping",
"up",
"the",
"next",
"multiple",
"of",
"mfac",
"if",
"the",
"result",
"is",
"not",
"a",
"multiple",
"already"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L607-L625 | train | Adds num to the current value jumping up the next next |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | RangedMint.ok | def ok(self):
"""
Returns True if OK to use, else False
"""
try:
v = int(self._value)
chunk = self.mfac.value()
if v < self.imin or v > self.imax or (v % chunk != 0):
return False
else:
return True
ex... | python | def ok(self):
"""
Returns True if OK to use, else False
"""
try:
v = int(self._value)
chunk = self.mfac.value()
if v < self.imin or v > self.imax or (v % chunk != 0):
return False
else:
return True
ex... | [
"def",
"ok",
"(",
"self",
")",
":",
"try",
":",
"v",
"=",
"int",
"(",
"self",
".",
"_value",
")",
"chunk",
"=",
"self",
".",
"mfac",
".",
"value",
"(",
")",
"if",
"v",
"<",
"self",
".",
"imin",
"or",
"v",
">",
"self",
".",
"imax",
"or",
"("... | Returns True if OK to use, else False | [
"Returns",
"True",
"if",
"OK",
"to",
"use",
"else",
"False"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L647-L659 | train | Returns True if OK to use False otherwise |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | ListInt.set_bind | def set_bind(self):
"""
Sets key bindings -- we need this more than once
"""
IntegerEntry.set_bind(self)
self.unbind('<Shift-Up>')
self.unbind('<Shift-Down>')
self.unbind('<Control-Up>')
self.unbind('<Control-Down>')
self.unbind('<Double-Button-1>'... | python | def set_bind(self):
"""
Sets key bindings -- we need this more than once
"""
IntegerEntry.set_bind(self)
self.unbind('<Shift-Up>')
self.unbind('<Shift-Down>')
self.unbind('<Control-Up>')
self.unbind('<Control-Down>')
self.unbind('<Double-Button-1>'... | [
"def",
"set_bind",
"(",
"self",
")",
":",
"IntegerEntry",
".",
"set_bind",
"(",
"self",
")",
"self",
".",
"unbind",
"(",
"'<Shift-Up>'",
")",
"self",
".",
"unbind",
"(",
"'<Shift-Down>'",
")",
"self",
".",
"unbind",
"(",
"'<Control-Up>'",
")",
"self",
".... | Sets key bindings -- we need this more than once | [
"Sets",
"key",
"bindings",
"--",
"we",
"need",
"this",
"more",
"than",
"once"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L697-L719 | train | Sets key bindings for the current locale. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | ListInt.set_unbind | def set_unbind(self):
"""
Unsets key bindings -- we need this more than once
"""
IntegerEntry.set_unbind(self)
self.unbind('<Button-1>')
self.unbind('<Button-3>')
self.unbind('<Up>')
self.unbind('<Down>')
self.unbind('<Enter>')
self.unbind(... | python | def set_unbind(self):
"""
Unsets key bindings -- we need this more than once
"""
IntegerEntry.set_unbind(self)
self.unbind('<Button-1>')
self.unbind('<Button-3>')
self.unbind('<Up>')
self.unbind('<Down>')
self.unbind('<Enter>')
self.unbind(... | [
"def",
"set_unbind",
"(",
"self",
")",
":",
"IntegerEntry",
".",
"set_unbind",
"(",
"self",
")",
"self",
".",
"unbind",
"(",
"'<Button-1>'",
")",
"self",
".",
"unbind",
"(",
"'<Button-3>'",
")",
"self",
".",
"unbind",
"(",
"'<Up>'",
")",
"self",
".",
"... | Unsets key bindings -- we need this more than once | [
"Unsets",
"key",
"bindings",
"--",
"we",
"need",
"this",
"more",
"than",
"once"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L721-L732 | train | Unbinds the key bindings for the current entry. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | ListInt.validate | def validate(self, value):
"""
Applies the validation criteria.
Returns value, new value, or None if invalid.
Overload this in derived classes.
"""
try:
v = int(value)
if v not in self.allowed:
return None
return value
... | python | def validate(self, value):
"""
Applies the validation criteria.
Returns value, new value, or None if invalid.
Overload this in derived classes.
"""
try:
v = int(value)
if v not in self.allowed:
return None
return value
... | [
"def",
"validate",
"(",
"self",
",",
"value",
")",
":",
"try",
":",
"v",
"=",
"int",
"(",
"value",
")",
"if",
"v",
"not",
"in",
"self",
".",
"allowed",
":",
"return",
"None",
"return",
"value",
"except",
"ValueError",
":",
"return",
"None"
] | Applies the validation criteria.
Returns value, new value, or None if invalid.
Overload this in derived classes. | [
"Applies",
"the",
"validation",
"criteria",
".",
"Returns",
"value",
"new",
"value",
"or",
"None",
"if",
"invalid",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L734-L747 | train | Validates the value of the national product of the current user s log entry. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | ListInt.set | def set(self, num):
"""
Sets current value to num
"""
if self.validate(num) is not None:
self.index = self.allowed.index(num)
IntegerEntry.set(self, num) | python | def set(self, num):
"""
Sets current value to num
"""
if self.validate(num) is not None:
self.index = self.allowed.index(num)
IntegerEntry.set(self, num) | [
"def",
"set",
"(",
"self",
",",
"num",
")",
":",
"if",
"self",
".",
"validate",
"(",
"num",
")",
"is",
"not",
"None",
":",
"self",
".",
"index",
"=",
"self",
".",
"allowed",
".",
"index",
"(",
"num",
")",
"IntegerEntry",
".",
"set",
"(",
"self",
... | Sets current value to num | [
"Sets",
"current",
"value",
"to",
"num"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L749-L755 | train | Sets the current value to num |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | ListInt.add | def add(self, num):
"""
Adds num to the current value
"""
self.index = max(0, min(len(self.allowed)-1, self.index+num))
self.set(self.allowed[self.index]) | python | def add(self, num):
"""
Adds num to the current value
"""
self.index = max(0, min(len(self.allowed)-1, self.index+num))
self.set(self.allowed[self.index]) | [
"def",
"add",
"(",
"self",
",",
"num",
")",
":",
"self",
".",
"index",
"=",
"max",
"(",
"0",
",",
"min",
"(",
"len",
"(",
"self",
".",
"allowed",
")",
"-",
"1",
",",
"self",
".",
"index",
"+",
"num",
")",
")",
"self",
".",
"set",
"(",
"self... | Adds num to the current value | [
"Adds",
"num",
"to",
"the",
"current",
"value"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L757-L762 | train | Adds num to the current value of the set. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | FloatEntry.validate | def validate(self, value):
"""
Applies the validation criteria.
Returns value, new value, or None if invalid.
Overload this in derived classes.
"""
try:
# trap blank fields here
if not self.blank or value:
float(value)
... | python | def validate(self, value):
"""
Applies the validation criteria.
Returns value, new value, or None if invalid.
Overload this in derived classes.
"""
try:
# trap blank fields here
if not self.blank or value:
float(value)
... | [
"def",
"validate",
"(",
"self",
",",
"value",
")",
":",
"try",
":",
"# trap blank fields here",
"if",
"not",
"self",
".",
"blank",
"or",
"value",
":",
"float",
"(",
"value",
")",
"return",
"value",
"except",
"ValueError",
":",
"return",
"None"
] | Applies the validation criteria.
Returns value, new value, or None if invalid.
Overload this in derived classes. | [
"Applies",
"the",
"validation",
"criteria",
".",
"Returns",
"value",
"new",
"value",
"or",
"None",
"if",
"invalid",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L810-L823 | train | Validate the value of the key. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | FloatEntry.set | def set(self, num):
"""
Sets the current value equal to num
"""
self._value = str(round(float(num), self.nplaces))
self._variable.set(self._value) | python | def set(self, num):
"""
Sets the current value equal to num
"""
self._value = str(round(float(num), self.nplaces))
self._variable.set(self._value) | [
"def",
"set",
"(",
"self",
",",
"num",
")",
":",
"self",
".",
"_value",
"=",
"str",
"(",
"round",
"(",
"float",
"(",
"num",
")",
",",
"self",
".",
"nplaces",
")",
")",
"self",
".",
"_variable",
".",
"set",
"(",
"self",
".",
"_value",
")"
] | Sets the current value equal to num | [
"Sets",
"the",
"current",
"value",
"equal",
"to",
"num"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L834-L839 | train | Sets the current value equal to num
|
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | FloatEntry.set_bind | 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>',... | python | 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",
")",
":",
"self",
".",
"bind",
"(",
"'<Button-1>'",
",",
"lambda",
"e",
":",
"self",
".",
"add",
"(",
"0.1",
")",
")",
"self",
".",
"bind",
"(",
"'<Button-3>'",
",",
"lambda",
"e",
":",
"self",
".",
"sub",
"(",
"0.... | Sets key bindings. | [
"Sets",
"key",
"bindings",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L879-L897 | train | Sets key bindings. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | FloatEntry.set_unbind | 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.... | python | 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",
")",
":",
"self",
".",
"unbind",
"(",
"'<Button-1>'",
")",
"self",
".",
"unbind",
"(",
"'<Button-3>'",
")",
"self",
".",
"unbind",
"(",
"'<Up>'",
")",
"self",
".",
"unbind",
"(",
"'<Down>'",
")",
"self",
".",
"unbind",... | Unsets key bindings. | [
"Unsets",
"key",
"bindings",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L899-L917 | train | Unsets key bindings. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | RangedFloat.set_bind | 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)) | python | 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",
")",
":",
"FloatEntry",
".",
"set_bind",
"(",
"self",
")",
"self",
".",
"bind",
"(",
"'<Next>'",
",",
"lambda",
"e",
":",
"self",
".",
"set",
"(",
"self",
".",
"fmin",
")",
")",
"self",
".",
"bind",
"(",
"'<Prior>'",... | Sets key bindings -- we need this more than once | [
"Sets",
"key",
"bindings",
"--",
"we",
"need",
"this",
"more",
"than",
"once"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L989-L995 | train | Sets the bound methods for this object to the values of the current FloatEntry. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | RangedFloat.validate | 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)
... | python | 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",
")",
":",
"try",
":",
"# trap blank fields here",
"if",
"not",
"self",
".",
"blank",
"or",
"value",
":",
"v",
"=",
"float",
"(",
"value",
")",
"if",
"(",
"self",
".",
"allowzero",
"and",
"v",
"!=",
"0",
... | Applies the validation criteria.
Returns value, new value, or None if invalid.
Overload this in derived classes. | [
"Applies",
"the",
"validation",
"criteria",
".",
"Returns",
"value",
"new",
"value",
"or",
"None",
"if",
"invalid",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1005-L1021 | train | Validate the value of the record ID field. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | RangedFloat.add | 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))) | python | 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",
")",
":",
"try",
":",
"val",
"=",
"self",
".",
"value",
"(",
")",
"+",
"num",
"except",
":",
"val",
"=",
"num",
"self",
".",
"set",
"(",
"min",
"(",
"self",
".",
"fmax",
",",
"max",
"(",
"self",
".",
"... | Adds num to the current value | [
"Adds",
"num",
"to",
"the",
"current",
"value"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1023-L1031 | train | Adds num to the current value |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | RangedFloat.ok | 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 | python | 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",
")",
":",
"try",
":",
"v",
"=",
"float",
"(",
"self",
".",
"_value",
")",
"if",
"v",
"<",
"self",
".",
"fmin",
"or",
"v",
">",
"self",
".",
"fmax",
":",
"return",
"False",
"else",
":",
"return",
"True",
"except",
":",
... | Returns True if OK to use, else False | [
"Returns",
"True",
"if",
"OK",
"to",
"use",
"else",
"False"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1043-L1054 | train | Returns True if OK to use False otherwise |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Expose.validate | 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
... | python | 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",
")",
":",
"try",
":",
"# trap blank fields here",
"if",
"value",
":",
"v",
"=",
"float",
"(",
"value",
")",
"if",
"(",
"v",
"!=",
"0",
"and",
"v",
"<",
"self",
".",
"fmin",
")",
"or",
"v",
">",
"self"... | This prevents setting any value more precise than 0.00001 | [
"This",
"prevents",
"setting",
"any",
"value",
"more",
"precise",
"than",
"0",
".",
"00001"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1177-L1191 | train | Validate the value of the recordstore. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Expose.set_min | 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) | python | 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",
")",
":",
"if",
"round",
"(",
"100000",
"*",
"fmin",
")",
"!=",
"100000",
"*",
"fmin",
":",
"raise",
"DriverError",
"(",
"'utils.widgets.Expose.set_min: '",
"+",
"'fmin must be a multiple of 0.00001'",
")",
"self",
"... | Updates minimum value | [
"Updates",
"minimum",
"value"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1202-L1210 | train | Updates minimum value of the log entry. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | ActButton.disable | 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 | python | 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",
")",
":",
"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. | [
"Disable",
"the",
"button",
"if",
"in",
"non",
"-",
"expert",
"mode",
";",
"unset",
"its",
"activity",
"flag",
"come",
"-",
"what",
"-",
"may",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1445-L1452 | train | Disable the button if in non - expert mode unset its activity flag come - what - may. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | ActButton.setNonExpert | 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() | python | 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",
")",
":",
"self",
".",
"_expert",
"=",
"False",
"if",
"self",
".",
"_active",
":",
"self",
".",
"enable",
"(",
")",
"else",
":",
"self",
".",
"disable",
"(",
")"
] | Turns off 'expert' status whereby to allow a button to be disabled | [
"Turns",
"off",
"expert",
"status",
"whereby",
"to",
"allow",
"a",
"button",
"to",
"be",
"disabled"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1462-L1470 | train | Turn off expert status whereby to allow a button to be disabled |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Sexagesimal.validate | 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 | python | 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",
")",
":",
"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. | [
"Applies",
"the",
"validation",
"criteria",
".",
"Returns",
"value",
"new",
"value",
"or",
"None",
"if",
"invalid",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1527-L1536 | train | Validates the value of the key as specified by the user. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Sexagesimal.set | 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()) | python | 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",
")",
":",
"self",
".",
"_value",
"=",
"coord",
".",
"Angle",
"(",
"num",
",",
"unit",
"=",
"u",
".",
"deg",
")",
"self",
".",
"_variable",
".",
"set",
"(",
"self",
".",
"as_string",
"(",
")",
")"
] | Sets the current value equal to num | [
"Sets",
"the",
"current",
"value",
"equal",
"to",
"num"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1547-L1552 | train | Sets the current value equal to num
|
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Sexagesimal.add | def add(self, quantity):
"""
Adds an angle to the value
"""
newvalue = self._value + quantity
self.set(newvalue.deg) | python | def add(self, quantity):
"""
Adds an angle to the value
"""
newvalue = self._value + quantity
self.set(newvalue.deg) | [
"def",
"add",
"(",
"self",
",",
"quantity",
")",
":",
"newvalue",
"=",
"self",
".",
"_value",
"+",
"quantity",
"self",
".",
"set",
"(",
"newvalue",
".",
"deg",
")"
] | Adds an angle to the value | [
"Adds",
"an",
"angle",
"to",
"the",
"value"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1555-L1560 | train | Adds an angle to the value
|
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Sexagesimal.sub | def sub(self, quantity):
"""
Subtracts an angle from the value
"""
newvalue = self._value - quantity
self.set(newvalue.deg) | python | def sub(self, quantity):
"""
Subtracts an angle from the value
"""
newvalue = self._value - quantity
self.set(newvalue.deg) | [
"def",
"sub",
"(",
"self",
",",
"quantity",
")",
":",
"newvalue",
"=",
"self",
".",
"_value",
"-",
"quantity",
"self",
".",
"set",
"(",
"newvalue",
".",
"deg",
")"
] | Subtracts an angle from the value | [
"Subtracts",
"an",
"angle",
"from",
"the",
"value"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1563-L1568 | train | Subtracts an angle from the value |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Sexagesimal.ok | 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 | python | 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",
")",
":",
"try",
":",
"coord",
".",
"Angle",
"(",
"self",
".",
"_value",
",",
"unit",
"=",
"u",
".",
"deg",
")",
"return",
"True",
"except",
"ValueError",
":",
"return",
"False"
] | Returns True if OK to use, else False | [
"Returns",
"True",
"if",
"OK",
"to",
"use",
"else",
"False"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1570-L1578 | train | Returns True if OK to use False otherwise |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Sexagesimal._callback | 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:
... | python | 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",
")",
":",
"# retrieve the value from the Entry",
"value",
"=",
"self",
".",
"_variable",
".",
"get",
"(",
")",
"# run the validation. Returns None if no good",
"newvalue",
"=",
"self",
".",
"validate",
"(",
"valu... | This gets called on any attempt to change the value | [
"This",
"gets",
"called",
"on",
"any",
"attempt",
"to",
"change",
"the",
"value"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1628-L1644 | train | This is the callback function that is called when the value of the Entry is changed. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Stop.act | 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... | python | 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",
")",
":",
"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",
... | Carries out the action associated with Stop button | [
"Carries",
"out",
"the",
"action",
"associated",
"with",
"Stop",
"button"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1719-L1749 | train | Carries out the action associated with Stop button |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Stop.check | 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 ... | python | 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",
")",
":",
"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, ... | Checks the status of the stop exposure command
This is run in background and can take a few seconds | [
"Checks",
"the",
"status",
"of",
"the",
"stop",
"exposure",
"command",
"This",
"is",
"run",
"in",
"background",
"and",
"can",
"take",
"a",
"few",
"seconds"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1751-L1816 | train | Checks the status of the stop exposure command
|
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Target.modver | 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'])
... | python | 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",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"if",
"self",
".",
"ok",
"(",
")",
":",
"tname",
"=",
"self",
".",
"val",
".",
"get",
"(",
")",
"if",
"tname",
"in",
"self",
"."... | Switches colour of verify button | [
"Switches",
"colour",
"of",
"verify",
"button"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1940-L1962 | train | Change the status of the current user to the status of the current verify button. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Target.act | 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:
... | python | 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",
")",
":",
"tname",
"=",
"self",
".",
"val",
".",
"get",
"(",
")",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"g",
".",
"clog",
".",
"info",
"(",
"'Checking '",
"+",
"tname",
"+",
"' in simbad'",
")",
"try",... | Carries out the action associated with Verify button | [
"Carries",
"out",
"the",
"action",
"associated",
"with",
"Verify",
"button"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L1964-L1992 | train | Carries out the action associated with Verify button |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | PowerOn.act | 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):
... | python | 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",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"g",
".",
"clog",
".",
"debug",
"(",
"'Power on pressed'",
")",
"if",
"execCommand",
"(",
"g",
",",
"'online'",
")",
":",
"g",
".",
"clog",
".",
"info",
... | Power on action | [
"Power",
"on",
"action"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2262-L2298 | train | Power on action |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | InstSetup.setExpertLevel | 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... | python | 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",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"level",
"=",
"g",
".",
"cpars",
"[",
"'expert_level'",
"]",
"# first define which buttons are visible",
"if",
"level",
"==",
"0",
":",
"# simple layout",
... | Set expert level | [
"Set",
"expert",
"level"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2373-L2412 | train | Set the expert level of the current object. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Switch.setExpertLevel | 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... | python | 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",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"level",
"=",
"g",
".",
"cpars",
"[",
"'expert_level'",
"]",
"if",
"level",
"==",
"0",
":",
"if",
"self",
".",
"val",
".",
"get",
"(",
")",
"=... | Modifies widget according to expertise level, which in this
case is just matter of hiding or revealing the button to
set CCD temps | [
"Modifies",
"widget",
"according",
"to",
"expertise",
"level",
"which",
"in",
"this",
"case",
"is",
"just",
"matter",
"of",
"hiding",
"or",
"revealing",
"the",
"button",
"to",
"set",
"CCD",
"temps"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2477-L2491 | train | Set the expertise level of the current item |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Timer.start | def start(self):
"""
Starts the timer from zero
"""
self.startTime = time.time()
self.configure(text='{0:<d} s'.format(0))
self.update() | python | 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",
")",
":",
"self",
".",
"startTime",
"=",
"time",
".",
"time",
"(",
")",
"self",
".",
"configure",
"(",
"text",
"=",
"'{0:<d} s'",
".",
"format",
"(",
"0",
")",
")",
"self",
".",
"update",
"(",
")"
] | Starts the timer from zero | [
"Starts",
"the",
"timer",
"from",
"zero"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2580-L2586 | train | Starts the timer from zero
|
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Timer.update | 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... | python | 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",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"try",
":",
"self",
".",
"count",
"+=",
"1",
"delta",
"=",
"int",
"(",
"round",
"(",
"time",
".",
"time",
"(",
")",
"-",
"self",
".",
"startTime",
"... | Updates @ 10Hz to give smooth running clock, checks
run status @0.2Hz to reduce load on servers. | [
"Updates"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2588-L2647 | train | Updates the current state of the current object with the current state of the current object. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | InfoFrame.dumpJSON | 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... | python | 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",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"return",
"dict",
"(",
"RA",
"=",
"self",
".",
"ra",
"[",
"'text'",
"]",
",",
"DEC",
"=",
"self",
".",
"dec",
"[",
"'text'",
"]",
",",
"tel",
"=",... | Return dictionary of data for FITS headers. | [
"Return",
"dictionary",
"of",
"data",
"for",
"FITS",
"headers",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2751-L2766 | train | Dump the current object to a dictionary of data for FITS headers. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | InfoFrame.update_tcs_table | 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... | python | 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",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"if",
"not",
"g",
".",
"cpars",
"[",
"'tcs_on'",
"]",
"or",
"not",
"g",
".",
"cpars",
"[",
"'telins_name'",
"]",
".",
"lower",
"(",
")",
"==",... | Periodically update a table of info from the TCS.
Only works at GTC | [
"Periodically",
"update",
"a",
"table",
"of",
"info",
"from",
"the",
"TCS",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2774-L2793 | train | Periodically update a table of info from the TCS. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | InfoFrame.update_tcs | 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... | python | 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",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"if",
"not",
"g",
".",
"cpars",
"[",
"'tcs_on'",
"]",
":",
"self",
".",
"after",
"(",
"20000",
",",
"self",
".",
"update_tcs",
")",
"return",
"if",
... | Periodically update TCS info.
A long running process, so run in a thread and fill a queue | [
"Periodically",
"update",
"TCS",
"info",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2795-L2829 | train | Periodically update TCS info. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | InfoFrame.update_slidepos | 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... | python | 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",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"if",
"not",
"g",
".",
"cpars",
"[",
"'focal_plane_slide_on'",
"]",
":",
"self",
".",
"after",
"(",
"20000",
",",
"self",
".",
"update_slidepos",
"... | Periodically update the slide position.
Also farmed out to a thread to avoid hanging GUI main thread | [
"Periodically",
"update",
"the",
"slide",
"position",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2831-L2855 | train | Periodically update the slide position. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | InfoFrame.update | 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']:
... | python | 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",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"if",
"g",
".",
"astro",
"is",
"None",
"or",
"g",
".",
"fpslide",
"is",
"None",
":",
"self",
".",
"after",
"(",
"100",
",",
"self",
".",
"update",
"... | Updates run & tel status window. Runs
once every 2 seconds. | [
"Updates",
"run",
"&",
"tel",
"status",
"window",
".",
"Runs",
"once",
"every",
"2",
"seconds",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L2857-L2991 | train | Updates run & tel status window. Runs
once every 2 seconds. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | AstroFrame.update | 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... | python | 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",
")",
":",
"try",
":",
"# update counter",
"self",
".",
"counter",
"+=",
"1",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"# current time",
"now",
"=",
"Time",
".",
"now",
"(",
")",
"# configure times",
"self",
... | Updates @ 10Hz to give smooth running clock. | [
"Updates"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3081-L3195 | train | Updates the internal state of the object with the current state of the object. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | WinPairs.check | 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... | python | 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",
")",
":",
"status",
"=",
"True",
"synced",
"=",
"True",
"xbin",
"=",
"self",
".",
"xbin",
".",
"value",
"(",
")",
"ybin",
"=",
"self",
".",
"ybin",
".",
"value",
"(",
")",
"npair",
"=",
"self",
".",
"npair",
".",
"v... | 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. | [
"Checks",
"the",
"values",
"of",
"the",
"window",
"pairs",
".",
"If",
"any",
"problems",
"are",
"found",
"it",
"flags",
"them",
"by",
"changing",
"the",
"background",
"colour",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3337-L3449 | train | Checks the values of the window pairs. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | WinPairs.sync | 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 ??
... | python | 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",
")",
":",
"# needs some mods for ultracam ??",
"xbin",
"=",
"self",
".",
"xbin",
".",
"value",
"(",
")",
"ybin",
"=",
"self",
".",
"ybin",
".",
"value",
"(",
")",
"n",
"=",
"0",
"for",
"xsl",
",",
"xsr",
",",
"ys",
",",
... | 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. | [
"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... | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3451-L3477 | train | Synchronise the settings. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | WinPairs.freeze | 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()
... | python | 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",
")",
":",
"for",
"xsl",
",",
"xsr",
",",
"ys",
",",
"nx",
",",
"ny",
"in",
"zip",
"(",
"self",
".",
"xsl",
",",
"self",
".",
"xsr",
",",
"self",
".",
"ys",
",",
"self",
".",
"nx",
",",
"self",
".",
"ny",
")",
... | Freeze (disable) all settings so they can't be altered | [
"Freeze",
"(",
"disable",
")",
"all",
"settings",
"so",
"they",
"can",
"t",
"be",
"altered"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3479-L3495 | train | Freeze all settings so they can t be altered |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | WinPairs.disable | 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()
... | python | 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",
")",
":",
"self",
".",
"freeze",
"(",
")",
"if",
"not",
"everything",
":",
"self",
".",
"xbin",
".",
"enable",
"(",
")",
"self",
".",
"ybin",
".",
"enable",
"(",
")",
"self",
".",
"f... | Disable all but possibly not binning, which is needed for FF apps
Parameters
---------
everything : bool
disable binning as well | [
"Disable",
"all",
"but",
"possibly",
"not",
"binning",
"which",
"is",
"needed",
"for",
"FF",
"apps"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3505-L3518 | train | Disable all but possibly not binning. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | WinPairs.enable | 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... | python | 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",
")",
":",
"npair",
"=",
"self",
".",
"npair",
".",
"value",
"(",
")",
"for",
"label",
",",
"xsl",
",",
"xsr",
",",
"ys",
",",
"nx",
",",
"ny",
"in",
"zip",
"(",
"self",
".",
"label",
"[",
":",
"npair",
"]",
",",
... | Enables WinPair settings | [
"Enables",
"WinPair",
"settings"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3520-L3548 | train | Enables WinPair settings for the current instance of this class. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | WinQuads.check | 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... | python | 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",
")",
":",
"status",
"=",
"synced",
"=",
"True",
"xbin",
"=",
"self",
".",
"xbin",
".",
"value",
"(",
")",
"ybin",
"=",
"self",
".",
"ybin",
".",
"value",
"(",
")",
"nquad",
"=",
"self",
".",
"nquad",
".",
"value",
"... | 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 | [
"Checks",
"the",
"values",
"of",
"the",
"window",
"quads",
".",
"If",
"any",
"problems",
"are",
"found",
"it",
"flags",
"the",
"offending",
"window",
"by",
"changing",
"the",
"background",
"colour",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3720-L3835 | train | Checks the values of the window quads. If any problems are found it checks the values of the window quads. If any problems are found it checks the values of the offending window by changing the background colour. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | WinQuads.sync | 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... | python | 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",
")",
":",
"xbin",
"=",
"self",
".",
"xbin",
".",
"value",
"(",
")",
"ybin",
"=",
"self",
".",
"ybin",
".",
"value",
"(",
")",
"if",
"xbin",
"==",
"1",
"and",
"ybin",
"==",
"1",
":",
"self",
".",
"sbutt",
".",
"conf... | 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. | [
"Synchronise",
"the",
"settings",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3837-L3871 | train | Synchronise the settings. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | WinQuads.freeze | 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... | python | 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",
")",
":",
"for",
"fields",
"in",
"zip",
"(",
"self",
".",
"xsll",
",",
"self",
".",
"xsul",
",",
"self",
".",
"xslr",
",",
"self",
".",
"xsur",
",",
"self",
".",
"ys",
",",
"self",
".",
"nx",
",",
"self",
".",
"n... | Freeze (disable) all settings | [
"Freeze",
"(",
"disable",
")",
"all",
"settings"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3873-L3885 | train | Freeze all settings in this instance. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | WinQuads.enable | 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],... | python | 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",
")",
":",
"nquad",
"=",
"self",
".",
"nquad",
".",
"value",
"(",
")",
"for",
"label",
",",
"xsll",
",",
"xsul",
",",
"xslr",
",",
"xsur",
",",
"ys",
",",
"nx",
",",
"ny",
"in",
"zip",
"(",
"self",
".",
"label",
"... | Enables WinQuad setting | [
"Enables",
"WinQuad",
"setting"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L3910-L3934 | train | Enables WinQuad setting
|
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Windows.check | 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
... | python | 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",
")",
":",
"status",
"=",
"True",
"synced",
"=",
"True",
"xbin",
"=",
"self",
".",
"xbin",
".",
"value",
"(",
")",
"ybin",
"=",
"self",
".",
"ybin",
".",
"value",
"(",
")",
"nwin",
"=",
"self",
".",
"nwin",
".",
"val... | 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. | [
"Checks",
"the",
"values",
"of",
"the",
"windows",
".",
"If",
"any",
"problems",
"are",
"found",
"it",
"flags",
"them",
"by",
"changing",
"the",
"background",
"colour",
".",
"Only",
"active",
"windows",
"are",
"checked",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L4077-L4177 | train | Checks the values of the active windows and returns status and flag for whether parameters are viable. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Windows.sync | 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... | python | 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",
")",
":",
"xbin",
"=",
"self",
".",
"xbin",
".",
"value",
"(",
")",
"ybin",
"=",
"self",
".",
"ybin",
".",
"value",
"(",
")",
"n",
"=",
"0",
"for",
"xs",
",",
"ys",
",",
"nx",
",",
"ny",
"in",
... | 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 | [
"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... | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L4179-L4203 | train | Synchronise the settings. This is a no - op if the pixel start is not binned. |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Windows.freeze | 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()
... | python | 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",
")",
":",
"for",
"xs",
",",
"ys",
",",
"nx",
",",
"ny",
"in",
"zip",
"(",
"self",
".",
"xs",
",",
"self",
".",
"ys",
",",
"self",
".",
"nx",
",",
"self",
".",
"ny",
")",
":",
"xs",
".",
"disable",
"(",
")",
"... | Freeze all settings so they can't be altered | [
"Freeze",
"all",
"settings",
"so",
"they",
"can",
"t",
"be",
"altered"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L4205-L4219 | train | Freeze all settings so they can t be altered |
HiPERCAM/hcam_widgets | hcam_widgets/widgets.py | Windows.enable | 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')
... | python | 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",
")",
":",
"nwin",
"=",
"self",
".",
"nwin",
".",
"value",
"(",
")",
"for",
"label",
",",
"xs",
",",
"ys",
",",
"nx",
",",
"ny",
"in",
"zip",
"(",
"self",
".",
"label",
"[",
":",
"nwin",
"]",
",",
"self",
".",
"... | Enables all settings | [
"Enables",
"all",
"settings"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L4229-L4255 | train | Enables all settings for the current instance of the
class. |
IceflowRE/unidown | unidown/plugin/a_plugin.py | APlugin.check_download | 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... | python | 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",
"]",
",",
"D... | 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: ... | [
"Check",
"if",
"the",
"download",
"of",
"the",
"given",
"dict",
"was",
"successful",
".",
"No",
"proving",
"if",
"the",
"content",
"of",
"the",
"file",
"is",
"correct",
"too",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L190-L211 | train | Check if the download of the given dict was successful. |
IceflowRE/unidown | unidown/plugin/a_plugin.py | APlugin.delete_data | 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() | python | 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",
")",
":",
"self",
".",
"clean_up",
"(",
")",
"tools",
".",
"delete_dir_rec",
"(",
"self",
".",
"_download_path",
")",
"if",
"self",
".",
"_save_state_file",
".",
"exists",
"(",
")",
":",
"self",
".",
"_save_state_file",
... | Delete everything which is related to the plugin. **Do not use if you do not know what you do!** | [
"Delete",
"everything",
"which",
"is",
"related",
"to",
"the",
"plugin",
".",
"**",
"Do",
"not",
"use",
"if",
"you",
"do",
"not",
"know",
"what",
"you",
"do!",
"**"
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L221-L228 | train | Delete all data related to the plugin. |
IceflowRE/unidown | unidown/plugin/a_plugin.py | APlugin.download_as_file | 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
... | python | 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",
":",
"while",
"folder",
".",
"joinpath",
"(",
"name",
")",
".",
"exists",
... | 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
... | [
"Download",
"the",
"given",
"url",
"to",
"the",
"given",
"target",
"folder",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L230-L260 | train | Download the given url to the given target folder. |
IceflowRE/unidown | unidown/plugin/a_plugin.py | APlugin.download | 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... | python | 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 the plugins host, to the given path. Proceeded with multiple connections
:attr:`~unidown.plugin.a_plugin.APlugin._simul_downloads`. After
:fu... | [
"..",
"warning",
"::"
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L262-L315 | train | Download the given LinkItem dict to the given folder. |
IceflowRE/unidown | unidown/plugin/a_plugin.py | APlugin._create_save_state | 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: ... | python | 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",
":",
"return",
"SaveState",
"(",
"dynamic_data",
".",
"SAVE_STATE_VERSION",
",",
"self",
".",
"info",
",",
"self",
".",
... | 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 | [
"Create",
"protobuf",
"savestate",
"of",
"the",
"module",
"and",
"the",
"given",
"data",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L317-L326 | train | Create protobuf savestate of the module and the given data. |
IceflowRE/unidown | unidown/plugin/a_plugin.py | APlugin.save_save_state | 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... | python | 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",
"json_data",
"=",
"json_format",
".",
"MessageToJson",
"(",
"self",
".",
"_create_save_state",
"(",
"data_dict",
")",
"... | 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] | [
"Save",
"meta",
"data",
"about",
"the",
"downloaded",
"things",
"and",
"the",
"plugin",
"to",
"file",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L328-L337 | train | Save meta data about the downloaded things and the plugin to file. |
IceflowRE/unidown | unidown/plugin/a_plugin.py | APlugin.load_save_state | 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... | python | 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",
":",
"if",
"not",
"self",
".",
"_save_state_file",
".",
"exists",
"(",
")",
":",
"self",
".",
"log",
".",
"info",
"(",
"\"No savestate file found.\"",
")",
"return",
"SaveState",
"(",
"dynamic_da... | 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... | [
"Load",
"the",
"savestate",
"of",
"the",
"plugin",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L339-L379 | train | Loads the savestate of the plugin. |
IceflowRE/unidown | unidown/plugin/a_plugin.py | APlugin.get_updated_data | 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... | python | 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",
"]",
":",
"if",
"not",
"self",
".",
"download_data",
":",
"return",
"{",
"}",
"new_link_item_dict",
... | 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] | [
"Get",
"links",
"who",
"needs",
"to",
"be",
"downloaded",
"by",
"comparing",
"old",
"and",
"the",
"new",
"data",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L381-L403 | train | Get links who need to be downloaded by comparing old and new data. |
IceflowRE/unidown | unidown/plugin/a_plugin.py | APlugin.update_dict | 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... | python | 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",
"]",
")",
":",
"if",
"logging",
".",
"INFO",
">=",
"logging",
".",
"getLevelName",
"(",
"dynamic_data... | 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 ... | [
"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... | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L405-L419 | train | Update the base dict with the new dict. |
IceflowRE/unidown | unidown/plugin/a_plugin.py | APlugin._get_options_dic | 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... | python | 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",
"]",
":",
"options_dic",
"=",
"{",
"}",
"for",
"option",
"in",
"options",
":",
"cur_option",
"=",
"option",
".",
"split",... | 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
... | [
"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",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L421-L437 | train | Convert the option list to a dictionary where the key is the option and the value is the related option. |
IceflowRE/unidown | unidown/plugin/a_plugin.py | APlugin.get_plugins | 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')} | python | 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",
"]",
":",
"return",
"{",
"entry",
".",
"name",
":",
"entry",
"for",
"entry",
"in",
"pkg_resources",
".",
"iter_entry_points",
"(",
"'unidown.plugin'",
")",
"... | Get all available plugins for unidown.
:return: plugin name list
:rtype: Dict[str, ~pkg_resources.EntryPoint] | [
"Get",
"all",
"available",
"plugins",
"for",
"unidown",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/a_plugin.py#L440-L447 | train | Get all available plugins for unidown. |
HiPERCAM/hcam_widgets | hcam_widgets/astro.py | _equation_of_time | 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
... | python | 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",
")",
":",
"# Julian centuries since J2000.0",
"T",
"=",
"(",
"t",
"-",
"Time",
"(",
"\"J2000\"",
")",
")",
".",
"to",
"(",
"u",
".",
"year",
")",
".",
"value",
"/",
"100",
"# obliquity of ecliptic (Meeus 1998, eq 22.2)",
... | 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 | [
"Find",
"the",
"difference",
"between",
"apparent",
"and",
"mean",
"solar",
"time"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/astro.py#L15-L53 | train | Find the difference between apparent and mean solar time. |
HiPERCAM/hcam_widgets | hcam_widgets/astro.py | _astropy_time_from_LST | 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 : `... | python | 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",
")",
":",
"# now we need to figure out time to return from LST",
"raSun",
"=",
"coord",
".",
"get_sun",
"(",
"t",
")",
".",
"ra",
"# calculate Greenwich Apparent Solar Time, which ... | 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 | [
"Convert",
"a",
"Local",
"Sidereal",
"Time",
"to",
"an",
"astropy",
"Time",
"object",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/astro.py#L56-L97 | train | Convert a Local Sidereal Time to an astropy. time. Time object. |
HiPERCAM/hcam_widgets | hcam_widgets/astro.py | _rise_set_trig | 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... | python | 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",
")",
":",
"dec",
"=",
"target",
".",
"transform_to",
"(",
"coord",
".",
"ICRS",
")",
".",
"dec",
"with",
"warnings",
".",
"catch_warnings",
"(",
")",
... | 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`.
... | [
"Crude",
"time",
"at",
"next",
"rise",
"/",
"set",
"of",
"target",
"using",
"spherical",
"trig",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/astro.py#L100-L150 | train | This method calculates the time at next rise or set of target using spherical trig. |
HiPERCAM/hcam_widgets | hcam_widgets/astro.py | calc_riseset | 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... | python | 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",
")",
":",
"target",
"=",
"coord",
".",
"get_body",
"(",
"target_name",
",",
"t",
")",
"t0",
"=",
"_rise_set_trig",
"(",
"t",
",",
"... | 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 ... | [
"Time",
"at",
"next",
"rise",
"/",
"set",
"of",
"target",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/astro.py#L153-L198 | train | Calculate next rise set of target. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.