Oscr

Latest version: v2.1.0

Safety actively analyzes 622918 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 3

2.1.0

Finally bringing refresh token support, this release should hopefully not crash and burn instantly, but absolutely will. Apart from the big refresh token feature, this is mostly a minor release with a few improvements here and there and a couple of bug fixes.

Functionality

- Added refresh token support. (33, 139)
- Added "dibs" to the default blacklist and regexBlacklist. (140, 141)
- Removed ``--format-old`` runtime argument. (105, 131)

Cleanup/Optimisation

- Deferred various functionalities in ``main.py`` to functions in other modules. (128, 145)
- Optimised the settings menu to allow for easier addition of new config and ini options. (127, 139, 142)
- Combined ``Log.clear()`` and ``Log.get()`` into ``Log.request()``. (125, 130)
- Other general cleanup, readability and optimisation improvements. (136, 137, 139, 142, 145)

Documentation/Logs

- Changed "core" folder to "oscrcore" to avoid issues with pip. (138, 139)

Bug Fixes

- Fixed a crash on calling ``resetConfig()``. (132, 134)
- Fixed a crash on passing an unknown run-time argument. (133, 135)

2.0.0

After way too long, it's finally here! **2.0.0**! And it doesn't have any GUI. This isn't to say I haven't done much work, it's actually to say I got too carried away with backend. This update includes a major refactor of basically all of the code, along with a few new config options and runtime arguments.

**Note:** `--format-old` is a very precarious function that will be deprecated in 2.1.0. It might work, it might not. It's probably safer to manually move over your praw.ini and config.json settings to the new locations.

Functionality

- Added ``--clean-hunt`` runtime argument to remove comments containing "treasure hunt". (48, 87, 115)
- Added caseSensitive config key. Determines whether or not OSCR is case sensitive when matching regexes or blacklisted comments. Set to False by default. (57, 69)
- Added printLogs config key and ``--print-logs`` runtime argument to override the config. Determines whether or not OSCR prints the log to the console. (70, 71)
- Added reportTotals config key and ``--report-totals`` runtime argument to override the config. Determines whether or not OSCR prints total statistics to the console. (65, 72)
- Added "unclaiming" to the default blacklist. (69, nice)
- OSCR now ignores punctuation when matching comments to blacklist entries. (80, 83)
- Added userList config key. If any users are specified in the list, OSCR will only check comments that are in reply to those users.(85, 87)
- Added ability to leave subredditList (and new userList key) empty, which will disable them, letting OSCR check comments on any subreddit or in reply to any user.
- OSCR now collects global variables at program initialisation (in the ``oscr`` script) and not ``main.py``. (49, 75)
- Contained all code in ``main.py`` within an ``oscr()`` function for the purpose of the above change. (50, 75)

Cleanup/Optimisation

- Refactored entire program with a much stronger object-oriented focus. This opens the door for a lot of backend improvements and optimisation. (108, 109)
- Re-wrote stats handling to use JSON and classes, making ``statistics.py`` a much neater module. (106, 109)
- Moved arguments checking to its own module, ``arguments.py``. (52, 75)
- Moved comment handling to its own module, ``comment.py``. (81, 82)
- Added type hinting. (101, 103)
- Staticised constant variables. (97, 96, 98)
- Optimised generation of ``config.json`` and ``praw.ini``. (51, 66, 67)
- Optimised handling of ``praw.ini``, including updating & formatting from CDRemover to OSCR. (76, 84)
- ``calculateEssentials()`` is no longer called unnecessarily. (53, 59)
- Combined default regexBlacklist items into one regex. (117, 118)
- Moved the default config variable to ``globals.py``. (56, 66)
- Made many miscellaneous optimisation and readability improvements. (77, 78, 79, 84, 96, 104, 109, 112, 114, 118, 120, 121)

Dependencies

- Added colored for coloured console output. (94)
- Updated Python requirement to >= 3.5 for type hinting. (107)

Documentation/Logs

- Moved documentation to readthedocs. (93, 99)
- Renamed ``oscrmodules`` to ``core``. (110, 111)
- Moved ``config.json`` to ``~/.config/oscr`` on Linux and Mac, and ``AppData\\Roaming\\oscr`` on Windows. (54, 64)
- Changed how ``praw.ini`` is read and moved file to ``~/.config/oscr`` on Linux and Mac, and ``AppData\\Roaming\\oscr`` on Windows. (55, 84)
- Improved log output surrounding comment retrieval & checking. (60, 68)
- Added license specification to ``setup.py``. (73, 74)
- Changed config guide from bullet point list to table. (83)
- Added colouring to logs, currently only on warnings. (91, 94)
- Generally improved log handling. (95, 96)
- Renamed ``gvars`` to ``Globals``. (100, 102)

Bug Fixes

- 45: Crash on attempting to use ``--show-config`` due to accidentally assigning ``Globals()`` instance to ``gvars.config``. (fixed in 58)
- 61: Attempting to update integer or boolean keys in the settings menu causes an infinite loop. (fixed in 63)
- 86: Regexes may delete comments that are not bot interactions. (fixed in 87)
- 88: Runtime arguments are not processed in the correct priority order. (fixed in 90)
- 89: Crash on passing conflicting arguments. (fixed in 90)
- 92: Potential crash on failing to update a statistic. (fixed in 94)

1.2.1

Cleanup/Optimisation

- Minor optimisation improvements in log.py, misc.py and statistics.py
- update() now uses smaller None-type instead of needlessly initialising an empty array
- Removed time.sleep() statement from comment checker (see note 1)

Documentation

- Added --version option to print the currently installed version.
- Removed credits from start of main.py (see note 2)

Dependencies

- praw; require >= 7.1.2.
- alive_progress; require >= 1.6.1.

Bug Fixes

- 16: Recursion error on initialising Reddit instance with empty Redditor *(fixed upstream in either PRAW 7.1.1)*

Notes

1. This was only there to slow down comment checking for debugging purposes.
2. This should have been committed in 1.2.0, but I somehow didn't.

1.2.0

Functionality

- Added support for regexes (big thanks to /u/metaquarx and /u/Tim3303 for their help with this; also, see note 1).
- For this purpose, added:
- regex config key that tells the program whether or not to check comments using regexes, by default set to False.
- regexBlacklist config key, to contain the regexes to check comments against, by default excludes anything with "treasure hunt".
- Added re import to main.py.
- Added a progress bar to console output (not saved to log file).
- Added new subredditList config key, containing a whitelist of subreddits the program is allowed to search through; contains only "transcribersofreddit" by default.
- Removed torOnly config key as of above change.
- Added a "-e" option to the settings menu, allowing users to escape to the main menu if they accidentally chose the incorrect key.
- Added a --show-config option to print the contents of the config file.

Cleanup/Optimisation

- Condensed comment search function thanks to new subredditList config key.
- Removed unnecessary failedStats check in fetch() (see note 2).
- Changed initialiseGlobals() to no longer unnecessarily pass empty lists.
- Removed unused import.
- Removed python3 env in main.py (see note 3).

Documentation

- Added a "How to use this menu" option to the settings menu.
- Clarified log messages for when OSCR counts less comments than the set limit.
- Added a log message to --format-cdr to indicate when praw.ini is already formatted to OSCR.
- When encountering a JSONDecodeError in getConfig(), OSCR now logs what the error was.
- Added copyright notices to the beginnings of all files except setup.py and __init__.py
- Added a note giving a minimum recommended cutoff of 15 minutes.
- Corrected a spelling error in README.md.
- Readibility improvements in settings.py.
- Moved credits from main.py to CREDITS.md
- Added a --credits option to print the credits in the console.

Dependencies

- alive_progress; added.

Bug Fixes

- Fixed int and boolean based keys not being updated by the settings menu.

Notes

1. Using regexes is HEAVILY DISCOURAGED for those who do not have a clear understanding of how they work. Incorrect regexes can delete A LOT more than what you might want to. For this reason, useRegex is set to False by default.
2. fetch() is only ever called once per run-time, so this piece of code would never run.
3. This forces the program to run in Python 3. It was an old catch for systems that still defaulted to Python 2, and I'm fairly sure it only affected Linux; more importantly, it should be redundant if the program is being run through pip or is run as `python3 oscr` instead of just `python oscr`.

1.1.1

Cleanup:

- Removed lingering debug print() statement.

Documentation:

- Added copyright notices;
- One at the beginning of the code in the oscr script file,
- One to be printed when the program is run.
- Added repository badges/information to README.md

Bug Fixes:

- Fixed 34: Crash caused by comparing None to int() after settings module output None-type to "limit" in config.json.
- Fixed 35: Converts all numerical limits to None-type.
- Fixed 36: Misleading logs could suggest a bug if available comments are less than the user's limit

1.1.0

Name:

- Changed the name of the project from ClaimDoneRemover to OSCR (Open Source Caretaker for Reddit), lovingly nicknamed Oscar.
- As a part of this, the pip package is now located at `https://pypi.org/project/oscr/`

Functionality:

- Added a settings menu from which you can edit config.json and praw.ini (see note 1).
- Added several arguments that can be passed to oscr console command;
- --format-cdr renames .cdremover and [cdrcredentials] to .oscr and [oscr], !! ADVISED TO RUN THIS BEFORE ANYTHING ELSE IF UPDATING FROM AN OLD VERSION !!
- --help displays a list of commands,
- --no-recur forces the program to run only one cycle regardless of 'recur' configuration,
- --reset-config resets the config file to defaults (useful if you irreparably break something like I did),
- --settings runs the settings menu.
- Added capability to stop attempting to update each statistic after a failure to do so (see note 2).
- Now defaults non-numeric instances of config["limit"] to None type (see note 3).
- Switched from .format() to fstrings for more succinct string formatting.
- Global variables are now contained in gvars class, passed into all necessary functions (see note 4).
- config is now a global variable.

Cleanup:

- setup.py now imports version from oscrmodules.gvars, avoiding the need to declare the variable twice.
- Squashed some code verbosity; unnecessary variable declarations, if statements with longer conditions than neeeded, etc.
- Removed unnecessary imports.
- fetch() and update() no longer unnecessarily globalise variables.

Documentation:

- Replaced the Notes section in README.md with a more informative Additional Help and FAQ section.
- Corrected minor spelling errors in log output and commenting.
- Avoided potential double timestamp in log noting failure to decode config.json.
- createIni() now logs its attempts to create praw.ini

Bug Fixes:

- 26: New "deleted" lines are appended to stats.txt rather than just updating one line as was intended.
- 27: Potential error with displaying log message in the format "X/None comments checked successfully".
- 28: Potential error with displaying log message in the format "X/Y comments checked successfully" where X is greater than Y (see note 5).
- 29: Incorrect INI Path for Windows (thanks to /u/--B_L_A_N_K--)
- 31: Program crash on attempting to fetch config.json if the parent directory is missing (see note 6).
- 32: Potential crash if config['logUpdates'] configuration was set to false.

Notes:

1. The code for this is god-awful, but it does the job and I won't be touching it for a while since I've already had far too much of it, plus, other hardships mean I haven't the mental capacity to work it out right now. If you like my r/badcode flair you can take a look but expect to be disgusted.
2. Added new global list failedStats for this purpose.
3. This was in the changelog for v1.0.0, but apparently I forgot to actually make the commit.
4. As much as I hated having to do this, sharing the global variables across files doesn't work with a program this complex.
5. This would have occurred where a limit was set that was not a mulitple of 25.
6. The new dumpConfig() function aids this.

Page 1 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.