1# Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14# ============================================================================== 15"""Module with basic entity definitions for testing.""" 16 17from __future__ import absolute_import 18from __future__ import division 19from __future__ import print_function 20from __future__ import with_statement # An extra future import for testing. 21 22 23def simple_function(x): 24 """Docstring.""" 25 return x # comment 26 27 28def nested_functions(x): 29 """Docstring.""" 30 31 def inner_fn(y): 32 return y 33 34 return inner_fn(x) 35 36 37def function_with_print(): 38 print('foo') 39 40 41simple_lambda = lambda: None 42 43 44class SimpleClass(object): 45 46 def simple_method(self): 47 return self 48 49 def method_with_print(self): 50 print('foo') 51 52 53def function_with_multiline_call(x): 54 """Docstring.""" 55 return range( 56 x, 57 x + 1, 58 ) 59 60 61def basic_decorator(f): 62 return f 63 64 65@basic_decorator 66@basic_decorator 67def decorated_function(x): 68 if x > 0: 69 return 1 70 return 2 71