Python future.builtins.object.tzname() Examples

The following are 30 code examples of future.builtins.object.tzname(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module future.builtins.object , or try the search function .
Example #1
Source File: datetime.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def tzname(self, dt):
        if isinstance(dt, datetime) or dt is None:
            if self._name is None:
                return self._name_from_offset(self._offset)
            return self._name
        raise TypeError("tzname() argument must be a datetime instance"
                        " or None") 
Example #2
Source File: datetime.py    From gimp-plugin-export-layers with GNU General Public License v3.0 5 votes vote down vote up
def tzname(self):
        """Return the timezone name.

        Note that the name is 100% informational -- there's no requirement that
        it mean anything in particular. For example, "GMT", "UTC", "-500",
        "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies.
        """
        if self._tzinfo is None:
            return None
        name = self._tzinfo.tzname(None)
        _check_tzname(name)
        return name 
Example #3
Source File: datetime.py    From blackmamba with MIT License 5 votes vote down vote up
def tzname(self, dt):
        if isinstance(dt, datetime) or dt is None:
            if self._name is None:
                return self._name_from_offset(self._offset)
            return self._name
        raise TypeError("tzname() argument must be a datetime instance"
                        " or None") 
Example #4
Source File: datetime.py    From blackmamba with MIT License 5 votes vote down vote up
def __str__(self):
        return self.tzname(None) 
Example #5
Source File: datetime.py    From blackmamba with MIT License 5 votes vote down vote up
def tzname(self):
        """Return the timezone name.

        Note that the name is 100% informational -- there's no requirement that
        it mean anything in particular. For example, "GMT", "UTC", "-500",
        "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies.
        """
        if self._tzinfo is None:
            return None
        name = self._tzinfo.tzname(None)
        _check_tzname(name)
        return name 
Example #6
Source File: datetime.py    From gimp-plugin-export-layers with GNU General Public License v3.0 5 votes vote down vote up
def _check_tzname(name):
    if name is not None and not isinstance(name, str):
        raise TypeError("tzinfo.tzname() must return None or string, "
                        "not '%s'" % type(name))

# name is the offset-producing method, "utcoffset" or "dst".
# offset is what it returned.
# If offset isn't None or timedelta, raises TypeError.
# If offset is None, returns None.
# Else offset is checked for being in range, and a whole # of minutes.
# If it is, its integer value is returned.  Else ValueError is raised. 
Example #7
Source File: datetime.py    From arissploit with GNU General Public License v3.0 5 votes vote down vote up
def _check_tzname(name):
    if name is not None and not isinstance(name, str):
        raise TypeError("tzinfo.tzname() must return None or string, "
                        "not '%s'" % type(name))

# name is the offset-producing method, "utcoffset" or "dst".
# offset is what it returned.
# If offset isn't None or timedelta, raises TypeError.
# If offset is None, returns None.
# Else offset is checked for being in range, and a whole # of minutes.
# If it is, its integer value is returned.  Else ValueError is raised. 
Example #8
Source File: datetime.py    From arissploit with GNU General Public License v3.0 5 votes vote down vote up
def tzname(self, dt):
        "datetime -> string name of time zone."
        raise NotImplementedError("tzinfo subclass must override tzname()") 
Example #9
Source File: datetime.py    From arissploit with GNU General Public License v3.0 5 votes vote down vote up
def tzname(self):
        """Return the timezone name.

        Note that the name is 100% informational -- there's no requirement that
        it mean anything in particular. For example, "GMT", "UTC", "-500",
        "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies.
        """
        if self._tzinfo is None:
            return None
        name = self._tzinfo.tzname(None)
        _check_tzname(name)
        return name 
Example #10
Source File: datetime.py    From arissploit with GNU General Public License v3.0 5 votes vote down vote up
def __str__(self):
        return self.tzname(None) 
Example #11
Source File: datetime.py    From arissploit with GNU General Public License v3.0 5 votes vote down vote up
def tzname(self, dt):
        if isinstance(dt, datetime) or dt is None:
            if self._name is None:
                return self._name_from_offset(self._offset)
            return self._name
        raise TypeError("tzname() argument must be a datetime instance"
                        " or None") 
Example #12
Source File: datetime.py    From Tautulli with GNU General Public License v3.0 5 votes vote down vote up
def _check_tzname(name):
    if name is not None and not isinstance(name, str):
        raise TypeError("tzinfo.tzname() must return None or string, "
                        "not '%s'" % type(name))

# name is the offset-producing method, "utcoffset" or "dst".
# offset is what it returned.
# If offset isn't None or timedelta, raises TypeError.
# If offset is None, returns None.
# Else offset is checked for being in range, and a whole # of minutes.
# If it is, its integer value is returned.  Else ValueError is raised. 
Example #13
Source File: datetime.py    From Tautulli with GNU General Public License v3.0 5 votes vote down vote up
def tzname(self, dt):
        "datetime -> string name of time zone."
        raise NotImplementedError("tzinfo subclass must override tzname()") 
Example #14
Source File: datetime.py    From gimp-plugin-export-layers with GNU General Public License v3.0 5 votes vote down vote up
def tzname(self, dt):
        if isinstance(dt, datetime) or dt is None:
            if self._name is None:
                return self._name_from_offset(self._offset)
            return self._name
        raise TypeError("tzname() argument must be a datetime instance"
                        " or None") 
Example #15
Source File: datetime.py    From blackmamba with MIT License 5 votes vote down vote up
def _check_tzname(name):
    if name is not None and not isinstance(name, str):
        raise TypeError("tzinfo.tzname() must return None or string, "
                        "not '%s'" % type(name))

# name is the offset-producing method, "utcoffset" or "dst".
# offset is what it returned.
# If offset isn't None or timedelta, raises TypeError.
# If offset is None, returns None.
# Else offset is checked for being in range, and a whole # of minutes.
# If it is, its integer value is returned.  Else ValueError is raised. 
Example #16
Source File: datetime.py    From blackmamba with MIT License 5 votes vote down vote up
def tzname(self, dt):
        "datetime -> string name of time zone."
        raise NotImplementedError("tzinfo subclass must override tzname()") 
Example #17
Source File: datetime.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def __str__(self):
        return self.tzname(None) 
Example #18
Source File: datetime.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def tzname(self):
        """Return the timezone name.

        Note that the name is 100% informational -- there's no requirement that
        it mean anything in particular. For example, "GMT", "UTC", "-500",
        "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies.
        """
        if self._tzinfo is None:
            return None
        name = self._tzinfo.tzname(None)
        _check_tzname(name)
        return name 
Example #19
Source File: datetime.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def tzname(self, dt):
        "datetime -> string name of time zone."
        raise NotImplementedError("tzinfo subclass must override tzname()") 
Example #20
Source File: datetime.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def _check_tzname(name):
    if name is not None and not isinstance(name, str):
        raise TypeError("tzinfo.tzname() must return None or string, "
                        "not '%s'" % type(name))

# name is the offset-producing method, "utcoffset" or "dst".
# offset is what it returned.
# If offset isn't None or timedelta, raises TypeError.
# If offset is None, returns None.
# Else offset is checked for being in range, and a whole # of minutes.
# If it is, its integer value is returned.  Else ValueError is raised. 
Example #21
Source File: datetime.py    From cadquery-freecad-module with GNU Lesser General Public License v3.0 5 votes vote down vote up
def tzname(self, dt):
        if isinstance(dt, datetime) or dt is None:
            if self._name is None:
                return self._name_from_offset(self._offset)
            return self._name
        raise TypeError("tzname() argument must be a datetime instance"
                        " or None") 
Example #22
Source File: datetime.py    From cadquery-freecad-module with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __str__(self):
        return self.tzname(None) 
Example #23
Source File: datetime.py    From cadquery-freecad-module with GNU Lesser General Public License v3.0 5 votes vote down vote up
def tzname(self):
        """Return the timezone name.

        Note that the name is 100% informational -- there's no requirement that
        it mean anything in particular. For example, "GMT", "UTC", "-500",
        "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies.
        """
        if self._tzinfo is None:
            return None
        name = self._tzinfo.tzname(None)
        _check_tzname(name)
        return name 
Example #24
Source File: datetime.py    From cadquery-freecad-module with GNU Lesser General Public License v3.0 5 votes vote down vote up
def tzname(self, dt):
        "datetime -> string name of time zone."
        raise NotImplementedError("tzinfo subclass must override tzname()") 
Example #25
Source File: datetime.py    From cadquery-freecad-module with GNU Lesser General Public License v3.0 5 votes vote down vote up
def _check_tzname(name):
    if name is not None and not isinstance(name, str):
        raise TypeError("tzinfo.tzname() must return None or string, "
                        "not '%s'" % type(name))

# name is the offset-producing method, "utcoffset" or "dst".
# offset is what it returned.
# If offset isn't None or timedelta, raises TypeError.
# If offset is None, returns None.
# Else offset is checked for being in range, and a whole # of minutes.
# If it is, its integer value is returned.  Else ValueError is raised. 
Example #26
Source File: datetime.py    From telegram-robot-rss with Mozilla Public License 2.0 5 votes vote down vote up
def tzname(self, dt):
        if isinstance(dt, datetime) or dt is None:
            if self._name is None:
                return self._name_from_offset(self._offset)
            return self._name
        raise TypeError("tzname() argument must be a datetime instance"
                        " or None") 
Example #27
Source File: datetime.py    From telegram-robot-rss with Mozilla Public License 2.0 5 votes vote down vote up
def tzname(self):
        """Return the timezone name.

        Note that the name is 100% informational -- there's no requirement that
        it mean anything in particular. For example, "GMT", "UTC", "-500",
        "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies.
        """
        if self._tzinfo is None:
            return None
        name = self._tzinfo.tzname(None)
        _check_tzname(name)
        return name 
Example #28
Source File: datetime.py    From telegram-robot-rss with Mozilla Public License 2.0 5 votes vote down vote up
def tzname(self, dt):
        "datetime -> string name of time zone."
        raise NotImplementedError("tzinfo subclass must override tzname()") 
Example #29
Source File: datetime.py    From telegram-robot-rss with Mozilla Public License 2.0 5 votes vote down vote up
def _check_tzname(name):
    if name is not None and not isinstance(name, str):
        raise TypeError("tzinfo.tzname() must return None or string, "
                        "not '%s'" % type(name))

# name is the offset-producing method, "utcoffset" or "dst".
# offset is what it returned.
# If offset isn't None or timedelta, raises TypeError.
# If offset is None, returns None.
# Else offset is checked for being in range, and a whole # of minutes.
# If it is, its integer value is returned.  Else ValueError is raised. 
Example #30
Source File: datetime.py    From kgsgo-dataset-preprocessor with Mozilla Public License 2.0 5 votes vote down vote up
def tzname(self, dt):
        if isinstance(dt, datetime) or dt is None:
            if self._name is None:
                return self._name_from_offset(self._offset)
            return self._name
        raise TypeError("tzname() argument must be a datetime instance"
                        " or None")