aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py (unfollow)
Commit message (Collapse)AuthorLines
2020-07-25Ensure all renamed symbols are keptGravatar Numerlor-1/+2
After the restructure behaviour change in d790c404ca3dba3843f351d6f42e766956aa73a1, the add to renamed_symbols was not readded and symbols that only passed the first check were being missed.
2020-07-22Change ValidPythonIdentifier tests to PackageName.Gravatar Numerlor-11/+10
2020-07-22Remove paragraph chars from descriptionsGravatar Numerlor-1/+1
2020-07-22Hold url parts in DocItem separately.Gravatar Numerlor-3/+8
This allows us to save up some memory by not creating unique strings with the base url repeated between them.
2020-07-22Remove caching from get_symbol_embed.Gravatar Numerlor-1/+0
The web request is already cached, and parsing doesn't much more time, but without moving the logic around the cache prevents the stat increase when a symbol is requested.
2020-07-22Change DocCog to use the new parsing module fully.Gravatar Numerlor-62/+7
The parsing module provides an interface for fetching the markdown from the symbol data provided to it. Because it's now fully done in an another module we can remove the needless parts from the cog.
2020-07-22Create the parsing interface function.Gravatar Numerlor-21/+71
Other functions from the module are not intended to be used directly, with the interface of it being the added function which accepts the symbol and calls internals. All other names except imports and log had the underscore prefix added to accommodate this.
2020-07-22Create a function for getting the result markdown.Gravatar Numerlor-0/+21
2020-07-22Fix ordered list indices in markdown converter.Gravatar Numerlor-0/+18
markdownify relies on the parent tag's index method, which goes through all of its contents, if there is anything else in the contents apart from the li tags, those indices are then shifted.
2020-07-22Move DocMarkdownConverter to parsing.Gravatar Numerlor-34/+34
2020-07-22Fix handling of elements when fetching signatures.Gravatar Numerlor-1/+1
After the change to `find_elements_until_tag`, the text contentsneed to be extracted from the tags instead of passing them directly to re.
2020-07-22Remove conversion to str when finding elements.Gravatar Numerlor-2/+2
The tags need to be processed down the line, which is not viable on strings.
2020-07-20Create a function for collecting signatures.Gravatar Numerlor-36/+10
By getting the signatures without the description we get more flexibility of parsing different symbol groups and decouple the logic from the description which can be parsed directly with the new `find_elements_until_tag` based function.
2020-07-20Simplify module parsing method.Gravatar Numerlor-9/+10
Instead of returning None and multiple values, the method now only returns the string of the description. Previously the parsing returned None and quit when appropriate tags for shortening the description were not found, but the new implementation simply defaults to the provided start tag if a better alternative is not found.
2020-07-20Add function for finding tags until a matching tagGravatar Numerlor-0/+35
This will allow flexibility in the future when collecting tags for the description and signature of symbols. The base is a function which accepts a callable which is called and iterated over, but 3 names with a partial function that has the callable supplied are provided to keep the outside interface neater.
2020-07-20Simplify cutoff text.Gravatar Numerlor-3/+4
"read more" seemed out of place with no permalink over it.
2020-07-20Remove permalink from truncated markdown.Gravatar Numerlor-3/+3
The permalink serves no functional purpose in the embed, as it is already included in the title. But it does add the complexity of passing in the url to the parser.
2020-07-20Rename parser.py to parsing.py.Gravatar Numerlor-1/+1
Parser is a stdlib module name, a rename avoids shadowing it.
2020-07-19Move markdown truncation into parser moduleGravatar Numerlor-25/+31
2020-07-18Move main parsing methods into a new moduleGravatar Numerlor-96/+108
2020-07-18Move async_cache into a separate moduleGravatar Numerlor-31/+34
2020-07-18Create a package for the Doc cog.Gravatar Numerlor-6/+8
2020-07-14Rename inventories to doc_symbols.Gravatar Numerlor-10/+10
2020-07-14Change docstrings to use suffixed command names.Gravatar Numerlor-3/+3
2020-07-14Change package name converter to only accept _a-z.Gravatar Numerlor-15/+13
Package names are now directly used for stats, where the lowercase a-z characters and _ are used.
2020-07-14Make the symbol parameter optional.Gravatar Numerlor-2/+2
The commands were changed to be greedy, this however made them required arguments breaking the access to the default listing of the available inventories
2020-07-14Add doc suffix to doc commands.Gravatar Numerlor-4/+4
The `set` command shadowed the `set` symbol, causing the command to seemingly not work. A suffix was added to all commands to keep them consistent and future proof; the shorthands were kept unchanged
2020-07-10Remove codeblock from symbol embed title.Gravatar Numerlor-1/+1
The code block caused the url to not highlight the title text on mobile
2020-07-07Use the group attribute instead of checking the symbol name.Gravatar Numerlor-1/+1
2020-07-07Create method to fetch and create a BeautifulSoup object from an url.Gravatar Numerlor-6/+11
Moving this part of the logic into a separate method allows us to put a cache on it, which caches the whole HTML document from the given url, removing the need to do requests to the same URL for every symbol behind it.
2020-07-06Intern `group_names`Gravatar Numerlor-1/+4
2020-06-29Add option for user to delete the not found message before it's auto deleted.Gravatar Numerlor-4/+11
2020-06-29Trigger typing in converter instead of command.Gravatar Numerlor-4/+2
The converter does a web request so triggering typing in the command itself left out a period where the bot seemed inactive.
2020-06-29Add stat for packages of fetched symbols.Gravatar Numerlor-10/+13
An additional variable is added to the DocItem named tuple to accommodate this. The `_package_name` is separated from `api_package_name` it previously overwrote and is now used for the stats and renamed symbols because the names are in a friendlier format.
2020-06-28Only update added inventory instead of all.Gravatar Numerlor-1/+1
2020-06-27Only include one newline for `p` tags in `li` elements.Gravatar Numerlor-0/+7
2020-06-27Redesign `find_all_text_until_tag` to search through all direct children.Gravatar Numerlor-27/+12
The previous approach didn't work for arbitrary tags with text.
2020-06-21Strip backticks from symbol input.Gravatar Numerlor-0/+1
This allows the user to wrap symbols in codeblocks to avoid markdown.
2020-06-21Correct return when a module symbol could not be parsed.Gravatar Numerlor-9/+8
2020-06-21Fix typehint.Gravatar Numerlor-1/+1
2020-06-21Renamed existing symbols from `NO_OVERRIDE_GROUPS` instead of replacing.Gravatar Numerlor-7/+12
Before, when a symbol from the group shared the name with a symbol outside of it the symbol was simply replaced and lost. The new implementation renames the old symbols to the group_name.symbol format before the new symbol takes their place.
2020-06-21Add symbol group name to symbol inventory entries.Gravatar Numerlor-10/+17
2020-06-21Remove unnecessary join.Gravatar Numerlor-1/+1
`find_all_text_until_tag` already returns a string so a join is not needed.
2020-06-21Also check signatures before selected symbol when collecting 3 signatures.Gravatar Numerlor-1/+5
2020-06-21Account for `NavigableString`s when gathering text.Gravatar Numerlor-3/+9
`find_next()` only goes to tags, leaving out text outside of them when parsing.
2020-06-18Make sure only class contents are included, without methods.Gravatar Numerlor-13/+42
When parsing classes, methods would sometimes get included causing bad looking markdown to be included in the description, this is solved by collecting all text *up to* the next dt tag. fixes: #990
2020-06-18Move symbol parsing into separate methods.Gravatar Numerlor-23/+43
2020-06-17Skip symbols with slashes in them.Gravatar Numerlor-0/+2
The symbols mostly point to autogenerated pages, and do not link to specific symbols on their pages and are thus unreachable with the current implementation.
2020-06-17Make doc get greedy.Gravatar Numerlor-5/+6
This allows us to find docs for symbols with spaces in them.
2020-06-17Resolve relative href urls in a html elements.Gravatar Numerlor-3/+13
Most docs will use relative urls to link across their pages, without resolving them ourselves the links remain unusable in discord's markdown and break out of codeblocks on mobile.