Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Readme
Time ranges.
timeranges is available on pip:
pip install timeranges
You can also install the latest version of the code directly from GitHub:
pip install git+git://github.com/MicaelJarniac/timeranges
For more examples, see the full documentation.
from datetime import time
from timeranges import TimeRange
# Create a `TimeRange` instance with the interval "0:00 -> 10:00"
time_range = TimeRange(time(0), time(10))
# Check if these times are contained in `time_range`
assert time(0) in time_range
assert time(5) in time_range
assert time(10) in time_range
# Check if these times aren't contained in `time_range`
assert time(10, 0, 1) not in time_range
assert time(11) not in time_range
assert time(20) not in time_range
from datetime import time
from timeranges import TimeRange, TimeRanges
# Create some `TimeRange` instances
time_range_1 = TimeRange(time(0), time(10))
time_range_2 = TimeRange(time(15), time(20))
# Create a `TimeRanges` instance containing multiple `TimeRange`
time_ranges = TimeRanges([time_range, time_range_2])
assert time(0) in time_ranges
assert time(5) in time_ranges
assert time(10) in time_ranges
assert time(12) not in time_ranges
assert time(15) in time_ranges
assert time(17) in time_ranges
assert time(20) in time_ranges
assert time(22) not in time_ranges
from datetime import time, datetime
from timematic.enums import Weekday
from timeranges import TimeRange, TimeRanges, WeekRange
week_range = WeekRange(
{
Weekday.MONDAY: TimeRanges(
[
TimeRange(time(5), time(10)),
TimeRange(time(12), time(14)),
]
),
Weekday.SATURDAY: TimeRanges(
[
TimeRange(time(0), time(2)),
TimeRange(time(4), time(8)),
]
),
}
)
assert datetime(2021, 12, 6, 5, 0, 0) in week_range
assert datetime(2021, 12, 6, 8, 0, 0) in week_range
assert datetime(2021, 12, 6, 10, 0, 0) in week_range
assert datetime(2021, 12, 6, 11, 0, 0) not in week_range
assert datetime(2021, 12, 7, 5, 0, 0) not in week_range
assert datetime(2021, 12, 13, 5, 0, 0) in week_range
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
More details can be found in CONTRIBUTING.
Micael Jarniac 🐛 💻 📖 💡 🤔 🚧 📆 👀 🔧 ⚠️ |
Created from cookiecutter-python-project.
FAQs
Time ranges.
We found that timeranges demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.