This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def pick_lines(file_name): | |
| with open(file_name, "rt", encoding="utf-8") as fileob: | |
| for line in fileob: | |
| if line.strip().startswith("bl_region_type"): | |
| yield line | |
| for pyfile in pyfiles(): | |
| for line in pick_lines(pyfile): | |
| pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| def pyfiles(): | |
| base_dir = "/home/username/blender-2.76b-linux-glibc211-x86_64/2.76/scripts" | |
| for dir_name, child_dirs, files in os.walk(base_dir): | |
| for file_name in files: | |
| if file_name.endswith(".py"): | |
| full_path = "{}{}{}".format(dir_name, os.path.sep, file_name) | |
| yield full_path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fizzbuzz12(maxnum): | |
| type("", (), {"__call__": staticmethod(lambda mn: print( | |
| "\n".join("{:2}: {}".format(num, | |
| (lambda n: ("" if n % 3 else "fizz") + | |
| ("" if n % 5 else "buzz") )(num)) | |
| for num in range(1, mn + 1))))})()(maxnum) | |
| fizzbuzz12(50) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fizzbuzz11(maxnum): | |
| type("", (), {"__call__": lambda self, mn: print( | |
| "\n".join("{}: {}".format(num, | |
| (lambda n: ("" if n % 3 else "fizz") + | |
| ("" if n % 5 else "buzz") )(num)) | |
| for num in range(1, mn + 1)))})()(maxnum) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fizzbuzz10(maxnum): | |
| (lambda mn: print("\n".join("{}: {}".format(num, | |
| (lambda n: ("" if n % 3 else "fizz") + | |
| ("" if n % 5 else "buzz") )(num)) | |
| for num in range(1, mn + 1))))(maxnum) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fizzbuzz9(maxnum): | |
| print((lambda mn: "\n".join("{}: {}".format(num, | |
| (lambda n: ("" if n % 3 else "fizz") + | |
| ("" if n % 5 else "buzz") )(num)) | |
| for num in range(1, mn + 1)))(maxnum)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fizzbuzz8(maxnum): | |
| pairs = (lambda mn: "\n".join("{}: {}".format(num, | |
| (lambda n: ("" if n % 3 else "fizz") + | |
| ("" if n % 5 else "buzz") )(num)) | |
| for num in range(1, mn + 1)))(maxnum) | |
| print(pairs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fizzbuzz7(maxnum): | |
| fizzbuzz_pairs = "\n".join("{}: {}".format(num, | |
| (lambda n: ("" if n % 3 else "fizz") + | |
| ("" if n % 5 else "buzz") )(num)) | |
| for num in range(1, maxnum + 1)) | |
| print(fizzbuzz_pairs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fizzbuzz6(maxnum): | |
| fizzbuzz_pairs = ("{}: {}".format(num, | |
| (lambda n: ("" if n % 3 else "fizz") + | |
| ("" if n % 5 else "buzz") )(num)) | |
| for num in range(1, maxnum + 1)) | |
| for msg in fizzbuzz_pairs: | |
| print(msg) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fizzbuzz5(maxnum): | |
| fizzbuzz_pairs = ((num, | |
| (lambda n: ("" if n % 3 else "fizz") + | |
| ("" if n % 5 else "buzz") )(num)) | |
| for num in range(1, maxnum + 1)) | |
| for num, msg in fizzbuzz_pairs: | |
| print("{}: {}".format(num, msg)) |