Permalink
Browse files

every journey starts with but a single step

  • Loading branch information...
0 parents commit c4591300b1e133363f1a77ec95d2a8a861f2bcec @ptarjan committed Aug 19, 2009
Showing with 10,647 additions and 0 deletions.
  1. +15 −0 app.yaml
  2. +89 −0 datetime_safe.py
  3. BIN datetime_safe.pyc
  4. +26 −0 django_jsonencoder.py
  5. BIN django_jsonencoder.pyc
  6. +3 −0 examples/2.01
  7. +3 −0 examples/2.02
  8. +8 −0 examples/2.03
  9. +8 −0 examples/2.04
  10. +3 −0 examples/2.05
  11. +5 −0 examples/2.06
  12. +10 −0 examples/2.07
  13. +10 −0 examples/2.08
  14. +8 −0 examples/2.09
  15. +8 −0 examples/2.10
  16. +9 −0 examples/2.11
  17. +8 −0 examples/2.12
  18. +4 −0 examples/2.13
  19. +4 −0 examples/2.14
  20. +8 −0 examples/2.15
  21. +7 −0 examples/2.16
  22. +7 −0 examples/2.17
  23. +6 −0 examples/2.18
  24. +4 −0 examples/2.19
  25. +5 −0 examples/2.20
  26. +3 −0 examples/2.21
  27. +4 −0 examples/2.22
  28. +13 −0 examples/2.23
  29. +14 −0 examples/2.24
  30. +7 −0 examples/2.25
  31. +7 −0 examples/2.26
  32. +29 −0 examples/2.27
  33. +26 −0 examples/2.28
  34. +126 −0 index.html
  35. +11 −0 index.yaml
  36. +19 −0 js/jquery-1.3.2.min.js
  37. +19 −0 js/jquery.hotkeys-0.7.9.min.js
  38. +66 −0 main.py
  39. +318 −0 simplejson/__init__.py
  40. BIN simplejson/__init__.pyc
  41. +2,329 −0 simplejson/_speedups.c
  42. +354 −0 simplejson/decoder.py
  43. BIN simplejson/decoder.pyc
  44. +440 −0 simplejson/encoder.py
  45. BIN simplejson/encoder.pyc
  46. +65 −0 simplejson/scanner.py
  47. BIN simplejson/scanner.pyc
  48. +23 −0 simplejson/tests/__init__.py
  49. +30 −0 simplejson/tests/test_check_circular.py
  50. +22 −0 simplejson/tests/test_decode.py
  51. +9 −0 simplejson/tests/test_default.py
  52. +21 −0 simplejson/tests/test_dump.py
  53. +38 −0 simplejson/tests/test_encode_basestring_ascii.py
  54. +76 −0 simplejson/tests/test_fail.py
  55. +15 −0 simplejson/tests/test_float.py
  56. +41 −0 simplejson/tests/test_indent.py
  57. +76 −0 simplejson/tests/test_pass1.py
  58. +14 −0 simplejson/tests/test_pass2.py
  59. +20 −0 simplejson/tests/test_pass3.py
  60. +67 −0 simplejson/tests/test_recursion.py
  61. +111 −0 simplejson/tests/test_scanstring.py
  62. +42 −0 simplejson/tests/test_separators.py
  63. +64 −0 simplejson/tests/test_unicode.py
  64. +37 −0 simplejson/tool.py
  65. +288 −0 yaml/__init__.py
  66. BIN yaml/__init__.pyc
  67. +139 −0 yaml/composer.py
  68. BIN yaml/composer.pyc
  69. +684 −0 yaml/constructor.py
  70. BIN yaml/constructor.pyc
  71. +85 −0 yaml/cyaml.py
  72. BIN yaml/cyaml.pyc
  73. +62 −0 yaml/dumper.py
  74. BIN yaml/dumper.pyc
  75. +1,132 −0 yaml/emitter.py
  76. BIN yaml/emitter.pyc
  77. +75 −0 yaml/error.py
  78. BIN yaml/error.pyc
  79. +86 −0 yaml/events.py
  80. BIN yaml/events.pyc
  81. +40 −0 yaml/loader.py
  82. BIN yaml/loader.pyc
  83. +49 −0 yaml/nodes.py
  84. BIN yaml/nodes.pyc
  85. +584 −0 yaml/parser.py
  86. BIN yaml/parser.pyc
  87. +225 −0 yaml/reader.py
  88. BIN yaml/reader.pyc
  89. +489 −0 yaml/representer.py
  90. BIN yaml/representer.pyc
  91. +224 −0 yaml/resolver.py
  92. BIN yaml/resolver.pyc
  93. +1,456 −0 yaml/scanner.py
  94. BIN yaml/scanner.pyc
  95. +111 −0 yaml/serializer.py
  96. BIN yaml/serializer.pyc
  97. +104 −0 yaml/tokens.py
  98. BIN yaml/tokens.pyc
@@ -0,0 +1,15 @@
+application: yaml-online-parser
+version: 1
+runtime: python
+api_version: 1
+
+handlers:
+- url: /js
+ static_dir: js
+
+#- url: /examples
+# static_dir: examples
+# mime_type: text/plain
+
+- url: .*
+ script: main.py
@@ -0,0 +1,89 @@
+# Python's datetime strftime doesn't handle dates before 1900.
+# These classes override date and datetime to support the formatting of a date
+# through its full "proleptic Gregorian" date range.
+#
+# Based on code submitted to comp.lang.python by Andrew Dalke
+#
+# >>> datetime_safe.date(1850, 8, 2).strftime("%Y/%M/%d was a %A")
+# '1850/08/02 was a Friday'
+
+from datetime import date as real_date, datetime as real_datetime
+import re
+import time
+
+class date(real_date):
+ def strftime(self, fmt):
+ return strftime(self, fmt)
+
+class datetime(real_datetime):
+ def strftime(self, fmt):
+ return strftime(self, fmt)
+
+ def combine(self, date, time):
+ return datetime(date.year, date.month, date.day, time.hour, time.minute, time.microsecond, time.tzinfo)
+
+ def date(self):
+ return date(self.year, self.month, self.day)
+
+def new_date(d):
+ "Generate a safe date from a datetime.date object."
+ return date(d.year, d.month, d.day)
+
+def new_datetime(d):
+ """
+ Generate a safe datetime from a datetime.date or datetime.datetime object.
+ """
+ kw = [d.year, d.month, d.day]
+ if isinstance(d, real_datetime):
+ kw.extend([d.hour, d.minute, d.second, d.microsecond, d.tzinfo])
+ return datetime(*kw)
+
+# This library does not support strftime's "%s" or "%y" format strings.
+# Allowed if there's an even number of "%"s because they are escaped.
+_illegal_formatting = re.compile(r"((^|[^%])(%%)*%[sy])")
+
+def _findall(text, substr):
+ # Also finds overlaps
+ sites = []
+ i = 0
+ while 1:
+ j = text.find(substr, i)
+ if j == -1:
+ break
+ sites.append(j)
+ i=j+1
+ return sites
+
+def strftime(dt, fmt):
+ if dt.year >= 1900:
+ return super(type(dt), dt).strftime(fmt)
+ illegal_formatting = _illegal_formatting.search(fmt)
+ if illegal_formatting:
+ raise TypeError("strftime of dates before 1900 does not handle" + illegal_formatting.group(0))
+
+ year = dt.year
+ # For every non-leap year century, advance by
+ # 6 years to get into the 28-year repeat cycle
+ delta = 2000 - year
+ off = 6 * (delta // 100 + delta // 400)
+ year = year + off
+
+ # Move to around the year 2000
+ year = year + ((2000 - year) // 28) * 28
+ timetuple = dt.timetuple()
+ s1 = time.strftime(fmt, (year,) + timetuple[1:])
+ sites1 = _findall(s1, str(year))
+
+ s2 = time.strftime(fmt, (year+28,) + timetuple[1:])
+ sites2 = _findall(s2, str(year+28))
+
+ sites = []
+ for site in sites1:
+ if site in sites2:
+ sites.append(site)
+
+ s = s1
+ syear = "%4d" % (dt.year,)
+ for site in sites:
+ s = s[:site] + syear + s[site+4:]
+ return s
Binary file not shown.
@@ -0,0 +1,26 @@
+import simplejson
+import datetime
+import datetime_safe
+import decimal
+
+class DjangoJSONEncoder(simplejson.JSONEncoder):
+ """
+ JSONEncoder subclass that knows how to encode date/time and decimal types.
+ """
+
+ DATE_FORMAT = "%Y-%m-%d"
+ TIME_FORMAT = "%H:%M:%S"
+
+ def default(self, o):
+ if isinstance(o, datetime.datetime):
+ d = datetime_safe.new_datetime(o)
+ return d.strftime("%s %s" % (self.DATE_FORMAT, self.TIME_FORMAT))
+ elif isinstance(o, datetime.date):
+ d = datetime_safe.new_date(o)
+ return d.strftime(self.DATE_FORMAT)
+ elif isinstance(o, datetime.time):
+ return o.strftime(self.TIME_FORMAT)
+ elif isinstance(o, decimal.Decimal):
+ return str(o)
+ else:
+ return super(DjangoJSONEncoder, self).default(o)
Binary file not shown.
@@ -0,0 +1,3 @@
+- Mark McGwire
+- Sammy Sosa
+- Ken Griffey
@@ -0,0 +1,3 @@
+hr: 65 # Home runs
+avg: 0.278 # Batting average
+rbi: 147 # Runs Batted In
@@ -0,0 +1,8 @@
+american:
+ - Boston Red Sox
+ - Detroit Tigers
+ - New York Yankees
+national:
+ - New York Mets
+ - Chicago Cubs
+ - Atlanta Braves
@@ -0,0 +1,8 @@
+-
+ name: Mark McGwire
+ hr: 65
+ avg: 0.278
+-
+ name: Sammy Sosa
+ hr: 63
+ avg: 0.288
@@ -0,0 +1,3 @@
+- [name , hr, avg ]
+- [Mark McGwire, 65, 0.278]
+- [Sammy Sosa , 63, 0.288]
@@ -0,0 +1,5 @@
+Mark McGwire: {hr: 65, avg: 0.278}
+Sammy Sosa: {
+ hr: 63,
+ avg: 0.288
+ }
@@ -0,0 +1,10 @@
+# Ranking of 1998 home runs
+---
+- Mark McGwire
+- Sammy Sosa
+- Ken Griffey
+
+# Team ranking
+---
+- Chicago Cubs
+- St Louis Cardinals
@@ -0,0 +1,10 @@
+---
+time: 20:03:20
+player: Sammy Sosa
+action: strike (miss)
+...
+---
+time: 20:03:47
+player: Sammy Sosa
+action: grand slam
+...
@@ -0,0 +1,8 @@
+---
+hr: # 1998 hr ranking
+ - Mark McGwire
+ - Sammy Sosa
+rbi:
+ # 1998 rbi ranking
+ - Sammy Sosa
+ - Ken Griffey
@@ -0,0 +1,8 @@
+---
+hr:
+ - Mark McGwire
+ # Following node labeled SS
+ - &SS Sammy Sosa
+rbi:
+ - *SS # Subsequent occurrence
+ - Ken Griffey
@@ -0,0 +1,9 @@
+? - Detroit Tigers
+ - Chicago cubs
+:
+ - 2001-07-23
+
+? [ New York Yankees,
+ Atlanta Braves ]
+: [ 2001-07-02, 2001-08-12,
+ 2001-08-14 ]
@@ -0,0 +1,8 @@
+---
+# Products purchased
+- item : Super Hoop
+ quantity: 1
+- item : Basketball
+ quantity: 4
+- item : Big Shoes
+ quantity: 1
@@ -0,0 +1,4 @@
+# ASCII Art
+--- |
+ \//||\/||
+ // || ||__
@@ -0,0 +1,4 @@
+--- >
+ Mark McGwire's
+ year was crippled
+ by a knee injury.
@@ -0,0 +1,8 @@
+>
+ Sammy Sosa completed another
+ fine season with great stats.
+
+ 63 Home Runs
+ 0.288 Batting Average
+
+ What a year!
@@ -0,0 +1,7 @@
+name: Mark McGwire
+accomplishment: >
+ Mark set a major league
+ home run record in 1998.
+stats: |
+ 65 Home Runs
+ 0.278 Batting Average
@@ -0,0 +1,7 @@
+unicode: "Sosa did fine.\u263A"
+control: "\b1998\t1999\t2000\n"
+hex esc: "\x0d\x0a is \r\n"
+
+single: '"Howdy!" he cried.'
+quoted: ' # Not a ''comment''.'
+tie-fighter: '|\-*-/|'
@@ -0,0 +1,6 @@
+plain:
+ This unquoted scalar
+ spans many lines.
+
+quoted: "So does this
+ quoted scalar.\n"
@@ -0,0 +1,4 @@
+canonical: 12345
+decimal: +12345
+octal: 0o14
+hexadecimal: 0xC
@@ -0,0 +1,5 @@
+canonical: 1.23015e+3
+exponential: 12.3015e+02
+fixed: 1230.15
+negative infinity: -.inf
+not a number: .NaN
@@ -0,0 +1,3 @@
+null:
+booleans: [ true, false ]
+string: '012345'
@@ -0,0 +1,4 @@
+canonical: 2001-12-15T02:59:43.1Z
+iso8601: 2001-12-14t21:59:43.10-05:00
+spaced: 2001-12-14 21:59:43.10 -5
+date: 2002-12-14
@@ -0,0 +1,13 @@
+---
+not-date: !!str 2002-04-28
+
+picture: !!binary |
+ R0lGODlhDAAMAIQAAP//9/X
+ 17unp5WZmZgAAAOfn515eXv
+ Pz7Y6OjuDg4J+fn5OTk6enp
+ 56enmleECcgggoBADs=
+
+application specific tag: !something |
+ The semantics of the tag
+ above may be different for
+ different documents.
@@ -0,0 +1,14 @@
+%TAG ! tag:clarkevans.com,2002:
+--- !shape
+ # Use the ! handle for presenting
+ # tag:clarkevans.com,2002:circle
+- !circle
+ center: &ORIGIN {x: 73, y: 129}
+ radius: 7
+- !line
+ start: *ORIGIN
+ finish: { x: 89, y: 102 }
+- !label
+ start: *ORIGIN
+ color: 0xFFEEBB
+ text: Pretty vector drawing.
@@ -0,0 +1,7 @@
+# Sets are represented as a
+# Mapping where each key is
+# associated with a null value
+--- !!set
+? Mark McGwire
+? Sammy Sosa
+? Ken Griff
@@ -0,0 +1,7 @@
+# Ordered maps are represented as
+# A sequence of mappings, with
+# each mapping having one key
+--- !!omap
+- Mark McGwire: 65
+- Sammy Sosa: 63
+- Ken Griffy: 58
@@ -0,0 +1,29 @@
+--- !<tag:clarkevans.com,2002:invoice>
+invoice: 34843
+date : 2001-01-23
+bill-to: &id001
+ given : Chris
+ family : Dumars
+ address:
+ lines: |
+ 458 Walkman Dr.
+ Suite #292
+ city : Royal Oak
+ state : MI
+ postal : 48046
+ship-to: *id001
+product:
+ - sku : BL394D
+ quantity : 4
+ description : Basketball
+ price : 450.00
+ - sku : BL4438H
+ quantity : 1
+ description : Super Hoop
+ price : 2392.00
+tax : 251.42
+total: 4443.52
+comments:
+ Late afternoon is best.
+ Backup contact is Nancy
+ Billsmer @ 338-4338.
@@ -0,0 +1,26 @@
+---
+Time: 2001-11-23 15:01:42 -5
+User: ed
+Warning:
+ This is an error message
+ for the log file
+---
+Time: 2001-11-23 15:02:31 -5
+User: ed
+Warning:
+ A slightly different error
+ message.
+---
+Date: 2001-11-23 15:03:17 -5
+User: ed
+Fatal:
+ Unknown variable "bar"
+Stack:
+ - file: TopClass.py
+ line: 23
+ code: |
+ x = MoreObject("345\n")
+ - file: MoreClass.py
+ line: 58
+ code: |-
+ foo = bar
Oops, something went wrong.

0 comments on commit c459130

Please sign in to comment.