Skip to content
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

94 improve exception strings #21

Conversation

CaitlinAzazel
Copy link

No description provided.

KingPhilip14 and others added 30 commits February 23, 2023 17:48
* Properly formatted the enums.py file while adding the ActionType enum class. All classes now inherit from Enum.

* Update enums.py

Properly formatted the enums, and every class inherits from the Enum class.
Made the Cook class generic, changed it to be Avatar and checked position inputs. Setter methods now raise exceptions when a illegal parameter is passed.
* Added Generic Tile

* Added the Generic Tile class
* Modified the ObjectType Enum to contain AVATAR
* Added a bit more verbose type-hinting to avatar.py

* Update tile.py

Saved the code in tile.py
* Created Generic Item

Created the generic Item class, added value errors for illegal assignments

* Update item.py

Changed durability to an int and removed bounds
Added indent value to pre-format json dumps
* base of generic station

more work required

* basics of occupied_station

* Station: minor fixes

* Station: major fix

occupied_station didn't have .py... yeah

* fixed station classes

* station / avatar fixes

occupied_by changed to GameObject, isinstance added to setter methods
* Added avatar implementations into the player.py file

Imported the Avatar class and added getter and setter methods for all the fields of the class. To and From json methods now include avatar as well.

* Changed constructor method

Added type hinting into the constructor method.
Added a random seed generator in generate_game.py. Main.py now has a terminal command to pass a seed into the generate function.
* Create movement_controller.py

* Update movement_controller.py

* Update movement_controller.py

reorderd to remove reduntant statements

* Update movement_controller.py

Removed Redundant occupied_by check

* Update movement_controller.py

* Update movement_controller.py

* Update movement_controller.py
* Created the vector.py file

Added the vector class to help standardize accessing coordinates.

* Updated vector.py

Added the str method to the vector file.
* Major changes

type hinting, correct raise errors, etc.
changes seen in:
avatar, game_object, item, tile, station, occupiable_station, interact_controller, movement_controller.

occupiable_station now uses super().__init__() from Tile and Station class.

* Update movement_controller.py

changed movement_controller to reflect changes made to occupiable_station and tile, mainly type hinting.

* Extra type hinting + fixes

Allowing item, held_item, and position to be None through extra type hinting.

score should only be int: now throws error when score is None.

* type hinting fixes + other

added extra type hinting

movement_controller change:
  match client.action.chosen_action: is now match client.action:

check __init__ type hinting for avatar and station, as well as movement_controller.

* fixed score.setter

changed and to or in score.setter
* Changed generation system to game_board.py

Changed the system of how maps are generated.  A docstring providing how it works will be added later

* Updated __help method

Renamed __help to __help_populate() and added more functionality to it for checking for occupied_by.

* Updated game_board.py

This isn't done yet, but changes were made to include Vector in some areas.

* Updated game_board

Added detailed documentation to explain the new system that was implemented for generation. Also added a method to go through the occupied_by chain in avatars() and stations().

* Updated game_board

Added properties for the field variables.

* Finalized game_board

Consolidated avatars() and stations() into   get_objects(). Made generate map() a stand-alone method as well and use it in generate_game.py.

* Update game_board.py

Started making the suggested changes to game_board. It's not finished yet

* Conflict resolutions

I hopefully fixed all the issues wrong with game_board. The properties and type hinting should all be good.

* Finalized game_board

Since lists can't be used as a key in a dict, it was changed to be a tuple. Both documentation and methods were adjusted for this.

* Removed Static Method

Removed the static tag from a static helper method.
* Changed generation system to game_board.py

Changed the system of how maps are generated.  A docstring providing how it works will be added later

* Updated __help method

Renamed __help to __help_populate() and added more functionality to it for checking for occupied_by.

* Updated game_board.py

This isn't done yet, but changes were made to include Vector in some areas.

* Updated game_board

Added detailed documentation to explain the new system that was implemented for generation. Also added a method to go through the occupied_by chain in avatars() and stations().

* Updated game_board

Added properties for the field variables.

* Finalized game_board

Consolidated avatars() and stations() into   get_objects(). Made generate map() a stand-alone method as well and use it in generate_game.py.

* Added vector changes

Created new methods in the Vector class that help add (x, y) values to existing vectors. Added these new functions to the files that use coordinates/positions.
* Update player.py

* Update player.py

* Update player.py

* Update player.py

* Update player.py

* Update player.py

* Update player.py
allow item to be None
* Update player.py

* Update player.py

* Update player.py

* Update player.py

* Create test_initialization.py

* item durability + some unit tests

item durability is able to be set to None if infinite durability

issues to look into: circular import,
needed unit tests, etc.

* Revert "item durability + some unit tests"

This reverts commit cb43a49.

* unit tests + changes

fixed circular import with:
occupiable interface
vector class

unit tests added:
initialization
avatar
tile
occupiable_station

changes:
avatar
enums
tile
occupiable_station
station
vector

* update python-app to 3.11

* added vector to test_initialization

* type hint, enum, and readme fix

fixed enum:

Iteractable -> Occupiable
added type hinting:

tile and occupiable_station from_json methods have more type hinting in match-case section

added to README.md:

added note about requiring Python 3.11 due to type Self

---------

Co-authored-by: MyFridgeIsFinePleaseStopAsking <101206316+MyFridgeIsFinePleaseStopAsking@users.noreply.github.com>
* Update master_controller.py

* Update master_controller.py

* Update master_controller.py

* Update master_controller.py

* added type hints, dont need game stats its specific for 1.7

* changes stuff :)

* added max number of actions per turn

* Update player.py
* Inventory changes

Added documentation and implementation for the inventory for the avatar class. Added appropriate enums and item implementation.

* Inventory controller added

Added an inventory controller that allows the player to select an item from their inventory and set that to be the held item

* Resolved conversation notes

Made the changes wanted.

* Type hinted

I fixed more type hinting

* Resolved discussions

Fixed issues in the inventory_controller to raise errors for bad input.
* tests for game_board + changes

* Update avatar.py

* Item/Avatar unit tests

Made unit tests for Item and Avatar.

---------

Co-authored-by: Gunnar Moody <[email protected]>
* tests for game_board + changes

* Update avatar.py

* Update avatar.py
Fixed the issue of there being multiple game_board files. It is now in the map folder.
* tests for game_board + changes

* Update avatar.py

* Update avatar.py

* interact_controller test

changes includes:

- test_interact_contoller
- Occupiable_Station -> OccupiableStation
- test methods: camel -> snake
- changed item -> held_item in
   - occupiable_station
   - station
- changed GameObject -> ObjectType in player
- plus other fixed

* Update test_interact_controller.py

* Update game_board.py
* Item.py documentation

Started the documentation for item.py. Will have to ask questions on durability and stack_size to ensure it's documented correctly.

* Item Documentation

Finished documentation for item.py.

* Finished Documentation

Finished the documentation for the item, map, and station packages.

* Errors

Trying to fix merge errors

* Fixed issue

Fixed issue that happened when fixing merge conflict.
Added documentation to the rest of the files in the common folder.
* Controller Documentation

All controller files are documented except master controller. I need it explained first before I document and create a pull request.

* Test file documention

I decided to put the test file documentation in this file since it isn't a lot.

* Finalized Documentation

Finished the documentation for all the files.

* Fixed a string

Added a comment to make more sense.
* unit tests

* Update test_movement_controller_if_occupiable_stations.py

* lkjgj

* changed import

* kkll

* SWBf

* asdfa

* added occ stn if not occupied

* Update test_movement_controller_if_occupiable_station_is_occupiable.py

* no fails for occupiable is occupiable

* movement controller test

* :'(

---------

Co-authored-by: MyFridgeIsFinePleaseStopAsking <101206316+MyFridgeIsFinePleaseStopAsking@users.noreply.github.com>
* Created Inventory Controller Tests

Inventory Controller is now tested.

* Added to inventory controller

Added a new test to inventory controller tests to throw error when trying to access an index out of bounds.
* tests for station & test fixes

+ test_station made
+ fixed take_action in station to default pass
+ added examples for stations and occupiable_stations
+ fixed interact_controller with new example stations
+ added example stations to enums
+ changed item class
  - default durability now: None
  - changed order of json methods

* tests for master_controller

+ fixed master_controller
+ fixed match case in player and object_type setter
+ fixed tile match case
+ fixed game_board
+ fixed issue with game_object
+ user_client: capitalized CLIENT, added avatar to take_turn
+ added avatar to take_turn in base_client and base_client_2
+ changed current_world to self.world in engine
+ made temp game_board in generate_game

* extra test fixes

* Update player.py

* comment for station_receiver_example
JeanAEckelberg and others added 28 commits May 27, 2023 01:14
* Fix Merge
Added more info for the avatar class in the README.
* Added base visualizer

* Initial Commit

* Update main.py (#35)

* Update main.py

* Update main.py

* added background color (#34)

* added background color

* Update config.py

* added comments to config

* Update main.py

* Update main.py

* Update main.py

* Update main.py

* Update python-app.yml

* Let me merge (#39)

* Turn_Log list populated

* Added TODOs

* Added more framework code

* Add event method to adapter (#44)

* added events in main and methods for them in adapter

* Config margins (#47)

* Fix merge (#46)

* Fix Merge

* Update config.py

* added margins

* Update config.py

---------

Co-authored-by: Jean A. Eckelberg <[email protected]>

* Implemented spritesheets on bytesprite (#48)

* First changes

Committing first changes for the sprite and bytesheet files

* Spritesheets implemented

Implemented spritesheets into Bytesprite.

* Fixed PR requests

Fixed wanted changes.

* Implement text class visualizer (#45)

* text class created

created class for making text in rect
Default Font: Bauhaus93
Default Color: #daa520
Default Position: Vector(0, 0)

* added getter and setter methods

added getter and setter methods to protect values of text

* added comments

* Update text.py

- fixed constructor
- fixed type hinting
-  added reevaluating to created text when changing values in setters
- allow full support of possible Color parameters

* Update text.py

- fixed some formatting
- fixed wrong check: str -> int

* font_size type hint

* Readme documentation (#51)

* Started documentation updates for README.md.

* Finished

Added documentation for all the files that were changes in revamp's lifespan.

* Development Notes

Added development notes to the README.

* Edits

Made requested changes.

* Plz approve (#57)

* Fix merge (#46)

* Fix Merge

* wip

* needs review

* Fixed it all... hopefully

---------

Co-authored-by: MyFridgeIsFinePleaseStopAsking <[email protected]>

* 58 create 3d list to store bytesprites (#60)

* Added functions to calculate logic and a data structure to store it all

* 59 create an example bytesprite (#65)

* Created example bytesprites, moved files around for a temporary fix, Will need to find a more permanent fix. Investigate a visualizer option when running built launcher?

* Added visualizer to build run with the v subcommand

* Create sidebars (#72)

* Fix merge (#46)

* Fix Merge

* created sidebars

* type safe

* fixed

* Update adapter.py

---------

Co-authored-by: Jean A. Eckelberg <[email protected]>

* Implement button visualizer (#71)

* Fix merge (#46)

* Fix Merge

* Fixed README (#68)

Added more info for the avatar class in the README.

* basic button implementation

- still needs work
- includes some testing in adapter class

* fixes and changes

added:
- better documentation
- background button to text
- padding parameter
- border_radius parameter (to round corners of button
- color parameters for bg button
- changed collision logic to work with bg rect, not text rect

* code clean up + timer

cleaned up code and added timer in button class to help display clicked colors better

* fixed documentation + timer

- relocated documentation to proper location
- fixed button timer to be adjustable and consistent with frame rate

* more timer changes

- reverted back to milliseconds, which do not need to be multiplied by the frame rate
- used math.floor when needed
- changed click_duration to int

---------

Co-authored-by: Jean A. Eckelberg <[email protected]>
Co-authored-by: Ian <[email protected]>

* Start screen (#76)

* Made Start Screen

Made progress on the start screen.

* Made writing logs async.
Allowed position to be set through text and button rect
Changed default background color for button
Renamed start_menu_templates.py to menu_templates.py
Refreshed sidebars in prerender
Added second avatar to generate_game.py
Added End screen to template

* Added interact controller back to master_controller.py

* cleaned up some duplicate code and resized the sidebars

* removed print statement

* Started documentation updates

---------

Co-authored-by: JeanAEckelberg <[email protected]>

* Sphinx documentation (#78)

* Fix merge (#46)

* Fix Merge

* Updated requirements.txt

Updated the requirements for the project.

* Fixed README (#68)

Added more info for the avatar class in the README.

* Starting to document

Starting to add sphinx documentation.

* Created rst files

Created the rst and html files for every file.

* Testing

Testing different things to make the formatting make sense.

* Fixing mistake

Fixed a mistake from a merge conflict.

* Item Docs

Finished the item docs for sphinx.

* Map Directory

Fixed documentation in Map directory. Will need to find solution for visuals.

* Added Stations

Added station docs. May need to expand on their explanations.

* Fixed Formatting

Fixed the formatting for GameBoard docs and README. Thanks Jean.

* Reformatting

Reformatted and made small changes to some files

* Game Package Classes

Fixed docs for Game package classes like enums and avatar

* Test File Docs

Formatted the Test File docs. Will eventually add proper docstrings to the individual files themselves.

* Formatting

This should be the final formats for the rst files.

* Controller Docs

Made changes for the Controller documents

* Test Docs

Made documentation for the tests.

* Test Docs 2

Last bits of the documentation for the test suit files.

* Utils Docs

Started documentation for the Utils files and the last few that are missing

* Changes

Changes for some files and an update to requirements.txt.

* Extra docs

Should be done adding documentation for everything.

* Fixes

Fixing warnings

* Removal

Removed unnecessary files

* Finalized

Should be done with documentation for main engine.

---------

Co-authored-by: Jean A. Eckelberg <[email protected]>

* Playback template (#77)

* Playback Buttons Template Basics

added:
- opencv added to requirements
- playback template for watching visualizer

modified:
- adapter to contain PlaybackButtons
- config file variables
- main to control the results of PlaybackButtons
- type hinting to menu_templates
- button to check if button can be clicked again during click_duration

* Switched to Flags instead of structs

* fixed multi-click bug

* main changes

- more type hinting
- optimized video recording to one frame per turn using bicubic as default setting
- organized methods in main

* Fixed button order

---------

Co-authored-by: Jean Eckelberg <[email protected]>

---------

Co-authored-by: JuliaCaesar <[email protected]>
Co-authored-by: Ian <[email protected]>
Co-authored-by: Gunnar Moody <[email protected]>
Made base file and folder structure.
* Base file

Made base file and folder structure.

* Small fix

Made small fix for PyCharm to stop crying.
* 3 New Files

Made GroupRun, TeamType, and University model files

* Added nullables

Added nullables to existing files

* Added unique

Added the unique constraint to team_type_name and uni_name.

* New things

Added some new files and foreign keys.

* Added new files

Added errors and turn table files.

* Fixes

Added fixes to all the files as needed.

* fixed?

* fixed again

* Small fix

Added Integer() to the primary key of the run file.

* Fixed

Fixed more Integer() that was missing.

---------

Co-authored-by: JuliaCaesar <[email protected]>
Co-authored-by: JuliaCaesar <[email protected]>
* Tweaked game generation

* Tweaked game generation names

* Added type

* moved to actual function

* cleaned up ternary

* Added comments

* documentation updates

---------

Co-authored-by: KingPhilip14 <[email protected]>
* Renaming

Renamed titles in rst files

* Fixing docs folder issue

Added everything from byte_engine_docs/build/html to a new, top-level docs folder
* Renaming

Renamed titles in rst files

* Fixing docs folder issue

Added everything from byte_engine_docs/build/html to a new, top-level docs folder

* Create .nojekyll

Added nojekyll file

---------

Co-authored-by: Jean A. Eckelberg <[email protected]>
* Added visualizer config option for held items and refactored list comprehension

* Changed bytesprite creation model to be more explicit and clear
…lized that the videowriter wasn't working when instantiated correctly due to new codec not supporting alpha values and writing the frames with flipped axes (#107)
* Fixed issue with populating map

* Can't put walls on stations
* Documented 2 examples

Documented 2 example files to explain the new architecture of the BytespriteFactory implementations.

* Documented ByteSprite

Documented the ByteSprite file

* Finished folder docs

Finished the folder documentation for bytesprite.

* Removed duplicates

Removed duplicate requirements from the requirements.txt

* Removed sidebars

Removed sidebars that are no longer used.

* Removed comment

Removed the comment related to sidebars
* Documented 2 examples

Documented 2 example files to explain the new architecture of the BytespriteFactory implementations.

* Documented ByteSprite

Documented the ByteSprite file

* Finished folder docs

Finished the folder documentation for bytesprite.

* Removed duplicates

Removed duplicate requirements from the requirements.txt

* Removed sidebars

Removed sidebars that are no longer used.

* Removed comment

Removed the comment related to sidebars

* Made changes

Made requests changes.
…}.<var_name> must be a It is a(n) {type(<var_name>)} with the value of {var_name}'
…}.<var_name> must be a It is a(n) {type(<var_name>)} with the value of {var_name}.' in game_board.py and added periods to the errors in item.py.
…}.<var_name> must be a It is a(n) {type(<var_name>)} with the value of {var_name}.' in game_board.py and added periods to the errors in item.py.
…}.<var_name> must be a It is a(n) {type(<var_name>)} with the value of {var_name}.' in game_board.py and added periods to the errors in item.py.
…}.<var_name> must be a It is a(n) {type(<var_name>)} with the value of {var_name}.' in game_board.py and added periods to the errors in item.py.
…}.<var_name> must be a It is a(n) {type(<var_name>)} with the value of {var_name}.' in game_board.py and changed occupational_station.py and tile.py to ValueError to The object type of the object is not handled properly. The object type passed in is {temp}.
…ar_inventory.py, test_game_board_no_gen.py, test_item.py, test_occupiable_station.py, and test_station.py so that their error messages matched in both their main file and test file. Still need to fix OccupiableStation test_fail_item_occ, test_set_quantity_fail_greater_than_0, test_set_quantity_fail_stack_size, and test_stack_size_fail_quantity
…ar_inventory.py, test_game_board_no_gen.py, test_item.py, test_occupiable_station.py, and test_station.py so that their error messages matched in both their main file and test file. Still need to fix OccupiableStation test_fail_item_occ, test_set_quantity_fail_greater_than_0, test_set_quantity_fail_stack_size, and test_stack_size_fail_quantity
@CaitlinAzazel CaitlinAzazel deleted the 94-improve-exception-strings branch February 17, 2024 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants