hexsha
stringlengths
40
40
repo
stringlengths
7
114
path
stringlengths
4
124
license
listlengths
1
9
language
stringclasses
1 value
identifier
stringlengths
1
71
return_type
stringlengths
1
749
original_string
stringlengths
76
22.7k
original_docstring
stringlengths
16
7.61k
docstring
stringlengths
16
2.47k
docstring_tokens
listlengths
6
477
code
stringlengths
14
10.2k
code_tokens
listlengths
6
996
short_docstring
stringlengths
2
644
short_docstring_tokens
listlengths
1
116
comment
listlengths
1
89
parameters
listlengths
0
64
docstring_params
dict
5f913d237cce9d491844bd8e4dc1c5d01ccaea01
zapisnicar/epsracun
eracuni/browser.py
[ "MIT" ]
Python
screenshot_browser_window
None
def screenshot_browser_window(browser: webdriver, file: str) -> None: """ Take screenshot of visible browser window and save as file Works in headless mode to """ browser.get_screenshot_as_file(file)
Take screenshot of visible browser window and save as file Works in headless mode to
Take screenshot of visible browser window and save as file Works in headless mode to
[ "Take", "screenshot", "of", "visible", "browser", "window", "and", "save", "as", "file", "Works", "in", "headless", "mode", "to" ]
def screenshot_browser_window(browser: webdriver, file: str) -> None: browser.get_screenshot_as_file(file)
[ "def", "screenshot_browser_window", "(", "browser", ":", "webdriver", ",", "file", ":", "str", ")", "->", "None", ":", "browser", ".", "get_screenshot_as_file", "(", "file", ")" ]
Take screenshot of visible browser window and save as file Works in headless mode to
[ "Take", "screenshot", "of", "visible", "browser", "window", "and", "save", "as", "file", "Works", "in", "headless", "mode", "to" ]
[ "\"\"\"\n Take screenshot of visible browser window and save as file\n Works in headless mode to\n \"\"\"" ]
[ { "param": "browser", "type": "webdriver" }, { "param": "file", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "browser", "type": "webdriver", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "file", "type": "str", "docstring": null, "docstring...
5f913d237cce9d491844bd8e4dc1c5d01ccaea01
zapisnicar/epsracun
eracuni/browser.py
[ "MIT" ]
Python
screenshot_full_page
None
def screenshot_full_page(browser: webdriver, file: str) -> None: """ Take screenshot of full page and save as file Works ONLY in headless mode """ # TODO fix height size def size(x): return browser.execute_script('return document.body.parentNode.scroll' + x) browser.set_window_size(s...
Take screenshot of full page and save as file Works ONLY in headless mode
Take screenshot of full page and save as file Works ONLY in headless mode
[ "Take", "screenshot", "of", "full", "page", "and", "save", "as", "file", "Works", "ONLY", "in", "headless", "mode" ]
def screenshot_full_page(browser: webdriver, file: str) -> None: def size(x): return browser.execute_script('return document.body.parentNode.scroll' + x) browser.set_window_size(size('Width'), size('Height')) browser.save_screenshot(file)
[ "def", "screenshot_full_page", "(", "browser", ":", "webdriver", ",", "file", ":", "str", ")", "->", "None", ":", "def", "size", "(", "x", ")", ":", "return", "browser", ".", "execute_script", "(", "'return document.body.parentNode.scroll'", "+", "x", ")", "...
Take screenshot of full page and save as file Works ONLY in headless mode
[ "Take", "screenshot", "of", "full", "page", "and", "save", "as", "file", "Works", "ONLY", "in", "headless", "mode" ]
[ "\"\"\"\n Take screenshot of full page and save as file\n Works ONLY in headless mode\n \"\"\"", "# TODO fix height size", "# May need manual adjustment", "# browser.find_element_by_tag_name('body').screenshot(file)" ]
[ { "param": "browser", "type": "webdriver" }, { "param": "file", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "browser", "type": "webdriver", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "file", "type": "str", "docstring": null, "docstring...
9ac6a447121ce1c6d51f3f078ca8555d52f87a8d
zapisnicar/epsracun
eracuni/messages.py
[ "MIT" ]
Python
add
None
def add(self, text: str) -> None: """ Add text to message body and report to stdout """ self.message_body = self.message_body + text + '\n' # Report also to console stdout print(text)
Add text to message body and report to stdout
Add text to message body and report to stdout
[ "Add", "text", "to", "message", "body", "and", "report", "to", "stdout" ]
def add(self, text: str) -> None: self.message_body = self.message_body + text + '\n' print(text)
[ "def", "add", "(", "self", ",", "text", ":", "str", ")", "->", "None", ":", "self", ".", "message_body", "=", "self", ".", "message_body", "+", "text", "+", "'\\n'", "print", "(", "text", ")" ]
Add text to message body and report to stdout
[ "Add", "text", "to", "message", "body", "and", "report", "to", "stdout" ]
[ "\"\"\"\n Add text to message body and report to stdout\n \"\"\"", "# Report also to console stdout" ]
[ { "param": "self", "type": null }, { "param": "text", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "text", "type": "str", "docstring": null, "docstring_tokens": ...
9ac6a447121ce1c6d51f3f078ca8555d52f87a8d
zapisnicar/epsracun
eracuni/messages.py
[ "MIT" ]
Python
send_email
None
def send_email(self) -> None: """ Send email, UTF-8 encoded text """ if self.config.email_enabled and self.message_body != '': message = f"""\ From: {self.config.email_address} To: {self.config.receiver_email} Subject: Novi računi {self.message_body} """ context ...
Send email, UTF-8 encoded text
Send email, UTF-8 encoded text
[ "Send", "email", "UTF", "-", "8", "encoded", "text" ]
def send_email(self) -> None: if self.config.email_enabled and self.message_body != '': message = f"""\ From: {self.config.email_address} To: {self.config.receiver_email} Subject: Novi računi {self.message_body} """ context = ssl.create_default_context() with smtplib.SMTP_SSL...
[ "def", "send_email", "(", "self", ")", "->", "None", ":", "if", "self", ".", "config", ".", "email_enabled", "and", "self", ".", "message_body", "!=", "''", ":", "message", "=", "f\"\"\"\\\nFrom: {self.config.email_address}\nTo: {self.config.receiver_email}\nSubject: No...
Send email, UTF-8 encoded text
[ "Send", "email", "UTF", "-", "8", "encoded", "text" ]
[ "\"\"\"\n Send email, UTF-8 encoded text\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
336bf850069303d8faceae1f96a6e6862a3801d5
zapisnicar/epsracun
eracuni/data.py
[ "MIT" ]
Python
gecko_path
str
def gecko_path() -> str: """ Return path of geckodriver binary, OS dependent """ my_system = platform.system() my_machine = platform.machine() if my_system == 'Linux' and my_machine == 'x86_64': # Linux PC exe_path = r'bin/linux64/geckodriver' ...
Return path of geckodriver binary, OS dependent
Return path of geckodriver binary, OS dependent
[ "Return", "path", "of", "geckodriver", "binary", "OS", "dependent" ]
def gecko_path() -> str: my_system = platform.system() my_machine = platform.machine() if my_system == 'Linux' and my_machine == 'x86_64': exe_path = r'bin/linux64/geckodriver' elif my_system == 'Linux' and my_machine == 'armv7l': exe_path = r'bin/arm7hf/geckodriv...
[ "def", "gecko_path", "(", ")", "->", "str", ":", "my_system", "=", "platform", ".", "system", "(", ")", "my_machine", "=", "platform", ".", "machine", "(", ")", "if", "my_system", "==", "'Linux'", "and", "my_machine", "==", "'x86_64'", ":", "exe_path", "...
Return path of geckodriver binary, OS dependent
[ "Return", "path", "of", "geckodriver", "binary", "OS", "dependent" ]
[ "\"\"\"\n Return path of geckodriver binary, OS dependent\n \"\"\"", "# Linux PC", "# Linux Raspberry Pi", "# Windows", "# Mac", "# Notarization Workaround:", "# https://firefox-source-docs.mozilla.org/testing/geckodriver/Notarization.html", "# No idea" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
34d4f6c26f04a6900408576aae6c392c58c484e6
imanuelcg/sqlalchemy-challenge
climate_app_hw.py
[ "ADSL" ]
Python
welcome
<not_specific>
def welcome(): """List all available api routes.""" return( f"Welcome to my website!<br/>" f"Available Routes:<br/>" f"/api/v1.0/precipitation<br/>" f"/api/v1.0/stations<br/>" f"/api/v1.0/tobs<br/>" f"//api/v1.0/<start><br/>" f"/api/v1.0/<start>/<end><br/>...
List all available api routes.
List all available api routes.
[ "List", "all", "available", "api", "routes", "." ]
def welcome(): return( f"Welcome to my website!<br/>" f"Available Routes:<br/>" f"/api/v1.0/precipitation<br/>" f"/api/v1.0/stations<br/>" f"/api/v1.0/tobs<br/>" f"//api/v1.0/<start><br/>" f"/api/v1.0/<start>/<end><br/>" )
[ "def", "welcome", "(", ")", ":", "return", "(", "f\"Welcome to my website!<br/>\"", "f\"Available Routes:<br/>\"", "f\"/api/v1.0/precipitation<br/>\"", "f\"/api/v1.0/stations<br/>\"", "f\"/api/v1.0/tobs<br/>\"", "f\"//api/v1.0/<start><br/>\"", "f\"/api/v1.0/<start>/<end><br/>\"", ")" ]
List all available api routes.
[ "List", "all", "available", "api", "routes", "." ]
[ "\"\"\"List all available api routes.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
9cb026c3a5fccc7cfc7d5c5abf803afad9dd3ffc
SuperGamer365/Project_Aera
src/bot.py
[ "MIT" ]
Python
load_exts
None
def load_exts(self) -> None: """Loads needed extensions in the cogs folder""" for filename in os.listdir(".\src\cogs"): if filename.endswith('.py'): try: self.load_extension(f"cogs.{filename[:-3]}") except ExtensionNotFound: ...
Loads needed extensions in the cogs folder
Loads needed extensions in the cogs folder
[ "Loads", "needed", "extensions", "in", "the", "cogs", "folder" ]
def load_exts(self) -> None: for filename in os.listdir(".\src\cogs"): if filename.endswith('.py'): try: self.load_extension(f"cogs.{filename[:-3]}") except ExtensionNotFound: logger.fatal("The extension could not be imported. T...
[ "def", "load_exts", "(", "self", ")", "->", "None", ":", "for", "filename", "in", "os", ".", "listdir", "(", "\".\\src\\cogs\"", ")", ":", "if", "filename", ".", "endswith", "(", "'.py'", ")", ":", "try", ":", "self", ".", "load_extension", "(", "f\"co...
Loads needed extensions in the cogs folder
[ "Loads", "needed", "extensions", "in", "the", "cogs", "folder" ]
[ "\"\"\"Loads needed extensions in the cogs folder\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9cb026c3a5fccc7cfc7d5c5abf803afad9dd3ffc
SuperGamer365/Project_Aera
src/bot.py
[ "MIT" ]
Python
create
"Bot"
def create(cls) -> "Bot": """Creates and returns a bot instance""" loop = asyncio.get_event_loop() return cls( command_prefix="$", loop=loop, case_insensitive=True, intents=Intents.all(), activity=Activity(type=discord.ActivityType.lis...
Creates and returns a bot instance
Creates and returns a bot instance
[ "Creates", "and", "returns", "a", "bot", "instance" ]
def create(cls) -> "Bot": loop = asyncio.get_event_loop() return cls( command_prefix="$", loop=loop, case_insensitive=True, intents=Intents.all(), activity=Activity(type=discord.ActivityType.listening, name="forgot prefix? ping me") )
[ "def", "create", "(", "cls", ")", "->", "\"Bot\"", ":", "loop", "=", "asyncio", ".", "get_event_loop", "(", ")", "return", "cls", "(", "command_prefix", "=", "\"$\"", ",", "loop", "=", "loop", ",", "case_insensitive", "=", "True", ",", "intents", "=", ...
Creates and returns a bot instance
[ "Creates", "and", "returns", "a", "bot", "instance" ]
[ "\"\"\"Creates and returns a bot instance\"\"\"" ]
[ { "param": "cls", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
28a6cd67583aaea23b8d40e9061ec596cdb2ce3c
whythawk/chapisha
chapisha/create/create.py
[ "BSD-3-Clause" ]
Python
_get_validated_bytes
bytes
def _get_validated_bytes(self, source: [Path, bytes], base_type: Optional[List[Literal["cover", "work"]]] = None) -> bytes: """ Validate a source file, and return a bytes version. Parameters ---------- source: Path, byt...
Validate a source file, and return a bytes version. Parameters ---------- source: Path, bytes or base64 string Filename to open, base64 string, or bytes from an opened file base_type: Optional, str Must be one of "cover" or "work" for interpreting base64...
Validate a source file, and return a bytes version. Parameters Path, bytes or base64 string Filename to open, base64 string, or bytes from an opened file base_type: Optional, str Must be one of "cover" or "work" for interpreting base64 mime type Raises if metadata not yet validated. FileNotFoundError: if the source ...
[ "Validate", "a", "source", "file", "and", "return", "a", "bytes", "version", ".", "Parameters", "Path", "bytes", "or", "base64", "string", "Filename", "to", "open", "base64", "string", "or", "bytes", "from", "an", "opened", "file", "base_type", ":", "Optiona...
def _get_validated_bytes(self, source: [Path, bytes], base_type: Optional[List[Literal["cover", "work"]]] = None) -> bytes: if not self.metadata: e = "`set_metadata` before setting source document." raise PermissionError(e) ...
[ "def", "_get_validated_bytes", "(", "self", ",", "source", ":", "[", "Path", ",", "bytes", "]", ",", "base_type", ":", "Optional", "[", "List", "[", "Literal", "[", "\"cover\"", ",", "\"work\"", "]", "]", "]", "=", "None", ")", "->", "bytes", ":", "i...
Validate a source file, and return a bytes version.
[ "Validate", "a", "source", "file", "and", "return", "a", "bytes", "version", "." ]
[ "\"\"\"\n Validate a source file, and return a bytes version.\n\n Parameters\n ----------\n source: Path, bytes or base64 string\n Filename to open, base64 string, or bytes from an opened file\n base_type: Optional, str\n Must be one of \"cover\" or \"work\" ...
[ { "param": "self", "type": null }, { "param": "source", "type": "[Path, bytes]" }, { "param": "base_type", "type": "Optional[List[Literal[\"cover\", \"work\"]]]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "source", "type": "[Path, bytes]", "docstring": null, "docstri...
28a6cd67583aaea23b8d40e9061ec596cdb2ce3c
whythawk/chapisha
chapisha/create/create.py
[ "BSD-3-Clause" ]
Python
add_contributor
null
def add_contributor(self, contributor: Contributor): """ Add a contributor to the list of those supporting the creation of the work. `contributor` is defined as a dict: .. code-block:: python contributor = { "role": "artist", "name": "Great A...
Add a contributor to the list of those supporting the creation of the work. `contributor` is defined as a dict: .. code-block:: python contributor = { "role": "artist", "name": "Great Artist", "year": "2021", "terms":...
Add a contributor to the list of those supporting the creation of the work. `contributor` is defined as a dict: code-block:: python Parameters Contributor Include the types of contributor who supported the creation of the work. Raises if metadata not yet validated.
[ "Add", "a", "contributor", "to", "the", "list", "of", "those", "supporting", "the", "creation", "of", "the", "work", ".", "`", "contributor", "`", "is", "defined", "as", "a", "dict", ":", "code", "-", "block", "::", "python", "Parameters", "Contributor", ...
def add_contributor(self, contributor: Contributor): if not self.work_name or not self.metadata: e = "`set_metadata` before adding contributors, or add the contributors when you set the metadata." raise PermissionError(e) if self.metadata.contributor is None: self.met...
[ "def", "add_contributor", "(", "self", ",", "contributor", ":", "Contributor", ")", ":", "if", "not", "self", ".", "work_name", "or", "not", "self", ".", "metadata", ":", "e", "=", "\"`set_metadata` before adding contributors, or add the contributors when you set the me...
Add a contributor to the list of those supporting the creation of the work.
[ "Add", "a", "contributor", "to", "the", "list", "of", "those", "supporting", "the", "creation", "of", "the", "work", "." ]
[ "\"\"\"\n Add a contributor to the list of those supporting the creation of the work. `contributor` is defined as a dict:\n \n .. code-block:: python\n\n contributor = {\n \"role\": \"artist\",\n \"name\": \"Great Artist\",\n \"year\": \"2...
[ { "param": "self", "type": null }, { "param": "contributor", "type": "Contributor" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "contributor", "type": "Contributor", "docstring": null, "docs...
28a6cd67583aaea23b8d40e9061ec596cdb2ce3c
whythawk/chapisha
chapisha/create/create.py
[ "BSD-3-Clause" ]
Python
build
null
def build(self): """ Automatically build the creative work as a standards compliant EPUB3. Save to the root directory. """ if not self.work_name or not self.metadata: e = "`set_metadata` before building creative work." raise PermissionError(e) epub_path = ...
Automatically build the creative work as a standards compliant EPUB3. Save to the root directory.
Automatically build the creative work as a standards compliant EPUB3. Save to the root directory.
[ "Automatically", "build", "the", "creative", "work", "as", "a", "standards", "compliant", "EPUB3", ".", "Save", "to", "the", "root", "directory", "." ]
def build(self): if not self.work_name or not self.metadata: e = "`set_metadata` before building creative work." raise PermissionError(e) epub_path = self.directory.parent / F"{self.work_name}.epub" if self.stateless: pypandoc.convert_file(str(self.directory /...
[ "def", "build", "(", "self", ")", ":", "if", "not", "self", ".", "work_name", "or", "not", "self", ".", "metadata", ":", "e", "=", "\"`set_metadata` before building creative work.\"", "raise", "PermissionError", "(", "e", ")", "epub_path", "=", "self", ".", ...
Automatically build the creative work as a standards compliant EPUB3.
[ "Automatically", "build", "the", "creative", "work", "as", "a", "standards", "compliant", "EPUB3", "." ]
[ "\"\"\"\n Automatically build the creative work as a standards compliant EPUB3. Save to the root directory.\n \"\"\"", "# Generate the initial creative content using Pandoc", "# pypandoc can't handle PosixPaths ...", "# Maybe one day Pandoc can return an epub object and we won't save the interim...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
28a6cd67583aaea23b8d40e9061ec596cdb2ce3c
whythawk/chapisha
chapisha/create/create.py
[ "BSD-3-Clause" ]
Python
validate
bool
def validate(self) -> bool: """ Validate the creative work as a standards compliant EPUB3. """ epub_path = self.directory.parent / F"{self.work_name}.epub" _c.check_source(epub_path) result = EpubCheck(epub_path) return result.valid
Validate the creative work as a standards compliant EPUB3.
Validate the creative work as a standards compliant EPUB3.
[ "Validate", "the", "creative", "work", "as", "a", "standards", "compliant", "EPUB3", "." ]
def validate(self) -> bool: epub_path = self.directory.parent / F"{self.work_name}.epub" _c.check_source(epub_path) result = EpubCheck(epub_path) return result.valid
[ "def", "validate", "(", "self", ")", "->", "bool", ":", "epub_path", "=", "self", ".", "directory", ".", "parent", "/", "F\"{self.work_name}.epub\"", "_c", ".", "check_source", "(", "epub_path", ")", "result", "=", "EpubCheck", "(", "epub_path", ")", "return...
Validate the creative work as a standards compliant EPUB3.
[ "Validate", "the", "creative", "work", "as", "a", "standards", "compliant", "EPUB3", "." ]
[ "\"\"\"\n Validate the creative work as a standards compliant EPUB3.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3b30e83d7b4b5a7792a4193558fd08791ccf491b
whythawk/chapisha
chapisha/helpers/pages.py
[ "BSD-3-Clause" ]
Python
restructure_chapter
<not_specific>
def restructure_chapter(source: bytes): """ Given an xml source, restructure the content into the default chapter xhtml format. Parameters ---------- source: bytes Chapter xhtml as bytes. Returns ------- Beautifulsoup xhtml. """ if not isinstance(source, bytes): ...
Given an xml source, restructure the content into the default chapter xhtml format. Parameters ---------- source: bytes Chapter xhtml as bytes. Returns ------- Beautifulsoup xhtml.
Given an xml source, restructure the content into the default chapter xhtml format. Parameters bytes Chapter xhtml as bytes. Returns Beautifulsoup xhtml.
[ "Given", "an", "xml", "source", "restructure", "the", "content", "into", "the", "default", "chapter", "xhtml", "format", ".", "Parameters", "bytes", "Chapter", "xhtml", "as", "bytes", ".", "Returns", "Beautifulsoup", "xhtml", "." ]
def restructure_chapter(source: bytes): if not isinstance(source, bytes): e = "Source is not of type `bytes`." raise TypeError(e) source = BeautifulSoup(source.decode("utf-8"), "lxml") for img in source.find_all("img"): img["src"] = img["src"].replace("../media/", "../images/") w...
[ "def", "restructure_chapter", "(", "source", ":", "bytes", ")", ":", "if", "not", "isinstance", "(", "source", ",", "bytes", ")", ":", "e", "=", "\"Source is not of type `bytes`.\"", "raise", "TypeError", "(", "e", ")", "source", "=", "BeautifulSoup", "(", "...
Given an xml source, restructure the content into the default chapter xhtml format.
[ "Given", "an", "xml", "source", "restructure", "the", "content", "into", "the", "default", "chapter", "xhtml", "format", "." ]
[ "\"\"\"\n Given an xml source, restructure the content into the default chapter xhtml format.\n\n Parameters\n ----------\n source: bytes\n Chapter xhtml as bytes.\n\n Returns\n -------\n Beautifulsoup xhtml.\n \"\"\"", "# rename `media` folder to `images`" ]
[ { "param": "source", "type": "bytes" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "source", "type": "bytes", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3b30e83d7b4b5a7792a4193558fd08791ccf491b
whythawk/chapisha
chapisha/helpers/pages.py
[ "BSD-3-Clause" ]
Python
create_titlepage_xhtml
str
def create_titlepage_xhtml(metadata: WorkMetadata) -> str: """ Load the default `titlepage.xhtml` file, and generate the required terms for the creative work. Return xhtml as a string. Parameters ---------- metadata: WorkMetadata All the terms for updating the work, not all compulsory ...
Load the default `titlepage.xhtml` file, and generate the required terms for the creative work. Return xhtml as a string. Parameters ---------- metadata: WorkMetadata All the terms for updating the work, not all compulsory Returns ------- str: svg response for `titlepage.xhtml...
Load the default `titlepage.xhtml` file, and generate the required terms for the creative work. Return xhtml as a string. Parameters WorkMetadata All the terms for updating the work, not all compulsory Returns svg response for `titlepage.xhtml` as a str.
[ "Load", "the", "default", "`", "titlepage", ".", "xhtml", "`", "file", "and", "generate", "the", "required", "terms", "for", "the", "creative", "work", ".", "Return", "xhtml", "as", "a", "string", ".", "Parameters", "WorkMetadata", "All", "the", "terms", "...
def create_titlepage_xhtml(metadata: WorkMetadata) -> str: with open(DATA_PATH / "xhtml" / DEFAULT_TITLEPAGE, "r+", encoding="utf-8") as xhtml_file: xml_txt = xhtml_file.read() title_xml = "" y = TITLEPAGE_TITLE_START for row in formats.get_text_rows(metadata.title): y +=...
[ "def", "create_titlepage_xhtml", "(", "metadata", ":", "WorkMetadata", ")", "->", "str", ":", "with", "open", "(", "DATA_PATH", "/", "\"xhtml\"", "/", "DEFAULT_TITLEPAGE", ",", "\"r+\"", ",", "encoding", "=", "\"utf-8\"", ")", "as", "xhtml_file", ":", "xml_txt...
Load the default `titlepage.xhtml` file, and generate the required terms for the creative work.
[ "Load", "the", "default", "`", "titlepage", ".", "xhtml", "`", "file", "and", "generate", "the", "required", "terms", "for", "the", "creative", "work", "." ]
[ "\"\"\"\n Load the default `titlepage.xhtml` file, and generate the required terms for the creative work. Return xhtml as a string.\n \n Parameters\n ----------\n metadata: WorkMetadata\n All the terms for updating the work, not all compulsory\n\n Returns\n -------\n str: svg response...
[ { "param": "metadata", "type": "WorkMetadata" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "metadata", "type": "WorkMetadata", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3b30e83d7b4b5a7792a4193558fd08791ccf491b
whythawk/chapisha
chapisha/helpers/pages.py
[ "BSD-3-Clause" ]
Python
create_content_opf
str
def create_content_opf(metadata: WorkMetadata, image_manifest: list[str], spine: list[Matter]) -> str: """ Load the default `content.opf` file, and generate the required terms for the creative work. Return xhtml as a string. Parameters ---------- metadata: WorkMetadata All the terms for...
Load the default `content.opf` file, and generate the required terms for the creative work. Return xhtml as a string. Parameters ---------- metadata: WorkMetadata All the terms for updating the work, not all compulsory manifest: list of str Complete resource manifest for the wo...
Load the default `content.opf` file, and generate the required terms for the creative work. Return xhtml as a string. Parameters WorkMetadata All the terms for updating the work, not all compulsory manifest: list of str Complete resource manifest for the work, derived from `ZipFile.namelist()` spine: list of Matter Sp...
[ "Load", "the", "default", "`", "content", ".", "opf", "`", "file", "and", "generate", "the", "required", "terms", "for", "the", "creative", "work", ".", "Return", "xhtml", "as", "a", "string", ".", "Parameters", "WorkMetadata", "All", "the", "terms", "for"...
def create_content_opf(metadata: WorkMetadata, image_manifest: list[str], spine: list[Matter]) -> str: with open(DATA_PATH / "xhtml" / DEFAULT_CONTENT_OPF, "r+", encoding="utf-8") as opf_file: opf_xml = opf_file.read() opf_xml = opf_xml.replace('<dc:identifier id="uid"></dc:identifier>', ...
[ "def", "create_content_opf", "(", "metadata", ":", "WorkMetadata", ",", "image_manifest", ":", "list", "[", "str", "]", ",", "spine", ":", "list", "[", "Matter", "]", ")", "->", "str", ":", "with", "open", "(", "DATA_PATH", "/", "\"xhtml\"", "/", "DEFAUL...
Load the default `content.opf` file, and generate the required terms for the creative work.
[ "Load", "the", "default", "`", "content", ".", "opf", "`", "file", "and", "generate", "the", "required", "terms", "for", "the", "creative", "work", "." ]
[ "\"\"\"\n Load the default `content.opf` file, and generate the required terms for the creative work. Return xhtml as a string.\n \n Parameters\n ----------\n metadata: WorkMetadata\n All the terms for updating the work, not all compulsory\n manifest: list of str\n Complete resource ...
[ { "param": "metadata", "type": "WorkMetadata" }, { "param": "image_manifest", "type": "list[str]" }, { "param": "spine", "type": "list[Matter]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "metadata", "type": "WorkMetadata", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "image_manifest", "type": "list[str]", "docstring": nu...
3b30e83d7b4b5a7792a4193558fd08791ccf491b
whythawk/chapisha
chapisha/helpers/pages.py
[ "BSD-3-Clause" ]
Python
create_toc_ncx
str
def create_toc_ncx(metadata: WorkMetadata, spine: list[Matter]) -> str: """ Load the default `toc.ncx` file, and generate the required terms for the creative work. Return xhtml as a string. Parameters ---------- metadata: WorkMetadata All the terms for updating the work, not all compuls...
Load the default `toc.ncx` file, and generate the required terms for the creative work. Return xhtml as a string. Parameters ---------- metadata: WorkMetadata All the terms for updating the work, not all compulsory spine: list of Matter Spine and guide list of Matter, with `ded...
Load the default `toc.ncx` file, and generate the required terms for the creative work. Return xhtml as a string. Parameters WorkMetadata All the terms for updating the work, not all compulsory spine: list of Matter Spine and guide list of Matter, with `dedication` at 0, if present Returns xhtml response for `toc.nc...
[ "Load", "the", "default", "`", "toc", ".", "ncx", "`", "file", "and", "generate", "the", "required", "terms", "for", "the", "creative", "work", ".", "Return", "xhtml", "as", "a", "string", ".", "Parameters", "WorkMetadata", "All", "the", "terms", "for", ...
def create_toc_ncx(metadata: WorkMetadata, spine: list[Matter]) -> str: with open(DATA_PATH / "xhtml" / DEFAULT_TOC_NCX, "r+", encoding="utf-8") as toc_file: toc_xml = toc_file.read() toc_xml = toc_xml.replace('<meta content="" name="dtb:uid"/>', F'<meta name="dtb:...
[ "def", "create_toc_ncx", "(", "metadata", ":", "WorkMetadata", ",", "spine", ":", "list", "[", "Matter", "]", ")", "->", "str", ":", "with", "open", "(", "DATA_PATH", "/", "\"xhtml\"", "/", "DEFAULT_TOC_NCX", ",", "\"r+\"", ",", "encoding", "=", "\"utf-8\"...
Load the default `toc.ncx` file, and generate the required terms for the creative work.
[ "Load", "the", "default", "`", "toc", ".", "ncx", "`", "file", "and", "generate", "the", "required", "terms", "for", "the", "creative", "work", "." ]
[ "\"\"\"\n Load the default `toc.ncx` file, and generate the required terms for the creative work. Return xhtml as a string.\n \n Parameters\n ----------\n metadata: WorkMetadata\n All the terms for updating the work, not all compulsory\n spine: list of Matter\n Spine and guide list o...
[ { "param": "metadata", "type": "WorkMetadata" }, { "param": "spine", "type": "list[Matter]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "metadata", "type": "WorkMetadata", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "spine", "type": "list[Matter]", "docstring": null, ...
3b30e83d7b4b5a7792a4193558fd08791ccf491b
whythawk/chapisha
chapisha/helpers/pages.py
[ "BSD-3-Clause" ]
Python
create_toc_xhtml
str
def create_toc_xhtml(metadata: WorkMetadata, spine: list[Matter]) -> str: """ Load the default `toc.xhtml` file, and generate the required terms for the creative work. Return xhtml as a string. Parameters ---------- metadata: WorkMetadata All the terms for updating the work, not all com...
Load the default `toc.xhtml` file, and generate the required terms for the creative work. Return xhtml as a string. Parameters ---------- metadata: WorkMetadata All the terms for updating the work, not all compulsory spine: list of Matter Spine and guide list of Matter, with `d...
Load the default `toc.xhtml` file, and generate the required terms for the creative work. Return xhtml as a string. Parameters WorkMetadata All the terms for updating the work, not all compulsory spine: list of Matter Spine and guide list of Matter, with `dedication` at 0, if present Returns xhtml response for `toc....
[ "Load", "the", "default", "`", "toc", ".", "xhtml", "`", "file", "and", "generate", "the", "required", "terms", "for", "the", "creative", "work", ".", "Return", "xhtml", "as", "a", "string", ".", "Parameters", "WorkMetadata", "All", "the", "terms", "for", ...
def create_toc_xhtml(metadata: WorkMetadata, spine: list[Matter]) -> str: with open(DATA_PATH / "xhtml" / DEFAULT_TOC_XHTML, "r+", encoding="utf-8") as toc_file: toc_xml = toc_file.read() toc_xhtml = "" chapter = 1 for matter in spine: if matter.content == FrontMatter.ded...
[ "def", "create_toc_xhtml", "(", "metadata", ":", "WorkMetadata", ",", "spine", ":", "list", "[", "Matter", "]", ")", "->", "str", ":", "with", "open", "(", "DATA_PATH", "/", "\"xhtml\"", "/", "DEFAULT_TOC_XHTML", ",", "\"r+\"", ",", "encoding", "=", "\"utf...
Load the default `toc.xhtml` file, and generate the required terms for the creative work.
[ "Load", "the", "default", "`", "toc", ".", "xhtml", "`", "file", "and", "generate", "the", "required", "terms", "for", "the", "creative", "work", "." ]
[ "\"\"\"\n Load the default `toc.xhtml` file, and generate the required terms for the creative work. Return xhtml as a string.\n \n Parameters\n ----------\n metadata: WorkMetadata\n All the terms for updating the work, not all compulsory\n spine: list of Matter\n Spine and guide list...
[ { "param": "metadata", "type": "WorkMetadata" }, { "param": "spine", "type": "list[Matter]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "metadata", "type": "WorkMetadata", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "spine", "type": "list[Matter]", "docstring": null, ...
3b30e83d7b4b5a7792a4193558fd08791ccf491b
whythawk/chapisha
chapisha/helpers/pages.py
[ "BSD-3-Clause" ]
Python
create_colophon_xhtml
str
def create_colophon_xhtml(metadata: WorkMetadata) -> str: """ Load the default `colophon.xhtml` file, and generate the required terms for the creative work. Return xhtml as a string. Parameters ---------- metadata: WorkMetadata All the terms for updating the work, not all compulsory ...
Load the default `colophon.xhtml` file, and generate the required terms for the creative work. Return xhtml as a string. Parameters ---------- metadata: WorkMetadata All the terms for updating the work, not all compulsory Returns ------- str: xhtml response for `colophon.xhtml...
Load the default `colophon.xhtml` file, and generate the required terms for the creative work. Return xhtml as a string. Parameters WorkMetadata All the terms for updating the work, not all compulsory Returns xhtml response for `colophon.xhtml` as a str.
[ "Load", "the", "default", "`", "colophon", ".", "xhtml", "`", "file", "and", "generate", "the", "required", "terms", "for", "the", "creative", "work", ".", "Return", "xhtml", "as", "a", "string", ".", "Parameters", "WorkMetadata", "All", "the", "terms", "f...
def create_colophon_xhtml(metadata: WorkMetadata) -> str: with open(DATA_PATH / "xhtml" / DEFAULT_COLOPHON_XHTML, "r+", encoding="utf-8") as xml_file: xml_txt = xml_file.read() xml_txt = xml_txt.replace("WORK_TITLE", metadata.title.upper()) creator = metadata.creator if isinstance(cr...
[ "def", "create_colophon_xhtml", "(", "metadata", ":", "WorkMetadata", ")", "->", "str", ":", "with", "open", "(", "DATA_PATH", "/", "\"xhtml\"", "/", "DEFAULT_COLOPHON_XHTML", ",", "\"r+\"", ",", "encoding", "=", "\"utf-8\"", ")", "as", "xml_file", ":", "xml_t...
Load the default `colophon.xhtml` file, and generate the required terms for the creative work.
[ "Load", "the", "default", "`", "colophon", ".", "xhtml", "`", "file", "and", "generate", "the", "required", "terms", "for", "the", "creative", "work", "." ]
[ "\"\"\"\n Load the default `colophon.xhtml` file, and generate the required terms for the creative work. Return xhtml as a string.\n \n Parameters\n ----------\n metadata: WorkMetadata\n All the terms for updating the work, not all compulsory\n\n Returns\n -------\n str: xhtml respons...
[ { "param": "metadata", "type": "WorkMetadata" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "metadata", "type": "WorkMetadata", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3b30e83d7b4b5a7792a4193558fd08791ccf491b
whythawk/chapisha
chapisha/helpers/pages.py
[ "BSD-3-Clause" ]
Python
create_dedication_xhtml
str
def create_dedication_xhtml(dedication: [str, list[str]]) -> str: """ Load the default `dedication.xhtml` file, and generate the required terms for the creative work. Return xhtml as a string. Parameters ---------- dedication: str or list of str Provide as a string, or list of strin...
Load the default `dedication.xhtml` file, and generate the required terms for the creative work. Return xhtml as a string. Parameters ---------- dedication: str or list of str Provide as a string, or list of strings for multiple paragraphs. Returns ------- str: xhtml respo...
Load the default `dedication.xhtml` file, and generate the required terms for the creative work. Return xhtml as a string. Parameters str or list of str Provide as a string, or list of strings for multiple paragraphs. Returns xhtml response for `dedication.xhtml` as a str.
[ "Load", "the", "default", "`", "dedication", ".", "xhtml", "`", "file", "and", "generate", "the", "required", "terms", "for", "the", "creative", "work", ".", "Return", "xhtml", "as", "a", "string", ".", "Parameters", "str", "or", "list", "of", "str", "Pr...
def create_dedication_xhtml(dedication: [str, list[str]]) -> str: if isinstance(dedication, list): dedication = "\n".join(dedication) with open(DATA_PATH / "xhtml" / DEFAULT_DEDICATION_XHTML, "r+", encoding="utf-8") as xml_file: xml_txt = xml_file.read() ddctn_xml = "" for p in f...
[ "def", "create_dedication_xhtml", "(", "dedication", ":", "[", "str", ",", "list", "[", "str", "]", "]", ")", "->", "str", ":", "if", "isinstance", "(", "dedication", ",", "list", ")", ":", "dedication", "=", "\"\\n\"", ".", "join", "(", "dedication", ...
Load the default `dedication.xhtml` file, and generate the required terms for the creative work.
[ "Load", "the", "default", "`", "dedication", ".", "xhtml", "`", "file", "and", "generate", "the", "required", "terms", "for", "the", "creative", "work", "." ]
[ "\"\"\"\n Load the default `dedication.xhtml` file, and generate the required terms for the creative work. Return xhtml as a string.\n \n Parameters\n ----------\n dedication: str or list of str\n Provide as a string, or list of strings for multiple paragraphs.\n\n Returns\n -------\...
[ { "param": "dedication", "type": "[str, list[str]]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "dedication", "type": "[str, list[str]]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
10ff8f775ec0962e717f15d25f9f09a94702575b
whythawk/chapisha
chapisha/helpers/updatezipfile.py
[ "BSD-3-Clause" ]
Python
write
null
def write(self, filename: str, arcname: Optional[str]=None, compress_type: Optional[int]=None, compresslevel: Optional[int]=None): """ Put the bytes from filename into the archive under the name arcname. Parameters ---------- ...
Put the bytes from filename into the archive under the name arcname. Parameters ---------- filename: str Complete path to source file arcname: str Name of destination file. If not provided, filename and arname are the same. compress_type:...
Put the bytes from filename into the archive under the name arcname. Parameters str Complete path to source file arcname: str Name of destination file. If not provided, filename and arname are the same. compress_type: int The numeric constant for an uncompressed archive member. compresslevel: int
[ "Put", "the", "bytes", "from", "filename", "into", "the", "archive", "under", "the", "name", "arcname", ".", "Parameters", "str", "Complete", "path", "to", "source", "file", "arcname", ":", "str", "Name", "of", "destination", "file", ".", "If", "not", "pro...
def write(self, filename: str, arcname: Optional[str]=None, compress_type: Optional[int]=None, compresslevel: Optional[int]=None): arcname = arcname or filename if self._allow_updates and arcname in self.namelist(): temp_file = self._replace[arcna...
[ "def", "write", "(", "self", ",", "filename", ":", "str", ",", "arcname", ":", "Optional", "[", "str", "]", "=", "None", ",", "compress_type", ":", "Optional", "[", "int", "]", "=", "None", ",", "compresslevel", ":", "Optional", "[", "int", "]", "=",...
Put the bytes from filename into the archive under the name arcname.
[ "Put", "the", "bytes", "from", "filename", "into", "the", "archive", "under", "the", "name", "arcname", "." ]
[ "\"\"\"\n Put the bytes from filename into the archive under the name arcname.\n \n Parameters\n ----------\n filename: str\n Complete path to source file\n arcname: str\n Name of destination file. If not provided, filename and arname are the same.\n ...
[ { "param": "self", "type": null }, { "param": "filename", "type": "str" }, { "param": "arcname", "type": "Optional[str]" }, { "param": "compress_type", "type": "Optional[int]" }, { "param": "compresslevel", "type": "Optional[int]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filename", "type": "str", "docstring": null, "docstring_token...
10ff8f775ec0962e717f15d25f9f09a94702575b
whythawk/chapisha
chapisha/helpers/updatezipfile.py
[ "BSD-3-Clause" ]
Python
remove_file
null
def remove_file(self, path: [str, Path]): """ Delete an object from the archive. Parameters ---------- path: str or Path """ self._replace[path] = self.DeleteMarker()
Delete an object from the archive. Parameters ---------- path: str or Path
Delete an object from the archive. Parameters str or Path
[ "Delete", "an", "object", "from", "the", "archive", ".", "Parameters", "str", "or", "Path" ]
def remove_file(self, path: [str, Path]): self._replace[path] = self.DeleteMarker()
[ "def", "remove_file", "(", "self", ",", "path", ":", "[", "str", ",", "Path", "]", ")", ":", "self", ".", "_replace", "[", "path", "]", "=", "self", ".", "DeleteMarker", "(", ")" ]
Delete an object from the archive.
[ "Delete", "an", "object", "from", "the", "archive", "." ]
[ "\"\"\"\n Delete an object from the archive.\n \n Parameters\n ----------\n path: str or Path\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "path", "type": "[str, Path]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "path", "type": "[str, Path]", "docstring": null, "docstring_t...
e6ab5a00e881cbdc0d734d2c35831c636fe3d56e
bmerrill17/python-email-validator
email_validator/__init__.py
[ "CC0-1.0" ]
Python
validate_email
<not_specific>
def validate_email( email, allow_smtputf8=True, allow_empty_local=False, check_deliverability=True, test_environment=False, timeout=DEFAULT_TIMEOUT, dns_resolver=None ): """ Validates an email address, returning an ValidationResult object. The ValidationResult object's property of va...
Validates an email address, returning an ValidationResult object. The ValidationResult object's property of valid will be set to False if the address is not valid or True when the address is valid. The ValidationResult object's property of error will be an empty string if the email in valid or it will cont...
Validates an email address, returning an ValidationResult object. The ValidationResult object's property of valid will be set to False if the address is not valid or True when the address is valid. The ValidationResult object's property of error will be an empty string if the email in valid or it will contain a string-...
[ "Validates", "an", "email", "address", "returning", "an", "ValidationResult", "object", ".", "The", "ValidationResult", "object", "'", "s", "property", "of", "valid", "will", "be", "set", "to", "False", "if", "the", "address", "is", "not", "valid", "or", "Tr...
def validate_email( email, allow_smtputf8=True, allow_empty_local=False, check_deliverability=True, test_environment=False, timeout=DEFAULT_TIMEOUT, dns_resolver=None ): error = "" if not isinstance(email, (str, unicode_class)): email = email.decode("ascii") parts = email...
[ "def", "validate_email", "(", "email", ",", "allow_smtputf8", "=", "True", ",", "allow_empty_local", "=", "False", ",", "check_deliverability", "=", "True", ",", "test_environment", "=", "False", ",", "timeout", "=", "DEFAULT_TIMEOUT", ",", "dns_resolver", "=", ...
Validates an email address, returning an ValidationResult object.
[ "Validates", "an", "email", "address", "returning", "an", "ValidationResult", "object", "." ]
[ "\"\"\"\n Validates an email address, returning an ValidationResult object. The ValidationResult object's property of valid\n will be set to False if the address is not valid or True when the address is valid. The ValidationResult object's\n property of error will be an empty string if the email in valid o...
[ { "param": "email", "type": null }, { "param": "allow_smtputf8", "type": null }, { "param": "allow_empty_local", "type": null }, { "param": "check_deliverability", "type": null }, { "param": "test_environment", "type": null }, { "param": "timeout", ...
{ "returns": [], "raises": [], "params": [ { "identifier": "email", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "allow_smtputf8", "type": null, "docstring": null, "docstring...
077df5fa7276541a0f5b70c4a4da6c4e9dbbbcaa
NeoCodesOracle/CatalogApp
catalog_database.py
[ "MIT", "Unlicense" ]
Python
serialize
<not_specific>
def serialize(self): """Return object data in easily serializeable format""" return { 'name': self.name, 'id': self.id, 'email': self.email, 'img_url': self.img_url, }
Return object data in easily serializeable format
Return object data in easily serializeable format
[ "Return", "object", "data", "in", "easily", "serializeable", "format" ]
def serialize(self): return { 'name': self.name, 'id': self.id, 'email': self.email, 'img_url': self.img_url, }
[ "def", "serialize", "(", "self", ")", ":", "return", "{", "'name'", ":", "self", ".", "name", ",", "'id'", ":", "self", ".", "id", ",", "'email'", ":", "self", ".", "email", ",", "'img_url'", ":", "self", ".", "img_url", ",", "}" ]
Return object data in easily serializeable format
[ "Return", "object", "data", "in", "easily", "serializeable", "format" ]
[ "\"\"\"Return object data in easily serializeable format\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
077df5fa7276541a0f5b70c4a4da6c4e9dbbbcaa
NeoCodesOracle/CatalogApp
catalog_database.py
[ "MIT", "Unlicense" ]
Python
serialize
<not_specific>
def serialize(self): """Return object data in easily serializeable format""" return { 'name': self.name, 'id': self.id, 'img_url': self.img_url, }
Return object data in easily serializeable format
Return object data in easily serializeable format
[ "Return", "object", "data", "in", "easily", "serializeable", "format" ]
def serialize(self): return { 'name': self.name, 'id': self.id, 'img_url': self.img_url, }
[ "def", "serialize", "(", "self", ")", ":", "return", "{", "'name'", ":", "self", ".", "name", ",", "'id'", ":", "self", ".", "id", ",", "'img_url'", ":", "self", ".", "img_url", ",", "}" ]
Return object data in easily serializeable format
[ "Return", "object", "data", "in", "easily", "serializeable", "format" ]
[ "\"\"\"Return object data in easily serializeable format\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
077df5fa7276541a0f5b70c4a4da6c4e9dbbbcaa
NeoCodesOracle/CatalogApp
catalog_database.py
[ "MIT", "Unlicense" ]
Python
serialize
<not_specific>
def serialize(self): """Return object data in easily serializeable format""" return { 'name': self.name, 'description': self.description, 'id': self.id, 'price': self.price, }
Return object data in easily serializeable format
Return object data in easily serializeable format
[ "Return", "object", "data", "in", "easily", "serializeable", "format" ]
def serialize(self): return { 'name': self.name, 'description': self.description, 'id': self.id, 'price': self.price, }
[ "def", "serialize", "(", "self", ")", ":", "return", "{", "'name'", ":", "self", ".", "name", ",", "'description'", ":", "self", ".", "description", ",", "'id'", ":", "self", ".", "id", ",", "'price'", ":", "self", ".", "price", ",", "}" ]
Return object data in easily serializeable format
[ "Return", "object", "data", "in", "easily", "serializeable", "format" ]
[ "\"\"\"Return object data in easily serializeable format\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
fbconnect
<not_specific>
def fbconnect(): ''' Connects a user using her Facebook credentials. ''' if request.args.get('state') != login_session['state']: response = make_response(json.dumps('Invalid state parameter.'), 401) response.headers['Content-Type'] = 'application/json' return response access_...
Connects a user using her Facebook credentials.
Connects a user using her Facebook credentials.
[ "Connects", "a", "user", "using", "her", "Facebook", "credentials", "." ]
def fbconnect(): if request.args.get('state') != login_session['state']: response = make_response(json.dumps('Invalid state parameter.'), 401) response.headers['Content-Type'] = 'application/json' return response access_token = request.data print "access token received %s " % access_...
[ "def", "fbconnect", "(", ")", ":", "if", "request", ".", "args", ".", "get", "(", "'state'", ")", "!=", "login_session", "[", "'state'", "]", ":", "response", "=", "make_response", "(", "json", ".", "dumps", "(", "'Invalid state parameter.'", ")", ",", "...
Connects a user using her Facebook credentials.
[ "Connects", "a", "user", "using", "her", "Facebook", "credentials", "." ]
[ "'''\n Connects a user using her Facebook credentials.\n '''", "# Use token to get user info from API", "# strip expire tag from access token", "# print \"url sent for API access:%s\"% url", "# print \"API JSON result: %s\" % result", "# The token must be stored in the login_session in order to prop...
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
fbdisconnect
<not_specific>
def fbdisconnect(): ''' Disconnects a user from Facebook. ''' facebook_id = login_session['facebook_id'] # The access token must me included to successfully logout access_token = login_session['access_token'] url = 'https://graph.facebook.com\ /%s/permissions?access_token=%s' % (...
Disconnects a user from Facebook.
Disconnects a user from Facebook.
[ "Disconnects", "a", "user", "from", "Facebook", "." ]
def fbdisconnect(): facebook_id = login_session['facebook_id'] access_token = login_session['access_token'] url = 'https://graph.facebook.com\ /%s/permissions?access_token=%s' % (facebook_id, access_token) h = httplib2.Http() result = h.request(url, 'DELETE')[1] return "you have been...
[ "def", "fbdisconnect", "(", ")", ":", "facebook_id", "=", "login_session", "[", "'facebook_id'", "]", "access_token", "=", "login_session", "[", "'access_token'", "]", "url", "=", "'https://graph.facebook.com\\\n /%s/permissions?access_token=%s'", "%", "(", "fa...
Disconnects a user from Facebook.
[ "Disconnects", "a", "user", "from", "Facebook", "." ]
[ "'''\n Disconnects a user from Facebook.\n '''", "# The access token must me included to successfully logout" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
gconnect
<not_specific>
def gconnect(): ''' Connects a user using her Google account. ''' # Validate state token if request.args.get('state') != login_session['state']: response = make_response(json.dumps('Invalid state parameter.'), 401) response.headers['Content-Type'] = 'application/json' return ...
Connects a user using her Google account.
Connects a user using her Google account.
[ "Connects", "a", "user", "using", "her", "Google", "account", "." ]
def gconnect(): if request.args.get('state') != login_session['state']: response = make_response(json.dumps('Invalid state parameter.'), 401) response.headers['Content-Type'] = 'application/json' return response code = request.data try: oauth_flow = flow_from_clientsecrets('c...
[ "def", "gconnect", "(", ")", ":", "if", "request", ".", "args", ".", "get", "(", "'state'", ")", "!=", "login_session", "[", "'state'", "]", ":", "response", "=", "make_response", "(", "json", ".", "dumps", "(", "'Invalid state parameter.'", ")", ",", "4...
Connects a user using her Google account.
[ "Connects", "a", "user", "using", "her", "Google", "account", "." ]
[ "'''\n Connects a user using her Google account.\n '''", "# Validate state token", "# Obtain authorization code", "# Upgrade the authorization code into a credentials object", "# Check that the access token is valid.", "# If there was an error in the access token info, abort.", "# Verify that the ...
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
gdisconnect
<not_specific>
def gdisconnect(): ''' Disconnects a user from her Google account. ''' # Only disconnect a connected user. credentials = login_session.get('credentials') if credentials is None: response = make_response( json.dumps('Current user not connected.'), 401) response.headers...
Disconnects a user from her Google account.
Disconnects a user from her Google account.
[ "Disconnects", "a", "user", "from", "her", "Google", "account", "." ]
def gdisconnect(): credentials = login_session.get('credentials') if credentials is None: response = make_response( json.dumps('Current user not connected.'), 401) response.headers['Content-Type'] = 'application/json' return response access_token = login_session['credenti...
[ "def", "gdisconnect", "(", ")", ":", "credentials", "=", "login_session", ".", "get", "(", "'credentials'", ")", "if", "credentials", "is", "None", ":", "response", "=", "make_response", "(", "json", ".", "dumps", "(", "'Current user not connected.'", ")", ","...
Disconnects a user from her Google account.
[ "Disconnects", "a", "user", "from", "her", "Google", "account", "." ]
[ "'''\n Disconnects a user from her Google account.\n '''", "# Only disconnect a connected user.", "# For whatever reason, the given token was invalid." ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
disconnect
<not_specific>
def disconnect(): ''' Disconnects a user based on login provider. ''' if 'provider' in login_session: if login_session['provider'] == 'google': gdisconnect() del login_session['gplus_id'] del login_session['credentials'] if login_session['provider'] ==...
Disconnects a user based on login provider.
Disconnects a user based on login provider.
[ "Disconnects", "a", "user", "based", "on", "login", "provider", "." ]
def disconnect(): if 'provider' in login_session: if login_session['provider'] == 'google': gdisconnect() del login_session['gplus_id'] del login_session['credentials'] if login_session['provider'] == 'facebook': fbdisconnect() del login_se...
[ "def", "disconnect", "(", ")", ":", "if", "'provider'", "in", "login_session", ":", "if", "login_session", "[", "'provider'", "]", "==", "'google'", ":", "gdisconnect", "(", ")", "del", "login_session", "[", "'gplus_id'", "]", "del", "login_session", "[", "'...
Disconnects a user based on login provider.
[ "Disconnects", "a", "user", "based", "on", "login", "provider", "." ]
[ "'''\n Disconnects a user based on login provider.\n '''" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
createUser
<not_specific>
def createUser(login_session): ''' Creates a new user from login_session credentials. ''' newUser = User(name=login_session['username'], email=login_session[ 'email'], img_url=login_session['picture']) session.add(newUser) session.commit() user = session.query(User).filter...
Creates a new user from login_session credentials.
Creates a new user from login_session credentials.
[ "Creates", "a", "new", "user", "from", "login_session", "credentials", "." ]
def createUser(login_session): newUser = User(name=login_session['username'], email=login_session[ 'email'], img_url=login_session['picture']) session.add(newUser) session.commit() user = session.query(User).filter_by(email=login_session['email']).one() return user.id
[ "def", "createUser", "(", "login_session", ")", ":", "newUser", "=", "User", "(", "name", "=", "login_session", "[", "'username'", "]", ",", "email", "=", "login_session", "[", "'email'", "]", ",", "img_url", "=", "login_session", "[", "'picture'", "]", ")...
Creates a new user from login_session credentials.
[ "Creates", "a", "new", "user", "from", "login_session", "credentials", "." ]
[ "'''\n Creates a new user from login_session credentials.\n '''" ]
[ { "param": "login_session", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "login_session", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
showLogin
<not_specific>
def showLogin(): ''' Renders the page for login. ''' state = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in xrange(32)) login_session['state'] = state # RENDER LOGIN TEMPLATE return render_template('newlogin.html', STATE=state, ...
Renders the page for login.
Renders the page for login.
[ "Renders", "the", "page", "for", "login", "." ]
def showLogin(): state = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in xrange(32)) login_session['state'] = state return render_template('newlogin.html', STATE=state, login_session=login_session)
[ "def", "showLogin", "(", ")", ":", "state", "=", "''", ".", "join", "(", "random", ".", "choice", "(", "string", ".", "ascii_uppercase", "+", "string", ".", "digits", ")", "for", "x", "in", "xrange", "(", "32", ")", ")", "login_session", "[", "'state...
Renders the page for login.
[ "Renders", "the", "page", "for", "login", "." ]
[ "'''\n Renders the page for login.\n '''", "# RENDER LOGIN TEMPLATE" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
login_required
<not_specific>
def login_required(f): """ Decorator function -- forces user to login by redirecting to login page. """ @wraps(f) def decorated_function(*args, **kwargs): if 'user_id' not in login_session: return redirect(url_for('showLogin', next=request.url)) return f(*args, **kwargs) ...
Decorator function -- forces user to login by redirecting to login page.
Decorator function -- forces user to login by redirecting to login page.
[ "Decorator", "function", "--", "forces", "user", "to", "login", "by", "redirecting", "to", "login", "page", "." ]
def login_required(f): @wraps(f) def decorated_function(*args, **kwargs): if 'user_id' not in login_session: return redirect(url_for('showLogin', next=request.url)) return f(*args, **kwargs) return decorated_function
[ "def", "login_required", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "decorated_function", "(", "*", "args", ",", "**", "kwargs", ")", ":", "if", "'user_id'", "not", "in", "login_session", ":", "return", "redirect", "(", "url_for", "(", "'s...
Decorator function -- forces user to login by redirecting to login page.
[ "Decorator", "function", "--", "forces", "user", "to", "login", "by", "redirecting", "to", "login", "page", "." ]
[ "\"\"\"\n Decorator function -- forces user to login by redirecting to login page.\n \"\"\"" ]
[ { "param": "f", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "f", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
categoryItemsJSON
<not_specific>
def categoryItemsJSON(category_id): ''' Returns JSON objects for all items matching category_id ''' category = session.query(Category).filter_by(id=category_id).one() items = session.query(Item).filter_by( category_id=category.id).all() return jsonify(Items=[i.serialize for i in items])
Returns JSON objects for all items matching category_id
Returns JSON objects for all items matching category_id
[ "Returns", "JSON", "objects", "for", "all", "items", "matching", "category_id" ]
def categoryItemsJSON(category_id): category = session.query(Category).filter_by(id=category_id).one() items = session.query(Item).filter_by( category_id=category.id).all() return jsonify(Items=[i.serialize for i in items])
[ "def", "categoryItemsJSON", "(", "category_id", ")", ":", "category", "=", "session", ".", "query", "(", "Category", ")", ".", "filter_by", "(", "id", "=", "category_id", ")", ".", "one", "(", ")", "items", "=", "session", ".", "query", "(", "Item", ")...
Returns JSON objects for all items matching category_id
[ "Returns", "JSON", "objects", "for", "all", "items", "matching", "category_id" ]
[ "'''\n Returns JSON objects for all items matching category_id\n '''" ]
[ { "param": "category_id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "category_id", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
categoryItemJSON
<not_specific>
def categoryItemJSON(category_id, item_id): ''' Returns JSON representation for a single item matching item_id ''' category_item = session.query(Item).filter_by(id=item_id).one() return jsonify(Item=category_item.serialize)
Returns JSON representation for a single item matching item_id
Returns JSON representation for a single item matching item_id
[ "Returns", "JSON", "representation", "for", "a", "single", "item", "matching", "item_id" ]
def categoryItemJSON(category_id, item_id): category_item = session.query(Item).filter_by(id=item_id).one() return jsonify(Item=category_item.serialize)
[ "def", "categoryItemJSON", "(", "category_id", ",", "item_id", ")", ":", "category_item", "=", "session", ".", "query", "(", "Item", ")", ".", "filter_by", "(", "id", "=", "item_id", ")", ".", "one", "(", ")", "return", "jsonify", "(", "Item", "=", "ca...
Returns JSON representation for a single item matching item_id
[ "Returns", "JSON", "representation", "for", "a", "single", "item", "matching", "item_id" ]
[ "'''\n Returns JSON representation for a single item matching item_id\n '''" ]
[ { "param": "category_id", "type": null }, { "param": "item_id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "category_id", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "item_id", "type": null, "docstring": null, "docstring_...
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
categoriesJSON
<not_specific>
def categoriesJSON(): ''' Returns JSON objects for all categories in catalog. ''' categories = session.query(Category).all() return jsonify(Catergories=[c.serialize for c in categories])
Returns JSON objects for all categories in catalog.
Returns JSON objects for all categories in catalog.
[ "Returns", "JSON", "objects", "for", "all", "categories", "in", "catalog", "." ]
def categoriesJSON(): categories = session.query(Category).all() return jsonify(Catergories=[c.serialize for c in categories])
[ "def", "categoriesJSON", "(", ")", ":", "categories", "=", "session", ".", "query", "(", "Category", ")", ".", "all", "(", ")", "return", "jsonify", "(", "Catergories", "=", "[", "c", ".", "serialize", "for", "c", "in", "categories", "]", ")" ]
Returns JSON objects for all categories in catalog.
[ "Returns", "JSON", "objects", "for", "all", "categories", "in", "catalog", "." ]
[ "'''\n Returns JSON objects for all categories in catalog.\n '''" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
allItemsXML
<not_specific>
def allItemsXML(): ''' Returns XML objects for all items in catalog. ''' items = session.query(Item).all() return render_template('items.xml', items=items)
Returns XML objects for all items in catalog.
Returns XML objects for all items in catalog.
[ "Returns", "XML", "objects", "for", "all", "items", "in", "catalog", "." ]
def allItemsXML(): items = session.query(Item).all() return render_template('items.xml', items=items)
[ "def", "allItemsXML", "(", ")", ":", "items", "=", "session", ".", "query", "(", "Item", ")", ".", "all", "(", ")", "return", "render_template", "(", "'items.xml'", ",", "items", "=", "items", ")" ]
Returns XML objects for all items in catalog.
[ "Returns", "XML", "objects", "for", "all", "items", "in", "catalog", "." ]
[ "'''\n Returns XML objects for all items in catalog.\n '''" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
showCategories
<not_specific>
def showCategories(): ''' Shows all the categories in database by alphabetical order. ''' categories = session.query(Category).order_by(asc(Category.name)) if 'username' not in login_session: return render_template('guestcategories.html', categories=categories, ...
Shows all the categories in database by alphabetical order.
Shows all the categories in database by alphabetical order.
[ "Shows", "all", "the", "categories", "in", "database", "by", "alphabetical", "order", "." ]
def showCategories(): categories = session.query(Category).order_by(asc(Category.name)) if 'username' not in login_session: return render_template('guestcategories.html', categories=categories, login_session=login_session) else: return render_template('categori...
[ "def", "showCategories", "(", ")", ":", "categories", "=", "session", ".", "query", "(", "Category", ")", ".", "order_by", "(", "asc", "(", "Category", ".", "name", ")", ")", "if", "'username'", "not", "in", "login_session", ":", "return", "render_template...
Shows all the categories in database by alphabetical order.
[ "Shows", "all", "the", "categories", "in", "database", "by", "alphabetical", "order", "." ]
[ "'''\n Shows all the categories in database by alphabetical order.\n '''" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
addCategory
<not_specific>
def addCategory(): ''' Adds a new category to the existing database. ''' if request.method == 'POST': if request.form['name']: newCategory = Category(name=request.form['name'], img_url=request.form['img_url'], user...
Adds a new category to the existing database.
Adds a new category to the existing database.
[ "Adds", "a", "new", "category", "to", "the", "existing", "database", "." ]
def addCategory(): if request.method == 'POST': if request.form['name']: newCategory = Category(name=request.form['name'], img_url=request.form['img_url'], user_id=login_session['user_id']) session.add(newCategory)...
[ "def", "addCategory", "(", ")", ":", "if", "request", ".", "method", "==", "'POST'", ":", "if", "request", ".", "form", "[", "'name'", "]", ":", "newCategory", "=", "Category", "(", "name", "=", "request", ".", "form", "[", "'name'", "]", ",", "img_u...
Adds a new category to the existing database.
[ "Adds", "a", "new", "category", "to", "the", "existing", "database", "." ]
[ "'''\n Adds a new category to the existing database.\n '''" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
editCategory
<not_specific>
def editCategory(category_id): ''' Makes changes to an existing category in the database. ''' editedCategory = session.query(Category).filter_by(id=category_id).one() if editedCategory.user_id != login_session['user_id']: flash("You cannot edit this category. Catergories can only be \ ...
Makes changes to an existing category in the database.
Makes changes to an existing category in the database.
[ "Makes", "changes", "to", "an", "existing", "category", "in", "the", "database", "." ]
def editCategory(category_id): editedCategory = session.query(Category).filter_by(id=category_id).one() if editedCategory.user_id != login_session['user_id']: flash("You cannot edit this category. Catergories can only be \ modified by their owners. Create a category of your own to \ ...
[ "def", "editCategory", "(", "category_id", ")", ":", "editedCategory", "=", "session", ".", "query", "(", "Category", ")", ".", "filter_by", "(", "id", "=", "category_id", ")", ".", "one", "(", ")", "if", "editedCategory", ".", "user_id", "!=", "login_sess...
Makes changes to an existing category in the database.
[ "Makes", "changes", "to", "an", "existing", "category", "in", "the", "database", "." ]
[ "'''\n Makes changes to an existing category in the database.\n '''" ]
[ { "param": "category_id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "category_id", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
deleteCategory
<not_specific>
def deleteCategory(category_id): ''' Removes an existing category from the database. ''' categoryToDelete = session.query(Category).filter_by(id=category_id).one() if categoryToDelete.user_id != login_session['user_id']: flash("You cannot delete this category. Catergories can only be \ ...
Removes an existing category from the database.
Removes an existing category from the database.
[ "Removes", "an", "existing", "category", "from", "the", "database", "." ]
def deleteCategory(category_id): categoryToDelete = session.query(Category).filter_by(id=category_id).one() if categoryToDelete.user_id != login_session['user_id']: flash("You cannot delete this category. Catergories can only be \ deleted by their owners.") return redirect(url_for(...
[ "def", "deleteCategory", "(", "category_id", ")", ":", "categoryToDelete", "=", "session", ".", "query", "(", "Category", ")", ".", "filter_by", "(", "id", "=", "category_id", ")", ".", "one", "(", ")", "if", "categoryToDelete", ".", "user_id", "!=", "logi...
Removes an existing category from the database.
[ "Removes", "an", "existing", "category", "from", "the", "database", "." ]
[ "'''\n Removes an existing category from the database.\n '''" ]
[ { "param": "category_id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "category_id", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
showItems
<not_specific>
def showItems(category_id): ''' Shows all the items that belong to category matching category_id. ''' categoryToShow = session.query(Category).filter_by( id=category_id).one() categoryItems = session.query(Item).filter_by( category_id=category_id).order_by(asc(Item.name)) return ...
Shows all the items that belong to category matching category_id.
Shows all the items that belong to category matching category_id.
[ "Shows", "all", "the", "items", "that", "belong", "to", "category", "matching", "category_id", "." ]
def showItems(category_id): categoryToShow = session.query(Category).filter_by( id=category_id).one() categoryItems = session.query(Item).filter_by( category_id=category_id).order_by(asc(Item.name)) return render_template('showitems.html', category=categoryToShow, ...
[ "def", "showItems", "(", "category_id", ")", ":", "categoryToShow", "=", "session", ".", "query", "(", "Category", ")", ".", "filter_by", "(", "id", "=", "category_id", ")", ".", "one", "(", ")", "categoryItems", "=", "session", ".", "query", "(", "Item"...
Shows all the items that belong to category matching category_id.
[ "Shows", "all", "the", "items", "that", "belong", "to", "category", "matching", "category_id", "." ]
[ "'''\n Shows all the items that belong to category matching category_id.\n '''" ]
[ { "param": "category_id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "category_id", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
addItem
<not_specific>
def addItem(newItemCategory_id): ''' Adds an item to category matching newItemCategory_id. ''' category = session.query(Category).filter_by( id=newItemCategory_id).one() if login_session['user_id'] != category.user_id: flash("Only the owner of %s category may add an item to it." ...
Adds an item to category matching newItemCategory_id.
Adds an item to category matching newItemCategory_id.
[ "Adds", "an", "item", "to", "category", "matching", "newItemCategory_id", "." ]
def addItem(newItemCategory_id): category = session.query(Category).filter_by( id=newItemCategory_id).one() if login_session['user_id'] != category.user_id: flash("Only the owner of %s category may add an item to it." % category.name) return redirect(url_for('showItems', ca...
[ "def", "addItem", "(", "newItemCategory_id", ")", ":", "category", "=", "session", ".", "query", "(", "Category", ")", ".", "filter_by", "(", "id", "=", "newItemCategory_id", ")", ".", "one", "(", ")", "if", "login_session", "[", "'user_id'", "]", "!=", ...
Adds an item to category matching newItemCategory_id.
[ "Adds", "an", "item", "to", "category", "matching", "newItemCategory_id", "." ]
[ "'''\n Adds an item to category matching newItemCategory_id.\n '''" ]
[ { "param": "newItemCategory_id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "newItemCategory_id", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
editItem
<not_specific>
def editItem(category_id, item_id): ''' Edits item with matching item_id. ''' itemToEdit = session.query(Item).filter_by(id=item_id).one() belongsToCategory = session.query(Category).filter_by( id=itemToEdit.category_id).one() if login_session['user_id'] != itemToEdit.user_id: fl...
Edits item with matching item_id.
Edits item with matching item_id.
[ "Edits", "item", "with", "matching", "item_id", "." ]
def editItem(category_id, item_id): itemToEdit = session.query(Item).filter_by(id=item_id).one() belongsToCategory = session.query(Category).filter_by( id=itemToEdit.category_id).one() if login_session['user_id'] != itemToEdit.user_id: flash("Only the owner of %s category may edit this item....
[ "def", "editItem", "(", "category_id", ",", "item_id", ")", ":", "itemToEdit", "=", "session", ".", "query", "(", "Item", ")", ".", "filter_by", "(", "id", "=", "item_id", ")", ".", "one", "(", ")", "belongsToCategory", "=", "session", ".", "query", "(...
Edits item with matching item_id.
[ "Edits", "item", "with", "matching", "item_id", "." ]
[ "'''\n Edits item with matching item_id.\n '''" ]
[ { "param": "category_id", "type": null }, { "param": "item_id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "category_id", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "item_id", "type": null, "docstring": null, "docstring_...
786f2c9f99265fe7ee4ae10fa7a27cc6bb87b760
NeoCodesOracle/CatalogApp
catalogApp.py
[ "MIT", "Unlicense" ]
Python
deleteItem
<not_specific>
def deleteItem(category_id, item_id): ''' Removes item matching item_id from database. ''' itemToDelete = session.query(Item).filter_by(id=item_id).one() belongsToCategory = session.query(Category).filter_by( id=category_id).one() if login_session['user_id'] != itemToDelete.user_id: ...
Removes item matching item_id from database.
Removes item matching item_id from database.
[ "Removes", "item", "matching", "item_id", "from", "database", "." ]
def deleteItem(category_id, item_id): itemToDelete = session.query(Item).filter_by(id=item_id).one() belongsToCategory = session.query(Category).filter_by( id=category_id).one() if login_session['user_id'] != itemToDelete.user_id: flash("Only the owner of %s category may remove this item." ...
[ "def", "deleteItem", "(", "category_id", ",", "item_id", ")", ":", "itemToDelete", "=", "session", ".", "query", "(", "Item", ")", ".", "filter_by", "(", "id", "=", "item_id", ")", ".", "one", "(", ")", "belongsToCategory", "=", "session", ".", "query", ...
Removes item matching item_id from database.
[ "Removes", "item", "matching", "item_id", "from", "database", "." ]
[ "'''\n Removes item matching item_id from database.\n '''" ]
[ { "param": "category_id", "type": null }, { "param": "item_id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "category_id", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "item_id", "type": null, "docstring": null, "docstring_...
e937b24df77b6601afaa3f2153d54a130d0532ea
tmatsuo/python-texttospeech
google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc_asyncio.py
[ "Apache-2.0" ]
Python
create_channel
aio.Channel
def create_channel( cls, host: str = "texttospeech.googleapis.com", credentials: credentials.Credentials = None, scopes: Optional[Sequence[str]] = None, **kwargs ) -> aio.Channel: """Create and return a gRPC AsyncIO channel object. Args: address (O...
Create and return a gRPC AsyncIO channel object. Args: address (Optional[str]): The host for the channel to use. credentials (Optional[~.Credentials]): The authorization credentials to attach to requests. These credentials identify this application to the ...
Create and return a gRPC AsyncIO channel object.
[ "Create", "and", "return", "a", "gRPC", "AsyncIO", "channel", "object", "." ]
def create_channel( cls, host: str = "texttospeech.googleapis.com", credentials: credentials.Credentials = None, scopes: Optional[Sequence[str]] = None, **kwargs ) -> aio.Channel: scopes = scopes or cls.AUTH_SCOPES return grpc_helpers_async.create_channel( ...
[ "def", "create_channel", "(", "cls", ",", "host", ":", "str", "=", "\"texttospeech.googleapis.com\"", ",", "credentials", ":", "credentials", ".", "Credentials", "=", "None", ",", "scopes", ":", "Optional", "[", "Sequence", "[", "str", "]", "]", "=", "None",...
Create and return a gRPC AsyncIO channel object.
[ "Create", "and", "return", "a", "gRPC", "AsyncIO", "channel", "object", "." ]
[ "\"\"\"Create and return a gRPC AsyncIO channel object.\n Args:\n address (Optional[str]): The host for the channel to use.\n credentials (Optional[~.Credentials]): The\n authorization credentials to attach to requests. These\n credentials identify this app...
[ { "param": "cls", "type": null }, { "param": "host", "type": "str" }, { "param": "credentials", "type": "credentials.Credentials" }, { "param": "scopes", "type": "Optional[Sequence[str]]" } ]
{ "returns": [ { "docstring": "A gRPC AsyncIO channel object.", "docstring_tokens": [ "A", "gRPC", "AsyncIO", "channel", "object", "." ], "type": "aio.Channel" } ], "raises": [], "params": [ { "identifier": "cls", "t...
e937b24df77b6601afaa3f2153d54a130d0532ea
tmatsuo/python-texttospeech
google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc_asyncio.py
[ "Apache-2.0" ]
Python
grpc_channel
aio.Channel
def grpc_channel(self) -> aio.Channel: """Create the channel designed to connect to this service. This property caches on the instance; repeated calls return the same channel. """ # Sanity check: Only create a new channel if we do not already # have one. if not h...
Create the channel designed to connect to this service. This property caches on the instance; repeated calls return the same channel.
Create the channel designed to connect to this service. This property caches on the instance; repeated calls return the same channel.
[ "Create", "the", "channel", "designed", "to", "connect", "to", "this", "service", ".", "This", "property", "caches", "on", "the", "instance", ";", "repeated", "calls", "return", "the", "same", "channel", "." ]
def grpc_channel(self) -> aio.Channel: if not hasattr(self, "_grpc_channel"): self._grpc_channel = self.create_channel( self._host, credentials=self._credentials ) return self._grpc_channel
[ "def", "grpc_channel", "(", "self", ")", "->", "aio", ".", "Channel", ":", "if", "not", "hasattr", "(", "self", ",", "\"_grpc_channel\"", ")", ":", "self", ".", "_grpc_channel", "=", "self", ".", "create_channel", "(", "self", ".", "_host", ",", "credent...
Create the channel designed to connect to this service.
[ "Create", "the", "channel", "designed", "to", "connect", "to", "this", "service", "." ]
[ "\"\"\"Create the channel designed to connect to this service.\n\n This property caches on the instance; repeated calls return\n the same channel.\n \"\"\"", "# Sanity check: Only create a new channel if we do not already", "# have one.", "# Return the channel from cache." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e937b24df77b6601afaa3f2153d54a130d0532ea
tmatsuo/python-texttospeech
google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc_asyncio.py
[ "Apache-2.0" ]
Python
list_voices
Callable[ [cloud_tts.ListVoicesRequest], Awaitable[cloud_tts.ListVoicesResponse] ]
def list_voices( self ) -> Callable[ [cloud_tts.ListVoicesRequest], Awaitable[cloud_tts.ListVoicesResponse] ]: r"""Return a callable for the list voices method over gRPC. Returns a list of Voice supported for synthesis. Returns: Callable[[~.ListVoicesRequest...
r"""Return a callable for the list voices method over gRPC. Returns a list of Voice supported for synthesis. Returns: Callable[[~.ListVoicesRequest], Awaitable[~.ListVoicesResponse]]: A function that, when called, will call the underlying RPC ...
r"""Return a callable for the list voices method over gRPC. Returns a list of Voice supported for synthesis.
[ "r", "\"", "\"", "\"", "Return", "a", "callable", "for", "the", "list", "voices", "method", "over", "gRPC", ".", "Returns", "a", "list", "of", "Voice", "supported", "for", "synthesis", "." ]
def list_voices( self ) -> Callable[ [cloud_tts.ListVoicesRequest], Awaitable[cloud_tts.ListVoicesResponse] ]: if "list_voices" not in self._stubs: self._stubs["list_voices"] = self.grpc_channel.unary_unary( "/google.cloud.texttospeech.v1beta1.TextToSpeech/Lis...
[ "def", "list_voices", "(", "self", ")", "->", "Callable", "[", "[", "cloud_tts", ".", "ListVoicesRequest", "]", ",", "Awaitable", "[", "cloud_tts", ".", "ListVoicesResponse", "]", "]", ":", "if", "\"list_voices\"", "not", "in", "self", ".", "_stubs", ":", ...
r"""Return a callable for the list voices method over gRPC.
[ "r", "\"", "\"", "\"", "Return", "a", "callable", "for", "the", "list", "voices", "method", "over", "gRPC", "." ]
[ "r\"\"\"Return a callable for the list voices method over gRPC.\n\n Returns a list of Voice supported for synthesis.\n\n Returns:\n Callable[[~.ListVoicesRequest],\n Awaitable[~.ListVoicesResponse]]:\n A function that, when called, will call the underlying ...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "A function that, when called, will call the underlying RPC\non the server.", "docstring_tokens": [ "A", "function", "that", "when", "called", "will", "call", "the", "underlying", "RPC", ...
e937b24df77b6601afaa3f2153d54a130d0532ea
tmatsuo/python-texttospeech
google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc_asyncio.py
[ "Apache-2.0" ]
Python
synthesize_speech
Callable[ [cloud_tts.SynthesizeSpeechRequest], Awaitable[cloud_tts.SynthesizeSpeechResponse], ]
def synthesize_speech( self ) -> Callable[ [cloud_tts.SynthesizeSpeechRequest], Awaitable[cloud_tts.SynthesizeSpeechResponse], ]: r"""Return a callable for the synthesize speech method over gRPC. Synthesizes speech synchronously: receive results after all text in...
r"""Return a callable for the synthesize speech method over gRPC. Synthesizes speech synchronously: receive results after all text input has been processed. Returns: Callable[[~.SynthesizeSpeechRequest], Awaitable[~.SynthesizeSpeechResponse]]: A ...
r"""Return a callable for the synthesize speech method over gRPC. Synthesizes speech synchronously: receive results after all text input has been processed.
[ "r", "\"", "\"", "\"", "Return", "a", "callable", "for", "the", "synthesize", "speech", "method", "over", "gRPC", ".", "Synthesizes", "speech", "synchronously", ":", "receive", "results", "after", "all", "text", "input", "has", "been", "processed", "." ]
def synthesize_speech( self ) -> Callable[ [cloud_tts.SynthesizeSpeechRequest], Awaitable[cloud_tts.SynthesizeSpeechResponse], ]: if "synthesize_speech" not in self._stubs: self._stubs["synthesize_speech"] = self.grpc_channel.unary_unary( "/google.clou...
[ "def", "synthesize_speech", "(", "self", ")", "->", "Callable", "[", "[", "cloud_tts", ".", "SynthesizeSpeechRequest", "]", ",", "Awaitable", "[", "cloud_tts", ".", "SynthesizeSpeechResponse", "]", ",", "]", ":", "if", "\"synthesize_speech\"", "not", "in", "self...
r"""Return a callable for the synthesize speech method over gRPC.
[ "r", "\"", "\"", "\"", "Return", "a", "callable", "for", "the", "synthesize", "speech", "method", "over", "gRPC", "." ]
[ "r\"\"\"Return a callable for the synthesize speech method over gRPC.\n\n Synthesizes speech synchronously: receive results\n after all text input has been processed.\n\n Returns:\n Callable[[~.SynthesizeSpeechRequest],\n Awaitable[~.SynthesizeSpeechResponse]]:\n ...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "A function that, when called, will call the underlying RPC\non the server.", "docstring_tokens": [ "A", "function", "that", "when", "called", "will", "call", "the", "underlying", "RPC", ...
f885936bb76fde9c0988c049fe04207c6f41483e
tmatsuo/python-texttospeech
google/cloud/texttospeech_v1beta1/services/text_to_speech/client.py
[ "Apache-2.0" ]
Python
list_voices
cloud_tts.ListVoicesResponse
def list_voices( self, request: cloud_tts.ListVoicesRequest = None, *, language_code: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cloud_tts.ListVoicesResponse: r"""Re...
r"""Returns a list of Voice supported for synthesis. Args: request (:class:`~.cloud_tts.ListVoicesRequest`): The request object. The top-level message sent by the client for the `ListVoices` method. language_code (:class:`str`): Optional. ...
r"""Returns a list of Voice supported for synthesis.
[ "r", "\"", "\"", "\"", "Returns", "a", "list", "of", "Voice", "supported", "for", "synthesis", "." ]
def list_voices( self, request: cloud_tts.ListVoicesRequest = None, *, language_code: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cloud_tts.ListVoicesResponse: if req...
[ "def", "list_voices", "(", "self", ",", "request", ":", "cloud_tts", ".", "ListVoicesRequest", "=", "None", ",", "*", ",", "language_code", ":", "str", "=", "None", ",", "retry", ":", "retries", ".", "Retry", "=", "gapic_v1", ".", "method", ".", "DEFAULT...
r"""Returns a list of Voice supported for synthesis.
[ "r", "\"", "\"", "\"", "Returns", "a", "list", "of", "Voice", "supported", "for", "synthesis", "." ]
[ "r\"\"\"Returns a list of Voice supported for synthesis.\n\n Args:\n request (:class:`~.cloud_tts.ListVoicesRequest`):\n The request object. The top-level message sent by the\n client for the `ListVoices` method.\n language_code (:class:`str`):\n ...
[ { "param": "self", "type": null }, { "param": "request", "type": "cloud_tts.ListVoicesRequest" }, { "param": "language_code", "type": "str" }, { "param": "retry", "type": "retries.Retry" }, { "param": "timeout", "type": "float" }, { "param": "metadata"...
{ "returns": [ { "docstring": "The message returned to the client by the ``ListVoices``\nmethod.", "docstring_tokens": [ "The", "message", "returned", "to", "the", "client", "by", "the", "`", "`", "ListVoices", ...
f885936bb76fde9c0988c049fe04207c6f41483e
tmatsuo/python-texttospeech
google/cloud/texttospeech_v1beta1/services/text_to_speech/client.py
[ "Apache-2.0" ]
Python
synthesize_speech
cloud_tts.SynthesizeSpeechResponse
def synthesize_speech( self, request: cloud_tts.SynthesizeSpeechRequest = None, *, input: cloud_tts.SynthesisInput = None, voice: cloud_tts.VoiceSelectionParams = None, audio_config: cloud_tts.AudioConfig = None, retry: retries.Retry = gapic_v1.method.DEFAULT, ...
r"""Synthesizes speech synchronously: receive results after all text input has been processed. Args: request (:class:`~.cloud_tts.SynthesizeSpeechRequest`): The request object. The top-level message sent by the client for the `SynthesizeSpeech` method. ...
r"""Synthesizes speech synchronously: receive results after all text input has been processed.
[ "r", "\"", "\"", "\"", "Synthesizes", "speech", "synchronously", ":", "receive", "results", "after", "all", "text", "input", "has", "been", "processed", "." ]
def synthesize_speech( self, request: cloud_tts.SynthesizeSpeechRequest = None, *, input: cloud_tts.SynthesisInput = None, voice: cloud_tts.VoiceSelectionParams = None, audio_config: cloud_tts.AudioConfig = None, retry: retries.Retry = gapic_v1.method.DEFAULT, ...
[ "def", "synthesize_speech", "(", "self", ",", "request", ":", "cloud_tts", ".", "SynthesizeSpeechRequest", "=", "None", ",", "*", ",", "input", ":", "cloud_tts", ".", "SynthesisInput", "=", "None", ",", "voice", ":", "cloud_tts", ".", "VoiceSelectionParams", "...
r"""Synthesizes speech synchronously: receive results after all text input has been processed.
[ "r", "\"", "\"", "\"", "Synthesizes", "speech", "synchronously", ":", "receive", "results", "after", "all", "text", "input", "has", "been", "processed", "." ]
[ "r\"\"\"Synthesizes speech synchronously: receive results\n after all text input has been processed.\n\n Args:\n request (:class:`~.cloud_tts.SynthesizeSpeechRequest`):\n The request object. The top-level message sent by the\n client for the `SynthesizeSpeech` ...
[ { "param": "self", "type": null }, { "param": "request", "type": "cloud_tts.SynthesizeSpeechRequest" }, { "param": "input", "type": "cloud_tts.SynthesisInput" }, { "param": "voice", "type": "cloud_tts.VoiceSelectionParams" }, { "param": "audio_config", "type":...
{ "returns": [ { "docstring": "The message returned to the client by the\n``SynthesizeSpeech`` method.", "docstring_tokens": [ "The", "message", "returned", "to", "the", "client", "by", "the", "`", "`", "Synthesize...
a516fbb83bc1ce4cb9ac9fc61f065680c81c188e
tmatsuo/python-texttospeech
google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc.py
[ "Apache-2.0" ]
Python
create_channel
grpc.Channel
def create_channel( cls, host: str = "texttospeech.googleapis.com", credentials: credentials.Credentials = None, scopes: Optional[Sequence[str]] = None, **kwargs ) -> grpc.Channel: """Create and return a gRPC channel object. Args: address (Optionsl...
Create and return a gRPC channel object. Args: address (Optionsl[str]): The host for the channel to use. credentials (Optional[~.Credentials]): The authorization credentials to attach to requests. These credentials identify this application to the service....
Create and return a gRPC channel object.
[ "Create", "and", "return", "a", "gRPC", "channel", "object", "." ]
def create_channel( cls, host: str = "texttospeech.googleapis.com", credentials: credentials.Credentials = None, scopes: Optional[Sequence[str]] = None, **kwargs ) -> grpc.Channel: scopes = scopes or cls.AUTH_SCOPES return grpc_helpers.create_channel( ...
[ "def", "create_channel", "(", "cls", ",", "host", ":", "str", "=", "\"texttospeech.googleapis.com\"", ",", "credentials", ":", "credentials", ".", "Credentials", "=", "None", ",", "scopes", ":", "Optional", "[", "Sequence", "[", "str", "]", "]", "=", "None",...
Create and return a gRPC channel object.
[ "Create", "and", "return", "a", "gRPC", "channel", "object", "." ]
[ "\"\"\"Create and return a gRPC channel object.\n Args:\n address (Optionsl[str]): The host for the channel to use.\n credentials (Optional[~.Credentials]): The\n authorization credentials to attach to requests. These\n credentials identify this application...
[ { "param": "cls", "type": null }, { "param": "host", "type": "str" }, { "param": "credentials", "type": "credentials.Credentials" }, { "param": "scopes", "type": "Optional[Sequence[str]]" } ]
{ "returns": [ { "docstring": "A gRPC channel object.", "docstring_tokens": [ "A", "gRPC", "channel", "object", "." ], "type": "grpc.Channel" } ], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstri...
a1658b0a0254b2fb2897ad327fbe2d057de8a8f4
alexjavier15/-spark-project
python/pyspark/ml/pipeline.py
[ "BSD-3-Clause-Open-MPI", "PSF-2.0", "Apache-2.0", "BSD-2-Clause", "MIT", "MIT-0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause-Clear", "BSD-3-Clause" ]
Python
_stages_java2py
<not_specific>
def _stages_java2py(java_stages): """ Transforms the parameter Python stages from a list of Java stages. :param java_stages: An array of Java stages. :return: An array of Python stages. """ return [JavaWrapper._transfer_stage_from_java(stage) for stage in java_stages]
Transforms the parameter Python stages from a list of Java stages. :param java_stages: An array of Java stages. :return: An array of Python stages.
Transforms the parameter Python stages from a list of Java stages.
[ "Transforms", "the", "parameter", "Python", "stages", "from", "a", "list", "of", "Java", "stages", "." ]
def _stages_java2py(java_stages): return [JavaWrapper._transfer_stage_from_java(stage) for stage in java_stages]
[ "def", "_stages_java2py", "(", "java_stages", ")", ":", "return", "[", "JavaWrapper", ".", "_transfer_stage_from_java", "(", "stage", ")", "for", "stage", "in", "java_stages", "]" ]
Transforms the parameter Python stages from a list of Java stages.
[ "Transforms", "the", "parameter", "Python", "stages", "from", "a", "list", "of", "Java", "stages", "." ]
[ "\"\"\"\n Transforms the parameter Python stages from a list of Java stages.\n :param java_stages: An array of Java stages.\n :return: An array of Python stages.\n \"\"\"" ]
[ { "param": "java_stages", "type": null } ]
{ "returns": [ { "docstring": "An array of Python stages.", "docstring_tokens": [ "An", "array", "of", "Python", "stages", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "java_stages", "type": nul...
a1658b0a0254b2fb2897ad327fbe2d057de8a8f4
alexjavier15/-spark-project
python/pyspark/ml/pipeline.py
[ "BSD-3-Clause-Open-MPI", "PSF-2.0", "Apache-2.0", "BSD-2-Clause", "MIT", "MIT-0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause-Clear", "BSD-3-Clause" ]
Python
_stages_py2java
<not_specific>
def _stages_py2java(py_stages, cls): """ Transforms the parameter of Python stages to a Java array of Java stages. :param py_stages: An array of Python stages. :return: A Java array of Java Stages. """ for stage in py_stages: assert(isinstance(stage, JavaWrapper), "Python...
Transforms the parameter of Python stages to a Java array of Java stages. :param py_stages: An array of Python stages. :return: A Java array of Java Stages.
Transforms the parameter of Python stages to a Java array of Java stages.
[ "Transforms", "the", "parameter", "of", "Python", "stages", "to", "a", "Java", "array", "of", "Java", "stages", "." ]
def _stages_py2java(py_stages, cls): for stage in py_stages: assert(isinstance(stage, JavaWrapper), "Python side implementation is not supported in the meta-PipelineStage currently.") gateway = SparkContext._gateway java_stages = gateway.new_array(cls, len(py_stages)) for idx, sta...
[ "def", "_stages_py2java", "(", "py_stages", ",", "cls", ")", ":", "for", "stage", "in", "py_stages", ":", "assert", "(", "isinstance", "(", "stage", ",", "JavaWrapper", ")", ",", "\"Python side implementation is not supported in the meta-PipelineStage currently.\"", ")"...
Transforms the parameter of Python stages to a Java array of Java stages.
[ "Transforms", "the", "parameter", "of", "Python", "stages", "to", "a", "Java", "array", "of", "Java", "stages", "." ]
[ "\"\"\"\n Transforms the parameter of Python stages to a Java array of Java stages.\n :param py_stages: An array of Python stages.\n :return: A Java array of Java Stages.\n \"\"\"" ]
[ { "param": "py_stages", "type": null }, { "param": "cls", "type": null } ]
{ "returns": [ { "docstring": "A Java array of Java Stages.", "docstring_tokens": [ "A", "Java", "array", "of", "Java", "Stages", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "py_stages", ...
a1658b0a0254b2fb2897ad327fbe2d057de8a8f4
alexjavier15/-spark-project
python/pyspark/ml/pipeline.py
[ "BSD-3-Clause-Open-MPI", "PSF-2.0", "Apache-2.0", "BSD-2-Clause", "MIT", "MIT-0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause-Clear", "BSD-3-Clause" ]
Python
load
<not_specific>
def load(self, path): """Load the Pipeline instance from the input path.""" if not isinstance(path, basestring): raise TypeError("path should be a basestring, got type %s" % type(path)) java_obj = self._jread.load(path) instance = self._clazz() instance._resetUid(jav...
Load the Pipeline instance from the input path.
Load the Pipeline instance from the input path.
[ "Load", "the", "Pipeline", "instance", "from", "the", "input", "path", "." ]
def load(self, path): if not isinstance(path, basestring): raise TypeError("path should be a basestring, got type %s" % type(path)) java_obj = self._jread.load(path) instance = self._clazz() instance._resetUid(java_obj.uid()) instance.setStages(_stages_java2py(java_ob...
[ "def", "load", "(", "self", ",", "path", ")", ":", "if", "not", "isinstance", "(", "path", ",", "basestring", ")", ":", "raise", "TypeError", "(", "\"path should be a basestring, got type %s\"", "%", "type", "(", "path", ")", ")", "java_obj", "=", "self", ...
Load the Pipeline instance from the input path.
[ "Load", "the", "Pipeline", "instance", "from", "the", "input", "path", "." ]
[ "\"\"\"Load the Pipeline instance from the input path.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "path", "type": null, "docstring": null, "docstring_tokens": [...
a1658b0a0254b2fb2897ad327fbe2d057de8a8f4
alexjavier15/-spark-project
python/pyspark/ml/pipeline.py
[ "BSD-3-Clause-Open-MPI", "PSF-2.0", "Apache-2.0", "BSD-2-Clause", "MIT", "MIT-0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause-Clear", "BSD-3-Clause" ]
Python
load
<not_specific>
def load(self, path): """Load the PipelineModel instance from the input path.""" if not isinstance(path, basestring): raise TypeError("path should be a basestring, got type %s" % type(path)) java_obj = self._jread.load(path) instance = self._clazz(_stages_java2py(java_obj.sta...
Load the PipelineModel instance from the input path.
Load the PipelineModel instance from the input path.
[ "Load", "the", "PipelineModel", "instance", "from", "the", "input", "path", "." ]
def load(self, path): if not isinstance(path, basestring): raise TypeError("path should be a basestring, got type %s" % type(path)) java_obj = self._jread.load(path) instance = self._clazz(_stages_java2py(java_obj.stages())) instance._resetUid(java_obj.uid()) return i...
[ "def", "load", "(", "self", ",", "path", ")", ":", "if", "not", "isinstance", "(", "path", ",", "basestring", ")", ":", "raise", "TypeError", "(", "\"path should be a basestring, got type %s\"", "%", "type", "(", "path", ")", ")", "java_obj", "=", "self", ...
Load the PipelineModel instance from the input path.
[ "Load", "the", "PipelineModel", "instance", "from", "the", "input", "path", "." ]
[ "\"\"\"Load the PipelineModel instance from the input path.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "path", "type": null, "docstring": null, "docstring_tokens": [...
896a9f8a5862db798fd6bec32ad8d62d7c56fac8
editid0/python-sense-hat
sense_hat/stick.py
[ "BSD-3-Clause" ]
Python
_stick_device
<not_specific>
def _stick_device(self): """ Discovers the filename of the evdev device that represents the Sense HAT's joystick. """ for evdev in glob.glob('/sys/class/input/event*'): try: with io.open(os.path.join(evdev, 'device', 'name'), 'r') as f: ...
Discovers the filename of the evdev device that represents the Sense HAT's joystick.
Discovers the filename of the evdev device that represents the Sense HAT's joystick.
[ "Discovers", "the", "filename", "of", "the", "evdev", "device", "that", "represents", "the", "Sense", "HAT", "'", "s", "joystick", "." ]
def _stick_device(self): for evdev in glob.glob('/sys/class/input/event*'): try: with io.open(os.path.join(evdev, 'device', 'name'), 'r') as f: if f.read().strip() == self.SENSE_HAT_EVDEV_NAME: return os.path.join('/dev', 'input', os.path.b...
[ "def", "_stick_device", "(", "self", ")", ":", "for", "evdev", "in", "glob", ".", "glob", "(", "'/sys/class/input/event*'", ")", ":", "try", ":", "with", "io", ".", "open", "(", "os", ".", "path", ".", "join", "(", "evdev", ",", "'device'", ",", "'na...
Discovers the filename of the evdev device that represents the Sense HAT's joystick.
[ "Discovers", "the", "filename", "of", "the", "evdev", "device", "that", "represents", "the", "Sense", "HAT", "'", "s", "joystick", "." ]
[ "\"\"\"\n Discovers the filename of the evdev device that represents the Sense\n HAT's joystick.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
896a9f8a5862db798fd6bec32ad8d62d7c56fac8
editid0/python-sense-hat
sense_hat/stick.py
[ "BSD-3-Clause" ]
Python
_read
<not_specific>
def _read(self): """ Reads a single event from the joystick, blocking until one is available. Returns `None` if a non-key event was read, or an `InputEvent` tuple describing the event otherwise. """ event = self._stick_file.read(self.EVENT_SIZE) (tv_sec, tv_usec, ...
Reads a single event from the joystick, blocking until one is available. Returns `None` if a non-key event was read, or an `InputEvent` tuple describing the event otherwise.
Reads a single event from the joystick, blocking until one is available. Returns `None` if a non-key event was read, or an `InputEvent` tuple describing the event otherwise.
[ "Reads", "a", "single", "event", "from", "the", "joystick", "blocking", "until", "one", "is", "available", ".", "Returns", "`", "None", "`", "if", "a", "non", "-", "key", "event", "was", "read", "or", "an", "`", "InputEvent", "`", "tuple", "describing", ...
def _read(self): event = self._stick_file.read(self.EVENT_SIZE) (tv_sec, tv_usec, type, code, value) = struct.unpack(self.EVENT_FORMAT, event) if type == self.EV_KEY: return InputEvent( timestamp=tv_sec + (tv_usec / 1000000), direction={ ...
[ "def", "_read", "(", "self", ")", ":", "event", "=", "self", ".", "_stick_file", ".", "read", "(", "self", ".", "EVENT_SIZE", ")", "(", "tv_sec", ",", "tv_usec", ",", "type", ",", "code", ",", "value", ")", "=", "struct", ".", "unpack", "(", "self"...
Reads a single event from the joystick, blocking until one is available.
[ "Reads", "a", "single", "event", "from", "the", "joystick", "blocking", "until", "one", "is", "available", "." ]
[ "\"\"\"\n Reads a single event from the joystick, blocking until one is\n available. Returns `None` if a non-key event was read, or an\n `InputEvent` tuple describing the event otherwise.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
896a9f8a5862db798fd6bec32ad8d62d7c56fac8
editid0/python-sense-hat
sense_hat/stick.py
[ "BSD-3-Clause" ]
Python
_wait
<not_specific>
def _wait(self, timeout=None): """ Waits *timeout* seconds until an event is available from the joystick. Returns `True` if an event became available, and `False` if the timeout expired. """ r, w, x = select.select([self._stick_file], [], [], timeout) return bool(...
Waits *timeout* seconds until an event is available from the joystick. Returns `True` if an event became available, and `False` if the timeout expired.
Waits *timeout* seconds until an event is available from the joystick. Returns `True` if an event became available, and `False` if the timeout expired.
[ "Waits", "*", "timeout", "*", "seconds", "until", "an", "event", "is", "available", "from", "the", "joystick", ".", "Returns", "`", "True", "`", "if", "an", "event", "became", "available", "and", "`", "False", "`", "if", "the", "timeout", "expired", "." ...
def _wait(self, timeout=None): r, w, x = select.select([self._stick_file], [], [], timeout) return bool(r)
[ "def", "_wait", "(", "self", ",", "timeout", "=", "None", ")", ":", "r", ",", "w", ",", "x", "=", "select", ".", "select", "(", "[", "self", ".", "_stick_file", "]", ",", "[", "]", ",", "[", "]", ",", "timeout", ")", "return", "bool", "(", "r...
Waits *timeout* seconds until an event is available from the joystick.
[ "Waits", "*", "timeout", "*", "seconds", "until", "an", "event", "is", "available", "from", "the", "joystick", "." ]
[ "\"\"\"\n Waits *timeout* seconds until an event is available from the\n joystick. Returns `True` if an event became available, and `False`\n if the timeout expired.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "timeout", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "timeout", "type": null, "docstring": null, "docstring_tokens"...
896a9f8a5862db798fd6bec32ad8d62d7c56fac8
editid0/python-sense-hat
sense_hat/stick.py
[ "BSD-3-Clause" ]
Python
direction_up
<not_specific>
def direction_up(self): """ The function to be called when the joystick is pushed up. The function can either take a parameter which will be the `InputEvent` tuple that has occurred, or the function can take no parameters at all. """ return self._callbacks.get(DIRECTION_U...
The function to be called when the joystick is pushed up. The function can either take a parameter which will be the `InputEvent` tuple that has occurred, or the function can take no parameters at all.
The function to be called when the joystick is pushed up. The function can either take a parameter which will be the `InputEvent` tuple that has occurred, or the function can take no parameters at all.
[ "The", "function", "to", "be", "called", "when", "the", "joystick", "is", "pushed", "up", ".", "The", "function", "can", "either", "take", "a", "parameter", "which", "will", "be", "the", "`", "InputEvent", "`", "tuple", "that", "has", "occurred", "or", "...
def direction_up(self): return self._callbacks.get(DIRECTION_UP)
[ "def", "direction_up", "(", "self", ")", ":", "return", "self", ".", "_callbacks", ".", "get", "(", "DIRECTION_UP", ")" ]
The function to be called when the joystick is pushed up.
[ "The", "function", "to", "be", "called", "when", "the", "joystick", "is", "pushed", "up", "." ]
[ "\"\"\"\n The function to be called when the joystick is pushed up. The function\n can either take a parameter which will be the `InputEvent` tuple that\n has occurred, or the function can take no parameters at all.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
896a9f8a5862db798fd6bec32ad8d62d7c56fac8
editid0/python-sense-hat
sense_hat/stick.py
[ "BSD-3-Clause" ]
Python
direction_down
<not_specific>
def direction_down(self): """ The function to be called when the joystick is pushed down. The function can either take a parameter which will be the `InputEvent` tuple that has occurred, or the function can take no parameters at all. Assign `None` to prevent this event from bein...
The function to be called when the joystick is pushed down. The function can either take a parameter which will be the `InputEvent` tuple that has occurred, or the function can take no parameters at all. Assign `None` to prevent this event from being fired.
The function to be called when the joystick is pushed down. The function can either take a parameter which will be the `InputEvent` tuple that has occurred, or the function can take no parameters at all. Assign `None` to prevent this event from being fired.
[ "The", "function", "to", "be", "called", "when", "the", "joystick", "is", "pushed", "down", ".", "The", "function", "can", "either", "take", "a", "parameter", "which", "will", "be", "the", "`", "InputEvent", "`", "tuple", "that", "has", "occurred", "or", ...
def direction_down(self): return self._callbacks.get(DIRECTION_DOWN)
[ "def", "direction_down", "(", "self", ")", ":", "return", "self", ".", "_callbacks", ".", "get", "(", "DIRECTION_DOWN", ")" ]
The function to be called when the joystick is pushed down.
[ "The", "function", "to", "be", "called", "when", "the", "joystick", "is", "pushed", "down", "." ]
[ "\"\"\"\n The function to be called when the joystick is pushed down. The\n function can either take a parameter which will be the `InputEvent`\n tuple that has occurred, or the function can take no parameters at all.\n\n Assign `None` to prevent this event from being fired.\n \"\...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
896a9f8a5862db798fd6bec32ad8d62d7c56fac8
editid0/python-sense-hat
sense_hat/stick.py
[ "BSD-3-Clause" ]
Python
direction_left
<not_specific>
def direction_left(self): """ The function to be called when the joystick is pushed left. The function can either take a parameter which will be the `InputEvent` tuple that has occurred, or the function can take no parameters at all. Assign `None` to prevent this event from bein...
The function to be called when the joystick is pushed left. The function can either take a parameter which will be the `InputEvent` tuple that has occurred, or the function can take no parameters at all. Assign `None` to prevent this event from being fired.
The function to be called when the joystick is pushed left. The function can either take a parameter which will be the `InputEvent` tuple that has occurred, or the function can take no parameters at all. Assign `None` to prevent this event from being fired.
[ "The", "function", "to", "be", "called", "when", "the", "joystick", "is", "pushed", "left", ".", "The", "function", "can", "either", "take", "a", "parameter", "which", "will", "be", "the", "`", "InputEvent", "`", "tuple", "that", "has", "occurred", "or", ...
def direction_left(self): return self._callbacks.get(DIRECTION_LEFT)
[ "def", "direction_left", "(", "self", ")", ":", "return", "self", ".", "_callbacks", ".", "get", "(", "DIRECTION_LEFT", ")" ]
The function to be called when the joystick is pushed left.
[ "The", "function", "to", "be", "called", "when", "the", "joystick", "is", "pushed", "left", "." ]
[ "\"\"\"\n The function to be called when the joystick is pushed left. The\n function can either take a parameter which will be the `InputEvent`\n tuple that has occurred, or the function can take no parameters at all.\n\n Assign `None` to prevent this event from being fired.\n \"\...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
896a9f8a5862db798fd6bec32ad8d62d7c56fac8
editid0/python-sense-hat
sense_hat/stick.py
[ "BSD-3-Clause" ]
Python
direction_right
<not_specific>
def direction_right(self): """ The function to be called when the joystick is pushed right. The function can either take a parameter which will be the `InputEvent` tuple that has occurred, or the function can take no parameters at all. Assign `None` to prevent this event from be...
The function to be called when the joystick is pushed right. The function can either take a parameter which will be the `InputEvent` tuple that has occurred, or the function can take no parameters at all. Assign `None` to prevent this event from being fired.
The function to be called when the joystick is pushed right. The function can either take a parameter which will be the `InputEvent` tuple that has occurred, or the function can take no parameters at all. Assign `None` to prevent this event from being fired.
[ "The", "function", "to", "be", "called", "when", "the", "joystick", "is", "pushed", "right", ".", "The", "function", "can", "either", "take", "a", "parameter", "which", "will", "be", "the", "`", "InputEvent", "`", "tuple", "that", "has", "occurred", "or", ...
def direction_right(self): return self._callbacks.get(DIRECTION_RIGHT)
[ "def", "direction_right", "(", "self", ")", ":", "return", "self", ".", "_callbacks", ".", "get", "(", "DIRECTION_RIGHT", ")" ]
The function to be called when the joystick is pushed right.
[ "The", "function", "to", "be", "called", "when", "the", "joystick", "is", "pushed", "right", "." ]
[ "\"\"\"\n The function to be called when the joystick is pushed right. The\n function can either take a parameter which will be the `InputEvent`\n tuple that has occurred, or the function can take no parameters at all.\n\n Assign `None` to prevent this event from being fired.\n \"...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
896a9f8a5862db798fd6bec32ad8d62d7c56fac8
editid0/python-sense-hat
sense_hat/stick.py
[ "BSD-3-Clause" ]
Python
direction_middle
<not_specific>
def direction_middle(self): """ The function to be called when the joystick middle click is pressed. The function can either take a parameter which will be the `InputEvent` tuple that has occurred, or the function can take no parameters at all. Assign `None` to prevent this even...
The function to be called when the joystick middle click is pressed. The function can either take a parameter which will be the `InputEvent` tuple that has occurred, or the function can take no parameters at all. Assign `None` to prevent this event from being fired.
The function to be called when the joystick middle click is pressed. The function can either take a parameter which will be the `InputEvent` tuple that has occurred, or the function can take no parameters at all. Assign `None` to prevent this event from being fired.
[ "The", "function", "to", "be", "called", "when", "the", "joystick", "middle", "click", "is", "pressed", ".", "The", "function", "can", "either", "take", "a", "parameter", "which", "will", "be", "the", "`", "InputEvent", "`", "tuple", "that", "has", "occurr...
def direction_middle(self): return self._callbacks.get(DIRECTION_MIDDLE)
[ "def", "direction_middle", "(", "self", ")", ":", "return", "self", ".", "_callbacks", ".", "get", "(", "DIRECTION_MIDDLE", ")" ]
The function to be called when the joystick middle click is pressed.
[ "The", "function", "to", "be", "called", "when", "the", "joystick", "middle", "click", "is", "pressed", "." ]
[ "\"\"\"\n The function to be called when the joystick middle click is pressed. The\n function can either take a parameter which will be the `InputEvent` tuple\n that has occurred, or the function can take no parameters at all.\n\n Assign `None` to prevent this event from being fired.\n ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1bd294296c2889e99f03564ed639077560910392
prakashsellathurai/fashion-Image-Recommender
server/middlewares/auth.py
[ "MIT" ]
Python
admin_auth_required
<not_specific>
def admin_auth_required(f): """ A decorator for view functions that require authentication. If signed in, pass the request to the decorated view function with authentication context; otherwise redirect the request. Parameters: f (func): The view function to decorate. Output: deco...
A decorator for view functions that require authentication. If signed in, pass the request to the decorated view function with authentication context; otherwise redirect the request. Parameters: f (func): The view function to decorate. Output: decorated (func): The decorated functio...
A decorator for view functions that require authentication. If signed in, pass the request to the decorated view function with authentication context; otherwise redirect the request.
[ "A", "decorator", "for", "view", "functions", "that", "require", "authentication", ".", "If", "signed", "in", "pass", "the", "request", "to", "the", "decorated", "view", "function", "with", "authentication", "context", ";", "otherwise", "redirect", "the", "reque...
def admin_auth_required(f): @wraps(f) def decorated(*args, **kwargs): firebase_id_token = request.cookies.get('firebase_id_token') if not firebase_id_token: return redirect(url_for('admin_login.display')) auth_context = verify_firebase_id_token(firebase_id_token) if n...
[ "def", "admin_auth_required", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "decorated", "(", "*", "args", ",", "**", "kwargs", ")", ":", "firebase_id_token", "=", "request", ".", "cookies", ".", "get", "(", "'firebase_id_token'", ")", "if", ...
A decorator for view functions that require authentication.
[ "A", "decorator", "for", "view", "functions", "that", "require", "authentication", "." ]
[ "\"\"\"\n A decorator for view functions that require authentication.\n If signed in, pass the request to the decorated view function with\n authentication context; otherwise redirect the request.\n\n Parameters:\n f (func): The view function to decorate.\n\n Output:\n decorated (func): T...
[ { "param": "f", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "f", "type": null, "docstring": "The view function to decorate.", "docstring_tokens": [ "The", "view", "function", "to", "decorate", "." ], "default": null, "is_...
1bd294296c2889e99f03564ed639077560910392
prakashsellathurai/fashion-Image-Recommender
server/middlewares/auth.py
[ "MIT" ]
Python
admin_auth_optional
<not_specific>
def admin_auth_optional(f): """ A decorator for view functions where authentication is optional. If signed in, pass the request to the decorated view function with authentication context. Parameters: f (func): The view function to decorate. Output: decorated (func): The decorated...
A decorator for view functions where authentication is optional. If signed in, pass the request to the decorated view function with authentication context. Parameters: f (func): The view function to decorate. Output: decorated (func): The decorated function.
A decorator for view functions where authentication is optional. If signed in, pass the request to the decorated view function with authentication context.
[ "A", "decorator", "for", "view", "functions", "where", "authentication", "is", "optional", ".", "If", "signed", "in", "pass", "the", "request", "to", "the", "decorated", "view", "function", "with", "authentication", "context", "." ]
def admin_auth_optional(f): @wraps(f) def decorated(*args, **kwargs): firebase_id_token = request.cookies.get('firebase_id_token') if not firebase_id_token: return f(auth_context=None, *args, **kwargs) auth_context = verify_firebase_id_token(firebase_id_token) if not ...
[ "def", "admin_auth_optional", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "decorated", "(", "*", "args", ",", "**", "kwargs", ")", ":", "firebase_id_token", "=", "request", ".", "cookies", ".", "get", "(", "'firebase_id_token'", ")", "if", ...
A decorator for view functions where authentication is optional.
[ "A", "decorator", "for", "view", "functions", "where", "authentication", "is", "optional", "." ]
[ "\"\"\"\n A decorator for view functions where authentication is optional.\n If signed in, pass the request to the decorated view function with\n authentication context.\n\n Parameters:\n f (func): The view function to decorate.\n\n Output:\n decorated (func): The decorated function.\n ...
[ { "param": "f", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "f", "type": null, "docstring": "The view function to decorate.", "docstring_tokens": [ "The", "view", "function", "to", "decorate", "." ], "default": null, "is_...
7718c1646412dd7d5607900d39d54ffe5ed1cd2d
prakashsellathurai/fashion-Image-Recommender
app-engine-function/main.py
[ "MIT" ]
Python
upload_blob
null
def upload_blob(bucket_name, src_file, dst_file_name): """Upload a file to the bucket""" storage_client = storage.Client() bucket = storage_client.get_bucket(bucket_name) blob = bucket.blob('uploads/'+dst_file_name) blob.upload_from_string(src_file, content_type='image/jpg') print('File upload...
Upload a file to the bucket
Upload a file to the bucket
[ "Upload", "a", "file", "to", "the", "bucket" ]
def upload_blob(bucket_name, src_file, dst_file_name): storage_client = storage.Client() bucket = storage_client.get_bucket(bucket_name) blob = bucket.blob('uploads/'+dst_file_name) blob.upload_from_string(src_file, content_type='image/jpg') print('File uploaded to uploads/{}.'.format(dst_file_name)...
[ "def", "upload_blob", "(", "bucket_name", ",", "src_file", ",", "dst_file_name", ")", ":", "storage_client", "=", "storage", ".", "Client", "(", ")", "bucket", "=", "storage_client", ".", "get_bucket", "(", "bucket_name", ")", "blob", "=", "bucket", ".", "bl...
Upload a file to the bucket
[ "Upload", "a", "file", "to", "the", "bucket" ]
[ "\"\"\"Upload a file to the bucket\"\"\"" ]
[ { "param": "bucket_name", "type": null }, { "param": "src_file", "type": null }, { "param": "dst_file_name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bucket_name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "src_file", "type": null, "docstring": null, "docstring...
3d1bd3b43106c962ffc09575be50da2939b95931
prakashsellathurai/fashion-Image-Recommender
server/middlewares/form_validation.py
[ "MIT" ]
Python
upload_form_validation_required
<not_specific>
def upload_form_validation_required(f): """ A decorator for validating requests with the upload form. Returns an error message if validation fails. Parameters: f (func): The view function to decorate. Output: decorated (func): The decorated function. """ @wraps(f) def dec...
A decorator for validating requests with the upload form. Returns an error message if validation fails. Parameters: f (func): The view function to decorate. Output: decorated (func): The decorated function.
A decorator for validating requests with the upload form. Returns an error message if validation fails.
[ "A", "decorator", "for", "validating", "requests", "with", "the", "upload", "form", ".", "Returns", "an", "error", "message", "if", "validation", "fails", "." ]
def upload_form_validation_required(f): @wraps(f) def decorated(*args, **kwargs): upload_form = UploadForm() if not upload_form.validate(): return 'Something does not look right. Check your input and try again.', 400 return f(form=upload_form, *args, **kwargs) return deco...
[ "def", "upload_form_validation_required", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "decorated", "(", "*", "args", ",", "**", "kwargs", ")", ":", "upload_form", "=", "UploadForm", "(", ")", "if", "not", "upload_form", ".", "validate", "(", ...
A decorator for validating requests with the upload form.
[ "A", "decorator", "for", "validating", "requests", "with", "the", "upload", "form", "." ]
[ "\"\"\"\n A decorator for validating requests with the upload form.\n Returns an error message if validation fails.\n\n Parameters:\n f (func): The view function to decorate.\n\n Output:\n decorated (func): The decorated function.\n \"\"\"" ]
[ { "param": "f", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "f", "type": null, "docstring": "The view function to decorate.", "docstring_tokens": [ "The", "view", "function", "to", "decorate", "." ], "default": null, "is_...
fde2c02b10c4570f5f9bd2824e84dcf1cc910cd5
prakashsellathurai/fashion-Image-Recommender
server/blueprints/home/blueprint.py
[ "MIT" ]
Python
display
<not_specific>
def display(): """ View function for displaying the home page. Output: Rendered HTML page. """ # products = product_catalog.list_products() return render_template('home.html')
View function for displaying the home page. Output: Rendered HTML page.
View function for displaying the home page. Output: Rendered HTML page.
[ "View", "function", "for", "displaying", "the", "home", "page", ".", "Output", ":", "Rendered", "HTML", "page", "." ]
def display(): return render_template('home.html')
[ "def", "display", "(", ")", ":", "return", "render_template", "(", "'home.html'", ")" ]
View function for displaying the home page.
[ "View", "function", "for", "displaying", "the", "home", "page", "." ]
[ "\"\"\"\n View function for displaying the home page.\n\n Output:\n Rendered HTML page.\n \"\"\"", "# products = product_catalog.list_products()" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a5e65805d7a38f50fcd36bad7c1b0ece19eda0cd
prakashsellathurai/fashion-Image-Recommender
server/models/product_catalog/data_classes.py
[ "MIT" ]
Python
deserialize
<not_specific>
def deserialize(document): """ Helper function for parsing a Firestore document to a Product object. Parameters: document (DocumentSnapshot): A snapshot of Firestore document. Output: A Product object. """ data = document.to_dict() if dat...
Helper function for parsing a Firestore document to a Product object. Parameters: document (DocumentSnapshot): A snapshot of Firestore document. Output: A Product object.
Helper function for parsing a Firestore document to a Product object.
[ "Helper", "function", "for", "parsing", "a", "Firestore", "document", "to", "a", "Product", "object", "." ]
def deserialize(document): data = document.to_dict() if data: return Product( id=document.id, asin=data.get('asin'), title=data.get('title'), category=data.get('category'), brand=data.get('brand'), ...
[ "def", "deserialize", "(", "document", ")", ":", "data", "=", "document", ".", "to_dict", "(", ")", "if", "data", ":", "return", "Product", "(", "id", "=", "document", ".", "id", ",", "asin", "=", "data", ".", "get", "(", "'asin'", ")", ",", "title...
Helper function for parsing a Firestore document to a Product object.
[ "Helper", "function", "for", "parsing", "a", "Firestore", "document", "to", "a", "Product", "object", "." ]
[ "\"\"\"\n Helper function for parsing a Firestore document to a Product object.\n\n Parameters:\n document (DocumentSnapshot): A snapshot of Firestore document.\n\n Output:\n A Product object.\n \"\"\"" ]
[ { "param": "document", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "document", "type": null, "docstring": "A snapshot of Firestore document.", "docstring_tokens": [ "A", "snapshot", "of", "Firestore", "document", "." ], "default": nul...
16674f61914cc5c0511a8ce951947ad7b0a23523
prakashsellathurai/fashion-Image-Recommender
server/blueprints/admin_home/blueprint.py
[ "MIT" ]
Python
display
<not_specific>
def display(auth_context): """ View function for displaying the admin home page. Parameters: auth_context (dict): The authentication context of request. See middlewares/auth.py for more information. Output: Rendered HTML page. """ print(auth_context) ...
View function for displaying the admin home page. Parameters: auth_context (dict): The authentication context of request. See middlewares/auth.py for more information. Output: Rendered HTML page.
View function for displaying the admin home page.
[ "View", "function", "for", "displaying", "the", "admin", "home", "page", "." ]
def display(auth_context): print(auth_context) return render_template('admin/home.html', auth_context=auth_context)
[ "def", "display", "(", "auth_context", ")", ":", "print", "(", "auth_context", ")", "return", "render_template", "(", "'admin/home.html'", ",", "auth_context", "=", "auth_context", ")" ]
View function for displaying the admin home page.
[ "View", "function", "for", "displaying", "the", "admin", "home", "page", "." ]
[ "\"\"\"\n View function for displaying the admin home page.\n\n Parameters:\n auth_context (dict): The authentication context of request.\n See middlewares/auth.py for more information.\n Output:\n Rendered HTML page.\n \"\"\"" ]
[ { "param": "auth_context", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "auth_context", "type": null, "docstring": "The authentication context of request.\nSee middlewares/auth.py for more information.", "docstring_tokens": [ "The", "authentication", "context", "of",...
66369d78e6db32fa7aa3c14705c5a9a88164acfe
prakashsellathurai/fashion-Image-Recommender
server/models/user_requests/data_classes.py
[ "MIT" ]
Python
deserialize
<not_specific>
def deserialize(document): """ Helper function for parsing a Firestore document to a Product object. Parameters: document (DocumentSnapshot): A snapshot of Firestore document. Output: A Product object. """ data = document.to_dict() if dat...
Helper function for parsing a Firestore document to a Product object. Parameters: document (DocumentSnapshot): A snapshot of Firestore document. Output: A Product object.
Helper function for parsing a Firestore document to a Product object.
[ "Helper", "function", "for", "parsing", "a", "Firestore", "document", "to", "a", "Product", "object", "." ]
def deserialize(document): data = document.to_dict() if data: return Product( id=document.id, top_k=data.get('top_k'), predicted_label=data.get('predicted_label'), prediction_probs=data.get('prediction_probs'), u...
[ "def", "deserialize", "(", "document", ")", ":", "data", "=", "document", ".", "to_dict", "(", ")", "if", "data", ":", "return", "Product", "(", "id", "=", "document", ".", "id", ",", "top_k", "=", "data", ".", "get", "(", "'top_k'", ")", ",", "pre...
Helper function for parsing a Firestore document to a Product object.
[ "Helper", "function", "for", "parsing", "a", "Firestore", "document", "to", "a", "Product", "object", "." ]
[ "\"\"\"\n Helper function for parsing a Firestore document to a Product object.\n\n Parameters:\n document (DocumentSnapshot): A snapshot of Firestore document.\n\n Output:\n A Product object.\n \"\"\"" ]
[ { "param": "document", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "document", "type": null, "docstring": "A snapshot of Firestore document.", "docstring_tokens": [ "A", "snapshot", "of", "Firestore", "document", "." ], "default": nul...
1bbd18eebaef51f1a1b0bb9ad8dfea8ef43287f4
firebase/firebase-token-generator-python
firebase_token_generator.py
[ "MIT" ]
Python
create_token
<not_specific>
def create_token(secret, data, options=None): """ Generates a secure authentication token. Our token format follows the JSON Web Token (JWT) standard: header.claims.signature Where: 1) "header" is a stringified, base64-encoded JSON object containing version and algorithm information. 2)...
Generates a secure authentication token. Our token format follows the JSON Web Token (JWT) standard: header.claims.signature Where: 1) "header" is a stringified, base64-encoded JSON object containing version and algorithm information. 2) "claims" is a stringified, base64-encoded JSON objec...
Generates a secure authentication token. Our token format follows the JSON Web Token (JWT) standard: header.claims.signature 1) "header" is a stringified, base64-encoded JSON object containing version and algorithm information. For base64-encoding we use URL-safe base64 encoding. This ensures that the entire token is...
[ "Generates", "a", "secure", "authentication", "token", ".", "Our", "token", "format", "follows", "the", "JSON", "Web", "Token", "(", "JWT", ")", "standard", ":", "header", ".", "claims", ".", "signature", "1", ")", "\"", "header", "\"", "is", "a", "strin...
def create_token(secret, data, options=None): if not isinstance(secret, basestring): raise ValueError("firebase_token_generator.create_token: secret must be a string.") if not options and not data: raise ValueError("firebase_token_generator.create_token: data is empty and no options are set. Th...
[ "def", "create_token", "(", "secret", ",", "data", ",", "options", "=", "None", ")", ":", "if", "not", "isinstance", "(", "secret", ",", "basestring", ")", ":", "raise", "ValueError", "(", "\"firebase_token_generator.create_token: secret must be a string.\"", ")", ...
Generates a secure authentication token.
[ "Generates", "a", "secure", "authentication", "token", "." ]
[ "\"\"\"\n Generates a secure authentication token.\n \n Our token format follows the JSON Web Token (JWT) standard:\n header.claims.signature\n \n Where:\n 1) \"header\" is a stringified, base64-encoded JSON object containing version and algorithm information.\n 2) \"claims\" is a stringified, ba...
[ { "param": "secret", "type": null }, { "param": "data", "type": null }, { "param": "options", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "secret", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": null, "docstring": null, "docstring_tokens":...
508cdd6e1e83f392f6a47f7d612588886c3f8008
FNNDSC/python-chrisstoreclient
chrisstoreclient/client.py
[ "MIT" ]
Python
add_plugin
<not_specific>
def add_plugin(self, name, dock_image, descriptor_file, public_repo): """ Add a new plugin to the ChRIS store. """ url = self.get_url('plugins') data = {'name': name, 'dock_image': dock_image, 'public_repo': public_repo} collection = self.post(url, data, descriptor_file) ...
Add a new plugin to the ChRIS store.
Add a new plugin to the ChRIS store.
[ "Add", "a", "new", "plugin", "to", "the", "ChRIS", "store", "." ]
def add_plugin(self, name, dock_image, descriptor_file, public_repo): url = self.get_url('plugins') data = {'name': name, 'dock_image': dock_image, 'public_repo': public_repo} collection = self.post(url, data, descriptor_file) result = self.get_data_from_collection(collection) re...
[ "def", "add_plugin", "(", "self", ",", "name", ",", "dock_image", ",", "descriptor_file", ",", "public_repo", ")", ":", "url", "=", "self", ".", "get_url", "(", "'plugins'", ")", "data", "=", "{", "'name'", ":", "name", ",", "'dock_image'", ":", "dock_im...
Add a new plugin to the ChRIS store.
[ "Add", "a", "new", "plugin", "to", "the", "ChRIS", "store", "." ]
[ "\"\"\"\n Add a new plugin to the ChRIS store.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "dock_image", "type": null }, { "param": "descriptor_file", "type": null }, { "param": "public_repo", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [...
508cdd6e1e83f392f6a47f7d612588886c3f8008
FNNDSC/python-chrisstoreclient
chrisstoreclient/client.py
[ "MIT" ]
Python
remove_plugin
null
def remove_plugin(self, id): """ Remove an existing plugin from the ChRIS store. """ url = self.get_url('plugins') query_url = url + 'search/' search_params = {'id': id} collection = self.get(query_url, search_params) url = collection.items[0].href ...
Remove an existing plugin from the ChRIS store.
Remove an existing plugin from the ChRIS store.
[ "Remove", "an", "existing", "plugin", "from", "the", "ChRIS", "store", "." ]
def remove_plugin(self, id): url = self.get_url('plugins') query_url = url + 'search/' search_params = {'id': id} collection = self.get(query_url, search_params) url = collection.items[0].href self.delete(url)
[ "def", "remove_plugin", "(", "self", ",", "id", ")", ":", "url", "=", "self", ".", "get_url", "(", "'plugins'", ")", "query_url", "=", "url", "+", "'search/'", "search_params", "=", "{", "'id'", ":", "id", "}", "collection", "=", "self", ".", "get", ...
Remove an existing plugin from the ChRIS store.
[ "Remove", "an", "existing", "plugin", "from", "the", "ChRIS", "store", "." ]
[ "\"\"\"\n Remove an existing plugin from the ChRIS store.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "id", "type": null, "docstring": null, "docstring_tokens": [],...
508cdd6e1e83f392f6a47f7d612588886c3f8008
FNNDSC/python-chrisstoreclient
chrisstoreclient/client.py
[ "MIT" ]
Python
modify_plugin_meta
<not_specific>
def modify_plugin_meta(self, name, public_repo, new_owner=None): """ Modify an existing plugin meta in the ChRIS store. """ url = self.get_url('plugin_metas') query_url = url + 'search/' search_params = {'name_exact': name} collection = self.get(query_url, search_...
Modify an existing plugin meta in the ChRIS store.
Modify an existing plugin meta in the ChRIS store.
[ "Modify", "an", "existing", "plugin", "meta", "in", "the", "ChRIS", "store", "." ]
def modify_plugin_meta(self, name, public_repo, new_owner=None): url = self.get_url('plugin_metas') query_url = url + 'search/' search_params = {'name_exact': name} collection = self.get(query_url, search_params) url = collection.items[0].href data = {'public_repo': publi...
[ "def", "modify_plugin_meta", "(", "self", ",", "name", ",", "public_repo", ",", "new_owner", "=", "None", ")", ":", "url", "=", "self", ".", "get_url", "(", "'plugin_metas'", ")", "query_url", "=", "url", "+", "'search/'", "search_params", "=", "{", "'name...
Modify an existing plugin meta in the ChRIS store.
[ "Modify", "an", "existing", "plugin", "meta", "in", "the", "ChRIS", "store", "." ]
[ "\"\"\"\n Modify an existing plugin meta in the ChRIS store.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "public_repo", "type": null }, { "param": "new_owner", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [...
508cdd6e1e83f392f6a47f7d612588886c3f8008
FNNDSC/python-chrisstoreclient
chrisstoreclient/client.py
[ "MIT" ]
Python
remove_plugin_meta
null
def remove_plugin_meta(self, id): """ Remove an existing plugin from the ChRIS store. """ url = self.get_url('plugin_metas') query_url = url + 'search/' search_params = {'id': id} collection = self.get(query_url, search_params) url = collection.items[0].hr...
Remove an existing plugin from the ChRIS store.
Remove an existing plugin from the ChRIS store.
[ "Remove", "an", "existing", "plugin", "from", "the", "ChRIS", "store", "." ]
def remove_plugin_meta(self, id): url = self.get_url('plugin_metas') query_url = url + 'search/' search_params = {'id': id} collection = self.get(query_url, search_params) url = collection.items[0].href self.delete(url)
[ "def", "remove_plugin_meta", "(", "self", ",", "id", ")", ":", "url", "=", "self", ".", "get_url", "(", "'plugin_metas'", ")", "query_url", "=", "url", "+", "'search/'", "search_params", "=", "{", "'id'", ":", "id", "}", "collection", "=", "self", ".", ...
Remove an existing plugin from the ChRIS store.
[ "Remove", "an", "existing", "plugin", "from", "the", "ChRIS", "store", "." ]
[ "\"\"\"\n Remove an existing plugin from the ChRIS store.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "id", "type": null, "docstring": null, "docstring_tokens": [],...
508cdd6e1e83f392f6a47f7d612588886c3f8008
FNNDSC/python-chrisstoreclient
chrisstoreclient/client.py
[ "MIT" ]
Python
_get_item_descriptors
<not_specific>
def _get_item_descriptors(self, item): """ Internal method to get an item's data (descriptors) in a dictionary. """ item_dict = {} # collect the item's descriptors for descriptor in item.data: item_dict[descriptor.name] = descriptor.value return item_d...
Internal method to get an item's data (descriptors) in a dictionary.
Internal method to get an item's data (descriptors) in a dictionary.
[ "Internal", "method", "to", "get", "an", "item", "'", "s", "data", "(", "descriptors", ")", "in", "a", "dictionary", "." ]
def _get_item_descriptors(self, item): item_dict = {} for descriptor in item.data: item_dict[descriptor.name] = descriptor.value return item_dict
[ "def", "_get_item_descriptors", "(", "self", ",", "item", ")", ":", "item_dict", "=", "{", "}", "for", "descriptor", "in", "item", ".", "data", ":", "item_dict", "[", "descriptor", ".", "name", "]", "=", "descriptor", ".", "value", "return", "item_dict" ]
Internal method to get an item's data (descriptors) in a dictionary.
[ "Internal", "method", "to", "get", "an", "item", "'", "s", "data", "(", "descriptors", ")", "in", "a", "dictionary", "." ]
[ "\"\"\"\n Internal method to get an item's data (descriptors) in a dictionary.\n \"\"\"", "# collect the item's descriptors" ]
[ { "param": "self", "type": null }, { "param": "item", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "item", "type": null, "docstring": null, "docstring_tokens": [...
508cdd6e1e83f392f6a47f7d612588886c3f8008
FNNDSC/python-chrisstoreclient
chrisstoreclient/client.py
[ "MIT" ]
Python
delete
null
def delete(self, url): """ Internal method to make a DELETE request to the ChRIS store. """ try: if self.username or self.password: r = requests.delete(url, auth=(self.username, self.password), ...
Internal method to make a DELETE request to the ChRIS store.
Internal method to make a DELETE request to the ChRIS store.
[ "Internal", "method", "to", "make", "a", "DELETE", "request", "to", "the", "ChRIS", "store", "." ]
def delete(self, url): try: if self.username or self.password: r = requests.delete(url, auth=(self.username, self.password), timeout=self.timeout) else: r = requests.delete(url, timeout...
[ "def", "delete", "(", "self", ",", "url", ")", ":", "try", ":", "if", "self", ".", "username", "or", "self", ".", "password", ":", "r", "=", "requests", ".", "delete", "(", "url", ",", "auth", "=", "(", "self", ".", "username", ",", "self", ".", ...
Internal method to make a DELETE request to the ChRIS store.
[ "Internal", "method", "to", "make", "a", "DELETE", "request", "to", "the", "ChRIS", "store", "." ]
[ "\"\"\"\n Internal method to make a DELETE request to the ChRIS store.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "url", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "url", "type": null, "docstring": null, "docstring_tokens": []...
508cdd6e1e83f392f6a47f7d612588886c3f8008
FNNDSC/python-chrisstoreclient
chrisstoreclient/client.py
[ "MIT" ]
Python
_post_put
<not_specific>
def _post_put(self, request_method, url, data, descriptor_file=None): """ Internal method to make either a POST or PUT request to the ChRIS store. """ if descriptor_file is None: headers = {'Content-Type': self.content_type, 'Accept': self.content_type} files = No...
Internal method to make either a POST or PUT request to the ChRIS store.
Internal method to make either a POST or PUT request to the ChRIS store.
[ "Internal", "method", "to", "make", "either", "a", "POST", "or", "PUT", "request", "to", "the", "ChRIS", "store", "." ]
def _post_put(self, request_method, url, data, descriptor_file=None): if descriptor_file is None: headers = {'Content-Type': self.content_type, 'Accept': self.content_type} files = None data = json.dumps(self._makeTemplate(data)) else: headers = None ...
[ "def", "_post_put", "(", "self", ",", "request_method", ",", "url", ",", "data", ",", "descriptor_file", "=", "None", ")", ":", "if", "descriptor_file", "is", "None", ":", "headers", "=", "{", "'Content-Type'", ":", "self", ".", "content_type", ",", "'Acce...
Internal method to make either a POST or PUT request to the ChRIS store.
[ "Internal", "method", "to", "make", "either", "a", "POST", "or", "PUT", "request", "to", "the", "ChRIS", "store", "." ]
[ "\"\"\"\n Internal method to make either a POST or PUT request to the ChRIS store.\n \"\"\"", "# this is a multipart request" ]
[ { "param": "self", "type": null }, { "param": "request_method", "type": null }, { "param": "url", "type": null }, { "param": "data", "type": null }, { "param": "descriptor_file", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "request_method", "type": null, "docstring": null, "docstring_...
508cdd6e1e83f392f6a47f7d612588886c3f8008
FNNDSC/python-chrisstoreclient
chrisstoreclient/client.py
[ "MIT" ]
Python
_get_collection_from_response
<not_specific>
def _get_collection_from_response(response): """ Internal method to get the collection object from a response object. """ content = json.loads(response.text) total = content['collection'].pop('total', None) collection = Collection.from_json(json.dumps(content)) if...
Internal method to get the collection object from a response object.
Internal method to get the collection object from a response object.
[ "Internal", "method", "to", "get", "the", "collection", "object", "from", "a", "response", "object", "." ]
def _get_collection_from_response(response): content = json.loads(response.text) total = content['collection'].pop('total', None) collection = Collection.from_json(json.dumps(content)) if collection.error: raise StoreRequestException(collection.error.message) if total...
[ "def", "_get_collection_from_response", "(", "response", ")", ":", "content", "=", "json", ".", "loads", "(", "response", ".", "text", ")", "total", "=", "content", "[", "'collection'", "]", ".", "pop", "(", "'total'", ",", "None", ")", "collection", "=", ...
Internal method to get the collection object from a response object.
[ "Internal", "method", "to", "get", "the", "collection", "object", "from", "a", "response", "object", "." ]
[ "\"\"\"\n Internal method to get the collection object from a response object.\n \"\"\"" ]
[ { "param": "response", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "response", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
508cdd6e1e83f392f6a47f7d612588886c3f8008
FNNDSC/python-chrisstoreclient
chrisstoreclient/client.py
[ "MIT" ]
Python
_get_link_relation_urls
<not_specific>
def _get_link_relation_urls(obj, relation_name): """ Internal method to get the list of urls for a link relation in a collection or item object. """ return [link.href for link in obj.links if link.rel == relation_name]
Internal method to get the list of urls for a link relation in a collection or item object.
Internal method to get the list of urls for a link relation in a collection or item object.
[ "Internal", "method", "to", "get", "the", "list", "of", "urls", "for", "a", "link", "relation", "in", "a", "collection", "or", "item", "object", "." ]
def _get_link_relation_urls(obj, relation_name): return [link.href for link in obj.links if link.rel == relation_name]
[ "def", "_get_link_relation_urls", "(", "obj", ",", "relation_name", ")", ":", "return", "[", "link", ".", "href", "for", "link", "in", "obj", ".", "links", "if", "link", ".", "rel", "==", "relation_name", "]" ]
Internal method to get the list of urls for a link relation in a collection or item object.
[ "Internal", "method", "to", "get", "the", "list", "of", "urls", "for", "a", "link", "relation", "in", "a", "collection", "or", "item", "object", "." ]
[ "\"\"\"\n Internal method to get the list of urls for a link relation in a collection or\n item object.\n \"\"\"" ]
[ { "param": "obj", "type": null }, { "param": "relation_name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "obj", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "relation_name", "type": null, "docstring": null, "docstring_to...
508cdd6e1e83f392f6a47f7d612588886c3f8008
FNNDSC/python-chrisstoreclient
chrisstoreclient/client.py
[ "MIT" ]
Python
_makeTemplate
<not_specific>
def _makeTemplate(descriptors_dict): """ Internal method to make a Collection+Json template from a regular dictionary whose properties are the item descriptors. """ template = {'data': []} for key in descriptors_dict: template['data'].append({'name': key, 'val...
Internal method to make a Collection+Json template from a regular dictionary whose properties are the item descriptors.
Internal method to make a Collection+Json template from a regular dictionary whose properties are the item descriptors.
[ "Internal", "method", "to", "make", "a", "Collection", "+", "Json", "template", "from", "a", "regular", "dictionary", "whose", "properties", "are", "the", "item", "descriptors", "." ]
def _makeTemplate(descriptors_dict): template = {'data': []} for key in descriptors_dict: template['data'].append({'name': key, 'value': descriptors_dict[key]}) return {'template': template}
[ "def", "_makeTemplate", "(", "descriptors_dict", ")", ":", "template", "=", "{", "'data'", ":", "[", "]", "}", "for", "key", "in", "descriptors_dict", ":", "template", "[", "'data'", "]", ".", "append", "(", "{", "'name'", ":", "key", ",", "'value'", "...
Internal method to make a Collection+Json template from a regular dictionary whose properties are the item descriptors.
[ "Internal", "method", "to", "make", "a", "Collection", "+", "Json", "template", "from", "a", "regular", "dictionary", "whose", "properties", "are", "the", "item", "descriptors", "." ]
[ "\"\"\"\n Internal method to make a Collection+Json template from a regular dictionary whose\n properties are the item descriptors.\n \"\"\"" ]
[ { "param": "descriptors_dict", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "descriptors_dict", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ac34d956ae12a396f76681b74282ea3628a18b16
Gibran000/Gibranpage
polls/static/ofdm/uhd_interface.py
[ "MIT" ]
Python
_print_verbage
null
def _print_verbage(self): """ Prints information about the UHD transmitter """ print "\nUHD Transmitter:" print "UHD Args: %s" % (self._args) print "Freq: %sHz" % (eng_notation.num_to_str(self._freq)) print "LO Offset: %sHz" % (eng_notation.num...
Prints information about the UHD transmitter
Prints information about the UHD transmitter
[ "Prints", "information", "about", "the", "UHD", "transmitter" ]
def _print_verbage(self): print "\nUHD Transmitter:" print "UHD Args: %s" % (self._args) print "Freq: %sHz" % (eng_notation.num_to_str(self._freq)) print "LO Offset: %sHz" % (eng_notation.num_to_str(self._lo_offset)) print "Gain: %f dB" % (self._gain) ...
[ "def", "_print_verbage", "(", "self", ")", ":", "print", "\"\\nUHD Transmitter:\"", "print", "\"UHD Args: %s\"", "%", "(", "self", ".", "_args", ")", "print", "\"Freq: %sHz\"", "%", "(", "eng_notation", ".", "num_to_str", "(", "self", ".", "_freq", "...
Prints information about the UHD transmitter
[ "Prints", "information", "about", "the", "UHD", "transmitter" ]
[ "\"\"\"\n Prints information about the UHD transmitter\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ac34d956ae12a396f76681b74282ea3628a18b16
Gibran000/Gibranpage
polls/static/ofdm/uhd_interface.py
[ "MIT" ]
Python
_print_verbage
null
def _print_verbage(self): """ Prints information about the UHD transmitter """ print "\nUHD Receiver:" print "UHD Args: %s" % (self._args) print "Freq: %sHz" % (eng_notation.num_to_str(self._freq)) print "LO Offset: %sHz" % (eng_notation.num_to...
Prints information about the UHD transmitter
Prints information about the UHD transmitter
[ "Prints", "information", "about", "the", "UHD", "transmitter" ]
def _print_verbage(self): print "\nUHD Receiver:" print "UHD Args: %s" % (self._args) print "Freq: %sHz" % (eng_notation.num_to_str(self._freq)) print "LO Offset: %sHz" % (eng_notation.num_to_str(self._lo_offset)) print "Gain: %f dB" % (self._gain) ...
[ "def", "_print_verbage", "(", "self", ")", ":", "print", "\"\\nUHD Receiver:\"", "print", "\"UHD Args: %s\"", "%", "(", "self", ".", "_args", ")", "print", "\"Freq: %sHz\"", "%", "(", "eng_notation", ".", "num_to_str", "(", "self", ".", "_freq", ")",...
Prints information about the UHD transmitter
[ "Prints", "information", "about", "the", "UHD", "transmitter" ]
[ "\"\"\"\n Prints information about the UHD transmitter\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e81073c6442c724c4495f8f008b5a718c049d33c
DanHickstein/gracefulOSA
stage_and_Ando.py
[ "Unlicense" ]
Python
MoveToPosition
<not_specific>
def MoveToPosition(SN, deviceUnits, timeout=20, queryDelay=0.01, tolerance=1): """ Moves the rotation stage to a certain position (given by device units). This call blocks future action until the move is complete. The timeout is in seconds SN is a c_buffer of the serial number string device...
Moves the rotation stage to a certain position (given by device units). This call blocks future action until the move is complete. The timeout is in seconds SN is a c_buffer of the serial number string deviceUnits shold be a int. tolerance is when the blocking should end (device units) ...
Moves the rotation stage to a certain position (given by device units). This call blocks future action until the move is complete. The timeout is in seconds SN is a c_buffer of the serial number string deviceUnits shold be a int. tolerance is when the blocking should end (device units)
[ "Moves", "the", "rotation", "stage", "to", "a", "certain", "position", "(", "given", "by", "device", "units", ")", ".", "This", "call", "blocks", "future", "action", "until", "the", "move", "is", "complete", ".", "The", "timeout", "is", "in", "seconds", ...
def MoveToPosition(SN, deviceUnits, timeout=20, queryDelay=0.01, tolerance=1): GetStatus(SN) p.ISC_MoveToPosition(SN, c.c_int(int(deviceUnits))) t = time.time() while time.time()<(t+timeout): GetStatus(SN) p.ISC_RequestStatus(SN) currentPosition = p.ISC_GetPosition(SN) e...
[ "def", "MoveToPosition", "(", "SN", ",", "deviceUnits", ",", "timeout", "=", "20", ",", "queryDelay", "=", "0.01", ",", "tolerance", "=", "1", ")", ":", "GetStatus", "(", "SN", ")", "p", ".", "ISC_MoveToPosition", "(", "SN", ",", "c", ".", "c_int", "...
Moves the rotation stage to a certain position (given by device units).
[ "Moves", "the", "rotation", "stage", "to", "a", "certain", "position", "(", "given", "by", "device", "units", ")", "." ]
[ "\"\"\"\n Moves the rotation stage to a certain position (given by device units).\n This call blocks future action until the move is complete.\n The timeout is in seconds\n \n SN is a c_buffer of the serial number string\n deviceUnits shold be a int.\n tolerance is when the blocking should end ...
[ { "param": "SN", "type": null }, { "param": "deviceUnits", "type": null }, { "param": "timeout", "type": null }, { "param": "queryDelay", "type": null }, { "param": "tolerance", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "SN", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "deviceUnits", "type": null, "docstring": null, "docstring_token...
ac8f96230aa4cc7922191a8253d2dbab19677cf3
IdanAtias/Felix
cloud_clients/azure.py
[ "MIT" ]
Python
list_all
Tuple[List[Vm], Optional[str]]
async def list_all( self, subscription: Subscription, filter_func: Callable[[Vm], bool] = None, next_link: str = None ) -> Tuple[List[Vm], Optional[str]]: """ list all VMs in subscriptions next link is for getting the next page of results filter func for filtering only vm...
list all VMs in subscriptions next link is for getting the next page of results filter func for filtering only vms that match filter conditions
list all VMs in subscriptions next link is for getting the next page of results filter func for filtering only vms that match filter conditions
[ "list", "all", "VMs", "in", "subscriptions", "next", "link", "is", "for", "getting", "the", "next", "page", "of", "results", "filter", "func", "for", "filtering", "only", "vms", "that", "match", "filter", "conditions" ]
async def list_all( self, subscription: Subscription, filter_func: Callable[[Vm], bool] = None, next_link: str = None ) -> Tuple[List[Vm], Optional[str]]: if next_link: next_link_parsed = urlparse.urlparse(next_link) path = next_link_parsed.path parsed_query_p...
[ "async", "def", "list_all", "(", "self", ",", "subscription", ":", "Subscription", ",", "filter_func", ":", "Callable", "[", "[", "Vm", "]", ",", "bool", "]", "=", "None", ",", "next_link", ":", "str", "=", "None", ")", "->", "Tuple", "[", "List", "[...
list all VMs in subscriptions next link is for getting the next page of results filter func for filtering only vms that match filter conditions
[ "list", "all", "VMs", "in", "subscriptions", "next", "link", "is", "for", "getting", "the", "next", "page", "of", "results", "filter", "func", "for", "filtering", "only", "vms", "that", "match", "filter", "conditions" ]
[ "\"\"\"\n list all VMs in subscriptions\n next link is for getting the next page of results\n filter func for filtering only vms that match filter conditions\n \"\"\"", "# convert dict style" ]
[ { "param": "self", "type": null }, { "param": "subscription", "type": "Subscription" }, { "param": "filter_func", "type": "Callable[[Vm], bool]" }, { "param": "next_link", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "subscription", "type": "Subscription", "docstring": null, "do...
73d9e3f46937b3389a8c9337091568319b609bc2
IdanAtias/Felix
cloud_clients/gcp.py
[ "MIT" ]
Python
validate_compute_engine_api_available
Optional[Project]
async def validate_compute_engine_api_available(self, project: Project) -> Optional[Project]: """ return the project if Compute Engine available else None """ try: path = self.filter_compute_engine_enabled_projects_path.format(project=project.id) await self.comput...
return the project if Compute Engine available else None
return the project if Compute Engine available else None
[ "return", "the", "project", "if", "Compute", "Engine", "available", "else", "None" ]
async def validate_compute_engine_api_available(self, project: Project) -> Optional[Project]: try: path = self.filter_compute_engine_enabled_projects_path.format(project=project.id) await self.compute_client.get(path=path, response_type=dict) except HTTPError as e: if...
[ "async", "def", "validate_compute_engine_api_available", "(", "self", ",", "project", ":", "Project", ")", "->", "Optional", "[", "Project", "]", ":", "try", ":", "path", "=", "self", ".", "filter_compute_engine_enabled_projects_path", ".", "format", "(", "project...
return the project if Compute Engine available else None
[ "return", "the", "project", "if", "Compute", "Engine", "available", "else", "None" ]
[ "\"\"\"\n return the project if Compute Engine available else None\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "project", "type": "Project" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "project", "type": "Project", "docstring": null, "docstring_to...
73d9e3f46937b3389a8c9337091568319b609bc2
IdanAtias/Felix
cloud_clients/gcp.py
[ "MIT" ]
Python
list_running
Tuple[List[Instance], Optional[str]]
async def list_running( self, project: str, zone: str, next_page_token: str = None ) -> Tuple[List[Instance], Optional[str]]: """ list all running instances in project next page token is for getting the next page of results """ path = self.list_instances_path.form...
list all running instances in project next page token is for getting the next page of results
list all running instances in project next page token is for getting the next page of results
[ "list", "all", "running", "instances", "in", "project", "next", "page", "token", "is", "for", "getting", "the", "next", "page", "of", "results" ]
async def list_running( self, project: str, zone: str, next_page_token: str = None ) -> Tuple[List[Instance], Optional[str]]: path = self.list_instances_path.format(project=project, zone=zone) query_params = {"filter": f"status = {InstanceState.running}"} if next_page_token: ...
[ "async", "def", "list_running", "(", "self", ",", "project", ":", "str", ",", "zone", ":", "str", ",", "next_page_token", ":", "str", "=", "None", ")", "->", "Tuple", "[", "List", "[", "Instance", "]", ",", "Optional", "[", "str", "]", "]", ":", "p...
list all running instances in project next page token is for getting the next page of results
[ "list", "all", "running", "instances", "in", "project", "next", "page", "token", "is", "for", "getting", "the", "next", "page", "of", "results" ]
[ "\"\"\"\n list all running instances in project\n next page token is for getting the next page of results\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "project", "type": "str" }, { "param": "zone", "type": "str" }, { "param": "next_page_token", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "project", "type": "str", "docstring": null, "docstring_tokens...
a9d63d84f85935b018f2be396cfb89de67705ee6
Fmccline/silly_bot
web_scrapers/riddle_scraper.py
[ "Unlicense" ]
Python
make_soup
<not_specific>
def make_soup(self): """makes a soup object with a given url param: string -- url for soup object returns: html soup object or None """ html = self.get_html() soup = BeautifulSoup(html, "html.parser") return soup
makes a soup object with a given url param: string -- url for soup object returns: html soup object or None
makes a soup object with a given url param: string -- url for soup object returns: html soup object or None
[ "makes", "a", "soup", "object", "with", "a", "given", "url", "param", ":", "string", "--", "url", "for", "soup", "object", "returns", ":", "html", "soup", "object", "or", "None" ]
def make_soup(self): html = self.get_html() soup = BeautifulSoup(html, "html.parser") return soup
[ "def", "make_soup", "(", "self", ")", ":", "html", "=", "self", ".", "get_html", "(", ")", "soup", "=", "BeautifulSoup", "(", "html", ",", "\"html.parser\"", ")", "return", "soup" ]
makes a soup object with a given url param: string -- url for soup object returns: html soup object or None
[ "makes", "a", "soup", "object", "with", "a", "given", "url", "param", ":", "string", "--", "url", "for", "soup", "object", "returns", ":", "html", "soup", "object", "or", "None" ]
[ "\"\"\"makes a soup object with a given url\n\n param: string -- url for soup object\n returns: html soup object or None\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a9d63d84f85935b018f2be396cfb89de67705ee6
Fmccline/silly_bot
web_scrapers/riddle_scraper.py
[ "Unlicense" ]
Python
scrape_content
<not_specific>
def scrape_content(self, soup): """makes a Riddle object from a given soup object param: BeautifulSoup object returns: list --question as first index and answer as the second """ question = "" answer = "" riddle = None try: question = soup.fin...
makes a Riddle object from a given soup object param: BeautifulSoup object returns: list --question as first index and answer as the second
makes a Riddle object from a given soup object param: BeautifulSoup object returns: list --question as first index and answer as the second
[ "makes", "a", "Riddle", "object", "from", "a", "given", "soup", "object", "param", ":", "BeautifulSoup", "object", "returns", ":", "list", "--", "question", "as", "first", "index", "and", "answer", "as", "the", "second" ]
def scrape_content(self, soup): question = "" answer = "" riddle = None try: question = soup.find('div', {"class": "riddle-question"}).find('p').text answer = soup.find('div', {"class": "riddle-answer hide print-show"}).find('p').text question = self.f...
[ "def", "scrape_content", "(", "self", ",", "soup", ")", ":", "question", "=", "\"\"", "answer", "=", "\"\"", "riddle", "=", "None", "try", ":", "question", "=", "soup", ".", "find", "(", "'div'", ",", "{", "\"class\"", ":", "\"riddle-question\"", "}", ...
makes a Riddle object from a given soup object param: BeautifulSoup object returns: list --question as first index and answer as the second
[ "makes", "a", "Riddle", "object", "from", "a", "given", "soup", "object", "param", ":", "BeautifulSoup", "object", "returns", ":", "list", "--", "question", "as", "first", "index", "and", "answer", "as", "the", "second" ]
[ "\"\"\"makes a Riddle object from a given soup object\n\n param: BeautifulSoup object\n returns: list --question as first index and answer as the second\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "soup", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "soup", "type": null, "docstring": null, "docstring_tokens": [...
ff394a1171c293e681f64072878f8148762d365e
Radico/tap-linkedin-marketing
tap_linkedin_marketing/executor.py
[ "Apache-2.0" ]
Python
call_full_stream
null
def call_full_stream(self, stream): """ Method to call all fully synced streams """ pivots = ( "CAMPAIGN", "CREATIVE", "CAMPAIGN_GROUP", "CONVERSION", ) for pivot in pivots: request_config = { 'ur...
Method to call all fully synced streams
Method to call all fully synced streams
[ "Method", "to", "call", "all", "fully", "synced", "streams" ]
def call_full_stream(self, stream): pivots = ( "CAMPAIGN", "CREATIVE", "CAMPAIGN_GROUP", "CONVERSION", ) for pivot in pivots: request_config = { 'url': self.url, 'headers': self.build_headers(), ...
[ "def", "call_full_stream", "(", "self", ",", "stream", ")", ":", "pivots", "=", "(", "\"CAMPAIGN\"", ",", "\"CREATIVE\"", ",", "\"CAMPAIGN_GROUP\"", ",", "\"CONVERSION\"", ",", ")", "for", "pivot", "in", "pivots", ":", "request_config", "=", "{", "'url'", ":...
Method to call all fully synced streams
[ "Method", "to", "call", "all", "fully", "synced", "streams" ]
[ "\"\"\"\n Method to call all fully synced streams\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "stream", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "stream", "type": null, "docstring": null, "docstring_tokens":...
8f50cc9736c0dd0d086a456d74dbf17639df1005
AaronBlare/pydnameth
pydnameth/scripts/develop/betas/clock.py
[ "MIT" ]
Python
betas_clock_special
null
def betas_clock_special( data, annotations, attributes, file, method_params=None, ): """ Producing epigentic clock, using best CpGs which are provided in input file. Epigentic clock represents as table: Each row corresponds to clocks, which are built on all CpGs from the...
Producing epigentic clock, using best CpGs which are provided in input file. Epigentic clock represents as table: Each row corresponds to clocks, which are built on all CpGs from the previous rows including the current row. Columns: * item: CpG id. * aux: gene, on whic...
Producing epigentic clock, using best CpGs which are provided in input file. Epigentic clock represents as table: Each row corresponds to clocks, which are built on all CpGs from the previous rows including the current row. Columns. Possible parameters of experiment. ``'type'``: type of clocks.
[ "Producing", "epigentic", "clock", "using", "best", "CpGs", "which", "are", "provided", "in", "input", "file", ".", "Epigentic", "clock", "represents", "as", "table", ":", "Each", "row", "corresponds", "to", "clocks", "which", "are", "built", "on", "all", "C...
def betas_clock_special( data, annotations, attributes, file, method_params=None, ): if os.path.isfile(file): head, tail = os.path.split(file) fn = os.path.splitext(tail)[0] ext = os.path.splitext(tail)[1] config_root = Config( data=copy.deepcopy(data)...
[ "def", "betas_clock_special", "(", "data", ",", "annotations", ",", "attributes", ",", "file", ",", "method_params", "=", "None", ",", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "file", ")", ":", "head", ",", "tail", "=", "os", ".", "path...
Producing epigentic clock, using best CpGs which are provided in input file.
[ "Producing", "epigentic", "clock", "using", "best", "CpGs", "which", "are", "provided", "in", "input", "file", "." ]
[ "\"\"\"\n Producing epigentic clock, using best CpGs which are provided in input file.\n\n Epigentic clock represents as table:\n Each row corresponds to clocks, which are built on all CpGs from the previous rows including the current row.\n Columns:\n\n * item: CpG id.\n *...
[ { "param": "data", "type": null }, { "param": "annotations", "type": null }, { "param": "attributes", "type": null }, { "param": "file", "type": null }, { "param": "method_params", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data", "type": null, "docstring": "pdm.Data instance, which specifies information about dataset.", "docstring_tokens": [ "pdm", ".", "Data", "instance", "which", "specifies", ...
077912bddf7ed90e426df99852acb1c2d75b5f80
pallet-io/Pallet-API
oss_server/explorer/update_db.py
[ "BSD-3-Clause" ]
Python
_get_or_create_datadir
<not_specific>
def _get_or_create_datadir(self): """ Get the last created Datadir object from self.blk_dir, or create one if no Datadir exists. We get the last created Datadir to make sure we are updating with latest blk file. """ datadir_all = Datadir.objects.filter(dirname=self.blk_dir).order...
Get the last created Datadir object from self.blk_dir, or create one if no Datadir exists. We get the last created Datadir to make sure we are updating with latest blk file.
Get the last created Datadir object from self.blk_dir, or create one if no Datadir exists. We get the last created Datadir to make sure we are updating with latest blk file.
[ "Get", "the", "last", "created", "Datadir", "object", "from", "self", ".", "blk_dir", "or", "create", "one", "if", "no", "Datadir", "exists", ".", "We", "get", "the", "last", "created", "Datadir", "to", "make", "sure", "we", "are", "updating", "with", "l...
def _get_or_create_datadir(self): datadir_all = Datadir.objects.filter(dirname=self.blk_dir).order_by('-create_time') if datadir_all.count() == 0: datadir = Datadir(dirname=self.blk_dir, blkfile_number=0, blkfile_offset=0) datadir.save() return datadir else: ...
[ "def", "_get_or_create_datadir", "(", "self", ")", ":", "datadir_all", "=", "Datadir", ".", "objects", ".", "filter", "(", "dirname", "=", "self", ".", "blk_dir", ")", ".", "order_by", "(", "'-create_time'", ")", "if", "datadir_all", ".", "count", "(", ")"...
Get the last created Datadir object from self.blk_dir, or create one if no Datadir exists.
[ "Get", "the", "last", "created", "Datadir", "object", "from", "self", ".", "blk_dir", "or", "create", "one", "if", "no", "Datadir", "exists", "." ]
[ "\"\"\"\n Get the last created Datadir object from self.blk_dir, or create one if no Datadir exists.\n We get the last created Datadir to make sure we are updating with latest blk file.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
077912bddf7ed90e426df99852acb1c2d75b5f80
pallet-io/Pallet-API
oss_server/explorer/update_db.py
[ "BSD-3-Clause" ]
Python
_get_next_blk_file_info
<not_specific>
def _get_next_blk_file_info(self): """Return next blk file path according to the latest Datadir or None if next blk file does not exist.""" datadir = self._get_or_create_datadir() file_name = 'blk{:05d}.dat'.format(datadir.blkfile_number + 1) file_path = os.path.join(datadir.dirname, fil...
Return next blk file path according to the latest Datadir or None if next blk file does not exist.
Return next blk file path according to the latest Datadir or None if next blk file does not exist.
[ "Return", "next", "blk", "file", "path", "according", "to", "the", "latest", "Datadir", "or", "None", "if", "next", "blk", "file", "does", "not", "exist", "." ]
def _get_next_blk_file_info(self): datadir = self._get_or_create_datadir() file_name = 'blk{:05d}.dat'.format(datadir.blkfile_number + 1) file_path = os.path.join(datadir.dirname, file_name) if os.path.exists(file_path): Datadir(dirname=self.blk_dir, blkfi...
[ "def", "_get_next_blk_file_info", "(", "self", ")", ":", "datadir", "=", "self", ".", "_get_or_create_datadir", "(", ")", "file_name", "=", "'blk{:05d}.dat'", ".", "format", "(", "datadir", ".", "blkfile_number", "+", "1", ")", "file_path", "=", "os", ".", "...
Return next blk file path according to the latest Datadir or None if next blk file does not exist.
[ "Return", "next", "blk", "file", "path", "according", "to", "the", "latest", "Datadir", "or", "None", "if", "next", "blk", "file", "does", "not", "exist", "." ]
[ "\"\"\"Return next blk file path according to the latest Datadir or None if next blk file does not exist.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3ea968ce9187d9d7c14bd726a75ac3063bea6482
pallet-io/Pallet-API
oss_server/base/utils.py
[ "BSD-3-Clause" ]
Python
select_utxo
<not_specific>
def select_utxo(utxos, sum): """Return a list of utxo sum up to the specified amount. Args: utxos: A list of dict with following format. [{ txid: '' value: 0, vout: 0, scriptPubKey: '', ...
Return a list of utxo sum up to the specified amount. Args: utxos: A list of dict with following format. [{ txid: '' value: 0, vout: 0, scriptPubKey: '', }, ...
Return a list of utxo sum up to the specified amount.
[ "Return", "a", "list", "of", "utxo", "sum", "up", "to", "the", "specified", "amount", "." ]
def select_utxo(utxos, sum): if not utxos: return [] utxos = sorted(utxos, key=lambda utxo: utxo['value']) value = 0 for i, utxo in enumerate(utxos): value += utxo['value'] if value >= sum: return utxos[:i + 1] return []
[ "def", "select_utxo", "(", "utxos", ",", "sum", ")", ":", "if", "not", "utxos", ":", "return", "[", "]", "utxos", "=", "sorted", "(", "utxos", ",", "key", "=", "lambda", "utxo", ":", "utxo", "[", "'value'", "]", ")", "value", "=", "0", "for", "i"...
Return a list of utxo sum up to the specified amount.
[ "Return", "a", "list", "of", "utxo", "sum", "up", "to", "the", "specified", "amount", "." ]
[ "\"\"\"Return a list of utxo sum up to the specified amount.\n\n Args:\n utxos: A list of dict with following format.\n [{\n txid: ''\n value: 0,\n vout: 0,\n scriptPubKey: '',\n },...
[ { "param": "utxos", "type": null }, { "param": "sum", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "utxos", "type": null, "docstring": "A list of dict with following format.", "docstring_tokens": [ "A", "list", "of", "dict", "with", "following", "format", "." ...
3ea968ce9187d9d7c14bd726a75ac3063bea6482
pallet-io/Pallet-API
oss_server/base/utils.py
[ "BSD-3-Clause" ]
Python
balance_from_utxos
<not_specific>
def balance_from_utxos(utxos): """Return balance of a list of utxo. Args: utxos: A list of utxo with following format. [{ txid: '' value: 0, vout: 0, scriptPubKey: '', }] ...
Return balance of a list of utxo. Args: utxos: A list of utxo with following format. [{ txid: '' value: 0, vout: 0, scriptPubKey: '', }] Returns: A balance sum of value ...
Return balance of a list of utxo.
[ "Return", "balance", "of", "a", "list", "of", "utxo", "." ]
def balance_from_utxos(utxos): balance = 0 if utxos: balance = sum(utxo['value'] for utxo in utxos) return balance
[ "def", "balance_from_utxos", "(", "utxos", ")", ":", "balance", "=", "0", "if", "utxos", ":", "balance", "=", "sum", "(", "utxo", "[", "'value'", "]", "for", "utxo", "in", "utxos", ")", "return", "balance" ]
Return balance of a list of utxo.
[ "Return", "balance", "of", "a", "list", "of", "utxo", "." ]
[ "\"\"\"Return balance of a list of utxo.\n\n Args:\n utxos: A list of utxo with following format.\n [{\n txid: ''\n value: 0,\n vout: 0,\n scriptPubKey: '',\n }]\n\n Returns: A b...
[ { "param": "utxos", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "utxos", "type": null, "docstring": "A list of utxo with following format.", "docstring_tokens": [ "A", "list", "of", "utxo", "with", "following", "format", "." ...
3ea968ce9187d9d7c14bd726a75ac3063bea6482
pallet-io/Pallet-API
oss_server/base/utils.py
[ "BSD-3-Clause" ]
Python
utxo_to_txin
<not_specific>
def utxo_to_txin(utxo): """Return a dict of transaction input build from an utxo. Args: utxo: an utxo dict. { txid: '' value: 0, vout: 0, scriptPubKey: '' } """ return { 'tx_id': utxo['txid'], 'index': utxo['vout'], 'script': utxo['scriptPubK...
Return a dict of transaction input build from an utxo. Args: utxo: an utxo dict. { txid: '' value: 0, vout: 0, scriptPubKey: '' }
Return a dict of transaction input build from an utxo. Args: utxo: an utxo dict.
[ "Return", "a", "dict", "of", "transaction", "input", "build", "from", "an", "utxo", ".", "Args", ":", "utxo", ":", "an", "utxo", "dict", "." ]
def utxo_to_txin(utxo): return { 'tx_id': utxo['txid'], 'index': utxo['vout'], 'script': utxo['scriptPubKey'] }
[ "def", "utxo_to_txin", "(", "utxo", ")", ":", "return", "{", "'tx_id'", ":", "utxo", "[", "'txid'", "]", ",", "'index'", ":", "utxo", "[", "'vout'", "]", ",", "'script'", ":", "utxo", "[", "'scriptPubKey'", "]", "}" ]
Return a dict of transaction input build from an utxo.
[ "Return", "a", "dict", "of", "transaction", "input", "build", "from", "an", "utxo", "." ]
[ "\"\"\"Return a dict of transaction input build from an utxo.\n\n Args:\n utxo: an utxo dict.\n {\n txid: ''\n value: 0,\n vout: 0,\n scriptPubKey: ''\n }\n \"\"\"" ]
[ { "param": "utxo", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "utxo", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c005a41c5b529a3a6040bf25c9c849fb5bcdcb54
pallet-io/Pallet-API
oss_server/explorer/pagination.py
[ "BSD-3-Clause" ]
Python
object_pagination
<not_specific>
def object_pagination(object_list, start_object=None, per_page=50): """ Paginate a list of objects (e.g transactions or blocks). The `start_object` object should have attribute `pk` and `time`. :param object_list: A list of objects need to paginate :param start_object: Starting object :param pe...
Paginate a list of objects (e.g transactions or blocks). The `start_object` object should have attribute `pk` and `time`. :param object_list: A list of objects need to paginate :param start_object: Starting object :param per_page: The page size :return: (page, objects). page is the pagination ...
Paginate a list of objects .
[ "Paginate", "a", "list", "of", "objects", "." ]
def object_pagination(object_list, start_object=None, per_page=50): pk = None time = None if start_object: pk = start_object.pk time = start_object.time paginator = SeekPaginator(object_list, per_page=per_page, lookup_field='time') try: objects = paginator.page(value=time, pk...
[ "def", "object_pagination", "(", "object_list", ",", "start_object", "=", "None", ",", "per_page", "=", "50", ")", ":", "pk", "=", "None", "time", "=", "None", "if", "start_object", ":", "pk", "=", "start_object", ".", "pk", "time", "=", "start_object", ...
Paginate a list of objects (e.g transactions or blocks).
[ "Paginate", "a", "list", "of", "objects", "(", "e", ".", "g", "transactions", "or", "blocks", ")", "." ]
[ "\"\"\"\n Paginate a list of objects (e.g transactions or blocks). The `start_object` object should have attribute `pk` and\n `time`.\n\n :param object_list: A list of objects need to paginate\n :param start_object: Starting object\n :param per_page: The page size\n :return: (page, objects). page ...
[ { "param": "object_list", "type": null }, { "param": "start_object", "type": null }, { "param": "per_page", "type": null } ]
{ "returns": [ { "docstring": "(page, objects). page is the pagination info. objects is the queried objects.", "docstring_tokens": [ "(", "page", "objects", ")", ".", "page", "is", "the", "pagination", "info", ".",...
0969ea63463b14105d9a8a77198468336bfa8520
pallet-io/Pallet-API
oss_server/explorer/blocktools/base58.py
[ "BSD-3-Clause" ]
Python
b58encode
<not_specific>
def b58encode(v): """Encode v, which is a string of bytes, to base58.""" long_value = 0L for (i, c) in enumerate(v[::-1]): long_value += ord(c) << (8 * i) # 2x speedup vs. exponentiation result = '' while long_value >= __b58base: div, mod = divmod(long_value, __b58base) re...
Encode v, which is a string of bytes, to base58.
Encode v, which is a string of bytes, to base58.
[ "Encode", "v", "which", "is", "a", "string", "of", "bytes", "to", "base58", "." ]
def b58encode(v): long_value = 0L for (i, c) in enumerate(v[::-1]): long_value += ord(c) << (8 * i) result = '' while long_value >= __b58base: div, mod = divmod(long_value, __b58base) result = __b58chars[mod] + result long_value = div result = __b58chars[long_value]...
[ "def", "b58encode", "(", "v", ")", ":", "long_value", "=", "0L", "for", "(", "i", ",", "c", ")", "in", "enumerate", "(", "v", "[", ":", ":", "-", "1", "]", ")", ":", "long_value", "+=", "ord", "(", "c", ")", "<<", "(", "8", "*", "i", ")", ...
Encode v, which is a string of bytes, to base58.
[ "Encode", "v", "which", "is", "a", "string", "of", "bytes", "to", "base58", "." ]
[ "\"\"\"Encode v, which is a string of bytes, to base58.\"\"\"", "# 2x speedup vs. exponentiation", "# Bitcoin does a little leading-zero-compression:", "# leading 0-bytes in the input become leading-1s" ]
[ { "param": "v", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "v", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }