repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
sibirrer/lenstronomy | lenstronomy/LensModel/multi_plane.py | MultiPlane._add_deflection | def _add_deflection(self, x, y, alpha_x, alpha_y, kwargs_lens, idex):
"""
adds the pyhsical deflection angle of a single lens plane to the deflection field
:param x: co-moving distance at the deflector plane
:param y: co-moving distance at the deflector plane
:param alpha_x: phy... | python | def _add_deflection(self, x, y, alpha_x, alpha_y, kwargs_lens, idex):
"""
adds the pyhsical deflection angle of a single lens plane to the deflection field
:param x: co-moving distance at the deflector plane
:param y: co-moving distance at the deflector plane
:param alpha_x: phy... | adds the pyhsical deflection angle of a single lens plane to the deflection field
:param x: co-moving distance at the deflector plane
:param y: co-moving distance at the deflector plane
:param alpha_x: physical angle (radian) before the deflector plane
:param alpha_y: physical angle (ra... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/multi_plane.py#L374-L393 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/sis.py | SIS.derivatives | def derivatives(self, x, y, theta_E, center_x=0, center_y=0):
"""
returns df/dx and df/dy of the function
"""
x_shift = x - center_x
y_shift = y - center_y
R = np.sqrt(x_shift*x_shift + y_shift*y_shift)
if isinstance(R, int) or isinstance(R, float):
a ... | python | def derivatives(self, x, y, theta_E, center_x=0, center_y=0):
"""
returns df/dx and df/dy of the function
"""
x_shift = x - center_x
y_shift = y - center_y
R = np.sqrt(x_shift*x_shift + y_shift*y_shift)
if isinstance(R, int) or isinstance(R, float):
a ... | returns df/dx and df/dy of the function | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/sis.py#L19-L35 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/sis.py | SIS.hessian | def hessian(self, x, y, theta_E, center_x=0, center_y=0):
"""
returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy
"""
x_shift = x - center_x
y_shift = y - center_y
R = (x_shift*x_shift + y_shift*y_shift)**(3./2)
if isinstance(R, int) or isinstance(R, ... | python | def hessian(self, x, y, theta_E, center_x=0, center_y=0):
"""
returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy
"""
x_shift = x - center_x
y_shift = y - center_y
R = (x_shift*x_shift + y_shift*y_shift)**(3./2)
if isinstance(R, int) or isinstance(R, ... | returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/sis.py#L37-L55 |
sibirrer/lenstronomy | lenstronomy/LightModel/Profiles/torus.py | function | def function(x, y, amp, a_x, a_y, center_x, center_y):
"""
returns torus (ellipse with constant surface brightnes) profile
"""
x_shift = x - center_x
y_shift = y - center_y
A = np.pi * a_x * a_y
dist = (x_shift/a_x)**2 + (y_shift/a_y)**2
torus = np.zeros_like(x)
torus[dist <= 1] = 1
... | python | def function(x, y, amp, a_x, a_y, center_x, center_y):
"""
returns torus (ellipse with constant surface brightnes) profile
"""
x_shift = x - center_x
y_shift = y - center_y
A = np.pi * a_x * a_y
dist = (x_shift/a_x)**2 + (y_shift/a_y)**2
torus = np.zeros_like(x)
torus[dist <= 1] = 1
... | returns torus (ellipse with constant surface brightnes) profile | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LightModel/Profiles/torus.py#L7-L17 |
sibirrer/lenstronomy | lenstronomy/GalKin/velocity_util.py | hyp_2F1 | def hyp_2F1(a, b, c, z):
"""
http://docs.sympy.org/0.7.1/modules/mpmath/functions/hypergeometric.html
"""
return mp.hyp2f1(a, b, c, z) | python | def hyp_2F1(a, b, c, z):
"""
http://docs.sympy.org/0.7.1/modules/mpmath/functions/hypergeometric.html
"""
return mp.hyp2f1(a, b, c, z) | http://docs.sympy.org/0.7.1/modules/mpmath/functions/hypergeometric.html | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/GalKin/velocity_util.py#L7-L11 |
sibirrer/lenstronomy | lenstronomy/LensModel/single_plane.py | SinglePlane.ray_shooting | def ray_shooting(self, x, y, kwargs, k=None):
"""
maps image to source position (inverse deflection)
:param x: x-position (preferentially arcsec)
:type x: numpy array
:param y: y-position (preferentially arcsec)
:type y: numpy array
:param kwargs: list of keyword ... | python | def ray_shooting(self, x, y, kwargs, k=None):
"""
maps image to source position (inverse deflection)
:param x: x-position (preferentially arcsec)
:type x: numpy array
:param y: y-position (preferentially arcsec)
:type y: numpy array
:param kwargs: list of keyword ... | maps image to source position (inverse deflection)
:param x: x-position (preferentially arcsec)
:type x: numpy array
:param y: y-position (preferentially arcsec)
:type y: numpy array
:param kwargs: list of keyword arguments of lens model parameters matching the lens model classes... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/single_plane.py#L30-L42 |
sibirrer/lenstronomy | lenstronomy/LensModel/single_plane.py | SinglePlane.fermat_potential | def fermat_potential(self, x_image, y_image, x_source, y_source, kwargs_lens, k=None):
"""
fermat potential (negative sign means earlier arrival time)
:param x_image: image position
:param y_image: image position
:param x_source: source position
:param y_source: source p... | python | def fermat_potential(self, x_image, y_image, x_source, y_source, kwargs_lens, k=None):
"""
fermat potential (negative sign means earlier arrival time)
:param x_image: image position
:param y_image: image position
:param x_source: source position
:param y_source: source p... | fermat potential (negative sign means earlier arrival time)
:param x_image: image position
:param y_image: image position
:param x_source: source position
:param y_source: source position
:param kwargs_lens: list of keyword arguments of lens model parameters matching the lens mo... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/single_plane.py#L44-L58 |
sibirrer/lenstronomy | lenstronomy/LensModel/single_plane.py | SinglePlane.potential | def potential(self, x, y, kwargs, k=None):
"""
lensing potential
:param x: x-position (preferentially arcsec)
:type x: numpy array
:param y: y-position (preferentially arcsec)
:type y: numpy array
:param kwargs: list of keyword arguments of lens model parameters m... | python | def potential(self, x, y, kwargs, k=None):
"""
lensing potential
:param x: x-position (preferentially arcsec)
:type x: numpy array
:param y: y-position (preferentially arcsec)
:type y: numpy array
:param kwargs: list of keyword arguments of lens model parameters m... | lensing potential
:param x: x-position (preferentially arcsec)
:type x: numpy array
:param y: y-position (preferentially arcsec)
:type y: numpy array
:param kwargs: list of keyword arguments of lens model parameters matching the lens model classes
:param k: only evaluate ... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/single_plane.py#L60-L82 |
sibirrer/lenstronomy | lenstronomy/LensModel/single_plane.py | SinglePlane.alpha | def alpha(self, x, y, kwargs, k=None):
"""
deflection angles
:param x: x-position (preferentially arcsec)
:type x: numpy array
:param y: y-position (preferentially arcsec)
:type y: numpy array
:param kwargs: list of keyword arguments of lens model parameters matc... | python | def alpha(self, x, y, kwargs, k=None):
"""
deflection angles
:param x: x-position (preferentially arcsec)
:type x: numpy array
:param y: y-position (preferentially arcsec)
:type y: numpy array
:param kwargs: list of keyword arguments of lens model parameters matc... | deflection angles
:param x: x-position (preferentially arcsec)
:type x: numpy array
:param y: y-position (preferentially arcsec)
:type y: numpy array
:param kwargs: list of keyword arguments of lens model parameters matching the lens model classes
:param k: only evaluate ... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/single_plane.py#L84-L109 |
sibirrer/lenstronomy | lenstronomy/LensModel/single_plane.py | SinglePlane.hessian | def hessian(self, x, y, kwargs, k=None):
"""
hessian matrix
:param x: x-position (preferentially arcsec)
:type x: numpy array
:param y: y-position (preferentially arcsec)
:type y: numpy array
:param kwargs: list of keyword arguments of lens model parameters matchi... | python | def hessian(self, x, y, kwargs, k=None):
"""
hessian matrix
:param x: x-position (preferentially arcsec)
:type x: numpy array
:param y: y-position (preferentially arcsec)
:type y: numpy array
:param kwargs: list of keyword arguments of lens model parameters matchi... | hessian matrix
:param x: x-position (preferentially arcsec)
:type x: numpy array
:param y: y-position (preferentially arcsec)
:type y: numpy array
:param kwargs: list of keyword arguments of lens model parameters matching the lens model classes
:param k: only evaluate the... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/single_plane.py#L111-L139 |
sibirrer/lenstronomy | lenstronomy/LensModel/single_plane.py | SinglePlane.mass_3d | def mass_3d(self, r, kwargs, bool_list=None):
"""
computes the mass within a 3d sphere of radius r
:param r: radius (in angular units)
:param kwargs: list of keyword arguments of lens model parameters matching the lens model classes
:param bool_list: list of bools that are part ... | python | def mass_3d(self, r, kwargs, bool_list=None):
"""
computes the mass within a 3d sphere of radius r
:param r: radius (in angular units)
:param kwargs: list of keyword arguments of lens model parameters matching the lens model classes
:param bool_list: list of bools that are part ... | computes the mass within a 3d sphere of radius r
:param r: radius (in angular units)
:param kwargs: list of keyword arguments of lens model parameters matching the lens model classes
:param bool_list: list of bools that are part of the output
:return: mass (in angular units, modulo epsi... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/single_plane.py#L171-L189 |
sibirrer/lenstronomy | lenstronomy/LensModel/single_plane.py | SinglePlane.mass_2d | def mass_2d(self, r, kwargs, bool_list=None):
"""
computes the mass enclosed a projected (2d) radius r
:param r: radius (in angular units)
:param kwargs: list of keyword arguments of lens model parameters matching the lens model classes
:param bool_list: list of bools that are p... | python | def mass_2d(self, r, kwargs, bool_list=None):
"""
computes the mass enclosed a projected (2d) radius r
:param r: radius (in angular units)
:param kwargs: list of keyword arguments of lens model parameters matching the lens model classes
:param bool_list: list of bools that are p... | computes the mass enclosed a projected (2d) radius r
:param r: radius (in angular units)
:param kwargs: list of keyword arguments of lens model parameters matching the lens model classes
:param bool_list: list of bools that are part of the output
:return: projected mass (in angular unit... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/single_plane.py#L191-L209 |
sibirrer/lenstronomy | lenstronomy/LensModel/single_plane.py | SinglePlane._bool_list | def _bool_list(self, k=None):
"""
returns a bool list of the length of the lens models
if k = None: returns bool list with True's
if k is int, returns bool list with False's but k'th is True
:param k: None, int, or list of ints
:return: bool list
"""
n = ... | python | def _bool_list(self, k=None):
"""
returns a bool list of the length of the lens models
if k = None: returns bool list with True's
if k is int, returns bool list with False's but k'th is True
:param k: None, int, or list of ints
:return: bool list
"""
n = ... | returns a bool list of the length of the lens models
if k = None: returns bool list with True's
if k is int, returns bool list with False's but k'th is True
:param k: None, int, or list of ints
:return: bool list | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/single_plane.py#L343-L370 |
Pelagicore/qface | qface/helper/qtcpp.py | Filters.open_ns | def open_ns(symbol):
''' generates a open namespace from symbol namespace x { y { z {'''
blocks = ['namespace {0} {{'.format(x) for x in symbol.module.name_parts]
return ' '.join(blocks) | python | def open_ns(symbol):
''' generates a open namespace from symbol namespace x { y { z {'''
blocks = ['namespace {0} {{'.format(x) for x in symbol.module.name_parts]
return ' '.join(blocks) | generates a open namespace from symbol namespace x { y { z { | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/helper/qtcpp.py#L148-L151 |
Pelagicore/qface | qface/helper/qtcpp.py | Filters.close_ns | def close_ns(symbol):
'''generates a closing names statement from a symbol'''
closing = ' '.join(['}' for x in symbol.module.name_parts])
name = '::'.join(symbol.module.name_parts)
return '{0} // namespace {1}'.format(closing, name) | python | def close_ns(symbol):
'''generates a closing names statement from a symbol'''
closing = ' '.join(['}' for x in symbol.module.name_parts])
name = '::'.join(symbol.module.name_parts)
return '{0} // namespace {1}'.format(closing, name) | generates a closing names statement from a symbol | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/helper/qtcpp.py#L154-L158 |
Pelagicore/qface | qface/helper/qtcpp.py | Filters.ns | def ns(symbol):
'''generates a namespace x::y::z statement from a symbol'''
if symbol.type and symbol.type.is_primitive:
return ''
return '{0}::'.format('::'.join(symbol.module.name_parts)) | python | def ns(symbol):
'''generates a namespace x::y::z statement from a symbol'''
if symbol.type and symbol.type.is_primitive:
return ''
return '{0}::'.format('::'.join(symbol.module.name_parts)) | generates a namespace x::y::z statement from a symbol | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/helper/qtcpp.py#L167-L171 |
Pelagicore/qface | qface/cli.py | app | def app(config, src, dst, features, reload, force):
"""Takes several files or directories as src and generates the code
in the given dst directory."""
config = Path(config)
if reload:
argv = sys.argv.copy()
argv.remove('--reload')
monitor(config.dirname(), src, dst, argv)
els... | python | def app(config, src, dst, features, reload, force):
"""Takes several files or directories as src and generates the code
in the given dst directory."""
config = Path(config)
if reload:
argv = sys.argv.copy()
argv.remove('--reload')
monitor(config.dirname(), src, dst, argv)
els... | Takes several files or directories as src and generates the code
in the given dst directory. | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/cli.py#L31-L40 |
Pelagicore/qface | cli.py | reload | def reload(script, input, output):
"""
reloads the generator script when the script files
or the input files changes
"""
script = Path(script).expand().abspath()
output = Path(output).expand().abspath()
input = input if isinstance(input, (list, tuple)) else [input]
output.makedirs_p()
... | python | def reload(script, input, output):
"""
reloads the generator script when the script files
or the input files changes
"""
script = Path(script).expand().abspath()
output = Path(output).expand().abspath()
input = input if isinstance(input, (list, tuple)) else [input]
output.makedirs_p()
... | reloads the generator script when the script files
or the input files changes | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/cli.py#L110-L119 |
Pelagicore/qface | cli.py | _script_reload | def _script_reload(script, input, output):
"""run the named generator and monitor the input and generator folder"""
input = [Path(entry).expand().abspath() for entry in input]
output = Path(output).expand().abspath()
cmd = 'python3 {0} {1} {2}'.format(script, ' '.join(input), output)
event_handler =... | python | def _script_reload(script, input, output):
"""run the named generator and monitor the input and generator folder"""
input = [Path(entry).expand().abspath() for entry in input]
output = Path(output).expand().abspath()
cmd = 'python3 {0} {1} {2}'.format(script, ' '.join(input), output)
event_handler =... | run the named generator and monitor the input and generator folder | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/cli.py#L122-L147 |
Pelagicore/qface | cli.py | install | def install(editable):
"""install the script onto the system using pip3"""
script_dir = str(Path(__file__).parent.abspath())
click.secho(script_dir, fg='blue')
if editable:
sh('pip3 install --editable {0} --upgrade'.format(script_dir))
else:
sh('pip3 install {0} --upgrade'.format(scr... | python | def install(editable):
"""install the script onto the system using pip3"""
script_dir = str(Path(__file__).parent.abspath())
click.secho(script_dir, fg='blue')
if editable:
sh('pip3 install --editable {0} --upgrade'.format(script_dir))
else:
sh('pip3 install {0} --upgrade'.format(scr... | install the script onto the system using pip3 | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/cli.py#L152-L159 |
Pelagicore/qface | qface/generator.py | merge | def merge(a, b):
"merges b into a recursively if a and b are dicts"
for key in b:
if isinstance(a.get(key), dict) and isinstance(b.get(key), dict):
merge(a[key], b[key])
else:
a[key] = b[key]
return a | python | def merge(a, b):
"merges b into a recursively if a and b are dicts"
for key in b:
if isinstance(a.get(key), dict) and isinstance(b.get(key), dict):
merge(a[key], b[key])
else:
a[key] = b[key]
return a | merges b into a recursively if a and b are dicts | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/generator.py#L36-L43 |
Pelagicore/qface | qface/generator.py | Generator.get_template | def get_template(self, name):
"""Retrieves a single template file from the template loader"""
source = name
if name and name[0] is '/':
source = name[1:]
elif self.source is not None:
source = '/'.join((self.source, name))
return self.env.get_template(sour... | python | def get_template(self, name):
"""Retrieves a single template file from the template loader"""
source = name
if name and name[0] is '/':
source = name[1:]
elif self.source is not None:
source = '/'.join((self.source, name))
return self.env.get_template(sour... | Retrieves a single template file from the template loader | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/generator.py#L145-L152 |
Pelagicore/qface | qface/generator.py | Generator.render | def render(self, name, context):
"""Returns the rendered text from a single template file from the
template loader using the given context data"""
if Generator.strict:
self.env.undefined = TestableUndefined
else:
self.env.undefined = Undefined
template = s... | python | def render(self, name, context):
"""Returns the rendered text from a single template file from the
template loader using the given context data"""
if Generator.strict:
self.env.undefined = TestableUndefined
else:
self.env.undefined = Undefined
template = s... | Returns the rendered text from a single template file from the
template loader using the given context data | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/generator.py#L154-L162 |
Pelagicore/qface | qface/generator.py | Generator.apply | def apply(self, template, context={}):
context.update(self.context)
"""Return the rendered text of a template instance"""
return self.env.from_string(template).render(context) | python | def apply(self, template, context={}):
context.update(self.context)
"""Return the rendered text of a template instance"""
return self.env.from_string(template).render(context) | Return the rendered text of a template instance | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/generator.py#L164-L167 |
Pelagicore/qface | qface/generator.py | Generator.write | def write(self, file_path, template, context={}, preserve=False, force=False):
"""Using a template file name it renders a template
into a file given a context
"""
if not file_path or not template:
click.secho('source or target missing for document')
return
... | python | def write(self, file_path, template, context={}, preserve=False, force=False):
"""Using a template file name it renders a template
into a file given a context
"""
if not file_path or not template:
click.secho('source or target missing for document')
return
... | Using a template file name it renders a template
into a file given a context | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/generator.py#L169-L194 |
Pelagicore/qface | qface/generator.py | RuleGenerator.process_rules | def process_rules(self, path: Path, system: System):
"""writes the templates read from the rules document"""
self.context.update({
'system': system,
})
document = FileSystem.load_yaml(path, required=True)
for module, rules in document.items():
click.secho(... | python | def process_rules(self, path: Path, system: System):
"""writes the templates read from the rules document"""
self.context.update({
'system': system,
})
document = FileSystem.load_yaml(path, required=True)
for module, rules in document.items():
click.secho(... | writes the templates read from the rules document | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/generator.py#L233-L241 |
Pelagicore/qface | qface/generator.py | RuleGenerator._process_rules | def _process_rules(self, rules: dict, system: System):
""" process a set of rules for a target """
self._source = None # reset the template source
if not self._shall_proceed(rules):
return
self.context.update(rules.get('context', {}))
self.path = rules.get('path', '')... | python | def _process_rules(self, rules: dict, system: System):
""" process a set of rules for a target """
self._source = None # reset the template source
if not self._shall_proceed(rules):
return
self.context.update(rules.get('context', {}))
self.path = rules.get('path', '')... | process a set of rules for a target | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/generator.py#L243-L259 |
Pelagicore/qface | qface/generator.py | RuleGenerator._process_rule | def _process_rule(self, rule: dict, context: dict):
""" process a single rule """
if not rule or not self._shall_proceed(rule):
return
self.context.update(context)
self.context.update(rule.get('context', {}))
self.path = rule.get('path', None)
self.source = ru... | python | def _process_rule(self, rule: dict, context: dict):
""" process a single rule """
if not rule or not self._shall_proceed(rule):
return
self.context.update(context)
self.context.update(rule.get('context', {}))
self.path = rule.get('path', None)
self.source = ru... | process a single rule | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/generator.py#L261-L274 |
Pelagicore/qface | qface/generator.py | FileSystem._parse_document | def _parse_document(document: Path, system: System = None, profile=EProfile.FULL):
"""Parses a document and returns the resulting domain system
:param path: document path to parse
:param system: system to be used (optional)
"""
logger.debug('parse document: {0}'.format(document)... | python | def _parse_document(document: Path, system: System = None, profile=EProfile.FULL):
"""Parses a document and returns the resulting domain system
:param path: document path to parse
:param system: system to be used (optional)
"""
logger.debug('parse document: {0}'.format(document)... | Parses a document and returns the resulting domain system
:param path: document path to parse
:param system: system to be used (optional) | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/generator.py#L316-L326 |
Pelagicore/qface | qface/generator.py | FileSystem.merge_annotations | def merge_annotations(system, document):
"""Read a YAML document and for each root symbol identifier
updates the tag information of that symbol
"""
if not Path(document).exists():
return
meta = FileSystem.load_yaml(document)
click.secho('merge: {0}'.format(doc... | python | def merge_annotations(system, document):
"""Read a YAML document and for each root symbol identifier
updates the tag information of that symbol
"""
if not Path(document).exists():
return
meta = FileSystem.load_yaml(document)
click.secho('merge: {0}'.format(doc... | Read a YAML document and for each root symbol identifier
updates the tag information of that symbol | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/generator.py#L343-L354 |
Pelagicore/qface | qface/generator.py | FileSystem.parse | def parse(input, identifier: str = None, use_cache=False, clear_cache=True, pattern="*.qface", profile=EProfile.FULL):
"""Input can be either a file or directory or a list of files or directory.
A directory will be parsed recursively. The function returns the resulting system.
Stores the result ... | python | def parse(input, identifier: str = None, use_cache=False, clear_cache=True, pattern="*.qface", profile=EProfile.FULL):
"""Input can be either a file or directory or a list of files or directory.
A directory will be parsed recursively. The function returns the resulting system.
Stores the result ... | Input can be either a file or directory or a list of files or directory.
A directory will be parsed recursively. The function returns the resulting system.
Stores the result of the run in the domain cache named after the identifier.
:param path: directory to parse
:param identifier: ide... | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/generator.py#L357-L389 |
Pelagicore/qface | qface/watch.py | monitor | def monitor(args, watch):
"""
reloads the script given by argv when src files changes
"""
watch = watch if isinstance(watch, (list, tuple)) else [watch]
watch = [Path(entry).expand().abspath() for entry in watch]
event_handler = RunScriptChangeHandler(args)
observer = Observer()
for entr... | python | def monitor(args, watch):
"""
reloads the script given by argv when src files changes
"""
watch = watch if isinstance(watch, (list, tuple)) else [watch]
watch = [Path(entry).expand().abspath() for entry in watch]
event_handler = RunScriptChangeHandler(args)
observer = Observer()
for entr... | reloads the script given by argv when src files changes | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/watch.py#L32-L53 |
Pelagicore/qface | qface/idl/domain.py | System.lookup | def lookup(self, name: str):
'''lookup a symbol by fully qualified name.'''
# <module>
if name in self._moduleMap:
return self._moduleMap[name]
# <module>.<Symbol>
(module_name, type_name, fragment_name) = self.split_typename(name)
if not module_name and type_... | python | def lookup(self, name: str):
'''lookup a symbol by fully qualified name.'''
# <module>
if name in self._moduleMap:
return self._moduleMap[name]
# <module>.<Symbol>
(module_name, type_name, fragment_name) = self.split_typename(name)
if not module_name and type_... | lookup a symbol by fully qualified name. | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/idl/domain.py#L51-L62 |
Pelagicore/qface | qface/idl/domain.py | NamedElement.qualified_name | def qualified_name(self):
'''return the fully qualified name (`<module>.<name>`)'''
if self.module == self:
return self.module.name
else:
if "." not in self.name:
return '{0}.{1}'.format(self.module.name, self.name)
else:
# We h... | python | def qualified_name(self):
'''return the fully qualified name (`<module>.<name>`)'''
if self.module == self:
return self.module.name
else:
if "." not in self.name:
return '{0}.{1}'.format(self.module.name, self.name)
else:
# We h... | return the fully qualified name (`<module>.<name>`) | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/idl/domain.py#L104-L113 |
Pelagicore/qface | qface/idl/domain.py | Symbol.add_tag | def add_tag(self, tag):
""" add a tag to the tag list """
if tag not in self._tags:
self._tags[tag] = dict() | python | def add_tag(self, tag):
""" add a tag to the tag list """
if tag not in self._tags:
self._tags[tag] = dict() | add a tag to the tag list | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/idl/domain.py#L146-L149 |
Pelagicore/qface | qface/idl/domain.py | Symbol.add_attribute | def add_attribute(self, tag, name, value):
""" add an attribute (nam, value pair) to the named tag """
self.add_tag(tag)
d = self._tags[tag]
d[name] = value | python | def add_attribute(self, tag, name, value):
""" add an attribute (nam, value pair) to the named tag """
self.add_tag(tag)
d = self._tags[tag]
d[name] = value | add an attribute (nam, value pair) to the named tag | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/idl/domain.py#L151-L155 |
Pelagicore/qface | qface/idl/domain.py | Symbol.attribute | def attribute(self, tag, name):
""" return attribute by tag and attribute name """
if tag in self._tags and name in self._tags[tag]:
return self._tags[tag][name] | python | def attribute(self, tag, name):
""" return attribute by tag and attribute name """
if tag in self._tags and name in self._tags[tag]:
return self._tags[tag][name] | return attribute by tag and attribute name | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/idl/domain.py#L161-L164 |
Pelagicore/qface | qface/idl/domain.py | TypeSymbol.is_valid | def is_valid(self):
'''checks if type is a valid type'''
return (self.is_primitive and self.name) \
or (self.is_complex and self.name) \
or (self.is_list and self.nested) \
or (self.is_map and self.nested) \
or (self.is_model and self.nested) | python | def is_valid(self):
'''checks if type is a valid type'''
return (self.is_primitive and self.name) \
or (self.is_complex and self.name) \
or (self.is_list and self.nested) \
or (self.is_map and self.nested) \
or (self.is_model and self.nested) | checks if type is a valid type | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/idl/domain.py#L209-L215 |
Pelagicore/qface | qface/idl/domain.py | TypeSymbol._resolve | def _resolve(self):
"""resolve the type symbol from name by doing a lookup"""
self.__is_resolved = True
if self.is_complex:
type = self.nested if self.nested else self
type.__reference = self.module.lookup(type.name) | python | def _resolve(self):
"""resolve the type symbol from name by doing a lookup"""
self.__is_resolved = True
if self.is_complex:
type = self.nested if self.nested else self
type.__reference = self.module.lookup(type.name) | resolve the type symbol from name by doing a lookup | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/idl/domain.py#L274-L279 |
Pelagicore/qface | qface/idl/domain.py | Module.lookup | def lookup(self, name: str, fragment: str = None):
'''lookup a symbol by name. If symbol is not local
it will be looked up system wide'''
if name in self._contentMap:
symbol = self._contentMap[name]
if fragment:
return symbol._contentMap[fragment]
... | python | def lookup(self, name: str, fragment: str = None):
'''lookup a symbol by name. If symbol is not local
it will be looked up system wide'''
if name in self._contentMap:
symbol = self._contentMap[name]
if fragment:
return symbol._contentMap[fragment]
... | lookup a symbol by name. If symbol is not local
it will be looked up system wide | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/idl/domain.py#L368-L376 |
Pelagicore/qface | qface/idl/domain.py | Operation.qualified_name | def qualified_name(self):
'''return the fully qualified name (`<module>.<interface>#<operation>`)'''
return '{0}.{1}#{2}'.format(self.module.name, self.interface.name, self.name) | python | def qualified_name(self):
'''return the fully qualified name (`<module>.<interface>#<operation>`)'''
return '{0}.{1}#{2}'.format(self.module.name, self.interface.name, self.name) | return the fully qualified name (`<module>.<interface>#<operation>`) | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/idl/domain.py#L440-L442 |
Pelagicore/qface | qface/idl/domain.py | Field.qualified_name | def qualified_name(self):
'''return the fully qualified name (`<module>.<struct>#<field>`)'''
return '{0}.{1}#{2}'.format(self.module.name, self.struct.name, self.name) | python | def qualified_name(self):
'''return the fully qualified name (`<module>.<struct>#<field>`)'''
return '{0}.{1}#{2}'.format(self.module.name, self.struct.name, self.name) | return the fully qualified name (`<module>.<struct>#<field>`) | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/idl/domain.py#L561-L563 |
Pelagicore/qface | qface/idl/domain.py | EnumMember.qualified_name | def qualified_name(self):
'''return the fully qualified name (`<module>.<enum>#<member>`)'''
return '{0}.{1}#{2}'.format(self.module.name, self.enum.name, self.name) | python | def qualified_name(self):
'''return the fully qualified name (`<module>.<enum>#<member>`)'''
return '{0}.{1}#{2}'.format(self.module.name, self.enum.name, self.name) | return the fully qualified name (`<module>.<enum>#<member>`) | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/idl/domain.py#L601-L603 |
Pelagicore/qface | qface/helper/generic.py | jsonify | def jsonify(symbol):
""" returns json format for symbol """
try:
# all symbols have a toJson method, try it
return json.dumps(symbol.toJson(), indent=' ')
except AttributeError:
pass
return json.dumps(symbol, indent=' ') | python | def jsonify(symbol):
""" returns json format for symbol """
try:
# all symbols have a toJson method, try it
return json.dumps(symbol.toJson(), indent=' ')
except AttributeError:
pass
return json.dumps(symbol, indent=' ') | returns json format for symbol | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/helper/generic.py#L5-L12 |
Pelagicore/qface | qface/helper/generic.py | hash | def hash(symbol, hash_type='sha1'):
""" create a hash code from symbol """
code = hashlib.new(hash_type)
code.update(str(symbol).encode('utf-8'))
return code.hexdigest() | python | def hash(symbol, hash_type='sha1'):
""" create a hash code from symbol """
code = hashlib.new(hash_type)
code.update(str(symbol).encode('utf-8'))
return code.hexdigest() | create a hash code from symbol | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/helper/generic.py#L26-L30 |
Pelagicore/qface | qface/shell.py | sh | def sh(args, **kwargs):
"""
runs the given cmd as shell command
"""
if isinstance(args, str):
args = args.split()
if not args:
return
click.echo('$ {0}'.format(' '.join(args)))
try:
return subprocess.check_call(args, **kwargs)
except subprocess.CalledProcessError ... | python | def sh(args, **kwargs):
"""
runs the given cmd as shell command
"""
if isinstance(args, str):
args = args.split()
if not args:
return
click.echo('$ {0}'.format(' '.join(args)))
try:
return subprocess.check_call(args, **kwargs)
except subprocess.CalledProcessError ... | runs the given cmd as shell command | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/shell.py#L9-L23 |
Pelagicore/qface | qface/helper/doc.py | parse_doc | def parse_doc(s):
""" parse a comment in the format of JavaDoc and returns an object, where each JavaDoc tag
is a property of the object. """
if not s:
return
doc = DocObject()
tag = None
s = s[3:-2] # remove '/**' and '*/'
for line in s.splitlines():
line = line.lstrip(... | python | def parse_doc(s):
""" parse a comment in the format of JavaDoc and returns an object, where each JavaDoc tag
is a property of the object. """
if not s:
return
doc = DocObject()
tag = None
s = s[3:-2] # remove '/**' and '*/'
for line in s.splitlines():
line = line.lstrip(... | parse a comment in the format of JavaDoc and returns an object, where each JavaDoc tag
is a property of the object. | https://github.com/Pelagicore/qface/blob/7f60e91e3a91a7cb04cfacbc9ce80f43df444853/qface/helper/doc.py#L58-L85 |
edx/completion | completion/api/permissions.py | IsUserInUrl.has_permission | def has_permission(self, request, view):
"""
Returns true if the current request is by the user themselves.
Note: a 404 is returned for non-staff instead of a 403. This is to prevent
users from being able to detect the existence of accounts.
"""
url_username = request.pa... | python | def has_permission(self, request, view):
"""
Returns true if the current request is by the user themselves.
Note: a 404 is returned for non-staff instead of a 403. This is to prevent
users from being able to detect the existence of accounts.
"""
url_username = request.pa... | Returns true if the current request is by the user themselves.
Note: a 404 is returned for non-staff instead of a 403. This is to prevent
users from being able to detect the existence of accounts. | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/api/permissions.py#L35-L47 |
edx/completion | completion/fields.py | BigAutoField.db_type | def db_type(self, connection):
"""
The type of the field to insert into the database.
"""
conn_module = type(connection).__module__
if "mysql" in conn_module:
return "bigint AUTO_INCREMENT"
elif "postgres" in conn_module:
return "bigserial"
... | python | def db_type(self, connection):
"""
The type of the field to insert into the database.
"""
conn_module = type(connection).__module__
if "mysql" in conn_module:
return "bigint AUTO_INCREMENT"
elif "postgres" in conn_module:
return "bigserial"
... | The type of the field to insert into the database. | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/fields.py#L19-L28 |
edx/completion | completion/models.py | BlockCompletionManager.submit_completion | def submit_completion(self, user, course_key, block_key, completion):
"""
Update the completion value for the specified record.
Parameters:
* user (django.contrib.auth.models.User): The user for whom the
completion is being submitted.
* course_key (opaque_k... | python | def submit_completion(self, user, course_key, block_key, completion):
"""
Update the completion value for the specified record.
Parameters:
* user (django.contrib.auth.models.User): The user for whom the
completion is being submitted.
* course_key (opaque_k... | Update the completion value for the specified record.
Parameters:
* user (django.contrib.auth.models.User): The user for whom the
completion is being submitted.
* course_key (opaque_keys.edx.keys.CourseKey): The course in
which the submitted block is found.
... | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/models.py#L46-L132 |
edx/completion | completion/models.py | BlockCompletionManager.submit_batch_completion | def submit_batch_completion(self, user, course_key, blocks):
"""
Performs a batch insertion of completion objects.
Parameters:
* user (django.contrib.auth.models.User): The user for whom the
completions are being submitted.
* course_key (opaque_keys.edx.key... | python | def submit_batch_completion(self, user, course_key, blocks):
"""
Performs a batch insertion of completion objects.
Parameters:
* user (django.contrib.auth.models.User): The user for whom the
completions are being submitted.
* course_key (opaque_keys.edx.key... | Performs a batch insertion of completion objects.
Parameters:
* user (django.contrib.auth.models.User): The user for whom the
completions are being submitted.
* course_key (opaque_keys.edx.keys.CourseKey): The course in
which the submitted blocks are found.
... | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/models.py#L135-L169 |
edx/completion | completion/models.py | BlockCompletion.full_block_key | def full_block_key(self):
"""
Returns the "correct" usage key value with the run filled in.
"""
if self.block_key.run is None:
# pylint: disable=unexpected-keyword-arg, no-value-for-parameter
return self.block_key.replace(course_key=self.course_key)
return... | python | def full_block_key(self):
"""
Returns the "correct" usage key value with the run filled in.
"""
if self.block_key.run is None:
# pylint: disable=unexpected-keyword-arg, no-value-for-parameter
return self.block_key.replace(course_key=self.course_key)
return... | Returns the "correct" usage key value with the run filled in. | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/models.py#L202-L209 |
edx/completion | completion/models.py | BlockCompletion.get_course_completions | def get_course_completions(cls, user, course_key):
"""
Returns a dictionary mapping BlockKeys to completion values for all
BlockCompletion records for the given user and course_key.
Return value:
dict[BlockKey] = float
"""
user_course_completions = cls.user_c... | python | def get_course_completions(cls, user, course_key):
"""
Returns a dictionary mapping BlockKeys to completion values for all
BlockCompletion records for the given user and course_key.
Return value:
dict[BlockKey] = float
"""
user_course_completions = cls.user_c... | Returns a dictionary mapping BlockKeys to completion values for all
BlockCompletion records for the given user and course_key.
Return value:
dict[BlockKey] = float | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/models.py#L212-L221 |
edx/completion | completion/models.py | BlockCompletion.user_course_completion_queryset | def user_course_completion_queryset(cls, user, course_key):
"""
Returns a Queryset of completions for a given user and course_key.
"""
return cls.objects.filter(user=user, course_key=course_key) | python | def user_course_completion_queryset(cls, user, course_key):
"""
Returns a Queryset of completions for a given user and course_key.
"""
return cls.objects.filter(user=user, course_key=course_key) | Returns a Queryset of completions for a given user and course_key. | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/models.py#L224-L228 |
edx/completion | completion/handlers.py | scorable_block_completion | def scorable_block_completion(sender, **kwargs): # pylint: disable=unused-argument
"""
When a problem is scored, submit a new BlockCompletion for that block.
"""
if not waffle.waffle().is_enabled(waffle.ENABLE_COMPLETION_TRACKING):
return
course_key = CourseKey.from_string(kwargs['course_id... | python | def scorable_block_completion(sender, **kwargs): # pylint: disable=unused-argument
"""
When a problem is scored, submit a new BlockCompletion for that block.
"""
if not waffle.waffle().is_enabled(waffle.ENABLE_COMPLETION_TRACKING):
return
course_key = CourseKey.from_string(kwargs['course_id... | When a problem is scored, submit a new BlockCompletion for that block. | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/handlers.py#L15-L39 |
edx/completion | completion/api/v1/views.py | CompletionBatchView._validate_and_parse | def _validate_and_parse(self, batch_object):
"""
Performs validation on the batch object to make sure it is in the proper format.
Parameters:
* batch_object: The data provided to a POST. The expected format is the following:
{
"username": "username",
... | python | def _validate_and_parse(self, batch_object):
"""
Performs validation on the batch object to make sure it is in the proper format.
Parameters:
* batch_object: The data provided to a POST. The expected format is the following:
{
"username": "username",
... | Performs validation on the batch object to make sure it is in the proper format.
Parameters:
* batch_object: The data provided to a POST. The expected format is the following:
{
"username": "username",
"course_key": "course-key",
"blocks":... | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/api/v1/views.py#L55-L107 |
edx/completion | completion/api/v1/views.py | CompletionBatchView._validate_and_parse_course_key | def _validate_and_parse_course_key(self, course_key):
"""
Returns a validated parsed CourseKey deserialized from the given course_key.
"""
try:
return CourseKey.from_string(course_key)
except InvalidKeyError:
raise ValidationError(_("Invalid course key: {}... | python | def _validate_and_parse_course_key(self, course_key):
"""
Returns a validated parsed CourseKey deserialized from the given course_key.
"""
try:
return CourseKey.from_string(course_key)
except InvalidKeyError:
raise ValidationError(_("Invalid course key: {}... | Returns a validated parsed CourseKey deserialized from the given course_key. | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/api/v1/views.py#L109-L116 |
edx/completion | completion/api/v1/views.py | CompletionBatchView._validate_and_parse_block_key | def _validate_and_parse_block_key(self, block_key, course_key_obj):
"""
Returns a validated, parsed UsageKey deserialized from the given block_key.
"""
try:
block_key_obj = UsageKey.from_string(block_key)
except InvalidKeyError:
raise ValidationError(_("In... | python | def _validate_and_parse_block_key(self, block_key, course_key_obj):
"""
Returns a validated, parsed UsageKey deserialized from the given block_key.
"""
try:
block_key_obj = UsageKey.from_string(block_key)
except InvalidKeyError:
raise ValidationError(_("In... | Returns a validated, parsed UsageKey deserialized from the given block_key. | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/api/v1/views.py#L118-L137 |
edx/completion | completion/api/v1/views.py | CompletionBatchView.post | def post(self, request, *args, **kwargs): # pylint: disable=unused-argument
"""
Inserts a batch of completions.
REST Endpoint Format:
{
"username": "username",
"course_key": "course-key",
"blocks": {
"block_key1": 0.0,
"block_key2":... | python | def post(self, request, *args, **kwargs): # pylint: disable=unused-argument
"""
Inserts a batch of completions.
REST Endpoint Format:
{
"username": "username",
"course_key": "course-key",
"blocks": {
"block_key1": 0.0,
"block_key2":... | Inserts a batch of completions.
REST Endpoint Format:
{
"username": "username",
"course_key": "course-key",
"blocks": {
"block_key1": 0.0,
"block_key2": 1.0,
"block_key3": 1.0,
}
}
**Returns**
A Respon... | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/api/v1/views.py#L139-L187 |
edx/completion | completion/api/v1/views.py | SubsectionCompletionView.get | def get(self, request, username, course_key, subsection_id):
"""
Returns completion for a (user, subsection, course).
"""
def get_completion(course_completions, all_blocks, block_id):
"""
Recursively get the aggregate completion for a subsection,
given... | python | def get(self, request, username, course_key, subsection_id):
"""
Returns completion for a (user, subsection, course).
"""
def get_completion(course_completions, all_blocks, block_id):
"""
Recursively get the aggregate completion for a subsection,
given... | Returns completion for a (user, subsection, course). | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/api/v1/views.py#L199-L252 |
edx/completion | completion/services.py | CompletionService.get_completions | def get_completions(self, candidates):
"""
Given an iterable collection of block_keys in the course, returns a
mapping of the block_keys to the present completion values of their
associated blocks.
If a completion is not found for a given block in the current course,
0.0... | python | def get_completions(self, candidates):
"""
Given an iterable collection of block_keys in the course, returns a
mapping of the block_keys to the present completion values of their
associated blocks.
If a completion is not found for a given block in the current course,
0.0... | Given an iterable collection of block_keys in the course, returns a
mapping of the block_keys to the present completion values of their
associated blocks.
If a completion is not found for a given block in the current course,
0.0 is returned. The service does not attempt to verify that ... | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/services.py#L41-L70 |
edx/completion | completion/services.py | CompletionService.vertical_is_complete | def vertical_is_complete(self, item):
"""
Calculates and returns whether a particular vertical is complete.
The logic in this method is temporary, and will go away once the
completion API is able to store a first-order notion of completeness
for parent blocks (right now it just s... | python | def vertical_is_complete(self, item):
"""
Calculates and returns whether a particular vertical is complete.
The logic in this method is temporary, and will go away once the
completion API is able to store a first-order notion of completeness
for parent blocks (right now it just s... | Calculates and returns whether a particular vertical is complete.
The logic in this method is temporary, and will go away once the
completion API is able to store a first-order notion of completeness
for parent blocks (right now it just stores completion for leaves-
problems, HTML, video... | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/services.py#L72-L94 |
edx/completion | completion/services.py | CompletionService.can_mark_block_complete_on_view | def can_mark_block_complete_on_view(self, block):
"""
Returns True if the xblock can be marked complete on view.
This is true of any non-customized, non-scorable, completable block.
"""
return (
XBlockCompletionMode.get_mode(block) == XBlockCompletionMode.COMPLETABLE
... | python | def can_mark_block_complete_on_view(self, block):
"""
Returns True if the xblock can be marked complete on view.
This is true of any non-customized, non-scorable, completable block.
"""
return (
XBlockCompletionMode.get_mode(block) == XBlockCompletionMode.COMPLETABLE
... | Returns True if the xblock can be marked complete on view.
This is true of any non-customized, non-scorable, completable block. | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/services.py#L103-L112 |
edx/completion | completion/services.py | CompletionService.blocks_to_mark_complete_on_view | def blocks_to_mark_complete_on_view(self, blocks):
"""
Returns a set of blocks which should be marked complete on view and haven't been yet.
"""
blocks = {block for block in blocks if self.can_mark_block_complete_on_view(block)}
completions = self.get_completions({block.location ... | python | def blocks_to_mark_complete_on_view(self, blocks):
"""
Returns a set of blocks which should be marked complete on view and haven't been yet.
"""
blocks = {block for block in blocks if self.can_mark_block_complete_on_view(block)}
completions = self.get_completions({block.location ... | Returns a set of blocks which should be marked complete on view and haven't been yet. | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/services.py#L114-L120 |
edx/completion | completion/services.py | CompletionService.submit_group_completion | def submit_group_completion(self, block_key, completion, users=None, user_ids=None):
"""
Submit a completion for a group of users.
Arguments:
block_key (opaque_key.edx.keys.UsageKey): The block to submit completions for.
completion (float): A value in the range [0.0, 1.... | python | def submit_group_completion(self, block_key, completion, users=None, user_ids=None):
"""
Submit a completion for a group of users.
Arguments:
block_key (opaque_key.edx.keys.UsageKey): The block to submit completions for.
completion (float): A value in the range [0.0, 1.... | Submit a completion for a group of users.
Arguments:
block_key (opaque_key.edx.keys.UsageKey): The block to submit completions for.
completion (float): A value in the range [0.0, 1.0]
users ([django.contrib.auth.models.User]): An optional iterable of Users that completed th... | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/services.py#L122-L155 |
edx/completion | completion/services.py | CompletionService.submit_completion | def submit_completion(self, block_key, completion):
"""
Submit a completion for the service user and course.
Returns a (BlockCompletion, bool) where the boolean indicates
whether the given BlockCompletion was newly created.
"""
return BlockCompletion.objects.submit_compl... | python | def submit_completion(self, block_key, completion):
"""
Submit a completion for the service user and course.
Returns a (BlockCompletion, bool) where the boolean indicates
whether the given BlockCompletion was newly created.
"""
return BlockCompletion.objects.submit_compl... | Submit a completion for the service user and course.
Returns a (BlockCompletion, bool) where the boolean indicates
whether the given BlockCompletion was newly created. | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/services.py#L157-L169 |
edx/completion | completion/utilities.py | get_key_to_last_completed_course_block | def get_key_to_last_completed_course_block(user, course_key):
"""
Returns the last block a "user" completed in a course (stated as "course_key").
raises UnavailableCompletionData when the user has not completed blocks in
the course.
raises UnavailableCompletionData when the visual progress waffle ... | python | def get_key_to_last_completed_course_block(user, course_key):
"""
Returns the last block a "user" completed in a course (stated as "course_key").
raises UnavailableCompletionData when the user has not completed blocks in
the course.
raises UnavailableCompletionData when the visual progress waffle ... | Returns the last block a "user" completed in a course (stated as "course_key").
raises UnavailableCompletionData when the user has not completed blocks in
the course.
raises UnavailableCompletionData when the visual progress waffle flag is
disabled. | https://github.com/edx/completion/blob/5c23806f6db69ce6be3fd068fc5b5fdf4d66bd60/completion/utilities.py#L13-L29 |
Nike-Inc/cerberus-python-client | cerberus/util.py | throw_if_bad_response | def throw_if_bad_response(response):
"""Throw an exception if the Cerberus response is not successful."""
try:
response.raise_for_status()
except RequestException:
try:
msg = 'Response code: {}; response body:\n{}'.format(response.status_code, json.dumps(response.json(), indent=2... | python | def throw_if_bad_response(response):
"""Throw an exception if the Cerberus response is not successful."""
try:
response.raise_for_status()
except RequestException:
try:
msg = 'Response code: {}; response body:\n{}'.format(response.status_code, json.dumps(response.json(), indent=2... | Throw an exception if the Cerberus response is not successful. | https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/util.py#L26-L36 |
keenlabs/KeenClient-Python | keen/__init__.py | _initialize_client_from_environment | def _initialize_client_from_environment():
''' Initialize a KeenClient instance using environment variables. '''
global _client, project_id, write_key, read_key, master_key, base_url
if _client is None:
# check environment for project ID and keys
project_id = project_id or os.environ.get("K... | python | def _initialize_client_from_environment():
''' Initialize a KeenClient instance using environment variables. '''
global _client, project_id, write_key, read_key, master_key, base_url
if _client is None:
# check environment for project ID and keys
project_id = project_id or os.environ.get("K... | Initialize a KeenClient instance using environment variables. | https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/__init__.py#L14-L33 |
keenlabs/KeenClient-Python | keen/__init__.py | add_event | def add_event(event_collection, body, timestamp=None):
""" Adds an event.
Depending on the persistence strategy of the client,
this will either result in the event being uploaded to Keen
immediately or will result in saving the event to some local cache.
:param event_collection: the name of the co... | python | def add_event(event_collection, body, timestamp=None):
""" Adds an event.
Depending on the persistence strategy of the client,
this will either result in the event being uploaded to Keen
immediately or will result in saving the event to some local cache.
:param event_collection: the name of the co... | Adds an event.
Depending on the persistence strategy of the client,
this will either result in the event being uploaded to Keen
immediately or will result in saving the event to some local cache.
:param event_collection: the name of the collection to insert the
event to
:param body: dict, the ... | https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/__init__.py#L36-L49 |
keenlabs/KeenClient-Python | keen/__init__.py | generate_image_beacon | def generate_image_beacon(event_collection, body, timestamp=None):
""" Generates an image beacon URL.
:param event_collection: the name of the collection to insert the
event to
:param body: dict, the body of the event to insert the event to
:param timestamp: datetime, optional, the timestamp of the... | python | def generate_image_beacon(event_collection, body, timestamp=None):
""" Generates an image beacon URL.
:param event_collection: the name of the collection to insert the
event to
:param body: dict, the body of the event to insert the event to
:param timestamp: datetime, optional, the timestamp of the... | Generates an image beacon URL.
:param event_collection: the name of the collection to insert the
event to
:param body: dict, the body of the event to insert the event to
:param timestamp: datetime, optional, the timestamp of the event | https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/__init__.py#L65-L74 |
keenlabs/KeenClient-Python | keen/__init__.py | count | def count(event_collection, timeframe=None, timezone=None, interval=None, filters=None, group_by=None, order_by=None,
max_age=None, limit=None):
""" Performs a count query
Counts the number of events that meet the given criteria.
:param event_collection: string, the name of the collection to que... | python | def count(event_collection, timeframe=None, timezone=None, interval=None, filters=None, group_by=None, order_by=None,
max_age=None, limit=None):
""" Performs a count query
Counts the number of events that meet the given criteria.
:param event_collection: string, the name of the collection to que... | Performs a count query
Counts the number of events that meet the given criteria.
:param event_collection: string, the name of the collection to query
:param timeframe: string or dict, the timeframe in which the events
happened example: "previous_7_days"
:param timezone: int, the timezone you'd lik... | https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/__init__.py#L77-L106 |
keenlabs/KeenClient-Python | keen/__init__.py | sum | def sum(event_collection, target_property, timeframe=None, timezone=None, interval=None, filters=None,
group_by=None, order_by=None, max_age=None, limit=None):
""" Performs a sum query
Adds the values of a target property for events that meet the given criteria.
:param event_collection: string, th... | python | def sum(event_collection, target_property, timeframe=None, timezone=None, interval=None, filters=None,
group_by=None, order_by=None, max_age=None, limit=None):
""" Performs a sum query
Adds the values of a target property for events that meet the given criteria.
:param event_collection: string, th... | Performs a sum query
Adds the values of a target property for events that meet the given criteria.
:param event_collection: string, the name of the collection to query
:param target_property: string, the name of the event property you would like use
:param timeframe: string or dict, the timeframe in w... | https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/__init__.py#L109-L139 |
keenlabs/KeenClient-Python | keen/__init__.py | extraction | def extraction(event_collection, timeframe=None, timezone=None, filters=None, latest=None, email=None,
property_names=None):
""" Performs a data extraction
Returns either a JSON object of events or a response
indicating an email will be sent to you with data.
:param event_collection: s... | python | def extraction(event_collection, timeframe=None, timezone=None, filters=None, latest=None, email=None,
property_names=None):
""" Performs a data extraction
Returns either a JSON object of events or a response
indicating an email will be sent to you with data.
:param event_collection: s... | Performs a data extraction
Returns either a JSON object of events or a response
indicating an email will be sent to you with data.
:param event_collection: string, the name of the collection to query
:param timeframe: string or dict, the timeframe in which the events
happened example: "previous_7... | https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/__init__.py#L385-L406 |
keenlabs/KeenClient-Python | keen/__init__.py | multi_analysis | def multi_analysis(event_collection, analyses, timeframe=None, interval=None, timezone=None,
filters=None, group_by=None, order_by=None, max_age=None, limit=None):
""" Performs a multi-analysis query
Returns a dictionary of analysis results.
:param event_collection: string, the name of ... | python | def multi_analysis(event_collection, analyses, timeframe=None, interval=None, timezone=None,
filters=None, group_by=None, order_by=None, max_age=None, limit=None):
""" Performs a multi-analysis query
Returns a dictionary of analysis results.
:param event_collection: string, the name of ... | Performs a multi-analysis query
Returns a dictionary of analysis results.
:param event_collection: string, the name of the collection to query
:param analyses: dict, the types of analyses you'd like to run. example:
{"total money made":{"analysis_type":"sum","target_property":"purchase.price",
"a... | https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/__init__.py#L429-L462 |
keenlabs/KeenClient-Python | keen/__init__.py | create_access_key | def create_access_key(name, is_active=True, permitted=[], options={}):
""" Creates a new access key. A master key must be set first.
:param name: the name of the access key to create
:param is_active: Boolean value dictating whether this key is currently active (default True)
:param permitted: list of ... | python | def create_access_key(name, is_active=True, permitted=[], options={}):
""" Creates a new access key. A master key must be set first.
:param name: the name of the access key to create
:param is_active: Boolean value dictating whether this key is currently active (default True)
:param permitted: list of ... | Creates a new access key. A master key must be set first.
:param name: the name of the access key to create
:param is_active: Boolean value dictating whether this key is currently active (default True)
:param permitted: list of strings describing which operation types this key will permit
... | https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/__init__.py#L500-L513 |
keenlabs/KeenClient-Python | keen/__init__.py | update_access_key_full | def update_access_key_full(access_key_id, name, is_active, permitted, options):
"""
Replaces the 'name', 'is_active', 'permitted', and 'options' values of a given key.
A master key must be set first.
:param access_key_id: the 'key' value of the access key for which the values will be replaced
:para... | python | def update_access_key_full(access_key_id, name, is_active, permitted, options):
"""
Replaces the 'name', 'is_active', 'permitted', and 'options' values of a given key.
A master key must be set first.
:param access_key_id: the 'key' value of the access key for which the values will be replaced
:para... | Replaces the 'name', 'is_active', 'permitted', and 'options' values of a given key.
A master key must be set first.
:param access_key_id: the 'key' value of the access key for which the values will be replaced
:param name: the new name desired for this access key
:param is_active: whether the key shoul... | https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/__init__.py#L590-L602 |
quintusdias/glymur | glymur/lib/openjp2.py | version | def version():
"""Wrapper for opj_version library routine."""
try:
OPENJP2.opj_version.restype = ctypes.c_char_p
except:
return "0.0.0"
v = OPENJP2.opj_version()
return v.decode('utf-8') if sys.hexversion >= 0x03000000 else v | python | def version():
"""Wrapper for opj_version library routine."""
try:
OPENJP2.opj_version.restype = ctypes.c_char_p
except:
return "0.0.0"
v = OPENJP2.opj_version()
return v.decode('utf-8') if sys.hexversion >= 0x03000000 else v | Wrapper for opj_version library routine. | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L22-L30 |
quintusdias/glymur | glymur/lib/openjp2.py | check_error | def check_error(status):
"""Set a generic function as the restype attribute of all OpenJPEG
functions that return a BOOL_TYPE value. This way we do not have to check
for error status in each wrapping function and an exception will always be
appropriately raised.
"""
global ERROR_MSG_LST
if ... | python | def check_error(status):
"""Set a generic function as the restype attribute of all OpenJPEG
functions that return a BOOL_TYPE value. This way we do not have to check
for error status in each wrapping function and an exception will always be
appropriately raised.
"""
global ERROR_MSG_LST
if ... | Set a generic function as the restype attribute of all OpenJPEG
functions that return a BOOL_TYPE value. This way we do not have to check
for error status in each wrapping function and an exception will always be
appropriately raised. | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L579-L594 |
quintusdias/glymur | glymur/lib/openjp2.py | create_compress | def create_compress(codec_format):
"""Creates a J2K/JP2 compress structure.
Wraps the openjp2 library function opj_create_compress.
Parameters
----------
codec_format : int
Specifies codec to select. Should be one of CODEC_J2K or CODEC_JP2.
Returns
-------
codec : Reference ... | python | def create_compress(codec_format):
"""Creates a J2K/JP2 compress structure.
Wraps the openjp2 library function opj_create_compress.
Parameters
----------
codec_format : int
Specifies codec to select. Should be one of CODEC_J2K or CODEC_JP2.
Returns
-------
codec : Reference ... | Creates a J2K/JP2 compress structure.
Wraps the openjp2 library function opj_create_compress.
Parameters
----------
codec_format : int
Specifies codec to select. Should be one of CODEC_J2K or CODEC_JP2.
Returns
-------
codec : Reference to CODEC_TYPE instance. | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L597-L615 |
quintusdias/glymur | glymur/lib/openjp2.py | decode | def decode(codec, stream, image):
"""Reads an entire image.
Wraps the openjp2 library function opj_decode.
Parameters
----------
codec : CODEC_TYPE
The JPEG2000 codec
stream : STREAM_TYPE_P
The stream to decode.
image : ImageType
Output image structure.
Raises
... | python | def decode(codec, stream, image):
"""Reads an entire image.
Wraps the openjp2 library function opj_decode.
Parameters
----------
codec : CODEC_TYPE
The JPEG2000 codec
stream : STREAM_TYPE_P
The stream to decode.
image : ImageType
Output image structure.
Raises
... | Reads an entire image.
Wraps the openjp2 library function opj_decode.
Parameters
----------
codec : CODEC_TYPE
The JPEG2000 codec
stream : STREAM_TYPE_P
The stream to decode.
image : ImageType
Output image structure.
Raises
------
RuntimeError
If th... | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L618-L641 |
quintusdias/glymur | glymur/lib/openjp2.py | decode_tile_data | def decode_tile_data(codec, tidx, data, data_size, stream):
"""Reads tile data.
Wraps the openjp2 library function opj_decode_tile_data.
Parameters
----------
codec : CODEC_TYPE
The JPEG2000 codec
tile_index : int
The index of the tile being decoded
data : array
Hol... | python | def decode_tile_data(codec, tidx, data, data_size, stream):
"""Reads tile data.
Wraps the openjp2 library function opj_decode_tile_data.
Parameters
----------
codec : CODEC_TYPE
The JPEG2000 codec
tile_index : int
The index of the tile being decoded
data : array
Hol... | Reads tile data.
Wraps the openjp2 library function opj_decode_tile_data.
Parameters
----------
codec : CODEC_TYPE
The JPEG2000 codec
tile_index : int
The index of the tile being decoded
data : array
Holds a memory block into which data will be decoded.
data_size : ... | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L644-L679 |
quintusdias/glymur | glymur/lib/openjp2.py | create_decompress | def create_decompress(codec_format):
"""Creates a J2K/JP2 decompress structure.
Wraps the openjp2 library function opj_create_decompress.
Parameters
----------
codec_format : int
Specifies codec to select. Should be one of CODEC_J2K or CODEC_JP2.
Returns
-------
codec : Refer... | python | def create_decompress(codec_format):
"""Creates a J2K/JP2 decompress structure.
Wraps the openjp2 library function opj_create_decompress.
Parameters
----------
codec_format : int
Specifies codec to select. Should be one of CODEC_J2K or CODEC_JP2.
Returns
-------
codec : Refer... | Creates a J2K/JP2 decompress structure.
Wraps the openjp2 library function opj_create_decompress.
Parameters
----------
codec_format : int
Specifies codec to select. Should be one of CODEC_J2K or CODEC_JP2.
Returns
-------
codec : Reference to CODEC_TYPE instance. | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L682-L700 |
quintusdias/glymur | glymur/lib/openjp2.py | destroy_codec | def destroy_codec(codec):
"""Destroy a decompressor handle.
Wraps the openjp2 library function opj_destroy_codec.
Parameters
----------
codec : CODEC_TYPE
Decompressor handle to destroy.
"""
OPENJP2.opj_destroy_codec.argtypes = [CODEC_TYPE]
OPENJP2.opj_destroy_codec.restype = c... | python | def destroy_codec(codec):
"""Destroy a decompressor handle.
Wraps the openjp2 library function opj_destroy_codec.
Parameters
----------
codec : CODEC_TYPE
Decompressor handle to destroy.
"""
OPENJP2.opj_destroy_codec.argtypes = [CODEC_TYPE]
OPENJP2.opj_destroy_codec.restype = c... | Destroy a decompressor handle.
Wraps the openjp2 library function opj_destroy_codec.
Parameters
----------
codec : CODEC_TYPE
Decompressor handle to destroy. | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L703-L715 |
quintusdias/glymur | glymur/lib/openjp2.py | encode | def encode(codec, stream):
"""Wraps openjp2 library function opj_encode.
Encode an image into a JPEG 2000 codestream.
Parameters
----------
codec : CODEC_TYPE
The jpeg2000 codec.
stream : STREAM_TYPE_P
The stream to which data is written.
Raises
------
RuntimeError... | python | def encode(codec, stream):
"""Wraps openjp2 library function opj_encode.
Encode an image into a JPEG 2000 codestream.
Parameters
----------
codec : CODEC_TYPE
The jpeg2000 codec.
stream : STREAM_TYPE_P
The stream to which data is written.
Raises
------
RuntimeError... | Wraps openjp2 library function opj_encode.
Encode an image into a JPEG 2000 codestream.
Parameters
----------
codec : CODEC_TYPE
The jpeg2000 codec.
stream : STREAM_TYPE_P
The stream to which data is written.
Raises
------
RuntimeError
If the OpenJPEG library r... | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L718-L738 |
quintusdias/glymur | glymur/lib/openjp2.py | get_decoded_tile | def get_decoded_tile(codec, stream, imagep, tile_index):
"""get the decoded tile from the codec
Wraps the openjp2 library function opj_get_decoded_tile.
Parameters
----------
codec : CODEC_TYPE
The jpeg2000 codec.
stream : STREAM_TYPE_P
The input stream.
image : ImageType
... | python | def get_decoded_tile(codec, stream, imagep, tile_index):
"""get the decoded tile from the codec
Wraps the openjp2 library function opj_get_decoded_tile.
Parameters
----------
codec : CODEC_TYPE
The jpeg2000 codec.
stream : STREAM_TYPE_P
The input stream.
image : ImageType
... | get the decoded tile from the codec
Wraps the openjp2 library function opj_get_decoded_tile.
Parameters
----------
codec : CODEC_TYPE
The jpeg2000 codec.
stream : STREAM_TYPE_P
The input stream.
image : ImageType
Output image structure.
tiler_index : int
Ind... | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L741-L768 |
quintusdias/glymur | glymur/lib/openjp2.py | end_compress | def end_compress(codec, stream):
"""End of compressing the current image.
Wraps the openjp2 library function opj_end_compress.
Parameters
----------
codec : CODEC_TYPE
Compressor handle.
stream : STREAM_TYPE_P
Output stream buffer.
Raises
------
RuntimeError
... | python | def end_compress(codec, stream):
"""End of compressing the current image.
Wraps the openjp2 library function opj_end_compress.
Parameters
----------
codec : CODEC_TYPE
Compressor handle.
stream : STREAM_TYPE_P
Output stream buffer.
Raises
------
RuntimeError
... | End of compressing the current image.
Wraps the openjp2 library function opj_end_compress.
Parameters
----------
codec : CODEC_TYPE
Compressor handle.
stream : STREAM_TYPE_P
Output stream buffer.
Raises
------
RuntimeError
If the OpenJPEG library routine opj_en... | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L771-L790 |
quintusdias/glymur | glymur/lib/openjp2.py | end_decompress | def end_decompress(codec, stream):
"""End of decompressing the current image.
Wraps the openjp2 library function opj_end_decompress.
Parameters
----------
codec : CODEC_TYPE
Compressor handle.
stream : STREAM_TYPE_P
Output stream buffer.
Raises
------
RuntimeError
... | python | def end_decompress(codec, stream):
"""End of decompressing the current image.
Wraps the openjp2 library function opj_end_decompress.
Parameters
----------
codec : CODEC_TYPE
Compressor handle.
stream : STREAM_TYPE_P
Output stream buffer.
Raises
------
RuntimeError
... | End of decompressing the current image.
Wraps the openjp2 library function opj_end_decompress.
Parameters
----------
codec : CODEC_TYPE
Compressor handle.
stream : STREAM_TYPE_P
Output stream buffer.
Raises
------
RuntimeError
If the OpenJPEG library routine op... | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L793-L812 |
quintusdias/glymur | glymur/lib/openjp2.py | image_destroy | def image_destroy(image):
"""Deallocate any resources associated with an image.
Wraps the openjp2 library function opj_image_destroy.
Parameters
----------
image : ImageType pointer
Image resource to be disposed.
"""
OPENJP2.opj_image_destroy.argtypes = [ctypes.POINTER(ImageType)]
... | python | def image_destroy(image):
"""Deallocate any resources associated with an image.
Wraps the openjp2 library function opj_image_destroy.
Parameters
----------
image : ImageType pointer
Image resource to be disposed.
"""
OPENJP2.opj_image_destroy.argtypes = [ctypes.POINTER(ImageType)]
... | Deallocate any resources associated with an image.
Wraps the openjp2 library function opj_image_destroy.
Parameters
----------
image : ImageType pointer
Image resource to be disposed. | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L815-L828 |
quintusdias/glymur | glymur/lib/openjp2.py | image_create | def image_create(comptparms, clrspc):
"""Creates a new image structure.
Wraps the openjp2 library function opj_image_create.
Parameters
----------
cmptparms : comptparms_t
The component parameters.
clrspc : int
Specifies the color space.
Returns
-------
image : Ima... | python | def image_create(comptparms, clrspc):
"""Creates a new image structure.
Wraps the openjp2 library function opj_image_create.
Parameters
----------
cmptparms : comptparms_t
The component parameters.
clrspc : int
Specifies the color space.
Returns
-------
image : Ima... | Creates a new image structure.
Wraps the openjp2 library function opj_image_create.
Parameters
----------
cmptparms : comptparms_t
The component parameters.
clrspc : int
Specifies the color space.
Returns
-------
image : ImageType
Reference to ImageType instanc... | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L831-L856 |
quintusdias/glymur | glymur/lib/openjp2.py | image_tile_create | def image_tile_create(comptparms, clrspc):
"""Creates a new image structure.
Wraps the openjp2 library function opj_image_tile_create.
Parameters
----------
cmptparms : comptparms_t
The component parameters.
clrspc : int
Specifies the color space.
Returns
-------
i... | python | def image_tile_create(comptparms, clrspc):
"""Creates a new image structure.
Wraps the openjp2 library function opj_image_tile_create.
Parameters
----------
cmptparms : comptparms_t
The component parameters.
clrspc : int
Specifies the color space.
Returns
-------
i... | Creates a new image structure.
Wraps the openjp2 library function opj_image_tile_create.
Parameters
----------
cmptparms : comptparms_t
The component parameters.
clrspc : int
Specifies the color space.
Returns
-------
image : ImageType
Reference to ImageType in... | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L859-L885 |
quintusdias/glymur | glymur/lib/openjp2.py | read_header | def read_header(stream, codec):
"""Decodes an image header.
Wraps the openjp2 library function opj_read_header.
Parameters
----------
stream: STREAM_TYPE_P
The JPEG2000 stream.
codec: codec_t
The JPEG2000 codec to read.
Returns
-------
imagep : reference to ImageT... | python | def read_header(stream, codec):
"""Decodes an image header.
Wraps the openjp2 library function opj_read_header.
Parameters
----------
stream: STREAM_TYPE_P
The JPEG2000 stream.
codec: codec_t
The JPEG2000 codec to read.
Returns
-------
imagep : reference to ImageT... | Decodes an image header.
Wraps the openjp2 library function opj_read_header.
Parameters
----------
stream: STREAM_TYPE_P
The JPEG2000 stream.
codec: codec_t
The JPEG2000 codec to read.
Returns
-------
imagep : reference to ImageType instance
The image structur... | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L888-L917 |
quintusdias/glymur | glymur/lib/openjp2.py | read_tile_header | def read_tile_header(codec, stream):
"""Reads a tile header.
Wraps the openjp2 library function opj_read_tile_header.
Parameters
----------
codec : codec_t
The JPEG2000 codec to read.
stream : STREAM_TYPE_P
The JPEG2000 stream.
Returns
-------
tile_index : int
... | python | def read_tile_header(codec, stream):
"""Reads a tile header.
Wraps the openjp2 library function opj_read_tile_header.
Parameters
----------
codec : codec_t
The JPEG2000 codec to read.
stream : STREAM_TYPE_P
The JPEG2000 stream.
Returns
-------
tile_index : int
... | Reads a tile header.
Wraps the openjp2 library function opj_read_tile_header.
Parameters
----------
codec : codec_t
The JPEG2000 codec to read.
stream : STREAM_TYPE_P
The JPEG2000 stream.
Returns
-------
tile_index : int
index of the tile being decoded
data... | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L920-L991 |
quintusdias/glymur | glymur/lib/openjp2.py | set_decode_area | def set_decode_area(codec, image, start_x=0, start_y=0, end_x=0, end_y=0):
"""Wraps openjp2 library function opj_set_decode area.
Sets the given area to be decoded. This function should be called right
after read_header and before any tile header reading.
Parameters
----------
codec : CODEC_T... | python | def set_decode_area(codec, image, start_x=0, start_y=0, end_x=0, end_y=0):
"""Wraps openjp2 library function opj_set_decode area.
Sets the given area to be decoded. This function should be called right
after read_header and before any tile header reading.
Parameters
----------
codec : CODEC_T... | Wraps openjp2 library function opj_set_decode area.
Sets the given area to be decoded. This function should be called right
after read_header and before any tile header reading.
Parameters
----------
codec : CODEC_TYPE
Codec initialized by create_decompress function.
image : ImageType... | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L994-L1028 |
quintusdias/glymur | glymur/lib/openjp2.py | set_default_decoder_parameters | def set_default_decoder_parameters():
"""Wraps openjp2 library function opj_set_default_decoder_parameters.
Sets decoding parameters to default values.
Returns
-------
dparam : DecompressionParametersType
Decompression parameters.
"""
ARGTYPES = [ctypes.POINTER(DecompressionParamet... | python | def set_default_decoder_parameters():
"""Wraps openjp2 library function opj_set_default_decoder_parameters.
Sets decoding parameters to default values.
Returns
-------
dparam : DecompressionParametersType
Decompression parameters.
"""
ARGTYPES = [ctypes.POINTER(DecompressionParamet... | Wraps openjp2 library function opj_set_default_decoder_parameters.
Sets decoding parameters to default values.
Returns
-------
dparam : DecompressionParametersType
Decompression parameters. | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L1031-L1047 |
quintusdias/glymur | glymur/lib/openjp2.py | set_default_encoder_parameters | def set_default_encoder_parameters():
"""Wraps openjp2 library function opj_set_default_encoder_parameters.
Sets encoding parameters to default values. That means
lossless
1 tile
size of precinct : 2^15 x 2^15 (means 1 precinct)
size of code-block : 64 x 64
number of r... | python | def set_default_encoder_parameters():
"""Wraps openjp2 library function opj_set_default_encoder_parameters.
Sets encoding parameters to default values. That means
lossless
1 tile
size of precinct : 2^15 x 2^15 (means 1 precinct)
size of code-block : 64 x 64
number of r... | Wraps openjp2 library function opj_set_default_encoder_parameters.
Sets encoding parameters to default values. That means
lossless
1 tile
size of precinct : 2^15 x 2^15 (means 1 precinct)
size of code-block : 64 x 64
number of resolutions: 6
no SOP marker in the co... | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L1050-L1086 |
quintusdias/glymur | glymur/lib/openjp2.py | set_error_handler | def set_error_handler(codec, handler, data=None):
"""Wraps openjp2 library function opj_set_error_handler.
Set the error handler use by openjpeg.
Parameters
----------
codec : CODEC_TYPE
Codec initialized by create_compress function.
handler : python function
The callback funct... | python | def set_error_handler(codec, handler, data=None):
"""Wraps openjp2 library function opj_set_error_handler.
Set the error handler use by openjpeg.
Parameters
----------
codec : CODEC_TYPE
Codec initialized by create_compress function.
handler : python function
The callback funct... | Wraps openjp2 library function opj_set_error_handler.
Set the error handler use by openjpeg.
Parameters
----------
codec : CODEC_TYPE
Codec initialized by create_compress function.
handler : python function
The callback function to be used.
user_data : anything
User/cli... | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L1089-L1112 |
quintusdias/glymur | glymur/lib/openjp2.py | set_info_handler | def set_info_handler(codec, handler, data=None):
"""Wraps openjp2 library function opj_set_info_handler.
Set the info handler use by openjpeg.
Parameters
----------
codec : CODEC_TYPE
Codec initialized by create_compress function.
handler : python function
The callback function... | python | def set_info_handler(codec, handler, data=None):
"""Wraps openjp2 library function opj_set_info_handler.
Set the info handler use by openjpeg.
Parameters
----------
codec : CODEC_TYPE
Codec initialized by create_compress function.
handler : python function
The callback function... | Wraps openjp2 library function opj_set_info_handler.
Set the info handler use by openjpeg.
Parameters
----------
codec : CODEC_TYPE
Codec initialized by create_compress function.
handler : python function
The callback function to be used.
user_data : anything
User/clien... | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L1115-L1138 |
quintusdias/glymur | glymur/lib/openjp2.py | set_warning_handler | def set_warning_handler(codec, handler, data=None):
"""Wraps openjp2 library function opj_set_warning_handler.
Set the warning handler use by openjpeg.
Parameters
----------
codec : CODEC_TYPE
Codec initialized by create_compress function.
handler : python function
The callback... | python | def set_warning_handler(codec, handler, data=None):
"""Wraps openjp2 library function opj_set_warning_handler.
Set the warning handler use by openjpeg.
Parameters
----------
codec : CODEC_TYPE
Codec initialized by create_compress function.
handler : python function
The callback... | Wraps openjp2 library function opj_set_warning_handler.
Set the warning handler use by openjpeg.
Parameters
----------
codec : CODEC_TYPE
Codec initialized by create_compress function.
handler : python function
The callback function to be used.
user_data : anything
User... | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L1141-L1165 |
quintusdias/glymur | glymur/lib/openjp2.py | setup_decoder | def setup_decoder(codec, dparams):
"""Wraps openjp2 library function opj_setup_decoder.
Setup the decoder with decompression parameters.
Parameters
----------
codec: CODEC_TYPE
Codec initialized by create_compress function.
dparams: DecompressionParametersType
Decompression p... | python | def setup_decoder(codec, dparams):
"""Wraps openjp2 library function opj_setup_decoder.
Setup the decoder with decompression parameters.
Parameters
----------
codec: CODEC_TYPE
Codec initialized by create_compress function.
dparams: DecompressionParametersType
Decompression p... | Wraps openjp2 library function opj_setup_decoder.
Setup the decoder with decompression parameters.
Parameters
----------
codec: CODEC_TYPE
Codec initialized by create_compress function.
dparams: DecompressionParametersType
Decompression parameters.
Raises
------
Runt... | https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L1168-L1189 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.