python-frontmatter 0.4.2__tar.gz → 0.4.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {python-frontmatter-0.4.2 → Library/Python/2.7/site-packages}/frontmatter/__init__.py +7 -3
  2. Library/Python/2.7/site-packages/frontmatter/__init__.pyc +0 -0
  3. Library/Python/2.7/site-packages/frontmatter/default_handlers.pyc +0 -0
  4. Library/Python/2.7/site-packages/frontmatter/util.pyc +0 -0
  5. {python-frontmatter-0.4.2/python_frontmatter.egg-info → Library/Python/2.7/site-packages/python_frontmatter-0.4.3-py2.7.egg-info}/PKG-INFO +3 -2
  6. python-frontmatter-0.4.2/LICENSE +0 -21
  7. python-frontmatter-0.4.2/MANIFEST.in +0 -6
  8. python-frontmatter-0.4.2/PKG-INFO +0 -111
  9. python-frontmatter-0.4.2/README.md +0 -90
  10. python-frontmatter-0.4.2/setup.cfg +0 -5
  11. python-frontmatter-0.4.2/setup.py +0 -50
  12. python-frontmatter-0.4.2/tests/chinese.txt +0 -5
  13. python-frontmatter-0.4.2/tests/empty-frontmatter.txt +0 -4
  14. python-frontmatter-0.4.2/tests/extra-dash.txt +0 -6
  15. python-frontmatter-0.4.2/tests/hello-json.markdown +0 -18
  16. python-frontmatter-0.4.2/tests/hello-markdown.markdown +0 -18
  17. python-frontmatter-0.4.2/tests/hello-toml.markdown +0 -18
  18. python-frontmatter-0.4.2/tests/hello-world.markdown +0 -6
  19. python-frontmatter-0.4.2/tests/network-diagrams.markdown +0 -12
  20. python-frontmatter-0.4.2/tests/no-frontmatter.txt +0 -1
  21. python-frontmatter-0.4.2/tests/unpretty.md +0 -21
  22. {python-frontmatter-0.4.2 → Library/Python/2.7/site-packages}/frontmatter/default_handlers.py +0 -0
  23. {python-frontmatter-0.4.2 → Library/Python/2.7/site-packages}/frontmatter/util.py +0 -0
  24. {python-frontmatter-0.4.2/python_frontmatter.egg-info → Library/Python/2.7/site-packages/python_frontmatter-0.4.3-py2.7.egg-info}/SOURCES.txt +0 -0
  25. {python-frontmatter-0.4.2/python_frontmatter.egg-info → Library/Python/2.7/site-packages/python_frontmatter-0.4.3-py2.7.egg-info}/dependency_links.txt +0 -0
  26. {python-frontmatter-0.4.2/python_frontmatter.egg-info → Library/Python/2.7/site-packages/python_frontmatter-0.4.3-py2.7.egg-info}/not-zip-safe +0 -0
  27. {python-frontmatter-0.4.2/python_frontmatter.egg-info → Library/Python/2.7/site-packages/python_frontmatter-0.4.3-py2.7.egg-info}/requires.txt +0 -0
  28. {python-frontmatter-0.4.2/python_frontmatter.egg-info → Library/Python/2.7/site-packages/python_frontmatter-0.4.3-py2.7.egg-info}/top_level.txt +0 -0
@@ -137,8 +137,8 @@ def dump(post, fd, encoding='utf-8', handler=None, **kwargs):
137
137
 
138
138
  ::
139
139
 
140
- >>> from io import StringIO
141
- >>> f = StringIO()
140
+ >>> from io import BytesIO
141
+ >>> f = BytesIO()
142
142
  >>> frontmatter.dump(post, f)
143
143
  >>> print(f.getvalue())
144
144
  ---
@@ -209,7 +209,11 @@ class Post(object):
209
209
 
210
210
  def __getitem__(self, name):
211
211
  "Get metadata key"
212
- return self.metadata[name]
212
+ return self.metadata[name]
213
+
214
+ def __contains__(self, item):
215
+ "Check metadata contains key"
216
+ return item in self.metadata
213
217
 
214
218
  def __setitem__(self, name, value):
215
219
  "Set a metadata key"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: python-frontmatter
3
- Version: 0.4.2
3
+ Version: 0.4.3
4
4
  Summary: Parse and manage posts with YAML frontmatter
5
5
  Home-page: https://github.com/eyeseast/python-frontmatter
6
6
  Author: Chris Amico
@@ -104,8 +104,9 @@ Classifier: Intended Audience :: Developers
104
104
  Classifier: License :: OSI Approved :: MIT License
105
105
  Classifier: Natural Language :: English
106
106
  Classifier: Programming Language :: Python :: 2
107
- Classifier: Programming Language :: Python :: 2.6
108
107
  Classifier: Programming Language :: Python :: 2.7
109
108
  Classifier: Programming Language :: Python :: 3
110
109
  Classifier: Programming Language :: Python :: 3.3
111
110
  Classifier: Programming Language :: Python :: 3.4
111
+ Classifier: Programming Language :: Python :: 3.5
112
+ Classifier: Programming Language :: Python :: 3.6
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016 Chris Amico, Glass Eye Media LLC
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
@@ -1,6 +0,0 @@
1
- include LICENSE
2
- include README.md
3
-
4
- recursive-include tests *
5
-
6
- exclude *.py[co]
@@ -1,111 +0,0 @@
1
- Metadata-Version: 1.1
2
- Name: python-frontmatter
3
- Version: 0.4.2
4
- Summary: Parse and manage posts with YAML frontmatter
5
- Home-page: https://github.com/eyeseast/python-frontmatter
6
- Author: Chris Amico
7
- Author-email: eyeseast@gmail.com
8
- License: MIT
9
- Description: Python Frontmatter
10
- ==================
11
-
12
- [Jekyll](http://jekyllrb.com/)-style YAML front matter offers a useful way to add arbitrary, structured metadata to text documents, regardless of type.
13
-
14
- This is a small package to load and parse files (or just text) with YAML front matter.
15
-
16
- [![Build Status](https://travis-ci.org/eyeseast/python-frontmatter.svg?branch=master)](https://travis-ci.org/eyeseast/python-frontmatter)
17
-
18
- Install:
19
- --------
20
-
21
- pip install python-frontmatter
22
-
23
-
24
- Usage:
25
- ------
26
-
27
- >>> import frontmatter
28
-
29
- Load a post from a filename:
30
-
31
- >>> post = frontmatter.load('tests/hello-world.markdown')
32
-
33
- Or a file (or file-like object):
34
-
35
- >>> with open('tests/hello-world.markdown') as f:
36
- ... post = frontmatter.load(f)
37
-
38
- Or load from text:
39
-
40
- >>> with open('tests/hello-world.markdown') as f:
41
- ... post = frontmatter.loads(f.read())
42
-
43
- Access content:
44
-
45
- >>> print(post.content)
46
- Well, hello there, world.
47
-
48
- # this works, too
49
- >>> print(post)
50
- Well, hello there, world.
51
-
52
-
53
- Use metadata (metadata gets proxied as post keys):
54
-
55
- >>> print(post['title'])
56
- Hello, world!
57
-
58
- Metadata is a dictionary, with some handy proxies:
59
-
60
- >>> sorted(post.keys())
61
- ['layout', 'title']
62
-
63
- >>> from pprint import pprint
64
- >>> post['excerpt'] = 'tl;dr'
65
- >>> pprint(post.metadata)
66
- {'excerpt': 'tl;dr', 'layout': 'post', 'title': 'Hello, world!'}
67
-
68
- If you don't need the whole post object, just parse:
69
-
70
- >>> with open('tests/hello-world.markdown') as f:
71
- ... metadata, content = frontmatter.parse(f.read())
72
- >>> print(metadata['title'])
73
- Hello, world!
74
-
75
- Write back to plain text, too:
76
-
77
- >>> print(frontmatter.dumps(post)) # doctest: +NORMALIZE_WHITESPACE
78
- ---
79
- excerpt: tl;dr
80
- layout: post
81
- title: Hello, world!
82
- ---
83
- Well, hello there, world.
84
-
85
- Or write to a file (or file-like object):
86
-
87
- >>> from io import BytesIO
88
- >>> f = BytesIO()
89
- >>> frontmatter.dump(post, f)
90
- >>> print(f.getvalue().decode('utf-8')) # doctest: +NORMALIZE_WHITESPACE
91
- ---
92
- excerpt: tl;dr
93
- layout: post
94
- title: Hello, world!
95
- ---
96
- Well, hello there, world.
97
-
98
-
99
-
100
- Keywords: frontmatter
101
- Platform: UNKNOWN
102
- Classifier: Development Status :: 4 - Beta
103
- Classifier: Intended Audience :: Developers
104
- Classifier: License :: OSI Approved :: MIT License
105
- Classifier: Natural Language :: English
106
- Classifier: Programming Language :: Python :: 2
107
- Classifier: Programming Language :: Python :: 2.6
108
- Classifier: Programming Language :: Python :: 2.7
109
- Classifier: Programming Language :: Python :: 3
110
- Classifier: Programming Language :: Python :: 3.3
111
- Classifier: Programming Language :: Python :: 3.4
@@ -1,90 +0,0 @@
1
- Python Frontmatter
2
- ==================
3
-
4
- [Jekyll](http://jekyllrb.com/)-style YAML front matter offers a useful way to add arbitrary, structured metadata to text documents, regardless of type.
5
-
6
- This is a small package to load and parse files (or just text) with YAML front matter.
7
-
8
- [![Build Status](https://travis-ci.org/eyeseast/python-frontmatter.svg?branch=master)](https://travis-ci.org/eyeseast/python-frontmatter)
9
-
10
- Install:
11
- --------
12
-
13
- pip install python-frontmatter
14
-
15
-
16
- Usage:
17
- ------
18
-
19
- >>> import frontmatter
20
-
21
- Load a post from a filename:
22
-
23
- >>> post = frontmatter.load('tests/hello-world.markdown')
24
-
25
- Or a file (or file-like object):
26
-
27
- >>> with open('tests/hello-world.markdown') as f:
28
- ... post = frontmatter.load(f)
29
-
30
- Or load from text:
31
-
32
- >>> with open('tests/hello-world.markdown') as f:
33
- ... post = frontmatter.loads(f.read())
34
-
35
- Access content:
36
-
37
- >>> print(post.content)
38
- Well, hello there, world.
39
-
40
- # this works, too
41
- >>> print(post)
42
- Well, hello there, world.
43
-
44
-
45
- Use metadata (metadata gets proxied as post keys):
46
-
47
- >>> print(post['title'])
48
- Hello, world!
49
-
50
- Metadata is a dictionary, with some handy proxies:
51
-
52
- >>> sorted(post.keys())
53
- ['layout', 'title']
54
-
55
- >>> from pprint import pprint
56
- >>> post['excerpt'] = 'tl;dr'
57
- >>> pprint(post.metadata)
58
- {'excerpt': 'tl;dr', 'layout': 'post', 'title': 'Hello, world!'}
59
-
60
- If you don't need the whole post object, just parse:
61
-
62
- >>> with open('tests/hello-world.markdown') as f:
63
- ... metadata, content = frontmatter.parse(f.read())
64
- >>> print(metadata['title'])
65
- Hello, world!
66
-
67
- Write back to plain text, too:
68
-
69
- >>> print(frontmatter.dumps(post)) # doctest: +NORMALIZE_WHITESPACE
70
- ---
71
- excerpt: tl;dr
72
- layout: post
73
- title: Hello, world!
74
- ---
75
- Well, hello there, world.
76
-
77
- Or write to a file (or file-like object):
78
-
79
- >>> from io import BytesIO
80
- >>> f = BytesIO()
81
- >>> frontmatter.dump(post, f)
82
- >>> print(f.getvalue().decode('utf-8')) # doctest: +NORMALIZE_WHITESPACE
83
- ---
84
- excerpt: tl;dr
85
- layout: post
86
- title: Hello, world!
87
- ---
88
- Well, hello there, world.
89
-
90
-
@@ -1,5 +0,0 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
- tag_svn_revision = 0
5
-
@@ -1,50 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
-
4
- try:
5
- from setuptools import setup
6
- except ImportError:
7
- from distutils.core import setup
8
-
9
-
10
- with open('README.md') as f:
11
- readme = f.read()
12
-
13
-
14
- requirements = [
15
- 'PyYAML',
16
- 'six'
17
- ]
18
-
19
-
20
- VERSION = '0.4.2'
21
-
22
-
23
- setup(
24
- name = 'python-frontmatter',
25
- version = VERSION,
26
- description = 'Parse and manage posts with YAML frontmatter',
27
- long_description = readme,
28
- author = 'Chris Amico',
29
- author_email = 'eyeseast@gmail.com',
30
- url = 'https://github.com/eyeseast/python-frontmatter',
31
- packages = ['frontmatter'],
32
- include_package_data = True,
33
- install_requires = requirements,
34
- license = 'MIT',
35
- zip_safe = False,
36
- keywords = 'frontmatter',
37
- classifiers=[
38
- 'Development Status :: 4 - Beta',
39
- 'Intended Audience :: Developers',
40
- 'License :: OSI Approved :: MIT License',
41
- 'Natural Language :: English',
42
- 'Programming Language :: Python :: 2',
43
- 'Programming Language :: Python :: 2.6',
44
- 'Programming Language :: Python :: 2.7',
45
- 'Programming Language :: Python :: 3',
46
- 'Programming Language :: Python :: 3.3',
47
- 'Programming Language :: Python :: 3.4',
48
- ],
49
- test_suite='test',
50
- )
@@ -1,5 +0,0 @@
1
- ---
2
- title: "Let's try unicode"
3
- ---
4
-
5
- 欢迎来到大连水产学院!
@@ -1,4 +0,0 @@
1
- ---
2
- ---
3
-
4
- I have frontmatter but no metadata.
@@ -1,6 +0,0 @@
1
- ----
2
- test: bob
3
- else: kate
4
- ----
5
-
6
- Here's some content.
@@ -1,18 +0,0 @@
1
- {
2
- "test": "tester",
3
- "author": "bob",
4
- "something": "else"
5
- }
6
-
7
- Title
8
- =====
9
-
10
- title2
11
- ------
12
-
13
- Hello.
14
-
15
- Just need three dashes
16
- ---
17
-
18
- And this might break.
@@ -1,18 +0,0 @@
1
- ---
2
- test: tester
3
- author: bob
4
- something: else
5
- ---
6
-
7
- Title
8
- =====
9
-
10
- title2
11
- ------
12
-
13
- Hello.
14
-
15
- Just need three dashes
16
- ---
17
-
18
- And this shouldn't break.
@@ -1,18 +0,0 @@
1
- +++
2
- author = "bob"
3
- something = "else"
4
- test = "tester"
5
- +++
6
-
7
- Title
8
- =====
9
-
10
- title2
11
- ------
12
-
13
- Hello.
14
-
15
- Just need three dashes
16
- ---
17
-
18
- And this shouldn't break.
@@ -1,6 +0,0 @@
1
- ---
2
- title: Hello, world!
3
- layout: post
4
- ---
5
-
6
- Well, hello there, world.
@@ -1,12 +0,0 @@
1
- ---
2
- title: "TODO: Understand Network Diagrams"
3
- layout: post
4
- published: true
5
- tags: [todo]
6
- ---
7
-
8
- Kim Rees, sitting in for Nathan Yau at [Flowing Data](http://flowingdata.com), has been posting examples of [network diagrams](http://flowingdata.com/category/visualization/network-visualization/) lately. I have to confess I'm stumped by most of them them. Or maybe I'm just overwhelmed. Maybe I'm [not alone](http://flowingdata.com/2012/05/28/network-diagrams-simplified/):
9
-
10
- > Network diagrams are notoriously messy. Even a small number of nodes can be overwhelmed by their chaotic placement and relationships. [Cody Dunne](http://www.cs.umd.edu/~cdunne/) of [HCIL](http://www.cs.umd.edu/hcil/) showed off [his new work in simplifying these complex structures](http://www.cs.umd.edu/localphp/hcil/tech-reports-search.php?number=2012-11). In essence, he aggregates leaf nodes into a fan glyph that describes the underlying data in its size, arc, and color. Span nodes are similarly captured into crescent glyphs. The result is an easy to read, high level look at the network. You can easily compare different sections of the network, understand areas that may have been occluded by the lines in a traditional diagram, and see relationships far more quickly.
11
-
12
- This seems like the kind of thing that could be useful for news, where we're often trying to understand and illustrate complex relationships. I'll have to find a good dataset to play with.
@@ -1 +0,0 @@
1
- I have no frontmatter.
@@ -1,21 +0,0 @@
1
- ---
2
- destination:
3
- encoding:
4
- xz:
5
- enabled: true
6
- min_size: 5120
7
- options:
8
- path_filter:
9
- result:
10
- append_to_file:
11
- append_to_lafs_dir:
12
- print_to_stdout: true
13
- url: http://localhost:3456/uri
14
- filter:
15
- - 'Длинный стринг на русском'
16
- - 'Еще одна длинная строка'
17
- ---
18
-
19
- This is a test of both unicode and prettier dumping. The above metadata comes from the [pretty-yaml](https://github.com/mk-fg/pretty-yaml) readme file.
20
-
21
- Metadata should be dumped in order.