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
5cc863158cbd6f040dfe92fe6fe9b059216425bf
sharm294/sonar
tests/conftest.py
[ "MIT" ]
Python
abs_path
<not_specific>
def abs_path(): """ Get the absolute path to the sonar repository Returns: str: Path to the sonar repository """ return os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Get the absolute path to the sonar repository Returns: str: Path to the sonar repository
Get the absolute path to the sonar repository
[ "Get", "the", "absolute", "path", "to", "the", "sonar", "repository" ]
def abs_path(): return os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
[ "def", "abs_path", "(", ")", ":", "return", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "__file__", ")", ")", ")" ]
Get the absolute path to the sonar repository
[ "Get", "the", "absolute", "path", "to", "the", "sonar", "repository" ]
[ "\"\"\"\n Get the absolute path to the sonar repository\n\n Returns:\n str: Path to the sonar repository\n \"\"\"" ]
[]
{ "returns": [ { "docstring": "Path to the sonar repository", "docstring_tokens": [ "Path", "to", "the", "sonar", "repository" ], "type": "str" } ], "raises": [], "params": [], "outlier_params": [], "others": [] }
5cc863158cbd6f040dfe92fe6fe9b059216425bf
sharm294/sonar
tests/conftest.py
[ "MIT" ]
Python
call_sonar
<not_specific>
def call_sonar(): """ Pytest fixture that just fetches the CallSonar object Returns: CallSonar: Allows pytest tests to call sonar """ return CallSonar
Pytest fixture that just fetches the CallSonar object Returns: CallSonar: Allows pytest tests to call sonar
Pytest fixture that just fetches the CallSonar object
[ "Pytest", "fixture", "that", "just", "fetches", "the", "CallSonar", "object" ]
def call_sonar(): return CallSonar
[ "def", "call_sonar", "(", ")", ":", "return", "CallSonar" ]
Pytest fixture that just fetches the CallSonar object
[ "Pytest", "fixture", "that", "just", "fetches", "the", "CallSonar", "object" ]
[ "\"\"\"\n Pytest fixture that just fetches the CallSonar object\n\n Returns:\n CallSonar: Allows pytest tests to call sonar\n \"\"\"" ]
[]
{ "returns": [ { "docstring": "Allows pytest tests to call sonar", "docstring_tokens": [ "Allows", "pytest", "tests", "to", "call", "sonar" ], "type": "CallSonar" } ], "raises": [], "params": [], "outlier_params": [], "others": ...
5cc863158cbd6f040dfe92fe6fe9b059216425bf
sharm294/sonar
tests/conftest.py
[ "MIT" ]
Python
check_filesystem
<not_specific>
def check_filesystem( base_path, directories=None, files=None, check_all=True ): """ Check the filesystem at a given path to make sure that the listed files and/or directories all exist Args: base_path (str): The base path to search from directories (...
Check the filesystem at a given path to make sure that the listed files and/or directories all exist Args: base_path (str): The base path to search from directories (list, optional): List of directories to search. Defaults to None. files (lis...
Check the filesystem at a given path to make sure that the listed files and/or directories all exist
[ "Check", "the", "filesystem", "at", "a", "given", "path", "to", "make", "sure", "that", "the", "listed", "files", "and", "/", "or", "directories", "all", "exist" ]
def check_filesystem( base_path, directories=None, files=None, check_all=True ): assert ( directories is not None or files is not None ), "One of directories or files must be specified" assert ( isinstance(files, list) or files is None ), "Argument mus...
[ "def", "check_filesystem", "(", "base_path", ",", "directories", "=", "None", ",", "files", "=", "None", ",", "check_all", "=", "True", ")", ":", "assert", "(", "directories", "is", "not", "None", "or", "files", "is", "not", "None", ")", ",", "\"One of d...
Check the filesystem at a given path to make sure that the listed files and/or directories all exist
[ "Check", "the", "filesystem", "at", "a", "given", "path", "to", "make", "sure", "that", "the", "listed", "files", "and", "/", "or", "directories", "all", "exist" ]
[ "\"\"\"\n Check the filesystem at a given path to make sure that the listed files\n and/or directories all exist\n\n Args:\n base_path (str): The base path to search from\n directories (list, optional): List of directories to search.\n Defaults to None.\n ...
[ { "param": "base_path", "type": null }, { "param": "directories", "type": null }, { "param": "files", "type": null }, { "param": "check_all", "type": null } ]
{ "returns": [ { "docstring": "(list of missing files/dirs, list of extra files/dirs)", "docstring_tokens": [ "(", "list", "of", "missing", "files", "/", "dirs", "list", "of", "extra", "files", "/", ...
5cc863158cbd6f040dfe92fe6fe9b059216425bf
sharm294/sonar
tests/conftest.py
[ "MIT" ]
Python
helper
<not_specific>
def helper(): """ Pytest fixture that just fetches the Helper object Returns: Helper: Helpful functions for pytest tests """ return Helper
Pytest fixture that just fetches the Helper object Returns: Helper: Helpful functions for pytest tests
Pytest fixture that just fetches the Helper object
[ "Pytest", "fixture", "that", "just", "fetches", "the", "Helper", "object" ]
def helper(): return Helper
[ "def", "helper", "(", ")", ":", "return", "Helper" ]
Pytest fixture that just fetches the Helper object
[ "Pytest", "fixture", "that", "just", "fetches", "the", "Helper", "object" ]
[ "\"\"\"\n Pytest fixture that just fetches the Helper object\n\n Returns:\n Helper: Helpful functions for pytest tests\n \"\"\"" ]
[]
{ "returns": [ { "docstring": "Helpful functions for pytest tests", "docstring_tokens": [ "Helpful", "functions", "for", "pytest", "tests" ], "type": "Helper" } ], "raises": [], "params": [], "outlier_params": [], "others": [] }
346e2bfe4dd465e48c3e48c3f979fe30f04e8abf
sharm294/sonar
sonar/interfaces/base_interface.py
[ "MIT" ]
Python
to_upper_case
<not_specific>
def to_upper_case(signals): """ For a dictionary of signals, change all the names to upper case Args: signals (dict): Dictionary of Signals Returns: dict: Updated dictionary """ for _, signal in signals.items(): signal.name = signal.name.upper() return signals
For a dictionary of signals, change all the names to upper case Args: signals (dict): Dictionary of Signals Returns: dict: Updated dictionary
For a dictionary of signals, change all the names to upper case
[ "For", "a", "dictionary", "of", "signals", "change", "all", "the", "names", "to", "upper", "case" ]
def to_upper_case(signals): for _, signal in signals.items(): signal.name = signal.name.upper() return signals
[ "def", "to_upper_case", "(", "signals", ")", ":", "for", "_", ",", "signal", "in", "signals", ".", "items", "(", ")", ":", "signal", ".", "name", "=", "signal", ".", "name", ".", "upper", "(", ")", "return", "signals" ]
For a dictionary of signals, change all the names to upper case
[ "For", "a", "dictionary", "of", "signals", "change", "all", "the", "names", "to", "upper", "case" ]
[ "\"\"\"\n For a dictionary of signals, change all the names to upper case\n\n Args:\n signals (dict): Dictionary of Signals\n\n Returns:\n dict: Updated dictionary\n \"\"\"" ]
[ { "param": "signals", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "dict" } ], "raises": [], "params": [ { "identifier": "signals", "type": null, "docstring": "Dictionary of Signals", "docstring_tokens": [ "Dictionary", ...
346e2bfe4dd465e48c3e48c3f979fe30f04e8abf
sharm294/sonar
sonar/interfaces/base_interface.py
[ "MIT" ]
Python
import_packages_global
<not_specific>
def import_packages_global(): """ Specifies any packages that must be imported once per testbench Returns: str: Packages to be imported """ return ""
Specifies any packages that must be imported once per testbench Returns: str: Packages to be imported
Specifies any packages that must be imported once per testbench
[ "Specifies", "any", "packages", "that", "must", "be", "imported", "once", "per", "testbench" ]
def import_packages_global(): return ""
[ "def", "import_packages_global", "(", ")", ":", "return", "\"\"" ]
Specifies any packages that must be imported once per testbench
[ "Specifies", "any", "packages", "that", "must", "be", "imported", "once", "per", "testbench" ]
[ "\"\"\"\n Specifies any packages that must be imported once per testbench\n\n Returns:\n str: Packages to be imported\n \"\"\"" ]
[]
{ "returns": [ { "docstring": "Packages to be imported", "docstring_tokens": [ "Packages", "to", "be", "imported" ], "type": "str" } ], "raises": [], "params": [], "outlier_params": [], "others": [] }
346e2bfe4dd465e48c3e48c3f979fe30f04e8abf
sharm294/sonar
sonar/interfaces/base_interface.py
[ "MIT" ]
Python
write_sv
<not_specific>
def write_sv(cls, packet): """ Write one line of the SV data file Args: packet (dict): The command to write Returns: str: The command as a line for the data file """ line = "" for word in packet["payload"]: count = 0 ...
Write one line of the SV data file Args: packet (dict): The command to write Returns: str: The command as a line for the data file
Write one line of the SV data file
[ "Write", "one", "line", "of", "the", "SV", "data", "file" ]
def write_sv(cls, packet): line = "" for word in packet["payload"]: count = 0 line += packet["type"] + " " + packet["name"] + " $COUNT$" for arg, _ in cls.args["sv"].items(): if arg in word: count += 1 line += " ...
[ "def", "write_sv", "(", "cls", ",", "packet", ")", ":", "line", "=", "\"\"", "for", "word", "in", "packet", "[", "\"payload\"", "]", ":", "count", "=", "0", "line", "+=", "packet", "[", "\"type\"", "]", "+", "\" \"", "+", "packet", "[", "\"name\"", ...
Write one line of the SV data file
[ "Write", "one", "line", "of", "the", "SV", "data", "file" ]
[ "\"\"\"\n Write one line of the SV data file\n\n Args:\n packet (dict): The command to write\n\n Returns:\n str: The command as a line for the data file\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "packet", "type": null } ]
{ "returns": [ { "docstring": "The command as a line for the data file", "docstring_tokens": [ "The", "command", "as", "a", "line", "for", "the", "data", "file" ], "type": "str" } ], "raises": [], "params": [...
346e2bfe4dd465e48c3e48c3f979fe30f04e8abf
sharm294/sonar
sonar/interfaces/base_interface.py
[ "MIT" ]
Python
write_cpp
<not_specific>
def write_cpp(cls, packet, identifier="NULL"): """ Write one line of the C++ data file Args: packet (dict): The command to write Returns: str: The command as a line for the data file """ line = "" for word in packet["payload"]: ...
Write one line of the C++ data file Args: packet (dict): The command to write Returns: str: The command as a line for the data file
Write one line of the C++ data file
[ "Write", "one", "line", "of", "the", "C", "++", "data", "file" ]
def write_cpp(cls, packet, identifier="NULL"): line = "" for word in packet["payload"]: count = 0 line += ( packet["name"] + " " + "NULL" + " " + identifier + " $COUNT$" ) for arg, _ in cls.args["cpp"].items(): if arg in wor...
[ "def", "write_cpp", "(", "cls", ",", "packet", ",", "identifier", "=", "\"NULL\"", ")", ":", "line", "=", "\"\"", "for", "word", "in", "packet", "[", "\"payload\"", "]", ":", "count", "=", "0", "line", "+=", "(", "packet", "[", "\"name\"", "]", "+", ...
Write one line of the C++ data file
[ "Write", "one", "line", "of", "the", "C", "++", "data", "file" ]
[ "\"\"\"\n Write one line of the C++ data file\n\n Args:\n packet (dict): The command to write\n\n Returns:\n str: The command as a line for the data file\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "packet", "type": null }, { "param": "identifier", "type": null } ]
{ "returns": [ { "docstring": "The command as a line for the data file", "docstring_tokens": [ "The", "command", "as", "a", "line", "for", "the", "data", "file" ], "type": "str" } ], "raises": [], "params": [...
346e2bfe4dd465e48c3e48c3f979fe30f04e8abf
sharm294/sonar
sonar/interfaces/base_interface.py
[ "MIT" ]
Python
add_signal
null
def add_signal(self, signal_type, signal): """ Adds a signal to this interface Args: signal_type (str): Type of signal to add (interface-dependent) signal (Signal): Signal object """ self.signals[signal_type] = signal
Adds a signal to this interface Args: signal_type (str): Type of signal to add (interface-dependent) signal (Signal): Signal object
Adds a signal to this interface
[ "Adds", "a", "signal", "to", "this", "interface" ]
def add_signal(self, signal_type, signal): self.signals[signal_type] = signal
[ "def", "add_signal", "(", "self", ",", "signal_type", ",", "signal", ")", ":", "self", ".", "signals", "[", "signal_type", "]", "=", "signal" ]
Adds a signal to this interface
[ "Adds", "a", "signal", "to", "this", "interface" ]
[ "\"\"\"\n Adds a signal to this interface\n\n Args:\n signal_type (str): Type of signal to add (interface-dependent)\n signal (Signal): Signal object\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "signal_type", "type": null }, { "param": "signal", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "signal_type", "type": null, "docstring": "Type of signal to add (in...
346e2bfe4dd465e48c3e48c3f979fe30f04e8abf
sharm294/sonar
sonar/interfaces/base_interface.py
[ "MIT" ]
Python
add_signals
null
def add_signals(self, signals): """ Adds a set of signals to this interface port Args: signals (dict): signals to add to the interface """ self.signals = {**self.signals, **signals}
Adds a set of signals to this interface port Args: signals (dict): signals to add to the interface
Adds a set of signals to this interface port
[ "Adds", "a", "set", "of", "signals", "to", "this", "interface", "port" ]
def add_signals(self, signals): self.signals = {**self.signals, **signals}
[ "def", "add_signals", "(", "self", ",", "signals", ")", ":", "self", ".", "signals", "=", "{", "**", "self", ".", "signals", ",", "**", "signals", "}" ]
Adds a set of signals to this interface port
[ "Adds", "a", "set", "of", "signals", "to", "this", "interface", "port" ]
[ "\"\"\"\n Adds a set of signals to this interface port\n\n Args:\n signals (dict): signals to add to the interface\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "signals", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "signals", "type": null, "docstring": "signals to add to the interfa...
346e2bfe4dd465e48c3e48c3f979fe30f04e8abf
sharm294/sonar
sonar/interfaces/base_interface.py
[ "MIT" ]
Python
has_signal
<not_specific>
def has_signal(self, signal_type): """ Returns a boolean if the interface has a specific signal Args: signal_type (str): The signal type to search Returns: bool: True if the interface has the signal """ if signal_type in self.signals: ...
Returns a boolean if the interface has a specific signal Args: signal_type (str): The signal type to search Returns: bool: True if the interface has the signal
Returns a boolean if the interface has a specific signal
[ "Returns", "a", "boolean", "if", "the", "interface", "has", "a", "specific", "signal" ]
def has_signal(self, signal_type): if signal_type in self.signals: return True return False
[ "def", "has_signal", "(", "self", ",", "signal_type", ")", ":", "if", "signal_type", "in", "self", ".", "signals", ":", "return", "True", "return", "False" ]
Returns a boolean if the interface has a specific signal
[ "Returns", "a", "boolean", "if", "the", "interface", "has", "a", "specific", "signal" ]
[ "\"\"\"\n Returns a boolean if the interface has a specific signal\n\n Args:\n signal_type (str): The signal type to search\n\n Returns:\n bool: True if the interface has the signal\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "signal_type", "type": null } ]
{ "returns": [ { "docstring": "True if the interface has the signal", "docstring_tokens": [ "True", "if", "the", "interface", "has", "the", "signal" ], "type": "bool" } ], "raises": [], "params": [ { "identifier": ...
346e2bfe4dd465e48c3e48c3f979fe30f04e8abf
sharm294/sonar
sonar/interfaces/base_interface.py
[ "MIT" ]
Python
add_endpoint
null
def add_endpoint(self, endpoint, **kwargs): """ Add an endpoint to the interface Args: endpoint (Endpoint): The endpoint to add kwargs (?): Keyworded arguments for the endpoint """ endpoint.arguments = kwargs self.endpoints.append(endpoint)
Add an endpoint to the interface Args: endpoint (Endpoint): The endpoint to add kwargs (?): Keyworded arguments for the endpoint
Add an endpoint to the interface
[ "Add", "an", "endpoint", "to", "the", "interface" ]
def add_endpoint(self, endpoint, **kwargs): endpoint.arguments = kwargs self.endpoints.append(endpoint)
[ "def", "add_endpoint", "(", "self", ",", "endpoint", ",", "**", "kwargs", ")", ":", "endpoint", ".", "arguments", "=", "kwargs", "self", ".", "endpoints", ".", "append", "(", "endpoint", ")" ]
Add an endpoint to the interface
[ "Add", "an", "endpoint", "to", "the", "interface" ]
[ "\"\"\"\n Add an endpoint to the interface\n\n Args:\n endpoint (Endpoint): The endpoint to add\n kwargs (?): Keyworded arguments for the endpoint\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "endpoint", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "endpoint", "type": null, "docstring": "The endpoint to add", ...
b4f64a01822e6e26c4fe9e42eceb1d912119371d
sharm294/sonar
sonar/cli.py
[ "MIT" ]
Python
activate
null
def activate(parser): """ Parse the "activate" argument Args: parser (argparse._SubParsersAction): The parser object """ subparser = parser.add_parser( "activate", help="Activate environment settings", add_help=False ) command_group = subparser.add_argument_group("Environme...
Parse the "activate" argument Args: parser (argparse._SubParsersAction): The parser object
Parse the "activate" argument
[ "Parse", "the", "\"", "activate", "\"", "argument" ]
def activate(parser): subparser = parser.add_parser( "activate", help="Activate environment settings", add_help=False ) command_group = subparser.add_argument_group("Environment") command_group.add_argument( "name", type=str, nargs="?", default=None, help=...
[ "def", "activate", "(", "parser", ")", ":", "subparser", "=", "parser", ".", "add_parser", "(", "\"activate\"", ",", "help", "=", "\"Activate environment settings\"", ",", "add_help", "=", "False", ")", "command_group", "=", "subparser", ".", "add_argument_group",...
Parse the "activate" argument
[ "Parse", "the", "\"", "activate", "\"", "argument" ]
[ "\"\"\"\n Parse the \"activate\" argument\n\n Args:\n parser (argparse._SubParsersAction): The parser object\n \"\"\"" ]
[ { "param": "parser", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parser", "type": null, "docstring": "The parser object", "docstring_tokens": [ "The", "parser", "object" ], "default": null, "is_optional": false } ], "outlier_params": [], "...
b4f64a01822e6e26c4fe9e42eceb1d912119371d
sharm294/sonar
sonar/cli.py
[ "MIT" ]
Python
env
null
def env(parser): """ Parse the "env" argument Args: parser (argparse._SubParserAction): The parser object """ subparser = parser.add_parser( "env", help="Manage sonar envs", add_help=False ) subsubparser = subparser.add_subparsers( title="Commands", metavar="command"...
Parse the "env" argument Args: parser (argparse._SubParserAction): The parser object
Parse the "env" argument
[ "Parse", "the", "\"", "env", "\"", "argument" ]
def env(parser): subparser = parser.add_parser( "env", help="Manage sonar envs", add_help=False ) subsubparser = subparser.add_subparsers( title="Commands", metavar="command" ) def add(): command = subsubparser.add_parser( "add", help="Add an env to so...
[ "def", "env", "(", "parser", ")", ":", "subparser", "=", "parser", ".", "add_parser", "(", "\"env\"", ",", "help", "=", "\"Manage sonar envs\"", ",", "add_help", "=", "False", ")", "subsubparser", "=", "subparser", ".", "add_subparsers", "(", "title", "=", ...
Parse the "env" argument
[ "Parse", "the", "\"", "env", "\"", "argument" ]
[ "\"\"\"\n Parse the \"env\" argument\n\n Args:\n parser (argparse._SubParserAction): The parser object\n \"\"\"", "# def edit():", "# command = subsubparser.add_parser(", "# \"edit\",", "# help=\"Edit an env\",", "# add_help=False,", "# description=\"E...
[ { "param": "parser", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parser", "type": null, "docstring": "The parser object", "docstring_tokens": [ "The", "parser", "object" ], "default": null, "is_optional": false } ], "outlier_params": [], "...
b4f64a01822e6e26c4fe9e42eceb1d912119371d
sharm294/sonar
sonar/cli.py
[ "MIT" ]
Python
tool
null
def tool(parser): """ Parse the "tool" argument Args: parser (argparse._SubParserAction): The parser object """ subparser = parser.add_parser( "tool", help="Manage hw tools", add_help=False ) subsubparser = subparser.add_subparsers( title="Commands", metavar="command...
Parse the "tool" argument Args: parser (argparse._SubParserAction): The parser object
Parse the "tool" argument
[ "Parse", "the", "\"", "tool", "\"", "argument" ]
def tool(parser): subparser = parser.add_parser( "tool", help="Manage hw tools", add_help=False ) subsubparser = subparser.add_subparsers( title="Commands", metavar="command" ) "type", type=str, help="Type of tool to remove") "ID", type=str, help="ID of tool") "type", type=st...
[ "def", "tool", "(", "parser", ")", ":", "subparser", "=", "parser", ".", "add_parser", "(", "\"tool\"", ",", "help", "=", "\"Manage hw tools\"", ",", "add_help", "=", "False", ")", "subsubparser", "=", "subparser", ".", "add_subparsers", "(", "title", "=", ...
Parse the "tool" argument
[ "Parse", "the", "\"", "tool", "\"", "argument" ]
[ "\"\"\"\n Parse the \"tool\" argument\n\n Args:\n parser (argparse._SubParserAction): The parser object\n \"\"\"", "# def add():", "# command = subsubparser.add_parser(", "# \"add\",", "# help=\"Add a tool to sonar's database\",", "# add_help=False,", "# ...
[ { "param": "parser", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parser", "type": null, "docstring": "The parser object", "docstring_tokens": [ "The", "parser", "object" ], "default": null, "is_optional": false } ], "outlier_params": [], "...
b4f64a01822e6e26c4fe9e42eceb1d912119371d
sharm294/sonar
sonar/cli.py
[ "MIT" ]
Python
board
null
def board(parser): """ Parse the "board" argument Args: parser (argparse._SubParserAction): The parser object """ subparser = parser.add_parser( "board", help="Manage board definitions", add_help=False ) subsubparser = subparser.add_subparsers( title="Commands", meta...
Parse the "board" argument Args: parser (argparse._SubParserAction): The parser object
Parse the "board" argument
[ "Parse", "the", "\"", "board", "\"", "argument" ]
def board(parser): subparser = parser.add_parser( "board", help="Manage board definitions", add_help=False ) subsubparser = subparser.add_subparsers( title="Commands", metavar="command" ) def add(): command = subsubparser.add_parser( "add", help="Add a...
[ "def", "board", "(", "parser", ")", ":", "subparser", "=", "parser", ".", "add_parser", "(", "\"board\"", ",", "help", "=", "\"Manage board definitions\"", ",", "add_help", "=", "False", ")", "subsubparser", "=", "subparser", ".", "add_subparsers", "(", "title...
Parse the "board" argument
[ "Parse", "the", "\"", "board", "\"", "argument" ]
[ "\"\"\"\n Parse the \"board\" argument\n\n Args:\n parser (argparse._SubParserAction): The parser object\n \"\"\"" ]
[ { "param": "parser", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parser", "type": null, "docstring": "The parser object", "docstring_tokens": [ "The", "parser", "object" ], "default": null, "is_optional": false } ], "outlier_params": [], "...
b4f64a01822e6e26c4fe9e42eceb1d912119371d
sharm294/sonar
sonar/cli.py
[ "MIT" ]
Python
repo
null
def repo(parser): """ Parse the "repo" argument Args: parser (argparse._SubParserAction): The parser object """ subparser = parser.add_parser( "repo", help="Manage sonar repos", add_help=False ) subsubparser = subparser.add_subparsers( title="Commands", metavar="comm...
Parse the "repo" argument Args: parser (argparse._SubParserAction): The parser object
Parse the "repo" argument
[ "Parse", "the", "\"", "repo", "\"", "argument" ]
def repo(parser): subparser = parser.add_parser( "repo", help="Manage sonar repos", add_help=False ) subsubparser = subparser.add_subparsers( title="Commands", metavar="command" ) def add(): command = subsubparser.add_parser( "add", help="Add the repo ...
[ "def", "repo", "(", "parser", ")", ":", "subparser", "=", "parser", ".", "add_parser", "(", "\"repo\"", ",", "help", "=", "\"Manage sonar repos\"", ",", "add_help", "=", "False", ")", "subsubparser", "=", "subparser", ".", "add_subparsers", "(", "title", "="...
Parse the "repo" argument
[ "Parse", "the", "\"", "repo", "\"", "argument" ]
[ "\"\"\"\n Parse the \"repo\" argument\n\n Args:\n parser (argparse._SubParserAction): The parser object\n \"\"\"", "# def remove():", "# command = subsubparser.add_parser(", "# \"remove\",", "# help=\"Remove an env\",", "# add_help=False,", "# descript...
[ { "param": "parser", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parser", "type": null, "docstring": "The parser object", "docstring_tokens": [ "The", "parser", "object" ], "default": null, "is_optional": false } ], "outlier_params": [], "...
b4f64a01822e6e26c4fe9e42eceb1d912119371d
sharm294/sonar
sonar/cli.py
[ "MIT" ]
Python
create
null
def create(parser): """ Parse the "create" argument Args: parser (argparse._SubParserAction): The parser object """ subparser = parser.add_parser( "create", help="Manipulate the active repo", add_help=False ) subsubparser = subparser.add_subparsers( title="Commands",...
Parse the "create" argument Args: parser (argparse._SubParserAction): The parser object
Parse the "create" argument
[ "Parse", "the", "\"", "create", "\"", "argument" ]
def create(parser): subparser = parser.add_parser( "create", help="Manipulate the active repo", add_help=False ) subsubparser = subparser.add_subparsers( title="Commands", metavar="command" ) def ip(): command = subsubparser.add_parser( "ip", help="Cre...
[ "def", "create", "(", "parser", ")", ":", "subparser", "=", "parser", ".", "add_parser", "(", "\"create\"", ",", "help", "=", "\"Manipulate the active repo\"", ",", "add_help", "=", "False", ")", "subsubparser", "=", "subparser", ".", "add_subparsers", "(", "t...
Parse the "create" argument
[ "Parse", "the", "\"", "create", "\"", "argument" ]
[ "\"\"\"\n Parse the \"create\" argument\n\n Args:\n parser (argparse._SubParserAction): The parser object\n \"\"\"" ]
[ { "param": "parser", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parser", "type": null, "docstring": "The parser object", "docstring_tokens": [ "The", "parser", "object" ], "default": null, "is_optional": false } ], "outlier_params": [], "...
b4f64a01822e6e26c4fe9e42eceb1d912119371d
sharm294/sonar
sonar/cli.py
[ "MIT" ]
Python
add_help
null
def add_help(parser): """ Add generic help message to parsers Args: parser (argparse._SubParserAction): The parser object """ command_group = parser.add_argument_group("Options") command_group.add_argument( "-h", "--help", action="help", help="show this help message and exit" ...
Add generic help message to parsers Args: parser (argparse._SubParserAction): The parser object
Add generic help message to parsers
[ "Add", "generic", "help", "message", "to", "parsers" ]
def add_help(parser): command_group = parser.add_argument_group("Options") command_group.add_argument( "-h", "--help", action="help", help="show this help message and exit" )
[ "def", "add_help", "(", "parser", ")", ":", "command_group", "=", "parser", ".", "add_argument_group", "(", "\"Options\"", ")", "command_group", ".", "add_argument", "(", "\"-h\"", ",", "\"--help\"", ",", "action", "=", "\"help\"", ",", "help", "=", "\"show th...
Add generic help message to parsers
[ "Add", "generic", "help", "message", "to", "parsers" ]
[ "\"\"\"\n Add generic help message to parsers\n\n Args:\n parser (argparse._SubParserAction): The parser object\n \"\"\"" ]
[ { "param": "parser", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parser", "type": null, "docstring": "The parser object", "docstring_tokens": [ "The", "parser", "object" ], "default": null, "is_optional": false } ], "outlier_params": [], "...
b4f64a01822e6e26c4fe9e42eceb1d912119371d
sharm294/sonar
sonar/cli.py
[ "MIT" ]
Python
init
null
def init(parser): """ Parse the "init" argument Args: parser (argparse._SubParserAction): The parser object """ subparser = parser.add_parser("init", help="Initialize sonar") subparser.set_defaults(func=api.Init.one_time_setup) subsubparser = subparser.add_subparsers( title...
Parse the "init" argument Args: parser (argparse._SubParserAction): The parser object
Parse the "init" argument
[ "Parse", "the", "\"", "init", "\"", "argument" ]
def init(parser): subparser = parser.add_parser("init", help="Initialize sonar") subparser.set_defaults(func=api.Init.one_time_setup) subsubparser = subparser.add_subparsers( title="Commands", metavar="command" ) def vivado(): command = subsubparser.add_parser( "vivado", ...
[ "def", "init", "(", "parser", ")", ":", "subparser", "=", "parser", ".", "add_parser", "(", "\"init\"", ",", "help", "=", "\"Initialize sonar\"", ")", "subparser", ".", "set_defaults", "(", "func", "=", "api", ".", "Init", ".", "one_time_setup", ")", "subs...
Parse the "init" argument
[ "Parse", "the", "\"", "init", "\"", "argument" ]
[ "\"\"\"\n Parse the \"init\" argument\n\n Args:\n parser (argparse._SubParserAction): The parser object\n \"\"\"", "# def repo():", "# command = subsubparser.add_parser(", "# \"repo\",", "# help=\"Create a new sonar repository\",", "# add_help=False,", "# ...
[ { "param": "parser", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parser", "type": null, "docstring": "The parser object", "docstring_tokens": [ "The", "parser", "object" ], "default": null, "is_optional": false } ], "outlier_params": [], "...
b4f64a01822e6e26c4fe9e42eceb1d912119371d
sharm294/sonar
sonar/cli.py
[ "MIT" ]
Python
database
null
def database(parser): """ Parse the "database" argument Args: parser (argparse._SubParserAction): The parser object """ subparser = parser.add_parser( "database", help="Manipulate the sonar database", add_help=False ) subsubparser = subparser.add_subparsers( title="C...
Parse the "database" argument Args: parser (argparse._SubParserAction): The parser object
Parse the "database" argument
[ "Parse", "the", "\"", "database", "\"", "argument" ]
def database(parser): subparser = parser.add_parser( "database", help="Manipulate the sonar database", add_help=False ) subsubparser = subparser.add_subparsers( title="Commands", metavar="command" ) def f_list(): command = subsubparser.add_parser( "list", ...
[ "def", "database", "(", "parser", ")", ":", "subparser", "=", "parser", ".", "add_parser", "(", "\"database\"", ",", "help", "=", "\"Manipulate the sonar database\"", ",", "add_help", "=", "False", ")", "subsubparser", "=", "subparser", ".", "add_subparsers", "(...
Parse the "database" argument
[ "Parse", "the", "\"", "database", "\"", "argument" ]
[ "\"\"\"\n Parse the \"database\" argument\n\n Args:\n parser (argparse._SubParserAction): The parser object\n \"\"\"" ]
[ { "param": "parser", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parser", "type": null, "docstring": "The parser object", "docstring_tokens": [ "The", "parser", "object" ], "default": null, "is_optional": false } ], "outlier_params": [], "...
320186811d7b984cc222b1512cb076e794aabd66
sharm294/sonar
sonar/core/backends/common.py
[ "MIT" ]
Python
add_headers
<not_specific>
def add_headers(testbench_config, testbench, lang): """ Add any header files to the testbench Args: testbench_config (Testbench): The testbench configuration testbench (str): The testbench being generated lang (str): Language of the testbench Returns: str: Updated testb...
Add any header files to the testbench Args: testbench_config (Testbench): The testbench configuration testbench (str): The testbench being generated lang (str): Language of the testbench Returns: str: Updated testbench
Add any header files to the testbench
[ "Add", "any", "header", "files", "to", "the", "testbench" ]
def add_headers(testbench_config, testbench, lang): headers = "" if "Headers" in testbench_config.metadata: for header_tuple in testbench_config.metadata["Headers"]: if isinstance(header_tuple, (list, tuple)): header_file = header_tuple[0] header_mode = header...
[ "def", "add_headers", "(", "testbench_config", ",", "testbench", ",", "lang", ")", ":", "headers", "=", "\"\"", "if", "\"Headers\"", "in", "testbench_config", ".", "metadata", ":", "for", "header_tuple", "in", "testbench_config", ".", "metadata", "[", "\"Headers...
Add any header files to the testbench
[ "Add", "any", "header", "files", "to", "the", "testbench" ]
[ "\"\"\"\n Add any header files to the testbench\n\n Args:\n testbench_config (Testbench): The testbench configuration\n testbench (str): The testbench being generated\n lang (str): Language of the testbench\n\n Returns:\n str: Updated testbench\n \"\"\"" ]
[ { "param": "testbench_config", "type": null }, { "param": "testbench", "type": null }, { "param": "lang", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "str" } ], "raises": [], "params": [ { "identifier": "testbench_config", "type": null, "docstring": "The testbench configuration", "docstring_tokens": [ "The", ...
320186811d7b984cc222b1512cb076e794aabd66
sharm294/sonar
sonar/core/backends/common.py
[ "MIT" ]
Python
prologue
<not_specific>
def prologue(testbench_config, testbench, lang): """ Run prior to any language-specific backend Args: testbench_config (Testbench): Testbench configuration testbench (str): Testbench to generate lang (str): Language of the testbench Returns: str: Updated testbench "...
Run prior to any language-specific backend Args: testbench_config (Testbench): Testbench configuration testbench (str): Testbench to generate lang (str): Language of the testbench Returns: str: Updated testbench
Run prior to any language-specific backend
[ "Run", "prior", "to", "any", "language", "-", "specific", "backend" ]
def prologue(testbench_config, testbench, lang): testbench = add_headers(testbench_config, testbench, lang) return testbench
[ "def", "prologue", "(", "testbench_config", ",", "testbench", ",", "lang", ")", ":", "testbench", "=", "add_headers", "(", "testbench_config", ",", "testbench", ",", "lang", ")", "return", "testbench" ]
Run prior to any language-specific backend
[ "Run", "prior", "to", "any", "language", "-", "specific", "backend" ]
[ "\"\"\"\n Run prior to any language-specific backend\n\n Args:\n testbench_config (Testbench): Testbench configuration\n testbench (str): Testbench to generate\n lang (str): Language of the testbench\n\n Returns:\n str: Updated testbench\n \"\"\"" ]
[ { "param": "testbench_config", "type": null }, { "param": "testbench", "type": null }, { "param": "lang", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "str" } ], "raises": [], "params": [ { "identifier": "testbench_config", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default":...
c8687887a6bf91278b1217158bccfa8e6480babc
sharm294/sonar
sonar/main.py
[ "MIT" ]
Python
parse_args
<not_specific>
def parse_args(): """ Defines the command-line argument parser. All the parsing functions are in the CLI module Returns: args: The parsed args """ parser = argparse.ArgumentParser( prog="sonar", description="sonar is a tool to manage and test your hardware projects.", ...
Defines the command-line argument parser. All the parsing functions are in the CLI module Returns: args: The parsed args
Defines the command-line argument parser. All the parsing functions are in the CLI module
[ "Defines", "the", "command", "-", "line", "argument", "parser", ".", "All", "the", "parsing", "functions", "are", "in", "the", "CLI", "module" ]
def parse_args(): parser = argparse.ArgumentParser( prog="sonar", description="sonar is a tool to manage and test your hardware projects.", add_help=False, ) parser.set_defaults(func=lambda x: parser.print_help()) subparser = parser.add_subparsers(title="Commands", metavar="comma...
[ "def", "parse_args", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "\"sonar\"", ",", "description", "=", "\"sonar is a tool to manage and test your hardware projects.\"", ",", "add_help", "=", "False", ",", ")", "parser", ".", ...
Defines the command-line argument parser.
[ "Defines", "the", "command", "-", "line", "argument", "parser", "." ]
[ "\"\"\"\n Defines the command-line argument parser. All the parsing functions are in\n the CLI module\n\n Returns:\n args: The parsed args\n \"\"\"" ]
[]
{ "returns": [ { "docstring": "The parsed args", "docstring_tokens": [ "The", "parsed", "args" ], "type": "args" } ], "raises": [], "params": [], "outlier_params": [], "others": [] }
c8687887a6bf91278b1217158bccfa8e6480babc
sharm294/sonar
sonar/main.py
[ "MIT" ]
Python
main
null
def main(): """ Main CLI usage. Parses the command-line arguments, checks the local database and calls the appropriate CLI function. """ args = parse_args() api.check_database() args.func(args) sys.exit(0)
Main CLI usage. Parses the command-line arguments, checks the local database and calls the appropriate CLI function.
Main CLI usage. Parses the command-line arguments, checks the local database and calls the appropriate CLI function.
[ "Main", "CLI", "usage", ".", "Parses", "the", "command", "-", "line", "arguments", "checks", "the", "local", "database", "and", "calls", "the", "appropriate", "CLI", "function", "." ]
def main(): args = parse_args() api.check_database() args.func(args) sys.exit(0)
[ "def", "main", "(", ")", ":", "args", "=", "parse_args", "(", ")", "api", ".", "check_database", "(", ")", "args", ".", "func", "(", "args", ")", "sys", ".", "exit", "(", "0", ")" ]
Main CLI usage.
[ "Main", "CLI", "usage", "." ]
[ "\"\"\"\n Main CLI usage. Parses the command-line arguments, checks the local database\n and calls the appropriate CLI function.\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
8efa362c8ee67762b6084a6e4e6f429356ab9e61
sharm294/sonar
tests/unit_tests/test_database.py
[ "MIT" ]
Python
mock_config
<not_specific>
def mock_config(_path): """ Load a mock config to override toml.load() Args: path (str): Normally, the path to the TOML is provided Returns: dict: The interpreted TOML file """ return {"project": {"name": "valid"}}
Load a mock config to override toml.load() Args: path (str): Normally, the path to the TOML is provided Returns: dict: The interpreted TOML file
Load a mock config to override toml.load()
[ "Load", "a", "mock", "config", "to", "override", "toml", ".", "load", "()" ]
def mock_config(_path): return {"project": {"name": "valid"}}
[ "def", "mock_config", "(", "_path", ")", ":", "return", "{", "\"project\"", ":", "{", "\"name\"", ":", "\"valid\"", "}", "}" ]
Load a mock config to override toml.load()
[ "Load", "a", "mock", "config", "to", "override", "toml", ".", "load", "()" ]
[ "\"\"\"\n Load a mock config to override toml.load()\n\n Args:\n path (str): Normally, the path to the TOML is provided\n\n Returns:\n dict: The interpreted TOML file\n \"\"\"" ]
[ { "param": "_path", "type": null } ]
{ "returns": [ { "docstring": "The interpreted TOML file", "docstring_tokens": [ "The", "interpreted", "TOML", "file" ], "type": "dict" } ], "raises": [], "params": [ { "identifier": "_path", "type": null, "docstring": null, ...
9955564603e2539552c13f1733617cbeec94a9e2
sharm294/sonar
sonar/layers/base_layer.py
[ "MIT" ]
Python
add_field
null
def add_field(self, name, field): """ Add a field to this layer as part of its header Args: name (str): Name of the field field (Field): The field object """ self.fields[name] = field
Add a field to this layer as part of its header Args: name (str): Name of the field field (Field): The field object
Add a field to this layer as part of its header
[ "Add", "a", "field", "to", "this", "layer", "as", "part", "of", "its", "header" ]
def add_field(self, name, field): self.fields[name] = field
[ "def", "add_field", "(", "self", ",", "name", ",", "field", ")", ":", "self", ".", "fields", "[", "name", "]", "=", "field" ]
Add a field to this layer as part of its header
[ "Add", "a", "field", "to", "this", "layer", "as", "part", "of", "its", "header" ]
[ "\"\"\"\n Add a field to this layer as part of its header\n\n Args:\n name (str): Name of the field\n field (Field): The field object\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "field", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": "Name of the field", "docst...
9955564603e2539552c13f1733617cbeec94a9e2
sharm294/sonar
sonar/layers/base_layer.py
[ "MIT" ]
Python
add_payload
null
def add_payload(self, payload): """ Add payload to this layer. This may be bytes or another Layer Args: payload (bytes or Layer): Data to add as payload """ self.payload = payload
Add payload to this layer. This may be bytes or another Layer Args: payload (bytes or Layer): Data to add as payload
Add payload to this layer. This may be bytes or another Layer
[ "Add", "payload", "to", "this", "layer", ".", "This", "may", "be", "bytes", "or", "another", "Layer" ]
def add_payload(self, payload): self.payload = payload
[ "def", "add_payload", "(", "self", ",", "payload", ")", ":", "self", ".", "payload", "=", "payload" ]
Add payload to this layer.
[ "Add", "payload", "to", "this", "layer", "." ]
[ "\"\"\"\n Add payload to this layer. This may be bytes or another Layer\n\n Args:\n payload (bytes or Layer): Data to add as payload\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "payload", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "payload", "type": null, "docstring": "Data to add as payload", ...
9955564603e2539552c13f1733617cbeec94a9e2
sharm294/sonar
sonar/layers/base_layer.py
[ "MIT" ]
Python
to_bytes
<not_specific>
def to_bytes(self): """ Get the field value as bytes Returns: bytes: Value of the field """ return self.value
Get the field value as bytes Returns: bytes: Value of the field
Get the field value as bytes
[ "Get", "the", "field", "value", "as", "bytes" ]
def to_bytes(self): return self.value
[ "def", "to_bytes", "(", "self", ")", ":", "return", "self", ".", "value" ]
Get the field value as bytes
[ "Get", "the", "field", "value", "as", "bytes" ]
[ "\"\"\"\n Get the field value as bytes\n\n Returns:\n bytes: Value of the field\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Value of the field", "docstring_tokens": [ "Value", "of", "the", "field" ], "type": "bytes" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstrin...
23e7eabd293c86c56d6b0c4bc2cd8b62bf3f3bcd
sharm294/sonar
sonar/interfaces/axi4_stream.py
[ "MIT" ]
Python
init_signals
null
def init_signals(self, mode, data_width, upper_case=True): """ Initialize the signals associated with this AXI4Stream interface. Initialize means to specify the names, types and widths of all the signals. Args: mode (str): Name of a signal preset to use. Options are: ...
Initialize the signals associated with this AXI4Stream interface. Initialize means to specify the names, types and widths of all the signals. Args: mode (str): Name of a signal preset to use. Options are: 'default': tdata, tvalid, tready, tlast 'tkee...
Initialize the signals associated with this AXI4Stream interface. Initialize means to specify the names, types and widths of all the signals.
[ "Initialize", "the", "signals", "associated", "with", "this", "AXI4Stream", "interface", ".", "Initialize", "means", "to", "specify", "the", "names", "types", "and", "widths", "of", "all", "the", "signals", "." ]
def init_signals(self, mode, data_width, upper_case=True): if mode == "default": signals = { "tdata": sonar.base_types.Signal("tdata", data_width), "tvalid": sonar.base_types.Signal("tvalid", 1), "tready": sonar.base_types.Signal("tready", 1), ...
[ "def", "init_signals", "(", "self", ",", "mode", ",", "data_width", ",", "upper_case", "=", "True", ")", ":", "if", "mode", "==", "\"default\"", ":", "signals", "=", "{", "\"tdata\"", ":", "sonar", ".", "base_types", ".", "Signal", "(", "\"tdata\"", ",",...
Initialize the signals associated with this AXI4Stream interface.
[ "Initialize", "the", "signals", "associated", "with", "this", "AXI4Stream", "interface", "." ]
[ "\"\"\"\n Initialize the signals associated with this AXI4Stream interface. Initialize\n means to specify the names, types and widths of all the signals.\n\n Args:\n mode (str): Name of a signal preset to use. Options are:\n 'default': tdata, tvalid, tready, tlast\n ...
[ { "param": "self", "type": null }, { "param": "mode", "type": null }, { "param": "data_width", "type": null }, { "param": "upper_case", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mode", "type": null, "docstring": "Name of a signal preset to use. ...
23e7eabd293c86c56d6b0c4bc2cd8b62bf3f3bcd
sharm294/sonar
sonar/interfaces/axi4_stream.py
[ "MIT" ]
Python
add_endpoint
null
def add_endpoint(self, endpoint, **kwargs): """ Add an endpoint to the AXI4-Stream interface Args: endpoint (str): Identifier for the endpoint kwargs (?): Keyworded arguments for the endpoint """ endpoint_obj = None if endpoint == "manual": ...
Add an endpoint to the AXI4-Stream interface Args: endpoint (str): Identifier for the endpoint kwargs (?): Keyworded arguments for the endpoint
Add an endpoint to the AXI4-Stream interface
[ "Add", "an", "endpoint", "to", "the", "AXI4", "-", "Stream", "interface" ]
def add_endpoint(self, endpoint, **kwargs): endpoint_obj = None if endpoint == "manual": if self.direction == "master": endpoint_obj = EndpointManualSlave else: endpoint_obj = EndpointManualMaster elif endpoint == "variable" and self.direct...
[ "def", "add_endpoint", "(", "self", ",", "endpoint", ",", "**", "kwargs", ")", ":", "endpoint_obj", "=", "None", "if", "endpoint", "==", "\"manual\"", ":", "if", "self", ".", "direction", "==", "\"master\"", ":", "endpoint_obj", "=", "EndpointManualSlave", "...
Add an endpoint to the AXI4-Stream interface
[ "Add", "an", "endpoint", "to", "the", "AXI4", "-", "Stream", "interface" ]
[ "\"\"\"\n Add an endpoint to the AXI4-Stream interface\n\n Args:\n endpoint (str): Identifier for the endpoint\n kwargs (?): Keyworded arguments for the endpoint\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "endpoint", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "endpoint", "type": null, "docstring": "Identifier for the endpoint"...
23e7eabd293c86c56d6b0c4bc2cd8b62bf3f3bcd
sharm294/sonar
sonar/interfaces/axi4_stream.py
[ "MIT" ]
Python
write
null
def write(self, thread, data, **kwargs): """ Writes the given command to the AXI stream. Args: data (str): Data to write kwargs (str): keyworded arguments where the keyword is the AXI4Stream signal or special keyword and is assigned to the ...
Writes the given command to the AXI stream. Args: data (str): Data to write kwargs (str): keyworded arguments where the keyword is the AXI4Stream signal or special keyword and is assigned to the given value
Writes the given command to the AXI stream.
[ "Writes", "the", "given", "command", "to", "the", "AXI", "stream", "." ]
def write(self, thread, data, **kwargs): payload_dict = self._payload(tdata=data, **kwargs) payload_arg = [payload_dict] self._write(thread, payload_arg)
[ "def", "write", "(", "self", ",", "thread", ",", "data", ",", "**", "kwargs", ")", ":", "payload_dict", "=", "self", ".", "_payload", "(", "tdata", "=", "data", ",", "**", "kwargs", ")", "payload_arg", "=", "[", "payload_dict", "]", "self", ".", "_wr...
Writes the given command to the AXI stream.
[ "Writes", "the", "given", "command", "to", "the", "AXI", "stream", "." ]
[ "\"\"\"\n Writes the given command to the AXI stream.\n\n Args:\n data (str): Data to write\n kwargs (str): keyworded arguments where the keyword is the\n AXI4Stream signal or special keyword and is assigned to the\n given value\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "thread", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "thread", "type": null, "docstring": null, "docstring_tokens":...
23e7eabd293c86c56d6b0c4bc2cd8b62bf3f3bcd
sharm294/sonar
sonar/interfaces/axi4_stream.py
[ "MIT" ]
Python
_writes
null
def _writes(self, thread, data): """ Writes an array of commands to the AXI stream. This command results in a smaller final file size than using the write command in a loop Args: thread (Thread): The thread to write the commands to data (Iterable): This should be...
Writes an array of commands to the AXI stream. This command results in a smaller final file size than using the write command in a loop Args: thread (Thread): The thread to write the commands to data (Iterable): This should be an iterable of kwargs where the ...
Writes an array of commands to the AXI stream. This command results in a smaller final file size than using the write command in a loop
[ "Writes", "an", "array", "of", "commands", "to", "the", "AXI", "stream", ".", "This", "command", "results", "in", "a", "smaller", "final", "file", "size", "than", "using", "the", "write", "command", "in", "a", "loop" ]
def _writes(self, thread, data): payload_arg = [] for datum in data: payload_dict = self._payload(**datum) payload_arg.append(payload_dict) self._write(thread, payload_arg)
[ "def", "_writes", "(", "self", ",", "thread", ",", "data", ")", ":", "payload_arg", "=", "[", "]", "for", "datum", "in", "data", ":", "payload_dict", "=", "self", ".", "_payload", "(", "**", "datum", ")", "payload_arg", ".", "append", "(", "payload_dic...
Writes an array of commands to the AXI stream.
[ "Writes", "an", "array", "of", "commands", "to", "the", "AXI", "stream", "." ]
[ "\"\"\"\n Writes an array of commands to the AXI stream. This command results in\n a smaller final file size than using the write command in a loop\n\n Args:\n thread (Thread): The thread to write the commands to\n data (Iterable): This should be an iterable of kwargs wher...
[ { "param": "self", "type": null }, { "param": "thread", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "thread", "type": null, "docstring": "The thread to write the comman...
23e7eabd293c86c56d6b0c4bc2cd8b62bf3f3bcd
sharm294/sonar
sonar/interfaces/axi4_stream.py
[ "MIT" ]
Python
writes
null
def writes(self, thread, data): """ Writes an array of commands to the AXI stream. This command results in a smaller final file size than using the write command in a loop Args: thread (Thread): The thread to write the commands to data (Iterable): This should be ...
Writes an array of commands to the AXI stream. This command results in a smaller final file size than using the write command in a loop Args: thread (Thread): The thread to write the commands to data (Iterable): This should be an iterable of kwargs where the ...
Writes an array of commands to the AXI stream. This command results in a smaller final file size than using the write command in a loop
[ "Writes", "an", "array", "of", "commands", "to", "the", "AXI", "stream", ".", "This", "command", "results", "in", "a", "smaller", "final", "file", "size", "than", "using", "the", "write", "command", "in", "a", "loop" ]
def writes(self, thread, data): self._writes(thread, data)
[ "def", "writes", "(", "self", ",", "thread", ",", "data", ")", ":", "self", ".", "_writes", "(", "thread", ",", "data", ")" ]
Writes an array of commands to the AXI stream.
[ "Writes", "an", "array", "of", "commands", "to", "the", "AXI", "stream", "." ]
[ "\"\"\"\n Writes an array of commands to the AXI stream. This command results in\n a smaller final file size than using the write command in a loop\n\n Args:\n thread (Thread): The thread to write the commands to\n data (Iterable): This should be an iterable of kwargs wher...
[ { "param": "self", "type": null }, { "param": "thread", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "thread", "type": null, "docstring": "The thread to write the comman...
23e7eabd293c86c56d6b0c4bc2cd8b62bf3f3bcd
sharm294/sonar
sonar/interfaces/axi4_stream.py
[ "MIT" ]
Python
_write
null
def _write(self, thread, payload): """ Writes the given payload to the AXI4Stream stream. Args: payload (list): Directly assigns a list containing valid transaction dicts to be written Returns: dict: Dictionary representing the data transaction ...
Writes the given payload to the AXI4Stream stream. Args: payload (list): Directly assigns a list containing valid transaction dicts to be written Returns: dict: Dictionary representing the data transaction
Writes the given payload to the AXI4Stream stream.
[ "Writes", "the", "given", "payload", "to", "the", "AXI4Stream", "stream", "." ]
def _write(self, thread, payload): transaction = { "interface": { "type": "axi4_stream", "name": self.name, "iClass": self.iClass, "payload": payload, } } for command in payload: if "endpoint_mode...
[ "def", "_write", "(", "self", ",", "thread", ",", "payload", ")", ":", "transaction", "=", "{", "\"interface\"", ":", "{", "\"type\"", ":", "\"axi4_stream\"", ",", "\"name\"", ":", "self", ".", "name", ",", "\"iClass\"", ":", "self", ".", "iClass", ",", ...
Writes the given payload to the AXI4Stream stream.
[ "Writes", "the", "given", "payload", "to", "the", "AXI4Stream", "stream", "." ]
[ "\"\"\"\n Writes the given payload to the AXI4Stream stream.\n\n Args:\n payload (list): Directly assigns a list containing valid\n transaction dicts to be written\n\n Returns:\n dict: Dictionary representing the data transaction\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "thread", "type": null }, { "param": "payload", "type": null } ]
{ "returns": [ { "docstring": "Dictionary representing the data transaction", "docstring_tokens": [ "Dictionary", "representing", "the", "data", "transaction" ], "type": "dict" } ], "raises": [], "params": [ { "identifier": "self"...
23e7eabd293c86c56d6b0c4bc2cd8b62bf3f3bcd
sharm294/sonar
sonar/interfaces/axi4_stream.py
[ "MIT" ]
Python
_payload
<not_specific>
def _payload(self, existing_payload=None, **kwargs): """ Formats the payload portion of an interface transaction Args: existing_payload (Dict, optional): Defaults to None. If an existing payload is being modified, pass it in. Otherwise an empty one is ...
Formats the payload portion of an interface transaction Args: existing_payload (Dict, optional): Defaults to None. If an existing payload is being modified, pass it in. Otherwise an empty one is created kwargs: Keywords should be AXI4Stream-compl...
Formats the payload portion of an interface transaction
[ "Formats", "the", "payload", "portion", "of", "an", "interface", "transaction" ]
def _payload(self, existing_payload=None, **kwargs): if existing_payload is None: payload_dict = {} else: payload_dict = existing_payload for key, value in kwargs.items(): payload_dict[key] = value if self.has_signal("tkeep") and "tkeep" not in payload...
[ "def", "_payload", "(", "self", ",", "existing_payload", "=", "None", ",", "**", "kwargs", ")", ":", "if", "existing_payload", "is", "None", ":", "payload_dict", "=", "{", "}", "else", ":", "payload_dict", "=", "existing_payload", "for", "key", ",", "value...
Formats the payload portion of an interface transaction
[ "Formats", "the", "payload", "portion", "of", "an", "interface", "transaction" ]
[ "\"\"\"\n Formats the payload portion of an interface transaction\n\n Args:\n existing_payload (Dict, optional): Defaults to None. If an existing\n payload is being modified, pass it in. Otherwise an empty one is\n created\n kwargs: Keywords should b...
[ { "param": "self", "type": null }, { "param": "existing_payload", "type": null } ]
{ "returns": [ { "docstring": "The new payload after the specified kwargs have been added", "docstring_tokens": [ "The", "new", "payload", "after", "the", "specified", "kwargs", "have", "been", "added" ], "type...
23e7eabd293c86c56d6b0c4bc2cd8b62bf3f3bcd
sharm294/sonar
sonar/interfaces/axi4_stream.py
[ "MIT" ]
Python
asdict
<not_specific>
def asdict(self): """ Returns this object as a dictionary Returns: dict: The fields of this object as a dictionary """ tmp = super().asdict() tmp["clock"] = self.clock if self.flit is not None: tmp["flit"] = self.flit if self.iCla...
Returns this object as a dictionary Returns: dict: The fields of this object as a dictionary
Returns this object as a dictionary
[ "Returns", "this", "object", "as", "a", "dictionary" ]
def asdict(self): tmp = super().asdict() tmp["clock"] = self.clock if self.flit is not None: tmp["flit"] = self.flit if self.iClass is not None: tmp["iClass"] = self.iClass return tmp
[ "def", "asdict", "(", "self", ")", ":", "tmp", "=", "super", "(", ")", ".", "asdict", "(", ")", "tmp", "[", "\"clock\"", "]", "=", "self", ".", "clock", "if", "self", ".", "flit", "is", "not", "None", ":", "tmp", "[", "\"flit\"", "]", "=", "sel...
Returns this object as a dictionary
[ "Returns", "this", "object", "as", "a", "dictionary" ]
[ "\"\"\"\n Returns this object as a dictionary\n\n Returns:\n dict: The fields of this object as a dictionary\n \"\"\"", "# tmp[\"connection_mode\"] = self.connection_mode" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "The fields of this object as a dictionary", "docstring_tokens": [ "The", "fields", "of", "this", "object", "as", "a", "dictionary" ], "type": "dict" } ], "raises": [], "params": [ {...
23e7eabd293c86c56d6b0c4bc2cd8b62bf3f3bcd
sharm294/sonar
sonar/interfaces/axi4_stream.py
[ "MIT" ]
Python
wait
null
def wait(self, thread, data, bit_range=None): """ Adds a wait statement to the provided thread for a specific tdata value Args: thread (Thread): The thread to add the wait to data (number): The value of tdata to wait for bit_range (string, optional): Defaults...
Adds a wait statement to the provided thread for a specific tdata value Args: thread (Thread): The thread to add the wait to data (number): The value of tdata to wait for bit_range (string, optional): Defaults to all bits. Range of bits to check in t...
Adds a wait statement to the provided thread for a specific tdata value
[ "Adds", "a", "wait", "statement", "to", "the", "provided", "thread", "for", "a", "specific", "tdata", "value" ]
def wait(self, thread, data, bit_range=None): if bit_range is None: wait_str = "(" + self.name + "_tdata == $value) " else: wait_str = self.name + "_tdata[" + bit_range + "] == $value)" wait_str += " && (" + self.name + "_tvalid == 1'b1)" if self.has_signal("tread...
[ "def", "wait", "(", "self", ",", "thread", ",", "data", ",", "bit_range", "=", "None", ")", ":", "if", "bit_range", "is", "None", ":", "wait_str", "=", "\"(\"", "+", "self", ".", "name", "+", "\"_tdata == $value) \"", "else", ":", "wait_str", "=", "sel...
Adds a wait statement to the provided thread for a specific tdata value
[ "Adds", "a", "wait", "statement", "to", "the", "provided", "thread", "for", "a", "specific", "tdata", "value" ]
[ "\"\"\"\n Adds a wait statement to the provided thread for a specific tdata value\n\n Args:\n thread (Thread): The thread to add the wait to\n data (number): The value of tdata to wait for\n bit_range (string, optional): Defaults to all bits. Range of bits\n ...
[ { "param": "self", "type": null }, { "param": "thread", "type": null }, { "param": "data", "type": null }, { "param": "bit_range", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "thread", "type": null, "docstring": "The thread to add the wait to"...
23e7eabd293c86c56d6b0c4bc2cd8b62bf3f3bcd
sharm294/sonar
sonar/interfaces/axi4_stream.py
[ "MIT" ]
Python
file_to_stream
null
def file_to_stream( self, thread, filepath, parsing_func=None, endian="little" ): """ Converts the provided file into a series of AXI4Stream transactions. Args: thread (Thread): Thread to stream the file in filepath (str): Path to the file to stream ...
Converts the provided file into a series of AXI4Stream transactions. Args: thread (Thread): Thread to stream the file in filepath (str): Path to the file to stream parsing_func (Func, optional): Defaults to None. Function that determines how the file...
Converts the provided file into a series of AXI4Stream transactions.
[ "Converts", "the", "provided", "file", "into", "a", "series", "of", "AXI4Stream", "transactions", "." ]
def file_to_stream( self, thread, filepath, parsing_func=None, endian="little" ): with open(filepath) as f: data = f.read() self.data_to_stream(thread, data, parsing_func, endian)
[ "def", "file_to_stream", "(", "self", ",", "thread", ",", "filepath", ",", "parsing_func", "=", "None", ",", "endian", "=", "\"little\"", ")", ":", "with", "open", "(", "filepath", ")", "as", "f", ":", "data", "=", "f", ".", "read", "(", ")", "self",...
Converts the provided file into a series of AXI4Stream transactions.
[ "Converts", "the", "provided", "file", "into", "a", "series", "of", "AXI4Stream", "transactions", "." ]
[ "\"\"\"\n Converts the provided file into a series of AXI4Stream transactions.\n\n Args:\n thread (Thread): Thread to stream the file in\n filepath (str): Path to the file to stream\n parsing_func (Func, optional): Defaults to None. Function that\n deter...
[ { "param": "self", "type": null }, { "param": "thread", "type": null }, { "param": "filepath", "type": null }, { "param": "parsing_func", "type": null }, { "param": "endian", "type": null } ]
{ "returns": [ { "docstring": "Dictionary representing the data transaction", "docstring_tokens": [ "Dictionary", "representing", "the", "data", "transaction" ], "type": "dict" } ], "raises": [], "params": [ { "identifier": "self"...
23e7eabd293c86c56d6b0c4bc2cd8b62bf3f3bcd
sharm294/sonar
sonar/interfaces/axi4_stream.py
[ "MIT" ]
Python
data_to_stream
null
def data_to_stream(self, thread, data, parsing_func=None, endian="little"): """ Sends the data as a series of AXI4Stream transactions. Args: thread (Thread): Thread to stream the data in data (Any): Data to stream parsing_func (Func, optional): Defaults to No...
Sends the data as a series of AXI4Stream transactions. Args: thread (Thread): Thread to stream the data in data (Any): Data to stream parsing_func (Func, optional): Defaults to None. Function that determines how the data is parsed. Must return a list...
Sends the data as a series of AXI4Stream transactions.
[ "Sends", "the", "data", "as", "a", "series", "of", "AXI4Stream", "transactions", "." ]
def data_to_stream(self, thread, data, parsing_func=None, endian="little"): transactions = [] if parsing_func is None: parsing_func = self._f2s_bin_data transactions = parsing_func(data, endian) self._write(thread, transactions)
[ "def", "data_to_stream", "(", "self", ",", "thread", ",", "data", ",", "parsing_func", "=", "None", ",", "endian", "=", "\"little\"", ")", ":", "transactions", "=", "[", "]", "if", "parsing_func", "is", "None", ":", "parsing_func", "=", "self", ".", "_f2...
Sends the data as a series of AXI4Stream transactions.
[ "Sends", "the", "data", "as", "a", "series", "of", "AXI4Stream", "transactions", "." ]
[ "\"\"\"\n Sends the data as a series of AXI4Stream transactions.\n\n Args:\n thread (Thread): Thread to stream the data in\n data (Any): Data to stream\n parsing_func (Func, optional): Defaults to None. Function that\n determines how the data is parsed. ...
[ { "param": "self", "type": null }, { "param": "thread", "type": null }, { "param": "data", "type": null }, { "param": "parsing_func", "type": null }, { "param": "endian", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "thread", "type": null, "docstring": "Thread to stream the data in",...
23e7eabd293c86c56d6b0c4bc2cd8b62bf3f3bcd
sharm294/sonar
sonar/interfaces/axi4_stream.py
[ "MIT" ]
Python
_f2s_bin_data
<not_specific>
def _f2s_bin_data(self, data_str, endian): """ A file parsing function for file_to_stream. Assumes a binary file that contains only tdata Args: data_str (str): Read data from the file as a string endian (str): little|big Returns: list: Contai...
A file parsing function for file_to_stream. Assumes a binary file that contains only tdata Args: data_str (str): Read data from the file as a string endian (str): little|big Returns: list: Contains dicts representing each beat of AXI4Stream transact...
A file parsing function for file_to_stream. Assumes a binary file that contains only tdata
[ "A", "file", "parsing", "function", "for", "file_to_stream", ".", "Assumes", "a", "binary", "file", "that", "contains", "only", "tdata" ]
def _f2s_bin_data(self, data_str, endian): transactions = [] data = bytearray(data_str) file_size = len(data) beat_count = (ceil(file_size / 8.0)) * 8 beat = 0 tdata_bytes = int(self.get_signal("tdata").size / 8) while beat < beat_count: tdata = 0 ...
[ "def", "_f2s_bin_data", "(", "self", ",", "data_str", ",", "endian", ")", ":", "transactions", "=", "[", "]", "data", "=", "bytearray", "(", "data_str", ")", "file_size", "=", "len", "(", "data", ")", "beat_count", "=", "(", "ceil", "(", "file_size", "...
A file parsing function for file_to_stream.
[ "A", "file", "parsing", "function", "for", "file_to_stream", "." ]
[ "\"\"\"\n A file parsing function for file_to_stream. Assumes a binary file that\n contains only tdata\n\n Args:\n data_str (str): Read data from the file as a string\n endian (str): little|big\n\n Returns:\n list: Contains dicts representing each beat of...
[ { "param": "self", "type": null }, { "param": "data_str", "type": null }, { "param": "endian", "type": null } ]
{ "returns": [ { "docstring": "Contains dicts representing each beat of AXI4Stream transaction", "docstring_tokens": [ "Contains", "dicts", "representing", "each", "beat", "of", "AXI4Stream", "transaction" ], "type": "list" ...
23e7eabd293c86c56d6b0c4bc2cd8b62bf3f3bcd
sharm294/sonar
sonar/interfaces/axi4_stream.py
[ "MIT" ]
Python
_f2s_tkeep
<not_specific>
def _f2s_tkeep(self, file_size, tdata_bytes, beat, endian): """ Calculates tkeep for a particular beat for file_to_stream since the last beat may be smaller than a word. Args: file_size (int): Size of data in bytes to send over tdata tdata_bytes (int): Width of t...
Calculates tkeep for a particular beat for file_to_stream since the last beat may be smaller than a word. Args: file_size (int): Size of data in bytes to send over tdata tdata_bytes (int): Width of tdata in bytes beat (int): Beat counter endian (...
Calculates tkeep for a particular beat for file_to_stream since the last beat may be smaller than a word.
[ "Calculates", "tkeep", "for", "a", "particular", "beat", "for", "file_to_stream", "since", "the", "last", "beat", "may", "be", "smaller", "than", "a", "word", "." ]
def _f2s_tkeep(self, file_size, tdata_bytes, beat, endian): if beat < ((ceil(file_size / 8.0) - 1) * 8.0): tkeep = (2 ** self.get_signal("tkeep").size) - 1 else: size_last_transaction = file_size % tdata_bytes if size_last_transaction != 0: tkeep = "" ...
[ "def", "_f2s_tkeep", "(", "self", ",", "file_size", ",", "tdata_bytes", ",", "beat", ",", "endian", ")", ":", "if", "beat", "<", "(", "(", "ceil", "(", "file_size", "/", "8.0", ")", "-", "1", ")", "*", "8.0", ")", ":", "tkeep", "=", "(", "2", "...
Calculates tkeep for a particular beat for file_to_stream since the last beat may be smaller than a word.
[ "Calculates", "tkeep", "for", "a", "particular", "beat", "for", "file_to_stream", "since", "the", "last", "beat", "may", "be", "smaller", "than", "a", "word", "." ]
[ "\"\"\"\n Calculates tkeep for a particular beat for file_to_stream since the last\n beat may be smaller than a word.\n\n Args:\n file_size (int): Size of data in bytes to send over tdata\n tdata_bytes (int): Width of tdata in bytes\n beat (int): Beat counter\n ...
[ { "param": "self", "type": null }, { "param": "file_size", "type": null }, { "param": "tdata_bytes", "type": null }, { "param": "beat", "type": null }, { "param": "endian", "type": null } ]
{ "returns": [ { "docstring": "Tkeep value for the current beat", "docstring_tokens": [ "Tkeep", "value", "for", "the", "current", "beat" ], "type": "str" } ], "raises": [], "params": [ { "identifier": "self", "type"...
23e7eabd293c86c56d6b0c4bc2cd8b62bf3f3bcd
sharm294/sonar
sonar/interfaces/axi4_stream.py
[ "MIT" ]
Python
_f2s_tlast
<not_specific>
def _f2s_tlast(file_size, beat): """ Calculates tlast for a particular beat for file_to_stream. The last beat must assert tlast Args: file_size (int): Size of data in bytes to send over tdata beat (int): Beat counter Returns: str: Tlast value...
Calculates tlast for a particular beat for file_to_stream. The last beat must assert tlast Args: file_size (int): Size of data in bytes to send over tdata beat (int): Beat counter Returns: str: Tlast value for the current beat
Calculates tlast for a particular beat for file_to_stream. The last beat must assert tlast
[ "Calculates", "tlast", "for", "a", "particular", "beat", "for", "file_to_stream", ".", "The", "last", "beat", "must", "assert", "tlast" ]
def _f2s_tlast(file_size, beat): tlast = 0 if beat >= ((ceil(file_size / 8.0) - 1) * 8): tlast = 1 return tlast
[ "def", "_f2s_tlast", "(", "file_size", ",", "beat", ")", ":", "tlast", "=", "0", "if", "beat", ">=", "(", "(", "ceil", "(", "file_size", "/", "8.0", ")", "-", "1", ")", "*", "8", ")", ":", "tlast", "=", "1", "return", "tlast" ]
Calculates tlast for a particular beat for file_to_stream.
[ "Calculates", "tlast", "for", "a", "particular", "beat", "for", "file_to_stream", "." ]
[ "\"\"\"\n Calculates tlast for a particular beat for file_to_stream. The last beat\n must assert tlast\n\n Args:\n file_size (int): Size of data in bytes to send over tdata\n beat (int): Beat counter\n\n Returns:\n str: Tlast value for the current beat\n ...
[ { "param": "file_size", "type": null }, { "param": "beat", "type": null } ]
{ "returns": [ { "docstring": "Tlast value for the current beat", "docstring_tokens": [ "Tlast", "value", "for", "the", "current", "beat" ], "type": "str" } ], "raises": [], "params": [ { "identifier": "file_size", "...
23e7eabd293c86c56d6b0c4bc2cd8b62bf3f3bcd
sharm294/sonar
sonar/interfaces/axi4_stream.py
[ "MIT" ]
Python
write_cpp
<not_specific>
def write_cpp(cls, packet, _identifier="NULL"): """ Write one line of the C++ data file Args: packet (dict): The command to write Returns: str: The command as a line for the data file """ return super().write_cpp(packet, str(packet["iClass"]))
Write one line of the C++ data file Args: packet (dict): The command to write Returns: str: The command as a line for the data file
Write one line of the C++ data file
[ "Write", "one", "line", "of", "the", "C", "++", "data", "file" ]
def write_cpp(cls, packet, _identifier="NULL"): return super().write_cpp(packet, str(packet["iClass"]))
[ "def", "write_cpp", "(", "cls", ",", "packet", ",", "_identifier", "=", "\"NULL\"", ")", ":", "return", "super", "(", ")", ".", "write_cpp", "(", "packet", ",", "str", "(", "packet", "[", "\"iClass\"", "]", ")", ")" ]
Write one line of the C++ data file
[ "Write", "one", "line", "of", "the", "C", "++", "data", "file" ]
[ "\"\"\"\n Write one line of the C++ data file\n\n Args:\n packet (dict): The command to write\n\n Returns:\n str: The command as a line for the data file\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "packet", "type": null }, { "param": "_identifier", "type": null } ]
{ "returns": [ { "docstring": "The command as a line for the data file", "docstring_tokens": [ "The", "command", "as", "a", "line", "for", "the", "data", "file" ], "type": "str" } ], "raises": [], "params": [...
23e7eabd293c86c56d6b0c4bc2cd8b62bf3f3bcd
sharm294/sonar
sonar/interfaces/axi4_stream.py
[ "MIT" ]
Python
instantiate
<not_specific>
def instantiate(_indent): """ Any modules that this interface instantiates in SV. Args: indent (str): Indentation to add to each line Returns: str: Updated ip_inst """ prologue = textwrap.dedent( """\ always @(posedge $$cl...
Any modules that this interface instantiates in SV. Args: indent (str): Indentation to add to each line Returns: str: Updated ip_inst
Any modules that this interface instantiates in SV.
[ "Any", "modules", "that", "this", "interface", "instantiates", "in", "SV", "." ]
def instantiate(_indent): prologue = textwrap.dedent( """\ always @(posedge $$clock) begin if ($$resetBool) begin $$name_tready_endpoint[$$endpointIndex] <= 0; end else begin $$name_tready_endpoint[$$endpointIndex] <...
[ "def", "instantiate", "(", "_indent", ")", ":", "prologue", "=", "textwrap", ".", "dedent", "(", "\"\"\"\\\n always @(posedge $$clock) begin\n if ($$resetBool) begin\n $$name_tready_endpoint[$$endpointIndex] <= 0;\n end else begin\n...
Any modules that this interface instantiates in SV.
[ "Any", "modules", "that", "this", "interface", "instantiates", "in", "SV", "." ]
[ "\"\"\"\n Any modules that this interface instantiates in SV.\n\n Args:\n indent (str): Indentation to add to each line\n\n Returns:\n str: Updated ip_inst\n \"\"\"" ]
[ { "param": "_indent", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "str" } ], "raises": [], "params": [ { "identifier": "_indent", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": nul...
23e7eabd293c86c56d6b0c4bc2cd8b62bf3f3bcd
sharm294/sonar
sonar/interfaces/axi4_stream.py
[ "MIT" ]
Python
instantiate
<not_specific>
def instantiate(_indent): """ Any modules that this interface instantiates in SV. Args: _indent (str): Indentation to add to each line Returns: str: Updated ip_inst """ prologue = textwrap.dedent( """\ logic [7:0] counter_...
Any modules that this interface instantiates in SV. Args: _indent (str): Indentation to add to each line Returns: str: Updated ip_inst
Any modules that this interface instantiates in SV.
[ "Any", "modules", "that", "this", "interface", "instantiates", "in", "SV", "." ]
def instantiate(_indent): prologue = textwrap.dedent( """\ logic [7:0] counter_$$endpointIndex; always @(posedge $$clock) begin if ($$resetBool) begin $$name_tready_endpoint[$$endpointIndex] <= 0; counter_$$endpointIndex...
[ "def", "instantiate", "(", "_indent", ")", ":", "prologue", "=", "textwrap", ".", "dedent", "(", "\"\"\"\\\n logic [7:0] counter_$$endpointIndex;\n always @(posedge $$clock) begin\n if ($$resetBool) begin\n $$name_tready_endpoint[$$endp...
Any modules that this interface instantiates in SV.
[ "Any", "modules", "that", "this", "interface", "instantiates", "in", "SV", "." ]
[ "\"\"\"\n Any modules that this interface instantiates in SV.\n\n Args:\n _indent (str): Indentation to add to each line\n\n Returns:\n str: Updated ip_inst\n \"\"\"" ]
[ { "param": "_indent", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "str" } ], "raises": [], "params": [ { "identifier": "_indent", "type": null, "docstring": "Indentation to add to each line", "docstring_tokens": [ "Indentation...
6cf20e0cb5040c7a03ac5439c76d23264d39ceb2
sharm294/sonar
sonar/layers/ethernet.py
[ "MIT" ]
Python
stream
null
def stream(self, thread, interface, stream_mode="frame", endian="little"): """ Stream data over an interface as part of a thread Args: thread (Thread): Thread to stream in interface (BaseInterface): An interface that supports streaming stream_mode (str, optio...
Stream data over an interface as part of a thread Args: thread (Thread): Thread to stream in interface (BaseInterface): An interface that supports streaming stream_mode (str, optional): frame|payload. Defaults to "frame". endian (str, optional): little|b...
Stream data over an interface as part of a thread
[ "Stream", "data", "over", "an", "interface", "as", "part", "of", "a", "thread" ]
def stream(self, thread, interface, stream_mode="frame", endian="little"): if stream_mode == "frame": frame = ( self.get_field("mac_dst").value + self.get_field("mac_src").value + self.get_field("ether_type").value + self.payload ...
[ "def", "stream", "(", "self", ",", "thread", ",", "interface", ",", "stream_mode", "=", "\"frame\"", ",", "endian", "=", "\"little\"", ")", ":", "if", "stream_mode", "==", "\"frame\"", ":", "frame", "=", "(", "self", ".", "get_field", "(", "\"mac_dst\"", ...
Stream data over an interface as part of a thread
[ "Stream", "data", "over", "an", "interface", "as", "part", "of", "a", "thread" ]
[ "\"\"\"\n Stream data over an interface as part of a thread\n\n Args:\n thread (Thread): Thread to stream in\n interface (BaseInterface): An interface that supports streaming\n stream_mode (str, optional): frame|payload. Defaults to \"frame\".\n endian (str,...
[ { "param": "self", "type": null }, { "param": "thread", "type": null }, { "param": "interface", "type": null }, { "param": "stream_mode", "type": null }, { "param": "endian", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "thread", "type": null, "docstring": "Thread to stream in", "d...
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
activate
null
def activate(args): """ Activate a particular environment by name. Args: args (object): Holds attributes name (str): Name of the enviroment to activate """ if args.name is not None: Env.activate(args) else: logger.error("Activating environment failed: no name...
Activate a particular environment by name. Args: args (object): Holds attributes name (str): Name of the enviroment to activate
Activate a particular environment by name.
[ "Activate", "a", "particular", "environment", "by", "name", "." ]
def activate(args): if args.name is not None: Env.activate(args) else: logger.error("Activating environment failed: no name specified")
[ "def", "activate", "(", "args", ")", ":", "if", "args", ".", "name", "is", "not", "None", ":", "Env", ".", "activate", "(", "args", ")", "else", ":", "logger", ".", "error", "(", "\"Activating environment failed: no name specified\"", ")" ]
Activate a particular environment by name.
[ "Activate", "a", "particular", "environment", "by", "name", "." ]
[ "\"\"\"\n Activate a particular environment by name.\n\n Args:\n args (object): Holds attributes\n name (str): Name of the enviroment to activate\n \"\"\"" ]
[ { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": "Holds attributes\nname (str): Name of the enviroment to activate", "docstring_tokens": [ "Holds", "attributes", "name", "(", "str", ")", ...
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
activate
null
def activate(args): """ Activate a particular environment by name. Args: args (object): Holds attributes name (str): Name of the enviroment to activate """ try: sonar.database.Env.activate(args.name) except SonarException as exc: ...
Activate a particular environment by name. Args: args (object): Holds attributes name (str): Name of the enviroment to activate
Activate a particular environment by name.
[ "Activate", "a", "particular", "environment", "by", "name", "." ]
def activate(args): try: sonar.database.Env.activate(args.name) except SonarException as exc: logger.error("Activating environment failed: %s", exc.exit_str) sys.exit(exc.exit_code)
[ "def", "activate", "(", "args", ")", ":", "try", ":", "sonar", ".", "database", ".", "Env", ".", "activate", "(", "args", ".", "name", ")", "except", "SonarException", "as", "exc", ":", "logger", ".", "error", "(", "\"Activating environment failed: %s\"", ...
Activate a particular environment by name.
[ "Activate", "a", "particular", "environment", "by", "name", "." ]
[ "\"\"\"\n Activate a particular environment by name.\n\n Args:\n args (object): Holds attributes\n name (str): Name of the enviroment to activate\n \"\"\"" ]
[ { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": "Holds attributes\nname (str): Name of the enviroment to activate", "docstring_tokens": [ "Holds", "attributes", "name", "(", "str", ")", ...
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
add
null
def add(args): """ Add a new environment to the database. Args: args (object): Holds attributes cad (str): CAD tool of the form "name:version" sim (str): Simulation tool of the form "name:version" hls (str): HLS tool of the form "name:...
Add a new environment to the database. Args: args (object): Holds attributes cad (str): CAD tool of the form "name:version" sim (str): Simulation tool of the form "name:version" hls (str): HLS tool of the form "name:version" n...
Add a new environment to the database.
[ "Add", "a", "new", "environment", "to", "the", "database", "." ]
def add(args): cad_tool = args.cad.split(":") sim_tool = args.sim.split(":") hls_tool = args.hls.split(":") sonar.database.Env.add( args.name, cad_tool, hls_tool, sim_tool, args.board, args.repo )
[ "def", "add", "(", "args", ")", ":", "cad_tool", "=", "args", ".", "cad", ".", "split", "(", "\":\"", ")", "sim_tool", "=", "args", ".", "sim", ".", "split", "(", "\":\"", ")", "hls_tool", "=", "args", ".", "hls", ".", "split", "(", "\":\"", ")",...
Add a new environment to the database.
[ "Add", "a", "new", "environment", "to", "the", "database", "." ]
[ "\"\"\"\n Add a new environment to the database.\n\n Args:\n args (object): Holds attributes\n cad (str): CAD tool of the form \"name:version\"\n sim (str): Simulation tool of the form \"name:version\"\n hls (str): HLS tool of the form \"name:ver...
[ { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": "Holds attributes\ncad (str): CAD tool of the form \"name:version\"\nsim (str): Simulation tool of the form \"name:version\"\nhls (str): HLS tool of the form \"name:version\"\nname (str): Name of th...
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
remove
null
def remove(args): """ Remove an environment from the database Args: args (object): Holds attributes name (str): Name of the environment to remove """ sonar.database.Env.remove(args.name)
Remove an environment from the database Args: args (object): Holds attributes name (str): Name of the environment to remove
Remove an environment from the database
[ "Remove", "an", "environment", "from", "the", "database" ]
def remove(args): sonar.database.Env.remove(args.name)
[ "def", "remove", "(", "args", ")", ":", "sonar", ".", "database", ".", "Env", ".", "remove", "(", "args", ".", "name", ")" ]
Remove an environment from the database
[ "Remove", "an", "environment", "from", "the", "database" ]
[ "\"\"\"\n Remove an environment from the database\n\n Args:\n args (object): Holds attributes\n name (str): Name of the environment to remove\n \"\"\"" ]
[ { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": "Holds attributes\nname (str): Name of the environment to remove", "docstring_tokens": [ "Holds", "attributes", "name", "(", "str", ")", ...
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
f_list
null
def f_list(_args): """ List the environments in the database Args: _args (object): Unused """ env = sonar.database.Env.get() pprint.pprint(env)
List the environments in the database Args: _args (object): Unused
List the environments in the database
[ "List", "the", "environments", "in", "the", "database" ]
def f_list(_args): env = sonar.database.Env.get() pprint.pprint(env)
[ "def", "f_list", "(", "_args", ")", ":", "env", "=", "sonar", ".", "database", ".", "Env", ".", "get", "(", ")", "pprint", ".", "pprint", "(", "env", ")" ]
List the environments in the database
[ "List", "the", "environments", "in", "the", "database" ]
[ "\"\"\"\n List the environments in the database\n\n Args:\n _args (object): Unused\n \"\"\"" ]
[ { "param": "_args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "_args", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is_optional": false } ], "outlier_params": [], "others": [] }
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
clear
null
def clear(_args): """ Clear all environments in the database Args: _args (object): Unused """ sonar.database.Env.clear()
Clear all environments in the database Args: _args (object): Unused
Clear all environments in the database
[ "Clear", "all", "environments", "in", "the", "database" ]
def clear(_args): sonar.database.Env.clear()
[ "def", "clear", "(", "_args", ")", ":", "sonar", ".", "database", ".", "Env", ".", "clear", "(", ")" ]
Clear all environments in the database
[ "Clear", "all", "environments", "in", "the", "database" ]
[ "\"\"\"\n Clear all environments in the database\n\n Args:\n _args (object): Unused\n \"\"\"" ]
[ { "param": "_args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "_args", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is_optional": false } ], "outlier_params": [], "others": [] }
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
add
null
def add(args): """ Add a new tool to the database. Args: args (object): Holds attributes name (str): Name of tool version (str): Version of tool cad (str): Name of CAD executable hls (str): Name of HLS executable ...
Add a new tool to the database. Args: args (object): Holds attributes name (str): Name of tool version (str): Version of tool cad (str): Name of CAD executable hls (str): Name of HLS executable sim (str): Name ...
Add a new tool to the database.
[ "Add", "a", "new", "tool", "to", "the", "database", "." ]
def add(args): try: sonar.database.Tool.add( args.name, args.version, args.cad, args.hls, args.sim, args.script, ) except SonarException as exc: logger.exception( ...
[ "def", "add", "(", "args", ")", ":", "try", ":", "sonar", ".", "database", ".", "Tool", ".", "add", "(", "args", ".", "name", ",", "args", ".", "version", ",", "args", ".", "cad", ",", "args", ".", "hls", ",", "args", ".", "sim", ",", "args", ...
Add a new tool to the database.
[ "Add", "a", "new", "tool", "to", "the", "database", "." ]
[ "\"\"\"\n Add a new tool to the database.\n\n Args:\n args (object): Holds attributes\n name (str): Name of tool\n version (str): Version of tool\n cad (str): Name of CAD executable\n hls (str): Name of HLS executable\n ...
[ { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": "Holds attributes\nname (str): Name of tool\nversion (str): Version of tool\ncad (str): Name of CAD executable\nhls (str): Name of HLS executable\nsim (str): Name of simulation executable\nscript (s...
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
f_list
null
def f_list(_args): """ List the tools in the sonar database Args: _args (object): Unused """ tools = sonar.database.Tool.get() pprint.pprint(tools)
List the tools in the sonar database Args: _args (object): Unused
List the tools in the sonar database
[ "List", "the", "tools", "in", "the", "sonar", "database" ]
def f_list(_args): tools = sonar.database.Tool.get() pprint.pprint(tools)
[ "def", "f_list", "(", "_args", ")", ":", "tools", "=", "sonar", ".", "database", ".", "Tool", ".", "get", "(", ")", "pprint", ".", "pprint", "(", "tools", ")" ]
List the tools in the sonar database
[ "List", "the", "tools", "in", "the", "sonar", "database" ]
[ "\"\"\"\n List the tools in the sonar database\n\n Args:\n _args (object): Unused\n \"\"\"" ]
[ { "param": "_args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "_args", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is_optional": false } ], "outlier_params": [], "others": [] }
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
add
null
def add(args): """ Add a new board to sonar database Args: args (object): Holds attributes path (str): Path to the board definition """ sonar.database.Board.add(args.path)
Add a new board to sonar database Args: args (object): Holds attributes path (str): Path to the board definition
Add a new board to sonar database
[ "Add", "a", "new", "board", "to", "sonar", "database" ]
def add(args): sonar.database.Board.add(args.path)
[ "def", "add", "(", "args", ")", ":", "sonar", ".", "database", ".", "Board", ".", "add", "(", "args", ".", "path", ")" ]
Add a new board to sonar database
[ "Add", "a", "new", "board", "to", "sonar", "database" ]
[ "\"\"\"\n Add a new board to sonar database\n\n Args:\n args (object): Holds attributes\n path (str): Path to the board definition\n \"\"\"" ]
[ { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": "Holds attributes\npath (str): Path to the board definition", "docstring_tokens": [ "Holds", "attributes", "path", "(", "str", ")", ":",...
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
remove
null
def remove(args): """ Remove a board from the sonar database Args: args (object): Holds attributes name (str): Name of board to remove """ sonar.database.Board.remove(args.name)
Remove a board from the sonar database Args: args (object): Holds attributes name (str): Name of board to remove
Remove a board from the sonar database
[ "Remove", "a", "board", "from", "the", "sonar", "database" ]
def remove(args): sonar.database.Board.remove(args.name)
[ "def", "remove", "(", "args", ")", ":", "sonar", ".", "database", ".", "Board", ".", "remove", "(", "args", ".", "name", ")" ]
Remove a board from the sonar database
[ "Remove", "a", "board", "from", "the", "sonar", "database" ]
[ "\"\"\"\n Remove a board from the sonar database\n\n Args:\n args (object): Holds attributes\n name (str): Name of board to remove\n \"\"\"" ]
[ { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": "Holds attributes\nname (str): Name of board to remove", "docstring_tokens": [ "Holds", "attributes", "name", "(", "str", ")", ":", ...
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
show
null
def show(args): """ Print a particular board by name Args: args (object): Holds attributes name (str): Name of board to show """ board = sonar.database.Board.get(args.name) pprint.pprint(board)
Print a particular board by name Args: args (object): Holds attributes name (str): Name of board to show
Print a particular board by name
[ "Print", "a", "particular", "board", "by", "name" ]
def show(args): board = sonar.database.Board.get(args.name) pprint.pprint(board)
[ "def", "show", "(", "args", ")", ":", "board", "=", "sonar", ".", "database", ".", "Board", ".", "get", "(", "args", ".", "name", ")", "pprint", ".", "pprint", "(", "board", ")" ]
Print a particular board by name
[ "Print", "a", "particular", "board", "by", "name" ]
[ "\"\"\"\n Print a particular board by name\n\n Args:\n args (object): Holds attributes\n name (str): Name of board to show\n \"\"\"" ]
[ { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": "Holds attributes\nname (str): Name of board to show", "docstring_tokens": [ "Holds", "attributes", "name", "(", "str", ")", ":", ...
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
clear
null
def clear(_args): """ Remove all boards from the sonar database Args: _args (object): Unused """ sonar.database.Board.clear()
Remove all boards from the sonar database Args: _args (object): Unused
Remove all boards from the sonar database
[ "Remove", "all", "boards", "from", "the", "sonar", "database" ]
def clear(_args): sonar.database.Board.clear()
[ "def", "clear", "(", "_args", ")", ":", "sonar", ".", "database", ".", "Board", ".", "clear", "(", ")" ]
Remove all boards from the sonar database
[ "Remove", "all", "boards", "from", "the", "sonar", "database" ]
[ "\"\"\"\n Remove all boards from the sonar database\n\n Args:\n _args (object): Unused\n \"\"\"" ]
[ { "param": "_args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "_args", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is_optional": false } ], "outlier_params": [], "others": [] }
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
f_list
null
def f_list(_args): """ List the active board and all boards in the sonar database Args: _args (object): Holds attributes """ active_board = sonar.database.Board.get_active() print(f"Active board: {active_board}") print("Available boards:") bo...
List the active board and all boards in the sonar database Args: _args (object): Holds attributes
List the active board and all boards in the sonar database
[ "List", "the", "active", "board", "and", "all", "boards", "in", "the", "sonar", "database" ]
def f_list(_args): active_board = sonar.database.Board.get_active() print(f"Active board: {active_board}") print("Available boards:") boards = sonar.database.Board.get() for board in boards: print(" " + board)
[ "def", "f_list", "(", "_args", ")", ":", "active_board", "=", "sonar", ".", "database", ".", "Board", ".", "get_active", "(", ")", "print", "(", "f\"Active board: {active_board}\"", ")", "print", "(", "\"Available boards:\"", ")", "boards", "=", "sonar", ".", ...
List the active board and all boards in the sonar database
[ "List", "the", "active", "board", "and", "all", "boards", "in", "the", "sonar", "database" ]
[ "\"\"\"\n List the active board and all boards in the sonar database\n\n Args:\n _args (object): Holds attributes\n \"\"\"" ]
[ { "param": "_args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "_args", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is_optional": false } ], "outlier_params": [], "others": [] }
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
one_time_setup
null
def one_time_setup(_args): """ Performs initial setup for sonar. It creates the database, copies files over to the user sonar directory and adds the default boards to the database. Args: _args (object): Unused """ sonar.database.init() src_di...
Performs initial setup for sonar. It creates the database, copies files over to the user sonar directory and adds the default boards to the database. Args: _args (object): Unused
Performs initial setup for sonar. It creates the database, copies files over to the user sonar directory and adds the default boards to the database.
[ "Performs", "initial", "setup", "for", "sonar", ".", "It", "creates", "the", "database", "copies", "files", "over", "to", "the", "user", "sonar", "directory", "and", "adds", "the", "default", "boards", "to", "the", "database", "." ]
def one_time_setup(_args): sonar.database.init() src_dir = os.path.join(os.path.dirname(__file__), "files_to_copy/home") copy_tree(src_dir, str(Constants.SONAR_PATH)) with open(Path.home().joinpath(".bashrc"), "r+") as f: for line in f: if "# added by sonar" i...
[ "def", "one_time_setup", "(", "_args", ")", ":", "sonar", ".", "database", ".", "init", "(", ")", "src_dir", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "\"files_to_copy/home\"", ")", "copy_tr...
Performs initial setup for sonar.
[ "Performs", "initial", "setup", "for", "sonar", "." ]
[ "\"\"\"\n Performs initial setup for sonar. It creates the database, copies files\n over to the user sonar directory and adds the default boards to the\n database.\n\n Args:\n _args (object): Unused\n \"\"\"", "# dst_dir = os.path.join(Constants.SONAR_PATH)", "# nee...
[ { "param": "_args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "_args", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is_optional": false } ], "outlier_params": [], "others": [] }
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
vivado
null
def vivado(args): """ Helper function to initialize Xilinx tools Args: args (object): Holds attributes path (str): Path to the Xilinx directory containing Vivado """ xilinx_path = os.path.abspath(args.path) if not os.path.exists(xilinx_path): ...
Helper function to initialize Xilinx tools Args: args (object): Holds attributes path (str): Path to the Xilinx directory containing Vivado
Helper function to initialize Xilinx tools
[ "Helper", "function", "to", "initialize", "Xilinx", "tools" ]
def vivado(args): xilinx_path = os.path.abspath(args.path) if not os.path.exists(xilinx_path): logger.error("Path does not exist: %s", xilinx_path) sys.exit(ReturnValue.SONAR_NONEXISTENT_PATH) vivado_path = os.path.join(xilinx_path, "Vivado") try: viva...
[ "def", "vivado", "(", "args", ")", ":", "xilinx_path", "=", "os", ".", "path", ".", "abspath", "(", "args", ".", "path", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "xilinx_path", ")", ":", "logger", ".", "error", "(", "\"Path does not e...
Helper function to initialize Xilinx tools
[ "Helper", "function", "to", "initialize", "Xilinx", "tools" ]
[ "\"\"\"\n Helper function to initialize Xilinx tools\n\n Args:\n args (object): Holds attributes\n path (str): Path to the Xilinx directory containing Vivado\n \"\"\"", "# \"ID\": f\"vivado_{version}\"," ]
[ { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": "Holds attributes\npath (str): Path to the Xilinx directory containing Vivado", "docstring_tokens": [ "Holds", "attributes", "path", "(", "str", ...
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
add
null
def add(_args): """ Add a new repository to the database Args: _args (object): Unused """ sonar.database.Repo.add()
Add a new repository to the database Args: _args (object): Unused
Add a new repository to the database
[ "Add", "a", "new", "repository", "to", "the", "database" ]
def add(_args): sonar.database.Repo.add()
[ "def", "add", "(", "_args", ")", ":", "sonar", ".", "database", ".", "Repo", ".", "add", "(", ")" ]
Add a new repository to the database
[ "Add", "a", "new", "repository", "to", "the", "database" ]
[ "\"\"\"\n Add a new repository to the database\n\n Args:\n _args (object): Unused\n \"\"\"" ]
[ { "param": "_args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "_args", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is_optional": false } ], "outlier_params": [], "others": [] }
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
f_list
null
def f_list(_args): """ List all the repositories in the database Args: _args (object): Unused """ repo = sonar.database.Repo.get() pprint.pprint(repo)
List all the repositories in the database Args: _args (object): Unused
List all the repositories in the database
[ "List", "all", "the", "repositories", "in", "the", "database" ]
def f_list(_args): repo = sonar.database.Repo.get() pprint.pprint(repo)
[ "def", "f_list", "(", "_args", ")", ":", "repo", "=", "sonar", ".", "database", ".", "Repo", ".", "get", "(", ")", "pprint", ".", "pprint", "(", "repo", ")" ]
List all the repositories in the database
[ "List", "all", "the", "repositories", "in", "the", "database" ]
[ "\"\"\"\n List all the repositories in the database\n\n Args:\n _args (object): Unused\n \"\"\"" ]
[ { "param": "_args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "_args", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is_optional": false } ], "outlier_params": [], "others": [] }
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
clear
null
def clear(_args): """ Clear the list of repositories in the database Args: _args (object): Unused """ # TODO accept an argument to remove a particular one sonar.database.Repo.clear()
Clear the list of repositories in the database Args: _args (object): Unused
Clear the list of repositories in the database
[ "Clear", "the", "list", "of", "repositories", "in", "the", "database" ]
def clear(_args): sonar.database.Repo.clear()
[ "def", "clear", "(", "_args", ")", ":", "sonar", ".", "database", ".", "Repo", ".", "clear", "(", ")" ]
Clear the list of repositories in the database
[ "Clear", "the", "list", "of", "repositories", "in", "the", "database" ]
[ "\"\"\"\n Clear the list of repositories in the database\n\n Args:\n _args (object): Unused\n \"\"\"", "# TODO accept an argument to remove a particular one" ]
[ { "param": "_args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "_args", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is_optional": false } ], "outlier_params": [], "others": [] }
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
ip
null
def ip(args): """ Create a new sonar IP in the current working directory. Args: args (object): Should have "name" attribute """ curr_dir = Path(os.getcwd()) ip_dir = curr_dir.joinpath(args.name) ip_dir.mkdir() ip_dir.joinpath("build/bin").mk...
Create a new sonar IP in the current working directory. Args: args (object): Should have "name" attribute
Create a new sonar IP in the current working directory.
[ "Create", "a", "new", "sonar", "IP", "in", "the", "current", "working", "directory", "." ]
def ip(args): curr_dir = Path(os.getcwd()) ip_dir = curr_dir.joinpath(args.name) ip_dir.mkdir() ip_dir.joinpath("build/bin").mkdir(parents=True) ip_dir.joinpath("include").mkdir() ip_dir.joinpath("src").mkdir() ip_dir.joinpath("testbench/build/bin").mkdir(parents=...
[ "def", "ip", "(", "args", ")", ":", "curr_dir", "=", "Path", "(", "os", ".", "getcwd", "(", ")", ")", "ip_dir", "=", "curr_dir", ".", "joinpath", "(", "args", ".", "name", ")", "ip_dir", ".", "mkdir", "(", ")", "ip_dir", ".", "joinpath", "(", "\"...
Create a new sonar IP in the current working directory.
[ "Create", "a", "new", "sonar", "IP", "in", "the", "current", "working", "directory", "." ]
[ "\"\"\"\n Create a new sonar IP in the current working directory.\n\n Args:\n args (object): Should have \"name\" attribute\n \"\"\"", "# ip_makefile.add_ip_variables(str(ip_dir))", "# active_repo = sonar.database.Repo.get_active()", "# repos = sonar.database.Repo.get()", "# ...
[ { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": "Should have \"name\" attribute", "docstring_tokens": [ "Should", "have", "\"", "name", "\"", "attribute" ], "default": null, ...
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
repo
null
def repo(args): """ Create a new sonar repo in the current working directory. Args: args (object): Should have "name" attribute """ curr_dir = Path(os.getcwd()) repo_dir = curr_dir.joinpath(args.name) repo_dir.mkdir() src_dir = os.path.join(...
Create a new sonar repo in the current working directory. Args: args (object): Should have "name" attribute
Create a new sonar repo in the current working directory.
[ "Create", "a", "new", "sonar", "repo", "in", "the", "current", "working", "directory", "." ]
def repo(args): curr_dir = Path(os.getcwd()) repo_dir = curr_dir.joinpath(args.name) repo_dir.mkdir() src_dir = os.path.join( os.path.dirname(__file__), "files_to_copy/repo/.sonar" ) sonar_dir = repo_dir.joinpath(".sonar") shutil.copytree( ...
[ "def", "repo", "(", "args", ")", ":", "curr_dir", "=", "Path", "(", "os", ".", "getcwd", "(", ")", ")", "repo_dir", "=", "curr_dir", ".", "joinpath", "(", "args", ".", "name", ")", "repo_dir", ".", "mkdir", "(", ")", "src_dir", "=", "os", ".", "p...
Create a new sonar repo in the current working directory.
[ "Create", "a", "new", "sonar", "repo", "in", "the", "current", "working", "directory", "." ]
[ "\"\"\"\n Create a new sonar repo in the current working directory.\n\n Args:\n args (object): Should have \"name\" attribute\n \"\"\"" ]
[ { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": "Should have \"name\" attribute", "docstring_tokens": [ "Should", "have", "\"", "name", "\"", "attribute" ], "default": null, ...
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
f_list
null
def f_list(_args=None): """ Print the database to stdout. Args: _args (object): unused """ sonar.database.print_db()
Print the database to stdout. Args: _args (object): unused
Print the database to stdout.
[ "Print", "the", "database", "to", "stdout", "." ]
def f_list(_args=None): sonar.database.print_db()
[ "def", "f_list", "(", "_args", "=", "None", ")", ":", "sonar", ".", "database", ".", "print_db", "(", ")" ]
Print the database to stdout.
[ "Print", "the", "database", "to", "stdout", "." ]
[ "\"\"\"\n Print the database to stdout.\n\n Args:\n _args (object): unused\n \"\"\"" ]
[ { "param": "_args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "_args", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is_optional": false } ], "outlier_params": [], "others": [] }
b76cabea295eff823b2fc5274ffee09d6642a6ab
sharm294/sonar
sonar/api.py
[ "MIT" ]
Python
check_database
null
def check_database(): """ Checks to see if the sonar database exists. If it does not, performs the setup to initialize the database. """ if not sonar.database.check_database(): Init.one_time_setup(None)
Checks to see if the sonar database exists. If it does not, performs the setup to initialize the database.
Checks to see if the sonar database exists. If it does not, performs the setup to initialize the database.
[ "Checks", "to", "see", "if", "the", "sonar", "database", "exists", ".", "If", "it", "does", "not", "performs", "the", "setup", "to", "initialize", "the", "database", "." ]
def check_database(): if not sonar.database.check_database(): Init.one_time_setup(None)
[ "def", "check_database", "(", ")", ":", "if", "not", "sonar", ".", "database", ".", "check_database", "(", ")", ":", "Init", ".", "one_time_setup", "(", "None", ")" ]
Checks to see if the sonar database exists.
[ "Checks", "to", "see", "if", "the", "sonar", "database", "exists", "." ]
[ "\"\"\"\n Checks to see if the sonar database exists. If it does not, performs the\n setup to initialize the database.\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
ecda1e448e9814a6dd27d274e93060eaff5ebd95
sharm294/sonar
sonar/make.py
[ "MIT" ]
Python
ip
<not_specific>
def ip(self, ip_dir): """ Add the IP-related variables and targets to the Makefile Args: ip_dir (str): Path to the IP directory Returns: str: Text to be added to the Makefile """ self._add_ip_variables(ip_dir) self._add_obj_deps() ...
Add the IP-related variables and targets to the Makefile Args: ip_dir (str): Path to the IP directory Returns: str: Text to be added to the Makefile
Add the IP-related variables and targets to the Makefile
[ "Add", "the", "IP", "-", "related", "variables", "and", "targets", "to", "the", "Makefile" ]
def ip(self, ip_dir): self._add_ip_variables(ip_dir) self._add_obj_deps() self._add_src_objs() self._add_ip_phony() return str(self)
[ "def", "ip", "(", "self", ",", "ip_dir", ")", ":", "self", ".", "_add_ip_variables", "(", "ip_dir", ")", "self", ".", "_add_obj_deps", "(", ")", "self", ".", "_add_src_objs", "(", ")", "self", ".", "_add_ip_phony", "(", ")", "return", "str", "(", "self...
Add the IP-related variables and targets to the Makefile
[ "Add", "the", "IP", "-", "related", "variables", "and", "targets", "to", "the", "Makefile" ]
[ "\"\"\"\n Add the IP-related variables and targets to the Makefile\n\n Args:\n ip_dir (str): Path to the IP directory\n\n Returns:\n str: Text to be added to the Makefile\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "ip_dir", "type": null } ]
{ "returns": [ { "docstring": "Text to be added to the Makefile", "docstring_tokens": [ "Text", "to", "be", "added", "to", "the", "Makefile" ], "type": "str" } ], "raises": [], "params": [ { "identifier": "self", ...
894d2ee5cd77a5652bb4ed4a377d5b8cf61f9b0c
sharm294/sonar
setup.py
[ "MIT" ]
Python
read
<not_specific>
def read(filepath): """ Reads the file at the filepath Args: filepath (str): Path to the file to read Returns: str: File contents as a string """ here = os.path.abspath(os.path.dirname(__file__)) with codecs.open(os.path.join(here, filepath), encoding="utf-8") as f: ...
Reads the file at the filepath Args: filepath (str): Path to the file to read Returns: str: File contents as a string
Reads the file at the filepath
[ "Reads", "the", "file", "at", "the", "filepath" ]
def read(filepath): here = os.path.abspath(os.path.dirname(__file__)) with codecs.open(os.path.join(here, filepath), encoding="utf-8") as f: return f.read()
[ "def", "read", "(", "filepath", ")", ":", "here", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "with", "codecs", ".", "open", "(", "os", ".", "path", ".", "join", "(", "here", ",", "...
Reads the file at the filepath
[ "Reads", "the", "file", "at", "the", "filepath" ]
[ "\"\"\"\n Reads the file at the filepath\n\n Args:\n filepath (str): Path to the file to read\n\n Returns:\n str: File contents as a string\n \"\"\"" ]
[ { "param": "filepath", "type": null } ]
{ "returns": [ { "docstring": "File contents as a string", "docstring_tokens": [ "File", "contents", "as", "a", "string" ], "type": "str" } ], "raises": [], "params": [ { "identifier": "filepath", "type": null, "docstr...
4c5971acfa951f27300c166703a2d83565a80ed6
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_1.py
[ "MIT" ]
Python
add_zombie
null
def add_zombie(self, row, col): """ Add zombie to the zombie list """ self._zombie_list.append((row,col))
Add zombie to the zombie list
Add zombie to the zombie list
[ "Add", "zombie", "to", "the", "zombie", "list" ]
def add_zombie(self, row, col): self._zombie_list.append((row,col))
[ "def", "add_zombie", "(", "self", ",", "row", ",", "col", ")", ":", "self", ".", "_zombie_list", ".", "append", "(", "(", "row", ",", "col", ")", ")" ]
Add zombie to the zombie list
[ "Add", "zombie", "to", "the", "zombie", "list" ]
[ "\"\"\"\r\n Add zombie to the zombie list\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "row", "type": null }, { "param": "col", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "row", "type": null, "docstring": null, "docstring_tokens": []...
4c5971acfa951f27300c166703a2d83565a80ed6
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_1.py
[ "MIT" ]
Python
zombies
null
def zombies(self): """ Generator that yields the zombies in the order they were added. """ for item in self._zombie_list: yield item
Generator that yields the zombies in the order they were added.
Generator that yields the zombies in the order they were added.
[ "Generator", "that", "yields", "the", "zombies", "in", "the", "order", "they", "were", "added", "." ]
def zombies(self): for item in self._zombie_list: yield item
[ "def", "zombies", "(", "self", ")", ":", "for", "item", "in", "self", ".", "_zombie_list", ":", "yield", "item" ]
Generator that yields the zombies in the order they were added.
[ "Generator", "that", "yields", "the", "zombies", "in", "the", "order", "they", "were", "added", "." ]
[ "\"\"\"\r\n Generator that yields the zombies in the order they were\r\n added.\r\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4c5971acfa951f27300c166703a2d83565a80ed6
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_1.py
[ "MIT" ]
Python
add_human
null
def add_human(self, row, col): """ Add human to the human list """ self._human_list.append((row,col))
Add human to the human list
Add human to the human list
[ "Add", "human", "to", "the", "human", "list" ]
def add_human(self, row, col): self._human_list.append((row,col))
[ "def", "add_human", "(", "self", ",", "row", ",", "col", ")", ":", "self", ".", "_human_list", ".", "append", "(", "(", "row", ",", "col", ")", ")" ]
Add human to the human list
[ "Add", "human", "to", "the", "human", "list" ]
[ "\"\"\"\r\n Add human to the human list\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "row", "type": null }, { "param": "col", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "row", "type": null, "docstring": null, "docstring_tokens": []...
4c5971acfa951f27300c166703a2d83565a80ed6
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_1.py
[ "MIT" ]
Python
humans
null
def humans(self): """ Generator that yields the humans in the order they were added. """ for item in self._human_list: yield item
Generator that yields the humans in the order they were added.
Generator that yields the humans in the order they were added.
[ "Generator", "that", "yields", "the", "humans", "in", "the", "order", "they", "were", "added", "." ]
def humans(self): for item in self._human_list: yield item
[ "def", "humans", "(", "self", ")", ":", "for", "item", "in", "self", ".", "_human_list", ":", "yield", "item" ]
Generator that yields the humans in the order they were added.
[ "Generator", "that", "yields", "the", "humans", "in", "the", "order", "they", "were", "added", "." ]
[ "\"\"\"\r\n Generator that yields the humans in the order they were added.\r\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4c5971acfa951f27300c166703a2d83565a80ed6
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_1.py
[ "MIT" ]
Python
compute_distance_field
<not_specific>
def compute_distance_field(self, entity_type): """ Function computes and returns a 2D distance field Distance at member of entity_list is zero Shortest paths avoid obstacles and use four-way distances """ height = poc_grid.Grid.get_grid_height(self) width =...
Function computes and returns a 2D distance field Distance at member of entity_list is zero Shortest paths avoid obstacles and use four-way distances
Function computes and returns a 2D distance field Distance at member of entity_list is zero Shortest paths avoid obstacles and use four-way distances
[ "Function", "computes", "and", "returns", "a", "2D", "distance", "field", "Distance", "at", "member", "of", "entity_list", "is", "zero", "Shortest", "paths", "avoid", "obstacles", "and", "use", "four", "-", "way", "distances" ]
def compute_distance_field(self, entity_type): height = poc_grid.Grid.get_grid_height(self) width = poc_grid.Grid.get_grid_width(self) visited = poc_grid.Grid(height,width) distance_field = [[width*height for dummy_col in range(width)] for dummy_row in range(heigh...
[ "def", "compute_distance_field", "(", "self", ",", "entity_type", ")", ":", "height", "=", "poc_grid", ".", "Grid", ".", "get_grid_height", "(", "self", ")", "width", "=", "poc_grid", ".", "Grid", ".", "get_grid_width", "(", "self", ")", "visited", "=", "p...
Function computes and returns a 2D distance field Distance at member of entity_list is zero Shortest paths avoid obstacles and use four-way distances
[ "Function", "computes", "and", "returns", "a", "2D", "distance", "field", "Distance", "at", "member", "of", "entity_list", "is", "zero", "Shortest", "paths", "avoid", "obstacles", "and", "use", "four", "-", "way", "distances" ]
[ "\"\"\"\r\n Function computes and returns a 2D distance field\r\n Distance at member of entity_list is zero\r\n Shortest paths avoid obstacles and use four-way distances\r\n \"\"\"", "#print distance_field\r" ]
[ { "param": "self", "type": null }, { "param": "entity_type", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "entity_type", "type": null, "docstring": null, "docstring_tok...
4c5971acfa951f27300c166703a2d83565a80ed6
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_1.py
[ "MIT" ]
Python
move_humans
<not_specific>
def move_humans(self, zombie_distance_field): """ Function that moves humans away from zombies, diagonal moves are allowed """ height = poc_grid.Grid.get_grid_height(self) width = poc_grid.Grid.get_grid_width(self) for idx in range(len(self._human_list)): ...
Function that moves humans away from zombies, diagonal moves are allowed
Function that moves humans away from zombies, diagonal moves are allowed
[ "Function", "that", "moves", "humans", "away", "from", "zombies", "diagonal", "moves", "are", "allowed" ]
def move_humans(self, zombie_distance_field): height = poc_grid.Grid.get_grid_height(self) width = poc_grid.Grid.get_grid_width(self) for idx in range(len(self._human_list)): i_duple = self._human_list[idx] max_dis = i_duple neighbor_cell_list = poc_grid.Grid....
[ "def", "move_humans", "(", "self", ",", "zombie_distance_field", ")", ":", "height", "=", "poc_grid", ".", "Grid", ".", "get_grid_height", "(", "self", ")", "width", "=", "poc_grid", ".", "Grid", ".", "get_grid_width", "(", "self", ")", "for", "idx", "in",...
Function that moves humans away from zombies, diagonal moves are allowed
[ "Function", "that", "moves", "humans", "away", "from", "zombies", "diagonal", "moves", "are", "allowed" ]
[ "\"\"\"\r\n Function that moves humans away from zombies, diagonal moves\r\n are allowed\r\n \"\"\"", "#print max_dis_list\r", "#print my_choice\r" ]
[ { "param": "self", "type": null }, { "param": "zombie_distance_field", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "zombie_distance_field", "type": null, "docstring": null, "doc...
4c5971acfa951f27300c166703a2d83565a80ed6
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_1.py
[ "MIT" ]
Python
move_zombies
null
def move_zombies(self, human_distance_field): """ Function that moves zombies towards humans, no diagonal moves are allowed """ for idx in range(len(self._zombie_list)): i_duple = self._zombie_list[idx] min_dis = i_duple neighbor_cell_l...
Function that moves zombies towards humans, no diagonal moves are allowed
Function that moves zombies towards humans, no diagonal moves are allowed
[ "Function", "that", "moves", "zombies", "towards", "humans", "no", "diagonal", "moves", "are", "allowed" ]
def move_zombies(self, human_distance_field): for idx in range(len(self._zombie_list)): i_duple = self._zombie_list[idx] min_dis = i_duple neighbor_cell_list = poc_grid.Grid.four_neighbors(self,i_duple[0], i_duple[1]) for neighbor_cell in neighbor_cell_list: ...
[ "def", "move_zombies", "(", "self", ",", "human_distance_field", ")", ":", "for", "idx", "in", "range", "(", "len", "(", "self", ".", "_zombie_list", ")", ")", ":", "i_duple", "=", "self", ".", "_zombie_list", "[", "idx", "]", "min_dis", "=", "i_duple", ...
Function that moves zombies towards humans, no diagonal moves are allowed
[ "Function", "that", "moves", "zombies", "towards", "humans", "no", "diagonal", "moves", "are", "allowed" ]
[ "\"\"\"\r\n Function that moves zombies towards humans, no diagonal moves\r\n are allowed\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "human_distance_field", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "human_distance_field", "type": null, "docstring": null, "docs...
e5ced33cd52f4acf87a5819822960c763cb98080
Arthur-Lanc/coursera
python_data_scien/algorithmic_thinking1/application1.py
[ "MIT" ]
Python
run_trial
<not_specific>
def run_trial(self, num_nodes): """ Conduct num_node trials using by applying random.choice() to the list of node numbers Updates the list of node numbers so that the number of instances of each node number is in the same ratio as the desired probabilities ...
Conduct num_node trials using by applying random.choice() to the list of node numbers Updates the list of node numbers so that the number of instances of each node number is in the same ratio as the desired probabilities Returns: Set of nodes ...
Conduct num_node trials using by applying random.choice() to the list of node numbers Updates the list of node numbers so that the number of instances of each node number is in the same ratio as the desired probabilities
[ "Conduct", "num_node", "trials", "using", "by", "applying", "random", ".", "choice", "()", "to", "the", "list", "of", "node", "numbers", "Updates", "the", "list", "of", "node", "numbers", "so", "that", "the", "number", "of", "instances", "of", "each", "nod...
def run_trial(self, num_nodes): new_node_neighbors = set() for dummy_idx in range(num_nodes): new_node_neighbors.add(random.choice(self._node_numbers)) self._node_numbers.append(self._num_nodes) self._node_numbers.extend(list(new_node_neighbors)) self._num_nodes += 1 ...
[ "def", "run_trial", "(", "self", ",", "num_nodes", ")", ":", "new_node_neighbors", "=", "set", "(", ")", "for", "dummy_idx", "in", "range", "(", "num_nodes", ")", ":", "new_node_neighbors", ".", "add", "(", "random", ".", "choice", "(", "self", ".", "_no...
Conduct num_node trials using by applying random.choice() to the list of node numbers
[ "Conduct", "num_node", "trials", "using", "by", "applying", "random", ".", "choice", "()", "to", "the", "list", "of", "node", "numbers" ]
[ "\"\"\"\r\n Conduct num_node trials using by applying random.choice()\r\n to the list of node numbers\r\n \r\n Updates the list of node numbers so that the number of instances of\r\n each node number is in the same ratio as the desired probabilities\r\n \r\n Returns:...
[ { "param": "self", "type": null }, { "param": "num_nodes", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
70d2c97724fffdf7ac9acffc7b075844237bb90a
Arthur-Lanc/coursera
python_data_scien/poc2/Tree_class.py
[ "MIT" ]
Python
run_examples
null
def run_examples(): """ Create some trees and apply various methods to these trees """ tree_a = Tree("a", []) tree_b = Tree("b", []) print "Tree consisting of single leaf node labelled 'a'", tree_a print "Tree consisting of single leaf node labelled 'b'", tree_b tree_cab = ...
Create some trees and apply various methods to these trees
Create some trees and apply various methods to these trees
[ "Create", "some", "trees", "and", "apply", "various", "methods", "to", "these", "trees" ]
def run_examples(): tree_a = Tree("a", []) tree_b = Tree("b", []) print "Tree consisting of single leaf node labelled 'a'", tree_a print "Tree consisting of single leaf node labelled 'b'", tree_b tree_cab = Tree("c", [tree_a, tree_b]) print "Tree consisting of three node", tree_cab tree_dcab...
[ "def", "run_examples", "(", ")", ":", "tree_a", "=", "Tree", "(", "\"a\"", ",", "[", "]", ")", "tree_b", "=", "Tree", "(", "\"b\"", ",", "[", "]", ")", "print", "\"Tree consisting of single leaf node labelled 'a'\"", ",", "tree_a", "print", "\"Tree consisting ...
Create some trees and apply various methods to these trees
[ "Create", "some", "trees", "and", "apply", "various", "methods", "to", "these", "trees" ]
[ "\"\"\"\r\n Create some trees and apply various methods to these trees\r\n \"\"\"", "#import poc_draw_tree\r", "#poc_draw_tree.TreeDisplay(my_tree)\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
e829ad886725845e60f4e402bb3dc487be30ef55
Arthur-Lanc/coursera
python_data_scien/poc2/ArithmeticExpression_tree.py
[ "MIT" ]
Python
run_example
null
def run_example(): """ Create and evaluate some examples of arithmetic expressions """ one = ArithmeticExpression("1", []) two = ArithmeticExpression("2", []) three = ArithmeticExpression("3", []) print one print one.evaluate() one_plus_two = ArithmeticExpression("+"...
Create and evaluate some examples of arithmetic expressions
Create and evaluate some examples of arithmetic expressions
[ "Create", "and", "evaluate", "some", "examples", "of", "arithmetic", "expressions" ]
def run_example(): one = ArithmeticExpression("1", []) two = ArithmeticExpression("2", []) three = ArithmeticExpression("3", []) print one print one.evaluate() one_plus_two = ArithmeticExpression("+", [one, two]) print one_plus_two print one_plus_two.evaluate() one_plus_two_times_thr...
[ "def", "run_example", "(", ")", ":", "one", "=", "ArithmeticExpression", "(", "\"1\"", ",", "[", "]", ")", "two", "=", "ArithmeticExpression", "(", "\"2\"", ",", "[", "]", ")", "three", "=", "ArithmeticExpression", "(", "\"3\"", ",", "[", "]", ")", "pr...
Create and evaluate some examples of arithmetic expressions
[ "Create", "and", "evaluate", "some", "examples", "of", "arithmetic", "expressions" ]
[ "\"\"\"\r\n Create and evaluate some examples of arithmetic expressions\r\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
f99c3feee678bfe599be8ff407f70e1f4c7924ed
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_2.py
[ "MIT" ]
Python
remove_duplicates
<not_specific>
def remove_duplicates(list1): """ Eliminate duplicates in a sorted list. Returns a new sorted list with the same elements in list1, but with no duplicates. This function can be iterative. """ result_list = [] for idx in range(len(list1)): if idx == 0: re...
Eliminate duplicates in a sorted list. Returns a new sorted list with the same elements in list1, but with no duplicates. This function can be iterative.
Eliminate duplicates in a sorted list. Returns a new sorted list with the same elements in list1, but with no duplicates. This function can be iterative.
[ "Eliminate", "duplicates", "in", "a", "sorted", "list", ".", "Returns", "a", "new", "sorted", "list", "with", "the", "same", "elements", "in", "list1", "but", "with", "no", "duplicates", ".", "This", "function", "can", "be", "iterative", "." ]
def remove_duplicates(list1): result_list = [] for idx in range(len(list1)): if idx == 0: result_list.append(list1[idx]) else: if list1[idx] == result_list[-1]: pass else: result_list.append(list1[idx]) return result_list
[ "def", "remove_duplicates", "(", "list1", ")", ":", "result_list", "=", "[", "]", "for", "idx", "in", "range", "(", "len", "(", "list1", ")", ")", ":", "if", "idx", "==", "0", ":", "result_list", ".", "append", "(", "list1", "[", "idx", "]", ")", ...
Eliminate duplicates in a sorted list.
[ "Eliminate", "duplicates", "in", "a", "sorted", "list", "." ]
[ "\"\"\"\r\n Eliminate duplicates in a sorted list.\r\n\r\n Returns a new sorted list with the same elements in list1, but\r\n with no duplicates.\r\n\r\n This function can be iterative.\r\n \"\"\"" ]
[ { "param": "list1", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "list1", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f99c3feee678bfe599be8ff407f70e1f4c7924ed
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_2.py
[ "MIT" ]
Python
intersect
<not_specific>
def intersect(list1, list2): """ Compute the intersection of two sorted lists. Returns a new sorted list containing only elements that are in both list1 and list2. This function can be iterative. """ result_list = [] idx1 = 0 idx2 = 0 while idx1 < len(list1) and idx...
Compute the intersection of two sorted lists. Returns a new sorted list containing only elements that are in both list1 and list2. This function can be iterative.
Compute the intersection of two sorted lists. Returns a new sorted list containing only elements that are in both list1 and list2. This function can be iterative.
[ "Compute", "the", "intersection", "of", "two", "sorted", "lists", ".", "Returns", "a", "new", "sorted", "list", "containing", "only", "elements", "that", "are", "in", "both", "list1", "and", "list2", ".", "This", "function", "can", "be", "iterative", "." ]
def intersect(list1, list2): result_list = [] idx1 = 0 idx2 = 0 while idx1 < len(list1) and idx2 < len(list2): if list1[idx1] == list2[idx2]: result_list.append(list1[idx1]) idx1 += 1 idx2 += 1 elif list1[idx1] < list2[idx2]: idx1 += 1 ...
[ "def", "intersect", "(", "list1", ",", "list2", ")", ":", "result_list", "=", "[", "]", "idx1", "=", "0", "idx2", "=", "0", "while", "idx1", "<", "len", "(", "list1", ")", "and", "idx2", "<", "len", "(", "list2", ")", ":", "if", "list1", "[", "...
Compute the intersection of two sorted lists.
[ "Compute", "the", "intersection", "of", "two", "sorted", "lists", "." ]
[ "\"\"\"\r\n Compute the intersection of two sorted lists.\r\n\r\n Returns a new sorted list containing only elements that are in\r\n both list1 and list2.\r\n\r\n This function can be iterative.\r\n \"\"\"" ]
[ { "param": "list1", "type": null }, { "param": "list2", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "list1", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "list2", "type": null, "docstring": null, "docstring_tokens":...
f99c3feee678bfe599be8ff407f70e1f4c7924ed
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_2.py
[ "MIT" ]
Python
merge
<not_specific>
def merge(list1, list2): """ Merge two sorted lists. Returns a new sorted list containing those elements that are in either list1 or list2. This function can be iterative. """ result_list = [] idx1 = 0 idx2 = 0 if len(list1) == 0 and len(list2) == 0: ret...
Merge two sorted lists. Returns a new sorted list containing those elements that are in either list1 or list2. This function can be iterative.
Merge two sorted lists. Returns a new sorted list containing those elements that are in either list1 or list2. This function can be iterative.
[ "Merge", "two", "sorted", "lists", ".", "Returns", "a", "new", "sorted", "list", "containing", "those", "elements", "that", "are", "in", "either", "list1", "or", "list2", ".", "This", "function", "can", "be", "iterative", "." ]
def merge(list1, list2): result_list = [] idx1 = 0 idx2 = 0 if len(list1) == 0 and len(list2) == 0: return [] elif len(list1) != 0 and len(list2) == 0: return list1 elif len(list1) == 0 and len(list2) != 0: return list2 while True: if list1[idx1] == list2[idx2...
[ "def", "merge", "(", "list1", ",", "list2", ")", ":", "result_list", "=", "[", "]", "idx1", "=", "0", "idx2", "=", "0", "if", "len", "(", "list1", ")", "==", "0", "and", "len", "(", "list2", ")", "==", "0", ":", "return", "[", "]", "elif", "l...
Merge two sorted lists.
[ "Merge", "two", "sorted", "lists", "." ]
[ "\"\"\"\r\n Merge two sorted lists.\r\n\r\n Returns a new sorted list containing those elements that are in\r\n either list1 or list2.\r\n\r\n This function can be iterative.\r\n \"\"\"" ]
[ { "param": "list1", "type": null }, { "param": "list2", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "list1", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "list2", "type": null, "docstring": null, "docstring_tokens":...
f99c3feee678bfe599be8ff407f70e1f4c7924ed
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_2.py
[ "MIT" ]
Python
merge_sort
<not_specific>
def merge_sort(list1): """ Sort the elements of list1. Return a new sorted list with the same elements as list1. This function should be recursive. """ if len(list1) == 1: return list1 elif len(list1) == 0: return [] else: part1_list1 = list1[:len(l...
Sort the elements of list1. Return a new sorted list with the same elements as list1. This function should be recursive.
Sort the elements of list1. Return a new sorted list with the same elements as list1. This function should be recursive.
[ "Sort", "the", "elements", "of", "list1", ".", "Return", "a", "new", "sorted", "list", "with", "the", "same", "elements", "as", "list1", ".", "This", "function", "should", "be", "recursive", "." ]
def merge_sort(list1): if len(list1) == 1: return list1 elif len(list1) == 0: return [] else: part1_list1 = list1[:len(list1)/2] part2_list1 = list1[len(list1)/2:] sort1_list1 = merge_sort(part1_list1) sort2_list1 = merge_sort(part2_list1) return merge...
[ "def", "merge_sort", "(", "list1", ")", ":", "if", "len", "(", "list1", ")", "==", "1", ":", "return", "list1", "elif", "len", "(", "list1", ")", "==", "0", ":", "return", "[", "]", "else", ":", "part1_list1", "=", "list1", "[", ":", "len", "(", ...
Sort the elements of list1.
[ "Sort", "the", "elements", "of", "list1", "." ]
[ "\"\"\"\r\n Sort the elements of list1.\r\n\r\n Return a new sorted list with the same elements as list1.\r\n\r\n This function should be recursive.\r\n \"\"\"" ]
[ { "param": "list1", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "list1", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f99c3feee678bfe599be8ff407f70e1f4c7924ed
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_2.py
[ "MIT" ]
Python
gen_all_strings
<not_specific>
def gen_all_strings(word): """ Generate all strings that can be composed from the letters in word in any order. Returns a list of all strings that can be formed from the letters in word. This function should be recursive. """ if len(word) == 1: return ['',word] ...
Generate all strings that can be composed from the letters in word in any order. Returns a list of all strings that can be formed from the letters in word. This function should be recursive.
Generate all strings that can be composed from the letters in word in any order. Returns a list of all strings that can be formed from the letters in word. This function should be recursive.
[ "Generate", "all", "strings", "that", "can", "be", "composed", "from", "the", "letters", "in", "word", "in", "any", "order", ".", "Returns", "a", "list", "of", "all", "strings", "that", "can", "be", "formed", "from", "the", "letters", "in", "word", ".", ...
def gen_all_strings(word): if len(word) == 1: return ['',word] elif len(word) == 0: return [''] else: first = word[0] rest = word[1:] rest_strings = gen_all_strings(rest) rest_strings2 = [] for index_i in range(len(rest_strings)): item = re...
[ "def", "gen_all_strings", "(", "word", ")", ":", "if", "len", "(", "word", ")", "==", "1", ":", "return", "[", "''", ",", "word", "]", "elif", "len", "(", "word", ")", "==", "0", ":", "return", "[", "''", "]", "else", ":", "first", "=", "word",...
Generate all strings that can be composed from the letters in word in any order.
[ "Generate", "all", "strings", "that", "can", "be", "composed", "from", "the", "letters", "in", "word", "in", "any", "order", "." ]
[ "\"\"\"\r\n Generate all strings that can be composed from the letters in word\r\n in any order.\r\n\r\n Returns a list of all strings that can be formed from the letters\r\n in word.\r\n\r\n This function should be recursive.\r\n \"\"\"" ]
[ { "param": "word", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "word", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f99c3feee678bfe599be8ff407f70e1f4c7924ed
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_2.py
[ "MIT" ]
Python
load_words
<not_specific>
def load_words(filename): """ Load word list from the file named filename. Returns a list of strings. """ a_file = urllib2.urlopen(codeskulptor.file2url(filename)) return a_file.readlines()
Load word list from the file named filename. Returns a list of strings.
Load word list from the file named filename. Returns a list of strings.
[ "Load", "word", "list", "from", "the", "file", "named", "filename", ".", "Returns", "a", "list", "of", "strings", "." ]
def load_words(filename): a_file = urllib2.urlopen(codeskulptor.file2url(filename)) return a_file.readlines()
[ "def", "load_words", "(", "filename", ")", ":", "a_file", "=", "urllib2", ".", "urlopen", "(", "codeskulptor", ".", "file2url", "(", "filename", ")", ")", "return", "a_file", ".", "readlines", "(", ")" ]
Load word list from the file named filename.
[ "Load", "word", "list", "from", "the", "file", "named", "filename", "." ]
[ "\"\"\"\r\n Load word list from the file named filename.\r\n\r\n Returns a list of strings.\r\n \"\"\"" ]
[ { "param": "filename", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0e1bb8f7ae36558ce1d511ceee7e6e5dbc50f7c1
Arthur-Lanc/coursera
python_data_scien/algorithmic_thinking2/project3/alg_project3_viz.py
[ "MIT" ]
Python
load_data_table
<not_specific>
def load_data_table(data_url): """ Import a table of county-based cancer risk data from a csv format file """ data_file = urllib2.urlopen(data_url) data = data_file.read() data_lines = data.split('\n') print "Loaded", len(data_lines), "data points" data_tokens = [line.split(...
Import a table of county-based cancer risk data from a csv format file
Import a table of county-based cancer risk data from a csv format file
[ "Import", "a", "table", "of", "county", "-", "based", "cancer", "risk", "data", "from", "a", "csv", "format", "file" ]
def load_data_table(data_url): data_file = urllib2.urlopen(data_url) data = data_file.read() data_lines = data.split('\n') print "Loaded", len(data_lines), "data points" data_tokens = [line.split(',') for line in data_lines] return [[tokens[0], float(tokens[1]), float(tokens[2]), int(tokens[3]),...
[ "def", "load_data_table", "(", "data_url", ")", ":", "data_file", "=", "urllib2", ".", "urlopen", "(", "data_url", ")", "data", "=", "data_file", ".", "read", "(", ")", "data_lines", "=", "data", ".", "split", "(", "'\\n'", ")", "print", "\"Loaded\"", ",...
Import a table of county-based cancer risk data from a csv format file
[ "Import", "a", "table", "of", "county", "-", "based", "cancer", "risk", "data", "from", "a", "csv", "format", "file" ]
[ "\"\"\"\r\n Import a table of county-based cancer risk data\r\n from a csv format file\r\n \"\"\"" ]
[ { "param": "data_url", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data_url", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0e1bb8f7ae36558ce1d511ceee7e6e5dbc50f7c1
Arthur-Lanc/coursera
python_data_scien/algorithmic_thinking2/project3/alg_project3_viz.py
[ "MIT" ]
Python
run_example
null
def run_example(): """ Load a data table, compute a list of clusters and plot a list of clusters Set DESKTOP = True/False to use either matplotlib or simplegui """ #data_table = load_data_table(DATA_3108_URL) data_table = load_data_table(DATA_111_URL) #data_table = load_data_t...
Load a data table, compute a list of clusters and plot a list of clusters Set DESKTOP = True/False to use either matplotlib or simplegui
Load a data table, compute a list of clusters and plot a list of clusters Set DESKTOP = True/False to use either matplotlib or simplegui
[ "Load", "a", "data", "table", "compute", "a", "list", "of", "clusters", "and", "plot", "a", "list", "of", "clusters", "Set", "DESKTOP", "=", "True", "/", "False", "to", "use", "either", "matplotlib", "or", "simplegui" ]
def run_example(): data_table = load_data_table(DATA_111_URL) singleton_list = [] for line in data_table: singleton_list.append(alg_cluster.Cluster(set([line[0]]), line[1], line[2], line[3], line[4])) cluster_list = alg_project3_solution.kmeans_clustering(singleton_list, 9, 5) print "Display...
[ "def", "run_example", "(", ")", ":", "data_table", "=", "load_data_table", "(", "DATA_111_URL", ")", "singleton_list", "=", "[", "]", "for", "line", "in", "data_table", ":", "singleton_list", ".", "append", "(", "alg_cluster", ".", "Cluster", "(", "set", "("...
Load a data table, compute a list of clusters and plot a list of clusters
[ "Load", "a", "data", "table", "compute", "a", "list", "of", "clusters", "and", "plot", "a", "list", "of", "clusters" ]
[ "\"\"\"\r\n Load a data table, compute a list of clusters and \r\n plot a list of clusters\r\n\r\n Set DESKTOP = True/False to use either matplotlib or simplegui\r\n \"\"\"", "#data_table = load_data_table(DATA_3108_URL)\r", "#data_table = load_data_table(DATA_290_URL)\r", "#cluster_list = sequent...
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
b28f8f6139ee1661cde95f83a1311b50915019da
Arthur-Lanc/coursera
python_data_scien/poc1/min_porj_1.py
[ "MIT" ]
Python
merge
<not_specific>
def merge(line): """ Function that merges a single row or column in 2048. """ line_t1 = [] for num in list(line): if num != 0: line_t1.append(num) for dummy_num in range(len(line)-len(line_t1)): line_t1.append(0) line_t2 = [] idx = 0 whil...
Function that merges a single row or column in 2048.
Function that merges a single row or column in 2048.
[ "Function", "that", "merges", "a", "single", "row", "or", "column", "in", "2048", "." ]
def merge(line): line_t1 = [] for num in list(line): if num != 0: line_t1.append(num) for dummy_num in range(len(line)-len(line_t1)): line_t1.append(0) line_t2 = [] idx = 0 while True: if idx == len(line): break elif idx == len(line) - 1: ...
[ "def", "merge", "(", "line", ")", ":", "line_t1", "=", "[", "]", "for", "num", "in", "list", "(", "line", ")", ":", "if", "num", "!=", "0", ":", "line_t1", ".", "append", "(", "num", ")", "for", "dummy_num", "in", "range", "(", "len", "(", "lin...
Function that merges a single row or column in 2048.
[ "Function", "that", "merges", "a", "single", "row", "or", "column", "in", "2048", "." ]
[ "\"\"\"\r\n Function that merges a single row or column in 2048.\r\n \"\"\"" ]
[ { "param": "line", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "line", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cfcdd112457d5c38f2ae8645ae11f6e83f3bf9b8
Arthur-Lanc/coursera
python_data_scien/algorithmic_thinking2/project3/alg_project3_solution.py
[ "MIT" ]
Python
slow_closest_pair
<not_specific>
def slow_closest_pair(cluster_list): """ Compute the distance between the closest pair of clusters in a list (slow) Input: cluster_list is the list of clusters Output: tuple of the form (dist, idx1, idx2) where the centers of the clusters cluster_list[idx1] and cluster_list[idx2] have m...
Compute the distance between the closest pair of clusters in a list (slow) Input: cluster_list is the list of clusters Output: tuple of the form (dist, idx1, idx2) where the centers of the clusters cluster_list[idx1] and cluster_list[idx2] have minimum distance dist.
Compute the distance between the closest pair of clusters in a list (slow) Input: cluster_list is the list of clusters tuple of the form (dist, idx1, idx2) where the centers of the clusters cluster_list[idx1] and cluster_list[idx2] have minimum distance dist.
[ "Compute", "the", "distance", "between", "the", "closest", "pair", "of", "clusters", "in", "a", "list", "(", "slow", ")", "Input", ":", "cluster_list", "is", "the", "list", "of", "clusters", "tuple", "of", "the", "form", "(", "dist", "idx1", "idx2", ")",...
def slow_closest_pair(cluster_list): result_tuple = (float('inf'),-1,-1) for idx_i in range(len(cluster_list)): for idx_j in range(len(cluster_list)): if idx_i != idx_j: temp_tuple = pair_distance(cluster_list,idx_i,idx_j) if temp_tuple[0] < result_tuple[0]: ...
[ "def", "slow_closest_pair", "(", "cluster_list", ")", ":", "result_tuple", "=", "(", "float", "(", "'inf'", ")", ",", "-", "1", ",", "-", "1", ")", "for", "idx_i", "in", "range", "(", "len", "(", "cluster_list", ")", ")", ":", "for", "idx_j", "in", ...
Compute the distance between the closest pair of clusters in a list (slow) Input: cluster_list is the list of clusters
[ "Compute", "the", "distance", "between", "the", "closest", "pair", "of", "clusters", "in", "a", "list", "(", "slow", ")", "Input", ":", "cluster_list", "is", "the", "list", "of", "clusters" ]
[ "\"\"\"\r\n Compute the distance between the closest pair of clusters in a list (slow)\r\n\r\n Input: cluster_list is the list of clusters\r\n \r\n Output: tuple of the form (dist, idx1, idx2) where the centers of the clusters\r\n cluster_list[idx1] and cluster_list[idx2] have minimum distance dist. ...
[ { "param": "cluster_list", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cluster_list", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cfcdd112457d5c38f2ae8645ae11f6e83f3bf9b8
Arthur-Lanc/coursera
python_data_scien/algorithmic_thinking2/project3/alg_project3_solution.py
[ "MIT" ]
Python
closest_pair_strip
<not_specific>
def closest_pair_strip(cluster_list, mid, width): """ Compute the distance between the closest pair of clusters in a list (fast) Input: cluster_list is list of clusters SORTED such that horizontal positions of their centers are in ascending order Output: tuple of the form (dist, idx1, i...
Compute the distance between the closest pair of clusters in a list (fast) Input: cluster_list is list of clusters SORTED such that horizontal positions of their centers are in ascending order Output: tuple of the form (dist, idx1, idx2) where the centers of the clusters cluster_list[i...
Compute the distance between the closest pair of clusters in a list (fast) Input: cluster_list is list of clusters SORTED such that horizontal positions of their centers are in ascending order tuple of the form (dist, idx1, idx2) where the centers of the clusters cluster_list[idx1] and cluster_list[idx2] have minimum ...
[ "Compute", "the", "distance", "between", "the", "closest", "pair", "of", "clusters", "in", "a", "list", "(", "fast", ")", "Input", ":", "cluster_list", "is", "list", "of", "clusters", "SORTED", "such", "that", "horizontal", "positions", "of", "their", "cente...
def closest_pair_strip(cluster_list, mid, width): s_list = [] for idx in range(len(cluster_list)): if abs(cluster_list[idx].horiz_center()-mid) < width: s_list.append(idx) s_list.sort(key = lambda idx: cluster_list[idx].vert_center()) len_k = len(s_list) result_tuple = (float('in...
[ "def", "closest_pair_strip", "(", "cluster_list", ",", "mid", ",", "width", ")", ":", "s_list", "=", "[", "]", "for", "idx", "in", "range", "(", "len", "(", "cluster_list", ")", ")", ":", "if", "abs", "(", "cluster_list", "[", "idx", "]", ".", "horiz...
Compute the distance between the closest pair of clusters in a list (fast) Input: cluster_list is list of clusters SORTED such that horizontal positions of their centers are in ascending order
[ "Compute", "the", "distance", "between", "the", "closest", "pair", "of", "clusters", "in", "a", "list", "(", "fast", ")", "Input", ":", "cluster_list", "is", "list", "of", "clusters", "SORTED", "such", "that", "horizontal", "positions", "of", "their", "cente...
[ "\"\"\"\r\n Compute the distance between the closest pair of clusters in a list (fast)\r\n\r\n Input: cluster_list is list of clusters SORTED such that horizontal positions of their\r\n centers are in ascending order\r\n \r\n Output: tuple of the form (dist, idx1, idx2) where the centers of the clust...
[ { "param": "cluster_list", "type": null }, { "param": "mid", "type": null }, { "param": "width", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cluster_list", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mid", "type": null, "docstring": null, "docstring_tok...
cfcdd112457d5c38f2ae8645ae11f6e83f3bf9b8
Arthur-Lanc/coursera
python_data_scien/algorithmic_thinking2/project3/alg_project3_solution.py
[ "MIT" ]
Python
fast_closest_pair
<not_specific>
def fast_closest_pair(cluster_list): """ Helper function to compute the closest pair of clusters in a vertical strip Input: cluster_list is a list of clusters produced by fast_closest_pair horiz_center is the horizontal position of the strip's_list vertical center line half_width is the h...
Helper function to compute the closest pair of clusters in a vertical strip Input: cluster_list is a list of clusters produced by fast_closest_pair horiz_center is the horizontal position of the strip's_list vertical center line half_width is the half the width of the strip (idx_i.e; the maxi...
Helper function to compute the closest pair of clusters in a vertical strip Input: cluster_list is a list of clusters produced by fast_closest_pair horiz_center is the horizontal position of the strip's_list vertical center line half_width is the half the width of the strip (idx_i.e; the maximum horizontal distance tha...
[ "Helper", "function", "to", "compute", "the", "closest", "pair", "of", "clusters", "in", "a", "vertical", "strip", "Input", ":", "cluster_list", "is", "a", "list", "of", "clusters", "produced", "by", "fast_closest_pair", "horiz_center", "is", "the", "horizontal"...
def fast_closest_pair(cluster_list): len_n = len(cluster_list) if len_n <= 3: result_tuple = slow_closest_pair(cluster_list) else: idx_m = int(math.floor(len_n/2.0)) cluster_list_l = cluster_list[:idx_m] cluster_list_r = cluster_list[idx_m:] distance_tuple_l = fast_cl...
[ "def", "fast_closest_pair", "(", "cluster_list", ")", ":", "len_n", "=", "len", "(", "cluster_list", ")", "if", "len_n", "<=", "3", ":", "result_tuple", "=", "slow_closest_pair", "(", "cluster_list", ")", "else", ":", "idx_m", "=", "int", "(", "math", ".",...
Helper function to compute the closest pair of clusters in a vertical strip Input: cluster_list is a list of clusters produced by fast_closest_pair horiz_center is the horizontal position of the strip's_list vertical center line half_width is the half the width of the strip (idx_i.e; the maximum horizontal distance tha...
[ "Helper", "function", "to", "compute", "the", "closest", "pair", "of", "clusters", "in", "a", "vertical", "strip", "Input", ":", "cluster_list", "is", "a", "list", "of", "clusters", "produced", "by", "fast_closest_pair", "horiz_center", "is", "the", "horizontal"...
[ "\"\"\"\r\n Helper function to compute the closest pair of clusters in a vertical strip\r\n \r\n Input: cluster_list is a list of clusters produced by fast_closest_pair\r\n horiz_center is the horizontal position of the strip's_list vertical center line\r\n half_width is the half the width of the str...
[ { "param": "cluster_list", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cluster_list", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cfcdd112457d5c38f2ae8645ae11f6e83f3bf9b8
Arthur-Lanc/coursera
python_data_scien/algorithmic_thinking2/project3/alg_project3_solution.py
[ "MIT" ]
Python
hierarchical_clustering
<not_specific>
def hierarchical_clustering(cluster_list, cluster_num_k): """ Compute a hierarchical clustering of a set of clusters Note: the function may mutate cluster_list Input: List of clusters, integer number of clusters Output: List of clusters whose length is num_clusters """ while len...
Compute a hierarchical clustering of a set of clusters Note: the function may mutate cluster_list Input: List of clusters, integer number of clusters Output: List of clusters whose length is num_clusters
Compute a hierarchical clustering of a set of clusters Note: the function may mutate cluster_list List of clusters, integer number of clusters Output: List of clusters whose length is num_clusters
[ "Compute", "a", "hierarchical", "clustering", "of", "a", "set", "of", "clusters", "Note", ":", "the", "function", "may", "mutate", "cluster_list", "List", "of", "clusters", "integer", "number", "of", "clusters", "Output", ":", "List", "of", "clusters", "whose"...
def hierarchical_clustering(cluster_list, cluster_num_k): while len(cluster_list) > cluster_num_k: cluster_list.sort(key = lambda cluster: cluster.horiz_center()) cp_tuple = fast_closest_pair(cluster_list) idx_i = cp_tuple[1] idx_j = cp_tuple[2] new_cluster = cluster_list[idx...
[ "def", "hierarchical_clustering", "(", "cluster_list", ",", "cluster_num_k", ")", ":", "while", "len", "(", "cluster_list", ")", ">", "cluster_num_k", ":", "cluster_list", ".", "sort", "(", "key", "=", "lambda", "cluster", ":", "cluster", ".", "horiz_center", ...
Compute a hierarchical clustering of a set of clusters Note: the function may mutate cluster_list
[ "Compute", "a", "hierarchical", "clustering", "of", "a", "set", "of", "clusters", "Note", ":", "the", "function", "may", "mutate", "cluster_list" ]
[ "\"\"\"\r\n Compute a hierarchical clustering of a set of clusters\r\n Note: the function may mutate cluster_list\r\n \r\n Input: List of clusters, integer number of clusters\r\n Output: List of clusters whose length is num_clusters\r\n \"\"\"", "#cp_tuple = slow_closest_pair(cluster_list)\r" ]
[ { "param": "cluster_list", "type": null }, { "param": "cluster_num_k", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cluster_list", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cluster_num_k", "type": null, "docstring": null, "doc...
cfcdd112457d5c38f2ae8645ae11f6e83f3bf9b8
Arthur-Lanc/coursera
python_data_scien/algorithmic_thinking2/project3/alg_project3_solution.py
[ "MIT" ]
Python
kmeans_clustering
<not_specific>
def kmeans_clustering(cluster_list, len_k, iter_times_q): """ Compute the len_k-means clustering of a set of clusters Note: the function may not mutate cluster_list Input: List of clusters, integers number of clusters and number of iterations Output: List of clusters whose length is num_c...
Compute the len_k-means clustering of a set of clusters Note: the function may not mutate cluster_list Input: List of clusters, integers number of clusters and number of iterations Output: List of clusters whose length is num_clusters
Compute the len_k-means clustering of a set of clusters Note: the function may not mutate cluster_list List of clusters, integers number of clusters and number of iterations Output: List of clusters whose length is num_clusters
[ "Compute", "the", "len_k", "-", "means", "clustering", "of", "a", "set", "of", "clusters", "Note", ":", "the", "function", "may", "not", "mutate", "cluster_list", "List", "of", "clusters", "integers", "number", "of", "clusters", "and", "number", "of", "itera...
def kmeans_clustering(cluster_list, len_k, iter_times_q): cluster_list_copy = list(cluster_list) cluster_list_copy.sort(key = lambda cluster: cluster.total_population(),reverse=True) miu = [] for idx_f in range(len_k): miu.append((cluster_list_copy[idx_f].horiz_center(),cluster_list_copy[idx_f]....
[ "def", "kmeans_clustering", "(", "cluster_list", ",", "len_k", ",", "iter_times_q", ")", ":", "cluster_list_copy", "=", "list", "(", "cluster_list", ")", "cluster_list_copy", ".", "sort", "(", "key", "=", "lambda", "cluster", ":", "cluster", ".", "total_populati...
Compute the len_k-means clustering of a set of clusters Note: the function may not mutate cluster_list
[ "Compute", "the", "len_k", "-", "means", "clustering", "of", "a", "set", "of", "clusters", "Note", ":", "the", "function", "may", "not", "mutate", "cluster_list" ]
[ "\"\"\"\r\n Compute the len_k-means clustering of a set of clusters\r\n Note: the function may not mutate cluster_list\r\n \r\n Input: List of clusters, integers number of clusters and number of iterations\r\n Output: List of clusters whose length is num_clusters\r\n \"\"\"", "# position initial...
[ { "param": "cluster_list", "type": null }, { "param": "len_k", "type": null }, { "param": "iter_times_q", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cluster_list", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "len_k", "type": null, "docstring": null, "docstring_t...
e639ca29605d9ea5247db0950151e3f25cfabc54
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_4.py
[ "MIT" ]
Python
lower_row_invariant
<not_specific>
def lower_row_invariant(self, target_row, target_col): """ Check whether the puzzle satisfies the specified invariant at the given position in the bottom rows of the puzzle (target_row > 1) Returns a boolean """ if 0 != self.get_number(target_row,target_col): ...
Check whether the puzzle satisfies the specified invariant at the given position in the bottom rows of the puzzle (target_row > 1) Returns a boolean
Check whether the puzzle satisfies the specified invariant at the given position in the bottom rows of the puzzle (target_row > 1) Returns a boolean
[ "Check", "whether", "the", "puzzle", "satisfies", "the", "specified", "invariant", "at", "the", "given", "position", "in", "the", "bottom", "rows", "of", "the", "puzzle", "(", "target_row", ">", "1", ")", "Returns", "a", "boolean" ]
def lower_row_invariant(self, target_row, target_col): if 0 != self.get_number(target_row,target_col): return False for idx_i in range(target_row+1,self.get_height()): for idx_j in range(0,self.get_width()): if (idx_i,idx_j) != self.current_position(idx_i,idx_j): ...
[ "def", "lower_row_invariant", "(", "self", ",", "target_row", ",", "target_col", ")", ":", "if", "0", "!=", "self", ".", "get_number", "(", "target_row", ",", "target_col", ")", ":", "return", "False", "for", "idx_i", "in", "range", "(", "target_row", "+",...
Check whether the puzzle satisfies the specified invariant at the given position in the bottom rows of the puzzle (target_row > 1) Returns a boolean
[ "Check", "whether", "the", "puzzle", "satisfies", "the", "specified", "invariant", "at", "the", "given", "position", "in", "the", "bottom", "rows", "of", "the", "puzzle", "(", "target_row", ">", "1", ")", "Returns", "a", "boolean" ]
[ "\"\"\"\r\n Check whether the puzzle satisfies the specified invariant\r\n at the given position in the bottom rows of the puzzle (target_row > 1)\r\n Returns a boolean\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "target_row", "type": null }, { "param": "target_col", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target_row", "type": null, "docstring": null, "docstring_toke...
e639ca29605d9ea5247db0950151e3f25cfabc54
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_4.py
[ "MIT" ]
Python
solve_interior_tile
<not_specific>
def solve_interior_tile(self, target_row, target_col): """ Place correct tile at target position Updates puzzle and returns a move string """ empyt_str = '' result_str = '' result_str += self.move_to_same_col(empyt_str,target_row,target_col,0) if s...
Place correct tile at target position Updates puzzle and returns a move string
Place correct tile at target position Updates puzzle and returns a move string
[ "Place", "correct", "tile", "at", "target", "position", "Updates", "puzzle", "and", "returns", "a", "move", "string" ]
def solve_interior_tile(self, target_row, target_col): empyt_str = '' result_str = '' result_str += self.move_to_same_col(empyt_str,target_row,target_col,0) if self.is_move_over(target_row,target_col,0): return result_str else: result_str += self.move_to_s...
[ "def", "solve_interior_tile", "(", "self", ",", "target_row", ",", "target_col", ")", ":", "empyt_str", "=", "''", "result_str", "=", "''", "result_str", "+=", "self", ".", "move_to_same_col", "(", "empyt_str", ",", "target_row", ",", "target_col", ",", "0", ...
Place correct tile at target position Updates puzzle and returns a move string
[ "Place", "correct", "tile", "at", "target", "position", "Updates", "puzzle", "and", "returns", "a", "move", "string" ]
[ "\"\"\"\r\n Place correct tile at target position\r\n Updates puzzle and returns a move string\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "target_row", "type": null }, { "param": "target_col", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target_row", "type": null, "docstring": null, "docstring_toke...
e639ca29605d9ea5247db0950151e3f25cfabc54
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_4.py
[ "MIT" ]
Python
solve_col0_tile
<not_specific>
def solve_col0_tile(self, target_row): """ Solve tile in column zero on specified row (> 1) Updates puzzle and returns a move string """ empyt_str = '' target_row -= 1 target_col = 1 result_str = '' result_str += 'ur' self.update_...
Solve tile in column zero on specified row (> 1) Updates puzzle and returns a move string
Solve tile in column zero on specified row (> 1) Updates puzzle and returns a move string
[ "Solve", "tile", "in", "column", "zero", "on", "specified", "row", "(", ">", "1", ")", "Updates", "puzzle", "and", "returns", "a", "move", "string" ]
def solve_col0_tile(self, target_row): empyt_str = '' target_row -= 1 target_col = 1 result_str = '' result_str += 'ur' self.update_puzzle(result_str) if self.is_move_over(target_row,target_col,1): move_str = 'r'*(self.get_width()-2) result...
[ "def", "solve_col0_tile", "(", "self", ",", "target_row", ")", ":", "empyt_str", "=", "''", "target_row", "-=", "1", "target_col", "=", "1", "result_str", "=", "''", "result_str", "+=", "'ur'", "self", ".", "update_puzzle", "(", "result_str", ")", "if", "s...
Solve tile in column zero on specified row (> 1) Updates puzzle and returns a move string
[ "Solve", "tile", "in", "column", "zero", "on", "specified", "row", "(", ">", "1", ")", "Updates", "puzzle", "and", "returns", "a", "move", "string" ]
[ "\"\"\"\r\n Solve tile in column zero on specified row (> 1)\r\n Updates puzzle and returns a move string\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "target_row", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target_row", "type": null, "docstring": null, "docstring_toke...
e639ca29605d9ea5247db0950151e3f25cfabc54
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_4.py
[ "MIT" ]
Python
row0_invariant
<not_specific>
def row0_invariant(self, target_col): """ Check whether the puzzle satisfies the row zero invariant at the given column (col > 1) Returns a boolean """ if self.get_number(0,target_col) != 0: return False for row in range(target_col+1,self.get_w...
Check whether the puzzle satisfies the row zero invariant at the given column (col > 1) Returns a boolean
Check whether the puzzle satisfies the row zero invariant at the given column (col > 1) Returns a boolean
[ "Check", "whether", "the", "puzzle", "satisfies", "the", "row", "zero", "invariant", "at", "the", "given", "column", "(", "col", ">", "1", ")", "Returns", "a", "boolean" ]
def row0_invariant(self, target_col): if self.get_number(0,target_col) != 0: return False for row in range(target_col+1,self.get_width()): if self.is_right_pos(0,row): pass else: return False for col in range(target_col,self.get...
[ "def", "row0_invariant", "(", "self", ",", "target_col", ")", ":", "if", "self", ".", "get_number", "(", "0", ",", "target_col", ")", "!=", "0", ":", "return", "False", "for", "row", "in", "range", "(", "target_col", "+", "1", ",", "self", ".", "get_...
Check whether the puzzle satisfies the row zero invariant at the given column (col > 1) Returns a boolean
[ "Check", "whether", "the", "puzzle", "satisfies", "the", "row", "zero", "invariant", "at", "the", "given", "column", "(", "col", ">", "1", ")", "Returns", "a", "boolean" ]
[ "\"\"\"\r\n Check whether the puzzle satisfies the row zero invariant\r\n at the given column (col > 1)\r\n Returns a boolean\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "target_col", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target_col", "type": null, "docstring": null, "docstring_toke...
e639ca29605d9ea5247db0950151e3f25cfabc54
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_4.py
[ "MIT" ]
Python
row1_invariant
<not_specific>
def row1_invariant(self, target_col): """ Check whether the puzzle satisfies the row one invariant at the given column (col > 1) Returns a boolean """ if self.get_number(1,target_col) != 0: return False for row in range(target_col+1,self.get_wi...
Check whether the puzzle satisfies the row one invariant at the given column (col > 1) Returns a boolean
Check whether the puzzle satisfies the row one invariant at the given column (col > 1) Returns a boolean
[ "Check", "whether", "the", "puzzle", "satisfies", "the", "row", "one", "invariant", "at", "the", "given", "column", "(", "col", ">", "1", ")", "Returns", "a", "boolean" ]
def row1_invariant(self, target_col): if self.get_number(1,target_col) != 0: return False for row in range(target_col+1,self.get_width()): if self.is_right_pos(0,row): pass else: return False for col in range(target_col+1,self.g...
[ "def", "row1_invariant", "(", "self", ",", "target_col", ")", ":", "if", "self", ".", "get_number", "(", "1", ",", "target_col", ")", "!=", "0", ":", "return", "False", "for", "row", "in", "range", "(", "target_col", "+", "1", ",", "self", ".", "get_...
Check whether the puzzle satisfies the row one invariant at the given column (col > 1) Returns a boolean
[ "Check", "whether", "the", "puzzle", "satisfies", "the", "row", "one", "invariant", "at", "the", "given", "column", "(", "col", ">", "1", ")", "Returns", "a", "boolean" ]
[ "\"\"\"\r\n Check whether the puzzle satisfies the row one invariant\r\n at the given column (col > 1)\r\n Returns a boolean\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "target_col", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target_col", "type": null, "docstring": null, "docstring_toke...