desc
stringlengths
3
26.7k
decl
stringlengths
11
7.89k
bodies
stringlengths
8
553k
'Regression test for #834.'
def test_filter_with_get_queryset_only(self):
view = GetQuerysetView.as_view() request = factory.get(u'/get-queryset/') view(request).render()
'GET requests to filtered ListCreateAPIView that have a filter_class set should return filtered results.'
def test_get_filtered_class_root_view(self):
view = FilterClassRootView.as_view() request = factory.get(u'/') response = view(request).render() self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response.data, self.data) search_decimal = Decimal(u'4.25') request = factory.get(u'/', {u'decimal': (u'%s' % search_...
'An error should be displayed when the filter class is misconfigured.'
def test_incorrectly_configured_filter(self):
view = IncorrectlyConfiguredRootView.as_view() request = factory.get(u'/') self.assertRaises(AssertionError, view, request)
'The `get_filter_class` model checks should allow base model filters.'
def test_base_model_filter(self):
view = BaseFilterableItemFilterRootView.as_view() request = factory.get(u'/?text=aaa') response = view(request).render() self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(len(response.data), 1)
'GET requests with filters that aren\'t configured should return 200.'
def test_unknown_filter(self):
view = FilterFieldsRootView.as_view() search_integer = 10 request = factory.get(u'/', {u'integer': (u'%s' % search_integer)}) response = view(request).render() self.assertEqual(response.status_code, status.HTTP_200_OK)
'Make sure response renders w/ backend'
def test_html_rendering(self):
view = FilterFieldsRootView.as_view() request = factory.get(u'/') request.META[u'HTTP_ACCEPT'] = u'text/html' response = view(request).render() self.assertEqual(response.status_code, status.HTTP_200_OK)
'Ensure validation errors return a proper error response instead of an internal server error.'
@override_settings(FILTERS_STRICTNESS=STRICTNESS.RAISE_VALIDATION_ERROR) def test_strictness_validation_error(self):
view = FilterFieldsRootView.as_view() request = factory.get(u'/?decimal=foobar') response = view(request).render() self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertEqual(response.data, {u'decimal': [u'Enter a number.']})
'GET requests to filtered RetrieveAPIView that have a filter_class set should return filtered results.'
def test_get_filtered_detail_view(self):
item = self.objects.all()[0] data = self._serialize_object(item) response = self.client.get(self._get_url(item)) self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response.data, data) search_decimal = Decimal(u'4.25') high_item = self.objects.filter(decimal__gt=sear...
'Tests that a filter with `conjoined=True` returns objects that have all the values included in `value`. For example filter users that have all of this books.'
def test_filter_conjoined_true(self):
book_kwargs = {u'price': 1, u'average_rating': 1} books = [] books.append(Book.objects.create(**book_kwargs)) books.append(Book.objects.create(**book_kwargs)) books.append(Book.objects.create(**book_kwargs)) books.append(Book.objects.create(**book_kwargs)) books.append(Book.objects.create(**...
'Tests that a filter with `conjoined=True` returns objects that have all the values included in `value`. For example filter users that have all of this books.'
def test_filter_conjoined_true(self):
book_kwargs = {u'price': 1, u'average_rating': 1} books = [] books.append(Book.objects.create(**book_kwargs)) books.append(Book.objects.create(**book_kwargs)) books.append(Book.objects.create(**book_kwargs)) books.append(Book.objects.create(**book_kwargs)) books.append(Book.objects.create(**...
'Check that the standard query terms can be correctly resolved. eg, an \'EXACT\' lookup on a user\'s username'
def test_resolve_plain_lookups(self):
model_field = User._meta.get_field('username') lookups = model_field.class_lookups.keys() for term in lookups: (field, lookup) = resolve_field(model_field, term) self.assertIsInstance(field, models.CharField) self.assertEqual(lookup, term)
'Check that lookups can be resolved for related fields in the forwards direction.'
def test_resolve_forward_related_lookups(self):
lookups = ['exact', 'gte', 'gt', 'lte', 'lt', 'in', 'isnull'] model_field = Article._meta.get_field('author') for term in lookups: (field, lookup) = resolve_field(model_field, term) self.assertIsInstance(field, models.ForeignKey) self.assertEqual(lookup, term) model_field = User....
'Check that lookups can be resolved for related fields in the reverse direction.'
@unittest.skipIf((django.VERSION < (1, 9)), 'version does not reverse lookups') def test_resolve_reverse_related_lookups(self):
lookups = ['exact', 'gte', 'gt', 'lte', 'lt', 'in', 'isnull'] model_field = User._meta.get_field('article') for term in lookups: (field, lookup) = resolve_field(model_field, term) self.assertIsInstance(field, models.ManyToOneRel) self.assertEqual(lookup, term) model_field = Book....
'Check that chained field transforms are correctly resolved. eg, a \'date__year__gte\' lookup on an article\'s \'published\' timestamp.'
@unittest.skipIf((django.VERSION < (1, 9)), 'version does not support transformed lookup expressions') def test_resolve_transformed_lookups(self):
model_field = Article._meta.get_field('published') standard_lookups = ['exact', 'iexact', 'gte', 'gt', 'lte', 'lt'] date_lookups = ['year', 'month', 'day', 'week_day'] datetime_lookups = (date_lookups + ['hour', 'minute', 'second']) for lookup in standard_lookups: (field, resolved_lookup) = ...
'pretty representation of the table: columns then rows'
def __repr__(self):
return ((str(self.columns) + '\n') + '\n'.join(map(str, self.rows)))
'delete all rows matching predicate or all rows if no predicate supplied'
def delete(self, predicate=(lambda row: True)):
self.rows = [row for row in self.rows if (not predicate(row))]
'return only the rows that satisfy the supplied predicate'
def where(self, predicate=(lambda row: True)):
where_table = Table(self.columns) where_table.rows = filter(predicate, self.rows) return where_table
'return only the first num_rows rows'
def limit(self, num_rows=None):
limit_table = Table(self.columns) limit_table.rows = (self.rows[:num_rows] if (num_rows is not None) else self.rows) return limit_table
'what do we do when twitter sends us data? here data will be a Python object representing a tweet'
def on_success(self, data):
if (data['lang'] == 'en'): tweets.append(data) if (len(tweets) >= 1000): self.disconnect()
'return the index of the cluster closest to the input'
def classify(self, input):
return min(range(self.k), key=(lambda i: squared_distance(input, self.means[i])))
'pretty representation of the table: columns then rows'
def __repr__(self):
return ((str(self.columns) + '\n') + '\n'.join(map(str, self.rows)))
'delete all rows matching predicate or all rows if no predicate supplied'
def delete(self, predicate=(lambda row: True)):
self.rows = [row for row in self.rows if (not predicate(row))]
'return only the rows that satisfy the supplied predicate'
def where(self, predicate=(lambda row: True)):
where_table = Table(self.columns) where_table.rows = list(filter(predicate, self.rows)) return where_table
'return only the first num_rows rows'
def limit(self, num_rows=None):
limit_table = Table(self.columns) limit_table.rows = (self.rows[:num_rows] if (num_rows is not None) else self.rows) return limit_table
'what do we do when twitter sends us data? here data will be a Python object representing a tweet'
def on_success(self, data):
if (data['lang'] == 'en'): tweets.append(data) if (len(tweets) >= 1000): self.disconnect()
'return the index of the cluster closest to the input'
def classify(self, input):
return min(range(self.k), key=(lambda i: squared_distance(input, self.means[i])))
'Plain copy'
@staticmethod def copy(field_name, source, **kwargs):
return source[field_name]
'Populate aux table from the main table'
@staticmethod def main(field_name, source, **kwargs):
return source[field_name]
'Capitalize'
@staticmethod def Main(field_name, source, **kwargs):
return source[field_name].capitalize()
'Craft an identifier from the \'identifier\' or \'name\' column'
@staticmethod def ident(source, **kwargs):
return name2ident(source.get('identifier', source.get('name')))
'Capitalize the name (or identifier) column'
@staticmethod def Name(source, **kwargs):
name = source.get('name', source.get('identifier', None)) name = ' '.join((word.capitalize() for word in name.split(' '))) return name
'Capitalize the identifier column'
@staticmethod def f_id(source, **kwargs):
return source['identifier'].capitalize()
'Get the original name'
@staticmethod def name(source, **kwargs):
return source['name']
'Assign a new "auto-incremented" id'
@staticmethod def newid(i, source, **kwargs):
source['id'] = i return i
'Assign the value for English -- unless it\'s Japanese'
@staticmethod def en(source, **kwargs):
if (source.get('version_group_id', None) == str(bw_version_group_id)): return japanese_id return english_id
'The original table\'s id'
@staticmethod def srcid(source, field_name, **kwargs):
try: return source['id'] except KeyError: if (field_name == 'pokemon_form_group_id'): return source['pokemon_id'] else: raise
'Returns the string as HTML. Pass a custom `extension` to use your own extension object to generate links. The default is the session\'s markdown_extension. Usually that\'s a `PokedexLinkExtension` described below, which is also the recommended superclass.'
def as_html(self, extension=None):
if (extension is None): extension = self.session.markdown_extension md = markdown.Markdown(extensions=['extra', extension], safe_mode='escape', output_format='xhtml1') return md.convert(self.source_text)
'Returns the string in a plaintext-friendly form. Currently there are no tunable parameters'
def as_text(self):
link_maker = PokedexLinkExtension(self.session) pattern = PokedexLinkPattern(link_maker, self.session, self.language) regex = ('()%s()' % pattern.regex) def handleMatch(m): return pattern.handleMatch(m).text return re.sub(regex, handleMatch, self.source_text)
'Make an <a> element Override this to set custom attributes, e.g. title.'
def make_link(self, category, obj, url, text):
el = etree.Element('a') el.set('href', url) el.text = AtomicString(text) return el
'Return the URL for the given {category:identifier} link. For ORM objects, object_url is tried first. Returns None by default, which causes <span> to be used in place of <a>. This method is also called for non-existent objects, e.g. []{pokemon:bogus}.'
def identifier_url(self, category, identifier):
return None
'Passes the new default language id through to the current session.'
@property def default_language_id(self):
return self.registry().default_language_id
'Be as useful as possible. Show the primary key, and an identifier if we\'ve got one.'
def __unicode__(self):
typename = u'.'.join((__name__, type(self).__name__)) pk_constraint = self.__table__.primary_key if (not pk_constraint): return (u'<%s object at %x>' % (typename, id(self))) pk = u', '.join((six.text_type(getattr(self, column.name)) for column in pk_constraint.columns)) try: ...
'Return the move\'s in-game power rating as a number of stars.'
@property def star_rating(self):
if (not self.power): return 0 else: stars = ((self.power - 1) // 10) stars = min(stars, 5) stars = max(stars, 1) return stars
'True if the item appears underground, as specified by the appropriate flag.'
@property def appears_underground(self):
return any(((flag.identifier == u'underground') for flag in self.flags))
'True if this machine is a HM, False if it\'s a TM.'
@property def is_hm(self):
return (self.machine_number >= 100)
'Recoil damage or HP drain; the opposite of `drain`.'
@hybrid_property def recoil(self):
return (- self.drain)
'Merge two messages, as required for flavor text summarizing'
def merge(self, other):
assert (self.merge_key == other.merge_key) for string in other.strings: if (string not in self.strings): self.strings.append(string) self.colsize = (self.colsize or other.colsize) self.pot = (self.pot or other.pot) self.source = None self.source_crc = None self.number_rep...
'All source (i.e. English) messages'
@property def source(self):
return self.official_messages(self.source_lang)
'All official messages (i.e. from main database) for the given lang'
def official_messages(self, lang):
lang_id = self.language_ids[lang] try: return self._sources[lang_id] except AttributeError: self._sources = {} for message in self.yield_source_messages(): self._sources.setdefault(message.language_id, []).append(message) self._sources = dict(((k, tuple(merge_adja...
'Write a translation CSV containing messages from streams. Streams should be ordered by priority, from highest to lowest. Any official translations (from the main database) are added automatically.'
def write_translations(self, lang, *streams):
writer = self.writer_for_lang(lang) writer.writerow('language_id table id column source_crc string'.split()) messages = merge_translations(self.source, self.official_messages(lang), *streams) warnings = {} for (source, sourcehash, string, exact) in messages: if (string and (so...
'Yield all messages from source CSV files Messages from all languages are returned. The messages are not ordered properly, but splitting the stream by language (and filtering results by merge_adjacent) will produce proper streams.'
def yield_source_messages(self, language_id=None):
if (language_id is None): language_id = self.source_lang_id for cls in sorted(toplevel_classes, key=(lambda c: c.__name__)): streams = [] for translation_class in cls.translation_classes: streams.append(yield_source_csv_messages(translation_class, cls, self.reader_for_class(t...
'Yield messages from the data/csv/translations/<lang>.csv file'
def yield_target_messages(self, lang):
path = os.path.join(self.csv_directory, 'translations', ('%s.csv' % lang)) try: file = open(path, 'r') except IOError: return () return yield_translation_csv_messages(file)
'Yield (translation_class, data for INSERT) pairs for loading into the DB langs is either a list of language identifiers or None'
def get_load_data(self, langs=None):
if (langs is None): langs = self.language_identifiers.values() stream = Merge() for lang in self.language_identifiers.values(): stream.add_iterator(self.yield_target_messages(lang)) stream = (message for message in stream if (not message.official)) count = 0 class GroupDict(dict,...
'Dummy object should identify itself as False.'
def __nonzero__(self):
return False
'Python 3000 version of the above. Future-proofing rules!'
def __bool__(self):
return False
'Opens the whoosh index stored in the named directory. If the index doesn\'t already exist, it will be created. `directory` Directory containing the index. Defaults to a location within the `pokedex` egg directory. `session` Used for creating the index and retrieving objects. Defaults to an attempt to connect to the...
def __init__(self, directory=None, session=None):
if (directory is None): directory = get_default_index_dir() self.directory = directory if session: self.session = session else: self.session = connect() if ((not os.path.exists(directory)) or (not os.listdir(directory))): self.index = UninitializedIndex() retu...
'Creates the index from scratch.'
def rebuild_index(self):
schema = whoosh.fields.Schema(name=whoosh.fields.ID(sortable=True, stored=True, spelling=True), table=whoosh.fields.ID(sortable=True, stored=True), row_id=whoosh.fields.ID(sortable=True, stored=True), language=whoosh.fields.STORED, iso639=whoosh.fields.ID(sortable=True, stored=True), iso3166=whoosh.fields.ID(sortab...
'Strips irrelevant formatting junk from name input. Specifically: everything is lowercased, and accents are removed.'
def normalize_name(self, name):
nkfd_form = unicodedata.normalize('NFKD', text_type(name)) name = u''.join((c for c in nkfd_form if (unicodedata.category(c) != 'Mn'))) name = unicodedata.normalize('NFC', name) name = name.strip() name = name.lower() return name
'Combines the enforced `valid_types` with any from the search string itself and updates the query. For example, a name of \'a,b:foo\' and valid_types of b,c will search for only `b`s named "foo". Returns `(name, merged_valid_types, term)`, where `name` has had any type prefix stripped, `merged_valid_types` combines the...
def _apply_valid_types(self, name, valid_types):
user_valid_types = [] if (':' in name): (prefix_chunk, name) = name.split(':', 1) name = name.strip() prefixes = prefix_chunk.split(',') user_valid_types = [] for prefix in prefixes: prefix = prefix.strip() if prefix: user_valid_typ...
'Takes a singular table name, table name, or table object and returns the table name. Returns None for a bogus name.'
def _parse_table_name(self, name):
if hasattr(name, '__tablename__'): return getattr(name, '__tablename__') for table in self.indexed_tables.values(): if (name in (table.__tablename__, table.__singlename__)): return table.__tablename__ return None
'Converts a list of whoosh\'s indexed records to LookupResult tuples containing database objects.'
def _whoosh_records_to_results(self, records, exact=True):
languages = dict(((row.identifier, row) for row in self.session.query(tables.Language))) seen = {} results = [] for record in records: seen_key = (record['table'], record['row_id']) if (seen_key in seen): continue seen[seen_key] = True cls = self.indexed_table...
'Returns the session\'s current default language, as an ORM row.'
def _get_current_locale(self):
return self.session.query(tables.Language).get(self.session.default_language_id)
'Attempts to find some sort of object, given a name. Returns a list of named (object, name, language, iso639, iso3166, exact) tuples. `object` is a database object, `name` is the name under which the object was found, `language` and the two isos are the name and country codes of the language in which the name was foun...
def lookup(self, input, valid_types=[], exact_only=False):
name = self.normalize_name(input) exact = True (name, merged_valid_types, type_term) = self._apply_valid_types(name, valid_types) if (name == 'random'): return self.random_lookup(valid_types=merged_valid_types) try: name_as_number = int(name, base=0) except ValueError: na...
'Returns a random lookup result from one of the provided `valid_types`.'
def random_lookup(self, valid_types=[]):
table_names = [] for valid_type in valid_types: table_name = self._parse_table_name(valid_type) if (table_name and (table_name != 'pokemon_forms')): table_names.append(table_name) if (not table_names): table_names = list(self.indexed_tables) table_names.remove('po...
'Returns terms starting with the given exact prefix. Type prefixes are recognized, but no other name munging is done.'
def prefix_lookup(self, prefix, valid_types=[]):
(prefix, merged_valid_types, type_term) = self._apply_valid_types(prefix, valid_types) query = whoosh.query.Prefix(u'name', self.normalize_name(prefix)) if type_term: query = (query & type_term) locale = self._get_current_locale() searcher = self.index.searcher() facet = LanguageFacet(lo...
'Open this file for reading, in the appropriate mode (i.e. binary)'
def open(self):
return open(self.path, 'rb')
'Get a main sprite sprite for a pokemon. Everything except version should be given as a keyword argument. Either specify version as an ORM object, or give the version path as a string (which is the only way to get \'red-green\'). Leave the default for the latest version. animated: get a GIF animation (currently Crystal...
def sprite(self, version='black-white', animated=False, back=False, color=None, shiny=False, female=False, frame=None, strict=False):
if isinstance(version, six.string_types): version_dir = version try: (generation, info) = self._pokemon_sprite_info[version_dir] except KeyError: raise ValueError('Version directory %s not found', version_dir) else: version_dir = version.identi...
'Get the Pokemon\'s menu icon'
def icon(self, female=False, strict=False):
return self._maybe_female(['icons'], female, strict)
'Get the Pokemon\'s official art, drawn by Ken Sugimori'
def sugimori(self, female=False, strict=False):
return self._maybe_female(['sugimori'], female, strict)
'Get an overworld sprite direction: \'up\', \'down\', \'left\', or \'right\' shiny: true for a shiny sprite female: true for female sprite (or the common one for both M & F) frame: 2 for the second animation frame strict: disable fallback for `female`'
def overworld(self, direction='down', shiny=False, female=False, frame=1, strict=False):
path_elements = ['overworld'] if shiny: path_elements.append('shiny') if female: if self.has_gender_differences: path_elements.append('female') elif strict: raise ValueError('No female overworld sprite') else: female = False pa...
'Get the Pokemon\'s footprint'
def footprint(self, strict=False):
return self._get_file(['footprints'], '.png', strict=strict)
'Get the Pokemon\'s animated Trozei sprite'
def trozei(self, strict=False):
return self._get_file(['trozei'], '.gif', strict=strict)
'Get the Pokemon\'s cry'
def cry(self, strict=False):
return self._get_file(['cries'], '.ogg', strict=strict)
'Get the Pokemon\'s cropped sprite'
def cropped_sprite(self, strict=False):
return self._get_file(['cropped'], '.png', strict=strict)
'Get the item\'s sprite as it appears in the Sinnoh underground Rotation can be 0, 90, 180, or 270.'
def underground(self, rotation=0):
if rotation: basename = (self.identifier + ('-%s' % rotation)) else: basename = self.identifier return self.from_path_elements(['underground'], basename, '.png')
'Get the item\'s sprite If version is not given, use the latest version.'
def sprite(self, version=None):
identifier = self.identifier if identifier.startswith(('tm', 'hm')): try: int(identifier[2:]) except ValueError: pass else: machines = self.item.machines if version: try: machine = [m for m in machines if...
'Get the item\'s sprite as it appears in the Sinnoh underground Rotation can be 0, 90, 180, or 270.'
def underground(self, rotation=0):
if (not self.item.appears_underground): raise ValueError(("%s doesn't appear underground" % self.identifier)) return super(ItemMedia, self).underground(rotation=rotation)
'Get a berry\'s big sprite'
def berry_image(self):
if (not self.item.berry): raise ValueError(('%s is not a berry' % self.identifier)) return self.from_path_elements(['berries'], self.identifier, '.png')
'Create a Romanizer parent: A LookupTables to base this one on tables: Dicts that become the object\'s attributes. If a parent is given, its tables are used, and updated with the given ones'
def __init__(self, parent=None, **tables):
self.parent = parent if parent: self.tables = parent.tables for (name, table) in tables.items(): self.tables[name] = dict(self.tables[name]) self.tables[name].update(table) else: self.tables = tables for (name, table) in self.tables.items(): setatt...
'Convert a string of kana to roomaji.'
def romanize(self, string):
vowels = ['a', 'e', 'i', 'o', 'u', 'y'] characters = [] last_kana = None last_char = None for char in string: if (65281 <= ord(char) <= 65374): if (last_kana == 'sokuon'): raise ValueError('Sokuon cannot precede Latin characters.') char = c...
'Module depends on the API version: * 2017-03-01: :mod:`v2017_03_01.models<azure.mgmt.containerregistry.v2017_03_01.models>` * 2017-06-01-preview: :mod:`v2017_06_01_preview.models<azure.mgmt.containerregistry.v2017_06_01_preview.models>`'
@classmethod def models(cls, api_version=DEFAULT_API_VERSION):
if (api_version == '2017-03-01'): from .v2017_03_01 import models return models elif (api_version == '2017-06-01-preview'): from .v2017_06_01_preview import models return models raise NotImplementedError('APIVersion {} is not available'.format(api_version))
'Instance depends on the API version: * 2017-03-01: :class:`Operations<azure.mgmt.containerregistry.v2017_03_01.operations.Operations>` * 2017-06-01-preview: :class:`Operations<azure.mgmt.containerregistry.v2017_06_01_preview.operations.Operations>`'
@property def operations(self):
if (self.api_version == '2017-03-01'): from .v2017_03_01.operations import Operations as OperationClass elif (self.api_version == '2017-06-01-preview'): from .v2017_06_01_preview.operations import Operations as OperationClass else: raise NotImplementedError('APIVersion {} is ...
'Instance depends on the API version: * 2017-03-01: :class:`RegistriesOperations<azure.mgmt.containerregistry.v2017_03_01.operations.RegistriesOperations>` * 2017-06-01-preview: :class:`RegistriesOperations<azure.mgmt.containerregistry.v2017_06_01_preview.operations.RegistriesOperations>`'
@property def registries(self):
if (self.api_version == '2017-03-01'): from .v2017_03_01.operations import RegistriesOperations as OperationClass elif (self.api_version == '2017-06-01-preview'): from .v2017_06_01_preview.operations import RegistriesOperations as OperationClass else: raise NotImplementedError('APIVe...
'Instance depends on the API version: * 2017-06-01-preview: :class:`ReplicationsOperations<azure.mgmt.containerregistry.v2017_06_01_preview.operations.ReplicationsOperations>`'
@property def replications(self):
if (self.api_version == '2017-06-01-preview'): from .v2017_06_01_preview.operations import ReplicationsOperations as OperationClass else: raise NotImplementedError('APIVersion {} is not available'.format(self.api_version)) return OperationClass(self._client, self.config, self._se...
'Instance depends on the API version: * 2017-06-01-preview: :class:`WebhooksOperations<azure.mgmt.containerregistry.v2017_06_01_preview.operations.WebhooksOperations>`'
@property def webhooks(self):
if (self.api_version == '2017-06-01-preview'): from .v2017_06_01_preview.operations import WebhooksOperations as OperationClass else: raise NotImplementedError('APIVersion {} is not available'.format(self.api_version)) return OperationClass(self._client, self.config, self._serial...
'Lists all of the available Azure Container Registry REST API operations. :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides<msrest:optionsforoperations>`....
def list(self, custom_headers=None, raw=False, **operation_config):
def internal_paging(next_link=None, raw=False): if (not next_link): url = '/providers/Microsoft.ContainerRegistry/operations' query_parameters = {} query_parameters['api-version'] = self._serialize.query('self.api_version', self.api_version, 'str') else: ...
'Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length. :param name: The name of the container registry. :type name: str :param dict custom_headers: headers that will be added to the request :par...
def check_name_availability(self, name, custom_headers=None, raw=False, **operation_config):
registry_name_check_request = models.RegistryNameCheckRequest(name=name) url = '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 'str')} ...
'Gets the properties of the specified container registry. :param resource_group_name: The name of the resource group to which the container registry belongs. :type resource_group_name: str :param registry_name: The name of the container registry. :type registry_name: str :param dict custom_headers: headers that will be...
def get(self, resource_group_name, registry_name, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url('...
'Creates a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry belongs. :type resource_group_name: str :param registry_name: The name of the container registry. :type registry_name: str :param registry: The parameters for creating ...
def create(self, resource_group_name, registry_name, registry, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url('...
'Deletes a container registry. :param resource_group_name: The name of the resource group to which the container registry belongs. :type resource_group_name: str :param registry_name: The name of the container registry. :type registry_name: str :param dict custom_headers: headers that will be added to the request :para...
def delete(self, resource_group_name, registry_name, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url('...
'Updates a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry belongs. :type resource_group_name: str :param registry_name: The name of the container registry. :type registry_name: str :param registry_update_parameters: The parame...
def update(self, resource_group_name, registry_name, registry_update_parameters, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url('...
'Lists all the container registries under the specified resource group. :param resource_group_name: The name of the resource group to which the container registry belongs. :type resource_group_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response al...
def list_by_resource_group(self, resource_group_name, custom_headers=None, raw=False, **operation_config):
def internal_paging(next_link=None, raw=False): if (not next_link): url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id'...
'Lists all the container registries under the specified subscription. :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides<msrest:optionsforoperations>`. :rt...
def list(self, custom_headers=None, raw=False, **operation_config):
def internal_paging(next_link=None, raw=False): if (not next_link): url = '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 'str...
'Lists the login credentials for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry belongs. :type resource_group_name: str :param registry_name: The name of the container registry. :type registry_name: str :param dict custom_headers: headers tha...
def list_credentials(self, resource_group_name, registry_name, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 'str'), 'resourceGroupName': self....
'Regenerates one of the login credentials for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry belongs. :type resource_group_name: str :param registry_name: The name of the container registry. :type registry_name: str :param name: Specifies nam...
def regenerate_credential(self, resource_group_name, registry_name, name, custom_headers=None, raw=False, **operation_config):
regenerate_credential_parameters = models.RegenerateCredentialParameters(name=name) url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential' path_format_arguments = {'subscriptionId': self._serialize.url('...
'Gets the quota usages for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry belongs. :type resource_group_name: str :param registry_name: The name of the container registry. :type registry_name: str :param dict custom_headers: headers that will...
def list_usages(self, resource_group_name, registry_name, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 'str'), 'resourceGroupName': self._seri...
'Gets the properties of the specified replication. :param resource_group_name: The name of the resource group to which the container registry belongs. :type resource_group_name: str :param registry_name: The name of the container registry. :type registry_name: str :param replication_name: The name of the replication. :...
def get(self, resource_group_name, registry_name, replication_name, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 'str'), 'resourceGr...
'Creates or updates a replication for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry belongs. :type resource_group_name: str :param registry_name: The name of the container registry. :type registry_name: str :param replicati...
def create_or_update(self, resource_group_name, registry_name, replication_name, location, tags=None, custom_headers=None, raw=False, **operation_config):
replication = models.Replication(location=location, tags=tags) url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}' path_format_arguments = {'subscriptionId': self._serialize.url('self.config...
'Deletes a replication from a container registry. :param resource_group_name: The name of the resource group to which the container registry belongs. :type resource_group_name: str :param registry_name: The name of the container registry. :type registry_name: str :param replication_name: The name of the replication. :t...
def delete(self, resource_group_name, registry_name, replication_name, custom_headers=None, raw=False, **operation_config):
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}' path_format_arguments = {'subscriptionId': self._serialize.url('self.config.subscription_id', self.config.subscription_id, 'str'), 'resourceGr...
'Lists all the replications for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry belongs. :type resource_group_name: str :param registry_name: The name of the container registry. :type registry_name: str :param dict custom_headers: headers that...
def list(self, resource_group_name, registry_name, custom_headers=None, raw=False, **operation_config):
def internal_paging(next_link=None, raw=False): if (not next_link): url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications' path_format_arguments = {'subscriptionId': self._serialize.url('...