code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
"""$Id: opml.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
from base import validatorBase
from validators import *
from logging impo... | Python |
"""$Id: skipDays.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
from base import validatorBase
from validators import text
from loggi... | Python |
"""$Id: text_plain.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
"""Output class for plain text output"""
from base import BaseForm... | Python |
"""$Id: text_html.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
"""Output class for HTML text output"""
from base import BaseFormat... | Python |
"""$Id: application_test.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
"""Output class for testing that all output messages are defi... | Python |
"""$Id: text_xml.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
"""Output class for xml output"""
from base import BaseFormatter
fro... | Python |
"""$Id: base.py 1055 2009-05-19 15:12:42Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 1055 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
"""Base class for output classes"""
from UserList import UserList
impo... | Python |
"""$Id: __init__.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
__all__ = ['base', 'text_plain', 'text_html']
| Python |
#!/usr/bin/python
"""
$Id: xmlEncoding.py 988 2008-03-12 18:22:48Z sa3ruby $
This module deals with detecting XML encodings, using both BOMs and
explicit declarations.
"""
__author__ = "Joseph Walton <http://www.kafsemo.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2004 Joseph Walton"
import... | Python |
"""$Id: entry.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
from base import validatorBase
from validators import *
from logging imp... | Python |
"""$Id: feed.py 1040 2009-02-15 20:01:32Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 1040 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
from base import validatorBase
from validators import *
from logging im... | Python |
"""$Id: kml.py 1057 2009-07-21 21:54:14Z sa3ruby $"""
__author__ = "Gregor J. Rothfuss <http://greg.abstrakt.ch/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 1057 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
from base import validatorBase
from validators import *
import... | Python |
"""$Id: validators.py 1058 2009-08-22 09:35:18Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 1058 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
from base import validatorBase
from logging import *
import re, t... | Python |
#$Id
####
# Copyright 2000,2001 by Timothy O'Malley <timo@alum.mit.edu>
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software
# and its documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appear in all
# copies... | Python |
"""$Id: base.py 1049 2009-05-06 02:00:03Z rothfuss $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 1049 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
from xml.sax.handler import ContentHandler
from xml.sax.xmlreader impo... | Python |
"""$Id: content.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
from base import validatorBase, namespaces
from validators import *
fr... | Python |
"""$Id: extension.py 1061 2010-01-25 17:50:01Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net>, Mark Pilgrim <http://diveintomark.org/> and Phil Ringnalda <http://philringnalda.com>"
__version__ = "$Revision: 1061 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby, Mark Pilgrim and Phil Ringnalda"
... | Python |
"""$Id: __init__.py 1027 2008-09-26 14:41:21Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 1027 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
import socket
if hasattr(socket, 'setdefaulttimeout'):
socket.set... | Python |
"""$Id: en.py 1041 2009-02-18 00:19:04Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 1041 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
import feedvalidator
from feedvalidator.logging import *
line = "line %(... | Python |
"""$Id: __init__.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
| Python |
from base import validatorBase
from validators import *
from extension import extension_everywhere
class service(validatorBase, extension_everywhere):
def getExpectedAttrNames(self):
return [] # (None,u'scheme'),(None,u'fixed')]
def validate(self):
if not "app_workspace" in self.children:
self.log(M... | Python |
"""$Id: author.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
from base import validatorBase
from validators import *
#
# author ele... | Python |
"""$Id: image.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
from base import validatorBase
from validators import *
from extension i... | Python |
from validators import *
class media_elements:
def do_media_adult(self):
self.log(DeprecatedMediaAdult({"parent":self.name, "element":"media:adult"}))
return truefalse(), noduplicates()
def do_media_category(self):
return media_category()
def do_media_copyright(self):
return media_copyright(), no... | Python |
#!/usr/bin/python
"""$Id: testXmlEncodingDecode.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Joseph Walton <http://www.kafsemo.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2004 Joseph Walton"
import os, sys
curdir = os.path.abspath(os.path.dirname(sys.argv[0]))
srcdir = os.path.sp... | Python |
#!/usr/bin/python
"""$Id: testMediaTypes.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Joseph Walton <http://www.kafsemo.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2004 Joseph Walton"
import os, sys
curdir = os.path.abspath(os.path.dirname(sys.argv[0]))
srcdir = os.path.split(cur... | Python |
#!/usr/bin/python
import os, sys, unittest
curdir = os.path.abspath(os.path.dirname(sys.argv[0]))
srcdir = os.path.split(curdir)[0]
if srcdir not in sys.path:
sys.path.insert(0, srcdir)
basedir = os.path.split(srcdir)[0]
from feedvalidator.base import namespaces
from os.path import dirname,join
class HowtoNsTest(u... | Python |
#!/usr/bin/python
"""$Id: testUri.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Joseph Walton <http://www.kafsemo.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2004 Joseph Walton"
import os, sys
curdir = os.path.abspath(os.path.dirname(sys.argv[0]))
srcdir = os.path.split(curdir)[0]... | Python |
#!/usr/bin/python
"""$Id: testXmlEncoding.py 988 2008-03-12 18:22:48Z sa3ruby $
Test XML character decoding against a range of encodings, valid and not."""
__author__ = "Joseph Walton <http://www.kafsemo.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2004, 2006 Joseph Walton"
import os, sys
i... | Python |
#!/usr/bin/python
"""$Id$"""
__author__ = "Joseph Walton <http://www.kafsemo.org/>"
__version__ = "$Revision$"
__copyright__ = "Copyright (c) 2004 Joseph Walton"
import os, sys
curdir = os.path.abspath(os.path.dirname(sys.argv[0]))
srcdir = os.path.split(curdir)[0]
if srcdir not in sys.path:
sys.path.insert(0, src... | Python |
#!/usr/bin/python
"""$Id$"""
__author__ = "Joseph Walton <http://www.kafsemo.org/>"
__version__ = "$Revision$"
__copyright__ = "Copyright (c) 2004 Joseph Walton"
import os, sys
curdir = os.path.abspath(os.path.dirname(sys.argv[0]))
srcdir = os.path.split(curdir)[0]
if srcdir not in sys.path:
sys.path.insert(0, src... | Python |
#!/usr/bin/python
"""$Id$"""
__author__ = "Joseph Walton <http://www.kafsemo.org/>"
__version__ = "$Revision$"
__copyright__ = "Copyright (c) 2004 Joseph Walton"
import os, sys
curdir = os.path.abspath(os.path.dirname(sys.argv[0]))
srcdir = os.path.split(curdir)[0]
if srcdir not in sys.path:
sys.path.insert(0, src... | Python |
#!/usr/bin/python
"""$Id$
Test XML character decoding against a range of encodings, valid and not."""
__author__ = "Joseph Walton <http://www.kafsemo.org/>"
__version__ = "$Revision$"
__copyright__ = "Copyright (c) 2004, 2006 Joseph Walton"
import os, sys
import codecs
import re
curdir = os.path.abspath(os.path.dir... | Python |
#!/usr/bin/python
import os, sys, unittest
curdir = os.path.abspath(os.path.dirname(sys.argv[0]))
srcdir = os.path.split(curdir)[0]
if srcdir not in sys.path:
sys.path.insert(0, srcdir)
basedir = os.path.split(srcdir)[0]
from feedvalidator.base import namespaces
from os.path import dirname,join
class HowtoNsTest(u... | Python |
from os import environ
# This is a test config, used by the runtests script, to ensure check.cgi
# runs without requiring a web server.
HOMEURL = 'http://localhost/check'
PYDIR = '/usr/lib/python/'
WEBDIR = environ['FEEDVALIDATOR_HOME']
SRCDIR = WEBDIR + '/src'
DOCSURL = 'docs'
CSSURL = 'css'
| Python |
#!/usr/bin/python
# This is a simple demo of validation through the web service.
WS_HOST = 'www.feedvalidator.org'
WS_URI = '/check.cgi'
import urllib, httplib
from xml.dom import minidom
from sys import exit
# Fetch the feed to validate
rawData = open('../testcases/rss/may/image_height_recommended.xml').read()
#... | Python |
#!/usr/bin/python
"""$Id: validtest.py 1014 2008-05-21 20:43:22Z joe.walton.gglcd $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 1014 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
import feedvalidator
import unittest, ... | Python |
class Identifier(unicode):
"""
See http://www.w3.org/2002/07/rdf-identifer-terminology/
regarding choice of terminology.
"""
| Python |
from rdflib.URIRef import URIRef
class Namespace(URIRef):
def __getitem__(self, key, default=None):
return URIRef(self + key)
| Python |
from rdflib.Namespace import Namespace
# The RDF Namespace
# http://ilrt.org/discovery/2001/07/rdf-syntax-grammar/#section-Namespace
RDFNS = Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#")
# Syntax names
RDF = RDFNS["RDF"]
DESCRIPTION = RDFNS["Description"]
ID = RDFNS["ID"]
ABOUT = RDFNS["about"]
PARSE_TYPE... | Python |
from string import ascii_letters
from random import choice
from rdflib.Identifier import Identifier
from rdflib.Literal import Literal
# Create a (hopefully) unique prefix so that BNode values do not
# collide with ones created with a different instance of this module.
prefix = ""
for i in xrange(0,8):
prefix += ... | Python |
from sys import version_info
if version_info[0:2] > (2, 2):
from unicodedata import normalize
else:
normalize = None
from rdflib.Identifier import Identifier
from rdflib.exceptions import Error
class Literal(Identifier):
"""
http://www.w3.org/TR/rdf-concepts/#section-Graph-Literal
"""
d... | Python |
# From: http://www.w3.org/TR/REC-xml#NT-CombiningChar
#
# * Name start characters must have one of the categories Ll, Lu, Lo,
# Lt, Nl.
#
# * Name characters other than Name-start characters must have one of
# the categories Mc, Me, Mn, Lm, or Nd.
#
# * Characters in the compatibility area (i.e. with character code... | Python |
# RDF Library
| Python |
# Copyright (c) 2002, Daniel Krech, http://eikeon.com/
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list ... | Python |
__all__ = ["RDFXMLParser", "NTParser"]
| Python |
class Error(Exception):
"""Base class for rdflib exceptions."""
def __init__(self, msg=None):
Exception.__init__(self, msg)
self.msg = msg
class TypeCheckError(Error):
"""Parts of assertions are subject to type checks."""
def __init__(self, node):
Error.__init__(self, node)
... | Python |
# RDF Library
__version__ = "2.0.6"
| Python |
from sys import version_info
if version_info[0:2] > (2, 2):
from unicodedata import normalize
else:
normalize = None
from rdflib.Identifier import Identifier
from rdflib.Literal import Literal
class URIRef(Identifier):
def __new__(cls, value):
return Identifier.__new__(cls, value)
d... | Python |
#!/usr/bin/python
"""$Id$"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision$"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
import feedvalidator
import unittest, new, os, sys, glob, re
from feedvalidator.logging import Message,... | Python |
#!/usr/bin/python
"""$Id$"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision$"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
import feedvalidator
import sys
import os
import urllib
import urllib2
import urlparse
if __name__ == ... | Python |
#!/usr/bin/python
# This is a simple demo of validation through the web service.
WS_HOST = 'www.feedvalidator.org'
WS_URI = '/check.cgi'
import urllib, httplib
from xml.dom import minidom
from sys import exit
# Fetch the feed to validate
rawData = open('../testcases/rss/may/image_height_recommended.xml').read()
#... | Python |
#!/usr/bin/python
"""
$Id$
Show any logging events without explanatory web pages
"""
from sys import path, argv, exit
from os.path import isfile
import inspect
import os.path
curdir = os.path.abspath(os.path.dirname(argv[0]))
BASE = os.path.split(curdir)[0]
path.insert(0, os.path.join(BASE, 'src'))
import feedvali... | Python |
#!/usr/bin/python
"""
$Id: missingWebPages.py 75 2004-03-28 07:48:21Z josephw $
Show any logging events without explanatory web pages
"""
from sys import path, argv, exit
from os.path import isfile
import inspect
import os.path
curdir = os.path.abspath(os.path.dirname(argv[0]))
BASE = os.path.split(curdir)[0]
path... | Python |
import feedvalidator
import sys
def escapeURL(url):
import cgi, urllib, urlparse
parts = map(urllib.quote, map(urllib.unquote, urlparse.urlparse(url)))
return cgi.escape(urlparse.urlunparse(parts))
def sanitizeURL(url):
# Allow feed: URIs, as described by draft-obasanjo-feed-URI-scheme-02
if url.l... | Python |
#!/usr/bin/python
"""$Id: demo.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
import feedvalidator
import sys
import os
import urlli... | Python |
#!/usr/bin/env python
from config import *
import cgi, sys, os, urlparse, sys, re, urllib
import cgitb
cgitb.enable()
import codecs
ENCODING='UTF-8'
sys.stdout = codecs.getwriter(ENCODING)(sys.stdout)
# Used for CGI parameters
decUTF8 = codecs.getdecoder('utf-8')
decW1252 = codecs.getdecoder('windows-1252')
if PYDI... | Python |
#!/usr/bin/python
print "Content-type: text/plain\r\n\r\n",
import rfc822
import time
print "Current time:\n"
print " RFC 2822: " + rfc822.formatdate()
print " RFC 3339: " + time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
| Python |
#!/usr/bin/env python
from config import *
import cgi, cgitb, sys
cgitb.enable()
import codecs
ENCODING='UTF-8'
sys.stdout = codecs.getwriter(ENCODING)(sys.stdout)
if SRCDIR not in sys.path:
sys.path.insert(0, SRCDIR)
class request:
content_type = "text/html"
from index import index
fs = cgi.FieldStorage()
... | Python |
#!/usr/bin/python
# Put a header and a footer on a list of all documented diagnostics,
# linking to their pages.
# Note that this script has lots of hardcoded paths, needs to be run
# from the docs-xml directory, and modifies the index.html in docs.
from os import listdir
from os import path
import re
from sys im... | Python |
#!/usr/bin/python
# Given a template (with a specific format), a target document root and a set of formatted XML
# documents, generate HTML documentation for public web access.
# Extracts information from XML using regular expression and proper parsing
from sys import argv, stderr, exit
if len(argv) < 3:
print ... | Python |
import sys
import os.path as path
basename = path.dirname(path.dirname(path.abspath(__file__)))
sys.path.append(path.join(basename,'src'))
from feedvalidator.i18n.en import messages
from feedvalidator.logging import Warning, Error
template = '''
<fvdoc>
<div xmlns='http://www.w3.org/1999/xhtml'>
<div id='message'>
<p... | Python |
#!/usr/bin/python
# Put a header and a footer on a list of all documented diagnostics,
# linking to their pages.
# Note that this script has lots of hardcoded paths, needs to be run
# from the docs-xml directory, and modifies the index.html in docs.
from os import listdir
from os import path
import re
from sys im... | Python |
#!/usr/bin/python
# Given a template (with a specific format), a target document root and a set of formatted XML
# documents, generate HTML documentation for public web access.
# Extracts information from XML using regular expression and proper parsing
from sys import argv, stderr, exit
if len(argv) < 3:
print ... | Python |
# Default URL of the validator itself... feel free to beautify as you like
import os
HOMEURL = os.environ['HTTP_HOST'] + os.environ['SCRIPT_NAME']
if not HOMEURL.startswith('http://'): HOMEURL = 'http://' + HOMEURL
# This is where the CGI itself is... other supporting scripts (like
# feedfinder) may be placed here.
WE... | Python |
#!/usr/bin/python
print "Content-type: text/plain\r\n\r\n",
import rfc822
import time
print "Current time:\n"
print " RFC 2822: " + rfc822.formatdate()
print " RFC 3339: " + time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
| Python |
#!/usr/bin/env python
"""Universal feed parser
Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds
Visit http://feedparser.org/ for the latest version
Visit http://feedparser.org/docs/ for the latest documentation
Required: Python 2.1 or later
Recommended: Python 2.3 or later
Recommended: CJKCodecs... | Python |
import sys
from docutils import core, io
# The following two functions are copied from:
#
# http://docutils.sourceforge.net/docutils/examples.py
def html_parts(input_string, source_path=None, destination_path=None,
input_encoding='unicode', doctitle=1, initial_header_level=1):
"""
G... | Python |
#!/usr/bin/env python
import glob, unittest, os, sys
from trace import fullmodname
try:
from tests.utils import cleanup
except:
def cleanup():
pass
# try to start in a consistent, predictable location
if sys.path[0]:
os.chdir(sys.path[0])
# find all of the planet test modules
modules = map(fullm... | Python |
from distutils.core import setup
VERSION = '0.1.0'
setup(name='atompubbase',
version=VERSION,
author='Joe Gregorio',
author_email='joe@bitworking.org',
url='http://code.google.com/p/feedvalidator/',
description='An Atom Publishing Protocol client library.',
license='MIT'... | Python |
from urllib import urlencode
import atompubbase
import atompubbase.events
from atompubbase.model import init_event_handlers
init_event_handlers()
def apply_credentials_file(filename, http, error):
parts = file(filename, "r").read().splitlines()
if len(parts) == 2:
name, password = parts
http.add_c... | Python |
# Copyright Google 2007
"""
An eventing system for atompubbase objects.
Each class that is registered with add_event_handlers()
will be hooked into the event system. Clients can then
register for callbacks when a member function is called,
filtering on when to trigger the callback. There
are several axes that can be us... | Python |
#!/usr/bin/env python
import glob, unittest, os, sys
from trace import fullmodname
try:
from tests.utils import cleanup
except:
def cleanup():
pass
# try to start in a consistent, predictable location
if sys.path[0]:
os.chdir(sys.path[0])
# find all of the planet test modules
modules = map(fullm... | Python |
"""MIME-Type Parser
This module provides basic functions for handling mime-types. It can handle
matching mime-types against a list of media-ranges. See section 14.1 of the
HTTP specification [RFC 2616] for a complete explanation.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
Contents:
- parse_mi... | Python |
# -*- coding: utf-8 -*-
#old way
from distutils.core import setup
#new way
#from setuptools import setup, find_packages
setup(name='mimeparse',
version='0.1.4',
description='A module provides basic functions for parsing mime-type names and matching them against a list of media-ranges.',
long_desc... | Python |
"""
Python tests for Mime-Type Parser.
This module loads a json file and converts the tests specified therein to a set
of PyUnitTestCases. Then it uses PyUnit to run them and report their status.
"""
__version__ = "0.1"
__author__ = 'Ade Oshineye'
__email__ = "ade@oshineye.com"
__credits__ = ""
import mimeparse
impor... | Python |
"""
There are four classes that make up the core
of the atompub model.
class Context
class Service
class Collection
class Entry
Context represents the current state, as represented
by a service document, a collection and an entry.
Each atompub object (Service, Collection, or Entry)
is just instantiated with a URI (... | Python |
SERVICE1 = """<?xml version="1.0" encoding='utf-8'?>
<service xmlns="http://www.w3.org/2007/app">
<workspace title="Main Site" >
<collection
title="My Blog Entries"
href="http://example.org/reilly/main" />
<collection
title="Pictures"
href="http://example.org/reilly/pic" >
<... | Python |
from pretty import pretty
try:
from xml.etree.ElementTree import fromstring, tostring
except:
from elementtree.ElementTree import fromstring, tostring
src = """<html:div xmlns:html="http://www.w3.org/1999/xhtml">
<html:p >I took a couple of days off work
and we drove down to Florida to visit family in "The... | Python |
#!/usr/bin/env python
import glob, unittest, os, sys
from trace import fullmodname
try:
from tests.utils import cleanup
except:
def cleanup():
pass
# try to start in a consistent, predictable location
if sys.path[0]:
os.chdir(sys.path[0])
# find all of the planet test modules
modules = map(fullm... | Python |
from model import init_event_handlers, Context, Service, Collection, Entry, ATOM, XHTML
from httplib2 import Http
import unittest
import events
try:
from xml.etree.ElementTree import fromstring, tostring
except:
from elementtree.ElementTree import fromstring, tostring
ATOM_CONTENT = "{%s}content/{%s}div" % (A... | Python |
try:
from xml.etree.ElementTree import fromstring, tostring, SubElement
import xml.etree.ElementTree as ElementTree
except:
from elementtree.ElementTree import fromstring, tostring, SubElement
import elementtree.ElementTree as ElementTree
class namespace(object):
def __init__(self, uri):
se... | Python |
import urlparse
import urllib
import httplib2
from email import message_from_string, message_from_file
import os
class MockHttp:
"""
A mock for httplib2.Http that takes its
response headers and bodies from files on disk
"""
def __init__(self, directory):
self.directory = directory
... | Python |
#!/usr/bin/env python
import glob, unittest, os, sys
from trace import fullmodname
try:
from tests.utils import cleanup
except:
def cleanup():
pass
# try to start in a consistent, predictable location
if sys.path[0]:
os.chdir(sys.path[0])
# find all of the planet test modules
modules = map(fullm... | Python |
#!/usr/bin/env python
"""Universal feed parser
Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds
Visit http://feedparser.org/ for the latest version
Visit http://feedparser.org/docs/ for the latest documentation
Required: Python 2.1 or later
Recommended: Python 2.3 or later
Recommended: CJKCodecs... | Python |
#!/bin/env python2.5
__version__ = "0.1.0"
import os
import sys
sys.path.append(os.getcwd())
from optparse import OptionParser, SUPPRESS_HELP, make_option
from atompubbase.model import Entry, Collection, Service, Context, APP, ATOM
from httplib2 import Http
import pickle
import itertools
import mimetypes
import copy
im... | Python |
#!/bin/env python2.5
__version__ = "0.1.0"
import os
import sys
sys.path.append(os.getcwd())
from optparse import OptionParser, SUPPRESS_HELP, make_option
from atompubbase.model import Entry, Collection, Service, Context, APP, ATOM
from httplib2 import Http
import pickle
import itertools
import mimetypes
import copy
im... | Python |
from distutils.core import setup
import py2exe
setup(console=["appeditor.py"]) | Python |
from subprocess import Popen, PIPE
import unittest
from appclienttest import msg
class Test(unittest.TestCase):
def _parse(self, output):
parsed = [tuple(l.split(" ", 1)[0].split(":")) for l in output.splitlines()]
parsed = [(code, getattr(msg, message)) for code, message in parsed]
msg_co... | Python |
"""$Id: uri.py 988 2008-03-12 18:22:48Z sa3ruby $"""
"""
Code to test URI references for validity, and give their normalized
form, according to RFC 3986.
"""
__author__ = "Joseph Walton <http://www.kafsemo.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2004, 2007 Joseph Walton"
from urlparse ... | Python |
"""$Id: compatibility.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
from logging import *
def _must(event):
return isinstance(eve... | Python |
"""$Id: root.py 1049 2009-05-06 02:00:03Z rothfuss $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 1049 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
from base import validatorBase
rss11_namespace='http://purl.org/net/r... | Python |
"""$Id: item.py 1019 2008-06-03 05:13:16Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 1019 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
from base import validatorBase
from validators import *
from logging im... | Python |
from base import validatorBase
from category import category
from validators import yesno
from logging import ConflictingCatAttr, ConflictingCatChildren
class categories(validatorBase):
def getExpectedAttrNames(self):
return [(None,u'scheme'),(None,u'fixed'),(None,u'href')]
def prevalidate(self):
self.val... | Python |
from base import validatorBase
from validators import *
class xrds(validatorBase):
def do_xrd_XRD(self):
return xrd()
class xrd(validatorBase):
def do_xrd_Service(self):
return service()
class service(validatorBase):
def getExpectedAttrNames(self):
return [(None,'priority')]
def prevalidate(self)... | Python |
"""$Id: rdf.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
from base import validatorBase
from logging import *
from validators impor... | Python |
"""$Id: iso639codes.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
isoLang = \
{'aa': 'Afar',
'ab': 'Abkhazian',
'ae': ... | Python |
from base import validatorBase
from validators import *
from logging import InvalidSseType, InvalidNSS, MissingElement, MissingByAndWhenAttrs
import re
class Sharing(validatorBase):
def getExpectedAttrNames(self):
return [ (None, u'expires'), (None, u'since'), (None, u'until') ]
def prevalidate(self):
if... | Python |
"""$Id: logging.py 1059 2009-11-12 22:08:04Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 1059 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
# feed types
TYPE_UNKNOWN = 0
TYPE_RSS1 = 1
TYPE_RSS2 = 2
TYPE_ATOM ... | Python |
"""$Id: itunes.py 988 2008-03-12 18:22:48Z sa3ruby $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 988 $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
from validators import *
class itunes:
def do_itunes_author(self):
... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.