OILS / mycpp / examples / invalid_python.py View on Github | oilshell.org

61 lines, 24 significant
1#!/usr/bin/env python2
2"""
3invalid_python.py
4"""
5from __future__ import print_function
6
7import sys
8
9from typing import List, Any, Iterator
10
11
12def visit_star(x):
13 # type: (Any) -> None
14 pass
15
16
17def f():
18 # type: () -> Iterator[int]
19 yield 42
20
21
22myglobal = 'bad'
23
24
25def g():
26 # type: () -> None
27 global myglobal
28 print('g')
29
30 exec('print("hi")')
31
32
33class Base:
34 pass
35
36
37class Derived:
38
39 def __init__(self):
40 # type: () -> None
41
42 # Hm not hitting this error
43 super(self)
44
45
46def main():
47 # type: () -> None
48
49 # Not handled
50 print(u'unicode')
51
52 # This is accepted -- as StrExpr?
53 print(b'bytes')
54
55 mycomplex = 3j
56
57 myset = {1, 2}
58
59 mylist = ['hi']
60 # This is somehow accepted? Not StarExpr?
61 visit_star(*mylist)