• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(5710)  |  Call(4263)  |  Derive(82)  |  Import(1365)
date(year, month, day) --> date object

src/d/j/django-roa-1.6/examples/django_roa_client/tests.py   django-roa(Download)
application into your own project, otherwise it will fail. Django do not 
handle very well projects inside projects.
"""
from datetime import time, date, datetime
from decimal import Decimal
 
from django.test import TestCase
    def test_date_field(self):
        page = RemotePageWithManyFields.objects.create(date_field=date(2008, 12, 24))
        self.assertEqual(repr(page.date_field), 'datetime.date(2008, 12, 24)')
        page = RemotePageWithManyFields.objects.get(id=page.id)
        self.assertEqual(repr(page.date_field), 'datetime.date(2008, 12, 24)')
        page.date_field = date(2008, 12, 25)
        page.save()

src/n/o/notmm-0.4.1/examples/lib/tax/modules/us_sst/management/commands/sst_import_rate.py   notmm(Download)
from django.core.management.base import BaseCommand
import os
from datetime import date
from tax.modules.us_sst.models import TaxRate
from decimal import Decimal
 
class Command(BaseCommand):
            (state, type, code, rate_intra, rate_inter, food_intra, food_inter,
             start, end) = line.split(',')
            state = int(state)
            start = date(int(start[0:4]), int(start[4:6]), int(start[6:9]))
            end = date(int(end[0:4]), int(end[4:6]), int(end[6:9]))
            try:
                tr = TaxRate.objects.get(

src/n/o/notmm-0.4.1/examples/lib/tax/modules/us_sst/management/commands/sst_import_boundry.py   notmm(Download)
from django.core.management.base import BaseCommand
import os
from datetime import date
 
# We don't actually need it, but otherwise livesettings chokes.
import tax.config
 
                del(d[v])
 
            d['recordType'] = d['recordType'].upper()
            d['startDate'] = date(int(d['startDate'][0:4]), int(d['startDate'][4:6]), int(d['startDate'][6:9]))
            d['endDate'] = date(int(d['endDate'][0:4]), int(d['endDate'][4:6]), int(d['endDate'][6:9]))
 
            # Empty strings are nulls.

src/p/y/pyoptionquote-HEAD/example.py   pyoptionquote(Download)
#!/usr/bin/env python
 
from datetime import datetime
from datetime import date
 
from pyoptionquote import CachedOptionQuote
 
data = optionquote.get_options('C')
 
# get jan-11 options with strike > 5
exp = date(2011, 1, 1)
data = optionquote.get_options('C', expirations=[exp], strike=lambda x:x<5)
print 'C jan-11 options with strike < 5'
for option in data:

src/l/u/lupyne-0.6/examples/numeric.py   lupyne(Download)
See the state:city field in the searching example.
"""
 
from datetime import date, datetime
import lucene
lucene.initVM(lucene.CLASSPATH)
from lupyne import engine
for doc in docs:
    point = doc.pop('longitude'), doc.pop('latitude')
    incorporated = map(int, doc.pop('incorporated').split('-'))
    indexer.add(doc, incorporated=date(*incorporated), point=[point])
indexer.commit()
 
query = indexer.fields['incorporated'].prefix([1850])
assert query.max.doubleValue() - query.min.doubleValue() == 60 * 60 * 24 * 365
assert [hit['city'] for hit in indexer.search(query)] == ['San Francisco', 'Los Angeles']
query = indexer.fields['incorporated'].range(date(1850, 4, 10), None)

src/z/i/zif-HEAD/zif.sedna/trunk/src/zif/sedna/persistence/tests/example1.py   zif(Download)
   </attr>
</PyObject>"""
 
from datetime import date
 
class Automobile(object):
    pass
    a.prev_owners = ("Jane Smith",('John Doe','Betty Doe'),'Charles Ng')
    a.repairs = []
    swindle = Swindle()
    swindle.date = date(1999,7,1)
    swindle.swindler = "Ed's Auto"
    swindle.purport = "Fix A/C"
    a.repairs.append("June 1, 1999: Fixed radiator")

src/y/d/ydbf-HEAD/doc/examples/gendbf.py   ydbf(Download)
import ydbf
from decimal import Decimal
from random import randint, choice
from datetime import date
 
def get_n_random(size, dec):
    assert size < 20, "number cannot be longer than 20 digits (got %s)" % size
def get_d_random(size, dec):
    try:
        return date(randint(1899, 2030), randint(1,12), randint(1,31))
    except ValueError:
        return get_d_random(size, dec)
 
def get_c_random(size, dec, force_ascii=False):

src/y/d/YDbf-0.3rc1/doc/examples/gendbf.py   YDbf(Download)
import ydbf
from decimal import Decimal
from random import randint, choice
from datetime import date
 
def get_n_random(size, dec):
    assert size < 20, "number cannot be longer than 20 digits (got %s)" % size
def get_d_random(size, dec):
    try:
        return date(randint(1899, 2030), randint(1,12), randint(1,31))
    except ValueError:
        return get_d_random(size, dec)
 
def get_c_random(size, dec, force_ascii=False):

src/p/y/python-stdnet-HEAD/stdnet/tests/examples/models.py   python-stdnet(Download)
import time
from datetime import datetime, date
 
from stdnet import orm
 
class SimpleModel(orm.StdModel):
    code = orm.SymbolField(unique = True)

src/p/y/pyaeso-0.5/examples/marginal_prices.py   pyaeso(Download)
# Standard library imports
import sys
from StringIO import StringIO
from datetime import date
from datetime import timedelta
 
# 3rd Party Libraries

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next