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
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
ripemd160
<not_specific>
def ripemd160(string, salt=None, front=False, back=False, **placeholder): """ Create a RipeMD160 hash from a given string > :param string: string to be hashed > :return: a hashed string with or without salt Example: >>> ripemd160("test") 5e52fee47e6b070565f74372468cdc699de8...
Create a RipeMD160 hash from a given string > :param string: string to be hashed > :return: a hashed string with or without salt Example: >>> ripemd160("test") 5e52fee47e6b070565f74372468cdc699de89107
Create a RipeMD160 hash from a given string > :param string: string to be hashed > :return: a hashed string with or without salt
[ "Create", "a", "RipeMD160", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "hashed", "string", "with", "or", "without", "salt" ]
def ripemd160(string, salt=None, front=False, back=False, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) obj = hashlib.new("ripemd160") if salt is not None and front and not back: obj.update(salt + string) elif salt is not None and back and not f...
[ "def", "ripemd160", "(", "string", ",", "salt", "=", "None", ",", "front", "=", "False", ",", "back", "=", "False", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", "...
Create a RipeMD160 hash from a given string > :param string: string to be hashed > :return: a hashed string with or without salt
[ "Create", "a", "RipeMD160", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "hashed", "string", "with", "or", "without", "salt" ]
[ "\"\"\"\n Create a RipeMD160 hash from a given string\n\n > :param string: string to be hashed\n > :return: a hashed string with or without salt\n\n Example:\n >>> ripemd160(\"test\")\n 5e52fee47e6b070565f74372468cdc699de89107\n \"\"\"" ]
[ { "param": "string", "type": null }, { "param": "salt", "type": null }, { "param": "front", "type": null }, { "param": "back", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
blake224
<not_specific>
def blake224(string, salt=None, front=False, back=False, **placeholder): """ Create a Blake224 hash from given string > :param string: string to be hashed > :return: a blake224 hash Example: >>> blake224("test") e9543bfe985642bc30d41903161b2252a014deca64a9af27fc0c111f "...
Create a Blake224 hash from given string > :param string: string to be hashed > :return: a blake224 hash Example: >>> blake224("test") e9543bfe985642bc30d41903161b2252a014deca64a9af27fc0c111f
Create a Blake224 hash from given string > :param string: string to be hashed > :return: a blake224 hash
[ "Create", "a", "Blake224", "hash", "from", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "blake224", "hash" ]
def blake224(string, salt=None, front=False, back=False, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) obj = blake.BLAKE(224) if salt is not None and front and not back: digest = obj.hexdigest(salt + string) elif salt is not None and back and no...
[ "def", "blake224", "(", "string", ",", "salt", "=", "None", ",", "front", "=", "False", ",", "back", "=", "False", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", "....
Create a Blake224 hash from given string > :param string: string to be hashed > :return: a blake224 hash
[ "Create", "a", "Blake224", "hash", "from", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "blake224", "hash" ]
[ "\"\"\"\n Create a Blake224 hash from given string\n\n > :param string: string to be hashed\n > :return: a blake224 hash\n\n Example:\n >>> blake224(\"test\")\n e9543bfe985642bc30d41903161b2252a014deca64a9af27fc0c111f\n \"\"\"" ]
[ { "param": "string", "type": null }, { "param": "salt", "type": null }, { "param": "front", "type": null }, { "param": "back", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
blake256
<not_specific>
def blake256(string, salt=None, front=False, back=False, **placeholder): """ Create a Blake256 hash from a given string > :param string: string to be hashed > :return: a blake256 hash Example: >>> blake256("test") dc1ef7d25c8658590f3498d15baa87834f39a6208ddcb28fdfb7cc3179b8...
Create a Blake256 hash from a given string > :param string: string to be hashed > :return: a blake256 hash Example: >>> blake256("test") dc1ef7d25c8658590f3498d15baa87834f39a6208ddcb28fdfb7cc3179b8bf8f
Create a Blake256 hash from a given string > :param string: string to be hashed > :return: a blake256 hash
[ "Create", "a", "Blake256", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "blake256", "hash" ]
def blake256(string, salt=None, front=False, back=False, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) obj = blake.BLAKE(256) if salt is not None and front and not back: digest = obj.hexdigest(salt + string) elif salt is not None and back and no...
[ "def", "blake256", "(", "string", ",", "salt", "=", "None", ",", "front", "=", "False", ",", "back", "=", "False", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", "....
Create a Blake256 hash from a given string > :param string: string to be hashed > :return: a blake256 hash
[ "Create", "a", "Blake256", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "blake256", "hash" ]
[ "\"\"\"\n Create a Blake256 hash from a given string\n\n > :param string: string to be hashed\n > :return: a blake256 hash\n\n Example:\n >>> blake256(\"test\")\n dc1ef7d25c8658590f3498d15baa87834f39a6208ddcb28fdfb7cc3179b8bf8f\n \"\"\"" ]
[ { "param": "string", "type": null }, { "param": "salt", "type": null }, { "param": "front", "type": null }, { "param": "back", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
blake384
<not_specific>
def blake384(string, salt=None, front=False, back=False, **placeholder): """ Create a bBlake384 hash from a given string > :param string: string to be hashed > :return: a blake384 hash Example: >>> blake384("test") 97c456fb92567f27324497d1d41a8427eed77a1f3a1161faf49e40ebae4...
Create a bBlake384 hash from a given string > :param string: string to be hashed > :return: a blake384 hash Example: >>> blake384("test") 97c456fb92567f27324497d1d41a8427eed77a1f3a1161faf49e40ebae44a7d1e2f9e8bdf7bc193ae9e37bebf50ece76
Create a bBlake384 hash from a given string > :param string: string to be hashed > :return: a blake384 hash
[ "Create", "a", "bBlake384", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "blake384", "hash" ]
def blake384(string, salt=None, front=False, back=False, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) obj = blake.BLAKE(384) if salt is not None and front and not back: digest = obj.hexdigest(salt + string) elif salt is not None and back and no...
[ "def", "blake384", "(", "string", ",", "salt", "=", "None", ",", "front", "=", "False", ",", "back", "=", "False", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", "....
Create a bBlake384 hash from a given string > :param string: string to be hashed > :return: a blake384 hash
[ "Create", "a", "bBlake384", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "blake384", "hash" ]
[ "\"\"\"\n Create a bBlake384 hash from a given string\n\n > :param string: string to be hashed\n > :return: a blake384 hash\n\n Example:\n >>> blake384(\"test\")\n 97c456fb92567f27324497d1d41a8427eed77a1f3a1161faf49e40ebae44a7d1e2f9e8bdf7bc193ae9e37bebf50ece76\n \"\"\"" ]
[ { "param": "string", "type": null }, { "param": "salt", "type": null }, { "param": "front", "type": null }, { "param": "back", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
blake512
<not_specific>
def blake512(string, salt=None, front=False, back=False, **placeholder): """ Create a Blake512 hash from a given string > :param string: string to ne hashed > :return: a blake512 hash Example: >>> blake512("test") 042d11c84ee88718f4451b05beb21c0751e243ed15491a927fef891ba0ba...
Create a Blake512 hash from a given string > :param string: string to ne hashed > :return: a blake512 hash Example: >>> blake512("test") 042d11c84ee88718f4451b05beb21c0751e243ed15491a927fef891ba0ba17bbe0d2f5286639cebabe86d876e4064821cd9d5764faba5bbd3d63d02275c0593e
Create a Blake512 hash from a given string > :param string: string to ne hashed > :return: a blake512 hash
[ "Create", "a", "Blake512", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "ne", "hashed", ">", ":", "return", ":", "a", "blake512", "hash" ]
def blake512(string, salt=None, front=False, back=False, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) obj = blake.BLAKE(512) if salt is not None and front and not back: digest = obj.hexdigest(salt + string) elif salt is not None and back and no...
[ "def", "blake512", "(", "string", ",", "salt", "=", "None", ",", "front", "=", "False", ",", "back", "=", "False", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", "....
Create a Blake512 hash from a given string > :param string: string to ne hashed > :return: a blake512 hash
[ "Create", "a", "Blake512", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "ne", "hashed", ">", ":", "return", ":", "a", "blake512", "hash" ]
[ "\"\"\"\n Create a Blake512 hash from a given string\n\n > :param string: string to ne hashed\n > :return: a blake512 hash\n\n Example:\n >>> blake512(\"test\")\n 042d11c84ee88718f4451b05beb21c0751e243ed15491a927fef891ba0ba17bbe0d2f5286639cebabe86d876e4064821cd9d5764faba5bbd3d63d02...
[ { "param": "string", "type": null }, { "param": "salt", "type": null }, { "param": "front", "type": null }, { "param": "back", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
md2
<not_specific>
def md2(string, salt=None, front=False, back=False, **placeholder): """ Create an MD2 hash from a given string > :param string: string to be hashed > :return: an MD2 hash Example: >>> md2("test") dd34716876364a02d0195e2fb9ae2d1b """ if type(string) is unicode: ...
Create an MD2 hash from a given string > :param string: string to be hashed > :return: an MD2 hash Example: >>> md2("test") dd34716876364a02d0195e2fb9ae2d1b
Create an MD2 hash from a given string > :param string: string to be hashed > :return: an MD2 hash
[ "Create", "an", "MD2", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "an", "MD2", "hash" ]
def md2(string, salt=None, front=False, back=False, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) if salt is not None and front and not back: obj = md2_hash.md2h(salt + string) elif salt is not None and back and not front: obj = md2_hash.md2...
[ "def", "md2", "(", "string", ",", "salt", "=", "None", ",", "front", "=", "False", ",", "back", "=", "False", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", ".", ...
Create an MD2 hash from a given string > :param string: string to be hashed > :return: an MD2 hash
[ "Create", "an", "MD2", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "an", "MD2", "hash" ]
[ "\"\"\"\n Create an MD2 hash from a given string\n\n > :param string: string to be hashed\n > :return: an MD2 hash\n\n Example:\n >>> md2(\"test\")\n dd34716876364a02d0195e2fb9ae2d1b\n \"\"\"" ]
[ { "param": "string", "type": null }, { "param": "salt", "type": null }, { "param": "front", "type": null }, { "param": "back", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
sha1
<not_specific>
def sha1(string, salt=None, front=False, back=False, **placeholder): """ Create an SHA1 hash from a given string > :param string: string to be hashed > :return: a SHA1 hashed string Example: >>> sha1("test") a94a8fe5ccb19ba61c4c0873d391e987982fbbd3 """ if type(strin...
Create an SHA1 hash from a given string > :param string: string to be hashed > :return: a SHA1 hashed string Example: >>> sha1("test") a94a8fe5ccb19ba61c4c0873d391e987982fbbd3
Create an SHA1 hash from a given string > :param string: string to be hashed > :return: a SHA1 hashed string
[ "Create", "an", "SHA1", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "SHA1", "hashed", "string" ]
def sha1(string, salt=None, front=False, back=False, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) if type(string) is unicode: string = lib.settings.force_encoding(string) obj = hashlib.sha1() if salt is not None and front and not back: ...
[ "def", "sha1", "(", "string", ",", "salt", "=", "None", ",", "front", "=", "False", ",", "back", "=", "False", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", ".", ...
Create an SHA1 hash from a given string > :param string: string to be hashed > :return: a SHA1 hashed string
[ "Create", "an", "SHA1", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "SHA1", "hashed", "string" ]
[ "\"\"\"\n Create an SHA1 hash from a given string\n\n > :param string: string to be hashed\n > :return: a SHA1 hashed string\n\n Example:\n >>> sha1(\"test\")\n a94a8fe5ccb19ba61c4c0873d391e987982fbbd3\n \"\"\"" ]
[ { "param": "string", "type": null }, { "param": "salt", "type": null }, { "param": "front", "type": null }, { "param": "back", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
sha1_rounds
<not_specific>
def sha1_rounds(string, rounds=10, salt=None, front=False, back=False, **placeholder): """ Create a SHA1 hash in given rounds, meaning re-hexdigest the hash with a already created hash value > :param string: string to be hashed > :param rounds: how many rounds the digest should go > :...
Create a SHA1 hash in given rounds, meaning re-hexdigest the hash with a already created hash value > :param string: string to be hashed > :param rounds: how many rounds the digest should go > :return: a hashed string Example: >>> sha1_rounds("test", rounds=3) 84cb...
Create a SHA1 hash in given rounds, meaning re-hexdigest the hash with a already created hash value
[ "Create", "a", "SHA1", "hash", "in", "given", "rounds", "meaning", "re", "-", "hexdigest", "the", "hash", "with", "a", "already", "created", "hash", "value" ]
def sha1_rounds(string, rounds=10, salt=None, front=False, back=False, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) if type(string) is unicode: string = lib.settings.force_encoding(string) obj = hashlib.sha1() if salt is not None and fr...
[ "def", "sha1_rounds", "(", "string", ",", "rounds", "=", "10", ",", "salt", "=", "None", ",", "front", "=", "False", ",", "back", "=", "False", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=...
Create a SHA1 hash in given rounds, meaning re-hexdigest the hash with a already created hash value
[ "Create", "a", "SHA1", "hash", "in", "given", "rounds", "meaning", "re", "-", "hexdigest", "the", "hash", "with", "a", "already", "created", "hash", "value" ]
[ "\"\"\"\n Create a SHA1 hash in given rounds, meaning re-hexdigest the hash with a already created\n hash value\n\n > :param string: string to be hashed\n > :param rounds: how many rounds the digest should go\n > :return: a hashed string\n\n Example:\n >>> sha1_rounds(\"test\", ...
[ { "param": "string", "type": null }, { "param": "rounds", "type": null }, { "param": "salt", "type": null }, { "param": "front", "type": null }, { "param": "back", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rounds", "type": null, "docstring": null, "docstring_tokens...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
sha224
<not_specific>
def sha224(string, salt=None, front=False, back=False, **placeholder): """ Create a SHA224 hash from a given string > :param string: string to be hashed > :return: an SHA224 hash Example: >>> sha224("test") 90a3ed9e32b2aaf4c61c410eb925426119e1a9dc53d4286ade99a809 """ ...
Create a SHA224 hash from a given string > :param string: string to be hashed > :return: an SHA224 hash Example: >>> sha224("test") 90a3ed9e32b2aaf4c61c410eb925426119e1a9dc53d4286ade99a809
Create a SHA224 hash from a given string > :param string: string to be hashed > :return: an SHA224 hash
[ "Create", "a", "SHA224", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "an", "SHA224", "hash" ]
def sha224(string, salt=None, front=False, back=False, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) if type(string) is unicode: string = lib.settings.force_encoding(string) obj = hashlib.sha224() if salt is not None and front and not ba...
[ "def", "sha224", "(", "string", ",", "salt", "=", "None", ",", "front", "=", "False", ",", "back", "=", "False", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", ".",...
Create a SHA224 hash from a given string > :param string: string to be hashed > :return: an SHA224 hash
[ "Create", "a", "SHA224", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "an", "SHA224", "hash" ]
[ "\"\"\"\n Create a SHA224 hash from a given string\n\n > :param string: string to be hashed\n > :return: an SHA224 hash\n\n Example:\n >>> sha224(\"test\")\n 90a3ed9e32b2aaf4c61c410eb925426119e1a9dc53d4286ade99a809\n \"\"\"" ]
[ { "param": "string", "type": null }, { "param": "salt", "type": null }, { "param": "front", "type": null }, { "param": "back", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
sha256
<not_specific>
def sha256(string, salt=None, front=False, back=False, **placeholder): """ Create an SHA256 hash from a given string > :param string: string to be hashed > :return: a SHA256 hash Example: >>> sha256("test") 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 ...
Create an SHA256 hash from a given string > :param string: string to be hashed > :return: a SHA256 hash Example: >>> sha256("test") 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
Create an SHA256 hash from a given string > :param string: string to be hashed > :return: a SHA256 hash
[ "Create", "an", "SHA256", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "SHA256", "hash" ]
def sha256(string, salt=None, front=False, back=False, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) if type(string) is unicode: string = lib.settings.force_encoding(string) obj = hashlib.sha256() if salt is not None and front and not ba...
[ "def", "sha256", "(", "string", ",", "salt", "=", "None", ",", "front", "=", "False", ",", "back", "=", "False", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", ".",...
Create an SHA256 hash from a given string > :param string: string to be hashed > :return: a SHA256 hash
[ "Create", "an", "SHA256", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "SHA256", "hash" ]
[ "\"\"\"\n Create an SHA256 hash from a given string\n\n > :param string: string to be hashed\n > :return: a SHA256 hash\n\n Example:\n >>> sha256(\"test\")\n 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08\n \"\"\"" ]
[ { "param": "string", "type": null }, { "param": "salt", "type": null }, { "param": "front", "type": null }, { "param": "back", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
sha512
<not_specific>
def sha512(string, salt=None, front=False, back=False, **placeholder): """ Create an SHA512 hash from a given string > :param string: string to be hashed > :return: an SHA512 hash Example: >>> sha512("test") ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27a...
Create an SHA512 hash from a given string > :param string: string to be hashed > :return: an SHA512 hash Example: >>> sha512("test") ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ff
Create an SHA512 hash from a given string > :param string: string to be hashed > :return: an SHA512 hash
[ "Create", "an", "SHA512", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "an", "SHA512", "hash" ]
def sha512(string, salt=None, front=False, back=False, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) obj = hashlib.sha512() if salt is not None and front and not back: obj.update(salt + string) elif salt is not None and back and not front: ...
[ "def", "sha512", "(", "string", ",", "salt", "=", "None", ",", "front", "=", "False", ",", "back", "=", "False", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", ".",...
Create an SHA512 hash from a given string > :param string: string to be hashed > :return: an SHA512 hash
[ "Create", "an", "SHA512", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "an", "SHA512", "hash" ]
[ "\"\"\"\n Create an SHA512 hash from a given string\n\n > :param string: string to be hashed\n > :return: an SHA512 hash\n\n Example:\n >>> sha512(\"test\")\n ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f5002...
[ { "param": "string", "type": null }, { "param": "salt", "type": null }, { "param": "front", "type": null }, { "param": "back", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
sha3_224
<not_specific>
def sha3_224(string, salt=None, front=False, back=False, **placeholder): """ Create a SHA3 224 hash from a given string > :param string: string to be hashed > :return: an SHA3 224 hash Example: >>> sha3_224("test") 3797bf0afbbfca4a7bbba7602a2b552746876517a7f9b7ce2db0ae7b ...
Create a SHA3 224 hash from a given string > :param string: string to be hashed > :return: an SHA3 224 hash Example: >>> sha3_224("test") 3797bf0afbbfca4a7bbba7602a2b552746876517a7f9b7ce2db0ae7b
Create a SHA3 224 hash from a given string > :param string: string to be hashed > :return: an SHA3 224 hash
[ "Create", "a", "SHA3", "224", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "an", "SHA3", "224", "hash" ]
def sha3_224(string, salt=None, front=False, back=False, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) obj = sha3.sha3_224() if salt is not None and front and not back: obj.update(salt + string) elif salt is not None and back and not front: ...
[ "def", "sha3_224", "(", "string", ",", "salt", "=", "None", ",", "front", "=", "False", ",", "back", "=", "False", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", "....
Create a SHA3 224 hash from a given string > :param string: string to be hashed > :return: an SHA3 224 hash
[ "Create", "a", "SHA3", "224", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "an", "SHA3", "224", "hash" ]
[ "\"\"\"\n Create a SHA3 224 hash from a given string\n\n > :param string: string to be hashed\n > :return: an SHA3 224 hash\n\n Example:\n\n >>> sha3_224(\"test\")\n 3797bf0afbbfca4a7bbba7602a2b552746876517a7f9b7ce2db0ae7b\n \"\"\"" ]
[ { "param": "string", "type": null }, { "param": "salt", "type": null }, { "param": "front", "type": null }, { "param": "back", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
sha3_256
<not_specific>
def sha3_256(string, salt=None, front=False, back=False, **placeholder): """ Create a SHA3 256 hash from a given string > :param string: string to be hashed > :return: SHA3 256 hash Example: >>> sha3_256("test") 36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab...
Create a SHA3 256 hash from a given string > :param string: string to be hashed > :return: SHA3 256 hash Example: >>> sha3_256("test") 36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab80
Create a SHA3 256 hash from a given string > :param string: string to be hashed > :return: SHA3 256 hash
[ "Create", "a", "SHA3", "256", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "SHA3", "256", "hash" ]
def sha3_256(string, salt=None, front=False, back=False, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) obj = sha3.sha3_256() if salt is not None and front and not back: obj.update(salt + string) elif salt is not None and back and not front: ...
[ "def", "sha3_256", "(", "string", ",", "salt", "=", "None", ",", "front", "=", "False", ",", "back", "=", "False", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", "....
Create a SHA3 256 hash from a given string > :param string: string to be hashed > :return: SHA3 256 hash
[ "Create", "a", "SHA3", "256", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "SHA3", "256", "hash" ]
[ "\"\"\"\n Create a SHA3 256 hash from a given string\n\n > :param string: string to be hashed\n > :return: SHA3 256 hash\n\n Example:\n >>> sha3_256(\"test\")\n 36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab80\n \"\"\"" ]
[ { "param": "string", "type": null }, { "param": "salt", "type": null }, { "param": "front", "type": null }, { "param": "back", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
sha3_384
<not_specific>
def sha3_384(string, salt=None, front=False, back=False, **placeholder): """ Create a SHA3 384 hash from a given string > :param string: string to hash > :return: SHA3 384 hash Example: >>> sha3_384("test") e516dabb23b6e30026863543282780a3ae0dccf05551cf0295178d7ff0f1b41eecb...
Create a SHA3 384 hash from a given string > :param string: string to hash > :return: SHA3 384 hash Example: >>> sha3_384("test") e516dabb23b6e30026863543282780a3ae0dccf05551cf0295178d7ff0f1b41eecb9db3ff219007c4e097260d58621bd
Create a SHA3 384 hash from a given string > :param string: string to hash > :return: SHA3 384 hash
[ "Create", "a", "SHA3", "384", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "hash", ">", ":", "return", ":", "SHA3", "384", "hash" ]
def sha3_384(string, salt=None, front=False, back=False, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) obj = sha3.sha3_384() if salt is not None and front and not back: obj.update(salt + string) elif salt is not None and back and not front: ...
[ "def", "sha3_384", "(", "string", ",", "salt", "=", "None", ",", "front", "=", "False", ",", "back", "=", "False", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", "....
Create a SHA3 384 hash from a given string > :param string: string to hash > :return: SHA3 384 hash
[ "Create", "a", "SHA3", "384", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "hash", ">", ":", "return", ":", "SHA3", "384", "hash" ]
[ "\"\"\"\n Create a SHA3 384 hash from a given string\n\n > :param string: string to hash\n > :return: SHA3 384 hash\n\n Example:\n >>> sha3_384(\"test\")\n e516dabb23b6e30026863543282780a3ae0dccf05551cf0295178d7ff0f1b41eecb9db3ff219007c4e097260d58621bd\n \"\"\"" ]
[ { "param": "string", "type": null }, { "param": "salt", "type": null }, { "param": "front", "type": null }, { "param": "back", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
whirlpool
<not_specific>
def whirlpool(string, salt=None, front=False, back=False, **placeholder): """ Create a WHIRLPOOL hash from a given string > :param string: string to be hashed > :return: a WHIRLPOOL hash Example: >>> whirlpool("test") b913d5bbb8e461c2c5961cbe0edcdadfd29f068225ceb37da6defcf8...
Create a WHIRLPOOL hash from a given string > :param string: string to be hashed > :return: a WHIRLPOOL hash Example: >>> whirlpool("test") b913d5bbb8e461c2c5961cbe0edcdadfd29f068225ceb37da6defcf89849368f8c6c2eb6a4c4ac75775d032a0ecfdfe8550573062b653fe92fc7b8fb3b7be8d6
Create a WHIRLPOOL hash from a given string > :param string: string to be hashed > :return: a WHIRLPOOL hash
[ "Create", "a", "WHIRLPOOL", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "WHIRLPOOL", "hash" ]
def whirlpool(string, salt=None, front=False, back=False, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) obj = hashlib.new("whirlpool") if salt is not None and front and not back: obj.update(salt + string) elif salt is not None and back and not f...
[ "def", "whirlpool", "(", "string", ",", "salt", "=", "None", ",", "front", "=", "False", ",", "back", "=", "False", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", "...
Create a WHIRLPOOL hash from a given string > :param string: string to be hashed > :return: a WHIRLPOOL hash
[ "Create", "a", "WHIRLPOOL", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "WHIRLPOOL", "hash" ]
[ "\"\"\"\n Create a WHIRLPOOL hash from a given string\n\n > :param string: string to be hashed\n > :return: a WHIRLPOOL hash\n\n Example:\n >>> whirlpool(\"test\")\n b913d5bbb8e461c2c5961cbe0edcdadfd29f068225ceb37da6defcf89849368f8c6c2eb6a4c4ac75775d032a0ecfdfe8550573062b653fe92fc7...
[ { "param": "string", "type": null }, { "param": "salt", "type": null }, { "param": "front", "type": null }, { "param": "back", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
tiger192
<not_specific>
def tiger192(string, salt=None, front=False, back=False, **placeholder): """ Hash a password using Tiger192 > :param string: string to be hashed into Tiger192 > :return: a Tiger192 hash Example: >>> tiger192("test") 8d1fd829fc83b37af1e5ba697ce8680d1d8bc430d76682f1 """ ...
Hash a password using Tiger192 > :param string: string to be hashed into Tiger192 > :return: a Tiger192 hash Example: >>> tiger192("test") 8d1fd829fc83b37af1e5ba697ce8680d1d8bc430d76682f1
Hash a password using Tiger192 > :param string: string to be hashed into Tiger192 > :return: a Tiger192 hash
[ "Hash", "a", "password", "using", "Tiger192", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", "into", "Tiger192", ">", ":", "return", ":", "a", "Tiger192", "hash" ]
def tiger192(string, salt=None, front=False, back=False, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) if salt is not None and front and not back: obj = tiger.hash(salt + string) elif salt is not None and back and not front: obj = tiger.hash...
[ "def", "tiger192", "(", "string", ",", "salt", "=", "None", ",", "front", "=", "False", ",", "back", "=", "False", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", "....
Hash a password using Tiger192 > :param string: string to be hashed into Tiger192 > :return: a Tiger192 hash
[ "Hash", "a", "password", "using", "Tiger192", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", "into", "Tiger192", ">", ":", "return", ":", "a", "Tiger192", "hash" ]
[ "\"\"\"\n Hash a password using Tiger192\n\n > :param string: string to be hashed into Tiger192\n > :return: a Tiger192 hash\n\n Example:\n >>> tiger192(\"test\")\n 8d1fd829fc83b37af1e5ba697ce8680d1d8bc430d76682f1\n \"\"\"" ]
[ { "param": "string", "type": null }, { "param": "salt", "type": null }, { "param": "front", "type": null }, { "param": "back", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
crc32
<not_specific>
def crc32(string, salt=None, front=False, back=False, use_hex=False, **placeholder): """ Create a CRC32 hash from a given string > :param string: string to be hashed > :return: a CRC32 hash Example: >>> crc32("test") d87f7e0c >>> crc32("test", use_hex=True) ...
Create a CRC32 hash from a given string > :param string: string to be hashed > :return: a CRC32 hash Example: >>> crc32("test") d87f7e0c >>> crc32("test", use_hex=True) 0xd87f7e0cL
Create a CRC32 hash from a given string > :param string: string to be hashed > :return: a CRC32 hash
[ "Create", "a", "CRC32", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "CRC32", "hash" ]
def crc32(string, salt=None, front=False, back=False, use_hex=False, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) if salt is not None and front and not back: long_int = hex(zlib.crc32(salt + string) % 2 ** 32) elif salt is not None and back and not...
[ "def", "crc32", "(", "string", ",", "salt", "=", "None", ",", "front", "=", "False", ",", "back", "=", "False", ",", "use_hex", "=", "False", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=",...
Create a CRC32 hash from a given string > :param string: string to be hashed > :return: a CRC32 hash
[ "Create", "a", "CRC32", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "CRC32", "hash" ]
[ "\"\"\"\n Create a CRC32 hash from a given string\n\n > :param string: string to be hashed\n > :return: a CRC32 hash\n\n Example:\n >>> crc32(\"test\")\n d87f7e0c\n >>> crc32(\"test\", use_hex=True)\n 0xd87f7e0cL\n \"\"\"" ]
[ { "param": "string", "type": null }, { "param": "salt", "type": null }, { "param": "front", "type": null }, { "param": "back", "type": null }, { "param": "use_hex", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
crc64
<not_specific>
def crc64(string, salt=None, front=False, back=False, use_hex=False, **placeholder): """ Create a CRC64 hash from a given string > :param string: string to be hashed > :return: a CRC64 hash Example: >>> crc64("test") bf3d60cae58eeb8e >>> crc64("test", use_hex=True) ...
Create a CRC64 hash from a given string > :param string: string to be hashed > :return: a CRC64 hash Example: >>> crc64("test") bf3d60cae58eeb8e >>> crc64("test", use_hex=True) 0xbf3d60cae58eeb8eL
Create a CRC64 hash from a given string > :param string: string to be hashed > :return: a CRC64 hash
[ "Create", "a", "CRC64", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "CRC64", "hash" ]
def crc64(string, salt=None, front=False, back=False, use_hex=False, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) if salt is not None and front and not back: long_int = _crc64.crc64(salt + string) elif salt is not None and back and not front: ...
[ "def", "crc64", "(", "string", ",", "salt", "=", "None", ",", "front", "=", "False", ",", "back", "=", "False", ",", "use_hex", "=", "False", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=",...
Create a CRC64 hash from a given string > :param string: string to be hashed > :return: a CRC64 hash
[ "Create", "a", "CRC64", "hash", "from", "a", "given", "string", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "CRC64", "hash" ]
[ "\"\"\"\n Create a CRC64 hash from a given string\n\n > :param string: string to be hashed\n > :return: a CRC64 hash\n\n Example:\n >>> crc64(\"test\")\n bf3d60cae58eeb8e\n >>> crc64(\"test\", use_hex=True)\n 0xbf3d60cae58eeb8eL\n \"\"\"" ]
[ { "param": "string", "type": null }, { "param": "salt", "type": null }, { "param": "front", "type": null }, { "param": "back", "type": null }, { "param": "use_hex", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
ntlm
<not_specific>
def ntlm(string, **placeholder): """ Create an NTLM hash, identical to the one used in Windows protocol > :param string: string to be hashed > :return: a NTLM hashed string Example: >>> ntlm("test") 0cb6948805f797bf2a82807973b89537 """ if type(string) is unicode: ...
Create an NTLM hash, identical to the one used in Windows protocol > :param string: string to be hashed > :return: a NTLM hashed string Example: >>> ntlm("test") 0cb6948805f797bf2a82807973b89537
Create an NTLM hash, identical to the one used in Windows protocol > :param string: string to be hashed > :return: a NTLM hashed string
[ "Create", "an", "NTLM", "hash", "identical", "to", "the", "one", "used", "in", "Windows", "protocol", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "NTLM", "hashed", "string" ]
def ntlm(string, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) obj = hashlib.new("md4") obj.update(string.encode("utf-16le")) data = obj.digest() return binascii.hexlify(data)
[ "def", "ntlm", "(", "string", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", ".", "force_encoding", "(", "string", ")", "obj", "=", "hashlib", ".", "new", "(", "\"md4...
Create an NTLM hash, identical to the one used in Windows protocol > :param string: string to be hashed > :return: a NTLM hashed string
[ "Create", "an", "NTLM", "hash", "identical", "to", "the", "one", "used", "in", "Windows", "protocol", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "NTLM", "hashed", "string" ]
[ "\"\"\"\n Create an NTLM hash, identical to the one used in Windows protocol\n\n > :param string: string to be hashed\n > :return: a NTLM hashed string\n\n Example:\n >>> ntlm(\"test\")\n 0cb6948805f797bf2a82807973b89537\n \"\"\"" ]
[ { "param": "string", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [ { "identifier": "examples", "docstring": null,...
c70e3d2df6679a06f28391115214b1a0698b945b
fir3storm/Dagon
thirdparty/md2/md2_hash.py
[ "MIT" ]
Python
readchars
<not_specific>
def readchars(f): "Returns an iteration over the characters in a file." while True: b = f.read(1) if (b == ""): return yield b
Returns an iteration over the characters in a file.
Returns an iteration over the characters in a file.
[ "Returns", "an", "iteration", "over", "the", "characters", "in", "a", "file", "." ]
def readchars(f): while True: b = f.read(1) if (b == ""): return yield b
[ "def", "readchars", "(", "f", ")", ":", "while", "True", ":", "b", "=", "f", ".", "read", "(", "1", ")", "if", "(", "b", "==", "\"\"", ")", ":", "return", "yield", "b" ]
Returns an iteration over the characters in a file.
[ "Returns", "an", "iteration", "over", "the", "characters", "in", "a", "file", "." ]
[ "\"Returns an iteration over the characters in a file.\"" ]
[ { "param": "f", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "f", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
537cfdb49e6ba61c634ed4d99a508502a9aec8f6
m-o-leary/f1-analysis
src/f1lib/setup_mpl.py
[ "MIT" ]
Python
heatmap
<not_specific>
def heatmap(data, row_labels, col_labels, ax=None, cbar_kw={}, cbarlabel="", **kwargs): """ Create a heatmap from a numpy array and two lists of labels. Parameters ---------- data A 2D numpy array of shape (N, M). row_labels A list or array of length N with the label...
Create a heatmap from a numpy array and two lists of labels. Parameters ---------- data A 2D numpy array of shape (N, M). row_labels A list or array of length N with the labels for the rows. col_labels A list or array of length M with the labels for the columns. ax ...
Create a heatmap from a numpy array and two lists of labels. Parameters data A 2D numpy array of shape (N, M). row_labels A list or array of length N with the labels for the rows. col_labels A list or array of length M with the labels for the columns. ax A `matplotlib.axes.Axes` instance to which the heatmap is plotte...
[ "Create", "a", "heatmap", "from", "a", "numpy", "array", "and", "two", "lists", "of", "labels", ".", "Parameters", "data", "A", "2D", "numpy", "array", "of", "shape", "(", "N", "M", ")", ".", "row_labels", "A", "list", "or", "array", "of", "length", ...
def heatmap(data, row_labels, col_labels, ax=None, cbar_kw={}, cbarlabel="", **kwargs): if not ax: ax = plt.gca() im = ax.imshow(data, **kwargs) ax.set_xticks(np.arange(data.shape[1])) ax.set_yticks(np.arange(data.shape[0])) ax.set_xticklabels(col_labels) ax.set_yticklabels(r...
[ "def", "heatmap", "(", "data", ",", "row_labels", ",", "col_labels", ",", "ax", "=", "None", ",", "cbar_kw", "=", "{", "}", ",", "cbarlabel", "=", "\"\"", ",", "**", "kwargs", ")", ":", "if", "not", "ax", ":", "ax", "=", "plt", ".", "gca", "(", ...
Create a heatmap from a numpy array and two lists of labels.
[ "Create", "a", "heatmap", "from", "a", "numpy", "array", "and", "two", "lists", "of", "labels", "." ]
[ "\"\"\"\n Create a heatmap from a numpy array and two lists of labels.\n\n Parameters\n ----------\n data\n A 2D numpy array of shape (N, M).\n row_labels\n A list or array of length N with the labels for the rows.\n col_labels\n A list or array of length M with the labels for...
[ { "param": "data", "type": null }, { "param": "row_labels", "type": null }, { "param": "col_labels", "type": null }, { "param": "ax", "type": null }, { "param": "cbar_kw", "type": null }, { "param": "cbarlabel", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "row_labels", "type": null, "docstring": null, "docstring_toke...
b5fe55ddac17406e41467194f7bb639c62cef2ba
m-o-leary/f1-analysis
src/f1lib/plot_drivers.py
[ "MIT" ]
Python
plot_relative_pace
None
def plot_relative_pace(laptimes: ff1.core.Laps, session : str="fp3") -> None: """ Provided with Laps object, plot the relative pace. """ fig = ((laptimes[[session]] - laptimes[[session]].min()) .sort_values(session, ascending=False) .plot(kind='barh', figsize=(7,10))) plt.grid() ...
Provided with Laps object, plot the relative pace.
Provided with Laps object, plot the relative pace.
[ "Provided", "with", "Laps", "object", "plot", "the", "relative", "pace", "." ]
def plot_relative_pace(laptimes: ff1.core.Laps, session : str="fp3") -> None: fig = ((laptimes[[session]] - laptimes[[session]].min()) .sort_values(session, ascending=False) .plot(kind='barh', figsize=(7,10))) plt.grid() plt.show()
[ "def", "plot_relative_pace", "(", "laptimes", ":", "ff1", ".", "core", ".", "Laps", ",", "session", ":", "str", "=", "\"fp3\"", ")", "->", "None", ":", "fig", "=", "(", "(", "laptimes", "[", "[", "session", "]", "]", "-", "laptimes", "[", "[", "ses...
Provided with Laps object, plot the relative pace.
[ "Provided", "with", "Laps", "object", "plot", "the", "relative", "pace", "." ]
[ "\"\"\"\n Provided with Laps object, plot the relative pace.\n \"\"\"" ]
[ { "param": "laptimes", "type": "ff1.core.Laps" }, { "param": "session", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "laptimes", "type": "ff1.core.Laps", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "session", "type": "str", "docstring": null, "d...
280f97cbe391512cbf97b67a0547949de69e032c
m-o-leary/f1-analysis
src/f1lib/data_prep.py
[ "MIT" ]
Python
prep_for_lap_plot
pd.DataFrame
def prep_for_lap_plot(self) -> pd.DataFrame: """ Prepare data for plotting a relative gap plot over all laps. Returns: pd.DataFrame: Dataframe with a column for each driver with an entry for each lap. The enties are the relative gap for that lap from the average laoptim...
Prepare data for plotting a relative gap plot over all laps. Returns: pd.DataFrame: Dataframe with a column for each driver with an entry for each lap. The enties are the relative gap for that lap from the average laoptime on that lap based on the best time + 10% (to account f...
Prepare data for plotting a relative gap plot over all laps.
[ "Prepare", "data", "for", "plotting", "a", "relative", "gap", "plot", "over", "all", "laps", "." ]
def prep_for_lap_plot(self) -> pd.DataFrame: df = ( self.get_laps() .assign(LapTimeNorm=lambda df: df.apply(lambda row: row['Time'] - row["LapStartTime"], axis=1)) .assign(LapTimeSeconds=lambda df: [i.seconds for i in df["LapTimeNorm"]]) ) ref = self.get_refer...
[ "def", "prep_for_lap_plot", "(", "self", ")", "->", "pd", ".", "DataFrame", ":", "df", "=", "(", "self", ".", "get_laps", "(", ")", ".", "assign", "(", "LapTimeNorm", "=", "lambda", "df", ":", "df", ".", "apply", "(", "lambda", "row", ":", "row", "...
Prepare data for plotting a relative gap plot over all laps.
[ "Prepare", "data", "for", "plotting", "a", "relative", "gap", "plot", "over", "all", "laps", "." ]
[ "\"\"\"\n Prepare data for plotting a relative gap plot over all laps.\n\n Returns:\n pd.DataFrame: Dataframe with a column for each driver with an entry for each lap. \n The enties are the relative gap for that lap from the average laoptime on that lap based on the best time + 1...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Dataframe with a column for each driver with an entry for each lap.\nThe enties are the relative gap for that lap from the average laoptime on that lap based on the best time + 10% (to account for pitting)", "docstring_tokens": [ "Dataframe", "with", ...
e024b21596a30f4470e60100ffc155e9b239475f
dlarkinc/soft8023-darts-04
app/gameimpl/x01_match.py
[ "MIT" ]
Python
check_winning_condition
<not_specific>
def check_winning_condition(self, player_index, visit): """returns 1, 2 or 3 for when a dart closes the game / leg (i.e. finishing double) or 0 if not closed out :param player_index: position of player details in various lists :param visit: a list of 3 Darts (each containing multiplier and segm...
returns 1, 2 or 3 for when a dart closes the game / leg (i.e. finishing double) or 0 if not closed out :param player_index: position of player details in various lists :param visit: a list of 3 Darts (each containing multiplier and segment) :return: 0, 1, 2 or 3
returns 1, 2 or 3 for when a dart closes the game / leg or 0 if not closed out
[ "returns", "1", "2", "or", "3", "for", "when", "a", "dart", "closes", "the", "game", "/", "leg", "or", "0", "if", "not", "closed", "out" ]
def check_winning_condition(self, player_index, visit): i = 0 for dart in visit.darts: i = i + 1 if dart.multiplier == DartMultiplier.DOUBLE and self.scores[player_index] - dart.get_score() == 0: self.scores[player_index] = 0 self.match.status = Ma...
[ "def", "check_winning_condition", "(", "self", ",", "player_index", ",", "visit", ")", ":", "i", "=", "0", "for", "dart", "in", "visit", ".", "darts", ":", "i", "=", "i", "+", "1", "if", "dart", ".", "multiplier", "==", "DartMultiplier", ".", "DOUBLE",...
returns 1, 2 or 3 for when a dart closes the game / leg (i.e.
[ "returns", "1", "2", "or", "3", "for", "when", "a", "dart", "closes", "the", "game", "/", "leg", "(", "i", ".", "e", "." ]
[ "\"\"\"returns 1, 2 or 3 for when a dart closes the game / leg (i.e. finishing double) or 0 if not closed out\n\n :param player_index: position of player details in various lists\n :param visit: a list of 3 Darts (each containing multiplier and segment)\n :return: 0, 1, 2 or 3\n \"\"\"",...
[ { "param": "self", "type": null }, { "param": "player_index", "type": null }, { "param": "visit", "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 ...
e024b21596a30f4470e60100ffc155e9b239475f
dlarkinc/soft8023-darts-04
app/gameimpl/x01_match.py
[ "MIT" ]
Python
record_statistics
null
def record_statistics(self, player_index, visit, result): """Store stats both for in-memory immediate use and send a message to the stats consumer (micro)service :return: """ if result is not 0: visit.remove_trailing_darts(result) # a double finished the game, so ignore any...
Store stats both for in-memory immediate use and send a message to the stats consumer (micro)service :return:
Store stats both for in-memory immediate use and send a message to the stats consumer (micro)service
[ "Store", "stats", "both", "for", "in", "-", "memory", "immediate", "use", "and", "send", "a", "message", "to", "the", "stats", "consumer", "(", "micro", ")", "service" ]
def record_statistics(self, player_index, visit, result): if result is not 0: visit.remove_trailing_darts(result) self.match.visits[player_index].append(visit) if len(self.match.visits[player_index]) == 3: self.first9[player_index] = (STARTING_TOTAL - self.scores[player...
[ "def", "record_statistics", "(", "self", ",", "player_index", ",", "visit", ",", "result", ")", ":", "if", "result", "is", "not", "0", ":", "visit", ".", "remove_trailing_darts", "(", "result", ")", "self", ".", "match", ".", "visits", "[", "player_index",...
Store stats both for in-memory immediate use and send a message to the stats consumer (micro)service
[ "Store", "stats", "both", "for", "in", "-", "memory", "immediate", "use", "and", "send", "a", "message", "to", "the", "stats", "consumer", "(", "micro", ")", "service" ]
[ "\"\"\"Store stats both for in-memory immediate use and send a message to the stats consumer (micro)service\n\n :return:\n \"\"\"", "# a double finished the game, so ignore any subsequent darts", "# Calculate first 9 if, and only if, this is the 3rd visit", "# Calculate single-dart average takin...
[ { "param": "self", "type": null }, { "param": "player_index", "type": null }, { "param": "visit", "type": null }, { "param": "result", "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 ...
1dd082aae62520728c053bdf1f77169c1bf2ad00
vegadodo/project-euler-python
p004.py
[ "MIT" ]
Python
is_palindrome
<not_specific>
def is_palindrome(n): """Determine whether n is palindrome.""" # Convert the given number into list. number_original = list(map(int, str(n))) # First, store a copy of the list of original number. number_reversed = number_original[:] # Then, reverse the list. number_reversed.reverse() r...
Determine whether n is palindrome.
Determine whether n is palindrome.
[ "Determine", "whether", "n", "is", "palindrome", "." ]
def is_palindrome(n): number_original = list(map(int, str(n))) number_reversed = number_original[:] number_reversed.reverse() return number_original == number_reversed
[ "def", "is_palindrome", "(", "n", ")", ":", "number_original", "=", "list", "(", "map", "(", "int", ",", "str", "(", "n", ")", ")", ")", "number_reversed", "=", "number_original", "[", ":", "]", "number_reversed", ".", "reverse", "(", ")", "return", "n...
Determine whether n is palindrome.
[ "Determine", "whether", "n", "is", "palindrome", "." ]
[ "\"\"\"Determine whether n is palindrome.\"\"\"", "# Convert the given number into list.", "# First, store a copy of the list of original number.", "# Then, reverse the list." ]
[ { "param": "n", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "n", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1dd082aae62520728c053bdf1f77169c1bf2ad00
vegadodo/project-euler-python
p004.py
[ "MIT" ]
Python
is_prod_of_two_3_digit_num
<not_specific>
def is_prod_of_two_3_digit_num(n): """Determine whether n is the product of 3-digit numbers.""" result = False for i in range(100, 1000): if n % i == 0 and n // i in range(100, 1000): result = True break return result
Determine whether n is the product of 3-digit numbers.
Determine whether n is the product of 3-digit numbers.
[ "Determine", "whether", "n", "is", "the", "product", "of", "3", "-", "digit", "numbers", "." ]
def is_prod_of_two_3_digit_num(n): result = False for i in range(100, 1000): if n % i == 0 and n // i in range(100, 1000): result = True break return result
[ "def", "is_prod_of_two_3_digit_num", "(", "n", ")", ":", "result", "=", "False", "for", "i", "in", "range", "(", "100", ",", "1000", ")", ":", "if", "n", "%", "i", "==", "0", "and", "n", "//", "i", "in", "range", "(", "100", ",", "1000", ")", "...
Determine whether n is the product of 3-digit numbers.
[ "Determine", "whether", "n", "is", "the", "product", "of", "3", "-", "digit", "numbers", "." ]
[ "\"\"\"Determine whether n is the product of 3-digit numbers.\"\"\"" ]
[ { "param": "n", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "n", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
03dc86f99a75121718b0ff78faf2ebd898e06ed8
vegadodo/project-euler-python
p007.py
[ "MIT" ]
Python
is_prime
<not_specific>
def is_prime(num_to_check): """Determine if num_to_check is a prime.""" for prime in primes: # We use primes found so far to determine # whether num_to_check is a prime. # If num_to_check is divisible by any of primes, # then num_to_check is not a prime number. if num_to_...
Determine if num_to_check is a prime.
Determine if num_to_check is a prime.
[ "Determine", "if", "num_to_check", "is", "a", "prime", "." ]
def is_prime(num_to_check): for prime in primes: if num_to_check % prime == 0: return False return True
[ "def", "is_prime", "(", "num_to_check", ")", ":", "for", "prime", "in", "primes", ":", "if", "num_to_check", "%", "prime", "==", "0", ":", "return", "False", "return", "True" ]
Determine if num_to_check is a prime.
[ "Determine", "if", "num_to_check", "is", "a", "prime", "." ]
[ "\"\"\"Determine if num_to_check is a prime.\"\"\"", "# We use primes found so far to determine", "# whether num_to_check is a prime.", "# If num_to_check is divisible by any of primes,", "# then num_to_check is not a prime number." ]
[ { "param": "num_to_check", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "num_to_check", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9de9b7dad2ddc729645f138148b4be204ce5edb6
vegadodo/project-euler-python
p003.py
[ "MIT" ]
Python
is_prime
<not_specific>
def is_prime(n): """Determine whether the given integer n is prime.""" result = True for i in range(n - 1, 2, -1): if n % i == 0: # If n is divisible by a smaller integer, then n is not prime. result = False break return result
Determine whether the given integer n is prime.
Determine whether the given integer n is prime.
[ "Determine", "whether", "the", "given", "integer", "n", "is", "prime", "." ]
def is_prime(n): result = True for i in range(n - 1, 2, -1): if n % i == 0: result = False break return result
[ "def", "is_prime", "(", "n", ")", ":", "result", "=", "True", "for", "i", "in", "range", "(", "n", "-", "1", ",", "2", ",", "-", "1", ")", ":", "if", "n", "%", "i", "==", "0", ":", "result", "=", "False", "break", "return", "result" ]
Determine whether the given integer n is prime.
[ "Determine", "whether", "the", "given", "integer", "n", "is", "prime", "." ]
[ "\"\"\"Determine whether the given integer n is prime.\"\"\"", "# If n is divisible by a smaller integer, then n is not prime." ]
[ { "param": "n", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "n", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e7a249b634c52d92a1e7465e6adeb2c93a04d443
benwhalley/django-feedmapper
feedmapper/models.py
[ "BSD-3-Clause" ]
Python
parse
null
def parse(self): "Dynamically pull in this mapping's parser and parse the mapping." module_path, parser_class = self.parser.rsplit('.', 1) module = __import__(module_path, fromlist=[parser_class]) parser_class = getattr(module, parser_class) parser = parser_class(self) pa...
Dynamically pull in this mapping's parser and parse the mapping.
Dynamically pull in this mapping's parser and parse the mapping.
[ "Dynamically", "pull", "in", "this", "mapping", "'", "s", "parser", "and", "parse", "the", "mapping", "." ]
def parse(self): module_path, parser_class = self.parser.rsplit('.', 1) module = __import__(module_path, fromlist=[parser_class]) parser_class = getattr(module, parser_class) parser = parser_class(self) parser.parse()
[ "def", "parse", "(", "self", ")", ":", "module_path", ",", "parser_class", "=", "self", ".", "parser", ".", "rsplit", "(", "'.'", ",", "1", ")", "module", "=", "__import__", "(", "module_path", ",", "fromlist", "=", "[", "parser_class", "]", ")", "pars...
Dynamically pull in this mapping's parser and parse the mapping.
[ "Dynamically", "pull", "in", "this", "mapping", "'", "s", "parser", "and", "parse", "the", "mapping", "." ]
[ "\"Dynamically pull in this mapping's parser and parse the mapping.\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e7a249b634c52d92a1e7465e6adeb2c93a04d443
benwhalley/django-feedmapper
feedmapper/models.py
[ "BSD-3-Clause" ]
Python
save
null
def save(self, *args, **kwargs): "Create or update a django-celery periodic task for this mapping." super(Mapping, self).save(*args, **kwargs) from djcelery.models import CrontabSchedule, PeriodicTask crontab, created = CrontabSchedule.objects.get_or_create(minute='0', ho...
Create or update a django-celery periodic task for this mapping.
Create or update a django-celery periodic task for this mapping.
[ "Create", "or", "update", "a", "django", "-", "celery", "periodic", "task", "for", "this", "mapping", "." ]
def save(self, *args, **kwargs): super(Mapping, self).save(*args, **kwargs) from djcelery.models import CrontabSchedule, PeriodicTask crontab, created = CrontabSchedule.objects.get_or_create(minute='0', hour='*', day_of_week='*') task = 'feedmapper.tasks.feedmapper_sync' ...
[ "def", "save", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "super", "(", "Mapping", ",", "self", ")", ".", "save", "(", "*", "args", ",", "**", "kwargs", ")", "from", "djcelery", ".", "models", "import", "CrontabSchedule", ",", "P...
Create or update a django-celery periodic task for this mapping.
[ "Create", "or", "update", "a", "django", "-", "celery", "periodic", "task", "for", "this", "mapping", "." ]
[ "\"Create or update a django-celery periodic task for this mapping.\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
dd95b992633937eebf81cb397faa33d394a049e7
benwhalley/django-feedmapper
feedmapper/tasks.py
[ "BSD-3-Clause" ]
Python
feedmapper_sync
null
def feedmapper_sync(mapping_id): "Grab the requested Mapping and parse it." try: mapping = Mapping.objects.get(pk=mapping_id) mapping.parse() except Mapping.DoesNotExist: logger = feedmapper_sync.get_logger() logger.info("feedmapper_sync failed for mapping with ID %s" % mappi...
Grab the requested Mapping and parse it.
Grab the requested Mapping and parse it.
[ "Grab", "the", "requested", "Mapping", "and", "parse", "it", "." ]
def feedmapper_sync(mapping_id): try: mapping = Mapping.objects.get(pk=mapping_id) mapping.parse() except Mapping.DoesNotExist: logger = feedmapper_sync.get_logger() logger.info("feedmapper_sync failed for mapping with ID %s" % mapping_id)
[ "def", "feedmapper_sync", "(", "mapping_id", ")", ":", "try", ":", "mapping", "=", "Mapping", ".", "objects", ".", "get", "(", "pk", "=", "mapping_id", ")", "mapping", ".", "parse", "(", ")", "except", "Mapping", ".", "DoesNotExist", ":", "logger", "=", ...
Grab the requested Mapping and parse it.
[ "Grab", "the", "requested", "Mapping", "and", "parse", "it", "." ]
[ "\"Grab the requested Mapping and parse it.\"" ]
[ { "param": "mapping_id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mapping_id", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
926d854be5f7fb3ef589dae4ef4533e4f159f74d
iepngs/python-socketio
tests/test_asyncio_manager.py
[ "MIT" ]
Python
AsyncMock
<not_specific>
def AsyncMock(*args, **kwargs): """Return a mock asynchronous function.""" m = mock.MagicMock(*args, **kwargs) @coroutine def mock_coro(*args, **kwargs): return m(*args, **kwargs) mock_coro.mock = m return mock_coro
Return a mock asynchronous function.
Return a mock asynchronous function.
[ "Return", "a", "mock", "asynchronous", "function", "." ]
def AsyncMock(*args, **kwargs): m = mock.MagicMock(*args, **kwargs) @coroutine def mock_coro(*args, **kwargs): return m(*args, **kwargs) mock_coro.mock = m return mock_coro
[ "def", "AsyncMock", "(", "*", "args", ",", "**", "kwargs", ")", ":", "m", "=", "mock", ".", "MagicMock", "(", "*", "args", ",", "**", "kwargs", ")", "@", "coroutine", "def", "mock_coro", "(", "*", "args", ",", "**", "kwargs", ")", ":", "return", ...
Return a mock asynchronous function.
[ "Return", "a", "mock", "asynchronous", "function", "." ]
[ "\"\"\"Return a mock asynchronous function.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7f4fe4ab297d22256a5a870c870261295dff0b80
iepngs/python-socketio
examples/wsgi/app.py
[ "MIT" ]
Python
background_thread
null
def background_thread(): """Example of how to send server generated events to clients.""" count = 0 while True: sio.sleep(10) count += 1 sio.emit('my response', {'data': 'Server generated event'}, namespace='/test')
Example of how to send server generated events to clients.
Example of how to send server generated events to clients.
[ "Example", "of", "how", "to", "send", "server", "generated", "events", "to", "clients", "." ]
def background_thread(): count = 0 while True: sio.sleep(10) count += 1 sio.emit('my response', {'data': 'Server generated event'}, namespace='/test')
[ "def", "background_thread", "(", ")", ":", "count", "=", "0", "while", "True", ":", "sio", ".", "sleep", "(", "10", ")", "count", "+=", "1", "sio", ".", "emit", "(", "'my response'", ",", "{", "'data'", ":", "'Server generated event'", "}", ",", "names...
Example of how to send server generated events to clients.
[ "Example", "of", "how", "to", "send", "server", "generated", "events", "to", "clients", "." ]
[ "\"\"\"Example of how to send server generated events to clients.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
f164283aa6ee0834bde0ddc4313c04ec8a91f684
kvmu/KURRI-workterm
side_project_kiwamu/rk4_CsNeu_writeData.py
[ "MIT" ]
Python
rk4_solve
<not_specific>
def rk4_solve(CS135, CS133, XE135, XE134, XE133, XE132, BA135, fCS135, fCS133, fXE135, fXE134, fXE133, fXE132, fBA135, dt): """ This function solves the system of equations describing the dynamics of neutron-production via muon transmutation. It takes in the initial values of the problem and retu...
This function solves the system of equations describing the dynamics of neutron-production via muon transmutation. It takes in the initial values of the problem and returns the value after 1 step of the Runge-Kutta algorithm.
This function solves the system of equations describing the dynamics of neutron-production via muon transmutation. It takes in the initial values of the problem and returns the value after 1 step of the Runge-Kutta algorithm.
[ "This", "function", "solves", "the", "system", "of", "equations", "describing", "the", "dynamics", "of", "neutron", "-", "production", "via", "muon", "transmutation", ".", "It", "takes", "in", "the", "initial", "values", "of", "the", "problem", "and", "returns...
def rk4_solve(CS135, CS133, XE135, XE134, XE133, XE132, BA135, fCS135, fCS133, fXE135, fXE134, fXE133, fXE132, fBA135, dt): CS135_1 = fCS135(CS135, CS133, XE135, XE134, XE133, XE132, BA135)*dt CS133_1 = fCS133(CS135, CS133, XE135, XE134, XE133, XE132, BA135)*dt XE135_1 = fXE135(CS135, CS133, XE135, XE134, X...
[ "def", "rk4_solve", "(", "CS135", ",", "CS133", ",", "XE135", ",", "XE134", ",", "XE133", ",", "XE132", ",", "BA135", ",", "fCS135", ",", "fCS133", ",", "fXE135", ",", "fXE134", ",", "fXE133", ",", "fXE132", ",", "fBA135", ",", "dt", ")", ":", "CS1...
This function solves the system of equations describing the dynamics of neutron-production via muon transmutation.
[ "This", "function", "solves", "the", "system", "of", "equations", "describing", "the", "dynamics", "of", "neutron", "-", "production", "via", "muon", "transmutation", "." ]
[ "\"\"\" \n \n This function solves the system of equations describing the dynamics\n of neutron-production via muon transmutation. It takes in the\n initial values of the problem and returns the value after 1 step\n of the Runge-Kutta algorithm.\n \n \"\"\"" ]
[ { "param": "CS135", "type": null }, { "param": "CS133", "type": null }, { "param": "XE135", "type": null }, { "param": "XE134", "type": null }, { "param": "XE133", "type": null }, { "param": "XE132", "type": null }, { "param": "BA135", ...
{ "returns": [], "raises": [], "params": [ { "identifier": "CS135", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "CS133", "type": null, "docstring": null, "docstring_tokens":...
a60c854c7d9191b2a63fd1491288d82f71669009
kvmu/KURRI-workterm
width_delay_beam_experiment/DataAnalysis.py
[ "MIT" ]
Python
load
<not_specific>
def load(self, path_to_file, filename): ''' load's purpose is to load in the raw data. assumes: - valid path_to_file and filenames - that the data file is comma separated and contains time and voltage data in columns 3 and 4, respectively. arguments: ...
load's purpose is to load in the raw data. assumes: - valid path_to_file and filenames - that the data file is comma separated and contains time and voltage data in columns 3 and 4, respectively. arguments: - path_to_file(string): the path to the folder cont...
load's purpose is to load in the raw data. assumes: valid path_to_file and filenames that the data file is comma separated and contains time and voltage data in columns 3 and 4, respectively. the path to the folder containing data the filename of the data sets the filename, data_path, and raw data instance attribut...
[ "load", "'", "s", "purpose", "is", "to", "load", "in", "the", "raw", "data", ".", "assumes", ":", "valid", "path_to_file", "and", "filenames", "that", "the", "data", "file", "is", "comma", "separated", "and", "contains", "time", "and", "voltage", "data", ...
def load(self, path_to_file, filename): self.filename = filename self.data_path = path_to_file mat = np.genfromtxt(self.data_path + self.filename, delimiter=',', usecols=(3,4)) self.raw_t, self.raw_V = mat[:,0]-mat[0,0], mat[:,1] self.raw_numturns = se...
[ "def", "load", "(", "self", ",", "path_to_file", ",", "filename", ")", ":", "self", ".", "filename", "=", "filename", "self", ".", "data_path", "=", "path_to_file", "mat", "=", "np", ".", "genfromtxt", "(", "self", ".", "data_path", "+", "self", ".", "...
load's purpose is to load in the raw data.
[ "load", "'", "s", "purpose", "is", "to", "load", "in", "the", "raw", "data", "." ]
[ "'''\n load's purpose is to load in the raw data.\n\n assumes:\n - valid path_to_file and filenames\n\n - that the data file is comma separated and contains time and voltage\n data in columns 3 and 4, respectively.\n\n arguments:\n - path_to_file(string): the path ...
[ { "param": "self", "type": null }, { "param": "path_to_file", "type": null }, { "param": "filename", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "path_to_file", "type": null, "docstring": null, "docstring_to...
a60c854c7d9191b2a63fd1491288d82f71669009
kvmu/KURRI-workterm
width_delay_beam_experiment/DataAnalysis.py
[ "MIT" ]
Python
clean
<not_specific>
def clean(self, trim_start=10000, trim_stop=50000, noise_filname='rf_noise.csv'): ''' clean has two purposes: trim the data to specify the signal region, and remove the rf noise data from the raw voltage data. If None or 'None' is passed in for the noise_filename, the data...
clean has two purposes: trim the data to specify the signal region, and remove the rf noise data from the raw voltage data. If None or 'None' is passed in for the noise_filename, the data is only trimmed. assumes: that the load() method has been already called and ther...
clean has two purposes: trim the data to specify the signal region, and remove the rf noise data from the raw voltage data. If None or 'None' is passed in for the noise_filename, the data is only trimmed. that the load() method has been already called and there is raw data to be cleaned. the start index (excluding i...
[ "clean", "has", "two", "purposes", ":", "trim", "the", "data", "to", "specify", "the", "signal", "region", "and", "remove", "the", "rf", "noise", "data", "from", "the", "raw", "voltage", "data", ".", "If", "None", "or", "'", "None", "'", "is", "passed"...
def clean(self, trim_start=10000, trim_stop=50000, noise_filname='rf_noise.csv'): if noise_filname is None or noise_filname == 'None': self.clean_V = self.raw_V[trim_start:trim_stop] else: noise_dat = np.genfromtxt(self.data_path + noise_filname, ...
[ "def", "clean", "(", "self", ",", "trim_start", "=", "10000", ",", "trim_stop", "=", "50000", ",", "noise_filname", "=", "'rf_noise.csv'", ")", ":", "if", "noise_filname", "is", "None", "or", "noise_filname", "==", "'None'", ":", "self", ".", "clean_V", "=...
clean has two purposes: trim the data to specify the signal region, and remove the rf noise data from the raw voltage data.
[ "clean", "has", "two", "purposes", ":", "trim", "the", "data", "to", "specify", "the", "signal", "region", "and", "remove", "the", "rf", "noise", "data", "from", "the", "raw", "voltage", "data", "." ]
[ "'''\n clean has two purposes: trim the data to specify the signal region,\n and remove the rf noise data from the raw voltage data.\n\n If None or 'None' is passed in for the noise_filename, the data is\n only trimmed.\n\n assumes:\n that the load() method has been already...
[ { "param": "self", "type": null }, { "param": "trim_start", "type": null }, { "param": "trim_stop", "type": null }, { "param": "noise_filname", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "trim_start", "type": null, "docstring": null, "docstring_toke...
a60c854c7d9191b2a63fd1491288d82f71669009
kvmu/KURRI-workterm
width_delay_beam_experiment/DataAnalysis.py
[ "MIT" ]
Python
calculate_envelope
<not_specific>
def calculate_envelope(self, neg = False): ''' Calculate_envelope: calculates the positive envelop of the given waveform by default (neg = True, for negative envelope) and fits the envelop to a model function. assumes: - the waveform contains clean data -- i.e. waveform....
Calculate_envelope: calculates the positive envelop of the given waveform by default (neg = True, for negative envelope) and fits the envelop to a model function. assumes: - the waveform contains clean data -- i.e. waveform.clean(..) has been called. argument...
calculates the positive envelop of the given waveform by default (neg = True, for negative envelope) and fits the envelop to a model function. the waveform contains clean data -- i.e. a boolean flag which determines if the positive envelope or negative envelope (default False -- positive envelope) is needed. sets th...
[ "calculates", "the", "positive", "envelop", "of", "the", "given", "waveform", "by", "default", "(", "neg", "=", "True", "for", "negative", "envelope", ")", "and", "fits", "the", "envelop", "to", "a", "model", "function", ".", "the", "waveform", "contains", ...
def calculate_envelope(self, neg = False): Then I run the algorithm again, on the result of the first run the net effect is a smoothing out of the maxima and we end up with the envelope. This sometimes has a bit of noise in the final result -- but works most of the time. ...
[ "def", "calculate_envelope", "(", "self", ",", "neg", "=", "False", ")", ":", "tempx", ",", "tempy", "=", "peak_detect", "(", "self", ".", "waveform", ".", "clean_t", ",", "self", ".", "waveform", ".", "clean_V", ")", "self", ".", "envelope_t", ",", "s...
Calculate_envelope: calculates the positive envelop of the given waveform by default (neg = True, for negative envelope) and fits the envelop to a model function.
[ "Calculate_envelope", ":", "calculates", "the", "positive", "envelop", "of", "the", "given", "waveform", "by", "default", "(", "neg", "=", "True", "for", "negative", "envelope", ")", "and", "fits", "the", "envelop", "to", "a", "model", "function", "." ]
[ "'''\n Calculate_envelope: calculates the positive envelop of the given\n waveform by default (neg = True, for negative envelope) and fits\n the envelop to a model function.\n\n assumes:\n - the waveform contains clean data -- i.e. waveform.clean(..) has\n been called.\n\...
[ { "param": "self", "type": null }, { "param": "neg", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "neg", "type": null, "docstring": null, "docstring_tokens": []...
a60c854c7d9191b2a63fd1491288d82f71669009
kvmu/KURRI-workterm
width_delay_beam_experiment/DataAnalysis.py
[ "MIT" ]
Python
step_responseRLC_overdamped
<not_specific>
def step_responseRLC_overdamped(t, a_0, a_1, a_2, alpha, w_d): ''' Callable function used as a model for fitting. This function is the overdamped step response for an RLC second order circuit. assumes: nothing arguments: - t(np.array): the independent variable - a_0(float): the dc comp...
Callable function used as a model for fitting. This function is the overdamped step response for an RLC second order circuit. assumes: nothing arguments: - t(np.array): the independent variable - a_0(float): the dc component of response - a_1(float): related to f(0) - a_2(float): ...
Callable function used as a model for fitting. This function is the overdamped step response for an RLC second order circuit. nothing
[ "Callable", "function", "used", "as", "a", "model", "for", "fitting", ".", "This", "function", "is", "the", "overdamped", "step", "response", "for", "an", "RLC", "second", "order", "circuit", ".", "nothing" ]
def step_responseRLC_overdamped(t, a_0, a_1, a_2, alpha, w_d): return (a_0 + a_1 * np.exp(-alpha * t) * np.cosh(w_d * t) + a_2 * np.exp(-alpha * t) * np.sinh(w_d * t))
[ "def", "step_responseRLC_overdamped", "(", "t", ",", "a_0", ",", "a_1", ",", "a_2", ",", "alpha", ",", "w_d", ")", ":", "return", "(", "a_0", "+", "a_1", "*", "np", ".", "exp", "(", "-", "alpha", "*", "t", ")", "*", "np", ".", "cosh", "(", "w_d...
Callable function used as a model for fitting.
[ "Callable", "function", "used", "as", "a", "model", "for", "fitting", "." ]
[ "'''\n Callable function used as a model for fitting. This function\n is the overdamped step response for an RLC second order circuit.\n\n assumes:\n nothing\n\n arguments:\n - t(np.array): the independent variable\n - a_0(float): the dc component of response\n - a_1(float): related to f(0)\...
[ { "param": "t", "type": null }, { "param": "a_0", "type": null }, { "param": "a_1", "type": null }, { "param": "a_2", "type": null }, { "param": "alpha", "type": null }, { "param": "w_d", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "t", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "a_0", "type": null, "docstring": null, "docstring_tokens": [], ...
a60c854c7d9191b2a63fd1491288d82f71669009
kvmu/KURRI-workterm
width_delay_beam_experiment/DataAnalysis.py
[ "MIT" ]
Python
step_responseRLC_underdamped
<not_specific>
def step_responseRLC_underdamped(t, a_0, a_1, a_2, alpha, w_d): ''' Callable function used as a model for fitting. This function is the underdamped step response for an RLC second order circuit. assumes: nothing arguments: - t(np.array): the independent variable - a_0(float): the dc co...
Callable function used as a model for fitting. This function is the underdamped step response for an RLC second order circuit. assumes: nothing arguments: - t(np.array): the independent variable - a_0(float): the dc component of response - a_1(float): related to f(0) - a_2(float):...
Callable function used as a model for fitting. This function is the underdamped step response for an RLC second order circuit. nothing
[ "Callable", "function", "used", "as", "a", "model", "for", "fitting", ".", "This", "function", "is", "the", "underdamped", "step", "response", "for", "an", "RLC", "second", "order", "circuit", ".", "nothing" ]
def step_responseRLC_underdamped(t, a_0, a_1, a_2, alpha, w_d): return (a_0 + a_1 * np.exp(-alpha * t) * np.cos(w_d * t) + a_2 * np.exp(-alpha * t) * np.sin(w_d * t))
[ "def", "step_responseRLC_underdamped", "(", "t", ",", "a_0", ",", "a_1", ",", "a_2", ",", "alpha", ",", "w_d", ")", ":", "return", "(", "a_0", "+", "a_1", "*", "np", ".", "exp", "(", "-", "alpha", "*", "t", ")", "*", "np", ".", "cos", "(", "w_d...
Callable function used as a model for fitting.
[ "Callable", "function", "used", "as", "a", "model", "for", "fitting", "." ]
[ "'''\n Callable function used as a model for fitting. This function\n is the underdamped step response for an RLC second order circuit.\n\n assumes:\n nothing\n\n arguments:\n - t(np.array): the independent variable\n - a_0(float): the dc component of response\n - a_1(float): related to f(0)...
[ { "param": "t", "type": null }, { "param": "a_0", "type": null }, { "param": "a_1", "type": null }, { "param": "a_2", "type": null }, { "param": "alpha", "type": null }, { "param": "w_d", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "t", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "a_0", "type": null, "docstring": null, "docstring_tokens": [], ...
a60c854c7d9191b2a63fd1491288d82f71669009
kvmu/KURRI-workterm
width_delay_beam_experiment/DataAnalysis.py
[ "MIT" ]
Python
peak_detect
<not_specific>
def peak_detect(xarr, yarr, lookahead = 1, delta=0): ''' Taken from :: sixtenbe (GitHub Gist) https://gist.github.com/sixtenbe Modified to be compatible with this file's structure. Converted from/based on a MATLAB script at: http://billauer.co.il/peakdet.html function for detecting local ...
Taken from :: sixtenbe (GitHub Gist) https://gist.github.com/sixtenbe Modified to be compatible with this file's structure. Converted from/based on a MATLAB script at: http://billauer.co.il/peakdet.html function for detecting local maximas and minmias in a signal. Discovers peaks by sear...
Modified to be compatible with this file's structure. function for detecting local maximas and minmias in a signal. Discovers peaks by searching for values which are surrounded by lower or larger values for maximas and minimas respectively - ym, xm : the maximum values and corresponding x values
[ "Modified", "to", "be", "compatible", "with", "this", "file", "'", "s", "structure", ".", "function", "for", "detecting", "local", "maximas", "and", "minmias", "in", "a", "signal", ".", "Discovers", "peaks", "by", "searching", "for", "values", "which", "are"...
def peak_detect(xarr, yarr, lookahead = 1, delta=0): maxPeaks = [] minPeaks = [] dump = [] length = len(yarr) if lookahead < 1: raise ValueError, "Lookahead must be '1' or above in value" if not (np.isscalar(delta) and delta >= 0): raise ValueError, "delta must be a positive numb...
[ "def", "peak_detect", "(", "xarr", ",", "yarr", ",", "lookahead", "=", "1", ",", "delta", "=", "0", ")", ":", "maxPeaks", "=", "[", "]", "minPeaks", "=", "[", "]", "dump", "=", "[", "]", "length", "=", "len", "(", "yarr", ")", "if", "lookahead", ...
Taken from :: sixtenbe (GitHub Gist) https://gist.github.com/sixtenbe
[ "Taken", "from", "::", "sixtenbe", "(", "GitHub", "Gist", ")", "https", ":", "//", "gist", ".", "github", ".", "com", "/", "sixtenbe" ]
[ "'''\n Taken from :: sixtenbe (GitHub Gist)\n https://gist.github.com/sixtenbe\n\n Modified to be compatible with this file's structure.\n\n Converted from/based on a MATLAB script at:\n http://billauer.co.il/peakdet.html\n\n function for detecting local maximas and minmias in a signal.\n Disco...
[ { "param": "xarr", "type": null }, { "param": "yarr", "type": null }, { "param": "lookahead", "type": null }, { "param": "delta", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "xarr", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "yarr", "type": null, "docstring": null, "docstring_tokens": [...
a60c854c7d9191b2a63fd1491288d82f71669009
kvmu/KURRI-workterm
width_delay_beam_experiment/DataAnalysis.py
[ "MIT" ]
Python
envelope_fit
<not_specific>
def envelope_fit(t, V, verbose = True): ''' Uses the package lmfit to fit the given data: t and V. The model for this fit is an overdamped step response of a second order RLC circuit. assumes: - the data is suitable for the fitting model of overdamped step response of a second order RLC circu...
Uses the package lmfit to fit the given data: t and V. The model for this fit is an overdamped step response of a second order RLC circuit. assumes: - the data is suitable for the fitting model of overdamped step response of a second order RLC circuit. arguments: - t: the time-axis (or ...
Uses the package lmfit to fit the given data: t and V. The model for this fit is an overdamped step response of a second order RLC circuit. the data is suitable for the fitting model of overdamped step response of a second order RLC circuit. the time-axis (or x-axis) of data V: the voltage values the model object c...
[ "Uses", "the", "package", "lmfit", "to", "fit", "the", "given", "data", ":", "t", "and", "V", ".", "The", "model", "for", "this", "fit", "is", "an", "overdamped", "step", "response", "of", "a", "second", "order", "RLC", "circuit", ".", "the", "data", ...
def envelope_fit(t, V, verbose = True): init = [0.5, -2, 200, 1000, 50] fit_mod = lmfit.model.Model(step_responseRLC_overdamped) pars = fit_mod.make_params() pars['a_0'].set(init[0]) pars['a_1'].set(init[1]) pars['a_2'].set(init[2]) pars['alpha'].set(init[3]) pars['w_d'].set(init[4]) ...
[ "def", "envelope_fit", "(", "t", ",", "V", ",", "verbose", "=", "True", ")", ":", "init", "=", "[", "0.5", ",", "-", "2", ",", "200", ",", "1000", ",", "50", "]", "fit_mod", "=", "lmfit", ".", "model", ".", "Model", "(", "step_responseRLC_overdampe...
Uses the package lmfit to fit the given data: t and V. The model for this fit is an overdamped step response of a second order RLC circuit.
[ "Uses", "the", "package", "lmfit", "to", "fit", "the", "given", "data", ":", "t", "and", "V", ".", "The", "model", "for", "this", "fit", "is", "an", "overdamped", "step", "response", "of", "a", "second", "order", "RLC", "circuit", "." ]
[ "'''\n Uses the package lmfit to fit the given data: t and V. The model for this\n fit is an overdamped step response of a second order RLC circuit.\n\n assumes:\n - the data is suitable for the fitting model of overdamped step response\n of a second order RLC circuit.\n\n arguments:\n - t: t...
[ { "param": "t", "type": null }, { "param": "V", "type": null }, { "param": "verbose", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "t", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "V", "type": null, "docstring": null, "docstring_tokens": [], ...
a60c854c7d9191b2a63fd1491288d82f71669009
kvmu/KURRI-workterm
width_delay_beam_experiment/DataAnalysis.py
[ "MIT" ]
Python
int_bunch_fit
<not_specific>
def int_bunch_fit(t, V, verbose = True): ''' Uses the package lmfit to fit the given data: t and V. The model for this fit is an underdamped step response of a second order RLC circuit. assumes: - the data is suitable for the fitting model of overdamped step response of a second order RLC cir...
Uses the package lmfit to fit the given data: t and V. The model for this fit is an underdamped step response of a second order RLC circuit. assumes: - the data is suitable for the fitting model of overdamped step response of a second order RLC circuit. arguments: - t: the time-axis (or...
Uses the package lmfit to fit the given data: t and V. The model for this fit is an underdamped step response of a second order RLC circuit. the data is suitable for the fitting model of overdamped step response of a second order RLC circuit. the time-axis (or x-axis) of data V: the voltage values result.best_fit: t...
[ "Uses", "the", "package", "lmfit", "to", "fit", "the", "given", "data", ":", "t", "and", "V", ".", "The", "model", "for", "this", "fit", "is", "an", "underdamped", "step", "response", "of", "a", "second", "order", "RLC", "circuit", ".", "the", "data", ...
def int_bunch_fit(t, V, verbose = True): init = [-0.5, -0.5, 0.2, 0.055, 50] fit_mod = lmfit.model.Model(step_responseRLC_underdamped) pars = fit_mod.make_params() pars['a_0'].set(init[0]) pars['a_1'].set(init[1]) pars['a_2'].set(init[2]) pars['alpha'].set(init[3]) pars['w_d'].set(init[4...
[ "def", "int_bunch_fit", "(", "t", ",", "V", ",", "verbose", "=", "True", ")", ":", "init", "=", "[", "-", "0.5", ",", "-", "0.5", ",", "0.2", ",", "0.055", ",", "50", "]", "fit_mod", "=", "lmfit", ".", "model", ".", "Model", "(", "step_responseRL...
Uses the package lmfit to fit the given data: t and V. The model for this fit is an underdamped step response of a second order RLC circuit.
[ "Uses", "the", "package", "lmfit", "to", "fit", "the", "given", "data", ":", "t", "and", "V", ".", "The", "model", "for", "this", "fit", "is", "an", "underdamped", "step", "response", "of", "a", "second", "order", "RLC", "circuit", "." ]
[ "'''\n Uses the package lmfit to fit the given data: t and V. The model for this\n fit is an underdamped step response of a second order RLC circuit.\n\n assumes:\n - the data is suitable for the fitting model of overdamped step response\n of a second order RLC circuit.\n\n arguments:\n - t: ...
[ { "param": "t", "type": null }, { "param": "V", "type": null }, { "param": "verbose", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "t", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "V", "type": null, "docstring": null, "docstring_tokens": [], ...
3fb285b973c6d959808aeb728a114f8230e23ba8
kvmu/KURRI-workterm
width_delay_beam_experiment/analysis_script.py
[ "MIT" ]
Python
plot_noise
<not_specific>
def plot_noise(path_to_data, filename, save_path='.//'): ''' Plots the noise data with pretty formatting. assumes: - The data is a csv file where the time and voltage data are in columns 3 and 4, respectively. - save_path, if given, is a valid directory. arguments: - path_to_data(st...
Plots the noise data with pretty formatting. assumes: - The data is a csv file where the time and voltage data are in columns 3 and 4, respectively. - save_path, if given, is a valid directory. arguments: - path_to_data(string): The absolute or relative path to the ...
Plots the noise data with pretty formatting. assumes: The data is a csv file where the time and voltage data are in columns 3 and 4, respectively. save_path, if given, is a valid directory. The absolute or relative path to the folder containing the noise data file. the filename of noise data file the path where the...
[ "Plots", "the", "noise", "data", "with", "pretty", "formatting", ".", "assumes", ":", "The", "data", "is", "a", "csv", "file", "where", "the", "time", "and", "voltage", "data", "are", "in", "columns", "3", "and", "4", "respectively", ".", "save_path", "i...
def plot_noise(path_to_data, filename, save_path='.//'): dat = np.genfromtxt(path_to_data+filename, delimiter=',', usecols=(3,4)) x, y = dat[:,0], dat[:,1] fig = plt.figure(figsize = (10,8)) ax = plt.gca() ax.plot(x, y, c=color_dict['data'], label=filename.replace('_', '\_'), alpha = 0.7) for la...
[ "def", "plot_noise", "(", "path_to_data", ",", "filename", ",", "save_path", "=", "'.//'", ")", ":", "dat", "=", "np", ".", "genfromtxt", "(", "path_to_data", "+", "filename", ",", "delimiter", "=", "','", ",", "usecols", "=", "(", "3", ",", "4", ")", ...
Plots the noise data with pretty formatting.
[ "Plots", "the", "noise", "data", "with", "pretty", "formatting", "." ]
[ "'''\n Plots the noise data with pretty formatting.\n\n assumes:\n - The data is a csv file where the time and voltage data are in columns\n 3 and 4, respectively.\n\n - save_path, if given, is a valid directory.\n\n arguments:\n - path_to_data(string): The absolute or relative path to the\n ...
[ { "param": "path_to_data", "type": null }, { "param": "filename", "type": null }, { "param": "save_path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "path_to_data", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filename", "type": null, "docstring": null, "docstrin...
3fb285b973c6d959808aeb728a114f8230e23ba8
kvmu/KURRI-workterm
width_delay_beam_experiment/analysis_script.py
[ "MIT" ]
Python
batch_analyze
<not_specific>
def batch_analyze(data_path): ''' Analyzes all the preferred files using the DataAnalysis.py module in the directory given by data_path. assumes: - the data files are comma separated files with time and voltage data in columns 3 and 4 respectively. arguments: - data_path(string): the...
Analyzes all the preferred files using the DataAnalysis.py module in the directory given by data_path. assumes: - the data files are comma separated files with time and voltage data in columns 3 and 4 respectively. arguments: - data_path(string): the relative or absolute path to the dir...
Analyzes all the preferred files using the DataAnalysis.py module in the directory given by data_path. the data files are comma separated files with time and voltage data in columns 3 and 4 respectively. the relative or absolute path to the directory where the files are stored (note in windows you need instead of \ s...
[ "Analyzes", "all", "the", "preferred", "files", "using", "the", "DataAnalysis", ".", "py", "module", "in", "the", "directory", "given", "by", "data_path", ".", "the", "data", "files", "are", "comma", "separated", "files", "with", "time", "and", "voltage", "d...
def batch_analyze(data_path): analyzed_batch = [] for filename in os.listdir(data_path): if 'inu' in filename: waveform = DataAnalysis.Waveform() waveform.load(data_path, filename) waveform.clean() analyzed_waveform = DataAnalysis.Analyzer(waveform) ...
[ "def", "batch_analyze", "(", "data_path", ")", ":", "analyzed_batch", "=", "[", "]", "for", "filename", "in", "os", ".", "listdir", "(", "data_path", ")", ":", "if", "'inu'", "in", "filename", ":", "waveform", "=", "DataAnalysis", ".", "Waveform", "(", "...
Analyzes all the preferred files using the DataAnalysis.py module in the directory given by data_path.
[ "Analyzes", "all", "the", "preferred", "files", "using", "the", "DataAnalysis", ".", "py", "module", "in", "the", "directory", "given", "by", "data_path", "." ]
[ "'''\n Analyzes all the preferred files using the DataAnalysis.py module in the\n directory given by data_path.\n\n assumes:\n - the data files are comma separated files with time and voltage data in\n columns 3 and 4 respectively.\n\n arguments:\n - data_path(string): the relative or absolut...
[ { "param": "data_path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data_path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3fb285b973c6d959808aeb728a114f8230e23ba8
kvmu/KURRI-workterm
width_delay_beam_experiment/analysis_script.py
[ "MIT" ]
Python
main
null
def main(): ''' This is the main function -- it calls all the specified functions and methods and completes the analysis. ''' # The following lines create the waveform object, load in the data # and then does the analysis. It is important that the analysis code # is called in this order -- w...
This is the main function -- it calls all the specified functions and methods and completes the analysis.
This is the main function -- it calls all the specified functions and methods and completes the analysis.
[ "This", "is", "the", "main", "function", "--", "it", "calls", "all", "the", "specified", "functions", "and", "methods", "and", "completes", "the", "analysis", "." ]
def main(): waveform = DataAnalysis.Waveform() waveform.load(data_path, filename_sample) waveform.clean(trim_start=15000) analyzed_waveform = DataAnalysis.Analyzer(waveform) analyzed_waveform.calculate_envelope() analyzed_waveform.calculate_bunchArea_diff() analyzed_waveform.calculate_P() ...
[ "def", "main", "(", ")", ":", "waveform", "=", "DataAnalysis", ".", "Waveform", "(", ")", "waveform", ".", "load", "(", "data_path", ",", "filename_sample", ")", "waveform", ".", "clean", "(", "trim_start", "=", "15000", ")", "analyzed_waveform", "=", "Dat...
This is the main function -- it calls all the specified functions and methods and completes the analysis.
[ "This", "is", "the", "main", "function", "--", "it", "calls", "all", "the", "specified", "functions", "and", "methods", "and", "completes", "the", "analysis", "." ]
[ "'''\n This is the main function -- it calls all the specified functions and\n methods and completes the analysis.\n '''", "# The following lines create the waveform object, load in the data", "# and then does the analysis. It is important that the analysis code", "# is called in this order -- with t...
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
f94378ed337ec56ee596b5824a228efe79802a68
protojour/mikrokosmos
mikrokosmos/mikro.py
[ "MIT" ]
Python
gen
null
def gen(scenario, indent): """ Generate static data from a scenario. Generates objects defined in the scenario's list of objects. Output is written to stdout. """ scenario_dict = yaml.safe_load(scenario) objects = resolve_objects(scenario_dict) output = json.dumps(objects, indent=inde...
Generate static data from a scenario. Generates objects defined in the scenario's list of objects. Output is written to stdout.
Generate static data from a scenario. Generates objects defined in the scenario's list of objects. Output is written to stdout.
[ "Generate", "static", "data", "from", "a", "scenario", ".", "Generates", "objects", "defined", "in", "the", "scenario", "'", "s", "list", "of", "objects", ".", "Output", "is", "written", "to", "stdout", "." ]
def gen(scenario, indent): scenario_dict = yaml.safe_load(scenario) objects = resolve_objects(scenario_dict) output = json.dumps(objects, indent=indent) click.echo(output)
[ "def", "gen", "(", "scenario", ",", "indent", ")", ":", "scenario_dict", "=", "yaml", ".", "safe_load", "(", "scenario", ")", "objects", "=", "resolve_objects", "(", "scenario_dict", ")", "output", "=", "json", ".", "dumps", "(", "objects", ",", "indent", ...
Generate static data from a scenario.
[ "Generate", "static", "data", "from", "a", "scenario", "." ]
[ "\"\"\"\n Generate static data from a scenario.\n\n Generates objects defined in the scenario's list of objects.\n Output is written to stdout.\n \"\"\"" ]
[ { "param": "scenario", "type": null }, { "param": "indent", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "scenario", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "indent", "type": null, "docstring": null, "docstring_toke...
f94378ed337ec56ee596b5824a228efe79802a68
protojour/mikrokosmos
mikrokosmos/mikro.py
[ "MIT" ]
Python
run
null
def run(scenario): """ Run a scenario. Not yet implemented. """ scenario_dict = yaml.safe_load(scenario) scenario_name = scenario_dict.get('name') click.echo(f'Running scenario {scenario_name}...') click.echo(f'Not yet implemented.')
Run a scenario. Not yet implemented.
Run a scenario. Not yet implemented.
[ "Run", "a", "scenario", ".", "Not", "yet", "implemented", "." ]
def run(scenario): scenario_dict = yaml.safe_load(scenario) scenario_name = scenario_dict.get('name') click.echo(f'Running scenario {scenario_name}...') click.echo(f'Not yet implemented.')
[ "def", "run", "(", "scenario", ")", ":", "scenario_dict", "=", "yaml", ".", "safe_load", "(", "scenario", ")", "scenario_name", "=", "scenario_dict", ".", "get", "(", "'name'", ")", "click", ".", "echo", "(", "f'Running scenario {scenario_name}...'", ")", "cli...
Run a scenario.
[ "Run", "a", "scenario", "." ]
[ "\"\"\"\n Run a scenario.\n\n Not yet implemented.\n \"\"\"" ]
[ { "param": "scenario", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "scenario", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4af1cbea99601b00b6b0a9cd6f3cc673a0ea5826
protojour/mikrokosmos
mikrokosmos/objects.py
[ "MIT" ]
Python
recursive_resolve
<not_specific>
def recursive_resolve(data, obj, trigger=None, triggers=[]): """Recurse through a nested data structure and format strings using attributes of obj and triggers""" if isinstance(data, dict): if 'triggers' in data: return [recursive_resolve(data['triggers'], obj, trigger, triggers) for trigge...
Recurse through a nested data structure and format strings using attributes of obj and triggers
Recurse through a nested data structure and format strings using attributes of obj and triggers
[ "Recurse", "through", "a", "nested", "data", "structure", "and", "format", "strings", "using", "attributes", "of", "obj", "and", "triggers" ]
def recursive_resolve(data, obj, trigger=None, triggers=[]): if isinstance(data, dict): if 'triggers' in data: return [recursive_resolve(data['triggers'], obj, trigger, triggers) for trigger in triggers] return {k: recursive_resolve(v, obj, trigger, triggers) for k, v in data.items()} ...
[ "def", "recursive_resolve", "(", "data", ",", "obj", ",", "trigger", "=", "None", ",", "triggers", "=", "[", "]", ")", ":", "if", "isinstance", "(", "data", ",", "dict", ")", ":", "if", "'triggers'", "in", "data", ":", "return", "[", "recursive_resolve...
Recurse through a nested data structure and format strings using attributes of obj and triggers
[ "Recurse", "through", "a", "nested", "data", "structure", "and", "format", "strings", "using", "attributes", "of", "obj", "and", "triggers" ]
[ "\"\"\"Recurse through a nested data structure and format strings using attributes of obj and triggers\"\"\"" ]
[ { "param": "data", "type": null }, { "param": "obj", "type": null }, { "param": "trigger", "type": null }, { "param": "triggers", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "obj", "type": null, "docstring": null, "docstring_tokens": []...
4af1cbea99601b00b6b0a9cd6f3cc673a0ea5826
protojour/mikrokosmos
mikrokosmos/objects.py
[ "MIT" ]
Python
resolve_value
<not_specific>
def resolve_value(value, args, kwargs, ctx): """Resolve an attribute value spec, return a lambda to call for the value""" try: _ = iter(value) except TypeError: return lambda self, value=value: value if 'self.' in value: _, att = value.split('.', 1) return lambda self, ...
Resolve an attribute value spec, return a lambda to call for the value
Resolve an attribute value spec, return a lambda to call for the value
[ "Resolve", "an", "attribute", "value", "spec", "return", "a", "lambda", "to", "call", "for", "the", "value" ]
def resolve_value(value, args, kwargs, ctx): try: _ = iter(value) except TypeError: return lambda self, value=value: value if 'self.' in value: _, att = value.split('.', 1) return lambda self, att=att: getattr(self, att) elif 'scenario.' in value: _, key = value.s...
[ "def", "resolve_value", "(", "value", ",", "args", ",", "kwargs", ",", "ctx", ")", ":", "try", ":", "_", "=", "iter", "(", "value", ")", "except", "TypeError", ":", "return", "lambda", "self", ",", "value", "=", "value", ":", "value", "if", "'self.'"...
Resolve an attribute value spec, return a lambda to call for the value
[ "Resolve", "an", "attribute", "value", "spec", "return", "a", "lambda", "to", "call", "for", "the", "value" ]
[ "\"\"\"Resolve an attribute value spec, return a lambda to call for the value\"\"\"" ]
[ { "param": "value", "type": null }, { "param": "args", "type": null }, { "param": "kwargs", "type": null }, { "param": "ctx", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "value", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "args", "type": null, "docstring": null, "docstring_tokens": ...
4af1cbea99601b00b6b0a9cd6f3cc673a0ea5826
protojour/mikrokosmos
mikrokosmos/objects.py
[ "MIT" ]
Python
resolve_attributes
<not_specific>
def resolve_attributes(attributes, ctx): """Resolve a set of object attributes""" result_attributes = {} for key, value in attributes.items(): args = [] kwargs = {} if isinstance(value, dict): value, rest = list(value.items())[0] if isinstance(rest, dict): ...
Resolve a set of object attributes
Resolve a set of object attributes
[ "Resolve", "a", "set", "of", "object", "attributes" ]
def resolve_attributes(attributes, ctx): result_attributes = {} for key, value in attributes.items(): args = [] kwargs = {} if isinstance(value, dict): value, rest = list(value.items())[0] if isinstance(rest, dict): kwargs = rest elif i...
[ "def", "resolve_attributes", "(", "attributes", ",", "ctx", ")", ":", "result_attributes", "=", "{", "}", "for", "key", ",", "value", "in", "attributes", ".", "items", "(", ")", ":", "args", "=", "[", "]", "kwargs", "=", "{", "}", "if", "isinstance", ...
Resolve a set of object attributes
[ "Resolve", "a", "set", "of", "object", "attributes" ]
[ "\"\"\"Resolve a set of object attributes\"\"\"" ]
[ { "param": "attributes", "type": null }, { "param": "ctx", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "attributes", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_token...
4af1cbea99601b00b6b0a9cd6f3cc673a0ea5826
protojour/mikrokosmos
mikrokosmos/objects.py
[ "MIT" ]
Python
resolve_objects
<not_specific>
def resolve_objects(scenario): """Resolve a set of classes, generate objects, resolve objects""" set_seed(scenario) faker = init_faker(scenario) @attr.s class Context: faker = attr.ib() scenario = attr.ib() ctx = Context(faker, scenario) objects = [] triggered_objects...
Resolve a set of classes, generate objects, resolve objects
Resolve a set of classes, generate objects, resolve objects
[ "Resolve", "a", "set", "of", "classes", "generate", "objects", "resolve", "objects" ]
def resolve_objects(scenario): set_seed(scenario) faker = init_faker(scenario) @attr.s class Context: faker = attr.ib() scenario = attr.ib() ctx = Context(faker, scenario) objects = [] triggered_objects = [] outputs = [] classes = [ cls for cls in scenario['ob...
[ "def", "resolve_objects", "(", "scenario", ")", ":", "set_seed", "(", "scenario", ")", "faker", "=", "init_faker", "(", "scenario", ")", "@", "attr", ".", "s", "class", "Context", ":", "faker", "=", "attr", ".", "ib", "(", ")", "scenario", "=", "attr",...
Resolve a set of classes, generate objects, resolve objects
[ "Resolve", "a", "set", "of", "classes", "generate", "objects", "resolve", "objects" ]
[ "\"\"\"Resolve a set of classes, generate objects, resolve objects\"\"\"", "# TODO: This is crazy wrong, but will do for now" ]
[ { "param": "scenario", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "scenario", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
972fd5f1a275064b20c6869bcb4497945071bf3d
chz816/savvy-sue
data-collection/dealmoon-crawler/crawler.py
[ "MIT" ]
Python
scrape
null
def scrape(retailer, url, domain, save_every=15): ''' url: the URL of the homepage we wish to scrape retailer: the name of the Retailer we wish to preserve for human readability domain: the domain of the retailer's store to avoid entering foreign stores, blogs, or investor pages save_every: number o...
url: the URL of the homepage we wish to scrape retailer: the name of the Retailer we wish to preserve for human readability domain: the domain of the retailer's store to avoid entering foreign stores, blogs, or investor pages save_every: number of minutes between back-up saves, default is 15, 0 will ne...
the URL of the homepage we wish to scrape retailer: the name of the Retailer we wish to preserve for human readability domain: the domain of the retailer's store to avoid entering foreign stores, blogs, or investor pages save_every: number of minutes between back-up saves, default is 15, 0 will never save till completi...
[ "the", "URL", "of", "the", "homepage", "we", "wish", "to", "scrape", "retailer", ":", "the", "name", "of", "the", "Retailer", "we", "wish", "to", "preserve", "for", "human", "readability", "domain", ":", "the", "domain", "of", "the", "retailer", "'", "s"...
def scrape(retailer, url, domain, save_every=15): links_to_visit = deque([url]) links_visited = set() local_urls = set(domain) foreign_urls = set() broken_urls = set() user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/5...
[ "def", "scrape", "(", "retailer", ",", "url", ",", "domain", ",", "save_every", "=", "15", ")", ":", "links_to_visit", "=", "deque", "(", "[", "url", "]", ")", "links_visited", "=", "set", "(", ")", "local_urls", "=", "set", "(", "domain", ")", "fore...
url: the URL of the homepage we wish to scrape retailer: the name of the Retailer we wish to preserve for human readability domain: the domain of the retailer's store to avoid entering foreign stores, blogs, or investor pages save_every: number of minutes between back-up saves, default is 15, 0 will never save till com...
[ "url", ":", "the", "URL", "of", "the", "homepage", "we", "wish", "to", "scrape", "retailer", ":", "the", "name", "of", "the", "Retailer", "we", "wish", "to", "preserve", "for", "human", "readability", "domain", ":", "the", "domain", "of", "the", "retaile...
[ "'''\n url: the URL of the homepage we wish to scrape\n retailer: the name of the Retailer we wish to preserve for human readability\n domain: the domain of the retailer's store to avoid entering foreign stores, blogs, or investor pages\n save_every: number of minutes between back-up saves, default is 1...
[ { "param": "retailer", "type": null }, { "param": "url", "type": null }, { "param": "domain", "type": null }, { "param": "save_every", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "retailer", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "url", "type": null, "docstring": null, "docstring_tokens"...
4c20436635b5221c13d4e6ab9d61584aeddd1a10
chz816/savvy-sue
data-collection/email/emlx_parser.py
[ "MIT" ]
Python
parse
<not_specific>
def parse(self): """return the data structure for the current emlx file * an email object * the plist structure as a dict data structure """ with open(self.filename, "r", errors='ignore') as f: # extract the bytecount content = f.readlines() if co...
return the data structure for the current emlx file * an email object * the plist structure as a dict data structure
return the data structure for the current emlx file an email object the plist structure as a dict data structure
[ "return", "the", "data", "structure", "for", "the", "current", "emlx", "file", "an", "email", "object", "the", "plist", "structure", "as", "a", "dict", "data", "structure" ]
def parse(self): with open(self.filename, "r", errors='ignore') as f: content = f.readlines() if content: t = open(self.filename, "rb") self.bytecount = int(t.readline().strip()) self.email = email.message_from_bytes(t.read(self.bytecount)) for par...
[ "def", "parse", "(", "self", ")", ":", "with", "open", "(", "self", ".", "filename", ",", "\"r\"", ",", "errors", "=", "'ignore'", ")", "as", "f", ":", "content", "=", "f", ".", "readlines", "(", ")", "if", "content", ":", "t", "=", "open", "(", ...
return the data structure for the current emlx file an email object the plist structure as a dict data structure
[ "return", "the", "data", "structure", "for", "the", "current", "emlx", "file", "an", "email", "object", "the", "plist", "structure", "as", "a", "dict", "data", "structure" ]
[ "\"\"\"return the data structure for the current emlx file\n * an email object\n * the plist structure as a dict data structure\n \"\"\"", "# extract the bytecount", "# parse du mail" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
79a3ac8c1984635eacd3d2112e6cbdc1747d5a03
fossabot/d2a
d2a/__init__.py
[ "MIT" ]
Python
declare
<not_specific>
def declare(django_model, db_type=AUTO_DETECTED_DB_TYPE, back_type='backref'): """It converts a django model to alchemy orm object. :param django.db.models.base.Model django_model: Django model object or equivalent object. :param str db_type: Database type, for example `postgresql`. If omitted this option, ...
It converts a django model to alchemy orm object. :param django.db.models.base.Model django_model: Django model object or equivalent object. :param str db_type: Database type, for example `postgresql`. If omitted this option, it will be detected from django settings. :param str back_type: Back relation type...
It converts a django model to alchemy orm object.
[ "It", "converts", "a", "django", "model", "to", "alchemy", "orm", "object", "." ]
def declare(django_model, db_type=AUTO_DETECTED_DB_TYPE, back_type='backref'): model_info = parse_model(django_model) if django_model in existing: return existing[django_model] rel_options = OrderedDict() attrs = OrderedDict({'__tablename__': model_info['table_name']}) for name, fields in mo...
[ "def", "declare", "(", "django_model", ",", "db_type", "=", "AUTO_DETECTED_DB_TYPE", ",", "back_type", "=", "'backref'", ")", ":", "model_info", "=", "parse_model", "(", "django_model", ")", "if", "django_model", "in", "existing", ":", "return", "existing", "[",...
It converts a django model to alchemy orm object.
[ "It", "converts", "a", "django", "model", "to", "alchemy", "orm", "object", "." ]
[ "\"\"\"It converts a django model to alchemy orm object.\n :param django.db.models.base.Model django_model: Django model object or equivalent object.\n :param str db_type: Database type, for example `postgresql`. If omitted this option, it will be detected from django settings.\n :param str back_type: Back...
[ { "param": "django_model", "type": null }, { "param": "db_type", "type": null }, { "param": "back_type", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "django_model", "type": null, "docstring": "Django model object or equivalent object.", "docstring_tokens": [ "Django", "model", "object", "or", "equivalent", "object", "....
79a3ac8c1984635eacd3d2112e6cbdc1747d5a03
fossabot/d2a
d2a/__init__.py
[ "MIT" ]
Python
transfer
null
def transfer(models, exports, db_type=AUTO_DETECTED_DB_TYPE, back_type='backref', as_table=False, name_formatter=NAME_FORMATTER): """It makes sqlalchemy model objects from django models. :param module models: Django `models.py` or equivalent object. :param dict exports: Namespace which you want to put the ...
It makes sqlalchemy model objects from django models. :param module models: Django `models.py` or equivalent object. :param dict exports: Namespace which you want to put the models into. In most case, that is ``globals()``. :param str db_type: Database type, for example `postgresql`. If omitted this option...
It makes sqlalchemy model objects from django models.
[ "It", "makes", "sqlalchemy", "model", "objects", "from", "django", "models", "." ]
def transfer(models, exports, db_type=AUTO_DETECTED_DB_TYPE, back_type='backref', as_table=False, name_formatter=NAME_FORMATTER): for model in parse_models(models).values(): declare(model, db_type=db_type, back_type=back_type) for django_model, alchemy_model in existing.items(): if models.__name...
[ "def", "transfer", "(", "models", ",", "exports", ",", "db_type", "=", "AUTO_DETECTED_DB_TYPE", ",", "back_type", "=", "'backref'", ",", "as_table", "=", "False", ",", "name_formatter", "=", "NAME_FORMATTER", ")", ":", "for", "model", "in", "parse_models", "("...
It makes sqlalchemy model objects from django models.
[ "It", "makes", "sqlalchemy", "model", "objects", "from", "django", "models", "." ]
[ "\"\"\"It makes sqlalchemy model objects from django models.\n\n :param module models: Django `models.py` or equivalent object.\n :param dict exports: Namespace which you want to put the models into. In most case, that is ``globals()``.\n :param str db_type: Database type, for example `postgresql`. If omit...
[ { "param": "models", "type": null }, { "param": "exports", "type": null }, { "param": "db_type", "type": null }, { "param": "back_type", "type": null }, { "param": "as_table", "type": null }, { "param": "name_formatter", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "models", "type": null, "docstring": "Django `models.py` or equivalent object.", "docstring_tokens": [ "Django", "`", "models", ".", "py", "`", "or", "equivalent",...
79a3ac8c1984635eacd3d2112e6cbdc1747d5a03
fossabot/d2a
d2a/__init__.py
[ "MIT" ]
Python
autoload
null
def autoload(config=D2A_CONFIG.get('AUTOLOAD', {})): """It loads all models automatically. """ module = config.get('module', 'models_sqla') option = config.get('option', {}) for app in settings.INSTALLED_APPS: mods = app.split('.') for i in range(1, len(mods) + 1): mod = ...
It loads all models automatically.
It loads all models automatically.
[ "It", "loads", "all", "models", "automatically", "." ]
def autoload(config=D2A_CONFIG.get('AUTOLOAD', {})): module = config.get('module', 'models_sqla') option = config.get('option', {}) for app in settings.INSTALLED_APPS: mods = app.split('.') for i in range(1, len(mods) + 1): mod = '.'.join(mods[:i]) d = '{mod}.models'....
[ "def", "autoload", "(", "config", "=", "D2A_CONFIG", ".", "get", "(", "'AUTOLOAD'", ",", "{", "}", ")", ")", ":", "module", "=", "config", ".", "get", "(", "'module'", ",", "'models_sqla'", ")", "option", "=", "config", ".", "get", "(", "'option'", "...
It loads all models automatically.
[ "It", "loads", "all", "models", "automatically", "." ]
[ "\"\"\"It loads all models automatically.\n \"\"\"" ]
[ { "param": "config", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "config", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2345a1ee0a86b191963a0c0fc1ef798c7cde3d93
urugi/pueba
data_generator/object_detection_2d_data_generator_manga.py
[ "Apache-2.0" ]
Python
parse_xml
<not_specific>
def parse_xml(self, images_dirs, image_set_filenames, annotations_dirs=[], classes=['background', 'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', ...
This is an XML parser for the Pascal VOC datasets. It might be applicable to other datasets with minor changes to the code, but in its current form it expects the data format and XML tags of the Pascal VOC datasets. Arguments: images_dirs (list): A list of strings, where each strin...
This is an XML parser for the Pascal VOC datasets. It might be applicable to other datasets with minor changes to the code, but in its current form it expects the data format and XML tags of the Pascal VOC datasets.
[ "This", "is", "an", "XML", "parser", "for", "the", "Pascal", "VOC", "datasets", ".", "It", "might", "be", "applicable", "to", "other", "datasets", "with", "minor", "changes", "to", "the", "code", "but", "in", "its", "current", "form", "it", "expects", "t...
def parse_xml(self, images_dirs, image_set_filenames, annotations_dirs=[], classes=['background', 'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', ...
[ "def", "parse_xml", "(", "self", ",", "images_dirs", ",", "image_set_filenames", ",", "annotations_dirs", "=", "[", "]", ",", "classes", "=", "[", "'background'", ",", "'aeroplane'", ",", "'bicycle'", ",", "'bird'", ",", "'boat'", ",", "'bottle'", ",", "'bus...
This is an XML parser for the Pascal VOC datasets.
[ "This", "is", "an", "XML", "parser", "for", "the", "Pascal", "VOC", "datasets", "." ]
[ "'''\n This is an XML parser for the Pascal VOC datasets. It might be applicable to other datasets with minor changes to\n the code, but in its current form it expects the data format and XML tags of the Pascal VOC datasets.\n\n Arguments:\n images_dirs (list): A list of strings, whe...
[ { "param": "self", "type": null }, { "param": "images_dirs", "type": null }, { "param": "image_set_filenames", "type": null }, { "param": "annotations_dirs", "type": null }, { "param": "classes", "type": null }, { "param": "include_classes", "type"...
{ "returns": [ { "docstring": "None by default, optionally the image filenames and labels.", "docstring_tokens": [ "None", "by", "default", "optionally", "the", "image", "filenames", "and", "labels", "." ], "ty...
2345a1ee0a86b191963a0c0fc1ef798c7cde3d93
urugi/pueba
data_generator/object_detection_2d_data_generator_manga.py
[ "Apache-2.0" ]
Python
parse_json
<not_specific>
def parse_json(self, images_dirs, annotations_filenames, ground_truth_available=False, include_classes = 'all', ret=False): ''' This is an JSON parser for the MS COCO datasets. It might be applicable to other ...
This is an JSON parser for the MS COCO datasets. It might be applicable to other datasets with minor changes to the code, but in its current form it expects the JSON format of the MS COCO datasets. Arguments: images_dirs (list, optional): A list of strings, where each string is the...
This is an JSON parser for the MS COCO datasets. It might be applicable to other datasets with minor changes to the code, but in its current form it expects the JSON format of the MS COCO datasets.
[ "This", "is", "an", "JSON", "parser", "for", "the", "MS", "COCO", "datasets", ".", "It", "might", "be", "applicable", "to", "other", "datasets", "with", "minor", "changes", "to", "the", "code", "but", "in", "its", "current", "form", "it", "expects", "the...
def parse_json(self, images_dirs, annotations_filenames, ground_truth_available=False, include_classes = 'all', ret=False): self.images_dirs = images_dirs self.annotations_filenames = annotations_filenames ...
[ "def", "parse_json", "(", "self", ",", "images_dirs", ",", "annotations_filenames", ",", "ground_truth_available", "=", "False", ",", "include_classes", "=", "'all'", ",", "ret", "=", "False", ")", ":", "self", ".", "images_dirs", "=", "images_dirs", "self", "...
This is an JSON parser for the MS COCO datasets.
[ "This", "is", "an", "JSON", "parser", "for", "the", "MS", "COCO", "datasets", "." ]
[ "'''\n This is an JSON parser for the MS COCO datasets. It might be applicable to other datasets with minor changes to\n the code, but in its current form it expects the JSON format of the MS COCO datasets.\n\n Arguments:\n images_dirs (list, optional): A list of strings, where each ...
[ { "param": "self", "type": null }, { "param": "images_dirs", "type": null }, { "param": "annotations_filenames", "type": null }, { "param": "ground_truth_available", "type": null }, { "param": "include_classes", "type": null }, { "param": "ret", "t...
{ "returns": [ { "docstring": "None by default, optionally the image filenames and labels.", "docstring_tokens": [ "None", "by", "default", "optionally", "the", "image", "filenames", "and", "labels", "." ], "ty...
91191231f45f1fe89d5d71dc3e35727e2edd15e4
musoke/gif
gif.py
[ "MIT" ]
Python
frame
<not_specific>
def frame(func): """ Decorator for a matplotlib plot function. Example: ``` @gif.frame def plot(x, y): plt.figure(figsize=(5, 5)) plt.scatter(x, y) plt.xlim((0, 100)) plt.ylim((0, 100)) ``` """ @functools.wraps(func) def wrapper(*args, **kwargs):...
Decorator for a matplotlib plot function. Example: ``` @gif.frame def plot(x, y): plt.figure(figsize=(5, 5)) plt.scatter(x, y) plt.xlim((0, 100)) plt.ylim((0, 100)) ```
Decorator for a matplotlib plot function.
[ "Decorator", "for", "a", "matplotlib", "plot", "function", "." ]
def frame(func): @functools.wraps(func) def wrapper(*args, **kwargs): buffer = io.BytesIO() func(*args, **kwargs) plt.savefig(buffer, format="png") buffer.seek(0) image = Image.open(buffer) plt.close() return image return wrapper
[ "def", "frame", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "**", "kwargs", ")", ":", "buffer", "=", "io", ".", "BytesIO", "(", ")", "func", "(", "*", "args", ",", "**", "kwa...
Decorator for a matplotlib plot function.
[ "Decorator", "for", "a", "matplotlib", "plot", "function", "." ]
[ "\"\"\"\n Decorator for a matplotlib plot function.\n\n Example:\n ```\n @gif.frame\n def plot(x, y):\n plt.figure(figsize=(5, 5))\n plt.scatter(x, y)\n plt.xlim((0, 100))\n plt.ylim((0, 100))\n ```\n \"\"\"" ]
[ { "param": "func", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "func", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [ { "identifier": "examples", "docstring": null, ...
91191231f45f1fe89d5d71dc3e35727e2edd15e4
musoke/gif
gif.py
[ "MIT" ]
Python
save
null
def save(frames, path, duration=100): """ Save decorated frames to an animated gif. - frames (list): collection of frames built with the frame decorator - path (str): filename with relative or absolute path - duration (int): milliseconds between frames """ frames[0].save( path, ...
Save decorated frames to an animated gif. - frames (list): collection of frames built with the frame decorator - path (str): filename with relative or absolute path - duration (int): milliseconds between frames
Save decorated frames to an animated gif. frames (list): collection of frames built with the frame decorator path (str): filename with relative or absolute path duration (int): milliseconds between frames
[ "Save", "decorated", "frames", "to", "an", "animated", "gif", ".", "frames", "(", "list", ")", ":", "collection", "of", "frames", "built", "with", "the", "frame", "decorator", "path", "(", "str", ")", ":", "filename", "with", "relative", "or", "absolute", ...
def save(frames, path, duration=100): frames[0].save( path, save_all=True, append_images=frames[1:], optimize=True, duration=duration, loop=0, )
[ "def", "save", "(", "frames", ",", "path", ",", "duration", "=", "100", ")", ":", "frames", "[", "0", "]", ".", "save", "(", "path", ",", "save_all", "=", "True", ",", "append_images", "=", "frames", "[", "1", ":", "]", ",", "optimize", "=", "Tru...
Save decorated frames to an animated gif.
[ "Save", "decorated", "frames", "to", "an", "animated", "gif", "." ]
[ "\"\"\"\n Save decorated frames to an animated gif.\n\n - frames (list): collection of frames built with the frame decorator\n - path (str): filename with relative or absolute path\n - duration (int): milliseconds between frames\n \"\"\"" ]
[ { "param": "frames", "type": null }, { "param": "path", "type": null }, { "param": "duration", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "frames", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "path", "type": null, "docstring": null, "docstring_tokens":...
319f5dba34bc03ffc0e03df9b4f558256e9efcaa
Gumbachi/colorBOT
main.py
[ "MIT" ]
Python
on_ready
null
async def on_ready(): """Change presence and report ready.""" activity = discord.Game(name=f"@Vibrant for help ({len(bot.guilds)})") await bot.change_presence(activity=activity) print("Ready Player One.")
Change presence and report ready.
Change presence and report ready.
[ "Change", "presence", "and", "report", "ready", "." ]
async def on_ready(): activity = discord.Game(name=f"@Vibrant for help ({len(bot.guilds)})") await bot.change_presence(activity=activity) print("Ready Player One.")
[ "async", "def", "on_ready", "(", ")", ":", "activity", "=", "discord", ".", "Game", "(", "name", "=", "f\"@Vibrant for help ({len(bot.guilds)})\"", ")", "await", "bot", ".", "change_presence", "(", "activity", "=", "activity", ")", "print", "(", "\"Ready Player ...
Change presence and report ready.
[ "Change", "presence", "and", "report", "ready", "." ]
[ "\"\"\"Change presence and report ready.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
d966844fd47c808cd53c0227d071841bc05e7df2
Gumbachi/colorBOT
cogs/general.py
[ "MIT" ]
Python
change_server_prefix
null
async def change_server_prefix(self, ctx, *, new_prefix): """Change the bots prefix for the guild.""" db.guilds.update_one( {"_id": ctx.guild.id}, {"$set": {"prefix": new_prefix}} ) await ctx.send(f"Prefix changed to `{new_prefix}` {check_emoji()}")
Change the bots prefix for the guild.
Change the bots prefix for the guild.
[ "Change", "the", "bots", "prefix", "for", "the", "guild", "." ]
async def change_server_prefix(self, ctx, *, new_prefix): db.guilds.update_one( {"_id": ctx.guild.id}, {"$set": {"prefix": new_prefix}} ) await ctx.send(f"Prefix changed to `{new_prefix}` {check_emoji()}")
[ "async", "def", "change_server_prefix", "(", "self", ",", "ctx", ",", "*", ",", "new_prefix", ")", ":", "db", ".", "guilds", ".", "update_one", "(", "{", "\"_id\"", ":", "ctx", ".", "guild", ".", "id", "}", ",", "{", "\"$set\"", ":", "{", "\"prefix\"...
Change the bots prefix for the guild.
[ "Change", "the", "bots", "prefix", "for", "the", "guild", "." ]
[ "\"\"\"Change the bots prefix for the guild.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null }, { "param": "new_prefix", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
693098421a28cbcab8441a34ff8d14e6a7a7baf5
Gumbachi/colorBOT
cogs/catalog.py
[ "MIT" ]
Python
send
<not_specific>
async def send(self, channel): """Sends the message containing the catalog.""" # Send Images if self.type == "Image": # only one image to send if len(self.content) == 1: imagefile = image_to_file(self.content[0]) return await channel.send(f...
Sends the message containing the catalog.
Sends the message containing the catalog.
[ "Sends", "the", "message", "containing", "the", "catalog", "." ]
async def send(self, channel): if self.type == "Image": if len(self.content) == 1: imagefile = image_to_file(self.content[0]) return await channel.send(file=imagefile) await self.delete_message() imagefile = image_to_file(self.content[self.pa...
[ "async", "def", "send", "(", "self", ",", "channel", ")", ":", "if", "self", ".", "type", "==", "\"Image\"", ":", "if", "len", "(", "self", ".", "content", ")", "==", "1", ":", "imagefile", "=", "image_to_file", "(", "self", ".", "content", "[", "0...
Sends the message containing the catalog.
[ "Sends", "the", "message", "containing", "the", "catalog", "." ]
[ "\"\"\"Sends the message containing the catalog.\"\"\"", "# Send Images", "# only one image to send", "# delete current message", "# Send and add reactions to new image", "# Send embeds", "# Edit or send new message", "# add to catalog instances" ]
[ { "param": "self", "type": null }, { "param": "channel", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "channel", "type": null, "docstring": null, "docstring_tokens"...
693098421a28cbcab8441a34ff8d14e6a7a7baf5
Gumbachi/colorBOT
cogs/catalog.py
[ "MIT" ]
Python
delete_message
null
async def delete_message(self): """Attempts to delete the message stored.""" if self.message: try: await self.message.delete() except discord.errors.NotFound: pass
Attempts to delete the message stored.
Attempts to delete the message stored.
[ "Attempts", "to", "delete", "the", "message", "stored", "." ]
async def delete_message(self): if self.message: try: await self.message.delete() except discord.errors.NotFound: pass
[ "async", "def", "delete_message", "(", "self", ")", ":", "if", "self", ".", "message", ":", "try", ":", "await", "self", ".", "message", ".", "delete", "(", ")", "except", "discord", ".", "errors", ".", "NotFound", ":", "pass" ]
Attempts to delete the message stored.
[ "Attempts", "to", "delete", "the", "message", "stored", "." ]
[ "\"\"\"Attempts to delete the message stored.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
91049e5f782ea8ec7388a5faf74b26af78f83b3b
Gumbachi/colorBOT
cogs/welcome.py
[ "MIT" ]
Python
on_guild_join
null
async def on_guild_join(self, guild): """Add new guild to database.""" db.guilds.insert_one( { "_id": guild.id, "prefix": "$", "wc": None, "colors": [], "themes": [] } )
Add new guild to database.
Add new guild to database.
[ "Add", "new", "guild", "to", "database", "." ]
async def on_guild_join(self, guild): db.guilds.insert_one( { "_id": guild.id, "prefix": "$", "wc": None, "colors": [], "themes": [] } )
[ "async", "def", "on_guild_join", "(", "self", ",", "guild", ")", ":", "db", ".", "guilds", ".", "insert_one", "(", "{", "\"_id\"", ":", "guild", ".", "id", ",", "\"prefix\"", ":", "\"$\"", ",", "\"wc\"", ":", "None", ",", "\"colors\"", ":", "[", "]",...
Add new guild to database.
[ "Add", "new", "guild", "to", "database", "." ]
[ "\"\"\"Add new guild to database.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "guild", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "guild", "type": null, "docstring": null, "docstring_tokens": ...
91049e5f782ea8ec7388a5faf74b26af78f83b3b
Gumbachi/colorBOT
cogs/welcome.py
[ "MIT" ]
Python
on_guild_channel_delete
null
async def on_guild_channel_delete(self, channel): """Update database if welcome channel is deleted.""" db.guilds.update_one( {"_id": channel.guild.id, "wc": channel.id}, {"$set": {"wc": None}} )
Update database if welcome channel is deleted.
Update database if welcome channel is deleted.
[ "Update", "database", "if", "welcome", "channel", "is", "deleted", "." ]
async def on_guild_channel_delete(self, channel): db.guilds.update_one( {"_id": channel.guild.id, "wc": channel.id}, {"$set": {"wc": None}} )
[ "async", "def", "on_guild_channel_delete", "(", "self", ",", "channel", ")", ":", "db", ".", "guilds", ".", "update_one", "(", "{", "\"_id\"", ":", "channel", ".", "guild", ".", "id", ",", "\"wc\"", ":", "channel", ".", "id", "}", ",", "{", "\"$set\"",...
Update database if welcome channel is deleted.
[ "Update", "database", "if", "welcome", "channel", "is", "deleted", "." ]
[ "\"\"\"Update database if welcome channel is deleted.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "channel", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "channel", "type": null, "docstring": null, "docstring_tokens"...
3ce986fdd22ba9c6195d92302a13e0ad6229db5a
Gumbachi/colorBOT
cogs/theme/assignment.py
[ "MIT" ]
Python
load_theme
null
async def load_theme(self, ctx, *, themename): """Change the active colors to a theme.""" themes = db.get(ctx.guild.id, "themes") theme = theme_lookup(themename, themes) output_suppressed = ctx.guild.id in cfg.suppress_output if not theme: raise UserInputError("Cou...
Change the active colors to a theme.
Change the active colors to a theme.
[ "Change", "the", "active", "colors", "to", "a", "theme", "." ]
async def load_theme(self, ctx, *, themename): themes = db.get(ctx.guild.id, "themes") theme = theme_lookup(themename, themes) output_suppressed = ctx.guild.id in cfg.suppress_output if not theme: raise UserInputError("Could not find that theme") if not output_suppres...
[ "async", "def", "load_theme", "(", "self", ",", "ctx", ",", "*", ",", "themename", ")", ":", "themes", "=", "db", ".", "get", "(", "ctx", ".", "guild", ".", "id", ",", "\"themes\"", ")", "theme", "=", "theme_lookup", "(", "themename", ",", "themes", ...
Change the active colors to a theme.
[ "Change", "the", "active", "colors", "to", "a", "theme", "." ]
[ "\"\"\"Change the active colors to a theme.\"\"\"", "# Supress output from clear_colors and prevent other commands from modifying colors", "# clear colors", "# Progress update", "# kind of a monster and probably impractical but it works", "# keeps only colors that have members that can be found", "# Upd...
[ { "param": "self", "type": null }, { "param": "ctx", "type": null }, { "param": "themename", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
7f01b013cd99837509e9b655107649832c8d1383
Gumbachi/colorBOT
cogs/color/assignment.py
[ "MIT" ]
Python
cog_check
<not_specific>
def cog_check(self, ctx): """Disable all commands in cog if heavy command is running.""" if ctx.guild.id in cfg.heavy_command_active: raise CommandError("A command is running, please wait") return True
Disable all commands in cog if heavy command is running.
Disable all commands in cog if heavy command is running.
[ "Disable", "all", "commands", "in", "cog", "if", "heavy", "command", "is", "running", "." ]
def cog_check(self, ctx): if ctx.guild.id in cfg.heavy_command_active: raise CommandError("A command is running, please wait") return True
[ "def", "cog_check", "(", "self", ",", "ctx", ")", ":", "if", "ctx", ".", "guild", ".", "id", "in", "cfg", ".", "heavy_command_active", ":", "raise", "CommandError", "(", "\"A command is running, please wait\"", ")", "return", "True" ]
Disable all commands in cog if heavy command is running.
[ "Disable", "all", "commands", "in", "cog", "if", "heavy", "command", "is", "running", "." ]
[ "\"\"\"Disable all commands in cog if heavy command is running.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
7f01b013cd99837509e9b655107649832c8d1383
Gumbachi/colorBOT
cogs/color/assignment.py
[ "MIT" ]
Python
uncolor
<not_specific>
async def uncolor(member, color): """Removes the color role if a user has one.""" # do nothing if there is no associated role if not color["role"]: return role = member.guild.get_role(color["role"]) await member.remove_roles(role)
Removes the color role if a user has one.
Removes the color role if a user has one.
[ "Removes", "the", "color", "role", "if", "a", "user", "has", "one", "." ]
async def uncolor(member, color): if not color["role"]: return role = member.guild.get_role(color["role"]) await member.remove_roles(role)
[ "async", "def", "uncolor", "(", "member", ",", "color", ")", ":", "if", "not", "color", "[", "\"role\"", "]", ":", "return", "role", "=", "member", ".", "guild", ".", "get_role", "(", "color", "[", "\"role\"", "]", ")", "await", "member", ".", "remov...
Removes the color role if a user has one.
[ "Removes", "the", "color", "role", "if", "a", "user", "has", "one", "." ]
[ "\"\"\"Removes the color role if a user has one.\"\"\"", "# do nothing if there is no associated role" ]
[ { "param": "member", "type": null }, { "param": "color", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "member", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "color", "type": null, "docstring": null, "docstring_tokens"...
7f01b013cd99837509e9b655107649832c8d1383
Gumbachi/colorBOT
cogs/color/assignment.py
[ "MIT" ]
Python
create_role
<not_specific>
async def create_role(guild, color): """Create a role and update database.""" role = await guild.create_role( name=color["name"], color=utils.discord_color(color) ) db.guilds.update_one( {"_id": guild.id, "colors.name": color["name"]}, {"$s...
Create a role and update database.
Create a role and update database.
[ "Create", "a", "role", "and", "update", "database", "." ]
async def create_role(guild, color): role = await guild.create_role( name=color["name"], color=utils.discord_color(color) ) db.guilds.update_one( {"_id": guild.id, "colors.name": color["name"]}, {"$set": {"colors.$.role": role.id}} ) ...
[ "async", "def", "create_role", "(", "guild", ",", "color", ")", ":", "role", "=", "await", "guild", ".", "create_role", "(", "name", "=", "color", "[", "\"name\"", "]", ",", "color", "=", "utils", ".", "discord_color", "(", "color", ")", ")", "db", "...
Create a role and update database.
[ "Create", "a", "role", "and", "update", "database", "." ]
[ "\"\"\"Create a role and update database.\"\"\"" ]
[ { "param": "guild", "type": null }, { "param": "color", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "guild", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "color", "type": null, "docstring": null, "docstring_tokens":...
7f01b013cd99837509e9b655107649832c8d1383
Gumbachi/colorBOT
cogs/color/assignment.py
[ "MIT" ]
Python
color_user
null
async def color_user(self, ctx, member: discord.Member, *, cstring=""): """Color a specified user a specified color.""" colors = db.get(ctx.guild.id, "colors") ucolor = utils.find_user_color(member, colors) if not colors: raise CommandError("There are no active colors") ...
Color a specified user a specified color.
Color a specified user a specified color.
[ "Color", "a", "specified", "user", "a", "specified", "color", "." ]
async def color_user(self, ctx, member: discord.Member, *, cstring=""): colors = db.get(ctx.guild.id, "colors") ucolor = utils.find_user_color(member, colors) if not colors: raise CommandError("There are no active colors") if len(colors) > 1 and not cstring: exclu...
[ "async", "def", "color_user", "(", "self", ",", "ctx", ",", "member", ":", "discord", ".", "Member", ",", "*", ",", "cstring", "=", "\"\"", ")", ":", "colors", "=", "db", ".", "get", "(", "ctx", ".", "guild", ".", "id", ",", "\"colors\"", ")", "u...
Color a specified user a specified color.
[ "Color", "a", "specified", "user", "a", "specified", "color", "." ]
[ "\"\"\"Color a specified user a specified color.\"\"\"", "# to eliminate random coloring the same color", "# attempt to uncolor and then color user" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null }, { "param": "member", "type": "discord.Member" }, { "param": "cstring", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
7f01b013cd99837509e9b655107649832c8d1383
Gumbachi/colorBOT
cogs/color/assignment.py
[ "MIT" ]
Python
colorme
null
async def colorme(self, ctx, *, cstring=""): """Display an image of equipped colors.""" await ctx.invoke( self.bot.get_command("color"), member=ctx.author, cstring=cstring )
Display an image of equipped colors.
Display an image of equipped colors.
[ "Display", "an", "image", "of", "equipped", "colors", "." ]
async def colorme(self, ctx, *, cstring=""): await ctx.invoke( self.bot.get_command("color"), member=ctx.author, cstring=cstring )
[ "async", "def", "colorme", "(", "self", ",", "ctx", ",", "*", ",", "cstring", "=", "\"\"", ")", ":", "await", "ctx", ".", "invoke", "(", "self", ".", "bot", ".", "get_command", "(", "\"color\"", ")", ",", "member", "=", "ctx", ".", "author", ",", ...
Display an image of equipped colors.
[ "Display", "an", "image", "of", "equipped", "colors", "." ]
[ "\"\"\"Display an image of equipped colors.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null }, { "param": "cstring", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
7f01b013cd99837509e9b655107649832c8d1383
Gumbachi/colorBOT
cogs/color/assignment.py
[ "MIT" ]
Python
uncolorme
null
async def uncolorme(self, ctx): """Display an image of equipped colors.""" colors = db.get(ctx.guild.id, "colors") ucolor = utils.find_user_color(ctx.author, colors) # remove color if ucolor: await self.uncolor(ctx.author, ucolor) response = f"You have be...
Display an image of equipped colors.
Display an image of equipped colors.
[ "Display", "an", "image", "of", "equipped", "colors", "." ]
async def uncolorme(self, ctx): colors = db.get(ctx.guild.id, "colors") ucolor = utils.find_user_color(ctx.author, colors) if ucolor: await self.uncolor(ctx.author, ucolor) response = f"You have been uncolored {check_emoji()}" else: response = "You don...
[ "async", "def", "uncolorme", "(", "self", ",", "ctx", ")", ":", "colors", "=", "db", ".", "get", "(", "ctx", ".", "guild", ".", "id", ",", "\"colors\"", ")", "ucolor", "=", "utils", ".", "find_user_color", "(", "ctx", ".", "author", ",", "colors", ...
Display an image of equipped colors.
[ "Display", "an", "image", "of", "equipped", "colors", "." ]
[ "\"\"\"Display an image of equipped colors.\"\"\"", "# remove color" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
7f01b013cd99837509e9b655107649832c8d1383
Gumbachi/colorBOT
cogs/color/assignment.py
[ "MIT" ]
Python
color_server
null
async def color_server(self, ctx, *, color: utils.ColorConverter = None): """Gather all of the uncolored users and assigns them a color""" output_suppressed = ctx.guild.id in cfg.suppress_output colors = db.get(ctx.guild.id, "colors") # Fetch colors if not colors: raise Co...
Gather all of the uncolored users and assigns them a color
Gather all of the uncolored users and assigns them a color
[ "Gather", "all", "of", "the", "uncolored", "users", "and", "assigns", "them", "a", "color" ]
async def color_server(self, ctx, *, color: utils.ColorConverter = None): output_suppressed = ctx.guild.id in cfg.suppress_output colors = db.get(ctx.guild.id, "colors") if not colors: raise CommandError("There are no active colors") cfg.heavy_command_active.add(ctx.guild.i...
[ "async", "def", "color_server", "(", "self", ",", "ctx", ",", "*", ",", "color", ":", "utils", ".", "ColorConverter", "=", "None", ")", ":", "output_suppressed", "=", "ctx", ".", "guild", ".", "id", "in", "cfg", ".", "suppress_output", "colors", "=", "...
Gather all of the uncolored users and assigns them a color
[ "Gather", "all", "of", "the", "uncolored", "users", "and", "assigns", "them", "a", "color" ]
[ "\"\"\"Gather all of the uncolored users and assigns them a color\"\"\"", "# Fetch colors", "# begin heavy command", "# get uncolored members", "# Send working message", "# color generator for splashing", "# One color needed if color arg", "# random index in colors", "# Loop over all colors that wil...
[ { "param": "self", "type": null }, { "param": "ctx", "type": null }, { "param": "color", "type": "utils.ColorConverter" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
7f01b013cd99837509e9b655107649832c8d1383
Gumbachi/colorBOT
cogs/color/assignment.py
[ "MIT" ]
Python
uncolor_server
null
async def uncolor_server(self, ctx): """Remove all colors but not delete them.""" colors = db.get(ctx.guild.id, "colors") cfg.heavy_command_active.add(ctx.guild.id) # begin heavy command # Remove every role associated with a color for color in colors: if color["rol...
Remove all colors but not delete them.
Remove all colors but not delete them.
[ "Remove", "all", "colors", "but", "not", "delete", "them", "." ]
async def uncolor_server(self, ctx): colors = db.get(ctx.guild.id, "colors") cfg.heavy_command_active.add(ctx.guild.id) for color in colors: if color["role"]: role = ctx.guild.get_role(color["role"]) await role.delete() cfg.heavy_command_acti...
[ "async", "def", "uncolor_server", "(", "self", ",", "ctx", ")", ":", "colors", "=", "db", ".", "get", "(", "ctx", ".", "guild", ".", "id", ",", "\"colors\"", ")", "cfg", ".", "heavy_command_active", ".", "add", "(", "ctx", ".", "guild", ".", "id", ...
Remove all colors but not delete them.
[ "Remove", "all", "colors", "but", "not", "delete", "them", "." ]
[ "\"\"\"Remove all colors but not delete them.\"\"\"", "# begin heavy command", "# Remove every role associated with a color", "# end heavy cmd", "# Send success message" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
7f01b013cd99837509e9b655107649832c8d1383
Gumbachi/colorBOT
cogs/color/assignment.py
[ "MIT" ]
Python
on_member_join
<not_specific>
async def on_member_join(self, member): """Welcome and attempt to randomly color a new user.""" # get required data wc, colors = db.get_many(member.guild.id, "wc", "colors") # do nothing if no welcome channel if not wc: return welcome_channel = member.guild....
Welcome and attempt to randomly color a new user.
Welcome and attempt to randomly color a new user.
[ "Welcome", "and", "attempt", "to", "randomly", "color", "a", "new", "user", "." ]
async def on_member_join(self, member): wc, colors = db.get_many(member.guild.id, "wc", "colors") if not wc: return welcome_channel = member.guild.get_channel(wc) if colors: color = random.choice(colors) await self.color(member, color) acce...
[ "async", "def", "on_member_join", "(", "self", ",", "member", ")", ":", "wc", ",", "colors", "=", "db", ".", "get_many", "(", "member", ".", "guild", ".", "id", ",", "\"wc\"", ",", "\"colors\"", ")", "if", "not", "wc", ":", "return", "welcome_channel",...
Welcome and attempt to randomly color a new user.
[ "Welcome", "and", "attempt", "to", "randomly", "color", "a", "new", "user", "." ]
[ "\"\"\"Welcome and attempt to randomly color a new user.\"\"\"", "# get required data", "# do nothing if no welcome channel", "# generate and send weclome embed message" ]
[ { "param": "self", "type": null }, { "param": "member", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "member", "type": null, "docstring": null, "docstring_tokens":...
7f01b013cd99837509e9b655107649832c8d1383
Gumbachi/colorBOT
cogs/color/assignment.py
[ "MIT" ]
Python
on_member_remove
<not_specific>
async def on_member_remove(self, member): """Sends a goodbye message when a member leaves the server.""" wc, colors = db.get_many(member.guild.id, "wc", "colors") ucolor = utils.find_user_color(member, colors) # do nothing if no welcome channel if not wc: return ...
Sends a goodbye message when a member leaves the server.
Sends a goodbye message when a member leaves the server.
[ "Sends", "a", "goodbye", "message", "when", "a", "member", "leaves", "the", "server", "." ]
async def on_member_remove(self, member): wc, colors = db.get_many(member.guild.id, "wc", "colors") ucolor = utils.find_user_color(member, colors) if not wc: return welcome_channel = member.guild.get_channel(wc) embed = discord.Embed(title=f"{member.name} has left the...
[ "async", "def", "on_member_remove", "(", "self", ",", "member", ")", ":", "wc", ",", "colors", "=", "db", ".", "get_many", "(", "member", ".", "guild", ".", "id", ",", "\"wc\"", ",", "\"colors\"", ")", "ucolor", "=", "utils", ".", "find_user_color", "(...
Sends a goodbye message when a member leaves the server.
[ "Sends", "a", "goodbye", "message", "when", "a", "member", "leaves", "the", "server", "." ]
[ "\"\"\"Sends a goodbye message when a member leaves the server.\"\"\"", "# do nothing if no welcome channel", "# generate and send goodbye message", "# remove member and update db" ]
[ { "param": "self", "type": null }, { "param": "member", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "member", "type": null, "docstring": null, "docstring_tokens":...
7f01b013cd99837509e9b655107649832c8d1383
Gumbachi/colorBOT
cogs/color/assignment.py
[ "MIT" ]
Python
on_member_update
<not_specific>
async def on_member_update(self, before, after): """Updates color info if a users color role is manually removed""" # check if any roles changed if before.roles == after.roles: return # convert roles to set for comparison roles_before = set(before.roles) role...
Updates color info if a users color role is manually removed
Updates color info if a users color role is manually removed
[ "Updates", "color", "info", "if", "a", "users", "color", "role", "is", "manually", "removed" ]
async def on_member_update(self, before, after): if before.roles == after.roles: return roles_before = set(before.roles) roles_after = set(after.roles) removed_roles = roles_before - roles_after added_roles = roles_after - roles_before for role in removed_role...
[ "async", "def", "on_member_update", "(", "self", ",", "before", ",", "after", ")", ":", "if", "before", ".", "roles", "==", "after", ".", "roles", ":", "return", "roles_before", "=", "set", "(", "before", ".", "roles", ")", "roles_after", "=", "set", "...
Updates color info if a users color role is manually removed
[ "Updates", "color", "info", "if", "a", "users", "color", "role", "is", "manually", "removed" ]
[ "\"\"\"Updates color info if a users color role is manually removed\"\"\"", "# check if any roles changed", "# convert roles to set for comparison", "# find difference between sets", "# Role removed", "# clear role if empty", "# Role added" ]
[ { "param": "self", "type": null }, { "param": "before", "type": null }, { "param": "after", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "before", "type": null, "docstring": null, "docstring_tokens":...
61ed28e059b4bc482f7b73c92a3541cba17c3c1a
Gumbachi/colorBOT
cogs/color/management.py
[ "MIT" ]
Python
cog_check
<not_specific>
def cog_check(self, ctx): """Ensure user has permissions and heavy command is not active for cog commands.""" if not ctx.author.guild_permissions.manage_roles: raise CommandError(f"You need Manage Roles permission") if ctx.guild.id in cfg.heavy_command_active: raise Comma...
Ensure user has permissions and heavy command is not active for cog commands.
Ensure user has permissions and heavy command is not active for cog commands.
[ "Ensure", "user", "has", "permissions", "and", "heavy", "command", "is", "not", "active", "for", "cog", "commands", "." ]
def cog_check(self, ctx): if not ctx.author.guild_permissions.manage_roles: raise CommandError(f"You need Manage Roles permission") if ctx.guild.id in cfg.heavy_command_active: raise CommandError("Please wait for the current command to finish") return True
[ "def", "cog_check", "(", "self", ",", "ctx", ")", ":", "if", "not", "ctx", ".", "author", ".", "guild_permissions", ".", "manage_roles", ":", "raise", "CommandError", "(", "f\"You need Manage Roles permission\"", ")", "if", "ctx", ".", "guild", ".", "id", "i...
Ensure user has permissions and heavy command is not active for cog commands.
[ "Ensure", "user", "has", "permissions", "and", "heavy", "command", "is", "not", "active", "for", "cog", "commands", "." ]
[ "\"\"\"Ensure user has permissions and heavy command is not active for cog commands.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
61ed28e059b4bc482f7b73c92a3541cba17c3c1a
Gumbachi/colorBOT
cogs/color/management.py
[ "MIT" ]
Python
add_color
null
async def add_color(self, ctx, hexcode, *, name=""): """Add a color to the database colors.""" colors = db.get(ctx.guild.id, "colors") if len(colors) >= cfg.color_limit: raise CommandError(f"Color Limit Reached ({len(colors)}/50)") if not utils.validate_hex(hexcode): ...
Add a color to the database colors.
Add a color to the database colors.
[ "Add", "a", "color", "to", "the", "database", "colors", "." ]
async def add_color(self, ctx, hexcode, *, name=""): colors = db.get(ctx.guild.id, "colors") if len(colors) >= cfg.color_limit: raise CommandError(f"Color Limit Reached ({len(colors)}/50)") if not utils.validate_hex(hexcode): raise UserInputError( f"Invali...
[ "async", "def", "add_color", "(", "self", ",", "ctx", ",", "hexcode", ",", "*", ",", "name", "=", "\"\"", ")", ":", "colors", "=", "db", ".", "get", "(", "ctx", ".", "guild", ".", "id", ",", "\"colors\"", ")", "if", "len", "(", "colors", ")", "...
Add a color to the database colors.
[ "Add", "a", "color", "to", "the", "database", "colors", "." ]
[ "\"\"\"Add a color to the database colors.\"\"\"", "# auto name if name not given", "# change black color because #000000 in discord is transparent", "# create and add color", "# update database" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null }, { "param": "hexcode", "type": null }, { "param": "name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
61ed28e059b4bc482f7b73c92a3541cba17c3c1a
Gumbachi/colorBOT
cogs/color/management.py
[ "MIT" ]
Python
remove_color
null
async def remove_color(self, ctx, *, color: utils.ColorConverter): """Remove a color from a guild's colors.""" # remove color from db db.guilds.update_one( {"_id": ctx.guild.id}, {"$pull": {"colors": color}} ) # remove role if exists if color["ro...
Remove a color from a guild's colors.
Remove a color from a guild's colors.
[ "Remove", "a", "color", "from", "a", "guild", "'", "s", "colors", "." ]
async def remove_color(self, ctx, *, color: utils.ColorConverter): db.guilds.update_one( {"_id": ctx.guild.id}, {"$pull": {"colors": color}} ) if color["role"]: role = ctx.guild.get_role(color["role"]) await role.delete() await ctx.invoke(b...
[ "async", "def", "remove_color", "(", "self", ",", "ctx", ",", "*", ",", "color", ":", "utils", ".", "ColorConverter", ")", ":", "db", ".", "guilds", ".", "update_one", "(", "{", "\"_id\"", ":", "ctx", ".", "guild", ".", "id", "}", ",", "{", "\"$pul...
Remove a color from a guild's colors.
[ "Remove", "a", "color", "from", "a", "guild", "'", "s", "colors", "." ]
[ "\"\"\"Remove a color from a guild's colors.\"\"\"", "# remove color from db", "# remove role if exists" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null }, { "param": "color", "type": "utils.ColorConverter" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
61ed28e059b4bc482f7b73c92a3541cba17c3c1a
Gumbachi/colorBOT
cogs/color/management.py
[ "MIT" ]
Python
recolor
null
async def recolor(self, ctx, *, query): """Change the way a color looks.""" colors = db.get(ctx.guild.id, "colors") try: before, after = query.split("|") except ValueError: raise UserInputError( "Command should be formatted as: $rename <color> | <...
Change the way a color looks.
Change the way a color looks.
[ "Change", "the", "way", "a", "color", "looks", "." ]
async def recolor(self, ctx, *, query): colors = db.get(ctx.guild.id, "colors") try: before, after = query.split("|") except ValueError: raise UserInputError( "Command should be formatted as: $rename <color> | <hexcode>") color = utils.color_lookup...
[ "async", "def", "recolor", "(", "self", ",", "ctx", ",", "*", ",", "query", ")", ":", "colors", "=", "db", ".", "get", "(", "ctx", ".", "guild", ".", "id", ",", "\"colors\"", ")", "try", ":", "before", ",", "after", "=", "query", ".", "split", ...
Change the way a color looks.
[ "Change", "the", "way", "a", "color", "looks", "." ]
[ "\"\"\"Change the way a color looks.\"\"\"", "# Find the correct color to remove. or dont.", "# adjust roles if color is changed", "# update database" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null }, { "param": "query", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
61ed28e059b4bc482f7b73c92a3541cba17c3c1a
Gumbachi/colorBOT
cogs/color/management.py
[ "MIT" ]
Python
on_guild_role_delete
null
async def on_guild_role_delete(self, role): """Removes a role from a color if user deletes it""" db.guilds.update_one( {"_id": role.guild.id, "colors.role": role.id}, {"$set": {"colors.$.role": None, "colors.$.members": []}} )
Removes a role from a color if user deletes it
Removes a role from a color if user deletes it
[ "Removes", "a", "role", "from", "a", "color", "if", "user", "deletes", "it" ]
async def on_guild_role_delete(self, role): db.guilds.update_one( {"_id": role.guild.id, "colors.role": role.id}, {"$set": {"colors.$.role": None, "colors.$.members": []}} )
[ "async", "def", "on_guild_role_delete", "(", "self", ",", "role", ")", ":", "db", ".", "guilds", ".", "update_one", "(", "{", "\"_id\"", ":", "role", ".", "guild", ".", "id", ",", "\"colors.role\"", ":", "role", ".", "id", "}", ",", "{", "\"$set\"", ...
Removes a role from a color if user deletes it
[ "Removes", "a", "role", "from", "a", "color", "if", "user", "deletes", "it" ]
[ "\"\"\"Removes a role from a color if user deletes it\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "role", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "role", "type": null, "docstring": null, "docstring_tokens": [...
61ed28e059b4bc482f7b73c92a3541cba17c3c1a
Gumbachi/colorBOT
cogs/color/management.py
[ "MIT" ]
Python
on_guild_role_update
null
async def on_guild_role_update(self, before, after): """Updated a color if the associated role is updated""" # Name has changed if before.name != after.name: db.guilds.update_one( {"_id": before.guild.id, "colors.role": before.id}, {"$set": {"colors.$....
Updated a color if the associated role is updated
Updated a color if the associated role is updated
[ "Updated", "a", "color", "if", "the", "associated", "role", "is", "updated" ]
async def on_guild_role_update(self, before, after): if before.name != after.name: db.guilds.update_one( {"_id": before.guild.id, "colors.role": before.id}, {"$set": {"colors.$.name": after.name}} ) if before.color != after.color: db.gu...
[ "async", "def", "on_guild_role_update", "(", "self", ",", "before", ",", "after", ")", ":", "if", "before", ".", "name", "!=", "after", ".", "name", ":", "db", ".", "guilds", ".", "update_one", "(", "{", "\"_id\"", ":", "before", ".", "guild", ".", "...
Updated a color if the associated role is updated
[ "Updated", "a", "color", "if", "the", "associated", "role", "is", "updated" ]
[ "\"\"\"Updated a color if the associated role is updated\"\"\"", "# Name has changed", "# Hexcode has changed" ]
[ { "param": "self", "type": null }, { "param": "before", "type": null }, { "param": "after", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "before", "type": null, "docstring": null, "docstring_tokens":...
eb36900279391a1b0a3ef48b1b89bfd55f93e084
Gumbachi/colorBOT
cogs/theme/info.py
[ "MIT" ]
Python
draw_themes
<not_specific>
def draw_themes(themes): """Creates an image displaying themes.""" canvas_width = 900 canvas_height = 600 slice_length = 5 # how many themes per page slice_amt = math.ceil(len(themes)/slice_length) # Pages needed # Theme container distribution cont_height = ca...
Creates an image displaying themes.
Creates an image displaying themes.
[ "Creates", "an", "image", "displaying", "themes", "." ]
def draw_themes(themes): canvas_width = 900 canvas_height = 600 slice_length = 5 slice_amt = math.ceil(len(themes)/slice_length) cont_height = canvas_height // slice_length text_top = int(cont_height * .1) text_height = int(cont_height * .30) color_t...
[ "def", "draw_themes", "(", "themes", ")", ":", "canvas_width", "=", "900", "canvas_height", "=", "600", "slice_length", "=", "5", "slice_amt", "=", "math", ".", "ceil", "(", "len", "(", "themes", ")", "/", "slice_length", ")", "cont_height", "=", "canvas_h...
Creates an image displaying themes.
[ "Creates", "an", "image", "displaying", "themes", "." ]
[ "\"\"\"Creates an image displaying themes.\"\"\"", "# how many themes per page", "# Pages needed", "# Theme container distribution", "# text is drawn at 10% of container height", "# text is 30% of container", "# color is drawn at 50% of container height", "# color is 40% of container", "# Create new...
[ { "param": "themes", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "themes", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
eb36900279391a1b0a3ef48b1b89bfd55f93e084
Gumbachi/colorBOT
cogs/theme/info.py
[ "MIT" ]
Python
show_themes
<not_specific>
async def show_themes(self, ctx): """Draw the guild's themes and send in channel.""" themes = db.get(ctx.guild.id, "themes") if not themes: return await ctx.send(embed=Embed(title="You have no themes")) theme_files = self.draw_themes(themes) # create and send catal...
Draw the guild's themes and send in channel.
Draw the guild's themes and send in channel.
[ "Draw", "the", "guild", "'", "s", "themes", "and", "send", "in", "channel", "." ]
async def show_themes(self, ctx): themes = db.get(ctx.guild.id, "themes") if not themes: return await ctx.send(embed=Embed(title="You have no themes")) theme_files = self.draw_themes(themes) catalog = Catalog(theme_files) await catalog.send(ctx.channel)
[ "async", "def", "show_themes", "(", "self", ",", "ctx", ")", ":", "themes", "=", "db", ".", "get", "(", "ctx", ".", "guild", ".", "id", ",", "\"themes\"", ")", "if", "not", "themes", ":", "return", "await", "ctx", ".", "send", "(", "embed", "=", ...
Draw the guild's themes and send in channel.
[ "Draw", "the", "guild", "'", "s", "themes", "and", "send", "in", "channel", "." ]
[ "\"\"\"Draw the guild's themes and send in channel.\"\"\"", "# create and send catalog" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
eb36900279391a1b0a3ef48b1b89bfd55f93e084
Gumbachi/colorBOT
cogs/theme/info.py
[ "MIT" ]
Python
show_themes_in_detail
null
async def show_themes_in_detail(self, ctx): """Shows a detailed, textbased view of your themes.""" themes = db.get(ctx.guild.id, "themes") themes_embed = Embed(title="Themes in Detail", description="") for theme in themes: colors = [f"**{color['name']}**: {color['hexcode']}" ...
Shows a detailed, textbased view of your themes.
Shows a detailed, textbased view of your themes.
[ "Shows", "a", "detailed", "textbased", "view", "of", "your", "themes", "." ]
async def show_themes_in_detail(self, ctx): themes = db.get(ctx.guild.id, "themes") themes_embed = Embed(title="Themes in Detail", description="") for theme in themes: colors = [f"**{color['name']}**: {color['hexcode']}" for color in theme["colors"]] ...
[ "async", "def", "show_themes_in_detail", "(", "self", ",", "ctx", ")", ":", "themes", "=", "db", ".", "get", "(", "ctx", ".", "guild", ".", "id", ",", "\"themes\"", ")", "themes_embed", "=", "Embed", "(", "title", "=", "\"Themes in Detail\"", ",", "descr...
Shows a detailed, textbased view of your themes.
[ "Shows", "a", "detailed", "textbased", "view", "of", "your", "themes", "." ]
[ "\"\"\"Shows a detailed, textbased view of your themes.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
eb36900279391a1b0a3ef48b1b89bfd55f93e084
Gumbachi/colorBOT
cogs/theme/info.py
[ "MIT" ]
Python
show_imports
null
async def show_imports(self, ctx): """Draw and send an image of all presets""" themes = [] for fname in os.listdir(f"assets{sep}presets{sep}"): with open(f"assets{sep}presets{sep}{fname}", "r") as preset: themes.append(json.load(preset)) # Create catalog and ...
Draw and send an image of all presets
Draw and send an image of all presets
[ "Draw", "and", "send", "an", "image", "of", "all", "presets" ]
async def show_imports(self, ctx): themes = [] for fname in os.listdir(f"assets{sep}presets{sep}"): with open(f"assets{sep}presets{sep}{fname}", "r") as preset: themes.append(json.load(preset)) catalog = Catalog(self.draw_themes(themes)) await catalog.send(ctx...
[ "async", "def", "show_imports", "(", "self", ",", "ctx", ")", ":", "themes", "=", "[", "]", "for", "fname", "in", "os", ".", "listdir", "(", "f\"assets{sep}presets{sep}\"", ")", ":", "with", "open", "(", "f\"assets{sep}presets{sep}{fname}\"", ",", "\"r\"", "...
Draw and send an image of all presets
[ "Draw", "and", "send", "an", "image", "of", "all", "presets" ]
[ "\"\"\"Draw and send an image of all presets\"\"\"", "# Create catalog and send" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
e765721897c9d886d223b940aef2464b8159c1d4
Gumbachi/colorBOT
cogs/admin.py
[ "MIT" ]
Python
delete_messages
null
async def delete_messages(self, ctx, amount): """purge a set amount of messages!""" if ctx.author.id in admin_ids: await ctx.channel.purge(limit=int(amount)+1) await ctx.send(f"purged {amount} messages", delete_after=2)
purge a set amount of messages!
purge a set amount of messages!
[ "purge", "a", "set", "amount", "of", "messages!" ]
async def delete_messages(self, ctx, amount): if ctx.author.id in admin_ids: await ctx.channel.purge(limit=int(amount)+1) await ctx.send(f"purged {amount} messages", delete_after=2)
[ "async", "def", "delete_messages", "(", "self", ",", "ctx", ",", "amount", ")", ":", "if", "ctx", ".", "author", ".", "id", "in", "admin_ids", ":", "await", "ctx", ".", "channel", ".", "purge", "(", "limit", "=", "int", "(", "amount", ")", "+", "1"...
purge a set amount of messages!
[ "purge", "a", "set", "amount", "of", "messages!" ]
[ "\"\"\"purge a set amount of messages!\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null }, { "param": "amount", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
d0f7eaa98c4ea96ff6258a468c46b8403f4f1446
Gumbachi/colorBOT
cogs/theme/management.py
[ "MIT" ]
Python
cog_check
<not_specific>
def cog_check(self, ctx): """Ensure user has permissions and heavy command is not active for cog commands.""" if not ctx.author.guild_permissions.manage_roles: raise CommandError(f"You need Manage Roles permission") return True
Ensure user has permissions and heavy command is not active for cog commands.
Ensure user has permissions and heavy command is not active for cog commands.
[ "Ensure", "user", "has", "permissions", "and", "heavy", "command", "is", "not", "active", "for", "cog", "commands", "." ]
def cog_check(self, ctx): if not ctx.author.guild_permissions.manage_roles: raise CommandError(f"You need Manage Roles permission") return True
[ "def", "cog_check", "(", "self", ",", "ctx", ")", ":", "if", "not", "ctx", ".", "author", ".", "guild_permissions", ".", "manage_roles", ":", "raise", "CommandError", "(", "f\"You need Manage Roles permission\"", ")", "return", "True" ]
Ensure user has permissions and heavy command is not active for cog commands.
[ "Ensure", "user", "has", "permissions", "and", "heavy", "command", "is", "not", "active", "for", "cog", "commands", "." ]
[ "\"\"\"Ensure user has permissions and heavy command is not active for cog commands.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
d0f7eaa98c4ea96ff6258a468c46b8403f4f1446
Gumbachi/colorBOT
cogs/theme/management.py
[ "MIT" ]
Python
save_theme
null
async def save_theme(self, ctx, *, name=""): """Save the current state of the guilds colors""" colors, themes = db.get_many(ctx.guild.id, "colors", "themes") if not colors: raise CommandError("There must be colors to save a theme") if len(themes) >= cfg.theme_limit: ...
Save the current state of the guilds colors
Save the current state of the guilds colors
[ "Save", "the", "current", "state", "of", "the", "guilds", "colors" ]
async def save_theme(self, ctx, *, name=""): colors, themes = db.get_many(ctx.guild.id, "colors", "themes") if not colors: raise CommandError("There must be colors to save a theme") if len(themes) >= cfg.theme_limit: raise CommandError(f"Theme Limit Reached ({len(themes)}...
[ "async", "def", "save_theme", "(", "self", ",", "ctx", ",", "*", ",", "name", "=", "\"\"", ")", ":", "colors", ",", "themes", "=", "db", ".", "get_many", "(", "ctx", ".", "guild", ".", "id", ",", "\"colors\"", ",", "\"themes\"", ")", "if", "not", ...
Save the current state of the guilds colors
[ "Save", "the", "current", "state", "of", "the", "guilds", "colors" ]
[ "\"\"\"Save the current state of the guilds colors\"\"\"", "# Verufy name", "# Remove unnecessary role attribute from database", "# create and add color", "# update database" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null }, { "param": "name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
d0f7eaa98c4ea96ff6258a468c46b8403f4f1446
Gumbachi/colorBOT
cogs/theme/management.py
[ "MIT" ]
Python
overwrite_theme
null
async def overwrite_theme(self, ctx, *, themename): """Overwrite one of the Guild's themes with another.""" colors, themes = db.get_many(ctx.guild.id, "colors", "themes") old_theme = theme_lookup(themename, themes) if not old_theme: raise UserInputError("Could not find that...
Overwrite one of the Guild's themes with another.
Overwrite one of the Guild's themes with another.
[ "Overwrite", "one", "of", "the", "Guild", "'", "s", "themes", "with", "another", "." ]
async def overwrite_theme(self, ctx, *, themename): colors, themes = db.get_many(ctx.guild.id, "colors", "themes") old_theme = theme_lookup(themename, themes) if not old_theme: raise UserInputError("Could not find that theme") for color in colors: del color["role"...
[ "async", "def", "overwrite_theme", "(", "self", ",", "ctx", ",", "*", ",", "themename", ")", ":", "colors", ",", "themes", "=", "db", ".", "get_many", "(", "ctx", ".", "guild", ".", "id", ",", "\"colors\"", ",", "\"themes\"", ")", "old_theme", "=", "...
Overwrite one of the Guild's themes with another.
[ "Overwrite", "one", "of", "the", "Guild", "'", "s", "themes", "with", "another", "." ]
[ "\"\"\"Overwrite one of the Guild's themes with another.\"\"\"", "# Remove unnecessary role attribute from database", "# create and add color", "# update database" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null }, { "param": "themename", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
d0f7eaa98c4ea96ff6258a468c46b8403f4f1446
Gumbachi/colorBOT
cogs/theme/management.py
[ "MIT" ]
Python
rename_theme
null
async def rename_theme(self, ctx, *, query): """Rename a theme in the guild.""" themes = db.get(ctx.guild.id, "themes") try: before, after = query.split("|") except ValueError: raise UserInputError( "Command should be formatted as: $t.rn <theme> |...
Rename a theme in the guild.
Rename a theme in the guild.
[ "Rename", "a", "theme", "in", "the", "guild", "." ]
async def rename_theme(self, ctx, *, query): themes = db.get(ctx.guild.id, "themes") try: before, after = query.split("|") except ValueError: raise UserInputError( "Command should be formatted as: $t.rn <theme> | <name>") theme = theme_lookup(befor...
[ "async", "def", "rename_theme", "(", "self", ",", "ctx", ",", "*", ",", "query", ")", ":", "themes", "=", "db", ".", "get", "(", "ctx", ".", "guild", ".", "id", ",", "\"themes\"", ")", "try", ":", "before", ",", "after", "=", "query", ".", "split...
Rename a theme in the guild.
[ "Rename", "a", "theme", "in", "the", "guild", "." ]
[ "\"\"\"Rename a theme in the guild.\"\"\"", "# Find the correct color to remove. or dont." ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null }, { "param": "query", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
d0f7eaa98c4ea96ff6258a468c46b8403f4f1446
Gumbachi/colorBOT
cogs/theme/management.py
[ "MIT" ]
Python
import_colors
null
async def import_colors(self, ctx, *, name): """Save a preset as a theme.""" themes = db.get(ctx.guild.id, "themes") if len(themes) >= cfg.theme_limit: raise CommandError(f"Theme Limit Reached ({len(themes)}/10)") # Read in preset as dict name = name.replace(" ", ""...
Save a preset as a theme.
Save a preset as a theme.
[ "Save", "a", "preset", "as", "a", "theme", "." ]
async def import_colors(self, ctx, *, name): themes = db.get(ctx.guild.id, "themes") if len(themes) >= cfg.theme_limit: raise CommandError(f"Theme Limit Reached ({len(themes)}/10)") name = name.replace(" ", "") try: with open(f"assets{sep}presets{sep}{name.lower()...
[ "async", "def", "import_colors", "(", "self", ",", "ctx", ",", "*", ",", "name", ")", ":", "themes", "=", "db", ".", "get", "(", "ctx", ".", "guild", ".", "id", ",", "\"themes\"", ")", "if", "len", "(", "themes", ")", ">=", "cfg", ".", "theme_lim...
Save a preset as a theme.
[ "Save", "a", "preset", "as", "a", "theme", "." ]
[ "\"\"\"Save a preset as a theme.\"\"\"", "# Read in preset as dict" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null }, { "param": "name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
37f7107ff8a5d79c81c626304b60e4bafe33e9f3
Gumbachi/colorBOT
common/utils.py
[ "MIT" ]
Python
convert
<not_specific>
async def convert(self, ctx, arg): """Find a color in a list of colors based on a query""" colors = db.get(ctx.guild.id, "colors") if not colors: raise CommandError("You have no active colors") color = color_lookup(arg, colors) if not color: raise Command...
Find a color in a list of colors based on a query
Find a color in a list of colors based on a query
[ "Find", "a", "color", "in", "a", "list", "of", "colors", "based", "on", "a", "query" ]
async def convert(self, ctx, arg): colors = db.get(ctx.guild.id, "colors") if not colors: raise CommandError("You have no active colors") color = color_lookup(arg, colors) if not color: raise CommandError("Color Not Found") return color
[ "async", "def", "convert", "(", "self", ",", "ctx", ",", "arg", ")", ":", "colors", "=", "db", ".", "get", "(", "ctx", ".", "guild", ".", "id", ",", "\"colors\"", ")", "if", "not", "colors", ":", "raise", "CommandError", "(", "\"You have no active colo...
Find a color in a list of colors based on a query
[ "Find", "a", "color", "in", "a", "list", "of", "colors", "based", "on", "a", "query" ]
[ "\"\"\"Find a color in a list of colors based on a query\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": null }, { "param": "arg", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...
37f7107ff8a5d79c81c626304b60e4bafe33e9f3
Gumbachi/colorBOT
common/utils.py
[ "MIT" ]
Python
theme_lookup
<not_specific>
def theme_lookup(arg, themes): """Find a theme based on a string.""" # Index lookup if arg.isdigit(): try: return themes[int(arg)-1] except IndexError: pass # Name lookup for theme in themes: if theme["name"].lower() == arg.lower(): return...
Find a theme based on a string.
Find a theme based on a string.
[ "Find", "a", "theme", "based", "on", "a", "string", "." ]
def theme_lookup(arg, themes): if arg.isdigit(): try: return themes[int(arg)-1] except IndexError: pass for theme in themes: if theme["name"].lower() == arg.lower(): return theme
[ "def", "theme_lookup", "(", "arg", ",", "themes", ")", ":", "if", "arg", ".", "isdigit", "(", ")", ":", "try", ":", "return", "themes", "[", "int", "(", "arg", ")", "-", "1", "]", "except", "IndexError", ":", "pass", "for", "theme", "in", "themes",...
Find a theme based on a string.
[ "Find", "a", "theme", "based", "on", "a", "string", "." ]
[ "\"\"\"Find a theme based on a string.\"\"\"", "# Index lookup", "# Name lookup" ]
[ { "param": "arg", "type": null }, { "param": "themes", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "arg", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "themes", "type": null, "docstring": null, "docstring_tokens": ...
37f7107ff8a5d79c81c626304b60e4bafe33e9f3
Gumbachi/colorBOT
common/utils.py
[ "MIT" ]
Python
color_lookup
<not_specific>
def color_lookup(arg, colors): """Find a color based on a string.""" # random color if arg == "": return random.choice(colors) # Index lookup if arg.isdigit(): try: return colors[int(arg)-1] except IndexError: pass # Name lookup for color in ...
Find a color based on a string.
Find a color based on a string.
[ "Find", "a", "color", "based", "on", "a", "string", "." ]
def color_lookup(arg, colors): if arg == "": return random.choice(colors) if arg.isdigit(): try: return colors[int(arg)-1] except IndexError: pass for color in colors: if color["name"].lower() == arg.lower(): return color
[ "def", "color_lookup", "(", "arg", ",", "colors", ")", ":", "if", "arg", "==", "\"\"", ":", "return", "random", ".", "choice", "(", "colors", ")", "if", "arg", ".", "isdigit", "(", ")", ":", "try", ":", "return", "colors", "[", "int", "(", "arg", ...
Find a color based on a string.
[ "Find", "a", "color", "based", "on", "a", "string", "." ]
[ "\"\"\"Find a color based on a string.\"\"\"", "# random color", "# Index lookup", "# Name lookup" ]
[ { "param": "arg", "type": null }, { "param": "colors", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "arg", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "colors", "type": null, "docstring": null, "docstring_tokens": ...
37f7107ff8a5d79c81c626304b60e4bafe33e9f3
Gumbachi/colorBOT
common/utils.py
[ "MIT" ]
Python
find_user_color
<not_specific>
def find_user_color(user, colors): """Extract the color from a list that contains the member id.""" for color in colors: if user.id in color["members"]: return color
Extract the color from a list that contains the member id.
Extract the color from a list that contains the member id.
[ "Extract", "the", "color", "from", "a", "list", "that", "contains", "the", "member", "id", "." ]
def find_user_color(user, colors): for color in colors: if user.id in color["members"]: return color
[ "def", "find_user_color", "(", "user", ",", "colors", ")", ":", "for", "color", "in", "colors", ":", "if", "user", ".", "id", "in", "color", "[", "\"members\"", "]", ":", "return", "color" ]
Extract the color from a list that contains the member id.
[ "Extract", "the", "color", "from", "a", "list", "that", "contains", "the", "member", "id", "." ]
[ "\"\"\"Extract the color from a list that contains the member id.\"\"\"" ]
[ { "param": "user", "type": null }, { "param": "colors", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "user", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "colors", "type": null, "docstring": null, "docstring_tokens":...
7559d8bfa3d2e2685d5385a0282a6a2f803099d3
Gumbachi/colorBOT
cogs/errors.py
[ "MIT" ]
Python
on_command_error
<not_specific>
async def on_command_error(self, ctx, error): """The event triggered when an error is raised while invoking a command.""" gumbachi = cfg.bot.get_user(128595549975871488) if hasattr(ctx.command, 'on_error'): return error = getattr(error, 'original', error) # ignore n...
The event triggered when an error is raised while invoking a command.
The event triggered when an error is raised while invoking a command.
[ "The", "event", "triggered", "when", "an", "error", "is", "raised", "while", "invoking", "a", "command", "." ]
async def on_command_error(self, ctx, error): gumbachi = cfg.bot.get_user(128595549975871488) if hasattr(ctx.command, 'on_error'): return error = getattr(error, 'original', error) if isinstance(error, commands.CommandNotFound): return cfg.heavy_command_act...
[ "async", "def", "on_command_error", "(", "self", ",", "ctx", ",", "error", ")", ":", "gumbachi", "=", "cfg", ".", "bot", ".", "get_user", "(", "128595549975871488", ")", "if", "hasattr", "(", "ctx", ".", "command", ",", "'on_error'", ")", ":", "return", ...
The event triggered when an error is raised while invoking a command.
[ "The", "event", "triggered", "when", "an", "error", "is", "raised", "while", "invoking", "a", "command", "." ]
[ "\"\"\"The event triggered when an error is raised while invoking a command.\"\"\"", "# ignore non-commands", "# ADD HEAVY COMMAND ERROR AND SUPPRESS ERROR HERE", "# reset heavy command", "# General command error (should go last)", "# 403 Error", "# Missing Access", "# Missing Permissions", "# NotFo...
[ { "param": "self", "type": null }, { "param": "ctx", "type": null }, { "param": "error", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": []...