GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — vision-agent/.cursorrules at main · eotechlabs/vision-agent Expand file tree/ Copy path.cursorrulesMore file actions 74 lines (65 loc) · 3.96 KB / Copy path.cursorrulesFile metadata and controls74 lines (65 loc) · 3.96 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 # Code Style - Use `_` prefix for all private variables, constants, functions, methods, properties, etc. that don't need to be accessible from outside the module - Mark everything as private that does not absolutely need to be accessible from outside the module - Use `@override` (imported from `typing_extensions`) decorator for all methods that override a parent class method - Use type hints for all variables, functions, methods, properties, return values, parameters etc. - Omit `Any` within type hints unless absolutely necessary - Use built-in types (e.g., `list`, `dict`, `tuple`, `set`, `str | None`) instead of types from `typing` module (e.g. `List`, `Dict`, `Tuple`, `Set`, `Optional`, `Union`) wherever possible - Instead of `Optional` use `| None` - Create a `__init__.py` file in each folder - Never pass literals, e.g., `error_msg`, directly to `Exceptions`, but instead assign them to variables and pass them to the exception, e.g., `raise FileNotFoundError(error_msg)` instead of `raise FileNotFoundError(f"Thread {thread_id} not found")` ## FastAPI - Instead of defining `response_model` within route annotation, use the model as the response type in the function signature - Do not assign `None` to dependencies but instead move it before arguments with default values # Testing - Use `pytest-mock` for mocking in tests wherever you need to mock something and pytest-mock can do the job. # Documentation ## Docstrings - All public functions, constants, classes, types etc. should have docstrings - Document the constructor (`__init__`) args as part of the class docstring - Omit the `__init__` docstring - All function parameter should be documented with their type (followed by `, optional` if there is a default value) in parenthesis and description - In descriptions, use backticks for all code references (variables, types, etc.), including types, e.g., `str` - When referencing a function, use the function name in backticks plus parentheses, e.g., `click()` - When referencing a class, use the class name in backticks, e.g., `VisionAgent` - When referencing a method, use the class name in backticks plus the method name in parentheses, e.g., `VisionAgent.click()` - When referencing a class attribute, use the class name in backticks plus the attribute name, e.g., `VisionAgent.display` - Use `Example` section for code examples - Use `Returns` section for return values - Use `Raises` section for exceptions listing all possible exceptions that can be raised by the function - Use `Notes` section for additional notes - Use `See Also` section for related functions - Use `References` section for references - Use `Examples` section for code examples - Example of a good docstring: ```python def locate( self, locator: str | Locator, screenshot: Img | None = None, model: ModelComposition | str | None = None, ) -> Point: """ Find the position of the UI element identified by the `locator` using the `model`. Args: locator (str | Locator): The identifier or description of the element to locate. screenshot (Img | None, optional): The screenshot to use for locating the element. Can be a path to an image file, a PIL Image object or a data URL. If `None`, takes a screenshot of the currently selected screen. model (ModelComposition | str | None, optional): The composition or name of the model(s) to be used for locating the element using the `locator`. Returns: Point: The coordinates of a point on the element, usually the center of the element, as a tuple (x, y). Raises: ValueError: If the arguments are not of the correct type. ElementNotFoundError: If no element can be found. Example: ```python from askui import VisionAgent with VisionAgent() as agent: point = agent.locate("Submit button") print(f"Element found at coordinates: {point}") ``` """ ... ``` |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |