How to use ensure_list method in localstack

Best Python code snippet using localstack_python

transforms.py

Source:transforms.py Github

copy

Full Screen

...45 return datetime.datetime.utcfromtimestamp(time.mktime(time.strptime(s,"%Y-%m-%d")))46def arxiv_to_article(item, save=False):47 art = Article()48 # Identifiers are a list of unique ids49 art.identifiers = ensure_list(item['identifier'])50 art.title = item['title']51 # Use the first "identifier" that looks like a url52 urls = find_urls(art.identifiers)53 if len(urls)>0: art.url = urls[0]54 # Authors don't change55 art.authors = ensure_list(item['creator'])56 # Latest update is the "published" date57 if item.has_key('date'):58 art.updates = map(ymd_to_datetime,ensure_list(item['date']))59 art.published_on = art.updates[-1]60 art.added_on = datetime.datetime.utcfromtimestamp(time.time())61 # Use sets as tags62 art.tags = dict(zip(ensure_list(item['setSpec']),iter(lambda:1,0)))63 # Use the longest desc as the fulltext description item64 descriptions = ensure_list(item['description'])65 descriptions.sort(lambda x,y: len(y)-len(x))66 art.description = text_to_ngrams(descriptions[0])67 68 # Store the original in metadata just in case69 art.metadata = {'arxiv_original' : dict(item.items())}70 art.validate()71 if save: art.save()...

Full Screen

Full Screen

genericTypes59.py

Source:genericTypes59.py Github

copy

Full Screen

...28 reveal_type(x, expected_text="float")29def func3b(value: List[Union[str, List[float]]]):30 # This should generate an error31 func1b(value)32def ensure_list(value: Union[T1, List[T1]]) -> List[T1]:33 ...34def func4(35 v1: list, v2: List[Any], v3: List[None], v4: Any, v5: int, v6: T1, v7: List[T1]36) -> T1:37 reveal_type(ensure_list(v1), expected_text="List[Unknown]")38 reveal_type(ensure_list(v2), expected_text="List[Any]")39 reveal_type(ensure_list(v3), expected_text="List[None]")40 reveal_type(ensure_list(v4), expected_text="List[Any]")41 reveal_type(ensure_list(v5), expected_text="List[int]")42 reveal_type(ensure_list(v6), expected_text="List[T1@func4]")43 reveal_type(ensure_list(v7), expected_text="List[T1@func4]")...

Full Screen

Full Screen

schemas.py

Source:schemas.py Github

copy

Full Screen

1import voluptuous as vol2import homeassistant.helpers.config_validation as cv3from homeassistant.const import (4 CONF_API_KEY, 5 CONF_NAME6)7from .const import (8 DOMAIN,9 DEFAULT_NAME,10 DEFAULT_DOMAIN,11 DEFAULT_CURRENCY,12 DEFAULT_BALANCES,13 DEFAULT_EXCHANGES,14 CONF_API_SECRET,15 CONF_BALANCES,16 CONF_EXCHANGES,17 CONF_MINING,18 CONF_DOMAIN,19 CONF_NATIVE_CURRENCY 20)21CONFIG_ENTRY_SCHEMA = vol.Schema(22 {23 vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,24 vol.Required(CONF_DOMAIN, default=DEFAULT_DOMAIN): vol.In({'com': 'binance.com', 'us': 'binance.us'}),25 vol.Optional(CONF_NATIVE_CURRENCY, default=DEFAULT_CURRENCY): vol.All(26 cv.ensure_list, [cv.string]27 ),28 vol.Required(CONF_API_KEY): cv.string,29 vol.Required(CONF_API_SECRET): cv.string,30 vol.Optional(CONF_BALANCES, default=DEFAULT_BALANCES): vol.All(31 cv.ensure_list, [cv.string]32 ),33 vol.Optional(CONF_EXCHANGES, default=DEFAULT_EXCHANGES): vol.All(34 cv.ensure_list, [cv.string]35 ),36 vol.Optional(CONF_MINING, default=[]): vol.All(37 cv.ensure_list, [cv.string]38 )39 },40 extra=vol.ALLOW_EXTRA41)42CONFIG_SCHEMA = vol.Schema(43 {44 vol.Optional(DOMAIN): vol.Any(45 vol.Equal({}),46 vol.Equal(CONFIG_ENTRY_SCHEMA),47 vol.All(48 cv.ensure_list,49 [CONFIG_ENTRY_SCHEMA] 50 )51 )52 },53 extra=vol.ALLOW_EXTRA...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful