-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
31 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
from collections import namedtuple | ||
|
||
try: | ||
from shutil import which | ||
except ImportError: | ||
def which(name): | ||
if os.path.exists("/usr/local/bin/" + name): | ||
return "/usr/local/bin/" + name | ||
elif os.path.exists("/usr/bin/" + name): | ||
return "/usr/bin/" + name | ||
|
||
class ARN(namedtuple("ARN", "partition service region account resource")): | ||
def __str__(self): | ||
return ":".join(["arn"] + list(self)) | ||
|
||
|
||
ARN.__new__.__defaults__ = ("aws", "", "", "", "") | ||
|
||
def from_bytes(data, big_endian=False): | ||
"""Used on Python 2 to handle int.from_bytes""" | ||
if isinstance(data, str): | ||
data = bytearray(data) | ||
if big_endian: | ||
data = reversed(data) | ||
num = 0 | ||
for offset, byte in enumerate(data): | ||
num += byte << (offset * 8) | ||
return num |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.0.0" | ||
__version__ = '1.0.9' |