partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
test
Striplog.find
Look for a regex expression in the descriptions of the striplog. If there's no description, it looks in the summaries. If you pass a Component, then it will search the components, not the descriptions or summaries. Case insensitive. Args: search_term (string or Com...
striplog/striplog.py
def find(self, search_term, index=False): """ Look for a regex expression in the descriptions of the striplog. If there's no description, it looks in the summaries. If you pass a Component, then it will search the components, not the descriptions or summaries. Case inse...
def find(self, search_term, index=False): """ Look for a regex expression in the descriptions of the striplog. If there's no description, it looks in the summaries. If you pass a Component, then it will search the components, not the descriptions or summaries. Case inse...
[ "Look", "for", "a", "regex", "expression", "in", "the", "descriptions", "of", "the", "striplog", ".", "If", "there", "s", "no", "description", "it", "looks", "in", "the", "summaries", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L1637-L1670
[ "def", "find", "(", "self", ",", "search_term", ",", "index", "=", "False", ")", ":", "hits", "=", "[", "]", "for", "i", ",", "iv", "in", "enumerate", "(", "self", ")", ":", "try", ":", "search_text", "=", "iv", ".", "description", "or", "iv", "....
8033b673a151f96c29802b43763e863519a3124c
test
Striplog.__find_incongruities
Private method. Finds gaps and overlaps in a striplog. Called by find_gaps() and find_overlaps(). Args: op (operator): ``operator.gt`` or ``operator.lt`` index (bool): If ``True``, returns indices of intervals with gaps after them. Returns: Strip...
striplog/striplog.py
def __find_incongruities(self, op, index): """ Private method. Finds gaps and overlaps in a striplog. Called by find_gaps() and find_overlaps(). Args: op (operator): ``operator.gt`` or ``operator.lt`` index (bool): If ``True``, returns indices of intervals with ...
def __find_incongruities(self, op, index): """ Private method. Finds gaps and overlaps in a striplog. Called by find_gaps() and find_overlaps(). Args: op (operator): ``operator.gt`` or ``operator.lt`` index (bool): If ``True``, returns indices of intervals with ...
[ "Private", "method", ".", "Finds", "gaps", "and", "overlaps", "in", "a", "striplog", ".", "Called", "by", "find_gaps", "()", "and", "find_overlaps", "()", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L1672-L1711
[ "def", "__find_incongruities", "(", "self", ",", "op", ",", "index", ")", ":", "if", "len", "(", "self", ")", "==", "1", ":", "return", "hits", "=", "[", "]", "intervals", "=", "[", "]", "if", "self", ".", "order", "==", "'depth'", ":", "one", ",...
8033b673a151f96c29802b43763e863519a3124c
test
Striplog.find_overlaps
Find overlaps in a striplog. Args: index (bool): If True, returns indices of intervals with gaps after them. Returns: Striplog: A striplog of all the overlaps as intervals.
striplog/striplog.py
def find_overlaps(self, index=False): """ Find overlaps in a striplog. Args: index (bool): If True, returns indices of intervals with gaps after them. Returns: Striplog: A striplog of all the overlaps as intervals. """ return self.__f...
def find_overlaps(self, index=False): """ Find overlaps in a striplog. Args: index (bool): If True, returns indices of intervals with gaps after them. Returns: Striplog: A striplog of all the overlaps as intervals. """ return self.__f...
[ "Find", "overlaps", "in", "a", "striplog", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L1713-L1724
[ "def", "find_overlaps", "(", "self", ",", "index", "=", "False", ")", ":", "return", "self", ".", "__find_incongruities", "(", "op", "=", "operator", ".", "gt", ",", "index", "=", "index", ")" ]
8033b673a151f96c29802b43763e863519a3124c
test
Striplog.find_gaps
Finds gaps in a striplog. Args: index (bool): If True, returns indices of intervals with gaps after them. Returns: Striplog: A striplog of all the gaps. A sort of anti-striplog.
striplog/striplog.py
def find_gaps(self, index=False): """ Finds gaps in a striplog. Args: index (bool): If True, returns indices of intervals with gaps after them. Returns: Striplog: A striplog of all the gaps. A sort of anti-striplog. """ return self.__...
def find_gaps(self, index=False): """ Finds gaps in a striplog. Args: index (bool): If True, returns indices of intervals with gaps after them. Returns: Striplog: A striplog of all the gaps. A sort of anti-striplog. """ return self.__...
[ "Finds", "gaps", "in", "a", "striplog", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L1726-L1737
[ "def", "find_gaps", "(", "self", ",", "index", "=", "False", ")", ":", "return", "self", ".", "__find_incongruities", "(", "op", "=", "operator", ".", "lt", ",", "index", "=", "index", ")" ]
8033b673a151f96c29802b43763e863519a3124c
test
Striplog.prune
Remove intervals below a certain limit thickness. In place. Args: limit (float): Anything thinner than this will be pruned. n (int): The n thinnest beds will be pruned. percentile (float): The thinnest specified percentile will be pruned. keep_end...
striplog/striplog.py
def prune(self, limit=None, n=None, percentile=None, keep_ends=False): """ Remove intervals below a certain limit thickness. In place. Args: limit (float): Anything thinner than this will be pruned. n (int): The n thinnest beds will be pruned. percentile (flo...
def prune(self, limit=None, n=None, percentile=None, keep_ends=False): """ Remove intervals below a certain limit thickness. In place. Args: limit (float): Anything thinner than this will be pruned. n (int): The n thinnest beds will be pruned. percentile (flo...
[ "Remove", "intervals", "below", "a", "certain", "limit", "thickness", ".", "In", "place", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L1739-L1773
[ "def", "prune", "(", "self", ",", "limit", "=", "None", ",", "n", "=", "None", ",", "percentile", "=", "None", ",", "keep_ends", "=", "False", ")", ":", "strip", "=", "self", ".", "copy", "(", ")", "if", "not", "(", "limit", "or", "n", "or", "p...
8033b673a151f96c29802b43763e863519a3124c
test
Striplog.anneal
Fill in empty intervals by growing from top and base. Note that this operation happens in-place and destroys any information about the ``Position`` (e.g. metadata associated with the top or base). See GitHub issue #54.
striplog/striplog.py
def anneal(self): """ Fill in empty intervals by growing from top and base. Note that this operation happens in-place and destroys any information about the ``Position`` (e.g. metadata associated with the top or base). See GitHub issue #54. """ strip = self.copy(...
def anneal(self): """ Fill in empty intervals by growing from top and base. Note that this operation happens in-place and destroys any information about the ``Position`` (e.g. metadata associated with the top or base). See GitHub issue #54. """ strip = self.copy(...
[ "Fill", "in", "empty", "intervals", "by", "growing", "from", "top", "and", "base", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L1775-L1803
[ "def", "anneal", "(", "self", ")", ":", "strip", "=", "self", ".", "copy", "(", ")", "gaps", "=", "strip", ".", "find_gaps", "(", "index", "=", "True", ")", "if", "not", "gaps", ":", "return", "for", "gap", "in", "gaps", ":", "before", "=", "stri...
8033b673a151f96c29802b43763e863519a3124c
test
Striplog.fill
Fill gaps with the component provided. Example t = s.fill(Component({'lithology': 'cheese'}))
striplog/striplog.py
def fill(self, component=None): """ Fill gaps with the component provided. Example t = s.fill(Component({'lithology': 'cheese'})) """ c = [component] if component is not None else [] # Make the intervals to go in the gaps. gaps = self.find_gaps() ...
def fill(self, component=None): """ Fill gaps with the component provided. Example t = s.fill(Component({'lithology': 'cheese'})) """ c = [component] if component is not None else [] # Make the intervals to go in the gaps. gaps = self.find_gaps() ...
[ "Fill", "gaps", "with", "the", "component", "provided", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L1805-L1821
[ "def", "fill", "(", "self", ",", "component", "=", "None", ")", ":", "c", "=", "[", "component", "]", "if", "component", "is", "not", "None", "else", "[", "]", "# Make the intervals to go in the gaps.", "gaps", "=", "self", ".", "find_gaps", "(", ")", "i...
8033b673a151f96c29802b43763e863519a3124c
test
Striplog.union
Makes a striplog of all unions. Args: Striplog. The striplog instance to union with. Returns: Striplog. The result of the union.
striplog/striplog.py
def union(self, other): """ Makes a striplog of all unions. Args: Striplog. The striplog instance to union with. Returns: Striplog. The result of the union. """ if not isinstance(other, self.__class__): m = "You can only union striplo...
def union(self, other): """ Makes a striplog of all unions. Args: Striplog. The striplog instance to union with. Returns: Striplog. The result of the union. """ if not isinstance(other, self.__class__): m = "You can only union striplo...
[ "Makes", "a", "striplog", "of", "all", "unions", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L1823-L1843
[ "def", "union", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "self", ".", "__class__", ")", ":", "m", "=", "\"You can only union striplogs with each other.\"", "raise", "StriplogError", "(", "m", ")", "result", "=", "[",...
8033b673a151f96c29802b43763e863519a3124c
test
Striplog.intersect
Makes a striplog of all intersections. Args: Striplog. The striplog instance to intersect with. Returns: Striplog. The result of the intersection.
striplog/striplog.py
def intersect(self, other): """ Makes a striplog of all intersections. Args: Striplog. The striplog instance to intersect with. Returns: Striplog. The result of the intersection. """ if not isinstance(other, self.__class__): m = "You ...
def intersect(self, other): """ Makes a striplog of all intersections. Args: Striplog. The striplog instance to intersect with. Returns: Striplog. The result of the intersection. """ if not isinstance(other, self.__class__): m = "You ...
[ "Makes", "a", "striplog", "of", "all", "intersections", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L1845-L1867
[ "def", "intersect", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "self", ".", "__class__", ")", ":", "m", "=", "\"You can only intersect striplogs with each other.\"", "raise", "StriplogError", "(", "m", ")", "result", "="...
8033b673a151f96c29802b43763e863519a3124c
test
Striplog.merge_overlaps
Merges overlaps by merging overlapping Intervals. The function takes no arguments and returns ``None``. It operates on the striplog 'in place' TODO: This function will not work if any interval overlaps more than one other intervals at either its base or top.
striplog/striplog.py
def merge_overlaps(self): """ Merges overlaps by merging overlapping Intervals. The function takes no arguments and returns ``None``. It operates on the striplog 'in place' TODO: This function will not work if any interval overlaps more than one other intervals at e...
def merge_overlaps(self): """ Merges overlaps by merging overlapping Intervals. The function takes no arguments and returns ``None``. It operates on the striplog 'in place' TODO: This function will not work if any interval overlaps more than one other intervals at e...
[ "Merges", "overlaps", "by", "merging", "overlapping", "Intervals", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L1869-L1900
[ "def", "merge_overlaps", "(", "self", ")", ":", "overlaps", "=", "np", ".", "array", "(", "self", ".", "find_overlaps", "(", "index", "=", "True", ")", ")", "if", "not", "overlaps", ".", "any", "(", ")", ":", "return", "for", "overlap", "in", "overla...
8033b673a151f96c29802b43763e863519a3124c
test
Striplog.merge_neighbours
Makes a new striplog in which matching neighbours (for which the components are the same) are unioned. That is, they are replaced by a new Interval with the same top as the uppermost and the same bottom as the lowermost. Args strict (bool): If True, then all of the component...
striplog/striplog.py
def merge_neighbours(self, strict=True): """ Makes a new striplog in which matching neighbours (for which the components are the same) are unioned. That is, they are replaced by a new Interval with the same top as the uppermost and the same bottom as the lowermost. Args ...
def merge_neighbours(self, strict=True): """ Makes a new striplog in which matching neighbours (for which the components are the same) are unioned. That is, they are replaced by a new Interval with the same top as the uppermost and the same bottom as the lowermost. Args ...
[ "Makes", "a", "new", "striplog", "in", "which", "matching", "neighbours", "(", "for", "which", "the", "components", "are", "the", "same", ")", "are", "unioned", ".", "That", "is", "they", "are", "replaced", "by", "a", "new", "Interval", "with", "the", "s...
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L1902-L1939
[ "def", "merge_neighbours", "(", "self", ",", "strict", "=", "True", ")", ":", "new_strip", "=", "[", "self", "[", "0", "]", ".", "copy", "(", ")", "]", "for", "lower", "in", "self", "[", "1", ":", "]", ":", "# Determine if touching.", "touching", "="...
8033b673a151f96c29802b43763e863519a3124c
test
Striplog.thickest
Returns the thickest interval(s) as a striplog. Args: n (int): The number of thickest intervals to return. Default: 1. index (bool): If True, only the indices of the intervals are returned. You can use this to index into the striplog. Returns: Interv...
striplog/striplog.py
def thickest(self, n=1, index=False): """ Returns the thickest interval(s) as a striplog. Args: n (int): The number of thickest intervals to return. Default: 1. index (bool): If True, only the indices of the intervals are returned. You can use this to ind...
def thickest(self, n=1, index=False): """ Returns the thickest interval(s) as a striplog. Args: n (int): The number of thickest intervals to return. Default: 1. index (bool): If True, only the indices of the intervals are returned. You can use this to ind...
[ "Returns", "the", "thickest", "interval", "(", "s", ")", "as", "a", "striplog", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L1941-L1964
[ "def", "thickest", "(", "self", ",", "n", "=", "1", ",", "index", "=", "False", ")", ":", "s", "=", "sorted", "(", "range", "(", "len", "(", "self", ")", ")", ",", "key", "=", "lambda", "k", ":", "self", "[", "k", "]", ".", "thickness", ")", ...
8033b673a151f96c29802b43763e863519a3124c
test
Striplog.hist
Plots a histogram and returns the data for it. Args: lumping (str): If given, the bins will be lumped based on this attribute of the primary components of the intervals encountered. summary (bool): If True, the summaries of the components are ...
striplog/striplog.py
def hist(self, lumping=None, summary=False, sort=True, plot=True, legend=None, ax=None ): """ Plots a histogram and returns the data for it. Args: lumping (str): If given, the bins will be lum...
def hist(self, lumping=None, summary=False, sort=True, plot=True, legend=None, ax=None ): """ Plots a histogram and returns the data for it. Args: lumping (str): If given, the bins will be lum...
[ "Plots", "a", "histogram", "and", "returns", "the", "data", "for", "it", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L1994-L2070
[ "def", "hist", "(", "self", ",", "lumping", "=", "None", ",", "summary", "=", "False", ",", "sort", "=", "True", ",", "plot", "=", "True", ",", "legend", "=", "None", ",", "ax", "=", "None", ")", ":", "# This seems like overkill, but collecting all this st...
8033b673a151f96c29802b43763e863519a3124c
test
Striplog.bar
Make a bar plot of thickness per interval. Args: height (str): The property of the primary component to plot. sort (bool or function): Either pass a boolean indicating whether to reverse sort by thickness, or pass a function to be used as the sort...
striplog/striplog.py
def bar(self, height='thickness', sort=False, reverse=False, legend=None, ax=None, figsize=None, **kwargs): """ Make a bar plot of thickness per interval. Args: height (str): The property of the primary component to plot. sort (bool or function): Eith...
def bar(self, height='thickness', sort=False, reverse=False, legend=None, ax=None, figsize=None, **kwargs): """ Make a bar plot of thickness per interval. Args: height (str): The property of the primary component to plot. sort (bool or function): Eith...
[ "Make", "a", "bar", "plot", "of", "thickness", "per", "interval", ".", "Args", ":", "height", "(", "str", ")", ":", "The", "property", "of", "the", "primary", "component", "to", "plot", ".", "sort", "(", "bool", "or", "function", ")", ":", "Either", ...
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L2074-L2122
[ "def", "bar", "(", "self", ",", "height", "=", "'thickness'", ",", "sort", "=", "False", ",", "reverse", "=", "False", ",", "legend", "=", "None", ",", "ax", "=", "None", ",", "figsize", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "sort...
8033b673a151f96c29802b43763e863519a3124c
test
Striplog.invert
Inverts the striplog, changing its order and the order of its contents. Operates in place by default. Args: copy (bool): Whether to operate in place or make a copy. Returns: None if operating in-place, or an inverted copy of the striplog if not.
striplog/striplog.py
def invert(self, copy=False): """ Inverts the striplog, changing its order and the order of its contents. Operates in place by default. Args: copy (bool): Whether to operate in place or make a copy. Returns: None if operating in-place, or an inverted co...
def invert(self, copy=False): """ Inverts the striplog, changing its order and the order of its contents. Operates in place by default. Args: copy (bool): Whether to operate in place or make a copy. Returns: None if operating in-place, or an inverted co...
[ "Inverts", "the", "striplog", "changing", "its", "order", "and", "the", "order", "of", "its", "contents", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L2124-L2145
[ "def", "invert", "(", "self", ",", "copy", "=", "False", ")", ":", "if", "copy", ":", "return", "Striplog", "(", "[", "i", ".", "invert", "(", "copy", "=", "True", ")", "for", "i", "in", "self", "]", ")", "else", ":", "for", "i", "in", "self", ...
8033b673a151f96c29802b43763e863519a3124c
test
Striplog.crop
Crop to a new depth range. Args: extent (tuple): The new start and stop depth. Must be 'inside' existing striplog. copy (bool): Whether to operate in place or make a copy. Returns: Operates in place by deault; if copy is True, returns a striplog.
striplog/striplog.py
def crop(self, extent, copy=False): """ Crop to a new depth range. Args: extent (tuple): The new start and stop depth. Must be 'inside' existing striplog. copy (bool): Whether to operate in place or make a copy. Returns: Operates in p...
def crop(self, extent, copy=False): """ Crop to a new depth range. Args: extent (tuple): The new start and stop depth. Must be 'inside' existing striplog. copy (bool): Whether to operate in place or make a copy. Returns: Operates in p...
[ "Crop", "to", "a", "new", "depth", "range", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L2147-L2183
[ "def", "crop", "(", "self", ",", "extent", ",", "copy", "=", "False", ")", ":", "try", ":", "if", "extent", "[", "0", "]", "is", "None", ":", "extent", "=", "(", "self", ".", "start", ".", "z", ",", "extent", "[", "1", "]", ")", "if", "extent...
8033b673a151f96c29802b43763e863519a3124c
test
Striplog.quality
Run a series of tests and return the corresponding results. Based on curve testing for ``welly``. Args: tests (list): a list of functions. Returns: list. The results. Stick to booleans (True = pass) or ints.
striplog/striplog.py
def quality(self, tests, alias=None): """ Run a series of tests and return the corresponding results. Based on curve testing for ``welly``. Args: tests (list): a list of functions. Returns: list. The results. Stick to booleans (True = pass) or ints. ...
def quality(self, tests, alias=None): """ Run a series of tests and return the corresponding results. Based on curve testing for ``welly``. Args: tests (list): a list of functions. Returns: list. The results. Stick to booleans (True = pass) or ints. ...
[ "Run", "a", "series", "of", "tests", "and", "return", "the", "corresponding", "results", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L2185-L2219
[ "def", "quality", "(", "self", ",", "tests", ",", "alias", "=", "None", ")", ":", "# This is hacky... striplog should probably merge with welly...", "# Ignore aliases", "alias", "=", "alias", "or", "{", "}", "alias", "=", "alias", ".", "get", "(", "'striplog'", ...
8033b673a151f96c29802b43763e863519a3124c
test
dict_repr_html
Jupyter Notebook magic repr function.
striplog/utils.py
def dict_repr_html(dictionary): """ Jupyter Notebook magic repr function. """ rows = '' s = '<tr><td><strong>{k}</strong></td><td>{v}</td></tr>' for k, v in dictionary.items(): rows += s.format(k=k, v=v) html = '<table>{}</table>'.format(rows) return html
def dict_repr_html(dictionary): """ Jupyter Notebook magic repr function. """ rows = '' s = '<tr><td><strong>{k}</strong></td><td>{v}</td></tr>' for k, v in dictionary.items(): rows += s.format(k=k, v=v) html = '<table>{}</table>'.format(rows) return html
[ "Jupyter", "Notebook", "magic", "repr", "function", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/utils.py#L123-L132
[ "def", "dict_repr_html", "(", "dictionary", ")", ":", "rows", "=", "''", "s", "=", "'<tr><td><strong>{k}</strong></td><td>{v}</td></tr>'", "for", "k", ",", "v", "in", "dictionary", ".", "items", "(", ")", ":", "rows", "+=", "s", ".", "format", "(", "k", "=...
8033b673a151f96c29802b43763e863519a3124c
test
hex_to_name
Convert hex to a color name, using matplotlib's colour names. Args: hexx (str): A hexadecimal colour, starting with '#'. Returns: str: The name of the colour, or None if not found.
striplog/utils.py
def hex_to_name(hexx): """ Convert hex to a color name, using matplotlib's colour names. Args: hexx (str): A hexadecimal colour, starting with '#'. Returns: str: The name of the colour, or None if not found. """ for n, h in defaults.COLOURS.items(): if (len(n) > 1) and ...
def hex_to_name(hexx): """ Convert hex to a color name, using matplotlib's colour names. Args: hexx (str): A hexadecimal colour, starting with '#'. Returns: str: The name of the colour, or None if not found. """ for n, h in defaults.COLOURS.items(): if (len(n) > 1) and ...
[ "Convert", "hex", "to", "a", "color", "name", "using", "matplotlib", "s", "colour", "names", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/utils.py#L179-L192
[ "def", "hex_to_name", "(", "hexx", ")", ":", "for", "n", ",", "h", "in", "defaults", ".", "COLOURS", ".", "items", "(", ")", ":", "if", "(", "len", "(", "n", ")", ">", "1", ")", "and", "(", "h", "==", "hexx", ".", "upper", "(", ")", ")", ":...
8033b673a151f96c29802b43763e863519a3124c
test
rgb_to_hex
Utility function to convert (r,g,b) triples to hex. http://ageo.co/1CFxXpO Args: rgb (tuple): A sequence of RGB values in the range 0-255 or 0-1. Returns: str: The hex code for the colour.
striplog/utils.py
def rgb_to_hex(rgb): """ Utility function to convert (r,g,b) triples to hex. http://ageo.co/1CFxXpO Args: rgb (tuple): A sequence of RGB values in the range 0-255 or 0-1. Returns: str: The hex code for the colour. """ r, g, b = rgb[:3] if (r < 0) or (g < 0) or (b < 0)...
def rgb_to_hex(rgb): """ Utility function to convert (r,g,b) triples to hex. http://ageo.co/1CFxXpO Args: rgb (tuple): A sequence of RGB values in the range 0-255 or 0-1. Returns: str: The hex code for the colour. """ r, g, b = rgb[:3] if (r < 0) or (g < 0) or (b < 0)...
[ "Utility", "function", "to", "convert", "(", "r", "g", "b", ")", "triples", "to", "hex", ".", "http", ":", "//", "ageo", ".", "co", "/", "1CFxXpO", "Args", ":", "rgb", "(", "tuple", ")", ":", "A", "sequence", "of", "RGB", "values", "in", "the", "...
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/utils.py#L208-L231
[ "def", "rgb_to_hex", "(", "rgb", ")", ":", "r", ",", "g", ",", "b", "=", "rgb", "[", ":", "3", "]", "if", "(", "r", "<", "0", ")", "or", "(", "g", "<", "0", ")", "or", "(", "b", "<", "0", ")", ":", "raise", "Exception", "(", "\"RGB values...
8033b673a151f96c29802b43763e863519a3124c
test
loglike_from_image
Get a log-like stream of RGB values from an image. Args: filename (str): The filename of a PNG image. offset (Number): If < 1, interpreted as proportion of way across the image. If > 1, interpreted as pixels from left. Returns: ndarray: A 2d array (a column of RGB triples) ...
striplog/utils.py
def loglike_from_image(filename, offset): """ Get a log-like stream of RGB values from an image. Args: filename (str): The filename of a PNG image. offset (Number): If < 1, interpreted as proportion of way across the image. If > 1, interpreted as pixels from left. Returns: ...
def loglike_from_image(filename, offset): """ Get a log-like stream of RGB values from an image. Args: filename (str): The filename of a PNG image. offset (Number): If < 1, interpreted as proportion of way across the image. If > 1, interpreted as pixels from left. Returns: ...
[ "Get", "a", "log", "-", "like", "stream", "of", "RGB", "values", "from", "an", "image", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/utils.py#L280-L303
[ "def", "loglike_from_image", "(", "filename", ",", "offset", ")", ":", "im", "=", "plt", ".", "imread", "(", "filename", ")", "if", "offset", "<", "1", ":", "col", "=", "int", "(", "im", ".", "shape", "[", "1", "]", "*", "offset", ")", "else", ":...
8033b673a151f96c29802b43763e863519a3124c
test
tops_from_loglike
Take a log-like stream of numbers or strings, and return two arrays: one of the tops (changes), and one of the values from the stream. Args: loglike (array-like): The input stream of loglike data. offset (int): Offset (down) from top at which to get lithology, to be sure of getting ...
striplog/utils.py
def tops_from_loglike(a, offset=0, null=None): """ Take a log-like stream of numbers or strings, and return two arrays: one of the tops (changes), and one of the values from the stream. Args: loglike (array-like): The input stream of loglike data. offset (int): Offset (down) from top at...
def tops_from_loglike(a, offset=0, null=None): """ Take a log-like stream of numbers or strings, and return two arrays: one of the tops (changes), and one of the values from the stream. Args: loglike (array-like): The input stream of loglike data. offset (int): Offset (down) from top at...
[ "Take", "a", "log", "-", "like", "stream", "of", "numbers", "or", "strings", "and", "return", "two", "arrays", ":", "one", "of", "the", "tops", "(", "changes", ")", "and", "one", "of", "the", "values", "from", "the", "stream", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/utils.py#L306-L349
[ "def", "tops_from_loglike", "(", "a", ",", "offset", "=", "0", ",", "null", "=", "None", ")", ":", "a", "=", "np", ".", "copy", "(", "a", ")", "try", ":", "contains_nans", "=", "np", ".", "isnan", "(", "a", ")", ".", "any", "(", ")", "except", ...
8033b673a151f96c29802b43763e863519a3124c
test
axis_transform
http://stackoverflow.com/questions/29107800 inverse = False : Axis => Data = True : Data => Axis
striplog/utils.py
def axis_transform(ax, x, y, xlim=None, ylim=None, inverse=False): """ http://stackoverflow.com/questions/29107800 inverse = False : Axis => Data = True : Data => Axis """ xlim = xlim or ax.get_xlim() ylim = ylim or ax.get_ylim() xdelta = xlim[1] - xlim[0] ydelta = ylim[1]...
def axis_transform(ax, x, y, xlim=None, ylim=None, inverse=False): """ http://stackoverflow.com/questions/29107800 inverse = False : Axis => Data = True : Data => Axis """ xlim = xlim or ax.get_xlim() ylim = ylim or ax.get_ylim() xdelta = xlim[1] - xlim[0] ydelta = ylim[1]...
[ "http", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "29107800" ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/utils.py#L389-L411
[ "def", "axis_transform", "(", "ax", ",", "x", ",", "y", ",", "xlim", "=", "None", ",", "ylim", "=", "None", ",", "inverse", "=", "False", ")", ":", "xlim", "=", "xlim", "or", "ax", ".", "get_xlim", "(", ")", "ylim", "=", "ylim", "or", "ax", "."...
8033b673a151f96c29802b43763e863519a3124c
test
CustomFormatter.get_field
Return an underscore if the attribute is absent. Not all components have the same attributes.
striplog/utils.py
def get_field(self, field_name, args, kwargs): """ Return an underscore if the attribute is absent. Not all components have the same attributes. """ try: s = super(CustomFormatter, self) return s.get_field(field_name, args, kwargs) except KeyError:...
def get_field(self, field_name, args, kwargs): """ Return an underscore if the attribute is absent. Not all components have the same attributes. """ try: s = super(CustomFormatter, self) return s.get_field(field_name, args, kwargs) except KeyError:...
[ "Return", "an", "underscore", "if", "the", "attribute", "is", "absent", ".", "Not", "all", "components", "have", "the", "same", "attributes", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/utils.py#L84-L95
[ "def", "get_field", "(", "self", ",", "field_name", ",", "args", ",", "kwargs", ")", ":", "try", ":", "s", "=", "super", "(", "CustomFormatter", ",", "self", ")", "return", "s", ".", "get_field", "(", "field_name", ",", "args", ",", "kwargs", ")", "e...
8033b673a151f96c29802b43763e863519a3124c
test
CustomFormatter.convert_field
Define some extra field conversion functions.
striplog/utils.py
def convert_field(self, value, conversion): """ Define some extra field conversion functions. """ try: # If the normal behaviour works, do it. s = super(CustomFormatter, self) return s.convert_field(value, conversion) except ValueError: funcs ...
def convert_field(self, value, conversion): """ Define some extra field conversion functions. """ try: # If the normal behaviour works, do it. s = super(CustomFormatter, self) return s.convert_field(value, conversion) except ValueError: funcs ...
[ "Define", "some", "extra", "field", "conversion", "functions", "." ]
agile-geoscience/striplog
python
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/utils.py#L97-L120
[ "def", "convert_field", "(", "self", ",", "value", ",", "conversion", ")", ":", "try", ":", "# If the normal behaviour works, do it.", "s", "=", "super", "(", "CustomFormatter", ",", "self", ")", "return", "s", ".", "convert_field", "(", "value", ",", "convers...
8033b673a151f96c29802b43763e863519a3124c
test
Jobs.get_jobs
Lists all the jobs registered with Nomad. https://www.nomadproject.io/docs/http/jobs.html arguments: - prefix :(str) optional, specifies a string to filter jobs on based on an prefix. This is specified as a querystring parameter. returns: list ...
nomad/api/jobs.py
def get_jobs(self, prefix=None): """ Lists all the jobs registered with Nomad. https://www.nomadproject.io/docs/http/jobs.html arguments: - prefix :(str) optional, specifies a string to filter jobs on based on an prefix. This is specified as a querys...
def get_jobs(self, prefix=None): """ Lists all the jobs registered with Nomad. https://www.nomadproject.io/docs/http/jobs.html arguments: - prefix :(str) optional, specifies a string to filter jobs on based on an prefix. This is specified as a querys...
[ "Lists", "all", "the", "jobs", "registered", "with", "Nomad", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/jobs.py#L66-L79
[ "def", "get_jobs", "(", "self", ",", "prefix", "=", "None", ")", ":", "params", "=", "{", "\"prefix\"", ":", "prefix", "}", "return", "self", ".", "request", "(", "method", "=", "\"get\"", ",", "params", "=", "params", ")", ".", "json", "(", ")" ]
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Jobs.parse
Parse a HCL Job file. Returns a dict with the JSON formatted job. This API endpoint is only supported from Nomad version 0.8.3. https://www.nomadproject.io/api/jobs.html#parse-job returns: dict raises: - nomad.api.exceptions.BaseNomadException ...
nomad/api/jobs.py
def parse(self, hcl, canonicalize=False): """ Parse a HCL Job file. Returns a dict with the JSON formatted job. This API endpoint is only supported from Nomad version 0.8.3. https://www.nomadproject.io/api/jobs.html#parse-job returns: dict raises: ...
def parse(self, hcl, canonicalize=False): """ Parse a HCL Job file. Returns a dict with the JSON formatted job. This API endpoint is only supported from Nomad version 0.8.3. https://www.nomadproject.io/api/jobs.html#parse-job returns: dict raises: ...
[ "Parse", "a", "HCL", "Job", "file", ".", "Returns", "a", "dict", "with", "the", "JSON", "formatted", "job", ".", "This", "API", "endpoint", "is", "only", "supported", "from", "Nomad", "version", "0", ".", "8", ".", "3", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/jobs.py#L93-L104
[ "def", "parse", "(", "self", ",", "hcl", ",", "canonicalize", "=", "False", ")", ":", "return", "self", ".", "request", "(", "\"parse\"", ",", "json", "=", "{", "\"JobHCL\"", ":", "hcl", ",", "\"Canonicalize\"", ":", "canonicalize", "}", ",", "method", ...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Acl.update_token
Update token. https://www.nomadproject.io/api/acl-tokens.html arguments: - AccdesorID - token returns: dict raises: - nomad.api.exceptions.BaseNomadException - nomad.api.exceptions.URLNotFoundNomadException
nomad/api/acl.py
def update_token(self, id, token): """ Update token. https://www.nomadproject.io/api/acl-tokens.html arguments: - AccdesorID - token returns: dict raises: - nomad.api.exceptions.BaseNomadException - no...
def update_token(self, id, token): """ Update token. https://www.nomadproject.io/api/acl-tokens.html arguments: - AccdesorID - token returns: dict raises: - nomad.api.exceptions.BaseNomadException - no...
[ "Update", "token", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/acl.py#L108-L122
[ "def", "update_token", "(", "self", ",", "id", ",", "token", ")", ":", "return", "self", ".", "request", "(", "\"token\"", ",", "id", ",", "json", "=", "token", ",", "method", "=", "\"post\"", ")", ".", "json", "(", ")" ]
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Acl.create_policy
Create policy. https://www.nomadproject.io/api/acl-policies.html arguments: - policy returns: request.Response raises: - nomad.api.exceptions.BaseNomadException - nomad.api.exceptions.URLNotFoundNomadException
nomad/api/acl.py
def create_policy(self, id, policy): """ Create policy. https://www.nomadproject.io/api/acl-policies.html arguments: - policy returns: request.Response raises: - nomad.api.exceptions.BaseNomadException - nomad.api.exc...
def create_policy(self, id, policy): """ Create policy. https://www.nomadproject.io/api/acl-policies.html arguments: - policy returns: request.Response raises: - nomad.api.exceptions.BaseNomadException - nomad.api.exc...
[ "Create", "policy", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/acl.py#L137-L150
[ "def", "create_policy", "(", "self", ",", "id", ",", "policy", ")", ":", "return", "self", ".", "request", "(", "\"policy\"", ",", "id", ",", "json", "=", "policy", ",", "method", "=", "\"post\"", ")" ]
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Acl.update_policy
Create policy. https://www.nomadproject.io/api/acl-policies.html arguments: - name - policy returns: request.Response raises: - nomad.api.exceptions.BaseNomadException - nomad.api.exceptions.URLNotFoundNomadEx...
nomad/api/acl.py
def update_policy(self, id, policy): """ Create policy. https://www.nomadproject.io/api/acl-policies.html arguments: - name - policy returns: request.Response raises: - nomad.api.exceptions.BaseNomadException ...
def update_policy(self, id, policy): """ Create policy. https://www.nomadproject.io/api/acl-policies.html arguments: - name - policy returns: request.Response raises: - nomad.api.exceptions.BaseNomadException ...
[ "Create", "policy", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/acl.py#L165-L179
[ "def", "update_policy", "(", "self", ",", "id", ",", "policy", ")", ":", "return", "self", ".", "request", "(", "\"policy\"", ",", "id", ",", "json", "=", "policy", ",", "method", "=", "\"post\"", ")" ]
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Allocations.get_allocations
Lists all the allocations. https://www.nomadproject.io/docs/http/allocs.html arguments: - prefix :(str) optional, specifies a string to filter allocations on based on an prefix. This is specified as a querystring parameter. returns: list ...
nomad/api/allocations.py
def get_allocations(self, prefix=None): """ Lists all the allocations. https://www.nomadproject.io/docs/http/allocs.html arguments: - prefix :(str) optional, specifies a string to filter allocations on based on an prefix. This is specified as a query...
def get_allocations(self, prefix=None): """ Lists all the allocations. https://www.nomadproject.io/docs/http/allocs.html arguments: - prefix :(str) optional, specifies a string to filter allocations on based on an prefix. This is specified as a query...
[ "Lists", "all", "the", "allocations", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/allocations.py#L35-L48
[ "def", "get_allocations", "(", "self", ",", "prefix", "=", "None", ")", ":", "params", "=", "{", "\"prefix\"", ":", "prefix", "}", "return", "self", ".", "request", "(", "method", "=", "\"get\"", ",", "params", "=", "params", ")", ".", "json", "(", "...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Deployment.fail_deployment
This endpoint is used to mark a deployment as failed. This should be done to force the scheduler to stop creating allocations as part of the deployment or to cause a rollback to a previous job version. https://www.nomadproject.io/docs/http/deployments.html arguments: -...
nomad/api/deployment.py
def fail_deployment(self, id): """ This endpoint is used to mark a deployment as failed. This should be done to force the scheduler to stop creating allocations as part of the deployment or to cause a rollback to a previous job version. https://www.nomadproject.io/docs/http/deployments.h...
def fail_deployment(self, id): """ This endpoint is used to mark a deployment as failed. This should be done to force the scheduler to stop creating allocations as part of the deployment or to cause a rollback to a previous job version. https://www.nomadproject.io/docs/http/deployments.h...
[ "This", "endpoint", "is", "used", "to", "mark", "a", "deployment", "as", "failed", ".", "This", "should", "be", "done", "to", "force", "the", "scheduler", "to", "stop", "creating", "allocations", "as", "part", "of", "the", "deployment", "or", "to", "cause"...
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/deployment.py#L74-L88
[ "def", "fail_deployment", "(", "self", ",", "id", ")", ":", "fail_json", "=", "{", "\"DeploymentID\"", ":", "id", "}", "return", "self", ".", "request", "(", "\"fail\"", ",", "id", ",", "json", "=", "fail_json", ",", "method", "=", "\"post\"", ")", "."...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Deployment.pause_deployment
This endpoint is used to pause or unpause a deployment. This is done to pause a rolling upgrade or resume it. https://www.nomadproject.io/docs/http/deployments.html arguments: - id - pause, Specifies whether to pause or resume the deployment. ...
nomad/api/deployment.py
def pause_deployment(self, id, pause): """ This endpoint is used to pause or unpause a deployment. This is done to pause a rolling upgrade or resume it. https://www.nomadproject.io/docs/http/deployments.html arguments: - id - pause, Specifies whet...
def pause_deployment(self, id, pause): """ This endpoint is used to pause or unpause a deployment. This is done to pause a rolling upgrade or resume it. https://www.nomadproject.io/docs/http/deployments.html arguments: - id - pause, Specifies whet...
[ "This", "endpoint", "is", "used", "to", "pause", "or", "unpause", "a", "deployment", ".", "This", "is", "done", "to", "pause", "a", "rolling", "upgrade", "or", "resume", "it", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/deployment.py#L90-L106
[ "def", "pause_deployment", "(", "self", ",", "id", ",", "pause", ")", ":", "pause_json", "=", "{", "\"Pause\"", ":", "pause", ",", "\"DeploymentID\"", ":", "id", "}", "return", "self", ".", "request", "(", "\"pause\"", ",", "id", ",", "json", "=", "pau...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Deployment.promote_deployment_all
This endpoint is used to promote task groups that have canaries for a deployment. This should be done when the placed canaries are healthy and the rolling upgrade of the remaining allocations should begin. https://www.nomadproject.io/docs/http/deployments.html arguments: ...
nomad/api/deployment.py
def promote_deployment_all(self, id, all=True): """ This endpoint is used to promote task groups that have canaries for a deployment. This should be done when the placed canaries are healthy and the rolling upgrade of the remaining allocations should begin. https://www.nomadproject.io/do...
def promote_deployment_all(self, id, all=True): """ This endpoint is used to promote task groups that have canaries for a deployment. This should be done when the placed canaries are healthy and the rolling upgrade of the remaining allocations should begin. https://www.nomadproject.io/do...
[ "This", "endpoint", "is", "used", "to", "promote", "task", "groups", "that", "have", "canaries", "for", "a", "deployment", ".", "This", "should", "be", "done", "when", "the", "placed", "canaries", "are", "healthy", "and", "the", "rolling", "upgrade", "of", ...
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/deployment.py#L108-L124
[ "def", "promote_deployment_all", "(", "self", ",", "id", ",", "all", "=", "True", ")", ":", "promote_all_json", "=", "{", "\"All\"", ":", "all", ",", "\"DeploymentID\"", ":", "id", "}", "return", "self", ".", "request", "(", "\"promote\"", ",", "id", ","...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Deployment.promote_deployment_groups
This endpoint is used to promote task groups that have canaries for a deployment. This should be done when the placed canaries are healthy and the rolling upgrade of the remaining allocations should begin. https://www.nomadproject.io/docs/http/deployments.html arguments: ...
nomad/api/deployment.py
def promote_deployment_groups(self, id, groups=list()): """ This endpoint is used to promote task groups that have canaries for a deployment. This should be done when the placed canaries are healthy and the rolling upgrade of the remaining allocations should begin. https://www.nomadproje...
def promote_deployment_groups(self, id, groups=list()): """ This endpoint is used to promote task groups that have canaries for a deployment. This should be done when the placed canaries are healthy and the rolling upgrade of the remaining allocations should begin. https://www.nomadproje...
[ "This", "endpoint", "is", "used", "to", "promote", "task", "groups", "that", "have", "canaries", "for", "a", "deployment", ".", "This", "should", "be", "done", "when", "the", "placed", "canaries", "are", "healthy", "and", "the", "rolling", "upgrade", "of", ...
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/deployment.py#L126-L142
[ "def", "promote_deployment_groups", "(", "self", ",", "id", ",", "groups", "=", "list", "(", ")", ")", ":", "promote_groups_json", "=", "{", "\"Groups\"", ":", "groups", ",", "\"DeploymentID\"", ":", "id", "}", "return", "self", ".", "request", "(", "\"pro...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Deployment.deployment_allocation_health
This endpoint is used to set the health of an allocation that is in the deployment manually. In some use cases, automatic detection of allocation health may not be desired. As such those task groups can be marked with an upgrade policy that uses health_check = "manual". Those allocations must ha...
nomad/api/deployment.py
def deployment_allocation_health(self, id, healthy_allocations=list(), unhealthy_allocations=list()): """ This endpoint is used to set the health of an allocation that is in the deployment manually. In some use cases, automatic detection of allocation health may not be desired. As such those task gr...
def deployment_allocation_health(self, id, healthy_allocations=list(), unhealthy_allocations=list()): """ This endpoint is used to set the health of an allocation that is in the deployment manually. In some use cases, automatic detection of allocation health may not be desired. As such those task gr...
[ "This", "endpoint", "is", "used", "to", "set", "the", "health", "of", "an", "allocation", "that", "is", "in", "the", "deployment", "manually", ".", "In", "some", "use", "cases", "automatic", "detection", "of", "allocation", "health", "may", "not", "be", "d...
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/deployment.py#L144-L165
[ "def", "deployment_allocation_health", "(", "self", ",", "id", ",", "healthy_allocations", "=", "list", "(", ")", ",", "unhealthy_allocations", "=", "list", "(", ")", ")", ":", "allocations", "=", "{", "\"HealthyAllocationIDs\"", ":", "healthy_allocations", ",", ...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Node.drain_node
Toggle the drain mode of the node. When enabled, no further allocations will be assigned and existing allocations will be migrated. https://www.nomadproject.io/docs/http/node.html arguments: - id (str uuid): node id - enable (bool): enable nod...
nomad/api/node.py
def drain_node(self, id, enable=False): """ Toggle the drain mode of the node. When enabled, no further allocations will be assigned and existing allocations will be migrated. https://www.nomadproject.io/docs/http/node.html arguments: - id (str uuid...
def drain_node(self, id, enable=False): """ Toggle the drain mode of the node. When enabled, no further allocations will be assigned and existing allocations will be migrated. https://www.nomadproject.io/docs/http/node.html arguments: - id (str uuid...
[ "Toggle", "the", "drain", "mode", "of", "the", "node", ".", "When", "enabled", "no", "further", "allocations", "will", "be", "assigned", "and", "existing", "allocations", "will", "be", "migrated", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/node.py#L89-L105
[ "def", "drain_node", "(", "self", ",", "id", ",", "enable", "=", "False", ")", ":", "return", "self", ".", "request", "(", "id", ",", "\"drain\"", ",", "params", "=", "{", "\"enable\"", ":", "enable", "}", ",", "method", "=", "\"post\"", ")", ".", ...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Node.drain_node_with_spec
This endpoint toggles the drain mode of the node. When draining is enabled, no further allocations will be assigned to this node, and existing allocations will be migrated to new nodes. If an empty dictionary is given as drain_spec this will disable/toggle the drain. ht...
nomad/api/node.py
def drain_node_with_spec(self, id, drain_spec, mark_eligible=None): """ This endpoint toggles the drain mode of the node. When draining is enabled, no further allocations will be assigned to this node, and existing allocations will be migrated to new nodes. If an empty dicti...
def drain_node_with_spec(self, id, drain_spec, mark_eligible=None): """ This endpoint toggles the drain mode of the node. When draining is enabled, no further allocations will be assigned to this node, and existing allocations will be migrated to new nodes. If an empty dicti...
[ "This", "endpoint", "toggles", "the", "drain", "mode", "of", "the", "node", ".", "When", "draining", "is", "enabled", "no", "further", "allocations", "will", "be", "assigned", "to", "this", "node", "and", "existing", "allocations", "will", "be", "migrated", ...
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/node.py#L107-L150
[ "def", "drain_node_with_spec", "(", "self", ",", "id", ",", "drain_spec", ",", "mark_eligible", "=", "None", ")", ":", "payload", "=", "{", "}", "if", "drain_spec", "and", "mark_eligible", "is", "not", "None", ":", "payload", "=", "{", "\"NodeID\"", ":", ...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Node.eligible_node
Toggle the eligibility of the node. https://www.nomadproject.io/docs/http/node.html arguments: - id (str uuid): node id - eligible (bool): Set to True to mark node eligible - ineligible (bool): Set to True to mark node ineligible returns: di...
nomad/api/node.py
def eligible_node(self, id, eligible=None, ineligible=None): """ Toggle the eligibility of the node. https://www.nomadproject.io/docs/http/node.html arguments: - id (str uuid): node id - eligible (bool): Set to True to mark node eligible - ineli...
def eligible_node(self, id, eligible=None, ineligible=None): """ Toggle the eligibility of the node. https://www.nomadproject.io/docs/http/node.html arguments: - id (str uuid): node id - eligible (bool): Set to True to mark node eligible - ineli...
[ "Toggle", "the", "eligibility", "of", "the", "node", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/node.py#L152-L182
[ "def", "eligible_node", "(", "self", ",", "id", ",", "eligible", "=", "None", ",", "ineligible", "=", "None", ")", ":", "payload", "=", "{", "}", "if", "eligible", "is", "not", "None", "and", "ineligible", "is", "not", "None", ":", "raise", "nomad", ...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
ls.list_files
List files in an allocation directory. https://www.nomadproject.io/docs/http/client-fs-ls.html arguments: - id - path returns: list raises: - nomad.api.exceptions.BaseNomadException - nomad.api.exceptions....
nomad/api/client.py
def list_files(self, id=None, path="/"): """ List files in an allocation directory. https://www.nomadproject.io/docs/http/client-fs-ls.html arguments: - id - path returns: list raises: - nomad.api.exceptions.Bas...
def list_files(self, id=None, path="/"): """ List files in an allocation directory. https://www.nomadproject.io/docs/http/client-fs-ls.html arguments: - id - path returns: list raises: - nomad.api.exceptions.Bas...
[ "List", "files", "in", "an", "allocation", "directory", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/client.py#L43-L59
[ "def", "list_files", "(", "self", ",", "id", "=", "None", ",", "path", "=", "\"/\"", ")", ":", "if", "id", ":", "return", "self", ".", "request", "(", "id", ",", "params", "=", "{", "\"path\"", ":", "path", "}", ",", "method", "=", "\"get\"", ")"...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
cat.read_file
Read contents of a file in an allocation directory. https://www.nomadproject.io/docs/http/client-fs-cat.html arguments: - id - path returns: (str) text raises: - nomad.api.exceptions.BaseNomadException - nomad.api.e...
nomad/api/client.py
def read_file(self, id=None, path="/"): """ Read contents of a file in an allocation directory. https://www.nomadproject.io/docs/http/client-fs-cat.html arguments: - id - path returns: (str) text raises: - nomad.api.excep...
def read_file(self, id=None, path="/"): """ Read contents of a file in an allocation directory. https://www.nomadproject.io/docs/http/client-fs-cat.html arguments: - id - path returns: (str) text raises: - nomad.api.excep...
[ "Read", "contents", "of", "a", "file", "in", "an", "allocation", "directory", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/client.py#L78-L94
[ "def", "read_file", "(", "self", ",", "id", "=", "None", ",", "path", "=", "\"/\"", ")", ":", "if", "id", ":", "return", "self", ".", "request", "(", "id", ",", "params", "=", "{", "\"path\"", ":", "path", "}", ",", "method", "=", "\"get\"", ")",...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
read_at.read_file_offset
Read contents of a file in an allocation directory. https://www.nomadproject.io/docs/http/client-fs-cat.html arguments: - id: (str) allocation_id required - offset: (int) required - limit: (int) required - path: (str) optional ...
nomad/api/client.py
def read_file_offset(self, id, offset, limit, path="/"): """ Read contents of a file in an allocation directory. https://www.nomadproject.io/docs/http/client-fs-cat.html arguments: - id: (str) allocation_id required - offset: (int) required - li...
def read_file_offset(self, id, offset, limit, path="/"): """ Read contents of a file in an allocation directory. https://www.nomadproject.io/docs/http/client-fs-cat.html arguments: - id: (str) allocation_id required - offset: (int) required - li...
[ "Read", "contents", "of", "a", "file", "in", "an", "allocation", "directory", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/client.py#L110-L130
[ "def", "read_file_offset", "(", "self", ",", "id", ",", "offset", ",", "limit", ",", "path", "=", "\"/\"", ")", ":", "params", "=", "{", "\"path\"", ":", "path", ",", "\"offset\"", ":", "offset", ",", "\"limit\"", ":", "limit", "}", "return", "self", ...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
stream_file.stream
This endpoint streams the contents of a file in an allocation directory. https://www.nomadproject.io/api/client.html#stream-file arguments: - id: (str) allocation_id required - offset: (int) required - origin: (str) either start|end - pat...
nomad/api/client.py
def stream(self, id, offset, origin, path="/"): """ This endpoint streams the contents of a file in an allocation directory. https://www.nomadproject.io/api/client.html#stream-file arguments: - id: (str) allocation_id required - offset: (int) required ...
def stream(self, id, offset, origin, path="/"): """ This endpoint streams the contents of a file in an allocation directory. https://www.nomadproject.io/api/client.html#stream-file arguments: - id: (str) allocation_id required - offset: (int) required ...
[ "This", "endpoint", "streams", "the", "contents", "of", "a", "file", "in", "an", "allocation", "directory", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/client.py#L146-L166
[ "def", "stream", "(", "self", ",", "id", ",", "offset", ",", "origin", ",", "path", "=", "\"/\"", ")", ":", "params", "=", "{", "\"path\"", ":", "path", ",", "\"offset\"", ":", "offset", ",", "\"origin\"", ":", "origin", "}", "return", "self", ".", ...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
stream_logs.stream
This endpoint streams a task's stderr/stdout logs. https://www.nomadproject.io/api/client.html#stream-logs arguments: - id: (str) allocation_id required - task: (str) name of the task inside the allocation to stream logs from - type: (str) Specifies th...
nomad/api/client.py
def stream(self, id, task, type, follow=False, offset=0, origin="start", plain=False): """ This endpoint streams a task's stderr/stdout logs. https://www.nomadproject.io/api/client.html#stream-logs arguments: - id: (str) allocation_id required - task: (str) ...
def stream(self, id, task, type, follow=False, offset=0, origin="start", plain=False): """ This endpoint streams a task's stderr/stdout logs. https://www.nomadproject.io/api/client.html#stream-logs arguments: - id: (str) allocation_id required - task: (str) ...
[ "This", "endpoint", "streams", "a", "task", "s", "stderr", "/", "stdout", "logs", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/client.py#L182-L208
[ "def", "stream", "(", "self", ",", "id", ",", "task", ",", "type", ",", "follow", "=", "False", ",", "offset", "=", "0", ",", "origin", "=", "\"start\"", ",", "plain", "=", "False", ")", ":", "params", "=", "{", "\"task\"", ":", "task", ",", "\"t...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
stat.stat_file
Stat a file in an allocation directory. https://www.nomadproject.io/docs/http/client-fs-stat.html arguments: - id - path returns: dict raises: - nomad.api.exceptions.BaseNomadException - nomad.api.exceptions.URLNotF...
nomad/api/client.py
def stat_file(self, id=None, path="/"): """ Stat a file in an allocation directory. https://www.nomadproject.io/docs/http/client-fs-stat.html arguments: - id - path returns: dict raises: - nomad.api.exceptions.BaseNomadEx...
def stat_file(self, id=None, path="/"): """ Stat a file in an allocation directory. https://www.nomadproject.io/docs/http/client-fs-stat.html arguments: - id - path returns: dict raises: - nomad.api.exceptions.BaseNomadEx...
[ "Stat", "a", "file", "in", "an", "allocation", "directory", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/client.py#L226-L242
[ "def", "stat_file", "(", "self", ",", "id", "=", "None", ",", "path", "=", "\"/\"", ")", ":", "if", "id", ":", "return", "self", ".", "request", "(", "id", ",", "params", "=", "{", "\"path\"", ":", "path", "}", ",", "method", "=", "\"get\"", ")",...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Agent.join_agent
Initiate a join between the agent and target peers. https://www.nomadproject.io/docs/http/agent-join.html returns: dict raises: - nomad.api.exceptions.BaseNomadException - nomad.api.exceptions.URLNotFoundNomadException
nomad/api/agent.py
def join_agent(self, addresses): """Initiate a join between the agent and target peers. https://www.nomadproject.io/docs/http/agent-join.html returns: dict raises: - nomad.api.exceptions.BaseNomadException - nomad.api.exceptions.URLNotFoundNomadEx...
def join_agent(self, addresses): """Initiate a join between the agent and target peers. https://www.nomadproject.io/docs/http/agent-join.html returns: dict raises: - nomad.api.exceptions.BaseNomadException - nomad.api.exceptions.URLNotFoundNomadEx...
[ "Initiate", "a", "join", "between", "the", "agent", "and", "target", "peers", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/agent.py#L60-L71
[ "def", "join_agent", "(", "self", ",", "addresses", ")", ":", "params", "=", "{", "\"address\"", ":", "addresses", "}", "return", "self", ".", "request", "(", "\"join\"", ",", "params", "=", "params", ",", "method", "=", "\"post\"", ")", ".", "json", "...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Agent.update_servers
Updates the list of known servers to the provided list. Replaces all previous server addresses with the new list. https://www.nomadproject.io/docs/http/agent-servers.html returns: 200 status code raises: - nomad.api.exceptions.BaseNomadException ...
nomad/api/agent.py
def update_servers(self, addresses): """Updates the list of known servers to the provided list. Replaces all previous server addresses with the new list. https://www.nomadproject.io/docs/http/agent-servers.html returns: 200 status code raises: - noma...
def update_servers(self, addresses): """Updates the list of known servers to the provided list. Replaces all previous server addresses with the new list. https://www.nomadproject.io/docs/http/agent-servers.html returns: 200 status code raises: - noma...
[ "Updates", "the", "list", "of", "known", "servers", "to", "the", "provided", "list", ".", "Replaces", "all", "previous", "server", "addresses", "with", "the", "new", "list", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/agent.py#L73-L85
[ "def", "update_servers", "(", "self", ",", "addresses", ")", ":", "params", "=", "{", "\"address\"", ":", "addresses", "}", "return", "self", ".", "request", "(", "\"servers\"", ",", "params", "=", "params", ",", "method", "=", "\"post\"", ")", ".", "sta...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Agent.force_leave
Force a failed gossip member into the left state. https://www.nomadproject.io/docs/http/agent-force-leave.html returns: 200 status code raises: - nomad.api.exceptions.BaseNomadException - nomad.api.exceptions.URLNotFoundNomadException
nomad/api/agent.py
def force_leave(self, node): """Force a failed gossip member into the left state. https://www.nomadproject.io/docs/http/agent-force-leave.html returns: 200 status code raises: - nomad.api.exceptions.BaseNomadException - nomad.api.exceptions.URLNo...
def force_leave(self, node): """Force a failed gossip member into the left state. https://www.nomadproject.io/docs/http/agent-force-leave.html returns: 200 status code raises: - nomad.api.exceptions.BaseNomadException - nomad.api.exceptions.URLNo...
[ "Force", "a", "failed", "gossip", "member", "into", "the", "left", "state", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/agent.py#L87-L98
[ "def", "force_leave", "(", "self", ",", "node", ")", ":", "params", "=", "{", "\"node\"", ":", "node", "}", "return", "self", ".", "request", "(", "\"force-leave\"", ",", "params", "=", "params", ",", "method", "=", "\"post\"", ")", ".", "status_code" ]
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Nodes.get_nodes
Lists all the client nodes registered with Nomad. https://www.nomadproject.io/docs/http/nodes.html arguments: - prefix :(str) optional, specifies a string to filter nodes on based on an prefix. This is specified as a querystring parameter. return...
nomad/api/nodes.py
def get_nodes(self, prefix=None): """ Lists all the client nodes registered with Nomad. https://www.nomadproject.io/docs/http/nodes.html arguments: - prefix :(str) optional, specifies a string to filter nodes on based on an prefix. This is specified ...
def get_nodes(self, prefix=None): """ Lists all the client nodes registered with Nomad. https://www.nomadproject.io/docs/http/nodes.html arguments: - prefix :(str) optional, specifies a string to filter nodes on based on an prefix. This is specified ...
[ "Lists", "all", "the", "client", "nodes", "registered", "with", "Nomad", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/nodes.py#L64-L77
[ "def", "get_nodes", "(", "self", ",", "prefix", "=", "None", ")", ":", "params", "=", "{", "\"prefix\"", ":", "prefix", "}", "return", "self", ".", "request", "(", "method", "=", "\"get\"", ",", "params", "=", "params", ")", ".", "json", "(", ")" ]
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Evaluations.get_evaluations
Lists all the evaluations. https://www.nomadproject.io/docs/http/evals.html arguments: - prefix :(str) optional, specifies a string to filter evaluations on based on an prefix. This is specified as a querystring parameter. returns: list ...
nomad/api/evaluations.py
def get_evaluations(self, prefix=None): """ Lists all the evaluations. https://www.nomadproject.io/docs/http/evals.html arguments: - prefix :(str) optional, specifies a string to filter evaluations on based on an prefix. This is specified as a querys...
def get_evaluations(self, prefix=None): """ Lists all the evaluations. https://www.nomadproject.io/docs/http/evals.html arguments: - prefix :(str) optional, specifies a string to filter evaluations on based on an prefix. This is specified as a querys...
[ "Lists", "all", "the", "evaluations", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/evaluations.py#L60-L73
[ "def", "get_evaluations", "(", "self", ",", "prefix", "=", "None", ")", ":", "params", "=", "{", "\"prefix\"", ":", "prefix", "}", "return", "self", ".", "request", "(", "method", "=", "\"get\"", ",", "params", "=", "params", ")", ".", "json", "(", "...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Namespaces.get_namespaces
Lists all the namespaces registered with Nomad. https://www.nomadproject.io/docs/enterprise/namespaces/index.html arguments: - prefix :(str) optional, specifies a string to filter namespaces on based on an prefix. This is specified as a querystring parameter...
nomad/api/namespaces.py
def get_namespaces(self, prefix=None): """ Lists all the namespaces registered with Nomad. https://www.nomadproject.io/docs/enterprise/namespaces/index.html arguments: - prefix :(str) optional, specifies a string to filter namespaces on based on an prefix. ...
def get_namespaces(self, prefix=None): """ Lists all the namespaces registered with Nomad. https://www.nomadproject.io/docs/enterprise/namespaces/index.html arguments: - prefix :(str) optional, specifies a string to filter namespaces on based on an prefix. ...
[ "Lists", "all", "the", "namespaces", "registered", "with", "Nomad", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/namespaces.py#L60-L73
[ "def", "get_namespaces", "(", "self", ",", "prefix", "=", "None", ")", ":", "params", "=", "{", "\"prefix\"", ":", "prefix", "}", "return", "self", ".", "request", "(", "method", "=", "\"get\"", ",", "params", "=", "params", ")", ".", "json", "(", ")...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Job.register_job
Registers a new job or updates an existing job https://www.nomadproject.io/docs/http/job.html arguments: - id returns: dict raises: - nomad.api.exceptions.BaseNomadException - nomad.api.exceptions.URLNotFoundNomadException
nomad/api/job.py
def register_job(self, id, job): """ Registers a new job or updates an existing job https://www.nomadproject.io/docs/http/job.html arguments: - id returns: dict raises: - nomad.api.exceptions.BaseNomadException - nomad.ap...
def register_job(self, id, job): """ Registers a new job or updates an existing job https://www.nomadproject.io/docs/http/job.html arguments: - id returns: dict raises: - nomad.api.exceptions.BaseNomadException - nomad.ap...
[ "Registers", "a", "new", "job", "or", "updates", "an", "existing", "job" ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/job.py#L149-L161
[ "def", "register_job", "(", "self", ",", "id", ",", "job", ")", ":", "return", "self", ".", "request", "(", "id", ",", "json", "=", "job", ",", "method", "=", "\"post\"", ")", ".", "json", "(", ")" ]
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Job.plan_job
Invoke a dry-run of the scheduler for the job. https://www.nomadproject.io/docs/http/job.html arguments: - id - job, dict - diff, boolean - policy_override, boolean returns: dict raises: - nomad.api.ex...
nomad/api/job.py
def plan_job(self, id, job, diff=False, policy_override=False): """ Invoke a dry-run of the scheduler for the job. https://www.nomadproject.io/docs/http/job.html arguments: - id - job, dict - diff, boolean - policy_override, boolea...
def plan_job(self, id, job, diff=False, policy_override=False): """ Invoke a dry-run of the scheduler for the job. https://www.nomadproject.io/docs/http/job.html arguments: - id - job, dict - diff, boolean - policy_override, boolea...
[ "Invoke", "a", "dry", "-", "run", "of", "the", "scheduler", "for", "the", "job", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/job.py#L178-L197
[ "def", "plan_job", "(", "self", ",", "id", ",", "job", ",", "diff", "=", "False", ",", "policy_override", "=", "False", ")", ":", "json_dict", "=", "{", "}", "json_dict", ".", "update", "(", "job", ")", "json_dict", ".", "setdefault", "(", "'Diff'", ...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Job.dispatch_job
Dispatches a new instance of a parameterized job. https://www.nomadproject.io/docs/http/job.html arguments: - id - payload - meta returns: dict raises: - nomad.api.exceptions.BaseNomadException - nomad...
nomad/api/job.py
def dispatch_job(self, id, payload=None, meta=None): """ Dispatches a new instance of a parameterized job. https://www.nomadproject.io/docs/http/job.html arguments: - id - payload - meta returns: dict raises: ...
def dispatch_job(self, id, payload=None, meta=None): """ Dispatches a new instance of a parameterized job. https://www.nomadproject.io/docs/http/job.html arguments: - id - payload - meta returns: dict raises: ...
[ "Dispatches", "a", "new", "instance", "of", "a", "parameterized", "job", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/job.py#L216-L231
[ "def", "dispatch_job", "(", "self", ",", "id", ",", "payload", "=", "None", ",", "meta", "=", "None", ")", ":", "dispatch_json", "=", "{", "\"Meta\"", ":", "meta", ",", "\"Payload\"", ":", "payload", "}", "return", "self", ".", "request", "(", "id", ...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Job.revert_job
This endpoint reverts the job to an older version. https://www.nomadproject.io/docs/http/job.html arguments: - id - version, Specifies the job version to revert to. optional_arguments: - enforce_prior_version, Optional value specifying the c...
nomad/api/job.py
def revert_job(self, id, version, enforce_prior_version=None): """ This endpoint reverts the job to an older version. https://www.nomadproject.io/docs/http/job.html arguments: - id - version, Specifies the job version to revert to. optional_argume...
def revert_job(self, id, version, enforce_prior_version=None): """ This endpoint reverts the job to an older version. https://www.nomadproject.io/docs/http/job.html arguments: - id - version, Specifies the job version to revert to. optional_argume...
[ "This", "endpoint", "reverts", "the", "job", "to", "an", "older", "version", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/job.py#L233-L253
[ "def", "revert_job", "(", "self", ",", "id", ",", "version", ",", "enforce_prior_version", "=", "None", ")", ":", "revert_json", "=", "{", "\"JobID\"", ":", "id", ",", "\"JobVersion\"", ":", "version", ",", "\"EnforcePriorVersion\"", ":", "enforce_prior_version"...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Job.stable_job
This endpoint sets the job's stability. https://www.nomadproject.io/docs/http/job.html arguments: - id - version, Specifies the job version to revert to. - stable, Specifies whether the job should be marked as stable or not. returns: dict ...
nomad/api/job.py
def stable_job(self, id, version, stable): """ This endpoint sets the job's stability. https://www.nomadproject.io/docs/http/job.html arguments: - id - version, Specifies the job version to revert to. - stable, Specifies whether the job should b...
def stable_job(self, id, version, stable): """ This endpoint sets the job's stability. https://www.nomadproject.io/docs/http/job.html arguments: - id - version, Specifies the job version to revert to. - stable, Specifies whether the job should b...
[ "This", "endpoint", "sets", "the", "job", "s", "stability", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/job.py#L255-L272
[ "def", "stable_job", "(", "self", ",", "id", ",", "version", ",", "stable", ")", ":", "revert_json", "=", "{", "\"JobID\"", ":", "id", ",", "\"JobVersion\"", ":", "version", ",", "\"Stable\"", ":", "stable", "}", "return", "self", ".", "request", "(", ...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Job.deregister_job
Deregisters a job, and stops all allocations part of it. https://www.nomadproject.io/docs/http/job.html arguments: - id - purge (bool), optionally specifies whether the job should be stopped and purged immediately (`purge=True`) or deferred to the ...
nomad/api/job.py
def deregister_job(self, id, purge=None): """ Deregisters a job, and stops all allocations part of it. https://www.nomadproject.io/docs/http/job.html arguments: - id - purge (bool), optionally specifies whether the job should be stopped and pu...
def deregister_job(self, id, purge=None): """ Deregisters a job, and stops all allocations part of it. https://www.nomadproject.io/docs/http/job.html arguments: - id - purge (bool), optionally specifies whether the job should be stopped and pu...
[ "Deregisters", "a", "job", "and", "stops", "all", "allocations", "part", "of", "it", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/job.py#L274-L297
[ "def", "deregister_job", "(", "self", ",", "id", ",", "purge", "=", "None", ")", ":", "params", "=", "None", "if", "purge", "is", "not", "None", ":", "if", "not", "isinstance", "(", "purge", ",", "bool", ")", ":", "raise", "nomad", ".", "api", ".",...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Operator.get_configuration
Query the status of a client node registered with Nomad. https://www.nomadproject.io/docs/http/operator.html returns: dict optional arguments: - stale, (defaults to False), Specifies if the cluster should respond without an active leader. ...
nomad/api/operator.py
def get_configuration(self, stale=False): """ Query the status of a client node registered with Nomad. https://www.nomadproject.io/docs/http/operator.html returns: dict optional arguments: - stale, (defaults to False), Specifies if the cluster should respond w...
def get_configuration(self, stale=False): """ Query the status of a client node registered with Nomad. https://www.nomadproject.io/docs/http/operator.html returns: dict optional arguments: - stale, (defaults to False), Specifies if the cluster should respond w...
[ "Query", "the", "status", "of", "a", "client", "node", "registered", "with", "Nomad", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/operator.py#L27-L42
[ "def", "get_configuration", "(", "self", ",", "stale", "=", "False", ")", ":", "params", "=", "{", "\"stale\"", ":", "stale", "}", "return", "self", ".", "request", "(", "\"raft\"", ",", "\"configuration\"", ",", "params", "=", "params", ",", "method", "...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Operator.delete_peer
Remove the Nomad server with given address from the Raft configuration. The return code signifies success or failure. https://www.nomadproject.io/docs/http/operator.html arguments: - peer_address, The address specifies the server to remove and is given as an IP:port ...
nomad/api/operator.py
def delete_peer(self, peer_address, stale=False): """ Remove the Nomad server with given address from the Raft configuration. The return code signifies success or failure. https://www.nomadproject.io/docs/http/operator.html arguments: - peer_address, The addre...
def delete_peer(self, peer_address, stale=False): """ Remove the Nomad server with given address from the Raft configuration. The return code signifies success or failure. https://www.nomadproject.io/docs/http/operator.html arguments: - peer_address, The addre...
[ "Remove", "the", "Nomad", "server", "with", "given", "address", "from", "the", "Raft", "configuration", ".", "The", "return", "code", "signifies", "success", "or", "failure", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/operator.py#L44-L62
[ "def", "delete_peer", "(", "self", ",", "peer_address", ",", "stale", "=", "False", ")", ":", "params", "=", "{", "\"address\"", ":", "peer_address", ",", "\"stale\"", ":", "stale", "}", "return", "self", ".", "request", "(", "\"raft\"", ",", "\"peer\"", ...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Deployments.get_deployments
This endpoint lists all deployments. https://www.nomadproject.io/docs/http/deployments.html optional_arguments: - prefix, (default "") Specifies a string to filter deployments on based on an index prefix. This is specified as a querystring parameter. ...
nomad/api/deployments.py
def get_deployments(self, prefix=""): """ This endpoint lists all deployments. https://www.nomadproject.io/docs/http/deployments.html optional_arguments: - prefix, (default "") Specifies a string to filter deployments on based on an index prefix. Th...
def get_deployments(self, prefix=""): """ This endpoint lists all deployments. https://www.nomadproject.io/docs/http/deployments.html optional_arguments: - prefix, (default "") Specifies a string to filter deployments on based on an index prefix. Th...
[ "This", "endpoint", "lists", "all", "deployments", "." ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/deployments.py#L59-L74
[ "def", "get_deployments", "(", "self", ",", "prefix", "=", "\"\"", ")", ":", "params", "=", "{", "\"prefix\"", ":", "prefix", "}", "return", "self", ".", "request", "(", "params", "=", "params", ",", "method", "=", "\"get\"", ")", ".", "json", "(", "...
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
Namespace.update_namespace
Update namespace https://www.nomadproject.io/api/namespaces.html arguments: - id - namespace (dict) returns: requests.Response raises: - nomad.api.exceptions.BaseNomadException - nomad.api.exceptions.URLNotFoundNoma...
nomad/api/namespace.py
def update_namespace(self, id, namespace): """ Update namespace https://www.nomadproject.io/api/namespaces.html arguments: - id - namespace (dict) returns: requests.Response raises: - nomad.api.exceptions.BaseNomadExcepti...
def update_namespace(self, id, namespace): """ Update namespace https://www.nomadproject.io/api/namespaces.html arguments: - id - namespace (dict) returns: requests.Response raises: - nomad.api.exceptions.BaseNomadExcepti...
[ "Update", "namespace" ]
jrxFive/python-nomad
python
https://github.com/jrxFive/python-nomad/blob/37df37e4de21e6f8ac41c6154e7f1f44f1800020/nomad/api/namespace.py#L80-L93
[ "def", "update_namespace", "(", "self", ",", "id", ",", "namespace", ")", ":", "return", "self", ".", "request", "(", "id", ",", "json", "=", "namespace", ",", "method", "=", "\"post\"", ")" ]
37df37e4de21e6f8ac41c6154e7f1f44f1800020
test
PJFMutators._get_random
Get a random mutator from a list of mutators
pyjfuzz/core/pjf_mutators.py
def _get_random(self, obj_type): """ Get a random mutator from a list of mutators """ return self.mutator[obj_type][random.randint(0, self.config.level)]
def _get_random(self, obj_type): """ Get a random mutator from a list of mutators """ return self.mutator[obj_type][random.randint(0, self.config.level)]
[ "Get", "a", "random", "mutator", "from", "a", "list", "of", "mutators" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_mutators.py#L127-L131
[ "def", "_get_random", "(", "self", ",", "obj_type", ")", ":", "return", "self", ".", "mutator", "[", "obj_type", "]", "[", "random", ".", "randint", "(", "0", ",", "self", ".", "config", ".", "level", ")", "]" ]
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFMutators.get_mutator
Get a random mutator for the given type
pyjfuzz/core/pjf_mutators.py
def get_mutator(self, obj, obj_type): """ Get a random mutator for the given type """ if obj_type == unicode: obj_type = str obj = str(obj) return self._get_random(obj_type)(obj)
def get_mutator(self, obj, obj_type): """ Get a random mutator for the given type """ if obj_type == unicode: obj_type = str obj = str(obj) return self._get_random(obj_type)(obj)
[ "Get", "a", "random", "mutator", "for", "the", "given", "type" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_mutators.py#L133-L140
[ "def", "get_mutator", "(", "self", ",", "obj", ",", "obj_type", ")", ":", "if", "obj_type", "==", "unicode", ":", "obj_type", "=", "str", "obj", "=", "str", "(", "obj", ")", "return", "self", ".", "_get_random", "(", "obj_type", ")", "(", "obj", ")" ...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFMutators.get_string_polyglot_attack
Return a polyglot attack containing the original object
pyjfuzz/core/pjf_mutators.py
def get_string_polyglot_attack(self, obj): """ Return a polyglot attack containing the original object """ return self.polyglot_attacks[random.choice(self.config.techniques)] % obj
def get_string_polyglot_attack(self, obj): """ Return a polyglot attack containing the original object """ return self.polyglot_attacks[random.choice(self.config.techniques)] % obj
[ "Return", "a", "polyglot", "attack", "containing", "the", "original", "object" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_mutators.py#L142-L146
[ "def", "get_string_polyglot_attack", "(", "self", ",", "obj", ")", ":", "return", "self", ".", "polyglot_attacks", "[", "random", ".", "choice", "(", "self", ".", "config", ".", "techniques", ")", "]", "%", "obj" ]
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFMutators.fuzz
Perform the fuzzing
pyjfuzz/core/pjf_mutators.py
def fuzz(self, obj): """ Perform the fuzzing """ buf = list(obj) FuzzFactor = random.randrange(1, len(buf)) numwrites=random.randrange(math.ceil((float(len(buf)) / FuzzFactor)))+1 for j in range(numwrites): self.random_action(buf) return self.s...
def fuzz(self, obj): """ Perform the fuzzing """ buf = list(obj) FuzzFactor = random.randrange(1, len(buf)) numwrites=random.randrange(math.ceil((float(len(buf)) / FuzzFactor)))+1 for j in range(numwrites): self.random_action(buf) return self.s...
[ "Perform", "the", "fuzzing" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_mutators.py#L148-L157
[ "def", "fuzz", "(", "self", ",", "obj", ")", ":", "buf", "=", "list", "(", "obj", ")", "FuzzFactor", "=", "random", ".", "randrange", "(", "1", ",", "len", "(", "buf", ")", ")", "numwrites", "=", "random", ".", "randrange", "(", "math", ".", "cei...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFMutators.random_action
Perform the actual fuzzing using random strategies
pyjfuzz/core/pjf_mutators.py
def random_action(self, b): """ Perform the actual fuzzing using random strategies """ action = random.choice([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) if len(b) >= 3: pos = random.randint(0, len(b)-2) if action == 1: rbyte = random.randrange(256) ...
def random_action(self, b): """ Perform the actual fuzzing using random strategies """ action = random.choice([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) if len(b) >= 3: pos = random.randint(0, len(b)-2) if action == 1: rbyte = random.randrange(256) ...
[ "Perform", "the", "actual", "fuzzing", "using", "random", "strategies" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_mutators.py#L159-L248
[ "def", "random_action", "(", "self", ",", "b", ")", ":", "action", "=", "random", ".", "choice", "(", "[", "1", ",", "2", ",", "3", ",", "4", ",", "5", ",", "6", ",", "7", ",", "8", ",", "9", ",", "10", "]", ")", "if", "len", "(", "b", ...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFMutators.safe_unicode
Safely return an unicode encoded string
pyjfuzz/core/pjf_mutators.py
def safe_unicode(self, buf): """ Safely return an unicode encoded string """ tmp = "" buf = "".join(b for b in buf) for character in buf: tmp += character return tmp
def safe_unicode(self, buf): """ Safely return an unicode encoded string """ tmp = "" buf = "".join(b for b in buf) for character in buf: tmp += character return tmp
[ "Safely", "return", "an", "unicode", "encoded", "string" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_mutators.py#L259-L267
[ "def", "safe_unicode", "(", "self", ",", "buf", ")", ":", "tmp", "=", "\"\"", "buf", "=", "\"\"", ".", "join", "(", "b", "for", "b", "in", "buf", ")", "for", "character", "in", "buf", ":", "tmp", "+=", "character", "return", "tmp" ]
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFServer.run
Start the servers
pyjfuzz/core/pjf_server.py
def run(self): """ Start the servers """ route("/")(self.serve) if self.config.html: route("/<filepath:path>")(self.custom_html) if self.config.fuzz_web: self.request_checker.start() self.httpd.start() self.httpsd.start()
def run(self): """ Start the servers """ route("/")(self.serve) if self.config.html: route("/<filepath:path>")(self.custom_html) if self.config.fuzz_web: self.request_checker.start() self.httpd.start() self.httpsd.start()
[ "Start", "the", "servers" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_server.py#L104-L114
[ "def", "run", "(", "self", ")", ":", "route", "(", "\"/\"", ")", "(", "self", ".", "serve", ")", "if", "self", ".", "config", ".", "html", ":", "route", "(", "\"/<filepath:path>\"", ")", "(", "self", ".", "custom_html", ")", "if", "self", ".", "con...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFServer.stop
Kill the servers
pyjfuzz/core/pjf_server.py
def stop(self): """ Kill the servers """ os.kill(self.httpd.pid, signal.SIGKILL) os.kill(self.httpsd.pid, signal.SIGKILL) self.client_queue.put((0,0)) if self.config.fuzz_web: self.request_checker.join() self.logger.debug("[{0}] - PJFServer suc...
def stop(self): """ Kill the servers """ os.kill(self.httpd.pid, signal.SIGKILL) os.kill(self.httpsd.pid, signal.SIGKILL) self.client_queue.put((0,0)) if self.config.fuzz_web: self.request_checker.join() self.logger.debug("[{0}] - PJFServer suc...
[ "Kill", "the", "servers" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_server.py#L162-L171
[ "def", "stop", "(", "self", ")", ":", "os", ".", "kill", "(", "self", ".", "httpd", ".", "pid", ",", "signal", ".", "SIGKILL", ")", "os", ".", "kill", "(", "self", ".", "httpsd", ".", "pid", ",", "signal", ".", "SIGKILL", ")", "self", ".", "cli...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFServer.custom_html
Serve custom HTML page
pyjfuzz/core/pjf_server.py
def custom_html(self, filepath): """ Serve custom HTML page """ try: response.headers.append("Access-Control-Allow-Origin", "*") response.headers.append("Accept-Encoding", "identity") response.headers.append("Content-Type", "text/html") ret...
def custom_html(self, filepath): """ Serve custom HTML page """ try: response.headers.append("Access-Control-Allow-Origin", "*") response.headers.append("Accept-Encoding", "identity") response.headers.append("Content-Type", "text/html") ret...
[ "Serve", "custom", "HTML", "page" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_server.py#L173-L183
[ "def", "custom_html", "(", "self", ",", "filepath", ")", ":", "try", ":", "response", ".", "headers", ".", "append", "(", "\"Access-Control-Allow-Origin\"", ",", "\"*\"", ")", "response", ".", "headers", ".", "append", "(", "\"Accept-Encoding\"", ",", "\"ident...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFServer.serve
Serve fuzzed JSON object
pyjfuzz/core/pjf_server.py
def serve(self): """ Serve fuzzed JSON object """ try: fuzzed = self.json.fuzzed if self.config.fuzz_web: self.client_queue.put((request.environ.get('REMOTE_ADDR'), fuzzed)) response.headers.append("Access-Control-Allow-Origin", "*") ...
def serve(self): """ Serve fuzzed JSON object """ try: fuzzed = self.json.fuzzed if self.config.fuzz_web: self.client_queue.put((request.environ.get('REMOTE_ADDR'), fuzzed)) response.headers.append("Access-Control-Allow-Origin", "*") ...
[ "Serve", "fuzzed", "JSON", "object" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_server.py#L185-L200
[ "def", "serve", "(", "self", ")", ":", "try", ":", "fuzzed", "=", "self", ".", "json", ".", "fuzzed", "if", "self", ".", "config", ".", "fuzz_web", ":", "self", ".", "client_queue", ".", "put", "(", "(", "request", ".", "environ", ".", "get", "(", ...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFServer.apply_patch
Fix default socket lib to handle client disconnection while receiving data (Broken pipe)
pyjfuzz/core/pjf_server.py
def apply_patch(self): """ Fix default socket lib to handle client disconnection while receiving data (Broken pipe) """ if sys.version_info >= (3, 0): # No patch for python >= 3.0 pass else: from .patch.socket import socket as patch ...
def apply_patch(self): """ Fix default socket lib to handle client disconnection while receiving data (Broken pipe) """ if sys.version_info >= (3, 0): # No patch for python >= 3.0 pass else: from .patch.socket import socket as patch ...
[ "Fix", "default", "socket", "lib", "to", "handle", "client", "disconnection", "while", "receiving", "data", "(", "Broken", "pipe", ")" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_server.py#L208-L217
[ "def", "apply_patch", "(", "self", ")", ":", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "0", ")", ":", "# No patch for python >= 3.0", "pass", "else", ":", "from", ".", "patch", ".", "socket", "import", "socket", "as", "patch", "socket", ".",...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFMutation.fuzz
Generic fuzz mutator, use a decorator for the given type
pyjfuzz/core/pjf_mutation.py
def fuzz(self, obj): """ Generic fuzz mutator, use a decorator for the given type """ decorators = self.decorators @decorators.mutate_object_decorate def mutate(): return obj return mutate()
def fuzz(self, obj): """ Generic fuzz mutator, use a decorator for the given type """ decorators = self.decorators @decorators.mutate_object_decorate def mutate(): return obj return mutate()
[ "Generic", "fuzz", "mutator", "use", "a", "decorator", "for", "the", "given", "type" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_mutation.py#L35-L44
[ "def", "fuzz", "(", "self", ",", "obj", ")", ":", "decorators", "=", "self", ".", "decorators", "@", "decorators", ".", "mutate_object_decorate", "def", "mutate", "(", ")", ":", "return", "obj", "return", "mutate", "(", ")" ]
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFExecutor.spawn
Spawn a new process using subprocess
pyjfuzz/core/pjf_executor.py
def spawn(self, cmd, stdin_content="", stdin=False, shell=False, timeout=2): """ Spawn a new process using subprocess """ try: if type(cmd) != list: raise PJFInvalidType(type(cmd), list) if type(stdin_content) != str: raise PJFInval...
def spawn(self, cmd, stdin_content="", stdin=False, shell=False, timeout=2): """ Spawn a new process using subprocess """ try: if type(cmd) != list: raise PJFInvalidType(type(cmd), list) if type(stdin_content) != str: raise PJFInval...
[ "Spawn", "a", "new", "process", "using", "subprocess" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_executor.py#L51-L73
[ "def", "spawn", "(", "self", ",", "cmd", ",", "stdin_content", "=", "\"\"", ",", "stdin", "=", "False", ",", "shell", "=", "False", ",", "timeout", "=", "2", ")", ":", "try", ":", "if", "type", "(", "cmd", ")", "!=", "list", ":", "raise", "PJFInv...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFExecutor.get_output
Try to get output in a separate thread
pyjfuzz/core/pjf_executor.py
def get_output(self, stdin_content, stdin): """ Try to get output in a separate thread """ try: if stdin: if sys.version_info >= (3, 0): self.process.stdin.write(bytes(stdin_content, "utf-8")) else: self....
def get_output(self, stdin_content, stdin): """ Try to get output in a separate thread """ try: if stdin: if sys.version_info >= (3, 0): self.process.stdin.write(bytes(stdin_content, "utf-8")) else: self....
[ "Try", "to", "get", "output", "in", "a", "separate", "thread" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_executor.py#L75-L88
[ "def", "get_output", "(", "self", ",", "stdin_content", ",", "stdin", ")", ":", "try", ":", "if", "stdin", ":", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "0", ")", ":", "self", ".", "process", ".", "stdin", ".", "write", "(", "bytes", ...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFExecutor.finish_read
Wait until we got output or until timeout is over
pyjfuzz/core/pjf_executor.py
def finish_read(self, timeout=2, stdin_content="", stdin=False): """ Wait until we got output or until timeout is over """ process = Thread(target=self.get_output, args=(stdin_content, stdin)) process.start() if timeout > 0: process.join(timeout) else:...
def finish_read(self, timeout=2, stdin_content="", stdin=False): """ Wait until we got output or until timeout is over """ process = Thread(target=self.get_output, args=(stdin_content, stdin)) process.start() if timeout > 0: process.join(timeout) else:...
[ "Wait", "until", "we", "got", "output", "or", "until", "timeout", "is", "over" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_executor.py#L90-L104
[ "def", "finish_read", "(", "self", ",", "timeout", "=", "2", ",", "stdin_content", "=", "\"\"", ",", "stdin", "=", "False", ")", ":", "process", "=", "Thread", "(", "target", "=", "self", ".", "get_output", ",", "args", "=", "(", "stdin_content", ",", ...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFExecutor.close
Terminate the newly created process
pyjfuzz/core/pjf_executor.py
def close(self): """ Terminate the newly created process """ try: self.process.terminate() self.return_code = self.process.returncode except OSError: pass self.process.stdin.close() self.process.stdout.close() self.proce...
def close(self): """ Terminate the newly created process """ try: self.process.terminate() self.return_code = self.process.returncode except OSError: pass self.process.stdin.close() self.process.stdout.close() self.proce...
[ "Terminate", "the", "newly", "created", "process" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_executor.py#L106-L118
[ "def", "close", "(", "self", ")", ":", "try", ":", "self", ".", "process", ".", "terminate", "(", ")", "self", ".", "return_code", "=", "self", ".", "process", ".", "returncode", "except", "OSError", ":", "pass", "self", ".", "process", ".", "stdin", ...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFConfiguration.start
Parse the command line and start PyJFuzz
pyjfuzz/core/pjf_configuration.py
def start(self): """ Parse the command line and start PyJFuzz """ from .pjf_worker import PJFWorker worker = PJFWorker(self) if self.update_pjf: worker.update_library() elif self.browser_auto: worker.browser_autopwn() elif self.fuzz...
def start(self): """ Parse the command line and start PyJFuzz """ from .pjf_worker import PJFWorker worker = PJFWorker(self) if self.update_pjf: worker.update_library() elif self.browser_auto: worker.browser_autopwn() elif self.fuzz...
[ "Parse", "the", "command", "line", "and", "start", "PyJFuzz" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_configuration.py#L125-L155
[ "def", "start", "(", "self", ")", ":", "from", ".", "pjf_worker", "import", "PJFWorker", "worker", "=", "PJFWorker", "(", "self", ")", "if", "self", ".", "update_pjf", ":", "worker", ".", "update_library", "(", ")", "elif", "self", ".", "browser_auto", "...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
val
Build the provided value, while properly handling native Python types, :any:`gramfuzz.fields.Field` instances, and :any:`gramfuzz.fields.Field` subclasses. :param list pre: The prerequisites list :returns: str
gramfuzz/gramfuzz/utils.py
def val(val, pre=None, shortest=False): """Build the provided value, while properly handling native Python types, :any:`gramfuzz.fields.Field` instances, and :any:`gramfuzz.fields.Field` subclasses. :param list pre: The prerequisites list :returns: str """ if pre is None: pre = [] ...
def val(val, pre=None, shortest=False): """Build the provided value, while properly handling native Python types, :any:`gramfuzz.fields.Field` instances, and :any:`gramfuzz.fields.Field` subclasses. :param list pre: The prerequisites list :returns: str """ if pre is None: pre = [] ...
[ "Build", "the", "provided", "value", "while", "properly", "handling", "native", "Python", "types", ":", "any", ":", "gramfuzz", ".", "fields", ".", "Field", "instances", "and", ":", "any", ":", "gramfuzz", ".", "fields", ".", "Field", "subclasses", "." ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/utils.py#L13-L33
[ "def", "val", "(", "val", ",", "pre", "=", "None", ",", "shortest", "=", "False", ")", ":", "if", "pre", "is", "None", ":", "pre", "=", "[", "]", "fields", "=", "gramfuzz", ".", "fields", "MF", "=", "fields", ".", "MetaField", "F", "=", "fields",...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFExternalFuzzer.execute
Perform the actual external fuzzing, you may replace this method in order to increase performance
pyjfuzz/core/pjf_external_fuzzer.py
def execute(self, obj): """ Perform the actual external fuzzing, you may replace this method in order to increase performance """ try: if self.config.stdin: self.spawn(self.config.command, stdin_content=obj, stdin=True, timeout=1) else: ...
def execute(self, obj): """ Perform the actual external fuzzing, you may replace this method in order to increase performance """ try: if self.config.stdin: self.spawn(self.config.command, stdin_content=obj, stdin=True, timeout=1) else: ...
[ "Perform", "the", "actual", "external", "fuzzing", "you", "may", "replace", "this", "method", "in", "order", "to", "increase", "performance" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_external_fuzzer.py#L53-L72
[ "def", "execute", "(", "self", ",", "obj", ")", ":", "try", ":", "if", "self", ".", "config", ".", "stdin", ":", "self", ".", "spawn", "(", "self", ".", "config", ".", "command", ",", "stdin_content", "=", "obj", ",", "stdin", "=", "True", ",", "...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFEncoder.json_encode
Decorator used to change the return value from PJFFactory.fuzzed, it makes the structure printable
pyjfuzz/core/pjf_encoder.py
def json_encode(func): """ Decorator used to change the return value from PJFFactory.fuzzed, it makes the structure printable """ def func_wrapper(self, indent, utf8): if utf8: encoding = "\\x%02x" else: encoding = "\\u%04x" ...
def json_encode(func): """ Decorator used to change the return value from PJFFactory.fuzzed, it makes the structure printable """ def func_wrapper(self, indent, utf8): if utf8: encoding = "\\x%02x" else: encoding = "\\u%04x" ...
[ "Decorator", "used", "to", "change", "the", "return", "value", "from", "PJFFactory", ".", "fuzzed", "it", "makes", "the", "structure", "printable" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_encoder.py#L35-L106
[ "def", "json_encode", "(", "func", ")", ":", "def", "func_wrapper", "(", "self", ",", "indent", ",", "utf8", ")", ":", "if", "utf8", ":", "encoding", "=", "\"\\\\x%02x\"", "else", ":", "encoding", "=", "\"\\\\u%04x\"", "hex_regex", "=", "re", ".", "compi...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
Field._odds_val
Determine a new random value derived from the defined :any:`gramfuzz.fields.Field.odds` value. :returns: The derived value
gramfuzz/gramfuzz/fields.py
def _odds_val(self): """Determine a new random value derived from the defined :any:`gramfuzz.fields.Field.odds` value. :returns: The derived value """ if len(self.odds) == 0: self.odds = [(1.00, [self.min, self.max])] rand_val = rand.random() total =...
def _odds_val(self): """Determine a new random value derived from the defined :any:`gramfuzz.fields.Field.odds` value. :returns: The derived value """ if len(self.odds) == 0: self.odds = [(1.00, [self.min, self.max])] rand_val = rand.random() total =...
[ "Determine", "a", "new", "random", "value", "derived", "from", "the", "defined", ":", "any", ":", "gramfuzz", ".", "fields", ".", "Field", ".", "odds", "value", "." ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/fields.py#L164-L192
[ "def", "_odds_val", "(", "self", ")", ":", "if", "len", "(", "self", ".", "odds", ")", "==", "0", ":", "self", ".", "odds", "=", "[", "(", "1.00", ",", "[", "self", ".", "min", ",", "self", ".", "max", "]", ")", "]", "rand_val", "=", "rand", ...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
Int.build
Build the integer, optionally providing a ``pre`` list that *may* be used to define prerequisites for a Field being built. :param list pre: A list of prerequisites to be collected during the building of a Field. :param bool shortest: Whether or not the shortest reference-chain (most minimal) ve...
gramfuzz/gramfuzz/fields.py
def build(self, pre=None, shortest=False): """Build the integer, optionally providing a ``pre`` list that *may* be used to define prerequisites for a Field being built. :param list pre: A list of prerequisites to be collected during the building of a Field. :param bool shortest: Whether...
def build(self, pre=None, shortest=False): """Build the integer, optionally providing a ``pre`` list that *may* be used to define prerequisites for a Field being built. :param list pre: A list of prerequisites to be collected during the building of a Field. :param bool shortest: Whether...
[ "Build", "the", "integer", "optionally", "providing", "a", "pre", "list", "that", "*", "may", "*", "be", "used", "to", "define", "prerequisites", "for", "a", "Field", "being", "built", "." ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/fields.py#L239-L258
[ "def", "build", "(", "self", ",", "pre", "=", "None", ",", "shortest", "=", "False", ")", ":", "if", "pre", "is", "None", ":", "pre", "=", "[", "]", "if", "self", ".", "value", "is", "not", "None", "and", "rand", ".", "maybe", "(", ")", ":", ...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
String.build
Build the String instance :param list pre: The prerequisites list (optional, default=None) :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
gramfuzz/gramfuzz/fields.py
def build(self, pre=None, shortest=False): """Build the String instance :param list pre: The prerequisites list (optional, default=None) :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated. """ if pre is None:...
def build(self, pre=None, shortest=False): """Build the String instance :param list pre: The prerequisites list (optional, default=None) :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated. """ if pre is None:...
[ "Build", "the", "String", "instance" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/fields.py#L346-L360
[ "def", "build", "(", "self", ",", "pre", "=", "None", ",", "shortest", "=", "False", ")", ":", "if", "pre", "is", "None", ":", "pre", "=", "[", "]", "if", "self", ".", "value", "is", "not", "None", "and", "rand", ".", "maybe", "(", ")", ":", ...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
Join.build
Build the ``Join`` field instance. :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
gramfuzz/gramfuzz/fields.py
def build(self, pre=None, shortest=False): """Build the ``Join`` field instance. :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated. """ if pre is None: ...
def build(self, pre=None, shortest=False): """Build the ``Join`` field instance. :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated. """ if pre is None: ...
[ "Build", "the", "Join", "field", "instance", ".", ":", "param", "list", "pre", ":", "The", "prerequisites", "list", ":", "param", "bool", "shortest", ":", "Whether", "or", "not", "the", "shortest", "reference", "-", "chain", "(", "most", "minimal", ")", ...
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/fields.py#L385-L411
[ "def", "build", "(", "self", ",", "pre", "=", "None", ",", "shortest", "=", "False", ")", ":", "if", "pre", "is", "None", ":", "pre", "=", "[", "]", "if", "self", ".", "max", "is", "not", "None", ":", "if", "shortest", ":", "vals", "=", "[", ...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
And.build
Build the ``And`` instance :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
gramfuzz/gramfuzz/fields.py
def build(self, pre=None, shortest=False): """Build the ``And`` instance :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated. """ if pre is None: pre = [] ...
def build(self, pre=None, shortest=False): """Build the ``And`` instance :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated. """ if pre is None: pre = [] ...
[ "Build", "the", "And", "instance" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/fields.py#L432-L460
[ "def", "build", "(", "self", ",", "pre", "=", "None", ",", "shortest", "=", "False", ")", ":", "if", "pre", "is", "None", ":", "pre", "=", "[", "]", "res", "=", "deque", "(", ")", "for", "x", "in", "self", ".", "values", ":", "try", ":", "res...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
Q.build
Build the ``Quote`` instance :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
gramfuzz/gramfuzz/fields.py
def build(self, pre=None, shortest=False): """Build the ``Quote`` instance :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated. """ res = super(Q, self).build(pre, short...
def build(self, pre=None, shortest=False): """Build the ``Quote`` instance :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated. """ res = super(Q, self).build(pre, short...
[ "Build", "the", "Quote", "instance" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/fields.py#L491-L504
[ "def", "build", "(", "self", ",", "pre", "=", "None", ",", "shortest", "=", "False", ")", ":", "res", "=", "super", "(", "Q", ",", "self", ")", ".", "build", "(", "pre", ",", "shortest", "=", "shortest", ")", "if", "self", ".", "escape", ":", "...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
Or.build
Build the ``Or`` instance :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
gramfuzz/gramfuzz/fields.py
def build(self, pre=None, shortest=False): """Build the ``Or`` instance :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated. """ if pre is None: pre = [] ...
def build(self, pre=None, shortest=False): """Build the ``Or`` instance :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated. """ if pre is None: pre = [] ...
[ "Build", "the", "Or", "instance" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/fields.py#L526-L541
[ "def", "build", "(", "self", ",", "pre", "=", "None", ",", "shortest", "=", "False", ")", ":", "if", "pre", "is", "None", ":", "pre", "=", "[", "]", "# self.shortest_vals will be set by the GramFuzzer and will", "# contain a list of value options that have a minimal r...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
Opt.build
Build the current ``Opt`` instance :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
gramfuzz/gramfuzz/fields.py
def build(self, pre=None, shortest=False): """Build the current ``Opt`` instance :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated. """ if pre is None: pre...
def build(self, pre=None, shortest=False): """Build the current ``Opt`` instance :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated. """ if pre is None: pre...
[ "Build", "the", "current", "Opt", "instance" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/fields.py#L570-L582
[ "def", "build", "(", "self", ",", "pre", "=", "None", ",", "shortest", "=", "False", ")", ":", "if", "pre", "is", "None", ":", "pre", "=", "[", "]", "if", "shortest", "or", "rand", ".", "maybe", "(", "self", ".", "prob", ")", ":", "raise", "err...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
Def.build
Build this rule definition :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
gramfuzz/gramfuzz/fields.py
def build(self, pre=None, shortest=False): """Build this rule definition :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated. """ if pre is None: pre...
def build(self, pre=None, shortest=False): """Build this rule definition :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated. """ if pre is None: pre...
[ "Build", "this", "rule", "definition", ":", "param", "list", "pre", ":", "The", "prerequisites", "list", ":", "param", "bool", "shortest", ":", "Whether", "or", "not", "the", "shortest", "reference", "-", "chain", "(", "most", "minimal", ")", "version", "o...
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/fields.py#L654-L685
[ "def", "build", "(", "self", ",", "pre", "=", "None", ",", "shortest", "=", "False", ")", ":", "if", "pre", "is", "None", ":", "pre", "=", "[", "]", "res", "=", "deque", "(", ")", "for", "value", "in", "self", ".", "values", ":", "try", ":", ...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
Ref.build
Build the ``Ref`` instance by fetching the rule from the GramFuzzer instance and building it :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
gramfuzz/gramfuzz/fields.py
def build(self, pre=None, shortest=False): """Build the ``Ref`` instance by fetching the rule from the GramFuzzer instance and building it :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should...
def build(self, pre=None, shortest=False): """Build the ``Ref`` instance by fetching the rule from the GramFuzzer instance and building it :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should...
[ "Build", "the", "Ref", "instance", "by", "fetching", "the", "rule", "from", "the", "GramFuzzer", "instance", "and", "building", "it" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/fields.py#L726-L753
[ "def", "build", "(", "self", ",", "pre", "=", "None", ",", "shortest", "=", "False", ")", ":", "global", "REF_LEVEL", "REF_LEVEL", "+=", "1", "try", ":", "if", "pre", "is", "None", ":", "pre", "=", "[", "]", "#print(\"{:04d} - {} - {}:{}\".format(REF_LEVEL...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
STAR.build
Build the STAR field. :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
gramfuzz/gramfuzz/fields.py
def build(self, pre=None, shortest=False): """Build the STAR field. :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated. """ if pre is None: pre = [] ...
def build(self, pre=None, shortest=False): """Build the STAR field. :param list pre: The prerequisites list :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated. """ if pre is None: pre = [] ...
[ "Build", "the", "STAR", "field", "." ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/fields.py#L785-L799
[ "def", "build", "(", "self", ",", "pre", "=", "None", ",", "shortest", "=", "False", ")", ":", "if", "pre", "is", "None", ":", "pre", "=", "[", "]", "if", "shortest", ":", "raise", "errors", ".", "OptGram", "elif", "rand", ".", "maybe", "(", ")",...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFProcessMonitor.shutdown
Shutdown the running process and the monitor
pyjfuzz/core/pjf_process_monitor.py
def shutdown(self, *args): """ Shutdown the running process and the monitor """ try: self._shutdown() if self.process: self.process.wait() self.process.stdout.close() self.process.stdin.close() self.p...
def shutdown(self, *args): """ Shutdown the running process and the monitor """ try: self._shutdown() if self.process: self.process.wait() self.process.stdout.close() self.process.stdin.close() self.p...
[ "Shutdown", "the", "running", "process", "and", "the", "monitor" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_process_monitor.py#L56-L71
[ "def", "shutdown", "(", "self", ",", "*", "args", ")", ":", "try", ":", "self", ".", "_shutdown", "(", ")", "if", "self", ".", "process", ":", "self", ".", "process", ".", "wait", "(", ")", "self", ".", "process", ".", "stdout", ".", "close", "("...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFProcessMonitor.run_and_monitor
Run command once and check exit code
pyjfuzz/core/pjf_process_monitor.py
def run_and_monitor(self): """ Run command once and check exit code """ signal.signal(signal.SIGINT, self.shutdown) self.spawn(self.config.process_to_monitor, timeout=0) return self._is_sigsegv(self.return_code)
def run_and_monitor(self): """ Run command once and check exit code """ signal.signal(signal.SIGINT, self.shutdown) self.spawn(self.config.process_to_monitor, timeout=0) return self._is_sigsegv(self.return_code)
[ "Run", "command", "once", "and", "check", "exit", "code" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_process_monitor.py#L93-L99
[ "def", "run_and_monitor", "(", "self", ")", ":", "signal", ".", "signal", "(", "signal", ".", "SIGINT", ",", "self", ".", "shutdown", ")", "self", ".", "spawn", "(", "self", ".", "config", ".", "process_to_monitor", ",", "timeout", "=", "0", ")", "retu...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
PJFProcessMonitor.start_monitor
Run command in a loop and check exit status plus restart process when needed
pyjfuzz/core/pjf_process_monitor.py
def start_monitor(self, standalone=True): """ Run command in a loop and check exit status plus restart process when needed """ try: self.start() cmdline = shlex.split(self.config.process_to_monitor) if standalone: signal.signal(signal.S...
def start_monitor(self, standalone=True): """ Run command in a loop and check exit status plus restart process when needed """ try: self.start() cmdline = shlex.split(self.config.process_to_monitor) if standalone: signal.signal(signal.S...
[ "Run", "command", "in", "a", "loop", "and", "check", "exit", "status", "plus", "restart", "process", "when", "needed" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_process_monitor.py#L101-L127
[ "def", "start_monitor", "(", "self", ",", "standalone", "=", "True", ")", ":", "try", ":", "self", ".", "start", "(", ")", "cmdline", "=", "shlex", ".", "split", "(", "self", ".", "config", ".", "process_to_monitor", ")", "if", "standalone", ":", "sign...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
randfloat
Return a random float :param float a: Either the minimum value (inclusive) if ``b`` is set, or the maximum value if ``b`` is not set (non-inclusive, in which case the minimum is implicitly 0.0) :param float b: The maximum value to generate (non-inclusive) :returns: float
gramfuzz/gramfuzz/rand.py
def randfloat(a, b=None): """Return a random float :param float a: Either the minimum value (inclusive) if ``b`` is set, or the maximum value if ``b`` is not set (non-inclusive, in which case the minimum is implicitly 0.0) :param float b: The maximum value to generate (non-inclusive) :returns: ...
def randfloat(a, b=None): """Return a random float :param float a: Either the minimum value (inclusive) if ``b`` is set, or the maximum value if ``b`` is not set (non-inclusive, in which case the minimum is implicitly 0.0) :param float b: The maximum value to generate (non-inclusive) :returns: ...
[ "Return", "a", "random", "float" ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/rand.py#L50-L70
[ "def", "randfloat", "(", "a", ",", "b", "=", "None", ")", ":", "if", "b", "is", "None", ":", "max_", "=", "a", "min_", "=", "0.0", "else", ":", "min_", "=", "a", "max_", "=", "b", "diff", "=", "max_", "-", "min_", "res", "=", "_random", "(", ...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
GramFuzzer.load_grammar
Load a grammar file (python file containing grammar definitions) by file path. When loaded, the global variable ``GRAMFUZZER`` will be set within the module. This is not always needed, but can be useful. :param str path: The path to the grammar file
gramfuzz/gramfuzz/__init__.py
def load_grammar(self, path): """Load a grammar file (python file containing grammar definitions) by file path. When loaded, the global variable ``GRAMFUZZER`` will be set within the module. This is not always needed, but can be useful. :param str path: The path to the grammar file ...
def load_grammar(self, path): """Load a grammar file (python file containing grammar definitions) by file path. When loaded, the global variable ``GRAMFUZZER`` will be set within the module. This is not always needed, but can be useful. :param str path: The path to the grammar file ...
[ "Load", "a", "grammar", "file", "(", "python", "file", "containing", "grammar", "definitions", ")", "by", "file", "path", ".", "When", "loaded", "the", "global", "variable", "GRAMFUZZER", "will", "be", "set", "within", "the", "module", ".", "This", "is", "...
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/__init__.py#L98-L131
[ "def", "load_grammar", "(", "self", ",", "path", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "raise", "Exception", "(", "\"path does not exist: {!r}\"", ".", "format", "(", "path", ")", ")", "# this will let grammars refer...
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
GramFuzzer.set_max_recursion
Set the maximum reference-recursion depth (not the Python system maximum stack recursion level). This controls how many levels deep of nested references are allowed before gramfuzz attempts to generate the shortest (reference-wise) rules possible. :param int level: The new maximum reference lev...
gramfuzz/gramfuzz/__init__.py
def set_max_recursion(self, level): """Set the maximum reference-recursion depth (not the Python system maximum stack recursion level). This controls how many levels deep of nested references are allowed before gramfuzz attempts to generate the shortest (reference-wise) rules possible. ...
def set_max_recursion(self, level): """Set the maximum reference-recursion depth (not the Python system maximum stack recursion level). This controls how many levels deep of nested references are allowed before gramfuzz attempts to generate the shortest (reference-wise) rules possible. ...
[ "Set", "the", "maximum", "reference", "-", "recursion", "depth", "(", "not", "the", "Python", "system", "maximum", "stack", "recursion", "level", ")", ".", "This", "controls", "how", "many", "levels", "deep", "of", "nested", "references", "are", "allowed", "...
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/__init__.py#L133-L141
[ "def", "set_max_recursion", "(", "self", ",", "level", ")", ":", "import", "gramfuzz", ".", "fields", "gramfuzz", ".", "fields", ".", "Ref", ".", "max_recursion", "=", "level" ]
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
GramFuzzer.preprocess_rules
Calculate shortest reference-paths of each rule (and Or field), and prune all unreachable rules.
gramfuzz/gramfuzz/__init__.py
def preprocess_rules(self): """Calculate shortest reference-paths of each rule (and Or field), and prune all unreachable rules. """ to_prune = self._find_shortest_paths() self._prune_rules(to_prune) self._rules_processed = True
def preprocess_rules(self): """Calculate shortest reference-paths of each rule (and Or field), and prune all unreachable rules. """ to_prune = self._find_shortest_paths() self._prune_rules(to_prune) self._rules_processed = True
[ "Calculate", "shortest", "reference", "-", "paths", "of", "each", "rule", "(", "and", "Or", "field", ")", "and", "prune", "all", "unreachable", "rules", "." ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/__init__.py#L143-L150
[ "def", "preprocess_rules", "(", "self", ")", ":", "to_prune", "=", "self", ".", "_find_shortest_paths", "(", ")", "self", ".", "_prune_rules", "(", "to_prune", ")", "self", ".", "_rules_processed", "=", "True" ]
f777067076f62c9ab74ffea6e90fd54402b7a1b4
test
GramFuzzer.add_definition
Add a new rule definition named ``def_name`` having value ``def_value`` to the category ``cat``. :param str cat: The category to add the rule to :param str def_name: The name of the rule definition :param def_val: The value of the rule definition :param bool no_prune: If the rul...
gramfuzz/gramfuzz/__init__.py
def add_definition(self, cat, def_name, def_val, no_prune=False, gram_file="default"): """Add a new rule definition named ``def_name`` having value ``def_value`` to the category ``cat``. :param str cat: The category to add the rule to :param str def_name: The name of the rule definition...
def add_definition(self, cat, def_name, def_val, no_prune=False, gram_file="default"): """Add a new rule definition named ``def_name`` having value ``def_value`` to the category ``cat``. :param str cat: The category to add the rule to :param str def_name: The name of the rule definition...
[ "Add", "a", "new", "rule", "definition", "named", "def_name", "having", "value", "def_value", "to", "the", "category", "cat", "." ]
mseclab/PyJFuzz
python
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/gramfuzz/gramfuzz/__init__.py#L315-L338
[ "def", "add_definition", "(", "self", ",", "cat", ",", "def_name", ",", "def_val", ",", "no_prune", "=", "False", ",", "gram_file", "=", "\"default\"", ")", ":", "self", ".", "_rules_processed", "=", "False", "self", ".", "add_to_cat_group", "(", "cat", ",...
f777067076f62c9ab74ffea6e90fd54402b7a1b4