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 17 18def simple_function(x): 19 """Docstring.""" 20 return x # comment 21 22 23def nested_functions(x): 24 """Docstring.""" 25 26 def inner_fn(y): 27 return y 28 29 return inner_fn(x) 30 31 32def function_with_print(): 33 print('foo') 34 35 36simple_lambda = lambda: None 37 38 39class SimpleClass(object): 40 41 def simple_method(self): 42 return self 43 44 def method_with_print(self): 45 print('foo') 46 47 48def function_with_multiline_call(x): 49 """Docstring.""" 50 return range( 51 x, 52 x + 1, 53 ) 54 55 56def basic_decorator(f): 57 return f 58 59 60@basic_decorator 61@basic_decorator 62def decorated_function(x): 63 if x > 0: 64 return 1 65 return 2 66