Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoSign 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 - pypi Package Compare versions

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

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

@@ -88,19 +88,20 @@ """Utilities for interpreting mf2 data.

"""
return next(_find_all_entries(parsed, types), None)
return next(_find_all_entries(parsed, types, False), None)
def find_all_entries(parsed, types):
def find_all_entries(parsed, types, include_properties=False):
"""Find all h-* objects of a given type in BFS-order. Traverses the
top-level items and their children and descendents. Does not
include property values (e.g. finding all h-cards would not find
values of "p-author h-card")
top-level items and their children and descendents. Includes property
values (e.g. finding all h-cards would not find values of
"p-author h-card") only if `include_properties` is True.
:param dict parsed: a mf2py parsed dict
:param list types: target types, e.g. ['h-entry', 'h-event']
:param boolean include_properties: include properties in search of entries
:return: all entries with any of the the target types
"""
return list(_find_all_entries(parsed, types))
return list(_find_all_entries(parsed, types, include_properties))
def _find_all_entries(parsed, types):
def _find_all_entries(parsed, types, include_properties):
queue = deque(item for item in parsed['items'])

@@ -112,2 +113,5 @@ while queue:

queue.extend(item.get('children', []))
if include_properties:
queue.extend(prop for props in item.get('properties', {}).values()
for prop in props if isinstance(prop, dict))

@@ -235,3 +239,3 @@

def find_parent_hfeed_author(hentry):
for hfeed in _find_all_entries(parsed, ['h-feed']):
for hfeed in _find_all_entries(parsed, ['h-feed'], False):
# find the h-entry's parent h-feed

@@ -325,3 +329,3 @@ if hentry in hfeed.get('children', []):

"""
hcards = find_all_entries(parsed, ['h-card'])
hcards = find_all_entries(parsed, ['h-card'], include_properties=True)
# uid and url both match source_url

@@ -328,0 +332,0 @@ for hcard in hcards:

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

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

@@ -1,2 +0,2 @@

[pytest]
[tool:pytest]
norecursedirs = venv*

@@ -6,4 +6,4 @@

tag_build =
tag_date = 0
tag_svn_revision = 0
tag_date = 0

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

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

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