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
| """ | |
| Bunny Carrot Coding Game - PyQt6 UI | |
| An interactive version of bunny_game_solution.py. | |
| Move the bunny with the arrow keys (or the on-screen buttons) to eat all the | |
| carrots while avoiding the walls and the garden fence. | |
| Run with: | |
| python bunny_game_ui.py | |
| """ |
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
| """ | |
| Bunny Carrot Coding Game - Mentor Reference Solution | |
| """ | |
| import time | |
| grid = [ | |
| ["C", "C", "C", "C", "C"], | |
| ["C", "X", "C", "X", "C"], |
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
| """ | |
| Bunny Carrot Coding Game - PyQt6 UI | |
| An interactive version of bunny_game_solution.py. | |
| Move the bunny with the arrow keys (or the on-screen buttons) to eat all the | |
| carrots while avoiding the walls and the garden fence. | |
| Run with: | |
| python bunny_game_ui.py | |
| """ |
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
| $ pex pyspark==2.3.2 numpy userlib -o myarchive.pex | |
| $./myarchive.pex -m userlib.startup | |
| 14 |
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 | |
| import sys | |
| import numpy as np | |
| from pyspark import SparkConf, SparkContext | |
| def create_spark_context(): | |
| pex_file = os.path.basename([path for path in sys.path if path.endswith('.pex')][0]) | |
| conf = SparkConf() \ | |
| .setMaster("yarn") \ | |
| .set("spark.submit.deployMode", "client") \ |
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 json | |
| import subprocess | |
| import sys | |
| import os | |
| import zipfile | |
| def upload_editable_requirement_from_current_venv(sc): | |
| for requirement_dir in get_editable_requirements(): | |
| add_lib_to_spark_context(requirement_dir, sc) |
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 json | |
| import subprocess | |
| import sys | |
| from pex.fetcher import PyPIFetcher | |
| from pex.pex_builder import PEXBuilder | |
| from pex.resolvable import Resolvable | |
| from pex.resolver import resolve_multi, Unsatisfiable, Untranslateable | |
| from pex.resolver_options import ResolverOptionsBuilder |
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
| python3.6 -m venv venv | |
| source venv/bin/activate | |
| mkdir -p userlib/userlib | |
| echo -n > userlib/__init__.py | |
| echo -n > userlib/userlib/__init__.py | |
| echo -n > userlib/userlib/startup.py | |
| echo "import setuptools | |
| setuptools.setup( | |
| name='userlib', |