Skip to content
This repository was archived by the owner on Apr 19, 2026. It is now read-only.

Commit 9da6081

Browse files
authored
Begin enveloping protorpc dependencies. (#158)
Code can now import message_types, messages, and remote directly from the endpoints library, which gives us flexibility to change things. Also, all import organization has been standardized using the isort utility for Python.
1 parent 6d9987f commit 9da6081

38 files changed

Lines changed: 160 additions & 196 deletions

endpoints/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
# pylint: disable=wildcard-import
2121
from __future__ import absolute_import
2222

23+
from protorpc import message_types
24+
from protorpc import messages
25+
from protorpc import remote
26+
2327
from .api_config import api, method
2428
from .api_config import AUTH_LEVEL, EMAIL_SCOPE
2529
from .api_config import Issuer, LimitDefinition, Namespace

endpoints/_endpointscfg_impl.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,28 @@
4444
import argparse
4545
import collections
4646
import contextlib
47-
# Conditional import, pylint: disable=g-import-not-at-top
48-
try:
49-
import json
50-
except ImportError:
51-
# If we can't find json packaged with Python import simplejson, which is
52-
# packaged with the SDK.
53-
import simplejson as json
5447
import logging
5548
import os
5649
import re
5750
import sys
5851
import urllib
5952
import urllib2
53+
54+
import yaml
55+
from google.appengine.ext import testbed
56+
6057
from . import api_config
61-
from protorpc import remote
6258
from . import openapi_generator
63-
import yaml
59+
from . import remote
60+
61+
# Conditional import, pylint: disable=g-import-not-at-top
62+
try:
63+
import json
64+
except ImportError:
65+
# If we can't find json packaged with Python import simplejson, which is
66+
# packaged with the SDK.
67+
import simplejson as json
6468

65-
from google.appengine.ext import testbed
6669

6770
DISCOVERY_DOC_BASE = ('https://webapis-discovery.appspot.com/_ah/api/'
6871
'discovery/v1/apis/generate/')

endpoints/api_config.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,22 @@ def entries_get(self, request):
3939
import logging
4040
import re
4141

42-
from . import api_exceptions
43-
from . import message_parser
44-
45-
from protorpc import message_types
46-
from protorpc import messages
47-
from protorpc import remote
48-
from protorpc import util
42+
from google.appengine.api import app_identity
4943

5044
import attr
5145
import semver
46+
from protorpc import util
5247

48+
from . import api_exceptions
49+
from . import constants
50+
from . import message_parser
51+
from . import message_types
52+
from . import messages
53+
from . import remote
5354
from . import resource_container
55+
from . import types as endpoints_types
5456
from . import users_id_token
5557
from . import util as endpoints_util
56-
from . import types as endpoints_types
57-
from . import constants
58-
59-
from google.appengine.api import app_identity
60-
6158

6259
_logger = logging.getLogger(__name__)
6360
package = 'google.appengine.endpoints'

endpoints/api_exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import httplib
2020

21-
from protorpc import remote
21+
from . import remote
2222

2323

2424
class ServiceException(remote.ApplicationError):

endpoints/apiserving.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,21 @@ def list(self, request):
6666
import logging
6767
import os
6868

69-
from . import api_config
70-
from . import api_exceptions
71-
from . import endpoints_dispatcher
72-
from . import protojson
73-
7469
from google.appengine.api import app_identity
70+
7571
from endpoints_management.control import client as control_client
7672
from endpoints_management.control import wsgi as control_wsgi
77-
78-
from protorpc import message_types
79-
from protorpc import messages
80-
from protorpc import remote
8173
from protorpc.wsgi import service as wsgi_service
8274

75+
from . import api_config
76+
from . import api_exceptions
77+
from . import endpoints_dispatcher
78+
from . import message_types
79+
from . import messages
80+
from . import protojson
81+
from . import remote
8382
from . import util
8483

85-
8684
_logger = logging.getLogger(__name__)
8785
package = 'google.appengine.endpoints'
8886

endpoints/directory_list_generator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
from . import util
2525

26+
2627
class DirectoryListGenerator(object):
2728
"""Generates a discovery directory list from a ProtoRPC service.
2829

endpoints/discovery_generator.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@
2323

2424
from . import api_exceptions
2525
from . import message_parser
26-
from protorpc import message_types
27-
from protorpc import messages
28-
from protorpc import remote
26+
from . import message_types
27+
from . import messages
28+
from . import remote
2929
from . import resource_container
3030
from . import util
3131

32-
3332
_logger = logging.getLogger(__name__)
3433
_PATH_VARIABLE_PATTERN = r'{([a-zA-Z_][a-zA-Z_.\d]*)}'
3534

endpoints/endpoints_dispatcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import re
3333
import urlparse
3434
import wsgiref
35+
3536
import pkg_resources
3637

3738
from . import api_config_manager
@@ -42,7 +43,6 @@
4243
from . import parameter_converter
4344
from . import util
4445

45-
4646
_logger = logging.getLogger(__name__)
4747

4848

endpoints/endpointscfg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
"""
2424

2525
import sys
26+
2627
import _endpointscfg_setup # pylint: disable=unused-import
2728
from endpoints._endpointscfg_impl import main
2829

29-
3030
if __name__ == '__main__':
3131
main(sys.argv)

endpoints/errors.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
from . import generated_error_info
2424

25-
2625
__all__ = ['BackendError',
2726
'BasicTypeParameterError',
2827
'EnumRejectionError',

0 commit comments

Comments
 (0)