class CalendarType
An enumeration class that defines calendar type constants as specified in Microsoft SharePoint protocols [MS-WSSFO2] and [MS-WSSFO3].
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/webs/calendar_type.py
1 - 8
simple
Purpose
CalendarType serves as a constant enumeration class for representing different calendar types in Microsoft SharePoint-related operations. It provides standardized integer values for calendar type identification, primarily supporting None (unspecified) and Gregorian calendar types. This class is used for interoperability with SharePoint services and document formats that require calendar type specification.
Source Code
class CalendarType:
"""As specified in [MS-WSSFO2] section 2.2.3.3 or [MS-WSSFO3] section 2.2.1.2.3."""
None_ = 0
"""Specifies that the calendar type is not specified."""
Gregorian = 1
"""Specifies a Gregorian (localized) calendar type."""
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
- | - |
Parameter Details
bases: The base classes from which CalendarType inherits. In this case, it implicitly inherits from 'object' (Python's default base class). No explicit parameters are required for instantiation.
Return Value
Instantiating CalendarType returns a CalendarType object instance. However, this class is designed to be used as a namespace for constants rather than being instantiated. The class attributes (None_ and Gregorian) return integer values (0 and 1 respectively) when accessed.
Class Interface
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
None_ |
int | Specifies that the calendar type is not specified. Value is 0. Uses underscore suffix to avoid conflict with Python's None keyword. | class |
Gregorian |
int | Specifies a Gregorian (localized) calendar type. Value is 1. This is the standard calendar system used in most of the world. | class |
Usage Example
# Access calendar type constants
calendar_type = CalendarType.Gregorian
print(calendar_type) # Output: 1
# Check if calendar type is not specified
if calendar_type == CalendarType.None_:
print("Calendar type not specified")
else:
print("Calendar type is specified")
# Use in conditional logic
def process_calendar(cal_type):
if cal_type == CalendarType.Gregorian:
return "Processing Gregorian calendar"
elif cal_type == CalendarType.None_:
return "No calendar type specified"
else:
return "Unknown calendar type"
result = process_calendar(CalendarType.Gregorian)
print(result) # Output: Processing Gregorian calendar
Best Practices
- This class should not be instantiated; use it as a namespace for accessing calendar type constants directly via class attributes (e.g., CalendarType.Gregorian).
- Always use the named constants (CalendarType.None_, CalendarType.Gregorian) rather than hardcoding integer values (0, 1) for better code readability and maintainability.
- Note that 'None_' uses an underscore suffix to avoid conflict with Python's built-in None keyword.
- This class follows the constant enumeration pattern common in Microsoft protocol implementations and should be treated as immutable.
- When extending this class or adding new calendar types, maintain the integer value pattern and follow Microsoft SharePoint protocol specifications.
- Consider using Python's enum.IntEnum for more robust enumeration behavior if modifying this code for production use.
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class PageType 75.1% similar
-
class SiteType 66.2% similar
-
class ViewType 65.9% similar
-
class TemplateFileType 65.2% similar
-
class FileSystemObjectType 64.9% similar