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

All Samples(36)  |  Call(0)  |  Derive(0)  |  Import(36)
int(x[, base]) -> integer

Convert a string or number to an integer, if possible.  A floating point
argument will be truncated towards zero (this does not include a string
representation of a floating point number!)  When converting a string, use
the optional base.  It is an error to supply a base when converting a
non-string.  If base is zero, the proper base is guessed based on the
string content.  If the argument is outside the integer range a
long object will be returned instead.

src/m/i/MidgardPyMVC-HEAD/midgardmvc/lib/utils/fixed_datetime.py   MidgardPyMVC(Download)
        dtout = fmt % tuple(args)        
        return dtout + tzout
 
from datetime import date, timedelta, time, tzinfo, MAXYEAR, MINYEAR
 

src/z/s/zsi-HEAD/ZSI/TCtimes.py   zsi(Download)
from ZSI.wstools.Namespaces import SCHEMA
import operator, re, time as _time
from time import mktime as _mktime, localtime as _localtime, gmtime as _gmtime
from datetime import tzinfo as _tzinfo, timedelta as _timedelta,\
    datetime as _datetime, MINYEAR, MAXYEAR
from math import modf as _modf
 
    # Fix local copy of time tuple
    ltv = list(_fix_none_fields(tv))
 
    if ltv[0] < MINYEAR + 1 or ltv[0] > MAXYEAR - 1:
        return tv # Unable to fix timestamp
 
    _tz_from = _tz_to_tzinfo(tz_from)
def _fix_none_fields(tv):
    ltv = list(tv)
    if ltv[0] is None: ltv[0] = MINYEAR + 1 # Year is absent
    if ltv[1] is None: ltv[1] = 1 # Month is absent
    if ltv[2] is None: ltv[2] = 1 # Day is absent
    return tuple(ltv)
 

src/p/y/pywebsvcs-HEAD/trunk/zsi/ZSI/TCtimes.py   pywebsvcs(Download)
from ZSI.wstools.Namespaces import SCHEMA
import operator, re, time as _time
from time import mktime as _mktime, localtime as _localtime, gmtime as _gmtime
from datetime import tzinfo as _tzinfo, timedelta as _timedelta,\
    datetime as _datetime, MINYEAR, MAXYEAR
from math import modf as _modf
 
    # Fix local copy of time tuple
    ltv = list(_fix_none_fields(tv))
 
    if ltv[0] < MINYEAR + 1 or ltv[0] > MAXYEAR - 1:
        return tv # Unable to fix timestamp
 
    _tz_from = _tz_to_tzinfo(tz_from)
def _fix_none_fields(tv):
    ltv = list(tv)
    if ltv[0] is None: ltv[0] = MINYEAR + 1 # Year is absent
    if ltv[1] is None: ltv[1] = 1 # Month is absent
    if ltv[2] is None: ltv[2] = 1 # Day is absent
    return tuple(ltv)
 

src/p/y/pywebsvcs-HEAD/zsi/ZSI/TCtimes.py   pywebsvcs(Download)
from ZSI.wstools.Namespaces import SCHEMA
import operator, re, time as _time
from time import mktime as _mktime, localtime as _localtime, gmtime as _gmtime
from datetime import tzinfo as _tzinfo, timedelta as _timedelta,\
    datetime as _datetime, MINYEAR, MAXYEAR
from math import modf as _modf
 
    # Fix local copy of time tuple
    ltv = list(_fix_none_fields(tv))
 
    if ltv[0] < MINYEAR + 1 or ltv[0] > MAXYEAR - 1:
        return tv # Unable to fix timestamp
 
    _tz_from = _tz_to_tzinfo(tz_from)
def _fix_none_fields(tv):
    ltv = list(tv)
    if ltv[0] is None: ltv[0] = MINYEAR + 1 # Year is absent
    if ltv[1] is None: ltv[1] = 1 # Month is absent
    if ltv[2] is None: ltv[2] = 1 # Day is absent
    return tuple(ltv)
 

src/i/r/ironruby-HEAD/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/test/test_datetime.py   ironruby(Download)
 
from test import test_support
 
from datetime import MINYEAR, MAXYEAR
from datetime import timedelta
from datetime import tzinfo
from datetime import time
 
        # Check first and last days of year spottily across the whole
        # range of years supported.
        for year in xrange(MINYEAR, MAXYEAR+1, 7):
            # Verify (year, 1, 1) -> ordinal -> y, m, d is identity.
            d = self.theclass(year, 1, 1)
            n = d.toordinal()
    def test_bad_constructor_arguments(self):
        # bad years
        self.theclass(MINYEAR, 1, 1)  # no exception
        self.theclass(MAXYEAR, 1, 1)  # no exception
        self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1)
        self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1)
        # bad months
    def test_bad_constructor_arguments(self):
        # bad years
        self.theclass(MINYEAR, 1, 1)  # no exception
        self.theclass(MAXYEAR, 1, 1)  # no exception
        self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1)
        self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1)
        # bad months
        # for a datetime object.  Ensure that a correct timetuple is
        # created anyway.
        if not test_support.due_to_ironpython_bug("http://tkbgitvstfat01:8080/WorkItemTracking/WorkItem.aspx?artifactMoniker=305776"):
            tiny = cls(MINYEAR, 1, 1, 0, 0, 37, tzinfo=UOFS(1439))
            # That goes back 1 minute less than a full day.
            t = tiny.utctimetuple()
            self.assertEqual(t.tm_year, MINYEAR-1)

src/i/r/ironruby-HEAD/External.LCA_RESTRICTED/Languages/CPython/27/Lib/test/test_datetime.py   ironruby(Download)
 
from test import test_support
 
from datetime import MINYEAR, MAXYEAR
from datetime import timedelta
from datetime import tzinfo
from datetime import time
 
        # Check first and last days of year spottily across the whole
        # range of years supported.
        for year in xrange(MINYEAR, MAXYEAR+1, 7):
            # Verify (year, 1, 1) -> ordinal -> y, m, d is identity.
            d = self.theclass(year, 1, 1)
            n = d.toordinal()
    def test_bad_constructor_arguments(self):
        # bad years
        self.theclass(MINYEAR, 1, 1)  # no exception
        self.theclass(MAXYEAR, 1, 1)  # no exception
        self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1)
        self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1)
        # bad months
    def test_bad_constructor_arguments(self):
        # bad years
        self.theclass(MINYEAR, 1, 1)  # no exception
        self.theclass(MAXYEAR, 1, 1)  # no exception
        self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1)
        self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1)
        # bad months
        # At the edges, UTC adjustment can normalize into years out-of-range
        # for a datetime object.  Ensure that a correct timetuple is
        # created anyway.
        tiny = cls(MINYEAR, 1, 1, 0, 0, 37, tzinfo=UOFS(1439))
        # That goes back 1 minute less than a full day.
        t = tiny.utctimetuple()
        self.assertEqual(t.tm_year, MINYEAR-1)

src/j/y/jython-HEAD/sandbox/wierzbicki/test27/CPythonLib/test/test_datetime.py   jython(Download)
 
from test import test_support
 
from datetime import MINYEAR, MAXYEAR
from datetime import timedelta
from datetime import tzinfo
from datetime import time
 
        # Check first and last days of year spottily across the whole
        # range of years supported.
        for year in xrange(MINYEAR, MAXYEAR+1, 7):
            # Verify (year, 1, 1) -> ordinal -> y, m, d is identity.
            d = self.theclass(year, 1, 1)
            n = d.toordinal()
    def test_bad_constructor_arguments(self):
        # bad years
        self.theclass(MINYEAR, 1, 1)  # no exception
        self.theclass(MAXYEAR, 1, 1)  # no exception
        self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1)
        self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1)
        # bad months
    def test_bad_constructor_arguments(self):
        # bad years
        self.theclass(MINYEAR, 1, 1)  # no exception
        self.theclass(MAXYEAR, 1, 1)  # no exception
        self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1)
        self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1)
        # bad months
        # At the edges, UTC adjustment can normalize into years out-of-range
        # for a datetime object.  Ensure that a correct timetuple is
        # created anyway.
        tiny = cls(MINYEAR, 1, 1, 0, 0, 37, tzinfo=UOFS(1439))
        # That goes back 1 minute less than a full day.
        t = tiny.utctimetuple()
        self.assertEqual(t.tm_year, MINYEAR-1)

src/j/y/jython-HEAD/sandbox/tobias/jython/CPythonLib/test/test_datetime.py   jython(Download)
 
from test import test_support
 
from datetime import MINYEAR, MAXYEAR
from datetime import timedelta
from datetime import tzinfo
from datetime import time
 
        # Check first and last days of year spottily across the whole
        # range of years supported.
        for year in xrange(MINYEAR, MAXYEAR+1, 7):
            # Verify (year, 1, 1) -> ordinal -> y, m, d is identity.
            d = self.theclass(year, 1, 1)
            n = d.toordinal()
    def test_bad_constructor_arguments(self):
        # bad years
        self.theclass(MINYEAR, 1, 1)  # no exception
        self.theclass(MAXYEAR, 1, 1)  # no exception
        self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1)
        self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1)
        # bad months
    def test_bad_constructor_arguments(self):
        # bad years
        self.theclass(MINYEAR, 1, 1)  # no exception
        self.theclass(MAXYEAR, 1, 1)  # no exception
        self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1)
        self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1)
        # bad months
        # At the edges, UTC adjustment can normalize into years out-of-range
        # for a datetime object.  Ensure that a correct timetuple is
        # created anyway.
        tiny = cls(MINYEAR, 1, 1, 0, 0, 37, tzinfo=UOFS(1439))
        # That goes back 1 minute less than a full day.
        t = tiny.utctimetuple()
        self.assertEqual(t.tm_year, MINYEAR-1)

src/j/y/jython-HEAD/jython/CPythonLib/test/test_datetime.py   jython(Download)
 
from test import test_support
 
from datetime import MINYEAR, MAXYEAR
from datetime import timedelta
from datetime import tzinfo
from datetime import time
 
        # Check first and last days of year spottily across the whole
        # range of years supported.
        for year in xrange(MINYEAR, MAXYEAR+1, 7):
            # Verify (year, 1, 1) -> ordinal -> y, m, d is identity.
            d = self.theclass(year, 1, 1)
            n = d.toordinal()
    def test_bad_constructor_arguments(self):
        # bad years
        self.theclass(MINYEAR, 1, 1)  # no exception
        self.theclass(MAXYEAR, 1, 1)  # no exception
        self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1)
        self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1)
        # bad months
    def test_bad_constructor_arguments(self):
        # bad years
        self.theclass(MINYEAR, 1, 1)  # no exception
        self.theclass(MAXYEAR, 1, 1)  # no exception
        self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1)
        self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1)
        # bad months
        # At the edges, UTC adjustment can normalize into years out-of-range
        # for a datetime object.  Ensure that a correct timetuple is
        # created anyway.
        tiny = cls(MINYEAR, 1, 1, 0, 0, 37, tzinfo=UOFS(1439))
        # That goes back 1 minute less than a full day.
        t = tiny.utctimetuple()
        self.assertEqual(t.tm_year, MINYEAR-1)

src/p/y/pypy3-HEAD/lib-python/3.1.2/test/test_datetime.py   pypy3(Download)
 
from test import support
 
from datetime import MINYEAR, MAXYEAR
from datetime import timedelta
from datetime import tzinfo
from datetime import time
 
        # Check first and last days of year spottily across the whole
        # range of years supported.
        for year in range(MINYEAR, MAXYEAR+1, 7):
            # Verify (year, 1, 1) -> ordinal -> y, m, d is identity.
            d = self.theclass(year, 1, 1)
            n = d.toordinal()
    def test_bad_constructor_arguments(self):
        # bad years
        self.theclass(MINYEAR, 1, 1)  # no exception
        self.theclass(MAXYEAR, 1, 1)  # no exception
        self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1)
        self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1)
        # bad months
    def test_bad_constructor_arguments(self):
        # bad years
        self.theclass(MINYEAR, 1, 1)  # no exception
        self.theclass(MAXYEAR, 1, 1)  # no exception
        self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1)
        self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1)
        # bad months
        # At the edges, UTC adjustment can normalize into years out-of-range
        # for a datetime object.  Ensure that a correct timetuple is
        # created anyway.
        tiny = cls(MINYEAR, 1, 1, 0, 0, 37, tzinfo=UOFS(1439))
        # That goes back 1 minute less than a full day.
        t = tiny.utctimetuple()
        self.assertEqual(t.tm_year, MINYEAR-1)

  1 | 2 | 3 | 4  Next