repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
adrn/gala
gala/dynamics/plot.py
plot_projections
def plot_projections(x, relative_to=None, autolim=True, axes=None, subplots_kwargs=dict(), labels=None, plot_function=None, **kwargs): """ Given N-dimensional quantity, ``x``, make a figure containing 2D projections of all combinations of the axes. Parameters ...
python
def plot_projections(x, relative_to=None, autolim=True, axes=None, subplots_kwargs=dict(), labels=None, plot_function=None, **kwargs): """ Given N-dimensional quantity, ``x``, make a figure containing 2D projections of all combinations of the axes. Parameters ...
[ "def", "plot_projections", "(", "x", ",", "relative_to", "=", "None", ",", "autolim", "=", "True", ",", "axes", "=", "None", ",", "subplots_kwargs", "=", "dict", "(", ")", ",", "labels", "=", "None", ",", "plot_function", "=", "None", ",", "**", "kwarg...
Given N-dimensional quantity, ``x``, make a figure containing 2D projections of all combinations of the axes. Parameters ---------- x : array_like Array of values. ``axis=0`` is assumed to be the dimensionality, ``axis=1`` is the time axis. See :ref:`shape-conventions` for more ...
[ "Given", "N", "-", "dimensional", "quantity", "x", "make", "a", "figure", "containing", "2D", "projections", "of", "all", "combinations", "of", "the", "axes", "." ]
ea95575a0df1581bb4b0986aebd6eea8438ab7eb
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/dynamics/plot.py#L34-L120
train
adrn/gala
gala/dynamics/_genfunc/genfunc_3d.py
angmom
def angmom(x): """ returns angular momentum vector of phase-space point x""" return np.array([x[1]*x[5]-x[2]*x[4],x[2]*x[3]-x[0]*x[5],x[0]*x[4]-x[1]*x[3]])
python
def angmom(x): """ returns angular momentum vector of phase-space point x""" return np.array([x[1]*x[5]-x[2]*x[4],x[2]*x[3]-x[0]*x[5],x[0]*x[4]-x[1]*x[3]])
[ "def", "angmom", "(", "x", ")", ":", "return", "np", ".", "array", "(", "[", "x", "[", "1", "]", "*", "x", "[", "5", "]", "-", "x", "[", "2", "]", "*", "x", "[", "4", "]", ",", "x", "[", "2", "]", "*", "x", "[", "3", "]", "-", "x", ...
returns angular momentum vector of phase-space point x
[ "returns", "angular", "momentum", "vector", "of", "phase", "-", "space", "point", "x" ]
ea95575a0df1581bb4b0986aebd6eea8438ab7eb
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/dynamics/_genfunc/genfunc_3d.py#L186-L188
train
adrn/gala
gala/dynamics/_genfunc/genfunc_3d.py
flip_coords
def flip_coords(X,loop): """ Align circulation with z-axis """ if(loop[0]==1): return np.array(map(lambda i: np.array([i[2],i[1],i[0],i[5],i[4],i[3]]),X)) else: return X
python
def flip_coords(X,loop): """ Align circulation with z-axis """ if(loop[0]==1): return np.array(map(lambda i: np.array([i[2],i[1],i[0],i[5],i[4],i[3]]),X)) else: return X
[ "def", "flip_coords", "(", "X", ",", "loop", ")", ":", "if", "(", "loop", "[", "0", "]", "==", "1", ")", ":", "return", "np", ".", "array", "(", "map", "(", "lambda", "i", ":", "np", ".", "array", "(", "[", "i", "[", "2", "]", ",", "i", "...
Align circulation with z-axis
[ "Align", "circulation", "with", "z", "-", "axis" ]
ea95575a0df1581bb4b0986aebd6eea8438ab7eb
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/dynamics/_genfunc/genfunc_3d.py#L213-L218
train
adrn/gala
gala/dynamics/analyticactionangle.py
harmonic_oscillator_to_aa
def harmonic_oscillator_to_aa(w, potential): """ Transform the input cartesian position and velocity to action-angle coordinates for the Harmonic Oscillator potential. This transformation is analytic and can be used as a "toy potential" in the Sanders & Binney (2014) formalism for computing action-...
python
def harmonic_oscillator_to_aa(w, potential): """ Transform the input cartesian position and velocity to action-angle coordinates for the Harmonic Oscillator potential. This transformation is analytic and can be used as a "toy potential" in the Sanders & Binney (2014) formalism for computing action-...
[ "def", "harmonic_oscillator_to_aa", "(", "w", ",", "potential", ")", ":", "usys", "=", "potential", ".", "units", "if", "usys", "is", "not", "None", ":", "x", "=", "w", ".", "xyz", ".", "decompose", "(", "usys", ")", ".", "value", "v", "=", "w", "....
Transform the input cartesian position and velocity to action-angle coordinates for the Harmonic Oscillator potential. This transformation is analytic and can be used as a "toy potential" in the Sanders & Binney (2014) formalism for computing action-angle coordinates in any potential. .. note:: ...
[ "Transform", "the", "input", "cartesian", "position", "and", "velocity", "to", "action", "-", "angle", "coordinates", "for", "the", "Harmonic", "Oscillator", "potential", "." ]
ea95575a0df1581bb4b0986aebd6eea8438ab7eb
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/dynamics/analyticactionangle.py#L299-L352
train
adrn/gala
gala/integrate/pyintegrators/rk5.py
RK5Integrator.step
def step(self, t, w, dt): """ Step forward the vector w by the given timestep. Parameters ---------- dt : numeric The timestep to move forward. """ # Runge-Kutta Fehlberg formulas (see: Numerical Recipes) F = lambda t, w: self.F(t, w,...
python
def step(self, t, w, dt): """ Step forward the vector w by the given timestep. Parameters ---------- dt : numeric The timestep to move forward. """ # Runge-Kutta Fehlberg formulas (see: Numerical Recipes) F = lambda t, w: self.F(t, w,...
[ "def", "step", "(", "self", ",", "t", ",", "w", ",", "dt", ")", ":", "F", "=", "lambda", "t", ",", "w", ":", "self", ".", "F", "(", "t", ",", "w", ",", "*", "self", ".", "_func_args", ")", "K", "=", "np", ".", "zeros", "(", "(", "6", ",...
Step forward the vector w by the given timestep. Parameters ---------- dt : numeric The timestep to move forward.
[ "Step", "forward", "the", "vector", "w", "by", "the", "given", "timestep", "." ]
ea95575a0df1581bb4b0986aebd6eea8438ab7eb
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/integrate/pyintegrators/rk5.py#L52-L77
train
adrn/gala
gala/dynamics/_genfunc/solver.py
check_each_direction
def check_each_direction(n,angs,ifprint=True): """ returns a list of the index of elements of n which do not have adequate toy angle coverage. The criterion is that we must have at least one sample in each Nyquist box when we project the toy angles along the vector n """ checks = np.array([]) P = np...
python
def check_each_direction(n,angs,ifprint=True): """ returns a list of the index of elements of n which do not have adequate toy angle coverage. The criterion is that we must have at least one sample in each Nyquist box when we project the toy angles along the vector n """ checks = np.array([]) P = np...
[ "def", "check_each_direction", "(", "n", ",", "angs", ",", "ifprint", "=", "True", ")", ":", "checks", "=", "np", ".", "array", "(", "[", "]", ")", "P", "=", "np", ".", "array", "(", "[", "]", ")", "if", "(", "ifprint", ")", ":", "print", "(", ...
returns a list of the index of elements of n which do not have adequate toy angle coverage. The criterion is that we must have at least one sample in each Nyquist box when we project the toy angles along the vector n
[ "returns", "a", "list", "of", "the", "index", "of", "elements", "of", "n", "which", "do", "not", "have", "adequate", "toy", "angle", "coverage", ".", "The", "criterion", "is", "that", "we", "must", "have", "at", "least", "one", "sample", "in", "each", ...
ea95575a0df1581bb4b0986aebd6eea8438ab7eb
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/dynamics/_genfunc/solver.py#L10-L33
train
adrn/gala
gala/dynamics/_genfunc/solver.py
unroll_angles
def unroll_angles(A,sign): """ Unrolls the angles, A, so they increase continuously """ n = np.array([0,0,0]) P = np.zeros(np.shape(A)) P[0]=A[0] for i in range(1,len(A)): n = n+((A[i]-A[i-1]+0.5*sign*np.pi)*sign<0)*np.ones(3)*2.*np.pi P[i] = A[i]+sign*n return P
python
def unroll_angles(A,sign): """ Unrolls the angles, A, so they increase continuously """ n = np.array([0,0,0]) P = np.zeros(np.shape(A)) P[0]=A[0] for i in range(1,len(A)): n = n+((A[i]-A[i-1]+0.5*sign*np.pi)*sign<0)*np.ones(3)*2.*np.pi P[i] = A[i]+sign*n return P
[ "def", "unroll_angles", "(", "A", ",", "sign", ")", ":", "n", "=", "np", ".", "array", "(", "[", "0", ",", "0", ",", "0", "]", ")", "P", "=", "np", ".", "zeros", "(", "np", ".", "shape", "(", "A", ")", ")", "P", "[", "0", "]", "=", "A",...
Unrolls the angles, A, so they increase continuously
[ "Unrolls", "the", "angles", "A", "so", "they", "increase", "continuously" ]
ea95575a0df1581bb4b0986aebd6eea8438ab7eb
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/dynamics/_genfunc/solver.py#L81-L89
train
adrn/gala
gala/potential/scf/core.py
compute_coeffs
def compute_coeffs(density_func, nmax, lmax, M, r_s, args=(), skip_odd=False, skip_even=False, skip_m=False, S_only=False, progress=False, **nquad_opts): """ Compute the expansion coefficients for representing the input density function using a basis function expansion....
python
def compute_coeffs(density_func, nmax, lmax, M, r_s, args=(), skip_odd=False, skip_even=False, skip_m=False, S_only=False, progress=False, **nquad_opts): """ Compute the expansion coefficients for representing the input density function using a basis function expansion....
[ "def", "compute_coeffs", "(", "density_func", ",", "nmax", ",", "lmax", ",", "M", ",", "r_s", ",", "args", "=", "(", ")", ",", "skip_odd", "=", "False", ",", "skip_even", "=", "False", ",", "skip_m", "=", "False", ",", "S_only", "=", "False", ",", ...
Compute the expansion coefficients for representing the input density function using a basis function expansion. Computing the coefficients involves computing triple integrals which are computationally expensive. For an example of how to parallelize the computation of the coefficients, see ``examples/p...
[ "Compute", "the", "expansion", "coefficients", "for", "representing", "the", "input", "density", "function", "using", "a", "basis", "function", "expansion", "." ]
ea95575a0df1581bb4b0986aebd6eea8438ab7eb
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/potential/scf/core.py#L13-L129
train
adrn/gala
gala/potential/scf/core.py
compute_coeffs_discrete
def compute_coeffs_discrete(xyz, mass, nmax, lmax, r_s, skip_odd=False, skip_even=False, skip_m=False, compute_var=False): """ Compute the expansion coefficients for representing the density distribution of input points as a basis function expansion. T...
python
def compute_coeffs_discrete(xyz, mass, nmax, lmax, r_s, skip_odd=False, skip_even=False, skip_m=False, compute_var=False): """ Compute the expansion coefficients for representing the density distribution of input points as a basis function expansion. T...
[ "def", "compute_coeffs_discrete", "(", "xyz", ",", "mass", ",", "nmax", ",", "lmax", ",", "r_s", ",", "skip_odd", "=", "False", ",", "skip_even", "=", "False", ",", "skip_m", "=", "False", ",", "compute_var", "=", "False", ")", ":", "lmin", "=", "0", ...
Compute the expansion coefficients for representing the density distribution of input points as a basis function expansion. The points, ``xyz``, are assumed to be samples from the density distribution. Computing the coefficients involves computing triple integrals which are computationally expensive. F...
[ "Compute", "the", "expansion", "coefficients", "for", "representing", "the", "density", "distribution", "of", "input", "points", "as", "a", "basis", "function", "expansion", ".", "The", "points", "xyz", "are", "assumed", "to", "be", "samples", "from", "the", "...
ea95575a0df1581bb4b0986aebd6eea8438ab7eb
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/potential/scf/core.py#L132-L216
train
adrn/gala
gala/dynamics/nbody/core.py
DirectNBody.integrate_orbit
def integrate_orbit(self, **time_spec): """ Integrate the initial conditions in the combined external potential plus N-body forces. This integration uses the `~gala.integrate.DOPRI853Integrator`. Parameters ---------- **time_spec Specification of how...
python
def integrate_orbit(self, **time_spec): """ Integrate the initial conditions in the combined external potential plus N-body forces. This integration uses the `~gala.integrate.DOPRI853Integrator`. Parameters ---------- **time_spec Specification of how...
[ "def", "integrate_orbit", "(", "self", ",", "**", "time_spec", ")", ":", "pos", "=", "self", ".", "w0", ".", "xyz", ".", "decompose", "(", "self", ".", "units", ")", ".", "value", "vel", "=", "self", ".", "w0", ".", "v_xyz", ".", "decompose", "(", ...
Integrate the initial conditions in the combined external potential plus N-body forces. This integration uses the `~gala.integrate.DOPRI853Integrator`. Parameters ---------- **time_spec Specification of how long to integrate. See documentation for `~gala...
[ "Integrate", "the", "initial", "conditions", "in", "the", "combined", "external", "potential", "plus", "N", "-", "body", "forces", "." ]
ea95575a0df1581bb4b0986aebd6eea8438ab7eb
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/dynamics/nbody/core.py#L115-L153
train
adrn/gala
gala/dynamics/representation_nd.py
NDMixin._apply
def _apply(self, method, *args, **kwargs): """Create a new representation with ``method`` applied to the arrays. In typical usage, the method is any of the shape-changing methods for `~numpy.ndarray` (``reshape``, ``swapaxes``, etc.), as well as those picking particular elements (``__ge...
python
def _apply(self, method, *args, **kwargs): """Create a new representation with ``method`` applied to the arrays. In typical usage, the method is any of the shape-changing methods for `~numpy.ndarray` (``reshape``, ``swapaxes``, etc.), as well as those picking particular elements (``__ge...
[ "def", "_apply", "(", "self", ",", "method", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "callable", "(", "method", ")", ":", "apply_method", "=", "lambda", "array", ":", "method", "(", "array", ",", "*", "args", ",", "**", "kwargs", ")"...
Create a new representation with ``method`` applied to the arrays. In typical usage, the method is any of the shape-changing methods for `~numpy.ndarray` (``reshape``, ``swapaxes``, etc.), as well as those picking particular elements (``__getitem__``, ``take``, etc.), which are all defi...
[ "Create", "a", "new", "representation", "with", "method", "applied", "to", "the", "arrays", "." ]
ea95575a0df1581bb4b0986aebd6eea8438ab7eb
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/dynamics/representation_nd.py#L14-L43
train
adrn/gala
gala/dynamics/representation_nd.py
NDCartesianRepresentation.get_xyz
def get_xyz(self, xyz_axis=0): """Return a vector array of the x, y, and z coordinates. Parameters ---------- xyz_axis : int, optional The axis in the final array along which the x, y, z components should be stored (default: 0). Returns ------- ...
python
def get_xyz(self, xyz_axis=0): """Return a vector array of the x, y, and z coordinates. Parameters ---------- xyz_axis : int, optional The axis in the final array along which the x, y, z components should be stored (default: 0). Returns ------- ...
[ "def", "get_xyz", "(", "self", ",", "xyz_axis", "=", "0", ")", ":", "result_ndim", "=", "self", ".", "ndim", "+", "1", "if", "not", "-", "result_ndim", "<=", "xyz_axis", "<", "result_ndim", ":", "raise", "IndexError", "(", "'xyz_axis {0} out of bounds [-{1},...
Return a vector array of the x, y, and z coordinates. Parameters ---------- xyz_axis : int, optional The axis in the final array along which the x, y, z components should be stored (default: 0). Returns ------- xs : `~astropy.units.Quantity` ...
[ "Return", "a", "vector", "array", "of", "the", "x", "y", "and", "z", "coordinates", "." ]
ea95575a0df1581bb4b0986aebd6eea8438ab7eb
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/dynamics/representation_nd.py#L100-L132
train
adrn/gala
gala/potential/common.py
CommonBase._get_c_valid_arr
def _get_c_valid_arr(self, x): """ Warning! Interpretation of axes is different for C code. """ orig_shape = x.shape x = np.ascontiguousarray(x.reshape(orig_shape[0], -1).T) return orig_shape, x
python
def _get_c_valid_arr(self, x): """ Warning! Interpretation of axes is different for C code. """ orig_shape = x.shape x = np.ascontiguousarray(x.reshape(orig_shape[0], -1).T) return orig_shape, x
[ "def", "_get_c_valid_arr", "(", "self", ",", "x", ")", ":", "orig_shape", "=", "x", ".", "shape", "x", "=", "np", ".", "ascontiguousarray", "(", "x", ".", "reshape", "(", "orig_shape", "[", "0", "]", ",", "-", "1", ")", ".", "T", ")", "return", "...
Warning! Interpretation of axes is different for C code.
[ "Warning!", "Interpretation", "of", "axes", "is", "different", "for", "C", "code", "." ]
ea95575a0df1581bb4b0986aebd6eea8438ab7eb
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/potential/common.py#L60-L66
train
adrn/gala
gala/potential/common.py
CommonBase._validate_prepare_time
def _validate_prepare_time(self, t, pos_c): """ Make sure that t is a 1D array and compatible with the C position array. """ if hasattr(t, 'unit'): t = t.decompose(self.units).value if not isiterable(t): t = np.atleast_1d(t) t = np.ascontiguousar...
python
def _validate_prepare_time(self, t, pos_c): """ Make sure that t is a 1D array and compatible with the C position array. """ if hasattr(t, 'unit'): t = t.decompose(self.units).value if not isiterable(t): t = np.atleast_1d(t) t = np.ascontiguousar...
[ "def", "_validate_prepare_time", "(", "self", ",", "t", ",", "pos_c", ")", ":", "if", "hasattr", "(", "t", ",", "'unit'", ")", ":", "t", "=", "t", ".", "decompose", "(", "self", ".", "units", ")", ".", "value", "if", "not", "isiterable", "(", "t", ...
Make sure that t is a 1D array and compatible with the C position array.
[ "Make", "sure", "that", "t", "is", "a", "1D", "array", "and", "compatible", "with", "the", "C", "position", "array", "." ]
ea95575a0df1581bb4b0986aebd6eea8438ab7eb
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/potential/common.py#L68-L85
train
adrn/gala
gala/dynamics/core.py
PhaseSpacePosition.get_components
def get_components(self, which): """ Get the component name dictionary for the desired object. The returned dictionary maps component names on this class to component names on the desired object. Parameters ---------- which : str Can either be ``'pos...
python
def get_components(self, which): """ Get the component name dictionary for the desired object. The returned dictionary maps component names on this class to component names on the desired object. Parameters ---------- which : str Can either be ``'pos...
[ "def", "get_components", "(", "self", ",", "which", ")", ":", "mappings", "=", "self", ".", "representation_mappings", ".", "get", "(", "getattr", "(", "self", ",", "which", ")", ".", "__class__", ",", "[", "]", ")", "old_to_new", "=", "dict", "(", ")"...
Get the component name dictionary for the desired object. The returned dictionary maps component names on this class to component names on the desired object. Parameters ---------- which : str Can either be ``'pos'`` or ``'vel'`` to get the components for the ...
[ "Get", "the", "component", "name", "dictionary", "for", "the", "desired", "object", "." ]
ea95575a0df1581bb4b0986aebd6eea8438ab7eb
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/dynamics/core.py#L196-L226
train
adrn/gala
gala/dynamics/core.py
PhaseSpacePosition.to_frame
def to_frame(self, frame, current_frame=None, **kwargs): """ Transform to a new reference frame. Parameters ---------- frame : `~gala.potential.FrameBase` The frame to transform to. current_frame : `gala.potential.CFrameBase` The current frame the...
python
def to_frame(self, frame, current_frame=None, **kwargs): """ Transform to a new reference frame. Parameters ---------- frame : `~gala.potential.FrameBase` The frame to transform to. current_frame : `gala.potential.CFrameBase` The current frame the...
[ "def", "to_frame", "(", "self", ",", "frame", ",", "current_frame", "=", "None", ",", "**", "kwargs", ")", ":", "from", ".", ".", "potential", ".", "frame", ".", "builtin", "import", "transformations", "as", "frame_trans", "if", "(", "(", "inspect", ".",...
Transform to a new reference frame. Parameters ---------- frame : `~gala.potential.FrameBase` The frame to transform to. current_frame : `gala.potential.CFrameBase` The current frame the phase-space position is in. **kwargs Any additional argu...
[ "Transform", "to", "a", "new", "reference", "frame", "." ]
ea95575a0df1581bb4b0986aebd6eea8438ab7eb
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/dynamics/core.py#L348-L402
train
adrn/gala
gala/dynamics/core.py
PhaseSpacePosition.to_coord_frame
def to_coord_frame(self, frame, galactocentric_frame=None, **kwargs): """ Transform the orbit from Galactocentric, cartesian coordinates to Heliocentric coordinates in the specified Astropy coordinate frame. Parameters ---------- frame : :class:`~astropy.coordinates.Base...
python
def to_coord_frame(self, frame, galactocentric_frame=None, **kwargs): """ Transform the orbit from Galactocentric, cartesian coordinates to Heliocentric coordinates in the specified Astropy coordinate frame. Parameters ---------- frame : :class:`~astropy.coordinates.Base...
[ "def", "to_coord_frame", "(", "self", ",", "frame", ",", "galactocentric_frame", "=", "None", ",", "**", "kwargs", ")", ":", "if", "self", ".", "ndim", "!=", "3", ":", "raise", "ValueError", "(", "\"Can only change representation for \"", "\"ndim=3 instances.\"", ...
Transform the orbit from Galactocentric, cartesian coordinates to Heliocentric coordinates in the specified Astropy coordinate frame. Parameters ---------- frame : :class:`~astropy.coordinates.BaseCoordinateFrame` The class or frame instance specifying the desired output fra...
[ "Transform", "the", "orbit", "from", "Galactocentric", "cartesian", "coordinates", "to", "Heliocentric", "coordinates", "in", "the", "specified", "Astropy", "coordinate", "frame", "." ]
ea95575a0df1581bb4b0986aebd6eea8438ab7eb
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/dynamics/core.py#L404-L455
train
adrn/gala
gala/dynamics/core.py
PhaseSpacePosition._plot_prepare
def _plot_prepare(self, components, units): """ Prepare the ``PhaseSpacePosition`` or subclass for passing to a plotting routine to plot all projections of the object. """ # components to plot if components is None: components = self.pos.components n_...
python
def _plot_prepare(self, components, units): """ Prepare the ``PhaseSpacePosition`` or subclass for passing to a plotting routine to plot all projections of the object. """ # components to plot if components is None: components = self.pos.components n_...
[ "def", "_plot_prepare", "(", "self", ",", "components", ",", "units", ")", ":", "if", "components", "is", "None", ":", "components", "=", "self", ".", "pos", ".", "components", "n_comps", "=", "len", "(", "components", ")", "if", "units", "is", "not", ...
Prepare the ``PhaseSpacePosition`` or subclass for passing to a plotting routine to plot all projections of the object.
[ "Prepare", "the", "PhaseSpacePosition", "or", "subclass", "for", "passing", "to", "a", "plotting", "routine", "to", "plot", "all", "projections", "of", "the", "object", "." ]
ea95575a0df1581bb4b0986aebd6eea8438ab7eb
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/dynamics/core.py#L723-L776
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.get_account_info
def get_account_info(self): ''' Get current account information The information then will be saved in `self.account` so that you can access the information like this: >>> hsclient = HSClient() >>> acct = hsclient.get_account_info() >>> print acct.email_address ...
python
def get_account_info(self): ''' Get current account information The information then will be saved in `self.account` so that you can access the information like this: >>> hsclient = HSClient() >>> acct = hsclient.get_account_info() >>> print acct.email_address ...
[ "def", "get_account_info", "(", "self", ")", ":", "request", "=", "self", ".", "_get_request", "(", ")", "response", "=", "request", ".", "get", "(", "self", ".", "ACCOUNT_INFO_URL", ")", "self", ".", "account", ".", "json_data", "=", "response", "[", "\...
Get current account information The information then will be saved in `self.account` so that you can access the information like this: >>> hsclient = HSClient() >>> acct = hsclient.get_account_info() >>> print acct.email_address Returns: An Account object
[ "Get", "current", "account", "information" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L210-L227
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.update_account_info
def update_account_info(self): ''' Update current account information At the moment you can only update your callback_url. Returns: An Account object ''' request = self._get_request() return request.post(self.ACCOUNT_UPDATE_URL, { 'callback_url'...
python
def update_account_info(self): ''' Update current account information At the moment you can only update your callback_url. Returns: An Account object ''' request = self._get_request() return request.post(self.ACCOUNT_UPDATE_URL, { 'callback_url'...
[ "def", "update_account_info", "(", "self", ")", ":", "request", "=", "self", ".", "_get_request", "(", ")", "return", "request", ".", "post", "(", "self", ".", "ACCOUNT_UPDATE_URL", ",", "{", "'callback_url'", ":", "self", ".", "account", ".", "callback_url"...
Update current account information At the moment you can only update your callback_url. Returns: An Account object
[ "Update", "current", "account", "information" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L231-L243
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.verify_account
def verify_account(self, email_address): ''' Verify whether a HelloSign Account exists Args: email_address (str): Email address for the account to verify Returns: True or False ''' request = self._get_request() resp = request.pos...
python
def verify_account(self, email_address): ''' Verify whether a HelloSign Account exists Args: email_address (str): Email address for the account to verify Returns: True or False ''' request = self._get_request() resp = request.pos...
[ "def", "verify_account", "(", "self", ",", "email_address", ")", ":", "request", "=", "self", ".", "_get_request", "(", ")", "resp", "=", "request", ".", "post", "(", "self", ".", "ACCOUNT_VERIFY_URL", ",", "{", "'email_address'", ":", "email_address", "}", ...
Verify whether a HelloSign Account exists Args: email_address (str): Email address for the account to verify Returns: True or False
[ "Verify", "whether", "a", "HelloSign", "Account", "exists" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L245-L259
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.get_signature_request
def get_signature_request(self, signature_request_id, ux_version=None): ''' Get a signature request by its ID Args: signature_request_id (str): The id of the SignatureRequest to retrieve ux_version (int): UX version, either 1 (default) or 2. Returns:...
python
def get_signature_request(self, signature_request_id, ux_version=None): ''' Get a signature request by its ID Args: signature_request_id (str): The id of the SignatureRequest to retrieve ux_version (int): UX version, either 1 (default) or 2. Returns:...
[ "def", "get_signature_request", "(", "self", ",", "signature_request_id", ",", "ux_version", "=", "None", ")", ":", "request", "=", "self", ".", "_get_request", "(", ")", "parameters", "=", "None", "if", "ux_version", "is", "not", "None", ":", "parameters", ...
Get a signature request by its ID Args: signature_request_id (str): The id of the SignatureRequest to retrieve ux_version (int): UX version, either 1 (default) or 2. Returns: A SignatureRequest object
[ "Get", "a", "signature", "request", "by", "its", "ID" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L264-L286
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.get_signature_request_list
def get_signature_request_list(self, page=1, ux_version=None): ''' Get a list of SignatureRequest that you can access This includes SignatureRequests you have sent as well as received, but not ones that you have been CCed on. Args: page (int, optional): Which page number...
python
def get_signature_request_list(self, page=1, ux_version=None): ''' Get a list of SignatureRequest that you can access This includes SignatureRequests you have sent as well as received, but not ones that you have been CCed on. Args: page (int, optional): Which page number...
[ "def", "get_signature_request_list", "(", "self", ",", "page", "=", "1", ",", "ux_version", "=", "None", ")", ":", "request", "=", "self", ".", "_get_request", "(", ")", "parameters", "=", "{", "\"page\"", ":", "page", "}", "if", "ux_version", "is", "not...
Get a list of SignatureRequest that you can access This includes SignatureRequests you have sent as well as received, but not ones that you have been CCed on. Args: page (int, optional): Which page number of the SignatureRequest list to return. Defaults to 1. ux_ver...
[ "Get", "a", "list", "of", "SignatureRequest", "that", "you", "can", "access" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L289-L314
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.get_signature_request_file
def get_signature_request_file(self, signature_request_id, path_or_file=None, file_type=None, filename=None): ''' Download the PDF copy of the current documents Args: signature_request_id (str): Id of the signature request path_or_file (str or file): A writable File-like objec...
python
def get_signature_request_file(self, signature_request_id, path_or_file=None, file_type=None, filename=None): ''' Download the PDF copy of the current documents Args: signature_request_id (str): Id of the signature request path_or_file (str or file): A writable File-like objec...
[ "def", "get_signature_request_file", "(", "self", ",", "signature_request_id", ",", "path_or_file", "=", "None", ",", "file_type", "=", "None", ",", "filename", "=", "None", ")", ":", "request", "=", "self", ".", "_get_request", "(", ")", "url", "=", "self",...
Download the PDF copy of the current documents Args: signature_request_id (str): Id of the signature request path_or_file (str or file): A writable File-like object or a full path to save the PDF file to. filename (str): [DEPRECATED] Filename to save the PDF f...
[ "Download", "the", "PDF", "copy", "of", "the", "current", "documents" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L316-L337
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.send_signature_request
def send_signature_request(self, test_mode=False, files=None, file_urls=None, title=None, subject=None, message=None, signing_redirect_url=None, signers=None, cc_email_addresses=None, form_fields_per_document=None, use_text_tags=False, hide_text_tags=False, metadata=None, ux_version=None, allow_decline=False): ...
python
def send_signature_request(self, test_mode=False, files=None, file_urls=None, title=None, subject=None, message=None, signing_redirect_url=None, signers=None, cc_email_addresses=None, form_fields_per_document=None, use_text_tags=False, hide_text_tags=False, metadata=None, ux_version=None, allow_decline=False): ...
[ "def", "send_signature_request", "(", "self", ",", "test_mode", "=", "False", ",", "files", "=", "None", ",", "file_urls", "=", "None", ",", "title", "=", "None", ",", "subject", "=", "None", ",", "message", "=", "None", ",", "signing_redirect_url", "=", ...
Creates and sends a new SignatureRequest with the submitted documents Creates and sends a new SignatureRequest with the submitted documents. If form_fields_per_document is not specified, a signature page will be affixed where all signers will be required to add their signature, signifyi...
[ "Creates", "and", "sends", "a", "new", "SignatureRequest", "with", "the", "submitted", "documents" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L339-L417
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.send_signature_request_with_template
def send_signature_request_with_template(self, test_mode=False, template_id=None, template_ids=None, title=None, subject=None, message=None, signing_redirect_url=None, signers=None, ccs=None, custom_fields=None, metadata=None, ux_version=None, allow_decline=False): ''' Creates and sends a new SignatureRequest b...
python
def send_signature_request_with_template(self, test_mode=False, template_id=None, template_ids=None, title=None, subject=None, message=None, signing_redirect_url=None, signers=None, ccs=None, custom_fields=None, metadata=None, ux_version=None, allow_decline=False): ''' Creates and sends a new SignatureRequest b...
[ "def", "send_signature_request_with_template", "(", "self", ",", "test_mode", "=", "False", ",", "template_id", "=", "None", ",", "template_ids", "=", "None", ",", "title", "=", "None", ",", "subject", "=", "None", ",", "message", "=", "None", ",", "signing_...
Creates and sends a new SignatureRequest based off of a Template Creates and sends a new SignatureRequest based off of the Template specified with the template_id parameter. Args: test_mode (bool, optional): Whether this is a test, the signature request will not be leg...
[ "Creates", "and", "sends", "a", "new", "SignatureRequest", "based", "off", "of", "a", "Template" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L419-L492
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.remind_signature_request
def remind_signature_request(self, signature_request_id, email_address): ''' Sends an email to the signer reminding them to sign the signature request Sends an email to the signer reminding them to sign the signature request. You cannot send a reminder within 1 hours of the last reminder ...
python
def remind_signature_request(self, signature_request_id, email_address): ''' Sends an email to the signer reminding them to sign the signature request Sends an email to the signer reminding them to sign the signature request. You cannot send a reminder within 1 hours of the last reminder ...
[ "def", "remind_signature_request", "(", "self", ",", "signature_request_id", ",", "email_address", ")", ":", "request", "=", "self", ".", "_get_request", "(", ")", "return", "request", ".", "post", "(", "self", ".", "SIGNATURE_REQUEST_REMIND_URL", "+", "signature_...
Sends an email to the signer reminding them to sign the signature request Sends an email to the signer reminding them to sign the signature request. You cannot send a reminder within 1 hours of the last reminder that was sent. This includes manual AND automatic reminders. Args: ...
[ "Sends", "an", "email", "to", "the", "signer", "reminding", "them", "to", "sign", "the", "signature", "request" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L495-L515
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.cancel_signature_request
def cancel_signature_request(self, signature_request_id): ''' Cancels a SignatureRequest Cancels a SignatureRequest. After canceling, no one will be able to sign or access the SignatureRequest or its documents. Only the requester can cancel and only before everyone has signed. ...
python
def cancel_signature_request(self, signature_request_id): ''' Cancels a SignatureRequest Cancels a SignatureRequest. After canceling, no one will be able to sign or access the SignatureRequest or its documents. Only the requester can cancel and only before everyone has signed. ...
[ "def", "cancel_signature_request", "(", "self", ",", "signature_request_id", ")", ":", "request", "=", "self", ".", "_get_request", "(", ")", "request", ".", "post", "(", "url", "=", "self", ".", "SIGNATURE_REQUEST_CANCEL_URL", "+", "signature_request_id", ",", ...
Cancels a SignatureRequest Cancels a SignatureRequest. After canceling, no one will be able to sign or access the SignatureRequest or its documents. Only the requester can cancel and only before everyone has signed. Args: signing_request_id (str): The id of the signature r...
[ "Cancels", "a", "SignatureRequest" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L517-L533
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.get_template
def get_template(self, template_id): ''' Gets a Template which includes a list of Accounts that can access it Args: template_id (str): The id of the template to retrieve Returns: A Template object ''' request = self._get_request() return reques...
python
def get_template(self, template_id): ''' Gets a Template which includes a list of Accounts that can access it Args: template_id (str): The id of the template to retrieve Returns: A Template object ''' request = self._get_request() return reques...
[ "def", "get_template", "(", "self", ",", "template_id", ")", ":", "request", "=", "self", ".", "_get_request", "(", ")", "return", "request", ".", "get", "(", "self", ".", "TEMPLATE_GET_URL", "+", "template_id", ")" ]
Gets a Template which includes a list of Accounts that can access it Args: template_id (str): The id of the template to retrieve Returns: A Template object
[ "Gets", "a", "Template", "which", "includes", "a", "list", "of", "Accounts", "that", "can", "access", "it" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L705-L717
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.get_template_list
def get_template_list(self, page=1, page_size=None, account_id=None, query=None): ''' Lists your Templates Args: page (int, optional): Page number of the template List to return. Defaults to 1. page_size (int, optional): Number of objects to be returned per page,...
python
def get_template_list(self, page=1, page_size=None, account_id=None, query=None): ''' Lists your Templates Args: page (int, optional): Page number of the template List to return. Defaults to 1. page_size (int, optional): Number of objects to be returned per page,...
[ "def", "get_template_list", "(", "self", ",", "page", "=", "1", ",", "page_size", "=", "None", ",", "account_id", "=", "None", ",", "query", "=", "None", ")", ":", "request", "=", "self", ".", "_get_request", "(", ")", "parameters", "=", "{", "'page'",...
Lists your Templates Args: page (int, optional): Page number of the template List to return. Defaults to 1. page_size (int, optional): Number of objects to be returned per page, must be between 1 and 100, default is 20. account_id (str, optional): Which a...
[ "Lists", "your", "Templates" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L720-L741
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.add_user_to_template
def add_user_to_template(self, template_id, account_id=None, email_address=None): ''' Gives the specified Account access to the specified Template Args: template_id (str): The id of the template to give the account access to account_id (str): The id of the account t...
python
def add_user_to_template(self, template_id, account_id=None, email_address=None): ''' Gives the specified Account access to the specified Template Args: template_id (str): The id of the template to give the account access to account_id (str): The id of the account t...
[ "def", "add_user_to_template", "(", "self", ",", "template_id", ",", "account_id", "=", "None", ",", "email_address", "=", "None", ")", ":", "return", "self", ".", "_add_remove_user_template", "(", "self", ".", "TEMPLATE_ADD_USER_URL", ",", "template_id", ",", "...
Gives the specified Account access to the specified Template Args: template_id (str): The id of the template to give the account access to account_id (str): The id of the account to give access to the template. The account id prevails if both account_id and email_address ar...
[ "Gives", "the", "specified", "Account", "access", "to", "the", "specified", "Template" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L744-L759
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.remove_user_from_template
def remove_user_from_template(self, template_id, account_id=None, email_address=None): ''' Removes the specified Account's access to the specified Template Args: template_id (str): The id of the template to remove the account's access from. account_id (str): The id ...
python
def remove_user_from_template(self, template_id, account_id=None, email_address=None): ''' Removes the specified Account's access to the specified Template Args: template_id (str): The id of the template to remove the account's access from. account_id (str): The id ...
[ "def", "remove_user_from_template", "(", "self", ",", "template_id", ",", "account_id", "=", "None", ",", "email_address", "=", "None", ")", ":", "return", "self", ".", "_add_remove_user_template", "(", "self", ".", "TEMPLATE_REMOVE_USER_URL", ",", "template_id", ...
Removes the specified Account's access to the specified Template Args: template_id (str): The id of the template to remove the account's access from. account_id (str): The id of the account to remove access from the template. The account id prevails if both account_id and e...
[ "Removes", "the", "specified", "Account", "s", "access", "to", "the", "specified", "Template" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L761-L776
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.delete_template
def delete_template(self, template_id): ''' Deletes the specified template Args: template_id (str): The id of the template to delete Returns: A status code ''' url = self.TEMPLATE_DELETE_URL request = self._get_request() response = re...
python
def delete_template(self, template_id): ''' Deletes the specified template Args: template_id (str): The id of the template to delete Returns: A status code ''' url = self.TEMPLATE_DELETE_URL request = self._get_request() response = re...
[ "def", "delete_template", "(", "self", ",", "template_id", ")", ":", "url", "=", "self", ".", "TEMPLATE_DELETE_URL", "request", "=", "self", ".", "_get_request", "(", ")", "response", "=", "request", ".", "post", "(", "url", "+", "template_id", ",", "get_j...
Deletes the specified template Args: template_id (str): The id of the template to delete Returns: A status code
[ "Deletes", "the", "specified", "template" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L778-L795
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.get_template_files
def get_template_files(self, template_id, filename): ''' Download a PDF copy of a template's original files Args: template_id (str): The id of the template to retrieve. filename (str): Filename to save the PDF file to. This should be a full path. Returns: ...
python
def get_template_files(self, template_id, filename): ''' Download a PDF copy of a template's original files Args: template_id (str): The id of the template to retrieve. filename (str): Filename to save the PDF file to. This should be a full path. Returns: ...
[ "def", "get_template_files", "(", "self", ",", "template_id", ",", "filename", ")", ":", "url", "=", "self", ".", "TEMPLATE_GET_FILES_URL", "+", "template_id", "request", "=", "self", ".", "_get_request", "(", ")", "return", "request", ".", "get_file", "(", ...
Download a PDF copy of a template's original files Args: template_id (str): The id of the template to retrieve. filename (str): Filename to save the PDF file to. This should be a full path. Returns: Returns a PDF file
[ "Download", "a", "PDF", "copy", "of", "a", "template", "s", "original", "files" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L798-L815
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.create_embedded_template_draft
def create_embedded_template_draft(self, client_id, signer_roles, test_mode=False, files=None, file_urls=None, title=None, subject=None, message=None, cc_roles=None, merge_fields=None, use_preexisting_fields=False): ''' Creates an embedded Template draft for further editing. Args: test_mod...
python
def create_embedded_template_draft(self, client_id, signer_roles, test_mode=False, files=None, file_urls=None, title=None, subject=None, message=None, cc_roles=None, merge_fields=None, use_preexisting_fields=False): ''' Creates an embedded Template draft for further editing. Args: test_mod...
[ "def", "create_embedded_template_draft", "(", "self", ",", "client_id", ",", "signer_roles", ",", "test_mode", "=", "False", ",", "files", "=", "None", ",", "file_urls", "=", "None", ",", "title", "=", "None", ",", "subject", "=", "None", ",", "message", "...
Creates an embedded Template draft for further editing. Args: test_mode (bool, optional): Whether this is a test, the signature request created from this draft will not be legally binding if set to 1. Defaults to 0. client_id (str): Client id of the app you'...
[ "Creates", "an", "embedded", "Template", "draft", "for", "further", "editing", "." ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L817-L868
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.create_team
def create_team(self, name): ''' Creates a new Team Creates a new Team and makes you a member. You must not currently belong to a team to invoke. Args: name (str): The name of your team Returns: A Team object ''' request = self._get_request() ...
python
def create_team(self, name): ''' Creates a new Team Creates a new Team and makes you a member. You must not currently belong to a team to invoke. Args: name (str): The name of your team Returns: A Team object ''' request = self._get_request() ...
[ "def", "create_team", "(", "self", ",", "name", ")", ":", "request", "=", "self", ".", "_get_request", "(", ")", "return", "request", ".", "post", "(", "self", ".", "TEAM_CREATE_URL", ",", "{", "\"name\"", ":", "name", "}", ")" ]
Creates a new Team Creates a new Team and makes you a member. You must not currently belong to a team to invoke. Args: name (str): The name of your team Returns: A Team object
[ "Creates", "a", "new", "Team" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L888-L902
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.update_team_name
def update_team_name(self, name): ''' Updates a Team's name Args: name (str): The new name of your team Returns: A Team object ''' request = self._get_request() return request.post(self.TEAM_UPDATE_URL, {"name": name})
python
def update_team_name(self, name): ''' Updates a Team's name Args: name (str): The new name of your team Returns: A Team object ''' request = self._get_request() return request.post(self.TEAM_UPDATE_URL, {"name": name})
[ "def", "update_team_name", "(", "self", ",", "name", ")", ":", "request", "=", "self", ".", "_get_request", "(", ")", "return", "request", ".", "post", "(", "self", ".", "TEAM_UPDATE_URL", ",", "{", "\"name\"", ":", "name", "}", ")" ]
Updates a Team's name Args: name (str): The new name of your team Returns: A Team object
[ "Updates", "a", "Team", "s", "name" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L906-L918
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.destroy_team
def destroy_team(self): ''' Delete your Team Deletes your Team. Can only be invoked when you have a team with only one member left (yourself). Returns: None ''' request = self._get_request() request.post(url=self.TEAM_DESTROY_URL, get_json=False)
python
def destroy_team(self): ''' Delete your Team Deletes your Team. Can only be invoked when you have a team with only one member left (yourself). Returns: None ''' request = self._get_request() request.post(url=self.TEAM_DESTROY_URL, get_json=False)
[ "def", "destroy_team", "(", "self", ")", ":", "request", "=", "self", ".", "_get_request", "(", ")", "request", ".", "post", "(", "url", "=", "self", ".", "TEAM_DESTROY_URL", ",", "get_json", "=", "False", ")" ]
Delete your Team Deletes your Team. Can only be invoked when you have a team with only one member left (yourself). Returns: None
[ "Delete", "your", "Team" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L920-L930
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.add_team_member
def add_team_member(self, account_id=None, email_address=None): ''' Add or invite a user to your Team Args: account_id (str): The id of the account of the user to invite to your team. email_address (str): The email address of the account to invite to your team. The ac...
python
def add_team_member(self, account_id=None, email_address=None): ''' Add or invite a user to your Team Args: account_id (str): The id of the account of the user to invite to your team. email_address (str): The email address of the account to invite to your team. The ac...
[ "def", "add_team_member", "(", "self", ",", "account_id", "=", "None", ",", "email_address", "=", "None", ")", ":", "return", "self", ".", "_add_remove_team_member", "(", "self", ".", "TEAM_ADD_MEMBER_URL", ",", "email_address", ",", "account_id", ")" ]
Add or invite a user to your Team Args: account_id (str): The id of the account of the user to invite to your team. email_address (str): The email address of the account to invite to your team. The account id prevails if both account_id and email_address are provided. ...
[ "Add", "or", "invite", "a", "user", "to", "your", "Team" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L932-L945
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.remove_team_member
def remove_team_member(self, account_id=None, email_address=None): ''' Remove a user from your Team Args: account_id (str): The id of the account of the user to remove from your team. email_address (str): The email address of the account to remove from your team. The ...
python
def remove_team_member(self, account_id=None, email_address=None): ''' Remove a user from your Team Args: account_id (str): The id of the account of the user to remove from your team. email_address (str): The email address of the account to remove from your team. The ...
[ "def", "remove_team_member", "(", "self", ",", "account_id", "=", "None", ",", "email_address", "=", "None", ")", ":", "return", "self", ".", "_add_remove_team_member", "(", "self", ".", "TEAM_REMOVE_MEMBER_URL", ",", "email_address", ",", "account_id", ")" ]
Remove a user from your Team Args: account_id (str): The id of the account of the user to remove from your team. email_address (str): The email address of the account to remove from your team. The account id prevails if both account_id and email_address are provided. ...
[ "Remove", "a", "user", "from", "your", "Team" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L948-L961
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.get_embedded_object
def get_embedded_object(self, signature_id): ''' Retrieves a embedded signing object Retrieves an embedded object containing a signature url that can be opened in an iFrame. Args: signature_id (str): The id of the signature to get a signature url for Returns: ...
python
def get_embedded_object(self, signature_id): ''' Retrieves a embedded signing object Retrieves an embedded object containing a signature url that can be opened in an iFrame. Args: signature_id (str): The id of the signature to get a signature url for Returns: ...
[ "def", "get_embedded_object", "(", "self", ",", "signature_id", ")", ":", "request", "=", "self", ".", "_get_request", "(", ")", "return", "request", ".", "get", "(", "self", ".", "EMBEDDED_OBJECT_GET_URL", "+", "signature_id", ")" ]
Retrieves a embedded signing object Retrieves an embedded object containing a signature url that can be opened in an iFrame. Args: signature_id (str): The id of the signature to get a signature url for Returns: An Embedded object
[ "Retrieves", "a", "embedded", "signing", "object" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L966-L980
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.get_template_edit_url
def get_template_edit_url(self, template_id): ''' Retrieves a embedded template for editing Retrieves an embedded object containing a template url that can be opened in an iFrame. Args: template_id (str): The id of the template to get a signature url for Returns: ...
python
def get_template_edit_url(self, template_id): ''' Retrieves a embedded template for editing Retrieves an embedded object containing a template url that can be opened in an iFrame. Args: template_id (str): The id of the template to get a signature url for Returns: ...
[ "def", "get_template_edit_url", "(", "self", ",", "template_id", ")", ":", "request", "=", "self", ".", "_get_request", "(", ")", "return", "request", ".", "get", "(", "self", ".", "EMBEDDED_TEMPLATE_EDIT_URL", "+", "template_id", ")" ]
Retrieves a embedded template for editing Retrieves an embedded object containing a template url that can be opened in an iFrame. Args: template_id (str): The id of the template to get a signature url for Returns: An Embedded object
[ "Retrieves", "a", "embedded", "template", "for", "editing" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L983-L997
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.get_oauth_data
def get_oauth_data(self, code, client_id, client_secret, state): ''' Get Oauth data from HelloSign Args: code (str): Code returned by HelloSign for our callback url client_id (str): Client id of the associated app client_secret (str): Secret ...
python
def get_oauth_data(self, code, client_id, client_secret, state): ''' Get Oauth data from HelloSign Args: code (str): Code returned by HelloSign for our callback url client_id (str): Client id of the associated app client_secret (str): Secret ...
[ "def", "get_oauth_data", "(", "self", ",", "code", ",", "client_id", ",", "client_secret", ",", "state", ")", ":", "request", "=", "self", ".", "_get_request", "(", ")", "response", "=", "request", ".", "post", "(", "self", ".", "OAUTH_TOKEN_URL", ",", "...
Get Oauth data from HelloSign Args: code (str): Code returned by HelloSign for our callback url client_id (str): Client id of the associated app client_secret (str): Secret token of the associated app Returns: A HSAccessTokenAuth...
[ "Get", "Oauth", "data", "from", "HelloSign" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L1230-L1253
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.refresh_access_token
def refresh_access_token(self, refresh_token): ''' Refreshes the current access token. Gets a new access token, updates client auth and returns it. Args: refresh_token (str): Refresh token to use Returns: The new access token ''' request = ...
python
def refresh_access_token(self, refresh_token): ''' Refreshes the current access token. Gets a new access token, updates client auth and returns it. Args: refresh_token (str): Refresh token to use Returns: The new access token ''' request = ...
[ "def", "refresh_access_token", "(", "self", ",", "refresh_token", ")", ":", "request", "=", "self", ".", "_get_request", "(", ")", "response", "=", "request", ".", "post", "(", "self", ".", "OAUTH_TOKEN_URL", ",", "{", "\"grant_type\"", ":", "\"refresh_token\"...
Refreshes the current access token. Gets a new access token, updates client auth and returns it. Args: refresh_token (str): Refresh token to use Returns: The new access token
[ "Refreshes", "the", "current", "access", "token", "." ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L1255-L1273
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient._get_request
def _get_request(self, auth=None): ''' Return an http request object auth: Auth data to use Returns: A HSRequest object ''' self.request = HSRequest(auth or self.auth, self.env) self.request.response_callback = self.response_callback retu...
python
def _get_request(self, auth=None): ''' Return an http request object auth: Auth data to use Returns: A HSRequest object ''' self.request = HSRequest(auth or self.auth, self.env) self.request.response_callback = self.response_callback retu...
[ "def", "_get_request", "(", "self", ",", "auth", "=", "None", ")", ":", "self", ".", "request", "=", "HSRequest", "(", "auth", "or", "self", ".", "auth", ",", "self", ".", "env", ")", "self", ".", "request", ".", "response_callback", "=", "self", "."...
Return an http request object auth: Auth data to use Returns: A HSRequest object
[ "Return", "an", "http", "request", "object" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L1286-L1296
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient._authenticate
def _authenticate(self, email_address=None, password=None, api_key=None, access_token=None, access_token_type=None): ''' Create authentication object to send requests Args: email_address (str): Email address of the account to make the requests password (str): ...
python
def _authenticate(self, email_address=None, password=None, api_key=None, access_token=None, access_token_type=None): ''' Create authentication object to send requests Args: email_address (str): Email address of the account to make the requests password (str): ...
[ "def", "_authenticate", "(", "self", ",", "email_address", "=", "None", ",", "password", "=", "None", ",", "api_key", "=", "None", ",", "access_token", "=", "None", ",", "access_token_type", "=", "None", ")", ":", "if", "access_token_type", "and", "access_to...
Create authentication object to send requests Args: email_address (str): Email address of the account to make the requests password (str): Password of the account used with email address api_key (str): API Key. You can find your API key in ...
[ "Create", "authentication", "object", "to", "send", "requests" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L1298-L1328
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient._check_required_fields
def _check_required_fields(self, fields=None, either_fields=None): ''' Check the values of the fields If no value found in `fields`, an exception will be raised. `either_fields` are the fields that one of them must have a value Raises: HSException: If no value found in at l...
python
def _check_required_fields(self, fields=None, either_fields=None): ''' Check the values of the fields If no value found in `fields`, an exception will be raised. `either_fields` are the fields that one of them must have a value Raises: HSException: If no value found in at l...
[ "def", "_check_required_fields", "(", "self", ",", "fields", "=", "None", ",", "either_fields", "=", "None", ")", ":", "for", "(", "key", ",", "value", ")", "in", "fields", ".", "items", "(", ")", ":", "if", "not", "value", ":", "raise", "HSException",...
Check the values of the fields If no value found in `fields`, an exception will be raised. `either_fields` are the fields that one of them must have a value Raises: HSException: If no value found in at least one item of`fields`, or no value found in one of the items...
[ "Check", "the", "values", "of", "the", "fields" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L1330-L1353
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient._send_signature_request
def _send_signature_request(self, test_mode=False, client_id=None, files=None, file_urls=None, title=None, subject=None, message=None, signing_redirect_url=None, signers=None, cc_email_addresses=None, form_fields_per_document=None, use_text_tags=False, hide_text_tags=False, metadata=None, ux_version=None, allow_decline...
python
def _send_signature_request(self, test_mode=False, client_id=None, files=None, file_urls=None, title=None, subject=None, message=None, signing_redirect_url=None, signers=None, cc_email_addresses=None, form_fields_per_document=None, use_text_tags=False, hide_text_tags=False, metadata=None, ux_version=None, allow_decline...
[ "def", "_send_signature_request", "(", "self", ",", "test_mode", "=", "False", ",", "client_id", "=", "None", ",", "files", "=", "None", ",", "file_urls", "=", "None", ",", "title", "=", "None", ",", "subject", "=", "None", ",", "message", "=", "None", ...
To share the same logic between send_signature_request & send_signature_request_embedded functions Args: test_mode (bool, optional): Whether this is a test, the signature request will not be legally binding if set to True. Defaults to False. client_id (str): ...
[ "To", "share", "the", "same", "logic", "between", "send_signature_request", "&", "send_signature_request_embedded", "functions" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L1356-L1451
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient._send_signature_request_with_template
def _send_signature_request_with_template(self, test_mode=False, client_id=None, template_id=None, template_ids=None, title=None, subject=None, message=None, signing_redirect_url=None, signers=None, ccs=None, custom_fields=None, metadata=None, ux_version=None, allow_decline=False): ''' To share the same logic b...
python
def _send_signature_request_with_template(self, test_mode=False, client_id=None, template_id=None, template_ids=None, title=None, subject=None, message=None, signing_redirect_url=None, signers=None, ccs=None, custom_fields=None, metadata=None, ux_version=None, allow_decline=False): ''' To share the same logic b...
[ "def", "_send_signature_request_with_template", "(", "self", ",", "test_mode", "=", "False", ",", "client_id", "=", "None", ",", "template_id", "=", "None", ",", "template_ids", "=", "None", ",", "title", "=", "None", ",", "subject", "=", "None", ",", "messa...
To share the same logic between send_signature_request_with_template and send_signature_request_embedded_with_template Args: test_mode (bool, optional): Whether this is a test, the signature request will not be legally binding if set to True. Defaults to False. ...
[ "To", "share", "the", "same", "logic", "between", "send_signature_request_with_template", "and", "send_signature_request_embedded_with_template" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L1454-L1550
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient._add_remove_user_template
def _add_remove_user_template(self, url, template_id, account_id=None, email_address=None): ''' Add or Remove user from a Template We use this function for two tasks because they have the same API call Args: template_id (str): The id of the template account_id (s...
python
def _add_remove_user_template(self, url, template_id, account_id=None, email_address=None): ''' Add or Remove user from a Template We use this function for two tasks because they have the same API call Args: template_id (str): The id of the template account_id (s...
[ "def", "_add_remove_user_template", "(", "self", ",", "url", ",", "template_id", ",", "account_id", "=", "None", ",", "email_address", "=", "None", ")", ":", "if", "not", "email_address", "and", "not", "account_id", ":", "raise", "HSException", "(", "\"No emai...
Add or Remove user from a Template We use this function for two tasks because they have the same API call Args: template_id (str): The id of the template account_id (str): ID of the account to add/remove access to/from email_address (str): The email...
[ "Add", "or", "Remove", "user", "from", "a", "Template" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L1659-L1696
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient._add_remove_team_member
def _add_remove_team_member(self, url, email_address=None, account_id=None): ''' Add or Remove a team member We use this function for two different tasks because they have the same API call Args: email_address (str): Email address of the Account to add/remove ...
python
def _add_remove_team_member(self, url, email_address=None, account_id=None): ''' Add or Remove a team member We use this function for two different tasks because they have the same API call Args: email_address (str): Email address of the Account to add/remove ...
[ "def", "_add_remove_team_member", "(", "self", ",", "url", ",", "email_address", "=", "None", ",", "account_id", "=", "None", ")", ":", "if", "not", "email_address", "and", "not", "account_id", ":", "raise", "HSException", "(", "\"No email address or account_id sp...
Add or Remove a team member We use this function for two different tasks because they have the same API call Args: email_address (str): Email address of the Account to add/remove account_id (str): ID of the Account to add/remove Returns: ...
[ "Add", "or", "Remove", "a", "team", "member" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L1699-L1732
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient._create_embedded_template_draft
def _create_embedded_template_draft(self, client_id, signer_roles, test_mode=False, files=None, file_urls=None, title=None, subject=None, message=None, cc_roles=None, merge_fields=None, use_preexisting_fields=False): ''' Helper method for creating embedded template drafts. See public function for pa...
python
def _create_embedded_template_draft(self, client_id, signer_roles, test_mode=False, files=None, file_urls=None, title=None, subject=None, message=None, cc_roles=None, merge_fields=None, use_preexisting_fields=False): ''' Helper method for creating embedded template drafts. See public function for pa...
[ "def", "_create_embedded_template_draft", "(", "self", ",", "client_id", ",", "signer_roles", ",", "test_mode", "=", "False", ",", "files", "=", "None", ",", "file_urls", "=", "None", ",", "title", "=", "None", ",", "subject", "=", "None", ",", "message", ...
Helper method for creating embedded template drafts. See public function for params.
[ "Helper", "method", "for", "creating", "embedded", "template", "drafts", ".", "See", "public", "function", "for", "params", "." ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L1735-L1778
train
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient._create_embedded_unclaimed_draft_with_template
def _create_embedded_unclaimed_draft_with_template(self, test_mode=False, client_id=None, is_for_embedded_signing=False, template_id=None, template_ids=None, requester_email_address=None, title=None, subject=None, message=None, signers=None, ccs=None, signing_redirect_url=None, requesting_redirect_url=None, metadata=No...
python
def _create_embedded_unclaimed_draft_with_template(self, test_mode=False, client_id=None, is_for_embedded_signing=False, template_id=None, template_ids=None, requester_email_address=None, title=None, subject=None, message=None, signers=None, ccs=None, signing_redirect_url=None, requesting_redirect_url=None, metadata=No...
[ "def", "_create_embedded_unclaimed_draft_with_template", "(", "self", ",", "test_mode", "=", "False", ",", "client_id", "=", "None", ",", "is_for_embedded_signing", "=", "False", ",", "template_id", "=", "None", ",", "template_ids", "=", "None", ",", "requester_emai...
Helper method for creating unclaimed drafts from templates See public function for params.
[ "Helper", "method", "for", "creating", "unclaimed", "drafts", "from", "templates", "See", "public", "function", "for", "params", "." ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L1781-L1823
train
hellosign/hellosign-python-sdk
hellosign_sdk/utils/request.py
HSRequest.get_file
def get_file(self, url, path_or_file=None, headers=None, filename=None): ''' Get a file from a url and save it as `filename` Args: url (str): URL to send the request to path_or_file (str or file): A writable File-like object or a path to save the file to. filename ...
python
def get_file(self, url, path_or_file=None, headers=None, filename=None): ''' Get a file from a url and save it as `filename` Args: url (str): URL to send the request to path_or_file (str or file): A writable File-like object or a path to save the file to. filename ...
[ "def", "get_file", "(", "self", ",", "url", ",", "path_or_file", "=", "None", ",", "headers", "=", "None", ",", "filename", "=", "None", ")", ":", "path_or_file", "=", "path_or_file", "or", "filename", "if", "self", ".", "debug", ":", "print", "(", "\"...
Get a file from a url and save it as `filename` Args: url (str): URL to send the request to path_or_file (str or file): A writable File-like object or a path to save the file to. filename (str): [DEPRECATED] File name to save the file as, this can be either ...
[ "Get", "a", "file", "from", "a", "url", "and", "save", "it", "as", "filename" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/utils/request.py#L69-L111
train
hellosign/hellosign-python-sdk
hellosign_sdk/utils/request.py
HSRequest.get
def get(self, url, headers=None, parameters=None, get_json=True): ''' Send a GET request with custome headers and parameters Args: url (str): URL to send the request to headers (str, optional): custom headers parameters (str, optional): optional parameters R...
python
def get(self, url, headers=None, parameters=None, get_json=True): ''' Send a GET request with custome headers and parameters Args: url (str): URL to send the request to headers (str, optional): custom headers parameters (str, optional): optional parameters R...
[ "def", "get", "(", "self", ",", "url", ",", "headers", "=", "None", ",", "parameters", "=", "None", ",", "get_json", "=", "True", ")", ":", "if", "self", ".", "debug", ":", "print", "(", "\"GET: %s, headers=%s\"", "%", "(", "url", ",", "headers", ")"...
Send a GET request with custome headers and parameters Args: url (str): URL to send the request to headers (str, optional): custom headers parameters (str, optional): optional parameters Returns: A JSON object of the returned response if `get_json` is Tr...
[ "Send", "a", "GET", "request", "with", "custome", "headers", "and", "parameters" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/utils/request.py#L113-L143
train
hellosign/hellosign-python-sdk
hellosign_sdk/utils/request.py
HSRequest.post
def post(self, url, data=None, files=None, headers=None, get_json=True): ''' Make POST request to a url Args: url (str): URL to send the request to data (dict, optional): Data to send files (dict, optional): Files to send with the request headers (str, op...
python
def post(self, url, data=None, files=None, headers=None, get_json=True): ''' Make POST request to a url Args: url (str): URL to send the request to data (dict, optional): Data to send files (dict, optional): Files to send with the request headers (str, op...
[ "def", "post", "(", "self", ",", "url", ",", "data", "=", "None", ",", "files", "=", "None", ",", "headers", "=", "None", ",", "get_json", "=", "True", ")", ":", "if", "self", ".", "debug", ":", "print", "(", "\"POST: %s, headers=%s\"", "%", "(", "...
Make POST request to a url Args: url (str): URL to send the request to data (dict, optional): Data to send files (dict, optional): Files to send with the request headers (str, optional): custom headers Returns: A JSON object of the returned r...
[ "Make", "POST", "request", "to", "a", "url" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/utils/request.py#L145-L170
train
hellosign/hellosign-python-sdk
hellosign_sdk/utils/request.py
HSRequest._get_json_response
def _get_json_response(self, resp): ''' Parse a JSON response ''' if resp is not None and resp.text is not None: try: text = resp.text.strip('\n') if len(text) > 0: return json.loads(text) except ValueError as e: ...
python
def _get_json_response(self, resp): ''' Parse a JSON response ''' if resp is not None and resp.text is not None: try: text = resp.text.strip('\n') if len(text) > 0: return json.loads(text) except ValueError as e: ...
[ "def", "_get_json_response", "(", "self", ",", "resp", ")", ":", "if", "resp", "is", "not", "None", "and", "resp", ".", "text", "is", "not", "None", ":", "try", ":", "text", "=", "resp", ".", "text", ".", "strip", "(", "'\\n'", ")", "if", "len", ...
Parse a JSON response
[ "Parse", "a", "JSON", "response" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/utils/request.py#L175-L185
train
hellosign/hellosign-python-sdk
hellosign_sdk/utils/request.py
HSRequest._process_json_response
def _process_json_response(self, response): ''' Process a given response ''' json_response = self._get_json_response(response) if self.response_callback is not None: json_response = self.response_callback(json_response) response._content = json.dumps(json_respon...
python
def _process_json_response(self, response): ''' Process a given response ''' json_response = self._get_json_response(response) if self.response_callback is not None: json_response = self.response_callback(json_response) response._content = json.dumps(json_respon...
[ "def", "_process_json_response", "(", "self", ",", "response", ")", ":", "json_response", "=", "self", ".", "_get_json_response", "(", "response", ")", "if", "self", ".", "response_callback", "is", "not", "None", ":", "json_response", "=", "self", ".", "respon...
Process a given response
[ "Process", "a", "given", "response" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/utils/request.py#L199-L212
train
hellosign/hellosign-python-sdk
hellosign_sdk/utils/request.py
HSRequest._check_error
def _check_error(self, response, json_response=None): ''' Check for HTTP error code from the response, raise exception if there's any Args: response (object): Object returned by requests' `get` and `post` methods json_response (dict): JSON response, if applicabl...
python
def _check_error(self, response, json_response=None): ''' Check for HTTP error code from the response, raise exception if there's any Args: response (object): Object returned by requests' `get` and `post` methods json_response (dict): JSON response, if applicabl...
[ "def", "_check_error", "(", "self", ",", "response", ",", "json_response", "=", "None", ")", ":", "if", "response", ".", "status_code", ">=", "400", ":", "json_response", "=", "json_response", "or", "self", ".", "_get_json_response", "(", "response", ")", "e...
Check for HTTP error code from the response, raise exception if there's any Args: response (object): Object returned by requests' `get` and `post` methods json_response (dict): JSON response, if applicable Raises: HTTPError: If the status code of re...
[ "Check", "for", "HTTP", "error", "code", "from", "the", "response", "raise", "exception", "if", "there", "s", "any" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/utils/request.py#L214-L242
train
hellosign/hellosign-python-sdk
hellosign_sdk/utils/request.py
HSRequest._check_warnings
def _check_warnings(self, json_response): ''' Extract warnings from the response to make them accessible Args: json_response (dict): JSON response ''' self.warnings = None if json_response: self.warnings = json_response.get('warnings') ...
python
def _check_warnings(self, json_response): ''' Extract warnings from the response to make them accessible Args: json_response (dict): JSON response ''' self.warnings = None if json_response: self.warnings = json_response.get('warnings') ...
[ "def", "_check_warnings", "(", "self", ",", "json_response", ")", ":", "self", ".", "warnings", "=", "None", "if", "json_response", ":", "self", ".", "warnings", "=", "json_response", ".", "get", "(", "'warnings'", ")", "if", "self", ".", "debug", "and", ...
Extract warnings from the response to make them accessible Args: json_response (dict): JSON response
[ "Extract", "warnings", "from", "the", "response", "to", "make", "them", "accessible" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/utils/request.py#L244-L258
train
hellosign/hellosign-python-sdk
hellosign_sdk/utils/hsaccesstokenauth.py
HSAccessTokenAuth.from_response
def from_response(self, response_data): ''' Builds a new HSAccessTokenAuth straight from response data Args: response_data (dict): Response data to use Returns: A HSAccessTokenAuth objet ''' return HSAccessTokenAuth( response_data['access_t...
python
def from_response(self, response_data): ''' Builds a new HSAccessTokenAuth straight from response data Args: response_data (dict): Response data to use Returns: A HSAccessTokenAuth objet ''' return HSAccessTokenAuth( response_data['access_t...
[ "def", "from_response", "(", "self", ",", "response_data", ")", ":", "return", "HSAccessTokenAuth", "(", "response_data", "[", "'access_token'", "]", ",", "response_data", "[", "'token_type'", "]", ",", "response_data", "[", "'refresh_token'", "]", ",", "response_...
Builds a new HSAccessTokenAuth straight from response data Args: response_data (dict): Response data to use Returns: A HSAccessTokenAuth objet
[ "Builds", "a", "new", "HSAccessTokenAuth", "straight", "from", "response", "data" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/utils/hsaccesstokenauth.py#L53-L69
train
hellosign/hellosign-python-sdk
hellosign_sdk/resource/signature_request.py
SignatureRequest.find_response_component
def find_response_component(self, api_id=None, signature_id=None): ''' Find one or many repsonse components. Args: api_id (str): Api id associated with the component(s) to be retrieved. signature_id (str): Signature id associated with the component(s)...
python
def find_response_component(self, api_id=None, signature_id=None): ''' Find one or many repsonse components. Args: api_id (str): Api id associated with the component(s) to be retrieved. signature_id (str): Signature id associated with the component(s)...
[ "def", "find_response_component", "(", "self", ",", "api_id", "=", "None", ",", "signature_id", "=", "None", ")", ":", "if", "not", "api_id", "and", "not", "signature_id", ":", "raise", "ValueError", "(", "'At least one of api_id and signature_id is required'", ")",...
Find one or many repsonse components. Args: api_id (str): Api id associated with the component(s) to be retrieved. signature_id (str): Signature id associated with the component(s) to be retrieved. Returns: A list of dictionaries ...
[ "Find", "one", "or", "many", "repsonse", "components", "." ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/resource/signature_request.py#L114-L137
train
hellosign/hellosign-python-sdk
hellosign_sdk/resource/signature_request.py
SignatureRequest.find_signature
def find_signature(self, signature_id=None, signer_email_address=None): ''' Return a signature for the given parameters Args: signature_id (str): Id of the signature to retrieve. signer_email_address (str): Email address of the associated signer for ...
python
def find_signature(self, signature_id=None, signer_email_address=None): ''' Return a signature for the given parameters Args: signature_id (str): Id of the signature to retrieve. signer_email_address (str): Email address of the associated signer for ...
[ "def", "find_signature", "(", "self", ",", "signature_id", "=", "None", ",", "signer_email_address", "=", "None", ")", ":", "if", "self", ".", "signatures", ":", "for", "signature", "in", "self", ".", "signatures", ":", "if", "signature", ".", "signature_id"...
Return a signature for the given parameters Args: signature_id (str): Id of the signature to retrieve. signer_email_address (str): Email address of the associated signer for the signature to retrieve. Returns: A Signature object ...
[ "Return", "a", "signature", "for", "the", "given", "parameters" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/resource/signature_request.py#L139-L154
train
hellosign/hellosign-python-sdk
hellosign_sdk/utils/__init__.py
api_resource._uncamelize
def _uncamelize(self, s): ''' Convert a camel-cased string to using underscores ''' res = '' if s: for i in range(len(s)): if i > 0 and s[i].lower() != s[i]: res += '_' res += s[i].lower() return res
python
def _uncamelize(self, s): ''' Convert a camel-cased string to using underscores ''' res = '' if s: for i in range(len(s)): if i > 0 and s[i].lower() != s[i]: res += '_' res += s[i].lower() return res
[ "def", "_uncamelize", "(", "self", ",", "s", ")", ":", "res", "=", "''", "if", "s", ":", "for", "i", "in", "range", "(", "len", "(", "s", ")", ")", ":", "if", "i", ">", "0", "and", "s", "[", "i", "]", ".", "lower", "(", ")", "!=", "s", ...
Convert a camel-cased string to using underscores
[ "Convert", "a", "camel", "-", "cased", "string", "to", "using", "underscores" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/utils/__init__.py#L53-L61
train
hellosign/hellosign-python-sdk
hellosign_sdk/utils/hsformat.py
HSFormat.format_file_params
def format_file_params(files): ''' Utility method for formatting file parameters for transmission ''' files_payload = {} if files: for idx, filename in enumerate(files): files_payload["file[" + str(idx) + "]"] = open(filename, 'rb') return ...
python
def format_file_params(files): ''' Utility method for formatting file parameters for transmission ''' files_payload = {} if files: for idx, filename in enumerate(files): files_payload["file[" + str(idx) + "]"] = open(filename, 'rb') return ...
[ "def", "format_file_params", "(", "files", ")", ":", "files_payload", "=", "{", "}", "if", "files", ":", "for", "idx", ",", "filename", "in", "enumerate", "(", "files", ")", ":", "files_payload", "[", "\"file[\"", "+", "str", "(", "idx", ")", "+", "\"]...
Utility method for formatting file parameters for transmission
[ "Utility", "method", "for", "formatting", "file", "parameters", "for", "transmission" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/utils/hsformat.py#L41-L49
train
hellosign/hellosign-python-sdk
hellosign_sdk/utils/hsformat.py
HSFormat.format_file_url_params
def format_file_url_params(file_urls): ''' Utility method for formatting file URL parameters for transmission ''' file_urls_payload = {} if file_urls: for idx, fileurl in enumerate(file_urls): file_urls_payload["file_url[" + str(idx) + "]"] = fileu...
python
def format_file_url_params(file_urls): ''' Utility method for formatting file URL parameters for transmission ''' file_urls_payload = {} if file_urls: for idx, fileurl in enumerate(file_urls): file_urls_payload["file_url[" + str(idx) + "]"] = fileu...
[ "def", "format_file_url_params", "(", "file_urls", ")", ":", "file_urls_payload", "=", "{", "}", "if", "file_urls", ":", "for", "idx", ",", "fileurl", "in", "enumerate", "(", "file_urls", ")", ":", "file_urls_payload", "[", "\"file_url[\"", "+", "str", "(", ...
Utility method for formatting file URL parameters for transmission
[ "Utility", "method", "for", "formatting", "file", "URL", "parameters", "for", "transmission" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/utils/hsformat.py#L52-L60
train
hellosign/hellosign-python-sdk
hellosign_sdk/utils/hsformat.py
HSFormat.format_single_dict
def format_single_dict(dictionary, output_name): ''' Currently used for metadata fields ''' output_payload = {} if dictionary: for (k, v) in dictionary.items(): output_payload[output_name + '[' + k + ']'] = v return output_payload
python
def format_single_dict(dictionary, output_name): ''' Currently used for metadata fields ''' output_payload = {} if dictionary: for (k, v) in dictionary.items(): output_payload[output_name + '[' + k + ']'] = v return output_payload
[ "def", "format_single_dict", "(", "dictionary", ",", "output_name", ")", ":", "output_payload", "=", "{", "}", "if", "dictionary", ":", "for", "(", "k", ",", "v", ")", "in", "dictionary", ".", "items", "(", ")", ":", "output_payload", "[", "output_name", ...
Currently used for metadata fields
[ "Currently", "used", "for", "metadata", "fields" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/utils/hsformat.py#L106-L114
train
hellosign/hellosign-python-sdk
hellosign_sdk/utils/hsformat.py
HSFormat.format_custom_fields
def format_custom_fields(list_of_custom_fields): ''' Custom fields formatting for submission ''' output_payload = {} if list_of_custom_fields: # custom_field: {"name": value} for custom_field in list_of_custom_fields: for key, value in ...
python
def format_custom_fields(list_of_custom_fields): ''' Custom fields formatting for submission ''' output_payload = {} if list_of_custom_fields: # custom_field: {"name": value} for custom_field in list_of_custom_fields: for key, value in ...
[ "def", "format_custom_fields", "(", "list_of_custom_fields", ")", ":", "output_payload", "=", "{", "}", "if", "list_of_custom_fields", ":", "for", "custom_field", "in", "list_of_custom_fields", ":", "for", "key", ",", "value", "in", "custom_field", ".", "items", "...
Custom fields formatting for submission
[ "Custom", "fields", "formatting", "for", "submission" ]
4325a29ad5766380a214eac3914511f62f7ecba4
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/utils/hsformat.py#L117-L127
train
GaretJax/django-click
setup.py
Setup.read
def read(fname, fail_silently=False): """ Read the content of the given file. The path is evaluated from the directory containing this file. """ try: filepath = os.path.join(os.path.dirname(__file__), fname) with io.open(filepath, 'rt', encoding='utf8') as...
python
def read(fname, fail_silently=False): """ Read the content of the given file. The path is evaluated from the directory containing this file. """ try: filepath = os.path.join(os.path.dirname(__file__), fname) with io.open(filepath, 'rt', encoding='utf8') as...
[ "def", "read", "(", "fname", ",", "fail_silently", "=", "False", ")", ":", "try", ":", "filepath", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "fname", ")", "with", "io", ".", "open", "(...
Read the content of the given file. The path is evaluated from the directory containing this file.
[ "Read", "the", "content", "of", "the", "given", "file", ".", "The", "path", "is", "evaluated", "from", "the", "directory", "containing", "this", "file", "." ]
3584bff81cb7891a1aa2d7fe49c1db501f5b0e84
https://github.com/GaretJax/django-click/blob/3584bff81cb7891a1aa2d7fe49c1db501f5b0e84/setup.py#L35-L47
train
GaretJax/django-click
djclick/adapter.py
pass_verbosity
def pass_verbosity(f): """ Marks a callback as wanting to receive the verbosity as a keyword argument. """ def new_func(*args, **kwargs): kwargs['verbosity'] = click.get_current_context().verbosity return f(*args, **kwargs) return update_wrapper(new_func, f)
python
def pass_verbosity(f): """ Marks a callback as wanting to receive the verbosity as a keyword argument. """ def new_func(*args, **kwargs): kwargs['verbosity'] = click.get_current_context().verbosity return f(*args, **kwargs) return update_wrapper(new_func, f)
[ "def", "pass_verbosity", "(", "f", ")", ":", "def", "new_func", "(", "*", "args", ",", "**", "kwargs", ")", ":", "kwargs", "[", "'verbosity'", "]", "=", "click", ".", "get_current_context", "(", ")", ".", "verbosity", "return", "f", "(", "*", "args", ...
Marks a callback as wanting to receive the verbosity as a keyword argument.
[ "Marks", "a", "callback", "as", "wanting", "to", "receive", "the", "verbosity", "as", "a", "keyword", "argument", "." ]
3584bff81cb7891a1aa2d7fe49c1db501f5b0e84
https://github.com/GaretJax/django-click/blob/3584bff81cb7891a1aa2d7fe49c1db501f5b0e84/djclick/adapter.py#L232-L239
train
GaretJax/django-click
djclick/adapter.py
DjangoCommandMixin.run_from_argv
def run_from_argv(self, argv): """ Called when run from the command line. """ try: return self.main(args=argv[2:], standalone_mode=False) except click.ClickException as e: if getattr(e.ctx, 'traceback', False): raise e.show() ...
python
def run_from_argv(self, argv): """ Called when run from the command line. """ try: return self.main(args=argv[2:], standalone_mode=False) except click.ClickException as e: if getattr(e.ctx, 'traceback', False): raise e.show() ...
[ "def", "run_from_argv", "(", "self", ",", "argv", ")", ":", "try", ":", "return", "self", ".", "main", "(", "args", "=", "argv", "[", "2", ":", "]", ",", "standalone_mode", "=", "False", ")", "except", "click", ".", "ClickException", "as", "e", ":", ...
Called when run from the command line.
[ "Called", "when", "run", "from", "the", "command", "line", "." ]
3584bff81cb7891a1aa2d7fe49c1db501f5b0e84
https://github.com/GaretJax/django-click/blob/3584bff81cb7891a1aa2d7fe49c1db501f5b0e84/djclick/adapter.py#L57-L67
train
xxtea/xxtea-python
xxtea/__init__.py
encrypt
def encrypt(data, key): '''encrypt the data with the key''' data = __tobytes(data) data_len = len(data) data = ffi.from_buffer(data) key = ffi.from_buffer(__tobytes(key)) out_len = ffi.new('size_t *') result = lib.xxtea_encrypt(data, data_len, key, out_len) ret = ffi.buffer(result, out_l...
python
def encrypt(data, key): '''encrypt the data with the key''' data = __tobytes(data) data_len = len(data) data = ffi.from_buffer(data) key = ffi.from_buffer(__tobytes(key)) out_len = ffi.new('size_t *') result = lib.xxtea_encrypt(data, data_len, key, out_len) ret = ffi.buffer(result, out_l...
[ "def", "encrypt", "(", "data", ",", "key", ")", ":", "data", "=", "__tobytes", "(", "data", ")", "data_len", "=", "len", "(", "data", ")", "data", "=", "ffi", ".", "from_buffer", "(", "data", ")", "key", "=", "ffi", ".", "from_buffer", "(", "__toby...
encrypt the data with the key
[ "encrypt", "the", "data", "with", "the", "key" ]
35bd893cb42dce338631d051be9302fcbc21b7fc
https://github.com/xxtea/xxtea-python/blob/35bd893cb42dce338631d051be9302fcbc21b7fc/xxtea/__init__.py#L30-L40
train
xxtea/xxtea-python
xxtea/__init__.py
decrypt
def decrypt(data, key): '''decrypt the data with the key''' data_len = len(data) data = ffi.from_buffer(data) key = ffi.from_buffer(__tobytes(key)) out_len = ffi.new('size_t *') result = lib.xxtea_decrypt(data, data_len, key, out_len) ret = ffi.buffer(result, out_len[0])[:] lib.free(resu...
python
def decrypt(data, key): '''decrypt the data with the key''' data_len = len(data) data = ffi.from_buffer(data) key = ffi.from_buffer(__tobytes(key)) out_len = ffi.new('size_t *') result = lib.xxtea_decrypt(data, data_len, key, out_len) ret = ffi.buffer(result, out_len[0])[:] lib.free(resu...
[ "def", "decrypt", "(", "data", ",", "key", ")", ":", "data_len", "=", "len", "(", "data", ")", "data", "=", "ffi", ".", "from_buffer", "(", "data", ")", "key", "=", "ffi", ".", "from_buffer", "(", "__tobytes", "(", "key", ")", ")", "out_len", "=", ...
decrypt the data with the key
[ "decrypt", "the", "data", "with", "the", "key" ]
35bd893cb42dce338631d051be9302fcbc21b7fc
https://github.com/xxtea/xxtea-python/blob/35bd893cb42dce338631d051be9302fcbc21b7fc/xxtea/__init__.py#L42-L51
train
mozilla/taar
taar/flask_app.py
flaskrun
def flaskrun(app, default_host="127.0.0.1", default_port="8000"): """ Takes a flask.Flask instance and runs it. Parses command-line flags to configure the app. """ # Set up the command-line options parser = optparse.OptionParser() parser.add_option( "-H", "--host", h...
python
def flaskrun(app, default_host="127.0.0.1", default_port="8000"): """ Takes a flask.Flask instance and runs it. Parses command-line flags to configure the app. """ # Set up the command-line options parser = optparse.OptionParser() parser.add_option( "-H", "--host", h...
[ "def", "flaskrun", "(", "app", ",", "default_host", "=", "\"127.0.0.1\"", ",", "default_port", "=", "\"8000\"", ")", ":", "parser", "=", "optparse", ".", "OptionParser", "(", ")", "parser", ".", "add_option", "(", "\"-H\"", ",", "\"--host\"", ",", "help", ...
Takes a flask.Flask instance and runs it. Parses command-line flags to configure the app.
[ "Takes", "a", "flask", ".", "Flask", "instance", "and", "runs", "it", ".", "Parses", "command", "-", "line", "flags", "to", "configure", "the", "app", "." ]
4002eb395f0b7ad837f1578e92d590e2cf82bdca
https://github.com/mozilla/taar/blob/4002eb395f0b7ad837f1578e92d590e2cf82bdca/taar/flask_app.py#L41-L86
train
mozilla/taar
taar/recommenders/hybrid_recommender.py
CuratedWhitelistCache.get_randomized_guid_sample
def get_randomized_guid_sample(self, item_count): """ Fetch a subset of randomzied GUIDs from the whitelist """ dataset = self.get_whitelist() random.shuffle(dataset) return dataset[:item_count]
python
def get_randomized_guid_sample(self, item_count): """ Fetch a subset of randomzied GUIDs from the whitelist """ dataset = self.get_whitelist() random.shuffle(dataset) return dataset[:item_count]
[ "def", "get_randomized_guid_sample", "(", "self", ",", "item_count", ")", ":", "dataset", "=", "self", ".", "get_whitelist", "(", ")", "random", ".", "shuffle", "(", "dataset", ")", "return", "dataset", "[", ":", "item_count", "]" ]
Fetch a subset of randomzied GUIDs from the whitelist
[ "Fetch", "a", "subset", "of", "randomzied", "GUIDs", "from", "the", "whitelist" ]
4002eb395f0b7ad837f1578e92d590e2cf82bdca
https://github.com/mozilla/taar/blob/4002eb395f0b7ad837f1578e92d590e2cf82bdca/taar/recommenders/hybrid_recommender.py#L28-L32
train
mozilla/taar
taar/recommenders/hybrid_recommender.py
CuratedRecommender.can_recommend
def can_recommend(self, client_data, extra_data={}): """The Curated recommender will always be able to recommend something""" self.logger.info("Curated can_recommend: {}".format(True)) return True
python
def can_recommend(self, client_data, extra_data={}): """The Curated recommender will always be able to recommend something""" self.logger.info("Curated can_recommend: {}".format(True)) return True
[ "def", "can_recommend", "(", "self", ",", "client_data", ",", "extra_data", "=", "{", "}", ")", ":", "self", ".", "logger", ".", "info", "(", "\"Curated can_recommend: {}\"", ".", "format", "(", "True", ")", ")", "return", "True" ]
The Curated recommender will always be able to recommend something
[ "The", "Curated", "recommender", "will", "always", "be", "able", "to", "recommend", "something" ]
4002eb395f0b7ad837f1578e92d590e2cf82bdca
https://github.com/mozilla/taar/blob/4002eb395f0b7ad837f1578e92d590e2cf82bdca/taar/recommenders/hybrid_recommender.py#L52-L56
train
mozilla/taar
taar/recommenders/hybrid_recommender.py
CuratedRecommender.recommend
def recommend(self, client_data, limit, extra_data={}): """ Curated recommendations are just random selections """ guids = self._curated_wl.get_randomized_guid_sample(limit) results = [(guid, 1.0) for guid in guids] log_data = (client_data["client_id"], str(guids)) ...
python
def recommend(self, client_data, limit, extra_data={}): """ Curated recommendations are just random selections """ guids = self._curated_wl.get_randomized_guid_sample(limit) results = [(guid, 1.0) for guid in guids] log_data = (client_data["client_id"], str(guids)) ...
[ "def", "recommend", "(", "self", ",", "client_data", ",", "limit", ",", "extra_data", "=", "{", "}", ")", ":", "guids", "=", "self", ".", "_curated_wl", ".", "get_randomized_guid_sample", "(", "limit", ")", "results", "=", "[", "(", "guid", ",", "1.0", ...
Curated recommendations are just random selections
[ "Curated", "recommendations", "are", "just", "random", "selections" ]
4002eb395f0b7ad837f1578e92d590e2cf82bdca
https://github.com/mozilla/taar/blob/4002eb395f0b7ad837f1578e92d590e2cf82bdca/taar/recommenders/hybrid_recommender.py#L58-L70
train
mozilla/taar
taar/recommenders/hybrid_recommender.py
HybridRecommender.recommend
def recommend(self, client_data, limit, extra_data={}): """ Hybrid recommendations simply select half recommendations from the ensemble recommender, and half from the curated one. Duplicate recommendations are accomodated by rank ordering by weight. """ preinsta...
python
def recommend(self, client_data, limit, extra_data={}): """ Hybrid recommendations simply select half recommendations from the ensemble recommender, and half from the curated one. Duplicate recommendations are accomodated by rank ordering by weight. """ preinsta...
[ "def", "recommend", "(", "self", ",", "client_data", ",", "limit", ",", "extra_data", "=", "{", "}", ")", ":", "preinstalled_addon_ids", "=", "client_data", ".", "get", "(", "\"installed_addons\"", ",", "[", "]", ")", "extended_limit", "=", "limit", "+", "...
Hybrid recommendations simply select half recommendations from the ensemble recommender, and half from the curated one. Duplicate recommendations are accomodated by rank ordering by weight.
[ "Hybrid", "recommendations", "simply", "select", "half", "recommendations", "from", "the", "ensemble", "recommender", "and", "half", "from", "the", "curated", "one", "." ]
4002eb395f0b7ad837f1578e92d590e2cf82bdca
https://github.com/mozilla/taar/blob/4002eb395f0b7ad837f1578e92d590e2cf82bdca/taar/recommenders/hybrid_recommender.py#L102-L169
train
mozilla/taar
taar/recommenders/ensemble_recommender.py
EnsembleRecommender._recommend
def _recommend(self, client_data, limit, extra_data={}): """ Ensemble recommendations are aggregated from individual recommenders. The ensemble recommender applies a weight to the recommendation outputs of each recommender to reorder the recommendations to be a better fit. ...
python
def _recommend(self, client_data, limit, extra_data={}): """ Ensemble recommendations are aggregated from individual recommenders. The ensemble recommender applies a weight to the recommendation outputs of each recommender to reorder the recommendations to be a better fit. ...
[ "def", "_recommend", "(", "self", ",", "client_data", ",", "limit", ",", "extra_data", "=", "{", "}", ")", ":", "self", ".", "logger", ".", "info", "(", "\"Ensemble recommend invoked\"", ")", "preinstalled_addon_ids", "=", "client_data", ".", "get", "(", "\"...
Ensemble recommendations are aggregated from individual recommenders. The ensemble recommender applies a weight to the recommendation outputs of each recommender to reorder the recommendations to be a better fit. The intuitive understanding is that the total space of recommende...
[ "Ensemble", "recommendations", "are", "aggregated", "from", "individual", "recommenders", ".", "The", "ensemble", "recommender", "applies", "a", "weight", "to", "the", "recommendation", "outputs", "of", "each", "recommender", "to", "reorder", "the", "recommendations",...
4002eb395f0b7ad837f1578e92d590e2cf82bdca
https://github.com/mozilla/taar/blob/4002eb395f0b7ad837f1578e92d590e2cf82bdca/taar/recommenders/ensemble_recommender.py#L81-L150
train
mozilla/taar
taar/recommenders/lazys3.py
LazyJSONLoader.get
def get(self, transform=None): """ Return the JSON defined at the S3 location in the constructor. The get method will reload the S3 object after the TTL has expired. Fetch the JSON object from cache or S3 if necessary """ if not self.has_expired() and self._cache...
python
def get(self, transform=None): """ Return the JSON defined at the S3 location in the constructor. The get method will reload the S3 object after the TTL has expired. Fetch the JSON object from cache or S3 if necessary """ if not self.has_expired() and self._cache...
[ "def", "get", "(", "self", ",", "transform", "=", "None", ")", ":", "if", "not", "self", ".", "has_expired", "(", ")", "and", "self", ".", "_cached_copy", "is", "not", "None", ":", "return", "self", ".", "_cached_copy", ",", "False", "return", "self", ...
Return the JSON defined at the S3 location in the constructor. The get method will reload the S3 object after the TTL has expired. Fetch the JSON object from cache or S3 if necessary
[ "Return", "the", "JSON", "defined", "at", "the", "S3", "location", "in", "the", "constructor", "." ]
4002eb395f0b7ad837f1578e92d590e2cf82bdca
https://github.com/mozilla/taar/blob/4002eb395f0b7ad837f1578e92d590e2cf82bdca/taar/recommenders/lazys3.py#L43-L54
train
mozilla/taar
bin/pipstrap.py
hashed_download
def hashed_download(url, temp, digest): """Download ``url`` to ``temp``, make sure it has the SHA-256 ``digest``, and return its path.""" # Based on pip 1.4.1's URLOpener but with cert verification removed def opener(): opener = build_opener(HTTPSHandler()) # Strip out HTTPHandler to pre...
python
def hashed_download(url, temp, digest): """Download ``url`` to ``temp``, make sure it has the SHA-256 ``digest``, and return its path.""" # Based on pip 1.4.1's URLOpener but with cert verification removed def opener(): opener = build_opener(HTTPSHandler()) # Strip out HTTPHandler to pre...
[ "def", "hashed_download", "(", "url", ",", "temp", ",", "digest", ")", ":", "def", "opener", "(", ")", ":", "opener", "=", "build_opener", "(", "HTTPSHandler", "(", ")", ")", "for", "handler", "in", "opener", ".", "handlers", ":", "if", "isinstance", "...
Download ``url`` to ``temp``, make sure it has the SHA-256 ``digest``, and return its path.
[ "Download", "url", "to", "temp", "make", "sure", "it", "has", "the", "SHA", "-", "256", "digest", "and", "return", "its", "path", "." ]
4002eb395f0b7ad837f1578e92d590e2cf82bdca
https://github.com/mozilla/taar/blob/4002eb395f0b7ad837f1578e92d590e2cf82bdca/bin/pipstrap.py#L65-L95
train
mozilla/taar
taar/recommenders/similarity_recommender.py
SimilarityRecommender._build_features_caches
def _build_features_caches(self): """This function build two feature cache matrices. That's the self.categorical_features and self.continuous_features attributes. One matrix is for the continuous features and the other is for the categorical features. This is needed to speed up...
python
def _build_features_caches(self): """This function build two feature cache matrices. That's the self.categorical_features and self.continuous_features attributes. One matrix is for the continuous features and the other is for the categorical features. This is needed to speed up...
[ "def", "_build_features_caches", "(", "self", ")", ":", "_donors_pool", "=", "self", ".", "_donors_pool", ".", "get", "(", ")", "[", "0", "]", "_lr_curves", "=", "self", ".", "_lr_curves", ".", "get", "(", ")", "[", "0", "]", "if", "_donors_pool", "is"...
This function build two feature cache matrices. That's the self.categorical_features and self.continuous_features attributes. One matrix is for the continuous features and the other is for the categorical features. This is needed to speed up the similarity recommendation proces...
[ "This", "function", "build", "two", "feature", "cache", "matrices", "." ]
4002eb395f0b7ad837f1578e92d590e2cf82bdca
https://github.com/mozilla/taar/blob/4002eb395f0b7ad837f1578e92d590e2cf82bdca/taar/recommenders/similarity_recommender.py#L103-L136
train
mozilla/taar
taar/recommenders/recommendation_manager.py
RecommendationManager.recommend
def recommend(self, client_id, limit, extra_data={}): """Return recommendations for the given client. The recommendation logic will go through each recommender and pick the first one that "can_recommend". :param client_id: the client unique id. :param limit: the maximum number ...
python
def recommend(self, client_id, limit, extra_data={}): """Return recommendations for the given client. The recommendation logic will go through each recommender and pick the first one that "can_recommend". :param client_id: the client unique id. :param limit: the maximum number ...
[ "def", "recommend", "(", "self", ",", "client_id", ",", "limit", ",", "extra_data", "=", "{", "}", ")", ":", "if", "client_id", "in", "TEST_CLIENT_IDS", ":", "data", "=", "self", ".", "_whitelist_data", ".", "get", "(", ")", "[", "0", "]", "random", ...
Return recommendations for the given client. The recommendation logic will go through each recommender and pick the first one that "can_recommend". :param client_id: the client unique id. :param limit: the maximum number of recommendations to return. :param extra_data: a dictio...
[ "Return", "recommendations", "for", "the", "given", "client", "." ]
4002eb395f0b7ad837f1578e92d590e2cf82bdca
https://github.com/mozilla/taar/blob/4002eb395f0b7ad837f1578e92d590e2cf82bdca/taar/recommenders/recommendation_manager.py#L85-L116
train
mozilla/taar
taar/profile_fetcher.py
ProfileController.get_client_profile
def get_client_profile(self, client_id): """This fetches a single client record out of DynamoDB """ try: response = self._table.get_item(Key={'client_id': client_id}) compressed_bytes = response['Item']['json_payload'].value json_byte_data = zlib.decompress(co...
python
def get_client_profile(self, client_id): """This fetches a single client record out of DynamoDB """ try: response = self._table.get_item(Key={'client_id': client_id}) compressed_bytes = response['Item']['json_payload'].value json_byte_data = zlib.decompress(co...
[ "def", "get_client_profile", "(", "self", ",", "client_id", ")", ":", "try", ":", "response", "=", "self", ".", "_table", ".", "get_item", "(", "Key", "=", "{", "'client_id'", ":", "client_id", "}", ")", "compressed_bytes", "=", "response", "[", "'Item'", ...
This fetches a single client record out of DynamoDB
[ "This", "fetches", "a", "single", "client", "record", "out", "of", "DynamoDB" ]
4002eb395f0b7ad837f1578e92d590e2cf82bdca
https://github.com/mozilla/taar/blob/4002eb395f0b7ad837f1578e92d590e2cf82bdca/taar/profile_fetcher.py#L33-L50
train
mozilla/taar
taar/plugin.py
clean_promoted_guids
def clean_promoted_guids(raw_promoted_guids): """ Verify that the promoted GUIDs are formatted correctly, otherwise strip it down into an empty list. """ valid = True for row in raw_promoted_guids: if len(row) != 2: valid = False break if not ( (...
python
def clean_promoted_guids(raw_promoted_guids): """ Verify that the promoted GUIDs are formatted correctly, otherwise strip it down into an empty list. """ valid = True for row in raw_promoted_guids: if len(row) != 2: valid = False break if not ( (...
[ "def", "clean_promoted_guids", "(", "raw_promoted_guids", ")", ":", "valid", "=", "True", "for", "row", "in", "raw_promoted_guids", ":", "if", "len", "(", "row", ")", "!=", "2", ":", "valid", "=", "False", "break", "if", "not", "(", "(", "isinstance", "(...
Verify that the promoted GUIDs are formatted correctly, otherwise strip it down into an empty list.
[ "Verify", "that", "the", "promoted", "GUIDs", "are", "formatted", "correctly", "otherwise", "strip", "it", "down", "into", "an", "empty", "list", "." ]
4002eb395f0b7ad837f1578e92d590e2cf82bdca
https://github.com/mozilla/taar/blob/4002eb395f0b7ad837f1578e92d590e2cf82bdca/taar/plugin.py#L32-L52
train
philklei/tahoma-api
tahoma_api/tahoma_api.py
TahomaApi.login
def login(self): """Login to Tahoma API.""" if self.__logged_in: return login = {'userId': self.__username, 'userPassword': self.__password} header = BASE_HEADERS.copy() request = requests.post(BASE_URL + 'login', data=login, ...
python
def login(self): """Login to Tahoma API.""" if self.__logged_in: return login = {'userId': self.__username, 'userPassword': self.__password} header = BASE_HEADERS.copy() request = requests.post(BASE_URL + 'login', data=login, ...
[ "def", "login", "(", "self", ")", ":", "if", "self", ".", "__logged_in", ":", "return", "login", "=", "{", "'userId'", ":", "self", ".", "__username", ",", "'userPassword'", ":", "self", ".", "__password", "}", "header", "=", "BASE_HEADERS", ".", "copy",...
Login to Tahoma API.
[ "Login", "to", "Tahoma", "API", "." ]
fc84f6ba3b673d0cd0e9e618777834a74a3c7b64
https://github.com/philklei/tahoma-api/blob/fc84f6ba3b673d0cd0e9e618777834a74a3c7b64/tahoma_api/tahoma_api.py#L32-L68
train
philklei/tahoma-api
tahoma_api/tahoma_api.py
TahomaApi.get_user
def get_user(self): """Get the user informations from the server. :return: a dict with all the informations :rtype: dict raises ValueError in case of protocol issues :Example: >>> "creationTime": <time>, >>> "lastUpdateTime": <time>, >>> "userId": "<em...
python
def get_user(self): """Get the user informations from the server. :return: a dict with all the informations :rtype: dict raises ValueError in case of protocol issues :Example: >>> "creationTime": <time>, >>> "lastUpdateTime": <time>, >>> "userId": "<em...
[ "def", "get_user", "(", "self", ")", ":", "header", "=", "BASE_HEADERS", ".", "copy", "(", ")", "header", "[", "'Cookie'", "]", "=", "self", ".", "__cookie", "request", "=", "requests", ".", "get", "(", "BASE_URL", "+", "'getEndUser'", ",", "headers", ...
Get the user informations from the server. :return: a dict with all the informations :rtype: dict raises ValueError in case of protocol issues :Example: >>> "creationTime": <time>, >>> "lastUpdateTime": <time>, >>> "userId": "<email for login>", >>> "t...
[ "Get", "the", "user", "informations", "from", "the", "server", "." ]
fc84f6ba3b673d0cd0e9e618777834a74a3c7b64
https://github.com/philklei/tahoma-api/blob/fc84f6ba3b673d0cd0e9e618777834a74a3c7b64/tahoma_api/tahoma_api.py#L70-L114
train
philklei/tahoma-api
tahoma_api/tahoma_api.py
TahomaApi._get_setup
def _get_setup(self, result): """Internal method which process the results from the server.""" self.__devices = {} if ('setup' not in result.keys() or 'devices' not in result['setup'].keys()): raise Exception( "Did not find device definition.") ...
python
def _get_setup(self, result): """Internal method which process the results from the server.""" self.__devices = {} if ('setup' not in result.keys() or 'devices' not in result['setup'].keys()): raise Exception( "Did not find device definition.") ...
[ "def", "_get_setup", "(", "self", ",", "result", ")", ":", "self", ".", "__devices", "=", "{", "}", "if", "(", "'setup'", "not", "in", "result", ".", "keys", "(", ")", "or", "'devices'", "not", "in", "result", "[", "'setup'", "]", ".", "keys", "(",...
Internal method which process the results from the server.
[ "Internal", "method", "which", "process", "the", "results", "from", "the", "server", "." ]
fc84f6ba3b673d0cd0e9e618777834a74a3c7b64
https://github.com/philklei/tahoma-api/blob/fc84f6ba3b673d0cd0e9e618777834a74a3c7b64/tahoma_api/tahoma_api.py#L156-L170
train
philklei/tahoma-api
tahoma_api/tahoma_api.py
TahomaApi.apply_actions
def apply_actions(self, name_of_action, actions): """Start to execute an action or a group of actions. This method takes a bunch of actions and runs them on your Tahoma box. :param name_of_action: the label/name for the action :param actions: an array of Action objects ...
python
def apply_actions(self, name_of_action, actions): """Start to execute an action or a group of actions. This method takes a bunch of actions and runs them on your Tahoma box. :param name_of_action: the label/name for the action :param actions: an array of Action objects ...
[ "def", "apply_actions", "(", "self", ",", "name_of_action", ",", "actions", ")", ":", "header", "=", "BASE_HEADERS", ".", "copy", "(", ")", "header", "[", "'Cookie'", "]", "=", "self", ".", "__cookie", "actions_serialized", "=", "[", "]", "for", "action", ...
Start to execute an action or a group of actions. This method takes a bunch of actions and runs them on your Tahoma box. :param name_of_action: the label/name for the action :param actions: an array of Action objects :return: the execution identifier ************** wha...
[ "Start", "to", "execute", "an", "action", "or", "a", "group", "of", "actions", "." ]
fc84f6ba3b673d0cd0e9e618777834a74a3c7b64
https://github.com/philklei/tahoma-api/blob/fc84f6ba3b673d0cd0e9e618777834a74a3c7b64/tahoma_api/tahoma_api.py#L281-L333
train
philklei/tahoma-api
tahoma_api/tahoma_api.py
TahomaApi.get_events
def get_events(self): """Return a set of events. Which have been occured since the last call of this method. This method should be called regulary to get all occuring Events. There are three different Event types/classes which can be returned: - DeviceStateChangedEvent...
python
def get_events(self): """Return a set of events. Which have been occured since the last call of this method. This method should be called regulary to get all occuring Events. There are three different Event types/classes which can be returned: - DeviceStateChangedEvent...
[ "def", "get_events", "(", "self", ")", ":", "header", "=", "BASE_HEADERS", ".", "copy", "(", ")", "header", "[", "'Cookie'", "]", "=", "self", ".", "__cookie", "request", "=", "requests", ".", "post", "(", "BASE_URL", "+", "'getEvents'", ",", "headers", ...
Return a set of events. Which have been occured since the last call of this method. This method should be called regulary to get all occuring Events. There are three different Event types/classes which can be returned: - DeviceStateChangedEvent, if any device changed it's stat...
[ "Return", "a", "set", "of", "events", "." ]
fc84f6ba3b673d0cd0e9e618777834a74a3c7b64
https://github.com/philklei/tahoma-api/blob/fc84f6ba3b673d0cd0e9e618777834a74a3c7b64/tahoma_api/tahoma_api.py#L335-L381
train
philklei/tahoma-api
tahoma_api/tahoma_api.py
TahomaApi._get_events
def _get_events(self, result): """"Internal method for being able to run unit tests.""" events = [] for event_data in result: event = Event.factory(event_data) if event is not None: events.append(event) if isinstance(event, DeviceStateCh...
python
def _get_events(self, result): """"Internal method for being able to run unit tests.""" events = [] for event_data in result: event = Event.factory(event_data) if event is not None: events.append(event) if isinstance(event, DeviceStateCh...
[ "def", "_get_events", "(", "self", ",", "result", ")", ":", "events", "=", "[", "]", "for", "event_data", "in", "result", ":", "event", "=", "Event", ".", "factory", "(", "event_data", ")", "if", "event", "is", "not", "None", ":", "events", ".", "app...
Internal method for being able to run unit tests.
[ "Internal", "method", "for", "being", "able", "to", "run", "unit", "tests", "." ]
fc84f6ba3b673d0cd0e9e618777834a74a3c7b64
https://github.com/philklei/tahoma-api/blob/fc84f6ba3b673d0cd0e9e618777834a74a3c7b64/tahoma_api/tahoma_api.py#L383-L404
train
philklei/tahoma-api
tahoma_api/tahoma_api.py
TahomaApi.get_current_executions
def get_current_executions(self): """Get all current running executions. :return: Returns a set of running Executions or empty list. :rtype: list raises ValueError in case of protocol issues :Seealso: - apply_actions - launch_action_group - get_history...
python
def get_current_executions(self): """Get all current running executions. :return: Returns a set of running Executions or empty list. :rtype: list raises ValueError in case of protocol issues :Seealso: - apply_actions - launch_action_group - get_history...
[ "def", "get_current_executions", "(", "self", ")", ":", "header", "=", "BASE_HEADERS", ".", "copy", "(", ")", "header", "[", "'Cookie'", "]", "=", "self", ".", "__cookie", "request", "=", "requests", ".", "get", "(", "BASE_URL", "+", "'getCurrentExecutions'"...
Get all current running executions. :return: Returns a set of running Executions or empty list. :rtype: list raises ValueError in case of protocol issues :Seealso: - apply_actions - launch_action_group - get_history
[ "Get", "all", "current", "running", "executions", "." ]
fc84f6ba3b673d0cd0e9e618777834a74a3c7b64
https://github.com/philklei/tahoma-api/blob/fc84f6ba3b673d0cd0e9e618777834a74a3c7b64/tahoma_api/tahoma_api.py#L406-L451
train
philklei/tahoma-api
tahoma_api/tahoma_api.py
TahomaApi.get_action_groups
def get_action_groups(self): """Get all Action Groups. :return: List of Action Groups """ header = BASE_HEADERS.copy() header['Cookie'] = self.__cookie request = requests.get(BASE_URL + "getActionGroups", headers=header, ...
python
def get_action_groups(self): """Get all Action Groups. :return: List of Action Groups """ header = BASE_HEADERS.copy() header['Cookie'] = self.__cookie request = requests.get(BASE_URL + "getActionGroups", headers=header, ...
[ "def", "get_action_groups", "(", "self", ")", ":", "header", "=", "BASE_HEADERS", ".", "copy", "(", ")", "header", "[", "'Cookie'", "]", "=", "self", ".", "__cookie", "request", "=", "requests", ".", "get", "(", "BASE_URL", "+", "\"getActionGroups\"", ",",...
Get all Action Groups. :return: List of Action Groups
[ "Get", "all", "Action", "Groups", "." ]
fc84f6ba3b673d0cd0e9e618777834a74a3c7b64
https://github.com/philklei/tahoma-api/blob/fc84f6ba3b673d0cd0e9e618777834a74a3c7b64/tahoma_api/tahoma_api.py#L494-L527
train
philklei/tahoma-api
tahoma_api/tahoma_api.py
TahomaApi.launch_action_group
def launch_action_group(self, action_id): """Start action group.""" header = BASE_HEADERS.copy() header['Cookie'] = self.__cookie request = requests.get( BASE_URL + 'launchActionGroup?oid=' + action_id, headers=header, timeout=10) ...
python
def launch_action_group(self, action_id): """Start action group.""" header = BASE_HEADERS.copy() header['Cookie'] = self.__cookie request = requests.get( BASE_URL + 'launchActionGroup?oid=' + action_id, headers=header, timeout=10) ...
[ "def", "launch_action_group", "(", "self", ",", "action_id", ")", ":", "header", "=", "BASE_HEADERS", ".", "copy", "(", ")", "header", "[", "'Cookie'", "]", "=", "self", ".", "__cookie", "request", "=", "requests", ".", "get", "(", "BASE_URL", "+", "'lau...
Start action group.
[ "Start", "action", "group", "." ]
fc84f6ba3b673d0cd0e9e618777834a74a3c7b64
https://github.com/philklei/tahoma-api/blob/fc84f6ba3b673d0cd0e9e618777834a74a3c7b64/tahoma_api/tahoma_api.py#L529-L560
train
philklei/tahoma-api
tahoma_api/tahoma_api.py
TahomaApi.get_states
def get_states(self, devices): """Get States of Devices.""" header = BASE_HEADERS.copy() header['Cookie'] = self.__cookie json_data = self._create_get_state_request(devices) request = requests.post( BASE_URL + 'getStates', headers=header, dat...
python
def get_states(self, devices): """Get States of Devices.""" header = BASE_HEADERS.copy() header['Cookie'] = self.__cookie json_data = self._create_get_state_request(devices) request = requests.post( BASE_URL + 'getStates', headers=header, dat...
[ "def", "get_states", "(", "self", ",", "devices", ")", ":", "header", "=", "BASE_HEADERS", ".", "copy", "(", ")", "header", "[", "'Cookie'", "]", "=", "self", ".", "__cookie", "json_data", "=", "self", ".", "_create_get_state_request", "(", "devices", ")",...
Get States of Devices.
[ "Get", "States", "of", "Devices", "." ]
fc84f6ba3b673d0cd0e9e618777834a74a3c7b64
https://github.com/philklei/tahoma-api/blob/fc84f6ba3b673d0cd0e9e618777834a74a3c7b64/tahoma_api/tahoma_api.py#L562-L588
train
philklei/tahoma-api
tahoma_api/tahoma_api.py
TahomaApi._create_get_state_request
def _create_get_state_request(self, given_devices): """Create state request.""" dev_list = [] if isinstance(given_devices, list): devices = given_devices else: devices = [] for dev_name, item in self.__devices.items(): if item: ...
python
def _create_get_state_request(self, given_devices): """Create state request.""" dev_list = [] if isinstance(given_devices, list): devices = given_devices else: devices = [] for dev_name, item in self.__devices.items(): if item: ...
[ "def", "_create_get_state_request", "(", "self", ",", "given_devices", ")", ":", "dev_list", "=", "[", "]", "if", "isinstance", "(", "given_devices", ",", "list", ")", ":", "devices", "=", "given_devices", "else", ":", "devices", "=", "[", "]", "for", "dev...
Create state request.
[ "Create", "state", "request", "." ]
fc84f6ba3b673d0cd0e9e618777834a74a3c7b64
https://github.com/philklei/tahoma-api/blob/fc84f6ba3b673d0cd0e9e618777834a74a3c7b64/tahoma_api/tahoma_api.py#L590-L612
train
philklei/tahoma-api
tahoma_api/tahoma_api.py
TahomaApi._get_states
def _get_states(self, result): """Get states of devices.""" if 'devices' not in result.keys(): return for device_states in result['devices']: device = self.__devices[device_states['deviceURL']] try: device.set_active_states(device_states['stat...
python
def _get_states(self, result): """Get states of devices.""" if 'devices' not in result.keys(): return for device_states in result['devices']: device = self.__devices[device_states['deviceURL']] try: device.set_active_states(device_states['stat...
[ "def", "_get_states", "(", "self", ",", "result", ")", ":", "if", "'devices'", "not", "in", "result", ".", "keys", "(", ")", ":", "return", "for", "device_states", "in", "result", "[", "'devices'", "]", ":", "device", "=", "self", ".", "__devices", "["...
Get states of devices.
[ "Get", "states", "of", "devices", "." ]
fc84f6ba3b673d0cd0e9e618777834a74a3c7b64
https://github.com/philklei/tahoma-api/blob/fc84f6ba3b673d0cd0e9e618777834a74a3c7b64/tahoma_api/tahoma_api.py#L614-L624
train
philklei/tahoma-api
tahoma_api/tahoma_api.py
TahomaApi.refresh_all_states
def refresh_all_states(self): """Update all states.""" header = BASE_HEADERS.copy() header['Cookie'] = self.__cookie request = requests.get( BASE_URL + "refreshAllStates", headers=header, timeout=10) if request.status_code != 200: self.__logged_in = Fals...
python
def refresh_all_states(self): """Update all states.""" header = BASE_HEADERS.copy() header['Cookie'] = self.__cookie request = requests.get( BASE_URL + "refreshAllStates", headers=header, timeout=10) if request.status_code != 200: self.__logged_in = Fals...
[ "def", "refresh_all_states", "(", "self", ")", ":", "header", "=", "BASE_HEADERS", ".", "copy", "(", ")", "header", "[", "'Cookie'", "]", "=", "self", ".", "__cookie", "request", "=", "requests", ".", "get", "(", "BASE_URL", "+", "\"refreshAllStates\"", ",...
Update all states.
[ "Update", "all", "states", "." ]
fc84f6ba3b673d0cd0e9e618777834a74a3c7b64
https://github.com/philklei/tahoma-api/blob/fc84f6ba3b673d0cd0e9e618777834a74a3c7b64/tahoma_api/tahoma_api.py#L626-L638
train
philklei/tahoma-api
tahoma_api/tahoma_api.py
Device.set_active_state
def set_active_state(self, name, value): """Set active state.""" if name not in self.__active_states.keys(): raise ValueError("Can not set unknown state '" + name + "'") if (isinstance(self.__active_states[name], int) and isinstance(value, str)): # we get...
python
def set_active_state(self, name, value): """Set active state.""" if name not in self.__active_states.keys(): raise ValueError("Can not set unknown state '" + name + "'") if (isinstance(self.__active_states[name], int) and isinstance(value, str)): # we get...
[ "def", "set_active_state", "(", "self", ",", "name", ",", "value", ")", ":", "if", "name", "not", "in", "self", ".", "__active_states", ".", "keys", "(", ")", ":", "raise", "ValueError", "(", "\"Can not set unknown state '\"", "+", "name", "+", "\"'\"", ")...
Set active state.
[ "Set", "active", "state", "." ]
fc84f6ba3b673d0cd0e9e618777834a74a3c7b64
https://github.com/philklei/tahoma-api/blob/fc84f6ba3b673d0cd0e9e618777834a74a3c7b64/tahoma_api/tahoma_api.py#L749-L765
train
philklei/tahoma-api
tahoma_api/tahoma_api.py
Action.add_command
def add_command(self, cmd_name, *args): """Add command to action.""" self.__commands.append(Command(cmd_name, args))
python
def add_command(self, cmd_name, *args): """Add command to action.""" self.__commands.append(Command(cmd_name, args))
[ "def", "add_command", "(", "self", ",", "cmd_name", ",", "*", "args", ")", ":", "self", ".", "__commands", ".", "append", "(", "Command", "(", "cmd_name", ",", "args", ")", ")" ]
Add command to action.
[ "Add", "command", "to", "action", "." ]
fc84f6ba3b673d0cd0e9e618777834a74a3c7b64
https://github.com/philklei/tahoma-api/blob/fc84f6ba3b673d0cd0e9e618777834a74a3c7b64/tahoma_api/tahoma_api.py#L818-L820
train