function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def addToAddr(self,toAddr):
"""
"""
if self.hasToAddr(toAddr.__class__):
return
try:
if self._toAddrGenerator:
pass
except AttributeError, e:
self._toAddrGenerator = Counter()
id = toAddr.getId()
if id == -1:
... | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def recoverToAddr(self, toAddr):
self.addToAddr(toAddr)
toAddr.recover() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getToAddrList(self):
"""
"""
try:
if self._toAddrs:
pass
except AttributeError, e:
self._toAddrs = PersistentList()
return self._toAddrs | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def hasToAddr(self,toAddrKlass):
"""Returns True if the TPL contains a "toAddr" which class is "toAddrKlass"
"""
for toAddr in self.getToAddrList():
if toAddr.__class__ == toAddrKlass:
return True
return False | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def addCondition(self,cond):
"""
"""
if cond in self._conditions:
return
id = cond.getId()
if id == -1:
id = int(self._condGenerator.newCount())
cond.includeInTpl(self, id)
self._conditions.append(cond) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def recoverCondition(self, cond):
self.addCondition(cond)
cond.recover() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getConditionById(self,id):
"""
"""
for cond in self._conditions:
if cond.getId()==int(id):
return cond
return None | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def satisfies(self,abs):
"""
"""
for cond in self._conditions:
if cond.satisfies(abs):
return True
return False | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def parseTplContentUndo(self, content, varList):
# The body content is shown without "%()" and with "%" in instead of "%%" but it is not modified
result = content
for var in varList:
result = result.replace("%("+var.getName()+")s", "{"+var.getName()+"}")
# replace the %% by %... | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def __init__(self):
self._tpl=None
self._id=-1 | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def delete(self):
TrashCanManager().add(self) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def includeInTpl(self,newTpl,newId):
self._tpl=newTpl
self._id=newId | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getId(self):
return self._id | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getToAddrList(self,abs):
l = []
l.append(abs.getSubmitter())
return l | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getToAddrList(self,abs):
l = []
for pa in abs.getPrimaryAuthorList():
l.append(pa)
return l | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def __init__(self):
self._tpl=None
self._id=-1 | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def delete(self):
TrashCanManager().add(self) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def includeInTpl(self,newTpl,newId):
self._tpl=newTpl
self._id=newId | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getId(self):
return self._id | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def __init__(self, track="--any--", contribType="--any--"):
NotifTplCondition.__init__(self)
self._track = track
self._contrib_type_id = contribType if isinstance(contribType, basestring) else contribType.id | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def setContribType(self, ct="--any--"):
self._contrib_type_id = '--any--' if ct == '--any--' else ct.id | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def setTrack(self, tr="--any--"):
self._track = tr | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def _satifiesContribType(self, abs_wrap):
abstract_type = abs_wrap.getCurrentStatus().getAbstract().as_new.accepted_type
if self._contrib_type_id == "--any--":
return True
else:
if self._contrib_type_id == '--none--':
return not abstract_type
i... | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def satisfies(self,abs):
if not isinstance(abs.getCurrentStatus(), AbstractStatusAccepted):
return False
else:
return self._satifiesContribType(abs) and self._satifiesTrack(abs) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def satisfies(self,abs):
return isinstance(abs.getCurrentStatus(),AbstractStatusRejected) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def __init__(self, track=None, contrib_type=None):
NotifTplCondition.__init__(self)
self._track = track
self._contrib_type_id = contrib_type if isinstance(contrib_type, basestring) else contrib_type.id | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def _satisfiesContribType(self, abs_wrap):
if self._contrib_type_id == '--any--':
return True
else:
abstract_type = abs_wrap.getCurrentStatus().getAbstract().as_new.type
if self._contrib_type_id == '--none--':
return not abstract_type
if no... | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getTrack(self):
return self._track | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def clone(self, conference, template):
ntcm = NotifTplCondMerged()
for newtrack in conference.getTrackList():
if newtrack.getTitle() == self.getTrack().getTitle():
ntcm.setTrack(newtrack)
break
for newtype in conference.as_event.contribution_types:
... | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def __init__(self,abstract):
self._abstract=abstract
self._entries=PersistentList() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def addEntry(self,newEntry):
if newEntry!=None and newEntry not in self._entries:
self._entries.append(newEntry) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def removeEntry(self, entry):
if entry!=None and entry in self._entries:
self._entries.remove(entry)
entry.delete() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def clearEntryList(self):
while len(self.getEntryList()) > 0:
self.removeEntry(self.getEntryList()[0]) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def __init__(self,responsible,tpl):
self._setDate(nowutc())
self._setResponsible(responsible)
self._setTpl(tpl) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getDate(self):
return self._date | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getResponsible(self):
return self._responsible | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getTpl(self):
return self._tpl | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def test_clark_dist(self):
"""Test abydos.distance.Clark.dist."""
# Base cases
self.assertEqual(self.cmp.dist('', ''), 0.0)
self.assertEqual(self.cmp.dist('a', ''), 1.0)
self.assertEqual(self.cmp.dist('', 'a'), 1.0)
self.assertEqual(self.cmp.dist('a', 'a'), 0.0)
s... | chrislit/abydos | [
154,
26,
154,
63,
1398235847
] |
def starter():
isRaise = False
try:
context.plgMain (importLI=ITD_FILE) | Taifxx/xxtrep | [
9,
6,
9,
4,
1460037342
] |
def service(externalAbort, report):
## Load monitor ...
monitor = context.xbmc.Monitor() | Taifxx/xxtrep | [
9,
6,
9,
4,
1460037342
] |
def run(self):
'''It runs the analysis.'''
contigs_path = self._get_input_fpaths()['contigs']
contigs_ext = contigs_path.extension
reference_dir = self._create_output_dirs()['result']
reference_fpath = os.path.join(reference_dir,
BACKBONE_BASENAMES['mapp... | JoseBlanca/franklin | [
23,
3,
23,
25,
1272293875
] |
def run(self):
'''It runs the analysis.'''
self._log({'analysis_started':True})
project_settings = self._project_settings
settings = project_settings['Mappers']
tmp_dir = project_settings['General_settings']['tmpdir']
project_path = project_settings['General_settings']['... | JoseBlanca/franklin | [
23,
3,
23,
25,
1272293875
] |
def run(self):
'''It runs the analysis.'''
self._log({'analysis_started':True})
settings = self._project_settings
project_path = settings['General_settings']['project_path']
tmp_dir = settings['General_settings']['tmpdir']
inputs = self._get_input_fpaths()
b... | JoseBlanca/franklin | [
23,
3,
23,
25,
1272293875
] |
def run(self):
'''It runs the analysis.'''
self._log({'analysis_started':True})
inputs = self._get_input_fpaths()
bam_path = inputs['bam']
bam_fpath = bam_path.last_version
reference_fpath = inputs['reference'].last_version
out_fhand = open(bam_path.next_version, ... | JoseBlanca/franklin | [
23,
3,
23,
25,
1272293875
] |
def run(self):
'''It runs the analysis.'''
self._log({'analysis_started':True})
settings = self._project_settings
project_path = settings['General_settings']['project_path']
tmp_dir = settings['General_settings']['tmpdir']
inputs = self._get_input_fpaths()
b... | JoseBlanca/franklin | [
23,
3,
23,
25,
1272293875
] |
def run(self):
'''It runs the analysis.'''
self._log({'analysis_started':True})
settings = self._project_settings
self._create_output_dirs()['result']
project_name = settings['General_settings']['project_name']
sample_size = settings['Sam_stats']['sampling_size']
... | JoseBlanca/franklin | [
23,
3,
23,
25,
1272293875
] |
def __init__(self):
self.env = Environment.getInstance()
self.log = logging.getLogger(__name__)
self.log.info("initializing workflow upload handler") | gonicus/gosa | [
13,
3,
13,
1,
1350561752
] |
def __init__(self):
self.chipLib = GetLibraryHandle()
self.__InitNativeFunctions(self.chipLib)
self.attributes = {}
self.vendor_attributes = {}
def AddAttribute(name, value):
self.attributes[name.decode()] = value.decode()
def AddVendorAttribute(tag, value):... | project-chip/connectedhomeip | [
5774,
1369,
5774,
982,
1583255110
] |
def ParseManualPairingCode(self, manualPairingCode: str):
self.Clear()
err = self.chipLib.pychip_SetupPayload_ParseManualPairingCode(manualPairingCode.encode(),
self.attribute_visitor,
... | project-chip/connectedhomeip | [
5774,
1369,
5774,
982,
1583255110
] |
def Print(self):
for name, value in self.attributes.items():
decorated_value = self.__DecorateValue(name, value)
decorated_value = f" [{decorated_value}]" if decorated_value else ""
print(f"{name}: {value}{decorated_value}")
for tag in self.vendor_attributes:
... | project-chip/connectedhomeip | [
5774,
1369,
5774,
982,
1583255110
] |
def __DecorateValue(self, name, value):
if name == "RendezvousInformation":
rendezvous_methods = []
if int(value) & 0b001:
rendezvous_methods += ["SoftAP"]
if int(value) & 0b010:
rendezvous_methods += ["BLE"]
if int(value) & 0b100:
... | project-chip/connectedhomeip | [
5774,
1369,
5774,
982,
1583255110
] |
def test_default_automl_with_regression_task():
ds = import_dataset('regression')
aml = H2OAutoML(max_models=2,
project_name='aml_regression')
aml.train(y=ds.target, training_frame=ds.train, validation_frame=ds.valid, leaderboard_frame=ds.test)
print(aml.leader)
print(aml.leader... | h2oai/h2o-3 | [
6169,
1943,
6169,
208,
1393862887
] |
def _log_thread_running_at_shutdown(name: str, ident: int) -> None:
"""Log the stack of a thread that was still running at shutdown."""
frames = sys._current_frames() # pylint: disable=protected-access
stack = frames.get(ident)
formatted_stack = traceback.format_stack(stack)
_LOGGER.warning(
... | home-assistant/home-assistant | [
58698,
22318,
58698,
2794,
1379402988
] |
def shutdown(self, *args, **kwargs) -> None: # type: ignore
"""Shutdown backport from cpython 3.9 with interrupt support added."""
with self._shutdown_lock: # type: ignore[attr-defined]
self._shutdown = True
# Drain all work items from the queue, and then cancel their
... | home-assistant/home-assistant | [
58698,
22318,
58698,
2794,
1379402988
] |
def render_matrix(request):
# get the user selection from session
simple_selection = request.session.get('selection', False)
# create an alignment object
a = Alignment()
# load data from selection into the alignment
a.load_proteins_from_selection(simple_selection)
a.load_segments_from_sele... | protwis/protwis | [
27,
66,
27,
10,
1453280568
] |
def configure_loader_modules():
return {modjk: {}} | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def test_get_running():
"""
Test for get the current running config (not from disk)
"""
with patch.object(modjk, "_do_http", return_value={}):
assert modjk.get_running() == {} | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def test_list_configured_members():
"""
Test for return a list of member workers from the configuration files
"""
with patch.object(modjk, "_do_http", return_value={}):
assert modjk.list_configured_members("loadbalancer1") == []
with patch.object(
modjk,
"_do_http",
... | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def test_recover_all():
"""
Test for set the all the workers in lbn to recover and
activate them if they are not
"""
with patch.object(modjk, "_do_http", return_value={}):
assert modjk.recover_all("loadbalancer1") == {}
with patch.object(
modjk,
"_do_http",
retur... | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def test_lb_edit():
"""
Test for edit the loadbalancer settings
"""
with patch.object(modjk, "_do_http", return_value={"worker.result.type": "OK"}):
assert modjk.lb_edit("loadbalancer1", {"vlr": 1, "vlt": 60}) | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def test_bulk_activate():
"""
Test for activate all the given workers in the specific load balancer
"""
with patch.object(modjk, "_do_http", return_value={"worker.result.type": "OK"}):
assert modjk.bulk_activate(["node1", "node2", "node3"], "loadbalancer1") | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def test_bulk_recover():
"""
Test for recover all the given workers in the specific load balancer
"""
with patch.object(modjk, "_do_http", return_value={"worker.result.type": "OK"}):
assert modjk.bulk_recover(["node1", "node2", "node3"], "loadbalancer1") | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def test_worker_recover():
"""
Test for set the worker to recover this module will fail
if it is in OK state
"""
with patch.object(modjk, "_do_http", return_value={}):
assert modjk.worker_recover("node1", "loadbalancer1") == {} | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def test_worker_activate():
"""
Test for set the worker to activate state in the lbn load balancer
"""
with patch.object(modjk, "_do_http", return_value={"worker.result.type": "OK"}):
assert modjk.worker_activate("node1", "loadbalancer1") | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def read_input(message):
if sys.version_info[0] >= 3:
return input(message)
else:
# This is not defined in python3, and the linter will thus
# throw an undefined-variable<E0602> error on this line.
# Suppress it here.
return raw_input(message) # pylint: disable=E0602 | Azure/WALinuxAgent | [
495,
376,
495,
85,
1339008955
] |
def __init__(self, func, args=None, kwargs=None):
if args is None:
args = []
if kwargs is None:
kwargs = {}
self.func = func
self.args = args
self.kwargs = kwargs | Azure/WALinuxAgent | [
495,
376,
495,
85,
1339008955
] |
def __init__(self):
self.osutil = get_osutil()
self.protocol_util = get_protocol_util()
self.actions_running = False
signal.signal(signal.SIGINT, self.handle_interrupt_signal) | Azure/WALinuxAgent | [
495,
376,
495,
85,
1339008955
] |
def del_user(self, warnings, actions):
try:
ovfenv = self.protocol_util.get_ovf_env()
except ProtocolError:
warnings.append("WARNING! ovf-env.xml is not found.")
warnings.append("WARNING! Skip delete user.")
return
username = ovfenv.username
... | Azure/WALinuxAgent | [
495,
376,
495,
85,
1339008955
] |
def stop_agent_service(self, warnings, actions):
warnings.append("WARNING! The waagent service will be stopped.")
actions.append(DeprovisionAction(self.osutil.stop_agent_service)) | Azure/WALinuxAgent | [
495,
376,
495,
85,
1339008955
] |
def del_files(self, warnings, actions): # pylint: disable=W0613
files = ['/root/.bash_history', conf.get_agent_log_file()]
actions.append(DeprovisionAction(fileutil.rm_files, files))
# For OpenBSD
actions.append(DeprovisionAction(fileutil.rm_files,
... | Azure/WALinuxAgent | [
495,
376,
495,
85,
1339008955
] |
def del_dhcp_lease(self, warnings, actions):
warnings.append("WARNING! Cached DHCP leases will be deleted.")
dirs_to_del = ["/var/lib/dhclient", "/var/lib/dhcpcd", "/var/lib/dhcp"]
actions.append(DeprovisionAction(fileutil.rm_dirs, dirs_to_del))
# For FreeBSD and OpenBSD
actions... | Azure/WALinuxAgent | [
495,
376,
495,
85,
1339008955
] |
def del_lib_dir_files(self, warnings, actions): # pylint: disable=W0613
known_files = [
'HostingEnvironmentConfig.xml',
'Incarnation',
'partition',
'Protocol',
'SharedConfig.xml',
'WireServerEndpoint'
]
known_files_glob = [... | Azure/WALinuxAgent | [
495,
376,
495,
85,
1339008955
] |
def setup(self, deluser):
warnings = []
actions = []
self.stop_agent_service(warnings, actions)
if conf.get_regenerate_ssh_host_key():
self.regen_ssh_host_key(warnings, actions)
self.del_dhcp_lease(warnings, actions)
self.reset_hostname(warnings, actions)
... | Azure/WALinuxAgent | [
495,
376,
495,
85,
1339008955
] |
def run(self, force=False, deluser=False):
warnings, actions = self.setup(deluser)
self.do_warnings(warnings)
if self.do_confirmation(force=force):
self.do_actions(actions) | Azure/WALinuxAgent | [
495,
376,
495,
85,
1339008955
] |
def do_actions(self, actions):
self.actions_running = True
for action in actions:
action.invoke()
self.actions_running = False | Azure/WALinuxAgent | [
495,
376,
495,
85,
1339008955
] |
def do_warnings(self, warnings):
for warning in warnings:
print(warning) | Azure/WALinuxAgent | [
495,
376,
495,
85,
1339008955
] |
def to_return(self):
result = {}
for returnable in self.returnables:
result[returnable] = getattr(self, returnable)
result = self._filter_params(result)
return result | mcgonagle/ansible_f5 | [
10,
27,
10,
1,
1478300759
] |
def search(self):
result = []
if self._values['search'] is None:
return None
for server in self._values['search']:
result.append(str(server))
return result | mcgonagle/ansible_f5 | [
10,
27,
10,
1,
1478300759
] |
def name_servers(self):
result = []
if self._values['name_servers'] is None:
return None
for server in self._values['name_servers']:
result.append(str(server))
return result | mcgonagle/ansible_f5 | [
10,
27,
10,
1,
1478300759
] |
def cache(self):
if str(self._values['cache']) in ['enabled', 'enable']:
return 'enable'
else:
return 'disable' | mcgonagle/ansible_f5 | [
10,
27,
10,
1,
1478300759
] |
def dhcp(self):
valid = ['enable', 'enabled']
return True if self._values['dhcp'] in valid else False | mcgonagle/ansible_f5 | [
10,
27,
10,
1,
1478300759
] |
def forwarders(self):
if self._values['forwarders'] is None:
return None
else:
raise F5ModuleError(
"The modifying of forwarders is not supported."
) | mcgonagle/ansible_f5 | [
10,
27,
10,
1,
1478300759
] |
def ip_version(self):
if self._values['ip_version'] in [6, '6', 'options inet6']:
return "options inet6"
elif self._values['ip_version'] in [4, '4', '']:
return ""
else:
return None | mcgonagle/ansible_f5 | [
10,
27,
10,
1,
1478300759
] |
def __init__(self, client):
self.client = client
self.have = None
self.want = Parameters(self.client.module.params)
self.changes = Parameters() | mcgonagle/ansible_f5 | [
10,
27,
10,
1,
1478300759
] |
def exec_module(self):
changed = False
result = dict()
state = self.want.state
try:
if state == "present":
changed = self.update()
elif state == "absent":
changed = self.absent()
except iControlUnexpectedHTTPError as e:
... | mcgonagle/ansible_f5 | [
10,
27,
10,
1,
1478300759
] |
def update(self):
self.have = self.read_current_from_device()
if not self.should_update():
return False
if self.client.check_mode:
return True
self.update_on_device()
return True | mcgonagle/ansible_f5 | [
10,
27,
10,
1,
1478300759
] |
def update_on_device(self):
params = self.want.api_params()
tx = self.client.api.tm.transactions.transaction
with BigIpTxContext(tx) as api:
cache = api.tm.sys.dbs.db.load(name='dns.cache')
dns = api.tm.sys.dns.load()
# Empty values can be supplied, but you c... | mcgonagle/ansible_f5 | [
10,
27,
10,
1,
1478300759
] |
def should_absent(self):
result = self._absent_changed_options()
if result:
return True
return False | mcgonagle/ansible_f5 | [
10,
27,
10,
1,
1478300759
] |
def absent_on_device(self):
params = self.changes.api_params()
tx = self.client.api.tm.transactions.transaction
with BigIpTxContext(tx) as api:
dns = api.tm.sys.dns.load()
dns.update(**params) | mcgonagle/ansible_f5 | [
10,
27,
10,
1,
1478300759
] |
def __init__(self):
self.supports_check_mode = True
self.argument_spec = dict(
cache=dict(
required=False,
choices=['disabled', 'enabled', 'disable', 'enable'],
default=None
),
name_servers=dict(
required... | mcgonagle/ansible_f5 | [
10,
27,
10,
1,
1478300759
] |
def get_human_type(cls, abbreviated_type):
"""
Args:
abbreviated_type(str): An attribute of DDBType
Returns:
str: The human readable form of the DDBType.
"""
return cls._human_type_mapping.get(abbreviated_type, abbreviated_type) | spulec/moto | [
6700,
1808,
6700,
82,
1361221859
] |
def __init__(self, type_as_dict):
if type(type_as_dict) == DynamoType:
self.type = type_as_dict.type
self.value = type_as_dict.value
else:
self.type = list(type_as_dict)[0]
self.value = list(type_as_dict.values())[0]
if self.is_list():
... | spulec/moto | [
6700,
1808,
6700,
82,
1361221859
] |
def __hash__(self):
return hash((self.type, self.value)) | spulec/moto | [
6700,
1808,
6700,
82,
1361221859
] |
def __ne__(self, other):
return self.type != other.type or self.value != other.value | spulec/moto | [
6700,
1808,
6700,
82,
1361221859
] |
def __le__(self, other):
return self.cast_value <= other.cast_value | spulec/moto | [
6700,
1808,
6700,
82,
1361221859
] |
def __ge__(self, other):
return self.cast_value >= other.cast_value | spulec/moto | [
6700,
1808,
6700,
82,
1361221859
] |
def __add__(self, other):
if self.type != other.type:
raise TypeError("Different types of operandi is not allowed.")
if self.is_number():
self_value = float(self.value) if "." in self.value else int(self.value)
other_value = float(other.value) if "." in other.value el... | spulec/moto | [
6700,
1808,
6700,
82,
1361221859
] |
def __getitem__(self, item):
if isinstance(item, str):
# If our DynamoType is a map it should be subscriptable with a key
if self.type == DDBType.MAP:
return self.value[item]
elif isinstance(item, int):
# If our DynamoType is a list is should be subscr... | spulec/moto | [
6700,
1808,
6700,
82,
1361221859
] |
def cast_value(self):
if self.is_number():
try:
return int(self.value)
except ValueError:
return float(self.value)
elif self.is_set():
sub_type = self.type[0]
return set([DynamoType({sub_type: v}).cast_value for v in self.va... | spulec/moto | [
6700,
1808,
6700,
82,
1361221859
] |
def size(self):
if self.is_number():
value_size = len(str(self.value))
elif self.is_set():
sub_type = self.type[0]
value_size = sum([DynamoType({sub_type: v}).size() for v in self.value])
elif self.is_list():
value_size = sum([v.size() for v in sel... | spulec/moto | [
6700,
1808,
6700,
82,
1361221859
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.