query
stringlengths 9
60
| language
stringclasses 1
value | code
stringlengths 105
25.7k
| url
stringlengths 91
217
|
---|---|---|---|
get current observable value
|
python
|
def get_current(self, layout=None, network=None, verbose=False):
"""
Returns the current view or null if there is none.
:param verbose: print more
:returns: current view or null if there is none
"""
PARAMS={}
response=api(url=self.__url+"/get_current", PARAMS=PARAMS, method="POST", verbose=verbose)
return response
|
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/view.py#L110-L120
|
get current observable value
|
python
|
def currentValue(self):
"""
Returns the current value for the widget. If this widget is checkable
then the bitor value for all checked items is returned, otherwise, the
selected value is returned.
:return <int>
"""
enum = self.enum()
if ( self.isCheckable() ):
value = 0
for i in self.checkedIndexes():
value |= enum[nativestring(self.itemText(i))]
return value
else:
try:
return enum[nativestring(self.itemText(self.currentIndex()))]
except KeyError:
return 0
|
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xenumbox.py#L80-L98
|
get current observable value
|
python
|
def get_value(self):
"""Get the current value of the underlying measurement.
Calls the tracked function and stores the value in the wrapped
measurement as a side-effect.
:rtype: int, float, or None
:return: The current value of the wrapped function, or `None` if it no
longer exists.
"""
try:
val = self.func()()
except TypeError: # The underlying function has been GC'd
return None
self.gauge_point._set(val)
return self.gauge_point.get_value()
|
https://github.com/census-instrumentation/opencensus-python/blob/992b223f7e34c5dcb65922b7d5c827e7a1351e7d/opencensus/metrics/export/gauge.py#L205-L221
|
get current observable value
|
python
|
def get_current_item(self):
"""Returns (first) selected item or None"""
l = self.selectedIndexes()
if len(l) > 0:
return self.model().get_item(l[0])
|
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/list_views.py#L391-L395
|
get current observable value
|
python
|
def setCurrentValue(self, value):
"""
Sets the value for the combobox to the inputed value. If the combobox
is in a checkable state, then the values will be checked, otherwise,
the value will be selected.
:param value | <int>
"""
enum = self.enum()
if not enum:
return
if self.isCheckable():
indexes = []
for i in range(self.count()):
try:
check_value = enum[nativestring(self.itemText(i))]
except KeyError:
continue
if check_value & value:
indexes.append(i)
self.setCheckedIndexes(indexes)
else:
try:
text = enum[value]
except (AttributeError, KeyError):
return
self.setCurrentIndex(self.findText(text))
|
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xenumbox.py#L162-L191
|
get current observable value
|
python
|
def get(self):
"""Get the value"""
val = self.db.get_attributes(self.id, consistent_read=True)
if val:
if val.has_key('timestamp'):
self.timestamp = val['timestamp']
if val.has_key('current_value'):
self._value = self.item_type(val['current_value'])
if val.has_key("last_value") and val['last_value'] != None:
self.last_value = self.item_type(val['last_value'])
return self._value
|
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/sdb/db/sequence.py#L179-L189
|
get current observable value
|
python
|
def get_value(self, instance):
"""
Get value for the current object instance
:param instance:
:return:
"""
return instance.values.get(self.alias, self.default)
|
https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/fields.py#L37-L44
|
get current observable value
|
python
|
def get_value_from_view(context, field):
"""
Responsible for deriving the displayed value for the passed in 'field'.
This first checks for a particular method on the ListView, then looks for a method
on the object, then finally treats it as an attribute.
"""
view = context['view']
obj = None
if 'object' in context:
obj = context['object']
value = view.lookup_field_value(context, obj, field)
# it's a date
if type(value) == datetime:
return format_datetime(value)
return value
|
https://github.com/nyaruka/smartmin/blob/488a676a4960555e4d216a7b95d6e01a4ad4efd8/smartmin/templatetags/smartmin.py#L46-L64
|
get current observable value
|
python
|
def get_value(self, name):
"""Get the value of a variable"""
value = self.shellwidget.get_value(name)
# Reset temporal variable where value is saved to
# save memory
self.shellwidget._kernel_value = None
return value
|
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1560-L1566
|
get current observable value
|
python
|
def value(self, observation, input_actions=None):
""" Calculate value for given state """
action, value = self(observation, input_actions)
return value
|
https://github.com/MillionIntegrals/vel/blob/e0726e1f63742b728966ccae0c8b825ea0ba491a/vel/rl/models/deterministic_policy_model.py#L118-L121
|
get current observable value
|
python
|
def currentRecord(self):
"""
Returns the current record based on the active index from the model.
:return <orb.Table> || None
"""
completion = nativestring(self._pywidget.text())
options = map(str, self.model().stringList())
try:
index = options.index(completion)
except ValueError:
return None
return self._records[index]
|
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/completers/xorbsearchcompleter.py#L62-L76
|
get current observable value
|
python
|
def _value__get(self):
"""
Get/set the value of this element, using the ``value`` attribute.
Also, if this is a checkbox and it has no value, this defaults
to ``'on'``. If it is a checkbox or radio that is not
checked, this returns None.
"""
if self.checkable:
if self.checked:
return self.get('value') or 'on'
else:
return None
return self.get('value')
|
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L1439-L1452
|
get current observable value
|
python
|
def getValue(self):
'''
Returns
str(option_string * DropDown Value)
e.g.
-vvvvv
'''
dropdown_value = self.widget.GetValue()
if not str(dropdown_value).isdigit():
return ''
arg = str(self.option_string).replace('-', '')
repeated_args = arg * int(dropdown_value)
return '-' + repeated_args
|
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/gooey/gui/widgets/widget_pack.py#L199-L211
|
get current observable value
|
python
|
def getCurrent(cls):
"""
:rtype: YowsupEnv
"""
if cls.__CURR is None:
env = DEFAULT
envs = cls.getRegisteredEnvs()
if env not in envs:
env = envs[0]
logger.debug("Env not set, setting it to %s" % env)
cls.setEnv(env)
return cls.__CURR
|
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/env/env.py#L49-L60
|
get current observable value
|
python
|
def GET_getitemvalues(self) -> None:
"""Get the values of all |Variable| objects observed by the
current |GetItem| objects.
For |GetItem| objects observing time series,
|HydPyServer.GET_getitemvalues| returns only the values within
the current simulation period.
"""
for item in state.getitems:
for name, value in item.yield_name2value(state.idx1, state.idx2):
self._outputs[name] = value
|
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1025-L1035
|
get current observable value
|
python
|
def get_value(self, *args, **kwargs):
"""
Quickly retrieve single value at (item, major, minor) location.
.. deprecated:: 0.21.0
Please use .at[] or .iat[] accessors.
Parameters
----------
item : item label (panel item)
major : major axis label (panel item row)
minor : minor axis label (panel item column)
takeable : interpret the passed labels as indexers, default False
Returns
-------
value : scalar value
"""
warnings.warn("get_value is deprecated and will be removed "
"in a future release. Please use "
".at[] or .iat[] accessors instead", FutureWarning,
stacklevel=2)
return self._get_value(*args, **kwargs)
|
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/panel.py#L467-L490
|
get current observable value
|
python
|
def get_is_value(tag):
"""
Getters for data that also work with implicit transfersyntax
:param tag: the tag to read
"""
# data is int formatted as string so convert te string first and cast to int
if tag.VR == 'OB' or tag.VR == 'UN':
value = int(tag.value.decode("ascii").replace(" ", ""))
return value
return int(tag.value)
|
https://github.com/icometrix/dicom2nifti/blob/1462ae5dd979fa3f276fe7a78ceb9b028121536f/dicom2nifti/common.py#L333-L343
|
get current observable value
|
python
|
def get_value(self, var_name):
"""Return the value of a given variable.
Parameters
----------
var_name : str
The name of the variable whose value should be returned
Returns
-------
value : float
The value of the given variable in the current state
"""
if var_name in self.outside_name_map:
var_name = self.outside_name_map[var_name]
species_idx = self.species_name_map[var_name]
return self.state[species_idx]
|
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/bmi_wrapper.py#L147-L163
|
get current observable value
|
python
|
def get_value(self, i=None, unit=None,
uncover=None, trail=None,
linebreak=None, sort_by_indep=None,
attr='_value'):
"""
access the value for a given value of i (independent-variable) depending
on which effects (i.e. uncover) are enabled.
If uncover, trail, or linebreak are None (default), then the value from
the parent Call will be used.
"""
value = getattr(self, attr) # could be self._value or self._error
if value is None:
return None
if uncover is None:
uncover = self.call.uncover
if trail is None:
trail = self.call.trail
if linebreak is None:
linebreak = self.call.linebreak
if sort_by_indep is None:
# TODO: make this a property of the call?
sort_by_indep = True
if isinstance(value, str) or isinstance(value, float):
if i is None:
return self._to_unit(value, unit)
elif isinstance(self.call.i.value, float):
# then we still want to "select" based on the value of i
if self._filter_at_i(i):
return value
else:
return None
else:
# then we should show either way. For example - a color or
# axhline even with i given won't change in i
return self._to_unit(value, unit)
# from here on we're assuming the value is an array, so let's just check
# to be sure
if not isinstance(value, np.ndarray):
raise NotImplementedError("value/error must be a numpy array")
if linebreak is not False:
return self._do_linebreak(func='get{}'.format(attr),
i=i,
unit=unit,
uncover=uncover,
trail=trail,
linebreak=linebreak,
sort_by_indep=sort_by_indep)
if sort_by_indep is not False:
# if we've made it here, linebreak should already be False (if
# linebreak was True, then we'd be within _do_linebreak and those
# get_value calls pass linebreak=False)
return self._sort_by_indep(func='get{}'.format(attr),
i=i,
unit=unit,
uncover=uncover,
trail=trail,
linebreak=False,
sort_by_indep=sort_by_indep)
# from here on, linebreak==False and sort_by_indep==False (if either
# were True, then we're within those functions and asking for the original
# array)
if i is None:
if len(value.shape)==1:
return self._to_unit(value, unit)
else:
if isinstance(self.call, Plot):
return self._to_unit(value.T, unit)
else:
return self._to_unit(value, unit)
# filter the data as necessary
filter_ = self._filter_at_i(i, uncover=uncover, trail=trail)
if isinstance(self.call.i.value, float):
if filter_:
return self._to_unit(value, unit)
else:
return None
if len(value.shape)==1:
# then we're dealing with a flat 1D array
if attr == '_value':
if trail is not False:
trail_i = self._get_trail_min(i)
first_point = self.interpolate_at_i(trail_i)
if uncover:
last_point = self.interpolate_at_i(i)
else:
first_point = np.nan
last_point = np.nan
if uncover and trail is not False:
concat = (np.array([first_point]),
value[filter_],
np.array([last_point]))
elif uncover:
concat = (value[filter_],
np.array([last_point]))
elif trail:
concat = (np.array([first_point]),
value[filter_])
else:
return self._to_unit(value[filter_], unit)
return self._to_unit(np.concatenate(concat), unit)
else:
# then we need to "select" based on the indep and the value
if isinstance(self.call, Plot):
return self._to_unit(value[filter_].T, unit)
else:
return self._to_unit(value[filter_], unit)
|
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/autofig/call.py#L1582-L1708
|
get current observable value
|
python
|
def get_current_object(self):
"""Return the current object. This is useful if you want the real
object behind the proxy at a time for performance reasons or because
you want to pass the object into a different context.
"""
if not hasattr(self.__local, '__release_local__'):
return self.__local()
try:
return getattr(self.__local, self.__name__)
except AttributeError:
raise RuntimeError('no object bound to %s' % self.__name__)
|
https://github.com/reorx/torext/blob/84c4300ebc7fab0dbd11cf8b020bc7d4d1570171/torext/utils.py#L240-L250
|
get current observable value
|
python
|
def get_observatory_status(self, observatory_id, status_time=None):
"""
Get details of the specified camera's status
:param string observatory_id:
a observatory ID, as returned by list_observatories()
:param float status_time:
optional, if specified attempts to get the status for the given camera at a particular point in time
specified as a datetime instance. This is useful if you want to retrieve the status of the camera at the
time a given event or file was produced. If this is None or not specified the time is 'now'.
:return:
a dictionary, or None if there was either no observatory found.
"""
if status_time is None:
response = requests.get(
self.base_url + '/obstory/{0}/statusdict'.format(observatory_id))
else:
response = requests.get(
self.base_url + '/obstory/{0}/statusdict/{1}'.format(observatory_id, str(status_time)))
if response.status_code == 200:
d = safe_load(response.text)
if 'status' in d:
return d['status']
return None
|
https://github.com/camsci/meteor-pi/blob/7b01527650bd1b2b76d6f364e8122e25b8812c8d/src/pythonModules/meteorpi_client/meteorpi_client/__init__.py#L78-L101
|
get current observable value
|
python
|
def get_value(self, name):
"""Get the value of a variable"""
ns = self._get_current_namespace()
value = ns[name]
try:
self.send_spyder_msg('data', data=value)
except:
# * There is no need to inform users about
# these errors.
# * value = None makes Spyder to ignore
# petitions to display a value
self.send_spyder_msg('data', data=None)
self._do_publish_pdb_state = False
|
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L150-L162
|
get current observable value
|
python
|
def get(self, agentml, user=None, key=None):
"""
Evaluate and return the current value of a user variable
:param user: The active user object
:type user: agentml.User or None
:param agentml: The active AgentML instance
:type agentml: AgentML
:param key: The variables key
:type key: str
:return: Current value of the user variable (or None if the variable has not been set)
:rtype : str or None
"""
if not user or not key:
return
try:
return user.get_var(key)
except VarNotDefinedError:
return
|
https://github.com/FujiMakoto/AgentML/blob/c8cb64b460d876666bf29ea2c682189874c7c403/agentml/parser/trigger/condition/types/user_var.py#L15-L36
|
get current observable value
|
python
|
def get_value(self, index):
"""Return current value"""
if index.column() == 0:
return self.keys[ index.row() ]
elif index.column() == 1:
return self.types[ index.row() ]
elif index.column() == 2:
return self.sizes[ index.row() ]
else:
return self._data[ self.keys[index.row()] ]
|
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L301-L310
|
get current observable value
|
python
|
def _get_current_object(self):
"""Return the current object. This is useful if you want the real
object behind the proxy at a time for performance reasons or because
you want to pass the object into a different context.
"""
if not hasattr(self.__local, '__release_local__'):
return self.__local()
try:
return getattr(self.__local, self.__name__)
except AttributeError:
raise RuntimeError('no object bound to %s' % self.__name__)
|
https://github.com/tomekwojcik/envelopes/blob/8ad190a55d0d8b805b6ae545b896e719467253b7/envelopes/local.py#L301-L311
|
get current observable value
|
python
|
def getRowCurrentIndex(self):
""" Returns the index of column 0 of the current item in the underlying model.
See also the notes at the top of this module on current item vs selected item(s).
"""
curIndex = self.currentIndex()
col0Index = curIndex.sibling(curIndex.row(), 0)
return col0Index
|
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/widgets/argostreeview.py#L107-L113
|
get current observable value
|
python
|
def get_current(self, channel, unit='A'):
'''Reading current
'''
values = self._get_adc_value(address=self._ch_map[channel]['ADCI']['address'])
raw = values[self._ch_map[channel]['ADCI']['adc_ch']]
dac_offset = self._ch_cal[channel]['ADCI']['offset']
dac_gain = self._ch_cal[channel]['ADCI']['gain']
if 'PWR' in channel:
current = ((raw - dac_offset) / dac_gain)
if unit == 'raw':
return raw
elif unit == 'A':
return current / 1000
elif unit == 'mA':
return current
elif unit == 'uA':
return current * 1000
else:
raise TypeError("Invalid unit type.")
else:
voltage = values[self._ch_map[channel]['ADCV']['adc_ch']]
current = (((raw - voltage) - dac_offset) / dac_gain)
if unit == 'raw':
return raw
elif unit == 'A':
return current / 1000000
elif unit == 'mA':
return current / 1000
elif unit == 'uA':
return current
else:
raise TypeError("Invalid unit type.")
|
https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/GPAC.py#L785-L819
|
get current observable value
|
python
|
def get_value(self, name, parameters=None):
"""Return the value of a cached variable if applicable
The value of the variable 'name' is returned, if no parameters are passed or if all parameters are identical
to the ones stored for the variable.
:param str name: Name of teh variable
:param dict parameters: Current parameters or None if parameters do not matter
:return: The cached value of the variable or None if the parameters differ
"""
if not isinstance(parameters, dict):
raise TypeError("parameters must a dict")
if name not in self._cache:
return None
hash = self._parameter_hash(parameters)
hashdigest = hash.hexdigest()
return self._cache[name].get(hashdigest, None)
|
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/cache/value_cache.py#L59-L75
|
get current observable value
|
python
|
def value(self):
"""Return the current value of the Variable.
"""
try:
return self._value.value()
except UnresolvedVariableValue:
raise UnresolvedVariable("<unknown>", self)
except InvalidLookupConcatenation as e:
raise InvalidLookupCombination(e.lookup, e.lookups, self)
|
https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/variables.py#L53-L61
|
get current observable value
|
python
|
def value(self):
""" Return the broadcasted value
"""
if not hasattr(self, "_value") and self._path is not None:
self._value = self._load(self._path)
return self._value
|
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/models/utils/model_broadcast.py#L61-L66
|
get current observable value
|
python
|
def get_current_notification(self):
"""
returns the current notification (i.e. the one that is visible)
"""
log.debug("getting visible notification...")
cmd, url = DEVICE_URLS["get_current_notification"]
return self._exec(cmd, url)
|
https://github.com/keans/lmnotify/blob/b0a5282a582e5090852dc20fea8a135ca258d0d3/lmnotify/lmnotify.py#L313-L319
|
get current observable value
|
python
|
def getCurrentObjective(self):
"""
Get the the current objective. Returns `None` if no objective is set.
"""
name = self._impl.getCurrentObjectiveName()
if name == '':
return None
else:
return self.getObjective(name)
|
https://github.com/ampl/amplpy/blob/39df6954049a11a8f666aed26853259b4687099a/amplpy/ampl.py#L849-L857
|
get current observable value
|
python
|
async def get_value(self):
"""
Get the value from the API. Make sure to use a lock in order not to
fetch the value twice at the same time.
"""
cc = self.request.custom_content
async with self.lock:
if self.content_key not in cc:
cc[self.content_key] = await self.call_api()
return cc[self.content_key]
|
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/engine/triggers.py#L119-L131
|
get current observable value
|
python
|
def get_current(self):
"""Return current name.
"""
suffix = self._separator + "%s" % str(self._counter_curr)
return self._base_name + suffix
|
https://github.com/programa-stic/barf-project/blob/18ed9e5eace55f7bf6015ec57f037c364099021c/barf/utils/utils.py#L78-L83
|
get current observable value
|
python
|
def get_current_value(self):
"""Return current annealing value
# Returns
Value to use in annealing
"""
if self.agent.training:
# Linear annealed: f(x) = ax + b.
a = -float(self.value_max - self.value_min) / float(self.nb_steps)
b = float(self.value_max)
value = max(self.value_min, a * float(self.agent.step) + b)
else:
value = self.value_test
return value
|
https://github.com/keras-rl/keras-rl/blob/e6efb0d8297ec38d704a3110b5d6ed74d09a05e3/rl/policy.py#L62-L75
|
get current observable value
|
python
|
def get_value(self, consumer=None):
"""
If consumer is specified, the channel will record that consumer as having consumed the value.
"""
if consumer:
self.consumers[consumer] = True
return self.value
|
https://github.com/sleibman/python-conduit/blob/f6002d45c4f25e4418591a72fdac9ac6fb422d80/conduit/core.py#L105-L111
|
get current observable value
|
python
|
def get_value(cls, bucket, key):
"""Get tag value."""
obj = cls.get(bucket, key)
return obj.value if obj else None
|
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/models.py#L623-L626
|
get current observable value
|
python
|
def get_value(self):
"""
Retrieves the value to inject in the component
:return: The value to inject
"""
with self._lock:
# The value field must be a deep copy of our dictionary
if self._future_value is not None:
return {
key: value[:] for key, value in self._future_value.items()
}
return None
|
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresmap.py#L551-L564
|
get current observable value
|
python
|
def get_current(self):
"""Get current forecast."""
now = dt.now().timestamp()
url = build_url(self.api_key, self.spot_id, self.fields,
self.unit, now, now)
return get_msw(url)
|
https://github.com/jcconnell/python-magicseaweed/blob/b22d5f22a134532ac6ab7fc274ee768e85f624a0/magicseaweed/__init__.py#L164-L169
|
get current observable value
|
python
|
def current(self):
"""
Currently active item on the _timeline Canvas
:rtype: str
"""
results = self._timeline.find_withtag(tk.CURRENT)
return results[0] if len(results) != 0 else None
|
https://github.com/RedFantom/ttkwidgets/blob/02150322060f867b6e59a175522ef84b09168019/ttkwidgets/timeline.py#L997-L1004
|
get current observable value
|
python
|
def get_value_by_parameter(self, parameter_id=None):
"""Gets a ``Value`` for the given parameter ``Id``.
If more than one value exists for the given parameter, the most
preferred value is returned. This method can be used as a
convenience when only one value is expected.
``get_values_by_parameters()`` should be used for getting all
the active values.
arg: parameter_id (osid.id.Id): the ``Id`` of the
``Parameter`` to retrieve
return: (osid.configuration.Value) - the value
raise: NotFound - the ``parameter_id`` not found or no value
available
raise: NullArgument - the ``parameter_id`` is ``null``
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
*compliance: mandatory -- This method must be implemented.*
"""
pass
if parameter_id is None:
raise NullArgument
try:
parameter_key = parameter_id.get_identifier() + '.' + parameter_id.get_identifier_namespace()
parameter_map = self._catalog._config_map['parameters'][parameter_key]
except KeyError:
try:
parameter_key = parameter_id.get_identifier()
parameter_map = self._catalog._config_map['parameters'][parameter_key]
except KeyError:
raise NotFound(str(parameter_id))
if len(parameter_map['values']) == 0:
raise NotFound()
lowest_priority_value_map = None
for value_map in parameter_map['values']:
if lowest_priority_value_map is None or lowest_priority_value_map['priority'] < value_map['priority']:
lowest_priority_value_map = value_map
return Value(lowest_priority_value_map, Parameter(parameter_map))
|
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/runtime/impls/configuration/sessions.py#L166-L204
|
get current observable value
|
python
|
def get_value(self, continuous_future, dt, field):
"""
Retrieve the value at the given coordinates.
Parameters
----------
sid : int
The asset identifier.
dt : pd.Timestamp
The timestamp for the desired data point.
field : string
The OHLVC name for the desired data point.
Returns
-------
value : float|int
The value at the given coordinates, ``float`` for OHLC, ``int``
for 'volume'.
Raises
------
NoDataOnDate
If the given dt is not a valid market minute (in minute mode) or
session (in daily mode) according to this reader's tradingcalendar.
"""
rf = self._roll_finders[continuous_future.roll_style]
sid = (rf.get_contract_center(continuous_future.root_symbol,
dt,
continuous_future.offset))
return self._bar_reader.get_value(sid, dt, field)
|
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/continuous_future_reader.py#L127-L156
|
get current observable value
|
python
|
def value(self):
"""Utility method to retrieve Response Object information"""
# Set the code to the status value
if isinstance(self.code, Status):
code = self.code.value
else:
code = self.code
return {'code': code, 'errors': self.errors}
|
https://github.com/proteanhq/protean/blob/0e29873f4aa634aa93cc08ed675dd749c7ed4b0f/src/protean/core/transport/response.py#L62-L69
|
get current observable value
|
python
|
def set_current_value(self, value):
"""Set the detected IP in the current run (if any)."""
self._oldvalue = self.get_current_value()
self._currentvalue = value
if self._oldvalue != value:
# self.notify_observers("new_ip_detected", {"ip": value})
LOG.debug("%s.set_current_value(%s)", self.__class__.__name__, value)
return value
|
https://github.com/infothrill/python-dyndnsc/blob/2196d48aa6098da9835a7611fbdb0b5f0fbf51e4/dyndnsc/detector/base.py#L75-L82
|
get current observable value
|
python
|
def get_current_ns(
ns_var_name: str = NS_VAR_NAME, ns_var_ns: str = NS_VAR_NS
) -> Namespace:
"""Get the value of the dynamic variable `*ns*` in the current thread."""
ns_sym = sym.Symbol(ns_var_name, ns=ns_var_ns)
ns: Namespace = Maybe(Var.find(ns_sym)).map(lambda v: v.value).or_else_raise(
lambda: RuntimeException(f"Dynamic Var {ns_sym} not bound!")
)
return ns
|
https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/runtime.py#L1333-L1341
|
get current observable value
|
python
|
def observable_object_references(instance):
"""Ensure certain observable object properties reference the correct type
of object.
"""
for key, obj in instance['objects'].items():
if 'type' not in obj:
continue
elif obj['type'] not in enums.OBSERVABLE_PROP_REFS:
continue
obj_type = obj['type']
for obj_prop in enums.OBSERVABLE_PROP_REFS[obj_type]:
if obj_prop not in obj:
continue
enum_prop = enums.OBSERVABLE_PROP_REFS[obj_type][obj_prop]
if isinstance(enum_prop, list):
refs = obj[obj_prop]
enum_vals = enum_prop
for x in check_observable_refs(refs, obj_prop, enum_prop, '',
enum_vals, key, instance):
yield x
elif isinstance(enum_prop, dict):
for embedded_prop in enum_prop:
if isinstance(obj[obj_prop], dict):
if embedded_prop not in obj[obj_prop]:
continue
embedded_obj = obj[obj_prop][embedded_prop]
for embed_obj_prop in embedded_obj:
if embed_obj_prop not in enum_prop[embedded_prop]:
continue
refs = embedded_obj[embed_obj_prop]
enum_vals = enum_prop[embedded_prop][embed_obj_prop]
for x in check_observable_refs(refs, obj_prop, enum_prop,
embed_obj_prop, enum_vals,
key, instance):
yield x
elif isinstance(obj[obj_prop], list):
for embedded_list_obj in obj[obj_prop]:
if embedded_prop not in embedded_list_obj:
continue
embedded_obj = embedded_list_obj[embedded_prop]
refs = embedded_obj
enum_vals = enum_prop[embedded_prop]
for x in check_observable_refs(refs, obj_prop, enum_prop,
embedded_prop, enum_vals,
key, instance):
yield x
|
https://github.com/oasis-open/cti-stix-validator/blob/a607014e3fa500a7678f8b61b278456ca581f9d0/stix2validator/v20/musts.py#L191-L240
|
get current observable value
|
python
|
def _get_current_object(self):
"""Get current object.
This is useful if you want the real
object behind the proxy at a time for performance reasons or because
you want to pass the object into a different context.
"""
loc = object.__getattribute__(self, '_Proxy__local')
if not hasattr(loc, '__release_local__'):
return loc(*self.__args, **self.__kwargs)
try: # pragma: no cover
# not sure what this is about
return getattr(loc, self.__name__)
except AttributeError: # pragma: no cover
raise RuntimeError('no object bound to {0.__name__}'.format(self))
|
https://github.com/shanbay/sea/blob/a4484a571e3d68cc333411264077a59ea20cc5f1/sea/local.py#L58-L71
|
get current observable value
|
python
|
def get_value(cls, object_version, key):
"""Get the tag value."""
obj = cls.get(object_version, key)
return obj.value if obj else None
|
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/models.py#L1347-L1350
|
get current observable value
|
python
|
def current_item(self):
"""Return the current element."""
if self._history and self._index >= 0:
self._check_index()
return self._history[self._index]
|
https://github.com/kwikteam/phy/blob/7e9313dc364304b7d2bd03b92938347343703003/phy/cluster/_history.py#L28-L32
|
get current observable value
|
python
|
def get_full_current_object(arn, current_model):
"""
Utility method to fetch items from the Current table if they are too big for SNS/SQS.
:param record:
:param current_model:
:return:
"""
LOG.debug(f'[-->] Item with ARN: {arn} was too big for SNS -- fetching it from the Current table...')
item = list(current_model.query(arn))
# If for whatever reason, the item *cannot* be found, then this record should be skipped over.
# This will happen if this event came in and got processed right after the item was deleted
# from the Current table. If so, then do nothing -- the deletion event will be processed later.
if not item:
return None
# We need to place the real configuration data into the record so it can be deserialized into
# the current model correctly:
return item[0]
|
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/common/dynamodb.py#L124-L143
|
get current observable value
|
python
|
def get_observation(observation_id: int) -> Dict[str, Any]:
"""Get details about an observation.
:param observation_id:
:returns: a dict with details on the observation
:raises: ObservationNotFound
"""
r = get_observations(params={'id': observation_id})
if r['results']:
return r['results'][0]
raise ObservationNotFound()
|
https://github.com/inbo/pyinaturalist/blob/d380ede84bdf15eca8ccab9efefe08d2505fe6a8/pyinaturalist/node_api.py#L30-L42
|
get current observable value
|
python
|
def getObservers(self):
"""
Get the list of observer to the instance of the class.
:return: Subscribed Obversers.
:rtype: Array
"""
result = []
for observer in self._observers:
result.append(
{
"observing": observer["observing"],
"call": observer["call"]
})
return result
|
https://github.com/fredericklussier/ObservablePy/blob/fd7926a0568621f80b1d567d18f199976f1fa4e8/observablePy/ObserverStore.py#L55-L69
|
get current observable value
|
python
|
def value(self):
"""Return the current value.
This first checks if the value is cached (i.e., if
`self.__value__` is not None)
If it is not cached then it invokes the `loader` function to
compute the value, and caches the computed value
"""
if self.__value__ is None:
try:
loader = self.__dict__['loader']
except KeyError:
raise AttributeError("Loader is not defined")
# Try to run the loader.
# Don't catch expections here, let the Model class figure it out
val = loader()
# Try to set the value
try:
self.set_value(val)
except TypeError:
msg = "Loader must return variable of type %s or None, got %s" % (self.__dict__['dtype'], type(val))
raise TypeError(msg)
return self.__value__
|
https://github.com/kadrlica/pymodeler/blob/f426c01416fd4b8fc3afeeb6d3b5d1cb0cb8f8e3/pymodeler/parameter.py#L290-L317
|
get current observable value
|
python
|
def _get_value(self):
"""
Get the value represented by this node.
"""
if self._path:
try:
container, last = self._resolve_path()
return container[last]
except KeyError:
return None
except IndexError:
return None
else:
return self._data
|
https://github.com/snare/scruffy/blob/0fedc08cfdb6db927ff93c09f25f24ce5a04c541/scruffy/config.py#L187-L200
|
get current observable value
|
python
|
def get(self):
"""
Resolves and returns the object value. Re-uses an existing previous evaluation, if applicable.
:return: The result of evaluating the object.
"""
if not self._evaluated:
self._val = self._func(*self._args, **self._kwargs)
self._evaluated = True
return self._val
|
https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/functional.py#L124-L133
|
get current observable value
|
python
|
def get_current(self, item=None, raw=False, start=None, end=None):
"""
Get a Panel that is the current data in view. It is not safe to persist
these objects because internal data might change
"""
item_indexer = slice(None)
if item:
item_indexer = self.items.get_loc(item)
start_index = self._start_index
end_index = self._pos
# get inital date window
where = slice(start_index, end_index)
current_dates = self.date_buf[where]
def convert_datelike_to_long(dt):
if isinstance(dt, pd.Timestamp):
return dt.asm8
if isinstance(dt, datetime.datetime):
return np.datetime64(dt)
return dt
# constrict further by date
if start:
start = convert_datelike_to_long(start)
start_index += current_dates.searchsorted(start)
if end:
end = convert_datelike_to_long(end)
_end = current_dates.searchsorted(end, 'right')
end_index -= len(current_dates) - _end
where = slice(start_index, end_index)
values = self.buffer.values[item_indexer, where, :]
current_dates = self.date_buf[where]
if raw:
# return copy so we can change it without side effects here
return values.copy()
major_axis = pd.DatetimeIndex(deepcopy(current_dates), tz='utc')
if values.ndim == 3:
return pd.Panel(values, self.items, major_axis, self.minor_axis,
dtype=self.dtype)
elif values.ndim == 2:
return pd.DataFrame(values, major_axis, self.minor_axis,
dtype=self.dtype)
|
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/data.py#L165-L214
|
get current observable value
|
python
|
def getvariable(name):
"""Get the value of a local variable somewhere in the call stack."""
import inspect
fr = inspect.currentframe()
try:
while fr:
fr = fr.f_back
vars = fr.f_locals
if name in vars:
return vars[name]
except:
pass
return None
|
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/util/substitute.py#L47-L59
|
get current observable value
|
python
|
def observe(self, key, master_only=False):
"""Return storage information for a key.
It returns a :class:`.ValueResult` object with the ``value``
field set to a list of :class:`~.ObserveInfo` objects. Each
element in the list responds to the storage status for the key
on the given node. The length of the list (and thus the number
of :class:`~.ObserveInfo` objects) are equal to the number of
online replicas plus the master for the given key.
:param string key: The key to inspect
:param bool master_only: Whether to only retrieve information
from the master node.
.. seealso:: :ref:`observe_info`
"""
return _Base.observe(self, key, master_only=master_only)
|
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L977-L993
|
get current observable value
|
python
|
def get_value(self, label, takeable=False):
"""
Retrieve single value at passed index label
.. deprecated:: 0.21.0
Please use .at[] or .iat[] accessors.
Parameters
----------
index : label
takeable : interpret the index as indexers, default False
Returns
-------
value : scalar value
"""
warnings.warn("get_value is deprecated and will be removed "
"in a future release. Please use "
".at[] or .iat[] accessors instead", FutureWarning,
stacklevel=2)
return self._get_value(label, takeable=takeable)
|
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/sparse/series.py#L342-L364
|
get current observable value
|
python
|
def get_value(self, obj, attr, accessor=None, default=missing_):
"""Return the value for a given key from an object.
:param object obj: The object to get the value from
:param str attr: The attribute/key in `obj` to get the value from.
:param callable accessor: A callable used to retrieve the value of `attr` from
the object `obj`. Defaults to `marshmallow.utils.get_value`.
"""
# NOTE: Use getattr instead of direct attribute access here so that
# subclasses aren't required to define `attribute` member
attribute = getattr(self, 'attribute', None)
accessor_func = accessor or utils.get_value
check_key = attr if attribute is None else attribute
return accessor_func(obj, check_key, default)
|
https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/fields.py#L204-L217
|
get current observable value
|
python
|
def isObservableElement(self, elementName):
"""
Mention if an element is an observable element.
:param str ElementName: the element name to evaluate
:return: true if is an observable element, otherwise false.
:rtype: bool
"""
if not(isinstance(elementName, str)):
raise TypeError(
"Element name should be a string ." +
"I receive this {0}"
.format(elementName))
return (True if (elementName == "*")
else self._evaluateString(elementName))
|
https://github.com/fredericklussier/ObservablePy/blob/fd7926a0568621f80b1d567d18f199976f1fa4e8/observablePy/ObservableStore.py#L43-L58
|
get current observable value
|
python
|
def get_cached_value(self, *args, **kwargs):
"""
:returns: The cached value or ``Ellipsis``
"""
key = self.get_cache_key(*args, **kwargs)
logger.debug(key)
return self.cache.get(key, default=Ellipsis)
|
https://github.com/dimagi/quickcache/blob/fe62e2c6b9690859c57534058637fc6fcd4f4e0e/quickcache/quickcache_helper.py#L78-L84
|
get current observable value
|
python
|
def _get_observer_fun(self, prop_name):
"""This is the code for an value change observer"""
def _observer_fun(self, model, old, new):
if self._itsme:
return
self._on_prop_changed()
# doesn't affect stack traces
_observer_fun.__name__ = "property_%s_value_change" % prop_name
return _observer_fun
|
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/adapters/basic.py#L294-L303
|
get current observable value
|
python
|
def current(self):
"""
get the index of the currently executing chain element
:return int: current chain index
"""
if not self.started:
return None
return count_group(self.group, cached=self.cached)
|
https://github.com/Koed00/django-q/blob/c84fd11a67c9a47d821786dfcdc189bb258c6f54/django_q/tasks.py#L561-L568
|
get current observable value
|
python
|
def get(self, key, default=None, index=-1, type=None):
''' Return the most recent value for a key.
:param default: The default value to be returned if the key is not
present or the type conversion fails.
:param index: An index for the list of available values.
:param type: If defined, this callable is used to cast the value
into a specific type. Exception are suppressed and result in
the default value to be returned.
'''
try:
val = self.dict[key][index]
return type(val) if type else val
except Exception, e:
pass
return default
|
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L1621-L1636
|
get current observable value
|
python
|
def _get_current_label(self):
"""Get the label from the last line read"""
if len(self._last) == 0:
raise StopIteration
return self._last[:self._last.find(":")]
|
https://github.com/molmod/molmod/blob/a7b5b4364ed514ad4c465856c05b5eda1cb561e0/molmod/io/atrj.py#L45-L49
|
get current observable value
|
python
|
def get_thread_id_for_variable_reference(self, variable_reference):
'''
We can't evaluate variable references values on any thread, only in the suspended
thread (the main reason for this is that in UI frameworks inspecting a UI object
from a different thread can potentially crash the application).
:param int variable_reference:
The variable reference (can be either a frame id or a reference to a previously
gotten variable).
:return str:
The thread id for the thread to be used to inspect the given variable reference or
None if the thread was already resumed.
'''
frames_tracker = self._get_tracker_for_variable_reference(variable_reference)
if frames_tracker is not None:
return frames_tracker.get_main_thread_id()
return None
|
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_suspended_frames.py#L330-L347
|
get current observable value
|
python
|
def get_current_status(self):
"""Returns the current state of the local spotify client"""
url = get_url("/remote/status.json")
params = {"oauth": self._oauth_token, "csrf": self._csrf_token}
r = self._request(url=url, params=params)
return r.json()
|
https://github.com/erinxocon/spotify-local/blob/8188eef221e3d8b9f408ff430d80e74560360459/src/spotify_local/core.py#L119-L124
|
get current observable value
|
python
|
def value(self, ob, *args, **kwargs):
"""
Compute value estimate(s) given the observation(s)
Parameters:
----------
observation observation data (either single or a batch)
**extra_feed additional data such as state or mask (names of the arguments should match the ones in constructor, see __init__)
Returns:
-------
value estimate
"""
return self._evaluate(self.vf, ob, *args, **kwargs)
|
https://github.com/openai/baselines/blob/3301089b48c42b87b396e246ea3f56fa4bfc9678/baselines/common/policies.py#L98-L113
|
get current observable value
|
python
|
def current_iid(self):
"""
Currently active item's iid
:rtype: str
"""
current = self.current
if current is None or current not in self._canvas_markers:
return None
return self._canvas_markers[current]
|
https://github.com/RedFantom/ttkwidgets/blob/02150322060f867b6e59a175522ef84b09168019/ttkwidgets/timeline.py#L1007-L1016
|
get current observable value
|
python
|
def _get_value(self, node, scope, ctxt, stream):
"""Return the value of the node. It is expected to be
either an AST.ID instance or a constant
:node: TODO
:returns: TODO
"""
res = self._handle_node(node, scope, ctxt, stream)
if isinstance(res, fields.Field):
return res._pfp__value
# assume it's a constant
else:
return res
|
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L2318-L2334
|
get current observable value
|
python
|
def _check_current_value(gnome_kwargs, value):
'''
Check the current value with the passed value
'''
current_value = __salt__['gnome.get'](**gnome_kwargs)
return six.text_type(current_value) == six.text_type(value)
|
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/gnomedesktop.py#L38-L43
|
get current observable value
|
python
|
def GetValue(self):
'''
Returns
"--option_name argument"
'''
self.AssertInitialization('Choice')
if self._widget.GetValue() == self._DEFAULT_VALUE:
return None
return ' '.join(
[self._action.option_strings[0] if self._action.option_strings else '', # get the verbose copy if available
self._widget.GetValue()])
|
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/gooey/gui/components.py#L291-L301
|
get current observable value
|
python
|
def _get_value(obj, key):
"""Get a value for 'key' from 'obj', if possible"""
if isinstance(obj, (list, tuple)):
for item in obj:
v = _find_value(key, item)
if v is not None:
return v
return None
if isinstance(obj, dict):
return obj.get(key)
if obj is not None:
return getattr(obj, key, None)
|
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/convert.py#L262-L273
|
get current observable value
|
python
|
def get_current_channel(self):
"""Get the current tv channel."""
self.request(EP_GET_CURRENT_CHANNEL)
return {} if self.last_response is None else self.last_response.get('payload')
|
https://github.com/TheRealLink/pylgtv/blob/a7d9ad87ce47e77180fe9262da785465219f4ed6/pylgtv/webos_client.py#L348-L351
|
get current observable value
|
python
|
def __get_value(self, field_name):
""" Get request Json value by field name """
value = request.values.get(field_name)
if value is None:
if self.json_form_data is None:
value = None
elif field_name in self.json_form_data:
value = self.json_form_data[field_name]
return value
|
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/classes/form_data.py#L80-L88
|
get current observable value
|
python
|
def get_stats_value(self, item, value):
"""Return the stats object for a specific item=value in JSON format.
Stats should be a list of dict (processlist, network...)
"""
if not isinstance(self.stats, list):
return None
else:
if value.isdigit():
value = int(value)
try:
return self._json_dumps({value: [i for i in self.stats if i[item] == value]})
except (KeyError, ValueError) as e:
logger.error(
"Cannot get item({})=value({}) ({})".format(item, value, e))
return None
|
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L401-L416
|
get current observable value
|
python
|
def get_value(cls, value):
'''Takes the class of the item that we want to
query, along with a potential instance of that class.
If the value is an instance of int or basestring, then
we will treat it like an id for that instance.'''
if isinstance(value, (basestring, int)):
value = cls.fetch_by(id=value)
return value if isinstance(value, cls) else None
|
https://github.com/ucsb-cs/submit/blob/92810c81255a4fc6bbebac1ac8aae856fd576ffe/submit/models.py#L919-L926
|
get current observable value
|
python
|
def currentStore(self, store_view=None):
"""
Set/Get current store view
:param store_view: Store view ID or Code
:return: int
"""
args = [store_view] if store_view else []
return int(self.call('catalog_category_attribute.currentStore', args))
|
https://github.com/fulfilio/python-magento/blob/720ec136a6e438a9ee4ee92848a9820b91732750/magento/catalog.py#L191-L199
|
get current observable value
|
python
|
def _get_value(self, evt):
"""Internal usage only"""
if evt.err:
e = evt.errors[0]
return "[%s] %s" % (e.reason, e.desc)
if isinstance(evt, EventData):
return "[%s] %s" % (
evt.attr_value.quality, str(evt.attr_value.value))
elif isinstance(evt, AttrConfEventData):
cfg = evt.attr_conf
return "label='%s'; unit='%s'" % (cfg.label, cfg.unit)
elif isinstance(evt, DataReadyEventData):
return ""
elif isinstance(evt, PipeEventData):
return evt.pipe_value
elif isinstance(evt, DevIntrChangeEventData):
print("utils::_get_value()")
return
|
https://github.com/tango-controls/pytango/blob/9cf78c517c9cdc1081ff6d080a9646a740cc1d36/tango/utils.py#L1578-L1596
|
get current observable value
|
python
|
def _get_value(first, second):
"""
数据转化
:param first:
:param second:
:return:
>>> _get_value(1,'2')
2
>>> _get_value([1,2],[2,3])
[1, 2, 3]
"""
if isinstance(first, list) and isinstance(second, list):
return list(set(first).union(set(second)))
elif isinstance(first, dict) and isinstance(second, dict):
first.update(second)
return first
elif first is not None and second is not None and not isinstance(first, type(second)):
return type(first)(second)
else:
return second
|
https://github.com/lvjiyong/configreset/blob/cde0a426e993a6aa483d6934358e61750c944de9/configreset/__init__.py#L286-L306
|
get current observable value
|
python
|
def emitCurrentRecordChanged(self, item):
"""
Emits the record changed signal for the given item, provided the
signals are not currently blocked.
:param item | <QTreeWidgetItem>
"""
if self.signalsBlocked():
return
# emit that the record has been clicked
if isinstance(item, XOrbRecordItem):
self.currentRecordChanged.emit(item.record())
else:
self.currentRecordChanged.emit(None)
|
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L1118-L1132
|
get current observable value
|
python
|
def get_value_at(all_info, current_path, key, to_string=False):
"""
Get value located at a given path
:param all_info:
:param current_path:
:param key:
:param to_string:
:return:
"""
keys = key.split('.')
if keys[-1] == 'id':
target_obj = current_path[len(keys)-1]
else:
if key == 'this':
target_path = current_path
elif '.' in key:
target_path = []
for i, key in enumerate(keys):
if key == 'id':
target_path.append(current_path[i])
else:
target_path.append(key)
if len(keys) > len(current_path):
target_path = target_path + keys[len(target_path):]
else:
target_path = copy.deepcopy(current_path)
target_path.append(key)
target_obj = all_info
for p in target_path:
try:
if type(target_obj) == list and type(target_obj[0]) == dict:
target_obj = target_obj[int(p)]
elif type(target_obj) == list:
target_obj = p
elif p == '':
target_obj = target_obj
else:
try:
target_obj = target_obj[p]
except Exception as e:
printInfo('Info: %s\n'
'Path: %s\n'
'Key: %s' % (str(all_info),
str(current_path),
str(key)))
printException(e)
raise Exception
except Exception as e:
printInfo('Info: %s\n'
'Path: %s\n'
'Key: %s' % (str(all_info),
str(current_path),
str(key)))
printException(e)
raise Exception
if to_string:
return str(target_obj)
else:
return target_obj
|
https://github.com/nccgroup/Scout2/blob/5d86d46d7ed91a92000496189e9cfa6b98243937/AWSScout2/configs/browser.py#L55-L114
|
get current observable value
|
python
|
def _get_value(self, key, context):
"""Works out whether key is a value or if it's a variable referencing a
value in context and returns the correct value.
"""
string_quotes = ('"', "'")
if key[0] in string_quotes and key[-1] in string_quotes:
return key[1:-1]
if key in string.digits:
return int(key)
return context.get(key, None)
|
https://github.com/mypebble/django-feature-flipper/blob/53ff52296955f2ff8b5b6ae4ea426b3f0665960e/feature_flipper/templatetags/feature_flipper.py#L53-L63
|
get current observable value
|
python
|
def get_current_value(self, use_cached=False):
"""Return the most recent DataPoint value written to a stream
The current value is the last recorded data point for this stream.
:param bool use_cached: If False, the function will always request the latest from Device Cloud.
If True, the device will not make a request if it already has cached data.
:raises devicecloud.DeviceCloudHttpException: in the case of an unexpected http error
:raises devicecloud.streams.NoSuchStreamException: if this stream has not yet been created
:return: The most recent value written to this stream (or None if nothing has been written)
:rtype: :class:`~DataPoint` or None
"""
current_value = self._get_stream_metadata(use_cached).get("currentValue")
if current_value:
return DataPoint.from_json(self, current_value)
else:
return None
|
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/streams.py#L750-L767
|
get current observable value
|
python
|
def get_value(self, item, default=None):
"""Get the value of a child"""
try:
return self[item].value
except (AttributeError, KeyError) as e:
return default
|
https://github.com/Metatab/metatab/blob/8336ec3e4bd8da84a9a5cb86de1c1086e14b8b22/metatab/terms.py#L390-L395
|
get current observable value
|
python
|
def _get_value(self):
"""Return current parameter value"""
# This is going to be true (possibly) only for derived classes. It is here to make the code cleaner
# and also to avoid infinite recursion
if self._aux_variable:
return self._aux_variable['law'](self._aux_variable['variable'].value)
if self._transformation is None:
return self._internal_value
else:
# A transformation is set. Transform back from internal value to true value
#
# print("Interval value is %s" % self._internal_value)
# print("Returning %s" % self._transformation.backward(self._internal_value))
return self._transformation.backward(self._internal_value)
|
https://github.com/threeML/astromodels/blob/9aac365a372f77603039533df9a6b694c1e360d5/astromodels/core/parameter.py#L394-L415
|
get current observable value
|
python
|
def get_observation(self, observation_id):
"""
Retrieve an existing :class:`meteorpi_model.Observation` by its ID
:param string observation_id:
UUID of the observation
:return:
A :class:`meteorpi_model.Observation` instance, or None if not found
"""
search = mp.ObservationSearch(observation_id=observation_id)
b = search_observations_sql_builder(search)
sql = b.get_select_sql(columns='l.publicId AS obstory_id, l.name AS obstory_name, '
'o.obsTime, s.name AS obsType, o.publicId, o.uid',
skip=0, limit=1, order='o.obsTime DESC')
obs = list(self.generators.observation_generator(sql=sql, sql_args=b.sql_args))
if not obs:
return None
return obs[0]
|
https://github.com/camsci/meteor-pi/blob/7b01527650bd1b2b76d6f364e8122e25b8812c8d/src/pythonModules/meteorpi_db/meteorpi_db/__init__.py#L580-L597
|
get current observable value
|
python
|
def get_ss_value(tag):
"""
Getters for data that also work with implicit transfersyntax
:param tag: the tag to read
"""
# data is int formatted as string so convert te string first and cast to int
if tag.VR == 'OB' or tag.VR == 'UN':
value = struct.unpack('h', tag.value)[0]
return value
return tag.value
|
https://github.com/icometrix/dicom2nifti/blob/1462ae5dd979fa3f276fe7a78ceb9b028121536f/dicom2nifti/common.py#L346-L356
|
get current observable value
|
python
|
def get_previous_and_current_values(self, instance):
"""
Obtain the previous and actual values and compares them
in order to detect which fields has changed
:param instance:
:param translation:
:return:
"""
translated_field_names = self._get_translated_field_names(instance.master)
if instance.pk:
try:
previous_obj = instance._meta.model.objects.get(pk=instance.pk)
previous_values = self.get_obj_values(previous_obj, translated_field_names)
except ObjectDoesNotExist:
previous_values = {}
else:
previous_values = {}
current_values = self.get_obj_values(instance, translated_field_names)
return previous_values, current_values
|
https://github.com/APSL/transmanager/blob/79157085840008e146b264521681913090197ed1/transmanager/manager.py#L211-L230
|
get current observable value
|
python
|
def get_value(self, obj):
"""
Returns the value of the object's attribute.
"""
if self.attribute is None:
return None
attrs = self.attribute.split('__')
value = obj
for attr in attrs:
try:
value = getattr(value, attr, None)
except (ValueError, ObjectDoesNotExist):
# needs to have a primary key value before a many-to-many
# relationship can be used.
return None
if value is None:
return None
# RelatedManager and ManyRelatedManager classes are callable in
# Django >= 1.7 but we don't want to call them
if callable(value) and not isinstance(value, Manager):
value = value()
return value
|
https://github.com/django-import-export/django-import-export/blob/127f00d03fd0ad282615b064b7f444a639e6ff0c/import_export/fields.py#L75-L99
|
get current observable value
|
python
|
def get(self):
'''
Please don't do this in production environments.
'''
self.write("Memory Session Object Demo:")
if "sv" in self.session:
current_value = self.session["sv"]
self.write("current sv value is %s, and system will delete this value.<br/>" % self.session["sv"])
self.session.delete("sv")
if "sv" not in self.session:
self.write("current sv value is empty")
else:
self.write("Session data not found")
|
https://github.com/MitchellChu/torndsession/blob/dd08554c06f47d33396a0a4485f53d0522961155/demos/memory_session.py#L53-L65
|
get current observable value
|
python
|
def get_value(self, key):
"""Extract a value for a given key."""
for title in _TITLES.get(key, ()) + (key,):
try:
value = [entry['lastMeasurement']['value'] for entry in
self.data['sensors'] if entry['title'] == title][0]
return value
except IndexError:
pass
return None
|
https://github.com/fabaff/python-opensensemap-api/blob/3c4f5473c514185087aae5d766ab4d5736ec1f30/opensensemap_api/__init__.py#L123-L132
|
get current observable value
|
python
|
def inspect_value(self_,name): # pylint: disable-msg=E0213
"""
Return the current value of the named attribute without modifying it.
Same as getattr() except for Dynamic parameters, which have their
last generated value returned.
"""
cls_or_slf = self_.self_or_cls
param_obj = cls_or_slf.param.objects('existing').get(name)
if not param_obj:
value = getattr(cls_or_slf,name)
elif hasattr(param_obj,'attribs'):
value = [cls_or_slf.param.inspect_value(a) for a in param_obj.attribs]
elif not hasattr(param_obj,'_inspect'):
value = getattr(cls_or_slf,name)
else:
if isinstance(cls_or_slf,type):
value = param_obj._inspect(None,cls_or_slf)
else:
value = param_obj._inspect(cls_or_slf,None)
return value
|
https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1539-L1561
|
get current observable value
|
python
|
def get(self):
"""Gets the next item from the queue.
Returns a Future that resolves to the next item once it is available.
"""
io_loop = IOLoop.current()
new_get = Future()
with self._lock:
get, self._get = self._get, new_get
answer = Future()
def _on_node(future):
if future.exception(): # pragma: no cover (never happens)
return answer.set_exc_info(future.exc_info())
node = future.result()
value = node.value
new_hole, node.next = node.next, None
new_get.set_result(new_hole)
answer.set_result(value)
def _on_get(future):
if future.exception(): # pragma: no cover (never happens)
return answer.set_exc_info(future.exc_info())
hole = future.result()
io_loop.add_future(hole, _on_node)
io_loop.add_future(get, _on_get)
return answer
|
https://github.com/uber/tchannel-python/blob/ee08cce6234f24fd2373774988186dd374306c43/tchannel/_queue.py#L159-L190
|
get current observable value
|
python
|
def get_current(self, channel, unit='A'):
'''Reading current
'''
kwargs = self._ch_map[channel]['ADCI']
current_raw = self._get_adc_value(**kwargs)
voltage = self.get_voltage(channel)
current_raw_iq = current_raw - (self._ch_cal[channel]['ADCI']['iq_offset'] + self._ch_cal[channel]['ADCI']['iq_gain'] * voltage) # quiescent current (IQ) compensation
current = (current_raw_iq - self._ch_cal[channel]['ADCI']['offset']) / self._ch_cal[channel]['ADCI']['gain']
if unit == 'raw':
return current_raw
elif unit == 'raw_iq':
return current_raw_iq
elif unit == 'A':
return current
elif unit == 'mA':
return current * 1000
elif unit == 'uA':
return current * 1000000
else:
raise TypeError("Invalid unit type.")
|
https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/FEI4AdapterCard.py#L182-L203
|
get current observable value
|
python
|
def get(self):
'''
This handles GET requests for the current checkplot-list.json file.
Used with AJAX from frontend.
'''
# add the reviewed key to the current dict if it doesn't exist
# this will hold all the reviewed objects for the frontend
if 'reviewed' not in self.currentproject:
self.currentproject['reviewed'] = {}
# just returns the current project as JSON
self.write(self.currentproject)
|
https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/cpserver/checkplotserver_handlers.py#L1150-L1164
|
get current observable value
|
python
|
def value(self, data):
"""Get value from data."""
value = data.get(self.name)
if value:
return int(value)
return self.default
|
https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/peewee.py#L251-L256
|
get current observable value
|
python
|
def get_value(self):
"""Gets the value of a select or input element
@rtype: str
@return: The value of the element
@raise: ValueError if element is not of type input or select, or has multiple selected options
"""
def get_element_value():
if self.tag_name() == 'input':
return self.get_attribute('value')
elif self.tag_name() == 'select':
selected_options = self.element.all_selected_options
if len(selected_options) > 1:
raise ValueError(
'Select {} has multiple selected options, only one selected '
'option is valid for this method'.format(self)
)
return selected_options[0].get_attribute('value')
else:
raise ValueError('Can not get the value of elements or type "{}"'.format(self.tag_name()))
return self.execute_and_handle_webelement_exceptions(get_element_value, name_of_action='get value')
|
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L159-L180
|
get current observable value
|
python
|
def GET_savedgetitemvalues(self) -> None:
"""Get the previously saved values of all |GetItem| objects."""
dict_ = state.getitemvalues.get(self._id)
if dict_ is None:
self.GET_getitemvalues()
else:
for name, value in dict_.items():
self._outputs[name] = value
|
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1101-L1108
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.