Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit f670438

Browse files
committed
Add and test PEP 263 source file encoding specifications.
PEP 263 describes how to specify the encoding of a Python source file. This commit adds UTF-8 encoding specifications to all CKAN Python source files. It also adds a test which verifies that each source file does indeed have a UTF-8 encoding specification.
1 parent 8e6aab9 commit f670438

File tree

445 files changed

+952
-15
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

445 files changed

+952
-15
lines changed

ckan/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
__version__ = '2.6.0a'
24

35
__description__ = 'CKAN Software'

ckan/authz.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import sys
24
import re
35
from logging import getLogger

ckan/ckan_nose_plugin.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
from nose.plugins import Plugin
24
from inspect import isclass
35
import hashlib

ckan/common.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
# This file contains commonly used parts of external libraries. The idea is
24
# to help in removing helpers from being used as a dependency by many files
35
# but at the same time making it easy to change for example the json lib

ckan/config/environment.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# -*- coding: utf-8 -*-
1+
# encoding: utf-8
2+
23
"""Pylons environment configuration"""
34
import os
45
import logging

ckan/config/install.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import re
24

35
from pylons.util import PylonsInstaller

ckan/config/middleware.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
"""Pylons middleware initialization"""
24
import urllib
35
import urllib2

ckan/config/routing.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
"""Routes configuration
24
35
The more specific and detailed routes should be defined first so they

ckan/controllers/admin.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
from pylons import config
24

35
import ckan.lib.base as base

ckan/controllers/api.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import os.path
24
import logging
35
import cgi

ckan/controllers/error.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import cgi
24

35
from paste.urlparser import PkgResourcesParser

ckan/controllers/feed.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
"""
24
The feed controller produces Atom feeds of datasets.
35

ckan/controllers/group.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import logging
24
import datetime
35
from urllib import urlencode

ckan/controllers/home.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
from pylons import config, cache
24
import sqlalchemy.exc
35

ckan/controllers/organization.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import re
24

35
import ckan.controllers.group as group

ckan/controllers/package.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import logging
24
from urllib import urlencode
35
import datetime

ckan/controllers/partyline.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
from pylons.controllers import WSGIController
24
from pylons import config
35

ckan/controllers/revision.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
from datetime import datetime, timedelta
24

35
from pylons.i18n import get_lang

ckan/controllers/storage.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
'''
24
35
Note: This is the old file store controller for CKAN < 2.2.

ckan/controllers/template.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import ckan.lib.base as base
24
import ckan.lib.render
35

ckan/controllers/user.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import logging
24
from urllib import quote
35

ckan/controllers/util.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import re
24

35
import ckan.lib.base as base

ckan/exceptions.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# -*- coding: utf-8 -*-
1+
# encoding: utf-8
2+
3+
24
class CkanException(Exception):
35
pass
46

ckan/i18n/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
# encoding: utf-8
2+
13
# Need some content here to avoid the packaging stripping it out

ckan/i18n/check_po_files.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env python
2+
# encoding: utf-8
3+
24
'''Script for checking for common translation mistakes in po files, see:
35
46
paster check-po-files --help

ckan/lib/activity_streams.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import re
24

35
from webhelpers.html import literal

ckan/lib/activity_streams_session_extension.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
from pylons import config
24
from sqlalchemy.orm.session import SessionExtension
35
from paste.deploy.converters import asbool

ckan/lib/alphabet_paginate.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
'''
24
Based on webhelpers.paginator, but:
35
* each page is for items beginning with a particular letter

ckan/lib/app_globals.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
''' The application's Globals object '''
24

35
import logging

ckan/lib/auth_tkt.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import math
24
import os
35

ckan/lib/authenticator.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import logging
24

35
from zope.interface import implements

ckan/lib/base.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
"""The base Controller API
24
35
Provides the BaseController class for subclassing.

ckan/lib/captcha.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
from pylons import config
24

35
import urllib

ckan/lib/celery_app.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import ConfigParser
24
import os
35
import logging

ckan/lib/cli.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import collections
24
import csv
35
import multiprocessing as mp

ckan/lib/config_tool.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import re
24

35
INSERT_NEW_SECTIONS_BEFORE_SECTION = 'app:main'

ckan/lib/create_test_data.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import logging
24
from collections import defaultdict
35
import datetime

ckan/lib/datapreview.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# coding=UTF-8
1+
# encoding: utf-8
22

33
"""Data previewer functions
44

ckan/lib/dictization/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import datetime
24
from sqlalchemy.orm import class_mapper
35
import sqlalchemy

ckan/lib/dictization/model_dictize.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
'''
24
These dictize functions generally take a domain object (such as Package) and
35
convert it to a dictionary, including related objects (e.g. for Package it

ckan/lib/dictization/model_save.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import datetime
24
import uuid
35
import logging

ckan/lib/email_notifications.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
'''
24
Code for generating email notifications for users (e.g. email notifications for
35
new activities in your dashboard activity stream) and emailing them to the

ckan/lib/extract.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import re
24
from jinja2.ext import babel_extract as extract_jinja2
35
import lib.jinja_extensions

ckan/lib/fanstatic_extensions.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import fanstatic.core as core
24

35

ckan/lib/fanstatic_resources.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import os.path
24
import sys
35
import logging

ckan/lib/formatters.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import datetime
24
import pytz
35
from babel import numbers

ckan/lib/hash.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import hmac
24
import hashlib
35

ckan/lib/helpers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# coding=UTF-8
1+
# encoding: utf-8
22

33
'''Helper functions
44

ckan/lib/i18n.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import os
24

35
from babel import Locale, localedata

ckan/lib/jinja_extensions.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import re
24
from os import path
35
import logging

ckan/lib/jsonp.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import decorator
24

35
from ckan.common import json, request, response

ckan/lib/mailer.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import smtplib
24
import logging
35
import uuid

ckan/lib/maintain.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
''' This module contains code that helps in maintaining the Ckan codebase. '''
24

35
import inspect

ckan/lib/munge.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
# Note these functions are similar to, but separate from name/title mungers
24
# found in the ckanext importer. That one needs to be stable to prevent
35
# packages changing name on reimport, but these ones can be changed and

ckan/lib/navl/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
# encoding: utf-8
2+
13
__license__ = 'MIT'

ckan/lib/navl/dictization_functions.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import copy
24
import formencode as fe
35
import inspect

ckan/lib/navl/validators.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import ckan.lib.navl.dictization_functions as df
24

35
from ckan.common import _

ckan/lib/plugins.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import logging
24
import os
35
import sys

ckan/lib/render.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import os
24
import re
35
import logging

ckan/lib/search/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import logging
24
import sys
35
import cgitb

ckan/lib/search/common.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import datetime
24
import logging
35
import re

ckan/lib/search/index.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import socket
24
import string
35
import logging

ckan/lib/search/query.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import re
24
import logging
35

ckan/lib/search/sql.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
from sqlalchemy import or_
24
from ckan.lib.search.query import SearchQuery
35
import ckan.model as model

ckan/lib/uploader.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
import os
24
import cgi
35
import pylons

ckan/lib/util.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
13
'''Shared utility functions for any Python code to use.
24

35
Unlike :py:mod:`ckan.lib.helpers`, the functions in this module are not

0 commit comments

Comments
 (0)