repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
faxir/faxir-python | faxir/api/numbers_api.py | NumbersApi.list_numbers | def list_numbers(self, **kwargs): # noqa: E501
"""Get your numbers # noqa: E501
List all your purchased numbers # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.list_numbers(asy... | python | def list_numbers(self, **kwargs): # noqa: E501
"""Get your numbers # noqa: E501
List all your purchased numbers # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.list_numbers(asy... | [
"def",
"list_numbers",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'async'",
")",
":",
"return",
"self",
".",
"list_numbers_with_http_info",
"(... | Get your numbers # noqa: E501
List all your purchased numbers # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.list_numbers(async=True)
>>> result = thread.get()
:param ... | [
"Get",
"your",
"numbers",
"#",
"noqa",
":",
"E501"
] | 75ed2ea487a6be537342baea1077a02b0c8e70c1 | https://github.com/faxir/faxir-python/blob/75ed2ea487a6be537342baea1077a02b0c8e70c1/faxir/api/numbers_api.py#L135-L154 | train | List all your numbers |
faxir/faxir-python | faxir/api/numbers_api.py | NumbersApi.revoke_number | def revoke_number(self, number, **kwargs): # noqa: E501
"""Revoke number # noqa: E501
Revoke a specific number from your corporate member # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thr... | python | def revoke_number(self, number, **kwargs): # noqa: E501
"""Revoke number # noqa: E501
Revoke a specific number from your corporate member # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thr... | [
"def",
"revoke_number",
"(",
"self",
",",
"number",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'async'",
")",
":",
"return",
"self",
".",
"revoke_number_... | Revoke number # noqa: E501
Revoke a specific number from your corporate member # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.revoke_number(number, async=True)
>>> result = thr... | [
"Revoke",
"number",
"#",
"noqa",
":",
"E501"
] | 75ed2ea487a6be537342baea1077a02b0c8e70c1 | https://github.com/faxir/faxir-python/blob/75ed2ea487a6be537342baea1077a02b0c8e70c1/faxir/api/numbers_api.py#L226-L246 | train | Revoke a specific number from your corporate member. |
faxir/faxir-python | faxir/api/numbers_api.py | NumbersApi.update_number | def update_number(self, number, payload_number_modification, **kwargs): # noqa: E501
"""Assign number # noqa: E501
With this API call you will be able to assign a specific number to a specific account (one of your members). # noqa: E501
This method makes a synchronous HTTP request by default... | python | def update_number(self, number, payload_number_modification, **kwargs): # noqa: E501
"""Assign number # noqa: E501
With this API call you will be able to assign a specific number to a specific account (one of your members). # noqa: E501
This method makes a synchronous HTTP request by default... | [
"def",
"update_number",
"(",
"self",
",",
"number",
",",
"payload_number_modification",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'async'",
")",
":",
"ret... | Assign number # noqa: E501
With this API call you will be able to assign a specific number to a specific account (one of your members). # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.u... | [
"Assign",
"number",
"#",
"noqa",
":",
"E501"
] | 75ed2ea487a6be537342baea1077a02b0c8e70c1 | https://github.com/faxir/faxir-python/blob/75ed2ea487a6be537342baea1077a02b0c8e70c1/faxir/api/numbers_api.py#L325-L346 | train | Assign a number to a specific account. |
FNNDSC/pfurl | pfurl/pfurl.py | zipdir | def zipdir(path, ziph, **kwargs):
"""
Zip up a directory.
:param path:
:param ziph:
:param kwargs:
:return:
"""
str_arcroot = ""
for k, v in kwargs.items():
if k == 'arcroot': str_arcroot = v
for root, dirs, files in os.walk(path):
for file in files:
... | python | def zipdir(path, ziph, **kwargs):
"""
Zip up a directory.
:param path:
:param ziph:
:param kwargs:
:return:
"""
str_arcroot = ""
for k, v in kwargs.items():
if k == 'arcroot': str_arcroot = v
for root, dirs, files in os.walk(path):
for file in files:
... | [
"def",
"zipdir",
"(",
"path",
",",
"ziph",
",",
"*",
"*",
"kwargs",
")",
":",
"str_arcroot",
"=",
"\"\"",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"k",
"==",
"'arcroot'",
":",
"str_arcroot",
"=",
"v",
"for",
"root"... | Zip up a directory.
:param path:
:param ziph:
:param kwargs:
:return: | [
"Zip",
"up",
"a",
"directory",
"."
] | 572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958 | https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L1350-L1373 | train | Zip up a directory. |
FNNDSC/pfurl | pfurl/pfurl.py | zip_process | def zip_process(**kwargs):
"""
Process zip operations.
:param kwargs:
:return:
"""
str_localPath = ""
str_zipFileName = ""
str_action = "zip"
str_arcroot = ""
for k,v in kwargs.items():
if k == 'path': str_localPath = v
if k == 'action':... | python | def zip_process(**kwargs):
"""
Process zip operations.
:param kwargs:
:return:
"""
str_localPath = ""
str_zipFileName = ""
str_action = "zip"
str_arcroot = ""
for k,v in kwargs.items():
if k == 'path': str_localPath = v
if k == 'action':... | [
"def",
"zip_process",
"(",
"*",
"*",
"kwargs",
")",
":",
"str_localPath",
"=",
"\"\"",
"str_zipFileName",
"=",
"\"\"",
"str_action",
"=",
"\"zip\"",
"str_arcroot",
"=",
"\"\"",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"k... | Process zip operations.
:param kwargs:
:return: | [
"Process",
"zip",
"operations",
"."
] | 572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958 | https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L1376-L1435 | train | Process zip operations. |
FNNDSC/pfurl | pfurl/pfurl.py | base64_process | def base64_process(**kwargs):
"""
Process base64 file io
"""
str_fileToSave = ""
str_fileToRead = ""
str_action = "encode"
data = None
for k,v in kwargs.items():
if k == 'action': str_action = v
if k == 'payloadBytes'... | python | def base64_process(**kwargs):
"""
Process base64 file io
"""
str_fileToSave = ""
str_fileToRead = ""
str_action = "encode"
data = None
for k,v in kwargs.items():
if k == 'action': str_action = v
if k == 'payloadBytes'... | [
"def",
"base64_process",
"(",
"*",
"*",
"kwargs",
")",
":",
"str_fileToSave",
"=",
"\"\"",
"str_fileToRead",
"=",
"\"\"",
"str_action",
"=",
"\"encode\"",
"data",
"=",
"None",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"k"... | Process base64 file io | [
"Process",
"base64",
"file",
"io"
] | 572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958 | https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L1438-L1488 | train | Process base64 file io
|
FNNDSC/pfurl | pfurl/pfurl.py | Pfurl.storage_resolveBasedOnKey | def storage_resolveBasedOnKey(self, *args, **kwargs):
"""
Call the remote service and ask for the storage location based on the key.
:param args:
:param kwargs:
:return:
"""
global Gd_internalvar
d_msg = {
'action': 'internalctl',
... | python | def storage_resolveBasedOnKey(self, *args, **kwargs):
"""
Call the remote service and ask for the storage location based on the key.
:param args:
:param kwargs:
:return:
"""
global Gd_internalvar
d_msg = {
'action': 'internalctl',
... | [
"def",
"storage_resolveBasedOnKey",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"global",
"Gd_internalvar",
"d_msg",
"=",
"{",
"'action'",
":",
"'internalctl'",
",",
"'meta'",
":",
"{",
"'var'",
":",
"'key2address'",
",",
"'compute'",
... | Call the remote service and ask for the storage location based on the key.
:param args:
:param kwargs:
:return: | [
"Call",
"the",
"remote",
"service",
"and",
"ask",
"for",
"the",
"storage",
"location",
"based",
"on",
"the",
"key",
"."
] | 572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958 | https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L190-L221 | train | Call the remote service and ask for the storage location based on the key. |
FNNDSC/pfurl | pfurl/pfurl.py | Pfurl.remoteLocation_resolveSimple | def remoteLocation_resolveSimple(self, d_remote):
"""
Resolve the remote "path" location by returning either the
'path' or 'key' parameter in the 'remote' JSON record.
:param d_remote:
:return:
"""
b_status = False
str_remotePath = ""
if '... | python | def remoteLocation_resolveSimple(self, d_remote):
"""
Resolve the remote "path" location by returning either the
'path' or 'key' parameter in the 'remote' JSON record.
:param d_remote:
:return:
"""
b_status = False
str_remotePath = ""
if '... | [
"def",
"remoteLocation_resolveSimple",
"(",
"self",
",",
"d_remote",
")",
":",
"b_status",
"=",
"False",
"str_remotePath",
"=",
"\"\"",
"if",
"'path'",
"in",
"d_remote",
".",
"keys",
"(",
")",
":",
"str_remotePath",
"=",
"d_remote",
"[",
"'path'",
"]",
"b_st... | Resolve the remote "path" location by returning either the
'path' or 'key' parameter in the 'remote' JSON record.
:param d_remote:
:return: | [
"Resolve",
"the",
"remote",
"path",
"location",
"by",
"returning",
"either",
"the",
"path",
"or",
"key",
"parameter",
"in",
"the",
"remote",
"JSON",
"record",
"."
] | 572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958 | https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L223-L242 | train | Resolve the remote path location by returning either the
status or the
path parameter in the remote JSON record. |
FNNDSC/pfurl | pfurl/pfurl.py | Pfurl.remoteLocation_resolve | def remoteLocation_resolve(self, d_remote):
"""
Resolve the remote path location
:param d_remote: the "remote" specification
:return: a string representation of the remote path
"""
b_status = False
str_remotePath = ""
if 'path' in d_remote.keys():... | python | def remoteLocation_resolve(self, d_remote):
"""
Resolve the remote path location
:param d_remote: the "remote" specification
:return: a string representation of the remote path
"""
b_status = False
str_remotePath = ""
if 'path' in d_remote.keys():... | [
"def",
"remoteLocation_resolve",
"(",
"self",
",",
"d_remote",
")",
":",
"b_status",
"=",
"False",
"str_remotePath",
"=",
"\"\"",
"if",
"'path'",
"in",
"d_remote",
".",
"keys",
"(",
")",
":",
"str_remotePath",
"=",
"d_remote",
"[",
"'path'",
"]",
"b_status",... | Resolve the remote path location
:param d_remote: the "remote" specification
:return: a string representation of the remote path | [
"Resolve",
"the",
"remote",
"path",
"location"
] | 572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958 | https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L244-L264 | train | Resolve the remote path location |
FNNDSC/pfurl | pfurl/pfurl.py | Pfurl.man | def man(self, **kwargs):
"""
Print some man for each understood command
"""
str_man = 'commands'
str_amount = 'full'
for k, v in kwargs.items():
if k == 'on': str_man = v
if k == 'amount': str_amount = v
if str_man == '... | python | def man(self, **kwargs):
"""
Print some man for each understood command
"""
str_man = 'commands'
str_amount = 'full'
for k, v in kwargs.items():
if k == 'on': str_man = v
if k == 'amount': str_amount = v
if str_man == '... | [
"def",
"man",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"str_man",
"=",
"'commands'",
"str_amount",
"=",
"'full'",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"k",
"==",
"'on'",
":",
"str_man",
"=",
"v",
"if",
... | Print some man for each understood command | [
"Print",
"some",
"man",
"for",
"each",
"understood",
"command"
] | 572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958 | https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L266-L330 | train | Print some man for each understood command in the log file. |
FNNDSC/pfurl | pfurl/pfurl.py | Pfurl.pull_core | def pull_core(self, **kwargs):
"""
Just the core of the pycurl logic.
"""
str_ip = self.str_ip
str_port = self.str_port
verbose = 0
d_msg = {}
for k,v in kwargs.items():
if k == 'ip': st... | python | def pull_core(self, **kwargs):
"""
Just the core of the pycurl logic.
"""
str_ip = self.str_ip
str_port = self.str_port
verbose = 0
d_msg = {}
for k,v in kwargs.items():
if k == 'ip': st... | [
"def",
"pull_core",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"str_ip",
"=",
"self",
".",
"str_ip",
"str_port",
"=",
"self",
".",
"str_port",
"verbose",
"=",
"0",
"d_msg",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"... | Just the core of the pycurl logic. | [
"Just",
"the",
"core",
"of",
"the",
"pycurl",
"logic",
"."
] | 572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958 | https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L517-L574 | train | Pull the core of the pycurl logic. |
FNNDSC/pfurl | pfurl/pfurl.py | Pfurl.pullPath_core | def pullPath_core(self, **kwargs):
"""
Just the core of the pycurl logic.
"""
d_msg = self.d_msg
for k,v in kwargs.items():
if k == 'd_msg': d_msg = v
str_response = self.pull_core(msg = d_msg)
if len(str_response) < 800:
# It... | python | def pullPath_core(self, **kwargs):
"""
Just the core of the pycurl logic.
"""
d_msg = self.d_msg
for k,v in kwargs.items():
if k == 'd_msg': d_msg = v
str_response = self.pull_core(msg = d_msg)
if len(str_response) < 800:
# It... | [
"def",
"pullPath_core",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"d_msg",
"=",
"self",
".",
"d_msg",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"k",
"==",
"'d_msg'",
":",
"d_msg",
"=",
"v",
"str_response",
"="... | Just the core of the pycurl logic. | [
"Just",
"the",
"core",
"of",
"the",
"pycurl",
"logic",
"."
] | 572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958 | https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L576-L625 | train | This function pulls the core of the pycurl logic and returns the core of the pycurl logic. |
FNNDSC/pfurl | pfurl/pfurl.py | Pfurl.pullPath_copy | def pullPath_copy(self, d_msg, **kwargs):
"""
Handle the "copy" pull operation
"""
# Parse "header" information
d_meta = d_msg['meta']
d_local = d_meta['local']
str_localPath = d_local['path']
d_remote = d_meta['r... | python | def pullPath_copy(self, d_msg, **kwargs):
"""
Handle the "copy" pull operation
"""
# Parse "header" information
d_meta = d_msg['meta']
d_local = d_meta['local']
str_localPath = d_local['path']
d_remote = d_meta['r... | [
"def",
"pullPath_copy",
"(",
"self",
",",
"d_msg",
",",
"*",
"*",
"kwargs",
")",
":",
"# Parse \"header\" information",
"d_meta",
"=",
"d_msg",
"[",
"'meta'",
"]",
"d_local",
"=",
"d_meta",
"[",
"'local'",
"]",
"str_localPath",
"=",
"d_local",
"[",
"'path'",... | Handle the "copy" pull operation | [
"Handle",
"the",
"copy",
"pull",
"operation"
] | 572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958 | https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L776-L799 | train | Pulls the path of a copy from the server into a dictionary holder. |
FNNDSC/pfurl | pfurl/pfurl.py | Pfurl.path_localLocationCheck | def path_localLocationCheck(self, d_msg, **kwargs):
"""
Check if a path exists on the local filesystem
:param self:
:param kwargs:
:return:
"""
b_pull = False
d_meta = d_msg['meta']
if 'do' in d_meta:
... | python | def path_localLocationCheck(self, d_msg, **kwargs):
"""
Check if a path exists on the local filesystem
:param self:
:param kwargs:
:return:
"""
b_pull = False
d_meta = d_msg['meta']
if 'do' in d_meta:
... | [
"def",
"path_localLocationCheck",
"(",
"self",
",",
"d_msg",
",",
"*",
"*",
"kwargs",
")",
":",
"b_pull",
"=",
"False",
"d_meta",
"=",
"d_msg",
"[",
"'meta'",
"]",
"if",
"'do'",
"in",
"d_meta",
":",
"if",
"d_meta",
"[",
"'do'",
"]",
"==",
"'pull'",
"... | Check if a path exists on the local filesystem
:param self:
:param kwargs:
:return: | [
"Check",
"if",
"a",
"path",
"exists",
"on",
"the",
"local",
"filesystem"
] | 572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958 | https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L810-L879 | train | Check if a path exists on the local filesystem. |
FNNDSC/pfurl | pfurl/pfurl.py | Pfurl.pushPath_copy | def pushPath_copy(self, d_msg, **kwargs):
"""
Handle the "copy" pull operation
"""
# Parse "header" information
d_meta = d_msg['meta']
d_local = d_meta['local']
str_localPath = d_local['path']
d_remote = d_meta['r... | python | def pushPath_copy(self, d_msg, **kwargs):
"""
Handle the "copy" pull operation
"""
# Parse "header" information
d_meta = d_msg['meta']
d_local = d_meta['local']
str_localPath = d_local['path']
d_remote = d_meta['r... | [
"def",
"pushPath_copy",
"(",
"self",
",",
"d_msg",
",",
"*",
"*",
"kwargs",
")",
":",
"# Parse \"header\" information",
"d_meta",
"=",
"d_msg",
"[",
"'meta'",
"]",
"d_local",
"=",
"d_meta",
"[",
"'local'",
"]",
"str_localPath",
"=",
"d_local",
"[",
"'path'",... | Handle the "copy" pull operation | [
"Handle",
"the",
"copy",
"pull",
"operation"
] | 572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958 | https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L1116-L1140 | train | Handle the copy pull operation |
FNNDSC/pfurl | pfurl/pfurl.py | Pfurl.pathOp_do | def pathOp_do(self, d_msg, **kwargs):
"""
Entry point for path-based push/pull calls.
Essentially, this method is the central dispatching nexus to various
specialized push operations.
"""
d_meta = d_msg['meta']
b_OK = True
d_... | python | def pathOp_do(self, d_msg, **kwargs):
"""
Entry point for path-based push/pull calls.
Essentially, this method is the central dispatching nexus to various
specialized push operations.
"""
d_meta = d_msg['meta']
b_OK = True
d_... | [
"def",
"pathOp_do",
"(",
"self",
",",
"d_msg",
",",
"*",
"*",
"kwargs",
")",
":",
"d_meta",
"=",
"d_msg",
"[",
"'meta'",
"]",
"b_OK",
"=",
"True",
"d_ret",
"=",
"{",
"}",
"str_action",
"=",
"\"pull\"",
"for",
"k",
",",
"v",
",",
"in",
"kwargs",
"... | Entry point for path-based push/pull calls.
Essentially, this method is the central dispatching nexus to various
specialized push operations. | [
"Entry",
"point",
"for",
"path",
"-",
"based",
"push",
"/",
"pull",
"calls",
"."
] | 572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958 | https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L1142-L1227 | train | This method is used to dispatch path - based push or pull calls. |
FNNDSC/pfurl | pfurl/pfurl.py | Pfurl.httpResponse_bodyParse | def httpResponse_bodyParse(self, **kwargs):
"""
Returns the *body* from a http response.
:param kwargs: response = <string>
:return: the <body> from the http <string>
"""
str_response = ''
for k,v in kwargs.items():
if k == 'response': str_respons... | python | def httpResponse_bodyParse(self, **kwargs):
"""
Returns the *body* from a http response.
:param kwargs: response = <string>
:return: the <body> from the http <string>
"""
str_response = ''
for k,v in kwargs.items():
if k == 'response': str_respons... | [
"def",
"httpResponse_bodyParse",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"str_response",
"=",
"''",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"k",
"==",
"'response'",
":",
"str_response",
"=",
"v",
"try",
":",
... | Returns the *body* from a http response.
:param kwargs: response = <string>
:return: the <body> from the http <string> | [
"Returns",
"the",
"*",
"body",
"*",
"from",
"a",
"http",
"response",
"."
] | 572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958 | https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L1295-L1312 | train | Parse the HTTP response body. |
bitesofcode/projexui | projexui/widgets/xswitchbutton.py | XSwitchButton.currentPixmapRect | def currentPixmapRect(self):
"""
Returns the rect that defines the boundary for the current pixmap
based on the size of the button and the size of the pixmap.
:return <QtCore.QRect>
"""
pixmap = self.currentPixmap()
rect = self.rect()
... | python | def currentPixmapRect(self):
"""
Returns the rect that defines the boundary for the current pixmap
based on the size of the button and the size of the pixmap.
:return <QtCore.QRect>
"""
pixmap = self.currentPixmap()
rect = self.rect()
... | [
"def",
"currentPixmapRect",
"(",
"self",
")",
":",
"pixmap",
"=",
"self",
".",
"currentPixmap",
"(",
")",
"rect",
"=",
"self",
".",
"rect",
"(",
")",
"size",
"=",
"pixmap",
".",
"size",
"(",
")",
"x",
"=",
"rect",
".",
"center",
"(",
")",
".",
"x... | Returns the rect that defines the boundary for the current pixmap
based on the size of the button and the size of the pixmap.
:return <QtCore.QRect> | [
"Returns",
"the",
"rect",
"that",
"defines",
"the",
"boundary",
"for",
"the",
"current",
"pixmap",
"based",
"on",
"the",
"size",
"of",
"the",
"button",
"and",
"the",
"size",
"of",
"the",
"pixmap",
".",
":",
"return",
"<QtCore",
".",
"QRect",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xswitchbutton.py#L47-L61 | train | Returns the rect that defines the boundary for the current pixmap. |
bitesofcode/projexui | projexui/widgets/xswitchbutton.py | XSwitchButton.paintEvent | def paintEvent(self, event):
"""
Draws the pixmap for this widget.
:param event | <QPaintEvent>
"""
pixmap = self.currentPixmap()
rect = self.currentPixmapRect()
with XPainter(self) as painter:
painter.drawPixmap(rect... | python | def paintEvent(self, event):
"""
Draws the pixmap for this widget.
:param event | <QPaintEvent>
"""
pixmap = self.currentPixmap()
rect = self.currentPixmapRect()
with XPainter(self) as painter:
painter.drawPixmap(rect... | [
"def",
"paintEvent",
"(",
"self",
",",
"event",
")",
":",
"pixmap",
"=",
"self",
".",
"currentPixmap",
"(",
")",
"rect",
"=",
"self",
".",
"currentPixmapRect",
"(",
")",
"with",
"XPainter",
"(",
"self",
")",
"as",
"painter",
":",
"painter",
".",
"drawP... | Draws the pixmap for this widget.
:param event | <QPaintEvent> | [
"Draws",
"the",
"pixmap",
"for",
"this",
"widget",
".",
":",
"param",
"event",
"|",
"<QPaintEvent",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xswitchbutton.py#L88-L98 | train | Draws the pixmap for this widget. |
bitesofcode/projexui | projexui/widgets/xswitchbutton.py | XSwitchButton.setOffPixmap | def setOffPixmap(self, pixmap):
"""
Sets the off pixmap that will be used for this button to the
given pixmap. This can be a QPixmap instance, or a string for where
to load the pixmap from.
:param pixmap | <QtGui.QPixmap> || <str>
"""
pmap =... | python | def setOffPixmap(self, pixmap):
"""
Sets the off pixmap that will be used for this button to the
given pixmap. This can be a QPixmap instance, or a string for where
to load the pixmap from.
:param pixmap | <QtGui.QPixmap> || <str>
"""
pmap =... | [
"def",
"setOffPixmap",
"(",
"self",
",",
"pixmap",
")",
":",
"pmap",
"=",
"QtGui",
".",
"QPixmap",
"(",
"pixmap",
")",
"self",
".",
"_offPixmap",
"=",
"pmap",
".",
"scaled",
"(",
"self",
".",
"width",
"(",
")",
",",
"self",
".",
"height",
"(",
")",... | Sets the off pixmap that will be used for this button to the
given pixmap. This can be a QPixmap instance, or a string for where
to load the pixmap from.
:param pixmap | <QtGui.QPixmap> || <str> | [
"Sets",
"the",
"off",
"pixmap",
"that",
"will",
"be",
"used",
"for",
"this",
"button",
"to",
"the",
"given",
"pixmap",
".",
"This",
"can",
"be",
"a",
"QPixmap",
"instance",
"or",
"a",
"string",
"for",
"where",
"to",
"load",
"the",
"pixmap",
"from",
"."... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xswitchbutton.py#L100-L111 | train | Sets the off pixmap that will be used for this button to the given pixmap. |
bitesofcode/projexui | projexui/widgets/xswitchbutton.py | XSwitchButton.setOnPixmap | def setOnPixmap(self, pixmap):
"""
Sets the on pixmap that will be used for this button to the given
pixmap. THis can be a QPixmap instance, or a string for where to load
the pixmap from.
:param pixmap | <QtGui.QPixmap> || <str>
"""
pmap = Q... | python | def setOnPixmap(self, pixmap):
"""
Sets the on pixmap that will be used for this button to the given
pixmap. THis can be a QPixmap instance, or a string for where to load
the pixmap from.
:param pixmap | <QtGui.QPixmap> || <str>
"""
pmap = Q... | [
"def",
"setOnPixmap",
"(",
"self",
",",
"pixmap",
")",
":",
"pmap",
"=",
"QtGui",
".",
"QPixmap",
"(",
"pixmap",
")",
"self",
".",
"_onPixmap",
"=",
"pmap",
".",
"scaled",
"(",
"self",
".",
"width",
"(",
")",
",",
"self",
".",
"height",
"(",
")",
... | Sets the on pixmap that will be used for this button to the given
pixmap. THis can be a QPixmap instance, or a string for where to load
the pixmap from.
:param pixmap | <QtGui.QPixmap> || <str> | [
"Sets",
"the",
"on",
"pixmap",
"that",
"will",
"be",
"used",
"for",
"this",
"button",
"to",
"the",
"given",
"pixmap",
".",
"THis",
"can",
"be",
"a",
"QPixmap",
"instance",
"or",
"a",
"string",
"for",
"where",
"to",
"load",
"the",
"pixmap",
"from",
".",... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xswitchbutton.py#L113-L124 | train | Sets the on pixmap that will be used for this button. |
bitesofcode/projexui | projexui/widgets/xchart/xchartdataset.py | XChartDataset.color | def color(self, key=None):
"""
Returns the color for this data set.
:return <QColor>
"""
if key is not None:
return self._colorMap.get(nativestring(key), self._color)
return self._color | python | def color(self, key=None):
"""
Returns the color for this data set.
:return <QColor>
"""
if key is not None:
return self._colorMap.get(nativestring(key), self._color)
return self._color | [
"def",
"color",
"(",
"self",
",",
"key",
"=",
"None",
")",
":",
"if",
"key",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_colorMap",
".",
"get",
"(",
"nativestring",
"(",
"key",
")",
",",
"self",
".",
"_color",
")",
"return",
"self",
".",
"... | Returns the color for this data set.
:return <QColor> | [
"Returns",
"the",
"color",
"for",
"this",
"data",
"set",
".",
":",
"return",
"<QColor",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/xchartdataset.py#L39-L47 | train | Returns the color for the current data set. |
bitesofcode/projexui | projexui/widgets/xchart/xchartdataset.py | XChartDataset.dragData | def dragData(self, key=None, default=None):
"""
Returns the drag data associated with this data set. This will be
used when the user attempts to drag & drop a data set from the
chart somewhere. If no key is supplied, then the full data dictionary
is returned.
... | python | def dragData(self, key=None, default=None):
"""
Returns the drag data associated with this data set. This will be
used when the user attempts to drag & drop a data set from the
chart somewhere. If no key is supplied, then the full data dictionary
is returned.
... | [
"def",
"dragData",
"(",
"self",
",",
"key",
"=",
"None",
",",
"default",
"=",
"None",
")",
":",
"if",
"key",
"is",
"None",
":",
"return",
"self",
".",
"_dragData",
"return",
"self",
".",
"_dragData",
".",
"get",
"(",
"nativestring",
"(",
"key",
")",
... | Returns the drag data associated with this data set. This will be
used when the user attempts to drag & drop a data set from the
chart somewhere. If no key is supplied, then the full data dictionary
is returned.
:param key | <str> || None
de... | [
"Returns",
"the",
"drag",
"data",
"associated",
"with",
"this",
"data",
"set",
".",
"This",
"will",
"be",
"used",
"when",
"the",
"user",
"attempts",
"to",
"drag",
"&",
"drop",
"a",
"data",
"set",
"from",
"the",
"chart",
"somewhere",
".",
"If",
"no",
"k... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/xchartdataset.py#L57-L72 | train | Returns the drag data associated with this data set. |
bitesofcode/projexui | projexui/widgets/xchart/xchartdataset.py | XChartDataset.setColor | def setColor(self, color, key=None):
"""
Sets the color for this data set.
:param color | <QColor>
"""
self._color = QColor(color)
if key is not None:
self._colorMap[nativestring(key)] = self._color | python | def setColor(self, color, key=None):
"""
Sets the color for this data set.
:param color | <QColor>
"""
self._color = QColor(color)
if key is not None:
self._colorMap[nativestring(key)] = self._color | [
"def",
"setColor",
"(",
"self",
",",
"color",
",",
"key",
"=",
"None",
")",
":",
"self",
".",
"_color",
"=",
"QColor",
"(",
"color",
")",
"if",
"key",
"is",
"not",
"None",
":",
"self",
".",
"_colorMap",
"[",
"nativestring",
"(",
"key",
")",
"]",
... | Sets the color for this data set.
:param color | <QColor> | [
"Sets",
"the",
"color",
"for",
"this",
"data",
"set",
".",
":",
"param",
"color",
"|",
"<QColor",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/xchartdataset.py#L122-L130 | train | Sets the color for the object. |
bitesofcode/projexui | projexui/widgets/xchart/xchartdataset.py | XChartDataset.values | def values(self, axis=None):
"""
Returns the values for this dataset.
:return [{<str> axis: <variant> value, ..}, ..]
"""
if axis is None:
return self._plot
else:
return [value.get(axis) for value in self._plot] | python | def values(self, axis=None):
"""
Returns the values for this dataset.
:return [{<str> axis: <variant> value, ..}, ..]
"""
if axis is None:
return self._plot
else:
return [value.get(axis) for value in self._plot] | [
"def",
"values",
"(",
"self",
",",
"axis",
"=",
"None",
")",
":",
"if",
"axis",
"is",
"None",
":",
"return",
"self",
".",
"_plot",
"else",
":",
"return",
"[",
"value",
".",
"get",
"(",
"axis",
")",
"for",
"value",
"in",
"self",
".",
"_plot",
"]"
... | Returns the values for this dataset.
:return [{<str> axis: <variant> value, ..}, ..] | [
"Returns",
"the",
"values",
"for",
"this",
"dataset",
".",
":",
"return",
"[",
"{",
"<str",
">",
"axis",
":",
"<variant",
">",
"value",
"..",
"}",
"..",
"]"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/xchartdataset.py#L158-L167 | train | Returns the values for this dataset along the specified axis. |
SkullTech/webdriver-start | wdstart/helper.py | find_file | def find_file(name, path=os.getcwd(), deep=False, partial=False):
"""
Searches for a file and returns its path upon finding it.
Searches for a file with the given `name` in the list of directories
mentioned in `path`. It also supports `deep` search (recursive) and
`partial` search (searching for fi... | python | def find_file(name, path=os.getcwd(), deep=False, partial=False):
"""
Searches for a file and returns its path upon finding it.
Searches for a file with the given `name` in the list of directories
mentioned in `path`. It also supports `deep` search (recursive) and
`partial` search (searching for fi... | [
"def",
"find_file",
"(",
"name",
",",
"path",
"=",
"os",
".",
"getcwd",
"(",
")",
",",
"deep",
"=",
"False",
",",
"partial",
"=",
"False",
")",
":",
"paths",
"=",
"path",
".",
"split",
"(",
"os",
".",
"pathsep",
")",
"if",
"type",
"(",
"path",
... | Searches for a file and returns its path upon finding it.
Searches for a file with the given `name` in the list of directories
mentioned in `path`. It also supports `deep` search (recursive) and
`partial` search (searching for files having filename matching
partially with the query) through the respect... | [
"Searches",
"for",
"a",
"file",
"and",
"returns",
"its",
"path",
"upon",
"finding",
"it",
"."
] | 26285fd84c4deaf8906828e0ec0758a650b7ba49 | https://github.com/SkullTech/webdriver-start/blob/26285fd84c4deaf8906828e0ec0758a650b7ba49/wdstart/helper.py#L5-L41 | train | Searches for a file and returns its path upon finding it. |
SkullTech/webdriver-start | wdstart/helper.py | __find_file | def __find_file(name, path, deep=False, partial=False):
"""
Searches for a file and returns its path upon finding it.
Searches for a file with the given `name` in the list of directory
mentioned in `path`. It also supports `deep` search (recursive) and
`partial` search (searching for files having f... | python | def __find_file(name, path, deep=False, partial=False):
"""
Searches for a file and returns its path upon finding it.
Searches for a file with the given `name` in the list of directory
mentioned in `path`. It also supports `deep` search (recursive) and
`partial` search (searching for files having f... | [
"def",
"__find_file",
"(",
"name",
",",
"path",
",",
"deep",
"=",
"False",
",",
"partial",
"=",
"False",
")",
":",
"if",
"deep",
":",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"path",
")",
":",
"if",
"partial",
":",
... | Searches for a file and returns its path upon finding it.
Searches for a file with the given `name` in the list of directory
mentioned in `path`. It also supports `deep` search (recursive) and
`partial` search (searching for files having filename matching
partially with the query) through the respectiv... | [
"Searches",
"for",
"a",
"file",
"and",
"returns",
"its",
"path",
"upon",
"finding",
"it",
"."
] | 26285fd84c4deaf8906828e0ec0758a650b7ba49 | https://github.com/SkullTech/webdriver-start/blob/26285fd84c4deaf8906828e0ec0758a650b7ba49/wdstart/helper.py#L44-L88 | train | Searches for a file in the given path and returns its path upon finding it. |
SkullTech/webdriver-start | wdstart/helper.py | find_executable | def find_executable(name):
"""
Returns the path of an executable file.
Searches for an executable with the given name, first in the `PATH`,
then in the current directory (recursively). Upon finding the file,
returns the full filepath of it.
Parameters
----------
name : str
The... | python | def find_executable(name):
"""
Returns the path of an executable file.
Searches for an executable with the given name, first in the `PATH`,
then in the current directory (recursively). Upon finding the file,
returns the full filepath of it.
Parameters
----------
name : str
The... | [
"def",
"find_executable",
"(",
"name",
")",
":",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"'win'",
")",
"or",
"os",
".",
"name",
".",
"startswith",
"(",
"'os2'",
")",
":",
"name",
"=",
"name",
"+",
"'.exe'",
"executable_path",
"=",
"find_f... | Returns the path of an executable file.
Searches for an executable with the given name, first in the `PATH`,
then in the current directory (recursively). Upon finding the file,
returns the full filepath of it.
Parameters
----------
name : str
The name of the executable. This is platfo... | [
"Returns",
"the",
"path",
"of",
"an",
"executable",
"file",
"."
] | 26285fd84c4deaf8906828e0ec0758a650b7ba49 | https://github.com/SkullTech/webdriver-start/blob/26285fd84c4deaf8906828e0ec0758a650b7ba49/wdstart/helper.py#L91-L117 | train | Returns the full path of an executable file. |
swappsco/django-email | django_email/djemail.py | send_email | def send_email(to=None, message=None, template='base',
context={}, subject=None):
"""
Generic Method to Send Emails from template in an easier and modular way
:param to: Email Address to send the email message
:param message: Message content that is added to context
:param template: P... | python | def send_email(to=None, message=None, template='base',
context={}, subject=None):
"""
Generic Method to Send Emails from template in an easier and modular way
:param to: Email Address to send the email message
:param message: Message content that is added to context
:param template: P... | [
"def",
"send_email",
"(",
"to",
"=",
"None",
",",
"message",
"=",
"None",
",",
"template",
"=",
"'base'",
",",
"context",
"=",
"{",
"}",
",",
"subject",
"=",
"None",
")",
":",
"from_email",
"=",
"settings",
".",
"DEFAULT_FROM_EMAIL",
"if",
"to",
"is",
... | Generic Method to Send Emails from template in an easier and modular way
:param to: Email Address to send the email message
:param message: Message content that is added to context
:param template: Path of the email template (Without extension)
:param context: Dict context variables to send to the templ... | [
"Generic",
"Method",
"to",
"Send",
"Emails",
"from",
"template",
"in",
"an",
"easier",
"and",
"modular",
"way",
":",
"param",
"to",
":",
"Email",
"Address",
"to",
"send",
"the",
"email",
"message",
":",
"param",
"message",
":",
"Message",
"content",
"that"... | bc89a9b0bfa35748f5022abcd4cb3cfce0a10de2 | https://github.com/swappsco/django-email/blob/bc89a9b0bfa35748f5022abcd4cb3cfce0a10de2/django_email/djemail.py#L10-L64 | train | Send an email from a template |
starling-lab/rnlp | rnlp/corpus.py | readCorpus | def readCorpus(location):
"""
Returns the contents of a file or a group of files as a string.
:param location: .txt file or a directory to read files from.
:type location: str.
:returns: A string of all contents joined together.
:rtype: str.
.. note::
This function takes a ``loca... | python | def readCorpus(location):
"""
Returns the contents of a file or a group of files as a string.
:param location: .txt file or a directory to read files from.
:type location: str.
:returns: A string of all contents joined together.
:rtype: str.
.. note::
This function takes a ``loca... | [
"def",
"readCorpus",
"(",
"location",
")",
":",
"print",
"(",
"\"Reading corpus from file(s)...\"",
")",
"corpus",
"=",
"''",
"if",
"'.txt'",
"in",
"location",
":",
"with",
"open",
"(",
"location",
")",
"as",
"fp",
":",
"corpus",
"=",
"fp",
".",
"read",
... | Returns the contents of a file or a group of files as a string.
:param location: .txt file or a directory to read files from.
:type location: str.
:returns: A string of all contents joined together.
:rtype: str.
.. note::
This function takes a ``location`` on disk as a parameter. Locatio... | [
"Returns",
"the",
"contents",
"of",
"a",
"file",
"or",
"a",
"group",
"of",
"files",
"as",
"a",
"string",
"."
] | 72054cc2c0cbaea1d281bf3d56b271d4da29fc4a | https://github.com/starling-lab/rnlp/blob/72054cc2c0cbaea1d281bf3d56b271d4da29fc4a/rnlp/corpus.py#L33-L78 | train | Reads a corpus from a file or a directory. |
bearyinnovative/bearychat.py | bearychat/incoming.py | validate | def validate(data):
"""Validates incoming data
Args:
data(dict): the incoming data
Returns:
True if the data is valid
Raises:
ValueError: the data is not valid
"""
text = data.get('text')
if not isinstance(text, _string_types) or len(text) == 0:
raise Value... | python | def validate(data):
"""Validates incoming data
Args:
data(dict): the incoming data
Returns:
True if the data is valid
Raises:
ValueError: the data is not valid
"""
text = data.get('text')
if not isinstance(text, _string_types) or len(text) == 0:
raise Value... | [
"def",
"validate",
"(",
"data",
")",
":",
"text",
"=",
"data",
".",
"get",
"(",
"'text'",
")",
"if",
"not",
"isinstance",
"(",
"text",
",",
"_string_types",
")",
"or",
"len",
"(",
"text",
")",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"'text field ... | Validates incoming data
Args:
data(dict): the incoming data
Returns:
True if the data is valid
Raises:
ValueError: the data is not valid | [
"Validates",
"incoming",
"data"
] | 6c7af2d215c2ff7135bb5af66ca333d0ea1089fd | https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/bearychat/incoming.py#L13-L40 | train | Validates incoming data for the
field |
bearyinnovative/bearychat.py | bearychat/incoming.py | send | def send(url, data):
"""Sends an incoming message
Args:
url(str): the incoming hook url
data(dict): the sending data
Returns:
requests.Response
"""
validate(data)
return requests.post(url, json=data) | python | def send(url, data):
"""Sends an incoming message
Args:
url(str): the incoming hook url
data(dict): the sending data
Returns:
requests.Response
"""
validate(data)
return requests.post(url, json=data) | [
"def",
"send",
"(",
"url",
",",
"data",
")",
":",
"validate",
"(",
"data",
")",
"return",
"requests",
".",
"post",
"(",
"url",
",",
"json",
"=",
"data",
")"
] | Sends an incoming message
Args:
url(str): the incoming hook url
data(dict): the sending data
Returns:
requests.Response | [
"Sends",
"an",
"incoming",
"message"
] | 6c7af2d215c2ff7135bb5af66ca333d0ea1089fd | https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/bearychat/incoming.py#L43-L55 | train | Sends an incoming message to the specified url |
bitesofcode/projexui | projexui/widgets/xchart/xchartscene.py | XChartScene.addDataset | def addDataset(self, dataset):
"""
Creates a new dataset instance for this scene.
:param dataset | <XChartDataset>
:return <XChartDatasetItem>
"""
item = XChartDatasetItem()
self.addItem(item)
item.setDataset(dataset)
... | python | def addDataset(self, dataset):
"""
Creates a new dataset instance for this scene.
:param dataset | <XChartDataset>
:return <XChartDatasetItem>
"""
item = XChartDatasetItem()
self.addItem(item)
item.setDataset(dataset)
... | [
"def",
"addDataset",
"(",
"self",
",",
"dataset",
")",
":",
"item",
"=",
"XChartDatasetItem",
"(",
")",
"self",
".",
"addItem",
"(",
"item",
")",
"item",
".",
"setDataset",
"(",
"dataset",
")",
"return",
"item"
] | Creates a new dataset instance for this scene.
:param dataset | <XChartDataset>
:return <XChartDatasetItem> | [
"Creates",
"a",
"new",
"dataset",
"instance",
"for",
"this",
"scene",
".",
":",
"param",
"dataset",
"|",
"<XChartDataset",
">",
":",
"return",
"<XChartDatasetItem",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/xchartscene.py#L27-L38 | train | Adds a dataset instance to this scene. |
bitesofcode/projexui | projexui/widgets/xchart/xchartscene.py | XChartScene.datasetItems | def datasetItems(self):
"""
Returns the items in this scene mapped with their dataset instance.
:return {<XChartDataset>: <QGraphicsItem>, ..}
"""
out = {}
for item in self.items():
if isinstance(item, XChartDatasetItem):
... | python | def datasetItems(self):
"""
Returns the items in this scene mapped with their dataset instance.
:return {<XChartDataset>: <QGraphicsItem>, ..}
"""
out = {}
for item in self.items():
if isinstance(item, XChartDatasetItem):
... | [
"def",
"datasetItems",
"(",
"self",
")",
":",
"out",
"=",
"{",
"}",
"for",
"item",
"in",
"self",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"item",
",",
"XChartDatasetItem",
")",
":",
"out",
"[",
"item",
".",
"dataset",
"(",
")",
"]",
... | Returns the items in this scene mapped with their dataset instance.
:return {<XChartDataset>: <QGraphicsItem>, ..} | [
"Returns",
"the",
"items",
"in",
"this",
"scene",
"mapped",
"with",
"their",
"dataset",
"instance",
".",
":",
"return",
"{",
"<XChartDataset",
">",
":",
"<QGraphicsItem",
">",
"..",
"}"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/xchartscene.py#L48-L58 | train | Returns the items in this scene mapped with their dataset instance. |
bitesofcode/projexui | projexui/widgets/xchart/xchartscene.py | XChartScene.drawBackground | def drawBackground(self, painter, rect):
"""
Draws the background for the chart scene.
:param painter | <QPainter>
rect | <QRect>
"""
chart = self.chart()
chart._drawBackground(self, painter, rect) | python | def drawBackground(self, painter, rect):
"""
Draws the background for the chart scene.
:param painter | <QPainter>
rect | <QRect>
"""
chart = self.chart()
chart._drawBackground(self, painter, rect) | [
"def",
"drawBackground",
"(",
"self",
",",
"painter",
",",
"rect",
")",
":",
"chart",
"=",
"self",
".",
"chart",
"(",
")",
"chart",
".",
"_drawBackground",
"(",
"self",
",",
"painter",
",",
"rect",
")"
] | Draws the background for the chart scene.
:param painter | <QPainter>
rect | <QRect> | [
"Draws",
"the",
"background",
"for",
"the",
"chart",
"scene",
".",
":",
"param",
"painter",
"|",
"<QPainter",
">",
"rect",
"|",
"<QRect",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/xchartscene.py#L60-L68 | train | Draws the background for the current chart. |
bitesofcode/projexui | projexui/widgets/xchart/xchartscene.py | XChartScene.drawForeground | def drawForeground(self, painter, rect):
"""
Draws the foreground for the chart scene.
:param painter | <QPainter>
rect | <QRect>
"""
chart = self.chart()
chart._drawForeground(self, painter, rect) | python | def drawForeground(self, painter, rect):
"""
Draws the foreground for the chart scene.
:param painter | <QPainter>
rect | <QRect>
"""
chart = self.chart()
chart._drawForeground(self, painter, rect) | [
"def",
"drawForeground",
"(",
"self",
",",
"painter",
",",
"rect",
")",
":",
"chart",
"=",
"self",
".",
"chart",
"(",
")",
"chart",
".",
"_drawForeground",
"(",
"self",
",",
"painter",
",",
"rect",
")"
] | Draws the foreground for the chart scene.
:param painter | <QPainter>
rect | <QRect> | [
"Draws",
"the",
"foreground",
"for",
"the",
"chart",
"scene",
".",
":",
"param",
"painter",
"|",
"<QPainter",
">",
"rect",
"|",
"<QRect",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/xchartscene.py#L70-L78 | train | Draws the foreground for the chart scene. |
pnegahdar/inenv | inenv/cli.py | switch_or_run | def switch_or_run(cmd, venv_name=None):
"""Switch or run in this env"""
if cmd:
return _run(venv_name, cmd)
inenv = InenvManager()
if not os.getenv(INENV_ENV_VAR):
activator_warn(inenv)
return
else:
venv = inenv.get_prepped_venv(venv_name)
inenv.clear_extra_so... | python | def switch_or_run(cmd, venv_name=None):
"""Switch or run in this env"""
if cmd:
return _run(venv_name, cmd)
inenv = InenvManager()
if not os.getenv(INENV_ENV_VAR):
activator_warn(inenv)
return
else:
venv = inenv.get_prepped_venv(venv_name)
inenv.clear_extra_so... | [
"def",
"switch_or_run",
"(",
"cmd",
",",
"venv_name",
"=",
"None",
")",
":",
"if",
"cmd",
":",
"return",
"_run",
"(",
"venv_name",
",",
"cmd",
")",
"inenv",
"=",
"InenvManager",
"(",
")",
"if",
"not",
"os",
".",
"getenv",
"(",
"INENV_ENV_VAR",
")",
"... | Switch or run in this env | [
"Switch",
"or",
"run",
"in",
"this",
"env"
] | 8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6 | https://github.com/pnegahdar/inenv/blob/8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6/inenv/cli.py#L91-L108 | train | Switch or run in this env |
pnegahdar/inenv | inenv/cli.py | rm | def rm(venv_name):
""" Removes the venv by name """
inenv = InenvManager()
venv = inenv.get_venv(venv_name)
click.confirm("Delete dir {}".format(venv.path))
shutil.rmtree(venv.path) | python | def rm(venv_name):
""" Removes the venv by name """
inenv = InenvManager()
venv = inenv.get_venv(venv_name)
click.confirm("Delete dir {}".format(venv.path))
shutil.rmtree(venv.path) | [
"def",
"rm",
"(",
"venv_name",
")",
":",
"inenv",
"=",
"InenvManager",
"(",
")",
"venv",
"=",
"inenv",
".",
"get_venv",
"(",
"venv_name",
")",
"click",
".",
"confirm",
"(",
"\"Delete dir {}\"",
".",
"format",
"(",
"venv",
".",
"path",
")",
")",
"shutil... | Removes the venv by name | [
"Removes",
"the",
"venv",
"by",
"name"
] | 8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6 | https://github.com/pnegahdar/inenv/blob/8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6/inenv/cli.py#L113-L118 | train | Removes the venv by name |
pnegahdar/inenv | inenv/cli.py | root | def root(venv_name):
"""Print the root directory of a virtualenv"""
inenv = InenvManager()
inenv.get_venv(venv_name)
venv = inenv.registered_venvs[venv_name]
click.secho(venv['root']) | python | def root(venv_name):
"""Print the root directory of a virtualenv"""
inenv = InenvManager()
inenv.get_venv(venv_name)
venv = inenv.registered_venvs[venv_name]
click.secho(venv['root']) | [
"def",
"root",
"(",
"venv_name",
")",
":",
"inenv",
"=",
"InenvManager",
"(",
")",
"inenv",
".",
"get_venv",
"(",
"venv_name",
")",
"venv",
"=",
"inenv",
".",
"registered_venvs",
"[",
"venv_name",
"]",
"click",
".",
"secho",
"(",
"venv",
"[",
"'root'",
... | Print the root directory of a virtualenv | [
"Print",
"the",
"root",
"directory",
"of",
"a",
"virtualenv"
] | 8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6 | https://github.com/pnegahdar/inenv/blob/8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6/inenv/cli.py#L123-L128 | train | Print the root directory of a virtualenv |
pnegahdar/inenv | inenv/cli.py | init | def init(venv_name):
"""Initializez a virtualenv"""
inenv = InenvManager()
inenv.get_prepped_venv(venv_name, skip_cached=False)
if not os.getenv(INENV_ENV_VAR):
activator_warn(inenv)
click.secho("Your venv is ready. Enjoy!", fg='green') | python | def init(venv_name):
"""Initializez a virtualenv"""
inenv = InenvManager()
inenv.get_prepped_venv(venv_name, skip_cached=False)
if not os.getenv(INENV_ENV_VAR):
activator_warn(inenv)
click.secho("Your venv is ready. Enjoy!", fg='green') | [
"def",
"init",
"(",
"venv_name",
")",
":",
"inenv",
"=",
"InenvManager",
"(",
")",
"inenv",
".",
"get_prepped_venv",
"(",
"venv_name",
",",
"skip_cached",
"=",
"False",
")",
"if",
"not",
"os",
".",
"getenv",
"(",
"INENV_ENV_VAR",
")",
":",
"activator_warn"... | Initializez a virtualenv | [
"Initializez",
"a",
"virtualenv"
] | 8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6 | https://github.com/pnegahdar/inenv/blob/8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6/inenv/cli.py#L133-L139 | train | Initializez a virtualenv |
pnegahdar/inenv | inenv/cli.py | autojump | def autojump():
"""Initializes a virtualenv"""
currently_enabled = autojump_enabled()
toggle_autojump()
if not currently_enabled:
click.secho("Autojump enabled", fg='green')
else:
click.secho("Autojump disabled", fg='red') | python | def autojump():
"""Initializes a virtualenv"""
currently_enabled = autojump_enabled()
toggle_autojump()
if not currently_enabled:
click.secho("Autojump enabled", fg='green')
else:
click.secho("Autojump disabled", fg='red') | [
"def",
"autojump",
"(",
")",
":",
"currently_enabled",
"=",
"autojump_enabled",
"(",
")",
"toggle_autojump",
"(",
")",
"if",
"not",
"currently_enabled",
":",
"click",
".",
"secho",
"(",
"\"Autojump enabled\"",
",",
"fg",
"=",
"'green'",
")",
"else",
":",
"cl... | Initializes a virtualenv | [
"Initializes",
"a",
"virtualenv"
] | 8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6 | https://github.com/pnegahdar/inenv/blob/8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6/inenv/cli.py#L143-L150 | train | Initializes a virtualenv |
pnegahdar/inenv | inenv/cli.py | InenvCliGroup.format_commands | def format_commands(self, ctx, formatter):
"""Extra format methods for multi methods that adds all the commands
after the options.
"""
core_commands, inenv_commands = [], []
for subcommand in self.list_commands(ctx):
cmd = self.get_command(ctx, subcommand)
... | python | def format_commands(self, ctx, formatter):
"""Extra format methods for multi methods that adds all the commands
after the options.
"""
core_commands, inenv_commands = [], []
for subcommand in self.list_commands(ctx):
cmd = self.get_command(ctx, subcommand)
... | [
"def",
"format_commands",
"(",
"self",
",",
"ctx",
",",
"formatter",
")",
":",
"core_commands",
",",
"inenv_commands",
"=",
"[",
"]",
",",
"[",
"]",
"for",
"subcommand",
"in",
"self",
".",
"list_commands",
"(",
"ctx",
")",
":",
"cmd",
"=",
"self",
".",... | Extra format methods for multi methods that adds all the commands
after the options. | [
"Extra",
"format",
"methods",
"for",
"multi",
"methods",
"that",
"adds",
"all",
"the",
"commands",
"after",
"the",
"options",
"."
] | 8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6 | https://github.com/pnegahdar/inenv/blob/8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6/inenv/cli.py#L48-L71 | train | Extra format methods for multi - command commands. |
bitesofcode/projexui | projexui/widgets/xchartwidget/xchartruler.py | XChartRuler.calcTotal | def calcTotal( self, values ):
"""
Calculates the total for the given values. For Datetime/Time objects,
this will be seconds from minimum to maximum - defaulting to 1 second.
For Date objects, this will be days from minimum to maximum, defaulting
to 1 day. For Number obje... | python | def calcTotal( self, values ):
"""
Calculates the total for the given values. For Datetime/Time objects,
this will be seconds from minimum to maximum - defaulting to 1 second.
For Date objects, this will be days from minimum to maximum, defaulting
to 1 day. For Number obje... | [
"def",
"calcTotal",
"(",
"self",
",",
"values",
")",
":",
"rtype",
"=",
"self",
".",
"rulerType",
"(",
")",
"if",
"(",
"not",
"values",
")",
":",
"return",
"0",
"if",
"(",
"rtype",
"==",
"XChartRuler",
".",
"Type",
".",
"Number",
")",
":",
"return"... | Calculates the total for the given values. For Datetime/Time objects,
this will be seconds from minimum to maximum - defaulting to 1 second.
For Date objects, this will be days from minimum to maximum, defaulting
to 1 day. For Number objects, this will be the sum of the list. For
... | [
"Calculates",
"the",
"total",
"for",
"the",
"given",
"values",
".",
"For",
"Datetime",
"/",
"Time",
"objects",
"this",
"will",
"be",
"seconds",
"from",
"minimum",
"to",
"maximum",
"-",
"defaulting",
"to",
"1",
"second",
".",
"For",
"Date",
"objects",
"this... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchartwidget/xchartruler.py#L59-L89 | train | Calculates the total value for the given list of values. |
bitesofcode/projexui | projexui/widgets/xchartwidget/xchartruler.py | XChartRuler.clear | def clear( self ):
"""
Clears all the cached information about this ruler.
"""
self._minimum = None
self._maximum = None
self._step = None
self._notches = None
self._format = None
self._formatter = None
self._padEnd = 0
... | python | def clear( self ):
"""
Clears all the cached information about this ruler.
"""
self._minimum = None
self._maximum = None
self._step = None
self._notches = None
self._format = None
self._formatter = None
self._padEnd = 0
... | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"_minimum",
"=",
"None",
"self",
".",
"_maximum",
"=",
"None",
"self",
".",
"_step",
"=",
"None",
"self",
".",
"_notches",
"=",
"None",
"self",
".",
"_format",
"=",
"None",
"self",
".",
"_formatter"... | Clears all the cached information about this ruler. | [
"Clears",
"all",
"the",
"cached",
"information",
"about",
"this",
"ruler",
"."
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchartwidget/xchartruler.py#L91-L102 | train | Clears all the cached information about this ruler. |
bitesofcode/projexui | projexui/widgets/xchartwidget/xchartruler.py | XChartRuler.compareValues | def compareValues( self, a, b ):
"""
Compares two values based on the notches and values for this ruler.
:param a | <variant>
b | <variant>
:return <int> 1 || 0 || -1
"""
if ( self.rulerType() in (XChartRuler.Type.Cu... | python | def compareValues( self, a, b ):
"""
Compares two values based on the notches and values for this ruler.
:param a | <variant>
b | <variant>
:return <int> 1 || 0 || -1
"""
if ( self.rulerType() in (XChartRuler.Type.Cu... | [
"def",
"compareValues",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"if",
"(",
"self",
".",
"rulerType",
"(",
")",
"in",
"(",
"XChartRuler",
".",
"Type",
".",
"Custom",
",",
"XChartRuler",
".",
"Type",
".",
"Monthly",
")",
")",
":",
"try",
":",
"a... | Compares two values based on the notches and values for this ruler.
:param a | <variant>
b | <variant>
:return <int> 1 || 0 || -1 | [
"Compares",
"two",
"values",
"based",
"on",
"the",
"notches",
"and",
"values",
"for",
"this",
"ruler",
".",
":",
"param",
"a",
"|",
"<variant",
">",
"b",
"|",
"<variant",
">",
":",
"return",
"<int",
">",
"1",
"||",
"0",
"||",
"-",
"1"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchartwidget/xchartruler.py#L104-L128 | train | Compares two values based on the notches and values for this ruler. |
bitesofcode/projexui | projexui/widgets/xchartwidget/xchartruler.py | XChartRuler.format | def format( self ):
"""
Returns the format that will be used for this ruler.
:return <str>
"""
if ( self._format is not None ):
return self._format
rtype = self.rulerType()
if ( rtype == XChartRuler.Type.Number ):
self... | python | def format( self ):
"""
Returns the format that will be used for this ruler.
:return <str>
"""
if ( self._format is not None ):
return self._format
rtype = self.rulerType()
if ( rtype == XChartRuler.Type.Number ):
self... | [
"def",
"format",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_format",
"is",
"not",
"None",
")",
":",
"return",
"self",
".",
"_format",
"rtype",
"=",
"self",
".",
"rulerType",
"(",
")",
"if",
"(",
"rtype",
"==",
"XChartRuler",
".",
"Type",
".",... | Returns the format that will be used for this ruler.
:return <str> | [
"Returns",
"the",
"format",
"that",
"will",
"be",
"used",
"for",
"this",
"ruler",
".",
":",
"return",
"<str",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchartwidget/xchartruler.py#L130-L152 | train | Returns the format that will be used for this ruler. |
bitesofcode/projexui | projexui/widgets/xchartwidget/xchartruler.py | XChartRuler.formatValue | def formatValue( self, value ):
"""
Formats the inputed value based on the formatting system for this ruler.
:param value | <variant>
"""
formatter = self.formatter()
if ( formatter is not None ):
return formatter(value)
... | python | def formatValue( self, value ):
"""
Formats the inputed value based on the formatting system for this ruler.
:param value | <variant>
"""
formatter = self.formatter()
if ( formatter is not None ):
return formatter(value)
... | [
"def",
"formatValue",
"(",
"self",
",",
"value",
")",
":",
"formatter",
"=",
"self",
".",
"formatter",
"(",
")",
"if",
"(",
"formatter",
"is",
"not",
"None",
")",
":",
"return",
"formatter",
"(",
"value",
")",
"elif",
"(",
"self",
".",
"format",
"(",... | Formats the inputed value based on the formatting system for this ruler.
:param value | <variant> | [
"Formats",
"the",
"inputed",
"value",
"based",
"on",
"the",
"formatting",
"system",
"for",
"this",
"ruler",
".",
":",
"param",
"value",
"|",
"<variant",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchartwidget/xchartruler.py#L163-L184 | train | Formats the inputed value based on the formatting system for this ruler. |
bitesofcode/projexui | projexui/widgets/xchartwidget/xchartruler.py | XChartRuler.maxNotchSize | def maxNotchSize( self, orientation ):
"""
Returns the maximum size for this ruler based on its notches and the
given orientation.
:param orientation | <Qt.Orientation>
:return <int>
"""
metrics = QFontMetrics(QApplication.font(... | python | def maxNotchSize( self, orientation ):
"""
Returns the maximum size for this ruler based on its notches and the
given orientation.
:param orientation | <Qt.Orientation>
:return <int>
"""
metrics = QFontMetrics(QApplication.font(... | [
"def",
"maxNotchSize",
"(",
"self",
",",
"orientation",
")",
":",
"metrics",
"=",
"QFontMetrics",
"(",
"QApplication",
".",
"font",
"(",
")",
")",
"if",
"orientation",
"==",
"Qt",
".",
"Vertical",
":",
"notch",
"=",
"''",
"for",
"n",
"in",
"self",
".",... | Returns the maximum size for this ruler based on its notches and the
given orientation.
:param orientation | <Qt.Orientation>
:return <int> | [
"Returns",
"the",
"maximum",
"size",
"for",
"this",
"ruler",
"based",
"on",
"its",
"notches",
"and",
"the",
"given",
"orientation",
".",
":",
"param",
"orientation",
"|",
"<Qt",
".",
"Orientation",
">",
":",
"return",
"<int",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchartwidget/xchartruler.py#L186-L205 | train | Returns the maximum size for this ruler based on its notches and the given orientation. |
bitesofcode/projexui | projexui/widgets/xchartwidget/xchartruler.py | XChartRuler.minLength | def minLength( self, orientation ):
"""
Returns the minimum length for this ruler based on its notches and the
given orientation.
:param orientation | <Qt.Orientation>
:return <int>
"""
padding = self.padStart() + self.p... | python | def minLength( self, orientation ):
"""
Returns the minimum length for this ruler based on its notches and the
given orientation.
:param orientation | <Qt.Orientation>
:return <int>
"""
padding = self.padStart() + self.p... | [
"def",
"minLength",
"(",
"self",
",",
"orientation",
")",
":",
"padding",
"=",
"self",
".",
"padStart",
"(",
")",
"+",
"self",
".",
"padEnd",
"(",
")",
"count",
"=",
"len",
"(",
"self",
".",
"notches",
"(",
")",
")",
"notch_padding",
"=",
"self",
"... | Returns the minimum length for this ruler based on its notches and the
given orientation.
:param orientation | <Qt.Orientation>
:return <int> | [
"Returns",
"the",
"minimum",
"length",
"for",
"this",
"ruler",
"based",
"on",
"its",
"notches",
"and",
"the",
"given",
"orientation",
".",
":",
"param",
"orientation",
"|",
"<Qt",
".",
"Orientation",
">",
":",
"return",
"<int",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchartwidget/xchartruler.py#L207-L225 | train | Returns the minimum length for this ruler based on its notches and the orientation. |
bitesofcode/projexui | projexui/widgets/xchartwidget/xchartruler.py | XChartRuler.maximum | def maximum( self ):
"""
Returns the maximum value for this ruler. If the cached value is None,
then a default value will be specified based on the ruler type.
:return <variant>
"""
if ( self._maximum is not None ):
return self._maximum
... | python | def maximum( self ):
"""
Returns the maximum value for this ruler. If the cached value is None,
then a default value will be specified based on the ruler type.
:return <variant>
"""
if ( self._maximum is not None ):
return self._maximum
... | [
"def",
"maximum",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_maximum",
"is",
"not",
"None",
")",
":",
"return",
"self",
".",
"_maximum",
"rtype",
"=",
"self",
".",
"rulerType",
"(",
")",
"if",
"(",
"rtype",
"==",
"XChartRuler",
".",
"Type",
"... | Returns the maximum value for this ruler. If the cached value is None,
then a default value will be specified based on the ruler type.
:return <variant> | [
"Returns",
"the",
"maximum",
"value",
"for",
"this",
"ruler",
".",
"If",
"the",
"cached",
"value",
"is",
"None",
"then",
"a",
"default",
"value",
"will",
"be",
"specified",
"based",
"on",
"the",
"ruler",
"type",
".",
":",
"return",
"<variant",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchartwidget/xchartruler.py#L227-L256 | train | Returns the maximum value for this ruler. |
bitesofcode/projexui | projexui/widgets/xchartwidget/xchartruler.py | XChartRuler.minimum | def minimum( self ):
"""
Returns the minimum value for this ruler. If the cached value is None,
then a default value will be specified based on the ruler type.
:return <variant>
"""
if ( self._minimum is not None ):
return self._minimum
... | python | def minimum( self ):
"""
Returns the minimum value for this ruler. If the cached value is None,
then a default value will be specified based on the ruler type.
:return <variant>
"""
if ( self._minimum is not None ):
return self._minimum
... | [
"def",
"minimum",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_minimum",
"is",
"not",
"None",
")",
":",
"return",
"self",
".",
"_minimum",
"rtype",
"=",
"self",
".",
"rulerType",
"(",
")",
"if",
"(",
"rtype",
"==",
"XChartRuler",
".",
"Type",
"... | Returns the minimum value for this ruler. If the cached value is None,
then a default value will be specified based on the ruler type.
:return <variant> | [
"Returns",
"the",
"minimum",
"value",
"for",
"this",
"ruler",
".",
"If",
"the",
"cached",
"value",
"is",
"None",
"then",
"a",
"default",
"value",
"will",
"be",
"specified",
"based",
"on",
"the",
"ruler",
"type",
".",
":",
"return",
"<variant",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchartwidget/xchartruler.py#L258-L287 | train | Returns the minimum value for this ruler. |
bitesofcode/projexui | projexui/widgets/xchartwidget/xchartruler.py | XChartRuler.notches | def notches( self ):
"""
Reutrns a list of the notches that are going to be used for this ruler.
If the notches have not been explicitly set (per a Custom type), then
the notches will be generated based on the minimum, maximum and step
values the current ruler type.
... | python | def notches( self ):
"""
Reutrns a list of the notches that are going to be used for this ruler.
If the notches have not been explicitly set (per a Custom type), then
the notches will be generated based on the minimum, maximum and step
values the current ruler type.
... | [
"def",
"notches",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_notches",
"is",
"not",
"None",
")",
":",
"return",
"self",
".",
"_notches",
"rtype",
"=",
"self",
".",
"rulerType",
"(",
")",
"formatter",
"=",
"self",
".",
"formatter",
"(",
")",
"... | Reutrns a list of the notches that are going to be used for this ruler.
If the notches have not been explicitly set (per a Custom type), then
the notches will be generated based on the minimum, maximum and step
values the current ruler type.
:return [<str>, ..] | [
"Reutrns",
"a",
"list",
"of",
"the",
"notches",
"that",
"are",
"going",
"to",
"be",
"used",
"for",
"this",
"ruler",
".",
"If",
"the",
"notches",
"have",
"not",
"been",
"explicitly",
"set",
"(",
"per",
"a",
"Custom",
"type",
")",
"then",
"the",
"notches... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchartwidget/xchartruler.py#L289-L328 | train | Returns a list of the notches that are going to be used for this ruler. |
bitesofcode/projexui | projexui/widgets/xchartwidget/xchartruler.py | XChartRuler.percentAt | def percentAt( self, value ):
"""
Returns the percentage where the given value lies between this rulers
minimum and maximum values. If the value equals the minimum, then the
percent is 0, if it equals the maximum, then the percent is 1 - any
value between will be a floating... | python | def percentAt( self, value ):
"""
Returns the percentage where the given value lies between this rulers
minimum and maximum values. If the value equals the minimum, then the
percent is 0, if it equals the maximum, then the percent is 1 - any
value between will be a floating... | [
"def",
"percentAt",
"(",
"self",
",",
"value",
")",
":",
"if",
"(",
"value",
"is",
"None",
")",
":",
"return",
"0.0",
"minim",
"=",
"self",
".",
"minimum",
"(",
")",
"maxim",
"=",
"self",
".",
"maximum",
"(",
")",
"rtype",
"=",
"self",
".",
"rule... | Returns the percentage where the given value lies between this rulers
minimum and maximum values. If the value equals the minimum, then the
percent is 0, if it equals the maximum, then the percent is 1 - any
value between will be a floating point. If the ruler is a custom type,
the... | [
"Returns",
"the",
"percentage",
"where",
"the",
"given",
"value",
"lies",
"between",
"this",
"rulers",
"minimum",
"and",
"maximum",
"values",
".",
"If",
"the",
"value",
"equals",
"the",
"minimum",
"then",
"the",
"percent",
"is",
"0",
"if",
"it",
"equals",
... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchartwidget/xchartruler.py#L355-L419 | train | Returns the percentage between the given value and the given ruler. |
bitesofcode/projexui | projexui/widgets/xchartwidget/xchartruler.py | XChartRuler.setNotches | def setNotches( self, notches ):
"""
Manually sets the notches list for this ruler to the inputed notches.
:param notches | [<str>, ..] || None
"""
self._rulerType = XChartRuler.Type.Custom
self._notches = notches | python | def setNotches( self, notches ):
"""
Manually sets the notches list for this ruler to the inputed notches.
:param notches | [<str>, ..] || None
"""
self._rulerType = XChartRuler.Type.Custom
self._notches = notches | [
"def",
"setNotches",
"(",
"self",
",",
"notches",
")",
":",
"self",
".",
"_rulerType",
"=",
"XChartRuler",
".",
"Type",
".",
"Custom",
"self",
".",
"_notches",
"=",
"notches"
] | Manually sets the notches list for this ruler to the inputed notches.
:param notches | [<str>, ..] || None | [
"Manually",
"sets",
"the",
"notches",
"list",
"for",
"this",
"ruler",
"to",
"the",
"inputed",
"notches",
".",
":",
"param",
"notches",
"|",
"[",
"<str",
">",
"..",
"]",
"||",
"None"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchartwidget/xchartruler.py#L467-L474 | train | Sets the notches list for this ruler. |
bitesofcode/projexui | projexui/widgets/xchartwidget/xchartruler.py | XChartRuler.setRulerType | def setRulerType( self, rulerType ):
"""
Sets the ruler type for this ruler to the inputed type.
:param rulerType | <XChartRuler.Type>
"""
self._rulerType = rulerType
self.clear()
# handle custom types
if ( rulerType == XChartRule... | python | def setRulerType( self, rulerType ):
"""
Sets the ruler type for this ruler to the inputed type.
:param rulerType | <XChartRuler.Type>
"""
self._rulerType = rulerType
self.clear()
# handle custom types
if ( rulerType == XChartRule... | [
"def",
"setRulerType",
"(",
"self",
",",
"rulerType",
")",
":",
"self",
".",
"_rulerType",
"=",
"rulerType",
"self",
".",
"clear",
"(",
")",
"# handle custom types\r",
"if",
"(",
"rulerType",
"==",
"XChartRuler",
".",
"Type",
".",
"Monthly",
")",
":",
"sel... | Sets the ruler type for this ruler to the inputed type.
:param rulerType | <XChartRuler.Type> | [
"Sets",
"the",
"ruler",
"type",
"for",
"this",
"ruler",
"to",
"the",
"inputed",
"type",
".",
":",
"param",
"rulerType",
"|",
"<XChartRuler",
".",
"Type",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchartwidget/xchartruler.py#L501-L513 | train | Sets the ruler type for this ruler. |
bitesofcode/projexui | projexui/widgets/xchartwidget/xchartruler.py | XChartRuler.step | def step( self ):
"""
Returns the step value for this ruler. If the cached value is None,
then a default value will be specified based on the ruler type.
:return <variant>
"""
if ( self._step is not None ):
return self._step
eli... | python | def step( self ):
"""
Returns the step value for this ruler. If the cached value is None,
then a default value will be specified based on the ruler type.
:return <variant>
"""
if ( self._step is not None ):
return self._step
eli... | [
"def",
"step",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_step",
"is",
"not",
"None",
")",
":",
"return",
"self",
".",
"_step",
"elif",
"(",
"self",
".",
"rulerType",
"(",
")",
"==",
"XChartRuler",
".",
"Type",
".",
"Number",
")",
":",
"sel... | Returns the step value for this ruler. If the cached value is None,
then a default value will be specified based on the ruler type.
:return <variant> | [
"Returns",
"the",
"step",
"value",
"for",
"this",
"ruler",
".",
"If",
"the",
"cached",
"value",
"is",
"None",
"then",
"a",
"default",
"value",
"will",
"be",
"specified",
"based",
"on",
"the",
"ruler",
"type",
".",
":",
"return",
"<variant",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchartwidget/xchartruler.py#L536-L557 | train | Returns the step value for this ruler. |
bitesofcode/projexui | projexui/widgets/xchartwidget/xchartruler.py | XChartRuler.valueAt | def valueAt( self, percent ):
"""
Returns the value at the inputed percent.
:param percent | <float>
:return <variant>
"""
minim = self.minimum()
maxim = self.maximum()
rtype = self.rulerType()
# simpl... | python | def valueAt( self, percent ):
"""
Returns the value at the inputed percent.
:param percent | <float>
:return <variant>
"""
minim = self.minimum()
maxim = self.maximum()
rtype = self.rulerType()
# simpl... | [
"def",
"valueAt",
"(",
"self",
",",
"percent",
")",
":",
"minim",
"=",
"self",
".",
"minimum",
"(",
")",
"maxim",
"=",
"self",
".",
"maximum",
"(",
")",
"rtype",
"=",
"self",
".",
"rulerType",
"(",
")",
"# simple minimum\r",
"if",
"(",
"percent",
"<=... | Returns the value at the inputed percent.
:param percent | <float>
:return <variant> | [
"Returns",
"the",
"value",
"at",
"the",
"inputed",
"percent",
".",
":",
"param",
"percent",
"|",
"<float",
">",
":",
"return",
"<variant",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchartwidget/xchartruler.py#L567-L623 | train | Returns the value at the inputed percent. |
bitesofcode/projexui | projexui/widgets/xorbquerywidget/xorbquickfilterwidget.py | XOrbQuickFilterWidget.query | def query(self):
"""
Builds the query for this quick filter.
:return <orb.Query>
"""
output = Query()
for column, op, plugin, editor in self._plugins:
query = Query(column)
if plugin.setupQuery(query, op, editor):
... | python | def query(self):
"""
Builds the query for this quick filter.
:return <orb.Query>
"""
output = Query()
for column, op, plugin, editor in self._plugins:
query = Query(column)
if plugin.setupQuery(query, op, editor):
... | [
"def",
"query",
"(",
"self",
")",
":",
"output",
"=",
"Query",
"(",
")",
"for",
"column",
",",
"op",
",",
"plugin",
",",
"editor",
"in",
"self",
".",
"_plugins",
":",
"query",
"=",
"Query",
"(",
"column",
")",
"if",
"plugin",
".",
"setupQuery",
"("... | Builds the query for this quick filter.
:return <orb.Query> | [
"Builds",
"the",
"query",
"for",
"this",
"quick",
"filter",
".",
":",
"return",
"<orb",
".",
"Query",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbquickfilterwidget.py#L83-L94 | train | Builds the query for this quick filter. |
bitesofcode/projexui | projexui/widgets/xorbquerywidget/xorbquickfilterwidget.py | XOrbQuickFilterWidget.keyPressEvent | def keyPressEvent(self, event):
"""
Listens for the enter event to check if the query is setup.
"""
if event.key() in (Qt.Key_Enter, Qt.Key_Return):
self.queryEntered.emit(self.query())
super(XOrbQuickFilterWidget, self).keyPressEvent(event) | python | def keyPressEvent(self, event):
"""
Listens for the enter event to check if the query is setup.
"""
if event.key() in (Qt.Key_Enter, Qt.Key_Return):
self.queryEntered.emit(self.query())
super(XOrbQuickFilterWidget, self).keyPressEvent(event) | [
"def",
"keyPressEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"key",
"(",
")",
"in",
"(",
"Qt",
".",
"Key_Enter",
",",
"Qt",
".",
"Key_Return",
")",
":",
"self",
".",
"queryEntered",
".",
"emit",
"(",
"self",
".",
"query",
"(",
... | Listens for the enter event to check if the query is setup. | [
"Listens",
"for",
"the",
"enter",
"event",
"to",
"check",
"if",
"the",
"query",
"is",
"setup",
"."
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbquickfilterwidget.py#L96-L103 | train | Emits the queryEntered signal if the user has entered the query. |
bitesofcode/projexui | projexui/widgets/xorbquerywidget/xorbquickfilterwidget.py | XOrbQuickFilterWidget.rebuild | def rebuild(self):
"""
Rebuilds the data associated with this filter widget.
"""
table = self.tableType()
form = nativestring(self.filterFormat())
if not table and form:
if self.layout().count() == 0:
self.layout().addWidget(... | python | def rebuild(self):
"""
Rebuilds the data associated with this filter widget.
"""
table = self.tableType()
form = nativestring(self.filterFormat())
if not table and form:
if self.layout().count() == 0:
self.layout().addWidget(... | [
"def",
"rebuild",
"(",
"self",
")",
":",
"table",
"=",
"self",
".",
"tableType",
"(",
")",
"form",
"=",
"nativestring",
"(",
"self",
".",
"filterFormat",
"(",
")",
")",
"if",
"not",
"table",
"and",
"form",
":",
"if",
"self",
".",
"layout",
"(",
")"... | Rebuilds the data associated with this filter widget. | [
"Rebuilds",
"the",
"data",
"associated",
"with",
"this",
"filter",
"widget",
"."
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbquickfilterwidget.py#L105-L168 | train | Rebuilds the data associated with this filter widget. |
bitesofcode/projexui | projexui/widgets/xorbquerywidget/xorbquickfilterwidget.py | XOrbQuickFilterWidget.showMenu | def showMenu(self, point):
"""
Displays the menu for this filter widget.
"""
menu = QMenu(self)
acts = {}
acts['edit'] = menu.addAction('Edit quick filter...')
trigger = menu.exec_(self.mapToGlobal(point))
if trigger == acts['ed... | python | def showMenu(self, point):
"""
Displays the menu for this filter widget.
"""
menu = QMenu(self)
acts = {}
acts['edit'] = menu.addAction('Edit quick filter...')
trigger = menu.exec_(self.mapToGlobal(point))
if trigger == acts['ed... | [
"def",
"showMenu",
"(",
"self",
",",
"point",
")",
":",
"menu",
"=",
"QMenu",
"(",
"self",
")",
"acts",
"=",
"{",
"}",
"acts",
"[",
"'edit'",
"]",
"=",
"menu",
".",
"addAction",
"(",
"'Edit quick filter...'",
")",
"trigger",
"=",
"menu",
".",
"exec_"... | Displays the menu for this filter widget. | [
"Displays",
"the",
"menu",
"for",
"this",
"filter",
"widget",
"."
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbquickfilterwidget.py#L170-L188 | train | Displays the menu for this filter widget. |
bitesofcode/projexui | projexui/widgets/xorbquerywidget/xorbquickfilterwidget.py | XOrbQuickFilterWidget.setQuery | def setQuery(self, query):
"""
Sets the query information for this filter widget.
:param query | <orb.Query> || None
"""
if query is None:
return
count = {}
for widget in self.findChildren(QWidget):
... | python | def setQuery(self, query):
"""
Sets the query information for this filter widget.
:param query | <orb.Query> || None
"""
if query is None:
return
count = {}
for widget in self.findChildren(QWidget):
... | [
"def",
"setQuery",
"(",
"self",
",",
"query",
")",
":",
"if",
"query",
"is",
"None",
":",
"return",
"count",
"=",
"{",
"}",
"for",
"widget",
"in",
"self",
".",
"findChildren",
"(",
"QWidget",
")",
":",
"column",
"=",
"nativestring",
"(",
"widget",
".... | Sets the query information for this filter widget.
:param query | <orb.Query> || None | [
"Sets",
"the",
"query",
"information",
"for",
"this",
"filter",
"widget",
".",
":",
"param",
"query",
"|",
"<orb",
".",
"Query",
">",
"||",
"None"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbquickfilterwidget.py#L190-L208 | train | Sets the query information for this filter widget. |
tueda/python-form | form/ioutil.py | set_nonblock | def set_nonblock(fd):
# type: (int) -> None
"""Set the given file descriptor to non-blocking mode."""
fcntl.fcntl(fd,
fcntl.F_SETFL,
fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK) | python | def set_nonblock(fd):
# type: (int) -> None
"""Set the given file descriptor to non-blocking mode."""
fcntl.fcntl(fd,
fcntl.F_SETFL,
fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK) | [
"def",
"set_nonblock",
"(",
"fd",
")",
":",
"# type: (int) -> None",
"fcntl",
".",
"fcntl",
"(",
"fd",
",",
"fcntl",
".",
"F_SETFL",
",",
"fcntl",
".",
"fcntl",
"(",
"fd",
",",
"fcntl",
".",
"F_GETFL",
")",
"|",
"os",
".",
"O_NONBLOCK",
")"
] | Set the given file descriptor to non-blocking mode. | [
"Set",
"the",
"given",
"file",
"descriptor",
"to",
"non",
"-",
"blocking",
"mode",
"."
] | 1e5a8464f7a7a6cbbb32411fc2ea3615fd48334b | https://github.com/tueda/python-form/blob/1e5a8464f7a7a6cbbb32411fc2ea3615fd48334b/form/ioutil.py#L10-L15 | train | Set the given file descriptor to non - blocking mode. |
tueda/python-form | form/ioutil.py | PushbackReader.read | def read(self):
# type: () -> str
"""Read data from the stream."""
s = self._buf + self._raw.read()
self._buf = ''
return s | python | def read(self):
# type: () -> str
"""Read data from the stream."""
s = self._buf + self._raw.read()
self._buf = ''
return s | [
"def",
"read",
"(",
"self",
")",
":",
"# type: () -> str",
"s",
"=",
"self",
".",
"_buf",
"+",
"self",
".",
"_raw",
".",
"read",
"(",
")",
"self",
".",
"_buf",
"=",
"''",
"return",
"s"
] | Read data from the stream. | [
"Read",
"data",
"from",
"the",
"stream",
"."
] | 1e5a8464f7a7a6cbbb32411fc2ea3615fd48334b | https://github.com/tueda/python-form/blob/1e5a8464f7a7a6cbbb32411fc2ea3615fd48334b/form/ioutil.py#L37-L42 | train | Read data from the stream. |
bearyinnovative/bearychat.py | examples/rtm_loop.py | RTMLoop.on_open | def on_open(self, ws):
"""Websocket on_open event handler"""
def keep_alive(interval):
while True:
time.sleep(interval)
self.ping()
start_new_thread(keep_alive, (self.keep_alive_interval, )) | python | def on_open(self, ws):
"""Websocket on_open event handler"""
def keep_alive(interval):
while True:
time.sleep(interval)
self.ping()
start_new_thread(keep_alive, (self.keep_alive_interval, )) | [
"def",
"on_open",
"(",
"self",
",",
"ws",
")",
":",
"def",
"keep_alive",
"(",
"interval",
")",
":",
"while",
"True",
":",
"time",
".",
"sleep",
"(",
"interval",
")",
"self",
".",
"ping",
"(",
")",
"start_new_thread",
"(",
"keep_alive",
",",
"(",
"sel... | Websocket on_open event handler | [
"Websocket",
"on_open",
"event",
"handler"
] | 6c7af2d215c2ff7135bb5af66ca333d0ea1089fd | https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/examples/rtm_loop.py#L50-L57 | train | Called when the websocket connection is established. |
bearyinnovative/bearychat.py | examples/rtm_loop.py | RTMLoop.on_message | def on_message(self, ws, message):
"""Websocket on_message event handler
Saves message as RTMMessage in self._inbox
"""
try:
data = json.loads(message)
except Exception:
self._set_error(message, "decode message failed")
else:
self._inb... | python | def on_message(self, ws, message):
"""Websocket on_message event handler
Saves message as RTMMessage in self._inbox
"""
try:
data = json.loads(message)
except Exception:
self._set_error(message, "decode message failed")
else:
self._inb... | [
"def",
"on_message",
"(",
"self",
",",
"ws",
",",
"message",
")",
":",
"try",
":",
"data",
"=",
"json",
".",
"loads",
"(",
"message",
")",
"except",
"Exception",
":",
"self",
".",
"_set_error",
"(",
"message",
",",
"\"decode message failed\"",
")",
"else... | Websocket on_message event handler
Saves message as RTMMessage in self._inbox | [
"Websocket",
"on_message",
"event",
"handler"
] | 6c7af2d215c2ff7135bb5af66ca333d0ea1089fd | https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/examples/rtm_loop.py#L59-L69 | train | Called when a message is received from the websocket. |
bearyinnovative/bearychat.py | examples/rtm_loop.py | RTMLoop.send | def send(self, message):
"""Sends a RTMMessage
Should be called after starting the loop
Args:
message(RTMMessage): the sending message
Raises:
WebSocketConnectionClosedException: if the loop is closed
"""
if "call_id" not in message:
... | python | def send(self, message):
"""Sends a RTMMessage
Should be called after starting the loop
Args:
message(RTMMessage): the sending message
Raises:
WebSocketConnectionClosedException: if the loop is closed
"""
if "call_id" not in message:
... | [
"def",
"send",
"(",
"self",
",",
"message",
")",
":",
"if",
"\"call_id\"",
"not",
"in",
"message",
":",
"message",
"[",
"\"call_id\"",
"]",
"=",
"self",
".",
"gen_call_id",
"(",
")",
"self",
".",
"_ws",
".",
"send",
"(",
"message",
".",
"to_json",
"(... | Sends a RTMMessage
Should be called after starting the loop
Args:
message(RTMMessage): the sending message
Raises:
WebSocketConnectionClosedException: if the loop is closed | [
"Sends",
"a",
"RTMMessage",
"Should",
"be",
"called",
"after",
"starting",
"the",
"loop"
] | 6c7af2d215c2ff7135bb5af66ca333d0ea1089fd | https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/examples/rtm_loop.py#L120-L133 | train | Sends a RTMMessage to the loop |
bearyinnovative/bearychat.py | examples/rtm_loop.py | RTMLoop.get_message | def get_message(self, block=False, timeout=None):
"""Removes and returns a RTMMessage from self._inbox
Args:
block(bool): if True block until a RTMMessage is available,
else it will return None when self._inbox is empty
timeout(int): it blocks at most ti... | python | def get_message(self, block=False, timeout=None):
"""Removes and returns a RTMMessage from self._inbox
Args:
block(bool): if True block until a RTMMessage is available,
else it will return None when self._inbox is empty
timeout(int): it blocks at most ti... | [
"def",
"get_message",
"(",
"self",
",",
"block",
"=",
"False",
",",
"timeout",
"=",
"None",
")",
":",
"try",
":",
"message",
"=",
"self",
".",
"_inbox",
".",
"get",
"(",
"block",
"=",
"block",
",",
"timeout",
"=",
"timeout",
")",
"return",
"message",... | Removes and returns a RTMMessage from self._inbox
Args:
block(bool): if True block until a RTMMessage is available,
else it will return None when self._inbox is empty
timeout(int): it blocks at most timeout seconds
Returns:
RTMMessage if sel... | [
"Removes",
"and",
"returns",
"a",
"RTMMessage",
"from",
"self",
".",
"_inbox"
] | 6c7af2d215c2ff7135bb5af66ca333d0ea1089fd | https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/examples/rtm_loop.py#L135-L150 | train | Removes and returns a RTMMessage from self. _inbox |
bearyinnovative/bearychat.py | examples/rtm_loop.py | RTMLoop.get_error | def get_error(self, block=False, timeout=None):
"""Removes and returns an error from self._errors
Args:
block(bool): if True block until a RTMMessage is available,
else it will return None when self._inbox is empty
timeout(int): it blocks at most timeout... | python | def get_error(self, block=False, timeout=None):
"""Removes and returns an error from self._errors
Args:
block(bool): if True block until a RTMMessage is available,
else it will return None when self._inbox is empty
timeout(int): it blocks at most timeout... | [
"def",
"get_error",
"(",
"self",
",",
"block",
"=",
"False",
",",
"timeout",
"=",
"None",
")",
":",
"try",
":",
"error",
"=",
"self",
".",
"_errors",
".",
"get",
"(",
"block",
"=",
"block",
",",
"timeout",
"=",
"timeout",
")",
"return",
"error",
"e... | Removes and returns an error from self._errors
Args:
block(bool): if True block until a RTMMessage is available,
else it will return None when self._inbox is empty
timeout(int): it blocks at most timeout seconds
Returns:
error if inbox is no... | [
"Removes",
"and",
"returns",
"an",
"error",
"from",
"self",
".",
"_errors"
] | 6c7af2d215c2ff7135bb5af66ca333d0ea1089fd | https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/examples/rtm_loop.py#L152-L167 | train | Removes and returns an error from self. _errors and returns None if there is no error |
bitesofcode/projexui | projexui/widgets/xorbquerywidget/plugins.py | init | def init(factory):
# simple types
factory.register(BoolPlugin(), ColumnType.Bool)
factory.register(NumericPlugin(QLineEdit), ColumnType.Double)
factory.register(NumericPlugin(QLineEdit), ColumnType.Decimal)
factory.register(NumericPlugin(QLineEdit), ColumnType.In... | python | def init(factory):
# simple types
factory.register(BoolPlugin(), ColumnType.Bool)
factory.register(NumericPlugin(QLineEdit), ColumnType.Double)
factory.register(NumericPlugin(QLineEdit), ColumnType.Decimal)
factory.register(NumericPlugin(QLineEdit), ColumnType.In... | [
"def",
"init",
"(",
"factory",
")",
":",
"# simple types\r",
"factory",
".",
"register",
"(",
"BoolPlugin",
"(",
")",
",",
"ColumnType",
".",
"Bool",
")",
"factory",
".",
"register",
"(",
"NumericPlugin",
"(",
"QLineEdit",
")",
",",
"ColumnType",
".",
"Dou... | Image | [
"Image"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/plugins.py#L299-L331 | train | Initializes the column types with the given factory |
bitesofcode/projexui | projexui/widgets/xorbquerywidget/plugins.py | DateTimePlugin.createEditor | def createEditor(self, parent, column, operator, value):
"""
Creates a new editor for the given parent and operator.
:param parent | <QWidget>
operator | <str>
value | <variant>
"""
if type(value) == date... | python | def createEditor(self, parent, column, operator, value):
"""
Creates a new editor for the given parent and operator.
:param parent | <QWidget>
operator | <str>
value | <variant>
"""
if type(value) == date... | [
"def",
"createEditor",
"(",
"self",
",",
"parent",
",",
"column",
",",
"operator",
",",
"value",
")",
":",
"if",
"type",
"(",
"value",
")",
"==",
"datetime",
".",
"timedelta",
":",
"editor",
"=",
"XTimeDeltaEdit",
"(",
"parent",
")",
"editor",
".",
"se... | Creates a new editor for the given parent and operator.
:param parent | <QWidget>
operator | <str>
value | <variant> | [
"Creates",
"a",
"new",
"editor",
"for",
"the",
"given",
"parent",
"and",
"operator",
".",
":",
"param",
"parent",
"|",
"<QWidget",
">",
"operator",
"|",
"<str",
">",
"value",
"|",
"<variant",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/plugins.py#L69-L93 | train | Creates a new editor for the given parent and column and operator and value. |
bitesofcode/projexui | projexui/widgets/xorbquerywidget/plugins.py | DateTimePlugin.operator | def operator(self, operatorType, value):
"""
Returns the best match for the given operator type from the list
of choices.
:param operatorType | <Query.Op>
value | <variant>
:return <str>
"""
if type(v... | python | def operator(self, operatorType, value):
"""
Returns the best match for the given operator type from the list
of choices.
:param operatorType | <Query.Op>
value | <variant>
:return <str>
"""
if type(v... | [
"def",
"operator",
"(",
"self",
",",
"operatorType",
",",
"value",
")",
":",
"if",
"type",
"(",
"value",
")",
"==",
"datetime",
".",
"timedelta",
":",
"if",
"operatorType",
"==",
"Query",
".",
"Op",
".",
"After",
":",
"return",
"'after (delta)'",
"elif",... | Returns the best match for the given operator type from the list
of choices.
:param operatorType | <Query.Op>
value | <variant>
:return <str> | [
"Returns",
"the",
"best",
"match",
"for",
"the",
"given",
"operator",
"type",
"from",
"the",
"list",
"of",
"choices",
".",
":",
"param",
"operatorType",
"|",
"<Query",
".",
"Op",
">",
"value",
"|",
"<variant",
">",
":",
"return",
"<str",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/plugins.py#L95-L111 | train | Returns the best match for the given operator type and value. |
bitesofcode/projexui | projexui/widgets/xorbquerywidget/plugins.py | EnumPlugin.createEditor | def createEditor(self, parent, column, operator, value):
"""
Creates a new editor for the system.
"""
editor = super(EnumPlugin, self).createEditor(parent,
column,
operator,
... | python | def createEditor(self, parent, column, operator, value):
"""
Creates a new editor for the system.
"""
editor = super(EnumPlugin, self).createEditor(parent,
column,
operator,
... | [
"def",
"createEditor",
"(",
"self",
",",
"parent",
",",
"column",
",",
"operator",
",",
"value",
")",
":",
"editor",
"=",
"super",
"(",
"EnumPlugin",
",",
"self",
")",
".",
"createEditor",
"(",
"parent",
",",
"column",
",",
"operator",
",",
"value",
")... | Creates a new editor for the system. | [
"Creates",
"a",
"new",
"editor",
"for",
"the",
"system",
"."
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/plugins.py#L127-L141 | train | Creates a new editor for the system. |
bitesofcode/projexui | projexui/widgets/xorbquerywidget/plugins.py | ForeignKeyPlugin.createEditor | def createEditor(self, parent, column, operator, value):
"""
Creates a new editor for the given parent and operator.
:param parent | <QWidget>
operator | <str>
value | <variant>
"""
editor = super(Foreign... | python | def createEditor(self, parent, column, operator, value):
"""
Creates a new editor for the given parent and operator.
:param parent | <QWidget>
operator | <str>
value | <variant>
"""
editor = super(Foreign... | [
"def",
"createEditor",
"(",
"self",
",",
"parent",
",",
"column",
",",
"operator",
",",
"value",
")",
":",
"editor",
"=",
"super",
"(",
"ForeignKeyPlugin",
",",
"self",
")",
".",
"createEditor",
"(",
"parent",
",",
"column",
",",
"operator",
",",
"value"... | Creates a new editor for the given parent and operator.
:param parent | <QWidget>
operator | <str>
value | <variant> | [
"Creates",
"a",
"new",
"editor",
"for",
"the",
"given",
"parent",
"and",
"operator",
".",
":",
"param",
"parent",
"|",
"<QWidget",
">",
"operator",
"|",
"<str",
">",
"value",
"|",
"<variant",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/plugins.py#L161-L187 | train | Creates a new editor for the given parent and operator. |
bitesofcode/projexui | projexui/widgets/xorbquerywidget/plugins.py | ForeignKeyPlugin.setupQuery | def setupQuery(self, query, op, editor):
"""
Sets up the query for this editor.
"""
if editor is not None:
value = editor.currentRecord()
if value is None:
return False
return super(ForeignKeyPlugin, self).setupQuery(query... | python | def setupQuery(self, query, op, editor):
"""
Sets up the query for this editor.
"""
if editor is not None:
value = editor.currentRecord()
if value is None:
return False
return super(ForeignKeyPlugin, self).setupQuery(query... | [
"def",
"setupQuery",
"(",
"self",
",",
"query",
",",
"op",
",",
"editor",
")",
":",
"if",
"editor",
"is",
"not",
"None",
":",
"value",
"=",
"editor",
".",
"currentRecord",
"(",
")",
"if",
"value",
"is",
"None",
":",
"return",
"False",
"return",
"supe... | Sets up the query for this editor. | [
"Sets",
"up",
"the",
"query",
"for",
"this",
"editor",
"."
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/plugins.py#L189-L198 | train | Sets up the query for this editor. |
bitesofcode/projexui | projexui/widgets/xorbquerywidget/plugins.py | NumericPlugin.createEditor | def createEditor(self, parent, column, operator, value):
"""
Creates a new editor for the given parent and operator.
:param parent | <QWidget>
operator | <str>
value | <variant>
"""
editor = super(Numeric... | python | def createEditor(self, parent, column, operator, value):
"""
Creates a new editor for the given parent and operator.
:param parent | <QWidget>
operator | <str>
value | <variant>
"""
editor = super(Numeric... | [
"def",
"createEditor",
"(",
"self",
",",
"parent",
",",
"column",
",",
"operator",
",",
"value",
")",
":",
"editor",
"=",
"super",
"(",
"NumericPlugin",
",",
"self",
")",
".",
"createEditor",
"(",
"parent",
",",
"column",
",",
"operator",
",",
"value",
... | Creates a new editor for the given parent and operator.
:param parent | <QWidget>
operator | <str>
value | <variant> | [
"Creates",
"a",
"new",
"editor",
"for",
"the",
"given",
"parent",
"and",
"operator",
".",
":",
"param",
"parent",
"|",
"<QWidget",
">",
"operator",
"|",
"<str",
">",
"value",
"|",
"<variant",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/plugins.py#L216-L235 | train | Creates a new editor for the given parent and operator. |
bitesofcode/projexui | projexui/widgets/xorbquerywidget/plugins.py | NumericPlugin.editorValue | def editorValue(self, editor):
"""
Returns the value for this plugin from the inputed editor.
:param editor | <QtGui.QWidget>
:return <variant>
"""
if isinstance(editor, QLineEdit):
try:
return eval(nativest... | python | def editorValue(self, editor):
"""
Returns the value for this plugin from the inputed editor.
:param editor | <QtGui.QWidget>
:return <variant>
"""
if isinstance(editor, QLineEdit):
try:
return eval(nativest... | [
"def",
"editorValue",
"(",
"self",
",",
"editor",
")",
":",
"if",
"isinstance",
"(",
"editor",
",",
"QLineEdit",
")",
":",
"try",
":",
"return",
"eval",
"(",
"nativestring",
"(",
"editor",
".",
"text",
"(",
")",
")",
")",
"except",
":",
"return",
"0"... | Returns the value for this plugin from the inputed editor.
:param editor | <QtGui.QWidget>
:return <variant> | [
"Returns",
"the",
"value",
"for",
"this",
"plugin",
"from",
"the",
"inputed",
"editor",
".",
":",
"param",
"editor",
"|",
"<QtGui",
".",
"QWidget",
">",
":",
"return",
"<variant",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/plugins.py#L237-L251 | train | Returns the value for this plugin from the inputed editor. |
hover2pi/svo_filters | svo_filters/svo.py | color_gen | def color_gen(colormap='viridis', key=None, n=15):
"""Color generator for Bokeh plots
Parameters
----------
colormap: str, sequence
The name of the color map
Returns
-------
generator
A generator for the color palette
"""
if colormap in dir(bpal):
palette = ... | python | def color_gen(colormap='viridis', key=None, n=15):
"""Color generator for Bokeh plots
Parameters
----------
colormap: str, sequence
The name of the color map
Returns
-------
generator
A generator for the color palette
"""
if colormap in dir(bpal):
palette = ... | [
"def",
"color_gen",
"(",
"colormap",
"=",
"'viridis'",
",",
"key",
"=",
"None",
",",
"n",
"=",
"15",
")",
":",
"if",
"colormap",
"in",
"dir",
"(",
"bpal",
")",
":",
"palette",
"=",
"getattr",
"(",
"bpal",
",",
"colormap",
")",
"if",
"isinstance",
"... | Color generator for Bokeh plots
Parameters
----------
colormap: str, sequence
The name of the color map
Returns
-------
generator
A generator for the color palette | [
"Color",
"generator",
"for",
"Bokeh",
"plots"
] | f0587c4908baf636d4bdf030fa95029e8f31b975 | https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L763-L796 | train | Color generator for Bokeh plots |
hover2pi/svo_filters | svo_filters/svo.py | filters | def filters(filter_directory=None, update=False, fmt='table', **kwargs):
"""
Get a list of the available filters
Parameters
----------
filter_directory: str
The directory containing the filter relative spectral response curves
update: bool
Check the filter directory for new filt... | python | def filters(filter_directory=None, update=False, fmt='table', **kwargs):
"""
Get a list of the available filters
Parameters
----------
filter_directory: str
The directory containing the filter relative spectral response curves
update: bool
Check the filter directory for new filt... | [
"def",
"filters",
"(",
"filter_directory",
"=",
"None",
",",
"update",
"=",
"False",
",",
"fmt",
"=",
"'table'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"filter_directory",
"is",
"None",
":",
"filter_directory",
"=",
"resource_filename",
"(",
"'svo_filters'... | Get a list of the available filters
Parameters
----------
filter_directory: str
The directory containing the filter relative spectral response curves
update: bool
Check the filter directory for new filters and generate pickle of table
fmt: str
The format for the returned tab... | [
"Get",
"a",
"list",
"of",
"the",
"available",
"filters"
] | f0587c4908baf636d4bdf030fa95029e8f31b975 | https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L799-L886 | train | Returns a list of the available filters and generates a pickle of the table. |
hover2pi/svo_filters | svo_filters/svo.py | rebin_spec | def rebin_spec(spec, wavnew, oversamp=100, plot=False):
"""
Rebin a spectrum to a new wavelength array while preserving
the total flux
Parameters
----------
spec: array-like
The wavelength and flux to be binned
wavenew: array-like
The new wavelength array
Returns
--... | python | def rebin_spec(spec, wavnew, oversamp=100, plot=False):
"""
Rebin a spectrum to a new wavelength array while preserving
the total flux
Parameters
----------
spec: array-like
The wavelength and flux to be binned
wavenew: array-like
The new wavelength array
Returns
--... | [
"def",
"rebin_spec",
"(",
"spec",
",",
"wavnew",
",",
"oversamp",
"=",
"100",
",",
"plot",
"=",
"False",
")",
":",
"wave",
",",
"flux",
"=",
"spec",
"nlam",
"=",
"len",
"(",
"wave",
")",
"x0",
"=",
"np",
".",
"arange",
"(",
"nlam",
",",
"dtype",
... | Rebin a spectrum to a new wavelength array while preserving
the total flux
Parameters
----------
spec: array-like
The wavelength and flux to be binned
wavenew: array-like
The new wavelength array
Returns
-------
np.ndarray
The rebinned flux | [
"Rebin",
"a",
"spectrum",
"to",
"a",
"new",
"wavelength",
"array",
"while",
"preserving",
"the",
"total",
"flux"
] | f0587c4908baf636d4bdf030fa95029e8f31b975 | https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L889-L931 | train | Rebin a spectrum to a new wavelength array while preserving
the total flux |
hover2pi/svo_filters | svo_filters/svo.py | Filter.apply | def apply(self, spectrum, plot=False):
"""
Apply the filter to the given [W, F], or [W, F, E] spectrum
Parameters
----------
spectrum: array-like
The wavelength [um] and flux of the spectrum
to apply the filter to
plot: bool
Plot the o... | python | def apply(self, spectrum, plot=False):
"""
Apply the filter to the given [W, F], or [W, F, E] spectrum
Parameters
----------
spectrum: array-like
The wavelength [um] and flux of the spectrum
to apply the filter to
plot: bool
Plot the o... | [
"def",
"apply",
"(",
"self",
",",
"spectrum",
",",
"plot",
"=",
"False",
")",
":",
"# Convert to filter units if possible",
"f_units",
"=",
"1.",
"if",
"hasattr",
"(",
"spectrum",
"[",
"0",
"]",
",",
"'unit'",
")",
":",
"spectrum",
"[",
"0",
"]",
"=",
... | Apply the filter to the given [W, F], or [W, F, E] spectrum
Parameters
----------
spectrum: array-like
The wavelength [um] and flux of the spectrum
to apply the filter to
plot: bool
Plot the original and filtered spectrum
Returns
----... | [
"Apply",
"the",
"filter",
"to",
"the",
"given",
"[",
"W",
"F",
"]",
"or",
"[",
"W",
"F",
"E",
"]",
"spectrum"
] | f0587c4908baf636d4bdf030fa95029e8f31b975 | https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L232-L324 | train | Applies the filter to the given spectrum and returns the filtered spectrum and error arrays. |
hover2pi/svo_filters | svo_filters/svo.py | Filter.bin | def bin(self, n_bins=1, pixels_per_bin=None, wave_min=None, wave_max=None):
"""
Break the filter up into bins and apply a throughput to each bin,
useful for G141, G102, and other grisms
Parameters
----------
n_bins: int
The number of bins to dice the throughp... | python | def bin(self, n_bins=1, pixels_per_bin=None, wave_min=None, wave_max=None):
"""
Break the filter up into bins and apply a throughput to each bin,
useful for G141, G102, and other grisms
Parameters
----------
n_bins: int
The number of bins to dice the throughp... | [
"def",
"bin",
"(",
"self",
",",
"n_bins",
"=",
"1",
",",
"pixels_per_bin",
"=",
"None",
",",
"wave_min",
"=",
"None",
",",
"wave_max",
"=",
"None",
")",
":",
"# Get wavelength limits",
"if",
"wave_min",
"is",
"not",
"None",
":",
"self",
".",
"wave_min",
... | Break the filter up into bins and apply a throughput to each bin,
useful for G141, G102, and other grisms
Parameters
----------
n_bins: int
The number of bins to dice the throughput curve into
pixels_per_bin: int (optional)
The number of channels per bin,... | [
"Break",
"the",
"filter",
"up",
"into",
"bins",
"and",
"apply",
"a",
"throughput",
"to",
"each",
"bin",
"useful",
"for",
"G141",
"G102",
"and",
"other",
"grisms"
] | f0587c4908baf636d4bdf030fa95029e8f31b975 | https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L326-L376 | train | This method splits the filter up into bins and applies a throughput to each bin. |
hover2pi/svo_filters | svo_filters/svo.py | Filter.centers | def centers(self):
"""A getter for the wavelength bin centers and average fluxes"""
# Get the bin centers
w_cen = np.nanmean(self.wave.value, axis=1)
f_cen = np.nanmean(self.throughput, axis=1)
return np.asarray([w_cen, f_cen]) | python | def centers(self):
"""A getter for the wavelength bin centers and average fluxes"""
# Get the bin centers
w_cen = np.nanmean(self.wave.value, axis=1)
f_cen = np.nanmean(self.throughput, axis=1)
return np.asarray([w_cen, f_cen]) | [
"def",
"centers",
"(",
"self",
")",
":",
"# Get the bin centers",
"w_cen",
"=",
"np",
".",
"nanmean",
"(",
"self",
".",
"wave",
".",
"value",
",",
"axis",
"=",
"1",
")",
"f_cen",
"=",
"np",
".",
"nanmean",
"(",
"self",
".",
"throughput",
",",
"axis",... | A getter for the wavelength bin centers and average fluxes | [
"A",
"getter",
"for",
"the",
"wavelength",
"bin",
"centers",
"and",
"average",
"fluxes"
] | f0587c4908baf636d4bdf030fa95029e8f31b975 | https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L379-L385 | train | A getter for the wavelength bin centers and average fluxes |
hover2pi/svo_filters | svo_filters/svo.py | Filter.flux_units | def flux_units(self, units):
"""
A setter for the flux units
Parameters
----------
units: str, astropy.units.core.PrefixUnit
The desired units of the zeropoint flux density
"""
# Check that the units are valid
dtypes = (q.core.PrefixUnit, q.qu... | python | def flux_units(self, units):
"""
A setter for the flux units
Parameters
----------
units: str, astropy.units.core.PrefixUnit
The desired units of the zeropoint flux density
"""
# Check that the units are valid
dtypes = (q.core.PrefixUnit, q.qu... | [
"def",
"flux_units",
"(",
"self",
",",
"units",
")",
":",
"# Check that the units are valid",
"dtypes",
"=",
"(",
"q",
".",
"core",
".",
"PrefixUnit",
",",
"q",
".",
"quantity",
".",
"Quantity",
",",
"q",
".",
"core",
".",
"CompositeUnit",
")",
"if",
"no... | A setter for the flux units
Parameters
----------
units: str, astropy.units.core.PrefixUnit
The desired units of the zeropoint flux density | [
"A",
"setter",
"for",
"the",
"flux",
"units"
] | f0587c4908baf636d4bdf030fa95029e8f31b975 | https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L393-L415 | train | Sets the flux units of the zeropoint. |
hover2pi/svo_filters | svo_filters/svo.py | Filter.info | def info(self, fetch=False):
"""
Print a table of info about the current filter
"""
# Get the info from the class
tp = (int, bytes, bool, str, float, tuple, list, np.ndarray)
info = [[k, str(v)] for k, v in vars(self).items() if isinstance(v, tp)
and k not... | python | def info(self, fetch=False):
"""
Print a table of info about the current filter
"""
# Get the info from the class
tp = (int, bytes, bool, str, float, tuple, list, np.ndarray)
info = [[k, str(v)] for k, v in vars(self).items() if isinstance(v, tp)
and k not... | [
"def",
"info",
"(",
"self",
",",
"fetch",
"=",
"False",
")",
":",
"# Get the info from the class",
"tp",
"=",
"(",
"int",
",",
"bytes",
",",
"bool",
",",
"str",
",",
"float",
",",
"tuple",
",",
"list",
",",
"np",
".",
"ndarray",
")",
"info",
"=",
"... | Print a table of info about the current filter | [
"Print",
"a",
"table",
"of",
"info",
"about",
"the",
"current",
"filter"
] | f0587c4908baf636d4bdf030fa95029e8f31b975 | https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L417-L436 | train | Print a table of info about the current filter
|
hover2pi/svo_filters | svo_filters/svo.py | Filter.load_TopHat | def load_TopHat(self, wave_min, wave_max, pixels_per_bin=100):
"""
Loads a top hat filter given wavelength min and max values
Parameters
----------
wave_min: astropy.units.quantity (optional)
The minimum wavelength to use
wave_max: astropy.units.quantity (opt... | python | def load_TopHat(self, wave_min, wave_max, pixels_per_bin=100):
"""
Loads a top hat filter given wavelength min and max values
Parameters
----------
wave_min: astropy.units.quantity (optional)
The minimum wavelength to use
wave_max: astropy.units.quantity (opt... | [
"def",
"load_TopHat",
"(",
"self",
",",
"wave_min",
",",
"wave_max",
",",
"pixels_per_bin",
"=",
"100",
")",
":",
"# Get min, max, effective wavelengths and width",
"self",
".",
"pixels_per_bin",
"=",
"pixels_per_bin",
"self",
".",
"n_bins",
"=",
"1",
"self",
".",... | Loads a top hat filter given wavelength min and max values
Parameters
----------
wave_min: astropy.units.quantity (optional)
The minimum wavelength to use
wave_max: astropy.units.quantity (optional)
The maximum wavelength to use
n_pixels: int
... | [
"Loads",
"a",
"top",
"hat",
"filter",
"given",
"wavelength",
"min",
"and",
"max",
"values"
] | f0587c4908baf636d4bdf030fa95029e8f31b975 | https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L438-L492 | train | Loads a top hat filter given wavelength min and max values. |
hover2pi/svo_filters | svo_filters/svo.py | Filter.load_txt | def load_txt(self, filepath):
"""Load the filter from a txt file
Parameters
----------
file: str
The filepath
"""
self.raw = np.genfromtxt(filepath, unpack=True)
# Convert to Angstroms if microns
if self.raw[0][-1] < 100:
self.raw... | python | def load_txt(self, filepath):
"""Load the filter from a txt file
Parameters
----------
file: str
The filepath
"""
self.raw = np.genfromtxt(filepath, unpack=True)
# Convert to Angstroms if microns
if self.raw[0][-1] < 100:
self.raw... | [
"def",
"load_txt",
"(",
"self",
",",
"filepath",
")",
":",
"self",
".",
"raw",
"=",
"np",
".",
"genfromtxt",
"(",
"filepath",
",",
"unpack",
"=",
"True",
")",
"# Convert to Angstroms if microns",
"if",
"self",
".",
"raw",
"[",
"0",
"]",
"[",
"-",
"1",
... | Load the filter from a txt file
Parameters
----------
file: str
The filepath | [
"Load",
"the",
"filter",
"from",
"a",
"txt",
"file"
] | f0587c4908baf636d4bdf030fa95029e8f31b975 | https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L494-L546 | train | Load the filter from a txt file. |
hover2pi/svo_filters | svo_filters/svo.py | Filter.load_xml | def load_xml(self, filepath):
"""Load the filter from a txt file
Parameters
----------
filepath: str
The filepath for the filter
"""
# Parse the XML file
vot = vo.parse_single_table(filepath)
self.raw = np.array([list(i) for i in vot.array]).T... | python | def load_xml(self, filepath):
"""Load the filter from a txt file
Parameters
----------
filepath: str
The filepath for the filter
"""
# Parse the XML file
vot = vo.parse_single_table(filepath)
self.raw = np.array([list(i) for i in vot.array]).T... | [
"def",
"load_xml",
"(",
"self",
",",
"filepath",
")",
":",
"# Parse the XML file",
"vot",
"=",
"vo",
".",
"parse_single_table",
"(",
"filepath",
")",
"self",
".",
"raw",
"=",
"np",
".",
"array",
"(",
"[",
"list",
"(",
"i",
")",
"for",
"i",
"in",
"vot... | Load the filter from a txt file
Parameters
----------
filepath: str
The filepath for the filter | [
"Load",
"the",
"filter",
"from",
"a",
"txt",
"file"
] | f0587c4908baf636d4bdf030fa95029e8f31b975 | https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L548-L586 | train | Load the filter from a txt file. |
hover2pi/svo_filters | svo_filters/svo.py | Filter.overlap | def overlap(self, spectrum):
"""Tests for overlap of this filter with a spectrum
Example of full overlap:
|---------- spectrum ----------|
|------ self ------|
Examples of partial overlap: :
|---------- self ----------|
|------ spectrum -... | python | def overlap(self, spectrum):
"""Tests for overlap of this filter with a spectrum
Example of full overlap:
|---------- spectrum ----------|
|------ self ------|
Examples of partial overlap: :
|---------- self ----------|
|------ spectrum -... | [
"def",
"overlap",
"(",
"self",
",",
"spectrum",
")",
":",
"swave",
"=",
"self",
".",
"wave",
"[",
"np",
".",
"where",
"(",
"self",
".",
"throughput",
"!=",
"0",
")",
"]",
"s1",
",",
"s2",
"=",
"swave",
".",
"min",
"(",
")",
",",
"swave",
".",
... | Tests for overlap of this filter with a spectrum
Example of full overlap:
|---------- spectrum ----------|
|------ self ------|
Examples of partial overlap: :
|---------- self ----------|
|------ spectrum ------|
|---- spectrum ----|... | [
"Tests",
"for",
"overlap",
"of",
"this",
"filter",
"with",
"a",
"spectrum"
] | f0587c4908baf636d4bdf030fa95029e8f31b975 | https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L588-L638 | train | Tests for overlap of this filter with a spectrum. |
hover2pi/svo_filters | svo_filters/svo.py | Filter.plot | def plot(self, fig=None, draw=True):
"""
Plot the filter
Parameters
----------
fig: bokeh.plotting.figure (optional)
A figure to plot on
draw: bool
Draw the figure, else return it
Returns
-------
bokeh.plotting.figure
... | python | def plot(self, fig=None, draw=True):
"""
Plot the filter
Parameters
----------
fig: bokeh.plotting.figure (optional)
A figure to plot on
draw: bool
Draw the figure, else return it
Returns
-------
bokeh.plotting.figure
... | [
"def",
"plot",
"(",
"self",
",",
"fig",
"=",
"None",
",",
"draw",
"=",
"True",
")",
":",
"COLORS",
"=",
"color_gen",
"(",
"'Category10'",
")",
"# Make the figure",
"if",
"fig",
"is",
"None",
":",
"xlab",
"=",
"'Wavelength [{}]'",
".",
"format",
"(",
"s... | Plot the filter
Parameters
----------
fig: bokeh.plotting.figure (optional)
A figure to plot on
draw: bool
Draw the figure, else return it
Returns
-------
bokeh.plotting.figure
The filter figure | [
"Plot",
"the",
"filter"
] | f0587c4908baf636d4bdf030fa95029e8f31b975 | https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L640-L677 | train | Plot the filter with the highest frequency. |
hover2pi/svo_filters | svo_filters/svo.py | Filter.rsr | def rsr(self):
"""A getter for the relative spectral response (rsr) curve"""
arr = np.array([self.wave.value, self.throughput]).swapaxes(0, 1)
return arr | python | def rsr(self):
"""A getter for the relative spectral response (rsr) curve"""
arr = np.array([self.wave.value, self.throughput]).swapaxes(0, 1)
return arr | [
"def",
"rsr",
"(",
"self",
")",
":",
"arr",
"=",
"np",
".",
"array",
"(",
"[",
"self",
".",
"wave",
".",
"value",
",",
"self",
".",
"throughput",
"]",
")",
".",
"swapaxes",
"(",
"0",
",",
"1",
")",
"return",
"arr"
] | A getter for the relative spectral response (rsr) curve | [
"A",
"getter",
"for",
"the",
"relative",
"spectral",
"response",
"(",
"rsr",
")",
"curve"
] | f0587c4908baf636d4bdf030fa95029e8f31b975 | https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L680-L684 | train | A getter for the relative spectral response curve |
hover2pi/svo_filters | svo_filters/svo.py | Filter.throughput | def throughput(self, points):
"""A setter for the throughput
Parameters
----------
throughput: sequence
The array of throughput points
"""
# Test shape
if not points.shape == self.wave.shape:
raise ValueError("Throughput and wavelength mus... | python | def throughput(self, points):
"""A setter for the throughput
Parameters
----------
throughput: sequence
The array of throughput points
"""
# Test shape
if not points.shape == self.wave.shape:
raise ValueError("Throughput and wavelength mus... | [
"def",
"throughput",
"(",
"self",
",",
"points",
")",
":",
"# Test shape",
"if",
"not",
"points",
".",
"shape",
"==",
"self",
".",
"wave",
".",
"shape",
":",
"raise",
"ValueError",
"(",
"\"Throughput and wavelength must be same shape.\"",
")",
"self",
".",
"_t... | A setter for the throughput
Parameters
----------
throughput: sequence
The array of throughput points | [
"A",
"setter",
"for",
"the",
"throughput"
] | f0587c4908baf636d4bdf030fa95029e8f31b975 | https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L692-L704 | train | A setter for the throughput |
hover2pi/svo_filters | svo_filters/svo.py | Filter.wave | def wave(self, wavelength):
"""A setter for the wavelength
Parameters
----------
wavelength: astropy.units.quantity.Quantity
The array with units
"""
# Test units
if not isinstance(wavelength, q.quantity.Quantity):
raise ValueError("Wavele... | python | def wave(self, wavelength):
"""A setter for the wavelength
Parameters
----------
wavelength: astropy.units.quantity.Quantity
The array with units
"""
# Test units
if not isinstance(wavelength, q.quantity.Quantity):
raise ValueError("Wavele... | [
"def",
"wave",
"(",
"self",
",",
"wavelength",
")",
":",
"# Test units",
"if",
"not",
"isinstance",
"(",
"wavelength",
",",
"q",
".",
"quantity",
".",
"Quantity",
")",
":",
"raise",
"ValueError",
"(",
"\"Wavelength must be in length units.\"",
")",
"self",
"."... | A setter for the wavelength
Parameters
----------
wavelength: astropy.units.quantity.Quantity
The array with units | [
"A",
"setter",
"for",
"the",
"wavelength"
] | f0587c4908baf636d4bdf030fa95029e8f31b975 | https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L712-L725 | train | A setter for the wavelengthParameters ---------- wavelength : astropy. units. Quantity |
hover2pi/svo_filters | svo_filters/svo.py | Filter.wave_units | def wave_units(self, units):
"""
A setter for the wavelength units
Parameters
----------
units: str, astropy.units.core.PrefixUnit
The wavelength units
"""
# Make sure it's length units
if not units.is_equivalent(q.m):
raise ValueE... | python | def wave_units(self, units):
"""
A setter for the wavelength units
Parameters
----------
units: str, astropy.units.core.PrefixUnit
The wavelength units
"""
# Make sure it's length units
if not units.is_equivalent(q.m):
raise ValueE... | [
"def",
"wave_units",
"(",
"self",
",",
"units",
")",
":",
"# Make sure it's length units",
"if",
"not",
"units",
".",
"is_equivalent",
"(",
"q",
".",
"m",
")",
":",
"raise",
"ValueError",
"(",
"units",
",",
"\": New wavelength units must be a length.\"",
")",
"#... | A setter for the wavelength units
Parameters
----------
units: str, astropy.units.core.PrefixUnit
The wavelength units | [
"A",
"setter",
"for",
"the",
"wavelength",
"units"
] | f0587c4908baf636d4bdf030fa95029e8f31b975 | https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L733-L760 | train | A setter for the wavelength units and the wavelength values of the log entry. |
bitesofcode/projexui | projexui/widgets/xdocktoolbar.py | XDockActionLabel.mousePressEvent | def mousePressEvent(self, event):
"""
Handles when the user presses this label.
:param event | <QEvent>
"""
if event.button() == Qt.LeftButton:
self.parent().actionTriggered.emit(self.action())
self.parent().setSelectedAction(self.act... | python | def mousePressEvent(self, event):
"""
Handles when the user presses this label.
:param event | <QEvent>
"""
if event.button() == Qt.LeftButton:
self.parent().actionTriggered.emit(self.action())
self.parent().setSelectedAction(self.act... | [
"def",
"mousePressEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"button",
"(",
")",
"==",
"Qt",
".",
"LeftButton",
":",
"self",
".",
"parent",
"(",
")",
".",
"actionTriggered",
".",
"emit",
"(",
"self",
".",
"action",
"(",
")",
"... | Handles when the user presses this label.
:param event | <QEvent> | [
"Handles",
"when",
"the",
"user",
"presses",
"this",
"label",
".",
":",
"param",
"event",
"|",
"<QEvent",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xdocktoolbar.py#L65-L80 | train | Handles the mouse press event. |
bitesofcode/projexui | projexui/widgets/xdocktoolbar.py | XDockActionLabel.setPixmapSize | def setPixmapSize(self, size):
"""
Sets the pixmap size for this label.
:param size | <QSize>
"""
self._pixmapSize = size
self.setPixmap(self.action().icon().pixmap(size))
max_size = self.parent().maximumPixmapSize()
... | python | def setPixmapSize(self, size):
"""
Sets the pixmap size for this label.
:param size | <QSize>
"""
self._pixmapSize = size
self.setPixmap(self.action().icon().pixmap(size))
max_size = self.parent().maximumPixmapSize()
... | [
"def",
"setPixmapSize",
"(",
"self",
",",
"size",
")",
":",
"self",
".",
"_pixmapSize",
"=",
"size",
"self",
".",
"setPixmap",
"(",
"self",
".",
"action",
"(",
")",
".",
"icon",
"(",
")",
".",
"pixmap",
"(",
"size",
")",
")",
"max_size",
"=",
"self... | Sets the pixmap size for this label.
:param size | <QSize> | [
"Sets",
"the",
"pixmap",
"size",
"for",
"this",
"label",
".",
":",
"param",
"size",
"|",
"<QSize",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xdocktoolbar.py#L114-L131 | train | Sets the pixmap size for this label. |
bitesofcode/projexui | projexui/widgets/xdocktoolbar.py | XDockActionLabel.setPosition | def setPosition(self, position):
"""
Adjusts this label to match the given position.
:param <XDockToolbar.Position>
"""
self._position = position
if position == XDockToolbar.Position.North:
self.setAlignment(Qt.AlignHCenter | Qt... | python | def setPosition(self, position):
"""
Adjusts this label to match the given position.
:param <XDockToolbar.Position>
"""
self._position = position
if position == XDockToolbar.Position.North:
self.setAlignment(Qt.AlignHCenter | Qt... | [
"def",
"setPosition",
"(",
"self",
",",
"position",
")",
":",
"self",
".",
"_position",
"=",
"position",
"if",
"position",
"==",
"XDockToolbar",
".",
"Position",
".",
"North",
":",
"self",
".",
"setAlignment",
"(",
"Qt",
".",
"AlignHCenter",
"|",
"Qt",
"... | Adjusts this label to match the given position.
:param <XDockToolbar.Position> | [
"Adjusts",
"this",
"label",
"to",
"match",
"the",
"given",
"position",
".",
":",
"param",
"<XDockToolbar",
".",
"Position",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xdocktoolbar.py#L133-L148 | train | Adjusts this label to match the given position. |
bitesofcode/projexui | projexui/widgets/xdocktoolbar.py | XDockToolbar.actionAt | def actionAt(self, pos):
"""
Returns the action at the given position.
:param pos | <QPoint>
:return <QAction> || None
"""
child = self.childAt(pos)
if child:
return child.action()
return None | python | def actionAt(self, pos):
"""
Returns the action at the given position.
:param pos | <QPoint>
:return <QAction> || None
"""
child = self.childAt(pos)
if child:
return child.action()
return None | [
"def",
"actionAt",
"(",
"self",
",",
"pos",
")",
":",
"child",
"=",
"self",
".",
"childAt",
"(",
"pos",
")",
"if",
"child",
":",
"return",
"child",
".",
"action",
"(",
")",
"return",
"None"
] | Returns the action at the given position.
:param pos | <QPoint>
:return <QAction> || None | [
"Returns",
"the",
"action",
"at",
"the",
"given",
"position",
".",
":",
"param",
"pos",
"|",
"<QPoint",
">",
":",
"return",
"<QAction",
">",
"||",
"None"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xdocktoolbar.py#L197-L208 | train | Returns the action at the given position. |
bitesofcode/projexui | projexui/widgets/xdocktoolbar.py | XDockToolbar.actionLabels | def actionLabels(self):
"""
Returns the labels for this widget.
:return <XDockActionLabel>
"""
l = self.layout()
return [l.itemAt(i).widget() for i in range(1, l.count() - 1)] | python | def actionLabels(self):
"""
Returns the labels for this widget.
:return <XDockActionLabel>
"""
l = self.layout()
return [l.itemAt(i).widget() for i in range(1, l.count() - 1)] | [
"def",
"actionLabels",
"(",
"self",
")",
":",
"l",
"=",
"self",
".",
"layout",
"(",
")",
"return",
"[",
"l",
".",
"itemAt",
"(",
"i",
")",
".",
"widget",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"l",
".",
"count",
"(",
")",
"-",
... | Returns the labels for this widget.
:return <XDockActionLabel> | [
"Returns",
"the",
"labels",
"for",
"this",
"widget",
".",
":",
"return",
"<XDockActionLabel",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xdocktoolbar.py#L219-L226 | train | Returns the list of action labels for this widget. |
bitesofcode/projexui | projexui/widgets/xdocktoolbar.py | XDockToolbar.addAction | def addAction(self, action):
"""
Adds the inputed action to this toolbar.
:param action | <QAction>
"""
super(XDockToolbar, self).addAction(action)
label = XDockActionLabel(action, self.minimumPixmapSize(), self)
label.setPosition(s... | python | def addAction(self, action):
"""
Adds the inputed action to this toolbar.
:param action | <QAction>
"""
super(XDockToolbar, self).addAction(action)
label = XDockActionLabel(action, self.minimumPixmapSize(), self)
label.setPosition(s... | [
"def",
"addAction",
"(",
"self",
",",
"action",
")",
":",
"super",
"(",
"XDockToolbar",
",",
"self",
")",
".",
"addAction",
"(",
"action",
")",
"label",
"=",
"XDockActionLabel",
"(",
"action",
",",
"self",
".",
"minimumPixmapSize",
"(",
")",
",",
"self",... | Adds the inputed action to this toolbar.
:param action | <QAction> | [
"Adds",
"the",
"inputed",
"action",
"to",
"this",
"toolbar",
".",
":",
"param",
"action",
"|",
"<QAction",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xdocktoolbar.py#L228-L240 | train | Adds the inputed action to this toolbar. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.