-
Notifications
You must be signed in to change notification settings - Fork 0
Adds dependencies to pyproject toml #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| __pycache__/ | ||
|
|
||
| .venv | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -181,6 +181,7 @@ def try_build(building:BuildingId) -> Integer: | |
| <br> | ||
| all functions pass by value and all variables in the function are only in their own scope. Note that it is the same variable for every call of the function, so if you do not set the varible it will have the value for the last call. If you need a variable from ouside the funtion you can use global to access it. otherwize it will create a new function scoped veriable. | ||
| <br> | ||
|
|
||
| ``` | ||
| def build_around_tc(building:BuildingId, radius:Integer) -> Integer: | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Github's markdown renderer had some kind of strange bug rendering this code bit. Added newlines to hopefully force it to be normal. |
||
| global tc_location | ||
|
|
@@ -189,6 +190,7 @@ def build_around_tc(building:BuildingId, radius:Integer) -> Integer: | |
| chat_to_all("E: tc_location not set, cannot build_around_tc") | ||
| return -1 | ||
| ``` | ||
|
|
||
| <br> | ||
| aoe2script Commands now look like functions, as you have seen above. but they are not the same! | ||
| if you use an aoe2script command it will work like it does in the original langauge. I have just added things for conveineince bellow. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,13 +4,16 @@ version = "0.0.1" | |
| description = "compile python code to aoe2script" | ||
| readme = "README.md" | ||
| requires-python = ">=3.6" | ||
| dependencies = [] | ||
| dependencies = [ | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are required to run the /src/main |
||
| "aenum>=3.1.10", | ||
| "colorama>=0.4.6", | ||
| "sortedcontainers>=2.4.0", | ||
| ] | ||
|
|
||
| [dependency-groups] | ||
| dev = [ | ||
| "colorama>=0.4.6", | ||
| "bs4<1", | ||
| "pytest>=7.0.1", | ||
| "aenum>=3.1.10", | ||
| ] | ||
|
|
||
| [tool.pytest.ini_options] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,19 @@ | ||
| import ast | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I sorted all the imports without thinking. |
||
| from copy import copy, deepcopy | ||
| import inspect | ||
| from itertools import chain | ||
|
|
||
| from aenum import EnumType, Enum | ||
|
|
||
| from custom_ast_nodes import Command, DefRule, Variable, aoeOp, EnumNode, Constructor, JumpType, FuncModule | ||
| from Memory import Memory, FUNC_RET_REG, ARRAY_RETURN_REG, FUNC_DEPTH_COUNT, FUNC_RETURN_LENGTH, ARRAY_RETURN_PTR, FUNC_RETURN_ARRAY, ARRAY_OFFSET | ||
| from MyLogging import logger | ||
| from scraper import * | ||
| from scraper import AOE2FUNC, Integer, Constant, Array, Register | ||
| from scraper import aoe2scriptFunctions as aoe2scriptFunctions | ||
| from custom_ast_nodes import Command, DefRule, Variable, aoeOp, EnumNode, Constructor, JumpType, FuncModule | ||
| from Memory import Memory, FUNC_RET_REG, ARRAY_RETURN_REG, FUNC_DEPTH_COUNT, FUNC_RETURN_LENGTH, ARRAY_RETURN_PTR, FUNC_RETURN_ARRAY, ARRAY_OFFSET | ||
| from copy import copy, deepcopy | ||
| from utils import ast_to_aoe, evaluate_expression, get_enum_classes, reverse_compare_op, get_aoe2_var_types, get_list_from_return, TEMP_SUPBSTRING | ||
| from utils_display import print_bordered | ||
| from MyLogging import logger | ||
|
|
||
|
|
||
| reserved_function_names = [ | ||
| 'range', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| import ast | ||
|
|
||
| from scraper import Constant | ||
|
|
||
| class Aoe2Tree: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,18 @@ | ||
| import ast | ||
| from Compiler import Command, Variable, aoeOp | ||
| from scraper import * | ||
| from scraper import mathOp, compareOp, Strenum, typeOp | ||
| from utils_display import read_file_as_string | ||
| from colorama import Fore, Back, Style | ||
| from pprint import pprint | ||
| import re | ||
| from time import time | ||
|
|
||
| from aenum import EnumType | ||
| from colorama import Fore, Back, Style | ||
|
|
||
| from Compiler import Command, Variable, aoeOp | ||
| from MyLogging import logger | ||
| from scraper import * | ||
| from scraper import mathOp, compareOp, Strenum, typeOp | ||
| from utils import get_enum_classes | ||
| from time import time | ||
| from pprint import pprint | ||
| from utils_display import read_file_as_string | ||
|
|
||
|
|
||
| class DefRulePrintVisitor(ast.NodeVisitor): | ||
| def __init__(self, final_list, const_tree = [], NO_FILE=False, TEST=True): | ||
|
|
@@ -27,7 +30,7 @@ def __init__(self, final_list, const_tree = [], NO_FILE=False, TEST=True): | |
| name = node.targets[0].id | ||
| value = node.value.args[0].value | ||
| self.def_const_list.add(name + " " + str(value)) | ||
| except IndexErrors: | ||
| except IndexError: | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wee bug, yeah? |
||
| raise Exception(f"defined Constant has no parameter, line {node.lineno}") | ||
|
|
||
| def visit_if(self, node): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my virtual env. Nobody needs that checked in here.