Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

mf2util

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mf2util - npm Package Compare versions

Comparing version
0.3.2
to
0.3.3
+1
-1
mf2util.egg-info/PKG-INFO
Metadata-Version: 1.1
Name: mf2util
Version: 0.3.2
Version: 0.3.3
Summary: Python Microformats2 utilities, a companion to mf2py

@@ -5,0 +5,0 @@ Home-page: http://indiewebcamp.com/mf2util

@@ -128,2 +128,19 @@ """Utilities for interpreting mf2 data.

def get_plain_text(values, strip=True):
"""Get the first value in a list of values that we expect to be plain-text.
If it is a dict, then return the value of "value".
:param list values: a list of values
:param boolean strip: true if we should strip the plaintext value
:return: a string or None
"""
if values:
v = values[0]
if isinstance(v, dict):
v = v.get('value', '')
if strip:
v = v.strip()
return v
def classify_comment(parsed, target_urls):

@@ -231,3 +248,3 @@ """Find and categorize comments that reference any of a collection of

rel_mes = parsed["rels"].get("me", [])
rel_mes = parsed.get('rels', {}).get("me", [])
for item in hcards:

@@ -238,3 +255,3 @@ urls = item['properties'].get('url', [])

rel_authors = parsed["rels"].get("author", [])
rel_authors = parsed.get('rels', {}).get("author", [])
for item in hcards:

@@ -267,3 +284,3 @@ urls = item['properties'].get('url', [])

for hcard in hcards:
if any(url in parsed['rels'].get('me', [])
if any(url in parsed.get('rels', {}).get('me', [])
for url in hcard['properties'].get('url', [])):

@@ -297,5 +314,2 @@ return hcard

base_url = urljoin(source_url, base_href) if base_href else source_url
print("converting", match.group(1), "to use base url", base_url)
return (match.string[match.start(0):match.start(1)] +

@@ -362,7 +376,2 @@ urljoin(base_url, match.group(1)) +

"""
def get_plain_text(values):
if values:
return ''.join(v.get('value') if isinstance(v, dict) else v
for v in values)
props = hentry.get('properties', {})

@@ -462,22 +471,19 @@ if 'h-card' in hentry.get('type', []):

for prop in ('url', 'uid', 'photo'):
url_strs = hentry['properties'].get(prop)
if url_strs:
if isinstance(url_strs[0], dict):
result[prop] = url_strs[0].get('value')
else:
result[prop] = url_strs[0]
value = get_plain_text(hentry['properties'].get(prop))
if value:
result[prop] = value
for prop in ('start', 'end', 'published', 'updated'):
date_strs = hentry['properties'].get(prop)
if date_strs:
date_str = get_plain_text(hentry['properties'].get(prop))
if date_str:
if want_json:
result[prop] = date_strs[0]
result[prop] = date_str
else:
result[prop + '-str'] = date_strs[0]
result[prop + '-str'] = date_str
try:
date = parse_datetime(date_strs[0])
date = parse_datetime(date_str)
if date:
result[prop] = date
except ValueError:
logging.warn('Failed to parse datetime %s', date_strs[0])
logging.warn('Failed to parse datetime %s', date_str)

@@ -514,3 +520,3 @@ author = find_author(parsed, source_url, hentry)

result['syndication'] = list(set(
parsed['rels'].get('syndication', []) +
parsed.get('rels', {}).get('syndication', []) +
hentry['properties'].get('syndication', [])))

@@ -558,7 +564,5 @@ else:

result['type'] = 'event'
name_prop = hevent['properties'].get('name')
if name_prop:
result['name'] = name_prop[0].strip()
name_value = get_plain_text(hevent['properties'].get('name'))
if name_value:
result['name'] = name_value
return result

@@ -620,7 +624,5 @@

name_prop = hentry['properties'].get('name')
if name_prop:
title = name_prop[0].strip()
if is_name_a_title(title, result.get('content-plain')):
result['name'] = title
title = get_plain_text(hentry['properties'].get('name'))
if title and is_name_a_title(title, result.get('content-plain')):
result['name'] = title

@@ -734,10 +736,9 @@ for prop in ('in-reply-to', 'like-of', 'repost-of', 'bookmark-of',

if item:
result = interpret_entry(parsed, source_url, base_href=base_href, hentry=item, want_json=want_json)
result = interpret_entry(parsed, source_url, base_href=base_href,
hentry=item, want_json=want_json)
if result:
result['comment_type'] = classify_comment(
parsed, target_urls)
rsvp = item['properties'].get('rsvp')
result['comment_type'] = classify_comment(parsed, target_urls)
rsvp = get_plain_text(item['properties'].get('rsvp'))
if rsvp:
result['rsvp'] = rsvp[0].lower()
result['rsvp'] = rsvp.lower()

@@ -744,0 +745,0 @@ invitees = item['properties'].get('invitee')

Metadata-Version: 1.1
Name: mf2util
Version: 0.3.2
Version: 0.3.3
Summary: Python Microformats2 utilities, a companion to mf2py

@@ -5,0 +5,0 @@ Home-page: http://indiewebcamp.com/mf2util

@@ -27,3 +27,3 @@ #!/usr/bin/env python

setup(name='mf2util',
version='0.3.2',
version='0.3.3',
description='Python Microformats2 utilities, a companion to mf2py',

@@ -30,0 +30,0 @@ long_description="""