aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
...
| * | | | | | | | | | | | | Merge remote-tracking branch 'upstream/master' into doc-impGravatar Numerlor2021-01-11-1234/+646
| |\ \ \ \ \ \ \ \ \ \ \ \ \
| * | | | | | | | | | | | | | Remove old reference to CachedParser and unused constGravatar Numerlor2021-01-11-4/+1
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | Check for containment instead of always getting the value from the dictGravatar Numerlor2021-01-11-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Getting the value from a defaultdict will always create the key for it, creating unnecessary entries every time a symbol is fetched from the bot
| * | | | | | | | | | | | | | Notify the user that inventories were refreshed on cache clearsGravatar Numerlor2021-01-11-1/+1
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | Don't convert package names into lowercaseGravatar Numerlor2021-01-11-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The converter used to set them already ensures this for us, making the call redundant
| * | | | | | | | | | | | | | Ensure footer fits into messageGravatar Numerlor2021-01-11-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The footer also now says Moved: at the start to clarify the meaning of the symbols to the user
| * | | | | | | | | | | | | | Use a dictionary of lists instead of set for renamed symbolsGravatar Numerlor2021-01-11-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A dictionary allows us to grab the original symbol name and then get all the renamed symbols from it, with the improvements to `ensure_unique_symbol_name` we can also use lists instead of sets as each symbol we add should be unique
| * | | | | | | | | | | | | | Handle renaming conflicting symbols in ensure_unique_symbol_nameGravatar Numerlor2021-01-11-15/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously update_single looped this function until there were no duplicates and when creating new symbols the function had to check if the symbol to create a new name from started with a group/package to avoid redundancy. The new approach ensures a new symbol is always unique when returning by handling the containment check inside and outputting a symbol name in the format of package.group.symbol which should always be unique
| * | | | | | | | | | | | | | Update outdated docstringGravatar Numerlor2021-01-11-1/+1
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | Send a message to devlog instead of logging a warningGravatar Numerlor2021-01-11-1/+30
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | Resolve wrapped command callbacks in the source commandGravatar Numerlor2021-01-10-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without this the command will fetch the source of the wrapper
| * | | | | | | | | | | | | | Create decorator for update_wrapper_globals mimicking functools.wrapsGravatar Numerlor2021-01-10-9/+30
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | Change the func name to wrapped for clarityGravatar Numerlor2021-01-10-6/+6
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | Rename CachedParser to BatchParser and move it to its own moduleGravatar Numerlor2021-01-10-166/+180
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | Defer import to avoid circular importsGravatar Numerlor2021-01-10-1/+1
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | Move functions strictly related to parsing html to the _html moduleGravatar Numerlor2021-01-10-120/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some constants need to be shared between html and parsing, because they may also be wanted to be edited by the cog user to change the behaviour, they were moved into the package's init.
| * | | | | | | | | | | | | | Expand docstringGravatar Numerlor2021-01-10-1/+6
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | Bump markdownify to 0.6.1-0.6.*Gravatar Numerlor2021-01-10-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 0.6 release brought a new parameter that has to be included in all tag handling methods
| * | | | | | | | | | | | | | Set exception on futureGravatar Numerlor2021-01-10-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without the exception set, to the user the bot would fail silently if an exception was handled here
| * | | | | | | | | | | | | | Refresh inventories when the redis cache is clearedGravatar Numerlor2021-01-10-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because the futures are cleaned up and Markdown only exists in the cache after a short time, items that were requested previously and had the cache cleared would be missing from the CachedParser
| * | | | | | | | | | | | | | Handle equal DocItems in the queueGravatar Numerlor2021-01-10-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This could be handled by using sets to hold the items in _page_symbols, but ultimately the check has a much smaller cost than having thousands of sets for the urls. Because we create futures for every item that ends up in the queue we can also skip the .get is None check and instead fetch the future directly from the dict
| * | | | | | | | | | | | | | Stop scheduled and long running tasks on cog unloadGravatar Numerlor2021-01-10-0/+6
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | Periodically clear unnecessary futures from the _item_futures dictGravatar Numerlor2021-01-10-1/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code has no way of reaching futures through new requests after their result has been set as that also includes setting its value in redis.
| * | | | | | | | | | | | | | Do not add package name to the front of the symbol if it's already thereGravatar Numerlor2021-01-09-2/+11
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | Do not ignore symbols with slashes.Gravatar Numerlor2021-01-09-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases these are actual symbols that we can look up
| * | | | | | | | | | | | | | Ensure no symbols get overwritten while generating symbol mappingsGravatar Numerlor2021-01-09-19/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code handling this was moved to a function to achieve this cleanly. Includes fixes for bugs where incorrect package was added to the symbol name in the second branch and an incorrect symbol being added in the third branch Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | | | | | | | | Do not attempt to set cache values for symbols that were not foundGravatar Numerlor2021-01-09-1/+2
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | Remove redundant variableGravatar Numerlor2021-01-09-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | | | | | | | | Add comments to truncation handling codeGravatar Numerlor2021-01-09-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | | | | | | | | Use update_wrapper instead of wrapsGravatar Numerlor2021-01-09-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're not using it as a decorator so using wraps only complicates the call syntax
| * | | | | | | | | | | | | | Return the fetched inventory in the Inventory converterGravatar Numerlor2021-01-09-46/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of fetching it again in the cog, the converter now returns the inventory for later use. The set command now no longer attempts to reschedule the inventory, and a bug that caused the inventory rescheduling to do nothing in `update_single` was fixed after moving it to its own method
| * | | | | | | | | | | | | | Wait for the inventory to be refreshed before attempting any fetchingGravatar Numerlor2021-01-09-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the bot returned an error if a symbol was not found while inventories were refreshing, but we can just wait for the to finish refreshing and then the symbol may be filled in. A logging call to notify of the refresh being done was also added.
| * | | | | | | | | | | | | | Create futures for all items in the queueGravatar Numerlor2021-01-09-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Creating futures for everything and then awaiting at the end takes care of all the potential race conditions that may pop up from items that are parsed and sent to redis while the get_markdown method is in the middle of fetching a page. In case it happens with the implementation we'll just need to move the item to the front and the future will get a result set soon afterwards.
| * | | | | | | | | | | | | | Clear up docstring so it doesn't rely on private attributeGravatar Numerlor2021-01-09-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | | | | | | | | Revert "Clear up docstring so it doesn't rely on private attribute"Gravatar Numerlor2021-01-09-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit ad90978f
| * | | | | | | | | | | | | | Run html parsing in an executorGravatar Numerlor2021-01-09-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The parsing may take up to a few hundred ms depending on the amount of work it has to do
| * | | | | | | | | | | | | | Simplify the implementation of the custom strainerGravatar Numerlor2021-01-09-15/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The strainer now forces the text attribute to be None, simplifying the check on strings and falls back to the superclass' method on non string elements
| * | | | | | | | | | | | | | Strip whitespace from symbol Markdown before returning itGravatar Numerlor2021-01-09-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The html we parse frequently ends up with trailing and sometimes leading newlines which get stripped out by discord anyway, we have no reason to keep those around when sending the Markdown over to redis
| * | | | | | | | | | | | | | Use cancel_all instead of manually calling cancel repeatedlyGravatar Numerlor2021-01-09-2/+1
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | Use send_denial util instead of creating embed manuallyGravatar Numerlor2021-01-09-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The symbol is also no longer sent back to the user, as it is not necessary and we can skip the cleanup on it
| * | | | | | | | | | | | | | Return the sent messageGravatar Numerlor2021-01-09-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows the caller to work with the message further
| * | | | | | | | | | | | | | Move copyright outside of license textGravatar Numerlor2021-01-09-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | | | | | | | | Use string addition instead of joinGravatar Numerlor2021-01-09-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With only two strings, the addition is a bit clearer than constructing and joining a tuple Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | | | | | | | | Change param styling to be consistent with the repoGravatar Numerlor2021-01-09-5/+6
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | Call command method directlyGravatar Numerlor2020-12-15-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | | | | | | | | Make reschedule delays a module constantGravatar Numerlor2020-12-15-3/+10
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | Reuse form body to construct log messageGravatar Numerlor2020-12-15-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | | | | | | | | Clear up grammarGravatar Numerlor2020-12-15-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | | | | | | | | Simplify flowGravatar Numerlor2020-12-15-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The else is a bit clearer than the early return
| * | | | | | | | | | | | | | Lock inventory refreshesGravatar Numerlor2020-12-15-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All commands that refresh the inventories in some way are now locked to prevent various race conditions that may have occurred in the unlikely scenario that they got triggered together, the fetching part of the get command now also has to wait for the running inventory refresh to finish before proceeding to fetch and parse the html