repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
lsst-sqre/sqre-codekit
codekit/cli/github_tag_teams.py
check_tags
def check_tags(repos, tags, ignore_existing=False, fail_fast=False): """ check if tags already exist in repos""" debug("looking for {n} tag(s):".format(n=len(tags))) [debug(" {t}".format(t=t)) for t in tags] debug("in {n} repo(s):".format(n=len(repos))) [debug(" {r}".format(r=r.full_name)) for r ...
python
def check_tags(repos, tags, ignore_existing=False, fail_fast=False): """ check if tags already exist in repos""" debug("looking for {n} tag(s):".format(n=len(tags))) [debug(" {t}".format(t=t)) for t in tags] debug("in {n} repo(s):".format(n=len(repos))) [debug(" {r}".format(r=r.full_name)) for r ...
[ "def", "check_tags", "(", "repos", ",", "tags", ",", "ignore_existing", "=", "False", ",", "fail_fast", "=", "False", ")", ":", "debug", "(", "\"looking for {n} tag(s):\"", ".", "format", "(", "n", "=", "len", "(", "tags", ")", ")", ")", "[", "debug", ...
check if tags already exist in repos
[ "check", "if", "tags", "already", "exist", "in", "repos" ]
98122404cd9065d4d1d570867fe518042669126c
https://github.com/lsst-sqre/sqre-codekit/blob/98122404cd9065d4d1d570867fe518042669126c/codekit/cli/github_tag_teams.py#L148-L198
train
lsst-sqre/sqre-codekit
codekit/cli/github_tag_teams.py
delete_refs
def delete_refs(repo, refs, dry_run=False): """Note that only the ref to a tag can be explicitly removed. The tag object will leave on until it's gargabe collected.""" assert isinstance(repo, github.Repository.Repository), type(repo) debug("removing {n} refs from {repo}".format( n=len(refs), ...
python
def delete_refs(repo, refs, dry_run=False): """Note that only the ref to a tag can be explicitly removed. The tag object will leave on until it's gargabe collected.""" assert isinstance(repo, github.Repository.Repository), type(repo) debug("removing {n} refs from {repo}".format( n=len(refs), ...
[ "def", "delete_refs", "(", "repo", ",", "refs", ",", "dry_run", "=", "False", ")", ":", "assert", "isinstance", "(", "repo", ",", "github", ".", "Repository", ".", "Repository", ")", ",", "type", "(", "repo", ")", "debug", "(", "\"removing {n} refs from {r...
Note that only the ref to a tag can be explicitly removed. The tag object will leave on until it's gargabe collected.
[ "Note", "that", "only", "the", "ref", "to", "a", "tag", "can", "be", "explicitly", "removed", ".", "The", "tag", "object", "will", "leave", "on", "until", "it", "s", "gargabe", "collected", "." ]
98122404cd9065d4d1d570867fe518042669126c
https://github.com/lsst-sqre/sqre-codekit/blob/98122404cd9065d4d1d570867fe518042669126c/codekit/cli/github_tag_teams.py#L397-L414
train
RedHatQE/Sentaku
examples/todo_example/ux.py
TodoUX.get_by
def get_by(self, name): """get a todo list ux by name :rtype: TodoListUX """ item = self.app.get_by(name) return TodoListUX(ux=self, controlled_list=item)
python
def get_by(self, name): """get a todo list ux by name :rtype: TodoListUX """ item = self.app.get_by(name) return TodoListUX(ux=self, controlled_list=item)
[ "def", "get_by", "(", "self", ",", "name", ")", ":", "item", "=", "self", ".", "app", ".", "get_by", "(", "name", ")", "return", "TodoListUX", "(", "ux", "=", "self", ",", "controlled_list", "=", "item", ")" ]
get a todo list ux by name :rtype: TodoListUX
[ "get", "a", "todo", "list", "ux", "by", "name" ]
b336cef5b6ee2db4e8dff28dcdb2be35a1f3d01c
https://github.com/RedHatQE/Sentaku/blob/b336cef5b6ee2db4e8dff28dcdb2be35a1f3d01c/examples/todo_example/ux.py#L9-L15
train
RedHatQE/Sentaku
examples/todo_example/ux.py
TodoUX.create_item
def create_item(self, name): """create a new named todo list :rtype: TodoListUX """ item = self.app.create_item(name) return TodoListUX(ux=self, controlled_list=item)
python
def create_item(self, name): """create a new named todo list :rtype: TodoListUX """ item = self.app.create_item(name) return TodoListUX(ux=self, controlled_list=item)
[ "def", "create_item", "(", "self", ",", "name", ")", ":", "item", "=", "self", ".", "app", ".", "create_item", "(", "name", ")", "return", "TodoListUX", "(", "ux", "=", "self", ",", "controlled_list", "=", "item", ")" ]
create a new named todo list :rtype: TodoListUX
[ "create", "a", "new", "named", "todo", "list" ]
b336cef5b6ee2db4e8dff28dcdb2be35a1f3d01c
https://github.com/RedHatQE/Sentaku/blob/b336cef5b6ee2db4e8dff28dcdb2be35a1f3d01c/examples/todo_example/ux.py#L17-L24
train
RedHatQE/Sentaku
examples/todo_example/ux.py
TodoListUX.get_by
def get_by(self, name): """ find a todo list element by name """ item = self.controlled_list.get_by(name) if item: return TodoElementUX(parent=self, controlled_element=item)
python
def get_by(self, name): """ find a todo list element by name """ item = self.controlled_list.get_by(name) if item: return TodoElementUX(parent=self, controlled_element=item)
[ "def", "get_by", "(", "self", ",", "name", ")", ":", "item", "=", "self", ".", "controlled_list", ".", "get_by", "(", "name", ")", "if", "item", ":", "return", "TodoElementUX", "(", "parent", "=", "self", ",", "controlled_element", "=", "item", ")" ]
find a todo list element by name
[ "find", "a", "todo", "list", "element", "by", "name" ]
b336cef5b6ee2db4e8dff28dcdb2be35a1f3d01c
https://github.com/RedHatQE/Sentaku/blob/b336cef5b6ee2db4e8dff28dcdb2be35a1f3d01c/examples/todo_example/ux.py#L44-L50
train
RedHatQE/Sentaku
examples/todo_example/ux.py
TodoListUX.create_item
def create_item(self, name): """ create a new todo list item """ elem = self.controlled_list.create_item(name) if elem: return TodoElementUX(parent=self, controlled_element=elem)
python
def create_item(self, name): """ create a new todo list item """ elem = self.controlled_list.create_item(name) if elem: return TodoElementUX(parent=self, controlled_element=elem)
[ "def", "create_item", "(", "self", ",", "name", ")", ":", "elem", "=", "self", ".", "controlled_list", ".", "create_item", "(", "name", ")", "if", "elem", ":", "return", "TodoElementUX", "(", "parent", "=", "self", ",", "controlled_element", "=", "elem", ...
create a new todo list item
[ "create", "a", "new", "todo", "list", "item" ]
b336cef5b6ee2db4e8dff28dcdb2be35a1f3d01c
https://github.com/RedHatQE/Sentaku/blob/b336cef5b6ee2db4e8dff28dcdb2be35a1f3d01c/examples/todo_example/ux.py#L52-L58
train
Frzk/Ellis
ellis_actions/nftables.py
NFTables.chose_blacklist
def chose_blacklist(self, ip): """ Given an IP address, figure out the set we have to use. If the address is an IPv4, we have to use *ellis_blacklist4*. If the address is an IPv6, we have to use *ellis_blacklist6*. Raises ipaddress.AddressValueError if the address is neither ...
python
def chose_blacklist(self, ip): """ Given an IP address, figure out the set we have to use. If the address is an IPv4, we have to use *ellis_blacklist4*. If the address is an IPv6, we have to use *ellis_blacklist6*. Raises ipaddress.AddressValueError if the address is neither ...
[ "def", "chose_blacklist", "(", "self", ",", "ip", ")", ":", "blacklist", "=", "'ellis_blacklist{0}'", "try", ":", "address", "=", "ipaddress", ".", "ip_address", "(", "ip", ")", "except", "ipaddress", ".", "AddressValueError", ":", "raise", "else", ":", "if"...
Given an IP address, figure out the set we have to use. If the address is an IPv4, we have to use *ellis_blacklist4*. If the address is an IPv6, we have to use *ellis_blacklist6*. Raises ipaddress.AddressValueError if the address is neither an IPv4 nor an IPv6.
[ "Given", "an", "IP", "address", "figure", "out", "the", "set", "we", "have", "to", "use", "." ]
39ce8987cbc503354cf1f45927344186a8b18363
https://github.com/Frzk/Ellis/blob/39ce8987cbc503354cf1f45927344186a8b18363/ellis_actions/nftables.py#L50-L82
train
sirfoga/pyhal
hal/maths/problems.py
EightQueen.under_attack
def under_attack(col, queens): """Checks if queen is under attack :param col: Column number :param queens: list of queens :return: True iff queen is under attack """ left = right = col for _, column in reversed(queens): left, right = left - 1, right +...
python
def under_attack(col, queens): """Checks if queen is under attack :param col: Column number :param queens: list of queens :return: True iff queen is under attack """ left = right = col for _, column in reversed(queens): left, right = left - 1, right +...
[ "def", "under_attack", "(", "col", ",", "queens", ")", ":", "left", "=", "right", "=", "col", "for", "_", ",", "column", "in", "reversed", "(", "queens", ")", ":", "left", ",", "right", "=", "left", "-", "1", ",", "right", "+", "1", "if", "column...
Checks if queen is under attack :param col: Column number :param queens: list of queens :return: True iff queen is under attack
[ "Checks", "if", "queen", "is", "under", "attack" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/maths/problems.py#L13-L25
train
rspivak/crammit
src/crammit/__init__.py
AssetManager._get_bundles_by_type
def _get_bundles_by_type(self, type): """Get a dictionary of bundles for requested type. Args: type: 'javascript' or 'css' """ bundles = {} bundle_definitions = self.config.get(type) if bundle_definitions is None: return bundles # bundle n...
python
def _get_bundles_by_type(self, type): """Get a dictionary of bundles for requested type. Args: type: 'javascript' or 'css' """ bundles = {} bundle_definitions = self.config.get(type) if bundle_definitions is None: return bundles # bundle n...
[ "def", "_get_bundles_by_type", "(", "self", ",", "type", ")", ":", "bundles", "=", "{", "}", "bundle_definitions", "=", "self", ".", "config", ".", "get", "(", "type", ")", "if", "bundle_definitions", "is", "None", ":", "return", "bundles", "for", "bundle_...
Get a dictionary of bundles for requested type. Args: type: 'javascript' or 'css'
[ "Get", "a", "dictionary", "of", "bundles", "for", "requested", "type", "." ]
ebd0f8a9b5267e6e1483f8886329ac262ab272d6
https://github.com/rspivak/crammit/blob/ebd0f8a9b5267e6e1483f8886329ac262ab272d6/src/crammit/__init__.py#L75-L107
train
lowandrew/OLCTools
spadespipeline/mMLST.py
getmlsthelper
def getmlsthelper(referencefilepath, start, organism, update): """Prepares to run the getmlst.py script provided in SRST2""" from accessoryFunctions.accessoryFunctions import GenObject # Initialise a set to for the organism(s) for which new alleles and profiles are desired organismset = set() # Allo...
python
def getmlsthelper(referencefilepath, start, organism, update): """Prepares to run the getmlst.py script provided in SRST2""" from accessoryFunctions.accessoryFunctions import GenObject # Initialise a set to for the organism(s) for which new alleles and profiles are desired organismset = set() # Allo...
[ "def", "getmlsthelper", "(", "referencefilepath", ",", "start", ",", "organism", ",", "update", ")", ":", "from", "accessoryFunctions", ".", "accessoryFunctions", "import", "GenObject", "organismset", "=", "set", "(", ")", "organism", "=", "organism", "if", "org...
Prepares to run the getmlst.py script provided in SRST2
[ "Prepares", "to", "run", "the", "getmlst", ".", "py", "script", "provided", "in", "SRST2" ]
88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/mMLST.py#L1229-L1306
train
lowandrew/OLCTools
spadespipeline/mMLST.py
MLST.blastnprep
def blastnprep(self): """Setup blastn analyses""" # Populate threads for each gene, genome combination for sample in self.metadata: if sample.general.bestassemblyfile != 'NA': # # sample[self.analysistype].alleleresults = GenObject() sa...
python
def blastnprep(self): """Setup blastn analyses""" # Populate threads for each gene, genome combination for sample in self.metadata: if sample.general.bestassemblyfile != 'NA': # # sample[self.analysistype].alleleresults = GenObject() sa...
[ "def", "blastnprep", "(", "self", ")", ":", "for", "sample", "in", "self", ".", "metadata", ":", "if", "sample", ".", "general", ".", "bestassemblyfile", "!=", "'NA'", ":", "sample", "[", "self", ".", "analysistype", "]", ".", "closealleles", "=", "dict"...
Setup blastn analyses
[ "Setup", "blastn", "analyses" ]
88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/mMLST.py#L170-L188
train
lowandrew/OLCTools
spadespipeline/mMLST.py
PipelineInit.strainer
def strainer(self): """ Determine whether it is required to run the MLST analyses """ # Initialise a variable to store whether the analyses need to be performed analyse = list() for sample in self.runmetadata.samples: if sample.general.bestassemblyfile != 'NA'...
python
def strainer(self): """ Determine whether it is required to run the MLST analyses """ # Initialise a variable to store whether the analyses need to be performed analyse = list() for sample in self.runmetadata.samples: if sample.general.bestassemblyfile != 'NA'...
[ "def", "strainer", "(", "self", ")", ":", "analyse", "=", "list", "(", ")", "for", "sample", "in", "self", ".", "runmetadata", ".", "samples", ":", "if", "sample", ".", "general", ".", "bestassemblyfile", "!=", "'NA'", ":", "try", ":", "if", "os", "....
Determine whether it is required to run the MLST analyses
[ "Determine", "whether", "it", "is", "required", "to", "run", "the", "MLST", "analyses" ]
88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/mMLST.py#L1542-L1584
train
sirfoga/pyhal
hal/times/utils.py
Timing.get_seconds
def get_seconds(self): """Gets seconds from raw time :return: Seconds in time """ parsed = self.parse_hh_mm_ss() # get times total_seconds = parsed.second total_seconds += parsed.minute * 60.0 total_seconds += parsed.hour * 60.0 * 60.0 return total_secon...
python
def get_seconds(self): """Gets seconds from raw time :return: Seconds in time """ parsed = self.parse_hh_mm_ss() # get times total_seconds = parsed.second total_seconds += parsed.minute * 60.0 total_seconds += parsed.hour * 60.0 * 60.0 return total_secon...
[ "def", "get_seconds", "(", "self", ")", ":", "parsed", "=", "self", ".", "parse_hh_mm_ss", "(", ")", "total_seconds", "=", "parsed", ".", "second", "total_seconds", "+=", "parsed", ".", "minute", "*", "60.0", "total_seconds", "+=", "parsed", ".", "hour", "...
Gets seconds from raw time :return: Seconds in time
[ "Gets", "seconds", "from", "raw", "time" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/times/utils.py#L39-L48
train
sirfoga/pyhal
hal/internet/email/utils.py
get_email_content
def get_email_content(file_path): """Email content in file :param file_path: Path to file with email text :return: Email text (html formatted) """ with open(file_path, "r") as in_file: text = str(in_file.read()) return text.replace("\n\n", "<br>")
python
def get_email_content(file_path): """Email content in file :param file_path: Path to file with email text :return: Email text (html formatted) """ with open(file_path, "r") as in_file: text = str(in_file.read()) return text.replace("\n\n", "<br>")
[ "def", "get_email_content", "(", "file_path", ")", ":", "with", "open", "(", "file_path", ",", "\"r\"", ")", "as", "in_file", ":", "text", "=", "str", "(", "in_file", ".", "read", "(", ")", ")", "return", "text", ".", "replace", "(", "\"\\n\\n\"", ",",...
Email content in file :param file_path: Path to file with email text :return: Email text (html formatted)
[ "Email", "content", "in", "file" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/internet/email/utils.py#L6-L14
train
portfors-lab/sparkle
sparkle/run/abstract_acquisition.py
AbstractAcquisitionRunner.set
def set(self, **kwargs): """Sets an internal setting for acquistion, using keywords. Available parameters to set: :param acqtime: duration of recording (input) window (seconds) :type acqtime: float :param aifs: sample rate of the recording (input) operation (Hz) ...
python
def set(self, **kwargs): """Sets an internal setting for acquistion, using keywords. Available parameters to set: :param acqtime: duration of recording (input) window (seconds) :type acqtime: float :param aifs: sample rate of the recording (input) operation (Hz) ...
[ "def", "set", "(", "self", ",", "**", "kwargs", ")", ":", "self", ".", "player_lock", ".", "acquire", "(", ")", "if", "'acqtime'", "in", "kwargs", ":", "self", ".", "player", ".", "set_aidur", "(", "kwargs", "[", "'acqtime'", "]", ")", "if", "'aifs'"...
Sets an internal setting for acquistion, using keywords. Available parameters to set: :param acqtime: duration of recording (input) window (seconds) :type acqtime: float :param aifs: sample rate of the recording (input) operation (Hz) :type aifs: int :param aoc...
[ "Sets", "an", "internal", "setting", "for", "acquistion", "using", "keywords", "." ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/abstract_acquisition.py#L64-L135
train
portfors-lab/sparkle
sparkle/run/abstract_acquisition.py
AbstractAcquisitionRunner.interval_wait
def interval_wait(self): """Pauses the correct amount of time according to this acquisition object's interval setting, and the last time this function was called""" # calculate time since last interation and wait to acheive desired interval now = time.time() elapsed = (...
python
def interval_wait(self): """Pauses the correct amount of time according to this acquisition object's interval setting, and the last time this function was called""" # calculate time since last interation and wait to acheive desired interval now = time.time() elapsed = (...
[ "def", "interval_wait", "(", "self", ")", ":", "now", "=", "time", ".", "time", "(", ")", "elapsed", "=", "(", "now", "-", "self", ".", "last_tick", ")", "*", "1000", "if", "elapsed", "<", "self", ".", "interval", ":", "time", ".", "sleep", "(", ...
Pauses the correct amount of time according to this acquisition object's interval setting, and the last time this function was called
[ "Pauses", "the", "correct", "amount", "of", "time", "according", "to", "this", "acquisition", "object", "s", "interval", "setting", "and", "the", "last", "time", "this", "function", "was", "called" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/abstract_acquisition.py#L150-L166
train
portfors-lab/sparkle
sparkle/run/abstract_acquisition.py
AbstractAcquisitionRunner.putnotify
def putnotify(self, name, *args): """Puts data into queue and alerts listeners""" # self.signals[name][0].send(*args) self.queues[name][0].put(*args) self.queues[name][1].set()
python
def putnotify(self, name, *args): """Puts data into queue and alerts listeners""" # self.signals[name][0].send(*args) self.queues[name][0].put(*args) self.queues[name][1].set()
[ "def", "putnotify", "(", "self", ",", "name", ",", "*", "args", ")", ":", "self", ".", "queues", "[", "name", "]", "[", "0", "]", ".", "put", "(", "*", "args", ")", "self", ".", "queues", "[", "name", "]", "[", "1", "]", ".", "set", "(", ")...
Puts data into queue and alerts listeners
[ "Puts", "data", "into", "queue", "and", "alerts", "listeners" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/abstract_acquisition.py#L168-L172
train
lowandrew/OLCTools
metagenomefilter/filtermetagenome.py
FilterGenome.loadassignment
def loadassignment(self): """Load the taxonomic assignment for each read""" printtime('Finding taxonomic assignments', self.start) # Create and start threads for i in range(self.cpus): # Send the threads to the appropriate destination function threads = Thread(tar...
python
def loadassignment(self): """Load the taxonomic assignment for each read""" printtime('Finding taxonomic assignments', self.start) # Create and start threads for i in range(self.cpus): # Send the threads to the appropriate destination function threads = Thread(tar...
[ "def", "loadassignment", "(", "self", ")", ":", "printtime", "(", "'Finding taxonomic assignments'", ",", "self", ".", "start", ")", "for", "i", "in", "range", "(", "self", ".", "cpus", ")", ":", "threads", "=", "Thread", "(", "target", "=", "self", ".",...
Load the taxonomic assignment for each read
[ "Load", "the", "taxonomic", "assignment", "for", "each", "read" ]
88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/metagenomefilter/filtermetagenome.py#L51-L66
train
lowandrew/OLCTools
metagenomefilter/filtermetagenome.py
FilterGenome.readlist
def readlist(self): """Sort the reads, and create lists to be used in creating sorted .fastq files""" printtime('Sorting reads', self.start) # Create and start threads for i in range(self.cpus): # Send the threads to the appropriate destination function threads = ...
python
def readlist(self): """Sort the reads, and create lists to be used in creating sorted .fastq files""" printtime('Sorting reads', self.start) # Create and start threads for i in range(self.cpus): # Send the threads to the appropriate destination function threads = ...
[ "def", "readlist", "(", "self", ")", ":", "printtime", "(", "'Sorting reads'", ",", "self", ".", "start", ")", "for", "i", "in", "range", "(", "self", ".", "cpus", ")", ":", "threads", "=", "Thread", "(", "target", "=", "self", ".", "listread", ",", ...
Sort the reads, and create lists to be used in creating sorted .fastq files
[ "Sort", "the", "reads", "and", "create", "lists", "to", "be", "used", "in", "creating", "sorted", ".", "fastq", "files" ]
88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/metagenomefilter/filtermetagenome.py#L86-L101
train
lowandrew/OLCTools
metagenomefilter/filtermetagenome.py
FilterGenome.fastqfilter
def fastqfilter(self): """Filter the reads into separate files based on taxonomic assignment""" printtime('Creating filtered .fastqfiles', self.start) # Create and start threads for i in range(self.cpus): # Send the threads to the appropriate destination function ...
python
def fastqfilter(self): """Filter the reads into separate files based on taxonomic assignment""" printtime('Creating filtered .fastqfiles', self.start) # Create and start threads for i in range(self.cpus): # Send the threads to the appropriate destination function ...
[ "def", "fastqfilter", "(", "self", ")", ":", "printtime", "(", "'Creating filtered .fastqfiles'", ",", "self", ".", "start", ")", "for", "i", "in", "range", "(", "self", ".", "cpus", ")", ":", "threads", "=", "Thread", "(", "target", "=", "self", ".", ...
Filter the reads into separate files based on taxonomic assignment
[ "Filter", "the", "reads", "into", "separate", "files", "based", "on", "taxonomic", "assignment" ]
88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/metagenomefilter/filtermetagenome.py#L125-L140
train
sirfoga/pyhal
hal/strings/models.py
String.remove_escapes
def remove_escapes(self): """Removes everything except number and letters from string :return: All numbers and letters in string """ chars = [] i = 0 while i < len(self.string): char = self.string[i] if char == "\\": i += 1 ...
python
def remove_escapes(self): """Removes everything except number and letters from string :return: All numbers and letters in string """ chars = [] i = 0 while i < len(self.string): char = self.string[i] if char == "\\": i += 1 ...
[ "def", "remove_escapes", "(", "self", ")", ":", "chars", "=", "[", "]", "i", "=", "0", "while", "i", "<", "len", "(", "self", ".", "string", ")", ":", "char", "=", "self", ".", "string", "[", "i", "]", "if", "char", "==", "\"\\\\\"", ":", "i", ...
Removes everything except number and letters from string :return: All numbers and letters in string
[ "Removes", "everything", "except", "number", "and", "letters", "from", "string" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/strings/models.py#L17-L34
train
sirfoga/pyhal
hal/strings/models.py
String.convert_accents
def convert_accents(self): """Removes accents from text :return: input with converted accents chars """ nkfd_form = unicodedata.normalize('NFKD', self.string) return "".join([ char for char in nkfd_form if not unicodedata.combining(char) ...
python
def convert_accents(self): """Removes accents from text :return: input with converted accents chars """ nkfd_form = unicodedata.normalize('NFKD', self.string) return "".join([ char for char in nkfd_form if not unicodedata.combining(char) ...
[ "def", "convert_accents", "(", "self", ")", ":", "nkfd_form", "=", "unicodedata", ".", "normalize", "(", "'NFKD'", ",", "self", ".", "string", ")", "return", "\"\"", ".", "join", "(", "[", "char", "for", "char", "in", "nkfd_form", "if", "not", "unicodeda...
Removes accents from text :return: input with converted accents chars
[ "Removes", "accents", "from", "text" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/strings/models.py#L43-L53
train
sirfoga/pyhal
hal/strings/models.py
String.remove_all
def remove_all(self, token): """Removes all occurrences of token :param token: string to remove :return: input without token """ out = self.string.replace(" ", token) # replace tokens while out.find(token + token) >= 0: # while there are tokens out = out.r...
python
def remove_all(self, token): """Removes all occurrences of token :param token: string to remove :return: input without token """ out = self.string.replace(" ", token) # replace tokens while out.find(token + token) >= 0: # while there are tokens out = out.r...
[ "def", "remove_all", "(", "self", ",", "token", ")", ":", "out", "=", "self", ".", "string", ".", "replace", "(", "\" \"", ",", "token", ")", "while", "out", ".", "find", "(", "token", "+", "token", ")", ">=", "0", ":", "out", "=", "out", ".", ...
Removes all occurrences of token :param token: string to remove :return: input without token
[ "Removes", "all", "occurrences", "of", "token" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/strings/models.py#L105-L115
train
portfors-lab/sparkle
sparkle/tools/log.py
init_logging
def init_logging(): """Initialize a logger from a configuration file to use throughout the project""" with open(os.path.join(os.path.dirname(__file__),'logging.conf'), 'r') as yf: config = yaml.load(yf) logging.config.dictConfig(config)
python
def init_logging(): """Initialize a logger from a configuration file to use throughout the project""" with open(os.path.join(os.path.dirname(__file__),'logging.conf'), 'r') as yf: config = yaml.load(yf) logging.config.dictConfig(config)
[ "def", "init_logging", "(", ")", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "'logging.conf'", ")", ",", "'r'", ")", "as", "yf", ":", "config", "=", "yaml", ".", "lo...
Initialize a logger from a configuration file to use throughout the project
[ "Initialize", "a", "logger", "from", "a", "configuration", "file", "to", "use", "throughout", "the", "project" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/tools/log.py#L8-L12
train
ArabellaTech/django-basic-cms
basic_cms/admin/forms.py
SlugFormMixin._clean_page_unique_slug_required
def _clean_page_unique_slug_required(self, slug): """See if this slug exists already""" if hasattr(self, 'instance') and self.instance.id: if Content.objects.exclude(page=self.instance).filter( body=slug, type="slug").count(): raise forms.ValidationError(...
python
def _clean_page_unique_slug_required(self, slug): """See if this slug exists already""" if hasattr(self, 'instance') and self.instance.id: if Content.objects.exclude(page=self.instance).filter( body=slug, type="slug").count(): raise forms.ValidationError(...
[ "def", "_clean_page_unique_slug_required", "(", "self", ",", "slug", ")", ":", "if", "hasattr", "(", "self", ",", "'instance'", ")", "and", "self", ".", "instance", ".", "id", ":", "if", "Content", ".", "objects", ".", "exclude", "(", "page", "=", "self"...
See if this slug exists already
[ "See", "if", "this", "slug", "exists", "already" ]
863f3c6098606f663994930cd8e7723ad0c07caf
https://github.com/ArabellaTech/django-basic-cms/blob/863f3c6098606f663994930cd8e7723ad0c07caf/basic_cms/admin/forms.py#L53-L62
train
klahnakoski/mo-logs
mo_logs/exceptions.py
extract_stack
def extract_stack(start=0): """ SNAGGED FROM traceback.py Altered to return Data Extract the raw traceback from the current stack frame. Each item in the returned list is a quadruple (filename, line number, function name, text), and the entries are in order from newest to oldest """ ...
python
def extract_stack(start=0): """ SNAGGED FROM traceback.py Altered to return Data Extract the raw traceback from the current stack frame. Each item in the returned list is a quadruple (filename, line number, function name, text), and the entries are in order from newest to oldest """ ...
[ "def", "extract_stack", "(", "start", "=", "0", ")", ":", "try", ":", "raise", "ZeroDivisionError", "except", "ZeroDivisionError", ":", "trace", "=", "sys", ".", "exc_info", "(", ")", "[", "2", "]", "f", "=", "trace", ".", "tb_frame", ".", "f_back", "f...
SNAGGED FROM traceback.py Altered to return Data Extract the raw traceback from the current stack frame. Each item in the returned list is a quadruple (filename, line number, function name, text), and the entries are in order from newest to oldest
[ "SNAGGED", "FROM", "traceback", ".", "py", "Altered", "to", "return", "Data" ]
0971277ac9caf28a755b766b70621916957d4fea
https://github.com/klahnakoski/mo-logs/blob/0971277ac9caf28a755b766b70621916957d4fea/mo_logs/exceptions.py#L155-L183
train
klahnakoski/mo-logs
mo_logs/exceptions.py
_extract_traceback
def _extract_traceback(start): """ SNAGGED FROM traceback.py RETURN list OF dicts DESCRIBING THE STACK TRACE """ tb = sys.exc_info()[2] for i in range(start): tb = tb.tb_next return _parse_traceback(tb)
python
def _extract_traceback(start): """ SNAGGED FROM traceback.py RETURN list OF dicts DESCRIBING THE STACK TRACE """ tb = sys.exc_info()[2] for i in range(start): tb = tb.tb_next return _parse_traceback(tb)
[ "def", "_extract_traceback", "(", "start", ")", ":", "tb", "=", "sys", ".", "exc_info", "(", ")", "[", "2", "]", "for", "i", "in", "range", "(", "start", ")", ":", "tb", "=", "tb", ".", "tb_next", "return", "_parse_traceback", "(", "tb", ")" ]
SNAGGED FROM traceback.py RETURN list OF dicts DESCRIBING THE STACK TRACE
[ "SNAGGED", "FROM", "traceback", ".", "py" ]
0971277ac9caf28a755b766b70621916957d4fea
https://github.com/klahnakoski/mo-logs/blob/0971277ac9caf28a755b766b70621916957d4fea/mo_logs/exceptions.py#L186-L195
train
klahnakoski/mo-logs
mo_logs/exceptions.py
Except.wrap
def wrap(cls, e, stack_depth=0): """ ENSURE THE STACKTRACE AND CAUSAL CHAIN IS CAPTURED, PLUS ADD FEATURES OF Except :param e: AN EXCEPTION OF ANY TYPE :param stack_depth: HOW MANY CALLS TO TAKE OFF THE TOP OF THE STACK TRACE :return: A Except OBJECT OF THE SAME """ ...
python
def wrap(cls, e, stack_depth=0): """ ENSURE THE STACKTRACE AND CAUSAL CHAIN IS CAPTURED, PLUS ADD FEATURES OF Except :param e: AN EXCEPTION OF ANY TYPE :param stack_depth: HOW MANY CALLS TO TAKE OFF THE TOP OF THE STACK TRACE :return: A Except OBJECT OF THE SAME """ ...
[ "def", "wrap", "(", "cls", ",", "e", ",", "stack_depth", "=", "0", ")", ":", "if", "e", "==", "None", ":", "return", "Null", "elif", "isinstance", "(", "e", ",", "(", "list", ",", "Except", ")", ")", ":", "return", "e", "elif", "is_data", "(", ...
ENSURE THE STACKTRACE AND CAUSAL CHAIN IS CAPTURED, PLUS ADD FEATURES OF Except :param e: AN EXCEPTION OF ANY TYPE :param stack_depth: HOW MANY CALLS TO TAKE OFF THE TOP OF THE STACK TRACE :return: A Except OBJECT OF THE SAME
[ "ENSURE", "THE", "STACKTRACE", "AND", "CAUSAL", "CHAIN", "IS", "CAPTURED", "PLUS", "ADD", "FEATURES", "OF", "Except" ]
0971277ac9caf28a755b766b70621916957d4fea
https://github.com/klahnakoski/mo-logs/blob/0971277ac9caf28a755b766b70621916957d4fea/mo_logs/exceptions.py#L74-L104
train
grahame/dividebatur
dividebatur/counter.py
SenateCounter.determine_elected_candidates_in_order
def determine_elected_candidates_in_order(self, candidate_votes): """ determine all candidates with at least a quota of votes in `candidate_votes'. returns results in order of decreasing vote count. Any ties are resolved within this method. """ eligible_by_vote = defaultdict(list...
python
def determine_elected_candidates_in_order(self, candidate_votes): """ determine all candidates with at least a quota of votes in `candidate_votes'. returns results in order of decreasing vote count. Any ties are resolved within this method. """ eligible_by_vote = defaultdict(list...
[ "def", "determine_elected_candidates_in_order", "(", "self", ",", "candidate_votes", ")", ":", "eligible_by_vote", "=", "defaultdict", "(", "list", ")", "for", "candidate_id", ",", "votes", "in", "candidate_votes", ".", "candidate_votes_iter", "(", ")", ":", "if", ...
determine all candidates with at least a quota of votes in `candidate_votes'. returns results in order of decreasing vote count. Any ties are resolved within this method.
[ "determine", "all", "candidates", "with", "at", "least", "a", "quota", "of", "votes", "in", "candidate_votes", ".", "returns", "results", "in", "order", "of", "decreasing", "vote", "count", ".", "Any", "ties", "are", "resolved", "within", "this", "method", "...
adc1f6e8013943471f1679e3c94f9448a1e4a472
https://github.com/grahame/dividebatur/blob/adc1f6e8013943471f1679e3c94f9448a1e4a472/dividebatur/counter.py#L264-L299
train
grahame/dividebatur
dividebatur/counter.py
SenateCounter.get_initial_totals
def get_initial_totals(self): "determine the initial total for each candidate. only call this at the start of round 1" candidate_votes = {} # initialise to zero for every individual candidate for candidate_id in self.candidate_ids: candidate_votes[candidate_id] = 0 fo...
python
def get_initial_totals(self): "determine the initial total for each candidate. only call this at the start of round 1" candidate_votes = {} # initialise to zero for every individual candidate for candidate_id in self.candidate_ids: candidate_votes[candidate_id] = 0 fo...
[ "def", "get_initial_totals", "(", "self", ")", ":", "\"determine the initial total for each candidate. only call this at the start of round 1\"", "candidate_votes", "=", "{", "}", "for", "candidate_id", "in", "self", ".", "candidate_ids", ":", "candidate_votes", "[", "candida...
determine the initial total for each candidate. only call this at the start of round 1
[ "determine", "the", "initial", "total", "for", "each", "candidate", ".", "only", "call", "this", "at", "the", "start", "of", "round", "1" ]
adc1f6e8013943471f1679e3c94f9448a1e4a472
https://github.com/grahame/dividebatur/blob/adc1f6e8013943471f1679e3c94f9448a1e4a472/dividebatur/counter.py#L301-L311
train
grahame/dividebatur
dividebatur/counter.py
SenateCounter.bundle_to_next_candidate
def bundle_to_next_candidate(self, bundle): """ returns the next candidate_it of the next preference expressed in the ticket for this bundle, and the next ticket_state after preferences are moved along if the vote exhausts, candidate_id will be None """ ticket_state = bun...
python
def bundle_to_next_candidate(self, bundle): """ returns the next candidate_it of the next preference expressed in the ticket for this bundle, and the next ticket_state after preferences are moved along if the vote exhausts, candidate_id will be None """ ticket_state = bun...
[ "def", "bundle_to_next_candidate", "(", "self", ",", "bundle", ")", ":", "ticket_state", "=", "bundle", ".", "ticket_state", "while", "True", ":", "ticket_state", "=", "TicketState", "(", "ticket_state", ".", "preferences", ",", "ticket_state", ".", "up_to", "+"...
returns the next candidate_it of the next preference expressed in the ticket for this bundle, and the next ticket_state after preferences are moved along if the vote exhausts, candidate_id will be None
[ "returns", "the", "next", "candidate_it", "of", "the", "next", "preference", "expressed", "in", "the", "ticket", "for", "this", "bundle", "and", "the", "next", "ticket_state", "after", "preferences", "are", "moved", "along", "if", "the", "vote", "exhausts", "c...
adc1f6e8013943471f1679e3c94f9448a1e4a472
https://github.com/grahame/dividebatur/blob/adc1f6e8013943471f1679e3c94f9448a1e4a472/dividebatur/counter.py#L313-L327
train
grahame/dividebatur
dividebatur/counter.py
SenateCounter.elect
def elect(self, candidate_aggregates, candidate_id): """ Elect a candidate, updating internal state to track this. Calculate the paper count to be transferred on to other candidates, and if required schedule a distribution fo papers. """ # somewhat paranoid cross-check, ...
python
def elect(self, candidate_aggregates, candidate_id): """ Elect a candidate, updating internal state to track this. Calculate the paper count to be transferred on to other candidates, and if required schedule a distribution fo papers. """ # somewhat paranoid cross-check, ...
[ "def", "elect", "(", "self", ",", "candidate_aggregates", ",", "candidate_id", ")", ":", "assert", "(", "candidate_id", "not", "in", "self", ".", "candidates_elected", ")", "elected_no", "=", "len", "(", "self", ".", "candidates_elected", ")", "+", "1", "sel...
Elect a candidate, updating internal state to track this. Calculate the paper count to be transferred on to other candidates, and if required schedule a distribution fo papers.
[ "Elect", "a", "candidate", "updating", "internal", "state", "to", "track", "this", ".", "Calculate", "the", "paper", "count", "to", "be", "transferred", "on", "to", "other", "candidates", "and", "if", "required", "schedule", "a", "distribution", "fo", "papers"...
adc1f6e8013943471f1679e3c94f9448a1e4a472
https://github.com/grahame/dividebatur/blob/adc1f6e8013943471f1679e3c94f9448a1e4a472/dividebatur/counter.py#L363-L392
train
grahame/dividebatur
dividebatur/counter.py
SenateCounter.find_tie_breaker
def find_tie_breaker(self, candidate_ids): """ finds a round in the count history in which the candidate_ids each had different vote counts if no such round exists, returns None """ for candidate_aggregates in reversed(self.round_candidate_aggregates): candidates_on_v...
python
def find_tie_breaker(self, candidate_ids): """ finds a round in the count history in which the candidate_ids each had different vote counts if no such round exists, returns None """ for candidate_aggregates in reversed(self.round_candidate_aggregates): candidates_on_v...
[ "def", "find_tie_breaker", "(", "self", ",", "candidate_ids", ")", ":", "for", "candidate_aggregates", "in", "reversed", "(", "self", ".", "round_candidate_aggregates", ")", ":", "candidates_on_vote", "=", "defaultdict", "(", "int", ")", "for", "candidate_id", "in...
finds a round in the count history in which the candidate_ids each had different vote counts if no such round exists, returns None
[ "finds", "a", "round", "in", "the", "count", "history", "in", "which", "the", "candidate_ids", "each", "had", "different", "vote", "counts", "if", "no", "such", "round", "exists", "returns", "None" ]
adc1f6e8013943471f1679e3c94f9448a1e4a472
https://github.com/grahame/dividebatur/blob/adc1f6e8013943471f1679e3c94f9448a1e4a472/dividebatur/counter.py#L480-L491
train
grahame/dividebatur
dividebatur/counter.py
SenateCounter.get_candidate_notional_votes
def get_candidate_notional_votes(self, candidate_aggregates, adjustment): "aggregate of vote received by each candidate, and the votes received by any candidate lower in the poll" continuing = self.get_continuing_candidates(candidate_aggregates) candidates_notional = {} by_votes = self.g...
python
def get_candidate_notional_votes(self, candidate_aggregates, adjustment): "aggregate of vote received by each candidate, and the votes received by any candidate lower in the poll" continuing = self.get_continuing_candidates(candidate_aggregates) candidates_notional = {} by_votes = self.g...
[ "def", "get_candidate_notional_votes", "(", "self", ",", "candidate_aggregates", ",", "adjustment", ")", ":", "\"aggregate of vote received by each candidate, and the votes received by any candidate lower in the poll\"", "continuing", "=", "self", ".", "get_continuing_candidates", "(...
aggregate of vote received by each candidate, and the votes received by any candidate lower in the poll
[ "aggregate", "of", "vote", "received", "by", "each", "candidate", "and", "the", "votes", "received", "by", "any", "candidate", "lower", "in", "the", "poll" ]
adc1f6e8013943471f1679e3c94f9448a1e4a472
https://github.com/grahame/dividebatur/blob/adc1f6e8013943471f1679e3c94f9448a1e4a472/dividebatur/counter.py#L544-L554
train
ArabellaTech/django-basic-cms
basic_cms/permissions.py
PagePermission.check
def check(self, action, page=None, lang=None, method=None): """Return ``True`` if the current user has permission on the page.""" if self.user.is_superuser: return True if action == 'change': return self.has_change_permission(page, lang, method) if action == 'de...
python
def check(self, action, page=None, lang=None, method=None): """Return ``True`` if the current user has permission on the page.""" if self.user.is_superuser: return True if action == 'change': return self.has_change_permission(page, lang, method) if action == 'de...
[ "def", "check", "(", "self", ",", "action", ",", "page", "=", "None", ",", "lang", "=", "None", ",", "method", "=", "None", ")", ":", "if", "self", ".", "user", ".", "is_superuser", ":", "return", "True", "if", "action", "==", "'change'", ":", "ret...
Return ``True`` if the current user has permission on the page.
[ "Return", "True", "if", "the", "current", "user", "has", "permission", "on", "the", "page", "." ]
863f3c6098606f663994930cd8e7723ad0c07caf
https://github.com/ArabellaTech/django-basic-cms/blob/863f3c6098606f663994930cd8e7723ad0c07caf/basic_cms/permissions.py#L20-L47
train
ArabellaTech/django-basic-cms
basic_cms/permissions.py
PagePermission.has_change_permission
def has_change_permission(self, page, lang, method=None): """Return ``True`` if the current user has permission to change the page.""" # the user has always the right to look at a page content # if he doesn't try to modify it. if method != 'POST': return True ...
python
def has_change_permission(self, page, lang, method=None): """Return ``True`` if the current user has permission to change the page.""" # the user has always the right to look at a page content # if he doesn't try to modify it. if method != 'POST': return True ...
[ "def", "has_change_permission", "(", "self", ",", "page", ",", "lang", ",", "method", "=", "None", ")", ":", "if", "method", "!=", "'POST'", ":", "return", "True", "if", "self", ".", "change_page", "(", ")", ":", "return", "True", "if", "lang", ":", ...
Return ``True`` if the current user has permission to change the page.
[ "Return", "True", "if", "the", "current", "user", "has", "permission", "to", "change", "the", "page", "." ]
863f3c6098606f663994930cd8e7723ad0c07caf
https://github.com/ArabellaTech/django-basic-cms/blob/863f3c6098606f663994930cd8e7723ad0c07caf/basic_cms/permissions.py#L49-L82
train
hughsie/python-appstream
appstream/utils.py
_join_lines
def _join_lines(txt): """ Remove whitespace from XML input """ txt = txt or '' # Handle NoneType input values val = '' lines = txt.split('\n') for line in lines: stripped = line.strip() if len(stripped) == 0: continue val += stripped + ' ' return val.strip()
python
def _join_lines(txt): """ Remove whitespace from XML input """ txt = txt or '' # Handle NoneType input values val = '' lines = txt.split('\n') for line in lines: stripped = line.strip() if len(stripped) == 0: continue val += stripped + ' ' return val.strip()
[ "def", "_join_lines", "(", "txt", ")", ":", "txt", "=", "txt", "or", "''", "val", "=", "''", "lines", "=", "txt", ".", "split", "(", "'\\n'", ")", "for", "line", "in", "lines", ":", "stripped", "=", "line", ".", "strip", "(", ")", "if", "len", ...
Remove whitespace from XML input
[ "Remove", "whitespace", "from", "XML", "input" ]
f2606380278c5728ee7f8e7d19914c54fca05e76
https://github.com/hughsie/python-appstream/blob/f2606380278c5728ee7f8e7d19914c54fca05e76/appstream/utils.py#L32-L42
train
hughsie/python-appstream
appstream/utils.py
_parse_desc
def _parse_desc(node): """ A quick'n'dirty description parser """ desc = '' if len(node) == 0: return '<p>' + node.text + '</p>' for n in node: if n.tag == 'p': desc += '<p>' + _join_lines(n.text) + '</p>' elif n.tag == 'ol' or n.tag == 'ul': desc += '<ul>...
python
def _parse_desc(node): """ A quick'n'dirty description parser """ desc = '' if len(node) == 0: return '<p>' + node.text + '</p>' for n in node: if n.tag == 'p': desc += '<p>' + _join_lines(n.text) + '</p>' elif n.tag == 'ol' or n.tag == 'ul': desc += '<ul>...
[ "def", "_parse_desc", "(", "node", ")", ":", "desc", "=", "''", "if", "len", "(", "node", ")", "==", "0", ":", "return", "'<p>'", "+", "node", ".", "text", "+", "'</p>'", "for", "n", "in", "node", ":", "if", "n", ".", "tag", "==", "'p'", ":", ...
A quick'n'dirty description parser
[ "A", "quick", "n", "dirty", "description", "parser" ]
f2606380278c5728ee7f8e7d19914c54fca05e76
https://github.com/hughsie/python-appstream/blob/f2606380278c5728ee7f8e7d19914c54fca05e76/appstream/utils.py#L44-L62
train
hughsie/python-appstream
appstream/utils.py
validate_description
def validate_description(xml_data): """ Validate the description for validity """ try: root = ET.fromstring('<document>' + xml_data + '</document>') except StdlibParseError as e: raise ParseError(str(e)) return _parse_desc(root)
python
def validate_description(xml_data): """ Validate the description for validity """ try: root = ET.fromstring('<document>' + xml_data + '</document>') except StdlibParseError as e: raise ParseError(str(e)) return _parse_desc(root)
[ "def", "validate_description", "(", "xml_data", ")", ":", "try", ":", "root", "=", "ET", ".", "fromstring", "(", "'<document>'", "+", "xml_data", "+", "'</document>'", ")", "except", "StdlibParseError", "as", "e", ":", "raise", "ParseError", "(", "str", "(",...
Validate the description for validity
[ "Validate", "the", "description", "for", "validity" ]
f2606380278c5728ee7f8e7d19914c54fca05e76
https://github.com/hughsie/python-appstream/blob/f2606380278c5728ee7f8e7d19914c54fca05e76/appstream/utils.py#L64-L70
train
hughsie/python-appstream
appstream/utils.py
import_description
def import_description(text): """ Convert ASCII text to AppStream markup format """ xml = '' is_in_ul = False for line in text.split('\n'): # don't include whitespace line = line.strip() if len(line) == 0: continue # detected as a list element? line_...
python
def import_description(text): """ Convert ASCII text to AppStream markup format """ xml = '' is_in_ul = False for line in text.split('\n'): # don't include whitespace line = line.strip() if len(line) == 0: continue # detected as a list element? line_...
[ "def", "import_description", "(", "text", ")", ":", "xml", "=", "''", "is_in_ul", "=", "False", "for", "line", "in", "text", ".", "split", "(", "'\\n'", ")", ":", "line", "=", "line", ".", "strip", "(", ")", "if", "len", "(", "line", ")", "==", "...
Convert ASCII text to AppStream markup format
[ "Convert", "ASCII", "text", "to", "AppStream", "markup", "format" ]
f2606380278c5728ee7f8e7d19914c54fca05e76
https://github.com/hughsie/python-appstream/blob/f2606380278c5728ee7f8e7d19914c54fca05e76/appstream/utils.py#L84-L117
train
sirfoga/pyhal
hal/internet/selenium/forms.py
SeleniumFormFiller.fill_form_field
def fill_form_field(self, field_name, field_value): """Fills given field with given value :param field_name: name of field to fill :param field_value: value with which to fill field """ self.browser.execute_script( "document.getElementsByName(\"" + str( ...
python
def fill_form_field(self, field_name, field_value): """Fills given field with given value :param field_name: name of field to fill :param field_value: value with which to fill field """ self.browser.execute_script( "document.getElementsByName(\"" + str( ...
[ "def", "fill_form_field", "(", "self", ",", "field_name", ",", "field_value", ")", ":", "self", ".", "browser", ".", "execute_script", "(", "\"document.getElementsByName(\\\"\"", "+", "str", "(", "field_name", ")", "+", "\"\\\")[0].value = \\\"\"", "+", "str", "("...
Fills given field with given value :param field_name: name of field to fill :param field_value: value with which to fill field
[ "Fills", "given", "field", "with", "given", "value" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/internet/selenium/forms.py#L15-L23
train
sirfoga/pyhal
hal/internet/selenium/forms.py
SeleniumFormFiller.fill_login_form
def fill_login_form(self, username, username_field, user_password, user_password_field): """Fills form with login info :param username: user login :param username_field: name of field to fill with username :param user_password: login password :param user_...
python
def fill_login_form(self, username, username_field, user_password, user_password_field): """Fills form with login info :param username: user login :param username_field: name of field to fill with username :param user_password: login password :param user_...
[ "def", "fill_login_form", "(", "self", ",", "username", ",", "username_field", ",", "user_password", ",", "user_password_field", ")", ":", "self", ".", "fill_form_field", "(", "username_field", ",", "username", ")", "self", ".", "fill_form_field", "(", "user_passw...
Fills form with login info :param username: user login :param username_field: name of field to fill with username :param user_password: login password :param user_password_field: name of field to fill with user password
[ "Fills", "form", "with", "login", "info" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/internet/selenium/forms.py#L25-L35
train
JukeboxPipeline/jukeboxmaya
src/jukeboxmaya/commands.py
open_scene
def open_scene(f, kwargs=None): """Opens the given JB_File :param f: the file to open :type f: :class:`jukeboxcore.filesys.JB_File` :param kwargs: keyword arguments for the command maya.cmds file. defaultflags that are always used: :open: ``True`` ...
python
def open_scene(f, kwargs=None): """Opens the given JB_File :param f: the file to open :type f: :class:`jukeboxcore.filesys.JB_File` :param kwargs: keyword arguments for the command maya.cmds file. defaultflags that are always used: :open: ``True`` ...
[ "def", "open_scene", "(", "f", ",", "kwargs", "=", "None", ")", ":", "defaultkwargs", "=", "{", "'open'", ":", "True", "}", "if", "kwargs", "is", "None", ":", "kwargs", "=", "{", "}", "kwargs", ".", "update", "(", "defaultkwargs", ")", "fp", "=", "...
Opens the given JB_File :param f: the file to open :type f: :class:`jukeboxcore.filesys.JB_File` :param kwargs: keyword arguments for the command maya.cmds file. defaultflags that are always used: :open: ``True`` e.g. to force the open command us...
[ "Opens", "the", "given", "JB_File" ]
c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c
https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/commands.py#L11-L34
train
JukeboxPipeline/jukeboxmaya
src/jukeboxmaya/commands.py
import_all_references
def import_all_references(arg, kwargs=None): """Import all references in the currently open scene :param arg: this argument is ignored. But thisway you can use this function in an ActionUnit more easily. :param kwargs: keyword arguments for the command maya.cmds file. defaultflags that a...
python
def import_all_references(arg, kwargs=None): """Import all references in the currently open scene :param arg: this argument is ignored. But thisway you can use this function in an ActionUnit more easily. :param kwargs: keyword arguments for the command maya.cmds file. defaultflags that a...
[ "def", "import_all_references", "(", "arg", ",", "kwargs", "=", "None", ")", ":", "defaultkwargs", "=", "{", "'importReference'", ":", "True", "}", "if", "kwargs", "is", "None", ":", "kwargs", "=", "{", "}", "kwargs", ".", "update", "(", "defaultkwargs", ...
Import all references in the currently open scene :param arg: this argument is ignored. But thisway you can use this function in an ActionUnit more easily. :param kwargs: keyword arguments for the command maya.cmds file. defaultflags that are always used: :importReferen...
[ "Import", "all", "references", "in", "the", "currently", "open", "scene" ]
c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c
https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/commands.py#L70-L98
train
JukeboxPipeline/jukeboxmaya
src/jukeboxmaya/commands.py
update_scenenode
def update_scenenode(f): """Set the id of the current scene node to the id for the given file :param f: the file to save the current scene to :type f: :class:`jukeboxcore.filesys.JB_File` :returns: None :rtype: None :raises: None """ n = get_current_scene_node() if not n: ms...
python
def update_scenenode(f): """Set the id of the current scene node to the id for the given file :param f: the file to save the current scene to :type f: :class:`jukeboxcore.filesys.JB_File` :returns: None :rtype: None :raises: None """ n = get_current_scene_node() if not n: ms...
[ "def", "update_scenenode", "(", "f", ")", ":", "n", "=", "get_current_scene_node", "(", ")", "if", "not", "n", ":", "msg", "=", "\"Could not find a scene node.\"", "return", "ActionStatus", "(", "ActionStatus", ".", "FAILURE", ",", "msg", ")", "tfi", "=", "f...
Set the id of the current scene node to the id for the given file :param f: the file to save the current scene to :type f: :class:`jukeboxcore.filesys.JB_File` :returns: None :rtype: None :raises: None
[ "Set", "the", "id", "of", "the", "current", "scene", "node", "to", "the", "id", "for", "the", "given", "file" ]
c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c
https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/commands.py#L101-L127
train
TorkamaniLab/metapipe
metapipe/models/job.py
call
def call(args, stdout=PIPE, stderr=PIPE): """ Calls the given arguments in a seperate process and returns the contents of standard out. """ p = Popen(args, stdout=stdout, stderr=stderr) out, err = p.communicate() try: return out.decode(sys.stdout.encoding), err.decode(sys.stdout.encodin...
python
def call(args, stdout=PIPE, stderr=PIPE): """ Calls the given arguments in a seperate process and returns the contents of standard out. """ p = Popen(args, stdout=stdout, stderr=stderr) out, err = p.communicate() try: return out.decode(sys.stdout.encoding), err.decode(sys.stdout.encodin...
[ "def", "call", "(", "args", ",", "stdout", "=", "PIPE", ",", "stderr", "=", "PIPE", ")", ":", "p", "=", "Popen", "(", "args", ",", "stdout", "=", "stdout", ",", "stderr", "=", "stderr", ")", "out", ",", "err", "=", "p", ".", "communicate", "(", ...
Calls the given arguments in a seperate process and returns the contents of standard out.
[ "Calls", "the", "given", "arguments", "in", "a", "seperate", "process", "and", "returns", "the", "contents", "of", "standard", "out", "." ]
15592e5b0c217afb00ac03503f8d0d7453d4baf4
https://github.com/TorkamaniLab/metapipe/blob/15592e5b0c217afb00ac03503f8d0d7453d4baf4/metapipe/models/job.py#L11-L21
train
TorkamaniLab/metapipe
metapipe/models/job.py
Job.make
def make(self): """ Evaluate the command, and write it to a file. """ eval = self.command.eval() with open(self.filename, 'w') as f: f.write(eval)
python
def make(self): """ Evaluate the command, and write it to a file. """ eval = self.command.eval() with open(self.filename, 'w') as f: f.write(eval)
[ "def", "make", "(", "self", ")", ":", "eval", "=", "self", ".", "command", ".", "eval", "(", ")", "with", "open", "(", "self", ".", "filename", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "eval", ")" ]
Evaluate the command, and write it to a file.
[ "Evaluate", "the", "command", "and", "write", "it", "to", "a", "file", "." ]
15592e5b0c217afb00ac03503f8d0d7453d4baf4
https://github.com/TorkamaniLab/metapipe/blob/15592e5b0c217afb00ac03503f8d0d7453d4baf4/metapipe/models/job.py#L49-L53
train
wylee/runcommands
runcommands/collection.py
Collection.set_default_args
def set_default_args(self, default_args): """Set default args for commands in collection. Default args are used when the corresponding args aren't passed on the command line or in a direct call. """ for name, args in default_args.items(): command = self[name] ...
python
def set_default_args(self, default_args): """Set default args for commands in collection. Default args are used when the corresponding args aren't passed on the command line or in a direct call. """ for name, args in default_args.items(): command = self[name] ...
[ "def", "set_default_args", "(", "self", ",", "default_args", ")", ":", "for", "name", ",", "args", "in", "default_args", ".", "items", "(", ")", ":", "command", "=", "self", "[", "name", "]", "command", ".", "default_args", "=", "default_args", ".", "get...
Set default args for commands in collection. Default args are used when the corresponding args aren't passed on the command line or in a direct call.
[ "Set", "default", "args", "for", "commands", "in", "collection", "." ]
b1d7c262885b9ced7ab89b63562f5464ca9970fe
https://github.com/wylee/runcommands/blob/b1d7c262885b9ced7ab89b63562f5464ca9970fe/runcommands/collection.py#L60-L69
train
ClearcodeHQ/matchbox
src/matchbox/box.py
MatchBox.extract_traits
def extract_traits(self, entity): """ Extract data required to classify entity. :param object entity: :return: namedtuple consisting of characteristic traits and match flag :rtype: matchbox.box.Trait """ traits = getattr(entity, self._characteristic) if t...
python
def extract_traits(self, entity): """ Extract data required to classify entity. :param object entity: :return: namedtuple consisting of characteristic traits and match flag :rtype: matchbox.box.Trait """ traits = getattr(entity, self._characteristic) if t...
[ "def", "extract_traits", "(", "self", ",", "entity", ")", ":", "traits", "=", "getattr", "(", "entity", ",", "self", ".", "_characteristic", ")", "if", "traits", "is", "not", "None", "and", "isinstance", "(", "traits", ",", "Hashable", ")", ":", "traits"...
Extract data required to classify entity. :param object entity: :return: namedtuple consisting of characteristic traits and match flag :rtype: matchbox.box.Trait
[ "Extract", "data", "required", "to", "classify", "entity", "." ]
22f5bd163ad22ceacb0fcd5d4ddae9069d1a94f4
https://github.com/ClearcodeHQ/matchbox/blob/22f5bd163ad22ceacb0fcd5d4ddae9069d1a94f4/src/matchbox/box.py#L62-L76
train
ClearcodeHQ/matchbox
src/matchbox/box.py
MatchBox.add
def add(self, entity): """ Add entity to index. :param object entity: single object to add to box's index """ characteristic = self.extract_traits(entity) if not characteristic.traits: return if characteristic.is_matching: self.add_match(...
python
def add(self, entity): """ Add entity to index. :param object entity: single object to add to box's index """ characteristic = self.extract_traits(entity) if not characteristic.traits: return if characteristic.is_matching: self.add_match(...
[ "def", "add", "(", "self", ",", "entity", ")", ":", "characteristic", "=", "self", ".", "extract_traits", "(", "entity", ")", "if", "not", "characteristic", ".", "traits", ":", "return", "if", "characteristic", ".", "is_matching", ":", "self", ".", "add_ma...
Add entity to index. :param object entity: single object to add to box's index
[ "Add", "entity", "to", "index", "." ]
22f5bd163ad22ceacb0fcd5d4ddae9069d1a94f4
https://github.com/ClearcodeHQ/matchbox/blob/22f5bd163ad22ceacb0fcd5d4ddae9069d1a94f4/src/matchbox/box.py#L78-L91
train
ClearcodeHQ/matchbox
src/matchbox/box.py
MatchBox.remove
def remove(self, entity): """ Remove entity from the MatchBox. :param object entity: """ empty_traits = set() self.mismatch_unknown.discard(entity) for trait, entities in self.index.items(): entities.discard(entity) if not entities: ...
python
def remove(self, entity): """ Remove entity from the MatchBox. :param object entity: """ empty_traits = set() self.mismatch_unknown.discard(entity) for trait, entities in self.index.items(): entities.discard(entity) if not entities: ...
[ "def", "remove", "(", "self", ",", "entity", ")", ":", "empty_traits", "=", "set", "(", ")", "self", ".", "mismatch_unknown", ".", "discard", "(", "entity", ")", "for", "trait", ",", "entities", "in", "self", ".", "index", ".", "items", "(", ")", ":"...
Remove entity from the MatchBox. :param object entity:
[ "Remove", "entity", "from", "the", "MatchBox", "." ]
22f5bd163ad22ceacb0fcd5d4ddae9069d1a94f4
https://github.com/ClearcodeHQ/matchbox/blob/22f5bd163ad22ceacb0fcd5d4ddae9069d1a94f4/src/matchbox/box.py#L93-L107
train
sholsapp/py509
py509/client.py
get_host_certificate
def get_host_certificate(host, port=443): """Get a host's certificate. :param str host: The hostname from which to fetch the certificate. :param int port: The port from which to fetch the certificate, if different than ``443``. :return: The host's X.509 certificate. :rtype: :class:`OpenSSL.crypto.X509` ...
python
def get_host_certificate(host, port=443): """Get a host's certificate. :param str host: The hostname from which to fetch the certificate. :param int port: The port from which to fetch the certificate, if different than ``443``. :return: The host's X.509 certificate. :rtype: :class:`OpenSSL.crypto.X509` ...
[ "def", "get_host_certificate", "(", "host", ",", "port", "=", "443", ")", ":", "ip_addr", "=", "socket", ".", "gethostbyname", "(", "host", ")", "sock", "=", "socket", ".", "socket", "(", ")", "context", "=", "SSL", ".", "Context", "(", "SSL", ".", "...
Get a host's certificate. :param str host: The hostname from which to fetch the certificate. :param int port: The port from which to fetch the certificate, if different than ``443``. :return: The host's X.509 certificate. :rtype: :class:`OpenSSL.crypto.X509`
[ "Get", "a", "host", "s", "certificate", "." ]
83bd6786a8ec1543b66c42ea5523e611c3e8dc5a
https://github.com/sholsapp/py509/blob/83bd6786a8ec1543b66c42ea5523e611c3e8dc5a/py509/client.py#L11-L29
train
sirfoga/pyhal
hal/data/dicts.py
get_inner_keys
def get_inner_keys(dictionary): """Gets 2nd-level dictionary keys :param dictionary: dict :return: inner keys """ keys = [] for key in dictionary.keys(): inner_keys = dictionary[key].keys() keys += [ key + " " + inner_key # concatenate for inner_key in...
python
def get_inner_keys(dictionary): """Gets 2nd-level dictionary keys :param dictionary: dict :return: inner keys """ keys = [] for key in dictionary.keys(): inner_keys = dictionary[key].keys() keys += [ key + " " + inner_key # concatenate for inner_key in...
[ "def", "get_inner_keys", "(", "dictionary", ")", ":", "keys", "=", "[", "]", "for", "key", "in", "dictionary", ".", "keys", "(", ")", ":", "inner_keys", "=", "dictionary", "[", "key", "]", ".", "keys", "(", ")", "keys", "+=", "[", "key", "+", "\" \...
Gets 2nd-level dictionary keys :param dictionary: dict :return: inner keys
[ "Gets", "2nd", "-", "level", "dictionary", "keys" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/data/dicts.py#L26-L42
train
sirfoga/pyhal
hal/data/dicts.py
get_inner_data
def get_inner_data(dictionary): """Gets 2nd-level data into 1st-level dictionary :param dictionary: dict :return: with 2nd-level data """ out = {} for key in dictionary.keys(): inner_keys = dictionary[key].keys() for inner_key in inner_keys: new_key = key + " " + i...
python
def get_inner_data(dictionary): """Gets 2nd-level data into 1st-level dictionary :param dictionary: dict :return: with 2nd-level data """ out = {} for key in dictionary.keys(): inner_keys = dictionary[key].keys() for inner_key in inner_keys: new_key = key + " " + i...
[ "def", "get_inner_data", "(", "dictionary", ")", ":", "out", "=", "{", "}", "for", "key", "in", "dictionary", ".", "keys", "(", ")", ":", "inner_keys", "=", "dictionary", "[", "key", "]", ".", "keys", "(", ")", "for", "inner_key", "in", "inner_keys", ...
Gets 2nd-level data into 1st-level dictionary :param dictionary: dict :return: with 2nd-level data
[ "Gets", "2nd", "-", "level", "data", "into", "1st", "-", "level", "dictionary" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/data/dicts.py#L45-L60
train
yamcs/yamcs-python
yamcs-cli/yamcs/cli/dbshell.py
DbShell.do_use
def do_use(self, args): """Use another instance, provided as argument.""" self.instance = args self.prompt = self.instance + '> ' archive = self._client.get_archive(self.instance) self.streams = [s.name for s in archive.list_streams()] self.tables = [t.name for t in arch...
python
def do_use(self, args): """Use another instance, provided as argument.""" self.instance = args self.prompt = self.instance + '> ' archive = self._client.get_archive(self.instance) self.streams = [s.name for s in archive.list_streams()] self.tables = [t.name for t in arch...
[ "def", "do_use", "(", "self", ",", "args", ")", ":", "self", ".", "instance", "=", "args", "self", ".", "prompt", "=", "self", ".", "instance", "+", "'> '", "archive", "=", "self", ".", "_client", ".", "get_archive", "(", "self", ".", "instance", ")"...
Use another instance, provided as argument.
[ "Use", "another", "instance", "provided", "as", "argument", "." ]
1082fee8a299010cc44416bbb7518fac0ef08b48
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-cli/yamcs/cli/dbshell.py#L72-L79
train
portfors-lab/sparkle
sparkle/gui/dialogs/saving_dlg.py
SavingDialog.update_label
def update_label(self): """Updates the text on the accept button, to reflect if the name of the data file will result in opening an existing file, or creating a new one""" current_file = str(self.selectedFiles()[0]) if not '.' in current_file.split(os.path.sep)[-1]: ...
python
def update_label(self): """Updates the text on the accept button, to reflect if the name of the data file will result in opening an existing file, or creating a new one""" current_file = str(self.selectedFiles()[0]) if not '.' in current_file.split(os.path.sep)[-1]: ...
[ "def", "update_label", "(", "self", ")", ":", "current_file", "=", "str", "(", "self", ".", "selectedFiles", "(", ")", "[", "0", "]", ")", "if", "not", "'.'", "in", "current_file", ".", "split", "(", "os", ".", "path", ".", "sep", ")", "[", "-", ...
Updates the text on the accept button, to reflect if the name of the data file will result in opening an existing file, or creating a new one
[ "Updates", "the", "text", "on", "the", "accept", "button", "to", "reflect", "if", "the", "name", "of", "the", "data", "file", "will", "result", "in", "opening", "an", "existing", "file", "or", "creating", "a", "new", "one" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/dialogs/saving_dlg.py#L28-L41
train
wylee/runcommands
runcommands/util/path.py
abs_path
def abs_path(path, format_kwargs={}, relative_to=None, keep_slash=False): """Get abs. path for ``path``. ``path`` may be a relative or absolute file system path or an asset path. If ``path`` is already an abs. path, it will be returned as is. Otherwise, it will be converted into a normalized abs. path....
python
def abs_path(path, format_kwargs={}, relative_to=None, keep_slash=False): """Get abs. path for ``path``. ``path`` may be a relative or absolute file system path or an asset path. If ``path`` is already an abs. path, it will be returned as is. Otherwise, it will be converted into a normalized abs. path....
[ "def", "abs_path", "(", "path", ",", "format_kwargs", "=", "{", "}", ",", "relative_to", "=", "None", ",", "keep_slash", "=", "False", ")", ":", "if", "format_kwargs", ":", "path", "=", "path", ".", "format_map", "(", "format_kwargs", ")", "has_slash", "...
Get abs. path for ``path``. ``path`` may be a relative or absolute file system path or an asset path. If ``path`` is already an abs. path, it will be returned as is. Otherwise, it will be converted into a normalized abs. path. If ``relative_to`` is passed *and* ``path`` is not absolute, the path w...
[ "Get", "abs", ".", "path", "for", "path", "." ]
b1d7c262885b9ced7ab89b63562f5464ca9970fe
https://github.com/wylee/runcommands/blob/b1d7c262885b9ced7ab89b63562f5464ca9970fe/runcommands/util/path.py#L7-L63
train
wylee/runcommands
runcommands/util/path.py
paths_to_str
def paths_to_str(paths, format_kwargs={}, delimiter=os.pathsep, asset_paths=False, check_paths=False): """Convert ``paths`` to a single string. Args: paths (str|list): A string like "/a/path:/another/path" or a list of paths; may include absolute paths and/or asset ...
python
def paths_to_str(paths, format_kwargs={}, delimiter=os.pathsep, asset_paths=False, check_paths=False): """Convert ``paths`` to a single string. Args: paths (str|list): A string like "/a/path:/another/path" or a list of paths; may include absolute paths and/or asset ...
[ "def", "paths_to_str", "(", "paths", ",", "format_kwargs", "=", "{", "}", ",", "delimiter", "=", "os", ".", "pathsep", ",", "asset_paths", "=", "False", ",", "check_paths", "=", "False", ")", ":", "if", "not", "paths", ":", "return", "''", "if", "isins...
Convert ``paths`` to a single string. Args: paths (str|list): A string like "/a/path:/another/path" or a list of paths; may include absolute paths and/or asset paths; paths that are relative will be left relative format_kwargs (dict): Will be injected into each path ...
[ "Convert", "paths", "to", "a", "single", "string", "." ]
b1d7c262885b9ced7ab89b63562f5464ca9970fe
https://github.com/wylee/runcommands/blob/b1d7c262885b9ced7ab89b63562f5464ca9970fe/runcommands/util/path.py#L122-L157
train
Naresh1318/crystal
crystal/app.py
index
def index(): """ Renders the dashboard when the server is initially run. Usage description: The rendered HTML allows the user to select a project and the desired run. :return: Template to render, Object that is taken care by flask. """ # Reset current index values when the page is refreshe...
python
def index(): """ Renders the dashboard when the server is initially run. Usage description: The rendered HTML allows the user to select a project and the desired run. :return: Template to render, Object that is taken care by flask. """ # Reset current index values when the page is refreshe...
[ "def", "index", "(", ")", ":", "for", "k", ",", "v", "in", "current_index", ".", "items", "(", ")", ":", "current_index", "[", "k", "]", "=", "0", "logging", ".", "info", "(", "\"Dashboard refreshed\"", ")", "return", "render_template", "(", "\"crystal_d...
Renders the dashboard when the server is initially run. Usage description: The rendered HTML allows the user to select a project and the desired run. :return: Template to render, Object that is taken care by flask.
[ "Renders", "the", "dashboard", "when", "the", "server", "is", "initially", "run", "." ]
6bb43fd1128296cc59b8ed3bc03064cc61c6bd88
https://github.com/Naresh1318/crystal/blob/6bb43fd1128296cc59b8ed3bc03064cc61c6bd88/crystal/app.py#L58-L74
train
Naresh1318/crystal
crystal/app.py
update
def update(): """ Called by XMLHTTPrequest function periodically to get new graph data. Usage description: This function queries the database and returns all the newly added values. :return: JSON Object, passed on to the JS script. """ assert request.method == "POST", "POST request expecte...
python
def update(): """ Called by XMLHTTPrequest function periodically to get new graph data. Usage description: This function queries the database and returns all the newly added values. :return: JSON Object, passed on to the JS script. """ assert request.method == "POST", "POST request expecte...
[ "def", "update", "(", ")", ":", "assert", "request", ".", "method", "==", "\"POST\"", ",", "\"POST request expected received {}\"", ".", "format", "(", "request", ".", "method", ")", "if", "request", ".", "method", "==", "'POST'", ":", "selected_run", "=", "...
Called by XMLHTTPrequest function periodically to get new graph data. Usage description: This function queries the database and returns all the newly added values. :return: JSON Object, passed on to the JS script.
[ "Called", "by", "XMLHTTPrequest", "function", "periodically", "to", "get", "new", "graph", "data", "." ]
6bb43fd1128296cc59b8ed3bc03064cc61c6bd88
https://github.com/Naresh1318/crystal/blob/6bb43fd1128296cc59b8ed3bc03064cc61c6bd88/crystal/app.py#L78-L100
train
Naresh1318/crystal
crystal/app.py
get_projects
def get_projects(): """ Send a dictionary of projects that are available on the database. Usage description: This function is usually called to get and display the list of projects available in the database. :return: JSON, {<int_keys>: <project_name>} """ assert request.method == "GET", "G...
python
def get_projects(): """ Send a dictionary of projects that are available on the database. Usage description: This function is usually called to get and display the list of projects available in the database. :return: JSON, {<int_keys>: <project_name>} """ assert request.method == "GET", "G...
[ "def", "get_projects", "(", ")", ":", "assert", "request", ".", "method", "==", "\"GET\"", ",", "\"GET request expected received {}\"", ".", "format", "(", "request", ".", "method", ")", "try", ":", "if", "request", ".", "method", "==", "'GET'", ":", "projec...
Send a dictionary of projects that are available on the database. Usage description: This function is usually called to get and display the list of projects available in the database. :return: JSON, {<int_keys>: <project_name>}
[ "Send", "a", "dictionary", "of", "projects", "that", "are", "available", "on", "the", "database", "." ]
6bb43fd1128296cc59b8ed3bc03064cc61c6bd88
https://github.com/Naresh1318/crystal/blob/6bb43fd1128296cc59b8ed3bc03064cc61c6bd88/crystal/app.py#L104-L121
train
Naresh1318/crystal
crystal/app.py
get_runs
def get_runs(): """ Send a dictionary of runs associated with the selected project. Usage description: This function is usually called to get and display the list of runs associated with a selected project available in the database. :return: JSON, {<int_keys>: <run_name>} """ assert re...
python
def get_runs(): """ Send a dictionary of runs associated with the selected project. Usage description: This function is usually called to get and display the list of runs associated with a selected project available in the database. :return: JSON, {<int_keys>: <run_name>} """ assert re...
[ "def", "get_runs", "(", ")", ":", "assert", "request", ".", "method", "==", "\"POST\"", ",", "\"POST request expected received {}\"", ".", "format", "(", "request", ".", "method", ")", "if", "request", ".", "method", "==", "\"POST\"", ":", "try", ":", "selec...
Send a dictionary of runs associated with the selected project. Usage description: This function is usually called to get and display the list of runs associated with a selected project available in the database. :return: JSON, {<int_keys>: <run_name>}
[ "Send", "a", "dictionary", "of", "runs", "associated", "with", "the", "selected", "project", "." ]
6bb43fd1128296cc59b8ed3bc03064cc61c6bd88
https://github.com/Naresh1318/crystal/blob/6bb43fd1128296cc59b8ed3bc03064cc61c6bd88/crystal/app.py#L125-L144
train
Naresh1318/crystal
crystal/app.py
get_variables
def get_variables(): """ Send a dictionary of variables associated with the selected run. Usage description: This function is usually called to get and display the list of runs associated with a selected project available in the database for the user to view. :return: JSON, {<int_keys>: <run_n...
python
def get_variables(): """ Send a dictionary of variables associated with the selected run. Usage description: This function is usually called to get and display the list of runs associated with a selected project available in the database for the user to view. :return: JSON, {<int_keys>: <run_n...
[ "def", "get_variables", "(", ")", ":", "assert", "request", ".", "method", "==", "\"POST\"", ",", "\"POST request expected received {}\"", ".", "format", "(", "request", ".", "method", ")", "if", "request", ".", "method", "==", "\"POST\"", ":", "try", ":", "...
Send a dictionary of variables associated with the selected run. Usage description: This function is usually called to get and display the list of runs associated with a selected project available in the database for the user to view. :return: JSON, {<int_keys>: <run_name>}
[ "Send", "a", "dictionary", "of", "variables", "associated", "with", "the", "selected", "run", "." ]
6bb43fd1128296cc59b8ed3bc03064cc61c6bd88
https://github.com/Naresh1318/crystal/blob/6bb43fd1128296cc59b8ed3bc03064cc61c6bd88/crystal/app.py#L148-L175
train
wylee/runcommands
commands.py
install_completion
def install_completion( shell: arg(choices=('bash', 'fish'), help='Shell to install completion for'), to: arg(help='~/.bashrc.d/runcommands.rc or ~/.config/fish/runcommands.fish') = None, overwrite: 'Overwrite if exists' = False): """Install command line completion script. Currently, ba...
python
def install_completion( shell: arg(choices=('bash', 'fish'), help='Shell to install completion for'), to: arg(help='~/.bashrc.d/runcommands.rc or ~/.config/fish/runcommands.fish') = None, overwrite: 'Overwrite if exists' = False): """Install command line completion script. Currently, ba...
[ "def", "install_completion", "(", "shell", ":", "arg", "(", "choices", "=", "(", "'bash'", ",", "'fish'", ")", ",", "help", "=", "'Shell to install completion for'", ")", ",", "to", ":", "arg", "(", "help", "=", "'~/.bashrc.d/runcommands.rc or ~/.config/fish/runco...
Install command line completion script. Currently, bash and fish are supported. The corresponding script will be copied to an appropriate directory. If the script already exists at that location, it will be overwritten by default.
[ "Install", "command", "line", "completion", "script", "." ]
b1d7c262885b9ced7ab89b63562f5464ca9970fe
https://github.com/wylee/runcommands/blob/b1d7c262885b9ced7ab89b63562f5464ca9970fe/commands.py#L48-L82
train
NoviceLive/intellicoder
intellicoder/synthesizers.py
Synthesizer.synthesize
def synthesize(self, modules, use_string, x64, native): """Transform sources.""" # code_opts = CodeOpts( # str.lower, None if use_string else hash_func, # 'reloc_delta', '->', # True) # gen_opts = GenOpts('defs', transformed) print(hash_func) g...
python
def synthesize(self, modules, use_string, x64, native): """Transform sources.""" # code_opts = CodeOpts( # str.lower, None if use_string else hash_func, # 'reloc_delta', '->', # True) # gen_opts = GenOpts('defs', transformed) print(hash_func) g...
[ "def", "synthesize", "(", "self", ",", "modules", ",", "use_string", ",", "x64", ",", "native", ")", ":", "print", "(", "hash_func", ")", "groups", "=", "group_by", "(", "modules", ",", "ends_with_punctuation", ")", "sources", "=", "self", ".", "make_sourc...
Transform sources.
[ "Transform", "sources", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/synthesizers.py#L46-L61
train
NoviceLive/intellicoder
intellicoder/synthesizers.py
Synthesizer.make_source
def make_source(self, groups, code_opts, gen_opts): """Build the final source code for all modules.""" modules = self.make_modules(groups, code_opts) var_decls = modules.var_decls relocs = AttrsGetter(modules.relocs) x86, x64 = relocs.get_attrs('x86', 'x64') if code_opts....
python
def make_source(self, groups, code_opts, gen_opts): """Build the final source code for all modules.""" modules = self.make_modules(groups, code_opts) var_decls = modules.var_decls relocs = AttrsGetter(modules.relocs) x86, x64 = relocs.get_attrs('x86', 'x64') if code_opts....
[ "def", "make_source", "(", "self", ",", "groups", ",", "code_opts", ",", "gen_opts", ")", ":", "modules", "=", "self", ".", "make_modules", "(", "groups", ",", "code_opts", ")", "var_decls", "=", "modules", ".", "var_decls", "relocs", "=", "AttrsGetter", "...
Build the final source code for all modules.
[ "Build", "the", "final", "source", "code", "for", "all", "modules", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/synthesizers.py#L63-L87
train
NoviceLive/intellicoder
intellicoder/synthesizers.py
Synthesizer.make_modules
def make_modules(self, groups, code_opts): """Build shellcoding files for the module.""" modules = [] for raw_module, raw_funcs in groups: module = raw_module[0].strip().strip(string.punctuation) funcs = [func.strip() for func in raw_funcs] args = [self.databa...
python
def make_modules(self, groups, code_opts): """Build shellcoding files for the module.""" modules = [] for raw_module, raw_funcs in groups: module = raw_module[0].strip().strip(string.punctuation) funcs = [func.strip() for func in raw_funcs] args = [self.databa...
[ "def", "make_modules", "(", "self", ",", "groups", ",", "code_opts", ")", ":", "modules", "=", "[", "]", "for", "raw_module", ",", "raw_funcs", "in", "groups", ":", "module", "=", "raw_module", "[", "0", "]", ".", "strip", "(", ")", ".", "strip", "("...
Build shellcoding files for the module.
[ "Build", "shellcoding", "files", "for", "the", "module", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/synthesizers.py#L89-L109
train
NoviceLive/intellicoder
intellicoder/synthesizers.py
ModuleSource.c_source
def c_source(self): """Return strings.""" relocs = Relocs( ''.join(self.c_self_relocs()), *self.c_module_relocs() ) return Source( ''.join(self.c_typedefs()), '' if self.opts.no_structs else self.c_struct(), ''.join(self.c_hashes()), ...
python
def c_source(self): """Return strings.""" relocs = Relocs( ''.join(self.c_self_relocs()), *self.c_module_relocs() ) return Source( ''.join(self.c_typedefs()), '' if self.opts.no_structs else self.c_struct(), ''.join(self.c_hashes()), ...
[ "def", "c_source", "(", "self", ")", ":", "relocs", "=", "Relocs", "(", "''", ".", "join", "(", "self", ".", "c_self_relocs", "(", ")", ")", ",", "*", "self", ".", "c_module_relocs", "(", ")", ")", "return", "Source", "(", "''", ".", "join", "(", ...
Return strings.
[ "Return", "strings", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/synthesizers.py#L134-L146
train
NoviceLive/intellicoder
intellicoder/synthesizers.py
ModuleSource.c_typedefs
def c_typedefs(self): """Get the typedefs of the module.""" defs = [] attrs = self.opts.attrs + '\n' if self.opts.attrs else '' for name, args in self.funcs: logging.debug('name: %s args: %s', name, args) defs.append( 'typedef\n{}\n{}{}({});\n'.for...
python
def c_typedefs(self): """Get the typedefs of the module.""" defs = [] attrs = self.opts.attrs + '\n' if self.opts.attrs else '' for name, args in self.funcs: logging.debug('name: %s args: %s', name, args) defs.append( 'typedef\n{}\n{}{}({});\n'.for...
[ "def", "c_typedefs", "(", "self", ")", ":", "defs", "=", "[", "]", "attrs", "=", "self", ".", "opts", ".", "attrs", "+", "'\\n'", "if", "self", ".", "opts", ".", "attrs", "else", "''", "for", "name", ",", "args", "in", "self", ".", "funcs", ":", ...
Get the typedefs of the module.
[ "Get", "the", "typedefs", "of", "the", "module", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/synthesizers.py#L148-L160
train
NoviceLive/intellicoder
intellicoder/synthesizers.py
ModuleSource.c_struct
def c_struct(self): """Get the struct of the module.""" member = '\n'.join(self.c_member_funcs(True)) if self.opts.windll: return 'struct {{\n{}{} }} {};\n'.format( self._c_dll_base(), member, self.name ) return 'typedef\nstruct {2} {{\n{0}\n{1}}}\...
python
def c_struct(self): """Get the struct of the module.""" member = '\n'.join(self.c_member_funcs(True)) if self.opts.windll: return 'struct {{\n{}{} }} {};\n'.format( self._c_dll_base(), member, self.name ) return 'typedef\nstruct {2} {{\n{0}\n{1}}}\...
[ "def", "c_struct", "(", "self", ")", ":", "member", "=", "'\\n'", ".", "join", "(", "self", ".", "c_member_funcs", "(", "True", ")", ")", "if", "self", ".", "opts", ".", "windll", ":", "return", "'struct {{\\n{}{} }} {};\\n'", ".", "format", "(", "self",...
Get the struct of the module.
[ "Get", "the", "struct", "of", "the", "module", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/synthesizers.py#L162-L171
train
NoviceLive/intellicoder
intellicoder/synthesizers.py
ModuleSource.c_hashes
def c_hashes(self): """Get the hashes of the module including functions and DLLs. """ if callable(self.opts.hash_func): hashes = [ '# define {}{} {}\n'.format( self.opts.prefix, name, self.opts.hash_func(name) ) for name, dummy_args...
python
def c_hashes(self): """Get the hashes of the module including functions and DLLs. """ if callable(self.opts.hash_func): hashes = [ '# define {}{} {}\n'.format( self.opts.prefix, name, self.opts.hash_func(name) ) for name, dummy_args...
[ "def", "c_hashes", "(", "self", ")", ":", "if", "callable", "(", "self", ".", "opts", ".", "hash_func", ")", ":", "hashes", "=", "[", "'# define {}{} {}\\n'", ".", "format", "(", "self", ".", "opts", ".", "prefix", ",", "name", ",", "self", ".", "opt...
Get the hashes of the module including functions and DLLs.
[ "Get", "the", "hashes", "of", "the", "module", "including", "functions", "and", "DLLs", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/synthesizers.py#L173-L191
train
NoviceLive/intellicoder
intellicoder/synthesizers.py
ModuleSource.c_self_relocs
def c_self_relocs(self): """Build relocation for strings.""" relocs = [] if not callable(self.opts.hash_func): relocs = [ reloc_ptr( self.opts.prefix + name, self.opts.reloc_delta, 'char *' ) for ...
python
def c_self_relocs(self): """Build relocation for strings.""" relocs = [] if not callable(self.opts.hash_func): relocs = [ reloc_ptr( self.opts.prefix + name, self.opts.reloc_delta, 'char *' ) for ...
[ "def", "c_self_relocs", "(", "self", ")", ":", "relocs", "=", "[", "]", "if", "not", "callable", "(", "self", ".", "opts", ".", "hash_func", ")", ":", "relocs", "=", "[", "reloc_ptr", "(", "self", ".", "opts", ".", "prefix", "+", "name", ",", "self...
Build relocation for strings.
[ "Build", "relocation", "for", "strings", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/synthesizers.py#L193-L211
train
NoviceLive/intellicoder
intellicoder/synthesizers.py
ModuleSource.c_var_decls
def c_var_decls(self): """Get the needed variable definitions.""" if self.opts.no_structs: mod_decl = 'HMODULE {} = NULL;\n'.format(self.name) return [mod_decl] + [ '{} *{} = NULL;\n'.format( self._c_type_name(name), name ) ...
python
def c_var_decls(self): """Get the needed variable definitions.""" if self.opts.no_structs: mod_decl = 'HMODULE {} = NULL;\n'.format(self.name) return [mod_decl] + [ '{} *{} = NULL;\n'.format( self._c_type_name(name), name ) ...
[ "def", "c_var_decls", "(", "self", ")", ":", "if", "self", ".", "opts", ".", "no_structs", ":", "mod_decl", "=", "'HMODULE {} = NULL;\\n'", ".", "format", "(", "self", ".", "name", ")", "return", "[", "mod_decl", "]", "+", "[", "'{} *{} = NULL;\\n'", ".", ...
Get the needed variable definitions.
[ "Get", "the", "needed", "variable", "definitions", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/synthesizers.py#L213-L229
train
NoviceLive/intellicoder
intellicoder/synthesizers.py
ModuleSource.c_module_relocs
def c_module_relocs(self): """Build relocation for the module variable.""" if self.opts.no_structs or self.opts.windll: return '', '' x86 = reloc_var( self.name, self._c_struct_names()[1], self.opts.reloc_delta, self._c_uses_pointer() ) ...
python
def c_module_relocs(self): """Build relocation for the module variable.""" if self.opts.no_structs or self.opts.windll: return '', '' x86 = reloc_var( self.name, self._c_struct_names()[1], self.opts.reloc_delta, self._c_uses_pointer() ) ...
[ "def", "c_module_relocs", "(", "self", ")", ":", "if", "self", ".", "opts", ".", "no_structs", "or", "self", ".", "opts", ".", "windll", ":", "return", "''", ",", "''", "x86", "=", "reloc_var", "(", "self", ".", "name", ",", "self", ".", "_c_struct_n...
Build relocation for the module variable.
[ "Build", "relocation", "for", "the", "module", "variable", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/synthesizers.py#L231-L243
train
NoviceLive/intellicoder
intellicoder/synthesizers.py
ModuleSource.c_loadlib
def c_loadlib(self): """Get the loadlib of the module.""" name = self._c_base_var() kernel32 = 'windll->kernel32.' if self.name == 'kernel32': loadlib = '{} = get_kernel32_base();\n'.format( 'kernel32' if self.opts.no_structs else kernel32 + se...
python
def c_loadlib(self): """Get the loadlib of the module.""" name = self._c_base_var() kernel32 = 'windll->kernel32.' if self.name == 'kernel32': loadlib = '{} = get_kernel32_base();\n'.format( 'kernel32' if self.opts.no_structs else kernel32 + se...
[ "def", "c_loadlib", "(", "self", ")", ":", "name", "=", "self", ".", "_c_base_var", "(", ")", "kernel32", "=", "'windll->kernel32.'", "if", "self", ".", "name", "==", "'kernel32'", ":", "loadlib", "=", "'{} = get_kernel32_base();\\n'", ".", "format", "(", "'...
Get the loadlib of the module.
[ "Get", "the", "loadlib", "of", "the", "module", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/synthesizers.py#L245-L260
train
NoviceLive/intellicoder
intellicoder/synthesizers.py
ModuleSource.c_getprocs
def c_getprocs(self): """Get the getprocs of the module.""" getprocs = [] for name, dummy_args in self.funcs: if name == 'GetProcAddress': if callable(self.opts.hash_func): continue getter = 'get_proc_by_string' elif sel...
python
def c_getprocs(self): """Get the getprocs of the module.""" getprocs = [] for name, dummy_args in self.funcs: if name == 'GetProcAddress': if callable(self.opts.hash_func): continue getter = 'get_proc_by_string' elif sel...
[ "def", "c_getprocs", "(", "self", ")", ":", "getprocs", "=", "[", "]", "for", "name", ",", "dummy_args", "in", "self", ".", "funcs", ":", "if", "name", "==", "'GetProcAddress'", ":", "if", "callable", "(", "self", ".", "opts", ".", "hash_func", ")", ...
Get the getprocs of the module.
[ "Get", "the", "getprocs", "of", "the", "module", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/synthesizers.py#L262-L288
train
NoviceLive/intellicoder
intellicoder/synthesizers.py
ModuleSource.c_member_funcs
def c_member_funcs(self, for_struct=False): """Get the decls of the module.""" decls = [ '{} *{};'.format(self._c_type_name(name), name) for name, dummy_args in self.funcs ] if for_struct: return decls return [self._c_mod_decl()] + decls
python
def c_member_funcs(self, for_struct=False): """Get the decls of the module.""" decls = [ '{} *{};'.format(self._c_type_name(name), name) for name, dummy_args in self.funcs ] if for_struct: return decls return [self._c_mod_decl()] + decls
[ "def", "c_member_funcs", "(", "self", ",", "for_struct", "=", "False", ")", ":", "decls", "=", "[", "'{} *{};'", ".", "format", "(", "self", ".", "_c_type_name", "(", "name", ")", ",", "name", ")", "for", "name", ",", "dummy_args", "in", "self", ".", ...
Get the decls of the module.
[ "Get", "the", "decls", "of", "the", "module", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/synthesizers.py#L290-L298
train
NoviceLive/intellicoder
intellicoder/synthesizers.py
ModuleSource._c_base_var
def _c_base_var(self): """Return the name of the module base variable.""" if self.opts.no_structs: return self.name return 'windll->{}.{}'.format( self.name, self.opts.base )
python
def _c_base_var(self): """Return the name of the module base variable.""" if self.opts.no_structs: return self.name return 'windll->{}.{}'.format( self.name, self.opts.base )
[ "def", "_c_base_var", "(", "self", ")", ":", "if", "self", ".", "opts", ".", "no_structs", ":", "return", "self", ".", "name", "return", "'windll->{}.{}'", ".", "format", "(", "self", ".", "name", ",", "self", ".", "opts", ".", "base", ")" ]
Return the name of the module base variable.
[ "Return", "the", "name", "of", "the", "module", "base", "variable", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/synthesizers.py#L330-L336
train
computational-metabolomics/msp2db
msp2db/utils.py
get_precursor_mz
def get_precursor_mz(exact_mass, precursor_type): """ Calculate precursor mz based on exact mass and precursor type Args: exact_mass (float): exact mass of compound of interest precursor_type (str): Precursor type (currently only works with '[M-H]-', '[M+H]+' and '[M+H-H2O]+' Return: ...
python
def get_precursor_mz(exact_mass, precursor_type): """ Calculate precursor mz based on exact mass and precursor type Args: exact_mass (float): exact mass of compound of interest precursor_type (str): Precursor type (currently only works with '[M-H]-', '[M+H]+' and '[M+H-H2O]+' Return: ...
[ "def", "get_precursor_mz", "(", "exact_mass", ",", "precursor_type", ")", ":", "d", "=", "{", "'[M-H]-'", ":", "-", "1.007276", ",", "'[M+H]+'", ":", "1.007276", ",", "'[M+H-H2O]+'", ":", "1.007276", "-", "(", "(", "1.007276", "*", "2", ")", "+", "15.994...
Calculate precursor mz based on exact mass and precursor type Args: exact_mass (float): exact mass of compound of interest precursor_type (str): Precursor type (currently only works with '[M-H]-', '[M+H]+' and '[M+H-H2O]+' Return: neutral mass of compound
[ "Calculate", "precursor", "mz", "based", "on", "exact", "mass", "and", "precursor", "type" ]
f86f01efca26fd2745547c9993f97337c6bef123
https://github.com/computational-metabolomics/msp2db/blob/f86f01efca26fd2745547c9993f97337c6bef123/msp2db/utils.py#L6-L28
train
computational-metabolomics/msp2db
msp2db/utils.py
line_count
def line_count(fn): """ Get line count of file Args: fn (str): Path to file Return: Number of lines in file (int) """ with open(fn) as f: for i, l in enumerate(f): pass return i + 1
python
def line_count(fn): """ Get line count of file Args: fn (str): Path to file Return: Number of lines in file (int) """ with open(fn) as f: for i, l in enumerate(f): pass return i + 1
[ "def", "line_count", "(", "fn", ")", ":", "with", "open", "(", "fn", ")", "as", "f", ":", "for", "i", ",", "l", "in", "enumerate", "(", "f", ")", ":", "pass", "return", "i", "+", "1" ]
Get line count of file Args: fn (str): Path to file Return: Number of lines in file (int)
[ "Get", "line", "count", "of", "file" ]
f86f01efca26fd2745547c9993f97337c6bef123
https://github.com/computational-metabolomics/msp2db/blob/f86f01efca26fd2745547c9993f97337c6bef123/msp2db/utils.py#L31-L44
train
portfors-lab/sparkle
sparkle/stim/abstract_component.py
AbstractStimulusComponent.amplitude
def amplitude(self, caldb, calv, atten=0): """Calculates the voltage amplitude for this stimulus, using internal intensity value and the given reference intensity & voltage :param caldb: calibration intensity in dbSPL :type caldb: float :param calv: calibration voltage that was ...
python
def amplitude(self, caldb, calv, atten=0): """Calculates the voltage amplitude for this stimulus, using internal intensity value and the given reference intensity & voltage :param caldb: calibration intensity in dbSPL :type caldb: float :param calv: calibration voltage that was ...
[ "def", "amplitude", "(", "self", ",", "caldb", ",", "calv", ",", "atten", "=", "0", ")", ":", "amp", "=", "(", "10", "**", "(", "float", "(", "self", ".", "_intensity", "+", "atten", "-", "caldb", ")", "/", "20", ")", "*", "calv", ")", "return"...
Calculates the voltage amplitude for this stimulus, using internal intensity value and the given reference intensity & voltage :param caldb: calibration intensity in dbSPL :type caldb: float :param calv: calibration voltage that was used to record the intensity provided :type ca...
[ "Calculates", "the", "voltage", "amplitude", "for", "this", "stimulus", "using", "internal", "intensity", "value", "and", "the", "given", "reference", "intensity", "&", "voltage" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/abstract_component.py#L38-L48
train
portfors-lab/sparkle
sparkle/stim/abstract_component.py
AbstractStimulusComponent.verify
def verify(self, **kwargs): """Checks this component for invalidating conditions :returns: str -- message if error, 0 otherwise """ if 'duration' in kwargs: if kwargs['duration'] < self._duration: return "Window size must equal or exceed stimulus length" ...
python
def verify(self, **kwargs): """Checks this component for invalidating conditions :returns: str -- message if error, 0 otherwise """ if 'duration' in kwargs: if kwargs['duration'] < self._duration: return "Window size must equal or exceed stimulus length" ...
[ "def", "verify", "(", "self", ",", "**", "kwargs", ")", ":", "if", "'duration'", "in", "kwargs", ":", "if", "kwargs", "[", "'duration'", "]", "<", "self", ".", "_duration", ":", "return", "\"Window size must equal or exceed stimulus length\"", "if", "self", "....
Checks this component for invalidating conditions :returns: str -- message if error, 0 otherwise
[ "Checks", "this", "component", "for", "invalidating", "conditions" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/abstract_component.py#L68-L78
train
portfors-lab/sparkle
sparkle/stim/abstract_component.py
AbstractStimulusComponent.stateDict
def stateDict(self): """Saves internal values to be loaded later :returns: dict -- {'parametername': value, ...} """ state = { 'duration' : self._duration, 'intensity' : self._intensity, 'risefall' : self._risefall, 'stim_t...
python
def stateDict(self): """Saves internal values to be loaded later :returns: dict -- {'parametername': value, ...} """ state = { 'duration' : self._duration, 'intensity' : self._intensity, 'risefall' : self._risefall, 'stim_t...
[ "def", "stateDict", "(", "self", ")", ":", "state", "=", "{", "'duration'", ":", "self", ".", "_duration", ",", "'intensity'", ":", "self", ".", "_intensity", ",", "'risefall'", ":", "self", ".", "_risefall", ",", "'stim_type'", ":", "self", ".", "name",...
Saves internal values to be loaded later :returns: dict -- {'parametername': value, ...}
[ "Saves", "internal", "values", "to", "be", "loaded", "later" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/abstract_component.py#L92-L103
train
portfors-lab/sparkle
sparkle/stim/abstract_component.py
AbstractStimulusComponent.loadState
def loadState(self, state): """Loads previously saved values to this component. :param state: return value from `stateDict` :type state: dict """ self._duration = state['duration'] self._intensity = state['intensity'] self._risefall = state['risefall']
python
def loadState(self, state): """Loads previously saved values to this component. :param state: return value from `stateDict` :type state: dict """ self._duration = state['duration'] self._intensity = state['intensity'] self._risefall = state['risefall']
[ "def", "loadState", "(", "self", ",", "state", ")", ":", "self", ".", "_duration", "=", "state", "[", "'duration'", "]", "self", ".", "_intensity", "=", "state", "[", "'intensity'", "]", "self", ".", "_risefall", "=", "state", "[", "'risefall'", "]" ]
Loads previously saved values to this component. :param state: return value from `stateDict` :type state: dict
[ "Loads", "previously", "saved", "values", "to", "this", "component", "." ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/abstract_component.py#L105-L113
train
mediawiki-utilities/python-mwoauth
mwoauth/handshaker.py
Handshaker.initiate
def initiate(self, callback=None): """ Initiate an OAuth handshake with MediaWiki. :Parameters: callback : `str` Callback URL. Defaults to 'oob'. :Returns: A `tuple` of two values: * a MediaWiki URL to direct the user to ...
python
def initiate(self, callback=None): """ Initiate an OAuth handshake with MediaWiki. :Parameters: callback : `str` Callback URL. Defaults to 'oob'. :Returns: A `tuple` of two values: * a MediaWiki URL to direct the user to ...
[ "def", "initiate", "(", "self", ",", "callback", "=", "None", ")", ":", "return", "initiate", "(", "self", ".", "mw_uri", ",", "self", ".", "consumer_token", ",", "callback", "=", "callback", "or", "self", ".", "callback", ",", "user_agent", "=", "self",...
Initiate an OAuth handshake with MediaWiki. :Parameters: callback : `str` Callback URL. Defaults to 'oob'. :Returns: A `tuple` of two values: * a MediaWiki URL to direct the user to * a :class:`~mwoauth.RequestToken` representing an acce...
[ "Initiate", "an", "OAuth", "handshake", "with", "MediaWiki", "." ]
cd6990753ec3d59b7cfd96a76459f71ef4790cd3
https://github.com/mediawiki-utilities/python-mwoauth/blob/cd6990753ec3d59b7cfd96a76459f71ef4790cd3/mwoauth/handshaker.py#L71-L89
train
AllTheWayDown/turgles
turgles/gl/uniform.py
_load_variable
def _load_variable(func, program_id, index): """Loads the meta data for a uniform or attribute""" n = 64 # max name length TODO: read from card bufsize = GLsizei(n) length = pointer(GLsizei(0)) size = pointer(GLint(0)) type = pointer(GLenum(0)) uname = create_string_buffer(n) func(progr...
python
def _load_variable(func, program_id, index): """Loads the meta data for a uniform or attribute""" n = 64 # max name length TODO: read from card bufsize = GLsizei(n) length = pointer(GLsizei(0)) size = pointer(GLint(0)) type = pointer(GLenum(0)) uname = create_string_buffer(n) func(progr...
[ "def", "_load_variable", "(", "func", ",", "program_id", ",", "index", ")", ":", "n", "=", "64", "bufsize", "=", "GLsizei", "(", "n", ")", "length", "=", "pointer", "(", "GLsizei", "(", "0", ")", ")", "size", "=", "pointer", "(", "GLint", "(", "0",...
Loads the meta data for a uniform or attribute
[ "Loads", "the", "meta", "data", "for", "a", "uniform", "or", "attribute" ]
1bb17abe9b3aa0953d9a8e9b05a23369c5bf8852
https://github.com/AllTheWayDown/turgles/blob/1bb17abe9b3aa0953d9a8e9b05a23369c5bf8852/turgles/gl/uniform.py#L49-L58
train
portfors-lab/sparkle
sparkle/gui/stim/explore_component_editor.py
ExploreComponentEditor.addWidget
def addWidget(self, widget, name): """Add a component editor widget""" self.exploreStimTypeCmbbx.addItem(name) self.componentStack.addWidget(widget) widget.valueChanged.connect(self.valueChanged.emit)
python
def addWidget(self, widget, name): """Add a component editor widget""" self.exploreStimTypeCmbbx.addItem(name) self.componentStack.addWidget(widget) widget.valueChanged.connect(self.valueChanged.emit)
[ "def", "addWidget", "(", "self", ",", "widget", ",", "name", ")", ":", "self", ".", "exploreStimTypeCmbbx", ".", "addItem", "(", "name", ")", "self", ".", "componentStack", ".", "addWidget", "(", "widget", ")", "widget", ".", "valueChanged", ".", "connect"...
Add a component editor widget
[ "Add", "a", "component", "editor", "widget" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/explore_component_editor.py#L56-L60
train
portfors-lab/sparkle
sparkle/gui/stim/explore_component_editor.py
ExploreComponentEditor.saveTemplate
def saveTemplate(self): """Get a json structure of the current inputs, to be able to load later""" savedict = {} for comp_editor in self.widgets(): stim = comp_editor.component() comp_editor.saveToObject() savedict[stim.name] = stim.stateDict() ...
python
def saveTemplate(self): """Get a json structure of the current inputs, to be able to load later""" savedict = {} for comp_editor in self.widgets(): stim = comp_editor.component() comp_editor.saveToObject() savedict[stim.name] = stim.stateDict() ...
[ "def", "saveTemplate", "(", "self", ")", ":", "savedict", "=", "{", "}", "for", "comp_editor", "in", "self", ".", "widgets", "(", ")", ":", "stim", "=", "comp_editor", ".", "component", "(", ")", "comp_editor", ".", "saveToObject", "(", ")", "savedict", ...
Get a json structure of the current inputs, to be able to load later
[ "Get", "a", "json", "structure", "of", "the", "current", "inputs", "to", "be", "able", "to", "load", "later" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/explore_component_editor.py#L73-L82
train
wylee/runcommands
runcommands/command.py
Command.expand_short_options
def expand_short_options(self, argv): """Convert grouped short options like `-abc` to `-a, -b, -c`. This is necessary because we set ``allow_abbrev=False`` on the ``ArgumentParser`` in :prop:`self.arg_parser`. The argparse docs say ``allow_abbrev`` applies only to long options, but it a...
python
def expand_short_options(self, argv): """Convert grouped short options like `-abc` to `-a, -b, -c`. This is necessary because we set ``allow_abbrev=False`` on the ``ArgumentParser`` in :prop:`self.arg_parser`. The argparse docs say ``allow_abbrev`` applies only to long options, but it a...
[ "def", "expand_short_options", "(", "self", ",", "argv", ")", ":", "new_argv", "=", "[", "]", "for", "arg", "in", "argv", ":", "result", "=", "self", ".", "parse_multi_short_option", "(", "arg", ")", "new_argv", ".", "extend", "(", "result", ")", "return...
Convert grouped short options like `-abc` to `-a, -b, -c`. This is necessary because we set ``allow_abbrev=False`` on the ``ArgumentParser`` in :prop:`self.arg_parser`. The argparse docs say ``allow_abbrev`` applies only to long options, but it also affects whether short options grouped...
[ "Convert", "grouped", "short", "options", "like", "-", "abc", "to", "-", "a", "-", "b", "-", "c", "." ]
b1d7c262885b9ced7ab89b63562f5464ca9970fe
https://github.com/wylee/runcommands/blob/b1d7c262885b9ced7ab89b63562f5464ca9970fe/runcommands/command.py#L270-L284
train
wylee/runcommands
runcommands/command.py
Command.find_arg
def find_arg(self, name): """Find arg by normalized arg name or parameter name.""" name = self.normalize_name(name) return self.args.get(name)
python
def find_arg(self, name): """Find arg by normalized arg name or parameter name.""" name = self.normalize_name(name) return self.args.get(name)
[ "def", "find_arg", "(", "self", ",", "name", ")", ":", "name", "=", "self", ".", "normalize_name", "(", "name", ")", "return", "self", ".", "args", ".", "get", "(", "name", ")" ]
Find arg by normalized arg name or parameter name.
[ "Find", "arg", "by", "normalized", "arg", "name", "or", "parameter", "name", "." ]
b1d7c262885b9ced7ab89b63562f5464ca9970fe
https://github.com/wylee/runcommands/blob/b1d7c262885b9ced7ab89b63562f5464ca9970fe/runcommands/command.py#L305-L308
train
wylee/runcommands
runcommands/command.py
Command.find_parameter
def find_parameter(self, name): """Find parameter by name or normalized arg name.""" name = self.normalize_name(name) arg = self.args.get(name) return None if arg is None else arg.parameter
python
def find_parameter(self, name): """Find parameter by name or normalized arg name.""" name = self.normalize_name(name) arg = self.args.get(name) return None if arg is None else arg.parameter
[ "def", "find_parameter", "(", "self", ",", "name", ")", ":", "name", "=", "self", ".", "normalize_name", "(", "name", ")", "arg", "=", "self", ".", "args", ".", "get", "(", "name", ")", "return", "None", "if", "arg", "is", "None", "else", "arg", "....
Find parameter by name or normalized arg name.
[ "Find", "parameter", "by", "name", "or", "normalized", "arg", "name", "." ]
b1d7c262885b9ced7ab89b63562f5464ca9970fe
https://github.com/wylee/runcommands/blob/b1d7c262885b9ced7ab89b63562f5464ca9970fe/runcommands/command.py#L310-L314
train
wylee/runcommands
runcommands/command.py
Command.args
def args(self): """Create args from function parameters.""" params = self.parameters args = OrderedDict() # This will be overridden if the command explicitly defines an # arg named help. args['help'] = HelpArg(command=self) normalize_name = self.normalize_name ...
python
def args(self): """Create args from function parameters.""" params = self.parameters args = OrderedDict() # This will be overridden if the command explicitly defines an # arg named help. args['help'] = HelpArg(command=self) normalize_name = self.normalize_name ...
[ "def", "args", "(", "self", ")", ":", "params", "=", "self", ".", "parameters", "args", "=", "OrderedDict", "(", ")", "args", "[", "'help'", "]", "=", "HelpArg", "(", "command", "=", "self", ")", "normalize_name", "=", "self", ".", "normalize_name", "g...
Create args from function parameters.
[ "Create", "args", "from", "function", "parameters", "." ]
b1d7c262885b9ced7ab89b63562f5464ca9970fe
https://github.com/wylee/runcommands/blob/b1d7c262885b9ced7ab89b63562f5464ca9970fe/runcommands/command.py#L377-L466
train
wylee/runcommands
runcommands/command.py
Command.option_map
def option_map(self): """Map command-line options to args.""" option_map = OrderedDict() for arg in self.args.values(): for option in arg.options: option_map[option] = arg return option_map
python
def option_map(self): """Map command-line options to args.""" option_map = OrderedDict() for arg in self.args.values(): for option in arg.options: option_map[option] = arg return option_map
[ "def", "option_map", "(", "self", ")", ":", "option_map", "=", "OrderedDict", "(", ")", "for", "arg", "in", "self", ".", "args", ".", "values", "(", ")", ":", "for", "option", "in", "arg", ".", "options", ":", "option_map", "[", "option", "]", "=", ...
Map command-line options to args.
[ "Map", "command", "-", "line", "options", "to", "args", "." ]
b1d7c262885b9ced7ab89b63562f5464ca9970fe
https://github.com/wylee/runcommands/blob/b1d7c262885b9ced7ab89b63562f5464ca9970fe/runcommands/command.py#L524-L530
train
lowandrew/OLCTools
sipprCommon/objectprep.py
Objectprep.objectprep
def objectprep(self): """ Creates fastq files from an in-progress Illumina MiSeq run or create an object and moves files appropriately """ # Create .fastq files if necessary. Otherwise create the metadata object if self.bcltofastq: if self.customsamplesheet: ...
python
def objectprep(self): """ Creates fastq files from an in-progress Illumina MiSeq run or create an object and moves files appropriately """ # Create .fastq files if necessary. Otherwise create the metadata object if self.bcltofastq: if self.customsamplesheet: ...
[ "def", "objectprep", "(", "self", ")", ":", "if", "self", ".", "bcltofastq", ":", "if", "self", ".", "customsamplesheet", ":", "assert", "os", ".", "path", ".", "isfile", "(", "self", ".", "customsamplesheet", ")", ",", "'Cannot find custom sample sheet as spe...
Creates fastq files from an in-progress Illumina MiSeq run or create an object and moves files appropriately
[ "Creates", "fastq", "files", "from", "an", "in", "-", "progress", "Illumina", "MiSeq", "run", "or", "create", "an", "object", "and", "moves", "files", "appropriately" ]
88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/sipprCommon/objectprep.py#L11-L33
train
lowandrew/OLCTools
spadespipeline/fileprep.py
Fileprep.fileprep
def fileprep(self): """Decompress and concatenate .fastq files""" # Create and start threads for i in range(self.cpus): # Send the threads to the appropriate destination function threads = Thread(target=self.prep, args=()) # Set the daemon to true - something ...
python
def fileprep(self): """Decompress and concatenate .fastq files""" # Create and start threads for i in range(self.cpus): # Send the threads to the appropriate destination function threads = Thread(target=self.prep, args=()) # Set the daemon to true - something ...
[ "def", "fileprep", "(", "self", ")", ":", "for", "i", "in", "range", "(", "self", ".", "cpus", ")", ":", "threads", "=", "Thread", "(", "target", "=", "self", ".", "prep", ",", "args", "=", "(", ")", ")", "threads", ".", "setDaemon", "(", "True",...
Decompress and concatenate .fastq files
[ "Decompress", "and", "concatenate", ".", "fastq", "files" ]
88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/fileprep.py#L11-L26
train
NoviceLive/intellicoder
intellicoder/converters.py
chunked_join
def chunked_join(iterable, int1, int2, str1, str2, func): """Chunk and join.""" chunks = list(chunked(iterable, int1)) logging.debug(chunks) groups = [list(chunked(chunk, int2)) for chunk in chunks] logging.debug(groups) return str1.join([ str2.join([func(''.join(chunk)) for chunk in chu...
python
def chunked_join(iterable, int1, int2, str1, str2, func): """Chunk and join.""" chunks = list(chunked(iterable, int1)) logging.debug(chunks) groups = [list(chunked(chunk, int2)) for chunk in chunks] logging.debug(groups) return str1.join([ str2.join([func(''.join(chunk)) for chunk in chu...
[ "def", "chunked_join", "(", "iterable", ",", "int1", ",", "int2", ",", "str1", ",", "str2", ",", "func", ")", ":", "chunks", "=", "list", "(", "chunked", "(", "iterable", ",", "int1", ")", ")", "logging", ".", "debug", "(", "chunks", ")", "groups", ...
Chunk and join.
[ "Chunk", "and", "join", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/converters.py#L100-L109
train
NoviceLive/intellicoder
intellicoder/converters.py
bytes_to_c_string
def bytes_to_c_string(data): """ Convert the hexadecimal string in to C-style string. """ rows = chunked_join(data, 20, 2, '"\n "', '', r'\x' + X) logging.debug(_('Returning rows: %s'), rows) return '"{}";'.format(rows)
python
def bytes_to_c_string(data): """ Convert the hexadecimal string in to C-style string. """ rows = chunked_join(data, 20, 2, '"\n "', '', r'\x' + X) logging.debug(_('Returning rows: %s'), rows) return '"{}";'.format(rows)
[ "def", "bytes_to_c_string", "(", "data", ")", ":", "rows", "=", "chunked_join", "(", "data", ",", "20", ",", "2", ",", "'\"\\n \"'", ",", "''", ",", "r'\\x'", "+", "X", ")", "logging", ".", "debug", "(", "_", "(", "'Returning rows: %s'", ")", ",", ...
Convert the hexadecimal string in to C-style string.
[ "Convert", "the", "hexadecimal", "string", "in", "to", "C", "-", "style", "string", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/converters.py#L112-L118
train
NoviceLive/intellicoder
intellicoder/converters.py
bytes_to_c_array
def bytes_to_c_array(data): """ Make a C array using the given string. """ chars = [ "'{}'".format(encode_escape(i)) for i in decode_escape(data) ] return ', '.join(chars) + ', 0'
python
def bytes_to_c_array(data): """ Make a C array using the given string. """ chars = [ "'{}'".format(encode_escape(i)) for i in decode_escape(data) ] return ', '.join(chars) + ', 0'
[ "def", "bytes_to_c_array", "(", "data", ")", ":", "chars", "=", "[", "\"'{}'\"", ".", "format", "(", "encode_escape", "(", "i", ")", ")", "for", "i", "in", "decode_escape", "(", "data", ")", "]", "return", "', '", ".", "join", "(", "chars", ")", "+",...
Make a C array using the given string.
[ "Make", "a", "C", "array", "using", "the", "given", "string", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/converters.py#L121-L129
train
NoviceLive/intellicoder
intellicoder/converters.py
Converter.uni_from
def uni_from(cls, source, *args, **kwargs): """Unified from.""" logging.debug(_('source: %s, args: %s, kwargs: %s'), source, args, kwargs) return getattr(cls, cls.cons_dict[source])(*args, **kwargs)
python
def uni_from(cls, source, *args, **kwargs): """Unified from.""" logging.debug(_('source: %s, args: %s, kwargs: %s'), source, args, kwargs) return getattr(cls, cls.cons_dict[source])(*args, **kwargs)
[ "def", "uni_from", "(", "cls", ",", "source", ",", "*", "args", ",", "**", "kwargs", ")", ":", "logging", ".", "debug", "(", "_", "(", "'source: %s, args: %s, kwargs: %s'", ")", ",", "source", ",", "args", ",", "kwargs", ")", "return", "getattr", "(", ...
Unified from.
[ "Unified", "from", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/converters.py#L46-L50
train
NoviceLive/intellicoder
intellicoder/converters.py
Converter.uni_to
def uni_to(self, target, *args, **kwargs): """Unified to.""" logging.debug(_('target: %s, args: %s, kwargs: %s'), target, args, kwargs) return getattr(self, self.func_dict[target])(*args, **kwargs)
python
def uni_to(self, target, *args, **kwargs): """Unified to.""" logging.debug(_('target: %s, args: %s, kwargs: %s'), target, args, kwargs) return getattr(self, self.func_dict[target])(*args, **kwargs)
[ "def", "uni_to", "(", "self", ",", "target", ",", "*", "args", ",", "**", "kwargs", ")", ":", "logging", ".", "debug", "(", "_", "(", "'target: %s, args: %s, kwargs: %s'", ")", ",", "target", ",", "args", ",", "kwargs", ")", "return", "getattr", "(", "...
Unified to.
[ "Unified", "to", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/converters.py#L52-L56
train