repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
getsentry/semaphore
py/semaphore/utils.py
decode_str
def decode_str(s, free=False): """Decodes a SymbolicStr""" try: if s.len == 0: return u"" return ffi.unpack(s.data, s.len).decode("utf-8", "replace") finally: if free: lib.semaphore_str_free(ffi.addressof(s))
python
def decode_str(s, free=False): """Decodes a SymbolicStr""" try: if s.len == 0: return u"" return ffi.unpack(s.data, s.len).decode("utf-8", "replace") finally: if free: lib.semaphore_str_free(ffi.addressof(s))
[ "def", "decode_str", "(", "s", ",", "free", "=", "False", ")", ":", "try", ":", "if", "s", ".", "len", "==", "0", ":", "return", "u\"\"", "return", "ffi", ".", "unpack", "(", "s", ".", "data", ",", "s", ".", "len", ")", ".", "decode", "(", "\...
Decodes a SymbolicStr
[ "Decodes", "a", "SymbolicStr" ]
6f260b4092261e893b4debd9a3a7a78232f46c5e
https://github.com/getsentry/semaphore/blob/6f260b4092261e893b4debd9a3a7a78232f46c5e/py/semaphore/utils.py#L69-L77
train
getsentry/semaphore
py/semaphore/utils.py
encode_str
def encode_str(s, mutable=False): """Encodes a SemaphoreStr""" rv = ffi.new("SemaphoreStr *") if isinstance(s, text_type): s = s.encode("utf-8") if mutable: s = bytearray(s) rv.data = ffi.from_buffer(s) rv.len = len(s) # we have to hold a weak reference here to ensure our str...
python
def encode_str(s, mutable=False): """Encodes a SemaphoreStr""" rv = ffi.new("SemaphoreStr *") if isinstance(s, text_type): s = s.encode("utf-8") if mutable: s = bytearray(s) rv.data = ffi.from_buffer(s) rv.len = len(s) # we have to hold a weak reference here to ensure our str...
[ "def", "encode_str", "(", "s", ",", "mutable", "=", "False", ")", ":", "rv", "=", "ffi", ".", "new", "(", "\"SemaphoreStr *\"", ")", "if", "isinstance", "(", "s", ",", "text_type", ")", ":", "s", "=", "s", ".", "encode", "(", "\"utf-8\"", ")", "if"...
Encodes a SemaphoreStr
[ "Encodes", "a", "SemaphoreStr" ]
6f260b4092261e893b4debd9a3a7a78232f46c5e
https://github.com/getsentry/semaphore/blob/6f260b4092261e893b4debd9a3a7a78232f46c5e/py/semaphore/utils.py#L80-L92
train
getsentry/semaphore
py/semaphore/utils.py
decode_uuid
def decode_uuid(value): """Decodes the given uuid value.""" return uuid.UUID(bytes=bytes(bytearray(ffi.unpack(value.data, 16))))
python
def decode_uuid(value): """Decodes the given uuid value.""" return uuid.UUID(bytes=bytes(bytearray(ffi.unpack(value.data, 16))))
[ "def", "decode_uuid", "(", "value", ")", ":", "return", "uuid", ".", "UUID", "(", "bytes", "=", "bytes", "(", "bytearray", "(", "ffi", ".", "unpack", "(", "value", ".", "data", ",", "16", ")", ")", ")", ")" ]
Decodes the given uuid value.
[ "Decodes", "the", "given", "uuid", "value", "." ]
6f260b4092261e893b4debd9a3a7a78232f46c5e
https://github.com/getsentry/semaphore/blob/6f260b4092261e893b4debd9a3a7a78232f46c5e/py/semaphore/utils.py#L104-L106
train
getsentry/semaphore
scripts/git-precommit-hook.py
has_cargo_fmt
def has_cargo_fmt(): """Runs a quick check to see if cargo fmt is installed.""" try: c = subprocess.Popen( ["cargo", "fmt", "--", "--help"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) return c.wait() == 0 except OSError: return False
python
def has_cargo_fmt(): """Runs a quick check to see if cargo fmt is installed.""" try: c = subprocess.Popen( ["cargo", "fmt", "--", "--help"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) return c.wait() == 0 except OSError: return False
[ "def", "has_cargo_fmt", "(", ")", ":", "try", ":", "c", "=", "subprocess", ".", "Popen", "(", "[", "\"cargo\"", ",", "\"fmt\"", ",", "\"--\"", ",", "\"--help\"", "]", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".",...
Runs a quick check to see if cargo fmt is installed.
[ "Runs", "a", "quick", "check", "to", "see", "if", "cargo", "fmt", "is", "installed", "." ]
6f260b4092261e893b4debd9a3a7a78232f46c5e
https://github.com/getsentry/semaphore/blob/6f260b4092261e893b4debd9a3a7a78232f46c5e/scripts/git-precommit-hook.py#L8-L18
train
getsentry/semaphore
scripts/git-precommit-hook.py
get_modified_files
def get_modified_files(): """Returns a list of all modified files.""" c = subprocess.Popen( ["git", "diff-index", "--cached", "--name-only", "HEAD"], stdout=subprocess.PIPE ) return c.communicate()[0].splitlines()
python
def get_modified_files(): """Returns a list of all modified files.""" c = subprocess.Popen( ["git", "diff-index", "--cached", "--name-only", "HEAD"], stdout=subprocess.PIPE ) return c.communicate()[0].splitlines()
[ "def", "get_modified_files", "(", ")", ":", "c", "=", "subprocess", ".", "Popen", "(", "[", "\"git\"", ",", "\"diff-index\"", ",", "\"--cached\"", ",", "\"--name-only\"", ",", "\"HEAD\"", "]", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", "return", "...
Returns a list of all modified files.
[ "Returns", "a", "list", "of", "all", "modified", "files", "." ]
6f260b4092261e893b4debd9a3a7a78232f46c5e
https://github.com/getsentry/semaphore/blob/6f260b4092261e893b4debd9a3a7a78232f46c5e/scripts/git-precommit-hook.py#L21-L26
train
RobinNil/file_read_backwards
file_read_backwards/buffer_work_space.py
_get_next_chunk
def _get_next_chunk(fp, previously_read_position, chunk_size): """Return next chunk of data that we would from the file pointer. Args: fp: file-like object previously_read_position: file pointer position that we have read from chunk_size: desired read chunk_size Returns: (b...
python
def _get_next_chunk(fp, previously_read_position, chunk_size): """Return next chunk of data that we would from the file pointer. Args: fp: file-like object previously_read_position: file pointer position that we have read from chunk_size: desired read chunk_size Returns: (b...
[ "def", "_get_next_chunk", "(", "fp", ",", "previously_read_position", ",", "chunk_size", ")", ":", "seek_position", ",", "read_size", "=", "_get_what_to_read_next", "(", "fp", ",", "previously_read_position", ",", "chunk_size", ")", "fp", ".", "seek", "(", "seek_p...
Return next chunk of data that we would from the file pointer. Args: fp: file-like object previously_read_position: file pointer position that we have read from chunk_size: desired read chunk_size Returns: (bytestring, int): data that has been read in, the file pointer position...
[ "Return", "next", "chunk", "of", "data", "that", "we", "would", "from", "the", "file", "pointer", "." ]
e56443095b58aae309fbc43a0943eba867dc8500
https://github.com/RobinNil/file_read_backwards/blob/e56443095b58aae309fbc43a0943eba867dc8500/file_read_backwards/buffer_work_space.py#L95-L110
train
RobinNil/file_read_backwards
file_read_backwards/buffer_work_space.py
_get_what_to_read_next
def _get_what_to_read_next(fp, previously_read_position, chunk_size): """Return information on which file pointer position to read from and how many bytes. Args: fp past_read_positon (int): The file pointer position that has been read previously chunk_size(int): ideal io chunk_size ...
python
def _get_what_to_read_next(fp, previously_read_position, chunk_size): """Return information on which file pointer position to read from and how many bytes. Args: fp past_read_positon (int): The file pointer position that has been read previously chunk_size(int): ideal io chunk_size ...
[ "def", "_get_what_to_read_next", "(", "fp", ",", "previously_read_position", ",", "chunk_size", ")", ":", "seek_position", "=", "max", "(", "previously_read_position", "-", "chunk_size", ",", "0", ")", "read_size", "=", "chunk_size", "# examples: say, our new_lines are ...
Return information on which file pointer position to read from and how many bytes. Args: fp past_read_positon (int): The file pointer position that has been read previously chunk_size(int): ideal io chunk_size Returns: (int, int): The next seek position, how many bytes to read ...
[ "Return", "information", "on", "which", "file", "pointer", "position", "to", "read", "from", "and", "how", "many", "bytes", "." ]
e56443095b58aae309fbc43a0943eba867dc8500
https://github.com/RobinNil/file_read_backwards/blob/e56443095b58aae309fbc43a0943eba867dc8500/file_read_backwards/buffer_work_space.py#L113-L143
train
RobinNil/file_read_backwards
file_read_backwards/buffer_work_space.py
_remove_trailing_new_line
def _remove_trailing_new_line(l): """Remove a single instance of new line at the end of l if it exists. Returns: bytestring """ # replace only 1 instance of newline # match longest line first (hence the reverse=True), we want to match "\r\n" rather than "\n" if we can for n in sorted(ne...
python
def _remove_trailing_new_line(l): """Remove a single instance of new line at the end of l if it exists. Returns: bytestring """ # replace only 1 instance of newline # match longest line first (hence the reverse=True), we want to match "\r\n" rather than "\n" if we can for n in sorted(ne...
[ "def", "_remove_trailing_new_line", "(", "l", ")", ":", "# replace only 1 instance of newline", "# match longest line first (hence the reverse=True), we want to match \"\\r\\n\" rather than \"\\n\" if we can", "for", "n", "in", "sorted", "(", "new_lines_bytes", ",", "key", "=", "la...
Remove a single instance of new line at the end of l if it exists. Returns: bytestring
[ "Remove", "a", "single", "instance", "of", "new", "line", "at", "the", "end", "of", "l", "if", "it", "exists", "." ]
e56443095b58aae309fbc43a0943eba867dc8500
https://github.com/RobinNil/file_read_backwards/blob/e56443095b58aae309fbc43a0943eba867dc8500/file_read_backwards/buffer_work_space.py#L146-L158
train
RobinNil/file_read_backwards
file_read_backwards/buffer_work_space.py
_find_furthest_new_line
def _find_furthest_new_line(read_buffer): """Return -1 if read_buffer does not contain new line otherwise the position of the rightmost newline. Args: read_buffer (bytestring) Returns: int: The right most position of new line character in read_buffer if found, else -1 """ new_line_...
python
def _find_furthest_new_line(read_buffer): """Return -1 if read_buffer does not contain new line otherwise the position of the rightmost newline. Args: read_buffer (bytestring) Returns: int: The right most position of new line character in read_buffer if found, else -1 """ new_line_...
[ "def", "_find_furthest_new_line", "(", "read_buffer", ")", ":", "new_line_positions", "=", "[", "read_buffer", ".", "rfind", "(", "n", ")", "for", "n", "in", "new_lines_bytes", "]", "return", "max", "(", "new_line_positions", ")" ]
Return -1 if read_buffer does not contain new line otherwise the position of the rightmost newline. Args: read_buffer (bytestring) Returns: int: The right most position of new line character in read_buffer if found, else -1
[ "Return", "-", "1", "if", "read_buffer", "does", "not", "contain", "new", "line", "otherwise", "the", "position", "of", "the", "rightmost", "newline", "." ]
e56443095b58aae309fbc43a0943eba867dc8500
https://github.com/RobinNil/file_read_backwards/blob/e56443095b58aae309fbc43a0943eba867dc8500/file_read_backwards/buffer_work_space.py#L161-L171
train
RobinNil/file_read_backwards
file_read_backwards/buffer_work_space.py
BufferWorkSpace.add_to_buffer
def add_to_buffer(self, content, read_position): """Add additional bytes content as read from the read_position. Args: content (bytes): data to be added to buffer working BufferWorkSpac. read_position (int): where in the file pointer the data was read from. """ s...
python
def add_to_buffer(self, content, read_position): """Add additional bytes content as read from the read_position. Args: content (bytes): data to be added to buffer working BufferWorkSpac. read_position (int): where in the file pointer the data was read from. """ s...
[ "def", "add_to_buffer", "(", "self", ",", "content", ",", "read_position", ")", ":", "self", ".", "read_position", "=", "read_position", "if", "self", ".", "read_buffer", "is", "None", ":", "self", ".", "read_buffer", "=", "content", "else", ":", "self", "...
Add additional bytes content as read from the read_position. Args: content (bytes): data to be added to buffer working BufferWorkSpac. read_position (int): where in the file pointer the data was read from.
[ "Add", "additional", "bytes", "content", "as", "read", "from", "the", "read_position", "." ]
e56443095b58aae309fbc43a0943eba867dc8500
https://github.com/RobinNil/file_read_backwards/blob/e56443095b58aae309fbc43a0943eba867dc8500/file_read_backwards/buffer_work_space.py#L29-L40
train
RobinNil/file_read_backwards
file_read_backwards/buffer_work_space.py
BufferWorkSpace.yieldable
def yieldable(self): """Return True if there is a line that the buffer can return, False otherwise.""" if self.read_buffer is None: return False t = _remove_trailing_new_line(self.read_buffer) n = _find_furthest_new_line(t) if n >= 0: return True ...
python
def yieldable(self): """Return True if there is a line that the buffer can return, False otherwise.""" if self.read_buffer is None: return False t = _remove_trailing_new_line(self.read_buffer) n = _find_furthest_new_line(t) if n >= 0: return True ...
[ "def", "yieldable", "(", "self", ")", ":", "if", "self", ".", "read_buffer", "is", "None", ":", "return", "False", "t", "=", "_remove_trailing_new_line", "(", "self", ".", "read_buffer", ")", "n", "=", "_find_furthest_new_line", "(", "t", ")", "if", "n", ...
Return True if there is a line that the buffer can return, False otherwise.
[ "Return", "True", "if", "there", "is", "a", "line", "that", "the", "buffer", "can", "return", "False", "otherwise", "." ]
e56443095b58aae309fbc43a0943eba867dc8500
https://github.com/RobinNil/file_read_backwards/blob/e56443095b58aae309fbc43a0943eba867dc8500/file_read_backwards/buffer_work_space.py#L42-L55
train
RobinNil/file_read_backwards
file_read_backwards/buffer_work_space.py
BufferWorkSpace.return_line
def return_line(self): """Return a new line if it is available. Precondition: self.yieldable() must be True """ assert(self.yieldable()) t = _remove_trailing_new_line(self.read_buffer) i = _find_furthest_new_line(t) if i >= 0: l = i + 1 ...
python
def return_line(self): """Return a new line if it is available. Precondition: self.yieldable() must be True """ assert(self.yieldable()) t = _remove_trailing_new_line(self.read_buffer) i = _find_furthest_new_line(t) if i >= 0: l = i + 1 ...
[ "def", "return_line", "(", "self", ")", ":", "assert", "(", "self", ".", "yieldable", "(", ")", ")", "t", "=", "_remove_trailing_new_line", "(", "self", ".", "read_buffer", ")", "i", "=", "_find_furthest_new_line", "(", "t", ")", "if", "i", ">=", "0", ...
Return a new line if it is available. Precondition: self.yieldable() must be True
[ "Return", "a", "new", "line", "if", "it", "is", "available", "." ]
e56443095b58aae309fbc43a0943eba867dc8500
https://github.com/RobinNil/file_read_backwards/blob/e56443095b58aae309fbc43a0943eba867dc8500/file_read_backwards/buffer_work_space.py#L57-L76
train
RobinNil/file_read_backwards
file_read_backwards/buffer_work_space.py
BufferWorkSpace.read_until_yieldable
def read_until_yieldable(self): """Read in additional chunks until it is yieldable.""" while not self.yieldable(): read_content, read_position = _get_next_chunk(self.fp, self.read_position, self.chunk_size) self.add_to_buffer(read_content, read_position)
python
def read_until_yieldable(self): """Read in additional chunks until it is yieldable.""" while not self.yieldable(): read_content, read_position = _get_next_chunk(self.fp, self.read_position, self.chunk_size) self.add_to_buffer(read_content, read_position)
[ "def", "read_until_yieldable", "(", "self", ")", ":", "while", "not", "self", ".", "yieldable", "(", ")", ":", "read_content", ",", "read_position", "=", "_get_next_chunk", "(", "self", ".", "fp", ",", "self", ".", "read_position", ",", "self", ".", "chunk...
Read in additional chunks until it is yieldable.
[ "Read", "in", "additional", "chunks", "until", "it", "is", "yieldable", "." ]
e56443095b58aae309fbc43a0943eba867dc8500
https://github.com/RobinNil/file_read_backwards/blob/e56443095b58aae309fbc43a0943eba867dc8500/file_read_backwards/buffer_work_space.py#L78-L82
train
RobinNil/file_read_backwards
file_read_backwards/file_read_backwards.py
FileReadBackwardsIterator.next
def next(self): """Returns unicode string from the last line until the beginning of file. Gets exhausted if:: * already reached the beginning of the file on previous iteration * the file got closed When it gets exhausted, it closes the file handler. """ ...
python
def next(self): """Returns unicode string from the last line until the beginning of file. Gets exhausted if:: * already reached the beginning of the file on previous iteration * the file got closed When it gets exhausted, it closes the file handler. """ ...
[ "def", "next", "(", "self", ")", ":", "# Using binary mode, because some encodings such as \"utf-8\" use variable number of", "# bytes to encode different Unicode points.", "# Without using binary mode, we would probably need to understand each encoding more", "# and do the seek operations to find...
Returns unicode string from the last line until the beginning of file. Gets exhausted if:: * already reached the beginning of the file on previous iteration * the file got closed When it gets exhausted, it closes the file handler.
[ "Returns", "unicode", "string", "from", "the", "last", "line", "until", "the", "beginning", "of", "file", "." ]
e56443095b58aae309fbc43a0943eba867dc8500
https://github.com/RobinNil/file_read_backwards/blob/e56443095b58aae309fbc43a0943eba867dc8500/file_read_backwards/file_read_backwards.py#L91-L112
train
hendrix/hendrix
examples/django_hx_chatserver/example_app/chat/views.py
home
def home(request, chat_channel_name=None): """ if we have a chat_channel_name kwarg, have the response include that channel name so the javascript knows to subscribe to that channel... """ if not chat_channel_name: chat_channel_name = 'homepage' context = { ...
python
def home(request, chat_channel_name=None): """ if we have a chat_channel_name kwarg, have the response include that channel name so the javascript knows to subscribe to that channel... """ if not chat_channel_name: chat_channel_name = 'homepage' context = { ...
[ "def", "home", "(", "request", ",", "chat_channel_name", "=", "None", ")", ":", "if", "not", "chat_channel_name", ":", "chat_channel_name", "=", "'homepage'", "context", "=", "{", "'address'", ":", "chat_channel_name", ",", "'history'", ":", "[", "]", ",", "...
if we have a chat_channel_name kwarg, have the response include that channel name so the javascript knows to subscribe to that channel...
[ "if", "we", "have", "a", "chat_channel_name", "kwarg", "have", "the", "response", "include", "that", "channel", "name", "so", "the", "javascript", "knows", "to", "subscribe", "to", "that", "channel", "..." ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/examples/django_hx_chatserver/example_app/chat/views.py#L9-L37
train
hendrix/hendrix
hendrix/ux.py
hendrixLauncher
def hendrixLauncher(action, options, with_tiempo=False): """ Decides which version of HendrixDeploy to use and then launches it. """ if options['key'] and options['cert'] and options['cache']: from hendrix.deploy import hybrid HendrixDeploy = hybrid.HendrixDeployHybrid elif optio...
python
def hendrixLauncher(action, options, with_tiempo=False): """ Decides which version of HendrixDeploy to use and then launches it. """ if options['key'] and options['cert'] and options['cache']: from hendrix.deploy import hybrid HendrixDeploy = hybrid.HendrixDeployHybrid elif optio...
[ "def", "hendrixLauncher", "(", "action", ",", "options", ",", "with_tiempo", "=", "False", ")", ":", "if", "options", "[", "'key'", "]", "and", "options", "[", "'cert'", "]", "and", "options", "[", "'cache'", "]", ":", "from", "hendrix", ".", "deploy", ...
Decides which version of HendrixDeploy to use and then launches it.
[ "Decides", "which", "version", "of", "HendrixDeploy", "to", "use", "and", "then", "launches", "it", "." ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/ux.py#L67-L87
train
hendrix/hendrix
hendrix/ux.py
logReload
def logReload(options): """ encompasses all the logic for reloading observer. """ event_handler = Reload(options) observer = Observer() observer.schedule(event_handler, path='.', recursive=True) observer.start() try: while True: time.sleep(1) except KeyboardInterr...
python
def logReload(options): """ encompasses all the logic for reloading observer. """ event_handler = Reload(options) observer = Observer() observer.schedule(event_handler, path='.', recursive=True) observer.start() try: while True: time.sleep(1) except KeyboardInterr...
[ "def", "logReload", "(", "options", ")", ":", "event_handler", "=", "Reload", "(", "options", ")", "observer", "=", "Observer", "(", ")", "observer", ".", "schedule", "(", "event_handler", ",", "path", "=", "'.'", ",", "recursive", "=", "True", ")", "obs...
encompasses all the logic for reloading observer.
[ "encompasses", "all", "the", "logic", "for", "reloading", "observer", "." ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/ux.py#L100-L118
train
hendrix/hendrix
hendrix/ux.py
launch
def launch(*args, **options): """ launch acts on the user specified action and options by executing Hedrix.run """ action = args[0] if options['reload']: logReload(options) else: assignDeploymentInstance(action, options)
python
def launch(*args, **options): """ launch acts on the user specified action and options by executing Hedrix.run """ action = args[0] if options['reload']: logReload(options) else: assignDeploymentInstance(action, options)
[ "def", "launch", "(", "*", "args", ",", "*", "*", "options", ")", ":", "action", "=", "args", "[", "0", "]", "if", "options", "[", "'reload'", "]", ":", "logReload", "(", "options", ")", "else", ":", "assignDeploymentInstance", "(", "action", ",", "o...
launch acts on the user specified action and options by executing Hedrix.run
[ "launch", "acts", "on", "the", "user", "specified", "action", "and", "options", "by", "executing", "Hedrix", ".", "run" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/ux.py#L121-L130
train
hendrix/hendrix
hendrix/ux.py
findSettingsModule
def findSettingsModule(): "Find the settings module dot path within django's manage.py file" try: with open('manage.py', 'r') as manage: manage_contents = manage.read() search = re.search( r"([\"\'](?P<module>[a-z\.]+)[\"\'])", manage_contents ) ...
python
def findSettingsModule(): "Find the settings module dot path within django's manage.py file" try: with open('manage.py', 'r') as manage: manage_contents = manage.read() search = re.search( r"([\"\'](?P<module>[a-z\.]+)[\"\'])", manage_contents ) ...
[ "def", "findSettingsModule", "(", ")", ":", "try", ":", "with", "open", "(", "'manage.py'", ",", "'r'", ")", "as", "manage", ":", "manage_contents", "=", "manage", ".", "read", "(", ")", "search", "=", "re", ".", "search", "(", "r\"([\\\"\\'](?P<module>[a-...
Find the settings module dot path within django's manage.py file
[ "Find", "the", "settings", "module", "dot", "path", "within", "django", "s", "manage", ".", "py", "file" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/ux.py#L133-L165
train
hendrix/hendrix
hendrix/ux.py
subprocessLaunch
def subprocessLaunch(): """ This function is called by the hxw script. It takes no arguments, and returns an instance of HendrixDeploy """ if not redis_available: raise RedisException("can't launch this subprocess without tiempo/redis.") try: action = 'start' options = RE...
python
def subprocessLaunch(): """ This function is called by the hxw script. It takes no arguments, and returns an instance of HendrixDeploy """ if not redis_available: raise RedisException("can't launch this subprocess without tiempo/redis.") try: action = 'start' options = RE...
[ "def", "subprocessLaunch", "(", ")", ":", "if", "not", "redis_available", ":", "raise", "RedisException", "(", "\"can't launch this subprocess without tiempo/redis.\"", ")", "try", ":", "action", "=", "'start'", "options", "=", "REDIS", ".", "get", "(", "'worker_arg...
This function is called by the hxw script. It takes no arguments, and returns an instance of HendrixDeploy
[ "This", "function", "is", "called", "by", "the", "hxw", "script", ".", "It", "takes", "no", "arguments", "and", "returns", "an", "instance", "of", "HendrixDeploy" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/ux.py#L227-L240
train
hendrix/hendrix
hendrix/ux.py
main
def main(args=None): "The function to execute when running hx" if args is None: args = sys.argv[1:] options, args = HendrixOptionParser.parse_args(args) options = vars(options) try: action = args[0] except IndexError: HendrixOptionParser.print_help() return ...
python
def main(args=None): "The function to execute when running hx" if args is None: args = sys.argv[1:] options, args = HendrixOptionParser.parse_args(args) options = vars(options) try: action = args[0] except IndexError: HendrixOptionParser.print_help() return ...
[ "def", "main", "(", "args", "=", "None", ")", ":", "if", "args", "is", "None", ":", "args", "=", "sys", ".", "argv", "[", "1", ":", "]", "options", ",", "args", "=", "HendrixOptionParser", ".", "parse_args", "(", "args", ")", "options", "=", "vars"...
The function to execute when running hx
[ "The", "function", "to", "execute", "when", "running", "hx" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/ux.py#L243-L268
train
hendrix/hendrix
hendrix/contrib/cache/resource.py
CacheClient.handleHeader
def handleHeader(self, key, value): "extends handleHeader to save headers to a local response object" key_lower = key.lower() if key_lower == 'location': value = self.modLocationPort(value) self._response.headers[key_lower] = value if key_lower != 'cache-control': ...
python
def handleHeader(self, key, value): "extends handleHeader to save headers to a local response object" key_lower = key.lower() if key_lower == 'location': value = self.modLocationPort(value) self._response.headers[key_lower] = value if key_lower != 'cache-control': ...
[ "def", "handleHeader", "(", "self", ",", "key", ",", "value", ")", ":", "key_lower", "=", "key", ".", "lower", "(", ")", "if", "key_lower", "==", "'location'", ":", "value", "=", "self", ".", "modLocationPort", "(", "value", ")", "self", ".", "_respons...
extends handleHeader to save headers to a local response object
[ "extends", "handleHeader", "to", "save", "headers", "to", "a", "local", "response", "object" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/resource.py#L38-L49
train
hendrix/hendrix
hendrix/contrib/cache/resource.py
CacheClient.handleStatus
def handleStatus(self, version, code, message): "extends handleStatus to instantiate a local response object" proxy.ProxyClient.handleStatus(self, version, code, message) # client.Response is currently just a container for needed data self._response = client.Response(version, code, messa...
python
def handleStatus(self, version, code, message): "extends handleStatus to instantiate a local response object" proxy.ProxyClient.handleStatus(self, version, code, message) # client.Response is currently just a container for needed data self._response = client.Response(version, code, messa...
[ "def", "handleStatus", "(", "self", ",", "version", ",", "code", ",", "message", ")", ":", "proxy", ".", "ProxyClient", ".", "handleStatus", "(", "self", ",", "version", ",", "code", ",", "message", ")", "# client.Response is currently just a container for needed ...
extends handleStatus to instantiate a local response object
[ "extends", "handleStatus", "to", "instantiate", "a", "local", "response", "object" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/resource.py#L51-L55
train
hendrix/hendrix
hendrix/contrib/cache/resource.py
CacheClient.modLocationPort
def modLocationPort(self, location): """ Ensures that the location port is a the given port value Used in `handleHeader` """ components = urlparse.urlparse(location) reverse_proxy_port = self.father.getHost().port reverse_proxy_host = self.father.getHost().host ...
python
def modLocationPort(self, location): """ Ensures that the location port is a the given port value Used in `handleHeader` """ components = urlparse.urlparse(location) reverse_proxy_port = self.father.getHost().port reverse_proxy_host = self.father.getHost().host ...
[ "def", "modLocationPort", "(", "self", ",", "location", ")", ":", "components", "=", "urlparse", ".", "urlparse", "(", "location", ")", "reverse_proxy_port", "=", "self", ".", "father", ".", "getHost", "(", ")", ".", "port", "reverse_proxy_host", "=", "self"...
Ensures that the location port is a the given port value Used in `handleHeader`
[ "Ensures", "that", "the", "location", "port", "is", "a", "the", "given", "port", "value", "Used", "in", "handleHeader" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/resource.py#L57-L70
train
hendrix/hendrix
hendrix/contrib/cache/resource.py
CacheClient.handleResponsePart
def handleResponsePart(self, buffer): """ Sends the content to the browser and keeps a local copy of it. buffer is just a str of the content to be shown, father is the intial request. """ self.father.write(buffer) self.buffer.write(buffer)
python
def handleResponsePart(self, buffer): """ Sends the content to the browser and keeps a local copy of it. buffer is just a str of the content to be shown, father is the intial request. """ self.father.write(buffer) self.buffer.write(buffer)
[ "def", "handleResponsePart", "(", "self", ",", "buffer", ")", ":", "self", ".", "father", ".", "write", "(", "buffer", ")", "self", ".", "buffer", ".", "write", "(", "buffer", ")" ]
Sends the content to the browser and keeps a local copy of it. buffer is just a str of the content to be shown, father is the intial request.
[ "Sends", "the", "content", "to", "the", "browser", "and", "keeps", "a", "local", "copy", "of", "it", ".", "buffer", "is", "just", "a", "str", "of", "the", "content", "to", "be", "shown", "father", "is", "the", "intial", "request", "." ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/resource.py#L92-L99
train
hendrix/hendrix
hendrix/contrib/cache/resource.py
CacheProxyResource.getChild
def getChild(self, path, request): """ This is necessary because the parent class would call proxy.ReverseProxyResource instead of CacheProxyResource """ return CacheProxyResource( self.host, self.port, self.path + '/' + urlquote(path, safe=""), self.react...
python
def getChild(self, path, request): """ This is necessary because the parent class would call proxy.ReverseProxyResource instead of CacheProxyResource """ return CacheProxyResource( self.host, self.port, self.path + '/' + urlquote(path, safe=""), self.react...
[ "def", "getChild", "(", "self", ",", "path", ",", "request", ")", ":", "return", "CacheProxyResource", "(", "self", ".", "host", ",", "self", ".", "port", ",", "self", ".", "path", "+", "'/'", "+", "urlquote", "(", "path", ",", "safe", "=", "\"\"", ...
This is necessary because the parent class would call proxy.ReverseProxyResource instead of CacheProxyResource
[ "This", "is", "necessary", "because", "the", "parent", "class", "would", "call", "proxy", ".", "ReverseProxyResource", "instead", "of", "CacheProxyResource" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/resource.py#L148-L156
train
hendrix/hendrix
hendrix/contrib/cache/resource.py
CacheProxyResource.getChildWithDefault
def getChildWithDefault(self, path, request): """ Retrieve a static or dynamically generated child resource from me. """ cached_resource = self.getCachedResource(request) if cached_resource: reactor.callInThread( responseInColor, reques...
python
def getChildWithDefault(self, path, request): """ Retrieve a static or dynamically generated child resource from me. """ cached_resource = self.getCachedResource(request) if cached_resource: reactor.callInThread( responseInColor, reques...
[ "def", "getChildWithDefault", "(", "self", ",", "path", ",", "request", ")", ":", "cached_resource", "=", "self", ".", "getCachedResource", "(", "request", ")", "if", "cached_resource", ":", "reactor", ".", "callInThread", "(", "responseInColor", ",", "request",...
Retrieve a static or dynamically generated child resource from me.
[ "Retrieve", "a", "static", "or", "dynamically", "generated", "child", "resource", "from", "me", "." ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/resource.py#L158-L176
train
hendrix/hendrix
hendrix/contrib/cache/resource.py
CacheProxyResource.render
def render(self, request): """ Render a request by forwarding it to the proxied server. """ # set up and evaluate a connection to the target server if self.port == 80: host = self.host else: host = "%s:%d" % (self.host, self.port) request.r...
python
def render(self, request): """ Render a request by forwarding it to the proxied server. """ # set up and evaluate a connection to the target server if self.port == 80: host = self.host else: host = "%s:%d" % (self.host, self.port) request.r...
[ "def", "render", "(", "self", ",", "request", ")", ":", "# set up and evaluate a connection to the target server", "if", "self", ".", "port", "==", "80", ":", "host", "=", "self", ".", "host", "else", ":", "host", "=", "\"%s:%d\"", "%", "(", "self", ".", "...
Render a request by forwarding it to the proxied server.
[ "Render", "a", "request", "by", "forwarding", "it", "to", "the", "proxied", "server", "." ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/resource.py#L178-L204
train
hendrix/hendrix
hendrix/contrib/cache/resource.py
CacheProxyResource.getGlobalSelf
def getGlobalSelf(self): """ This searches the reactor for the original instance of CacheProxyResource. This is necessary because with each call of getChild a new instance of CacheProxyResource is created. """ transports = self.reactor.getReaders() for transport i...
python
def getGlobalSelf(self): """ This searches the reactor for the original instance of CacheProxyResource. This is necessary because with each call of getChild a new instance of CacheProxyResource is created. """ transports = self.reactor.getReaders() for transport i...
[ "def", "getGlobalSelf", "(", "self", ")", ":", "transports", "=", "self", ".", "reactor", ".", "getReaders", "(", ")", "for", "transport", "in", "transports", ":", "try", ":", "resource", "=", "transport", ".", "factory", ".", "resource", "if", "isinstance...
This searches the reactor for the original instance of CacheProxyResource. This is necessary because with each call of getChild a new instance of CacheProxyResource is created.
[ "This", "searches", "the", "reactor", "for", "the", "original", "instance", "of", "CacheProxyResource", ".", "This", "is", "necessary", "because", "with", "each", "call", "of", "getChild", "a", "new", "instance", "of", "CacheProxyResource", "is", "created", "." ...
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/resource.py#L209-L223
train
hendrix/hendrix
hendrix/contrib/concurrency/resources.py
MessageHandlerProtocol.dataReceived
def dataReceived(self, data): """ Takes "data" which we assume is json encoded If data has a subject_id attribute, we pass that to the dispatcher as the subject_id so it will get carried through into any return communications and be identifiable to the client ...
python
def dataReceived(self, data): """ Takes "data" which we assume is json encoded If data has a subject_id attribute, we pass that to the dispatcher as the subject_id so it will get carried through into any return communications and be identifiable to the client ...
[ "def", "dataReceived", "(", "self", ",", "data", ")", ":", "try", ":", "address", "=", "self", ".", "guid", "data", "=", "json", ".", "loads", "(", "data", ")", "threads", ".", "deferToThread", "(", "send_signal", ",", "self", ".", "dispatcher", ",", ...
Takes "data" which we assume is json encoded If data has a subject_id attribute, we pass that to the dispatcher as the subject_id so it will get carried through into any return communications and be identifiable to the client falls back to just passing the message along....
[ "Takes", "data", "which", "we", "assume", "is", "json", "encoded", "If", "data", "has", "a", "subject_id", "attribute", "we", "pass", "that", "to", "the", "dispatcher", "as", "the", "subject_id", "so", "it", "will", "get", "carried", "through", "into", "an...
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/concurrency/resources.py#L26-L57
train
hendrix/hendrix
hendrix/contrib/concurrency/resources.py
MessageHandlerProtocol.connectionMade
def connectionMade(self): """ establish the address of this new connection and add it to the list of sockets managed by the dispatcher reply to the transport with a "setup_connection" notice containing the recipient's address for use by the client as a return address for...
python
def connectionMade(self): """ establish the address of this new connection and add it to the list of sockets managed by the dispatcher reply to the transport with a "setup_connection" notice containing the recipient's address for use by the client as a return address for...
[ "def", "connectionMade", "(", "self", ")", ":", "self", ".", "transport", ".", "uid", "=", "str", "(", "uuid", ".", "uuid1", "(", ")", ")", "self", ".", "guid", "=", "self", ".", "dispatcher", ".", "add", "(", "self", ".", "transport", ")", "self",...
establish the address of this new connection and add it to the list of sockets managed by the dispatcher reply to the transport with a "setup_connection" notice containing the recipient's address for use by the client as a return address for future communications
[ "establish", "the", "address", "of", "this", "new", "connection", "and", "add", "it", "to", "the", "list", "of", "sockets", "managed", "by", "the", "dispatcher" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/concurrency/resources.py#L59-L71
train
hendrix/hendrix
hendrix/utils/conf.py
generateInitd
def generateInitd(conf_file): """ Helper function to generate the text content needed to create an init.d executable """ allowed_opts = [ 'virtualenv', 'project_path', 'settings', 'processes', 'http_port', 'cache', 'cache_port', 'https_port', 'key', 'cert' ] base_opts = ['--d...
python
def generateInitd(conf_file): """ Helper function to generate the text content needed to create an init.d executable """ allowed_opts = [ 'virtualenv', 'project_path', 'settings', 'processes', 'http_port', 'cache', 'cache_port', 'https_port', 'key', 'cert' ] base_opts = ['--d...
[ "def", "generateInitd", "(", "conf_file", ")", ":", "allowed_opts", "=", "[", "'virtualenv'", ",", "'project_path'", ",", "'settings'", ",", "'processes'", ",", "'http_port'", ",", "'cache'", ",", "'cache_port'", ",", "'https_port'", ",", "'key'", ",", "'cert'",...
Helper function to generate the text content needed to create an init.d executable
[ "Helper", "function", "to", "generate", "the", "text", "content", "needed", "to", "create", "an", "init", ".", "d", "executable" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/utils/conf.py#L9-L61
train
hendrix/hendrix
hendrix/facilities/response.py
LoudWSGIResponse.startResponse
def startResponse(self, status, headers, excInfo=None): """ extends startResponse to call speakerBox in a thread """ self.status = status self.headers = headers self.reactor.callInThread( responseInColor, self.request, status, headers ) return ...
python
def startResponse(self, status, headers, excInfo=None): """ extends startResponse to call speakerBox in a thread """ self.status = status self.headers = headers self.reactor.callInThread( responseInColor, self.request, status, headers ) return ...
[ "def", "startResponse", "(", "self", ",", "status", ",", "headers", ",", "excInfo", "=", "None", ")", ":", "self", ".", "status", "=", "status", "self", ".", "headers", "=", "headers", "self", ".", "reactor", ".", "callInThread", "(", "responseInColor", ...
extends startResponse to call speakerBox in a thread
[ "extends", "startResponse", "to", "call", "speakerBox", "in", "a", "thread" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/facilities/response.py#L41-L50
train
hendrix/hendrix
hendrix/contrib/cache/backends/__init__.py
CacheBackend.cacheContent
def cacheContent(self, request, response, buffer): """ Checks if the response should be cached. Caches the content in a gzipped format given that a `cache_it` flag is True To be used CacheClient """ content = buffer.getvalue() code = int(response.code) ...
python
def cacheContent(self, request, response, buffer): """ Checks if the response should be cached. Caches the content in a gzipped format given that a `cache_it` flag is True To be used CacheClient """ content = buffer.getvalue() code = int(response.code) ...
[ "def", "cacheContent", "(", "self", ",", "request", ",", "response", ",", "buffer", ")", ":", "content", "=", "buffer", ".", "getvalue", "(", ")", "code", "=", "int", "(", "response", ".", "code", ")", "cache_it", "=", "False", "uri", ",", "bust", "=...
Checks if the response should be cached. Caches the content in a gzipped format given that a `cache_it` flag is True To be used CacheClient
[ "Checks", "if", "the", "response", "should", "be", "cached", ".", "Caches", "the", "content", "in", "a", "gzipped", "format", "given", "that", "a", "cache_it", "flag", "is", "True", "To", "be", "used", "CacheClient" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/backends/__init__.py#L70-L94
train
hendrix/hendrix
hendrix/facilities/gather.py
get_additional_services
def get_additional_services(settings_module): """ if HENDRIX_SERVICES is specified in settings_module, it should be a list twisted internet services example: HENDRIX_SERVICES = ( ('myServiceName', 'apps.offload.services.TimeService'), ) """ ad...
python
def get_additional_services(settings_module): """ if HENDRIX_SERVICES is specified in settings_module, it should be a list twisted internet services example: HENDRIX_SERVICES = ( ('myServiceName', 'apps.offload.services.TimeService'), ) """ ad...
[ "def", "get_additional_services", "(", "settings_module", ")", ":", "additional_services", "=", "[", "]", "if", "hasattr", "(", "settings_module", ",", "'HENDRIX_SERVICES'", ")", ":", "for", "name", ",", "module_path", "in", "settings_module", ".", "HENDRIX_SERVICES...
if HENDRIX_SERVICES is specified in settings_module, it should be a list twisted internet services example: HENDRIX_SERVICES = ( ('myServiceName', 'apps.offload.services.TimeService'), )
[ "if", "HENDRIX_SERVICES", "is", "specified", "in", "settings_module", "it", "should", "be", "a", "list", "twisted", "internet", "services" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/facilities/gather.py#L4-L25
train
hendrix/hendrix
hendrix/facilities/gather.py
get_additional_resources
def get_additional_resources(settings_module): """ if HENDRIX_CHILD_RESOURCES is specified in settings_module, it should be a list resources subclassed from hendrix.contrib.NamedResource example: HENDRIX_CHILD_RESOURCES = ( 'apps.offload.resources.LongRunningProcessResource', ...
python
def get_additional_resources(settings_module): """ if HENDRIX_CHILD_RESOURCES is specified in settings_module, it should be a list resources subclassed from hendrix.contrib.NamedResource example: HENDRIX_CHILD_RESOURCES = ( 'apps.offload.resources.LongRunningProcessResource', ...
[ "def", "get_additional_resources", "(", "settings_module", ")", ":", "additional_resources", "=", "[", "]", "if", "hasattr", "(", "settings_module", ",", "'HENDRIX_CHILD_RESOURCES'", ")", ":", "for", "module_path", "in", "settings_module", ".", "HENDRIX_CHILD_RESOURCES"...
if HENDRIX_CHILD_RESOURCES is specified in settings_module, it should be a list resources subclassed from hendrix.contrib.NamedResource example: HENDRIX_CHILD_RESOURCES = ( 'apps.offload.resources.LongRunningProcessResource', 'apps.chat.resources.ChatResource', )
[ "if", "HENDRIX_CHILD_RESOURCES", "is", "specified", "in", "settings_module", "it", "should", "be", "a", "list", "resources", "subclassed", "from", "hendrix", ".", "contrib", ".", "NamedResource" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/facilities/gather.py#L28-L52
train
hendrix/hendrix
hendrix/deploy/base.py
HendrixDeploy.getConf
def getConf(cls, settings, options): "updates the options dict to use config options in the settings module" ports = ['http_port', 'https_port', 'cache_port'] for port_name in ports: port = getattr(settings, port_name.upper(), None) # only use the settings ports if the de...
python
def getConf(cls, settings, options): "updates the options dict to use config options in the settings module" ports = ['http_port', 'https_port', 'cache_port'] for port_name in ports: port = getattr(settings, port_name.upper(), None) # only use the settings ports if the de...
[ "def", "getConf", "(", "cls", ",", "settings", ",", "options", ")", ":", "ports", "=", "[", "'http_port'", ",", "'https_port'", ",", "'cache_port'", "]", "for", "port_name", "in", "ports", ":", "port", "=", "getattr", "(", "settings", ",", "port_name", "...
updates the options dict to use config options in the settings module
[ "updates", "the", "options", "dict", "to", "use", "config", "options", "in", "the", "settings", "module" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/deploy/base.py#L99-L121
train
hendrix/hendrix
hendrix/deploy/base.py
HendrixDeploy.addHendrix
def addHendrix(self): ''' Instantiates a HendrixService with this object's threadpool. It will be added as a service later. ''' self.hendrix = HendrixService( self.application, threadpool=self.getThreadPool(), resources=self.resources, ...
python
def addHendrix(self): ''' Instantiates a HendrixService with this object's threadpool. It will be added as a service later. ''' self.hendrix = HendrixService( self.application, threadpool=self.getThreadPool(), resources=self.resources, ...
[ "def", "addHendrix", "(", "self", ")", ":", "self", ".", "hendrix", "=", "HendrixService", "(", "self", ".", "application", ",", "threadpool", "=", "self", ".", "getThreadPool", "(", ")", ",", "resources", "=", "self", ".", "resources", ",", "services", ...
Instantiates a HendrixService with this object's threadpool. It will be added as a service later.
[ "Instantiates", "a", "HendrixService", "with", "this", "object", "s", "threadpool", ".", "It", "will", "be", "added", "as", "a", "service", "later", "." ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/deploy/base.py#L144-L157
train
hendrix/hendrix
hendrix/deploy/base.py
HendrixDeploy.catalogServers
def catalogServers(self, hendrix): "collects a list of service names serving on TCP or SSL" for service in hendrix.services: if isinstance(service, (TCPServer, SSLServer)): self.servers.append(service.name)
python
def catalogServers(self, hendrix): "collects a list of service names serving on TCP or SSL" for service in hendrix.services: if isinstance(service, (TCPServer, SSLServer)): self.servers.append(service.name)
[ "def", "catalogServers", "(", "self", ",", "hendrix", ")", ":", "for", "service", "in", "hendrix", ".", "services", ":", "if", "isinstance", "(", "service", ",", "(", "TCPServer", ",", "SSLServer", ")", ")", ":", "self", ".", "servers", ".", "append", ...
collects a list of service names serving on TCP or SSL
[ "collects", "a", "list", "of", "service", "names", "serving", "on", "TCP", "or", "SSL" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/deploy/base.py#L159-L163
train
hendrix/hendrix
hendrix/deploy/base.py
HendrixDeploy.run
def run(self): "sets up the desired services and runs the requested action" self.addServices() self.catalogServers(self.hendrix) action = self.action fd = self.options['fd'] if action.startswith('start'): chalk.blue(self._listening_message()) geta...
python
def run(self): "sets up the desired services and runs the requested action" self.addServices() self.catalogServers(self.hendrix) action = self.action fd = self.options['fd'] if action.startswith('start'): chalk.blue(self._listening_message()) geta...
[ "def", "run", "(", "self", ")", ":", "self", ".", "addServices", "(", ")", "self", ".", "catalogServers", "(", "self", ".", "hendrix", ")", "action", "=", "self", ".", "action", "fd", "=", "self", ".", "options", "[", "'fd'", "]", "if", "action", "...
sets up the desired services and runs the requested action
[ "sets", "up", "the", "desired", "services", "and", "runs", "the", "requested", "action" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/deploy/base.py#L169-L191
train
hendrix/hendrix
hendrix/deploy/base.py
HendrixDeploy.setFDs
def setFDs(self): """ Iterator for file descriptors. Seperated from launchworkers for clarity and readability. """ # 0 corresponds to stdin, 1 to stdout, 2 to stderr self.childFDs = {0: 0, 1: 1, 2: 2} self.fds = {} for name in self.servers: sel...
python
def setFDs(self): """ Iterator for file descriptors. Seperated from launchworkers for clarity and readability. """ # 0 corresponds to stdin, 1 to stdout, 2 to stderr self.childFDs = {0: 0, 1: 1, 2: 2} self.fds = {} for name in self.servers: sel...
[ "def", "setFDs", "(", "self", ")", ":", "# 0 corresponds to stdin, 1 to stdout, 2 to stderr", "self", ".", "childFDs", "=", "{", "0", ":", "0", ",", "1", ":", "1", ",", "2", ":", "2", "}", "self", ".", "fds", "=", "{", "}", "for", "name", "in", "self...
Iterator for file descriptors. Seperated from launchworkers for clarity and readability.
[ "Iterator", "for", "file", "descriptors", ".", "Seperated", "from", "launchworkers", "for", "clarity", "and", "readability", "." ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/deploy/base.py#L240-L252
train
hendrix/hendrix
hendrix/deploy/base.py
HendrixDeploy.addSubprocess
def addSubprocess(self, fds, name, factory): """ Public method for _addSubprocess. Wraps reactor.adoptStreamConnection in a simple DeferredLock to guarantee workers play well together. """ self._lock.run(self._addSubprocess, self, fds, name, factory)
python
def addSubprocess(self, fds, name, factory): """ Public method for _addSubprocess. Wraps reactor.adoptStreamConnection in a simple DeferredLock to guarantee workers play well together. """ self._lock.run(self._addSubprocess, self, fds, name, factory)
[ "def", "addSubprocess", "(", "self", ",", "fds", ",", "name", ",", "factory", ")", ":", "self", ".", "_lock", ".", "run", "(", "self", ".", "_addSubprocess", ",", "self", ",", "fds", ",", "name", ",", "factory", ")" ]
Public method for _addSubprocess. Wraps reactor.adoptStreamConnection in a simple DeferredLock to guarantee workers play well together.
[ "Public", "method", "for", "_addSubprocess", ".", "Wraps", "reactor", ".", "adoptStreamConnection", "in", "a", "simple", "DeferredLock", "to", "guarantee", "workers", "play", "well", "together", "." ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/deploy/base.py#L273-L280
train
hendrix/hendrix
hendrix/deploy/base.py
HendrixDeploy.disownService
def disownService(self, name): """ disowns a service on hendirix by name returns a factory for use in the adoptStreamPort part of setting up multiple processes """ _service = self.hendrix.getServiceNamed(name) _service.disownServiceParent() return _service...
python
def disownService(self, name): """ disowns a service on hendirix by name returns a factory for use in the adoptStreamPort part of setting up multiple processes """ _service = self.hendrix.getServiceNamed(name) _service.disownServiceParent() return _service...
[ "def", "disownService", "(", "self", ",", "name", ")", ":", "_service", "=", "self", ".", "hendrix", ".", "getServiceNamed", "(", "name", ")", "_service", ".", "disownServiceParent", "(", ")", "return", "_service", ".", "factory" ]
disowns a service on hendirix by name returns a factory for use in the adoptStreamPort part of setting up multiple processes
[ "disowns", "a", "service", "on", "hendirix", "by", "name", "returns", "a", "factory", "for", "use", "in", "the", "adoptStreamPort", "part", "of", "setting", "up", "multiple", "processes" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/deploy/base.py#L307-L315
train
hendrix/hendrix
hendrix/utils/__init__.py
get_pid
def get_pid(options): """returns The default location of the pid file for process management""" namespace = options['settings'] if options['settings'] else options['wsgi'] return os.path.join('{}', '{}_{}.pid').format(PID_DIR, options['http_port'], namespace.replace('.', '_'))
python
def get_pid(options): """returns The default location of the pid file for process management""" namespace = options['settings'] if options['settings'] else options['wsgi'] return os.path.join('{}', '{}_{}.pid').format(PID_DIR, options['http_port'], namespace.replace('.', '_'))
[ "def", "get_pid", "(", "options", ")", ":", "namespace", "=", "options", "[", "'settings'", "]", "if", "options", "[", "'settings'", "]", "else", "options", "[", "'wsgi'", "]", "return", "os", ".", "path", ".", "join", "(", "'{}'", ",", "'{}_{}.pid'", ...
returns The default location of the pid file for process management
[ "returns", "The", "default", "location", "of", "the", "pid", "file", "for", "process", "management" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/utils/__init__.py#L21-L24
train
hendrix/hendrix
hendrix/utils/__init__.py
responseInColor
def responseInColor(request, status, headers, prefix='Response', opts=None): "Prints the response info in color" code, message = status.split(None, 1) message = '%s [%s] => Request %s %s %s on pid %d' % ( prefix, code, str(request.host), request.method, request.path, ...
python
def responseInColor(request, status, headers, prefix='Response', opts=None): "Prints the response info in color" code, message = status.split(None, 1) message = '%s [%s] => Request %s %s %s on pid %d' % ( prefix, code, str(request.host), request.method, request.path, ...
[ "def", "responseInColor", "(", "request", ",", "status", ",", "headers", ",", "prefix", "=", "'Response'", ",", "opts", "=", "None", ")", ":", "code", ",", "message", "=", "status", ".", "split", "(", "None", ",", "1", ")", "message", "=", "'%s [%s] =>...
Prints the response info in color
[ "Prints", "the", "response", "info", "in", "color" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/utils/__init__.py#L27-L44
train
hendrix/hendrix
hendrix/deploy/cache.py
HendrixDeployCache.addLocalCacheService
def addLocalCacheService(self): "adds a CacheService to the instatiated HendrixService" _cache = self.getCacheService() _cache.setName('cache_proxy') _cache.setServiceParent(self.hendrix)
python
def addLocalCacheService(self): "adds a CacheService to the instatiated HendrixService" _cache = self.getCacheService() _cache.setName('cache_proxy') _cache.setServiceParent(self.hendrix)
[ "def", "addLocalCacheService", "(", "self", ")", ":", "_cache", "=", "self", ".", "getCacheService", "(", ")", "_cache", ".", "setName", "(", "'cache_proxy'", ")", "_cache", ".", "setServiceParent", "(", "self", ".", "hendrix", ")" ]
adds a CacheService to the instatiated HendrixService
[ "adds", "a", "CacheService", "to", "the", "instatiated", "HendrixService" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/deploy/cache.py#L24-L28
train
hendrix/hendrix
hendrix/deploy/cache.py
HendrixDeployCache.addGlobalServices
def addGlobalServices(self): """ This is where we put service that we don't want to be duplicated on worker subprocesses """ if self.options.get('global_cache') and self.options.get('cache'): # only add the cache service here if the global_cache and cache ...
python
def addGlobalServices(self): """ This is where we put service that we don't want to be duplicated on worker subprocesses """ if self.options.get('global_cache') and self.options.get('cache'): # only add the cache service here if the global_cache and cache ...
[ "def", "addGlobalServices", "(", "self", ")", ":", "if", "self", ".", "options", ".", "get", "(", "'global_cache'", ")", "and", "self", ".", "options", ".", "get", "(", "'cache'", ")", ":", "# only add the cache service here if the global_cache and cache", "# opti...
This is where we put service that we don't want to be duplicated on worker subprocesses
[ "This", "is", "where", "we", "put", "service", "that", "we", "don", "t", "want", "to", "be", "duplicated", "on", "worker", "subprocesses" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/deploy/cache.py#L38-L47
train
hendrix/hendrix
hendrix/facilities/resources.py
HendrixResource.putNamedChild
def putNamedChild(self, res): """ putNamedChild takes either an instance of hendrix.contrib.NamedResource or any resource.Resource with a "namespace" attribute as a means of allowing application level control of resource namespacing. if a child is already found at an existing pa...
python
def putNamedChild(self, res): """ putNamedChild takes either an instance of hendrix.contrib.NamedResource or any resource.Resource with a "namespace" attribute as a means of allowing application level control of resource namespacing. if a child is already found at an existing pa...
[ "def", "putNamedChild", "(", "self", ",", "res", ")", ":", "try", ":", "EmptyResource", "=", "resource", ".", "Resource", "namespace", "=", "res", ".", "namespace", "parts", "=", "namespace", ".", "strip", "(", "'/'", ")", ".", "split", "(", "'/'", ")"...
putNamedChild takes either an instance of hendrix.contrib.NamedResource or any resource.Resource with a "namespace" attribute as a means of allowing application level control of resource namespacing. if a child is already found at an existing path, resources with paths that are children...
[ "putNamedChild", "takes", "either", "an", "instance", "of", "hendrix", ".", "contrib", ".", "NamedResource", "or", "any", "resource", ".", "Resource", "with", "a", "namespace", "attribute", "as", "a", "means", "of", "allowing", "application", "level", "control",...
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/facilities/resources.py#L59-L105
train
hendrix/hendrix
hendrix/contrib/concurrency/messaging.py
send_json_message
def send_json_message(address, message, **kwargs): """ a shortcut for message sending """ data = { 'message': message, } if not kwargs.get('subject_id'): data['subject_id'] = address data.update(kwargs) hxdispatcher.send(address, data)
python
def send_json_message(address, message, **kwargs): """ a shortcut for message sending """ data = { 'message': message, } if not kwargs.get('subject_id'): data['subject_id'] = address data.update(kwargs) hxdispatcher.send(address, data)
[ "def", "send_json_message", "(", "address", ",", "message", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "'message'", ":", "message", ",", "}", "if", "not", "kwargs", ".", "get", "(", "'subject_id'", ")", ":", "data", "[", "'subject_id'", "]", ...
a shortcut for message sending
[ "a", "shortcut", "for", "message", "sending" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/concurrency/messaging.py#L125-L139
train
hendrix/hendrix
hendrix/contrib/concurrency/messaging.py
send_callback_json_message
def send_callback_json_message(value, *args, **kwargs): """ useful for sending messages from callbacks as it puts the result of the callback in the dict for serialization """ if value: kwargs['result'] = value send_json_message(args[0], args[1], **kwargs) return value
python
def send_callback_json_message(value, *args, **kwargs): """ useful for sending messages from callbacks as it puts the result of the callback in the dict for serialization """ if value: kwargs['result'] = value send_json_message(args[0], args[1], **kwargs) return value
[ "def", "send_callback_json_message", "(", "value", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "value", ":", "kwargs", "[", "'result'", "]", "=", "value", "send_json_message", "(", "args", "[", "0", "]", ",", "args", "[", "1", "]", ","...
useful for sending messages from callbacks as it puts the result of the callback in the dict for serialization
[ "useful", "for", "sending", "messages", "from", "callbacks", "as", "it", "puts", "the", "result", "of", "the", "callback", "in", "the", "dict", "for", "serialization" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/concurrency/messaging.py#L142-L153
train
hendrix/hendrix
hendrix/contrib/concurrency/messaging.py
RecipientManager.send
def send(self, message): # usually a json string... """ sends whatever it is to each transport """ for transport in self.transports.values(): transport.protocol.sendMessage(message)
python
def send(self, message): # usually a json string... """ sends whatever it is to each transport """ for transport in self.transports.values(): transport.protocol.sendMessage(message)
[ "def", "send", "(", "self", ",", "message", ")", ":", "# usually a json string...", "for", "transport", "in", "self", ".", "transports", ".", "values", "(", ")", ":", "transport", ".", "protocol", ".", "sendMessage", "(", "message", ")" ]
sends whatever it is to each transport
[ "sends", "whatever", "it", "is", "to", "each", "transport" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/concurrency/messaging.py#L34-L39
train
hendrix/hendrix
hendrix/contrib/concurrency/messaging.py
RecipientManager.remove
def remove(self, transport): """ removes a transport if a member of this group """ if transport.uid in self.transports: del (self.transports[transport.uid])
python
def remove(self, transport): """ removes a transport if a member of this group """ if transport.uid in self.transports: del (self.transports[transport.uid])
[ "def", "remove", "(", "self", ",", "transport", ")", ":", "if", "transport", ".", "uid", "in", "self", ".", "transports", ":", "del", "(", "self", ".", "transports", "[", "transport", ".", "uid", "]", ")" ]
removes a transport if a member of this group
[ "removes", "a", "transport", "if", "a", "member", "of", "this", "group" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/concurrency/messaging.py#L41-L46
train
hendrix/hendrix
hendrix/contrib/concurrency/messaging.py
MessageDispatcher.add
def add(self, transport, address=None): """ add a new recipient to be addressable by this MessageDispatcher generate a new uuid address if one is not specified """ if not address: address = str(uuid.uuid1()) if address in self.recipients: ...
python
def add(self, transport, address=None): """ add a new recipient to be addressable by this MessageDispatcher generate a new uuid address if one is not specified """ if not address: address = str(uuid.uuid1()) if address in self.recipients: ...
[ "def", "add", "(", "self", ",", "transport", ",", "address", "=", "None", ")", ":", "if", "not", "address", ":", "address", "=", "str", "(", "uuid", ".", "uuid1", "(", ")", ")", "if", "address", "in", "self", ".", "recipients", ":", "self", ".", ...
add a new recipient to be addressable by this MessageDispatcher generate a new uuid address if one is not specified
[ "add", "a", "new", "recipient", "to", "be", "addressable", "by", "this", "MessageDispatcher", "generate", "a", "new", "uuid", "address", "if", "one", "is", "not", "specified" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/concurrency/messaging.py#L69-L83
train
hendrix/hendrix
hendrix/contrib/concurrency/messaging.py
MessageDispatcher.remove
def remove(self, transport): """ removes a transport from all channels to which it belongs. """ recipients = copy.copy(self.recipients) for address, recManager in recipients.items(): recManager.remove(transport) if not len(recManager.transports): ...
python
def remove(self, transport): """ removes a transport from all channels to which it belongs. """ recipients = copy.copy(self.recipients) for address, recManager in recipients.items(): recManager.remove(transport) if not len(recManager.transports): ...
[ "def", "remove", "(", "self", ",", "transport", ")", ":", "recipients", "=", "copy", ".", "copy", "(", "self", ".", "recipients", ")", "for", "address", ",", "recManager", "in", "recipients", ".", "items", "(", ")", ":", "recManager", ".", "remove", "(...
removes a transport from all channels to which it belongs.
[ "removes", "a", "transport", "from", "all", "channels", "to", "which", "it", "belongs", "." ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/concurrency/messaging.py#L85-L93
train
hendrix/hendrix
hendrix/contrib/concurrency/messaging.py
MessageDispatcher.send
def send(self, address, data_dict): """ address can either be a string or a list of strings data_dict gets sent along as is and could contain anything """ if type(address) == list: recipients = [self.recipients.get(rec) for rec in address] else: ...
python
def send(self, address, data_dict): """ address can either be a string or a list of strings data_dict gets sent along as is and could contain anything """ if type(address) == list: recipients = [self.recipients.get(rec) for rec in address] else: ...
[ "def", "send", "(", "self", ",", "address", ",", "data_dict", ")", ":", "if", "type", "(", "address", ")", "==", "list", ":", "recipients", "=", "[", "self", ".", "recipients", ".", "get", "(", "rec", ")", "for", "rec", "in", "address", "]", "else"...
address can either be a string or a list of strings data_dict gets sent along as is and could contain anything
[ "address", "can", "either", "be", "a", "string", "or", "a", "list", "of", "strings" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/concurrency/messaging.py#L95-L110
train
hendrix/hendrix
hendrix/contrib/concurrency/messaging.py
MessageDispatcher.subscribe
def subscribe(self, transport, data): """ adds a transport to a channel """ self.add(transport, address=data.get('hx_subscribe').encode()) self.send( data['hx_subscribe'], {'message': "%r is listening" % transport} )
python
def subscribe(self, transport, data): """ adds a transport to a channel """ self.add(transport, address=data.get('hx_subscribe').encode()) self.send( data['hx_subscribe'], {'message': "%r is listening" % transport} )
[ "def", "subscribe", "(", "self", ",", "transport", ",", "data", ")", ":", "self", ".", "add", "(", "transport", ",", "address", "=", "data", ".", "get", "(", "'hx_subscribe'", ")", ".", "encode", "(", ")", ")", "self", ".", "send", "(", "data", "["...
adds a transport to a channel
[ "adds", "a", "transport", "to", "a", "channel" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/concurrency/messaging.py#L112-L122
train
hendrix/hendrix
hendrix/options.py
cleanOptions
def cleanOptions(options): """ Takes an options dict and returns a tuple containing the daemonize boolean, the reload boolean, and the parsed list of cleaned options as would be expected to be passed to hx """ _reload = options.pop('reload') dev = options.pop('dev') opts = [] store_t...
python
def cleanOptions(options): """ Takes an options dict and returns a tuple containing the daemonize boolean, the reload boolean, and the parsed list of cleaned options as would be expected to be passed to hx """ _reload = options.pop('reload') dev = options.pop('dev') opts = [] store_t...
[ "def", "cleanOptions", "(", "options", ")", ":", "_reload", "=", "options", ".", "pop", "(", "'reload'", ")", "dev", "=", "options", ".", "pop", "(", "'dev'", ")", "opts", "=", "[", "]", "store_true", "=", "[", "'--nocache'", ",", "'--global_cache'", "...
Takes an options dict and returns a tuple containing the daemonize boolean, the reload boolean, and the parsed list of cleaned options as would be expected to be passed to hx
[ "Takes", "an", "options", "dict", "and", "returns", "a", "tuple", "containing", "the", "daemonize", "boolean", "the", "reload", "boolean", "and", "the", "parsed", "list", "of", "cleaned", "options", "as", "would", "be", "expected", "to", "be", "passed", "to"...
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/options.py#L7-L26
train
hendrix/hendrix
hendrix/options.py
options
def options(argv=[]): """ A helper function that returns a dictionary of the default key-values pairs """ parser = HendrixOptionParser parsed_args = parser.parse_args(argv) return vars(parsed_args[0])
python
def options(argv=[]): """ A helper function that returns a dictionary of the default key-values pairs """ parser = HendrixOptionParser parsed_args = parser.parse_args(argv) return vars(parsed_args[0])
[ "def", "options", "(", "argv", "=", "[", "]", ")", ":", "parser", "=", "HendrixOptionParser", "parsed_args", "=", "parser", ".", "parse_args", "(", "argv", ")", "return", "vars", "(", "parsed_args", "[", "0", "]", ")" ]
A helper function that returns a dictionary of the default key-values pairs
[ "A", "helper", "function", "that", "returns", "a", "dictionary", "of", "the", "default", "key", "-", "values", "pairs" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/options.py#L195-L201
train
hendrix/hendrix
hendrix/experience/hey_joe.py
_ParticipantRegistry.remove
def remove(self, participant): """ Unsubscribe this participant from all topic to which it is subscribed. """ for topic, participants in list(self._participants_by_topic.items()): self.unsubscribe(participant, topic) # It's possible that we just nixe the last subs...
python
def remove(self, participant): """ Unsubscribe this participant from all topic to which it is subscribed. """ for topic, participants in list(self._participants_by_topic.items()): self.unsubscribe(participant, topic) # It's possible that we just nixe the last subs...
[ "def", "remove", "(", "self", ",", "participant", ")", ":", "for", "topic", ",", "participants", "in", "list", "(", "self", ".", "_participants_by_topic", ".", "items", "(", ")", ")", ":", "self", ".", "unsubscribe", "(", "participant", ",", "topic", ")"...
Unsubscribe this participant from all topic to which it is subscribed.
[ "Unsubscribe", "this", "participant", "from", "all", "topic", "to", "which", "it", "is", "subscribed", "." ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/experience/hey_joe.py#L67-L75
train
hendrix/hendrix
hendrix/deploy/tls.py
HendrixDeployTLS.addSSLService
def addSSLService(self): "adds a SSLService to the instaitated HendrixService" https_port = self.options['https_port'] self.tls_service = HendrixTCPServiceWithTLS(https_port, self.hendrix.site, self.key, self.cert, self.context_factory, self.co...
python
def addSSLService(self): "adds a SSLService to the instaitated HendrixService" https_port = self.options['https_port'] self.tls_service = HendrixTCPServiceWithTLS(https_port, self.hendrix.site, self.key, self.cert, self.context_factory, self.co...
[ "def", "addSSLService", "(", "self", ")", ":", "https_port", "=", "self", ".", "options", "[", "'https_port'", "]", "self", ".", "tls_service", "=", "HendrixTCPServiceWithTLS", "(", "https_port", ",", "self", ".", "hendrix", ".", "site", ",", "self", ".", ...
adds a SSLService to the instaitated HendrixService
[ "adds", "a", "SSLService", "to", "the", "instaitated", "HendrixService" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/deploy/tls.py#L61-L66
train
hendrix/hendrix
hendrix/contrib/cache/backends/memory_cache.py
MemoryCacheBackend.addResource
def addResource(self, content, uri, headers): """ Adds the a hendrix.contrib.cache.resource.CachedResource to the ReverseProxy cache connection """ self.cache[uri] = CachedResource(content, headers)
python
def addResource(self, content, uri, headers): """ Adds the a hendrix.contrib.cache.resource.CachedResource to the ReverseProxy cache connection """ self.cache[uri] = CachedResource(content, headers)
[ "def", "addResource", "(", "self", ",", "content", ",", "uri", ",", "headers", ")", ":", "self", ".", "cache", "[", "uri", "]", "=", "CachedResource", "(", "content", ",", "headers", ")" ]
Adds the a hendrix.contrib.cache.resource.CachedResource to the ReverseProxy cache connection
[ "Adds", "the", "a", "hendrix", ".", "contrib", ".", "cache", ".", "resource", ".", "CachedResource", "to", "the", "ReverseProxy", "cache", "connection" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/backends/memory_cache.py#L15-L20
train
hendrix/hendrix
hendrix/contrib/cache/__init__.py
decompressBuffer
def decompressBuffer(buffer): "complements the compressBuffer function in CacheClient" zbuf = cStringIO.StringIO(buffer) zfile = gzip.GzipFile(fileobj=zbuf) deflated = zfile.read() zfile.close() return deflated
python
def decompressBuffer(buffer): "complements the compressBuffer function in CacheClient" zbuf = cStringIO.StringIO(buffer) zfile = gzip.GzipFile(fileobj=zbuf) deflated = zfile.read() zfile.close() return deflated
[ "def", "decompressBuffer", "(", "buffer", ")", ":", "zbuf", "=", "cStringIO", ".", "StringIO", "(", "buffer", ")", "zfile", "=", "gzip", ".", "GzipFile", "(", "fileobj", "=", "zbuf", ")", "deflated", "=", "zfile", ".", "read", "(", ")", "zfile", ".", ...
complements the compressBuffer function in CacheClient
[ "complements", "the", "compressBuffer", "function", "in", "CacheClient" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/__init__.py#L30-L36
train
hendrix/hendrix
hendrix/contrib/cache/__init__.py
CachedResource.getMaxAge
def getMaxAge(self): "get the max-age in seconds from the saved headers data" max_age = 0 cache_control = self.headers.get('cache-control') if cache_control: params = dict(urlparse.parse_qsl(cache_control)) max_age = int(params.get('max-age', '0')) return ...
python
def getMaxAge(self): "get the max-age in seconds from the saved headers data" max_age = 0 cache_control = self.headers.get('cache-control') if cache_control: params = dict(urlparse.parse_qsl(cache_control)) max_age = int(params.get('max-age', '0')) return ...
[ "def", "getMaxAge", "(", "self", ")", ":", "max_age", "=", "0", "cache_control", "=", "self", ".", "headers", ".", "get", "(", "'cache-control'", ")", "if", "cache_control", ":", "params", "=", "dict", "(", "urlparse", ".", "parse_qsl", "(", "cache_control...
get the max-age in seconds from the saved headers data
[ "get", "the", "max", "-", "age", "in", "seconds", "from", "the", "saved", "headers", "data" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/__init__.py#L51-L58
train
hendrix/hendrix
hendrix/contrib/cache/__init__.py
CachedResource.getLastModified
def getLastModified(self): "returns the GMT last-modified datetime or None" last_modified = self.headers.get('last-modified') if last_modified: last_modified = self.convertTimeString(last_modified) return last_modified
python
def getLastModified(self): "returns the GMT last-modified datetime or None" last_modified = self.headers.get('last-modified') if last_modified: last_modified = self.convertTimeString(last_modified) return last_modified
[ "def", "getLastModified", "(", "self", ")", ":", "last_modified", "=", "self", ".", "headers", ".", "get", "(", "'last-modified'", ")", "if", "last_modified", ":", "last_modified", "=", "self", ".", "convertTimeString", "(", "last_modified", ")", "return", "la...
returns the GMT last-modified datetime or None
[ "returns", "the", "GMT", "last", "-", "modified", "datetime", "or", "None" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/__init__.py#L68-L73
train
hendrix/hendrix
hendrix/contrib/cache/__init__.py
CachedResource.getDate
def getDate(self): "returns the GMT response datetime or None" date = self.headers.get('date') if date: date = self.convertTimeString(date) return date
python
def getDate(self): "returns the GMT response datetime or None" date = self.headers.get('date') if date: date = self.convertTimeString(date) return date
[ "def", "getDate", "(", "self", ")", ":", "date", "=", "self", ".", "headers", ".", "get", "(", "'date'", ")", "if", "date", ":", "date", "=", "self", ".", "convertTimeString", "(", "date", ")", "return", "date" ]
returns the GMT response datetime or None
[ "returns", "the", "GMT", "response", "datetime", "or", "None" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/__init__.py#L75-L80
train
hendrix/hendrix
hendrix/contrib/cache/__init__.py
CachedResource.isFresh
def isFresh(self): "returns True if cached object is still fresh" max_age = self.getMaxAge() date = self.getDate() is_fresh = False if max_age and date: delta_time = datetime.now() - date is_fresh = delta_time.total_seconds() < max_age return is_fr...
python
def isFresh(self): "returns True if cached object is still fresh" max_age = self.getMaxAge() date = self.getDate() is_fresh = False if max_age and date: delta_time = datetime.now() - date is_fresh = delta_time.total_seconds() < max_age return is_fr...
[ "def", "isFresh", "(", "self", ")", ":", "max_age", "=", "self", ".", "getMaxAge", "(", ")", "date", "=", "self", ".", "getDate", "(", ")", "is_fresh", "=", "False", "if", "max_age", "and", "date", ":", "delta_time", "=", "datetime", ".", "now", "(",...
returns True if cached object is still fresh
[ "returns", "True", "if", "cached", "object", "is", "still", "fresh" ]
175af011a7e5822b772bfec0e11a46466bb8688d
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/__init__.py#L82-L90
train
aio-libs/aiohttp-cors
aiohttp_cors/cors_config.py
_CorsConfigImpl._on_response_prepare
async def _on_response_prepare(self, request: web.Request, response: web.StreamResponse): """Non-preflight CORS request response processor. If request is done on CORS-enabled route, process request parameters and set appropri...
python
async def _on_response_prepare(self, request: web.Request, response: web.StreamResponse): """Non-preflight CORS request response processor. If request is done on CORS-enabled route, process request parameters and set appropri...
[ "async", "def", "_on_response_prepare", "(", "self", ",", "request", ":", "web", ".", "Request", ",", "response", ":", "web", ".", "StreamResponse", ")", ":", "if", "(", "not", "self", ".", "_router_adapter", ".", "is_cors_enabled_on_request", "(", "request", ...
Non-preflight CORS request response processor. If request is done on CORS-enabled route, process request parameters and set appropriate CORS response headers.
[ "Non", "-", "preflight", "CORS", "request", "response", "processor", "." ]
14affbd95c88c675eb513c1d295ede1897930f94
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/cors_config.py#L141-L195
train
aio-libs/aiohttp-cors
aiohttp_cors/resource_options.py
_is_proper_sequence
def _is_proper_sequence(seq): """Returns is seq is sequence and not string.""" return (isinstance(seq, collections.abc.Sequence) and not isinstance(seq, str))
python
def _is_proper_sequence(seq): """Returns is seq is sequence and not string.""" return (isinstance(seq, collections.abc.Sequence) and not isinstance(seq, str))
[ "def", "_is_proper_sequence", "(", "seq", ")", ":", "return", "(", "isinstance", "(", "seq", ",", "collections", ".", "abc", ".", "Sequence", ")", "and", "not", "isinstance", "(", "seq", ",", "str", ")", ")" ]
Returns is seq is sequence and not string.
[ "Returns", "is", "seq", "is", "sequence", "and", "not", "string", "." ]
14affbd95c88c675eb513c1d295ede1897930f94
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/resource_options.py#L25-L28
train
aio-libs/aiohttp-cors
aiohttp_cors/__init__.py
setup
def setup(app: web.Application, *, defaults: Mapping[str, Union[ResourceOptions, Mapping[str, Any]]]=None) -> CorsConfig: """Setup CORS processing for the application. To enable CORS for a resource you need to explicitly add route for that resource using `Co...
python
def setup(app: web.Application, *, defaults: Mapping[str, Union[ResourceOptions, Mapping[str, Any]]]=None) -> CorsConfig: """Setup CORS processing for the application. To enable CORS for a resource you need to explicitly add route for that resource using `Co...
[ "def", "setup", "(", "app", ":", "web", ".", "Application", ",", "*", ",", "defaults", ":", "Mapping", "[", "str", ",", "Union", "[", "ResourceOptions", ",", "Mapping", "[", "str", ",", "Any", "]", "]", "]", "=", "None", ")", "->", "CorsConfig", ":...
Setup CORS processing for the application. To enable CORS for a resource you need to explicitly add route for that resource using `CorsConfig.add()` method:: app = aiohttp.web.Application() cors = aiohttp_cors.setup(app) cors.add( app.router.add_route("GET", "/resource", ha...
[ "Setup", "CORS", "processing", "for", "the", "application", "." ]
14affbd95c88c675eb513c1d295ede1897930f94
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/__init__.py#L40-L67
train
aio-libs/aiohttp-cors
aiohttp_cors/preflight_handler.py
_PreflightHandler._parse_request_method
def _parse_request_method(request: web.Request): """Parse Access-Control-Request-Method header of the preflight request """ method = request.headers.get(hdrs.ACCESS_CONTROL_REQUEST_METHOD) if method is None: raise web.HTTPForbidden( text="CORS preflight reques...
python
def _parse_request_method(request: web.Request): """Parse Access-Control-Request-Method header of the preflight request """ method = request.headers.get(hdrs.ACCESS_CONTROL_REQUEST_METHOD) if method is None: raise web.HTTPForbidden( text="CORS preflight reques...
[ "def", "_parse_request_method", "(", "request", ":", "web", ".", "Request", ")", ":", "method", "=", "request", ".", "headers", ".", "get", "(", "hdrs", ".", "ACCESS_CONTROL_REQUEST_METHOD", ")", "if", "method", "is", "None", ":", "raise", "web", ".", "HTT...
Parse Access-Control-Request-Method header of the preflight request
[ "Parse", "Access", "-", "Control", "-", "Request", "-", "Method", "header", "of", "the", "preflight", "request" ]
14affbd95c88c675eb513c1d295ede1897930f94
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/preflight_handler.py#L10-L22
train
aio-libs/aiohttp-cors
aiohttp_cors/preflight_handler.py
_PreflightHandler._parse_request_headers
def _parse_request_headers(request: web.Request): """Parse Access-Control-Request-Headers header or the preflight request Returns set of headers in upper case. """ headers = request.headers.get(hdrs.ACCESS_CONTROL_REQUEST_HEADERS) if headers is None: return frozenset...
python
def _parse_request_headers(request: web.Request): """Parse Access-Control-Request-Headers header or the preflight request Returns set of headers in upper case. """ headers = request.headers.get(hdrs.ACCESS_CONTROL_REQUEST_HEADERS) if headers is None: return frozenset...
[ "def", "_parse_request_headers", "(", "request", ":", "web", ".", "Request", ")", ":", "headers", "=", "request", ".", "headers", ".", "get", "(", "hdrs", ".", "ACCESS_CONTROL_REQUEST_HEADERS", ")", "if", "headers", "is", "None", ":", "return", "frozenset", ...
Parse Access-Control-Request-Headers header or the preflight request Returns set of headers in upper case.
[ "Parse", "Access", "-", "Control", "-", "Request", "-", "Headers", "header", "or", "the", "preflight", "request" ]
14affbd95c88c675eb513c1d295ede1897930f94
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/preflight_handler.py#L25-L40
train
aio-libs/aiohttp-cors
aiohttp_cors/preflight_handler.py
_PreflightHandler._preflight_handler
async def _preflight_handler(self, request: web.Request): """CORS preflight request handler""" # Handle according to part 6.2 of the CORS specification. origin = request.headers.get(hdrs.ORIGIN) if origin is None: # Terminate CORS according to CORS 6.2.1. raise ...
python
async def _preflight_handler(self, request: web.Request): """CORS preflight request handler""" # Handle according to part 6.2 of the CORS specification. origin = request.headers.get(hdrs.ORIGIN) if origin is None: # Terminate CORS according to CORS 6.2.1. raise ...
[ "async", "def", "_preflight_handler", "(", "self", ",", "request", ":", "web", ".", "Request", ")", ":", "# Handle according to part 6.2 of the CORS specification.", "origin", "=", "request", ".", "headers", ".", "get", "(", "hdrs", ".", "ORIGIN", ")", "if", "or...
CORS preflight request handler
[ "CORS", "preflight", "request", "handler" ]
14affbd95c88c675eb513c1d295ede1897930f94
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/preflight_handler.py#L45-L130
train
aio-libs/aiohttp-cors
aiohttp_cors/urldispatcher_router_adapter.py
ResourcesUrlDispatcherRouterAdapter.add_preflight_handler
def add_preflight_handler( self, routing_entity: Union[web.Resource, web.StaticResource, web.ResourceRoute], handler): """Add OPTIONS handler for all routes defined by `routing_entity`. Does nothing if CORS handler already handles ro...
python
def add_preflight_handler( self, routing_entity: Union[web.Resource, web.StaticResource, web.ResourceRoute], handler): """Add OPTIONS handler for all routes defined by `routing_entity`. Does nothing if CORS handler already handles ro...
[ "def", "add_preflight_handler", "(", "self", ",", "routing_entity", ":", "Union", "[", "web", ".", "Resource", ",", "web", ".", "StaticResource", ",", "web", ".", "ResourceRoute", "]", ",", "handler", ")", ":", "if", "isinstance", "(", "routing_entity", ",",...
Add OPTIONS handler for all routes defined by `routing_entity`. Does nothing if CORS handler already handles routing entity. Should fail if there are conflicting user-defined OPTIONS handlers.
[ "Add", "OPTIONS", "handler", "for", "all", "routes", "defined", "by", "routing_entity", "." ]
14affbd95c88c675eb513c1d295ede1897930f94
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/urldispatcher_router_adapter.py#L137-L200
train
aio-libs/aiohttp-cors
aiohttp_cors/urldispatcher_router_adapter.py
ResourcesUrlDispatcherRouterAdapter.is_preflight_request
def is_preflight_request(self, request: web.Request) -> bool: """Is `request` is a CORS preflight request.""" route = self._request_route(request) if _is_web_view(route, strict=False): return request.method == 'OPTIONS' return route in self._preflight_routes
python
def is_preflight_request(self, request: web.Request) -> bool: """Is `request` is a CORS preflight request.""" route = self._request_route(request) if _is_web_view(route, strict=False): return request.method == 'OPTIONS' return route in self._preflight_routes
[ "def", "is_preflight_request", "(", "self", ",", "request", ":", "web", ".", "Request", ")", "->", "bool", ":", "route", "=", "self", ".", "_request_route", "(", "request", ")", "if", "_is_web_view", "(", "route", ",", "strict", "=", "False", ")", ":", ...
Is `request` is a CORS preflight request.
[ "Is", "request", "is", "a", "CORS", "preflight", "request", "." ]
14affbd95c88c675eb513c1d295ede1897930f94
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/urldispatcher_router_adapter.py#L214-L219
train
aio-libs/aiohttp-cors
aiohttp_cors/urldispatcher_router_adapter.py
ResourcesUrlDispatcherRouterAdapter.is_cors_enabled_on_request
def is_cors_enabled_on_request(self, request: web.Request) -> bool: """Is `request` is a request for CORS-enabled resource.""" return self._request_resource(request) in self._resource_config
python
def is_cors_enabled_on_request(self, request: web.Request) -> bool: """Is `request` is a request for CORS-enabled resource.""" return self._request_resource(request) in self._resource_config
[ "def", "is_cors_enabled_on_request", "(", "self", ",", "request", ":", "web", ".", "Request", ")", "->", "bool", ":", "return", "self", ".", "_request_resource", "(", "request", ")", "in", "self", ".", "_resource_config" ]
Is `request` is a request for CORS-enabled resource.
[ "Is", "request", "is", "a", "request", "for", "CORS", "-", "enabled", "resource", "." ]
14affbd95c88c675eb513c1d295ede1897930f94
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/urldispatcher_router_adapter.py#L221-L224
train
aio-libs/aiohttp-cors
aiohttp_cors/urldispatcher_router_adapter.py
ResourcesUrlDispatcherRouterAdapter.set_config_for_routing_entity
def set_config_for_routing_entity( self, routing_entity: Union[web.Resource, web.StaticResource, web.ResourceRoute], config): """Record configuration for resource or it's route.""" if isinstance(routing_entity, (web.Resource, web.Sta...
python
def set_config_for_routing_entity( self, routing_entity: Union[web.Resource, web.StaticResource, web.ResourceRoute], config): """Record configuration for resource or it's route.""" if isinstance(routing_entity, (web.Resource, web.Sta...
[ "def", "set_config_for_routing_entity", "(", "self", ",", "routing_entity", ":", "Union", "[", "web", ".", "Resource", ",", "web", ".", "StaticResource", ",", "web", ".", "ResourceRoute", "]", ",", "config", ")", ":", "if", "isinstance", "(", "routing_entity",...
Record configuration for resource or it's route.
[ "Record", "configuration", "for", "resource", "or", "it", "s", "route", "." ]
14affbd95c88c675eb513c1d295ede1897930f94
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/urldispatcher_router_adapter.py#L226-L271
train
aio-libs/aiohttp-cors
aiohttp_cors/urldispatcher_router_adapter.py
ResourcesUrlDispatcherRouterAdapter.get_non_preflight_request_config
def get_non_preflight_request_config(self, request: web.Request): """Get stored CORS configuration for routing entity that handles specified request.""" assert self.is_cors_enabled_on_request(request) resource = self._request_resource(request) resource_config = self._resource_c...
python
def get_non_preflight_request_config(self, request: web.Request): """Get stored CORS configuration for routing entity that handles specified request.""" assert self.is_cors_enabled_on_request(request) resource = self._request_resource(request) resource_config = self._resource_c...
[ "def", "get_non_preflight_request_config", "(", "self", ",", "request", ":", "web", ".", "Request", ")", ":", "assert", "self", ".", "is_cors_enabled_on_request", "(", "request", ")", "resource", "=", "self", ".", "_request_resource", "(", "request", ")", "resou...
Get stored CORS configuration for routing entity that handles specified request.
[ "Get", "stored", "CORS", "configuration", "for", "routing", "entity", "that", "handles", "specified", "request", "." ]
14affbd95c88c675eb513c1d295ede1897930f94
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/urldispatcher_router_adapter.py#L302-L324
train
HewlettPackard/python-hpOneView
hpOneView/resources/facilities/datacenters.py
Datacenters.add
def add(self, information, timeout=-1): """ Adds a data center resource based upon the attributes specified. Args: information: Data center information timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation ...
python
def add(self, information, timeout=-1): """ Adds a data center resource based upon the attributes specified. Args: information: Data center information timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation ...
[ "def", "add", "(", "self", ",", "information", ",", "timeout", "=", "-", "1", ")", ":", "return", "self", ".", "_client", ".", "create", "(", "information", ",", "timeout", "=", "timeout", ")" ]
Adds a data center resource based upon the attributes specified. Args: information: Data center information timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its completion. ...
[ "Adds", "a", "data", "center", "resource", "based", "upon", "the", "attributes", "specified", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/facilities/datacenters.py#L138-L150
train
HewlettPackard/python-hpOneView
hpOneView/resources/facilities/datacenters.py
Datacenters.update
def update(self, resource, timeout=-1): """ Updates the specified data center resource. Args: resource (dict): Object to update. timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just...
python
def update(self, resource, timeout=-1): """ Updates the specified data center resource. Args: resource (dict): Object to update. timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just...
[ "def", "update", "(", "self", ",", "resource", ",", "timeout", "=", "-", "1", ")", ":", "return", "self", ".", "_client", ".", "update", "(", "resource", ",", "timeout", "=", "timeout", ")" ]
Updates the specified data center resource. Args: resource (dict): Object to update. timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its completion. Returns: ...
[ "Updates", "the", "specified", "data", "center", "resource", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/facilities/datacenters.py#L152-L164
train
HewlettPackard/python-hpOneView
hpOneView/resources/facilities/datacenters.py
Datacenters.remove_all
def remove_all(self, filter, force=False, timeout=-1): """ Deletes the set of datacenters according to the specified parameters. A filter is required to identify the set of resources to be deleted. Args: filter: A general filter/query string to narrow the li...
python
def remove_all(self, filter, force=False, timeout=-1): """ Deletes the set of datacenters according to the specified parameters. A filter is required to identify the set of resources to be deleted. Args: filter: A general filter/query string to narrow the li...
[ "def", "remove_all", "(", "self", ",", "filter", ",", "force", "=", "False", ",", "timeout", "=", "-", "1", ")", ":", "return", "self", ".", "_client", ".", "delete_all", "(", "filter", "=", "filter", ",", "force", "=", "force", ",", "timeout", "=", ...
Deletes the set of datacenters according to the specified parameters. A filter is required to identify the set of resources to be deleted. Args: filter: A general filter/query string to narrow the list of items that will be removed. force: If se...
[ "Deletes", "the", "set", "of", "datacenters", "according", "to", "the", "specified", "parameters", ".", "A", "filter", "is", "required", "to", "identify", "the", "set", "of", "resources", "to", "be", "deleted", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/facilities/datacenters.py#L166-L184
train
HewlettPackard/python-hpOneView
hpOneView/resources/storage/drive_enclosures.py
DriveEnclosures.get_by
def get_by(self, field, value): """ Gets all drive enclosures that match the filter. The search is case-insensitive. Args: Field: field name to filter. Value: value to filter. Returns: list: A list of drive enclosures. """ re...
python
def get_by(self, field, value): """ Gets all drive enclosures that match the filter. The search is case-insensitive. Args: Field: field name to filter. Value: value to filter. Returns: list: A list of drive enclosures. """ re...
[ "def", "get_by", "(", "self", ",", "field", ",", "value", ")", ":", "return", "self", ".", "_client", ".", "get_by", "(", "field", "=", "field", ",", "value", "=", "value", ")" ]
Gets all drive enclosures that match the filter. The search is case-insensitive. Args: Field: field name to filter. Value: value to filter. Returns: list: A list of drive enclosures.
[ "Gets", "all", "drive", "enclosures", "that", "match", "the", "filter", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/drive_enclosures.py#L91-L104
train
HewlettPackard/python-hpOneView
hpOneView/resources/storage/drive_enclosures.py
DriveEnclosures.refresh_state
def refresh_state(self, id_or_uri, configuration, timeout=-1): """ Refreshes a drive enclosure. Args: id_or_uri: Can be either the resource ID or the resource URI. configuration: Configuration timeout: Timeout in seconds. Wait for task completion by default. ...
python
def refresh_state(self, id_or_uri, configuration, timeout=-1): """ Refreshes a drive enclosure. Args: id_or_uri: Can be either the resource ID or the resource URI. configuration: Configuration timeout: Timeout in seconds. Wait for task completion by default. ...
[ "def", "refresh_state", "(", "self", ",", "id_or_uri", ",", "configuration", ",", "timeout", "=", "-", "1", ")", ":", "uri", "=", "self", ".", "_client", ".", "build_uri", "(", "id_or_uri", ")", "+", "self", ".", "REFRESH_STATE_PATH", "return", "self", "...
Refreshes a drive enclosure. Args: id_or_uri: Can be either the resource ID or the resource URI. configuration: Configuration timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops ...
[ "Refreshes", "a", "drive", "enclosure", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/drive_enclosures.py#L119-L133
train
HewlettPackard/python-hpOneView
hpOneView/resources/uncategorized/os_deployment_servers.py
OsDeploymentServers.get_all
def get_all(self, start=0, count=-1, filter='', fields='', query='', sort='', view=''): """ Gets a list of Deployment Servers based on optional sorting and filtering, and constrained by start and count parameters. Args: start: The first item to return, using ...
python
def get_all(self, start=0, count=-1, filter='', fields='', query='', sort='', view=''): """ Gets a list of Deployment Servers based on optional sorting and filtering, and constrained by start and count parameters. Args: start: The first item to return, using ...
[ "def", "get_all", "(", "self", ",", "start", "=", "0", ",", "count", "=", "-", "1", ",", "filter", "=", "''", ",", "fields", "=", "''", ",", "query", "=", "''", ",", "sort", "=", "''", ",", "view", "=", "''", ")", ":", "return", "self", ".", ...
Gets a list of Deployment Servers based on optional sorting and filtering, and constrained by start and count parameters. Args: start: The first item to return, using 0-based indexing. If not specified, the default is 0 - start with the first available item. ...
[ "Gets", "a", "list", "of", "Deployment", "Servers", "based", "on", "optional", "sorting", "and", "filtering", "and", "constrained", "by", "start", "and", "count", "parameters", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/uncategorized/os_deployment_servers.py#L43-L75
train
HewlettPackard/python-hpOneView
hpOneView/resources/uncategorized/os_deployment_servers.py
OsDeploymentServers.delete
def delete(self, resource, force=False, timeout=-1): """ Deletes a Deployment Server object based on its UUID or URI. Args: resource (dict): Object to delete. force: If set to true, the operation completes despite any problems with ...
python
def delete(self, resource, force=False, timeout=-1): """ Deletes a Deployment Server object based on its UUID or URI. Args: resource (dict): Object to delete. force: If set to true, the operation completes despite any problems with ...
[ "def", "delete", "(", "self", ",", "resource", ",", "force", "=", "False", ",", "timeout", "=", "-", "1", ")", ":", "return", "self", ".", "_client", ".", "delete", "(", "resource", ",", "force", "=", "force", ",", "timeout", "=", "timeout", ")" ]
Deletes a Deployment Server object based on its UUID or URI. Args: resource (dict): Object to delete. force: If set to true, the operation completes despite any problems with network connectivity or errors on the resource itself. The def...
[ "Deletes", "a", "Deployment", "Server", "object", "based", "on", "its", "UUID", "or", "URI", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/uncategorized/os_deployment_servers.py#L153-L171
train
HewlettPackard/python-hpOneView
hpOneView/resources/uncategorized/os_deployment_servers.py
OsDeploymentServers.get_appliances
def get_appliances(self, start=0, count=-1, filter='', fields='', query='', sort='', view=''): """ Gets a list of all the Image Streamer resources based on optional sorting and filtering, and constrained by start and count parameters. Args: start: The first i...
python
def get_appliances(self, start=0, count=-1, filter='', fields='', query='', sort='', view=''): """ Gets a list of all the Image Streamer resources based on optional sorting and filtering, and constrained by start and count parameters. Args: start: The first i...
[ "def", "get_appliances", "(", "self", ",", "start", "=", "0", ",", "count", "=", "-", "1", ",", "filter", "=", "''", ",", "fields", "=", "''", ",", "query", "=", "''", ",", "sort", "=", "''", ",", "view", "=", "''", ")", ":", "uri", "=", "sel...
Gets a list of all the Image Streamer resources based on optional sorting and filtering, and constrained by start and count parameters. Args: start: The first item to return, using 0-based indexing. If not specified, the default is 0 - start with the first av...
[ "Gets", "a", "list", "of", "all", "the", "Image", "Streamer", "resources", "based", "on", "optional", "sorting", "and", "filtering", "and", "constrained", "by", "start", "and", "count", "parameters", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/uncategorized/os_deployment_servers.py#L183-L217
train
HewlettPackard/python-hpOneView
hpOneView/resources/uncategorized/os_deployment_servers.py
OsDeploymentServers.get_appliance
def get_appliance(self, id_or_uri, fields=''): """ Gets the particular Image Streamer resource based on its ID or URI. Args: id_or_uri: Can be either the Os Deployment Server ID or the URI fields: Specifies which fields should be returned ...
python
def get_appliance(self, id_or_uri, fields=''): """ Gets the particular Image Streamer resource based on its ID or URI. Args: id_or_uri: Can be either the Os Deployment Server ID or the URI fields: Specifies which fields should be returned ...
[ "def", "get_appliance", "(", "self", ",", "id_or_uri", ",", "fields", "=", "''", ")", ":", "uri", "=", "self", ".", "URI", "+", "'/image-streamer-appliances/'", "+", "extract_id_from_uri", "(", "id_or_uri", ")", "if", "fields", ":", "uri", "+=", "'?fields='"...
Gets the particular Image Streamer resource based on its ID or URI. Args: id_or_uri: Can be either the Os Deployment Server ID or the URI fields: Specifies which fields should be returned in the result. Returns: dict: Image Streamer ...
[ "Gets", "the", "particular", "Image", "Streamer", "resource", "based", "on", "its", "ID", "or", "URI", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/uncategorized/os_deployment_servers.py#L219-L236
train
HewlettPackard/python-hpOneView
hpOneView/resources/uncategorized/os_deployment_servers.py
OsDeploymentServers.get_appliance_by_name
def get_appliance_by_name(self, appliance_name): """ Gets the particular Image Streamer resource based on its name. Args: appliance_name: The Image Streamer resource name. Returns: dict: Image Streamer resource. """ appliances = ...
python
def get_appliance_by_name(self, appliance_name): """ Gets the particular Image Streamer resource based on its name. Args: appliance_name: The Image Streamer resource name. Returns: dict: Image Streamer resource. """ appliances = ...
[ "def", "get_appliance_by_name", "(", "self", ",", "appliance_name", ")", ":", "appliances", "=", "self", ".", "get_appliances", "(", ")", "if", "appliances", ":", "for", "appliance", "in", "appliances", ":", "if", "appliance", "[", "'name'", "]", "==", "appl...
Gets the particular Image Streamer resource based on its name. Args: appliance_name: The Image Streamer resource name. Returns: dict: Image Streamer resource.
[ "Gets", "the", "particular", "Image", "Streamer", "resource", "based", "on", "its", "name", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/uncategorized/os_deployment_servers.py#L238-L255
train
HewlettPackard/python-hpOneView
hpOneView/resources/storage/storage_systems.py
StorageSystems.get_managed_ports
def get_managed_ports(self, id_or_uri, port_id_or_uri=''): """ Gets all ports or a specific managed target port for the specified storage system. Args: id_or_uri: Can be either the storage system id or the storage system uri. port_id_or_uri: Can be either the port id or ...
python
def get_managed_ports(self, id_or_uri, port_id_or_uri=''): """ Gets all ports or a specific managed target port for the specified storage system. Args: id_or_uri: Can be either the storage system id or the storage system uri. port_id_or_uri: Can be either the port id or ...
[ "def", "get_managed_ports", "(", "self", ",", "id_or_uri", ",", "port_id_or_uri", "=", "''", ")", ":", "if", "port_id_or_uri", ":", "uri", "=", "self", ".", "_client", ".", "build_uri", "(", "port_id_or_uri", ")", "if", "\"/managedPorts\"", "not", "in", "uri...
Gets all ports or a specific managed target port for the specified storage system. Args: id_or_uri: Can be either the storage system id or the storage system uri. port_id_or_uri: Can be either the port id or the port uri. Returns: dict: Managed ports.
[ "Gets", "all", "ports", "or", "a", "specific", "managed", "target", "port", "for", "the", "specified", "storage", "system", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_systems.py#L163-L182
train
HewlettPackard/python-hpOneView
hpOneView/resources/storage/storage_systems.py
StorageSystems.get_by_ip_hostname
def get_by_ip_hostname(self, ip_hostname): """ Retrieve a storage system by its IP. Works only with API version <= 300. Args: ip_hostname: Storage system IP or hostname. Returns: dict """ resources = self._client.get_all() resou...
python
def get_by_ip_hostname(self, ip_hostname): """ Retrieve a storage system by its IP. Works only with API version <= 300. Args: ip_hostname: Storage system IP or hostname. Returns: dict """ resources = self._client.get_all() resou...
[ "def", "get_by_ip_hostname", "(", "self", ",", "ip_hostname", ")", ":", "resources", "=", "self", ".", "_client", ".", "get_all", "(", ")", "resources_filtered", "=", "[", "x", "for", "x", "in", "resources", "if", "x", "[", "'credentials'", "]", "[", "'i...
Retrieve a storage system by its IP. Works only with API version <= 300. Args: ip_hostname: Storage system IP or hostname. Returns: dict
[ "Retrieve", "a", "storage", "system", "by", "its", "IP", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_systems.py#L211-L230
train
HewlettPackard/python-hpOneView
hpOneView/resources/storage/storage_systems.py
StorageSystems.get_by_hostname
def get_by_hostname(self, hostname): """ Retrieve a storage system by its hostname. Works only in API500 onwards. Args: hostname: Storage system hostname. Returns: dict """ resources = self._client.get_all() resources_filtered =...
python
def get_by_hostname(self, hostname): """ Retrieve a storage system by its hostname. Works only in API500 onwards. Args: hostname: Storage system hostname. Returns: dict """ resources = self._client.get_all() resources_filtered =...
[ "def", "get_by_hostname", "(", "self", ",", "hostname", ")", ":", "resources", "=", "self", ".", "_client", ".", "get_all", "(", ")", "resources_filtered", "=", "[", "x", "for", "x", "in", "resources", "if", "x", "[", "'hostname'", "]", "==", "hostname",...
Retrieve a storage system by its hostname. Works only in API500 onwards. Args: hostname: Storage system hostname. Returns: dict
[ "Retrieve", "a", "storage", "system", "by", "its", "hostname", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_systems.py#L232-L251
train
HewlettPackard/python-hpOneView
hpOneView/resources/storage/storage_systems.py
StorageSystems.get_reachable_ports
def get_reachable_ports(self, id_or_uri, start=0, count=-1, filter='', query='', sort='', networks=[]): """ Gets the storage ports that are connected on the specified networks based on the storage system port's expected network connectivity. Returns: list: Reachable Storage ...
python
def get_reachable_ports(self, id_or_uri, start=0, count=-1, filter='', query='', sort='', networks=[]): """ Gets the storage ports that are connected on the specified networks based on the storage system port's expected network connectivity. Returns: list: Reachable Storage ...
[ "def", "get_reachable_ports", "(", "self", ",", "id_or_uri", ",", "start", "=", "0", ",", "count", "=", "-", "1", ",", "filter", "=", "''", ",", "query", "=", "''", ",", "sort", "=", "''", ",", "networks", "=", "[", "]", ")", ":", "uri", "=", "...
Gets the storage ports that are connected on the specified networks based on the storage system port's expected network connectivity. Returns: list: Reachable Storage Port List.
[ "Gets", "the", "storage", "ports", "that", "are", "connected", "on", "the", "specified", "networks", "based", "on", "the", "storage", "system", "port", "s", "expected", "network", "connectivity", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_systems.py#L253-L271
train
HewlettPackard/python-hpOneView
hpOneView/resources/storage/storage_systems.py
StorageSystems.get_templates
def get_templates(self, id_or_uri, start=0, count=-1, filter='', query='', sort=''): """ Gets a list of volume templates. Returns a list of storage templates belonging to the storage system. Returns: list: Storage Template List. """ uri = self._client.build_uri(id_or...
python
def get_templates(self, id_or_uri, start=0, count=-1, filter='', query='', sort=''): """ Gets a list of volume templates. Returns a list of storage templates belonging to the storage system. Returns: list: Storage Template List. """ uri = self._client.build_uri(id_or...
[ "def", "get_templates", "(", "self", ",", "id_or_uri", ",", "start", "=", "0", ",", "count", "=", "-", "1", ",", "filter", "=", "''", ",", "query", "=", "''", ",", "sort", "=", "''", ")", ":", "uri", "=", "self", ".", "_client", ".", "build_uri",...
Gets a list of volume templates. Returns a list of storage templates belonging to the storage system. Returns: list: Storage Template List.
[ "Gets", "a", "list", "of", "volume", "templates", ".", "Returns", "a", "list", "of", "storage", "templates", "belonging", "to", "the", "storage", "system", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_systems.py#L273-L282
train
HewlettPackard/python-hpOneView
hpOneView/resources/networking/fabrics.py
Fabrics.get_reserved_vlan_range
def get_reserved_vlan_range(self, id_or_uri): """ Gets the reserved vlan ID range for the fabric. Note: This method is only available on HPE Synergy. Args: id_or_uri: ID or URI of fabric. Returns: dict: vlan-pool """ uri = se...
python
def get_reserved_vlan_range(self, id_or_uri): """ Gets the reserved vlan ID range for the fabric. Note: This method is only available on HPE Synergy. Args: id_or_uri: ID or URI of fabric. Returns: dict: vlan-pool """ uri = se...
[ "def", "get_reserved_vlan_range", "(", "self", ",", "id_or_uri", ")", ":", "uri", "=", "self", ".", "_client", ".", "build_uri", "(", "id_or_uri", ")", "+", "\"/reserved-vlan-range\"", "return", "self", ".", "_client", ".", "get", "(", "uri", ")" ]
Gets the reserved vlan ID range for the fabric. Note: This method is only available on HPE Synergy. Args: id_or_uri: ID or URI of fabric. Returns: dict: vlan-pool
[ "Gets", "the", "reserved", "vlan", "ID", "range", "for", "the", "fabric", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/fabrics.py#L107-L121
train
HewlettPackard/python-hpOneView
hpOneView/resources/networking/fabrics.py
Fabrics.update_reserved_vlan_range
def update_reserved_vlan_range(self, id_or_uri, vlan_pool, force=False): """ Updates the reserved vlan ID range for the fabric. Note: This method is only available on HPE Synergy. Args: id_or_uri: ID or URI of fabric. vlan_pool (dict): vlan-pool data...
python
def update_reserved_vlan_range(self, id_or_uri, vlan_pool, force=False): """ Updates the reserved vlan ID range for the fabric. Note: This method is only available on HPE Synergy. Args: id_or_uri: ID or URI of fabric. vlan_pool (dict): vlan-pool data...
[ "def", "update_reserved_vlan_range", "(", "self", ",", "id_or_uri", ",", "vlan_pool", ",", "force", "=", "False", ")", ":", "uri", "=", "self", ".", "_client", ".", "build_uri", "(", "id_or_uri", ")", "+", "\"/reserved-vlan-range\"", "return", "self", ".", "...
Updates the reserved vlan ID range for the fabric. Note: This method is only available on HPE Synergy. Args: id_or_uri: ID or URI of fabric. vlan_pool (dict): vlan-pool data to update. force: If set to true, the operation completes despite any problems ...
[ "Updates", "the", "reserved", "vlan", "ID", "range", "for", "the", "fabric", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/fabrics.py#L123-L140
train
HewlettPackard/python-hpOneView
hpOneView/resources/security/roles.py
Roles.get
def get(self, name_or_uri): """ Get the role by its URI or Name. Args: name_or_uri: Can be either the Name or the URI. Returns: dict: Role """ name_or_uri = quote(name_or_uri) return self._client.get(name_or_uri)
python
def get(self, name_or_uri): """ Get the role by its URI or Name. Args: name_or_uri: Can be either the Name or the URI. Returns: dict: Role """ name_or_uri = quote(name_or_uri) return self._client.get(name_or_uri)
[ "def", "get", "(", "self", ",", "name_or_uri", ")", ":", "name_or_uri", "=", "quote", "(", "name_or_uri", ")", "return", "self", ".", "_client", ".", "get", "(", "name_or_uri", ")" ]
Get the role by its URI or Name. Args: name_or_uri: Can be either the Name or the URI. Returns: dict: Role
[ "Get", "the", "role", "by", "its", "URI", "or", "Name", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/security/roles.py#L74-L86
train
HewlettPackard/python-hpOneView
hpOneView/resources/storage/sas_logical_jbods.py
SasLogicalJbods.get_drives
def get_drives(self, id_or_uri): """ Gets the list of drives allocated to this SAS logical JBOD. Args: id_or_uri: Can be either the SAS logical JBOD ID or the SAS logical JBOD URI. Returns: list: A list of Drives """ uri = self._client.build_uri(...
python
def get_drives(self, id_or_uri): """ Gets the list of drives allocated to this SAS logical JBOD. Args: id_or_uri: Can be either the SAS logical JBOD ID or the SAS logical JBOD URI. Returns: list: A list of Drives """ uri = self._client.build_uri(...
[ "def", "get_drives", "(", "self", ",", "id_or_uri", ")", ":", "uri", "=", "self", ".", "_client", ".", "build_uri", "(", "id_or_uri", "=", "id_or_uri", ")", "+", "self", ".", "DRIVES_PATH", "return", "self", ".", "_client", ".", "get", "(", "id_or_uri", ...
Gets the list of drives allocated to this SAS logical JBOD. Args: id_or_uri: Can be either the SAS logical JBOD ID or the SAS logical JBOD URI. Returns: list: A list of Drives
[ "Gets", "the", "list", "of", "drives", "allocated", "to", "this", "SAS", "logical", "JBOD", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/sas_logical_jbods.py#L104-L115
train
HewlettPackard/python-hpOneView
hpOneView/resources/servers/id_pools_ranges.py
IdPoolsRanges.enable
def enable(self, information, id_or_uri, timeout=-1): """ Enables or disables a range. Args: information (dict): Information to update. id_or_uri: ID or URI of range. timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort...
python
def enable(self, information, id_or_uri, timeout=-1): """ Enables or disables a range. Args: information (dict): Information to update. id_or_uri: ID or URI of range. timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort...
[ "def", "enable", "(", "self", ",", "information", ",", "id_or_uri", ",", "timeout", "=", "-", "1", ")", ":", "uri", "=", "self", ".", "_client", ".", "build_uri", "(", "id_or_uri", ")", "return", "self", ".", "_client", ".", "update", "(", "information...
Enables or disables a range. Args: information (dict): Information to update. id_or_uri: ID or URI of range. timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its c...
[ "Enables", "or", "disables", "a", "range", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/id_pools_ranges.py#L86-L102
train
HewlettPackard/python-hpOneView
hpOneView/resources/servers/id_pools_ranges.py
IdPoolsRanges.get_allocated_fragments
def get_allocated_fragments(self, id_or_uri, count=-1, start=0): """ Gets all fragments that have been allocated in range. Args: id_or_uri: ID or URI of range. count: The number of resources to return. A count of -1 requests all items. Th...
python
def get_allocated_fragments(self, id_or_uri, count=-1, start=0): """ Gets all fragments that have been allocated in range. Args: id_or_uri: ID or URI of range. count: The number of resources to return. A count of -1 requests all items. Th...
[ "def", "get_allocated_fragments", "(", "self", ",", "id_or_uri", ",", "count", "=", "-", "1", ",", "start", "=", "0", ")", ":", "uri", "=", "self", ".", "_client", ".", "build_uri", "(", "id_or_uri", ")", "+", "\"/allocated-fragments?start={0}&count={1}\"", ...
Gets all fragments that have been allocated in range. Args: id_or_uri: ID or URI of range. count: The number of resources to return. A count of -1 requests all items. The actual number of items in the response may differ from the request...
[ "Gets", "all", "fragments", "that", "have", "been", "allocated", "in", "range", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/id_pools_ranges.py#L123-L142
train
HewlettPackard/python-hpOneView
hpOneView/resources/networking/logical_interconnects.py
LogicalInterconnects.get_all
def get_all(self, start=0, count=-1, sort=''): """ Gets a list of logical interconnects based on optional sorting and filtering and is constrained by start and count parameters. Args: start: The first item to return, using 0-based indexing. If...
python
def get_all(self, start=0, count=-1, sort=''): """ Gets a list of logical interconnects based on optional sorting and filtering and is constrained by start and count parameters. Args: start: The first item to return, using 0-based indexing. If...
[ "def", "get_all", "(", "self", ",", "start", "=", "0", ",", "count", "=", "-", "1", ",", "sort", "=", "''", ")", ":", "return", "self", ".", "_helper", ".", "get_all", "(", "start", ",", "count", ",", "sort", "=", "sort", ")" ]
Gets a list of logical interconnects based on optional sorting and filtering and is constrained by start and count parameters. Args: start: The first item to return, using 0-based indexing. If not specified, the default is 0 - start with the first available i...
[ "Gets", "a", "list", "of", "logical", "interconnects", "based", "on", "optional", "sorting", "and", "filtering", "and", "is", "constrained", "by", "start", "and", "count", "parameters", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L89-L109
train
HewlettPackard/python-hpOneView
hpOneView/resources/networking/logical_interconnects.py
LogicalInterconnects.update_compliance
def update_compliance(self, timeout=-1): """ Returns logical interconnects to a consistent state. The current logical interconnect state is compared to the associated logical interconnect group. Any differences identified are corrected, bringing the logical interconnect back to a consis...
python
def update_compliance(self, timeout=-1): """ Returns logical interconnects to a consistent state. The current logical interconnect state is compared to the associated logical interconnect group. Any differences identified are corrected, bringing the logical interconnect back to a consis...
[ "def", "update_compliance", "(", "self", ",", "timeout", "=", "-", "1", ")", ":", "uri", "=", "\"{}/compliance\"", ".", "format", "(", "self", ".", "data", "[", "\"uri\"", "]", ")", "return", "self", ".", "_helper", ".", "update", "(", "None", ",", "...
Returns logical interconnects to a consistent state. The current logical interconnect state is compared to the associated logical interconnect group. Any differences identified are corrected, bringing the logical interconnect back to a consistent state. Changes are asynchronously applied to all...
[ "Returns", "logical", "interconnects", "to", "a", "consistent", "state", ".", "The", "current", "logical", "interconnect", "state", "is", "compared", "to", "the", "associated", "logical", "interconnect", "group", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L131-L150
train