repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
TestInABox/stackInABox | stackinabox/services/service.py | StackInABoxService.create_route | def create_route(self, uri, sub_service):
"""Create the route for the URI.
:param uri: string - URI to be routed
:param sub_service: boolean - is the URI for a sub-service
:returns: n/a
"""
if uri not in self.routes.keys():
logger.debug('Service ({0}): Creat... | python | def create_route(self, uri, sub_service):
"""Create the route for the URI.
:param uri: string - URI to be routed
:param sub_service: boolean - is the URI for a sub-service
:returns: n/a
"""
if uri not in self.routes.keys():
logger.debug('Service ({0}): Creat... | [
"def",
"create_route",
"(",
"self",
",",
"uri",
",",
"sub_service",
")",
":",
"if",
"uri",
"not",
"in",
"self",
".",
"routes",
".",
"keys",
"(",
")",
":",
"logger",
".",
"debug",
"(",
"'Service ({0}): Creating routes'",
".",
"format",
"(",
"self",
".",
... | Create the route for the URI.
:param uri: string - URI to be routed
:param sub_service: boolean - is the URI for a sub-service
:returns: n/a | [
"Create",
"the",
"route",
"for",
"the",
"URI",
"."
] | train | https://github.com/TestInABox/stackInABox/blob/63ee457401e9a88d987f85f513eb512dcb12d984/stackinabox/services/service.py#L403-L423 |
TestInABox/stackInABox | stackinabox/services/service.py | StackInABoxService.register | def register(self, method, uri, call_back):
"""Register a class instance function to handle a request.
:param method: string - HTTP Verb
:param uri: string - URI for the request
:param call_back: class instance function that handles the request
:returns: n/a
"""
... | python | def register(self, method, uri, call_back):
"""Register a class instance function to handle a request.
:param method: string - HTTP Verb
:param uri: string - URI for the request
:param call_back: class instance function that handles the request
:returns: n/a
"""
... | [
"def",
"register",
"(",
"self",
",",
"method",
",",
"uri",
",",
"call_back",
")",
":",
"found",
"=",
"False",
"self",
".",
"create_route",
"(",
"uri",
",",
"False",
")",
"self",
".",
"routes",
"[",
"uri",
"]",
"[",
"'handlers'",
"]",
".",
"register_m... | Register a class instance function to handle a request.
:param method: string - HTTP Verb
:param uri: string - URI for the request
:param call_back: class instance function that handles the request
:returns: n/a | [
"Register",
"a",
"class",
"instance",
"function",
"to",
"handle",
"a",
"request",
"."
] | train | https://github.com/TestInABox/stackInABox/blob/63ee457401e9a88d987f85f513eb512dcb12d984/stackinabox/services/service.py#L425-L438 |
TestInABox/stackInABox | stackinabox/services/service.py | StackInABoxService.register_subservice | def register_subservice(self, uri, service):
"""Register a class instance to handle a URI.
:param uri: string - URI for the request
:param service: StackInABoxService object instance that handles
the request
:returns: n/a
"""
found = False
... | python | def register_subservice(self, uri, service):
"""Register a class instance to handle a URI.
:param uri: string - URI for the request
:param service: StackInABoxService object instance that handles
the request
:returns: n/a
"""
found = False
... | [
"def",
"register_subservice",
"(",
"self",
",",
"uri",
",",
"service",
")",
":",
"found",
"=",
"False",
"self",
".",
"create_route",
"(",
"uri",
",",
"True",
")",
"self",
".",
"routes",
"[",
"uri",
"]",
"[",
"'handlers'",
"]",
".",
"set_subservice",
"(... | Register a class instance to handle a URI.
:param uri: string - URI for the request
:param service: StackInABoxService object instance that handles
the request
:returns: n/a | [
"Register",
"a",
"class",
"instance",
"to",
"handle",
"a",
"URI",
"."
] | train | https://github.com/TestInABox/stackInABox/blob/63ee457401e9a88d987f85f513eb512dcb12d984/stackinabox/services/service.py#L440-L452 |
kervi/kervi-devices | kervi/devices/gpio/MCP230XX.py | _MCP230XX.define_as_input | def define_as_input(self, pin, pullup=False):
"""Set the input or output mode for a specified pin. Mode should be
either GPIO.OUT or GPIO.IN.
"""
self._validate_channel(pin)
# Set bit to 1 for input or 0 for output.
self.iodir[int(pin/8)] |= 1 << (int(pin%8))
sel... | python | def define_as_input(self, pin, pullup=False):
"""Set the input or output mode for a specified pin. Mode should be
either GPIO.OUT or GPIO.IN.
"""
self._validate_channel(pin)
# Set bit to 1 for input or 0 for output.
self.iodir[int(pin/8)] |= 1 << (int(pin%8))
sel... | [
"def",
"define_as_input",
"(",
"self",
",",
"pin",
",",
"pullup",
"=",
"False",
")",
":",
"self",
".",
"_validate_channel",
"(",
"pin",
")",
"# Set bit to 1 for input or 0 for output.",
"self",
".",
"iodir",
"[",
"int",
"(",
"pin",
"/",
"8",
")",
"]",
"|="... | Set the input or output mode for a specified pin. Mode should be
either GPIO.OUT or GPIO.IN. | [
"Set",
"the",
"input",
"or",
"output",
"mode",
"for",
"a",
"specified",
"pin",
".",
"Mode",
"should",
"be",
"either",
"GPIO",
".",
"OUT",
"or",
"GPIO",
".",
"IN",
"."
] | train | https://github.com/kervi/kervi-devices/blob/c6aaddc6da1d0bce0ea2b0c6eb8393ba10aefa56/kervi/devices/gpio/MCP230XX.py#L60-L68 |
kervi/kervi-devices | kervi/devices/gpio/MCP230XX.py | _MCP230XX.define_as_output | def define_as_output(self, pin):
"""Set the input or output mode for a specified pin. Mode should be
either GPIO.OUT or GPIO.IN.
"""
self._validate_channel(pin)
# Set bit to 1 for input or 0 for output.
self.iodir[int(pin/8)] &= ~(1 << (int(pin%8)))
self._write_i... | python | def define_as_output(self, pin):
"""Set the input or output mode for a specified pin. Mode should be
either GPIO.OUT or GPIO.IN.
"""
self._validate_channel(pin)
# Set bit to 1 for input or 0 for output.
self.iodir[int(pin/8)] &= ~(1 << (int(pin%8)))
self._write_i... | [
"def",
"define_as_output",
"(",
"self",
",",
"pin",
")",
":",
"self",
".",
"_validate_channel",
"(",
"pin",
")",
"# Set bit to 1 for input or 0 for output.",
"self",
".",
"iodir",
"[",
"int",
"(",
"pin",
"/",
"8",
")",
"]",
"&=",
"~",
"(",
"1",
"<<",
"("... | Set the input or output mode for a specified pin. Mode should be
either GPIO.OUT or GPIO.IN. | [
"Set",
"the",
"input",
"or",
"output",
"mode",
"for",
"a",
"specified",
"pin",
".",
"Mode",
"should",
"be",
"either",
"GPIO",
".",
"OUT",
"or",
"GPIO",
".",
"IN",
"."
] | train | https://github.com/kervi/kervi-devices/blob/c6aaddc6da1d0bce0ea2b0c6eb8393ba10aefa56/kervi/devices/gpio/MCP230XX.py#L70-L77 |
kervi/kervi-devices | kervi/devices/gpio/MCP230XX.py | _MCP230XX._output_pins | def _output_pins(self, pins):
"""Set multiple pins high or low at once. Pins should be a dict of pin
name to pin value (HIGH/True for 1, LOW/False for 0). All provided pins
will be set to the given values.
"""
[self._validate_channel(pin) for pin in pins.keys()]
# Set e... | python | def _output_pins(self, pins):
"""Set multiple pins high or low at once. Pins should be a dict of pin
name to pin value (HIGH/True for 1, LOW/False for 0). All provided pins
will be set to the given values.
"""
[self._validate_channel(pin) for pin in pins.keys()]
# Set e... | [
"def",
"_output_pins",
"(",
"self",
",",
"pins",
")",
":",
"[",
"self",
".",
"_validate_channel",
"(",
"pin",
")",
"for",
"pin",
"in",
"pins",
".",
"keys",
"(",
")",
"]",
"# Set each changed pin's bit.",
"for",
"pin",
",",
"value",
"in",
"iter",
"(",
"... | Set multiple pins high or low at once. Pins should be a dict of pin
name to pin value (HIGH/True for 1, LOW/False for 0). All provided pins
will be set to the given values. | [
"Set",
"multiple",
"pins",
"high",
"or",
"low",
"at",
"once",
".",
"Pins",
"should",
"be",
"a",
"dict",
"of",
"pin",
"name",
"to",
"pin",
"value",
"(",
"HIGH",
"/",
"True",
"for",
"1",
"LOW",
"/",
"False",
"for",
"0",
")",
".",
"All",
"provided",
... | train | https://github.com/kervi/kervi-devices/blob/c6aaddc6da1d0bce0ea2b0c6eb8393ba10aefa56/kervi/devices/gpio/MCP230XX.py#L91-L104 |
kervi/kervi-devices | kervi/devices/gpio/MCP230XX.py | _MCP230XX._input_pins | def _input_pins(self, pins):
"""Read multiple pins specified in the given list and return list of pin values
GPIO.HIGH/True if the pin is pulled high, or GPIO.LOW/False if pulled low.
"""
[self._validate_channel(pin) for pin in pins]
# Get GPIO state.
gpio = self.i2c.read... | python | def _input_pins(self, pins):
"""Read multiple pins specified in the given list and return list of pin values
GPIO.HIGH/True if the pin is pulled high, or GPIO.LOW/False if pulled low.
"""
[self._validate_channel(pin) for pin in pins]
# Get GPIO state.
gpio = self.i2c.read... | [
"def",
"_input_pins",
"(",
"self",
",",
"pins",
")",
":",
"[",
"self",
".",
"_validate_channel",
"(",
"pin",
")",
"for",
"pin",
"in",
"pins",
"]",
"# Get GPIO state.",
"gpio",
"=",
"self",
".",
"i2c",
".",
"read_list",
"(",
"self",
".",
"GPIO",
",",
... | Read multiple pins specified in the given list and return list of pin values
GPIO.HIGH/True if the pin is pulled high, or GPIO.LOW/False if pulled low. | [
"Read",
"multiple",
"pins",
"specified",
"in",
"the",
"given",
"list",
"and",
"return",
"list",
"of",
"pin",
"values",
"GPIO",
".",
"HIGH",
"/",
"True",
"if",
"the",
"pin",
"is",
"pulled",
"high",
"or",
"GPIO",
".",
"LOW",
"/",
"False",
"if",
"pulled",... | train | https://github.com/kervi/kervi-devices/blob/c6aaddc6da1d0bce0ea2b0c6eb8393ba10aefa56/kervi/devices/gpio/MCP230XX.py#L106-L114 |
kervi/kervi-devices | kervi/devices/gpio/MCP230XX.py | _MCP230XX.pullup | def pullup(self, pin, enabled):
"""Turn on the pull-up resistor for the specified pin if enabled is True,
otherwise turn off the pull-up resistor.
"""
self._validate_channel(pin)
if enabled:
self.gppu[int(pin/8)] |= 1 << (int(pin%8))
else:
self.gpp... | python | def pullup(self, pin, enabled):
"""Turn on the pull-up resistor for the specified pin if enabled is True,
otherwise turn off the pull-up resistor.
"""
self._validate_channel(pin)
if enabled:
self.gppu[int(pin/8)] |= 1 << (int(pin%8))
else:
self.gpp... | [
"def",
"pullup",
"(",
"self",
",",
"pin",
",",
"enabled",
")",
":",
"self",
".",
"_validate_channel",
"(",
"pin",
")",
"if",
"enabled",
":",
"self",
".",
"gppu",
"[",
"int",
"(",
"pin",
"/",
"8",
")",
"]",
"|=",
"1",
"<<",
"(",
"int",
"(",
"pin... | Turn on the pull-up resistor for the specified pin if enabled is True,
otherwise turn off the pull-up resistor. | [
"Turn",
"on",
"the",
"pull",
"-",
"up",
"resistor",
"for",
"the",
"specified",
"pin",
"if",
"enabled",
"is",
"True",
"otherwise",
"turn",
"off",
"the",
"pull",
"-",
"up",
"resistor",
"."
] | train | https://github.com/kervi/kervi-devices/blob/c6aaddc6da1d0bce0ea2b0c6eb8393ba10aefa56/kervi/devices/gpio/MCP230XX.py#L116-L125 |
kervi/kervi-devices | kervi/devices/gpio/MCP230XX.py | _MCP230XX._write_gpio | def _write_gpio(self, gpio=None):
"""Write the specified byte value to the GPIO registor. If no value
specified the current buffered value will be written.
"""
if gpio is not None:
self.gpio = gpio
self.i2c.write_list(self.GPIO, self.gpio) | python | def _write_gpio(self, gpio=None):
"""Write the specified byte value to the GPIO registor. If no value
specified the current buffered value will be written.
"""
if gpio is not None:
self.gpio = gpio
self.i2c.write_list(self.GPIO, self.gpio) | [
"def",
"_write_gpio",
"(",
"self",
",",
"gpio",
"=",
"None",
")",
":",
"if",
"gpio",
"is",
"not",
"None",
":",
"self",
".",
"gpio",
"=",
"gpio",
"self",
".",
"i2c",
".",
"write_list",
"(",
"self",
".",
"GPIO",
",",
"self",
".",
"gpio",
")"
] | Write the specified byte value to the GPIO registor. If no value
specified the current buffered value will be written. | [
"Write",
"the",
"specified",
"byte",
"value",
"to",
"the",
"GPIO",
"registor",
".",
"If",
"no",
"value",
"specified",
"the",
"current",
"buffered",
"value",
"will",
"be",
"written",
"."
] | train | https://github.com/kervi/kervi-devices/blob/c6aaddc6da1d0bce0ea2b0c6eb8393ba10aefa56/kervi/devices/gpio/MCP230XX.py#L127-L133 |
kervi/kervi-devices | kervi/devices/gpio/MCP230XX.py | _MCP230XX._write_iodir | def _write_iodir(self, iodir=None):
"""Write the specified byte value to the IODIR registor. If no value
specified the current buffered value will be written.
"""
if iodir is not None:
self.iodir = iodir
self.i2c.write_list(self.IODIR, self.iodir) | python | def _write_iodir(self, iodir=None):
"""Write the specified byte value to the IODIR registor. If no value
specified the current buffered value will be written.
"""
if iodir is not None:
self.iodir = iodir
self.i2c.write_list(self.IODIR, self.iodir) | [
"def",
"_write_iodir",
"(",
"self",
",",
"iodir",
"=",
"None",
")",
":",
"if",
"iodir",
"is",
"not",
"None",
":",
"self",
".",
"iodir",
"=",
"iodir",
"self",
".",
"i2c",
".",
"write_list",
"(",
"self",
".",
"IODIR",
",",
"self",
".",
"iodir",
")"
] | Write the specified byte value to the IODIR registor. If no value
specified the current buffered value will be written. | [
"Write",
"the",
"specified",
"byte",
"value",
"to",
"the",
"IODIR",
"registor",
".",
"If",
"no",
"value",
"specified",
"the",
"current",
"buffered",
"value",
"will",
"be",
"written",
"."
] | train | https://github.com/kervi/kervi-devices/blob/c6aaddc6da1d0bce0ea2b0c6eb8393ba10aefa56/kervi/devices/gpio/MCP230XX.py#L135-L141 |
kervi/kervi-devices | kervi/devices/gpio/MCP230XX.py | _MCP230XX._write_gppu | def _write_gppu(self, gppu=None):
"""Write the specified byte value to the GPPU registor. If no value
specified the current buffered value will be written.
"""
if gppu is not None:
self.gppu = gppu
self.i2c.write_list(self.GPPU, self.gppu) | python | def _write_gppu(self, gppu=None):
"""Write the specified byte value to the GPPU registor. If no value
specified the current buffered value will be written.
"""
if gppu is not None:
self.gppu = gppu
self.i2c.write_list(self.GPPU, self.gppu) | [
"def",
"_write_gppu",
"(",
"self",
",",
"gppu",
"=",
"None",
")",
":",
"if",
"gppu",
"is",
"not",
"None",
":",
"self",
".",
"gppu",
"=",
"gppu",
"self",
".",
"i2c",
".",
"write_list",
"(",
"self",
".",
"GPPU",
",",
"self",
".",
"gppu",
")"
] | Write the specified byte value to the GPPU registor. If no value
specified the current buffered value will be written. | [
"Write",
"the",
"specified",
"byte",
"value",
"to",
"the",
"GPPU",
"registor",
".",
"If",
"no",
"value",
"specified",
"the",
"current",
"buffered",
"value",
"will",
"be",
"written",
"."
] | train | https://github.com/kervi/kervi-devices/blob/c6aaddc6da1d0bce0ea2b0c6eb8393ba10aefa56/kervi/devices/gpio/MCP230XX.py#L143-L149 |
Brazelton-Lab/bio_utils | bio_utils/iterators/b6.py | B6Entry.write | def write(self, default: bool=False):
"""Restore B6/M8 entry to original format
Args:
default (bool): output entry in default BLAST+ B6 format
Returns:
str: properly formatted string containing the B6/M8 entry
"""
none_type = type(None)
if def... | python | def write(self, default: bool=False):
"""Restore B6/M8 entry to original format
Args:
default (bool): output entry in default BLAST+ B6 format
Returns:
str: properly formatted string containing the B6/M8 entry
"""
none_type = type(None)
if def... | [
"def",
"write",
"(",
"self",
",",
"default",
":",
"bool",
"=",
"False",
")",
":",
"none_type",
"=",
"type",
"(",
"None",
")",
"if",
"default",
":",
"# Default order of format specifiers",
"ordered_vals",
"=",
"[",
"'query'",
",",
"'subject'",
",",
"'identity... | Restore B6/M8 entry to original format
Args:
default (bool): output entry in default BLAST+ B6 format
Returns:
str: properly formatted string containing the B6/M8 entry | [
"Restore",
"B6",
"/",
"M8",
"entry",
"to",
"original",
"format"
] | train | https://github.com/Brazelton-Lab/bio_utils/blob/5a7ddf13ee0bf4baaaeb6b2b99e01bf74aa132b7/bio_utils/iterators/b6.py#L97-L125 |
Brazelton-Lab/bio_utils | bio_utils/iterators/b6.py | B6Reader.iterate | def iterate(self, start_line=None, header: list=['qaccver', 'saccver',
'pident', 'length', 'mismatch', 'gapopen', 'qstart', 'qend', 'sstart',
'send', 'evalue', 'bitscore'], comments: bool=False):
"""Iterate over B6/M8 file and return B6/M8 entries
Args:
start_line (str): Ne... | python | def iterate(self, start_line=None, header: list=['qaccver', 'saccver',
'pident', 'length', 'mismatch', 'gapopen', 'qstart', 'qend', 'sstart',
'send', 'evalue', 'bitscore'], comments: bool=False):
"""Iterate over B6/M8 file and return B6/M8 entries
Args:
start_line (str): Ne... | [
"def",
"iterate",
"(",
"self",
",",
"start_line",
"=",
"None",
",",
"header",
":",
"list",
"=",
"[",
"'qaccver'",
",",
"'saccver'",
",",
"'pident'",
",",
"'length'",
",",
"'mismatch'",
",",
"'gapopen'",
",",
"'qstart'",
",",
"'qend'",
",",
"'sstart'",
",... | Iterate over B6/M8 file and return B6/M8 entries
Args:
start_line (str): Next B6/M8 entry. If 'handle' has been partially
read and you want to start iterating at the next entry, read
the next B6/M8 entry and pass it to this variable when calling
b6_... | [
"Iterate",
"over",
"B6",
"/",
"M8",
"file",
"and",
"return",
"B6",
"/",
"M8",
"entries"
] | train | https://github.com/Brazelton-Lab/bio_utils/blob/5a7ddf13ee0bf4baaaeb6b2b99e01bf74aa132b7/bio_utils/iterators/b6.py#L147-L329 |
6809/dragonlib | dragonlib/utils/auto_shift.py | invert_shift | def invert_shift(chars):
"""
>>> invert_shift("a")
'A'
>>> invert_shift("A")
'a'
>>> invert_shift("123 foo 456 BAR #!")
'123 FOO 456 bar #!'
"""
result = ""
for char in chars:
if char in string.ascii_lowercase:
# log.critical("auto shift lowercase char %s to ... | python | def invert_shift(chars):
"""
>>> invert_shift("a")
'A'
>>> invert_shift("A")
'a'
>>> invert_shift("123 foo 456 BAR #!")
'123 FOO 456 bar #!'
"""
result = ""
for char in chars:
if char in string.ascii_lowercase:
# log.critical("auto shift lowercase char %s to ... | [
"def",
"invert_shift",
"(",
"chars",
")",
":",
"result",
"=",
"\"\"",
"for",
"char",
"in",
"chars",
":",
"if",
"char",
"in",
"string",
".",
"ascii_lowercase",
":",
"# log.critical(\"auto shift lowercase char %s to UPPERCASE\", repr(char))",
"char",
"=",
"c... | >>> invert_shift("a")
'A'
>>> invert_shift("A")
'a'
>>> invert_shift("123 foo 456 BAR #!")
'123 FOO 456 bar #!' | [
">>>",
"invert_shift",
"(",
"a",
")",
"A",
">>>",
"invert_shift",
"(",
"A",
")",
"a"
] | train | https://github.com/6809/dragonlib/blob/faa4011e76c5857db96efdb4199e2fd49711e999/dragonlib/utils/auto_shift.py#L17-L36 |
zloidemon/aiohttp_riak | aiohttp_riak/Bucket.py | Bucket.props_del | async def props_del(self):
""" Fix me after support 204 code in aiohttp """
endpoint = "{bucket}/props".format(bucket=self.path)
try:
async with self._client.delete(endpoint,
headers=self.headers) as r:
if r.status != 204:
... | python | async def props_del(self):
""" Fix me after support 204 code in aiohttp """
endpoint = "{bucket}/props".format(bucket=self.path)
try:
async with self._client.delete(endpoint,
headers=self.headers) as r:
if r.status != 204:
... | [
"async",
"def",
"props_del",
"(",
"self",
")",
":",
"endpoint",
"=",
"\"{bucket}/props\"",
".",
"format",
"(",
"bucket",
"=",
"self",
".",
"path",
")",
"try",
":",
"async",
"with",
"self",
".",
"_client",
".",
"delete",
"(",
"endpoint",
",",
"headers",
... | Fix me after support 204 code in aiohttp | [
"Fix",
"me",
"after",
"support",
"204",
"code",
"in",
"aiohttp"
] | train | https://github.com/zloidemon/aiohttp_riak/blob/221e8992cb318c1c3c1cb7def7bb4a75a9d35337/aiohttp_riak/Bucket.py#L74-L88 |
zloidemon/aiohttp_riak | aiohttp_riak/Bucket.py | Bucket.delete | async def delete(self, key):
""" Fix me after support 204 code in aiohttp """
try:
async with self._client.delete(self.path_keys(key)) as r:
if r.status not in [204, 404]:
return False
return True
except ContentEncodingError:
... | python | async def delete(self, key):
""" Fix me after support 204 code in aiohttp """
try:
async with self._client.delete(self.path_keys(key)) as r:
if r.status not in [204, 404]:
return False
return True
except ContentEncodingError:
... | [
"async",
"def",
"delete",
"(",
"self",
",",
"key",
")",
":",
"try",
":",
"async",
"with",
"self",
".",
"_client",
".",
"delete",
"(",
"self",
".",
"path_keys",
"(",
"key",
")",
")",
"as",
"r",
":",
"if",
"r",
".",
"status",
"not",
"in",
"[",
"2... | Fix me after support 204 code in aiohttp | [
"Fix",
"me",
"after",
"support",
"204",
"code",
"in",
"aiohttp"
] | train | https://github.com/zloidemon/aiohttp_riak/blob/221e8992cb318c1c3c1cb7def7bb4a75a9d35337/aiohttp_riak/Bucket.py#L139-L150 |
Zincr0/pyscrap | pyscrap/spiders.py | getJson | def getJson(url):
"""Download json and return simplejson object"""
site = urllib2.urlopen(url, timeout=300)
return json.load(site) | python | def getJson(url):
"""Download json and return simplejson object"""
site = urllib2.urlopen(url, timeout=300)
return json.load(site) | [
"def",
"getJson",
"(",
"url",
")",
":",
"site",
"=",
"urllib2",
".",
"urlopen",
"(",
"url",
",",
"timeout",
"=",
"300",
")",
"return",
"json",
".",
"load",
"(",
"site",
")"
] | Download json and return simplejson object | [
"Download",
"json",
"and",
"return",
"simplejson",
"object"
] | train | https://github.com/Zincr0/pyscrap/blob/69b4c2bd42dbec125444ad68a1f76168fab7607e/pyscrap/spiders.py#L43-L46 |
Zincr0/pyscrap | pyscrap/spiders.py | getWeb | def getWeb(url, isFeed):
"""Download url and parse it with lxml.
If "isFeed" is True returns lxml.etree
else, returns lxml.html
"""
socket.setdefaulttimeout(300)
loadedWeb = urllib2.build_opener()
loadedWeb.addheaders = getHeaders()
if isFeed:
web = etree.parse(loadedWeb.open(url... | python | def getWeb(url, isFeed):
"""Download url and parse it with lxml.
If "isFeed" is True returns lxml.etree
else, returns lxml.html
"""
socket.setdefaulttimeout(300)
loadedWeb = urllib2.build_opener()
loadedWeb.addheaders = getHeaders()
if isFeed:
web = etree.parse(loadedWeb.open(url... | [
"def",
"getWeb",
"(",
"url",
",",
"isFeed",
")",
":",
"socket",
".",
"setdefaulttimeout",
"(",
"300",
")",
"loadedWeb",
"=",
"urllib2",
".",
"build_opener",
"(",
")",
"loadedWeb",
".",
"addheaders",
"=",
"getHeaders",
"(",
")",
"if",
"isFeed",
":",
"web"... | Download url and parse it with lxml.
If "isFeed" is True returns lxml.etree
else, returns lxml.html | [
"Download",
"url",
"and",
"parse",
"it",
"with",
"lxml",
".",
"If",
"isFeed",
"is",
"True",
"returns",
"lxml",
".",
"etree",
"else",
"returns",
"lxml",
".",
"html"
] | train | https://github.com/Zincr0/pyscrap/blob/69b4c2bd42dbec125444ad68a1f76168fab7607e/pyscrap/spiders.py#L49-L61 |
Zincr0/pyscrap | pyscrap/spiders.py | rmSelf | def rmSelf(f):
"""f -> function.
Decorator, removes first argument from f parameters.
"""
def new_f(*args, **kwargs):
newArgs = args[1:]
result = f(*newArgs, **kwargs)
return result
return new_f | python | def rmSelf(f):
"""f -> function.
Decorator, removes first argument from f parameters.
"""
def new_f(*args, **kwargs):
newArgs = args[1:]
result = f(*newArgs, **kwargs)
return result
return new_f | [
"def",
"rmSelf",
"(",
"f",
")",
":",
"def",
"new_f",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"newArgs",
"=",
"args",
"[",
"1",
":",
"]",
"result",
"=",
"f",
"(",
"*",
"newArgs",
",",
"*",
"*",
"kwargs",
")",
"return",
"result",
"... | f -> function.
Decorator, removes first argument from f parameters. | [
"f",
"-",
">",
"function",
".",
"Decorator",
"removes",
"first",
"argument",
"from",
"f",
"parameters",
"."
] | train | https://github.com/Zincr0/pyscrap/blob/69b4c2bd42dbec125444ad68a1f76168fab7607e/pyscrap/spiders.py#L64-L72 |
Zincr0/pyscrap | pyscrap/spiders.py | catchItem | def catchItem(f, theSpider=None):
"""Decorador, ejecuta la función parse y procesa el resultado
como una lista de items, ejecutando la función 'saveitem' que corresponda."""
def new_f(*args, **kwargs):
#print("thepath "+os.getcwd())
#print("the spider")
#print(str(theSpider))
... | python | def catchItem(f, theSpider=None):
"""Decorador, ejecuta la función parse y procesa el resultado
como una lista de items, ejecutando la función 'saveitem' que corresponda."""
def new_f(*args, **kwargs):
#print("thepath "+os.getcwd())
#print("the spider")
#print(str(theSpider))
... | [
"def",
"catchItem",
"(",
"f",
",",
"theSpider",
"=",
"None",
")",
":",
"def",
"new_f",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"#print(\"thepath \"+os.getcwd())",
"#print(\"the spider\")",
"#print(str(theSpider))",
"items",
"=",
"f",
"(",
"*",
"... | Decorador, ejecuta la función parse y procesa el resultado
como una lista de items, ejecutando la función 'saveitem' que corresponda. | [
"Decorador",
"ejecuta",
"la",
"función",
"parse",
"y",
"procesa",
"el",
"resultado",
"como",
"una",
"lista",
"de",
"items",
"ejecutando",
"la",
"función",
"saveitem",
"que",
"corresponda",
"."
] | train | https://github.com/Zincr0/pyscrap/blob/69b4c2bd42dbec125444ad68a1f76168fab7607e/pyscrap/spiders.py#L119-L145 |
sbarham/dsrt | dsrt/data/transform/Padder.py | Padder.pad_dialogues | def pad_dialogues(self, dialogues):
"""
Pad the entire dataset.
This involves adding padding at the end of each sentence, and in the case of
a hierarchical model, it also involves adding padding at the end of each dialogue,
so that every training sample (dialogue) has the same di... | python | def pad_dialogues(self, dialogues):
"""
Pad the entire dataset.
This involves adding padding at the end of each sentence, and in the case of
a hierarchical model, it also involves adding padding at the end of each dialogue,
so that every training sample (dialogue) has the same di... | [
"def",
"pad_dialogues",
"(",
"self",
",",
"dialogues",
")",
":",
"self",
".",
"log",
"(",
"'info'",
",",
"'Padding the dialogues ...'",
")",
"return",
"[",
"self",
".",
"pad_dialogue",
"(",
"d",
")",
"for",
"d",
"in",
"dialogues",
"]"
] | Pad the entire dataset.
This involves adding padding at the end of each sentence, and in the case of
a hierarchical model, it also involves adding padding at the end of each dialogue,
so that every training sample (dialogue) has the same dimension. | [
"Pad",
"the",
"entire",
"dataset",
".",
"This",
"involves",
"adding",
"padding",
"at",
"the",
"end",
"of",
"each",
"sentence",
"and",
"in",
"the",
"case",
"of",
"a",
"hierarchical",
"model",
"it",
"also",
"involves",
"adding",
"padding",
"at",
"the",
"end"... | train | https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/dsrt/data/transform/Padder.py#L42-L51 |
roboogle/gtkmvc3 | gtkmvco/gtkmvc3/view.py | View.show | def show(self):
"""
Call `show()` on each top widget or `show_all()` if only one is known.
Otherwise does nothing.
"""
top = self.get_top_widget()
if isinstance(top, (list, tuple)):
for t in top:
if t is not None:
t.show()
... | python | def show(self):
"""
Call `show()` on each top widget or `show_all()` if only one is known.
Otherwise does nothing.
"""
top = self.get_top_widget()
if isinstance(top, (list, tuple)):
for t in top:
if t is not None:
t.show()
... | [
"def",
"show",
"(",
"self",
")",
":",
"top",
"=",
"self",
".",
"get_top_widget",
"(",
")",
"if",
"isinstance",
"(",
"top",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"for",
"t",
"in",
"top",
":",
"if",
"t",
"is",
"not",
"None",
":",
"t",
... | Call `show()` on each top widget or `show_all()` if only one is known.
Otherwise does nothing. | [
"Call",
"show",
"()",
"on",
"each",
"top",
"widget",
"or",
"show_all",
"()",
"if",
"only",
"one",
"is",
"known",
".",
"Otherwise",
"does",
"nothing",
"."
] | train | https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/view.py#L152-L163 |
roboogle/gtkmvc3 | gtkmvco/gtkmvc3/view.py | View.hide | def hide(self):
"""
Call `hide_all()` on all known top widgets.
"""
top = self.get_top_widget()
if isinstance(top, (list, tuple)):
for t in top:
if t is not None:
t.hide_all()
elif top is not None:
top.hide_all() | python | def hide(self):
"""
Call `hide_all()` on all known top widgets.
"""
top = self.get_top_widget()
if isinstance(top, (list, tuple)):
for t in top:
if t is not None:
t.hide_all()
elif top is not None:
top.hide_all() | [
"def",
"hide",
"(",
"self",
")",
":",
"top",
"=",
"self",
".",
"get_top_widget",
"(",
")",
"if",
"isinstance",
"(",
"top",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"for",
"t",
"in",
"top",
":",
"if",
"t",
"is",
"not",
"None",
":",
"t",
... | Call `hide_all()` on all known top widgets. | [
"Call",
"hide_all",
"()",
"on",
"all",
"known",
"top",
"widgets",
"."
] | train | https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/view.py#L165-L175 |
roboogle/gtkmvc3 | gtkmvco/gtkmvc3/view.py | View.set_parent_view | def set_parent_view(self, parent_view):
"""
Set ``self.``:meth:`get_top_widget` transient for
``parent_view.get_top_widget()``.
"""
top = self.get_top_widget()
if isinstance(top, (list, tuple)):
for t in top:
if t is not None:
... | python | def set_parent_view(self, parent_view):
"""
Set ``self.``:meth:`get_top_widget` transient for
``parent_view.get_top_widget()``.
"""
top = self.get_top_widget()
if isinstance(top, (list, tuple)):
for t in top:
if t is not None:
... | [
"def",
"set_parent_view",
"(",
"self",
",",
"parent_view",
")",
":",
"top",
"=",
"self",
".",
"get_top_widget",
"(",
")",
"if",
"isinstance",
"(",
"top",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"for",
"t",
"in",
"top",
":",
"if",
"t",
"is",
... | Set ``self.``:meth:`get_top_widget` transient for
``parent_view.get_top_widget()``. | [
"Set",
"self",
".",
":",
"meth",
":",
"get_top_widget",
"transient",
"for",
"parent_view",
".",
"get_top_widget",
"()",
"."
] | train | https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/view.py#L183-L194 |
roboogle/gtkmvc3 | gtkmvco/gtkmvc3/view.py | View.set_transient | def set_transient(self, transient_view):
"""
Set ``transient_view.get_top_widget()`` transient for
``self.``:meth:`get_top_widget`.
"""
top = self.get_top_widget()
if isinstance(top, (list, tuple)):
for t in top:
if t is not None:
... | python | def set_transient(self, transient_view):
"""
Set ``transient_view.get_top_widget()`` transient for
``self.``:meth:`get_top_widget`.
"""
top = self.get_top_widget()
if isinstance(top, (list, tuple)):
for t in top:
if t is not None:
... | [
"def",
"set_transient",
"(",
"self",
",",
"transient_view",
")",
":",
"top",
"=",
"self",
".",
"get_top_widget",
"(",
")",
"if",
"isinstance",
"(",
"top",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"for",
"t",
"in",
"top",
":",
"if",
"t",
"is",... | Set ``transient_view.get_top_widget()`` transient for
``self.``:meth:`get_top_widget`. | [
"Set",
"transient_view",
".",
"get_top_widget",
"()",
"transient",
"for",
"self",
".",
":",
"meth",
":",
"get_top_widget",
"."
] | train | https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/view.py#L196-L207 |
roboogle/gtkmvc3 | gtkmvco/gtkmvc3/view.py | View.__builder_connect_pending_signals | def __builder_connect_pending_signals(self):
"""Called internally to actually make the internal Gtk.Builder
instance connect all signals found in controllers controlling
self."""
class _MultiHandlersProxy (object):
def __init__(self, funcs): self.funcs = funcs
def... | python | def __builder_connect_pending_signals(self):
"""Called internally to actually make the internal Gtk.Builder
instance connect all signals found in controllers controlling
self."""
class _MultiHandlersProxy (object):
def __init__(self, funcs): self.funcs = funcs
def... | [
"def",
"__builder_connect_pending_signals",
"(",
"self",
")",
":",
"class",
"_MultiHandlersProxy",
"(",
"object",
")",
":",
"def",
"__init__",
"(",
"self",
",",
"funcs",
")",
":",
"self",
".",
"funcs",
"=",
"funcs",
"def",
"__call__",
"(",
"self",
",",
"*"... | Called internally to actually make the internal Gtk.Builder
instance connect all signals found in controllers controlling
self. | [
"Called",
"internally",
"to",
"actually",
"make",
"the",
"internal",
"Gtk",
".",
"Builder",
"instance",
"connect",
"all",
"signals",
"found",
"in",
"controllers",
"controlling",
"self",
"."
] | train | https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/view.py#L222-L243 |
roboogle/gtkmvc3 | gtkmvco/gtkmvc3/view.py | View._builder_connect_signals | def _builder_connect_signals(self, _dict):
"""Called by controllers which want to autoconnect their
handlers with signals declared in internal Gtk.Builder.
This method accumulates handlers, and books signal
autoconnection later on the idle of the next occurring gtk
loop. After t... | python | def _builder_connect_signals(self, _dict):
"""Called by controllers which want to autoconnect their
handlers with signals declared in internal Gtk.Builder.
This method accumulates handlers, and books signal
autoconnection later on the idle of the next occurring gtk
loop. After t... | [
"def",
"_builder_connect_signals",
"(",
"self",
",",
"_dict",
")",
":",
"assert",
"not",
"self",
".",
"builder_connected",
",",
"\"Gtk.Builder not already connected\"",
"if",
"_dict",
"and",
"not",
"self",
".",
"builder_pending_callbacks",
":",
"# this is the first call... | Called by controllers which want to autoconnect their
handlers with signals declared in internal Gtk.Builder.
This method accumulates handlers, and books signal
autoconnection later on the idle of the next occurring gtk
loop. After the autoconnection is done, this method cannot be
... | [
"Called",
"by",
"controllers",
"which",
"want",
"to",
"autoconnect",
"their",
"handlers",
"with",
"signals",
"declared",
"in",
"internal",
"Gtk",
".",
"Builder",
"."
] | train | https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/view.py#L245-L267 |
roboogle/gtkmvc3 | gtkmvco/gtkmvc3/view.py | View.__extract_autoWidgets | def __extract_autoWidgets(self):
"""Extract autoWidgets map if needed, out of the glade
specifications and gtk builder"""
if self.__autoWidgets_calculated: return
if self._builder is not None:
for wid in self._builder.get_objects():
# General workaround for i... | python | def __extract_autoWidgets(self):
"""Extract autoWidgets map if needed, out of the glade
specifications and gtk builder"""
if self.__autoWidgets_calculated: return
if self._builder is not None:
for wid in self._builder.get_objects():
# General workaround for i... | [
"def",
"__extract_autoWidgets",
"(",
"self",
")",
":",
"if",
"self",
".",
"__autoWidgets_calculated",
":",
"return",
"if",
"self",
".",
"_builder",
"is",
"not",
"None",
":",
"for",
"wid",
"in",
"self",
".",
"_builder",
".",
"get_objects",
"(",
")",
":",
... | Extract autoWidgets map if needed, out of the glade
specifications and gtk builder | [
"Extract",
"autoWidgets",
"map",
"if",
"needed",
"out",
"of",
"the",
"glade",
"specifications",
"and",
"gtk",
"builder"
] | train | https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/view.py#L284-L304 |
clef/clef-python | clef/clef.py | clef_error_check | def clef_error_check(func_to_decorate):
"""Return JSON decoded response from API call. Handle errors when bad response encountered."""
def wrapper(*args, **kwargs):
try:
response = func_to_decorate(*args, **kwargs)
except requests.exceptions.RequestException:
raise Connec... | python | def clef_error_check(func_to_decorate):
"""Return JSON decoded response from API call. Handle errors when bad response encountered."""
def wrapper(*args, **kwargs):
try:
response = func_to_decorate(*args, **kwargs)
except requests.exceptions.RequestException:
raise Connec... | [
"def",
"clef_error_check",
"(",
"func_to_decorate",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"response",
"=",
"func_to_decorate",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"except",
"requests",
... | Return JSON decoded response from API call. Handle errors when bad response encountered. | [
"Return",
"JSON",
"decoded",
"response",
"from",
"API",
"call",
".",
"Handle",
"errors",
"when",
"bad",
"response",
"encountered",
"."
] | train | https://github.com/clef/clef-python/blob/bee3cfd26c76fc9df64877b214181121f8bfad80/clef/clef.py#L29-L41 |
clef/clef-python | clef/clef.py | raise_right_error | def raise_right_error(response):
"""Raise appropriate error when bad response received."""
if response.status_code == 200:
return
if response.status_code == 500:
raise ServerError('Clef servers are down.')
if response.status_code == 403:
message = response.json().get('error')
... | python | def raise_right_error(response):
"""Raise appropriate error when bad response received."""
if response.status_code == 200:
return
if response.status_code == 500:
raise ServerError('Clef servers are down.')
if response.status_code == 403:
message = response.json().get('error')
... | [
"def",
"raise_right_error",
"(",
"response",
")",
":",
"if",
"response",
".",
"status_code",
"==",
"200",
":",
"return",
"if",
"response",
".",
"status_code",
"==",
"500",
":",
"raise",
"ServerError",
"(",
"'Clef servers are down.'",
")",
"if",
"response",
"."... | Raise appropriate error when bad response received. | [
"Raise",
"appropriate",
"error",
"when",
"bad",
"response",
"received",
"."
] | train | https://github.com/clef/clef-python/blob/bee3cfd26c76fc9df64877b214181121f8bfad80/clef/clef.py#L43-L64 |
clef/clef-python | clef/clef.py | ClefAPI._call | def _call(self, method, url, params):
"""Return response from Clef API call."""
request_params = {}
if method == 'GET':
request_params['params'] = params
elif method == 'POST':
request_params['data'] = params
response = requests.request(method, url, **requ... | python | def _call(self, method, url, params):
"""Return response from Clef API call."""
request_params = {}
if method == 'GET':
request_params['params'] = params
elif method == 'POST':
request_params['data'] = params
response = requests.request(method, url, **requ... | [
"def",
"_call",
"(",
"self",
",",
"method",
",",
"url",
",",
"params",
")",
":",
"request_params",
"=",
"{",
"}",
"if",
"method",
"==",
"'GET'",
":",
"request_params",
"[",
"'params'",
"]",
"=",
"params",
"elif",
"method",
"==",
"'POST'",
":",
"request... | Return response from Clef API call. | [
"Return",
"response",
"from",
"Clef",
"API",
"call",
"."
] | train | https://github.com/clef/clef-python/blob/bee3cfd26c76fc9df64877b214181121f8bfad80/clef/clef.py#L80-L88 |
clef/clef-python | clef/clef.py | ClefAPI.get_login_information | def get_login_information(self, code=None):
"""Return Clef user info after exchanging code for OAuth token."""
# do the handshake to get token
access_token = self._get_access_token(code)
# make request with token to get user details
return self._get_user_info(access_token) | python | def get_login_information(self, code=None):
"""Return Clef user info after exchanging code for OAuth token."""
# do the handshake to get token
access_token = self._get_access_token(code)
# make request with token to get user details
return self._get_user_info(access_token) | [
"def",
"get_login_information",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"# do the handshake to get token",
"access_token",
"=",
"self",
".",
"_get_access_token",
"(",
"code",
")",
"# make request with token to get user details",
"return",
"self",
".",
"_get_use... | Return Clef user info after exchanging code for OAuth token. | [
"Return",
"Clef",
"user",
"info",
"after",
"exchanging",
"code",
"for",
"OAuth",
"token",
"."
] | train | https://github.com/clef/clef-python/blob/bee3cfd26c76fc9df64877b214181121f8bfad80/clef/clef.py#L90-L95 |
clef/clef-python | clef/clef.py | ClefAPI._get_user_info | def _get_user_info(self, access_token):
"""Return Clef user info."""
info_response = self._call('GET', self.info_url, params={'access_token': access_token})
user_info = info_response.get('info')
return user_info | python | def _get_user_info(self, access_token):
"""Return Clef user info."""
info_response = self._call('GET', self.info_url, params={'access_token': access_token})
user_info = info_response.get('info')
return user_info | [
"def",
"_get_user_info",
"(",
"self",
",",
"access_token",
")",
":",
"info_response",
"=",
"self",
".",
"_call",
"(",
"'GET'",
",",
"self",
".",
"info_url",
",",
"params",
"=",
"{",
"'access_token'",
":",
"access_token",
"}",
")",
"user_info",
"=",
"info_r... | Return Clef user info. | [
"Return",
"Clef",
"user",
"info",
"."
] | train | https://github.com/clef/clef-python/blob/bee3cfd26c76fc9df64877b214181121f8bfad80/clef/clef.py#L107-L111 |
clef/clef-python | clef/clef.py | ClefAPI.get_logout_information | def get_logout_information(self, logout_token):
"""Return Clef user info after exchanging logout token."""
data = dict(logout_token=logout_token, app_id=self.app_id, app_secret=self.app_secret)
logout_response = self._call('POST', self.logout_url, params=data)
clef_user_id = logout_respo... | python | def get_logout_information(self, logout_token):
"""Return Clef user info after exchanging logout token."""
data = dict(logout_token=logout_token, app_id=self.app_id, app_secret=self.app_secret)
logout_response = self._call('POST', self.logout_url, params=data)
clef_user_id = logout_respo... | [
"def",
"get_logout_information",
"(",
"self",
",",
"logout_token",
")",
":",
"data",
"=",
"dict",
"(",
"logout_token",
"=",
"logout_token",
",",
"app_id",
"=",
"self",
".",
"app_id",
",",
"app_secret",
"=",
"self",
".",
"app_secret",
")",
"logout_response",
... | Return Clef user info after exchanging logout token. | [
"Return",
"Clef",
"user",
"info",
"after",
"exchanging",
"logout",
"token",
"."
] | train | https://github.com/clef/clef-python/blob/bee3cfd26c76fc9df64877b214181121f8bfad80/clef/clef.py#L113-L118 |
roboogle/gtkmvc3 | gtkmvco/gtkmvc3/observer.py | observes | def observes(*args):
"""
Decorate a method in an :class:`Observer` subclass as a notification.
Takes one to many property names as strings. If any of them changes
in a model we observe, the method is called. The name of the property
will be passed to the method.
The type of notification is infe... | python | def observes(*args):
"""
Decorate a method in an :class:`Observer` subclass as a notification.
Takes one to many property names as strings. If any of them changes
in a model we observe, the method is called. The name of the property
will be passed to the method.
The type of notification is infe... | [
"def",
"observes",
"(",
"*",
"args",
")",
":",
"@",
"decorators",
".",
"good_decorator",
"def",
"_decorator",
"(",
"_notified",
")",
":",
"# marks the method with observed properties",
"_list",
"=",
"getattr",
"(",
"_notified",
",",
"Observer",
".",
"_CUST_OBS_",
... | Decorate a method in an :class:`Observer` subclass as a notification.
Takes one to many property names as strings. If any of them changes
in a model we observe, the method is called. The name of the property
will be passed to the method.
The type of notification is inferred from the number of arguments... | [
"Decorate",
"a",
"method",
"in",
"an",
":",
"class",
":",
"Observer",
"subclass",
"as",
"a",
"notification",
".",
"Takes",
"one",
"to",
"many",
"property",
"names",
"as",
"strings",
".",
"If",
"any",
"of",
"them",
"changes",
"in",
"a",
"model",
"we",
"... | train | https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/observer.py#L68-L136 |
roboogle/gtkmvc3 | gtkmvco/gtkmvc3/observer.py | Observer.observe | def observe(cls, *args, **kwargs):
"""
Mark a method as receiving notifications. Comes in two flavours:
.. method:: observe(name, **types)
:noindex:
A decorator living in the class. Can be applied more than once to
the same method, provided the names differ.
... | python | def observe(cls, *args, **kwargs):
"""
Mark a method as receiving notifications. Comes in two flavours:
.. method:: observe(name, **types)
:noindex:
A decorator living in the class. Can be applied more than once to
the same method, provided the names differ.
... | [
"def",
"observe",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"@",
"decorators",
".",
"good_decorator",
"def",
"_decorator",
"(",
"_notified",
")",
":",
"# marks the method with observed properties",
"_list",
"=",
"getattr",
"(",
"_notifie... | Mark a method as receiving notifications. Comes in two flavours:
.. method:: observe(name, **types)
:noindex:
A decorator living in the class. Can be applied more than once to
the same method, provided the names differ.
*name* is the property we want to be notified... | [
"Mark",
"a",
"method",
"as",
"receiving",
"notifications",
".",
"Comes",
"in",
"two",
"flavours",
":"
] | train | https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/observer.py#L158-L255 |
roboogle/gtkmvc3 | gtkmvco/gtkmvc3/observer.py | Observer.get_observing_methods | def get_observing_methods(self, prop_name):
"""
Return a possibly empty set of callables registered with
:meth:`observe` for *prop_name*. The returned set includes
those notifications which have been registered by means of
patterns matching prop_name.
.. versionadded:: 1... | python | def get_observing_methods(self, prop_name):
"""
Return a possibly empty set of callables registered with
:meth:`observe` for *prop_name*. The returned set includes
those notifications which have been registered by means of
patterns matching prop_name.
.. versionadded:: 1... | [
"def",
"get_observing_methods",
"(",
"self",
",",
"prop_name",
")",
":",
"# searches in pattern and in map",
"return",
"(",
"functools",
".",
"reduce",
"(",
"set",
".",
"union",
",",
"(",
"meths",
"for",
"pat",
",",
"meths",
"in",
"self",
".",
"__PAT_TO_METHS"... | Return a possibly empty set of callables registered with
:meth:`observe` for *prop_name*. The returned set includes
those notifications which have been registered by means of
patterns matching prop_name.
.. versionadded:: 1.99.1
Replaces :meth:`get_custom_observing_methods`. | [
"Return",
"a",
"possibly",
"empty",
"set",
"of",
"callables",
"registered",
"with",
":",
"meth",
":",
"observe",
"for",
"*",
"prop_name",
"*",
".",
"The",
"returned",
"set",
"includes",
"those",
"notifications",
"which",
"have",
"been",
"registered",
"by",
"... | train | https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/observer.py#L355-L371 |
roboogle/gtkmvc3 | gtkmvco/gtkmvc3/observer.py | Observer.get_observing_method_kwargs | def get_observing_method_kwargs(self, prop_name, method):
"""
Returns the keyword arguments which were specified when
declaring a notification method, either statically or
dynamically with :meth:`Observer.observe`.
Since patterns may be involved when declaring the
notifi... | python | def get_observing_method_kwargs(self, prop_name, method):
"""
Returns the keyword arguments which were specified when
declaring a notification method, either statically or
dynamically with :meth:`Observer.observe`.
Since patterns may be involved when declaring the
notifi... | [
"def",
"get_observing_method_kwargs",
"(",
"self",
",",
"prop_name",
",",
"method",
")",
":",
"# exact match have precedence",
"if",
"(",
"prop_name",
",",
"method",
")",
"in",
"self",
".",
"__PAT_METH_TO_KWARGS",
":",
"return",
"self",
".",
"__PAT_METH_TO_KWARGS",
... | Returns the keyword arguments which were specified when
declaring a notification method, either statically or
dynamically with :meth:`Observer.observe`.
Since patterns may be involved when declaring the
notifications, first exact match is checked, and then the
single-allowed pat... | [
"Returns",
"the",
"keyword",
"arguments",
"which",
"were",
"specified",
"when",
"declaring",
"a",
"notification",
"method",
"either",
"statically",
"or",
"dynamically",
"with",
":",
"meth",
":",
"Observer",
".",
"observe",
"."
] | train | https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/observer.py#L376-L399 |
roboogle/gtkmvc3 | gtkmvco/gtkmvc3/observer.py | Observer.remove_observing_method | def remove_observing_method(self, prop_names, method):
"""
Remove dynamic notifications.
*method* a callable that was registered with :meth:`observe`.
*prop_names* a sequence of strings. This need not correspond to any
one `observe` call.
.. note::
This can... | python | def remove_observing_method(self, prop_names, method):
"""
Remove dynamic notifications.
*method* a callable that was registered with :meth:`observe`.
*prop_names* a sequence of strings. This need not correspond to any
one `observe` call.
.. note::
This can... | [
"def",
"remove_observing_method",
"(",
"self",
",",
"prop_names",
",",
"method",
")",
":",
"for",
"prop_name",
"in",
"prop_names",
":",
"if",
"prop_name",
"in",
"self",
".",
"__PROP_TO_METHS",
":",
"# exact match",
"self",
".",
"__PROP_TO_METHS",
"[",
"prop_name... | Remove dynamic notifications.
*method* a callable that was registered with :meth:`observe`.
*prop_names* a sequence of strings. This need not correspond to any
one `observe` call.
.. note::
This can revert even the effects of decorator `observe` at
runtime. Don'... | [
"Remove",
"dynamic",
"notifications",
"."
] | train | https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/observer.py#L401-L427 |
roboogle/gtkmvc3 | gtkmvco/gtkmvc3/observer.py | Observer.is_observing_method | def is_observing_method(self, prop_name, method):
"""
Returns `True` if the given method was previously added as an
observing method, either dynamically or via decorator.
"""
if (prop_name, method) in self.__PAT_METH_TO_KWARGS:
return True
if method in self.__... | python | def is_observing_method(self, prop_name, method):
"""
Returns `True` if the given method was previously added as an
observing method, either dynamically or via decorator.
"""
if (prop_name, method) in self.__PAT_METH_TO_KWARGS:
return True
if method in self.__... | [
"def",
"is_observing_method",
"(",
"self",
",",
"prop_name",
",",
"method",
")",
":",
"if",
"(",
"prop_name",
",",
"method",
")",
"in",
"self",
".",
"__PAT_METH_TO_KWARGS",
":",
"return",
"True",
"if",
"method",
"in",
"self",
".",
"__METH_TO_PAT",
":",
"pa... | Returns `True` if the given method was previously added as an
observing method, either dynamically or via decorator. | [
"Returns",
"True",
"if",
"the",
"given",
"method",
"was",
"previously",
"added",
"as",
"an",
"observing",
"method",
"either",
"dynamically",
"or",
"via",
"decorator",
"."
] | train | https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/observer.py#L429-L441 |
roboogle/gtkmvc3 | gtkmvco/gtkmvc3/observer.py | Observer.__register_notification | def __register_notification(self, prop_name, method, kwargs):
"""Internal service which associates the given property name
to the method, and the (prop_name, method) with the given
kwargs dictionary. If needed merges the dictionary, if the
given (prop_name, method) pair was already regis... | python | def __register_notification(self, prop_name, method, kwargs):
"""Internal service which associates the given property name
to the method, and the (prop_name, method) with the given
kwargs dictionary. If needed merges the dictionary, if the
given (prop_name, method) pair was already regis... | [
"def",
"__register_notification",
"(",
"self",
",",
"prop_name",
",",
"method",
",",
"kwargs",
")",
":",
"key",
"=",
"(",
"prop_name",
",",
"method",
")",
"if",
"key",
"in",
"self",
".",
"__PAT_METH_TO_KWARGS",
":",
"raise",
"ValueError",
"(",
"\"In class %s... | Internal service which associates the given property name
to the method, and the (prop_name, method) with the given
kwargs dictionary. If needed merges the dictionary, if the
given (prop_name, method) pair was already registered (in this
case the last registration wins in case of overlap... | [
"Internal",
"service",
"which",
"associates",
"the",
"given",
"property",
"name",
"to",
"the",
"method",
"and",
"the",
"(",
"prop_name",
"method",
")",
"with",
"the",
"given",
"kwargs",
"dictionary",
".",
"If",
"needed",
"merges",
"the",
"dictionary",
"if",
... | train | https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/observer.py#L443-L497 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | ListItemData.data | def data(self, column, role):
"""Return the data for the specified column and role
For DisplayRole the element in the list will be converted to a sting and returned.
:param column: the data column
:type column: int
:param role: the data role
:type role: QtCore.Qt.ItemDa... | python | def data(self, column, role):
"""Return the data for the specified column and role
For DisplayRole the element in the list will be converted to a sting and returned.
:param column: the data column
:type column: int
:param role: the data role
:type role: QtCore.Qt.ItemDa... | [
"def",
"data",
"(",
"self",
",",
"column",
",",
"role",
")",
":",
"if",
"role",
"==",
"QtCore",
".",
"Qt",
".",
"DisplayRole",
":",
"if",
"column",
">=",
"0",
"and",
"column",
"<",
"len",
"(",
"self",
".",
"_list",
")",
":",
"return",
"str",
"(",... | Return the data for the specified column and role
For DisplayRole the element in the list will be converted to a sting and returned.
:param column: the data column
:type column: int
:param role: the data role
:type role: QtCore.Qt.ItemDataRole
:returns: data depending o... | [
"Return",
"the",
"data",
"for",
"the",
"specified",
"column",
"and",
"role"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L122-L137 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | ListItemData.set_data | def set_data(self, column, value, role):
"""Set the data for the given column to value
The default implementation returns False
:param column: the column to set
:type column: int
:param value: the value to set
:param role: the role, usually EditRole
:type role: ... | python | def set_data(self, column, value, role):
"""Set the data for the given column to value
The default implementation returns False
:param column: the column to set
:type column: int
:param value: the value to set
:param role: the role, usually EditRole
:type role: ... | [
"def",
"set_data",
"(",
"self",
",",
"column",
",",
"value",
",",
"role",
")",
":",
"if",
"role",
"==",
"QtCore",
".",
"Qt",
".",
"EditRole",
"or",
"role",
"==",
"QtCore",
".",
"Qt",
".",
"DisplayRole",
":",
"self",
".",
"_list",
"[",
"column",
"]"... | Set the data for the given column to value
The default implementation returns False
:param column: the column to set
:type column: int
:param value: the value to set
:param role: the role, usually EditRole
:type role: :class:`QtCore.Qt.ItemDataRole`
:returns: Tr... | [
"Set",
"the",
"data",
"for",
"the",
"given",
"column",
"to",
"value"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L139-L157 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | ListItemData.flags | def flags(self, column):
"""Return the item flags for the item
Default is QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable
:param column: the column to query
:type column: int
:returns: the item flags
:rtype: QtCore.Qt.ItemFlags
:raises: None
"""
... | python | def flags(self, column):
"""Return the item flags for the item
Default is QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable
:param column: the column to query
:type column: int
:returns: the item flags
:rtype: QtCore.Qt.ItemFlags
:raises: None
"""
... | [
"def",
"flags",
"(",
"self",
",",
"column",
")",
":",
"flags",
"=",
"QtCore",
".",
"Qt",
".",
"ItemIsEnabled",
"|",
"QtCore",
".",
"Qt",
".",
"ItemIsSelectable",
"if",
"self",
".",
"_editable",
":",
"flags",
"=",
"flags",
"|",
"QtCore",
".",
"Qt",
".... | Return the item flags for the item
Default is QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable
:param column: the column to query
:type column: int
:returns: the item flags
:rtype: QtCore.Qt.ItemFlags
:raises: None | [
"Return",
"the",
"item",
"flags",
"for",
"the",
"item"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L177-L191 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | TreeItem.set_model | def set_model(self, model):
"""Set the model the item belongs to
A TreeItem can only belong to one model.
:param model: the model the item belongs to
:type model: :class:`Treemodel`
:returns: None
:rtype: None
:raises: None
"""
self._model = mode... | python | def set_model(self, model):
"""Set the model the item belongs to
A TreeItem can only belong to one model.
:param model: the model the item belongs to
:type model: :class:`Treemodel`
:returns: None
:rtype: None
:raises: None
"""
self._model = mode... | [
"def",
"set_model",
"(",
"self",
",",
"model",
")",
":",
"self",
".",
"_model",
"=",
"model",
"for",
"c",
"in",
"self",
".",
"childItems",
":",
"c",
".",
"set_model",
"(",
"model",
")"
] | Set the model the item belongs to
A TreeItem can only belong to one model.
:param model: the model the item belongs to
:type model: :class:`Treemodel`
:returns: None
:rtype: None
:raises: None | [
"Set",
"the",
"model",
"the",
"item",
"belongs",
"to"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L241-L254 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | TreeItem.add_child | def add_child(self, child):
"""Add child to children of this TreeItem
:param child: the child TreeItem
:type child: :class:`TreeItem`
:returns: None
:rtype: None
:raises: None
"""
child.set_model(self._model)
if self._model:
row = len(... | python | def add_child(self, child):
"""Add child to children of this TreeItem
:param child: the child TreeItem
:type child: :class:`TreeItem`
:returns: None
:rtype: None
:raises: None
"""
child.set_model(self._model)
if self._model:
row = len(... | [
"def",
"add_child",
"(",
"self",
",",
"child",
")",
":",
"child",
".",
"set_model",
"(",
"self",
".",
"_model",
")",
"if",
"self",
".",
"_model",
":",
"row",
"=",
"len",
"(",
"self",
".",
"childItems",
")",
"parentindex",
"=",
"self",
".",
"_model",
... | Add child to children of this TreeItem
:param child: the child TreeItem
:type child: :class:`TreeItem`
:returns: None
:rtype: None
:raises: None | [
"Add",
"child",
"to",
"children",
"of",
"this",
"TreeItem"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L256-L271 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | TreeItem.remove_child | def remove_child(self, child):
"""Remove the child from this TreeItem
:param child: the child TreeItem
:type child: :class:`TreeItem`
:returns: None
:rtype: None
:raises: ValueError
"""
child.set_model(None)
if self._model:
row = self.... | python | def remove_child(self, child):
"""Remove the child from this TreeItem
:param child: the child TreeItem
:type child: :class:`TreeItem`
:returns: None
:rtype: None
:raises: ValueError
"""
child.set_model(None)
if self._model:
row = self.... | [
"def",
"remove_child",
"(",
"self",
",",
"child",
")",
":",
"child",
".",
"set_model",
"(",
"None",
")",
"if",
"self",
".",
"_model",
":",
"row",
"=",
"self",
".",
"childItems",
".",
"index",
"(",
"child",
")",
"parentindex",
"=",
"self",
".",
"_mode... | Remove the child from this TreeItem
:param child: the child TreeItem
:type child: :class:`TreeItem`
:returns: None
:rtype: None
:raises: ValueError | [
"Remove",
"the",
"child",
"from",
"this",
"TreeItem"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L273-L288 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | TreeItem.column_count | def column_count(self, ):
"""Return the number of columns that the children have
If there are no children, return the column count of its own data.
:returns: the column count of the children data
:rtype: int
:raises: None
"""
if self.child_count():
r... | python | def column_count(self, ):
"""Return the number of columns that the children have
If there are no children, return the column count of its own data.
:returns: the column count of the children data
:rtype: int
:raises: None
"""
if self.child_count():
r... | [
"def",
"column_count",
"(",
"self",
",",
")",
":",
"if",
"self",
".",
"child_count",
"(",
")",
":",
"return",
"self",
".",
"childItems",
"[",
"0",
"]",
".",
"_data",
".",
"column_count",
"(",
")",
"else",
":",
"return",
"self",
".",
"_data",
".",
"... | Return the number of columns that the children have
If there are no children, return the column count of its own data.
:returns: the column count of the children data
:rtype: int
:raises: None | [
"Return",
"the",
"number",
"of",
"columns",
"that",
"the",
"children",
"have"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L321-L333 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | TreeItem.data | def data(self, column, role):
"""Return the data for the column and role
:param column: the data column
:type column: int
:param role: the data role
:type role: QtCore.Qt.ItemDataRole
:returns: data depending on the role
:rtype:
:raises: None
"""
... | python | def data(self, column, role):
"""Return the data for the column and role
:param column: the data column
:type column: int
:param role: the data role
:type role: QtCore.Qt.ItemDataRole
:returns: data depending on the role
:rtype:
:raises: None
"""
... | [
"def",
"data",
"(",
"self",
",",
"column",
",",
"role",
")",
":",
"if",
"self",
".",
"_data",
"is",
"not",
"None",
"and",
"(",
"column",
">=",
"0",
"or",
"column",
"<",
"self",
".",
"_data",
".",
"column_count",
"(",
")",
")",
":",
"return",
"sel... | Return the data for the column and role
:param column: the data column
:type column: int
:param role: the data role
:type role: QtCore.Qt.ItemDataRole
:returns: data depending on the role
:rtype:
:raises: None | [
"Return",
"the",
"data",
"for",
"the",
"column",
"and",
"role"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L335-L347 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | TreeItem.set_data | def set_data(self, column, value, role):
"""Set the data of column to value
:param column: the column to set
:type column: int
:param value: the value to set
:param role: the role, usually EditRole
:type role: :class:`QtCore.Qt.ItemDataRole`
:returns: True, if da... | python | def set_data(self, column, value, role):
"""Set the data of column to value
:param column: the column to set
:type column: int
:param value: the value to set
:param role: the role, usually EditRole
:type role: :class:`QtCore.Qt.ItemDataRole`
:returns: True, if da... | [
"def",
"set_data",
"(",
"self",
",",
"column",
",",
"value",
",",
"role",
")",
":",
"if",
"not",
"self",
".",
"_data",
"or",
"column",
">=",
"self",
".",
"_data",
".",
"column_count",
"(",
")",
":",
"return",
"False",
"return",
"self",
".",
"_data",
... | Set the data of column to value
:param column: the column to set
:type column: int
:param value: the value to set
:param role: the role, usually EditRole
:type role: :class:`QtCore.Qt.ItemDataRole`
:returns: True, if data successfully changed
:rtype: :class:`bool... | [
"Set",
"the",
"data",
"of",
"column",
"to",
"value"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L349-L363 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | TreeItem.set_parent | def set_parent(self, parent):
"""Set the parent of the treeitem
:param parent: parent treeitem
:type parent: :class:`TreeItem` | None
:returns: None
:rtype: None
:raises: None
"""
if self._parent == parent:
return
if self._parent:
... | python | def set_parent(self, parent):
"""Set the parent of the treeitem
:param parent: parent treeitem
:type parent: :class:`TreeItem` | None
:returns: None
:rtype: None
:raises: None
"""
if self._parent == parent:
return
if self._parent:
... | [
"def",
"set_parent",
"(",
"self",
",",
"parent",
")",
":",
"if",
"self",
".",
"_parent",
"==",
"parent",
":",
"return",
"if",
"self",
".",
"_parent",
":",
"self",
".",
"_parent",
".",
"remove_child",
"(",
"self",
")",
"self",
".",
"_parent",
"=",
"pa... | Set the parent of the treeitem
:param parent: parent treeitem
:type parent: :class:`TreeItem` | None
:returns: None
:rtype: None
:raises: None | [
"Set",
"the",
"parent",
"of",
"the",
"treeitem"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L374-L389 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | TreeModel.index | def index(self, row, column, parent=None):
"""Return the index of the item in the model specified by the given row,
column and parent index.
:param row: the row of the item
:type row: int
:param column: the column for the item
:type column: int
:param parent: the... | python | def index(self, row, column, parent=None):
"""Return the index of the item in the model specified by the given row,
column and parent index.
:param row: the row of the item
:type row: int
:param column: the column for the item
:type column: int
:param parent: the... | [
"def",
"index",
"(",
"self",
",",
"row",
",",
"column",
",",
"parent",
"=",
"None",
")",
":",
"if",
"parent",
"is",
"None",
":",
"parent",
"=",
"QtCore",
".",
"QModelIndex",
"(",
")",
"if",
"not",
"self",
".",
"hasIndex",
"(",
"row",
",",
"column",... | Return the index of the item in the model specified by the given row,
column and parent index.
:param row: the row of the item
:type row: int
:param column: the column for the item
:type column: int
:param parent: the parent index
:type parent: :class:`QtCore.QMo... | [
"Return",
"the",
"index",
"of",
"the",
"item",
"in",
"the",
"model",
"specified",
"by",
"the",
"given",
"row",
"column",
"and",
"parent",
"index",
"."
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L454-L482 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | TreeModel.rowCount | def rowCount(self, parent):
"""Return the number of rows under the given parent.
When the parent is valid return rowCount the number
of children of parent.
:param parent: the parent index
:type parent: :class:`QtCore.QModelIndex`:
:returns: the row count
:rtype: ... | python | def rowCount(self, parent):
"""Return the number of rows under the given parent.
When the parent is valid return rowCount the number
of children of parent.
:param parent: the parent index
:type parent: :class:`QtCore.QModelIndex`:
:returns: the row count
:rtype: ... | [
"def",
"rowCount",
"(",
"self",
",",
"parent",
")",
":",
"if",
"parent",
".",
"column",
"(",
")",
">",
"0",
":",
"return",
"0",
"if",
"not",
"parent",
".",
"isValid",
"(",
")",
":",
"parentItem",
"=",
"self",
".",
"_root",
"else",
":",
"parentItem"... | Return the number of rows under the given parent.
When the parent is valid return rowCount the number
of children of parent.
:param parent: the parent index
:type parent: :class:`QtCore.QModelIndex`:
:returns: the row count
:rtype: int
:raises: None | [
"Return",
"the",
"number",
"of",
"rows",
"under",
"the",
"given",
"parent",
".",
"When",
"the",
"parent",
"is",
"valid",
"return",
"rowCount",
"the",
"number",
"of",
"children",
"of",
"parent",
"."
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L502-L519 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | TreeModel.columnCount | def columnCount(self, parent):
"""Return the number of columns for the children of the given parent.
:param parent: the parent index
:type parent: :class:`QtCore.QModelIndex`:
:returns: the column count
:rtype: int
:raises: None
"""
if parent.isValid():
... | python | def columnCount(self, parent):
"""Return the number of columns for the children of the given parent.
:param parent: the parent index
:type parent: :class:`QtCore.QModelIndex`:
:returns: the column count
:rtype: int
:raises: None
"""
if parent.isValid():
... | [
"def",
"columnCount",
"(",
"self",
",",
"parent",
")",
":",
"if",
"parent",
".",
"isValid",
"(",
")",
":",
"return",
"parent",
".",
"internalPointer",
"(",
")",
".",
"column_count",
"(",
")",
"else",
":",
"return",
"self",
".",
"_root",
".",
"column_co... | Return the number of columns for the children of the given parent.
:param parent: the parent index
:type parent: :class:`QtCore.QModelIndex`:
:returns: the column count
:rtype: int
:raises: None | [
"Return",
"the",
"number",
"of",
"columns",
"for",
"the",
"children",
"of",
"the",
"given",
"parent",
"."
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L521-L533 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | TreeModel.setData | def setData(self, index, value, role=QtCore.Qt.EditRole):
"""Set the data of the given index to value
:param index: the index to set
:type index: :class:`QtCore.QModelIndex`
:param value: the value to set
:param role: the role, usually edit role
:type role: :data:`QtCore... | python | def setData(self, index, value, role=QtCore.Qt.EditRole):
"""Set the data of the given index to value
:param index: the index to set
:type index: :class:`QtCore.QModelIndex`
:param value: the value to set
:param role: the role, usually edit role
:type role: :data:`QtCore... | [
"def",
"setData",
"(",
"self",
",",
"index",
",",
"value",
",",
"role",
"=",
"QtCore",
".",
"Qt",
".",
"EditRole",
")",
":",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
":",
"return",
"False",
"item",
"=",
"index",
".",
"internalPointer",
"(",
... | Set the data of the given index to value
:param index: the index to set
:type index: :class:`QtCore.QModelIndex`
:param value: the value to set
:param role: the role, usually edit role
:type role: :data:`QtCore.Qt.ItemDataRole`
:returns: True, if successfull, False if un... | [
"Set",
"the",
"data",
"of",
"the",
"given",
"index",
"to",
"value"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L550-L568 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | TreeModel.headerData | def headerData(self, section, orientation, role):
"""Return the header data
Will call :meth:`TreeItem.data` of the root :class:`TreeItem` with the
given section (column) and role for horizontal orientations.
Vertical orientations are numbered.
:param section: the section in th... | python | def headerData(self, section, orientation, role):
"""Return the header data
Will call :meth:`TreeItem.data` of the root :class:`TreeItem` with the
given section (column) and role for horizontal orientations.
Vertical orientations are numbered.
:param section: the section in th... | [
"def",
"headerData",
"(",
"self",
",",
"section",
",",
"orientation",
",",
"role",
")",
":",
"if",
"orientation",
"==",
"QtCore",
".",
"Qt",
".",
"Horizontal",
":",
"d",
"=",
"self",
".",
"_root",
".",
"data",
"(",
"section",
",",
"role",
")",
"if",
... | Return the header data
Will call :meth:`TreeItem.data` of the root :class:`TreeItem` with the
given section (column) and role for horizontal orientations.
Vertical orientations are numbered.
:param section: the section in the header view
:type section: int
:param orien... | [
"Return",
"the",
"header",
"data"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L570-L593 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | TreeModel.insertRow | def insertRow(self, row, item, parent):
"""Insert a single item before the given row in the child items of the parent specified.
:param row: the index where the rows get inserted
:type row: int
:param item: the item to insert. When creating the item, make sure it's parent is None.
... | python | def insertRow(self, row, item, parent):
"""Insert a single item before the given row in the child items of the parent specified.
:param row: the index where the rows get inserted
:type row: int
:param item: the item to insert. When creating the item, make sure it's parent is None.
... | [
"def",
"insertRow",
"(",
"self",
",",
"row",
",",
"item",
",",
"parent",
")",
":",
"item",
".",
"set_model",
"(",
"self",
")",
"if",
"parent",
".",
"isValid",
"(",
")",
":",
"parentitem",
"=",
"parent",
".",
"internalPointer",
"(",
")",
"else",
":",
... | Insert a single item before the given row in the child items of the parent specified.
:param row: the index where the rows get inserted
:type row: int
:param item: the item to insert. When creating the item, make sure it's parent is None.
If not it will defeat the purpose o... | [
"Insert",
"a",
"single",
"item",
"before",
"the",
"given",
"row",
"in",
"the",
"child",
"items",
"of",
"the",
"parent",
"specified",
"."
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L595-L619 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | TreeModel.removeRow | def removeRow(self, row, parent):
"""Remove row from parent
:param row: the row index
:type row: int
:param parent: the parent index
:type parent: :class:`QtCore.QModelIndex`
:returns: True if row is inserted; otherwise returns false.
:rtype: bool
:raises... | python | def removeRow(self, row, parent):
"""Remove row from parent
:param row: the row index
:type row: int
:param parent: the parent index
:type parent: :class:`QtCore.QModelIndex`
:returns: True if row is inserted; otherwise returns false.
:rtype: bool
:raises... | [
"def",
"removeRow",
"(",
"self",
",",
"row",
",",
"parent",
")",
":",
"if",
"parent",
".",
"isValid",
"(",
")",
":",
"parentitem",
"=",
"parent",
".",
"internalPointer",
"(",
")",
"else",
":",
"parentitem",
"=",
"self",
".",
"_root",
"self",
".",
"be... | Remove row from parent
:param row: the row index
:type row: int
:param parent: the parent index
:type parent: :class:`QtCore.QModelIndex`
:returns: True if row is inserted; otherwise returns false.
:rtype: bool
:raises: None | [
"Remove",
"row",
"from",
"parent"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L621-L642 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | TreeModel.flags | def flags(self, index):
"""Return the flags for the given index
This will call :meth:`TreeItem.flags` for valid ones.
:param index: the index to query
:type index: :class:`QtCore.QModelIndex`
:returns: None
:rtype: None
:raises: None
"""
if index... | python | def flags(self, index):
"""Return the flags for the given index
This will call :meth:`TreeItem.flags` for valid ones.
:param index: the index to query
:type index: :class:`QtCore.QModelIndex`
:returns: None
:rtype: None
:raises: None
"""
if index... | [
"def",
"flags",
"(",
"self",
",",
"index",
")",
":",
"if",
"index",
".",
"isValid",
"(",
")",
":",
"item",
"=",
"index",
".",
"internalPointer",
"(",
")",
"return",
"item",
".",
"flags",
"(",
"index",
")",
"else",
":",
"super",
"(",
"TreeModel",
",... | Return the flags for the given index
This will call :meth:`TreeItem.flags` for valid ones.
:param index: the index to query
:type index: :class:`QtCore.QModelIndex`
:returns: None
:rtype: None
:raises: None | [
"Return",
"the",
"flags",
"for",
"the",
"given",
"index"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L654-L669 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/treemodel.py | TreeModel.index_of_item | def index_of_item(self, item):
"""Get the index for the given TreeItem
:param item: the treeitem to query
:type item: :class:`TreeItem`
:returns: the index of the item
:rtype: :class:`QtCore.QModelIndex`
:raises: ValueError
"""
# root has an invalid index... | python | def index_of_item(self, item):
"""Get the index for the given TreeItem
:param item: the treeitem to query
:type item: :class:`TreeItem`
:returns: the index of the item
:rtype: :class:`QtCore.QModelIndex`
:raises: ValueError
"""
# root has an invalid index... | [
"def",
"index_of_item",
"(",
"self",
",",
"item",
")",
":",
"# root has an invalid index",
"if",
"item",
"==",
"self",
".",
"_root",
":",
"return",
"QtCore",
".",
"QModelIndex",
"(",
")",
"# find all parents to get their index",
"parents",
"=",
"[",
"item",
"]",... | Get the index for the given TreeItem
:param item: the treeitem to query
:type item: :class:`TreeItem`
:returns: the index of the item
:rtype: :class:`QtCore.QModelIndex`
:raises: ValueError | [
"Get",
"the",
"index",
"for",
"the",
"given",
"TreeItem"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/treemodel.py#L671-L706 |
pbrisk/mathtoolspy | mathtoolspy/solver/analytic_solver.py | roots_of_cubic_polynom | def roots_of_cubic_polynom(a1, a2, a3):
'''
Finds the roots of a 3 dim polymon of the form x^3 + a1 * x^2 + a2 * x + a3.
The roots are returned as complex numbers.
'''
q = (a1 * a1 - 3.0 * a2) / 9.0
r = (2 * a1 * a1 * a1 - 9.0 * a1 * a2 + 27.0 * a3) / 54.0
r2 = r * r
q3 = q * q * q
a... | python | def roots_of_cubic_polynom(a1, a2, a3):
'''
Finds the roots of a 3 dim polymon of the form x^3 + a1 * x^2 + a2 * x + a3.
The roots are returned as complex numbers.
'''
q = (a1 * a1 - 3.0 * a2) / 9.0
r = (2 * a1 * a1 * a1 - 9.0 * a1 * a2 + 27.0 * a3) / 54.0
r2 = r * r
q3 = q * q * q
a... | [
"def",
"roots_of_cubic_polynom",
"(",
"a1",
",",
"a2",
",",
"a3",
")",
":",
"q",
"=",
"(",
"a1",
"*",
"a1",
"-",
"3.0",
"*",
"a2",
")",
"/",
"9.0",
"r",
"=",
"(",
"2",
"*",
"a1",
"*",
"a1",
"*",
"a1",
"-",
"9.0",
"*",
"a1",
"*",
"a2",
"+"... | Finds the roots of a 3 dim polymon of the form x^3 + a1 * x^2 + a2 * x + a3.
The roots are returned as complex numbers. | [
"Finds",
"the",
"roots",
"of",
"a",
"3",
"dim",
"polymon",
"of",
"the",
"form",
"x^3",
"+",
"a1",
"*",
"x^2",
"+",
"a2",
"*",
"x",
"+",
"a3",
".",
"The",
"roots",
"are",
"returned",
"as",
"complex",
"numbers",
"."
] | train | https://github.com/pbrisk/mathtoolspy/blob/d0d35b45d20f346ba8a755e53ed0aa182fab43dd/mathtoolspy/solver/analytic_solver.py#L21-L48 |
miped/django-envy | envy.py | Environment.dict | def dict(self, var, default=NOTSET, cast=None, force=True):
"""Convenience method for casting to a dict
Note:
Casting
"""
return self._get(var, default=default, cast={str: cast}, force=force) | python | def dict(self, var, default=NOTSET, cast=None, force=True):
"""Convenience method for casting to a dict
Note:
Casting
"""
return self._get(var, default=default, cast={str: cast}, force=force) | [
"def",
"dict",
"(",
"self",
",",
"var",
",",
"default",
"=",
"NOTSET",
",",
"cast",
"=",
"None",
",",
"force",
"=",
"True",
")",
":",
"return",
"self",
".",
"_get",
"(",
"var",
",",
"default",
"=",
"default",
",",
"cast",
"=",
"{",
"str",
":",
... | Convenience method for casting to a dict
Note:
Casting | [
"Convenience",
"method",
"for",
"casting",
"to",
"a",
"dict"
] | train | https://github.com/miped/django-envy/blob/d7fe3c5dcad09e024c502e0f0e3a7c668ba15631/envy.py#L156-L162 |
miped/django-envy | envy.py | Environment.decimal | def decimal(self, var, default=NOTSET, force=True):
"""Convenience method for casting to a decimal.Decimal
Note:
Casting
"""
return self._get(var, default=default, cast=Decimal, force=force) | python | def decimal(self, var, default=NOTSET, force=True):
"""Convenience method for casting to a decimal.Decimal
Note:
Casting
"""
return self._get(var, default=default, cast=Decimal, force=force) | [
"def",
"decimal",
"(",
"self",
",",
"var",
",",
"default",
"=",
"NOTSET",
",",
"force",
"=",
"True",
")",
":",
"return",
"self",
".",
"_get",
"(",
"var",
",",
"default",
"=",
"default",
",",
"cast",
"=",
"Decimal",
",",
"force",
"=",
"force",
")"
] | Convenience method for casting to a decimal.Decimal
Note:
Casting | [
"Convenience",
"method",
"for",
"casting",
"to",
"a",
"decimal",
".",
"Decimal"
] | train | https://github.com/miped/django-envy/blob/d7fe3c5dcad09e024c502e0f0e3a7c668ba15631/envy.py#L166-L172 |
miped/django-envy | envy.py | Environment.json | def json(self, var, default=NOTSET, force=True):
"""Get environment variable, parsed as a json string"""
return self._get(var, default=default, cast=json.loads, force=force) | python | def json(self, var, default=NOTSET, force=True):
"""Get environment variable, parsed as a json string"""
return self._get(var, default=default, cast=json.loads, force=force) | [
"def",
"json",
"(",
"self",
",",
"var",
",",
"default",
"=",
"NOTSET",
",",
"force",
"=",
"True",
")",
":",
"return",
"self",
".",
"_get",
"(",
"var",
",",
"default",
"=",
"default",
",",
"cast",
"=",
"json",
".",
"loads",
",",
"force",
"=",
"for... | Get environment variable, parsed as a json string | [
"Get",
"environment",
"variable",
"parsed",
"as",
"a",
"json",
"string"
] | train | https://github.com/miped/django-envy/blob/d7fe3c5dcad09e024c502e0f0e3a7c668ba15631/envy.py#L174-L176 |
miped/django-envy | envy.py | Environment.url | def url(self, var, default=NOTSET, force=True):
"""Get environment variable, parsed with urlparse/urllib.parse"""
return self._get(var, default=default, cast=urlparse.urlparse,
force=force) | python | def url(self, var, default=NOTSET, force=True):
"""Get environment variable, parsed with urlparse/urllib.parse"""
return self._get(var, default=default, cast=urlparse.urlparse,
force=force) | [
"def",
"url",
"(",
"self",
",",
"var",
",",
"default",
"=",
"NOTSET",
",",
"force",
"=",
"True",
")",
":",
"return",
"self",
".",
"_get",
"(",
"var",
",",
"default",
"=",
"default",
",",
"cast",
"=",
"urlparse",
".",
"urlparse",
",",
"force",
"=",
... | Get environment variable, parsed with urlparse/urllib.parse | [
"Get",
"environment",
"variable",
"parsed",
"with",
"urlparse",
"/",
"urllib",
".",
"parse"
] | train | https://github.com/miped/django-envy/blob/d7fe3c5dcad09e024c502e0f0e3a7c668ba15631/envy.py#L178-L181 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.init_selection | def init_selection(self):
"""Call selection changed in the beginning, so signals get emitted once
Emit shot_taskfile_sel_changed signal and asset_taskfile_sel_changed.
:returns: None
:raises: None
"""
si = self.shotverbrws.selected_indexes(0)
if si:
... | python | def init_selection(self):
"""Call selection changed in the beginning, so signals get emitted once
Emit shot_taskfile_sel_changed signal and asset_taskfile_sel_changed.
:returns: None
:raises: None
"""
si = self.shotverbrws.selected_indexes(0)
if si:
... | [
"def",
"init_selection",
"(",
"self",
")",
":",
"si",
"=",
"self",
".",
"shotverbrws",
".",
"selected_indexes",
"(",
"0",
")",
"if",
"si",
":",
"self",
".",
"shot_ver_sel_changed",
"(",
"si",
"[",
"0",
"]",
")",
"else",
":",
"self",
".",
"shot_ver_sel_... | Call selection changed in the beginning, so signals get emitted once
Emit shot_taskfile_sel_changed signal and asset_taskfile_sel_changed.
:returns: None
:raises: None | [
"Call",
"selection",
"changed",
"in",
"the",
"beginning",
"so",
"signals",
"get",
"emitted",
"once"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L58-L75 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.setup_ui | def setup_ui(self, ):
"""Create the browsers and all necessary ui elements for the tool
:returns: None
:rtype: None
:raises: None
"""
self.prjbrws = self.create_prj_browser()
self.shotbrws = self.create_shot_browser()
self.shotverbrws = self.create_ver_br... | python | def setup_ui(self, ):
"""Create the browsers and all necessary ui elements for the tool
:returns: None
:rtype: None
:raises: None
"""
self.prjbrws = self.create_prj_browser()
self.shotbrws = self.create_shot_browser()
self.shotverbrws = self.create_ver_br... | [
"def",
"setup_ui",
"(",
"self",
",",
")",
":",
"self",
".",
"prjbrws",
"=",
"self",
".",
"create_prj_browser",
"(",
")",
"self",
".",
"shotbrws",
"=",
"self",
".",
"create_shot_browser",
"(",
")",
"self",
".",
"shotverbrws",
"=",
"self",
".",
"create_ver... | Create the browsers and all necessary ui elements for the tool
:returns: None
:rtype: None
:raises: None | [
"Create",
"the",
"browsers",
"and",
"all",
"necessary",
"ui",
"elements",
"for",
"the",
"tool"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L77-L96 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.setup_releasetype_buttons | def setup_releasetype_buttons(self, ):
"""Create a radio button for every releasetype
:returns: None
:rtype: None
:raises: None
"""
# we insert the radiobuttons instead of adding them
# because there is already a spacer in the layout to
# keep the buttons... | python | def setup_releasetype_buttons(self, ):
"""Create a radio button for every releasetype
:returns: None
:rtype: None
:raises: None
"""
# we insert the radiobuttons instead of adding them
# because there is already a spacer in the layout to
# keep the buttons... | [
"def",
"setup_releasetype_buttons",
"(",
"self",
",",
")",
":",
"# we insert the radiobuttons instead of adding them",
"# because there is already a spacer in the layout to",
"# keep the buttons to the left. To maintain the original order",
"# we insert them all to position 0 but in reversed ord... | Create a radio button for every releasetype
:returns: None
:rtype: None
:raises: None | [
"Create",
"a",
"radio",
"button",
"for",
"every",
"releasetype"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L98-L120 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.setup_icons | def setup_icons(self, ):
"""Set all icons on buttons
:returns: None
:rtype: None
:raises: None
"""
folder_icon = get_icon('glyphicons_144_folder_open.png', asicon=True)
self.asset_open_path_tb.setIcon(folder_icon)
self.shot_open_path_tb.setIcon(folder_ico... | python | def setup_icons(self, ):
"""Set all icons on buttons
:returns: None
:rtype: None
:raises: None
"""
folder_icon = get_icon('glyphicons_144_folder_open.png', asicon=True)
self.asset_open_path_tb.setIcon(folder_icon)
self.shot_open_path_tb.setIcon(folder_ico... | [
"def",
"setup_icons",
"(",
"self",
",",
")",
":",
"folder_icon",
"=",
"get_icon",
"(",
"'glyphicons_144_folder_open.png'",
",",
"asicon",
"=",
"True",
")",
"self",
".",
"asset_open_path_tb",
".",
"setIcon",
"(",
"folder_icon",
")",
"self",
".",
"shot_open_path_t... | Set all icons on buttons
:returns: None
:rtype: None
:raises: None | [
"Set",
"all",
"icons",
"on",
"buttons"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L122-L137 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.setup_signals | def setup_signals(self, ):
"""Connect the signals with the slots to make the ui functional
:returns: None
:rtype: None
:raises: None
"""
prjlvl = self.prjbrws.get_level(0)
prjlvl.new_root.connect(self.update_browsers)
for rb in self._releasetype_button_ma... | python | def setup_signals(self, ):
"""Connect the signals with the slots to make the ui functional
:returns: None
:rtype: None
:raises: None
"""
prjlvl = self.prjbrws.get_level(0)
prjlvl.new_root.connect(self.update_browsers)
for rb in self._releasetype_button_ma... | [
"def",
"setup_signals",
"(",
"self",
",",
")",
":",
"prjlvl",
"=",
"self",
".",
"prjbrws",
".",
"get_level",
"(",
"0",
")",
"prjlvl",
".",
"new_root",
".",
"connect",
"(",
"self",
".",
"update_browsers",
")",
"for",
"rb",
"in",
"self",
".",
"_releasety... | Connect the signals with the slots to make the ui functional
:returns: None
:rtype: None
:raises: None | [
"Connect",
"the",
"signals",
"with",
"the",
"slots",
"to",
"make",
"the",
"ui",
"functional"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L139-L180 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.create_prj_browser | def create_prj_browser(self, ):
"""Create the project browser
This creates a combobox brower for projects
and adds it to the ui
:returns: the created combo box browser
:rtype: :class:`jukeboxcore.gui.widgets.browser.ComboBoxBrowser`
:raises: None
"""
prj... | python | def create_prj_browser(self, ):
"""Create the project browser
This creates a combobox brower for projects
and adds it to the ui
:returns: the created combo box browser
:rtype: :class:`jukeboxcore.gui.widgets.browser.ComboBoxBrowser`
:raises: None
"""
prj... | [
"def",
"create_prj_browser",
"(",
"self",
",",
")",
":",
"prjbrws",
"=",
"ComboBoxBrowser",
"(",
"1",
",",
"headers",
"=",
"[",
"'Project:'",
"]",
")",
"self",
".",
"central_vbox",
".",
"insertWidget",
"(",
"0",
",",
"prjbrws",
")",
"return",
"prjbrws"
] | Create the project browser
This creates a combobox brower for projects
and adds it to the ui
:returns: the created combo box browser
:rtype: :class:`jukeboxcore.gui.widgets.browser.ComboBoxBrowser`
:raises: None | [
"Create",
"the",
"project",
"browser"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L182-L194 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.create_shot_browser | def create_shot_browser(self, ):
"""Create the shot browser
This creates a list browser for shots
and adds it to the ui
:returns: the created borwser
:rtype: :class:`jukeboxcore.gui.widgets.browser.ListBrowser`
:raises: None
"""
shotbrws = ListBrowser(4,... | python | def create_shot_browser(self, ):
"""Create the shot browser
This creates a list browser for shots
and adds it to the ui
:returns: the created borwser
:rtype: :class:`jukeboxcore.gui.widgets.browser.ListBrowser`
:raises: None
"""
shotbrws = ListBrowser(4,... | [
"def",
"create_shot_browser",
"(",
"self",
",",
")",
":",
"shotbrws",
"=",
"ListBrowser",
"(",
"4",
",",
"headers",
"=",
"[",
"'Sequence'",
",",
"'Shot'",
",",
"'Task'",
",",
"'Descriptor'",
"]",
")",
"self",
".",
"shot_browser_vbox",
".",
"insertWidget",
... | Create the shot browser
This creates a list browser for shots
and adds it to the ui
:returns: the created borwser
:rtype: :class:`jukeboxcore.gui.widgets.browser.ListBrowser`
:raises: None | [
"Create",
"the",
"shot",
"browser"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L196-L208 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.create_asset_browser | def create_asset_browser(self, ):
"""Create the asset browser
This creates a list browser for assets
and adds it to the ui
:returns: the created borwser
:rtype: :class:`jukeboxcore.gui.widgets.browser.ListBrowser`
:raises: None
"""
assetbrws = ListBrowse... | python | def create_asset_browser(self, ):
"""Create the asset browser
This creates a list browser for assets
and adds it to the ui
:returns: the created borwser
:rtype: :class:`jukeboxcore.gui.widgets.browser.ListBrowser`
:raises: None
"""
assetbrws = ListBrowse... | [
"def",
"create_asset_browser",
"(",
"self",
",",
")",
":",
"assetbrws",
"=",
"ListBrowser",
"(",
"4",
",",
"headers",
"=",
"[",
"'Assettype'",
",",
"'Asset'",
",",
"'Task'",
",",
"'Descriptor'",
"]",
")",
"self",
".",
"asset_browser_vbox",
".",
"insertWidget... | Create the asset browser
This creates a list browser for assets
and adds it to the ui
:returns: the created borwser
:rtype: :class:`jukeboxcore.gui.widgets.browser.ListBrowser`
:raises: None | [
"Create",
"the",
"asset",
"browser"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L210-L222 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.create_ver_browser | def create_ver_browser(self, layout):
"""Create a version browser and insert it into the given layout
:param layout: the layout to insert the browser into
:type layout: QLayout
:returns: the created browser
:rtype: :class:`jukeboxcore.gui.widgets.browser.ComboBoxBrowser`
... | python | def create_ver_browser(self, layout):
"""Create a version browser and insert it into the given layout
:param layout: the layout to insert the browser into
:type layout: QLayout
:returns: the created browser
:rtype: :class:`jukeboxcore.gui.widgets.browser.ComboBoxBrowser`
... | [
"def",
"create_ver_browser",
"(",
"self",
",",
"layout",
")",
":",
"brws",
"=",
"ComboBoxBrowser",
"(",
"1",
",",
"headers",
"=",
"[",
"'Version:'",
"]",
")",
"layout",
".",
"insertWidget",
"(",
"1",
",",
"brws",
")",
"return",
"brws"
] | Create a version browser and insert it into the given layout
:param layout: the layout to insert the browser into
:type layout: QLayout
:returns: the created browser
:rtype: :class:`jukeboxcore.gui.widgets.browser.ComboBoxBrowser`
:raises: None | [
"Create",
"a",
"version",
"browser",
"and",
"insert",
"it",
"into",
"the",
"given",
"layout"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L224-L235 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.create_comment_browser | def create_comment_browser(self, layout):
"""Create a comment browser and insert it into the given layout
:param layout: the layout to insert the browser into
:type layout: QLayout
:returns: the created browser
:rtype: :class:`jukeboxcore.gui.widgets.browser.ListBrowser`
... | python | def create_comment_browser(self, layout):
"""Create a comment browser and insert it into the given layout
:param layout: the layout to insert the browser into
:type layout: QLayout
:returns: the created browser
:rtype: :class:`jukeboxcore.gui.widgets.browser.ListBrowser`
... | [
"def",
"create_comment_browser",
"(",
"self",
",",
"layout",
")",
":",
"brws",
"=",
"CommentBrowser",
"(",
"1",
",",
"headers",
"=",
"[",
"'Comments:'",
"]",
")",
"layout",
".",
"insertWidget",
"(",
"1",
",",
"brws",
")",
"return",
"brws"
] | Create a comment browser and insert it into the given layout
:param layout: the layout to insert the browser into
:type layout: QLayout
:returns: the created browser
:rtype: :class:`jukeboxcore.gui.widgets.browser.ListBrowser`
:raises: None | [
"Create",
"a",
"comment",
"browser",
"and",
"insert",
"it",
"into",
"the",
"given",
"layout"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L237-L248 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.create_current_pb | def create_current_pb(self, ):
"""Create a push button and place it in the corner of the tabwidget
:returns: the created button
:rtype: :class:`QtGui.QPushButton`
:raises: None
"""
pb = QtGui.QPushButton("Select current")
self.selection_tabw.setCornerWidget(pb)
... | python | def create_current_pb(self, ):
"""Create a push button and place it in the corner of the tabwidget
:returns: the created button
:rtype: :class:`QtGui.QPushButton`
:raises: None
"""
pb = QtGui.QPushButton("Select current")
self.selection_tabw.setCornerWidget(pb)
... | [
"def",
"create_current_pb",
"(",
"self",
",",
")",
":",
"pb",
"=",
"QtGui",
".",
"QPushButton",
"(",
"\"Select current\"",
")",
"self",
".",
"selection_tabw",
".",
"setCornerWidget",
"(",
"pb",
")",
"return",
"pb"
] | Create a push button and place it in the corner of the tabwidget
:returns: the created button
:rtype: :class:`QtGui.QPushButton`
:raises: None | [
"Create",
"a",
"push",
"button",
"and",
"place",
"it",
"in",
"the",
"corner",
"of",
"the",
"tabwidget"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L250-L259 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.create_prj_model | def create_prj_model(self, ):
"""Create and return a tree model that represents a list of projects
:returns: the creeated model
:rtype: :class:`jukeboxcore.gui.treemodel.TreeModel`
:raises: None
"""
prjs = djadapter.projects.all()
rootdata = treemodel.ListItemDat... | python | def create_prj_model(self, ):
"""Create and return a tree model that represents a list of projects
:returns: the creeated model
:rtype: :class:`jukeboxcore.gui.treemodel.TreeModel`
:raises: None
"""
prjs = djadapter.projects.all()
rootdata = treemodel.ListItemDat... | [
"def",
"create_prj_model",
"(",
"self",
",",
")",
":",
"prjs",
"=",
"djadapter",
".",
"projects",
".",
"all",
"(",
")",
"rootdata",
"=",
"treemodel",
".",
"ListItemData",
"(",
"[",
"'Name'",
",",
"'Short'",
",",
"'Rootpath'",
"]",
")",
"prjroot",
"=",
... | Create and return a tree model that represents a list of projects
:returns: the creeated model
:rtype: :class:`jukeboxcore.gui.treemodel.TreeModel`
:raises: None | [
"Create",
"and",
"return",
"a",
"tree",
"model",
"that",
"represents",
"a",
"list",
"of",
"projects"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L261-L275 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.create_shot_model | def create_shot_model(self, project, releasetype):
"""Create and return a new tree model that represents shots til descriptors
The tree will include sequences, shots, tasks and descriptors of the given releaetype.
:param releasetype: the releasetype for the model
:type releasetype: :da... | python | def create_shot_model(self, project, releasetype):
"""Create and return a new tree model that represents shots til descriptors
The tree will include sequences, shots, tasks and descriptors of the given releaetype.
:param releasetype: the releasetype for the model
:type releasetype: :da... | [
"def",
"create_shot_model",
"(",
"self",
",",
"project",
",",
"releasetype",
")",
":",
"rootdata",
"=",
"treemodel",
".",
"ListItemData",
"(",
"[",
"'Name'",
"]",
")",
"rootitem",
"=",
"treemodel",
".",
"TreeItem",
"(",
"rootdata",
")",
"for",
"seq",
"in",... | Create and return a new tree model that represents shots til descriptors
The tree will include sequences, shots, tasks and descriptors of the given releaetype.
:param releasetype: the releasetype for the model
:type releasetype: :data:`djadapter.RELEASETYPES`
:param project: the projec... | [
"Create",
"and",
"return",
"a",
"new",
"tree",
"model",
"that",
"represents",
"shots",
"til",
"descriptors"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L277-L308 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.create_asset_model | def create_asset_model(self, project, releasetype):
"""Create and return a new tree model that represents assets til descriptors
The tree will include assettypes, assets, tasks and descriptors of the given releaetype.
:param releasetype: the releasetype for the model
:type releasetype:... | python | def create_asset_model(self, project, releasetype):
"""Create and return a new tree model that represents assets til descriptors
The tree will include assettypes, assets, tasks and descriptors of the given releaetype.
:param releasetype: the releasetype for the model
:type releasetype:... | [
"def",
"create_asset_model",
"(",
"self",
",",
"project",
",",
"releasetype",
")",
":",
"rootdata",
"=",
"treemodel",
".",
"ListItemData",
"(",
"[",
"'Name'",
"]",
")",
"rootitem",
"=",
"treemodel",
".",
"TreeItem",
"(",
"rootdata",
")",
"for",
"atype",
"i... | Create and return a new tree model that represents assets til descriptors
The tree will include assettypes, assets, tasks and descriptors of the given releaetype.
:param releasetype: the releasetype for the model
:type releasetype: :data:`djadapter.RELEASETYPES`
:param project: the pro... | [
"Create",
"and",
"return",
"a",
"new",
"tree",
"model",
"that",
"represents",
"assets",
"til",
"descriptors"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L310-L340 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.create_version_model | def create_version_model(self, task, releasetype, descriptor):
"""Create and return a new model that represents taskfiles for the given task, releasetpye and descriptor
:param task: the task of the taskfiles
:type task: :class:`djadapter.models.Task`
:param releasetype: the releasetype
... | python | def create_version_model(self, task, releasetype, descriptor):
"""Create and return a new model that represents taskfiles for the given task, releasetpye and descriptor
:param task: the task of the taskfiles
:type task: :class:`djadapter.models.Task`
:param releasetype: the releasetype
... | [
"def",
"create_version_model",
"(",
"self",
",",
"task",
",",
"releasetype",
",",
"descriptor",
")",
":",
"rootdata",
"=",
"treemodel",
".",
"ListItemData",
"(",
"[",
"'Version'",
",",
"'Releasetype'",
",",
"'Path'",
"]",
")",
"rootitem",
"=",
"treemodel",
"... | Create and return a new model that represents taskfiles for the given task, releasetpye and descriptor
:param task: the task of the taskfiles
:type task: :class:`djadapter.models.Task`
:param releasetype: the releasetype
:type releasetype: str
:param descriptor: the descirptor
... | [
"Create",
"and",
"return",
"a",
"new",
"model",
"that",
"represents",
"taskfiles",
"for",
"the",
"given",
"task",
"releasetpye",
"and",
"descriptor"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L342-L364 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.update_shot_browser | def update_shot_browser(self, project, releasetype):
"""Update the shot browser to the given project
:param releasetype: the releasetype for the model
:type releasetype: :data:`djadapter.RELEASETYPES`
:param project: the project of the shots
:type project: :class:`djadapter.mode... | python | def update_shot_browser(self, project, releasetype):
"""Update the shot browser to the given project
:param releasetype: the releasetype for the model
:type releasetype: :data:`djadapter.RELEASETYPES`
:param project: the project of the shots
:type project: :class:`djadapter.mode... | [
"def",
"update_shot_browser",
"(",
"self",
",",
"project",
",",
"releasetype",
")",
":",
"if",
"project",
"is",
"None",
":",
"self",
".",
"shotbrws",
".",
"set_model",
"(",
"None",
")",
"return",
"shotmodel",
"=",
"self",
".",
"create_shot_model",
"(",
"pr... | Update the shot browser to the given project
:param releasetype: the releasetype for the model
:type releasetype: :data:`djadapter.RELEASETYPES`
:param project: the project of the shots
:type project: :class:`djadapter.models.Project`
:returns: None
:rtype: None
... | [
"Update",
"the",
"shot",
"browser",
"to",
"the",
"given",
"project"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L380-L395 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.update_asset_browser | def update_asset_browser(self, project, releasetype):
"""update the assetbrowser to the given project
:param releasetype: the releasetype for the model
:type releasetype: :data:`djadapter.RELEASETYPES`
:param project: the project of the assets
:type project: :class:`djadapter.mo... | python | def update_asset_browser(self, project, releasetype):
"""update the assetbrowser to the given project
:param releasetype: the releasetype for the model
:type releasetype: :data:`djadapter.RELEASETYPES`
:param project: the project of the assets
:type project: :class:`djadapter.mo... | [
"def",
"update_asset_browser",
"(",
"self",
",",
"project",
",",
"releasetype",
")",
":",
"if",
"project",
"is",
"None",
":",
"self",
".",
"assetbrws",
".",
"set_model",
"(",
"None",
")",
"return",
"assetmodel",
"=",
"self",
".",
"create_asset_model",
"(",
... | update the assetbrowser to the given project
:param releasetype: the releasetype for the model
:type releasetype: :data:`djadapter.RELEASETYPES`
:param project: the project of the assets
:type project: :class:`djadapter.models.Project`
:returns: None
:rtype: None
... | [
"update",
"the",
"assetbrowser",
"to",
"the",
"given",
"project"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L397-L412 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.update_browsers | def update_browsers(self, *args, **kwargs):
"""Update the shot and the assetbrowsers
:returns: None
:rtype: None
:raises: None
"""
sel = self.prjbrws.selected_indexes(0)
if not sel:
return
prjindex = sel[0]
if not prjindex.isValid():
... | python | def update_browsers(self, *args, **kwargs):
"""Update the shot and the assetbrowsers
:returns: None
:rtype: None
:raises: None
"""
sel = self.prjbrws.selected_indexes(0)
if not sel:
return
prjindex = sel[0]
if not prjindex.isValid():
... | [
"def",
"update_browsers",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"sel",
"=",
"self",
".",
"prjbrws",
".",
"selected_indexes",
"(",
"0",
")",
"if",
"not",
"sel",
":",
"return",
"prjindex",
"=",
"sel",
"[",
"0",
"]",
"if",
... | Update the shot and the assetbrowsers
:returns: None
:rtype: None
:raises: None | [
"Update",
"the",
"shot",
"and",
"the",
"assetbrowsers"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L414-L433 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.update_version_descriptor | def update_version_descriptor(self, task, releasetype, descriptor,
verbrowser, commentbrowser):
"""Update the versions in the given browser
:param task: the task of the taskfiles
:type task: :class:`djadapter.models.Task` | None
:param releasetype: the ... | python | def update_version_descriptor(self, task, releasetype, descriptor,
verbrowser, commentbrowser):
"""Update the versions in the given browser
:param task: the task of the taskfiles
:type task: :class:`djadapter.models.Task` | None
:param releasetype: the ... | [
"def",
"update_version_descriptor",
"(",
"self",
",",
"task",
",",
"releasetype",
",",
"descriptor",
",",
"verbrowser",
",",
"commentbrowser",
")",
":",
"if",
"task",
"is",
"None",
":",
"null",
"=",
"treemodel",
".",
"TreeItem",
"(",
"None",
")",
"verbrowser... | Update the versions in the given browser
:param task: the task of the taskfiles
:type task: :class:`djadapter.models.Task` | None
:param releasetype: the releasetype
:type releasetype: str|None
:param descriptor: the descirptor
:type descriptor: str|None
:param v... | [
"Update",
"the",
"versions",
"in",
"the",
"given",
"browser"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L435-L459 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.selection_changed | def selection_changed(self, index, source, update, commentbrowser, mapper):
"""Callback for when the asset or shot browser changed its selection
:param index: the modelindex with the descriptor tree item as internal data
:type index: QtCore.QModelIndex
:param source: the shot or asset b... | python | def selection_changed(self, index, source, update, commentbrowser, mapper):
"""Callback for when the asset or shot browser changed its selection
:param index: the modelindex with the descriptor tree item as internal data
:type index: QtCore.QModelIndex
:param source: the shot or asset b... | [
"def",
"selection_changed",
"(",
"self",
",",
"index",
",",
"source",
",",
"update",
",",
"commentbrowser",
",",
"mapper",
")",
":",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
":",
"# no descriptor selected",
"self",
".",
"update_version_descriptor",
"(",... | Callback for when the asset or shot browser changed its selection
:param index: the modelindex with the descriptor tree item as internal data
:type index: QtCore.QModelIndex
:param source: the shot or asset browser to that changed its selection
:type source: :class:`jukeboxcore.gui.widg... | [
"Callback",
"for",
"when",
"the",
"asset",
"or",
"shot",
"browser",
"changed",
"its",
"selection"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L461-L493 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.set_info_mapper_model | def set_info_mapper_model(self, mapper, model):
"""Set the model for the info mapper
:param mapper: the mapper to update
:type mapper: QtGui.QDataWidgetMapper
:param model: The model to set
:type model: QtGui.QAbstractItemModel | None
:returns: None
:rtype: None
... | python | def set_info_mapper_model(self, mapper, model):
"""Set the model for the info mapper
:param mapper: the mapper to update
:type mapper: QtGui.QDataWidgetMapper
:param model: The model to set
:type model: QtGui.QAbstractItemModel | None
:returns: None
:rtype: None
... | [
"def",
"set_info_mapper_model",
"(",
"self",
",",
"mapper",
",",
"model",
")",
":",
"# nothing changed. we can return.",
"# I noticed that when you set the model the very first time to None",
"# it printed a message:",
"# QObject::connect: Cannot connect (null)::dataChanged(QModelIndex,QMo... | Set the model for the info mapper
:param mapper: the mapper to update
:type mapper: QtGui.QDataWidgetMapper
:param model: The model to set
:type model: QtGui.QAbstractItemModel | None
:returns: None
:rtype: None
:raises: None | [
"Set",
"the",
"model",
"for",
"the",
"info",
"mapper"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L495-L539 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.set_mapper_index | def set_mapper_index(self, index, mapper):
"""Set the mapper to the given index
:param index: the index to set
:type index: QtCore.QModelIndex
:param mapper: the mapper to set
:type mapper: QtGui.QDataWidgetMapper
:returns: None
:rtype: None
:raises: None... | python | def set_mapper_index(self, index, mapper):
"""Set the mapper to the given index
:param index: the index to set
:type index: QtCore.QModelIndex
:param mapper: the mapper to set
:type mapper: QtGui.QDataWidgetMapper
:returns: None
:rtype: None
:raises: None... | [
"def",
"set_mapper_index",
"(",
"self",
",",
"index",
",",
"mapper",
")",
":",
"parent",
"=",
"index",
".",
"parent",
"(",
")",
"mapper",
".",
"setRootIndex",
"(",
"parent",
")",
"mapper",
".",
"setCurrentModelIndex",
"(",
"index",
")"
] | Set the mapper to the given index
:param index: the index to set
:type index: QtCore.QModelIndex
:param mapper: the mapper to set
:type mapper: QtGui.QDataWidgetMapper
:returns: None
:rtype: None
:raises: None | [
"Set",
"the",
"mapper",
"to",
"the",
"given",
"index"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L541-L554 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.get_releasetype | def get_releasetype(self, ):
"""Return the currently selected releasetype
:returns: the selected releasetype
:rtype: str
:raises: None
"""
for rt, rb in self._releasetype_button_mapping.items():
if rb.isChecked():
return rt | python | def get_releasetype(self, ):
"""Return the currently selected releasetype
:returns: the selected releasetype
:rtype: str
:raises: None
"""
for rt, rb in self._releasetype_button_mapping.items():
if rb.isChecked():
return rt | [
"def",
"get_releasetype",
"(",
"self",
",",
")",
":",
"for",
"rt",
",",
"rb",
"in",
"self",
".",
"_releasetype_button_mapping",
".",
"items",
"(",
")",
":",
"if",
"rb",
".",
"isChecked",
"(",
")",
":",
"return",
"rt"
] | Return the currently selected releasetype
:returns: the selected releasetype
:rtype: str
:raises: None | [
"Return",
"the",
"currently",
"selected",
"releasetype"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L556-L565 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.asset_ver_sel_changed | def asset_ver_sel_changed(self, index):
"""Callback for when the version selection has changed
Emit asset_taskfile_sel_changed signal.
:param index: the selected index
:type index: QtCore.QModelIndex
:returns: None
:rtype: None
:raises: None
"""
... | python | def asset_ver_sel_changed(self, index):
"""Callback for when the version selection has changed
Emit asset_taskfile_sel_changed signal.
:param index: the selected index
:type index: QtCore.QModelIndex
:returns: None
:rtype: None
:raises: None
"""
... | [
"def",
"asset_ver_sel_changed",
"(",
"self",
",",
"index",
")",
":",
"taskfile",
"=",
"None",
"if",
"index",
".",
"isValid",
"(",
")",
":",
"item",
"=",
"index",
".",
"internalPointer",
"(",
")",
"taskfile",
"=",
"item",
".",
"internal_data",
"(",
")",
... | Callback for when the version selection has changed
Emit asset_taskfile_sel_changed signal.
:param index: the selected index
:type index: QtCore.QModelIndex
:returns: None
:rtype: None
:raises: None | [
"Callback",
"for",
"when",
"the",
"version",
"selection",
"has",
"changed"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L567-L582 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.shot_ver_sel_changed | def shot_ver_sel_changed(self, index):
"""Callback for when the version selection has changed
Emit shot_taskfile_sel_changed signal.
:param index: the selected index
:type index: QtCore.QModelIndex
:returns: None
:rtype: None
:raises: None
"""
ta... | python | def shot_ver_sel_changed(self, index):
"""Callback for when the version selection has changed
Emit shot_taskfile_sel_changed signal.
:param index: the selected index
:type index: QtCore.QModelIndex
:returns: None
:rtype: None
:raises: None
"""
ta... | [
"def",
"shot_ver_sel_changed",
"(",
"self",
",",
"index",
")",
":",
"taskfile",
"=",
"None",
"if",
"index",
".",
"isValid",
"(",
")",
":",
"item",
"=",
"index",
".",
"internalPointer",
"(",
")",
"taskfile",
"=",
"item",
".",
"internal_data",
"(",
")",
... | Callback for when the version selection has changed
Emit shot_taskfile_sel_changed signal.
:param index: the selected index
:type index: QtCore.QModelIndex
:returns: None
:rtype: None
:raises: None | [
"Callback",
"for",
"when",
"the",
"version",
"selection",
"has",
"changed"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L584-L599 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.set_to_current | def set_to_current(self, ):
"""Set the selection to the currently open one
:returns: None
:rtype: None
:raises: None
"""
cur = self.get_current_file()
if cur is not None:
self.set_selection(cur)
else:
self.init_selection() | python | def set_to_current(self, ):
"""Set the selection to the currently open one
:returns: None
:rtype: None
:raises: None
"""
cur = self.get_current_file()
if cur is not None:
self.set_selection(cur)
else:
self.init_selection() | [
"def",
"set_to_current",
"(",
"self",
",",
")",
":",
"cur",
"=",
"self",
".",
"get_current_file",
"(",
")",
"if",
"cur",
"is",
"not",
"None",
":",
"self",
".",
"set_selection",
"(",
"cur",
")",
"else",
":",
"self",
".",
"init_selection",
"(",
")"
] | Set the selection to the currently open one
:returns: None
:rtype: None
:raises: None | [
"Set",
"the",
"selection",
"to",
"the",
"currently",
"open",
"one"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L601-L612 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.set_selection | def set_selection(self, taskfile):
"""Set the selection to the given taskfile
:param taskfile: the taskfile to set the selection to
:type taskfile: :class:`djadapter.models.TaskFile`
:returns: None
:rtype: None
:raises: None
"""
self.set_project(taskfile.... | python | def set_selection(self, taskfile):
"""Set the selection to the given taskfile
:param taskfile: the taskfile to set the selection to
:type taskfile: :class:`djadapter.models.TaskFile`
:returns: None
:rtype: None
:raises: None
"""
self.set_project(taskfile.... | [
"def",
"set_selection",
"(",
"self",
",",
"taskfile",
")",
":",
"self",
".",
"set_project",
"(",
"taskfile",
".",
"task",
".",
"project",
")",
"self",
".",
"set_releasetype",
"(",
"taskfile",
".",
"releasetype",
")",
"if",
"taskfile",
".",
"task",
".",
"... | Set the selection to the given taskfile
:param taskfile: the taskfile to set the selection to
:type taskfile: :class:`djadapter.models.TaskFile`
:returns: None
:rtype: None
:raises: None | [
"Set",
"the",
"selection",
"to",
"the",
"given",
"taskfile"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L614-L642 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.set_project | def set_project(self, project):
"""Set the project selection to the given project
:param project: the project to select
:type project: :class:`djadapter.models.Project`
:returns: None
:rtype: None
:raises: ValueError
"""
prjroot = self.prjbrws.model.root
... | python | def set_project(self, project):
"""Set the project selection to the given project
:param project: the project to select
:type project: :class:`djadapter.models.Project`
:returns: None
:rtype: None
:raises: ValueError
"""
prjroot = self.prjbrws.model.root
... | [
"def",
"set_project",
"(",
"self",
",",
"project",
")",
":",
"prjroot",
"=",
"self",
".",
"prjbrws",
".",
"model",
".",
"root",
"prjitems",
"=",
"prjroot",
".",
"childItems",
"for",
"row",
",",
"item",
"in",
"enumerate",
"(",
"prjitems",
")",
":",
"prj... | Set the project selection to the given project
:param project: the project to select
:type project: :class:`djadapter.models.Project`
:returns: None
:rtype: None
:raises: ValueError | [
"Set",
"the",
"project",
"selection",
"to",
"the",
"given",
"project"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L644-L662 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.set_level | def set_level(self, browser, lvl, obj):
"""Set the given browser level selection to the one that matches with obj
This is going to compare the internal_data of the model with the obj
:param browser:
:type browser:
:param lvl: the depth level to set
:type lvl: int
... | python | def set_level(self, browser, lvl, obj):
"""Set the given browser level selection to the one that matches with obj
This is going to compare the internal_data of the model with the obj
:param browser:
:type browser:
:param lvl: the depth level to set
:type lvl: int
... | [
"def",
"set_level",
"(",
"self",
",",
"browser",
",",
"lvl",
",",
"obj",
")",
":",
"if",
"lvl",
"==",
"0",
":",
"index",
"=",
"QtCore",
".",
"QModelIndex",
"(",
")",
"root",
"=",
"browser",
".",
"model",
".",
"root",
"items",
"=",
"root",
".",
"c... | Set the given browser level selection to the one that matches with obj
This is going to compare the internal_data of the model with the obj
:param browser:
:type browser:
:param lvl: the depth level to set
:type lvl: int
:param obj: the object to compare the indexes wit... | [
"Set",
"the",
"given",
"browser",
"level",
"selection",
"to",
"the",
"one",
"that",
"matches",
"with",
"obj"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L675-L705 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.update_model | def update_model(self, tfi):
"""Update the model for the given tfi
:param tfi: taskfile info
:type tfi: :class:`TaskFileInfo`
:returns: None
:rtype: None
:raises: None
"""
if tfi.task.department.assetflag:
browser = self.assetbrws
else... | python | def update_model(self, tfi):
"""Update the model for the given tfi
:param tfi: taskfile info
:type tfi: :class:`TaskFileInfo`
:returns: None
:rtype: None
:raises: None
"""
if tfi.task.department.assetflag:
browser = self.assetbrws
else... | [
"def",
"update_model",
"(",
"self",
",",
"tfi",
")",
":",
"if",
"tfi",
".",
"task",
".",
"department",
".",
"assetflag",
":",
"browser",
"=",
"self",
".",
"assetbrws",
"else",
":",
"browser",
"=",
"self",
".",
"shotbrws",
"if",
"tfi",
".",
"version",
... | Update the model for the given tfi
:param tfi: taskfile info
:type tfi: :class:`TaskFileInfo`
:returns: None
:rtype: None
:raises: None | [
"Update",
"the",
"model",
"for",
"the",
"given",
"tfi"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L722-L741 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.open_asset_path | def open_asset_path(self, *args, **kwargs):
"""Open the currently selected asset in the filebrowser
:returns: None
:rtype: None
:raises: None
"""
f = self.asset_path_le.text()
d = os.path.dirname(f)
osinter = get_interface()
osinter.open_path(d) | python | def open_asset_path(self, *args, **kwargs):
"""Open the currently selected asset in the filebrowser
:returns: None
:rtype: None
:raises: None
"""
f = self.asset_path_le.text()
d = os.path.dirname(f)
osinter = get_interface()
osinter.open_path(d) | [
"def",
"open_asset_path",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"f",
"=",
"self",
".",
"asset_path_le",
".",
"text",
"(",
")",
"d",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"f",
")",
"osinter",
"=",
"get_interface",
... | Open the currently selected asset in the filebrowser
:returns: None
:rtype: None
:raises: None | [
"Open",
"the",
"currently",
"selected",
"asset",
"in",
"the",
"filebrowser"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L743-L753 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.open_shot_path | def open_shot_path(self, *args, **kwargs):
"""Open the currently selected shot in the filebrowser
:returns: None
:rtype: None
:raises: None
"""
f = self.shot_path_le.text()
d = os.path.dirname(f)
osinter = get_interface()
osinter.open_path(d) | python | def open_shot_path(self, *args, **kwargs):
"""Open the currently selected shot in the filebrowser
:returns: None
:rtype: None
:raises: None
"""
f = self.shot_path_le.text()
d = os.path.dirname(f)
osinter = get_interface()
osinter.open_path(d) | [
"def",
"open_shot_path",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"f",
"=",
"self",
".",
"shot_path_le",
".",
"text",
"(",
")",
"d",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"f",
")",
"osinter",
"=",
"get_interface",
... | Open the currently selected shot in the filebrowser
:returns: None
:rtype: None
:raises: None | [
"Open",
"the",
"currently",
"selected",
"shot",
"in",
"the",
"filebrowser"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L755-L765 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.get_current_selection | def get_current_selection(self, i=None):
"""Get the :class:`TaskFileInfo` for the file selected in the active tab
:param i: If None, returns selection of active tab. If 0, assetselection. If 1, shotselection
:type i:
:returns: The taskfile info in the currently active tab
:rtype... | python | def get_current_selection(self, i=None):
"""Get the :class:`TaskFileInfo` for the file selected in the active tab
:param i: If None, returns selection of active tab. If 0, assetselection. If 1, shotselection
:type i:
:returns: The taskfile info in the currently active tab
:rtype... | [
"def",
"get_current_selection",
"(",
"self",
",",
"i",
"=",
"None",
")",
":",
"taskfile",
"=",
"None",
"if",
"(",
"i",
"is",
"None",
"and",
"self",
".",
"selection_tabw",
".",
"currentIndex",
"(",
")",
"==",
"0",
")",
"or",
"(",
"i",
"is",
"not",
"... | Get the :class:`TaskFileInfo` for the file selected in the active tab
:param i: If None, returns selection of active tab. If 0, assetselection. If 1, shotselection
:type i:
:returns: The taskfile info in the currently active tab
:rtype: :class:`TaskFileInfo` | None
:raises: None | [
"Get",
"the",
":",
"class",
":",
"TaskFileInfo",
"for",
"the",
"file",
"selected",
"in",
"the",
"active",
"tab"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L767-L787 |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/filebrowser.py | FileBrowser.refresh | def refresh(self, *args, **kwargs):
"""Refresh the model
:returns: None
:rtype: None
:raises: None
"""
self.prjbrws.set_model(self.create_prj_model())
if self.get_current_file():
self.set_to_current()
else:
self.init_selection() | python | def refresh(self, *args, **kwargs):
"""Refresh the model
:returns: None
:rtype: None
:raises: None
"""
self.prjbrws.set_model(self.create_prj_model())
if self.get_current_file():
self.set_to_current()
else:
self.init_selection() | [
"def",
"refresh",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"prjbrws",
".",
"set_model",
"(",
"self",
".",
"create_prj_model",
"(",
")",
")",
"if",
"self",
".",
"get_current_file",
"(",
")",
":",
"self",
".",
"s... | Refresh the model
:returns: None
:rtype: None
:raises: None | [
"Refresh",
"the",
"model"
] | train | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L789-L800 |
zkbt/the-friendly-stars | thefriendlystars/talker.py | Talker.speak | def speak(self, string='', level=0, progress=False):
'''If verbose=True and terse=False, this will print to terminal. Otherwise, it won't.'''
if self._pithy == False:
self.report(string=string, level=level, progress=progress) | python | def speak(self, string='', level=0, progress=False):
'''If verbose=True and terse=False, this will print to terminal. Otherwise, it won't.'''
if self._pithy == False:
self.report(string=string, level=level, progress=progress) | [
"def",
"speak",
"(",
"self",
",",
"string",
"=",
"''",
",",
"level",
"=",
"0",
",",
"progress",
"=",
"False",
")",
":",
"if",
"self",
".",
"_pithy",
"==",
"False",
":",
"self",
".",
"report",
"(",
"string",
"=",
"string",
",",
"level",
"=",
"leve... | If verbose=True and terse=False, this will print to terminal. Otherwise, it won't. | [
"If",
"verbose",
"=",
"True",
"and",
"terse",
"=",
"False",
"this",
"will",
"print",
"to",
"terminal",
".",
"Otherwise",
"it",
"won",
"t",
"."
] | train | https://github.com/zkbt/the-friendly-stars/blob/50d3f979e79e63c66629065c75595696dc79802e/thefriendlystars/talker.py#L29-L32 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.