mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Initial work on half-height RUs
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import datetime
|
||||
import decimal
|
||||
import json
|
||||
from collections import OrderedDict
|
||||
from decimal import Decimal
|
||||
@ -226,6 +227,21 @@ def deepmerge(original, new):
|
||||
return merged
|
||||
|
||||
|
||||
def drange(start, end, step=decimal.Decimal(1)):
|
||||
"""
|
||||
Decimal-compatible implementation of Python's range()
|
||||
"""
|
||||
start, end, step = decimal.Decimal(start), decimal.Decimal(end), decimal.Decimal(step)
|
||||
if start < end:
|
||||
while start < end:
|
||||
yield start
|
||||
start += step
|
||||
else:
|
||||
while start > end:
|
||||
yield start
|
||||
start += step
|
||||
|
||||
|
||||
def to_meters(length, unit):
|
||||
"""
|
||||
Convert the given length to meters.
|
||||
|
Reference in New Issue
Block a user