diff --git a/advertools/ad_from_string.py b/advertools/ad_from_string.py index 69d95744..9fa288bd 100644 --- a/advertools/ad_from_string.py +++ b/advertools/ad_from_string.py @@ -1,4 +1,4 @@ -""" +r""" .. _ad_from_string: Create Ads Using Long Descriptive Text (top-down approach) diff --git a/advertools/crawlytics.py b/advertools/crawlytics.py index 1c2b8202..b981c132 100644 --- a/advertools/crawlytics.py +++ b/advertools/crawlytics.py @@ -1,4 +1,4 @@ -""" +r""" After crawling a website, or a bunch of URLs, you mostly likely want to analyze the data and gain a better undersanding of the website's structure, strategy, and content. You probably also want to check for technical issues that the site might have. @@ -295,7 +295,7 @@ def redirects(crawldf): - """Create a tidy DataFrame for the redirects in `crawldf` with the columns: + r"""Create a tidy DataFrame for the redirects in `crawldf` with the columns: - url: All the URLs in the redirect (chain). - status: The status code of each URL. @@ -374,7 +374,7 @@ def redirects(crawldf): def links(crawldf, internal_url_regex=None): - """Summarize links from a crawl DataFrame. + r"""Summarize links from a crawl DataFrame. Parameters ---------- @@ -436,7 +436,7 @@ def links(crawldf, internal_url_regex=None): def images(crawldf): - """Summarize crawled images from a crawl DataFrame. + r"""Summarize crawled images from a crawl DataFrame. Parameters ---------- @@ -493,7 +493,7 @@ def images(crawldf): def jl_subset(filepath, columns=None, regex=None, chunksize=500): - """Read a jl file extracting selected `columns` and/or columns matching `regex`. + r"""Read a jl file extracting selected `columns` and/or columns matching `regex`. Parameters ---------- @@ -549,7 +549,7 @@ def jl_subset(filepath, columns=None, regex=None, chunksize=500): def jl_to_parquet(jl_filepath, parquet_filepath): - """Convert a jsonlines crawl file to the parquet format. + r"""Convert a jsonlines crawl file to the parquet format. Parameters ---------- @@ -577,7 +577,7 @@ def jl_to_parquet(jl_filepath, parquet_filepath): def parquet_columns(filepath): - """Get column names and datatypes of a parquet file. + r"""Get column names and datatypes of a parquet file. Parameters ---------- @@ -597,7 +597,7 @@ def parquet_columns(filepath): def compare(df1, df2, column, keep_equal=False): - """Compare common URLs in two crawl DataFrames with respect to `column`. + r"""Compare common URLs in two crawl DataFrames with respect to `column`. There are three main options that you might select for comparison: @@ -669,7 +669,7 @@ def compare(df1, df2, column, keep_equal=False): def running_crawls(): - """Get details of currently running spiders. + r"""Get details of currently running spiders. Get a DataFrame showing the following details: @@ -744,7 +744,7 @@ def running_crawls(): def generate_markdown(crawldf): - """ + r""" Generate markdown strings using h1-h6 headings and body_text. Parameters @@ -763,10 +763,10 @@ def generate_markdown(crawldf): >>> crawldf = pd.read_json("output_file.jsonl", lines=True) >>> md = adv.crawlytics.generate_markdown(crawldf) - """ + r""" def convert_single_row(row): - """Convert a single row to markdown.""" + r"""Convert a single row to markdown.""" body_text = ( "" if pd.isna(row.get("body_text", "")) else str(row.get("body_text", "")) ) diff --git a/advertools/partition.py b/advertools/partition.py index a97431e7..718b0ec8 100644 --- a/advertools/partition.py +++ b/advertools/partition.py @@ -1,4 +1,4 @@ -""" +r""" Text partitioning with Python ============================= @@ -167,13 +167,13 @@ ---- Content for section 2. -""" +r""" import re def partition(text, regex, flags=0): - """Partition a string based on a regex pattern. + r"""Partition a string based on a regex pattern. Splits the `text` by all occurrences of `regex`. The resulting list includes both the substrings between the matches and the matches diff --git a/advertools/regex.py b/advertools/regex.py index 2fcdf9ab..ebc02958 100644 --- a/advertools/regex.py +++ b/advertools/regex.py @@ -87,7 +87,7 @@ r"""(?i) # case-insensitive (?