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 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 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 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
| 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 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
| region_types = [] | |
| for pyfile in pyfiles(): | |
| for line in pick_lines(pyfile): | |
| _, region_type = line.split("=") | |
| region_type = region_type.replace("'", "") | |
| region_type = region_type.replace("\"", "") | |
| region_type = region_type.strip() | |
| region_types.append(region_type) |
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
| from collections import Counter | |
| counts = Counter(sorted(region_types)) | |
| for key, val in counts.items(): | |
| print("{}: {}".format(key, val)) |
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 | |
| from collections import Counter | |
| 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
| conn = eng.connect() | |
| resource_parm = bindparam("resource_id", type_=Integer) | |
| now = datetime.now() | |
| query = resource_deletion_table.insert()\ | |
| .values(resource_id=resource_parm, deletion_time=now) | |
| conn.execute(query, resource_id=resource_id) |