code
stringlengths
1
1.72M
language
stringclasses
1 value
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of web2py Web Framework (Copyrighted, 2007-2009). Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu> and Robin B <robi123@gmail.com>. License: GPL v2 """ __all__ = ['MEMDB', 'Field'] import re import sys import os import types import datetime ...
Python
# Only Python 2.6 and up, because of NamedTuple. import time from collections import namedtuple Score = namedtuple('Score', ['tag', 'stamp']) class TimeCollector(object): def __init__(self): '''The first time stamp is created here''' self.scores = [Score(tag='start', stamp=time.clock())] def ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """`cssmin` - A Python port of the YUI CSS compressor.""" """ Home page: https://github.com/zacharyvoase/cssmin License: BSD: https://github.com/zacharyvoase/cssmin/blob/master/LICENSE Original author: Zachary Voase Modified for inclusion into web2py by: Ross Peoples <ros...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ High-level CSS and JS minification class for web2py. Called by response.include_files() Created by: Ross Peoples <ross.peoples@gmail.com> Modified by: Massimo Di Pierro <massimo.dipierro@gmail.com> """ import cssmin import jsmin import os import hashlib import re de...
Python
# coding: utf-8 import re def minify(response): def _replace(match): match = match.group() # save whole <pre>, <textarea> tags, and opening <!-- (so it doesn't break <script>) # otherwise, replace all whitespace with a single space character return match if match.startswith(('<pre...
Python
#!/usr/bin/env python # -*- coding: ascii -*- # # Copyright 2011 # Andr\xe9 Malo or his licensors, as applicable # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/...
Python
"""Simple AES cipher implementation in pure Python following PEP-272 API Homepage: https://bitbucket.org/intgr/pyaes/ The goal of this module is to be as fast as reasonable in Python while still being Pythonic and readable/understandable. It is licensed under the permissive MIT license. Hopefully the code is readabl...
Python
SMSCODES = { 'Aliant': '@chat.wirefree.ca', 'Alltel': '@message.alltel.com', 'Ameritech': '@paging.acswireless.com', 'AT&T': '@txt.att.net', 'AU by KDDI': '@ezweb.ne.jp', 'BeeLine GSM': '@sms.beemail.ru', 'Bell Mobility Canada': '@txt.bellmobility.ca', 'Bellsouth': '@bellsouth.cl', '...
Python
""" Developed by 616d41631bff906704951934ffe4015e Released under web2py license because includes gluon/cache.py source code """ import redis from redis.exceptions import ConnectionError from gluon import current from gluon.cache import CacheAbstract import cPickle as pickle import time import re import logging import ...
Python
""" Developed by Massimo Di Pierro Released under the web2py license (LGPL) It an interface on top of urllib2 which simplifies scripting of http requests mostly for testing purposes - customizable - supports basic auth - supports cookies - supports session cookies (tested with web2py sessions) - detects broken sessio...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Creates a taskbar icon for web2py # # Author: Mark Larsen, mostly stolen from Mark Hammond's # # C:\Python25\Lib\site-packages\win32\Demos\win32gui_taskbar.py # # 11/7/08 # dual licensed under the web2py license (LGPL) and the Python license. import os import sys imp...
Python
""" AIM class to credit card payment with authorize.net Fork of authnet code written by John Conde http://www.johnconde.net/blog/integrate-the-authorizenet-aim-api-with-python-3-2/ Unkown license, assuming public domain Modifed by Massimo Di Pierro - ported from Python 3.x run on Python 2.4+ - fixed a couple of bugs...
Python
""" PyRSS2Gen - A Python library for generating RSS 2.0 feeds. (This is the BSD license, based on the template at http://www.opensource.org/licenses/bsd-license.php ) Copyright (c) 2003, Dalke Scientific Software, LLC All rights reserved. Redistribution and use in source and binary forms, with or without modific...
Python
#!/usr/bin/env python # -*- coding: latin-1 -*- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by the # Free Software Foundation; either version 3, or (at your option) any later # version. # # This program is distributed ...
Python
#!/usr/bin/env python # -*- coding: latin-1 -*- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by the # Free Software Foundation; either version 3, or (at your option) any later # version. # # This program is distributed ...
Python
#!/usr/bin/env python # -*- coding: latin-1 -*- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by the # Free Software Foundation; either version 3, or (at your option) any later # version. # # This program is distributed ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- "PySimpleSOAP" import client import server import simplexml import transport
Python
#!/usr/bin/env python # -*- coding: latin-1 -*- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by the # Free Software Foundation; either version 3, or (at your option) any later # version. # # This program is distributed ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # created by Massimo Di Pierro # recreated by Vladyslav Kozlovskyy # license MIT/BSD/GPL import re from cgi import escape from string import maketrans """ TODO: next version should use MathJax <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJ...
Python
#!/usr/bin/env python # created my Massimo Di Pierro # license MIT/BSD/GPL import re import cgi import sys import doctest from optparse import OptionParser __all__ = ['render','markmin2latex'] META = 'META' regex_newlines = re.compile('(\n\r)|(\r\n)') regex_dd=re.compile('\$\$(?P<latex>.*?)\$\$') regex_code = re.comp...
Python
""" Created by Massimo Di Pierro Licese BSD """ import subprocess import os import os.path import re import sys from tempfile import mkstemp, mkdtemp, NamedTemporaryFile from markmin2latex import markmin2latex __all__ = ['markmin2pdf'] def removeall(path): ERROR_STR= """Error removing %(path)s, %(error)s """ ...
Python
# this file exists for backward compatibility __all__ = ['DAL', 'Field', 'drivers', 'gae'] from gluon.dal import DAL, Field, Table, Query, Set, Expression, Row, Rows, drivers, BaseAdapter, SQLField, SQLTable, SQLXorable, SQLQuery, SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, SQLALL, SQLCustomType, gae
Python
from gluon import XML def button(merchant_id="123456789012345", products=[dict(name="shoes", quantity=1, price=23.5, currency='USD', description="running shoes black")]): t = '<input name="item_%(key)...
Python
# -*- coding: utf-8 -*- import struct import re try: import cStringIO as StringIO except ImportError: import StringIO from err import Warning, Error, InterfaceError, DataError, \ DatabaseError, OperationalError, IntegrityError, InternalError, \ NotSupportedError, ProgrammingError ins...
Python
import re import datetime import time import sys from constants import FIELD_TYPE, FLAG from charset import charset_by_id PYTHON3 = sys.version_info[0] > 2 try: set except NameError: try: from sets import BaseSet as set except ImportError: from sets import Set as set ESCAPE_REGEX = re.co...
Python
from time import localtime from datetime import date, datetime, time, timedelta Date = date Time = time TimeDelta = timedelta Timestamp = datetime def DateFromTicks(ticks): return date(*localtime(ticks)[:3]) def TimeFromTicks(ticks): return time(*localtime(ticks)[3:6]) def TimestampFromTicks(ticks): ret...
Python
import struct try: StandardError, Warning except ImportError: try: from exceptions import StandardError, Warning except ImportError: import sys e = sys.modules['exceptions'] StandardError = e.StandardError Warning = e.Warning from constants import ER import sys...
Python
import struct def byte2int(b): if isinstance(b, int): return b else: return struct.unpack("!B", b)[0] def int2byte(i): return struct.pack("!B", i) def join_bytes(bs): if len(bs) == 0: return "" else: rv = bs[0] for b in bs[1:]: rv += b r...
Python
MBLENGTH = { 8:1, 33:3, 88:2, 91:2 } class Charset: def __init__(self, id, name, collation, is_default): self.id, self.name, self.collation = id, name, collation self.is_default = is_default == 'Yes' class Charsets: def __init__(self): self._by_i...
Python
import pymysql import unittest class PyMySQLTestCase(unittest.TestCase): # Edit this to suit your test environment. databases = [ {"host":"localhost","user":"root", "passwd":"","db":"test_pymysql", "use_unicode": True}, {"host":"localhost","user":"root","passwd":"","db":"test_pymysql2"...
Python
from pymysql.tests.test_issues import * from pymysql.tests.test_example import * from pymysql.tests.test_basic import * from pymysql.tests.test_DictCursor import * import sys if sys.version_info[0] == 2: # MySQLdb tests were designed for Python 3 from pymysql.tests.thirdparty import * if __name__ == "__main__...
Python
''' PyMySQL: A pure-Python drop-in replacement for MySQLdb. Copyright (c) 2010 PyMySQL contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitati...
Python
# Python implementation of the MySQL client-server protocol # http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol try: import hashlib sha_new = lambda *args, **kwargs: hashlib.new("sha1", *args, **kwargs) except ImportError: import sha sha_new = sha.new import socket try: import ss...
Python
COM_SLEEP = 0x00 COM_QUIT = 0x01 COM_INIT_DB = 0x02 COM_QUERY = 0x03 COM_FIELD_LIST = 0x04 COM_CREATE_DB = 0x05 COM_DROP_DB = 0x06 COM_REFRESH = 0x07 COM_SHUTDOWN = 0x08 COM_STATISTICS = 0x09 COM_PROCESS_INFO = 0x0a COM_CONNECT = 0x0b COM_PROCESS_KILL = 0x0c COM_DEBUG = 0x0d COM_PING = 0x0e COM_TIME = 0x0f COM_DELAYED...
Python
DECIMAL = 0 TINY = 1 SHORT = 2 LONG = 3 FLOAT = 4 DOUBLE = 5 NULL = 6 TIMESTAMP = 7 LONGLONG = 8 INT24 = 9 DATE = 10 TIME = 11 DATETIME = 12 YEAR = 13 NEWDATE = 14 VARCHAR = 15 BIT = 16 NEWDECIMAL = 246 ENUM = 247 SET = 248 TINY_BLOB = 249 MEDIUM_BLOB = 250 LONG_BLOB = 251 BLOB = 252 VAR_STRING = 253 STRING = 254 GEO...
Python
NOT_NULL = 1 PRI_KEY = 2 UNIQUE_KEY = 4 MULTIPLE_KEY = 8 BLOB = 16 UNSIGNED = 32 ZEROFILL = 64 BINARY = 128 ENUM = 256 AUTO_INCREMENT = 512 TIMESTAMP = 1024 SET = 2048 PART_KEY = 16384 GROUP = 32767 UNIQUE = 65536
Python
ERROR_FIRST = 1000 HASHCHK = 1000 NISAMCHK = 1001 NO = 1002 YES = 1003 CANT_CREATE_FILE = 1004 CANT_CREATE_TABLE = 1005 CANT_CREATE_DB = 1006 DB_CREATE_EXISTS = 1007 DB_DROP_EXISTS = 1008 DB_DROP_DELETE = 1009 DB_DROP_RMDIR = 1010 CANT_DELETE_FILE = 1011 CANT_FIND_SYSTEM_REC = 1012 CANT_GET_STAT = 1013 CANT_GET_WD = 1...
Python
SERVER_STATUS_IN_TRANS = 1 SERVER_STATUS_AUTOCOMMIT = 2 SERVER_MORE_RESULTS_EXISTS = 8 SERVER_QUERY_NO_GOOD_INDEX_USED = 16 SERVER_QUERY_NO_INDEX_USED = 32 SERVER_STATUS_CURSOR_EXISTS = 64 SERVER_STATUS_LAST_ROW_SENT = 128 SERVER_STATUS_DB_DROPPED = 256 SERVER_STATUS_NO_BACKSLASH_ESCAPES = 512 SERVER_STATUS_METADATA_C...
Python
LONG_PASSWORD = 1 FOUND_ROWS = 1 << 1 LONG_FLAG = 1 << 2 CONNECT_WITH_DB = 1 << 3 NO_SCHEMA = 1 << 4 COMPRESS = 1 << 5 ODBC = 1 << 6 LOCAL_FILES = 1 << 7 IGNORE_SPACE = 1 << 8 PROTOCOL_41 = 1 << 9 INTERACTIVE = 1 << 10 SSL = 1 << 11 IGNORE_SIGPIPE = 1 << 12 TRANSACTIONS = 1 << 13 SECURE_CONNECTION = 1 << 15 MULTI_STA...
Python
#!/usr/bin/env python """ client module for memcached (memory cache daemon) Overview ======== See U{the MemCached homepage<http://www.danga.com/memcached>} for more about memcached. Usage summary ============= This should give you a feel for how this module operates:: import memcache mc = memcache.Client(...
Python
from gluon.contrib.memcache.memcache import Client from gluon.cache import CacheAbstract import time """ examle of usage: cache.memcache = MemcacheClient(request,[127.0.0.1:11211],debug=true) """ import cPickle as pickle import thread from gluon import current DEFAULT_TIME_EXPIRE = 300 # seconds (must be the same a...
Python
# (c) 2007 Chris AtLee <chris@atlee.ca> # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license.php """ PAM module for python Provides an authenticate function that will allow the caller to authenticate a user against the Pluggable Authentication Modules (PAM) on the system. Implemented usi...
Python
# # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
Python
""" Developed by niphlod@gmail.com """ import redis from redis.exceptions import ConnectionError from gluon import current from gluon.storage import Storage import cPickle as pickle import time import re import logging import thread logger = logging.getLogger("web2py.session.redis") locker = thread.allocate_lock() ...
Python
# vim: sw=4:expandtab:foldmethod=marker # # Copyright (c) 2007-2009, Mathieu Fenniak # 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 co...
Python
# vim: sw=4:expandtab:foldmethod=marker # # Copyright (c) 2007-2009, Mathieu Fenniak # 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 co...
Python
class MulticastDelegate(object): def __init__(self): self.delegates = [] def __iadd__(self, delegate): self.add(delegate) return self def add(self, delegate): self.delegates.append(delegate) def __isub__(self, delegate): self.delegates.remove(dele...
Python
# vim: sw=4:expandtab:foldmethod=marker # # Copyright (c) 2007-2009, Mathieu Fenniak # 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 co...
Python
# vim: sw=4:expandtab:foldmethod=marker # # Copyright (c) 2007-2009, Mathieu Fenniak # 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 co...
Python
# vim: sw=4:expandtab:foldmethod=marker # # Copyright (c) 2007-2009, Mathieu Fenniak # 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 co...
Python
# vim: sw=4:expandtab:foldmethod=marker # # Copyright (c) 2007-2009, Mathieu Fenniak # 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 co...
Python
def autoretry_datastore_timeouts(attempts=5.0, interval=0.1, exponent=2.0): """ Copyright (C) 2009 twitter.com/rcb Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without ...
Python
from types import StringType, ListType, TupleType from copy import deepcopy from Elements import * DEFAULT_TAB_WIDTH = 720 ParagraphAlignmentMap = { ParagraphPropertySet.LEFT : 'ql', ParagraphPropertySet.RIGHT : 'qr', ParagraphPropertySet.CENTER : 'qc...
Python
from types import IntType, FloatType, LongType, StringTypes from copy import deepcopy from binascii import hexlify from Constants import * from Styles import * class UnhandledParamError( Exception ) : def __init__( self, param ) : Exception.__init__( self, "Don't...
Python
""" A Styles is a collection of PropertySets that can be applied to a particular RTF element. At present there are only two, Text and Paragraph but ListStyles will be added soon too. """ from PropertySets import * class TextStyle : def __init__( self, text_props, name=None, shading_props=None ) : self....
Python
""" PropertySets group common attributes together, each property set is used to control a specific part of the rendering. PropertySets can be used in different elements of the document. For example the FramePropertySet is used in paragraphs, tables, cells, etc. The TextPropertySet can be used for text or in a Paragr...
Python
from PropertySets import * from Elements import * from Styles import * from Renderer import * def dumps(doc): import cStringIO s=cStringIO.StringIO() r=Renderer() r.Write(doc,s) return s.getvalue()
Python
class ViewKind : """An integer (0-5) that represents the view mode of the document.""" NONE = 0 PageLayout = 1 Outline = 2 MasterDocument = 3 Normal = 4 OnlineLayout = 5 DEFAULT = PageLayout def _IsValid( cls, value ) : return value in [ 0, 1...
Python
#!/usr/bin/env python # -*- coding: latin-1 -*- # **************************************************************************** # * Software: FPDF for python * # * Version: 1.7.1 * # * Date: 2010-09-10 ...
Python
#!/usr/bin/env python # -*- coding: latin-1 -*- # Fonts: fpdf_charwidths = {} fpdf_charwidths['courier']={} for i in xrange(0,256): fpdf_charwidths['courier'][chr(i)]=600 fpdf_charwidths['courierB']=fpdf_charwidths['courier'] fpdf_charwidths['courierI']=fpdf_charwidths['courier'] fpdf_c...
Python
#****************************************************************************** # TTFontFile class # # This class is based on The ReportLab Open Source PDF library ...
Python
# -*- coding: iso-8859-1 -*- "PDF Template Helper for FPDF.py" __author__ = "Mariano Reingart <reingart@gmail.com>" __copyright__ = "Copyright (C) 2010 Mariano Reingart" __license__ = "LGPL 3.0" import sys,os,csv from fpdf import FPDF def rgb(col): return (col // 65536), (col // 256 % 256), (col% 256) class Te...
Python
#!/usr/bin/env python # -*- coding: latin-1 -*- # fpdf php helpers: def substr(s, start, length=-1): if length < 0: length=len(s)-start return s[start:start+length] def sprintf(fmt, *args): return fmt % args def print_r(array): if not isinstance(array, dict): a...
Python
# -*- coding: latin-1 -*- "HTML Renderer for FPDF.py" __author__ = "Mariano Reingart <reingart@gmail.com>" __copyright__ = "Copyright (C) 2010 Mariano Reingart" __license__ = "LGPL 3.0" # Inspired by tuto5.py and several examples from fpdf.org, html2fpdf, etc. from fpdf import FPDF from HTMLParser import HTMLParser...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- "FPDF for python" __license__ = "LGPL 3.0" __version__ = "1.7" from fpdf import * try: from html import HTMLMixin except ImportError: import warnings warnings.warn("web2py gluon package not installed, required for html2pdf") from template import Template
Python
#!/usr/bin/env python # coding:utf-8 "Queues(Pipe)-based independent remote client-server Python Debugger" __author__ = "Mariano Reingart (reingart@gmail.com)" __copyright__ = "Copyright (C) 2011 Mariano Reingart" __license__ = "LGPL 3.0" __version__ = "1.01b" # remote debugger queue-based (jsonrpc-like interface): ...
Python
""" Developed by Massimo Di Pierro Released under the web2py license (LGPL) What does it do? if html is a variable containing HTML text and urls in the text, when you call html = expend_html(html) it automatically converts the url to links but when possible it embeds the object being linked. In particular it ca...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Developed by Robin Bhattacharyya (memecache for GAE) Released under the web2py license (LGPL) from gluon.contrib.gae_memcache import MemcacheClient cache.ram=cache.disk=MemcacheClient(request) """ import time from google.appengine.api.memcache import Client class M...
Python
"""Implementation of JSONDecoder """ import re import sys import struct from scanner import make_scanner def _import_c_scanstring(): try: raise ImportError # because assumes simplejson in path from simplejson._speedups import scanstring return scanstring except ImportError: retu...
Python
"""Drop-in replacement for collections.OrderedDict by Raymond Hettinger http://code.activestate.com/recipes/576693/ """ from UserDict import DictMixin # Modified from original to support Python 2.4, see # http://code.google.com/p/simplejson/issues/detail?id=53 try: all except NameError: def all(seq): ...
Python
"""JSON token scanner """ import re def _import_c_make_scanner(): try: raise ImportError # because assumes simplejson in path from simplejson._speedups import make_scanner return make_scanner except ImportError: return None c_make_scanner = _import_c_make_scanner() __all__ = ['m...
Python
"""Implementation of JSONEncoder """ import re from decimal import Decimal def _import_speedups(): try: raise ImportError # because assumes simplejson in path from simplejson import _speedups return _speedups.encode_basestring_ascii, _speedups.make_encoder except ImportError: re...
Python
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`simplejson` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is the externally maintained version of ...
Python
r"""Command-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m simplejson.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m simplejson.tool Expecting property name: line 1 column 2 (char 2) """ import sys import simplejson as json def main(): ...
Python
import urllib import simplejson class Stripe: """ Usage: key='<api key>' d = Stripe(key).charge( amount=100, currency='usd', card_number='4242424242424242', card_exp_month='5', card_exp_year='2012', card_cvc_chec...
Python
""" DowCommerce class to process credit card payments with DowCommerce.com Modifications to support Dow Commerce API from code originally written by John Conde http://www.johnconde.net/blog/integrate-the-authorizenet-aim-api-with-python-3-2/ Unkown license, assuming public domain Modifed by Dave Stoll dave.stoll@gmai...
Python
#!/usr/bin/env python # Copyright (c) 2007-2008 ActiveState Corp. # License: MIT (http://www.opensource.org/licenses/mit-license.php) r"""A fast and complete Python implementation of Markdown. [from http://daringfireball.net/projects/markdown/] > Markdown is a text-to-HTML filter; it translates an easy-to-read / > ea...
Python
from markdown2 import * from gluon.html import XML def WIKI(text, encoding="utf8", safe_mode='escape', html4tags=False, **attributes): if not text: test = '' if attributes.has_key('extras'): extras = attributes['extras'] del attributes['extras'] else: extras=None text = ...
Python
# -*- coding: utf-8 -*- # PyPyODBC is develped from RealPyODBC 0.1 beta released in 2004 by Michele Petrazzo. Thanks Michele. # The MIT License (MIT) # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated # documentation files (the "Software"), to deal in the ...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for zh (Chinese) nplurals=1 # Chinese language has ONE form! # Always returns 0: get_plural_id = lambda n: 0 # Construct and return plural form of *word* using # *plural_id* (which ALWAYS>0). This function will be executed # for words (or phrases) not foun...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for it (Italian) nplurals=2 # Italian language has 2 forms: # 1 singular and 1 plural # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_plural_id = lambda n...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for es (Spanish) nplurals=2 # Spanish language has 2 forms: # 1 singular and 1 plural # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_plural_id = lambda n...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for ja (Japanese) nplurals=1 # Japanese language has ONE form! # Always returns 0: get_plural_id = lambda n: 0 # Construct and return plural form of *word* using # *plural_id* (which ALWAYS>0). This function will be executed # for words (or phrases) not fo...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for cs (Czech) nplurals=3 # Czech language has 3 forms: # 1 singular and 2 plurals # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_plural_id = lambda n: (...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for id (Malay) nplurals=2 # Malay language has 2 forms: # 1 singular and 1 plural # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_plural_id = lambda n: in...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for af (Afrikaans (South Africa)) nplurals=2 # Afrikaans language has 2 forms: # 1 singular and 1 plural # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_p...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for sk (Slovak (Slovakia)) nplurals=3 # Slovak language has 3 forms: # 1 singular and 2 plurals # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_plural_id = ...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for uk (Ukrainian) nplurals=3 # Ukrainian language has 3 forms: # 1 singular and 2 plurals # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_plural_id = lambd...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for pl (Polish) nplurals=3 # Polish language has 3 forms: # 1 singular and 2 plurals # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_plural_id = lambda n: (...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for ru (Russian) nplurals=3 # Russian language has 3 forms: # 1 singular and 2 plurals # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_plural_id = lambda n:...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for de (Deutsch) nplurals=2 # German language has 2 forms: # 1 singular and 1 plural # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_plural_id = lambda n:...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for bg (Bulgarian) nplurals=2 # Bulgarian language has 2 forms: # 1 singular and 1 plural # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_plural_id = lamb...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for pt (Portuguese) nplurals=2 # Portuguese has 2 forms: # 1 singular and 1 plural # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_plural_id = lambda n: i...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for en (English) nplurals=2 # English language has 2 forms: # 1 singular and 1 plural # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_plural_id = lambda n...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for sl (Slovenian) nplurals=4 # Slovenian language has 4 forms: # 1 singular and 3 plurals # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_plural_id = lambd...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for he (Hindi) nplurals=2 # Hindi has 2 forms: # 1 singular and 1 plural # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_plural_id = lambda n: int(n != 1)...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for hu (Hungarian) nplurals=2 # Hungarian language has 2 forms: # 1 singular and 1 plural # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_plural_id = lamb...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for he (Hebrew) nplurals=2 # Hebrew language has 2 forms: # 1 singular and 1 plural # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_plural_id = lambda n: ...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for fr (French)) nplurals=2 # French language has 2 forms: # 1 singular and 1 plural # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_plural_id = lambda n:...
Python
#!/usr/bin/env python # -*- coding: utf8 -*- # Plural-Forms for ro (Romanian) nplurals=2 # Romanian has 2 forms: # 1 singular and 1 plural # Determine plural_id for number *n* as sequence of positive # integers: 0,1,... # NOTE! For singular form ALWAYS return plural_id = 0 get_plural_id = lambda n: int(n...
Python