Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
dded80f9
Commit
dded80f9
authored
Aug 17, 2017
by
cclauss
Committed by
GitHub
Aug 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
define long() for Python 3
parent
6f4c9b07
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
test_util.py
python/google/protobuf/internal/test_util.py
+9
-5
No files found.
python/google/protobuf/internal/test_util.py
View file @
dded80f9
...
...
@@ -39,11 +39,15 @@ __author__ = 'robinson@google.com (Will Robinson)'
import
numbers
import
operator
import
os.path
import
sys
from
google.protobuf
import
unittest_import_pb2
from
google.protobuf
import
unittest_pb2
from
google.protobuf
import
descriptor_pb2
try
:
long
# Python 2
except
NameError
:
long
=
int
# Python 3
# Tests whether the given TestAllTypes message is proto2 or not.
# This is used to gate several fields/features that only exist
...
...
@@ -51,6 +55,7 @@ from google.protobuf import descriptor_pb2
def
IsProto2
(
message
):
return
message
.
DESCRIPTOR
.
syntax
==
"proto2"
def
SetAllNonLazyFields
(
message
):
"""Sets every non-lazy field in the message to a unique value.
...
...
@@ -707,8 +712,8 @@ class NonStandardInteger(numbers.Integral):
NonStandardInteger is the minimal legal specification for a custom Integral.
As such, it does not support 0 < x < 5 and it is not hashable.
Note: This is added here instead of relying on numpy or a similar library
with
custom integers to limit dependencies.
Note: This is added here instead of relying on numpy or a similar library
with
custom integers to limit dependencies.
"""
def
__init__
(
self
,
val
,
error_string_on_conversion
=
None
):
...
...
@@ -845,4 +850,3 @@ class NonStandardInteger(numbers.Integral):
def
__repr__
(
self
):
return
'NonStandardInteger(
%
s)'
%
self
.
val
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment