repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
jf-parent/brome | brome/core/proxy_driver.py | ProxyDriver.pdb | def pdb(self):
"""Start the python debugger
Calling pdb won't do anything in a multithread context
"""
if self.embed_disabled:
self.warning_log("Pdb is disabled when runned from the grid runner because of the multithreading") # noqa
return False
if BROM... | python | def pdb(self):
"""Start the python debugger
Calling pdb won't do anything in a multithread context
"""
if self.embed_disabled:
self.warning_log("Pdb is disabled when runned from the grid runner because of the multithreading") # noqa
return False
if BROM... | [
"def",
"pdb",
"(",
"self",
")",
":",
"if",
"self",
".",
"embed_disabled",
":",
"self",
".",
"warning_log",
"(",
"\"Pdb is disabled when runned from the grid runner because of the multithreading\"",
")",
"# noqa",
"return",
"False",
"if",
"BROME_CONFIG",
"[",
"'runner'",... | Start the python debugger
Calling pdb won't do anything in a multithread context | [
"Start",
"the",
"python",
"debugger"
] | train | https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L791-L803 |
jf-parent/brome | brome/core/proxy_driver.py | ProxyDriver.drag_and_drop | def drag_and_drop(self, source_selector, destination_selector, **kwargs):
"""Drag and drop
Args:
source_selector: (str)
destination_selector: (str)
Kwargs:
use_javascript_dnd: bool; default:
config proxy_driver:use_javascript_dnd
"""
... | python | def drag_and_drop(self, source_selector, destination_selector, **kwargs):
"""Drag and drop
Args:
source_selector: (str)
destination_selector: (str)
Kwargs:
use_javascript_dnd: bool; default:
config proxy_driver:use_javascript_dnd
"""
... | [
"def",
"drag_and_drop",
"(",
"self",
",",
"source_selector",
",",
"destination_selector",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"info_log",
"(",
"\"Drag and drop: source (%s); destination (%s)\"",
"%",
"(",
"source_selector",
",",
"destination_selector",
")"... | Drag and drop
Args:
source_selector: (str)
destination_selector: (str)
Kwargs:
use_javascript_dnd: bool; default:
config proxy_driver:use_javascript_dnd | [
"Drag",
"and",
"drop"
] | train | https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L805-L855 |
jf-parent/brome | brome/core/proxy_driver.py | ProxyDriver.embed | def embed(self, title=''):
"""Start an IPython embed
Calling embed won't do anything in a multithread context
The stack_depth will be found automatically
"""
if self.embed_disabled:
self.warning_log("Embed is disabled when runned from the grid runner because of the ... | python | def embed(self, title=''):
"""Start an IPython embed
Calling embed won't do anything in a multithread context
The stack_depth will be found automatically
"""
if self.embed_disabled:
self.warning_log("Embed is disabled when runned from the grid runner because of the ... | [
"def",
"embed",
"(",
"self",
",",
"title",
"=",
"''",
")",
":",
"if",
"self",
".",
"embed_disabled",
":",
"self",
".",
"warning_log",
"(",
"\"Embed is disabled when runned from the grid runner because of the multithreading\"",
")",
"# noqa",
"return",
"False",
"from",... | Start an IPython embed
Calling embed won't do anything in a multithread context
The stack_depth will be found automatically | [
"Start",
"an",
"IPython",
"embed"
] | train | https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L857-L886 |
jf-parent/brome | brome/core/proxy_driver.py | ProxyDriver.take_node_screenshot | def take_node_screenshot(self, element, screenshot_path):
from PIL import Image
"""Take a screenshot of a node
Args:
element (object): the proxy_element
screenshot_path (str): the path where the screenshot will be saved
"""
temp_path = os.path.join(tempd... | python | def take_node_screenshot(self, element, screenshot_path):
from PIL import Image
"""Take a screenshot of a node
Args:
element (object): the proxy_element
screenshot_path (str): the path where the screenshot will be saved
"""
temp_path = os.path.join(tempd... | [
"def",
"take_node_screenshot",
"(",
"self",
",",
"element",
",",
"screenshot_path",
")",
":",
"from",
"PIL",
"import",
"Image",
"temp_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tempdir",
",",
"screenshot_path",
")",
"el_x",
"=",
"int",
"(",
"element... | Take a screenshot of a node
Args:
element (object): the proxy_element
screenshot_path (str): the path where the screenshot will be saved | [
"Take",
"a",
"screenshot",
"of",
"a",
"node"
] | train | https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L888-L932 |
jf-parent/brome | brome/core/proxy_driver.py | ProxyDriver.take_screenshot | def take_screenshot(self, screenshot_name=None, screenshot_path=None):
"""Take a screenshot
Use the screenshot_name args when you want to take a
screenshot for reference
If the `runner:cache_screenshot` config is set to True then
screenshot sharing all the same name wil... | python | def take_screenshot(self, screenshot_name=None, screenshot_path=None):
"""Take a screenshot
Use the screenshot_name args when you want to take a
screenshot for reference
If the `runner:cache_screenshot` config is set to True then
screenshot sharing all the same name wil... | [
"def",
"take_screenshot",
"(",
"self",
",",
"screenshot_name",
"=",
"None",
",",
"screenshot_path",
"=",
"None",
")",
":",
"self",
".",
"info_log",
"(",
"\"Taking a screenshot...\"",
")",
"save_to_db",
"=",
"False",
"if",
"screenshot_path",
":",
"self",
".",
"... | Take a screenshot
Use the screenshot_name args when you want to take a
screenshot for reference
If the `runner:cache_screenshot` config is set to True then
screenshot sharing all the same name will be saved only once
The screenshot_path args is exclusively used by the
... | [
"Take",
"a",
"screenshot"
] | train | https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L934-L1026 |
jf-parent/brome | brome/core/proxy_driver.py | ProxyDriver.take_quality_screenshot | def take_quality_screenshot(self, screenshot_name):
"""Take a quality screenshot
Use the screenshot_name args when you want to take a
screenshot for reference
Args:
screenshot_name (str) the name of the screenshot
"""
self.info_log("Taking a quality scre... | python | def take_quality_screenshot(self, screenshot_name):
"""Take a quality screenshot
Use the screenshot_name args when you want to take a
screenshot for reference
Args:
screenshot_name (str) the name of the screenshot
"""
self.info_log("Taking a quality scre... | [
"def",
"take_quality_screenshot",
"(",
"self",
",",
"screenshot_name",
")",
":",
"self",
".",
"info_log",
"(",
"\"Taking a quality screenshot...\"",
")",
"if",
"self",
".",
"test_instance",
".",
"_runner_dir",
":",
"_screenshot_name",
"=",
"'%s.png'",
"%",
"string_t... | Take a quality screenshot
Use the screenshot_name args when you want to take a
screenshot for reference
Args:
screenshot_name (str) the name of the screenshot | [
"Take",
"a",
"quality",
"screenshot"
] | train | https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L1028-L1075 |
jf-parent/brome | brome/core/proxy_driver.py | ProxyDriver.assert_present | def assert_present(self, selector, testid=None, **kwargs):
"""Assert that the element is present in the dom
Args:
selector (str): the selector used to find the element
test_id (str): the test_id or a str
Kwargs:
wait_until_present (bool)
Returns:
... | python | def assert_present(self, selector, testid=None, **kwargs):
"""Assert that the element is present in the dom
Args:
selector (str): the selector used to find the element
test_id (str): the test_id or a str
Kwargs:
wait_until_present (bool)
Returns:
... | [
"def",
"assert_present",
"(",
"self",
",",
"selector",
",",
"testid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"info_log",
"(",
"\"Assert present selector(%s) testid(%s)\"",
"%",
"(",
"selector",
",",
"testid",
")",
")",
"wait_until_present... | Assert that the element is present in the dom
Args:
selector (str): the selector used to find the element
test_id (str): the test_id or a str
Kwargs:
wait_until_present (bool)
Returns:
bool: True is the assertion succeed; False otherwise. | [
"Assert",
"that",
"the",
"element",
"is",
"present",
"in",
"the",
"dom"
] | train | https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L1078-L1117 |
jf-parent/brome | brome/core/proxy_driver.py | ProxyDriver.assert_not_present | def assert_not_present(self, selector, testid=None, **kwargs):
"""Assert that the element is not present in the dom
Args:
selector (str): the selector used to find the element
test_id (str): the test_id or a str
Kwargs:
wait_until_not_present (bool)
... | python | def assert_not_present(self, selector, testid=None, **kwargs):
"""Assert that the element is not present in the dom
Args:
selector (str): the selector used to find the element
test_id (str): the test_id or a str
Kwargs:
wait_until_not_present (bool)
... | [
"def",
"assert_not_present",
"(",
"self",
",",
"selector",
",",
"testid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"info_log",
"(",
"\"Assert not present selector(%s) testid(%s)\"",
"%",
"(",
"selector",
",",
"testid",
")",
")",
"wait_until... | Assert that the element is not present in the dom
Args:
selector (str): the selector used to find the element
test_id (str): the test_id or a str
Kwargs:
wait_until_not_present (bool)
Returns:
bool: True is the assertion succeed; False otherwise... | [
"Assert",
"that",
"the",
"element",
"is",
"not",
"present",
"in",
"the",
"dom"
] | train | https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L1119-L1159 |
jf-parent/brome | brome/core/proxy_driver.py | ProxyDriver.assert_visible | def assert_visible(self, selector, testid=None, **kwargs):
"""Assert that the element is visible in the dom
Args:
selector (str): the selector used to find the element
testid (str): the test_id or a str
Kwargs:
wait_until_visible (bool)
highlight... | python | def assert_visible(self, selector, testid=None, **kwargs):
"""Assert that the element is visible in the dom
Args:
selector (str): the selector used to find the element
testid (str): the test_id or a str
Kwargs:
wait_until_visible (bool)
highlight... | [
"def",
"assert_visible",
"(",
"self",
",",
"selector",
",",
"testid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"info_log",
"(",
"\"Assert visible selector(%s) testid(%s)\"",
"%",
"(",
"selector",
",",
"testid",
")",
")",
"highlight",
"=",... | Assert that the element is visible in the dom
Args:
selector (str): the selector used to find the element
testid (str): the test_id or a str
Kwargs:
wait_until_visible (bool)
highlight (bool)
Returns:
bool: True is the assertion succ... | [
"Assert",
"that",
"the",
"element",
"is",
"visible",
"in",
"the",
"dom"
] | train | https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L1161-L1213 |
jf-parent/brome | brome/core/proxy_driver.py | ProxyDriver.assert_not_visible | def assert_not_visible(self, selector, testid=None, **kwargs):
"""Assert that the element is not visible in the dom
Args:
selector (str): the selector used to find the element
test_id (str): the test_id or a str
Kwargs:
wait_until_not_visible (bool)
... | python | def assert_not_visible(self, selector, testid=None, **kwargs):
"""Assert that the element is not visible in the dom
Args:
selector (str): the selector used to find the element
test_id (str): the test_id or a str
Kwargs:
wait_until_not_visible (bool)
... | [
"def",
"assert_not_visible",
"(",
"self",
",",
"selector",
",",
"testid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"info_log",
"(",
"\"Assert not visible selector(%s) testid(%s)\"",
"%",
"(",
"selector",
",",
"testid",
")",
")",
"highlight"... | Assert that the element is not visible in the dom
Args:
selector (str): the selector used to find the element
test_id (str): the test_id or a str
Kwargs:
wait_until_not_visible (bool)
highlight (bool)
Returns:
bool: True is the asser... | [
"Assert",
"that",
"the",
"element",
"is",
"not",
"visible",
"in",
"the",
"dom"
] | train | https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L1215-L1278 |
jf-parent/brome | brome/core/proxy_driver.py | ProxyDriver.assert_text_equal | def assert_text_equal(self, selector, value, testid=None, **kwargs):
"""Assert that the element's text is equal to the provided value
Args:
selector (str): the selector used to find the element
value (str): the value that will be compare
with the element.text val... | python | def assert_text_equal(self, selector, value, testid=None, **kwargs):
"""Assert that the element's text is equal to the provided value
Args:
selector (str): the selector used to find the element
value (str): the value that will be compare
with the element.text val... | [
"def",
"assert_text_equal",
"(",
"self",
",",
"selector",
",",
"value",
",",
"testid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"info_log",
"(",
"\"Assert text equal selector(%s) testid(%s)\"",
"%",
"(",
"selector",
",",
"testid",
")",
")... | Assert that the element's text is equal to the provided value
Args:
selector (str): the selector used to find the element
value (str): the value that will be compare
with the element.text value
test_id (str): the test_id or a str
Kwargs:
... | [
"Assert",
"that",
"the",
"element",
"s",
"text",
"is",
"equal",
"to",
"the",
"provided",
"value"
] | train | https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L1280-L1340 |
heuer/cablemap | cablemap.nlp/cablemap/nlp/corpus.py | BaseCorpus.add_texts | def add_texts(self, reference_id, texts):
"""\
Adds the words from the provided iterable `texts` to the corpus.
The strings will be tokenized.
`reference_id`
The reference identifier of the cable.
`texts`
An iterable of strings.
"""
self.... | python | def add_texts(self, reference_id, texts):
"""\
Adds the words from the provided iterable `texts` to the corpus.
The strings will be tokenized.
`reference_id`
The reference identifier of the cable.
`texts`
An iterable of strings.
"""
self.... | [
"def",
"add_texts",
"(",
"self",
",",
"reference_id",
",",
"texts",
")",
":",
"self",
".",
"add_words",
"(",
"reference_id",
",",
"chain",
"(",
"*",
"(",
"self",
".",
"_tokenize",
"(",
"t",
")",
"for",
"t",
"in",
"texts",
")",
")",
")"
] | \
Adds the words from the provided iterable `texts` to the corpus.
The strings will be tokenized.
`reference_id`
The reference identifier of the cable.
`texts`
An iterable of strings. | [
"\\",
"Adds",
"the",
"words",
"from",
"the",
"provided",
"iterable",
"texts",
"to",
"the",
"corpus",
"."
] | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.nlp/cablemap/nlp/corpus.py#L65-L76 |
heuer/cablemap | cablemap.nlp/cablemap/nlp/corpus.py | BaseCorpus.add_text | def add_text(self, reference_id, text):
"""\
Adds the words from the provided text to the corpus.
The string will be tokenized.
`reference_id`
The reference identifier of the cable.
`text`
An string.
"""
self.add_words(reference_id, self.... | python | def add_text(self, reference_id, text):
"""\
Adds the words from the provided text to the corpus.
The string will be tokenized.
`reference_id`
The reference identifier of the cable.
`text`
An string.
"""
self.add_words(reference_id, self.... | [
"def",
"add_text",
"(",
"self",
",",
"reference_id",
",",
"text",
")",
":",
"self",
".",
"add_words",
"(",
"reference_id",
",",
"self",
".",
"_tokenize",
"(",
"text",
")",
")"
] | \
Adds the words from the provided text to the corpus.
The string will be tokenized.
`reference_id`
The reference identifier of the cable.
`text`
An string. | [
"\\",
"Adds",
"the",
"words",
"from",
"the",
"provided",
"text",
"to",
"the",
"corpus",
"."
] | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.nlp/cablemap/nlp/corpus.py#L78-L89 |
tapilab/twutil | twutil/collect.py | list_members | def list_members(slug, owner_screen_name, limit=1e10):
"""See https://dev.twitter.com/rest/reference/get/lists/members"""
cursor = -1
members = []
try:
response = twapi.request('lists/members', {'slug': slug, 'owner_screen_name': owner_screen_name, 'cursor': cursor, 'count': 5000})
if re... | python | def list_members(slug, owner_screen_name, limit=1e10):
"""See https://dev.twitter.com/rest/reference/get/lists/members"""
cursor = -1
members = []
try:
response = twapi.request('lists/members', {'slug': slug, 'owner_screen_name': owner_screen_name, 'cursor': cursor, 'count': 5000})
if re... | [
"def",
"list_members",
"(",
"slug",
",",
"owner_screen_name",
",",
"limit",
"=",
"1e10",
")",
":",
"cursor",
"=",
"-",
"1",
"members",
"=",
"[",
"]",
"try",
":",
"response",
"=",
"twapi",
".",
"request",
"(",
"'lists/members'",
",",
"{",
"'slug'",
":",... | See https://dev.twitter.com/rest/reference/get/lists/members | [
"See",
"https",
":",
"//",
"dev",
".",
"twitter",
".",
"com",
"/",
"rest",
"/",
"reference",
"/",
"get",
"/",
"lists",
"/",
"members"
] | train | https://github.com/tapilab/twutil/blob/c967120c41a6e216f3d476214b85a736cade0e29/twutil/collect.py#L33-L51 |
tapilab/twutil | twutil/collect.py | lookup_handles | def lookup_handles(ids):
""" Fetch the twitter screen_names of each id. """
names = set()
for id_list in [ids[100 * i:100 * i + 100] for i in range(len(ids))]:
if len(id_list) > 0:
while True:
r = twapi.request('users/lookup', {'user_id': ','.join([str(i) for i in id_list... | python | def lookup_handles(ids):
""" Fetch the twitter screen_names of each id. """
names = set()
for id_list in [ids[100 * i:100 * i + 100] for i in range(len(ids))]:
if len(id_list) > 0:
while True:
r = twapi.request('users/lookup', {'user_id': ','.join([str(i) for i in id_list... | [
"def",
"lookup_handles",
"(",
"ids",
")",
":",
"names",
"=",
"set",
"(",
")",
"for",
"id_list",
"in",
"[",
"ids",
"[",
"100",
"*",
"i",
":",
"100",
"*",
"i",
"+",
"100",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"ids",
")",
")",
"]",
... | Fetch the twitter screen_names of each id. | [
"Fetch",
"the",
"twitter",
"screen_names",
"of",
"each",
"id",
"."
] | train | https://github.com/tapilab/twutil/blob/c967120c41a6e216f3d476214b85a736cade0e29/twutil/collect.py#L54-L72 |
tapilab/twutil | twutil/collect.py | lookup_ids | def lookup_ids(handles):
""" Fetch the twitter ids of each screen_name. """
ids = set()
for handle_list in [handles[100 * i:100 * i + 100] for i in range(len(handles))]:
if len(handle_list) > 0:
while True:
r = twapi.request('users/lookup', {'screen_name': ','.join(handle... | python | def lookup_ids(handles):
""" Fetch the twitter ids of each screen_name. """
ids = set()
for handle_list in [handles[100 * i:100 * i + 100] for i in range(len(handles))]:
if len(handle_list) > 0:
while True:
r = twapi.request('users/lookup', {'screen_name': ','.join(handle... | [
"def",
"lookup_ids",
"(",
"handles",
")",
":",
"ids",
"=",
"set",
"(",
")",
"for",
"handle_list",
"in",
"[",
"handles",
"[",
"100",
"*",
"i",
":",
"100",
"*",
"i",
"+",
"100",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"handles",
")",
")"... | Fetch the twitter ids of each screen_name. | [
"Fetch",
"the",
"twitter",
"ids",
"of",
"each",
"screen_name",
"."
] | train | https://github.com/tapilab/twutil/blob/c967120c41a6e216f3d476214b85a736cade0e29/twutil/collect.py#L75-L93 |
tapilab/twutil | twutil/collect.py | tweets_for_id | def tweets_for_id(user_id, limit=1e10):
""" Collect the most recent 3200 tweets for this user_id, sleeping to deal with rate limits."""
# Map id to screen_name
r = twapi.request('users/lookup', {'user_id': user_id})
if r.status_code == 200:
sname = [t for t in r][0]['screen_name']
return... | python | def tweets_for_id(user_id, limit=1e10):
""" Collect the most recent 3200 tweets for this user_id, sleeping to deal with rate limits."""
# Map id to screen_name
r = twapi.request('users/lookup', {'user_id': user_id})
if r.status_code == 200:
sname = [t for t in r][0]['screen_name']
return... | [
"def",
"tweets_for_id",
"(",
"user_id",
",",
"limit",
"=",
"1e10",
")",
":",
"# Map id to screen_name",
"r",
"=",
"twapi",
".",
"request",
"(",
"'users/lookup'",
",",
"{",
"'user_id'",
":",
"user_id",
"}",
")",
"if",
"r",
".",
"status_code",
"==",
"200",
... | Collect the most recent 3200 tweets for this user_id, sleeping to deal with rate limits. | [
"Collect",
"the",
"most",
"recent",
"3200",
"tweets",
"for",
"this",
"user_id",
"sleeping",
"to",
"deal",
"with",
"rate",
"limits",
"."
] | train | https://github.com/tapilab/twutil/blob/c967120c41a6e216f3d476214b85a736cade0e29/twutil/collect.py#L96-L104 |
tapilab/twutil | twutil/collect.py | tweets_for_user | def tweets_for_user(screen_name, limit=1e10):
""" Collect the most recent 3200 tweets for this user, sleeping to deal with rate limits."""
qu = Queue()
p = Thread(target=_tweets_for_user, args=(qu, screen_name, limit))
p.start()
p.join(910)
if p.is_alive():
sys.stderr.write('no results a... | python | def tweets_for_user(screen_name, limit=1e10):
""" Collect the most recent 3200 tweets for this user, sleeping to deal with rate limits."""
qu = Queue()
p = Thread(target=_tweets_for_user, args=(qu, screen_name, limit))
p.start()
p.join(910)
if p.is_alive():
sys.stderr.write('no results a... | [
"def",
"tweets_for_user",
"(",
"screen_name",
",",
"limit",
"=",
"1e10",
")",
":",
"qu",
"=",
"Queue",
"(",
")",
"p",
"=",
"Thread",
"(",
"target",
"=",
"_tweets_for_user",
",",
"args",
"=",
"(",
"qu",
",",
"screen_name",
",",
"limit",
")",
")",
"p",... | Collect the most recent 3200 tweets for this user, sleeping to deal with rate limits. | [
"Collect",
"the",
"most",
"recent",
"3200",
"tweets",
"for",
"this",
"user",
"sleeping",
"to",
"deal",
"with",
"rate",
"limits",
"."
] | train | https://github.com/tapilab/twutil/blob/c967120c41a6e216f3d476214b85a736cade0e29/twutil/collect.py#L107-L117 |
tapilab/twutil | twutil/collect.py | track_locations | def track_locations(locations):
""" Return an iterator tweets from users in these locations.
See https://dev.twitter.com/streaming/overview/request-parameters#locations
Params:
locations...list of bounding box locations of the form:
southwest_longitude, southwest_latitude, northeast_longitud... | python | def track_locations(locations):
""" Return an iterator tweets from users in these locations.
See https://dev.twitter.com/streaming/overview/request-parameters#locations
Params:
locations...list of bounding box locations of the form:
southwest_longitude, southwest_latitude, northeast_longitud... | [
"def",
"track_locations",
"(",
"locations",
")",
":",
"if",
"len",
"(",
"locations",
")",
"%",
"4",
"!=",
"0",
":",
"raise",
"Exception",
"(",
"'length of bounding box list should be a multiple of four'",
")",
"results",
"=",
"twapi",
".",
"request",
"(",
"'stat... | Return an iterator tweets from users in these locations.
See https://dev.twitter.com/streaming/overview/request-parameters#locations
Params:
locations...list of bounding box locations of the form:
southwest_longitude, southwest_latitude, northeast_longitude, northeast_latitude, ... | [
"Return",
"an",
"iterator",
"tweets",
"from",
"users",
"in",
"these",
"locations",
".",
"See",
"https",
":",
"//",
"dev",
".",
"twitter",
".",
"com",
"/",
"streaming",
"/",
"overview",
"/",
"request",
"-",
"parameters#locations",
"Params",
":",
"locations",
... | train | https://github.com/tapilab/twutil/blob/c967120c41a6e216f3d476214b85a736cade0e29/twutil/collect.py#L160-L170 |
tapilab/twutil | twutil/collect.py | get_followers | def get_followers(id_=None, screen_name=None, limit=1e10):
""" Either id_ or screen_name must not be None. """
# FIXME: DRY from _tweets_for_user
if not (id_ or screen_name):
raise Exception("either id_ or screen_name must not be None")
if id_:
key = 'user_id'
val = id_
else:... | python | def get_followers(id_=None, screen_name=None, limit=1e10):
""" Either id_ or screen_name must not be None. """
# FIXME: DRY from _tweets_for_user
if not (id_ or screen_name):
raise Exception("either id_ or screen_name must not be None")
if id_:
key = 'user_id'
val = id_
else:... | [
"def",
"get_followers",
"(",
"id_",
"=",
"None",
",",
"screen_name",
"=",
"None",
",",
"limit",
"=",
"1e10",
")",
":",
"# FIXME: DRY from _tweets_for_user",
"if",
"not",
"(",
"id_",
"or",
"screen_name",
")",
":",
"raise",
"Exception",
"(",
"\"either id_ or scr... | Either id_ or screen_name must not be None. | [
"Either",
"id_",
"or",
"screen_name",
"must",
"not",
"be",
"None",
"."
] | train | https://github.com/tapilab/twutil/blob/c967120c41a6e216f3d476214b85a736cade0e29/twutil/collect.py#L266-L305 |
balanced/wac | example.py | configure | def configure(root_url, **kwargs):
""""
Notice that `configure` can either apply to the default configuration or
`Client.config`, which is the configuration used by the current thread
since `Client` inherits form `threading.local`.
"""
default = kwargs.pop('default', True)
kwargs['client_ag... | python | def configure(root_url, **kwargs):
""""
Notice that `configure` can either apply to the default configuration or
`Client.config`, which is the configuration used by the current thread
since `Client` inherits form `threading.local`.
"""
default = kwargs.pop('default', True)
kwargs['client_ag... | [
"def",
"configure",
"(",
"root_url",
",",
"*",
"*",
"kwargs",
")",
":",
"default",
"=",
"kwargs",
".",
"pop",
"(",
"'default'",
",",
"True",
")",
"kwargs",
"[",
"'client_agent'",
"]",
"=",
"'example-client/'",
"+",
"__version__",
"if",
"'headers'",
"not",
... | Notice that `configure` can either apply to the default configuration or
`Client.config`, which is the configuration used by the current thread
since `Client` inherits form `threading.local`. | [
"Notice",
"that",
"configure",
"can",
"either",
"apply",
"to",
"the",
"default",
"configuration",
"or",
"Client",
".",
"config",
"which",
"is",
"the",
"configuration",
"used",
"by",
"the",
"current",
"thread",
"since",
"Client",
"inherits",
"form",
"threading",
... | train | https://github.com/balanced/wac/blob/6ec254be601154c94c9747cf235286de24aa2259/example.py#L18-L32 |
praekelt/django-moderator | moderator/utils.py | classify_comment | def classify_comment(comment, cls=None):
"""
If 'reported' class is provided no training occures, the comment's class
is simply set as such and removed.
If no class is provided a lookup is done to see if the comment has been
reported by users as abusive. If indicated as abusive class is set
as ... | python | def classify_comment(comment, cls=None):
"""
If 'reported' class is provided no training occures, the comment's class
is simply set as such and removed.
If no class is provided a lookup is done to see if the comment has been
reported by users as abusive. If indicated as abusive class is set
as ... | [
"def",
"classify_comment",
"(",
"comment",
",",
"cls",
"=",
"None",
")",
":",
"if",
"cls",
"not",
"in",
"[",
"'spam'",
",",
"'ham'",
",",
"'unsure'",
",",
"'reported'",
",",
"None",
"]",
":",
"raise",
"Exception",
"(",
"\"Unrecognized classifications.\"",
... | If 'reported' class is provided no training occures, the comment's class
is simply set as such and removed.
If no class is provided a lookup is done to see if the comment has been
reported by users as abusive. If indicated as abusive class is set
as 'reported'and the comment being removed. | [
"If",
"reported",
"class",
"is",
"provided",
"no",
"training",
"occures",
"the",
"comment",
"s",
"class",
"is",
"simply",
"set",
"as",
"such",
"and",
"removed",
"."
] | train | https://github.com/praekelt/django-moderator/blob/72f1d5259128ff5a1a0341d4a573bfd561ba4665/moderator/utils.py#L8-L72 |
heuer/cablemap | cablemap.core/cablemap/core/c14n.py | canonicalize_origin | def canonicalize_origin(origin):
"""\
"""
origin = origin.replace(u'USMISSION', u'') \
.replace(u'AMEMBASSY', u'') \
.replace(u'EMBASSY', u'').strip()
return _STATION_C14N.get(origin, origin) | python | def canonicalize_origin(origin):
"""\
"""
origin = origin.replace(u'USMISSION', u'') \
.replace(u'AMEMBASSY', u'') \
.replace(u'EMBASSY', u'').strip()
return _STATION_C14N.get(origin, origin) | [
"def",
"canonicalize_origin",
"(",
"origin",
")",
":",
"origin",
"=",
"origin",
".",
"replace",
"(",
"u'USMISSION'",
",",
"u''",
")",
".",
"replace",
"(",
"u'AMEMBASSY'",
",",
"u''",
")",
".",
"replace",
"(",
"u'EMBASSY'",
",",
"u''",
")",
".",
"strip",
... | \ | [
"\\"
] | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/c14n.py#L174-L181 |
heuer/cablemap | cablemap.core/cablemap/core/c14n.py | canonicalize_id | def canonicalize_id(reference_id):
"""\
Returns the canonicalized form of the provided reference_id.
WikiLeaks provides some malformed cable identifiers. If the provided `reference_id`
is not valid, this method returns the valid reference identifier equivalent.
If the reference identifier is valid,... | python | def canonicalize_id(reference_id):
"""\
Returns the canonicalized form of the provided reference_id.
WikiLeaks provides some malformed cable identifiers. If the provided `reference_id`
is not valid, this method returns the valid reference identifier equivalent.
If the reference identifier is valid,... | [
"def",
"canonicalize_id",
"(",
"reference_id",
")",
":",
"rid",
"=",
"MALFORMED_CABLE_IDS",
".",
"get",
"(",
"reference_id",
",",
"None",
")",
"or",
"INVALID_CABLE_IDS",
".",
"get",
"(",
"reference_id",
",",
"None",
")",
"if",
"rid",
":",
"reference_id",
"="... | \
Returns the canonicalized form of the provided reference_id.
WikiLeaks provides some malformed cable identifiers. If the provided `reference_id`
is not valid, this method returns the valid reference identifier equivalent.
If the reference identifier is valid, the reference id is returned unchanged.
... | [
"\\",
"Returns",
"the",
"canonicalized",
"form",
"of",
"the",
"provided",
"reference_id",
"."
] | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/c14n.py#L184-L207 |
goshuirc/irc | girc/capabilities.py | cap_list | def cap_list(caps):
"""Given a cap string, return a list of cap, value."""
out = []
caps = caps.split()
for cap in caps:
# turn modifier chars into named modifiers
mods = []
while len(cap) > 0 and cap[0] in cap_modifiers:
attr = cap[0]
cap = cap[1:]
... | python | def cap_list(caps):
"""Given a cap string, return a list of cap, value."""
out = []
caps = caps.split()
for cap in caps:
# turn modifier chars into named modifiers
mods = []
while len(cap) > 0 and cap[0] in cap_modifiers:
attr = cap[0]
cap = cap[1:]
... | [
"def",
"cap_list",
"(",
"caps",
")",
":",
"out",
"=",
"[",
"]",
"caps",
"=",
"caps",
".",
"split",
"(",
")",
"for",
"cap",
"in",
"caps",
":",
"# turn modifier chars into named modifiers",
"mods",
"=",
"[",
"]",
"while",
"len",
"(",
"cap",
")",
">",
"... | Given a cap string, return a list of cap, value. | [
"Given",
"a",
"cap",
"string",
"return",
"a",
"list",
"of",
"cap",
"value",
"."
] | train | https://github.com/goshuirc/irc/blob/d6a5e3e04d337566c009b087f108cd76f9e122cc/girc/capabilities.py#L13-L38 |
peterldowns/djoauth2 | example/manage.py | addPath | def addPath(rel_path, prepend=False):
""" Adds a directory to the system python path, either by append (doesn't
override default or globally installed package names) or by prepend
(overrides default/global package names).
"""
path = lambda *paths: os.path.abspath(
os.path.join(os.path.dirnam... | python | def addPath(rel_path, prepend=False):
""" Adds a directory to the system python path, either by append (doesn't
override default or globally installed package names) or by prepend
(overrides default/global package names).
"""
path = lambda *paths: os.path.abspath(
os.path.join(os.path.dirnam... | [
"def",
"addPath",
"(",
"rel_path",
",",
"prepend",
"=",
"False",
")",
":",
"path",
"=",
"lambda",
"*",
"paths",
":",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
... | Adds a directory to the system python path, either by append (doesn't
override default or globally installed package names) or by prepend
(overrides default/global package names). | [
"Adds",
"a",
"directory",
"to",
"the",
"system",
"python",
"path",
"either",
"by",
"append",
"(",
"doesn",
"t",
"override",
"default",
"or",
"globally",
"installed",
"package",
"names",
")",
"or",
"by",
"prepend",
"(",
"overrides",
"default",
"/",
"global",
... | train | https://github.com/peterldowns/djoauth2/blob/151c7619d1d7a91d720397cfecf3a29fcc9747a9/example/manage.py#L5-L14 |
basilfx/flask-daapserver | daapserver/utils.py | diff | def diff(new, old):
"""
Compute the difference in items of two revisioned collections. If only
`new' is specified, it is assumed it is not an update. If both are set,
the removed items are returned first. Otherwise, the updated and edited
ones are returned.
:param set new: Set of new objects
... | python | def diff(new, old):
"""
Compute the difference in items of two revisioned collections. If only
`new' is specified, it is assumed it is not an update. If both are set,
the removed items are returned first. Otherwise, the updated and edited
ones are returned.
:param set new: Set of new objects
... | [
"def",
"diff",
"(",
"new",
",",
"old",
")",
":",
"if",
"old",
"is",
"not",
"None",
":",
"is_update",
"=",
"True",
"removed",
"=",
"set",
"(",
"new",
".",
"removed",
"(",
"old",
")",
")",
"updated",
"=",
"set",
"(",
"new",
".",
"updated",
"(",
"... | Compute the difference in items of two revisioned collections. If only
`new' is specified, it is assumed it is not an update. If both are set,
the removed items are returned first. Otherwise, the updated and edited
ones are returned.
:param set new: Set of new objects
:param set old: Set of old obj... | [
"Compute",
"the",
"difference",
"in",
"items",
"of",
"two",
"revisioned",
"collections",
".",
"If",
"only",
"new",
"is",
"specified",
"it",
"is",
"assumed",
"it",
"is",
"not",
"an",
"update",
".",
"If",
"both",
"are",
"set",
"the",
"removed",
"items",
"a... | train | https://github.com/basilfx/flask-daapserver/blob/ca595fcbc5b657cba826eccd3be5cebba0a1db0e/daapserver/utils.py#L6-L30 |
basilfx/flask-daapserver | daapserver/utils.py | parse_byte_range | def parse_byte_range(byte_range, min_byte=0, max_byte=sys.maxint):
"""
Parse and validate a byte range. A byte range is a tuple of (begin, end)
indices. `begin' should be smaller than `end', and both should fall within
the `min_byte' and `max_byte'.
In case of a violation, a `ValueError` is raised.... | python | def parse_byte_range(byte_range, min_byte=0, max_byte=sys.maxint):
"""
Parse and validate a byte range. A byte range is a tuple of (begin, end)
indices. `begin' should be smaller than `end', and both should fall within
the `min_byte' and `max_byte'.
In case of a violation, a `ValueError` is raised.... | [
"def",
"parse_byte_range",
"(",
"byte_range",
",",
"min_byte",
"=",
"0",
",",
"max_byte",
"=",
"sys",
".",
"maxint",
")",
":",
"if",
"not",
"byte_range",
":",
"return",
"min_byte",
",",
"max_byte",
"begin",
"=",
"byte_range",
"[",
"0",
"]",
"or",
"min_by... | Parse and validate a byte range. A byte range is a tuple of (begin, end)
indices. `begin' should be smaller than `end', and both should fall within
the `min_byte' and `max_byte'.
In case of a violation, a `ValueError` is raised. | [
"Parse",
"and",
"validate",
"a",
"byte",
"range",
".",
"A",
"byte",
"range",
"is",
"a",
"tuple",
"of",
"(",
"begin",
"end",
")",
"indices",
".",
"begin",
"should",
"be",
"smaller",
"than",
"end",
"and",
"both",
"should",
"fall",
"within",
"the",
"min_b... | train | https://github.com/basilfx/flask-daapserver/blob/ca595fcbc5b657cba826eccd3be5cebba0a1db0e/daapserver/utils.py#L45-L69 |
basilfx/flask-daapserver | daapserver/utils.py | to_tree | def to_tree(instance, *children):
"""
Generate tree structure of an instance, and its children. This method
yields its results, instead of returning them.
"""
# Yield representation of self
yield unicode(instance)
# Iterate trough each instance child collection
for i, child in enumerat... | python | def to_tree(instance, *children):
"""
Generate tree structure of an instance, and its children. This method
yields its results, instead of returning them.
"""
# Yield representation of self
yield unicode(instance)
# Iterate trough each instance child collection
for i, child in enumerat... | [
"def",
"to_tree",
"(",
"instance",
",",
"*",
"children",
")",
":",
"# Yield representation of self",
"yield",
"unicode",
"(",
"instance",
")",
"# Iterate trough each instance child collection",
"for",
"i",
",",
"child",
"in",
"enumerate",
"(",
"children",
")",
":",
... | Generate tree structure of an instance, and its children. This method
yields its results, instead of returning them. | [
"Generate",
"tree",
"structure",
"of",
"an",
"instance",
"and",
"its",
"children",
".",
"This",
"method",
"yields",
"its",
"results",
"instead",
"of",
"returning",
"them",
"."
] | train | https://github.com/basilfx/flask-daapserver/blob/ca595fcbc5b657cba826eccd3be5cebba0a1db0e/daapserver/utils.py#L72-L114 |
basilfx/flask-daapserver | daapserver/utils.py | invoke_hooks | def invoke_hooks(hooks, name, *args, **kwargs):
"""
Invoke one or more hooks that have been registered under `name'. Additional
arguments and keyword arguments can be provided.
There is no exception catching, so if a hook fails, it will disrupt the
chain and/or rest of program.
"""
callbac... | python | def invoke_hooks(hooks, name, *args, **kwargs):
"""
Invoke one or more hooks that have been registered under `name'. Additional
arguments and keyword arguments can be provided.
There is no exception catching, so if a hook fails, it will disrupt the
chain and/or rest of program.
"""
callbac... | [
"def",
"invoke_hooks",
"(",
"hooks",
",",
"name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"callbacks",
"=",
"hooks",
".",
"get",
"(",
"name",
",",
"[",
"]",
")",
"for",
"callback",
"in",
"callbacks",
":",
"callback",
"(",
"*",
"args",
... | Invoke one or more hooks that have been registered under `name'. Additional
arguments and keyword arguments can be provided.
There is no exception catching, so if a hook fails, it will disrupt the
chain and/or rest of program. | [
"Invoke",
"one",
"or",
"more",
"hooks",
"that",
"have",
"been",
"registered",
"under",
"name",
".",
"Additional",
"arguments",
"and",
"keyword",
"arguments",
"can",
"be",
"provided",
"."
] | train | https://github.com/basilfx/flask-daapserver/blob/ca595fcbc5b657cba826eccd3be5cebba0a1db0e/daapserver/utils.py#L117-L129 |
StyXman/ayrton | ayrton/logger.py | Logger.findCaller | def findCaller(self, stack_info=False, callers=0):
"""
Find the stack frame of the caller so that we can note the source
file name, line number and function name. Not only ignore this class's
and logger's source, but also as many callers as requested.
"""
f = logging.curr... | python | def findCaller(self, stack_info=False, callers=0):
"""
Find the stack frame of the caller so that we can note the source
file name, line number and function name. Not only ignore this class's
and logger's source, but also as many callers as requested.
"""
f = logging.curr... | [
"def",
"findCaller",
"(",
"self",
",",
"stack_info",
"=",
"False",
",",
"callers",
"=",
"0",
")",
":",
"f",
"=",
"logging",
".",
"currentframe",
"(",
")",
"#On some versions of IronPython, currentframe() returns None if",
"#IronPython isn't run with -X:Frames.",
"if",
... | Find the stack frame of the caller so that we can note the source
file name, line number and function name. Not only ignore this class's
and logger's source, but also as many callers as requested. | [
"Find",
"the",
"stack",
"frame",
"of",
"the",
"caller",
"so",
"that",
"we",
"can",
"note",
"the",
"source",
"file",
"name",
"line",
"number",
"and",
"function",
"name",
".",
"Not",
"only",
"ignore",
"this",
"class",
"s",
"and",
"logger",
"s",
"source",
... | train | https://github.com/StyXman/ayrton/blob/e1eed5c7ef230e3c2340a1f0bf44c72bbdc0debb/ayrton/logger.py#L43-L84 |
StyXman/ayrton | ayrton/logger.py | Logger._log | def _log(self, level, msg, args, exc_info=None, extra=None, stack_info=False,
callers=0):
"""
Low-level logging routine which creates a LogRecord and then calls
all the handlers of this logger to handle the record.
"""
sinfo = None
if _srcfile:
#I... | python | def _log(self, level, msg, args, exc_info=None, extra=None, stack_info=False,
callers=0):
"""
Low-level logging routine which creates a LogRecord and then calls
all the handlers of this logger to handle the record.
"""
sinfo = None
if _srcfile:
#I... | [
"def",
"_log",
"(",
"self",
",",
"level",
",",
"msg",
",",
"args",
",",
"exc_info",
"=",
"None",
",",
"extra",
"=",
"None",
",",
"stack_info",
"=",
"False",
",",
"callers",
"=",
"0",
")",
":",
"sinfo",
"=",
"None",
"if",
"_srcfile",
":",
"#IronPyth... | Low-level logging routine which creates a LogRecord and then calls
all the handlers of this logger to handle the record. | [
"Low",
"-",
"level",
"logging",
"routine",
"which",
"creates",
"a",
"LogRecord",
"and",
"then",
"calls",
"all",
"the",
"handlers",
"of",
"this",
"logger",
"to",
"handle",
"the",
"record",
"."
] | train | https://github.com/StyXman/ayrton/blob/e1eed5c7ef230e3c2340a1f0bf44c72bbdc0debb/ayrton/logger.py#L88-L112 |
ssato/python-anytemplate | anytemplate/compat.py | get_file_extension | def get_file_extension(filepath):
"""
Copy if anyconfig.utils.get_file_extension is not available.
>>> get_file_extension("/a/b/c")
''
>>> get_file_extension("/a/b.txt")
'txt'
>>> get_file_extension("/a/b/c.tar.xz")
'xz'
"""
_ext = os.path.splitext(filepath)[-1]
if _ext:
... | python | def get_file_extension(filepath):
"""
Copy if anyconfig.utils.get_file_extension is not available.
>>> get_file_extension("/a/b/c")
''
>>> get_file_extension("/a/b.txt")
'txt'
>>> get_file_extension("/a/b/c.tar.xz")
'xz'
"""
_ext = os.path.splitext(filepath)[-1]
if _ext:
... | [
"def",
"get_file_extension",
"(",
"filepath",
")",
":",
"_ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filepath",
")",
"[",
"-",
"1",
"]",
"if",
"_ext",
":",
"return",
"_ext",
"[",
"1",
":",
"]",
"if",
"_ext",
".",
"startswith",
"(",
"'.'",... | Copy if anyconfig.utils.get_file_extension is not available.
>>> get_file_extension("/a/b/c")
''
>>> get_file_extension("/a/b.txt")
'txt'
>>> get_file_extension("/a/b/c.tar.xz")
'xz' | [
"Copy",
"if",
"anyconfig",
".",
"utils",
".",
"get_file_extension",
"is",
"not",
"available",
"."
] | train | https://github.com/ssato/python-anytemplate/blob/3e56baa914bd47f044083b20e33100f836443596/anytemplate/compat.py#L57-L72 |
hospadar/sqlite_object | sqlite_object/_sqlite_list.py | SqliteList.append | def append(self, item):
"""
Add an item to the end of the list
"""
with self.lock:
with self._closeable_cursor() as cursor:
cursor.execute('''INSERT INTO list (list_index, value) VALUES ((SELECT MAX(list_index) FROM list) + 1, ?)''', (self._coder(item), ) )
... | python | def append(self, item):
"""
Add an item to the end of the list
"""
with self.lock:
with self._closeable_cursor() as cursor:
cursor.execute('''INSERT INTO list (list_index, value) VALUES ((SELECT MAX(list_index) FROM list) + 1, ?)''', (self._coder(item), ) )
... | [
"def",
"append",
"(",
"self",
",",
"item",
")",
":",
"with",
"self",
".",
"lock",
":",
"with",
"self",
".",
"_closeable_cursor",
"(",
")",
"as",
"cursor",
":",
"cursor",
".",
"execute",
"(",
"'''INSERT INTO list (list_index, value) VALUES ((SELECT MAX(list_index) ... | Add an item to the end of the list | [
"Add",
"an",
"item",
"to",
"the",
"end",
"of",
"the",
"list"
] | train | https://github.com/hospadar/sqlite_object/blob/a24a5d297f10a7d68b5f3e3b744654efb1eee9d4/sqlite_object/_sqlite_list.py#L148-L155 |
hospadar/sqlite_object | sqlite_object/_sqlite_list.py | SqliteList.extend | def extend(self, iterable):
"""
Add each item from iterable to the end of the list
"""
with self.lock:
for item in iterable:
self.append(item) | python | def extend(self, iterable):
"""
Add each item from iterable to the end of the list
"""
with self.lock:
for item in iterable:
self.append(item) | [
"def",
"extend",
"(",
"self",
",",
"iterable",
")",
":",
"with",
"self",
".",
"lock",
":",
"for",
"item",
"in",
"iterable",
":",
"self",
".",
"append",
"(",
"item",
")"
] | Add each item from iterable to the end of the list | [
"Add",
"each",
"item",
"from",
"iterable",
"to",
"the",
"end",
"of",
"the",
"list"
] | train | https://github.com/hospadar/sqlite_object/blob/a24a5d297f10a7d68b5f3e3b744654efb1eee9d4/sqlite_object/_sqlite_list.py#L198-L204 |
pennlabs/penncoursereview-sdk-python | penncoursereview/penncoursereview.py | fetch_pcr | def fetch_pcr(*args, **kwargs):
"""Wrapper for fetch to automatically parse results from the PCR API."""
# Load user's token from `PCR_AUTH_TOKEN`, use public token as default if missing
kwargs['token'] = os.getenv("PCR_AUTH_TOKEN", "public")
return fetch(DOMAIN, *args, **kwargs)['result'] | python | def fetch_pcr(*args, **kwargs):
"""Wrapper for fetch to automatically parse results from the PCR API."""
# Load user's token from `PCR_AUTH_TOKEN`, use public token as default if missing
kwargs['token'] = os.getenv("PCR_AUTH_TOKEN", "public")
return fetch(DOMAIN, *args, **kwargs)['result'] | [
"def",
"fetch_pcr",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Load user's token from `PCR_AUTH_TOKEN`, use public token as default if missing",
"kwargs",
"[",
"'token'",
"]",
"=",
"os",
".",
"getenv",
"(",
"\"PCR_AUTH_TOKEN\"",
",",
"\"public\"",
")",
... | Wrapper for fetch to automatically parse results from the PCR API. | [
"Wrapper",
"for",
"fetch",
"to",
"automatically",
"parse",
"results",
"from",
"the",
"PCR",
"API",
"."
] | train | https://github.com/pennlabs/penncoursereview-sdk-python/blob/f9f2f1bfcadf0aff50133e35d761f6d1cf85b564/penncoursereview/penncoursereview.py#L14-L18 |
heuer/cablemap | cablemap.core/cablemap/core/reader.py | reference_id_from_filename | def reference_id_from_filename(filename):
"""\
Extracts the reference identifier from the provided filename.
"""
reference_id = os.path.basename(filename)
if reference_id.rfind('.htm') > 0:
reference_id = reference_id[:reference_id.rfind('.')]
#TODO: else: raise ValueError('bla bla')?
... | python | def reference_id_from_filename(filename):
"""\
Extracts the reference identifier from the provided filename.
"""
reference_id = os.path.basename(filename)
if reference_id.rfind('.htm') > 0:
reference_id = reference_id[:reference_id.rfind('.')]
#TODO: else: raise ValueError('bla bla')?
... | [
"def",
"reference_id_from_filename",
"(",
"filename",
")",
":",
"reference_id",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
"if",
"reference_id",
".",
"rfind",
"(",
"'.htm'",
")",
">",
"0",
":",
"reference_id",
"=",
"reference_id",
"[",
... | \
Extracts the reference identifier from the provided filename. | [
"\\",
"Extracts",
"the",
"reference",
"identifier",
"from",
"the",
"provided",
"filename",
"."
] | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/reader.py#L45-L53 |
heuer/cablemap | cablemap.core/cablemap/core/reader.py | canonicalize_id | def canonicalize_id(reference_id):
"""\
Returns the canonicalized form of the provided reference_id.
WikiLeaks provides some malformed cable identifiers. If the provided `reference_id`
is not valid, this method returns the valid reference identifier equivalent.
If the reference identifier is valid,... | python | def canonicalize_id(reference_id):
"""\
Returns the canonicalized form of the provided reference_id.
WikiLeaks provides some malformed cable identifiers. If the provided `reference_id`
is not valid, this method returns the valid reference identifier equivalent.
If the reference identifier is valid,... | [
"def",
"canonicalize_id",
"(",
"reference_id",
")",
":",
"if",
"u'EMBASSY'",
"in",
"reference_id",
":",
"return",
"reference_id",
".",
"replace",
"(",
"u'EMBASSY'",
",",
"u''",
")",
"m",
"=",
"_C14N_PATTERN",
".",
"match",
"(",
"reference_id",
")",
"if",
"m"... | \
Returns the canonicalized form of the provided reference_id.
WikiLeaks provides some malformed cable identifiers. If the provided `reference_id`
is not valid, this method returns the valid reference identifier equivalent.
If the reference identifier is valid, the reference id is returned unchanged.
... | [
"\\",
"Returns",
"the",
"canonicalized",
"form",
"of",
"the",
"provided",
"reference_id",
"."
] | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/reader.py#L135-L157 |
heuer/cablemap | cablemap.core/cablemap/core/reader.py | reference_id_from_html | def reference_id_from_html(html):
"""\
Extracts the cable's reference identifier from the provided HTML string.
`html`
The HTML page of the cable.
"""
m = _REFERENCE_ID_FROM_HTML_PATTERN.search(html)
if m:
return m.group(1)
raise ValueError("Cannot extract the cable's refere... | python | def reference_id_from_html(html):
"""\
Extracts the cable's reference identifier from the provided HTML string.
`html`
The HTML page of the cable.
"""
m = _REFERENCE_ID_FROM_HTML_PATTERN.search(html)
if m:
return m.group(1)
raise ValueError("Cannot extract the cable's refere... | [
"def",
"reference_id_from_html",
"(",
"html",
")",
":",
"m",
"=",
"_REFERENCE_ID_FROM_HTML_PATTERN",
".",
"search",
"(",
"html",
")",
"if",
"m",
":",
"return",
"m",
".",
"group",
"(",
"1",
")",
"raise",
"ValueError",
"(",
"\"Cannot extract the cable's reference ... | \
Extracts the cable's reference identifier from the provided HTML string.
`html`
The HTML page of the cable. | [
"\\",
"Extracts",
"the",
"cable",
"s",
"reference",
"identifier",
"from",
"the",
"provided",
"HTML",
"string",
"."
] | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/reader.py#L161-L171 |
heuer/cablemap | cablemap.core/cablemap/core/reader.py | get_header_as_text | def get_header_as_text(file_content, reference_id):
"""\
Returns the cable's header as text.
`file_content`
The HTML file content, c.f. `get_file_content`.
"""
res = _CONTENT_PATTERN.findall(file_content)
if len(res) == 2:
content = res[0]
elif len(res) == 1:
ret... | python | def get_header_as_text(file_content, reference_id):
"""\
Returns the cable's header as text.
`file_content`
The HTML file content, c.f. `get_file_content`.
"""
res = _CONTENT_PATTERN.findall(file_content)
if len(res) == 2:
content = res[0]
elif len(res) == 1:
ret... | [
"def",
"get_header_as_text",
"(",
"file_content",
",",
"reference_id",
")",
":",
"res",
"=",
"_CONTENT_PATTERN",
".",
"findall",
"(",
"file_content",
")",
"if",
"len",
"(",
"res",
")",
"==",
"2",
":",
"content",
"=",
"res",
"[",
"0",
"]",
"elif",
"len",
... | \
Returns the cable's header as text.
`file_content`
The HTML file content, c.f. `get_file_content`. | [
"\\",
"Returns",
"the",
"cable",
"s",
"header",
"as",
"text",
".",
"file_content",
"The",
"HTML",
"file",
"content",
"c",
".",
"f",
".",
"get_file_content",
"."
] | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/reader.py#L189-L203 |
heuer/cablemap | cablemap.core/cablemap/core/reader.py | _clean_html | def _clean_html(html):
"""\
Removes links (``<a href="...">...</a>``) from the provided HTML input.
Further, it replaces "
" with ``\n`` and removes "¶" from the texts.
"""
content = html.replace(u'
', u'\n').replace(u'¶', '')
content = _LINK_PATTERN.sub(u'', content)
content =... | python | def _clean_html(html):
"""\
Removes links (``<a href="...">...</a>``) from the provided HTML input.
Further, it replaces "
" with ``\n`` and removes "¶" from the texts.
"""
content = html.replace(u'
', u'\n').replace(u'¶', '')
content = _LINK_PATTERN.sub(u'', content)
content =... | [
"def",
"_clean_html",
"(",
"html",
")",
":",
"content",
"=",
"html",
".",
"replace",
"(",
"u'
'",
",",
"u'\\n'",
")",
".",
"replace",
"(",
"u'¶',",
" ",
"')",
"",
"content",
"=",
"_LINK_PATTERN",
".",
"sub",
"(",
"u''",
",",
"content",
")",
"c... | \
Removes links (``<a href="...">...</a>``) from the provided HTML input.
Further, it replaces "
" with ``\n`` and removes "¶" from the texts. | [
"\\",
"Removes",
"links",
"(",
"<a",
"href",
"=",
"...",
">",
"...",
"<",
"/",
"a",
">",
")",
"from",
"the",
"provided",
"HTML",
"input",
".",
"Further",
"it",
"replaces",
"
",
";",
"with",
"\\",
"n",
"and",
"removes",
"¶",
"from",
"the",
"te... | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/reader.py#L210-L219 |
heuer/cablemap | cablemap.core/cablemap/core/reader.py | header_body_from_content | def header_body_from_content(content):
"""\
Tries to extract the header and the message from the cable content.
The header is something like
UNCLASSIFIED ...
SUBJECT ...
REF ...
while the message begins usually with a summary
1. SUMMARY ...
...
10. ...... | python | def header_body_from_content(content):
"""\
Tries to extract the header and the message from the cable content.
The header is something like
UNCLASSIFIED ...
SUBJECT ...
REF ...
while the message begins usually with a summary
1. SUMMARY ...
...
10. ...... | [
"def",
"header_body_from_content",
"(",
"content",
")",
":",
"m",
"=",
"_CLASSIFIED_BY_PATTERN",
".",
"search",
"(",
"content",
")",
"idx",
"=",
"m",
"and",
"m",
".",
"end",
"(",
")",
"or",
"0",
"m",
"=",
"_SUMMARY_PATTERN",
".",
"search",
"(",
"content"... | \
Tries to extract the header and the message from the cable content.
The header is something like
UNCLASSIFIED ...
SUBJECT ...
REF ...
while the message begins usually with a summary
1. SUMMARY ...
...
10. ...
Returns (header, msg) or (None, None... | [
"\\",
"Tries",
"to",
"extract",
"the",
"header",
"and",
"the",
"message",
"from",
"the",
"cable",
"content",
"."
] | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/reader.py#L226-L262 |
heuer/cablemap | cablemap.core/cablemap/core/reader.py | parse_meta | def parse_meta(file_content, cable):
"""\
Extracts the reference id, date/time of creation, the classification,
and the origin of the cable and assigns the value to the provided `cable`.
"""
end_idx = file_content.rindex("</table>")
start_idx = file_content.rindex("<table class='cable'>", 0, end... | python | def parse_meta(file_content, cable):
"""\
Extracts the reference id, date/time of creation, the classification,
and the origin of the cable and assigns the value to the provided `cable`.
"""
end_idx = file_content.rindex("</table>")
start_idx = file_content.rindex("<table class='cable'>", 0, end... | [
"def",
"parse_meta",
"(",
"file_content",
",",
"cable",
")",
":",
"end_idx",
"=",
"file_content",
".",
"rindex",
"(",
"\"</table>\"",
")",
"start_idx",
"=",
"file_content",
".",
"rindex",
"(",
"\"<table class='cable'>\"",
",",
"0",
",",
"end_idx",
")",
"m",
... | \
Extracts the reference id, date/time of creation, the classification,
and the origin of the cable and assigns the value to the provided `cable`. | [
"\\",
"Extracts",
"the",
"reference",
"id",
"date",
"/",
"time",
"of",
"creation",
"the",
"classification",
"and",
"the",
"origin",
"of",
"the",
"cable",
"and",
"assigns",
"the",
"value",
"to",
"the",
"provided",
"cable",
"."
] | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/reader.py#L268-L297 |
heuer/cablemap | cablemap.core/cablemap/core/reader.py | parse_transmission_id | def parse_transmission_id(header, reference_id=None):
"""\
Returns the transmission ID of the cable. If no transmission identifier was
found, ``None`` is returned.
`header`
The cable's header
`reference_id`
The cable's reference ID.
"""
m = _TID_PATTERN.search(header)
if... | python | def parse_transmission_id(header, reference_id=None):
"""\
Returns the transmission ID of the cable. If no transmission identifier was
found, ``None`` is returned.
`header`
The cable's header
`reference_id`
The cable's reference ID.
"""
m = _TID_PATTERN.search(header)
if... | [
"def",
"parse_transmission_id",
"(",
"header",
",",
"reference_id",
"=",
"None",
")",
":",
"m",
"=",
"_TID_PATTERN",
".",
"search",
"(",
"header",
")",
"if",
"not",
"m",
":",
"return",
"None",
"return",
"m",
".",
"group",
"(",
"1",
")"
] | \
Returns the transmission ID of the cable. If no transmission identifier was
found, ``None`` is returned.
`header`
The cable's header
`reference_id`
The cable's reference ID. | [
"\\",
"Returns",
"the",
"transmission",
"ID",
"of",
"the",
"cable",
".",
"If",
"no",
"transmission",
"identifier",
"was",
"found",
"None",
"is",
"returned",
"."
] | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/reader.py#L302-L315 |
heuer/cablemap | cablemap.core/cablemap/core/reader.py | parse_recipients | def parse_recipients(header, reference_id=None):
"""\
Returns the recipients of the cable as (maybe empty) list.
"""
m = _TO_PATTERN.search(header)
if not m:
if reference_id and reference_id not in _CABLES_WITHOUT_TO:
logger.warn('No TO header found in "%s", header: "%s"' % (refe... | python | def parse_recipients(header, reference_id=None):
"""\
Returns the recipients of the cable as (maybe empty) list.
"""
m = _TO_PATTERN.search(header)
if not m:
if reference_id and reference_id not in _CABLES_WITHOUT_TO:
logger.warn('No TO header found in "%s", header: "%s"' % (refe... | [
"def",
"parse_recipients",
"(",
"header",
",",
"reference_id",
"=",
"None",
")",
":",
"m",
"=",
"_TO_PATTERN",
".",
"search",
"(",
"header",
")",
"if",
"not",
"m",
":",
"if",
"reference_id",
"and",
"reference_id",
"not",
"in",
"_CABLES_WITHOUT_TO",
":",
"l... | \
Returns the recipients of the cable as (maybe empty) list. | [
"\\",
"Returns",
"the",
"recipients",
"of",
"the",
"cable",
"as",
"(",
"maybe",
"empty",
")",
"list",
"."
] | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/reader.py#L354-L364 |
heuer/cablemap | cablemap.core/cablemap/core/reader.py | parse_info_recipients | def parse_info_recipients(header, reference_id=None):
"""\
Returns the informal recipients of the cable as (maybe empty) list.
"""
m = _INFO_PATTERN.search(header)
if not m:
return []
to_header = m.group(1)
return _route_recipient_from_header(to_header, reference_id) | python | def parse_info_recipients(header, reference_id=None):
"""\
Returns the informal recipients of the cable as (maybe empty) list.
"""
m = _INFO_PATTERN.search(header)
if not m:
return []
to_header = m.group(1)
return _route_recipient_from_header(to_header, reference_id) | [
"def",
"parse_info_recipients",
"(",
"header",
",",
"reference_id",
"=",
"None",
")",
":",
"m",
"=",
"_INFO_PATTERN",
".",
"search",
"(",
"header",
")",
"if",
"not",
"m",
":",
"return",
"[",
"]",
"to_header",
"=",
"m",
".",
"group",
"(",
"1",
")",
"r... | \
Returns the informal recipients of the cable as (maybe empty) list. | [
"\\",
"Returns",
"the",
"informal",
"recipients",
"of",
"the",
"cable",
"as",
"(",
"maybe",
"empty",
")",
"list",
"."
] | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/reader.py#L369-L377 |
heuer/cablemap | cablemap.core/cablemap/core/reader.py | parse_classified_by | def parse_classified_by(content, normalize=True):
"""\
Returns the classificationist or ``None`` if the classificationist
cannot be extracted.
`content`
The cable's content.
"""
names = []
m = _CLIST_CONTENT_PATTERN.search(content)
if not m:
return ()
m = _CLSIST_PAT... | python | def parse_classified_by(content, normalize=True):
"""\
Returns the classificationist or ``None`` if the classificationist
cannot be extracted.
`content`
The cable's content.
"""
names = []
m = _CLIST_CONTENT_PATTERN.search(content)
if not m:
return ()
m = _CLSIST_PAT... | [
"def",
"parse_classified_by",
"(",
"content",
",",
"normalize",
"=",
"True",
")",
":",
"names",
"=",
"[",
"]",
"m",
"=",
"_CLIST_CONTENT_PATTERN",
".",
"search",
"(",
"content",
")",
"if",
"not",
"m",
":",
"return",
"(",
")",
"m",
"=",
"_CLSIST_PATTERN",... | \
Returns the classificationist or ``None`` if the classificationist
cannot be extracted.
`content`
The cable's content. | [
"\\",
"Returns",
"the",
"classificationist",
"or",
"None",
"if",
"the",
"classificationist",
"cannot",
"be",
"extracted",
"."
] | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/reader.py#L397-L420 |
heuer/cablemap | cablemap.core/cablemap/core/reader.py | parse_signed_by | def parse_signed_by(content, canonicalize=True):
"""\
Returns a maybe empty iterable of signers of the cable.
`content`
The cable's content.
`canonicalize`
Indicates if the signers should be canonicalized (upper-case the
string and remove typos) (enabled by default).
"""
... | python | def parse_signed_by(content, canonicalize=True):
"""\
Returns a maybe empty iterable of signers of the cable.
`content`
The cable's content.
`canonicalize`
Indicates if the signers should be canonicalized (upper-case the
string and remove typos) (enabled by default).
"""
... | [
"def",
"parse_signed_by",
"(",
"content",
",",
"canonicalize",
"=",
"True",
")",
":",
"s",
"=",
"content",
"[",
"-",
"300",
":",
"]",
"m",
"=",
"_SIGNER_PATTERN",
".",
"search",
"(",
"s",
")",
"or",
"_SIGNER_PATTERN2",
".",
"search",
"(",
"s",
")",
"... | \
Returns a maybe empty iterable of signers of the cable.
`content`
The cable's content.
`canonicalize`
Indicates if the signers should be canonicalized (upper-case the
string and remove typos) (enabled by default). | [
"\\",
"Returns",
"a",
"maybe",
"empty",
"iterable",
"of",
"signers",
"of",
"the",
"cable",
"."
] | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/reader.py#L429-L461 |
heuer/cablemap | cablemap.core/cablemap/core/reader.py | parse_subject | def parse_subject(content, reference_id=None, clean=True):
"""\
Parses and returns the subject of a cable. If the cable has no subject, an
empty string is returned.
`content`
The cable's content.
`reference_id`
The (optional) reference id of the cable. Used for error msgs
`c... | python | def parse_subject(content, reference_id=None, clean=True):
"""\
Parses and returns the subject of a cable. If the cable has no subject, an
empty string is returned.
`content`
The cable's content.
`reference_id`
The (optional) reference id of the cable. Used for error msgs
`c... | [
"def",
"parse_subject",
"(",
"content",
",",
"reference_id",
"=",
"None",
",",
"clean",
"=",
"True",
")",
":",
"def",
"to_unicodechar",
"(",
"match",
")",
":",
"return",
"unichr",
"(",
"int",
"(",
"match",
".",
"group",
"(",
"1",
")",
")",
")",
"m",
... | \
Parses and returns the subject of a cable. If the cable has no subject, an
empty string is returned.
`content`
The cable's content.
`reference_id`
The (optional) reference id of the cable. Used for error msgs
`clean`
Indicates if classification prefixes like ``(S)`` sh... | [
"\\",
"Parses",
"and",
"returns",
"the",
"subject",
"of",
"a",
"cable",
".",
"If",
"the",
"cable",
"has",
"no",
"subject",
"an",
"empty",
"string",
"is",
"returned",
".",
"content",
"The",
"cable",
"s",
"content",
".",
"reference_id",
"The",
"(",
"option... | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/reader.py#L473-L510 |
heuer/cablemap | cablemap.core/cablemap/core/reader.py | parse_nondisclosure_deadline | def parse_nondisclosure_deadline(content):
"""\
Returns the non-disclosure deadline if provided, otherwise ``None``.
Format of the returned string: ``YYYY-MM-DD``.
`content`
The cable's content.
"""
m = _DEADLINE_PATTERN.search(content)
if not m:
return None
p1, p2 = m.g... | python | def parse_nondisclosure_deadline(content):
"""\
Returns the non-disclosure deadline if provided, otherwise ``None``.
Format of the returned string: ``YYYY-MM-DD``.
`content`
The cable's content.
"""
m = _DEADLINE_PATTERN.search(content)
if not m:
return None
p1, p2 = m.g... | [
"def",
"parse_nondisclosure_deadline",
"(",
"content",
")",
":",
"m",
"=",
"_DEADLINE_PATTERN",
".",
"search",
"(",
"content",
")",
"if",
"not",
"m",
":",
"return",
"None",
"p1",
",",
"p2",
"=",
"m",
".",
"groups",
"(",
")",
"if",
"p1",
":",
"month",
... | \
Returns the non-disclosure deadline if provided, otherwise ``None``.
Format of the returned string: ``YYYY-MM-DD``.
`content`
The cable's content. | [
"\\",
"Returns",
"the",
"non",
"-",
"disclosure",
"deadline",
"if",
"provided",
"otherwise",
"None",
".",
"Format",
"of",
"the",
"returned",
"string",
":",
"YYYY",
"-",
"MM",
"-",
"DD",
"."
] | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/reader.py#L516-L536 |
heuer/cablemap | cablemap.core/cablemap/core/reader.py | parse_references | def parse_references(content, year, reference_id=None, canonicalize=True):
"""\
Returns the references to other cables as (maybe empty) list.
`content`
The content of the cable.
`year`
The year when the cable was created.
`reference_id`
The reference identifier of the ca... | python | def parse_references(content, year, reference_id=None, canonicalize=True):
"""\
Returns the references to other cables as (maybe empty) list.
`content`
The content of the cable.
`year`
The year when the cable was created.
`reference_id`
The reference identifier of the ca... | [
"def",
"parse_references",
"(",
"content",
",",
"year",
",",
"reference_id",
"=",
"None",
",",
"canonicalize",
"=",
"True",
")",
":",
"from",
"cablemap",
".",
"core",
".",
"models",
"import",
"Reference",
"def",
"format_year",
"(",
"y",
")",
":",
"y",
"=... | \
Returns the references to other cables as (maybe empty) list.
`content`
The content of the cable.
`year`
The year when the cable was created.
`reference_id`
The reference identifier of the cable.
`canonicalize`
Indicates if the cable reference origin should be ... | [
"\\",
"Returns",
"the",
"references",
"to",
"other",
"cables",
"as",
"(",
"maybe",
"empty",
")",
"list",
".",
"content",
"The",
"content",
"of",
"the",
"cable",
".",
"year",
"The",
"year",
"when",
"the",
"cable",
"was",
"created",
".",
"reference_id",
"T... | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/reader.py#L552-L629 |
heuer/cablemap | cablemap.core/cablemap/core/reader.py | parse_tags | def parse_tags(content, reference_id=None, canonicalize=True):
"""\
Returns the TAGS of a cable.
Acc. to the U.S. SD every cable needs at least one tag.
`content`
The content of the cable.
`reference_id`
The reference identifier of the cable.
`canonicalize`
Indicate... | python | def parse_tags(content, reference_id=None, canonicalize=True):
"""\
Returns the TAGS of a cable.
Acc. to the U.S. SD every cable needs at least one tag.
`content`
The content of the cable.
`reference_id`
The reference identifier of the cable.
`canonicalize`
Indicate... | [
"def",
"parse_tags",
"(",
"content",
",",
"reference_id",
"=",
"None",
",",
"canonicalize",
"=",
"True",
")",
":",
"max_idx",
"=",
"_MAX_HEADER_IDX",
"m",
"=",
"_SUBJECT_MAX_PATTERN",
".",
"search",
"(",
"content",
")",
"if",
"m",
":",
"max_idx",
"=",
"m",... | \
Returns the TAGS of a cable.
Acc. to the U.S. SD every cable needs at least one tag.
`content`
The content of the cable.
`reference_id`
The reference identifier of the cable.
`canonicalize`
Indicates if duplicates should be removed and malformed
TAGs like "ECO... | [
"\\",
"Returns",
"the",
"TAGS",
"of",
"a",
"cable",
".",
"Acc",
".",
"to",
"the",
"U",
".",
"S",
".",
"SD",
"every",
"cable",
"needs",
"at",
"least",
"one",
"tag",
"."
] | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/reader.py#L736-L785 |
heuer/cablemap | cablemap.core/cablemap/core/reader.py | parse_summary | def parse_summary(content, reference_id=None):
"""\
Extracts the summary from the `content` of the cable.
If no summary can be found, ``None`` is returned.
`content`
The content of the cable.
`reference_id`
The reference identifier of the cable.
"""
summary = None
... | python | def parse_summary(content, reference_id=None):
"""\
Extracts the summary from the `content` of the cable.
If no summary can be found, ``None`` is returned.
`content`
The content of the cable.
`reference_id`
The reference identifier of the cable.
"""
summary = None
... | [
"def",
"parse_summary",
"(",
"content",
",",
"reference_id",
"=",
"None",
")",
":",
"summary",
"=",
"None",
"m",
"=",
"_END_SUMMARY_PATTERN",
".",
"search",
"(",
"content",
")",
"if",
"m",
":",
"end_of_summary",
"=",
"m",
".",
"start",
"(",
")",
"m",
"... | \
Extracts the summary from the `content` of the cable.
If no summary can be found, ``None`` is returned.
`content`
The content of the cable.
`reference_id`
The reference identifier of the cable. | [
"\\",
"Extracts",
"the",
"summary",
"from",
"the",
"content",
"of",
"the",
"cable",
".",
"If",
"no",
"summary",
"can",
"be",
"found",
"None",
"is",
"returned",
".",
"content",
"The",
"content",
"of",
"the",
"cable",
".",
"reference_id",
"The",
"reference",... | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/reader.py#L798-L827 |
heuer/cablemap | cablemap.nlp/cablemap/nlp/texttools.py | clean_cable_content | def clean_cable_content(content):
"""\
Removes content like "1. (C)" from the content.
`content`
The content of the cable.
"""
for pattern, subst in _CLEAN_PATTERNS:
content = pattern.sub(subst, content)
return content | python | def clean_cable_content(content):
"""\
Removes content like "1. (C)" from the content.
`content`
The content of the cable.
"""
for pattern, subst in _CLEAN_PATTERNS:
content = pattern.sub(subst, content)
return content | [
"def",
"clean_cable_content",
"(",
"content",
")",
":",
"for",
"pattern",
",",
"subst",
"in",
"_CLEAN_PATTERNS",
":",
"content",
"=",
"pattern",
".",
"sub",
"(",
"subst",
",",
"content",
")",
"return",
"content"
] | \
Removes content like "1. (C)" from the content.
`content`
The content of the cable. | [
"\\",
"Removes",
"content",
"like",
"1",
".",
"(",
"C",
")",
"from",
"the",
"content",
".",
"content",
"The",
"content",
"of",
"the",
"cable",
"."
] | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.nlp/cablemap/nlp/texttools.py#L64-L73 |
heuer/cablemap | cablemap.nlp/cablemap/nlp/texttools.py | words | def words(content, filter=True, predicate=None):
"""\
Returns an iterable of words from the provided text.
`content`
A text.
`filter`
Indicates if stop words and garbage like "xxxxxx" should be removed from
the word list.
`predicate`
An alternative word filter. I... | python | def words(content, filter=True, predicate=None):
"""\
Returns an iterable of words from the provided text.
`content`
A text.
`filter`
Indicates if stop words and garbage like "xxxxxx" should be removed from
the word list.
`predicate`
An alternative word filter. I... | [
"def",
"words",
"(",
"content",
",",
"filter",
"=",
"True",
",",
"predicate",
"=",
"None",
")",
":",
"def",
"accept_word",
"(",
"word",
")",
":",
"\"\"\"\\\n Returns if the `word` is acceptable/useful\n \n `word`\n The word to check.\n \... | \
Returns an iterable of words from the provided text.
`content`
A text.
`filter`
Indicates if stop words and garbage like "xxxxxx" should be removed from
the word list.
`predicate`
An alternative word filter. If it is ``None`` "xxxx", "---",
default stop wor... | [
"\\",
"Returns",
"an",
"iterable",
"of",
"words",
"from",
"the",
"provided",
"text",
".",
"content",
"A",
"text",
".",
"filter",
"Indicates",
"if",
"stop",
"words",
"and",
"garbage",
"like",
"xxxxxx",
"should",
"be",
"removed",
"from",
"the",
"word",
"list... | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.nlp/cablemap/nlp/texttools.py#L78-L114 |
heuer/cablemap | cablemap.nlp/cablemap/nlp/texttools.py | lowercased_words | def lowercased_words(content, filter=True, predicate=None):
"""\
Returns an iterable of lowercased words from the provided text.
`content`
A text.
`filter`
Indicates if stop words and garbage like "xxxxxx" should be removed from
the word list.
`predicate`
An alte... | python | def lowercased_words(content, filter=True, predicate=None):
"""\
Returns an iterable of lowercased words from the provided text.
`content`
A text.
`filter`
Indicates if stop words and garbage like "xxxxxx" should be removed from
the word list.
`predicate`
An alte... | [
"def",
"lowercased_words",
"(",
"content",
",",
"filter",
"=",
"True",
",",
"predicate",
"=",
"None",
")",
":",
"return",
"(",
"w",
".",
"lower",
"(",
")",
"for",
"w",
"in",
"words",
"(",
"content",
",",
"filter",
",",
"predicate",
")",
")"
] | \
Returns an iterable of lowercased words from the provided text.
`content`
A text.
`filter`
Indicates if stop words and garbage like "xxxxxx" should be removed from
the word list.
`predicate`
An alternative word filter. If it is ``None`` "xxxx", "---",
defau... | [
"\\",
"Returns",
"an",
"iterable",
"of",
"lowercased",
"words",
"from",
"the",
"provided",
"text",
".",
"content",
"A",
"text",
".",
"filter",
"Indicates",
"if",
"stop",
"words",
"and",
"garbage",
"like",
"xxxxxx",
"should",
"be",
"removed",
"from",
"the",
... | train | https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.nlp/cablemap/nlp/texttools.py#L116-L137 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient._request | def _request(self, *args, **kwargs):
"""Make the request"""
try:
self.response = self.request(
*args, headers=self._request_headers(), **kwargs)
except BaseException, err:
code = 520
if hasattr(err, 'status_int'):
code = err.sta... | python | def _request(self, *args, **kwargs):
"""Make the request"""
try:
self.response = self.request(
*args, headers=self._request_headers(), **kwargs)
except BaseException, err:
code = 520
if hasattr(err, 'status_int'):
code = err.sta... | [
"def",
"_request",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"self",
".",
"response",
"=",
"self",
".",
"request",
"(",
"*",
"args",
",",
"headers",
"=",
"self",
".",
"_request_headers",
"(",
")",
",",
"*",
"*"... | Make the request | [
"Make",
"the",
"request"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L38-L59 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.api_call | def api_call(self, opts, args=None, body=None, **kwargs):
"""Setup the request"""
if args:
path = opts['name'] % args
else:
path = opts['name']
path = '/api/v1%s' % path
return self._request(
opts['method'], path=path, payload=body, **kwargs) | python | def api_call(self, opts, args=None, body=None, **kwargs):
"""Setup the request"""
if args:
path = opts['name'] % args
else:
path = opts['name']
path = '/api/v1%s' % path
return self._request(
opts['method'], path=path, payload=body, **kwargs) | [
"def",
"api_call",
"(",
"self",
",",
"opts",
",",
"args",
"=",
"None",
",",
"body",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"args",
":",
"path",
"=",
"opts",
"[",
"'name'",
"]",
"%",
"args",
"else",
":",
"path",
"=",
"opts",
"[",
... | Setup the request | [
"Setup",
"the",
"request"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L61-L69 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.get_users | def get_users(self, page=None):
"""Get users"""
opts = {}
if page:
opts['page'] = page
return self.api_call(ENDPOINTS['users']['list'], **opts) | python | def get_users(self, page=None):
"""Get users"""
opts = {}
if page:
opts['page'] = page
return self.api_call(ENDPOINTS['users']['list'], **opts) | [
"def",
"get_users",
"(",
"self",
",",
"page",
"=",
"None",
")",
":",
"opts",
"=",
"{",
"}",
"if",
"page",
":",
"opts",
"[",
"'page'",
"]",
"=",
"page",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'users'",
"]",
"[",
"'list'",
"]",
... | Get users | [
"Get",
"users"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L71-L76 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.set_user_passwd | def set_user_passwd(self, userid, data):
"""Set user password"""
return self.api_call(
ENDPOINTS['users']['password'],
dict(userid=userid),
body=data) | python | def set_user_passwd(self, userid, data):
"""Set user password"""
return self.api_call(
ENDPOINTS['users']['password'],
dict(userid=userid),
body=data) | [
"def",
"set_user_passwd",
"(",
"self",
",",
"userid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'users'",
"]",
"[",
"'password'",
"]",
",",
"dict",
"(",
"userid",
"=",
"userid",
")",
",",
"body",
"=",
"data",
"... | Set user password | [
"Set",
"user",
"password"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L94-L99 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.create_alias | def create_alias(self, userid, data):
"""Create alias address"""
return self.api_call(
ENDPOINTS['aliases']['new'],
dict(userid=userid),
body=data) | python | def create_alias(self, userid, data):
"""Create alias address"""
return self.api_call(
ENDPOINTS['aliases']['new'],
dict(userid=userid),
body=data) | [
"def",
"create_alias",
"(",
"self",
",",
"userid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'aliases'",
"]",
"[",
"'new'",
"]",
",",
"dict",
"(",
"userid",
"=",
"userid",
")",
",",
"body",
"=",
"data",
")"
] | Create alias address | [
"Create",
"alias",
"address"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L107-L112 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.update_alias | def update_alias(self, addressid, data):
"""Update alias address"""
return self.api_call(
ENDPOINTS['aliases']['update'],
dict(addressid=addressid),
body=data) | python | def update_alias(self, addressid, data):
"""Update alias address"""
return self.api_call(
ENDPOINTS['aliases']['update'],
dict(addressid=addressid),
body=data) | [
"def",
"update_alias",
"(",
"self",
",",
"addressid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'aliases'",
"]",
"[",
"'update'",
"]",
",",
"dict",
"(",
"addressid",
"=",
"addressid",
")",
",",
"body",
"=",
"data... | Update alias address | [
"Update",
"alias",
"address"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L114-L119 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.delete_alias | def delete_alias(self, addressid, data):
"""Delete alias address"""
return self.api_call(
ENDPOINTS['aliases']['delete'],
dict(addressid=addressid),
body=data) | python | def delete_alias(self, addressid, data):
"""Delete alias address"""
return self.api_call(
ENDPOINTS['aliases']['delete'],
dict(addressid=addressid),
body=data) | [
"def",
"delete_alias",
"(",
"self",
",",
"addressid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'aliases'",
"]",
"[",
"'delete'",
"]",
",",
"dict",
"(",
"addressid",
"=",
"addressid",
")",
",",
"body",
"=",
"data... | Delete alias address | [
"Delete",
"alias",
"address"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L121-L126 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.get_domains | def get_domains(self, page=None):
"""Get domains"""
opts = {}
if page:
opts['page'] = page
return self.api_call(ENDPOINTS['domains']['list'], **opts) | python | def get_domains(self, page=None):
"""Get domains"""
opts = {}
if page:
opts['page'] = page
return self.api_call(ENDPOINTS['domains']['list'], **opts) | [
"def",
"get_domains",
"(",
"self",
",",
"page",
"=",
"None",
")",
":",
"opts",
"=",
"{",
"}",
"if",
"page",
":",
"opts",
"[",
"'page'",
"]",
"=",
"page",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'domains'",
"]",
"[",
"'list'",
"]"... | Get domains | [
"Get",
"domains"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L128-L133 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.update_domain | def update_domain(self, domainid, data):
"""Update a domain"""
return self.api_call(
ENDPOINTS['domains']['update'],
dict(domainid=domainid),
body=data) | python | def update_domain(self, domainid, data):
"""Update a domain"""
return self.api_call(
ENDPOINTS['domains']['update'],
dict(domainid=domainid),
body=data) | [
"def",
"update_domain",
"(",
"self",
",",
"domainid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'domains'",
"]",
"[",
"'update'",
"]",
",",
"dict",
"(",
"domainid",
"=",
"domainid",
")",
",",
"body",
"=",
"data",... | Update a domain | [
"Update",
"a",
"domain"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L151-L156 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.get_domainaliases | def get_domainaliases(self, domainid, page=None):
"""Get Domain aliases"""
opts = {}
if page:
opts['page'] = page
return self.api_call(
ENDPOINTS['domainaliases']['list'],
dict(domainid=domainid), **opts) | python | def get_domainaliases(self, domainid, page=None):
"""Get Domain aliases"""
opts = {}
if page:
opts['page'] = page
return self.api_call(
ENDPOINTS['domainaliases']['list'],
dict(domainid=domainid), **opts) | [
"def",
"get_domainaliases",
"(",
"self",
",",
"domainid",
",",
"page",
"=",
"None",
")",
":",
"opts",
"=",
"{",
"}",
"if",
"page",
":",
"opts",
"[",
"'page'",
"]",
"=",
"page",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'domainaliases'"... | Get Domain aliases | [
"Get",
"Domain",
"aliases"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L164-L171 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.get_domainalias | def get_domainalias(self, domainid, aliasid):
"""Get a Domain alias"""
return self.api_call(
ENDPOINTS['domainaliases']['get'],
dict(domainid=domainid, aliasid=aliasid)) | python | def get_domainalias(self, domainid, aliasid):
"""Get a Domain alias"""
return self.api_call(
ENDPOINTS['domainaliases']['get'],
dict(domainid=domainid, aliasid=aliasid)) | [
"def",
"get_domainalias",
"(",
"self",
",",
"domainid",
",",
"aliasid",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'domainaliases'",
"]",
"[",
"'get'",
"]",
",",
"dict",
"(",
"domainid",
"=",
"domainid",
",",
"aliasid",
"=",
"al... | Get a Domain alias | [
"Get",
"a",
"Domain",
"alias"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L173-L177 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.create_domainalias | def create_domainalias(self, domainid, data):
"""Create a domain alias"""
return self.api_call(
ENDPOINTS['domainaliases']['new'],
dict(domainid=domainid),
body=data) | python | def create_domainalias(self, domainid, data):
"""Create a domain alias"""
return self.api_call(
ENDPOINTS['domainaliases']['new'],
dict(domainid=domainid),
body=data) | [
"def",
"create_domainalias",
"(",
"self",
",",
"domainid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'domainaliases'",
"]",
"[",
"'new'",
"]",
",",
"dict",
"(",
"domainid",
"=",
"domainid",
")",
",",
"body",
"=",
... | Create a domain alias | [
"Create",
"a",
"domain",
"alias"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L179-L184 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.update_domainalias | def update_domainalias(self, domainid, aliasid, data):
"""Update a domain alias"""
return self.api_call(
ENDPOINTS['domainaliases']['update'],
dict(domainid=domainid, aliasid=aliasid),
body=data) | python | def update_domainalias(self, domainid, aliasid, data):
"""Update a domain alias"""
return self.api_call(
ENDPOINTS['domainaliases']['update'],
dict(domainid=domainid, aliasid=aliasid),
body=data) | [
"def",
"update_domainalias",
"(",
"self",
",",
"domainid",
",",
"aliasid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'domainaliases'",
"]",
"[",
"'update'",
"]",
",",
"dict",
"(",
"domainid",
"=",
"domainid",
",",
... | Update a domain alias | [
"Update",
"a",
"domain",
"alias"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L186-L191 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.get_deliveryservers | def get_deliveryservers(self, domainid, page=None):
"""Get a domains delivery servers"""
opts = {}
if page:
opts['page'] = page
return self.api_call(
ENDPOINTS['deliveryservers']['list'],
dict(domainid=domainid), **opts) | python | def get_deliveryservers(self, domainid, page=None):
"""Get a domains delivery servers"""
opts = {}
if page:
opts['page'] = page
return self.api_call(
ENDPOINTS['deliveryservers']['list'],
dict(domainid=domainid), **opts) | [
"def",
"get_deliveryservers",
"(",
"self",
",",
"domainid",
",",
"page",
"=",
"None",
")",
":",
"opts",
"=",
"{",
"}",
"if",
"page",
":",
"opts",
"[",
"'page'",
"]",
"=",
"page",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'deliveryserve... | Get a domains delivery servers | [
"Get",
"a",
"domains",
"delivery",
"servers"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L200-L207 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.get_deliveryserver | def get_deliveryserver(self, domainid, serverid):
"""Get a delivery server"""
return self.api_call(
ENDPOINTS['deliveryservers']['get'],
dict(domainid=domainid, serverid=serverid)) | python | def get_deliveryserver(self, domainid, serverid):
"""Get a delivery server"""
return self.api_call(
ENDPOINTS['deliveryservers']['get'],
dict(domainid=domainid, serverid=serverid)) | [
"def",
"get_deliveryserver",
"(",
"self",
",",
"domainid",
",",
"serverid",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'deliveryservers'",
"]",
"[",
"'get'",
"]",
",",
"dict",
"(",
"domainid",
"=",
"domainid",
",",
"serverid",
"="... | Get a delivery server | [
"Get",
"a",
"delivery",
"server"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L209-L213 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.create_deliveryserver | def create_deliveryserver(self, domainid, data):
"""Create a delivery server"""
return self.api_call(
ENDPOINTS['deliveryservers']['new'],
dict(domainid=domainid),
body=data) | python | def create_deliveryserver(self, domainid, data):
"""Create a delivery server"""
return self.api_call(
ENDPOINTS['deliveryservers']['new'],
dict(domainid=domainid),
body=data) | [
"def",
"create_deliveryserver",
"(",
"self",
",",
"domainid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'deliveryservers'",
"]",
"[",
"'new'",
"]",
",",
"dict",
"(",
"domainid",
"=",
"domainid",
")",
",",
"body",
"... | Create a delivery server | [
"Create",
"a",
"delivery",
"server"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L215-L220 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.get_user_deliveryserver | def get_user_deliveryserver(self, domainid, serverid):
"""Get a user delivery server"""
return self.api_call(
ENDPOINTS['userdeliveryservers']['get'],
dict(domainid=domainid, serverid=serverid)) | python | def get_user_deliveryserver(self, domainid, serverid):
"""Get a user delivery server"""
return self.api_call(
ENDPOINTS['userdeliveryservers']['get'],
dict(domainid=domainid, serverid=serverid)) | [
"def",
"get_user_deliveryserver",
"(",
"self",
",",
"domainid",
",",
"serverid",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'userdeliveryservers'",
"]",
"[",
"'get'",
"]",
",",
"dict",
"(",
"domainid",
"=",
"domainid",
",",
"serveri... | Get a user delivery server | [
"Get",
"a",
"user",
"delivery",
"server"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L236-L240 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.create_user_deliveryserver | def create_user_deliveryserver(self, domainid, data):
"""Create a user delivery server"""
return self.api_call(
ENDPOINTS['userdeliveryservers']['new'],
dict(domainid=domainid),
body=data) | python | def create_user_deliveryserver(self, domainid, data):
"""Create a user delivery server"""
return self.api_call(
ENDPOINTS['userdeliveryservers']['new'],
dict(domainid=domainid),
body=data) | [
"def",
"create_user_deliveryserver",
"(",
"self",
",",
"domainid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'userdeliveryservers'",
"]",
"[",
"'new'",
"]",
",",
"dict",
"(",
"domainid",
"=",
"domainid",
")",
",",
"b... | Create a user delivery server | [
"Create",
"a",
"user",
"delivery",
"server"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L242-L247 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.get_domain_smarthost | def get_domain_smarthost(self, domainid, serverid):
"""Get a domain smarthost"""
return self.api_call(
ENDPOINTS['domainsmarthosts']['get'],
dict(domainid=domainid, serverid=serverid)) | python | def get_domain_smarthost(self, domainid, serverid):
"""Get a domain smarthost"""
return self.api_call(
ENDPOINTS['domainsmarthosts']['get'],
dict(domainid=domainid, serverid=serverid)) | [
"def",
"get_domain_smarthost",
"(",
"self",
",",
"domainid",
",",
"serverid",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'domainsmarthosts'",
"]",
"[",
"'get'",
"]",
",",
"dict",
"(",
"domainid",
"=",
"domainid",
",",
"serverid",
... | Get a domain smarthost | [
"Get",
"a",
"domain",
"smarthost"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L263-L267 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.create_domain_smarthost | def create_domain_smarthost(self, domainid, data):
"""Create a domain smarthost"""
return self.api_call(
ENDPOINTS['domainsmarthosts']['new'],
dict(domainid=domainid),
body=data) | python | def create_domain_smarthost(self, domainid, data):
"""Create a domain smarthost"""
return self.api_call(
ENDPOINTS['domainsmarthosts']['new'],
dict(domainid=domainid),
body=data) | [
"def",
"create_domain_smarthost",
"(",
"self",
",",
"domainid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'domainsmarthosts'",
"]",
"[",
"'new'",
"]",
",",
"dict",
"(",
"domainid",
"=",
"domainid",
")",
",",
"body",
... | Create a domain smarthost | [
"Create",
"a",
"domain",
"smarthost"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L269-L274 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.update_domain_smarthost | def update_domain_smarthost(self, domainid, serverid, data):
"""Update a domain smarthost"""
return self.api_call(
ENDPOINTS['domainsmarthosts']['update'],
dict(domainid=domainid, serverid=serverid),
body=data) | python | def update_domain_smarthost(self, domainid, serverid, data):
"""Update a domain smarthost"""
return self.api_call(
ENDPOINTS['domainsmarthosts']['update'],
dict(domainid=domainid, serverid=serverid),
body=data) | [
"def",
"update_domain_smarthost",
"(",
"self",
",",
"domainid",
",",
"serverid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'domainsmarthosts'",
"]",
"[",
"'update'",
"]",
",",
"dict",
"(",
"domainid",
"=",
"domainid",
... | Update a domain smarthost | [
"Update",
"a",
"domain",
"smarthost"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L276-L281 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.get_authservers | def get_authservers(self, domainid, page=None):
"""Get Authentication servers"""
opts = {}
if page:
opts['page'] = page
return self.api_call(
ENDPOINTS['authservers']['list'],
dict(domainid=domainid), **opts) | python | def get_authservers(self, domainid, page=None):
"""Get Authentication servers"""
opts = {}
if page:
opts['page'] = page
return self.api_call(
ENDPOINTS['authservers']['list'],
dict(domainid=domainid), **opts) | [
"def",
"get_authservers",
"(",
"self",
",",
"domainid",
",",
"page",
"=",
"None",
")",
":",
"opts",
"=",
"{",
"}",
"if",
"page",
":",
"opts",
"[",
"'page'",
"]",
"=",
"page",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'authservers'",
... | Get Authentication servers | [
"Get",
"Authentication",
"servers"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L290-L297 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.get_authserver | def get_authserver(self, domainid, serverid):
"""Get an Authentication server"""
return self.api_call(
ENDPOINTS['authservers']['get'],
dict(domainid=domainid, serverid=serverid)) | python | def get_authserver(self, domainid, serverid):
"""Get an Authentication server"""
return self.api_call(
ENDPOINTS['authservers']['get'],
dict(domainid=domainid, serverid=serverid)) | [
"def",
"get_authserver",
"(",
"self",
",",
"domainid",
",",
"serverid",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'authservers'",
"]",
"[",
"'get'",
"]",
",",
"dict",
"(",
"domainid",
"=",
"domainid",
",",
"serverid",
"=",
"ser... | Get an Authentication server | [
"Get",
"an",
"Authentication",
"server"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L299-L303 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.create_authserver | def create_authserver(self, domainid, data):
"""Create an Authentication server"""
return self.api_call(
ENDPOINTS['authservers']['new'],
dict(domainid=domainid),
body=data) | python | def create_authserver(self, domainid, data):
"""Create an Authentication server"""
return self.api_call(
ENDPOINTS['authservers']['new'],
dict(domainid=domainid),
body=data) | [
"def",
"create_authserver",
"(",
"self",
",",
"domainid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'authservers'",
"]",
"[",
"'new'",
"]",
",",
"dict",
"(",
"domainid",
"=",
"domainid",
")",
",",
"body",
"=",
"d... | Create an Authentication server | [
"Create",
"an",
"Authentication",
"server"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L305-L310 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.get_ldapsettings | def get_ldapsettings(self, domainid, serverid, settingsid):
"""Get LDAP settings"""
return self.api_call(
ENDPOINTS['ldapsettings']['get'],
dict(domainid=domainid, serverid=serverid, settingsid=settingsid)) | python | def get_ldapsettings(self, domainid, serverid, settingsid):
"""Get LDAP settings"""
return self.api_call(
ENDPOINTS['ldapsettings']['get'],
dict(domainid=domainid, serverid=serverid, settingsid=settingsid)) | [
"def",
"get_ldapsettings",
"(",
"self",
",",
"domainid",
",",
"serverid",
",",
"settingsid",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'ldapsettings'",
"]",
"[",
"'get'",
"]",
",",
"dict",
"(",
"domainid",
"=",
"domainid",
",",
... | Get LDAP settings | [
"Get",
"LDAP",
"settings"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L326-L330 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.get_radiussettings | def get_radiussettings(self, domainid, serverid, settingsid):
"""Get RADIUS settings"""
return self.api_call(
ENDPOINTS['radiussettings']['get'],
dict(domainid=domainid, serverid=serverid, settingsid=settingsid)) | python | def get_radiussettings(self, domainid, serverid, settingsid):
"""Get RADIUS settings"""
return self.api_call(
ENDPOINTS['radiussettings']['get'],
dict(domainid=domainid, serverid=serverid, settingsid=settingsid)) | [
"def",
"get_radiussettings",
"(",
"self",
",",
"domainid",
",",
"serverid",
",",
"settingsid",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'radiussettings'",
"]",
"[",
"'get'",
"]",
",",
"dict",
"(",
"domainid",
"=",
"domainid",
",... | Get RADIUS settings | [
"Get",
"RADIUS",
"settings"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L353-L357 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.delete_radiussettings | def delete_radiussettings(self, domainid, serverid, settingsid, data):
"""Delete RADIUS settings"""
return self.api_call(
ENDPOINTS['radiussettings']['delete'],
dict(domainid=domainid, serverid=serverid, settingsid=settingsid),
body=data) | python | def delete_radiussettings(self, domainid, serverid, settingsid, data):
"""Delete RADIUS settings"""
return self.api_call(
ENDPOINTS['radiussettings']['delete'],
dict(domainid=domainid, serverid=serverid, settingsid=settingsid),
body=data) | [
"def",
"delete_radiussettings",
"(",
"self",
",",
"domainid",
",",
"serverid",
",",
"settingsid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'radiussettings'",
"]",
"[",
"'delete'",
"]",
",",
"dict",
"(",
"domainid",
... | Delete RADIUS settings | [
"Delete",
"RADIUS",
"settings"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L373-L378 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.get_organizations | def get_organizations(self, page=None):
"""Get organizations"""
opts = {}
if page:
opts['page'] = page
return self.api_call(ENDPOINTS['organizations']['list'], **opts) | python | def get_organizations(self, page=None):
"""Get organizations"""
opts = {}
if page:
opts['page'] = page
return self.api_call(ENDPOINTS['organizations']['list'], **opts) | [
"def",
"get_organizations",
"(",
"self",
",",
"page",
"=",
"None",
")",
":",
"opts",
"=",
"{",
"}",
"if",
"page",
":",
"opts",
"[",
"'page'",
"]",
"=",
"page",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'organizations'",
"]",
"[",
"'l... | Get organizations | [
"Get",
"organizations"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L380-L385 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.update_organization | def update_organization(self, orgid, data):
"""Update an organization"""
return self.api_call(
ENDPOINTS['organizations']['update'],
dict(orgid=orgid),
body=data) | python | def update_organization(self, orgid, data):
"""Update an organization"""
return self.api_call(
ENDPOINTS['organizations']['update'],
dict(orgid=orgid),
body=data) | [
"def",
"update_organization",
"(",
"self",
",",
"orgid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'organizations'",
"]",
"[",
"'update'",
"]",
",",
"dict",
"(",
"orgid",
"=",
"orgid",
")",
",",
"body",
"=",
"dat... | Update an organization | [
"Update",
"an",
"organization"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L397-L402 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.create_relay | def create_relay(self, orgid, data):
"""Create relay settings"""
return self.api_call(
ENDPOINTS['relays']['new'],
dict(orgid=orgid), body=data) | python | def create_relay(self, orgid, data):
"""Create relay settings"""
return self.api_call(
ENDPOINTS['relays']['new'],
dict(orgid=orgid), body=data) | [
"def",
"create_relay",
"(",
"self",
",",
"orgid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'relays'",
"]",
"[",
"'new'",
"]",
",",
"dict",
"(",
"orgid",
"=",
"orgid",
")",
",",
"body",
"=",
"data",
")"
] | Create relay settings | [
"Create",
"relay",
"settings"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L416-L420 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.update_relay | def update_relay(self, relayid, data):
"""Update relay settings"""
return self.api_call(
ENDPOINTS['relays']['update'],
dict(relayid=relayid),
body=data) | python | def update_relay(self, relayid, data):
"""Update relay settings"""
return self.api_call(
ENDPOINTS['relays']['update'],
dict(relayid=relayid),
body=data) | [
"def",
"update_relay",
"(",
"self",
",",
"relayid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'relays'",
"]",
"[",
"'update'",
"]",
",",
"dict",
"(",
"relayid",
"=",
"relayid",
")",
",",
"body",
"=",
"data",
")... | Update relay settings | [
"Update",
"relay",
"settings"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L422-L427 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.delete_relay | def delete_relay(self, relayid, data):
"""Delete relay settings"""
return self.api_call(
ENDPOINTS['relays']['delete'],
dict(relayid=relayid),
body=data) | python | def delete_relay(self, relayid, data):
"""Delete relay settings"""
return self.api_call(
ENDPOINTS['relays']['delete'],
dict(relayid=relayid),
body=data) | [
"def",
"delete_relay",
"(",
"self",
",",
"relayid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'relays'",
"]",
"[",
"'delete'",
"]",
",",
"dict",
"(",
"relayid",
"=",
"relayid",
")",
",",
"body",
"=",
"data",
")... | Delete relay settings | [
"Delete",
"relay",
"settings"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L429-L434 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.get_fallbackservers | def get_fallbackservers(self, orgid, page=None):
"""Get Fallback server"""
opts = {}
if page:
opts['page'] = page
return self.api_call(
ENDPOINTS['fallbackservers']['list'],
dict(orgid=orgid), **opts) | python | def get_fallbackservers(self, orgid, page=None):
"""Get Fallback server"""
opts = {}
if page:
opts['page'] = page
return self.api_call(
ENDPOINTS['fallbackservers']['list'],
dict(orgid=orgid), **opts) | [
"def",
"get_fallbackservers",
"(",
"self",
",",
"orgid",
",",
"page",
"=",
"None",
")",
":",
"opts",
"=",
"{",
"}",
"if",
"page",
":",
"opts",
"[",
"'page'",
"]",
"=",
"page",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'fallbackservers'... | Get Fallback server | [
"Get",
"Fallback",
"server"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L436-L443 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.create_fallbackserver | def create_fallbackserver(self, orgid, data):
"""Create Fallback server"""
return self.api_call(
ENDPOINTS['fallbackservers']['new'],
dict(orgid=orgid), body=data) | python | def create_fallbackserver(self, orgid, data):
"""Create Fallback server"""
return self.api_call(
ENDPOINTS['fallbackservers']['new'],
dict(orgid=orgid), body=data) | [
"def",
"create_fallbackserver",
"(",
"self",
",",
"orgid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'fallbackservers'",
"]",
"[",
"'new'",
"]",
",",
"dict",
"(",
"orgid",
"=",
"orgid",
")",
",",
"body",
"=",
"da... | Create Fallback server | [
"Create",
"Fallback",
"server"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L451-L455 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.update_fallbackserver | def update_fallbackserver(self, serverid, data):
"""Update Fallback server"""
return self.api_call(
ENDPOINTS['fallbackservers']['update'],
dict(serverid=serverid),
body=data) | python | def update_fallbackserver(self, serverid, data):
"""Update Fallback server"""
return self.api_call(
ENDPOINTS['fallbackservers']['update'],
dict(serverid=serverid),
body=data) | [
"def",
"update_fallbackserver",
"(",
"self",
",",
"serverid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'fallbackservers'",
"]",
"[",
"'update'",
"]",
",",
"dict",
"(",
"serverid",
"=",
"serverid",
")",
",",
"body",
... | Update Fallback server | [
"Update",
"Fallback",
"server"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L457-L462 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.delete_fallbackserver | def delete_fallbackserver(self, serverid, data):
"""Delete Fallback server"""
return self.api_call(
ENDPOINTS['fallbackservers']['delete'],
dict(serverid=serverid),
body=data) | python | def delete_fallbackserver(self, serverid, data):
"""Delete Fallback server"""
return self.api_call(
ENDPOINTS['fallbackservers']['delete'],
dict(serverid=serverid),
body=data) | [
"def",
"delete_fallbackserver",
"(",
"self",
",",
"serverid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'fallbackservers'",
"]",
"[",
"'delete'",
"]",
",",
"dict",
"(",
"serverid",
"=",
"serverid",
")",
",",
"body",
... | Delete Fallback server | [
"Delete",
"Fallback",
"server"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L464-L469 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.get_org_smarthost | def get_org_smarthost(self, orgid, serverid):
"""Get an organization smarthost"""
return self.api_call(
ENDPOINTS['orgsmarthosts']['get'],
dict(orgid=orgid, serverid=serverid)) | python | def get_org_smarthost(self, orgid, serverid):
"""Get an organization smarthost"""
return self.api_call(
ENDPOINTS['orgsmarthosts']['get'],
dict(orgid=orgid, serverid=serverid)) | [
"def",
"get_org_smarthost",
"(",
"self",
",",
"orgid",
",",
"serverid",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'orgsmarthosts'",
"]",
"[",
"'get'",
"]",
",",
"dict",
"(",
"orgid",
"=",
"orgid",
",",
"serverid",
"=",
"serveri... | Get an organization smarthost | [
"Get",
"an",
"organization",
"smarthost"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L471-L475 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.create_org_smarthost | def create_org_smarthost(self, orgid, data):
"""Create an organization smarthost"""
return self.api_call(
ENDPOINTS['orgsmarthosts']['new'],
dict(orgid=orgid),
body=data) | python | def create_org_smarthost(self, orgid, data):
"""Create an organization smarthost"""
return self.api_call(
ENDPOINTS['orgsmarthosts']['new'],
dict(orgid=orgid),
body=data) | [
"def",
"create_org_smarthost",
"(",
"self",
",",
"orgid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'orgsmarthosts'",
"]",
"[",
"'new'",
"]",
",",
"dict",
"(",
"orgid",
"=",
"orgid",
")",
",",
"body",
"=",
"data"... | Create an organization smarthost | [
"Create",
"an",
"organization",
"smarthost"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L477-L482 |
baruwa-enterprise/BaruwaAPI | BaruwaAPI/resource.py | BaruwaAPIClient.update_org_smarthost | def update_org_smarthost(self, orgid, serverid, data):
"""Update an organization smarthost"""
return self.api_call(
ENDPOINTS['orgsmarthosts']['update'],
dict(orgid=orgid, serverid=serverid),
body=data) | python | def update_org_smarthost(self, orgid, serverid, data):
"""Update an organization smarthost"""
return self.api_call(
ENDPOINTS['orgsmarthosts']['update'],
dict(orgid=orgid, serverid=serverid),
body=data) | [
"def",
"update_org_smarthost",
"(",
"self",
",",
"orgid",
",",
"serverid",
",",
"data",
")",
":",
"return",
"self",
".",
"api_call",
"(",
"ENDPOINTS",
"[",
"'orgsmarthosts'",
"]",
"[",
"'update'",
"]",
",",
"dict",
"(",
"orgid",
"=",
"orgid",
",",
"serve... | Update an organization smarthost | [
"Update",
"an",
"organization",
"smarthost"
] | train | https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L484-L489 |
bretth/woven | woven/deployment.py | _backup_file | def _backup_file(path):
"""
Backup a file but never overwrite an existing backup file
"""
backup_base = '/var/local/woven-backup'
backup_path = ''.join([backup_base,path])
if not exists(backup_path):
directory = ''.join([backup_base,os.path.split(path)[0]])
sudo('mkdir -p %s'% di... | python | def _backup_file(path):
"""
Backup a file but never overwrite an existing backup file
"""
backup_base = '/var/local/woven-backup'
backup_path = ''.join([backup_base,path])
if not exists(backup_path):
directory = ''.join([backup_base,os.path.split(path)[0]])
sudo('mkdir -p %s'% di... | [
"def",
"_backup_file",
"(",
"path",
")",
":",
"backup_base",
"=",
"'/var/local/woven-backup'",
"backup_path",
"=",
"''",
".",
"join",
"(",
"[",
"backup_base",
",",
"path",
"]",
")",
"if",
"not",
"exists",
"(",
"backup_path",
")",
":",
"directory",
"=",
"''... | Backup a file but never overwrite an existing backup file | [
"Backup",
"a",
"file",
"but",
"never",
"overwrite",
"an",
"existing",
"backup",
"file"
] | train | https://github.com/bretth/woven/blob/ec1da7b401a335f43129e7115fe7a4d145649f1e/woven/deployment.py#L15-L24 |
bretth/woven | woven/deployment.py | _restore_file | def _restore_file(path, delete_backup=True):
"""
Restore a file if it exists and remove the backup
"""
backup_base = '/var/local/woven-backup'
backup_path = ''.join([backup_base,path])
if exists(backup_path):
if delete_backup:
sudo('mv -f %s %s'% (backup_path,path))
e... | python | def _restore_file(path, delete_backup=True):
"""
Restore a file if it exists and remove the backup
"""
backup_base = '/var/local/woven-backup'
backup_path = ''.join([backup_base,path])
if exists(backup_path):
if delete_backup:
sudo('mv -f %s %s'% (backup_path,path))
e... | [
"def",
"_restore_file",
"(",
"path",
",",
"delete_backup",
"=",
"True",
")",
":",
"backup_base",
"=",
"'/var/local/woven-backup'",
"backup_path",
"=",
"''",
".",
"join",
"(",
"[",
"backup_base",
",",
"path",
"]",
")",
"if",
"exists",
"(",
"backup_path",
")",... | Restore a file if it exists and remove the backup | [
"Restore",
"a",
"file",
"if",
"it",
"exists",
"and",
"remove",
"the",
"backup"
] | train | https://github.com/bretth/woven/blob/ec1da7b401a335f43129e7115fe7a4d145649f1e/woven/deployment.py#L26-L36 |
bretth/woven | woven/deployment.py | _get_local_files | def _get_local_files(local_dir, pattern=''):
"""
Returns a dictionary with directories as keys, and filenames as values
for filenames matching the glob ``pattern`` under the ``local_dir``
``pattern can contain the Boolean OR | to evaluated multiple patterns into
a combined set.
"""
local_fi... | python | def _get_local_files(local_dir, pattern=''):
"""
Returns a dictionary with directories as keys, and filenames as values
for filenames matching the glob ``pattern`` under the ``local_dir``
``pattern can contain the Boolean OR | to evaluated multiple patterns into
a combined set.
"""
local_fi... | [
"def",
"_get_local_files",
"(",
"local_dir",
",",
"pattern",
"=",
"''",
")",
":",
"local_files",
"=",
"{",
"}",
"if",
"pattern",
":",
"cwd",
"=",
"os",
".",
"getcwd",
"(",
")",
"os",
".",
"chdir",
"(",
"local_dir",
")",
"patterns",
"=",
"pattern",
".... | Returns a dictionary with directories as keys, and filenames as values
for filenames matching the glob ``pattern`` under the ``local_dir``
``pattern can contain the Boolean OR | to evaluated multiple patterns into
a combined set. | [
"Returns",
"a",
"dictionary",
"with",
"directories",
"as",
"keys",
"and",
"filenames",
"as",
"values",
"for",
"filenames",
"matching",
"the",
"glob",
"pattern",
"under",
"the",
"local_dir",
"pattern",
"can",
"contain",
"the",
"Boolean",
"OR",
"|",
"to",
"evalu... | train | https://github.com/bretth/woven/blob/ec1da7b401a335f43129e7115fe7a4d145649f1e/woven/deployment.py#L39-L61 |
bretth/woven | woven/deployment.py | _stage_local_files | def _stage_local_files(local_dir, local_files={}):
"""
Either ``local_files`` and/or ``context`` should be supplied.
Will stage a ``local_files`` dictionary of path:filename pairs where path
is relative to ``local_dir`` into a local tmp staging directory.
Returns a path to the temporary lo... | python | def _stage_local_files(local_dir, local_files={}):
"""
Either ``local_files`` and/or ``context`` should be supplied.
Will stage a ``local_files`` dictionary of path:filename pairs where path
is relative to ``local_dir`` into a local tmp staging directory.
Returns a path to the temporary lo... | [
"def",
"_stage_local_files",
"(",
"local_dir",
",",
"local_files",
"=",
"{",
"}",
")",
":",
"staging_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tempfile",
".",
"mkdtemp",
"(",
")",
",",
"os",
".",
"path",
".",
"basename",
"(",
"local_dir",
")",
... | Either ``local_files`` and/or ``context`` should be supplied.
Will stage a ``local_files`` dictionary of path:filename pairs where path
is relative to ``local_dir`` into a local tmp staging directory.
Returns a path to the temporary local staging directory | [
"Either",
"local_files",
"and",
"/",
"or",
"context",
"should",
"be",
"supplied",
".",
"Will",
"stage",
"a",
"local_files",
"dictionary",
"of",
"path",
":",
"filename",
"pairs",
"where",
"path",
"is",
"relative",
"to",
"local_dir",
"into",
"a",
"local",
"tmp... | train | https://github.com/bretth/woven/blob/ec1da7b401a335f43129e7115fe7a4d145649f1e/woven/deployment.py#L63-L88 |
bretth/woven | woven/deployment.py | deploy_files | def deploy_files(local_dir, remote_dir, pattern = '',rsync_exclude=['*.pyc','.*'], use_sudo=False):
"""
Generic deploy function for cases where one or more files are being deployed to a host.
Wraps around ``rsync_project`` and stages files locally and/or remotely
for network efficiency.
``local... | python | def deploy_files(local_dir, remote_dir, pattern = '',rsync_exclude=['*.pyc','.*'], use_sudo=False):
"""
Generic deploy function for cases where one or more files are being deployed to a host.
Wraps around ``rsync_project`` and stages files locally and/or remotely
for network efficiency.
``local... | [
"def",
"deploy_files",
"(",
"local_dir",
",",
"remote_dir",
",",
"pattern",
"=",
"''",
",",
"rsync_exclude",
"=",
"[",
"'*.pyc'",
",",
"'.*'",
"]",
",",
"use_sudo",
"=",
"False",
")",
":",
"#normalise paths",
"if",
"local_dir",
"[",
"-",
"1",
"]",
"==",
... | Generic deploy function for cases where one or more files are being deployed to a host.
Wraps around ``rsync_project`` and stages files locally and/or remotely
for network efficiency.
``local_dir`` is the directory that will be deployed.
``remote_dir`` is the directory the files will be deploye... | [
"Generic",
"deploy",
"function",
"for",
"cases",
"where",
"one",
"or",
"more",
"files",
"are",
"being",
"deployed",
"to",
"a",
"host",
".",
"Wraps",
"around",
"rsync_project",
"and",
"stages",
"files",
"locally",
"and",
"/",
"or",
"remotely",
"for",
"network... | train | https://github.com/bretth/woven/blob/ec1da7b401a335f43129e7115fe7a4d145649f1e/woven/deployment.py#L90-L147 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.