We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Remove deprecation warning: Resource `mapping` is deprecated, use `schema`
```
tests/core/resource/test_viewset.py::ViewSetTest::test_a_default_schema_is_added_when_method_doesnt_match
  /home/mathieu/Code/Mozilla/kinto/kinto/core/resource/viewset.py:160: DeprecationWarning: Resource `mapping` is deprecated, use `schema`
    warnings.warn(message, DeprecationWarning)
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `kinto/core/resource/viewset.py`
Content:
```
1 import functools
2 import warnings
3 
4 import colander
5 from cornice.validators import colander_validator
6 from pyramid.settings import asbool
7 
8 from kinto.core import authorization
9 
10 from .schema import (
11     PermissionsSchema,
12     RequestSchema,
13     PayloadRequestSchema,
14     PatchHeaderSchema,
15     CollectionQuerySchema,
16     CollectionGetQuerySchema,
17     RecordGetQuerySchema,
18     RecordSchema,
19     ResourceReponses,
20     ShareableResourseResponses,
21 )
22 
23 
24 CONTENT_TYPES = ["application/json"]
25 
26 PATCH_CONTENT_TYPES = ["application/merge-patch+json"]
27 
28 
29 class StrictSchema(colander.MappingSchema):
30     @staticmethod
31     def schema_type():
32         return colander.Mapping(unknown="raise")
33 
34 
35 class PartialSchema(colander.MappingSchema):
36     @staticmethod
37     def schema_type():
38         return colander.Mapping(unknown="ignore")
39 
40 
41 class SimpleSchema(colander.MappingSchema):
42     @staticmethod
43     def schema_type():
44         return colander.Mapping(unknown="preserve")
45 
46 
47 class ViewSet:
48     """The default ViewSet object.
49 
50     A viewset contains all the information needed to register
51     any resource in the Cornice registry.
52 
53     It provides the same features as ``cornice.resource()``, except
54     that it is much more flexible and extensible.
55     """
56 
57     service_name = "{resource_name}-{endpoint_type}"
58     collection_path = "/{resource_name}s"
59     record_path = "/{resource_name}s/{{id}}"
60 
61     collection_methods = ("GET", "POST", "DELETE")
62     record_methods = ("GET", "PUT", "PATCH", "DELETE")
63 
64     readonly_methods = ("GET", "OPTIONS", "HEAD")
65 
66     factory = authorization.RouteFactory
67 
68     responses = ResourceReponses()
69 
70     service_arguments = {"description": "Collection of {resource_name}"}
71 
72     default_arguments = {
73         "permission": authorization.PRIVATE,
74         "accept": CONTENT_TYPES,
75         "schema": RequestSchema(),
76     }
77 
78     default_post_arguments = {"content_type": CONTENT_TYPES, "schema": PayloadRequestSchema()}
79 
80     default_put_arguments = {"content_type": CONTENT_TYPES, "schema": PayloadRequestSchema()}
81 
82     default_patch_arguments = {
83         "content_type": CONTENT_TYPES + PATCH_CONTENT_TYPES,
84         "schema": PayloadRequestSchema().bind(header=PatchHeaderSchema()),
85     }
86 
87     default_collection_arguments = {
88         "schema": RequestSchema().bind(querystring=CollectionQuerySchema())
89     }
90     collection_get_arguments = {
91         "schema": RequestSchema().bind(querystring=CollectionGetQuerySchema()),
92         "cors_headers": (
93             "Next-Page",
94             "Total-Records",
95             "Last-Modified",
96             "ETag",
97             "Cache-Control",
98             "Expires",
99             "Pragma",
100         ),
101     }
102     collection_post_arguments = {"schema": PayloadRequestSchema()}
103     default_record_arguments = {}
104     record_get_arguments = {
105         "schema": RequestSchema().bind(querystring=RecordGetQuerySchema()),
106         "cors_headers": ("Last-Modified", "ETag", "Cache-Control", "Expires", "Pragma"),
107     }
108 
109     def __init__(self, **kwargs):
110         self.update(**kwargs)
111         self.record_arguments = functools.partial(self.get_view_arguments, "record")
112         self.collection_arguments = functools.partial(self.get_view_arguments, "collection")
113 
114     def update(self, **kwargs):
115         """Update viewset attributes with provided values."""
116         self.__dict__.update(**kwargs)
117 
118     def get_view_arguments(self, endpoint_type, resource_cls, method):
119         """Return the Pyramid/Cornice view arguments for the given endpoint
120         type and method.
121 
122         :param str endpoint_type: either "collection" or "record".
123         :param resource_cls: the resource class.
124         :param str method: the HTTP method.
125         """
126         args = {**self.default_arguments}
127         default_arguments = getattr(self, f"default_{endpoint_type}_arguments")
128         args.update(**default_arguments)
129 
130         by_http_verb = f"default_{method.lower()}_arguments"
131         method_args = getattr(self, by_http_verb, {})
132         args.update(**method_args)
133 
134         by_method = f"{endpoint_type}_{method.lower()}_arguments"
135         endpoint_args = getattr(self, by_method, {})
136         args.update(**endpoint_args)
137 
138         request_schema = args.get("schema", RequestSchema())
139         record_schema = self.get_record_schema(resource_cls, method)
140         request_schema = request_schema.bind(body=record_schema)
141         response_schemas = self.responses.get_and_bind(endpoint_type, method, record=record_schema)
142 
143         args["schema"] = request_schema
144         args["response_schemas"] = response_schemas
145 
146         validators = args.get("validators", [])
147         validators.append(colander_validator)
148         args["validators"] = validators
149 
150         return args
151 
152     def get_record_schema(self, resource_cls, method):
153         """Return the Cornice schema for the given method.
154         """
155         if method.lower() in ("patch", "delete"):
156             resource_schema = SimpleSchema
157         else:
158             resource_schema = resource_cls.schema
159             if hasattr(resource_cls, "mapping"):
160                 message = "Resource `mapping` is deprecated, use `schema`"
161                 warnings.warn(message, DeprecationWarning)
162                 resource_schema = resource_cls.mapping.__class__
163 
164         record_schema = RecordSchema().bind(data=resource_schema())
165 
166         return record_schema
167 
168     def get_view(self, endpoint_type, method):
169         """Return the view method name located on the resource object, for the
170         given type and method.
171 
172         * For collections, this will be "collection_{method|lower}
173         * For records, this will be "{method|lower}.
174         """
175         if endpoint_type == "record":
176             return method.lower()
177         return f"{endpoint_type}_{method.lower()}"
178 
179     def get_name(self, resource_cls):
180         """Returns the name of the resource.
181         """
182         # Provided on viewset during registration.
183         if "name" in self.__dict__:
184             return self.__dict__["name"]
185 
186         # Attribute on resource class (but not @property)
187         has_class_attr = hasattr(resource_cls, "name") and not callable(resource_cls.name)
188         if has_class_attr:
189             return resource_cls.name
190 
191         # Use classname
192         return resource_cls.__name__.lower()
193 
194     def get_service_name(self, endpoint_type, resource_cls):
195         """Returns the name of the service, depending a given type and
196         resource.
197         """
198         return self.service_name.format(
199             resource_name=self.get_name(resource_cls), endpoint_type=endpoint_type
200         )
201 
202     def get_service_arguments(self):
203         return {**self.service_arguments}
204 
205     def is_endpoint_enabled(self, endpoint_type, resource_name, method, settings):
206         """Returns if the given endpoint is enabled or not.
207 
208         Uses the settings to tell so.
209         """
210         readonly_enabled = asbool(settings.get("readonly"))
211         readonly_method = method.lower() in [m.lower() for m in self.readonly_methods]
212         if readonly_enabled and not readonly_method:
213             return False
214 
215         setting_enabled = f"{endpoint_type}_{resource_name}_{method.lower()}_enabled"
216         return asbool(settings.get(setting_enabled, True))
217 
218 
219 class ShareableViewSet(ViewSet):
220     """A ShareableViewSet will register the given resource with a schema
221     that supports permissions.
222 
223     The views will rely on dynamic permissions (e.g. create with PUT if
224     record does not exist), and solicit the cliquet RouteFactory.
225     """
226 
227     responses = ShareableResourseResponses()
228 
229     def get_record_schema(self, resource_cls, method):
230         """Return the Cornice schema for the given method.
231         """
232         record_schema = super(ShareableViewSet, self).get_record_schema(resource_cls, method)
233         allowed_permissions = resource_cls.permissions
234         permissions = PermissionsSchema(
235             name="permissions", missing=colander.drop, permissions=allowed_permissions
236         )
237         record_schema = record_schema.bind(permissions=permissions)
238         return record_schema
239 
240     def get_view_arguments(self, endpoint_type, resource_cls, method):
241         args = super().get_view_arguments(endpoint_type, resource_cls, method)
242         args["permission"] = authorization.DYNAMIC
243         return args
244 
245     def get_service_arguments(self):
246         args = super().get_service_arguments()
247         args["factory"] = self.factory
248         return args
249
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/kinto/core/resource/viewset.py b/kinto/core/resource/viewset.py
--- a/kinto/core/resource/viewset.py
+++ b/kinto/core/resource/viewset.py
@@ -1,5 +1,4 @@
 import functools
-import warnings
 
 import colander
 from cornice.validators import colander_validator
@@ -156,10 +155,6 @@
             resource_schema = SimpleSchema
         else:
             resource_schema = resource_cls.schema
-            if hasattr(resource_cls, "mapping"):
-                message = "Resource `mapping` is deprecated, use `schema`"
-                warnings.warn(message, DeprecationWarning)
-                resource_schema = resource_cls.mapping.__class__
 
         record_schema = RecordSchema().bind(data=resource_schema())

{"golden_diff": "diff --git a/kinto/core/resource/viewset.py b/kinto/core/resource/viewset.py\n--- a/kinto/core/resource/viewset.py\n+++ b/kinto/core/resource/viewset.py\n@@ -1,5 +1,4 @@\n import functools\n-import warnings\n \n import colander\n from cornice.validators import colander_validator\n@@ -156,10 +155,6 @@\n             resource_schema = SimpleSchema\n         else:\n             resource_schema = resource_cls.schema\n-            if hasattr(resource_cls, \"mapping\"):\n-                message = \"Resource `mapping` is deprecated, use `schema`\"\n-                warnings.warn(message, DeprecationWarning)\n-                resource_schema = resource_cls.mapping.__class__\n \n         record_schema = RecordSchema().bind(data=resource_schema())\n", "issue": "Remove deprecation warning: Resource `mapping` is deprecated, use `schema`\n```\r\ntests/core/resource/test_viewset.py::ViewSetTest::test_a_default_schema_is_added_when_method_doesnt_match\r\n  /home/mathieu/Code/Mozilla/kinto/kinto/core/resource/viewset.py:160: DeprecationWarning: Resource `mapping` is deprecated, use `schema`\r\n    warnings.warn(message, DeprecationWarning)\r\n```\r\n\n", "before_files": [{"content": "import functools\nimport warnings\n\nimport colander\nfrom cornice.validators import colander_validator\nfrom pyramid.settings import asbool\n\nfrom kinto.core import authorization\n\nfrom .schema import (\n    PermissionsSchema,\n    RequestSchema,\n    PayloadRequestSchema,\n    PatchHeaderSchema,\n    CollectionQuerySchema,\n    CollectionGetQuerySchema,\n    RecordGetQuerySchema,\n    RecordSchema,\n    ResourceReponses,\n    ShareableResourseResponses,\n)\n\n\nCONTENT_TYPES = [\"application/json\"]\n\nPATCH_CONTENT_TYPES = [\"application/merge-patch+json\"]\n\n\nclass StrictSchema(colander.MappingSchema):\n    @staticmethod\n    def schema_type():\n        return colander.Mapping(unknown=\"raise\")\n\n\nclass PartialSchema(colander.MappingSchema):\n    @staticmethod\n    def schema_type():\n        return colander.Mapping(unknown=\"ignore\")\n\n\nclass SimpleSchema(colander.MappingSchema):\n    @staticmethod\n    def schema_type():\n        return colander.Mapping(unknown=\"preserve\")\n\n\nclass ViewSet:\n    \"\"\"The default ViewSet object.\n\n    A viewset contains all the information needed to register\n    any resource in the Cornice registry.\n\n    It provides the same features as ``cornice.resource()``, except\n    that it is much more flexible and extensible.\n    \"\"\"\n\n    service_name = \"{resource_name}-{endpoint_type}\"\n    collection_path = \"/{resource_name}s\"\n    record_path = \"/{resource_name}s/{{id}}\"\n\n    collection_methods = (\"GET\", \"POST\", \"DELETE\")\n    record_methods = (\"GET\", \"PUT\", \"PATCH\", \"DELETE\")\n\n    readonly_methods = (\"GET\", \"OPTIONS\", \"HEAD\")\n\n    factory = authorization.RouteFactory\n\n    responses = ResourceReponses()\n\n    service_arguments = {\"description\": \"Collection of {resource_name}\"}\n\n    default_arguments = {\n        \"permission\": authorization.PRIVATE,\n        \"accept\": CONTENT_TYPES,\n        \"schema\": RequestSchema(),\n    }\n\n    default_post_arguments = {\"content_type\": CONTENT_TYPES, \"schema\": PayloadRequestSchema()}\n\n    default_put_arguments = {\"content_type\": CONTENT_TYPES, \"schema\": PayloadRequestSchema()}\n\n    default_patch_arguments = {\n        \"content_type\": CONTENT_TYPES + PATCH_CONTENT_TYPES,\n        \"schema\": PayloadRequestSchema().bind(header=PatchHeaderSchema()),\n    }\n\n    default_collection_arguments = {\n        \"schema\": RequestSchema().bind(querystring=CollectionQuerySchema())\n    }\n    collection_get_arguments = {\n        \"schema\": RequestSchema().bind(querystring=CollectionGetQuerySchema()),\n        \"cors_headers\": (\n            \"Next-Page\",\n            \"Total-Records\",\n            \"Last-Modified\",\n            \"ETag\",\n            \"Cache-Control\",\n            \"Expires\",\n            \"Pragma\",\n        ),\n    }\n    collection_post_arguments = {\"schema\": PayloadRequestSchema()}\n    default_record_arguments = {}\n    record_get_arguments = {\n        \"schema\": RequestSchema().bind(querystring=RecordGetQuerySchema()),\n        \"cors_headers\": (\"Last-Modified\", \"ETag\", \"Cache-Control\", \"Expires\", \"Pragma\"),\n    }\n\n    def __init__(self, **kwargs):\n        self.update(**kwargs)\n        self.record_arguments = functools.partial(self.get_view_arguments, \"record\")\n        self.collection_arguments = functools.partial(self.get_view_arguments, \"collection\")\n\n    def update(self, **kwargs):\n        \"\"\"Update viewset attributes with provided values.\"\"\"\n        self.__dict__.update(**kwargs)\n\n    def get_view_arguments(self, endpoint_type, resource_cls, method):\n        \"\"\"Return the Pyramid/Cornice view arguments for the given endpoint\n        type and method.\n\n        :param str endpoint_type: either \"collection\" or \"record\".\n        :param resource_cls: the resource class.\n        :param str method: the HTTP method.\n        \"\"\"\n        args = {**self.default_arguments}\n        default_arguments = getattr(self, f\"default_{endpoint_type}_arguments\")\n        args.update(**default_arguments)\n\n        by_http_verb = f\"default_{method.lower()}_arguments\"\n        method_args = getattr(self, by_http_verb, {})\n        args.update(**method_args)\n\n        by_method = f\"{endpoint_type}_{method.lower()}_arguments\"\n        endpoint_args = getattr(self, by_method, {})\n        args.update(**endpoint_args)\n\n        request_schema = args.get(\"schema\", RequestSchema())\n        record_schema = self.get_record_schema(resource_cls, method)\n        request_schema = request_schema.bind(body=record_schema)\n        response_schemas = self.responses.get_and_bind(endpoint_type, method, record=record_schema)\n\n        args[\"schema\"] = request_schema\n        args[\"response_schemas\"] = response_schemas\n\n        validators = args.get(\"validators\", [])\n        validators.append(colander_validator)\n        args[\"validators\"] = validators\n\n        return args\n\n    def get_record_schema(self, resource_cls, method):\n        \"\"\"Return the Cornice schema for the given method.\n        \"\"\"\n        if method.lower() in (\"patch\", \"delete\"):\n            resource_schema = SimpleSchema\n        else:\n            resource_schema = resource_cls.schema\n            if hasattr(resource_cls, \"mapping\"):\n                message = \"Resource `mapping` is deprecated, use `schema`\"\n                warnings.warn(message, DeprecationWarning)\n                resource_schema = resource_cls.mapping.__class__\n\n        record_schema = RecordSchema().bind(data=resource_schema())\n\n        return record_schema\n\n    def get_view(self, endpoint_type, method):\n        \"\"\"Return the view method name located on the resource object, for the\n        given type and method.\n\n        * For collections, this will be \"collection_{method|lower}\n        * For records, this will be \"{method|lower}.\n        \"\"\"\n        if endpoint_type == \"record\":\n            return method.lower()\n        return f\"{endpoint_type}_{method.lower()}\"\n\n    def get_name(self, resource_cls):\n        \"\"\"Returns the name of the resource.\n        \"\"\"\n        # Provided on viewset during registration.\n        if \"name\" in self.__dict__:\n            return self.__dict__[\"name\"]\n\n        # Attribute on resource class (but not @property)\n        has_class_attr = hasattr(resource_cls, \"name\") and not callable(resource_cls.name)\n        if has_class_attr:\n            return resource_cls.name\n\n        # Use classname\n        return resource_cls.__name__.lower()\n\n    def get_service_name(self, endpoint_type, resource_cls):\n        \"\"\"Returns the name of the service, depending a given type and\n        resource.\n        \"\"\"\n        return self.service_name.format(\n            resource_name=self.get_name(resource_cls), endpoint_type=endpoint_type\n        )\n\n    def get_service_arguments(self):\n        return {**self.service_arguments}\n\n    def is_endpoint_enabled(self, endpoint_type, resource_name, method, settings):\n        \"\"\"Returns if the given endpoint is enabled or not.\n\n        Uses the settings to tell so.\n        \"\"\"\n        readonly_enabled = asbool(settings.get(\"readonly\"))\n        readonly_method = method.lower() in [m.lower() for m in self.readonly_methods]\n        if readonly_enabled and not readonly_method:\n            return False\n\n        setting_enabled = f\"{endpoint_type}_{resource_name}_{method.lower()}_enabled\"\n        return asbool(settings.get(setting_enabled, True))\n\n\nclass ShareableViewSet(ViewSet):\n    \"\"\"A ShareableViewSet will register the given resource with a schema\n    that supports permissions.\n\n    The views will rely on dynamic permissions (e.g. create with PUT if\n    record does not exist), and solicit the cliquet RouteFactory.\n    \"\"\"\n\n    responses = ShareableResourseResponses()\n\n    def get_record_schema(self, resource_cls, method):\n        \"\"\"Return the Cornice schema for the given method.\n        \"\"\"\n        record_schema = super(ShareableViewSet, self).get_record_schema(resource_cls, method)\n        allowed_permissions = resource_cls.permissions\n        permissions = PermissionsSchema(\n            name=\"permissions\", missing=colander.drop, permissions=allowed_permissions\n        )\n        record_schema = record_schema.bind(permissions=permissions)\n        return record_schema\n\n    def get_view_arguments(self, endpoint_type, resource_cls, method):\n        args = super().get_view_arguments(endpoint_type, resource_cls, method)\n        args[\"permission\"] = authorization.DYNAMIC\n        return args\n\n    def get_service_arguments(self):\n        args = super().get_service_arguments()\n        args[\"factory\"] = self.factory\n        return args\n", "path": "kinto/core/resource/viewset.py"}], "after_files": [{"content": "import functools\n\nimport colander\nfrom cornice.validators import colander_validator\nfrom pyramid.settings import asbool\n\nfrom kinto.core import authorization\n\nfrom .schema import (\n    PermissionsSchema,\n    RequestSchema,\n    PayloadRequestSchema,\n    PatchHeaderSchema,\n    CollectionQuerySchema,\n    CollectionGetQuerySchema,\n    RecordGetQuerySchema,\n    RecordSchema,\n    ResourceReponses,\n    ShareableResourseResponses,\n)\n\n\nCONTENT_TYPES = [\"application/json\"]\n\nPATCH_CONTENT_TYPES = [\"application/merge-patch+json\"]\n\n\nclass StrictSchema(colander.MappingSchema):\n    @staticmethod\n    def schema_type():\n        return colander.Mapping(unknown=\"raise\")\n\n\nclass PartialSchema(colander.MappingSchema):\n    @staticmethod\n    def schema_type():\n        return colander.Mapping(unknown=\"ignore\")\n\n\nclass SimpleSchema(colander.MappingSchema):\n    @staticmethod\n    def schema_type():\n        return colander.Mapping(unknown=\"preserve\")\n\n\nclass ViewSet:\n    \"\"\"The default ViewSet object.\n\n    A viewset contains all the information needed to register\n    any resource in the Cornice registry.\n\n    It provides the same features as ``cornice.resource()``, except\n    that it is much more flexible and extensible.\n    \"\"\"\n\n    service_name = \"{resource_name}-{endpoint_type}\"\n    collection_path = \"/{resource_name}s\"\n    record_path = \"/{resource_name}s/{{id}}\"\n\n    collection_methods = (\"GET\", \"POST\", \"DELETE\")\n    record_methods = (\"GET\", \"PUT\", \"PATCH\", \"DELETE\")\n\n    readonly_methods = (\"GET\", \"OPTIONS\", \"HEAD\")\n\n    factory = authorization.RouteFactory\n\n    responses = ResourceReponses()\n\n    service_arguments = {\"description\": \"Collection of {resource_name}\"}\n\n    default_arguments = {\n        \"permission\": authorization.PRIVATE,\n        \"accept\": CONTENT_TYPES,\n        \"schema\": RequestSchema(),\n    }\n\n    default_post_arguments = {\"content_type\": CONTENT_TYPES, \"schema\": PayloadRequestSchema()}\n\n    default_put_arguments = {\"content_type\": CONTENT_TYPES, \"schema\": PayloadRequestSchema()}\n\n    default_patch_arguments = {\n        \"content_type\": CONTENT_TYPES + PATCH_CONTENT_TYPES,\n        \"schema\": PayloadRequestSchema().bind(header=PatchHeaderSchema()),\n    }\n\n    default_collection_arguments = {\n        \"schema\": RequestSchema().bind(querystring=CollectionQuerySchema())\n    }\n    collection_get_arguments = {\n        \"schema\": RequestSchema().bind(querystring=CollectionGetQuerySchema()),\n        \"cors_headers\": (\n            \"Next-Page\",\n            \"Total-Records\",\n            \"Last-Modified\",\n            \"ETag\",\n            \"Cache-Control\",\n            \"Expires\",\n            \"Pragma\",\n        ),\n    }\n    collection_post_arguments = {\"schema\": PayloadRequestSchema()}\n    default_record_arguments = {}\n    record_get_arguments = {\n        \"schema\": RequestSchema().bind(querystring=RecordGetQuerySchema()),\n        \"cors_headers\": (\"Last-Modified\", \"ETag\", \"Cache-Control\", \"Expires\", \"Pragma\"),\n    }\n\n    def __init__(self, **kwargs):\n        self.update(**kwargs)\n        self.record_arguments = functools.partial(self.get_view_arguments, \"record\")\n        self.collection_arguments = functools.partial(self.get_view_arguments, \"collection\")\n\n    def update(self, **kwargs):\n        \"\"\"Update viewset attributes with provided values.\"\"\"\n        self.__dict__.update(**kwargs)\n\n    def get_view_arguments(self, endpoint_type, resource_cls, method):\n        \"\"\"Return the Pyramid/Cornice view arguments for the given endpoint\n        type and method.\n\n        :param str endpoint_type: either \"collection\" or \"record\".\n        :param resource_cls: the resource class.\n        :param str method: the HTTP method.\n        \"\"\"\n        args = {**self.default_arguments}\n        default_arguments = getattr(self, f\"default_{endpoint_type}_arguments\")\n        args.update(**default_arguments)\n\n        by_http_verb = f\"default_{method.lower()}_arguments\"\n        method_args = getattr(self, by_http_verb, {})\n        args.update(**method_args)\n\n        by_method = f\"{endpoint_type}_{method.lower()}_arguments\"\n        endpoint_args = getattr(self, by_method, {})\n        args.update(**endpoint_args)\n\n        request_schema = args.get(\"schema\", RequestSchema())\n        record_schema = self.get_record_schema(resource_cls, method)\n        request_schema = request_schema.bind(body=record_schema)\n        response_schemas = self.responses.get_and_bind(endpoint_type, method, record=record_schema)\n\n        args[\"schema\"] = request_schema\n        args[\"response_schemas\"] = response_schemas\n\n        validators = args.get(\"validators\", [])\n        validators.append(colander_validator)\n        args[\"validators\"] = validators\n\n        return args\n\n    def get_record_schema(self, resource_cls, method):\n        \"\"\"Return the Cornice schema for the given method.\n        \"\"\"\n        if method.lower() in (\"patch\", \"delete\"):\n            resource_schema = SimpleSchema\n        else:\n            resource_schema = resource_cls.schema\n\n        record_schema = RecordSchema().bind(data=resource_schema())\n\n        return record_schema\n\n    def get_view(self, endpoint_type, method):\n        \"\"\"Return the view method name located on the resource object, for the\n        given type and method.\n\n        * For collections, this will be \"collection_{method|lower}\n        * For records, this will be \"{method|lower}.\n        \"\"\"\n        if endpoint_type == \"record\":\n            return method.lower()\n        return f\"{endpoint_type}_{method.lower()}\"\n\n    def get_name(self, resource_cls):\n        \"\"\"Returns the name of the resource.\n        \"\"\"\n        # Provided on viewset during registration.\n        if \"name\" in self.__dict__:\n            return self.__dict__[\"name\"]\n\n        # Attribute on resource class (but not @property)\n        has_class_attr = hasattr(resource_cls, \"name\") and not callable(resource_cls.name)\n        if has_class_attr:\n            return resource_cls.name\n\n        # Use classname\n        return resource_cls.__name__.lower()\n\n    def get_service_name(self, endpoint_type, resource_cls):\n        \"\"\"Returns the name of the service, depending a given type and\n        resource.\n        \"\"\"\n        return self.service_name.format(\n            resource_name=self.get_name(resource_cls), endpoint_type=endpoint_type\n        )\n\n    def get_service_arguments(self):\n        return {**self.service_arguments}\n\n    def is_endpoint_enabled(self, endpoint_type, resource_name, method, settings):\n        \"\"\"Returns if the given endpoint is enabled or not.\n\n        Uses the settings to tell so.\n        \"\"\"\n        readonly_enabled = asbool(settings.get(\"readonly\"))\n        readonly_method = method.lower() in [m.lower() for m in self.readonly_methods]\n        if readonly_enabled and not readonly_method:\n            return False\n\n        setting_enabled = f\"{endpoint_type}_{resource_name}_{method.lower()}_enabled\"\n        return asbool(settings.get(setting_enabled, True))\n\n\nclass ShareableViewSet(ViewSet):\n    \"\"\"A ShareableViewSet will register the given resource with a schema\n    that supports permissions.\n\n    The views will rely on dynamic permissions (e.g. create with PUT if\n    record does not exist), and solicit the cliquet RouteFactory.\n    \"\"\"\n\n    responses = ShareableResourseResponses()\n\n    def get_record_schema(self, resource_cls, method):\n        \"\"\"Return the Cornice schema for the given method.\n        \"\"\"\n        record_schema = super(ShareableViewSet, self).get_record_schema(resource_cls, method)\n        allowed_permissions = resource_cls.permissions\n        permissions = PermissionsSchema(\n            name=\"permissions\", missing=colander.drop, permissions=allowed_permissions\n        )\n        record_schema = record_schema.bind(permissions=permissions)\n        return record_schema\n\n    def get_view_arguments(self, endpoint_type, resource_cls, method):\n        args = super().get_view_arguments(endpoint_type, resource_cls, method)\n        args[\"permission\"] = authorization.DYNAMIC\n        return args\n\n    def get_service_arguments(self):\n        args = super().get_service_arguments()\n        args[\"factory\"] = self.factory\n        return args\n", "path": "kinto/core/resource/viewset.py"}]}