min_value = <NUM_LIT:0><EOL>max_value = <NUM_LIT:10><EOL>from django.core.validators import MinValueValidator, MaxValueValidator <EOL>for elem in field.validators:<EOL><INDENT>if isinstance(elem, MinValueValidator):<EOL><INDENT>min_value = elem.limit_value<EOL><DEDENT>if isinstance(elem, MaxValueValidator):<EOL><INDENT>max_value = elem.limit_value<EOL><DEDENT><DEDENT>if (field.max_digits and field.decimal_places):<EOL><INDENT>from decimal import Decimal<EOL>max_value = min(max_value,<EOL>Decimal('<STR_LIT>' % ('<STR_LIT>'*(field.max_digits-field.decimal_places),<EOL>'<STR_LIT>'*field.decimal_places)))<EOL><DEDENT>min_value = kwargs.get('<STR_LIT>') or min_value<EOL>max_value = kwargs.get('<STR_LIT>') or max_value<EOL>return str(xunit.any_decimal(min_value=min_value,<EOL>max_value=max_value,<EOL>decimal_places = field.decimal_places or <NUM_LIT:2>))<EOL>

Return random value for DecimalField

>>> result = any_form_field(forms.DecimalField(max_value=100, min_value=11, max_digits=4, decimal_places = 2))
>>> type(result)
<type 'str'>
>>> from decimal import Decimal
>>> Decimal(result) >= 11, Decimal(result) <= Decimal('99.99')
(True, True)


max_length = <NUM_LIT:10><EOL>if field.max_length:<EOL><INDENT>max_length = (field.max_length -<NUM_LIT:5>) / <NUM_LIT:2> <EOL><DEDENT>min_length = <NUM_LIT:10><EOL>if field.min_length:<EOL><INDENT>min_length = (field.min_length-<NUM_LIT:4>) / <NUM_LIT:2><EOL><DEDENT>return "<STR_LIT>" % (<EOL>xunit.any_string(min_length=min_length, max_length=max_length),<EOL>xunit.any_string(min_length=min_length, max_length=max_length),<EOL>xunit.any_string(min_length=<NUM_LIT:2>, max_length=<NUM_LIT:3>))<EOL>

Return random value for EmailField

>>> result = any_form_field(forms.EmailField(min_length=10, max_length=30))
>>> type(result)
<type 'str'>
>>> len(result) <= 30, len(result) >= 10
(True, True)


from_date = kwargs.get('<STR_LIT>', date(<NUM_LIT>, <NUM_LIT:1>, <NUM_LIT:1>))<EOL>to_date = kwargs.get('<STR_LIT>', date.today())<EOL>date_format = random.choice(field.input_formats or formats.get_format('<STR_LIT>'))<EOL>return xunit.any_date(from_date=from_date, to_date=to_date).strftime(date_format)<EOL>

Return random value for DateField

>>> result = any_form_field(forms.DateField())
>>> type(result)
<type 'str'>


from_date = kwargs.get('<STR_LIT>', datetime(<NUM_LIT>, <NUM_LIT:1>, <NUM_LIT:1>))<EOL>to_date = kwargs.get('<STR_LIT>', datetime.today())<EOL>date_format = random.choice(field.input_formats or formats.get_format('<STR_LIT>'))<EOL>return xunit.any_datetime(from_date=from_date, to_date=to_date).strftime(date_format)<EOL>

Return random value for DateTimeField

>>> result = any_form_field(forms.DateTimeField())
>>> type(result)
<type 'str'>


min_value = <NUM_LIT:0><EOL>max_value = <NUM_LIT:100><EOL>from django.core.validators import MinValueValidator, MaxValueValidator<EOL>for elem in field.validators:<EOL><INDENT>if isinstance(elem, MinValueValidator):<EOL><INDENT>min_value = elem.limit_value<EOL><DEDENT>if isinstance(elem, MaxValueValidator):<EOL><INDENT>max_value = elem.limit_value<EOL><DEDENT><DEDENT>min_value = kwargs.get('<STR_LIT>', min_value)<EOL>max_value = kwargs.get('<STR_LIT>', max_value)<EOL>precision = kwargs.get('<STR_LIT>', <NUM_LIT:3>)<EOL>return str(xunit.any_float(min_value=min_value, max_value=max_value, precision=precision))<EOL>

Return random value for FloatField

>>> result = any_form_field(forms.FloatField(max_value=200, min_value=100))
>>> type(result)
<type 'str'>
>>> float(result) >=100, float(result) <=200
(True, True)


min_value = <NUM_LIT:0><EOL>max_value = <NUM_LIT:100><EOL>from django.core.validators import MinValueValidator, MaxValueValidator <EOL>for elem in field.validators:<EOL><INDENT>if isinstance(elem, MinValueValidator):<EOL><INDENT>min_value = elem.limit_value<EOL><DEDENT>if isinstance(elem, MaxValueValidator):<EOL><INDENT>max_value = elem.limit_value<EOL><DEDENT><DEDENT>min_value = kwargs.get('<STR_LIT>', min_value)<EOL>max_value = kwargs.get('<STR_LIT>', max_value)<EOL>return str(xunit.any_int(min_value=min_value, max_value=max_value))<EOL>

Return random value for IntegerField

>>> result = any_form_field(forms.IntegerField(max_value=200, min_value=100))
>>> type(result)
<type 'str'>
>>> int(result) >=100, int(result) <=200
(True, True)


choices = kwargs.get('<STR_LIT>')<EOL>if choices:<EOL><INDENT>return random.choice(choices)<EOL><DEDENT>else:<EOL><INDENT>nums = [str(xunit.any_int(min_value=<NUM_LIT:0>, max_value=<NUM_LIT:255>)) for _ in xrange(<NUM_LIT:0>, <NUM_LIT:4>)]<EOL>return "<STR_LIT:.>".join(nums)<EOL><DEDENT>

Return random value for IPAddressField

>>> result = any_form_field(forms.IPAddressField())
>>> type(result)
<type 'str'>
>>> from django.core.validators import ipv4_re
>>> import re
>>> re.match(ipv4_re, result) is not None
True


return random.choice(['<STR_LIT:None>', '<STR_LIT:True>', '<STR_LIT:False>'])<EOL>

Return random value for NullBooleanField

>>> result = any_form_field(forms.NullBooleanField())
>>> type(result)
<type 'unicode'>
>>> result in [u'1', u'2', u'3']
True


min_length = kwargs.get('<STR_LIT>', <NUM_LIT:1>)<EOL>max_length = kwargs.get('<STR_LIT:max_length>', field.max_length or <NUM_LIT:20>)    <EOL>from string import ascii_letters, digits<EOL>letters = ascii_letters + digits + '<STR_LIT>' <EOL>return xunit.any_string(letters = letters, min_length = min_length, max_length = max_length)<EOL>

Return random value for SlugField

>>> result = any_form_field(forms.SlugField())
>>> type(result)
<type 'str'>
>>> from django.core.validators import slug_re
>>> import re
>>> re.match(slug_re, result) is not None
True


Return random value for URLField

>>> result = any_form_field(forms.URLField())
>>> from django.core.validators import URLValidator
>>> import re
>>> re.match(URLValidator.regex, result) is not None
True


time_format = random.choice(field.input_formats or formats.get_format('<STR_LIT>'))<EOL>return time(xunit.any_int(min_value=<NUM_LIT:0>, max_value=<NUM_LIT>),<EOL>xunit.any_int(min_value=<NUM_LIT:0>, max_value=<NUM_LIT>),<EOL>xunit.any_int(min_value=<NUM_LIT:0>, max_value=<NUM_LIT>)).strftime(time_format)<EOL>

Return random value for TimeField

>>> result = any_form_field(forms.TimeField())
>>> type(result)
<type 'str'>


if field.choices:<EOL><INDENT>return str(random.choice(list(valid_choices(field.choices))))<EOL><DEDENT>return '<STR_LIT:None>'<EOL>

Return random value for ChoiceField

>>> CHOICES = [('YNG', 'Child'), ('OLD', 'Parent')]
>>> result = any_form_field(forms.ChoiceField(choices=CHOICES))
>>> type(result)
<type 'str'>
>>> result in ['YNG', 'OLD']
True
>>> typed_result = any_form_field(forms.TypedChoiceField(choices=CHOICES))
>>> typed_result in ['YNG', 'OLD']
True


if field.choices:<EOL><INDENT>from django_any.functions import valid_choices <EOL>l = list(valid_choices(field.choices))<EOL>random.shuffle(l)<EOL>choices = []<EOL>count = xunit.any_int(min_value=<NUM_LIT:1>, max_value=len(field.choices))<EOL>for i in xrange(<NUM_LIT:0>, count):<EOL><INDENT>choices.append(l[i])<EOL><DEDENT>return '<STR_LIT:U+0020>'.join(choices)<EOL><DEDENT>return '<STR_LIT:None>'<EOL>

Return random value for MultipleChoiceField

>>> CHOICES = [('YNG', 'Child'), ('MIDDLE', 'Parent') ,('OLD', 'GrandParent')]
>>> result = any_form_field(forms.MultipleChoiceField(choices=CHOICES))
>>> type(result)
<type 'str'>


data = list(field.queryset[:<NUM_LIT:10>])<EOL>if data:<EOL><INDENT>return random.choice(data)<EOL><DEDENT>else:<EOL><INDENT>raise TypeError('<STR_LIT>' % field.queryset.model)<EOL><DEDENT>

Return one of first ten items for field queryset


for key in _context_keys_iterator(context):<EOL><INDENT>inst = context[key]<EOL>if isinstance(inst, (forms.Form, forms.ModelForm)):<EOL><INDENT>yield inst<EOL><DEDENT>elif isinstance(inst,  forms.formsets.BaseFormSet):<EOL><INDENT>yield inst<EOL><DEDENT>elif isinstance(inst, AdminForm):<EOL><INDENT>yield inst.form<EOL><DEDENT><DEDENT>

Lookup all stored in context froms instance


func.__django_any_without_random_seed = True<EOL>return func<EOL>

Marks that test method do not need to be started with random seed


def _wrapper(func):<EOL><INDENT>seeds = getattr(func, '<STR_LIT>', [])<EOL>seeds.append(seed)<EOL>func.__django_any_with_seed = seeds<EOL>return func<EOL><DEDENT>return _wrapper<EOL>

Marks that test method do not need to be started with specific seed


def _wrapper(self, seed=seed, *args, **kwargs):<EOL><INDENT>self.__django_any_seed = seed if seed else int(time.time()*<NUM_LIT:1000>)<EOL>random.seed(self.__django_any_seed)<EOL>return func(self, *args, **kwargs)<EOL><DEDENT>return _wrapper<EOL>

Set randon seed before executing function. If seed is
not provided current timestamp used


for key, value in choices:<EOL><INDENT>if isinstance(value, (list, tuple)):<EOL><INDENT>for key, _ in value:<EOL><INDENT>yield key<EOL><DEDENT><DEDENT>else:<EOL><INDENT>yield key<EOL><DEDENT><DEDENT>


from collections import defaultdict<EOL>model_fields = {}<EOL>fields_agrs = defaultdict(lambda : {})<EOL>for key in kw.keys():<EOL><INDENT>if '<STR_LIT>' in key:<EOL><INDENT>field, _, subfield = key.partition('<STR_LIT>')<EOL>fields_agrs[field][subfield] = kw[key]<EOL><DEDENT>else:<EOL><INDENT>model_fields[key] = kw[key]<EOL><DEDENT><DEDENT>return model_fields, fields_agrs<EOL>


def register(self, field_type, impl=None):

def _wrapper(func):<EOL><INDENT>self.registry[field_type] = func<EOL>return func<EOL><DEDENT>if impl:<EOL><INDENT>return _wrapper(impl)<EOL><DEDENT>return _wrapper<EOL>

Register form field data function.

Could be used as decorator


self._create_value = impl(self._create_value)<EOL>return impl<EOL>


def _create_value(self, *args, **kwargs):

if not len(args):<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>if self.by_instance:<EOL><INDENT>field_type = args[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>field_type = args[<NUM_LIT:0>].__class__<EOL><DEDENT>function = self.registry.get(field_type, self.default)<EOL>if function is None:<EOL><INDENT>raise TypeError("<STR_LIT>" % field_type)<EOL><DEDENT>return function(*args, **kwargs)<EOL>

Lowest value generator.

Separated from __call__, because it seems that python
cache __call__ reference on module import


total = sum([weight for (weight, _) in choices])<EOL>i = random.randint(<NUM_LIT:0>, total - <NUM_LIT:1>)<EOL>for weight, choice in choices:<EOL><INDENT>i -= weight<EOL>if i < <NUM_LIT:0>: <EOL><INDENT>if callable(choice):<EOL><INDENT>return choice()<EOL><DEDENT>return choice<EOL><DEDENT><DEDENT>raise Exception('<STR_LIT>')<EOL>

Supposes that choices is sequence of two elements items,
where first one is the probability and second is the
result object or callable

>>> result = weighted_choice([(20,'x'), (100, 'y')])
>>> result in ['x', 'y']
True


return random.choice([True, False])<EOL>

Returns True or False

>>> result = any_boolean()
>>> type(result)
<type 'bool'>


def any_int(min_value=<NUM_LIT:0>, max_value=<NUM_LIT:100>, **kwargs):

return random.randint(min_value, max_value)<EOL>

Return random integer from the selected range

>>> result = any_int(min_value=0, max_value=100)
>>> type(result)
<type 'int'>
>>> result in range(0,101)
True


def any_float(min_value=<NUM_LIT:0>, max_value=<NUM_LIT:100>, precision=<NUM_LIT:2>):

return round(random.uniform(min_value, max_value), precision)<EOL>

Returns random float

>>> result = any_float(min_value=0, max_value=100, precision=2)
>>> type(result)
<type 'float'>
>>> result >=0 and result <= 100
True


def any_letter(letters = ascii_letters, **kwargs):

return random.choice(letters)<EOL>

Return random letter

>>> result = any_letter(letters = ascii_letters)
>>> type(result)
<type 'str'>
>>> len(result)
1
>>> result in ascii_letters
True


def any_string(letters = ascii_letters, min_length=<NUM_LIT:3>, max_length=<NUM_LIT:100>):

length = random.randint(min_length, max_length)<EOL>letters = [any_letter(letters=letters) for _ in range(<NUM_LIT:0>, length)]<EOL>return "<STR_LIT>".join(letters)<EOL>

Return string with random content

>>> result = any_string(letters = ascii_letters, min_length=3, max_length=100)
>>> type(result)
<type 'str'>
>>> len(result) in range(3,101)
True
>>> any([c in ascii_letters for c in result])
True


def any_date(from_date=date(<NUM_LIT>, <NUM_LIT:1>, <NUM_LIT:1>), to_date=date.today()):

days = any_int(min_value=<NUM_LIT:0>, max_value=(to_date - from_date).days)<EOL>return from_date + timedelta(days=days)<EOL>

Return random date from the [from_date, to_date] interval

>>> result = any_date(from_date=date(1990,1,1), to_date=date(1990,1,3))
>>> type(result)
<type 'datetime.date'>
>>> result >= date(1990,1,1) and result <= date(1990,1,3)
True


def any_datetime(from_date=datetime(<NUM_LIT>, <NUM_LIT:1>, <NUM_LIT:1>), to_date=datetime.now()):

days = any_int(min_value=<NUM_LIT:0>, max_value=(to_date - from_date).days-<NUM_LIT:1>)<EOL>time = timedelta(seconds=any_int(min_value=<NUM_LIT:0>, max_value=<NUM_LIT>*<NUM_LIT>-<NUM_LIT:1>))<EOL>return from_date + timedelta(days=days) + time<EOL>

Return random datetime from the [from_date, to_date] interval

>>> result = any_datetime(from_date=datetime(1990,1,1), to_date=datetime(1990,1,3))
>>> type(result)
<type 'datetime.datetime'>
>>> result >= datetime(1990,1,1) and result <= datetime(1990,1,3)
True


def any_decimal(min_value=Decimal(<NUM_LIT:0>), max_value=Decimal('<STR_LIT>'), decimal_places=<NUM_LIT:2>):

return Decimal(str(any_float(min_value=float(min_value),<EOL>max_value=float(max_value),<EOL>precision=decimal_places)))<EOL>

Return random decimal from the [min_value, max_value] interval

>>> result = any_decimal(min_value=0.999, max_value=3, decimal_places=3)
>>> type(result)
<class 'decimal.Decimal'>
>>> result >= Decimal('0.999') and result <= Decimal(3)
True


def wrapper(field, **kwargs):<EOL><INDENT>if kwargs.get('<STR_LIT>', False):<EOL><INDENT>return None<EOL><DEDENT>if field.blank and random.random < <NUM_LIT:0.1>:<EOL><INDENT>return None<EOL><DEDENT>return function(field, **kwargs)<EOL><DEDENT>return wrapper<EOL>

Sometimes return None if field could be blank


def wrapper(field, **kwargs):<EOL><INDENT>if field.choices:<EOL><INDENT>return random.choice(list(valid_choices(field.choices)))<EOL><DEDENT>return function(field, **kwargs)<EOL><DEDENT>return wrapper<EOL>

Selection from field.choices

>>> CHOICES = [('YNG', 'Child'), ('OLD', 'Parent')]
>>> result = any_field(models.CharField(max_length=3, choices=CHOICES))
>>> result in ['YNG', 'OLD']
True


min_value = kwargs.get('<STR_LIT>', <NUM_LIT:1>)<EOL>max_value = kwargs.get('<STR_LIT>', <NUM_LIT:10>**<NUM_LIT:10>)<EOL>return long(xunit.any_int(min_value=min_value, max_value=max_value))<EOL>

Return random value for BigIntegerField

>>> result = any_field(models.BigIntegerField())
>>> type(result)
<type 'long'>


return xunit.any_boolean()<EOL>

Return random value for BooleanField

>>> result = any_field(models.BooleanField())
>>> type(result)
<type 'bool'>


min_value = kwargs.get('<STR_LIT>', <NUM_LIT:1>)<EOL>max_value = kwargs.get('<STR_LIT>', <NUM_LIT>)<EOL>return xunit.any_int(min_value=min_value, max_value=max_value)<EOL>

An positive integer

>>> result = any_field(models.PositiveIntegerField())
>>> type(result)
<type 'int'>
>>> result > 0
True


min_length = kwargs.get('<STR_LIT>', <NUM_LIT:1>)<EOL>max_length = kwargs.get('<STR_LIT:max_length>', field.max_length)<EOL>return xunit.any_string(min_length=min_length, max_length=max_length)<EOL>

Return random value for CharField

>>> result = any_field(models.CharField(max_length=10))
>>> type(result)
<type 'str'>


nums_count = field.max_length/<NUM_LIT:2><EOL>nums = [str(xunit.any_int(min_value=<NUM_LIT:0>, max_value=<NUM_LIT:9>)) for _ in xrange(<NUM_LIT:0>, nums_count)]<EOL>return "<STR_LIT:U+002C>".join(nums)<EOL>

Return random value for CharField

>>> result = any_field(models.CommaSeparatedIntegerField(max_length=10))
>>> type(result)
<type 'str'>
>>> [int(num) for num in result.split(',')] and 'OK'
'OK'


if field.auto_now or field.auto_now_add:<EOL><INDENT>return None<EOL><DEDENT>from_date = kwargs.get('<STR_LIT>', date(<NUM_LIT>, <NUM_LIT:1>, <NUM_LIT:1>))<EOL>to_date = kwargs.get('<STR_LIT>', date.today())<EOL>return xunit.any_date(from_date=from_date, to_date=to_date)<EOL>

Return random value for DateField,
skips auto_now and auto_now_add fields

>>> result = any_field(models.DateField())
>>> type(result)
<type 'datetime.date'>


from_date = kwargs.get('<STR_LIT>', datetime(<NUM_LIT>, <NUM_LIT:1>, <NUM_LIT:1>))<EOL>to_date = kwargs.get('<STR_LIT>', datetime.today())<EOL>return xunit.any_datetime(from_date=from_date, to_date=to_date)<EOL>

Return random value for DateTimeField,
skips auto_now and auto_now_add fields

>>> result = any_field(models.DateTimeField())
>>> type(result)
<type 'datetime.datetime'>


min_value = kwargs.get('<STR_LIT>', <NUM_LIT:0>)<EOL>max_value = kwargs.get('<STR_LIT>',<EOL>Decimal('<STR_LIT>' % ('<STR_LIT>'*(field.max_digits-field.decimal_places),<EOL>'<STR_LIT>'*field.decimal_places)))<EOL>decimal_places = kwargs.get('<STR_LIT>', field.decimal_places)<EOL>return xunit.any_decimal(min_value=min_value, max_value=max_value,<EOL>decimal_places = decimal_places)<EOL>

Return random value for DecimalField

>>> result = any_field(models.DecimalField(max_digits=5, decimal_places=2))
>>> type(result)
<class 'decimal.Decimal'>


return "<STR_LIT>" % (xunit.any_string(max_length=<NUM_LIT:10>),<EOL>xunit.any_string(max_length=<NUM_LIT:10>),<EOL>xunit.any_string(min_length=<NUM_LIT:2>, max_length=<NUM_LIT:3>))<EOL>

Return random value for EmailField

>>> result = any_field(models.EmailField())
>>> type(result)
<type 'str'>
>>> re.match(r"(?:^|\s)[-a-z0-9_.]+@(?:[-a-z0-9]+\.)+[a-z]{2,6}(?:\s|$)", result, re.IGNORECASE) is not None
True


min_value = kwargs.get('<STR_LIT>', <NUM_LIT:1>)<EOL>max_value = kwargs.get('<STR_LIT>', <NUM_LIT:100>)<EOL>precision = kwargs.get('<STR_LIT>', <NUM_LIT:3>)<EOL>return xunit.any_float(min_value=min_value, max_value=max_value, precision=precision)<EOL>

Return random value for FloatField

>>> result = any_field(models.FloatField())
>>> type(result)
<type 'float'>


def get_some_file(path):<EOL><INDENT>subdirs, files = field.storage.listdir(path)<EOL>if files:<EOL><INDENT>result_file = random.choice(files)<EOL>instance = field.storage.open("<STR_LIT>" % (path, result_file)).file<EOL>return FieldFile(instance, field, result_file)<EOL><DEDENT>for subdir in subdirs:<EOL><INDENT>result = get_some_file("<STR_LIT>" % (path, subdir))<EOL>if result:<EOL><INDENT>return result<EOL><DEDENT><DEDENT><DEDENT>result = get_some_file(field.upload_to)<EOL>if result is None and not field.null:<EOL><INDENT>raise TypeError("<STR_LIT>" % field.upload_to)<EOL><DEDENT>return result<EOL>


def get_some_file(path):<EOL><INDENT>subdirs, files = [], []<EOL>for entry in os.listdir(path):<EOL><INDENT>entry_path = os.path.join(path, entry)<EOL>if os.path.isdir(entry_path):<EOL><INDENT>subdirs.append(entry_path)<EOL><DEDENT>else:<EOL><INDENT>if not field.match or re.match(field.match,entry):<EOL><INDENT>files.append(entry_path)<EOL><DEDENT><DEDENT><DEDENT>if files:<EOL><INDENT>return random.choice(files)<EOL><DEDENT>if field.recursive:<EOL><INDENT>for subdir in subdirs:<EOL><INDENT>result = get_some_file(subdir)<EOL>if result:<EOL><INDENT>return result<EOL><DEDENT><DEDENT><DEDENT><DEDENT>result = get_some_file(field.path)<EOL>if result is None and not field.null:<EOL><INDENT>raise TypeError("<STR_LIT>" % field.path)<EOL><DEDENT>return result<EOL>


nums = [str(xunit.any_int(min_value=<NUM_LIT:0>, max_value=<NUM_LIT:255>)) for _ in xrange(<NUM_LIT:0>, <NUM_LIT:4>)]<EOL>return "<STR_LIT:.>".join(nums)<EOL>

Return random value for IPAddressField
>>> result = any_field(models.IPAddressField())
>>> type(result)
<type 'str'>
>>> from django.core.validators import ipv4_re
>>> re.match(ipv4_re, result) is not None
True


return random.choice([None, True, False])<EOL>

Return random value for NullBooleanField
>>> result = any_field(models.NullBooleanField())
>>> result in [None, True, False]
True


min_value = kwargs.get('<STR_LIT>', <NUM_LIT:1>)<EOL>max_value = kwargs.get('<STR_LIT>', <NUM_LIT:255>)<EOL>return xunit.any_int(min_value=min_value, max_value=max_value)<EOL>

Return random value for PositiveSmallIntegerField
>>> result = any_field(models.PositiveSmallIntegerField())
>>> type(result)
<type 'int'>
>>> result < 256, result > 0
(True, True)


letters = ascii_letters + digits + '<STR_LIT>'<EOL>return xunit.any_string(letters = letters, max_length = field.max_length)<EOL>

Return random value for SlugField
>>> result = any_field(models.SlugField())
>>> type(result)
<type 'str'>
>>> from django.core.validators import slug_re
>>> re.match(slug_re, result) is not None
True


min_value = kwargs.get('<STR_LIT>', -<NUM_LIT:255>)<EOL>max_value = kwargs.get('<STR_LIT>', <NUM_LIT:255>)<EOL>return xunit.any_int(min_value=min_value, max_value=max_value)<EOL>

Return random value for SmallIntegerValue
>>> result = any_field(models.SmallIntegerField())
>>> type(result)
<type 'int'>
>>> result > -256, result < 256
(True, True)


min_value = kwargs.get('<STR_LIT>', -<NUM_LIT>)<EOL>max_value = kwargs.get('<STR_LIT>', <NUM_LIT>)<EOL>return xunit.any_int(min_value=min_value, max_value=max_value)<EOL>

Return random value for IntegerField
>>> result = any_field(models.IntegerField())
>>> type(result)
<type 'int'>


return paragraphs(<NUM_LIT:10>)<EOL>

Return random 'lorem ipsum' Latin text
>>> result = any_field(models.TextField())
>>> from django.contrib.webdesign.lorem_ipsum import COMMON_P
>>> result[0] == COMMON_P
True


url = kwargs.get('<STR_LIT:url>')<EOL>if not url:<EOL><INDENT>verified = [validator for validator in field.validatorsif isinstance(validator, validators.URLValidator) andvalidator.verify_exists == True]<EOL>if verified:<EOL><INDENT>url = choice(['<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'])<EOL><DEDENT>else:<EOL><INDENT>url = "<STR_LIT>" % (<EOL>xunit.any_string(max_length=<NUM_LIT:10>),<EOL>xunit.any_string(min_length=<NUM_LIT:2>, max_length=<NUM_LIT:3>),<EOL>xunit.any_string(max_length=<NUM_LIT:20>))<EOL><DEDENT><DEDENT>return url<EOL>

Return random value for URLField
>>> result = any_field(models.URLField())
>>> from django.core.validators import URLValidator
>>> re.match(URLValidator.regex, result) is not None
True


return time(<EOL>xunit.any_int(min_value=<NUM_LIT:0>, max_value=<NUM_LIT>),<EOL>xunit.any_int(min_value=<NUM_LIT:0>, max_value=<NUM_LIT>),<EOL>xunit.any_int(min_value=<NUM_LIT:0>, max_value=<NUM_LIT>))<EOL>

Return random value for TimeField
>>> result = any_field(models.TimeField())
>>> type(result)
<type 'datetime.time'>


def __init__(self, initval=<NUM_LIT:0>, flags=<NUM_LIT:0>):

self._file = os.fdopen(eventfd(initval, flags), '<STR_LIT>')<EOL>

initval (int 0..2**64 - 1)
    Internal counter value.
flags (int)
    Bit mask of EFD_* constants.


return self<EOL>


def __exit__(self, exc_type, ex_val, exc_tb):

self.close()<EOL>


return unpack('<STR_LIT>', self._file.read(<NUM_LIT:8>))[<NUM_LIT:0>]<EOL>

Read current counter value.

See manpage for flags effect on this.


self._file.write(pack('<STR_LIT>', value))<EOL>


return self._file.fileno()<EOL>


self._iocb = iocb = libaio.iocb()<EOL>libaio.zero(iocb)<EOL>self.mode = mode<EOL>self.target_file = target_file<EOL>self.io_priority = io_priority<EOL>if mode is AIOBLOCK_MODE_POLL:<EOL><INDENT>self.event_mask = event_mask<EOL><DEDENT>else:<EOL><INDENT>self.buffer_list = buffer_list<EOL>self.offset = offset<EOL>self.rw_flags = rw_flags<EOL><DEDENT>self.eventfd = eventfd<EOL>self.onCompletion = onCompletion<EOL>

mode (AIOBLOCK_MODE_*)
    The action this block represents.
target_file (file-ish)
    The file to read from/write to.
buffer_list (list of mutable buffer instances: mmap, bytearray, ...)
    Buffers to use.
    Must be empty in AIOBLOCK_MODE_POLL.
offset (int)
    Where to start reading from/writing to.
    Must be zero in AIOBLOCK_MODE_POLL.
eventfd (EventFD)
    An eventfd file, so AIO completion can be waited upon by
    select/poll/epoll.
onCompletion (callable)
    Receives as arguments:
    - the AIOBlock instance which completed
    - res (int)
    - res2 (int)
    For forward compatibility, should return None.
rw_flags (int)
    OR-ed RWF_* constants, see aio_rw_flags in io_submit(2) manpage.
    Must be zero in AIOBLOCK_MODE_POLL.
io_priority (int)
    Request io priority & class, as returned by IOPRIO_PRIO_VALUE.
    "class" may be one of:
        IOPRIO_CLASS_RT: real-time
        IOPRIO_CLASS_BE: best-effort
        IOPRIO_CLASS_IDLE: idle
    "data" meaning depends on class, see ioprio_set(2) manpage.
event_mask (int)
    OR-ed select.EPOLL* constants. EPOLLERR and EPOLLHUP are always
    enabled.


return self._REVERSE_AIOBLOCK_MODE_DICT[self._iocb.aio_lio_opcode]<EOL>

This instance's mode.

Clears buffer_list, offset, event_mask and rw_flags when changed
between AIOBLOCK_MODE_POLL and any other mode.


return self._file<EOL>

The file object this instance operates on.


if self._iocb.aio_lio_opcode == libaio.IO_CMD_POLL:<EOL><INDENT>raise AttributeError<EOL><DEDENT>return self._buffer_list<EOL>

The buffer list this instance operates on.

Only available in mode != AIOBLOCK_MODE_POLL.

Changes on a submitted transfer are not fully applied until its
next submission: kernel will still be using original buffer list.


if self._iocb.aio_lio_opcode != libaio.IO_CMD_POLL:<EOL><INDENT>raise AttributeError<EOL><DEDENT>return self._iocb.u.c.buf.value<EOL>

The events this block will wait for.

Only available in mode == AIOBLOCK_MODE_POLL.


return self._iocb.u.c.offset.value<EOL>

The file offset this instance writes to/reads from.

Only available in mode != AIOBLOCK_MODE_POLL.


return self._onCompletion<EOL>

Called by AIOContext upon block completion.

res (int)
res2 (int)
    target_file-dependent values describing completion conditions.
    Like the number of bytes read/written, error codes, ...


return (<EOL>self._iocb.aio_reqprio<EOL>if self._iocb.u.c.flags & libaio.IOCB_FLAG_IOPRIO else<EOL>None<EOL>)<EOL>


if self._iocb.aio_lio_opcode == libaio.IO_CMD_POLL:<EOL><INDENT>raise AttributeError<EOL><DEDENT>return self._iocb.aio_rw_flags<EOL>

RWF_* bitmask.

Only available in mode != AIOBLOCK_MODE_POLL.


return self._eventfd<EOL>

eventfd file to use for event notifications.


<EOL>return (self._buffer_list, self._iovec)<EOL>


self._maxevents = maxevents<EOL>self._submitted = {}<EOL>self._io_queue_release = libaio.io_queue_release<EOL>ctx = libaio.io_context_t()<EOL>libaio.io_queue_init(self._maxevents, byref(ctx))<EOL>self._ctx = ctx<EOL>

maxevents (int)
    Maximum number of events this context will have to handle.


if self._ctx is not None:<EOL><INDENT>self._io_queue_release(self._ctx)<EOL>del self._ctx<EOL><DEDENT>

Cancels all pending IO blocks.
Waits until all non-cancellable IO blocks finish.
De-initialises AIO context.


return self<EOL>


self.close()<EOL>


self.close()<EOL>

Calls close, in case instance was not properly closed by the time it
gets garbage-collected.


<EOL>submitted_count = libaio.io_submit(<EOL>self._ctx,<EOL>len(block_list),<EOL>(libaio.iocb_p * len(block_list))(*[<EOL>pointer(x._iocb)<EOL>for x in block_list<EOL>]),<EOL>)<EOL>submitted = self._submitted<EOL>for block in block_list[:submitted_count]:<EOL><INDENT>submitted[addressof(block._iocb)] = (block, block._getSubmissionState())<EOL><DEDENT>return submitted_count<EOL>

Submits transfers.

block_list (list of AIOBlock)
    The IO blocks to hand off to kernel.

Returns the number of successfully submitted blocks.


event = libaio.io_event()<EOL>try:<EOL><INDENT>libaio.io_cancel(self._ctx, byref(block._iocb), byref(event))<EOL><DEDENT>except OSError as exc:<EOL><INDENT>if exc.errno == errno.EINPROGRESS:<EOL><INDENT>return None<EOL><DEDENT>raise<EOL><DEDENT>return self._eventToPython(event)<EOL>

Cancel an IO block.

block (AIOBlock)
    The IO block to cancel.

Returns cancelled block's event data (see getEvents), or None if the
kernel returned EINPROGRESS. In the latter case, event completion will
happen on a later getEvents call.


cancel = self.cancel<EOL>result = []<EOL>for block, _ in self._submitted.itervalues():<EOL><INDENT>try:<EOL><INDENT>result.append(cancel(block))<EOL><DEDENT>except OSError as exc:<EOL><INDENT>if exc.errno != errno.EINVAL:<EOL><INDENT>raise<EOL><DEDENT><DEDENT><DEDENT>return result<EOL>

Cancel all submitted IO blocks.

Blocks until all submitted transfers have been finalised.
Submitting more transfers or processing completion events while this
method is running produces undefined behaviour.
Returns the list of values returned by individual cancellations.
See "cancel" documentation.


def getEvents(self, min_nr=<NUM_LIT:1>, nr=None, timeout=None):

if min_nr is None:<EOL><INDENT>min_nr = len(self._submitted)<EOL><DEDENT>if nr is None:<EOL><INDENT>nr = max(len(self._submitted), self._maxevents)<EOL><DEDENT>if timeout is None:<EOL><INDENT>timeoutp = None<EOL><DEDENT>else:<EOL><INDENT>sec = int(timeout)<EOL>timeout = libaio.timespec(sec, int((timeout - sec) * <NUM_LIT>))<EOL>timeoutp = byref(timeout)<EOL><DEDENT>event_buffer = (libaio.io_event * nr)()<EOL>actual_nr = libaio.io_getevents(<EOL>self._ctx,<EOL>min_nr,<EOL>nr,<EOL>event_buffer,<EOL>timeoutp,<EOL>)<EOL>return [<EOL>self._eventToPython(event_buffer[x])<EOL>for x in xrange(actual_nr)<EOL>]<EOL>

Returns a list of event data from submitted IO blocks.

min_nr (int, None)
    When timeout is None, minimum number of events to collect before
    returning.
    If None, waits for all submitted events.
nr (int, None)
    Maximum number of events to return.
    If None, set to maxevents given at construction or to the number of
    currently submitted events, whichever is larger.
timeout (float, None):
    Time to wait for events.
    If None, become blocking.

Returns a list of 3-tuples, containing:
- completed AIOBlock instance
- res, file-object-type-dependent value
- res2, another file-object-type-dependent value


if self.limb_dark in ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>ds = np.linspace(<NUM_LIT:0.>, <NUM_LIT>, <NUM_LIT>)<EOL>fac_lo = <NUM_LIT><EOL>if self.limb_dark == "<STR_LIT>":<EOL><INDENT>f0 = _nonlinear_ld._nonlinear_ld(ds, self.rp, self.u[<NUM_LIT:0>], self.u[<NUM_LIT:1>], self.u[<NUM_LIT:2>], self.u[<NUM_LIT:3>], fac_lo, self.nthreads)<EOL>f = _nonlinear_ld._nonlinear_ld(ds, self.rp, self.u[<NUM_LIT:0>], self.u[<NUM_LIT:1>], self.u[<NUM_LIT:2>], self.u[<NUM_LIT:3>], self.fac, self.nthreads)<EOL><DEDENT>elif self.limb_dark == "<STR_LIT>":<EOL><INDENT>f0 = _nonlinear_ld._nonlinear_ld(ds, self.rp, self.u[<NUM_LIT:1>], self.u[<NUM_LIT:0>], <NUM_LIT:0.>, <NUM_LIT:0.>, fac_lo, self.nthreads)<EOL>f = _nonlinear_ld._nonlinear_ld(ds, self.rp, self.u[<NUM_LIT:1>], self.u[<NUM_LIT:0>], <NUM_LIT:0.>, <NUM_LIT:0.>, self.fac, self.nthreads)<EOL><DEDENT>elif self.limb_dark == "<STR_LIT>":<EOL><INDENT>f0 = _exponential_ld._exponential_ld(ds, self.rp, self.u[<NUM_LIT:0>], self.u[<NUM_LIT:1>], fac_lo, self.nthreads)<EOL>f = _exponential_ld._exponential_ld(ds, self.rp, self.u[<NUM_LIT:0>], self.u[<NUM_LIT:1>], self.fac, self.nthreads)<EOL><DEDENT>elif self.limb_dark == "<STR_LIT>":<EOL><INDENT>f0 = _logarithmic_ld._logarithmic_ld(ds, self.rp, self.u[<NUM_LIT:0>], self.u[<NUM_LIT:1>], fac_lo, self.nthreads)<EOL>f = _logarithmic_ld._logarithmic_ld(ds, self.rp, self.u[<NUM_LIT:0>], self.u[<NUM_LIT:1>], self.fac, self.nthreads)<EOL><DEDENT>elif self.limb_dark == "<STR_LIT>":<EOL><INDENT>f0 = _power2_ld._power2_ld(ds, self.rp, self.u[<NUM_LIT:0>], self.u[<NUM_LIT:1>], fac_lo, self.nthreads)<EOL>f = _power2_ld._power2_ld(ds, self.rp, self.u[<NUM_LIT:0>], self.u[<NUM_LIT:1>], self.fac, self.nthreads)<EOL><DEDENT>else:<EOL><INDENT>f0 = _custom_ld._custom_ld(ds, self.rp, self.u[<NUM_LIT:0>], self.u[<NUM_LIT:1>], self.u[<NUM_LIT:2>], self.u[<NUM_LIT:3>], self.u[<NUM_LIT:4>], self.u[<NUM_LIT:5>], fac_lo, self.nthreads)<EOL>f =  _custom_ld._custom_ld(ds, self.rp, self.u[<NUM_LIT:0>], self.u[<NUM_LIT:1>], self.u[<NUM_LIT:2>], self.u[<NUM_LIT:3>], self.u[<NUM_LIT:4>], self.u[<NUM_LIT:5>], self.fac, self.nthreads)<EOL><DEDENT>err = np.max(np.abs(f-f0))*<NUM_LIT><EOL>if plot == True:<EOL><INDENT>import matplotlib.pyplot as plt<EOL>plt.plot(ds, <NUM_LIT>*(f-f0), color='<STR_LIT:k>')<EOL>plt.xlabel("<STR_LIT>")<EOL>plt.ylabel("<STR_LIT>") <EOL>plt.show()<EOL><DEDENT>return err<EOL><DEDENT>else: raise Exception("<STR_LIT>" + self.limb_dark + "<STR_LIT>")<EOL>

Calculate maximum error for transit light curve calculation.

:param plot: If ``True``, plots the error in the light curve model as a function of separation of centers.
:type plot: bool

:return: Truncation error (parts per million)
:rtype: float


<EOL>if params.t0 != self.t0 or params.per != self.per or params.a != self.a or params.inc != self.inc or params.ecc != self.ecc or params.w != self.w or params.t_secondary != self.t_secondary:<EOL><INDENT>if self.transittype == <NUM_LIT:2> and params.t_secondary != self.t_secondary:<EOL><INDENT>params.t0 = self.get_t_conjunction(params)<EOL><DEDENT>self.ds= _rsky._rsky(self.t_supersample, params.t0, params.per, params.a, params.inc*pi/<NUM_LIT>, params.ecc, params.w*pi/<NUM_LIT>, self.transittype, self.nthreads)<EOL><DEDENT>if params.limb_dark != self.limb_dark: self.fac = self._get_fac()<EOL>self.t0 = params.t0<EOL>self.per = params.per<EOL>self.rp = params.rp<EOL>self.a = params.a<EOL>self.inc = params.inc<EOL>self.ecc = params.ecc<EOL>self.w = params.w<EOL>self.u = params.u<EOL>self.limb_dark = params.limb_dark<EOL>self.fp = params.fp<EOL>self.t_secondary = params.t_secondary<EOL>self.inverse = False<EOL>if self.rp < <NUM_LIT:0.>: <EOL><INDENT>self.rp = -<NUM_LIT:1.>*self.rp<EOL>params.rp = -<NUM_LIT:1.>*params.rp<EOL>self.inverse = True<EOL><DEDENT>if self.transittype == <NUM_LIT:1>:<EOL><INDENT>if params.limb_dark != self.limb_dark: raise Exception("<STR_LIT>")<EOL>if self.limb_dark == "<STR_LIT>": lc = _quadratic_ld._quadratic_ld(self.ds, params.rp, params.u[<NUM_LIT:0>], params.u[<NUM_LIT:1>], self.nthreads)<EOL>elif self.limb_dark == "<STR_LIT>": lc = _quadratic_ld._quadratic_ld(self.ds, params.rp, params.u[<NUM_LIT:0>], <NUM_LIT:0.>, self.nthreads)<EOL>elif self.limb_dark == "<STR_LIT>": lc = _nonlinear_ld._nonlinear_ld(self.ds, params.rp, params.u[<NUM_LIT:0>], params.u[<NUM_LIT:1>], params.u[<NUM_LIT:2>], params.u[<NUM_LIT:3>], self.fac, self.nthreads)<EOL>elif self.limb_dark == "<STR_LIT>": lc = _nonlinear_ld._nonlinear_ld(self.ds, params.rp, params.u[<NUM_LIT:1>], params.u[<NUM_LIT:0>], <NUM_LIT:0.>, <NUM_LIT:0.>, self.fac, self.nthreads)<EOL>elif self.limb_dark == "<STR_LIT>": lc = _uniform_ld._uniform_ld(self.ds, params.rp, self.nthreads)<EOL>elif self.limb_dark == "<STR_LIT>": lc = _logarithmic_ld._logarithmic_ld(self.ds, params.rp, params.u[<NUM_LIT:0>], params.u[<NUM_LIT:1>], self.fac, self.nthreads)<EOL>elif self.limb_dark == "<STR_LIT>": lc = _exponential_ld._exponential_ld(self.ds, params.rp, params.u[<NUM_LIT:0>], params.u[<NUM_LIT:1>], self.fac, self.nthreads)<EOL>elif self.limb_dark == "<STR_LIT>": lc = _power2_ld._power2_ld(self.ds, params.rp, params.u[<NUM_LIT:0>], params.u[<NUM_LIT:1>], self.fac, self.nthreads)<EOL>elif self.limb_dark == "<STR_LIT>": lc = _custom_ld._custom_ld(self.ds, params.rp, params.u[<NUM_LIT:0>], params.u[<NUM_LIT:1>], params.u[<NUM_LIT:2>], params.u[<NUM_LIT:3>], params.u[<NUM_LIT:4>], params.u[<NUM_LIT:5>], self.fac, self.nthreads)<EOL>else: raise Exception("<STR_LIT>")<EOL>if self.inverse == True: lc = <NUM_LIT> - lc<EOL><DEDENT>else: lc = _eclipse._eclipse(self.ds, params.rp, params.fp, self.nthreads)   <EOL>if self.supersample_factor == <NUM_LIT:1>: return lc<EOL>else: return np.mean(lc.reshape(-<NUM_LIT:1>, self.supersample_factor), axis=<NUM_LIT:1>)<EOL>

Calculate a model light curve.

:param params: Transit parameters
:type params: A `TransitParams` instance

:return: Relative flux
:rtype: ndarray

:Example:

>>> flux = m.light_curve(params)


phase = self._get_phase(params, "<STR_LIT>")<EOL>return params.t0 - params.per*phase<EOL>

Return the time of periastron passage (calculated using `params.t0`).


phase = self._get_phase(params, "<STR_LIT>")<EOL>phase2 = self._get_phase(params, "<STR_LIT>")<EOL>return params.t0 + params.per*(phase2-phase)<EOL>

Return the time of secondary eclipse center (calculated using `params.t0`).


phase = self._get_phase(params, "<STR_LIT>")<EOL>phase2 = self._get_phase(params, "<STR_LIT>")<EOL>return params.t_secondary + params.per*(phase-phase2)<EOL>

Return the time of primary transit center (calculated using `params.t_secondary`).


self.f = _rsky._getf(self.t_supersample, self.t0, self.per, self.a,<EOL>self.inc*pi/<NUM_LIT>, self.ecc, self.w*pi/<NUM_LIT>,<EOL>self.transittype, self.nthreads)<EOL>return self.f<EOL>


compiler = new_compiler()<EOL>hasopenmp = hasfunction(compiler, '<STR_LIT>')<EOL>needs_gomp = hasopenmp<EOL>if not hasopenmp:<EOL><INDENT>compiler.add_library('<STR_LIT>')<EOL><DEDENT>hasopenmp = hasfunction(compiler, '<STR_LIT>')<EOL>needs_gomp = hasopenmp<EOL>return hasopenmp<EOL>

Does this compiler support OpenMP parallelization?


compiler = new_compiler()<EOL>print("<STR_LIT>")<EOL>hasopenmp = hasfunction(compiler, '<STR_LIT>')<EOL>needs_gomp = hasopenmp<EOL>if not hasopenmp:<EOL><INDENT>compiler.add_library('<STR_LIT>')<EOL><DEDENT>hasopenmp = hasfunction(compiler, '<STR_LIT>')<EOL>needs_gomp = hasopenmp<EOL>if hasopenmp: print("<STR_LIT>")<EOL>else: print( "<STR_LIT>")<EOL>return hasopenmp, needs_gomp<EOL>


def get_link_display(url):<EOL><INDENT>unquoted = unquote(url.split('<STR_LIT>')[-<NUM_LIT:1>])<EOL>if sys.version_info.major == <NUM_LIT:2>:  <EOL><INDENT>from django.utils.encoding import force_unicode<EOL>unquoted = force_unicode(unquoted)<EOL><DEDENT>return escape(unquoted)<EOL><DEDENT>def get_template_substitution_values(self, value):<EOL><INDENT>subst = super(cls, self).get_template_substitution_values(value)<EOL>subst['<STR_LIT>'] = get_link_display(value.url)<EOL>return subst<EOL><DEDENT>setattr(cls,<EOL>'<STR_LIT>',<EOL>get_template_substitution_values)<EOL>def get_context(self, name, value, attrs):<EOL><INDENT>context = super(cls, self).get_context(name, value, attrs)<EOL>if value and hasattr(value, '<STR_LIT:url>'):<EOL><INDENT>context['<STR_LIT>']['<STR_LIT>'] = get_link_display(value.url)<EOL><DEDENT>return context<EOL><DEDENT>setattr(cls, '<STR_LIT>', get_context)<EOL>return cls<EOL>


if instance.pk:<EOL><INDENT>model_class = type(instance)<EOL>if model_class.objects.filter(pk=instance.pk).exclude(<EOL>**{'<STR_LIT>' % filefield_name: True}<EOL>).exclude(<EOL>**{'<STR_LIT>' % filefield_name: '<STR_LIT>'}<EOL>).exists():<EOL><INDENT>old_file = getattr(<EOL>model_class.objects.only(filefield_name).get(pk=instance.pk),<EOL>filefield_name<EOL>)<EOL><DEDENT>else:<EOL><INDENT>old_file = None<EOL><DEDENT>if old_file:<EOL><INDENT>if (old_file.name == getattr(instance, filefield_name)) is False:<EOL><INDENT>DatabaseFileStorage().delete(old_file.name)<EOL><DEDENT><DEDENT><DEDENT>

Delete file from database only if needed.

    When editing and the filefield is a new file,
    deletes the previous file (if any) from the database.
    Call this function immediately BEFORE saving the instance.


file_instance = getattr(instance, filefield_name)<EOL>if file_instance:<EOL><INDENT>DatabaseFileStorage().delete(file_instance.name)<EOL><DEDENT>

Delete the file (if any) from the database.

    Call this function immediately AFTER deleting the instance.


<EOL>x,y = self._getUnrotatedCellCentroidCoords(i, j)<EOL>return [<EOL>self.rotatePoint(x - self._side,       y                 ),  <EOL>self.rotatePoint(x - self._side / <NUM_LIT>, y - self._hexPerp ), <EOL>self.rotatePoint(x + self._side / <NUM_LIT>, y - self._hexPerp ), <EOL>self.rotatePoint(x + self._side,       y                 ),                 <EOL>self.rotatePoint(x + self._side / <NUM_LIT>, y + self._hexPerp ),<EOL>self.rotatePoint(x - self._side / <NUM_LIT>, y + self._hexPerp ), <EOL>]<EOL>

Edge coordinates of an hexagon centered in (x,y) having a side of d:

          [x-d/2, y+sqrt(3)*d/2]   [x+d/2, y+sqrt(3)*d/2]

 [x-d, y]                                                 [x+d, y]

          [x-d/2, y-sqrt(3)*d/2]   [x+d/2, y-sqrt(3)*d/2]


if(self.angle == <NUM_LIT:0> or self.angle == None):<EOL><INDENT>return(pointX, pointY)<EOL><DEDENT>length = math.sqrt((pointX - self.xll) ** <NUM_LIT:2> + (pointY - self.yll) ** <NUM_LIT:2>)<EOL>beta = math.acos((pointX - self.xll) / length) <EOL>if(pointY < self.yll):<EOL><INDENT>beta = math.pi * <NUM_LIT:2> - beta<EOL><DEDENT>offsetX = math.cos(beta) * length - math.cos(self._angle_rd + beta) * length<EOL>offsetY = math.sin(self._angle_rd + beta) * length - math.sin(beta) * length <EOL>return (pointX - offsetX, pointY + offsetY)<EOL>

Rotates a point relative to the mesh origin by the angle specified in the angle property.
Uses the angle formed between the segment linking the point of interest to the origin and
the parallel intersecting the origin. This angle is called beta in the code.


return WEBEX_TEAMS_TEST_STRING_TEMPLATE.substitute(<EOL>prefix=WEBEX_TEAMS_TEST_STRING_PREFIX,<EOL>item=item,<EOL>datetime=str(datetime.datetime.now())<EOL>)<EOL>


def download_file(url, local_directory, local_filename=None):

<EOL>local_filename = local_filename if local_filenameelse url.split('<STR_LIT:/>')[-<NUM_LIT:1>]<EOL>local_path = os.path.normpath(os.path.join(<EOL>local_directory, local_filename,<EOL>))<EOL>response = requests.get(url, stream=True)<EOL>with open(local_path, '<STR_LIT:wb>') as f:<EOL><INDENT>for chunk in response.iter_content(chunk_size=<NUM_LIT>):<EOL><INDENT>if chunk:<EOL><INDENT>f.write(chunk)<EOL><DEDENT><DEDENT><DEDENT>return local_path<EOL>

Download a file from a remote URL to a local directory.


while w:<EOL><INDENT>if issubclass(w.pop().category, webexteamssdk.RateLimitWarning):<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL>

Check to see if a rate-limit warning is in the warnings list.


@functools.wraps(generator_function)<EOL>def generator_container_wrapper(*args, **kwargs):<EOL><INDENT>"""<STR_LIT>"""<EOL>return GeneratorContainer(generator_function, *args, **kwargs)<EOL><DEDENT>return generator_container_wrapper<EOL>

Function Decorator: Containerize calls to a generator function.

    Args:
        generator_function(func): The generator function being containerized.

    Returns:
        func: A wrapper function that containerizes the calls to the generator
            function.


def __init__(self, generator_function, *args, **kwargs):

if not inspect.isgeneratorfunction(generator_function):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>self.generator_function = generator_function<EOL>if sys.version_info[<NUM_LIT:0>] < <NUM_LIT:3>:<EOL><INDENT>self.arguments = inspect.getcallargs(<EOL>self.generator_function,<EOL>*args,<EOL>**kwargs<EOL>)<EOL><DEDENT>else:<EOL><INDENT>signature = inspect.signature(self.generator_function)<EOL>bound_arguments = signature.bind(*args, **kwargs)<EOL>self.arguments = bound_arguments.arguments<EOL><DEDENT>

Init a new GeneratorContainer.

        Args:
            generator_function(func): The generator function.
            *args: The arguments passed to the generator function.
            **kwargs: The keyword arguments passed to the generator function.


return '<STR_LIT>'.format(<EOL>func_name=self.generator_function.__name__,<EOL>arguments="<STR_LIT:U+002CU+0020>".join(<EOL>str(key) + '<STR_LIT:=>' + repr(value)<EOL>for key, value in self.arguments.items()<EOL>),<EOL>)<EOL>


return self.__repr__()<EOL>

A human-readable string representation of this object.


return self.generator_function(**self.arguments)<EOL>


return self.new_generator()<EOL>


if isinstance(item, slice):<EOL><INDENT>arguments = self.arguments.copy()<EOL>arguments.setdefault('<STR_LIT>', item.stop)<EOL>return islice(<EOL>self.generator_function(**arguments),<EOL>item.start,<EOL>item.stop,<EOL>item.step,<EOL>)<EOL><DEDENT>else:<EOL><INDENT>raise IndexError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>

Slice a generator container.

        This is a convenience feature that, with a minor optimization, is
        essentially syntactic sugar for:

        `itertools.islice(GeneratorContainer, start, stop, step)`

        This method attempts to optimize the Webex Teams request page size for
        slicing by setting the `max` parameter to the stop-value of the slice.
        If the sliced sequence can be returned in a single response, it will
        be. Otherwise automatic pagination will take care of returning enough
        pages for the data to be sliced.  If `max=` was already specified as a
        parameter to the generator function wrapped by the GeneratorContainer,
        this optimization will not change the value.

        Args:
            item(slice): A slice object specifying the start, stop and step.

        Returns:
            itertools.islice: An itertools.islice object slicing the
                GeneratorContainer's wrapped generator function.


return SimpleDataModel(json_data)<EOL>

Factory function for creating SimpleDataModel objects.

    Args:
        model(basestring): The data model to use when creating the data
            object (message, room, membership, etc.).
        json_data(basestring, dict): The JSON string or dictionary data with
            which to initialize the object.

    Returns:
        SimpleDataModel: The created SimpleDataModel object.

    Raises:
        TypeError: If the json_data parameter is not a JSON string or
            dictionary.


super(SimpleDataModel, self).__init__()<EOL>for attribute, value in json_dict(json_data).items():<EOL><INDENT>setattr(self, attribute, value)<EOL><DEDENT>

Init a new SimpleDataModel object from a dictionary or JSON string.

        Args:
            json_data(dict, basestring): Input JSON string or dictionary.

        Raises:
            TypeError: If the input object is not a dictionary or string.


return json.dumps(self.__dict__, ensure_ascii=False, indent=<NUM_LIT:4>)<EOL>


class_str = self.__class__.__name__<EOL>json_str = json.dumps(self.__dict__, ensure_ascii=False)<EOL>return "<STR_LIT>".format(class_str, repr(json_str))<EOL>

A string representing this object as valid Python expression.


return json_dict(json_data)<EOL>

Factory function for creating SimpleDataModel objects.

    Args:
        model(basestring): The data model to use when creating the data
            object (message, room, membership, etc.).
        json_data(basestring, dict): The JSON string or dictionary data with
            which to initialize the object.

    Returns:
        OrderedDict: An ordered dictionary with the contents of the Webex Teams
         JSON object.

    Raises:
        TypeError: If the json_data parameter is not a JSON string or
            dictionary.


return self._json_data.get('<STR_LIT:id>')<EOL>


return self._json_data.get('<STR_LIT>')<EOL>

The human-friendly display name of the Organization.


created = self._json_data.get('<STR_LIT>')<EOL>if created:<EOL><INDENT>return WebexTeamsDateTime.strptime(created)<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>

Creation date and time in ISO8601 format.


return self._json_data.get('<STR_LIT:name>')<EOL>


The total number of license units consumed.


The filter that defines the webhook scope.


The ID of the organization that owns the webhook.


The ID of the person that added the webhook.


Identifies the application that added the webhook.


Indicates if the webhook is owned by the `org` or the `creator`.

        Webhooks owned by the creator can only receive events that are
        accessible to the creator of the webhook. Those owned by the
        organization will receive events that are visible to anyone in the
        organization.


return self._json_data.get('<STR_LIT:status>')<EOL>

Indicates if the webhook is active.

        A webhook that cannot reach your URL is disabled.


The ID of the person that caused the webhook to be sent.


The ID of the organization that the person is associated with.


The date and time the membership was created.


Refresh token used to request a new/refreshed access token.


return self._json_data.get('<STR_LIT:title>')<EOL>


return self._json_data.get('<STR_LIT:type>')<EOL>

The type of room (i.e. 'group', 'direct' etc.).


Whether or not the room is locked and controlled by moderator(s).


last_activity = self._json_data.get('<STR_LIT>')<EOL>if last_activity:<EOL><INDENT>return WebexTeamsDateTime.strptime(last_activity)<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>

The date and time when the room was last active.


The date and time when the room was created.


The ID of the person who created the room.


The ID for the team with which this room is associated.


The type of object returned by Webex Teams (should be `person`).


return self._json_data['<STR_LIT>']<EOL>


Nick name' or preferred short name of the person.


URL to the person's avatar in PNG format.


ID of the organization to which this person belongs.


The date and time the person was created.


The date and time of the person's last activity.


Person has been sent an invite, but hasn't responded.


The URL that receives POST requests for each event.


The filter that defines the webhook scope.


Secret used to generate payload signature.


The ID of the organization that owns the webhook.


The ID of the person that added the webhook.


Identifies the application that added the webhook.


Indicates if the webhook is owned by the `org` or the `creator`.

        Webhooks owned by the creator can only receive events that are
        accessible to the creator of the webhook. Those owned by the
        organization will receive events that are visible to anyone in the
        organization.


Indicates if the webhook is active.

        A webhook that cannot reach your URL is disabled.


Creation date and time in ISO8601 format.


The ID of the person who created the team.


The ID of the organization that the person is associated with.


The date and time the team membership was created.


The type of room (i.e. 'group', 'direct' etc.).


return self._json_data.get('<STR_LIT:text>')<EOL>


Files attached to the the message (list of URLs).


return self._json_data.get('<STR_LIT:html>')<EOL>


The list of IDs of people mentioned in the message.


The date and time the message was created.


The event resource type (`messages`, `memberships`).


The event type (`created`, `updated`, `deleted`).


The ID of the person that performed this event.


The date and time the event was performed.


return immutable_data_models[model](json_data)<EOL>

Factory function for creating ImmutableData objects.

    Args:
        model(basestring): The data model to use when creating the
            ImmutableData object (message, room, membership, etc.).
        json_data(basestring, dict): The JSON string or dictionary data with
            which to initialize the object.

    Returns:
        ImmutableData: The created ImmutableData object.

    Raises:
        TypeError: If the json_data parameter is not a JSON string or
            dictionary.


super(ImmutableData, self).__init__()<EOL>self._json_data = json_dict(json_data)<EOL>

Init a new ImmutableData object from a dictionary or JSON string.

        Args:
            json_data(dict, basestring): Input JSON string or dictionary.

        Raises:
            TypeError: If the input object is not a dictionary or string.


if item in list(self._json_data.keys()):<EOL><INDENT>item_data = self._json_data[item]<EOL>if isinstance(item_data, dict):<EOL><INDENT>return ImmutableData(item_data)<EOL><DEDENT>else:<EOL><INDENT>return item_data<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise AttributeError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(self.__class__.__name__, item)<EOL>)<EOL><DEDENT>

Provide native attribute access to the JSON object attributes.

        This method is called when attempting to access a object attribute that
        hasn't been defined for the object.  For example trying to access
        object.attribute1 when attribute1 hasn't been defined.

        ImmutableData.__getattr__() checks the original JSON object to see if
        the attribute exists, and if it does, it returns the attribute's value
        from the original JSON object.  This provides native access to all of
        the JSON object's attributes.

        Args:
            item(str): Name of the Attribute being accessed.

        Raises:
            AttributeError:  If the JSON object does not contain the attribute
                requested.


class_str = self.__class__.__name__<EOL>json_str = json.dumps(self._json_data, indent=<NUM_LIT:2>)<EOL>return "<STR_LIT>".format(class_str, json_str)<EOL>

A human-readable string representation of this object.


class_str = self.__class__.__name__<EOL>json_str = json.dumps(self._json_data, ensure_ascii=False)<EOL>return "<STR_LIT>".format(class_str, repr(json_str))<EOL>

A string representing this object as valid Python expression.


if hasattr(data, "<STR_LIT>") and callable(data.__hash__):<EOL><INDENT>return data<EOL><DEDENT>elif isinstance(data, list):<EOL><INDENT>return tuple((cls._serialize(item) for item in data))<EOL><DEDENT>elif isinstance(data, dict):<EOL><INDENT>key_value_tuples = [<EOL>(key, cls._serialize(value))<EOL>for key, value in data.items()<EOL>]<EOL>key_value_tuples.sort()<EOL>return tuple(key_value_tuples)<EOL><DEDENT>else:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>".format(type(data))<EOL>)<EOL><DEDENT>


return self._serialize(self._json_data)<EOL>


return isinstance(other, self.__class__)and self._freeze() == other._freeze()<EOL>


return hash(self._freeze())<EOL>


<EOL>return self._json_data.copy()<EOL>

A copy of the data object's JSON data (OrderedDict).


return dict(self._json_data)<EOL>

Convert the Webex Teams object data to a dictionary.


return json.dumps(self._json_data, **kwargs)<EOL>

Convert the Webex Teams object data to JSON.

        Any keyword arguments provided are passed through the Python JSON
        encoder.


return ImmutableData(self._json_data.get('<STR_LIT:data>'))<EOL>


<EOL>git_refnames = "<STR_LIT>"<EOL>git_full = "<STR_LIT>"<EOL>git_date = "<STR_LIT>"<EOL>keywords = {"<STR_LIT>": git_refnames, "<STR_LIT>": git_full, "<STR_LIT:date>": git_date}<EOL>return keywords<EOL>

Get the keywords needed to look up the version information.


<EOL>cfg = VersioneerConfig()<EOL>cfg.VCS = "<STR_LIT>"<EOL>cfg.style = "<STR_LIT>"<EOL>cfg.tag_prefix = "<STR_LIT:v>"<EOL>cfg.parentdir_prefix = "<STR_LIT:None>"<EOL>cfg.versionfile_source = "<STR_LIT>"<EOL>cfg.verbose = False<EOL>return cfg<EOL>

Create, populate and return the VersioneerConfig() object.


def decorate(f):<EOL><INDENT>"""<STR_LIT>"""<EOL>if vcs not in HANDLERS:<EOL><INDENT>HANDLERS[vcs] = {}<EOL><DEDENT>HANDLERS[vcs][method] = f<EOL>return f<EOL><DEDENT>return decorate<EOL>

Decorator to mark a method as the handler for a particular VCS.


def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,<EOL>env=None):

assert isinstance(commands, list)<EOL>p = None<EOL>for c in commands:<EOL><INDENT>try:<EOL><INDENT>dispcmd = str([c] + args)<EOL>p = subprocess.Popen([c] + args, cwd=cwd, env=env,<EOL>stdout=subprocess.PIPE,<EOL>stderr=(subprocess.PIPE if hide_stderr<EOL>else None))<EOL>break<EOL><DEDENT>except EnvironmentError:<EOL><INDENT>e = sys.exc_info()[<NUM_LIT:1>]<EOL>if e.errno == errno.ENOENT:<EOL><INDENT>continue<EOL><DEDENT>if verbose:<EOL><INDENT>print("<STR_LIT>" % dispcmd)<EOL>print(e)<EOL><DEDENT>return None, None<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if verbose:<EOL><INDENT>print("<STR_LIT>" % (commands,))<EOL><DEDENT>return None, None<EOL><DEDENT>stdout = p.communicate()[<NUM_LIT:0>].strip()<EOL>if sys.version_info[<NUM_LIT:0>] >= <NUM_LIT:3>:<EOL><INDENT>stdout = stdout.decode()<EOL><DEDENT>if p.returncode != <NUM_LIT:0>:<EOL><INDENT>if verbose:<EOL><INDENT>print("<STR_LIT>" % dispcmd)<EOL>print("<STR_LIT>" % stdout)<EOL><DEDENT>return None, p.returncode<EOL><DEDENT>return stdout, p.returncode<EOL>


def versions_from_parentdir(parentdir_prefix, root, verbose):

rootdirs = []<EOL>for i in range(<NUM_LIT:3>):<EOL><INDENT>dirname = os.path.basename(root)<EOL>if dirname.startswith(parentdir_prefix):<EOL><INDENT>return {"<STR_LIT:version>": dirname[len(parentdir_prefix):],<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT>": False, "<STR_LIT:error>": None, "<STR_LIT:date>": None}<EOL><DEDENT>else:<EOL><INDENT>rootdirs.append(root)<EOL>root = os.path.dirname(root)  <EOL><DEDENT><DEDENT>if verbose:<EOL><INDENT>print("<STR_LIT>" %<EOL>(str(rootdirs), parentdir_prefix))<EOL><DEDENT>raise NotThisMethod("<STR_LIT>")<EOL>

Try to determine the version from the parent directory name.

    Source tarballs conventionally unpack into a directory that includes both
    the project name and a version string. We will also support searching up
    two directory levels for an appropriately named parent directory


<EOL>keywords = {}<EOL>try:<EOL><INDENT>f = open(versionfile_abs, "<STR_LIT:r>")<EOL>for line in f.readlines():<EOL><INDENT>if line.strip().startswith("<STR_LIT>"):<EOL><INDENT>mo = re.search(r'<STR_LIT>', line)<EOL>if mo:<EOL><INDENT>keywords["<STR_LIT>"] = mo.group(<NUM_LIT:1>)<EOL><DEDENT><DEDENT>if line.strip().startswith("<STR_LIT>"):<EOL><INDENT>mo = re.search(r'<STR_LIT>', line)<EOL>if mo:<EOL><INDENT>keywords["<STR_LIT>"] = mo.group(<NUM_LIT:1>)<EOL><DEDENT><DEDENT>if line.strip().startswith("<STR_LIT>"):<EOL><INDENT>mo = re.search(r'<STR_LIT>', line)<EOL>if mo:<EOL><INDENT>keywords["<STR_LIT:date>"] = mo.group(<NUM_LIT:1>)<EOL><DEDENT><DEDENT><DEDENT>f.close()<EOL><DEDENT>except EnvironmentError:<EOL><INDENT>pass<EOL><DEDENT>return keywords<EOL>

Extract version information from the given file.


@register_vcs_handler("<STR_LIT>", "<STR_LIT>")<EOL>def git_versions_from_keywords(keywords, tag_prefix, verbose):

if not keywords:<EOL><INDENT>raise NotThisMethod("<STR_LIT>")<EOL><DEDENT>date = keywords.get("<STR_LIT:date>")<EOL>if date is not None:<EOL><INDENT>date = date.strip().replace("<STR_LIT:U+0020>", "<STR_LIT:T>", <NUM_LIT:1>).replace("<STR_LIT:U+0020>", "<STR_LIT>", <NUM_LIT:1>)<EOL><DEDENT>refnames = keywords["<STR_LIT>"].strip()<EOL>if refnames.startswith("<STR_LIT>"):<EOL><INDENT>if verbose:<EOL><INDENT>print("<STR_LIT>")<EOL><DEDENT>raise NotThisMethod("<STR_LIT>")<EOL><DEDENT>refs = set([r.strip() for r in refnames.strip("<STR_LIT>").split("<STR_LIT:U+002C>")])<EOL>TAG = "<STR_LIT>"<EOL>tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)])<EOL>if not tags:<EOL><INDENT>tags = set([r for r in refs if re.search(r'<STR_LIT>', r)])<EOL>if verbose:<EOL><INDENT>print("<STR_LIT>" % "<STR_LIT:U+002C>".join(refs - tags))<EOL><DEDENT><DEDENT>if verbose:<EOL><INDENT>print("<STR_LIT>" % "<STR_LIT:U+002C>".join(sorted(tags)))<EOL><DEDENT>for ref in sorted(tags):<EOL><INDENT>if ref.startswith(tag_prefix):<EOL><INDENT>r = ref[len(tag_prefix):]<EOL>if verbose:<EOL><INDENT>print("<STR_LIT>" % r)<EOL><DEDENT>return {"<STR_LIT:version>": r,<EOL>"<STR_LIT>": keywords["<STR_LIT>"].strip(),<EOL>"<STR_LIT>": False, "<STR_LIT:error>": None,<EOL>"<STR_LIT:date>": date}<EOL><DEDENT><DEDENT>if verbose:<EOL><INDENT>print("<STR_LIT>")<EOL><DEDENT>return {"<STR_LIT:version>": "<STR_LIT>",<EOL>"<STR_LIT>": keywords["<STR_LIT>"].strip(),<EOL>"<STR_LIT>": False, "<STR_LIT:error>": "<STR_LIT>", "<STR_LIT:date>": None}<EOL>

Get version information from git keywords.


@register_vcs_handler("<STR_LIT>", "<STR_LIT>")<EOL>def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):

GITS = ["<STR_LIT>"]<EOL>if sys.platform == "<STR_LIT:win32>":<EOL><INDENT>GITS = ["<STR_LIT>", "<STR_LIT>"]<EOL><DEDENT>out, rc = run_command(GITS, ["<STR_LIT>", "<STR_LIT>"], cwd=root,<EOL>hide_stderr=True)<EOL>if rc != <NUM_LIT:0>:<EOL><INDENT>if verbose:<EOL><INDENT>print("<STR_LIT>" % root)<EOL><DEDENT>raise NotThisMethod("<STR_LIT>")<EOL><DEDENT>describe_out, rc = run_command(GITS, ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>" % tag_prefix],<EOL>cwd=root)<EOL>if describe_out is None:<EOL><INDENT>raise NotThisMethod("<STR_LIT>")<EOL><DEDENT>describe_out = describe_out.strip()<EOL>full_out, rc = run_command(GITS, ["<STR_LIT>", "<STR_LIT>"], cwd=root)<EOL>if full_out is None:<EOL><INDENT>raise NotThisMethod("<STR_LIT>")<EOL><DEDENT>full_out = full_out.strip()<EOL>pieces = {}<EOL>pieces["<STR_LIT>"] = full_out<EOL>pieces["<STR_LIT>"] = full_out[:<NUM_LIT:7>]  <EOL>pieces["<STR_LIT:error>"] = None<EOL>git_describe = describe_out<EOL>dirty = git_describe.endswith("<STR_LIT>")<EOL>pieces["<STR_LIT>"] = dirty<EOL>if dirty:<EOL><INDENT>git_describe = git_describe[:git_describe.rindex("<STR_LIT>")]<EOL><DEDENT>if "<STR_LIT:->" in git_describe:<EOL><INDENT>mo = re.search(r'<STR_LIT>', git_describe)<EOL>if not mo:<EOL><INDENT>pieces["<STR_LIT:error>"] = ("<STR_LIT>"<EOL>% describe_out)<EOL>return pieces<EOL><DEDENT>full_tag = mo.group(<NUM_LIT:1>)<EOL>if not full_tag.startswith(tag_prefix):<EOL><INDENT>if verbose:<EOL><INDENT>fmt = "<STR_LIT>"<EOL>print(fmt % (full_tag, tag_prefix))<EOL><DEDENT>pieces["<STR_LIT:error>"] = ("<STR_LIT>"<EOL>% (full_tag, tag_prefix))<EOL>return pieces<EOL><DEDENT>pieces["<STR_LIT>"] = full_tag[len(tag_prefix):]<EOL>pieces["<STR_LIT>"] = int(mo.group(<NUM_LIT:2>))<EOL>pieces["<STR_LIT>"] = mo.group(<NUM_LIT:3>)<EOL><DEDENT>else:<EOL><INDENT>pieces["<STR_LIT>"] = None<EOL>count_out, rc = run_command(GITS, ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>"],<EOL>cwd=root)<EOL>pieces["<STR_LIT>"] = int(count_out)  <EOL><DEDENT>date = run_command(GITS, ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"],<EOL>cwd=root)[<NUM_LIT:0>].strip()<EOL>pieces["<STR_LIT:date>"] = date.strip().replace("<STR_LIT:U+0020>", "<STR_LIT:T>", <NUM_LIT:1>).replace("<STR_LIT:U+0020>", "<STR_LIT>", <NUM_LIT:1>)<EOL>return pieces<EOL>

Get version from 'git describe' in the root of the source tree.

    This only gets called if the git-archive 'subst' keywords were *not*
    expanded, and _version.py hasn't already been rewritten with a short
    version string, meaning we're inside a checked out source tree.


if "<STR_LIT:+>" in pieces.get("<STR_LIT>", "<STR_LIT>"):<EOL><INDENT>return "<STR_LIT:.>"<EOL><DEDENT>return "<STR_LIT:+>"<EOL>

Return a + if we don't already have one, else return a .


if pieces["<STR_LIT>"]:<EOL><INDENT>rendered = pieces["<STR_LIT>"]<EOL>if pieces["<STR_LIT>"] or pieces["<STR_LIT>"]:<EOL><INDENT>rendered += plus_or_dot(pieces)<EOL>rendered += "<STR_LIT>" % (pieces["<STR_LIT>"], pieces["<STR_LIT>"])<EOL>if pieces["<STR_LIT>"]:<EOL><INDENT>rendered += "<STR_LIT>"<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>rendered = "<STR_LIT>" % (pieces["<STR_LIT>"],<EOL>pieces["<STR_LIT>"])<EOL>if pieces["<STR_LIT>"]:<EOL><INDENT>rendered += "<STR_LIT>"<EOL><DEDENT><DEDENT>return rendered<EOL>

Build up version string, with post-release "local version identifier".

    Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
    get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty

    Exceptions:
    1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty]


if pieces["<STR_LIT>"]:<EOL><INDENT>rendered = pieces["<STR_LIT>"]<EOL>if pieces["<STR_LIT>"]:<EOL><INDENT>rendered += "<STR_LIT>" % pieces["<STR_LIT>"]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>rendered = "<STR_LIT>" % pieces["<STR_LIT>"]<EOL><DEDENT>return rendered<EOL>

TAG[.post.devDISTANCE] -- No -dirty.

    Exceptions:
    1: no tags. 0.post.devDISTANCE


if pieces["<STR_LIT>"]:<EOL><INDENT>rendered = pieces["<STR_LIT>"]<EOL>if pieces["<STR_LIT>"] or pieces["<STR_LIT>"]:<EOL><INDENT>rendered += "<STR_LIT>" % pieces["<STR_LIT>"]<EOL>if pieces["<STR_LIT>"]:<EOL><INDENT>rendered += "<STR_LIT>"<EOL><DEDENT>rendered += plus_or_dot(pieces)<EOL>rendered += "<STR_LIT>" % pieces["<STR_LIT>"]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>rendered = "<STR_LIT>" % pieces["<STR_LIT>"]<EOL>if pieces["<STR_LIT>"]:<EOL><INDENT>rendered += "<STR_LIT>"<EOL><DEDENT>rendered += "<STR_LIT>" % pieces["<STR_LIT>"]<EOL><DEDENT>return rendered<EOL>

TAG[.postDISTANCE[.dev0]+gHEX] .

    The ".dev0" means dirty. Note that .dev0 sorts backwards
    (a dirty tree will appear "older" than the corresponding clean one),
    but you shouldn't be releasing software with -dirty anyways.

    Exceptions:
    1: no tags. 0.postDISTANCE[.dev0]


if pieces["<STR_LIT>"]:<EOL><INDENT>rendered = pieces["<STR_LIT>"]<EOL>if pieces["<STR_LIT>"] or pieces["<STR_LIT>"]:<EOL><INDENT>rendered += "<STR_LIT>" % pieces["<STR_LIT>"]<EOL>if pieces["<STR_LIT>"]:<EOL><INDENT>rendered += "<STR_LIT>"<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>rendered = "<STR_LIT>" % pieces["<STR_LIT>"]<EOL>if pieces["<STR_LIT>"]:<EOL><INDENT>rendered += "<STR_LIT>"<EOL><DEDENT><DEDENT>return rendered<EOL>

TAG[.postDISTANCE[.dev0]] .

    The ".dev0" means dirty.

    Eexceptions:
    1: no tags. 0.postDISTANCE[.dev0]


if pieces["<STR_LIT>"]:<EOL><INDENT>rendered = pieces["<STR_LIT>"]<EOL>if pieces["<STR_LIT>"]:<EOL><INDENT>rendered += "<STR_LIT>" % (pieces["<STR_LIT>"], pieces["<STR_LIT>"])<EOL><DEDENT><DEDENT>else:<EOL><INDENT>rendered = pieces["<STR_LIT>"]<EOL><DEDENT>if pieces["<STR_LIT>"]:<EOL><INDENT>rendered += "<STR_LIT>"<EOL><DEDENT>return rendered<EOL>

TAG[-DISTANCE-gHEX][-dirty].

    Like 'git describe --tags --dirty --always'.

    Exceptions:
    1: no tags. HEX[-dirty]  (note: no 'g' prefix)


if pieces["<STR_LIT>"]:<EOL><INDENT>rendered = pieces["<STR_LIT>"]<EOL>rendered += "<STR_LIT>" % (pieces["<STR_LIT>"], pieces["<STR_LIT>"])<EOL><DEDENT>else:<EOL><INDENT>rendered = pieces["<STR_LIT>"]<EOL><DEDENT>if pieces["<STR_LIT>"]:<EOL><INDENT>rendered += "<STR_LIT>"<EOL><DEDENT>return rendered<EOL>

TAG-DISTANCE-gHEX[-dirty].

    Like 'git describe --tags --dirty --always -long'.
    The distance/hash is unconditional.

    Exceptions:
    1: no tags. HEX[-dirty]  (note: no 'g' prefix)


if pieces["<STR_LIT:error>"]:<EOL><INDENT>return {"<STR_LIT:version>": "<STR_LIT>",<EOL>"<STR_LIT>": pieces.get("<STR_LIT>"),<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT:error>": pieces["<STR_LIT:error>"],<EOL>"<STR_LIT:date>": None}<EOL><DEDENT>if not style or style == "<STR_LIT:default>":<EOL><INDENT>style = "<STR_LIT>"  <EOL><DEDENT>if style == "<STR_LIT>":<EOL><INDENT>rendered = render_pep440(pieces)<EOL><DEDENT>elif style == "<STR_LIT>":<EOL><INDENT>rendered = render_pep440_pre(pieces)<EOL><DEDENT>elif style == "<STR_LIT>":<EOL><INDENT>rendered = render_pep440_post(pieces)<EOL><DEDENT>elif style == "<STR_LIT>":<EOL><INDENT>rendered = render_pep440_old(pieces)<EOL><DEDENT>elif style == "<STR_LIT>":<EOL><INDENT>rendered = render_git_describe(pieces)<EOL><DEDENT>elif style == "<STR_LIT>":<EOL><INDENT>rendered = render_git_describe_long(pieces)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % style)<EOL><DEDENT>return {"<STR_LIT:version>": rendered, "<STR_LIT>": pieces["<STR_LIT>"],<EOL>"<STR_LIT>": pieces["<STR_LIT>"], "<STR_LIT:error>": None,<EOL>"<STR_LIT:date>": pieces.get("<STR_LIT:date>")}<EOL>

Render the given version pieces into the requested style.


<EOL>cfg = get_config()<EOL>verbose = cfg.verbose<EOL>try:<EOL><INDENT>return git_versions_from_keywords(get_keywords(), cfg.tag_prefix,<EOL>verbose)<EOL><DEDENT>except NotThisMethod:<EOL><INDENT>pass<EOL><DEDENT>try:<EOL><INDENT>root = os.path.realpath(__file__)<EOL>for i in cfg.versionfile_source.split('<STR_LIT:/>'):<EOL><INDENT>root = os.path.dirname(root)<EOL><DEDENT><DEDENT>except NameError:<EOL><INDENT>return {"<STR_LIT:version>": "<STR_LIT>", "<STR_LIT>": None,<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT:error>": "<STR_LIT>",<EOL>"<STR_LIT:date>": None}<EOL><DEDENT>try:<EOL><INDENT>pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)<EOL>return render(pieces, cfg.style)<EOL><DEDENT>except NotThisMethod:<EOL><INDENT>pass<EOL><DEDENT>try:<EOL><INDENT>if cfg.parentdir_prefix:<EOL><INDENT>return versions_from_parentdir(cfg.parentdir_prefix, root, verbose)<EOL><DEDENT><DEDENT>except NotThisMethod:<EOL><INDENT>pass<EOL><DEDENT>return {"<STR_LIT:version>": "<STR_LIT>", "<STR_LIT>": None,<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT:error>": "<STR_LIT>", "<STR_LIT:date>": None}<EOL>

Get version information or return default if unable to do so.


access_token = os.environ.get(ACCESS_TOKEN_ENVIRONMENT_VARIABLE)<EOL>if access_token:<EOL><INDENT>return access_token<EOL><DEDENT>else:<EOL><INDENT>for access_token_variable in LEGACY_ACCESS_TOKEN_ENVIRONMENT_VARIABLES:<EOL><INDENT>access_token = os.environ.get(access_token_variable)<EOL>if access_token:<EOL><INDENT>env_var_deprecation_warning = PendingDeprecationWarning(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(<EOL>legacy=access_token,<EOL>new=ACCESS_TOKEN_ENVIRONMENT_VARIABLE,<EOL>)<EOL>)<EOL>warnings.warn(env_var_deprecation_warning)<EOL>return access_token<EOL><DEDENT><DEDENT><DEDENT>

Attempt to get the access token from the environment.

    Try using the current and legacy environment variables. If the access token
    is found in a legacy environment variable, raise a deprecation warning.

    Returns:
        The access token found in the environment (str), or None.


def __init__(self, session, object_factory):

check_type(session, RestSession, may_be_none=False)<EOL>super(LicensesAPI, self).__init__()<EOL>self._session = session<EOL>self._object_factory = object_factory<EOL>

Initialize a new LicensesAPI object with the provided RestSession.

        Args:
            session(RestSession): The RESTful session object to be used for
                API calls to the Webex Teams service.

        Raises:
            TypeError: If the input object is not a dictionary or string.


@generator_container<EOL><INDENT>def list(self, orgId=None, **request_parameters):<DEDENT>

check_type(orgId, basestring)<EOL>params = dict_from_items_with_values(<EOL>request_parameters,<EOL>orgId=orgId,<EOL>)<EOL>items = self._session.get_items(API_ENDPOINT, params=params)<EOL>for item in items:<EOL><INDENT>yield self._object_factory(OBJECT_TYPE, item)<EOL><DEDENT>

List all licenses for a given organization.

        If no orgId is specified, the default is the organization of the
        authenticated user.

        Args:
            orgId(basestring): Specify the organization, by ID.
            **request_parameters: Additional request parameters (provides
                support for parameters that may be added in the future).

        Returns:
            GeneratorContainer: A GeneratorContainer which, when iterated,
            yields the licenses returned by the Webex Teams query.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


check_type(licenseId, basestring, may_be_none=False)<EOL>json_data = self._session.get(API_ENDPOINT + '<STR_LIT:/>' + licenseId)<EOL>return self._object_factory(OBJECT_TYPE, json_data)<EOL>

Get the details of a License, by ID.

        Args:
            licenseId(basestring): The ID of the License to be retrieved.

        Returns:
            License: A License object with the details of the requested
            License.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


def __init__(self, base_url, object_factory, single_request_timeout=None):

check_type(base_url, basestring, may_be_none=False)<EOL>check_type(single_request_timeout, int)<EOL>super(AccessTokensAPI, self).__init__()<EOL>self._base_url = str(validate_base_url(base_url))<EOL>self._single_request_timeout = single_request_timeout<EOL>self._endpoint_url = urllib.parse.urljoin(self.base_url, API_ENDPOINT)<EOL>self._request_kwargs = {"<STR_LIT>": single_request_timeout}<EOL>self._object_factory = object_factory<EOL>

Initialize an AccessTokensAPI object with the provided RestSession.

        Args:
            base_url(basestring): The base URL the API endpoints.
            single_request_timeout(int): Timeout in seconds for the API
                requests.

        Raises:
            TypeError: If the parameter types are incorrect.


return self._base_url<EOL>


return self._single_request_timeout<EOL>

Timeout in seconds for the API requests.


def get(self, client_id, client_secret, code, redirect_uri):

check_type(client_id, basestring, may_be_none=False)<EOL>check_type(client_secret, basestring, may_be_none=False)<EOL>check_type(code, basestring, may_be_none=False)<EOL>check_type(redirect_uri, basestring, may_be_none=False)<EOL>post_data = dict_from_items_with_values(<EOL>grant_type="<STR_LIT>",<EOL>client_id=client_id,<EOL>client_secret=client_secret,<EOL>code=code,<EOL>redirect_uri=redirect_uri,<EOL>)<EOL>response = requests.post(self._endpoint_url, data=post_data,<EOL>**self._request_kwargs)<EOL>check_response_code(response, EXPECTED_RESPONSE_CODE['<STR_LIT:POST>'])<EOL>json_data = extract_and_parse_json(response)<EOL>return self._object_factory(OBJECT_TYPE, json_data)<EOL>

Exchange an Authorization Code for an Access Token.

        Exchange an Authorization Code for an Access Token that can be used to
        invoke the APIs.

        Args:
            client_id(basestring): Provided when you created your integration.
            client_secret(basestring): Provided when you created your
                integration.
            code(basestring): The Authorization Code provided by the user
                OAuth process.
            redirect_uri(basestring): The redirect URI used in the user OAuth
                process.

        Returns:
            AccessToken: An AccessToken object with the access token provided
            by the Webex Teams cloud.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


def refresh(self, client_id, client_secret, refresh_token):

check_type(client_id, basestring, may_be_none=False)<EOL>check_type(client_secret, basestring, may_be_none=False)<EOL>check_type(refresh_token, basestring, may_be_none=False)<EOL>post_data = dict_from_items_with_values(<EOL>grant_type="<STR_LIT>",<EOL>client_id=client_id,<EOL>client_secret=client_secret,<EOL>refresh_token=refresh_token,<EOL>)<EOL>response = requests.post(self._endpoint_url, data=post_data,<EOL>**self._request_kwargs)<EOL>check_response_code(response, EXPECTED_RESPONSE_CODE['<STR_LIT:POST>'])<EOL>json_data = extract_and_parse_json(response)<EOL>return self._object_factory(OBJECT_TYPE, json_data)<EOL>

Return a refreshed Access Token from the provided refresh_token.

        Args:
            client_id(basestring): Provided when you created your integration.
            client_secret(basestring): Provided when you created your
                integration.
            refresh_token(basestring): Provided when you requested the Access
                Token.

        Returns:
            AccessToken: With the access token provided by the Webex Teams
            cloud.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


check_type(session, RestSession)<EOL>super(PeopleAPI, self).__init__()<EOL>self._session = session<EOL>self._object_factory = object_factory<EOL>

Initialize a new PeopleAPI object with the provided RestSession.

        Args:
            session(RestSession): The RESTful session object to be used for
                API calls to the Webex Teams service.

        Raises:
            TypeError: If the parameter types are incorrect.


@generator_container<EOL><INDENT>def list(self, email=None, displayName=None, id=None, orgId=None, max=None,<EOL>**request_parameters):<DEDENT>

check_type(id, basestring)<EOL>check_type(email, basestring)<EOL>check_type(displayName, basestring)<EOL>check_type(orgId, basestring)<EOL>check_type(max, int)<EOL>params = dict_from_items_with_values(<EOL>request_parameters,<EOL>id=id,<EOL>email=email,<EOL>displayName=displayName,<EOL>orgId=orgId,<EOL>max=max,<EOL>)<EOL>items = self._session.get_items(API_ENDPOINT, params=params)<EOL>for item in items:<EOL><INDENT>yield self._object_factory(OBJECT_TYPE, item)<EOL><DEDENT>

List people

        This method supports Webex Teams's implementation of RFC5988 Web
        Linking to provide pagination support.  It returns a generator
        container that incrementally yields all people returned by the
        query.  The generator will automatically request additional 'pages' of
        responses from Webex as needed until all responses have been returned.
        The container makes the generator safe for reuse.  A new API call will
        be made, using the same parameters that were specified when the
        generator was created, every time a new iterator is requested from the
        container.

        Args:
            email(basestring): The e-mail address of the person to be found.
            displayName(basestring): The complete or beginning portion of
                the displayName to be searched.
            id(basestring): List people by ID. Accepts up to 85 person IDs
                separated by commas.
            orgId(basestring): The organization ID.
            max(int): Limit the maximum number of items returned from the Webex
                Teams service per request.
            **request_parameters: Additional request parameters (provides
                support for parameters that may be added in the future).

        Returns:
            GeneratorContainer: A GeneratorContainer which, when iterated,
            yields the people returned by the Webex Teams query.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


def create(self, emails, displayName=None, firstName=None, lastName=None,<EOL>avatar=None, orgId=None, roles=None, licenses=None,<EOL>**request_parameters):

check_type(emails, list, may_be_none=False)<EOL>check_type(displayName, basestring)<EOL>check_type(firstName, basestring)<EOL>check_type(lastName, basestring)<EOL>check_type(avatar, basestring)<EOL>check_type(orgId, basestring)<EOL>check_type(roles, list)<EOL>check_type(licenses, list)<EOL>post_data = dict_from_items_with_values(<EOL>request_parameters,<EOL>emails=emails,<EOL>displayName=displayName,<EOL>firstName=firstName,<EOL>lastName=lastName,<EOL>avatar=avatar,<EOL>orgId=orgId,<EOL>roles=roles,<EOL>licenses=licenses,<EOL>)<EOL>json_data = self._session.post(API_ENDPOINT, json=post_data)<EOL>return self._object_factory(OBJECT_TYPE, json_data)<EOL>

Create a new user account for a given organization

        Only an admin can create a new user account.

        Args:
            emails(`list`): Email address(es) of the person (list of strings).
            displayName(basestring): Full name of the person.
            firstName(basestring): First name of the person.
            lastName(basestring): Last name of the person.
            avatar(basestring): URL to the person's avatar in PNG format.
            orgId(basestring): ID of the organization to which this
                person belongs.
            roles(`list`): Roles of the person (list of strings containing
                the role IDs to be assigned to the person).
            licenses(`list`): Licenses allocated to the person (list of
                strings - containing the license IDs to be allocated to the
                person).
            **request_parameters: Additional request parameters (provides
                support for parameters that may be added in the future).

        Returns:
            Person: A Person object with the details of the created person.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


check_type(personId, basestring, may_be_none=False)<EOL>json_data = self._session.get(API_ENDPOINT + '<STR_LIT:/>' + personId)<EOL>return self._object_factory(OBJECT_TYPE, json_data)<EOL>

Get a person's details, by ID.

        Args:
            personId(basestring): The ID of the person to be retrieved.

        Returns:
            Person: A Person object with the details of the requested person.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


def update(self, personId, emails=None, displayName=None, firstName=None,<EOL>lastName=None, avatar=None, orgId=None, roles=None,<EOL>licenses=None, **request_parameters):

check_type(emails, list)<EOL>check_type(displayName, basestring)<EOL>check_type(firstName, basestring)<EOL>check_type(lastName, basestring)<EOL>check_type(avatar, basestring)<EOL>check_type(orgId, basestring)<EOL>check_type(roles, list)<EOL>check_type(licenses, list)<EOL>put_data = dict_from_items_with_values(<EOL>request_parameters,<EOL>emails=emails,<EOL>displayName=displayName,<EOL>firstName=firstName,<EOL>lastName=lastName,<EOL>avatar=avatar,<EOL>orgId=orgId,<EOL>roles=roles,<EOL>licenses=licenses,<EOL>)<EOL>json_data = self._session.put(API_ENDPOINT + '<STR_LIT:/>' + personId,<EOL>json=put_data)<EOL>return self._object_factory(OBJECT_TYPE, json_data)<EOL>

Update details for a person, by ID.

        Only an admin can update a person's details.

        Email addresses for a person cannot be changed via the Webex Teams API.

        Include all details for the person. This action expects all user
        details to be present in the request. A common approach is to first GET
        the person's details, make changes, then PUT both the changed and
        unchanged values.

        Args:
            personId(basestring): The person ID.
            emails(`list`): Email address(es) of the person (list of strings).
            displayName(basestring): Full name of the person.
            firstName(basestring): First name of the person.
            lastName(basestring): Last name of the person.
            avatar(basestring): URL to the person's avatar in PNG format.
            orgId(basestring): ID of the organization to which this
                person belongs.
            roles(`list`): Roles of the person (list of strings containing
                the role IDs to be assigned to the person).
            licenses(`list`): Licenses allocated to the person (list of
                strings - containing the license IDs to be allocated to the
                person).
            **request_parameters: Additional request parameters (provides
                support for parameters that may be added in the future).

        Returns:
            Person: A Person object with the updated details.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


check_type(personId, basestring, may_be_none=False)<EOL>self._session.delete(API_ENDPOINT + '<STR_LIT:/>' + personId)<EOL>

Remove a person from the system.

        Only an admin can remove a person.

        Args:
            personId(basestring): The ID of the person to be deleted.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


<EOL>json_data = self._session.get(API_ENDPOINT + '<STR_LIT>')<EOL>return self._object_factory(OBJECT_TYPE, json_data)<EOL>

Get the details of the person accessing the API.

        Raises:
            ApiError: If the Webex Teams cloud returns an error.


check_type(session, RestSession)<EOL>super(TeamMembershipsAPI, self).__init__()<EOL>self._session = session<EOL>self._object_factory = object_factory<EOL>

Init a new TeamMembershipsAPI object with the provided RestSession.

        Args:
            session(RestSession): The RESTful session object to be used for
                API calls to the Webex Teams service.

        Raises:
            TypeError: If the parameter types are incorrect.


@generator_container<EOL><INDENT>def list(self, teamId, max=None, **request_parameters):<DEDENT>

check_type(teamId, basestring, may_be_none=False)<EOL>check_type(max, int)<EOL>params = dict_from_items_with_values(<EOL>request_parameters,<EOL>teamId=teamId,<EOL>max=max,<EOL>)<EOL>items = self._session.get_items(API_ENDPOINT, params=params)<EOL>for item in items:<EOL><INDENT>yield self._object_factory(OBJECT_TYPE, item)<EOL><DEDENT>

List team memberships for a team, by ID.

        This method supports Webex Teams's implementation of RFC5988 Web
        Linking to provide pagination support.  It returns a generator
        container that incrementally yields all team memberships returned by
        the query.  The generator will automatically request additional 'pages'
        of responses from Webex as needed until all responses have been
        returned. The container makes the generator safe for reuse.  A new API
        call will be made, using the same parameters that were specified when
        the generator was created, every time a new iterator is requested from
        the container.

        Args:
            teamId(basestring): List team memberships for a team, by ID.
            max(int): Limit the maximum number of items returned from the Webex
                Teams service per request.
            **request_parameters: Additional request parameters (provides
                support for parameters that may be added in the future).

        Returns:
            GeneratorContainer: A GeneratorContainer which, when iterated,
            yields the team memberships returned by the Webex Teams query.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


def create(self, teamId, personId=None, personEmail=None,<EOL>isModerator=False, **request_parameters):

check_type(teamId, basestring, may_be_none=False)<EOL>check_type(personId, basestring)<EOL>check_type(personEmail, basestring)<EOL>check_type(isModerator, bool)<EOL>post_data = dict_from_items_with_values(<EOL>request_parameters,<EOL>teamId=teamId,<EOL>personId=personId,<EOL>personEmail=personEmail,<EOL>isModerator=isModerator,<EOL>)<EOL>json_data = self._session.post(API_ENDPOINT, json=post_data)<EOL>return self._object_factory(OBJECT_TYPE, json_data)<EOL>

Add someone to a team by Person ID or email address.

        Add someone to a team by Person ID or email address; optionally making
        them a moderator.

        Args:
            teamId(basestring): The team ID.
            personId(basestring): The person ID.
            personEmail(basestring): The email address of the person.
            isModerator(bool): Set to True to make the person a team moderator.
            **request_parameters: Additional request parameters (provides
                support for parameters that may be added in the future).

        Returns:
            TeamMembership: A TeamMembership object with the details of the
            created team membership.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


check_type(membershipId, basestring, may_be_none=False)<EOL>json_data = self._session.get(API_ENDPOINT + '<STR_LIT:/>' + membershipId)<EOL>return self._object_factory(OBJECT_TYPE, json_data)<EOL>

Get details for a team membership, by ID.

        Args:
            membershipId(basestring): The team membership ID.

        Returns:
            TeamMembership: A TeamMembership object with the details of the
            requested team membership.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


def update(self, membershipId, isModerator=None, **request_parameters):

check_type(membershipId, basestring, may_be_none=False)<EOL>check_type(isModerator, bool)<EOL>put_data = dict_from_items_with_values(<EOL>request_parameters,<EOL>isModerator=isModerator,<EOL>)<EOL>json_data = self._session.put(API_ENDPOINT + '<STR_LIT:/>' + membershipId,<EOL>json=put_data)<EOL>return self._object_factory(OBJECT_TYPE, json_data)<EOL>

Update a team membership, by ID.

        Args:
            membershipId(basestring): The team membership ID.
            isModerator(bool): Set to True to make the person a team moderator.
            **request_parameters: Additional request parameters (provides
                support for parameters that may be added in the future).

        Returns:
            TeamMembership: A TeamMembership object with the updated Webex
            Teams team-membership details.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


check_type(membershipId, basestring, may_be_none=False)<EOL>self._session.delete(API_ENDPOINT + '<STR_LIT:/>' + membershipId)<EOL>

Delete a team membership, by ID.

        Args:
            membershipId(basestring): The team membership ID.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


check_type(session, RestSession, may_be_none=False)<EOL>super(MessagesAPI, self).__init__()<EOL>self._session = session<EOL>self._object_factory = object_factory<EOL>

Init a new MessagesAPI object with the provided RestSession.

        Args:
            session(RestSession): The RESTful session object to be used for
                API calls to the Webex Teams service.

        Raises:
            TypeError: If the parameter types are incorrect.


@generator_container<EOL><INDENT>def list(self, roomId, mentionedPeople=None, before=None,<EOL>beforeMessage=None, max=None, **request_parameters):<DEDENT>

check_type(roomId, basestring, may_be_none=False)<EOL>check_type(mentionedPeople, basestring)<EOL>check_type(before, basestring)<EOL>check_type(beforeMessage, basestring)<EOL>check_type(max, int)<EOL>params = dict_from_items_with_values(<EOL>request_parameters,<EOL>roomId=roomId,<EOL>mentionedPeople=mentionedPeople,<EOL>before=before,<EOL>beforeMessage=beforeMessage,<EOL>max=max,<EOL>)<EOL>items = self._session.get_items(API_ENDPOINT, params=params)<EOL>for item in items:<EOL><INDENT>yield self._object_factory(OBJECT_TYPE, item)<EOL><DEDENT>

Lists messages in a room.

        Each message will include content attachments if present.

        The list API sorts the messages in descending order by creation date.

        This method supports Webex Teams's implementation of RFC5988 Web
        Linking to provide pagination support.  It returns a generator
        container that incrementally yields all messages returned by the
        query.  The generator will automatically request additional 'pages' of
        responses from Webex as needed until all responses have been returned.
        The container makes the generator safe for reuse.  A new API call will
        be made, using the same parameters that were specified when the
        generator was created, every time a new iterator is requested from the
        container.

        Args:
            roomId(basestring): List messages for a room, by ID.
            mentionedPeople(basestring): List messages where the caller is
                mentioned by specifying "me" or the caller `personId`.
            before(basestring): List messages sent before a date and time, in
                ISO8601 format.
            beforeMessage(basestring): List messages sent before a message,
                by ID.
            max(int): Limit the maximum number of items returned from the Webex
                Teams service per request.
            **request_parameters: Additional request parameters (provides
                support for parameters that may be added in the future).

        Returns:
            GeneratorContainer: A GeneratorContainer which, when iterated,
            yields the messages returned by the Webex Teams query.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


def create(self, roomId=None, toPersonId=None, toPersonEmail=None,<EOL>text=None, markdown=None, files=None, **request_parameters):

check_type(roomId, basestring)<EOL>check_type(toPersonId, basestring)<EOL>check_type(toPersonEmail, basestring)<EOL>check_type(text, basestring)<EOL>check_type(markdown, basestring)<EOL>check_type(files, list)<EOL>if files:<EOL><INDENT>if len(files) != <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>check_type(files[<NUM_LIT:0>], basestring)<EOL><DEDENT>post_data = dict_from_items_with_values(<EOL>request_parameters,<EOL>roomId=roomId,<EOL>toPersonId=toPersonId,<EOL>toPersonEmail=toPersonEmail,<EOL>text=text,<EOL>markdown=markdown,<EOL>files=files,<EOL>)<EOL>if not files or is_web_url(files[<NUM_LIT:0>]):<EOL><INDENT>json_data = self._session.post(API_ENDPOINT, json=post_data)<EOL><DEDENT>elif is_local_file(files[<NUM_LIT:0>]):<EOL><INDENT>try:<EOL><INDENT>post_data['<STR_LIT>'] = open_local_file(files[<NUM_LIT:0>])<EOL>multipart_data = MultipartEncoder(post_data)<EOL>headers = {'<STR_LIT>': multipart_data.content_type}<EOL>json_data = self._session.post(API_ENDPOINT,<EOL>headers=headers,<EOL>data=multipart_data)<EOL><DEDENT>finally:<EOL><INDENT>post_data['<STR_LIT>'].file_object.close()<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>return self._object_factory(OBJECT_TYPE, json_data)<EOL>

Post a message, and optionally a attachment, to a room.

        The files parameter is a list, which accepts multiple values to allow
        for future expansion, but currently only one file may be included with
        the message.

        Args:
            roomId(basestring): The room ID.
            toPersonId(basestring): The ID of the recipient when sending a
                private 1:1 message.
            toPersonEmail(basestring): The email address of the recipient when
                sending a private 1:1 message.
            text(basestring): The message, in plain text. If `markdown` is
                specified this parameter may be optionally used to provide
                alternate text for UI clients that do not support rich text.
            markdown(basestring): The message, in markdown format.
            files(`list`): A list of public URL(s) or local path(s) to files to
                be posted into the room. Only one file is allowed per message.
            **request_parameters: Additional request parameters (provides
                support for parameters that may be added in the future).

        Returns:
            Message: A Message object with the details of the created message.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.
            ValueError: If the files parameter is a list of length > 1, or if
                the string in the list (the only element in the list) does not
                contain a valid URL or path to a local file.


check_type(messageId, basestring, may_be_none=False)<EOL>json_data = self._session.get(API_ENDPOINT + '<STR_LIT:/>' + messageId)<EOL>return self._object_factory(OBJECT_TYPE, json_data)<EOL>

Get the details of a message, by ID.

        Args:
            messageId(basestring): The ID of the message to be retrieved.

        Returns:
            Message: A Message object with the details of the requested
            message.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


check_type(messageId, basestring, may_be_none=False)<EOL>self._session.delete(API_ENDPOINT + '<STR_LIT:/>' + messageId)<EOL>

Delete a message.

        Args:
            messageId(basestring): The ID of the message to be deleted.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


check_type(session, RestSession, may_be_none=False)<EOL>super(RolesAPI, self).__init__()<EOL>self._session = session<EOL>self._object_factory = object_factory<EOL>

Initialize a new RolesAPI object with the provided RestSession.

        Args:
            session(RestSession): The RESTful session object to be used for
                API calls to the Webex Teams service.

        Raises:
            TypeError: If the parameter types are incorrect.


<EOL>items = self._session.get_items(<EOL>API_ENDPOINT,<EOL>params=request_parameters<EOL>)<EOL>for item in items:<EOL><INDENT>yield self._object_factory(OBJECT_TYPE, item)<EOL><DEDENT>

List all roles.

        Args:
            **request_parameters: Additional request parameters (provides
                support for parameters that may be added in the future).

        Returns:
            GeneratorContainer: A GeneratorContainer which, when iterated,
            yields the roles returned by the Webex Teams query.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


check_type(roleId, basestring, may_be_none=False)<EOL>json_data = self._session.get(API_ENDPOINT + '<STR_LIT:/>' + roleId)<EOL>return self._object_factory(OBJECT_TYPE, json_data)<EOL>

Get the details of a Role, by ID.

        Args:
            roleId(basestring): The ID of the Role to be retrieved.

        Returns:
            Role: A Role object with the details of the requested Role.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


check_type(session, RestSession)<EOL>super(WebhooksAPI, self).__init__()<EOL>self._session = session<EOL>self._object_factory = object_factory<EOL>

Initialize a new WebhooksAPI object with the provided RestSession.

        Args:
            session(RestSession): The RESTful session object to be used for
                API calls to the Webex Teams service.

        Raises:
            TypeError: If the parameter types are incorrect.