Skip to content

Commit

Permalink
release commit
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangFahl committed Jul 31, 2024
1 parent 122573b commit f58cf71
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
8 changes: 5 additions & 3 deletions frontend/clickstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,18 @@ class ClickstreamManager(object):
def __init__(
self,
root_path: str,
rdf_namespace="http://cms.bitplan.com/clickstream#",
rdf_namespace:str ="http://cms.bitplan.com/clickstream#",
show_progress: bool = True,
verbose: bool = True,
):
"""
Constructor
Args:
rdf_namespace(str): The base namespace URI for the RDF export.
verbose(bool): If True, print the output message.
root_path (str): the root path
rdf_namespace (str): The base namespace URI for the RDF export.
show_progress (bool): If True, show progress.
verbose (bool): If True, print the output message.
"""
self.root_path = root_path
self.rdf_namespace = rdf_namespace
Expand Down
4 changes: 2 additions & 2 deletions frontend/webscrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ def __init__(self, debug=False, showHtml=False):
self.debug = debug
self.showHtml = showHtml

def getSoup(self, url, showHtml):
def getSoup(self, url, showHtml:bool):
"""
get the beautiful Soup parser
Args:
showHtml(boolean): True if the html code should be pretty printed and shown
showHtml(bool): True if the html code should be pretty printed and shown
"""
req = Request(url, headers={"User-Agent": "Mozilla/5.0"})
html = urlopen(req).read()
Expand Down
34 changes: 18 additions & 16 deletions frontend/wikicms.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ def __init__(
else:
self.filterKeys = []

def log(self, msg):
def log(self, msg:str):
"""
log the given message if debugging is true
Args:
msg(str): the message to log
msg (str): the message to log
"""
if self.debug:
print(msg, flush=True)

@staticmethod
def extract_site_and_path(path):
def extract_site_and_path(path:str):
"""
Splits the given path into the site component and the remaining path.
Expand Down Expand Up @@ -124,14 +124,15 @@ def errMsg(self, ex):
msg = repr(ex)
return msg

def wikiPage(self, pagePath):
def wikiPage(self, pagePath: str) -> str:
"""
get the wikiPage for the given pagePath
Get the wiki page for the given page path.
Args:
pagePath(str): the page path
pagePath (str): The path of the page.
Returns:
str: the pageTitle
str: The title of the page.
"""
if "/index.php/" in pagePath:
wikipage = pagePath.replace("/index.php/", "")
Expand All @@ -141,12 +142,12 @@ def wikiPage(self, pagePath):
wikipage = pagePath
return wikipage

def checkPath(self, pagePath):
def checkPath(self, pagePath:str)->str:
"""
check the given pathPath
Args:
pagePath(str): the page Path to check
pagePath (str): the page Path to check
Returns:
str: None or an error message with the illegal chars being used
Expand All @@ -159,12 +160,13 @@ def checkPath(self, pagePath):
error = "invalid char %s in given pagePath " % (illegalChar)
return error

def needsProxy(self, path: str) -> bool:
def needsProxy(self, path:str) -> bool:
"""
Args:
path(str): the path to check
path (str): the path to check
Returns:
True if this path needs to be proxied
bool: True if this path needs to be proxied
"""
needs_proxy = False
for prefix in self.proxy_prefixes:
Expand Down Expand Up @@ -200,10 +202,10 @@ def fixNode(self, node, attribute, prefix, delim=None):
"""
fix the given node
node(BeautifulSoup): the node
attribute(str): the name of the attribute e.g. "href", "src"
prefix(str): the prefix to replace e.g. "/", "/images", "/thumbs"
delim(str): if not None the delimiter for multiple values
node (BeautifulSoup): the node
attribute (str): the name of the attribute e.g. "href", "src"
prefix (str): the prefix to replace e.g. "/", "/images", "/thumbs"
delim (str): if not None the delimiter for multiple values
"""
siteprefix = f"/{self.site.name}{prefix}"
if attribute in node.attrs:
Expand Down

0 comments on commit f58cf71

Please sign in to comment.